@drift-labs/sdk 2.93.0-beta.9 → 2.94.0-beta.0
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/idl/drift.json +1 -1
- package/package.json +1 -1
- package/src/idl/drift.json +1 -1
- package/tests/ci/idl.ts +53 -0
- package/tests/ci/verifyConstants.ts +1 -1
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.
|
|
1
|
+
2.94.0-beta.0
|
package/lib/idl/drift.json
CHANGED
package/package.json
CHANGED
package/src/idl/drift.json
CHANGED
package/tests/ci/idl.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DriftClient,
|
|
3
|
+
BulkAccountLoader,
|
|
4
|
+
} from '../../src';
|
|
5
|
+
import { Connection, Keypair } from '@solana/web3.js';
|
|
6
|
+
import { Wallet, Program } from '@coral-xyz/anchor';
|
|
7
|
+
import dotenv from 'dotenv';
|
|
8
|
+
import { assert } from 'chai';
|
|
9
|
+
import driftIDL from '../../src/idl/drift.json';
|
|
10
|
+
|
|
11
|
+
dotenv.config();
|
|
12
|
+
|
|
13
|
+
describe('Verify IDL', function () {
|
|
14
|
+
this.timeout(100_000);
|
|
15
|
+
const MAINNET_RPC_ENDPOINT = process.env.MAINNET_RPC_ENDPOINT;
|
|
16
|
+
|
|
17
|
+
// avoid breaking pre-commit
|
|
18
|
+
if (MAINNET_RPC_ENDPOINT === undefined) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const wallet = new Wallet(Keypair.generate());
|
|
23
|
+
|
|
24
|
+
const mainnetConnection = new Connection(MAINNET_RPC_ENDPOINT);
|
|
25
|
+
|
|
26
|
+
const mainnetBulkAccountLoader = new BulkAccountLoader(
|
|
27
|
+
mainnetConnection,
|
|
28
|
+
'processed',
|
|
29
|
+
1
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
const mainnetDriftClient = new DriftClient({
|
|
33
|
+
connection: mainnetConnection,
|
|
34
|
+
wallet,
|
|
35
|
+
env: 'mainnet-beta',
|
|
36
|
+
accountSubscription: {
|
|
37
|
+
type: 'polling',
|
|
38
|
+
accountLoader: mainnetBulkAccountLoader,
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
it('verify idl', async () => {
|
|
43
|
+
const idl = await Program.fetchIdl(mainnetDriftClient.program.programId, mainnetDriftClient.provider);
|
|
44
|
+
|
|
45
|
+
// anchor idl init seems to strip the metadata
|
|
46
|
+
idl["metadata"] = {"address":"dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH"};
|
|
47
|
+
const encodedMainnetIdl = JSON.stringify(idl);
|
|
48
|
+
|
|
49
|
+
const encodedSdkIdl = JSON.stringify(driftIDL);
|
|
50
|
+
|
|
51
|
+
assert(encodedSdkIdl === encodedMainnetIdl);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
@@ -20,7 +20,7 @@ describe('Verify Constants', function () {
|
|
|
20
20
|
const DEVNET_RPC_ENDPOINT = process.env.DEVNET_RPC_ENDPOINT;
|
|
21
21
|
|
|
22
22
|
// avoid breaking pre-commit
|
|
23
|
-
if (MAINNET_RPC_ENDPOINT === undefined
|
|
23
|
+
if (MAINNET_RPC_ENDPOINT === undefined || DEVNET_RPC_ENDPOINT === undefined) {
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
26
|
|