@drift-labs/sdk-browser 2.155.0-beta.2 → 2.155.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/VERSION +1 -1
- package/lib/browser/accounts/grpcAccountSubscriber.d.ts +0 -1
- package/lib/browser/accounts/grpcMultiAccountSubscriber.d.ts +0 -1
- package/lib/browser/accounts/grpcProgramAccountSubscriber.d.ts +0 -1
- package/lib/browser/accounts/laserProgramAccountSubscriber.d.ts +0 -1
- package/lib/browser/accounts/webSocketAccountSubscriber.d.ts +0 -1
- package/lib/browser/accounts/webSocketDriftClientAccountSubscriber.d.ts +0 -1
- package/lib/browser/accounts/webSocketProgramAccountSubscriber.d.ts +0 -1
- package/lib/browser/driftClient.d.ts +1 -2
- package/lib/browser/driftClient.js +5 -6
- package/lib/browser/oracles/pythPullClient.d.ts +2 -2
- package/lib/browser/oracles/pythPullClient.js +5 -2
- package/lib/browser/pyth/constants.d.ts +3 -0
- package/lib/browser/pyth/constants.js +6 -0
- package/lib/browser/pyth/index.d.ts +3 -0
- package/lib/browser/pyth/index.js +10 -0
- package/lib/browser/pyth/types.d.ts +2226 -0
- package/lib/browser/pyth/types.js +2224 -0
- package/lib/browser/pyth/utils.d.ts +2 -0
- package/lib/browser/pyth/utils.js +10 -0
- package/lib/node/accounts/grpcAccountSubscriber.d.ts +0 -1
- package/lib/node/accounts/grpcAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/grpcMultiAccountSubscriber.d.ts +0 -1
- package/lib/node/accounts/grpcMultiAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/grpcProgramAccountSubscriber.d.ts +0 -1
- package/lib/node/accounts/grpcProgramAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/laserProgramAccountSubscriber.d.ts +0 -1
- package/lib/node/accounts/laserProgramAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/webSocketAccountSubscriber.d.ts +0 -1
- package/lib/node/accounts/webSocketAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/webSocketDriftClientAccountSubscriber.d.ts +0 -1
- package/lib/node/accounts/webSocketDriftClientAccountSubscriber.d.ts.map +1 -1
- package/lib/node/accounts/webSocketProgramAccountSubscriber.d.ts +0 -1
- package/lib/node/accounts/webSocketProgramAccountSubscriber.d.ts.map +1 -1
- package/lib/node/driftClient.d.ts +1 -2
- package/lib/node/driftClient.d.ts.map +1 -1
- package/lib/node/driftClient.js +5 -6
- package/lib/node/oracles/pythPullClient.d.ts +2 -2
- package/lib/node/oracles/pythPullClient.d.ts.map +1 -1
- package/lib/node/oracles/pythPullClient.js +5 -2
- package/lib/node/pyth/constants.d.ts +4 -0
- package/lib/node/pyth/constants.d.ts.map +1 -0
- package/lib/node/pyth/constants.js +6 -0
- package/lib/node/pyth/index.d.ts +4 -0
- package/lib/node/pyth/index.d.ts.map +1 -0
- package/lib/node/pyth/index.js +10 -0
- package/lib/node/pyth/types.d.ts +2227 -0
- package/lib/node/pyth/types.d.ts.map +1 -0
- package/lib/node/pyth/types.js +2224 -0
- package/lib/node/pyth/utils.d.ts +3 -0
- package/lib/node/pyth/utils.d.ts.map +1 -0
- package/lib/node/pyth/utils.js +10 -0
- package/package.json +3 -4
- package/src/driftClient.ts +9 -11
- package/src/oracles/pythPullClient.ts +4 -5
- package/src/pyth/constants.ts +9 -0
- package/src/pyth/index.ts +11 -0
- package/src/pyth/types.ts +4453 -0
- package/src/pyth/utils.ts +13 -0
- package/tests/decode/test.ts +2 -1
- package/tests/dlob/helpers.ts +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/pyth/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,eAAO,MAAM,iBAAiB,qBACX,MAAM,qBACL,SAAS,cAQ5B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getGuardianSetPda = void 0;
|
|
4
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
5
|
+
const getGuardianSetPda = (guardianSetIndex, wormholeProgramId) => {
|
|
6
|
+
const guardianSetIndexBuf = Buffer.alloc(4);
|
|
7
|
+
guardianSetIndexBuf.writeUInt32BE(guardianSetIndex, 0);
|
|
8
|
+
return web3_js_1.PublicKey.findProgramAddressSync([Buffer.from('GuardianSet'), guardianSetIndexBuf], wormholeProgramId)[0];
|
|
9
|
+
};
|
|
10
|
+
exports.getGuardianSetPda = getGuardianSetPda;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drift-labs/sdk-browser",
|
|
3
|
-
"version": "2.155.0-beta.
|
|
3
|
+
"version": "2.155.0-beta.3",
|
|
4
4
|
"main": "lib/node/index.js",
|
|
5
5
|
"types": "lib/node/index.d.ts",
|
|
6
6
|
"module": "./lib/browser/index.js",
|
|
@@ -51,7 +51,6 @@
|
|
|
51
51
|
"@project-serum/serum": "0.13.65",
|
|
52
52
|
"@pythnetwork/client": "2.5.3",
|
|
53
53
|
"@pythnetwork/price-service-sdk": "1.7.1",
|
|
54
|
-
"@pythnetwork/pyth-solana-receiver": "0.7.0",
|
|
55
54
|
"@solana/spl-token": "0.4.13",
|
|
56
55
|
"@solana/web3.js": "1.98.0",
|
|
57
56
|
"@switchboard-xyz/common": "3.0.14",
|
|
@@ -150,9 +149,9 @@
|
|
|
150
149
|
"has-ansi": "<6.0.1"
|
|
151
150
|
},
|
|
152
151
|
"browser": {
|
|
153
|
-
"helius-laserstream": false,
|
|
154
|
-
"@triton-one/yellowstone-grpc": false,
|
|
155
152
|
"@grpc/grpc-js": false,
|
|
153
|
+
"@triton-one/yellowstone-grpc": false,
|
|
154
|
+
"helius-laserstream": false,
|
|
156
155
|
"zstddec": false
|
|
157
156
|
}
|
|
158
157
|
}
|
package/src/driftClient.ts
CHANGED
|
@@ -185,17 +185,7 @@ import {
|
|
|
185
185
|
trimVaaSignatures,
|
|
186
186
|
} from './math/oracles';
|
|
187
187
|
import { TxHandler } from './tx/txHandler';
|
|
188
|
-
import {
|
|
189
|
-
DEFAULT_RECEIVER_PROGRAM_ID,
|
|
190
|
-
wormholeCoreBridgeIdl,
|
|
191
|
-
} from '@pythnetwork/pyth-solana-receiver';
|
|
192
188
|
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';
|
|
199
189
|
import { getFeedIdUint8Array, trimFeedId } from './util/pythOracleUtils';
|
|
200
190
|
import { createMinimalEd25519VerifyIx } from './util/ed25519Utils';
|
|
201
191
|
import {
|
|
@@ -221,6 +211,14 @@ import {
|
|
|
221
211
|
} from './math/builder';
|
|
222
212
|
import { TitanClient, SwapMode as TitanSwapMode } from './titan/titanClient';
|
|
223
213
|
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';
|
|
224
222
|
|
|
225
223
|
/**
|
|
226
224
|
* Union type for swap clients (Titan and Jupiter) - Legacy type
|
|
@@ -11208,7 +11206,7 @@ export class DriftClient {
|
|
|
11208
11206
|
|
|
11209
11207
|
if (this.wormholeProgram === undefined) {
|
|
11210
11208
|
this.wormholeProgram = new Program(
|
|
11211
|
-
|
|
11209
|
+
WORMHOLE_CORE_BRIDGE_SOLANA_IDL,
|
|
11212
11210
|
DEFAULT_WORMHOLE_PROGRAM_ID,
|
|
11213
11211
|
this.provider
|
|
11214
11212
|
);
|
|
@@ -7,13 +7,12 @@ import {
|
|
|
7
7
|
QUOTE_PRECISION,
|
|
8
8
|
TEN,
|
|
9
9
|
} from '../constants/numericConstants';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
} from '@pythnetwork/pyth-solana-receiver';
|
|
14
|
-
import { PriceUpdateAccount } from '@pythnetwork/pyth-solana-receiver/lib/PythSolanaReceiver';
|
|
10
|
+
|
|
11
|
+
import pythSolanaReceiverIdl from '../idl/pyth_solana_receiver.json';
|
|
12
|
+
import { PythSolanaReceiver as PythSolanaReceiverProgram } from '../pyth';
|
|
15
13
|
import { DRIFT_ORACLE_RECEIVER_ID } from '../config';
|
|
16
14
|
import { Wallet } from '../wallet';
|
|
15
|
+
import { PriceUpdateAccount } from '../pyth';
|
|
17
16
|
|
|
18
17
|
export class PythPullClient implements OracleClient {
|
|
19
18
|
private connection: Connection;
|
|
@@ -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
|
+
);
|
|
@@ -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';
|