@drift-labs/sdk 2.104.0-beta.14 → 2.104.0-beta.15
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/driftClient.d.ts +2 -2
- package/lib/browser/driftClient.js +14 -10
- package/lib/browser/idl/drift.json +3 -12
- package/lib/node/driftClient.d.ts +2 -2
- package/lib/node/driftClient.js +14 -10
- package/lib/node/idl/drift.json +3 -12
- package/package.json +1 -1
- package/src/driftClient.ts +14 -14
- package/src/idl/drift.json +3 -12
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.104.0-beta.
|
|
1
|
+
2.104.0-beta.15
|
|
@@ -820,8 +820,8 @@ export declare class DriftClient {
|
|
|
820
820
|
proof: number[][];
|
|
821
821
|
};
|
|
822
822
|
}, feedId: string, encodedVaaAddress: PublicKey): Promise<TransactionInstruction>;
|
|
823
|
-
postPythLazerOracleUpdate(
|
|
824
|
-
getPostPythLazerOracleUpdateIxs(
|
|
823
|
+
postPythLazerOracleUpdate(feedIds: number[], pythMessageHex: string): Promise<string>;
|
|
824
|
+
getPostPythLazerOracleUpdateIxs(feedIds: number[], pythMessageHex: string, precedingIxs?: TransactionInstruction[], overrideIxCount?: number): TransactionInstruction[];
|
|
825
825
|
getPostSwitchboardOnDemandUpdateAtomicIx(feed: PublicKey, recentSlothash?: Slothash, numSignatures?: number): Promise<TransactionInstruction | undefined>;
|
|
826
826
|
postSwitchboardOnDemandUpdate(feed: PublicKey, recentSlothash?: Slothash, numSignatures?: number): Promise<TransactionSignature>;
|
|
827
827
|
private getBuildEncodedVaaIxs;
|
|
@@ -4523,26 +4523,30 @@ class DriftClient {
|
|
|
4523
4523
|
},
|
|
4524
4524
|
});
|
|
4525
4525
|
}
|
|
4526
|
-
async postPythLazerOracleUpdate(
|
|
4527
|
-
const postIxs = this.getPostPythLazerOracleUpdateIxs(
|
|
4526
|
+
async postPythLazerOracleUpdate(feedIds, pythMessageHex) {
|
|
4527
|
+
const postIxs = this.getPostPythLazerOracleUpdateIxs(feedIds, pythMessageHex, undefined, 2);
|
|
4528
4528
|
const tx = await this.buildTransaction(postIxs);
|
|
4529
4529
|
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
4530
4530
|
return txSig;
|
|
4531
4531
|
}
|
|
4532
|
-
getPostPythLazerOracleUpdateIxs(
|
|
4532
|
+
getPostPythLazerOracleUpdateIxs(feedIds, pythMessageHex, precedingIxs = [], overrideIxCount) {
|
|
4533
4533
|
const pythMessageBytes = Buffer.from(pythMessageHex, 'hex');
|
|
4534
|
-
const
|
|
4535
|
-
const
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4534
|
+
const updateData = new Uint8Array(pythMessageBytes);
|
|
4535
|
+
const verifyIx = (0, pythOracleUtils_1.createMinimalEd25519VerifyIx)(overrideIxCount || precedingIxs.length + 1, 0, updateData);
|
|
4536
|
+
const remainingAccountsMeta = feedIds.map((feedId) => {
|
|
4537
|
+
return {
|
|
4538
|
+
pubkey: (0, pda_1.getPythLazerOraclePublicKey)(this.program.programId, feedId),
|
|
4539
|
+
isSigner: false,
|
|
4540
|
+
isWritable: true,
|
|
4541
|
+
};
|
|
4542
|
+
});
|
|
4543
|
+
const ix = this.program.instruction.postPythLazerOracleUpdate(pythMessageBytes, {
|
|
4540
4544
|
accounts: {
|
|
4541
4545
|
keeper: this.wallet.publicKey,
|
|
4542
4546
|
pythLazerStorage: config_1.PYTH_LAZER_STORAGE_ACCOUNT_KEY,
|
|
4543
|
-
pythLazerOracle: (0, pda_1.getPythLazerOraclePublicKey)(this.program.programId, feedId),
|
|
4544
4547
|
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
4545
4548
|
},
|
|
4549
|
+
remainingAccounts: remainingAccountsMeta,
|
|
4546
4550
|
});
|
|
4547
4551
|
return [verifyIx, ix];
|
|
4548
4552
|
}
|
|
@@ -6503,25 +6503,16 @@
|
|
|
6503
6503
|
},
|
|
6504
6504
|
{
|
|
6505
6505
|
"name": "pythLazerStorage",
|
|
6506
|
-
"isMut":
|
|
6506
|
+
"isMut": false,
|
|
6507
6507
|
"isSigner": false
|
|
6508
6508
|
},
|
|
6509
6509
|
{
|
|
6510
6510
|
"name": "ixSysvar",
|
|
6511
6511
|
"isMut": false,
|
|
6512
6512
|
"isSigner": false
|
|
6513
|
-
},
|
|
6514
|
-
{
|
|
6515
|
-
"name": "pythLazerOracle",
|
|
6516
|
-
"isMut": true,
|
|
6517
|
-
"isSigner": false
|
|
6518
6513
|
}
|
|
6519
6514
|
],
|
|
6520
6515
|
"args": [
|
|
6521
|
-
{
|
|
6522
|
-
"name": "feedId",
|
|
6523
|
-
"type": "u32"
|
|
6524
|
-
},
|
|
6525
6516
|
{
|
|
6526
6517
|
"name": "pythMessage",
|
|
6527
6518
|
"type": "bytes"
|
|
@@ -14290,12 +14281,12 @@
|
|
|
14290
14281
|
{
|
|
14291
14282
|
"code": 6277,
|
|
14292
14283
|
"name": "OracleMismatchedVaaAndPriceUpdates",
|
|
14293
|
-
"msg": "Don't have the same remaining accounts number and
|
|
14284
|
+
"msg": "Don't have the same remaining accounts number and pyth updates left"
|
|
14294
14285
|
},
|
|
14295
14286
|
{
|
|
14296
14287
|
"code": 6278,
|
|
14297
14288
|
"name": "OracleBadRemainingAccountPublicKey",
|
|
14298
|
-
"msg": "Remaining account passed
|
|
14289
|
+
"msg": "Remaining account passed does not match oracle update derived pda"
|
|
14299
14290
|
},
|
|
14300
14291
|
{
|
|
14301
14292
|
"code": 6279,
|
|
@@ -820,8 +820,8 @@ export declare class DriftClient {
|
|
|
820
820
|
proof: number[][];
|
|
821
821
|
};
|
|
822
822
|
}, feedId: string, encodedVaaAddress: PublicKey): Promise<TransactionInstruction>;
|
|
823
|
-
postPythLazerOracleUpdate(
|
|
824
|
-
getPostPythLazerOracleUpdateIxs(
|
|
823
|
+
postPythLazerOracleUpdate(feedIds: number[], pythMessageHex: string): Promise<string>;
|
|
824
|
+
getPostPythLazerOracleUpdateIxs(feedIds: number[], pythMessageHex: string, precedingIxs?: TransactionInstruction[], overrideIxCount?: number): TransactionInstruction[];
|
|
825
825
|
getPostSwitchboardOnDemandUpdateAtomicIx(feed: PublicKey, recentSlothash?: Slothash, numSignatures?: number): Promise<TransactionInstruction | undefined>;
|
|
826
826
|
postSwitchboardOnDemandUpdate(feed: PublicKey, recentSlothash?: Slothash, numSignatures?: number): Promise<TransactionSignature>;
|
|
827
827
|
private getBuildEncodedVaaIxs;
|
package/lib/node/driftClient.js
CHANGED
|
@@ -4523,26 +4523,30 @@ class DriftClient {
|
|
|
4523
4523
|
},
|
|
4524
4524
|
});
|
|
4525
4525
|
}
|
|
4526
|
-
async postPythLazerOracleUpdate(
|
|
4527
|
-
const postIxs = this.getPostPythLazerOracleUpdateIxs(
|
|
4526
|
+
async postPythLazerOracleUpdate(feedIds, pythMessageHex) {
|
|
4527
|
+
const postIxs = this.getPostPythLazerOracleUpdateIxs(feedIds, pythMessageHex, undefined, 2);
|
|
4528
4528
|
const tx = await this.buildTransaction(postIxs);
|
|
4529
4529
|
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
4530
4530
|
return txSig;
|
|
4531
4531
|
}
|
|
4532
|
-
getPostPythLazerOracleUpdateIxs(
|
|
4532
|
+
getPostPythLazerOracleUpdateIxs(feedIds, pythMessageHex, precedingIxs = [], overrideIxCount) {
|
|
4533
4533
|
const pythMessageBytes = Buffer.from(pythMessageHex, 'hex');
|
|
4534
|
-
const
|
|
4535
|
-
const
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4534
|
+
const updateData = new Uint8Array(pythMessageBytes);
|
|
4535
|
+
const verifyIx = (0, pythOracleUtils_1.createMinimalEd25519VerifyIx)(overrideIxCount || precedingIxs.length + 1, 0, updateData);
|
|
4536
|
+
const remainingAccountsMeta = feedIds.map((feedId) => {
|
|
4537
|
+
return {
|
|
4538
|
+
pubkey: (0, pda_1.getPythLazerOraclePublicKey)(this.program.programId, feedId),
|
|
4539
|
+
isSigner: false,
|
|
4540
|
+
isWritable: true,
|
|
4541
|
+
};
|
|
4542
|
+
});
|
|
4543
|
+
const ix = this.program.instruction.postPythLazerOracleUpdate(pythMessageBytes, {
|
|
4540
4544
|
accounts: {
|
|
4541
4545
|
keeper: this.wallet.publicKey,
|
|
4542
4546
|
pythLazerStorage: config_1.PYTH_LAZER_STORAGE_ACCOUNT_KEY,
|
|
4543
|
-
pythLazerOracle: (0, pda_1.getPythLazerOraclePublicKey)(this.program.programId, feedId),
|
|
4544
4547
|
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
4545
4548
|
},
|
|
4549
|
+
remainingAccounts: remainingAccountsMeta,
|
|
4546
4550
|
});
|
|
4547
4551
|
return [verifyIx, ix];
|
|
4548
4552
|
}
|
package/lib/node/idl/drift.json
CHANGED
|
@@ -6503,25 +6503,16 @@
|
|
|
6503
6503
|
},
|
|
6504
6504
|
{
|
|
6505
6505
|
"name": "pythLazerStorage",
|
|
6506
|
-
"isMut":
|
|
6506
|
+
"isMut": false,
|
|
6507
6507
|
"isSigner": false
|
|
6508
6508
|
},
|
|
6509
6509
|
{
|
|
6510
6510
|
"name": "ixSysvar",
|
|
6511
6511
|
"isMut": false,
|
|
6512
6512
|
"isSigner": false
|
|
6513
|
-
},
|
|
6514
|
-
{
|
|
6515
|
-
"name": "pythLazerOracle",
|
|
6516
|
-
"isMut": true,
|
|
6517
|
-
"isSigner": false
|
|
6518
6513
|
}
|
|
6519
6514
|
],
|
|
6520
6515
|
"args": [
|
|
6521
|
-
{
|
|
6522
|
-
"name": "feedId",
|
|
6523
|
-
"type": "u32"
|
|
6524
|
-
},
|
|
6525
6516
|
{
|
|
6526
6517
|
"name": "pythMessage",
|
|
6527
6518
|
"type": "bytes"
|
|
@@ -14290,12 +14281,12 @@
|
|
|
14290
14281
|
{
|
|
14291
14282
|
"code": 6277,
|
|
14292
14283
|
"name": "OracleMismatchedVaaAndPriceUpdates",
|
|
14293
|
-
"msg": "Don't have the same remaining accounts number and
|
|
14284
|
+
"msg": "Don't have the same remaining accounts number and pyth updates left"
|
|
14294
14285
|
},
|
|
14295
14286
|
{
|
|
14296
14287
|
"code": 6278,
|
|
14297
14288
|
"name": "OracleBadRemainingAccountPublicKey",
|
|
14298
|
-
"msg": "Remaining account passed
|
|
14289
|
+
"msg": "Remaining account passed does not match oracle update derived pda"
|
|
14299
14290
|
},
|
|
14300
14291
|
{
|
|
14301
14292
|
"code": 6279,
|
package/package.json
CHANGED
package/src/driftClient.ts
CHANGED
|
@@ -8606,11 +8606,11 @@ export class DriftClient {
|
|
|
8606
8606
|
}
|
|
8607
8607
|
|
|
8608
8608
|
public async postPythLazerOracleUpdate(
|
|
8609
|
-
|
|
8609
|
+
feedIds: number[],
|
|
8610
8610
|
pythMessageHex: string
|
|
8611
8611
|
): Promise<string> {
|
|
8612
8612
|
const postIxs = this.getPostPythLazerOracleUpdateIxs(
|
|
8613
|
-
|
|
8613
|
+
feedIds,
|
|
8614
8614
|
pythMessageHex,
|
|
8615
8615
|
undefined,
|
|
8616
8616
|
2
|
|
@@ -8621,37 +8621,37 @@ export class DriftClient {
|
|
|
8621
8621
|
}
|
|
8622
8622
|
|
|
8623
8623
|
public getPostPythLazerOracleUpdateIxs(
|
|
8624
|
-
|
|
8624
|
+
feedIds: number[],
|
|
8625
8625
|
pythMessageHex: string,
|
|
8626
8626
|
precedingIxs: TransactionInstruction[] = [],
|
|
8627
8627
|
overrideIxCount?: number
|
|
8628
8628
|
): TransactionInstruction[] {
|
|
8629
8629
|
const pythMessageBytes = Buffer.from(pythMessageHex, 'hex');
|
|
8630
|
-
const
|
|
8631
|
-
|
|
8632
|
-
const updateData = new Uint8Array(1 + pythMessageBytes.length);
|
|
8633
|
-
updateData[0] = feedId;
|
|
8634
|
-
updateData.set(pythMessageBytes, 1);
|
|
8630
|
+
const updateData = new Uint8Array(pythMessageBytes);
|
|
8635
8631
|
|
|
8636
8632
|
const verifyIx = createMinimalEd25519VerifyIx(
|
|
8637
8633
|
overrideIxCount || precedingIxs.length + 1,
|
|
8638
|
-
|
|
8634
|
+
0,
|
|
8639
8635
|
updateData
|
|
8640
8636
|
);
|
|
8641
8637
|
|
|
8638
|
+
const remainingAccountsMeta = feedIds.map((feedId) => {
|
|
8639
|
+
return {
|
|
8640
|
+
pubkey: getPythLazerOraclePublicKey(this.program.programId, feedId),
|
|
8641
|
+
isSigner: false,
|
|
8642
|
+
isWritable: true,
|
|
8643
|
+
};
|
|
8644
|
+
});
|
|
8645
|
+
|
|
8642
8646
|
const ix = this.program.instruction.postPythLazerOracleUpdate(
|
|
8643
|
-
feedId,
|
|
8644
8647
|
pythMessageBytes,
|
|
8645
8648
|
{
|
|
8646
8649
|
accounts: {
|
|
8647
8650
|
keeper: this.wallet.publicKey,
|
|
8648
8651
|
pythLazerStorage: PYTH_LAZER_STORAGE_ACCOUNT_KEY,
|
|
8649
|
-
pythLazerOracle: getPythLazerOraclePublicKey(
|
|
8650
|
-
this.program.programId,
|
|
8651
|
-
feedId
|
|
8652
|
-
),
|
|
8653
8652
|
ixSysvar: SYSVAR_INSTRUCTIONS_PUBKEY,
|
|
8654
8653
|
},
|
|
8654
|
+
remainingAccounts: remainingAccountsMeta,
|
|
8655
8655
|
}
|
|
8656
8656
|
);
|
|
8657
8657
|
return [verifyIx, ix];
|
package/src/idl/drift.json
CHANGED
|
@@ -6503,25 +6503,16 @@
|
|
|
6503
6503
|
},
|
|
6504
6504
|
{
|
|
6505
6505
|
"name": "pythLazerStorage",
|
|
6506
|
-
"isMut":
|
|
6506
|
+
"isMut": false,
|
|
6507
6507
|
"isSigner": false
|
|
6508
6508
|
},
|
|
6509
6509
|
{
|
|
6510
6510
|
"name": "ixSysvar",
|
|
6511
6511
|
"isMut": false,
|
|
6512
6512
|
"isSigner": false
|
|
6513
|
-
},
|
|
6514
|
-
{
|
|
6515
|
-
"name": "pythLazerOracle",
|
|
6516
|
-
"isMut": true,
|
|
6517
|
-
"isSigner": false
|
|
6518
6513
|
}
|
|
6519
6514
|
],
|
|
6520
6515
|
"args": [
|
|
6521
|
-
{
|
|
6522
|
-
"name": "feedId",
|
|
6523
|
-
"type": "u32"
|
|
6524
|
-
},
|
|
6525
6516
|
{
|
|
6526
6517
|
"name": "pythMessage",
|
|
6527
6518
|
"type": "bytes"
|
|
@@ -14290,12 +14281,12 @@
|
|
|
14290
14281
|
{
|
|
14291
14282
|
"code": 6277,
|
|
14292
14283
|
"name": "OracleMismatchedVaaAndPriceUpdates",
|
|
14293
|
-
"msg": "Don't have the same remaining accounts number and
|
|
14284
|
+
"msg": "Don't have the same remaining accounts number and pyth updates left"
|
|
14294
14285
|
},
|
|
14295
14286
|
{
|
|
14296
14287
|
"code": 6278,
|
|
14297
14288
|
"name": "OracleBadRemainingAccountPublicKey",
|
|
14298
|
-
"msg": "Remaining account passed
|
|
14289
|
+
"msg": "Remaining account passed does not match oracle update derived pda"
|
|
14299
14290
|
},
|
|
14300
14291
|
{
|
|
14301
14292
|
"code": 6279,
|