First commit
Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
commit
a570ae197c
|
@ -0,0 +1,39 @@
|
|||
{
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"plugins": ["@typescript-eslint"],
|
||||
"extends": [
|
||||
"eslint:recommended",
|
||||
"plugin:@typescript-eslint/recommended",
|
||||
"prettier"
|
||||
],
|
||||
"env": {
|
||||
"es6": true,
|
||||
"browser": true,
|
||||
"jest": true,
|
||||
"node": true
|
||||
},
|
||||
"rules": {
|
||||
"@typescript-eslint/explicit-module-boundary-types": 0,
|
||||
"@typescript-eslint/ban-ts-comment": 0,
|
||||
"@typescript-eslint/explicit-function-return-type": 0,
|
||||
"@typescript-eslint/explicit-member-accessibility": 0,
|
||||
"@typescript-eslint/indent": 0,
|
||||
"@typescript-eslint/member-delimiter-style": 0,
|
||||
"@typescript-eslint/no-empty-function": 0,
|
||||
"@typescript-eslint/no-explicit-any": 0,
|
||||
"@typescript-eslint/no-var-requires": 0,
|
||||
"@typescript-eslint/no-use-before-define": 0,
|
||||
"@typescript-eslint/no-unused-vars": [
|
||||
2,
|
||||
{
|
||||
"argsIgnorePattern": "^_"
|
||||
}
|
||||
]
|
||||
// "no-console": [
|
||||
// 0,
|
||||
// {
|
||||
// "allow": ["warn", "error"]
|
||||
// }
|
||||
// ]
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
lib
|
||||
node_modules
|
||||
|
||||
.idea
|
|
@ -0,0 +1,13 @@
|
|||
import { Provider, Wallet } from '@project-serum/anchor';
|
||||
import { Connection, Keypair } from '@solana/web3.js';
|
||||
import { VsrClient } from '../src';
|
||||
|
||||
async function main() {
|
||||
const options = Provider.defaultOptions();
|
||||
const connection = new Connection('https://api.devnet.solana.com', options);
|
||||
const wallet = new Wallet(Keypair.generate());
|
||||
const provider = new Provider(connection, wallet, options);
|
||||
const client = await VsrClient.connect(provider, true);
|
||||
}
|
||||
|
||||
main();
|
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"name": "@blockworks-foundation/voter-stake-registry-client",
|
||||
"version": "0.1.0",
|
||||
"description": "Client for Voter-stake-registry which is a voter weight addin for Solana's spl-governance program.",
|
||||
"main": "lib/src/index.js",
|
||||
"types": "lib/src/index.d.ts",
|
||||
"repository": "https://github.com/blockworks-foundation/voter-stake-registry-client",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"clean": "rm -rf lib",
|
||||
"prepare": "yarn clean && yarn build",
|
||||
"type-check": "tsc --pretty --noEmit",
|
||||
"format": "prettier --check .",
|
||||
"lint": "eslint . --ext ts --ext tsx --ext js --quiet"
|
||||
},
|
||||
"author": {
|
||||
"name": "Blockworks Foundation",
|
||||
"email": "hello@blockworks.foundation",
|
||||
"url": "https://blockworks.foundation"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tsconfig/recommended": "^1.0.1",
|
||||
"@typescript-eslint/eslint-plugin": "^4.14.2",
|
||||
"@typescript-eslint/parser": "^4.14.2",
|
||||
"eslint": "^7.28.0",
|
||||
"eslint-config-prettier": "^7.2.0",
|
||||
"prettier": "^2.0.5",
|
||||
"ts-node": "^9.1.1",
|
||||
"typedoc": "^0.22.5",
|
||||
"typescript": "^4.1.3"
|
||||
},
|
||||
"prettier": {
|
||||
"singleQuote": true,
|
||||
"trailingComma": "all"
|
||||
},
|
||||
"dependencies": {
|
||||
"@project-serum/anchor": "^0.18.0",
|
||||
"@project-serum/serum": "^0.13.61"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
import { Program, Provider } from '@project-serum/anchor';
|
||||
import { PublicKey } from '@solana/web3.js';
|
||||
import { VoterStakeRegistry } from './idl';
|
||||
export const VSR_ID = new PublicKey('TODO');
|
||||
|
||||
export class VsrClient {
|
||||
constructor(
|
||||
public program: Program<VoterStakeRegistry>,
|
||||
public devnet?: boolean,
|
||||
) {}
|
||||
|
||||
static async connect(
|
||||
provider: Provider,
|
||||
devnet?: boolean,
|
||||
): Promise<VsrClient> {
|
||||
const idl = await Program.fetchIdl(VSR_ID, provider);
|
||||
return new VsrClient(
|
||||
new Program<VoterStakeRegistry>(
|
||||
idl as VoterStakeRegistry,
|
||||
VSR_ID,
|
||||
provider,
|
||||
),
|
||||
devnet,
|
||||
);
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1 @@
|
|||
export * from './client';
|
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"extends": "@tsconfig/recommended/tsconfig.json",
|
||||
|
||||
"compilerOptions": {
|
||||
"outDir": "./lib",
|
||||
"target": "es6",
|
||||
"lib": ["es2019"],
|
||||
"allowJs": true,
|
||||
"checkJs": true,
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
"noImplicitAny": false,
|
||||
"resolveJsonModule": true,
|
||||
"sourceMap": true,
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"include": ["./src/**/*"],
|
||||
"exclude": ["./src/**/*.test.js", "node_modules", "**/node_modules"]
|
||||
}
|
Loading…
Reference in New Issue