Skip to content

Commit 7a9a80f

Browse files
committed
refactor: replace pyth-solana-receiver with copied over code
1 parent fde9d60 commit 7a9a80f

File tree

7 files changed

+12283
-5130
lines changed

7 files changed

+12283
-5130
lines changed

sdk/package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
"@project-serum/serum": "0.13.65",
5252
"@pythnetwork/client": "2.5.3",
5353
"@pythnetwork/price-service-sdk": "1.7.1",
54-
"@pythnetwork/pyth-solana-receiver": "0.7.0",
5554
"@solana/spl-token": "0.4.13",
5655
"@solana/web3.js": "1.98.0",
5756
"@switchboard-xyz/common": "3.0.14",
@@ -150,9 +149,9 @@
150149
"has-ansi": "<6.0.1"
151150
},
152151
"browser": {
153-
"helius-laserstream": false,
154-
"@triton-one/yellowstone-grpc": false,
155152
"@grpc/grpc-js": false,
153+
"@triton-one/yellowstone-grpc": false,
154+
"helius-laserstream": false,
156155
"zstddec": false
157156
}
158157
}

sdk/src/driftClient.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -185,17 +185,7 @@ import {
185185
trimVaaSignatures,
186186
} from './math/oracles';
187187
import { TxHandler } from './tx/txHandler';
188-
import {
189-
DEFAULT_RECEIVER_PROGRAM_ID,
190-
wormholeCoreBridgeIdl,
191-
} from '@pythnetwork/pyth-solana-receiver';
192188
import { parseAccumulatorUpdateData } from '@pythnetwork/price-service-sdk';
193-
import {
194-
DEFAULT_WORMHOLE_PROGRAM_ID,
195-
getGuardianSetPda,
196-
} from '@pythnetwork/pyth-solana-receiver/lib/address';
197-
import { WormholeCoreBridgeSolana } from '@pythnetwork/pyth-solana-receiver/lib/idl/wormhole_core_bridge_solana';
198-
import { PythSolanaReceiver } from '@pythnetwork/pyth-solana-receiver/lib/idl/pyth_solana_receiver';
199189
import { getFeedIdUint8Array, trimFeedId } from './util/pythOracleUtils';
200190
import { createMinimalEd25519VerifyIx } from './util/ed25519Utils';
201191
import {
@@ -221,6 +211,14 @@ import {
221211
} from './math/builder';
222212
import { TitanClient, SwapMode as TitanSwapMode } from './titan/titanClient';
223213
import { UnifiedSwapClient } from './swap/UnifiedSwapClient';
214+
import {
215+
DEFAULT_RECEIVER_PROGRAM_ID,
216+
WORMHOLE_CORE_BRIDGE_SOLANA_IDL,
217+
DEFAULT_WORMHOLE_PROGRAM_ID,
218+
getGuardianSetPda,
219+
WormholeCoreBridgeSolana,
220+
PythSolanaReceiver,
221+
} from './pyth';
224222

225223
/**
226224
* Union type for swap clients (Titan and Jupiter) - Legacy type
@@ -11208,7 +11206,7 @@ export class DriftClient {
1120811206

1120911207
if (this.wormholeProgram === undefined) {
1121011208
this.wormholeProgram = new Program(
11211-
wormholeCoreBridgeIdl,
11209+
WORMHOLE_CORE_BRIDGE_SOLANA_IDL,
1121211210
DEFAULT_WORMHOLE_PROGRAM_ID,
1121311211
this.provider
1121411212
);

sdk/src/pyth/constants.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { PublicKey } from "@solana/web3.js";
2+
3+
export const DEFAULT_WORMHOLE_PROGRAM_ID = new PublicKey(
4+
"HDwcJBJXjL9FpJ7UBsYBtaDjsBUhuLCUYoz3zr8SWWaQ",
5+
);
6+
7+
export const DEFAULT_RECEIVER_PROGRAM_ID = new PublicKey(
8+
"rec5EKMGg6MxZYaMdyBfgwp4d5rB9T1VQH5pJv5LtFJ",
9+
);

sdk/src/pyth/index.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export {
2+
WormholeCoreBridgeSolana,
3+
WORMHOLE_CORE_BRIDGE_SOLANA_IDL,
4+
PythSolanaReceiver,
5+
PriceUpdateAccount,
6+
} from './types';
7+
export {
8+
DEFAULT_WORMHOLE_PROGRAM_ID,
9+
DEFAULT_RECEIVER_PROGRAM_ID,
10+
} from './constants';
11+
export { getGuardianSetPda } from './utils';

0 commit comments

Comments
 (0)