@drift-labs/sdk 2.107.0-beta.13 → 2.107.0-beta.14

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 CHANGED
@@ -1 +1 @@
1
- 2.107.0-beta.13
1
+ 2.107.0-beta.14
@@ -70,6 +70,7 @@ const on_demand_1 = require("@switchboard-xyz/on-demand");
70
70
  const grpcDriftClientAccountSubscriber_1 = require("./accounts/grpcDriftClientAccountSubscriber");
71
71
  const tweetnacl_1 = __importDefault(require("tweetnacl"));
72
72
  const oracleId_1 = require("./oracles/oracleId");
73
+ const sha256_1 = require("@coral-xyz/anchor/dist/cjs/utils/sha256");
73
74
  /**
74
75
  * # DriftClient
75
76
  * This class is the main way to interact with Drift Protocol. It allows you to subscribe to the various accounts where the Market's state is stored, as well as: opening positions, liquidating, settling funding, depositing & withdrawing, and more.
@@ -3185,7 +3186,12 @@ class DriftClient {
3185
3186
  * Borsh encode swift taker order params
3186
3187
  */
3187
3188
  encodeSwiftOrderParamsMessage(orderParamsMessage) {
3188
- return this.program.coder.types.encode('SwiftOrderParamsMessage', orderParamsMessage);
3189
+ const anchorIxName = 'global' + ':' + 'swiftOrderMessageParams';
3190
+ const prefix = Buffer.from((0, sha256_1.hash)(anchorIxName).slice(0, 8));
3191
+ return Buffer.concat([
3192
+ prefix,
3193
+ this.program.coder.types.encode('SwiftOrderParamsMessage', orderParamsMessage),
3194
+ ]);
3189
3195
  }
3190
3196
  /*
3191
3197
  * Decode swift taker order params from borsh buffer
@@ -70,6 +70,7 @@ const on_demand_1 = require("@switchboard-xyz/on-demand");
70
70
  const grpcDriftClientAccountSubscriber_1 = require("./accounts/grpcDriftClientAccountSubscriber");
71
71
  const tweetnacl_1 = __importDefault(require("tweetnacl"));
72
72
  const oracleId_1 = require("./oracles/oracleId");
73
+ const sha256_1 = require("@coral-xyz/anchor/dist/cjs/utils/sha256");
73
74
  /**
74
75
  * # DriftClient
75
76
  * This class is the main way to interact with Drift Protocol. It allows you to subscribe to the various accounts where the Market's state is stored, as well as: opening positions, liquidating, settling funding, depositing & withdrawing, and more.
@@ -3185,7 +3186,12 @@ class DriftClient {
3185
3186
  * Borsh encode swift taker order params
3186
3187
  */
3187
3188
  encodeSwiftOrderParamsMessage(orderParamsMessage) {
3188
- return this.program.coder.types.encode('SwiftOrderParamsMessage', orderParamsMessage);
3189
+ const anchorIxName = 'global' + ':' + 'swiftOrderMessageParams';
3190
+ const prefix = Buffer.from((0, sha256_1.hash)(anchorIxName).slice(0, 8));
3191
+ return Buffer.concat([
3192
+ prefix,
3193
+ this.program.coder.types.encode('SwiftOrderParamsMessage', orderParamsMessage),
3194
+ ]);
3189
3195
  }
3190
3196
  /*
3191
3197
  * Decode swift taker order params from borsh buffer
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.107.0-beta.13",
3
+ "version": "2.107.0-beta.14",
4
4
  "main": "lib/node/index.js",
5
5
  "types": "lib/node/index.d.ts",
6
6
  "browser": "./lib/browser/index.js",
@@ -182,6 +182,7 @@ import nacl from 'tweetnacl';
182
182
  import { Slothash } from './slot/SlothashSubscriber';
183
183
  import { getOracleId } from './oracles/oracleId';
184
184
  import { SignedSwiftOrderParams } from './swift/types';
185
+ import { hash } from '@coral-xyz/anchor/dist/cjs/utils/sha256';
185
186
 
186
187
  type RemainingAccountParams = {
187
188
  userAccounts: UserAccount[];
@@ -5882,10 +5883,15 @@ export class DriftClient {
5882
5883
  public encodeSwiftOrderParamsMessage(
5883
5884
  orderParamsMessage: SwiftOrderParamsMessage
5884
5885
  ): Buffer {
5885
- return this.program.coder.types.encode(
5886
- 'SwiftOrderParamsMessage',
5887
- orderParamsMessage
5888
- );
5886
+ const anchorIxName = 'global' + ':' + 'swiftOrderMessageParams';
5887
+ const prefix = Buffer.from(hash(anchorIxName).slice(0, 8));
5888
+ return Buffer.concat([
5889
+ prefix,
5890
+ this.program.coder.types.encode(
5891
+ 'SwiftOrderParamsMessage',
5892
+ orderParamsMessage
5893
+ ),
5894
+ ]);
5889
5895
  }
5890
5896
 
5891
5897
  /*