Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use local idl #254

Merged
merged 1 commit into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions staking/app/StakeConnection.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {
Provider,
Program,
Wallet,
utils,
Expand Down Expand Up @@ -27,6 +26,7 @@ import {
import BN from "bn.js";
import * as idljs from "@project-serum/anchor/dist/cjs/coder/borsh/idl";
import { Staking } from "../target/types/staking";
import IDL from "../target/idl/staking.json";
import { batchInstructions } from "./transaction";
import { PythBalance } from "./pythBalance";
import {
Expand All @@ -36,7 +36,7 @@ import {
} from "@solana/spl-governance";
import { GOVERNANCE_ADDRESS } from "./constants";
import assert from "assert";
import { PositionAccountJs, Position } from "./PositionAccountJs";
import { PositionAccountJs } from "./PositionAccountJs";
let wasm = wasm2;
export { wasm };

Expand Down Expand Up @@ -83,9 +83,8 @@ export class StakeConnection {
stakingProgramAddress: PublicKey
): Promise<StakeConnection> {
const provider = new AnchorProvider(connection, wallet, {});
const idl = (await Program.fetchIdl(stakingProgramAddress, provider))!;
const program = new Program(
idl,
IDL as Idl,
stakingProgramAddress,
provider
) as unknown as Program<Staking>;
Expand Down
8 changes: 5 additions & 3 deletions staking/app/deploy/4_transfer_authorities_to_multisig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ import {
} from "./mainnet_beta";

import { GOVERNANCE_ADDRESS, REALM_ID, STAKING_ADDRESS } from "../constants";
import { AnchorProvider, Program, Wallet } from "@project-serum/anchor";
import { AnchorProvider, Idl, Program, Wallet } from "@project-serum/anchor";
import IDL from "../../target/idl/staking.json";

// Actual transaction hash :
// mainnet-beta : 3FDjeBC946SZ6ZgSiDiNzFHKS5hs9bAXYrJKGZrGw1tuVcwi4BxXB1qvqsVmvtcnG5mzYvLM4hmPLjUTiCiY6Tfe
// devnet : 54WrJp6FDXvJCVzaGojUtWz4brm8wJHx3ZTYCpSTF2EwmeswySYsQY335XhJ1A7KL2N4mhYW7NtAGJpMA2fM9M6W
Expand All @@ -24,8 +26,8 @@ async function main() {
new Wallet(AUTHORITY_KEYPAIR),
{}
);
const idl = (await Program.fetchIdl(STAKING_ADDRESS, provider))!;
const program = new Program(idl, STAKING_ADDRESS, provider);

const program = new Program(IDL as Idl, STAKING_ADDRESS, provider);

const tx = new Transaction();
withSetRealmAuthority(
Expand Down
3 changes: 2 additions & 1 deletion staking/tsconfig.api.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"esModuleInterop": true,
"skipLibCheck": true,
"outDir": "lib",
"declaration": true
"declaration": true,
"resolveJsonModule": true
},
"include": ["./app/*.ts"],
"exclude": ["./tests", "./docker", "./migrations"]
Expand Down
3 changes: 2 additions & 1 deletion staking/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"module": "commonjs",
"target": "es6",
"esModuleInterop": true,
"skipLibCheck": true
"skipLibCheck": true,
"resolveJsonModule": true
},
"include": ["./app/*.ts", "./tests"],
"exclude": ["./docker", "./migrations"]
Expand Down