use idl from anchor build

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
microwavedcola1 2022-01-10 10:57:35 +01:00
parent 679f6492d4
commit 25f4e45726
4 changed files with 1094 additions and 4 deletions

View File

@ -2,6 +2,7 @@
set -e -o pipefail
anchor build
cp ./target/types/voter_stake_registry.ts src/types.ts
yarn clean && yarn build && cp package.json ./dist/ && yarn publish dist
cp ./target/idl/voter_stake_registry.json src/voter_stake_registry.json
cp ./target/types/voter_stake_registry.ts src/voter_stake_registry.ts
#yarn clean && yarn build && cp package.json ./dist/ && yarn publish dist

View File

@ -1,6 +1,7 @@
import { Program, Provider } from '@project-serum/anchor';
import { PublicKey } from '@solana/web3.js';
import { VoterStakeRegistry } from './types';
import { VoterStakeRegistry } from './voter_stake_registry';
import IDL from './voter_stake_registry.json';
export const VSR_ID = new PublicKey(
'4Q6WW2ouZ6V3iaNm56MTd5n2tnTm4C5fiH8miFHnAFHo',
@ -16,7 +17,10 @@ export class VsrClient {
provider: Provider,
devnet?: boolean,
): Promise<VsrClient> {
const idl = await Program.fetchIdl(VSR_ID, provider);
// fixme: when we push idl to mainnet we could use this
// const idl = await Program.fetchIdl(VSR_ID, provider);
const idl = IDL;
return new VsrClient(
new Program<VoterStakeRegistry>(
idl as VoterStakeRegistry,

File diff suppressed because it is too large Load Diff