Skip to content

Commit

Permalink
resolve anchor30 vs anchor29 issues
Browse files Browse the repository at this point in the history
  • Loading branch information
NourAlharithi committed Jul 23, 2024
1 parent 498f8b9 commit 9f4eb1d
Show file tree
Hide file tree
Showing 6 changed files with 3,031 additions and 2,171 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"license": "ISC",
"devDependencies": {
"@coral-xyz/anchor": "0.29.0",
"@coral-xyz/anchor-30": "npm:@coral-xyz/[email protected]",
"@project-serum/common": "0.0.1-beta.3",
"@project-serum/serum": "^0.13.38",
"@pythnetwork/client": "^2.5.1",
Expand Down
1 change: 1 addition & 0 deletions sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
},
"dependencies": {
"@coral-xyz/anchor": "0.28.0",
"@coral-xyz/anchor-30": "npm:@coral-xyz/[email protected]",
"@ellipsis-labs/phoenix-sdk": "^1.4.2",
"@project-serum/serum": "^0.13.38",
"@pythnetwork/client": "2.5.3",
Expand Down
16 changes: 6 additions & 10 deletions sdk/src/driftClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
Program,
ProgramAccount,
} from '@coral-xyz/anchor';
import { Idl as Idl30, Program as Program30 } from '@coral-xyz/anchor-30';
import bs58 from 'bs58';
import {
ASSOCIATED_TOKEN_PROGRAM_ID,
Expand Down Expand Up @@ -147,8 +148,8 @@ import { PythSolanaReceiver } from '@pythnetwork/pyth-solana-receiver/lib/idl/py
import { getFeedIdUint8Array, trimFeedId } from './util/pythPullOracleUtils';
import { isVersionedTransaction } from './tx/utils';
import pythSolanaReceiverIdl from './idl/pyth_solana_receiver.json';
import switchboardOnDemandIdl from './idl/switchboard_on_demand.json';
import { PullFeed, SB_ON_DEMAND_PID } from '@switchboard-xyz/on-demand';
import { PullFeed } from '@switchboard-xyz/on-demand';
import switchboardOnDemandIdl from './idl/switchboard_on_demand_30.json';

type RemainingAccountParams = {
userAccounts: UserAccount[];
Expand Down Expand Up @@ -200,7 +201,7 @@ export class DriftClient {

receiverProgram?: Program<PythSolanaReceiver>;
wormholeProgram?: Program<WormholeCoreBridgeSolana>;
sbOnDemandProgram?: Program<Idl>;
sbOnDemandProgram?: Program30<Idl30>;
sbProgramFeedConfigs?: Map<string, any>;

public get isSubscribed() {
Expand Down Expand Up @@ -7055,13 +7056,9 @@ export class DriftClient {
return this.receiverProgram;
}

public getSwitchboardOnDemandProgram(): Program<Idl> {
public getSwitchboardOnDemandProgram(): Program30<Idl30> {
if (this.sbOnDemandProgram === undefined) {
this.sbOnDemandProgram = new Program(
switchboardOnDemandIdl as Idl,
SB_ON_DEMAND_PID,
this.provider
);
this.sbOnDemandProgram = new Program30(switchboardOnDemandIdl as Idl30);
}
return this.sbOnDemandProgram;
}
Expand Down Expand Up @@ -7284,7 +7281,6 @@ export class DriftClient {
numSignatures = 3
): Promise<TransactionInstruction | undefined> {
const program = this.getSwitchboardOnDemandProgram();
// @ts-ignore
const feedAccount = new PullFeed(program, feed);
if (!this.sbProgramFeedConfigs) {
this.sbProgramFeedConfigs = new Map();
Expand Down
Loading

0 comments on commit 9f4eb1d

Please sign in to comment.