@drift-labs/sdk 2.107.0-beta.0 → 2.107.0-beta.2

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.0
1
+ 2.107.0-beta.2
@@ -1004,6 +1004,17 @@ exports.MainnetPerpMarkets = [
1004
1004
  oracleSource: __1.OracleSource.PYTH_PULL,
1005
1005
  pythFeedId: '0xbed3097008b9b5e3c93bec20be79cb43986b85a996475589351a21e67bae9b61',
1006
1006
  },
1007
+ {
1008
+ fullName: 'AI16Z',
1009
+ category: ['AI'],
1010
+ symbol: 'AI16Z-PERP',
1011
+ baseAssetSymbol: 'AI16Z',
1012
+ marketIndex: 63,
1013
+ oracle: new web3_js_1.PublicKey('3gdGkrmBdYR7B1MRRdRVysqhZCvYvLGHonr9b7o9WVki'),
1014
+ launchTs: 1736384970000,
1015
+ oracleSource: __1.OracleSource.PYTH_PULL,
1016
+ pythFeedId: '0x2551eca7784671173def2c41e6f3e51e11cd87494863f1d208fdd8c64a1f85ae',
1017
+ },
1007
1018
  ];
1008
1019
  exports.PerpMarkets = {
1009
1020
  devnet: exports.DevnetPerpMarkets,
@@ -513,6 +513,18 @@ exports.MainnetSpotMarkets = [
513
513
  pythFeedId: '0xeaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a',
514
514
  launchTs: 1735255852000,
515
515
  },
516
+ {
517
+ symbol: 'AI16Z',
518
+ marketIndex: 35,
519
+ poolId: 0,
520
+ oracle: new web3_js_1.PublicKey('3gdGkrmBdYR7B1MRRdRVysqhZCvYvLGHonr9b7o9WVki'),
521
+ oracleSource: __1.OracleSource.PYTH_PULL,
522
+ mint: new web3_js_1.PublicKey('HeLp6NuQkmYB4pYWo2zYs22mESHXPQYzXbB8n4V98jwC'),
523
+ precision: new __1.BN(10).pow(numericConstants_1.NINE),
524
+ precisionExp: numericConstants_1.NINE,
525
+ pythFeedId: '0x2551eca7784671173def2c41e6f3e51e11cd87494863f1d208fdd8c64a1f85ae',
526
+ launchTs: 1736384970000,
527
+ },
516
528
  ];
517
529
  exports.SpotMarkets = {
518
530
  devnet: exports.DevnetSpotMarkets,
@@ -24,6 +24,7 @@ import { TxHandler } from './tx/txHandler';
24
24
  import { WormholeCoreBridgeSolana } from '@pythnetwork/pyth-solana-receiver/lib/idl/wormhole_core_bridge_solana';
25
25
  import { PythSolanaReceiver } from '@pythnetwork/pyth-solana-receiver/lib/idl/pyth_solana_receiver';
26
26
  import { Slothash } from './slot/SlothashSubscriber';
27
+ import { SignedSwiftOrderParams } from './swift/types';
27
28
  type RemainingAccountParams = {
28
29
  userAccounts: UserAccount[];
29
30
  writablePerpMarketIndexes?: number[];
@@ -532,26 +533,26 @@ export declare class DriftClient {
532
533
  getPlaceAndTakePerpOrderIx(orderParams: OptionalOrderParams, makerInfo?: MakerInfo | MakerInfo[], referrerInfo?: ReferrerInfo, successCondition?: PlaceAndTakeOrderSuccessCondition, auctionDurationPercentage?: number, subAccountId?: number): Promise<TransactionInstruction>;
533
534
  placeAndMakePerpOrder(orderParams: OptionalOrderParams, takerInfo: TakerInfo, referrerInfo?: ReferrerInfo, txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
534
535
  getPlaceAndMakePerpOrderIx(orderParams: OptionalOrderParams, takerInfo: TakerInfo, referrerInfo?: ReferrerInfo, subAccountId?: number): Promise<TransactionInstruction>;
535
- signSwiftOrderParamsMessage(orderParamsMessage: SwiftOrderParamsMessage): Buffer;
536
+ signSwiftOrderParamsMessage(orderParamsMessage: SwiftOrderParamsMessage): SignedSwiftOrderParams;
536
537
  encodeSwiftOrderParamsMessage(orderParamsMessage: SwiftOrderParamsMessage): Buffer;
537
538
  decodeSwiftOrderParamsMessage(encodedMessage: Buffer): SwiftOrderParamsMessage;
538
539
  signMessage(message: Uint8Array, keypair?: Keypair): Buffer;
539
- placeSwiftTakerOrder(swiftOrderParamsMessage: Buffer, swiftOrderParamsSignature: Buffer, marketIndex: number, takerInfo: {
540
+ placeSwiftTakerOrder(signedSwiftOrderParams: SignedSwiftOrderParams, marketIndex: number, takerInfo: {
540
541
  taker: PublicKey;
541
542
  takerStats: PublicKey;
542
543
  takerUserAccount: UserAccount;
543
544
  }, precedingIxs?: TransactionInstruction[], overrideIxCount?: number, txParams?: TxParams): Promise<TransactionSignature>;
544
- getPlaceSwiftTakerPerpOrderIxs(encodedSwiftOrderParamsMessage: Buffer, swiftOrderParamsSignature: Buffer, marketIndex: number, takerInfo: {
545
+ getPlaceSwiftTakerPerpOrderIxs(signedSwiftOrderParams: SignedSwiftOrderParams, marketIndex: number, takerInfo: {
545
546
  taker: PublicKey;
546
547
  takerStats: PublicKey;
547
548
  takerUserAccount: UserAccount;
548
549
  }, authority?: PublicKey, precedingIxs?: TransactionInstruction[], overrideIxCount?: number): Promise<TransactionInstruction[]>;
549
- placeAndMakeSwiftPerpOrder(encodedSwiftOrderParamsMessage: Buffer, swiftOrderParamsSignature: Buffer, swiftOrderUuid: Uint8Array, takerInfo: {
550
+ placeAndMakeSwiftPerpOrder(signedSwiftOrderParams: SignedSwiftOrderParams, swiftOrderUuid: Uint8Array, takerInfo: {
550
551
  taker: PublicKey;
551
552
  takerStats: PublicKey;
552
553
  takerUserAccount: UserAccount;
553
554
  }, orderParams: OptionalOrderParams, referrerInfo?: ReferrerInfo, txParams?: TxParams, subAccountId?: number, precedingIxs?: TransactionInstruction[], overrideIxCount?: number): Promise<TransactionSignature>;
554
- getPlaceAndMakeSwiftPerpOrderIxs(encodedSwiftOrderParamsMessage: Buffer, swiftOrderParamsSignature: Buffer, swiftOrderUuid: Uint8Array, takerInfo: {
555
+ getPlaceAndMakeSwiftPerpOrderIxs(signedSwiftOrderParams: SignedSwiftOrderParams, swiftOrderUuid: Uint8Array, takerInfo: {
555
556
  taker: PublicKey;
556
557
  takerStats: PublicKey;
557
558
  takerUserAccount: UserAccount;
@@ -3181,26 +3181,34 @@ class DriftClient {
3181
3181
  });
3182
3182
  }
3183
3183
  signSwiftOrderParamsMessage(orderParamsMessage) {
3184
- const takerOrderParamsMessage = this.encodeSwiftOrderParamsMessage(orderParamsMessage);
3185
- return this.signMessage(takerOrderParamsMessage);
3184
+ const borshBuf = this.encodeSwiftOrderParamsMessage(orderParamsMessage);
3185
+ const orderParams = Buffer.from(borshBuf.toString('hex'));
3186
+ return {
3187
+ orderParams,
3188
+ signature: this.signMessage(Buffer.from(borshBuf.toString('hex'))),
3189
+ };
3186
3190
  }
3187
- // encode the swift order for use in program Ix/signing
3191
+ /*
3192
+ * Borsh encode swift taker order params
3193
+ */
3188
3194
  encodeSwiftOrderParamsMessage(orderParamsMessage) {
3189
- const borshBuf = this.program.coder.types.encode('SwiftOrderParamsMessage', orderParamsMessage);
3190
- return Buffer.from(borshBuf.toString('hex'));
3195
+ return this.program.coder.types.encode('SwiftOrderParamsMessage', orderParamsMessage);
3191
3196
  }
3197
+ /*
3198
+ * Decode swift taker order params from borsh buffer
3199
+ */
3192
3200
  decodeSwiftOrderParamsMessage(encodedMessage) {
3193
3201
  return this.program.coder.types.decode('SwiftOrderParamsMessage', encodedMessage);
3194
3202
  }
3195
3203
  signMessage(message, keypair = this.wallet.payer) {
3196
3204
  return Buffer.from(tweetnacl_1.default.sign.detached(message, keypair.secretKey));
3197
3205
  }
3198
- async placeSwiftTakerOrder(swiftOrderParamsMessage, swiftOrderParamsSignature, marketIndex, takerInfo, precedingIxs = [], overrideIxCount, txParams) {
3199
- const ixs = await this.getPlaceSwiftTakerPerpOrderIxs(swiftOrderParamsMessage, swiftOrderParamsSignature, marketIndex, takerInfo, undefined, precedingIxs, overrideIxCount);
3206
+ async placeSwiftTakerOrder(signedSwiftOrderParams, marketIndex, takerInfo, precedingIxs = [], overrideIxCount, txParams) {
3207
+ const ixs = await this.getPlaceSwiftTakerPerpOrderIxs(signedSwiftOrderParams, marketIndex, takerInfo, undefined, precedingIxs, overrideIxCount);
3200
3208
  const { txSig } = await this.sendTransaction(await this.buildTransaction(ixs, txParams), [], this.opts);
3201
3209
  return txSig;
3202
3210
  }
3203
- async getPlaceSwiftTakerPerpOrderIxs(encodedSwiftOrderParamsMessage, swiftOrderParamsSignature, marketIndex, takerInfo, authority, precedingIxs = [], overrideIxCount) {
3211
+ async getPlaceSwiftTakerPerpOrderIxs(signedSwiftOrderParams, marketIndex, takerInfo, authority, precedingIxs = [], overrideIxCount) {
3204
3212
  if (!authority && !takerInfo.takerUserAccount) {
3205
3213
  throw new Error('authority or takerUserAccount must be provided');
3206
3214
  }
@@ -3211,12 +3219,12 @@ class DriftClient {
3211
3219
  });
3212
3220
  const authorityToUse = authority || takerInfo.takerUserAccount.authority;
3213
3221
  const messageLengthBuffer = Buffer.alloc(2);
3214
- messageLengthBuffer.writeUInt16LE(encodedSwiftOrderParamsMessage.length);
3222
+ messageLengthBuffer.writeUInt16LE(signedSwiftOrderParams.orderParams.length);
3215
3223
  const swiftIxData = Buffer.concat([
3216
- swiftOrderParamsSignature,
3224
+ signedSwiftOrderParams.signature,
3217
3225
  authorityToUse.toBytes(),
3218
3226
  messageLengthBuffer,
3219
- encodedSwiftOrderParamsMessage,
3227
+ signedSwiftOrderParams.orderParams,
3220
3228
  ]);
3221
3229
  const swiftOrderParamsSignatureIx = (0, pythOracleUtils_1.createMinimalEd25519VerifyIx)(overrideIxCount || precedingIxs.length + 1, 12, swiftIxData, 0);
3222
3230
  const placeTakerSwiftPerpOrderIx = this.program.instruction.placeSwiftTakerOrder(swiftIxData, {
@@ -3232,14 +3240,14 @@ class DriftClient {
3232
3240
  });
3233
3241
  return [swiftOrderParamsSignatureIx, placeTakerSwiftPerpOrderIx];
3234
3242
  }
3235
- async placeAndMakeSwiftPerpOrder(encodedSwiftOrderParamsMessage, swiftOrderParamsSignature, swiftOrderUuid, takerInfo, orderParams, referrerInfo, txParams, subAccountId, precedingIxs = [], overrideIxCount) {
3236
- const ixs = await this.getPlaceAndMakeSwiftPerpOrderIxs(encodedSwiftOrderParamsMessage, swiftOrderParamsSignature, swiftOrderUuid, takerInfo, orderParams, referrerInfo, subAccountId, precedingIxs, overrideIxCount);
3243
+ async placeAndMakeSwiftPerpOrder(signedSwiftOrderParams, swiftOrderUuid, takerInfo, orderParams, referrerInfo, txParams, subAccountId, precedingIxs = [], overrideIxCount) {
3244
+ const ixs = await this.getPlaceAndMakeSwiftPerpOrderIxs(signedSwiftOrderParams, swiftOrderUuid, takerInfo, orderParams, referrerInfo, subAccountId, precedingIxs, overrideIxCount);
3237
3245
  const { txSig, slot } = await this.sendTransaction(await this.buildTransaction(ixs, txParams), [], this.opts);
3238
3246
  this.perpMarketLastSlotCache.set(orderParams.marketIndex, slot);
3239
3247
  return txSig;
3240
3248
  }
3241
- async getPlaceAndMakeSwiftPerpOrderIxs(encodedSwiftOrderParamsMessage, swiftOrderParamsSignature, swiftOrderUuid, takerInfo, orderParams, referrerInfo, subAccountId, precedingIxs = [], overrideIxCount) {
3242
- const [swiftOrderSignatureIx, placeTakerSwiftPerpOrderIx] = await this.getPlaceSwiftTakerPerpOrderIxs(encodedSwiftOrderParamsMessage, swiftOrderParamsSignature, orderParams.marketIndex, takerInfo, undefined, precedingIxs, overrideIxCount);
3249
+ async getPlaceAndMakeSwiftPerpOrderIxs(signedSwiftOrderParams, swiftOrderUuid, takerInfo, orderParams, referrerInfo, subAccountId, precedingIxs = [], overrideIxCount) {
3250
+ const [swiftOrderSignatureIx, placeTakerSwiftPerpOrderIx] = await this.getPlaceSwiftTakerPerpOrderIxs(signedSwiftOrderParams, orderParams.marketIndex, takerInfo, undefined, precedingIxs, overrideIxCount);
3243
3251
  orderParams = (0, orderParams_1.getOrderParams)(orderParams, { marketType: types_1.MarketType.PERP });
3244
3252
  const userStatsPublicKey = this.getUserStatsAccountPublicKey();
3245
3253
  const user = await this.getUserAccountPublicKey(subAccountId);
@@ -14651,5 +14651,8 @@
14651
14651
  "name": "InvalidLiquidateSpotWithSwap",
14652
14652
  "msg": "InvalidLiquidateSpotWithSwap"
14653
14653
  }
14654
- ]
14654
+ ],
14655
+ "metadata": {
14656
+ "address": "dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH"
14657
+ }
14655
14658
  }
@@ -71,7 +71,7 @@ class SwiftOrderSubscriber {
71
71
  }
72
72
  if (message['order']) {
73
73
  const order = JSON.parse(message['order']);
74
- const swiftOrderParamsBuf = Buffer.from(order['order_message'], 'base64');
74
+ const swiftOrderParamsBuf = Buffer.from(order['order_message'], 'hex');
75
75
  const swiftOrderParamsMessage = this.driftClient.program.coder.types.decode('SwiftOrderParamsMessage', swiftOrderParamsBuf);
76
76
  if (!swiftOrderParamsMessage.swiftOrderParams.price) {
77
77
  console.error(`order has no price: ${JSON.stringify(swiftOrderParamsMessage.swiftOrderParams)}`);
@@ -91,11 +91,13 @@ class SwiftOrderSubscriber {
91
91
  });
92
92
  }
93
93
  async getPlaceAndMakeSwiftOrderIxs(orderMessageRaw, swiftOrderParamsMessage, makerOrderParams) {
94
- const swiftOrderParamsBuf = Buffer.from(orderMessageRaw['order_message'], 'base64');
95
94
  const takerAuthority = new web3_js_1.PublicKey(orderMessageRaw['taker_authority']);
96
95
  const takerUserPubkey = await (0, __1.getUserAccountPublicKey)(this.driftClient.program.programId, takerAuthority, swiftOrderParamsMessage.subAccountId);
97
96
  const takerUserAccount = (await this.userMap.mustGet(takerUserPubkey.toString())).getUserAccount();
98
- const ixs = await this.driftClient.getPlaceAndMakeSwiftPerpOrderIxs(swiftOrderParamsBuf, Buffer.from(orderMessageRaw['order_signature'], 'base64'), (0, tweetnacl_util_1.decodeUTF8)(orderMessageRaw['uuid']), {
97
+ const ixs = await this.driftClient.getPlaceAndMakeSwiftPerpOrderIxs({
98
+ orderParams: orderMessageRaw['order_message'],
99
+ signature: Buffer.from(orderMessageRaw['order_signature'], 'base64'),
100
+ }, (0, tweetnacl_util_1.decodeUTF8)(orderMessageRaw['uuid']), {
99
101
  taker: takerUserPubkey,
100
102
  takerUserAccount,
101
103
  takerStats: (0, __1.getUserStatsAccountPublicKey)(this.driftClient.program.programId, takerUserAccount.authority),
@@ -0,0 +1,17 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import { Buffer } from 'buffer';
4
+ /**
5
+ * Represents proof of a swift taker order
6
+ * It can be provided to drift program to fill a swift order
7
+ */
8
+ export interface SignedSwiftOrderParams {
9
+ /**
10
+ * The encoded order params that were signed (borsh encoded then hexified).
11
+ */
12
+ orderParams: Buffer;
13
+ /**
14
+ * The signature generated for the orderParams
15
+ */
16
+ signature: Buffer;
17
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1004,6 +1004,17 @@ exports.MainnetPerpMarkets = [
1004
1004
  oracleSource: __1.OracleSource.PYTH_PULL,
1005
1005
  pythFeedId: '0xbed3097008b9b5e3c93bec20be79cb43986b85a996475589351a21e67bae9b61',
1006
1006
  },
1007
+ {
1008
+ fullName: 'AI16Z',
1009
+ category: ['AI'],
1010
+ symbol: 'AI16Z-PERP',
1011
+ baseAssetSymbol: 'AI16Z',
1012
+ marketIndex: 63,
1013
+ oracle: new web3_js_1.PublicKey('3gdGkrmBdYR7B1MRRdRVysqhZCvYvLGHonr9b7o9WVki'),
1014
+ launchTs: 1736384970000,
1015
+ oracleSource: __1.OracleSource.PYTH_PULL,
1016
+ pythFeedId: '0x2551eca7784671173def2c41e6f3e51e11cd87494863f1d208fdd8c64a1f85ae',
1017
+ },
1007
1018
  ];
1008
1019
  exports.PerpMarkets = {
1009
1020
  devnet: exports.DevnetPerpMarkets,
@@ -513,6 +513,18 @@ exports.MainnetSpotMarkets = [
513
513
  pythFeedId: '0xeaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a',
514
514
  launchTs: 1735255852000,
515
515
  },
516
+ {
517
+ symbol: 'AI16Z',
518
+ marketIndex: 35,
519
+ poolId: 0,
520
+ oracle: new web3_js_1.PublicKey('3gdGkrmBdYR7B1MRRdRVysqhZCvYvLGHonr9b7o9WVki'),
521
+ oracleSource: __1.OracleSource.PYTH_PULL,
522
+ mint: new web3_js_1.PublicKey('HeLp6NuQkmYB4pYWo2zYs22mESHXPQYzXbB8n4V98jwC'),
523
+ precision: new __1.BN(10).pow(numericConstants_1.NINE),
524
+ precisionExp: numericConstants_1.NINE,
525
+ pythFeedId: '0x2551eca7784671173def2c41e6f3e51e11cd87494863f1d208fdd8c64a1f85ae',
526
+ launchTs: 1736384970000,
527
+ },
516
528
  ];
517
529
  exports.SpotMarkets = {
518
530
  devnet: exports.DevnetSpotMarkets,
@@ -24,6 +24,7 @@ import { TxHandler } from './tx/txHandler';
24
24
  import { WormholeCoreBridgeSolana } from '@pythnetwork/pyth-solana-receiver/lib/idl/wormhole_core_bridge_solana';
25
25
  import { PythSolanaReceiver } from '@pythnetwork/pyth-solana-receiver/lib/idl/pyth_solana_receiver';
26
26
  import { Slothash } from './slot/SlothashSubscriber';
27
+ import { SignedSwiftOrderParams } from './swift/types';
27
28
  type RemainingAccountParams = {
28
29
  userAccounts: UserAccount[];
29
30
  writablePerpMarketIndexes?: number[];
@@ -532,26 +533,26 @@ export declare class DriftClient {
532
533
  getPlaceAndTakePerpOrderIx(orderParams: OptionalOrderParams, makerInfo?: MakerInfo | MakerInfo[], referrerInfo?: ReferrerInfo, successCondition?: PlaceAndTakeOrderSuccessCondition, auctionDurationPercentage?: number, subAccountId?: number): Promise<TransactionInstruction>;
533
534
  placeAndMakePerpOrder(orderParams: OptionalOrderParams, takerInfo: TakerInfo, referrerInfo?: ReferrerInfo, txParams?: TxParams, subAccountId?: number): Promise<TransactionSignature>;
534
535
  getPlaceAndMakePerpOrderIx(orderParams: OptionalOrderParams, takerInfo: TakerInfo, referrerInfo?: ReferrerInfo, subAccountId?: number): Promise<TransactionInstruction>;
535
- signSwiftOrderParamsMessage(orderParamsMessage: SwiftOrderParamsMessage): Buffer;
536
+ signSwiftOrderParamsMessage(orderParamsMessage: SwiftOrderParamsMessage): SignedSwiftOrderParams;
536
537
  encodeSwiftOrderParamsMessage(orderParamsMessage: SwiftOrderParamsMessage): Buffer;
537
538
  decodeSwiftOrderParamsMessage(encodedMessage: Buffer): SwiftOrderParamsMessage;
538
539
  signMessage(message: Uint8Array, keypair?: Keypair): Buffer;
539
- placeSwiftTakerOrder(swiftOrderParamsMessage: Buffer, swiftOrderParamsSignature: Buffer, marketIndex: number, takerInfo: {
540
+ placeSwiftTakerOrder(signedSwiftOrderParams: SignedSwiftOrderParams, marketIndex: number, takerInfo: {
540
541
  taker: PublicKey;
541
542
  takerStats: PublicKey;
542
543
  takerUserAccount: UserAccount;
543
544
  }, precedingIxs?: TransactionInstruction[], overrideIxCount?: number, txParams?: TxParams): Promise<TransactionSignature>;
544
- getPlaceSwiftTakerPerpOrderIxs(encodedSwiftOrderParamsMessage: Buffer, swiftOrderParamsSignature: Buffer, marketIndex: number, takerInfo: {
545
+ getPlaceSwiftTakerPerpOrderIxs(signedSwiftOrderParams: SignedSwiftOrderParams, marketIndex: number, takerInfo: {
545
546
  taker: PublicKey;
546
547
  takerStats: PublicKey;
547
548
  takerUserAccount: UserAccount;
548
549
  }, authority?: PublicKey, precedingIxs?: TransactionInstruction[], overrideIxCount?: number): Promise<TransactionInstruction[]>;
549
- placeAndMakeSwiftPerpOrder(encodedSwiftOrderParamsMessage: Buffer, swiftOrderParamsSignature: Buffer, swiftOrderUuid: Uint8Array, takerInfo: {
550
+ placeAndMakeSwiftPerpOrder(signedSwiftOrderParams: SignedSwiftOrderParams, swiftOrderUuid: Uint8Array, takerInfo: {
550
551
  taker: PublicKey;
551
552
  takerStats: PublicKey;
552
553
  takerUserAccount: UserAccount;
553
554
  }, orderParams: OptionalOrderParams, referrerInfo?: ReferrerInfo, txParams?: TxParams, subAccountId?: number, precedingIxs?: TransactionInstruction[], overrideIxCount?: number): Promise<TransactionSignature>;
554
- getPlaceAndMakeSwiftPerpOrderIxs(encodedSwiftOrderParamsMessage: Buffer, swiftOrderParamsSignature: Buffer, swiftOrderUuid: Uint8Array, takerInfo: {
555
+ getPlaceAndMakeSwiftPerpOrderIxs(signedSwiftOrderParams: SignedSwiftOrderParams, swiftOrderUuid: Uint8Array, takerInfo: {
555
556
  taker: PublicKey;
556
557
  takerStats: PublicKey;
557
558
  takerUserAccount: UserAccount;
@@ -3181,26 +3181,34 @@ class DriftClient {
3181
3181
  });
3182
3182
  }
3183
3183
  signSwiftOrderParamsMessage(orderParamsMessage) {
3184
- const takerOrderParamsMessage = this.encodeSwiftOrderParamsMessage(orderParamsMessage);
3185
- return this.signMessage(takerOrderParamsMessage);
3184
+ const borshBuf = this.encodeSwiftOrderParamsMessage(orderParamsMessage);
3185
+ const orderParams = Buffer.from(borshBuf.toString('hex'));
3186
+ return {
3187
+ orderParams,
3188
+ signature: this.signMessage(Buffer.from(borshBuf.toString('hex'))),
3189
+ };
3186
3190
  }
3187
- // encode the swift order for use in program Ix/signing
3191
+ /*
3192
+ * Borsh encode swift taker order params
3193
+ */
3188
3194
  encodeSwiftOrderParamsMessage(orderParamsMessage) {
3189
- const borshBuf = this.program.coder.types.encode('SwiftOrderParamsMessage', orderParamsMessage);
3190
- return Buffer.from(borshBuf.toString('hex'));
3195
+ return this.program.coder.types.encode('SwiftOrderParamsMessage', orderParamsMessage);
3191
3196
  }
3197
+ /*
3198
+ * Decode swift taker order params from borsh buffer
3199
+ */
3192
3200
  decodeSwiftOrderParamsMessage(encodedMessage) {
3193
3201
  return this.program.coder.types.decode('SwiftOrderParamsMessage', encodedMessage);
3194
3202
  }
3195
3203
  signMessage(message, keypair = this.wallet.payer) {
3196
3204
  return Buffer.from(tweetnacl_1.default.sign.detached(message, keypair.secretKey));
3197
3205
  }
3198
- async placeSwiftTakerOrder(swiftOrderParamsMessage, swiftOrderParamsSignature, marketIndex, takerInfo, precedingIxs = [], overrideIxCount, txParams) {
3199
- const ixs = await this.getPlaceSwiftTakerPerpOrderIxs(swiftOrderParamsMessage, swiftOrderParamsSignature, marketIndex, takerInfo, undefined, precedingIxs, overrideIxCount);
3206
+ async placeSwiftTakerOrder(signedSwiftOrderParams, marketIndex, takerInfo, precedingIxs = [], overrideIxCount, txParams) {
3207
+ const ixs = await this.getPlaceSwiftTakerPerpOrderIxs(signedSwiftOrderParams, marketIndex, takerInfo, undefined, precedingIxs, overrideIxCount);
3200
3208
  const { txSig } = await this.sendTransaction(await this.buildTransaction(ixs, txParams), [], this.opts);
3201
3209
  return txSig;
3202
3210
  }
3203
- async getPlaceSwiftTakerPerpOrderIxs(encodedSwiftOrderParamsMessage, swiftOrderParamsSignature, marketIndex, takerInfo, authority, precedingIxs = [], overrideIxCount) {
3211
+ async getPlaceSwiftTakerPerpOrderIxs(signedSwiftOrderParams, marketIndex, takerInfo, authority, precedingIxs = [], overrideIxCount) {
3204
3212
  if (!authority && !takerInfo.takerUserAccount) {
3205
3213
  throw new Error('authority or takerUserAccount must be provided');
3206
3214
  }
@@ -3211,12 +3219,12 @@ class DriftClient {
3211
3219
  });
3212
3220
  const authorityToUse = authority || takerInfo.takerUserAccount.authority;
3213
3221
  const messageLengthBuffer = Buffer.alloc(2);
3214
- messageLengthBuffer.writeUInt16LE(encodedSwiftOrderParamsMessage.length);
3222
+ messageLengthBuffer.writeUInt16LE(signedSwiftOrderParams.orderParams.length);
3215
3223
  const swiftIxData = Buffer.concat([
3216
- swiftOrderParamsSignature,
3224
+ signedSwiftOrderParams.signature,
3217
3225
  authorityToUse.toBytes(),
3218
3226
  messageLengthBuffer,
3219
- encodedSwiftOrderParamsMessage,
3227
+ signedSwiftOrderParams.orderParams,
3220
3228
  ]);
3221
3229
  const swiftOrderParamsSignatureIx = (0, pythOracleUtils_1.createMinimalEd25519VerifyIx)(overrideIxCount || precedingIxs.length + 1, 12, swiftIxData, 0);
3222
3230
  const placeTakerSwiftPerpOrderIx = this.program.instruction.placeSwiftTakerOrder(swiftIxData, {
@@ -3232,14 +3240,14 @@ class DriftClient {
3232
3240
  });
3233
3241
  return [swiftOrderParamsSignatureIx, placeTakerSwiftPerpOrderIx];
3234
3242
  }
3235
- async placeAndMakeSwiftPerpOrder(encodedSwiftOrderParamsMessage, swiftOrderParamsSignature, swiftOrderUuid, takerInfo, orderParams, referrerInfo, txParams, subAccountId, precedingIxs = [], overrideIxCount) {
3236
- const ixs = await this.getPlaceAndMakeSwiftPerpOrderIxs(encodedSwiftOrderParamsMessage, swiftOrderParamsSignature, swiftOrderUuid, takerInfo, orderParams, referrerInfo, subAccountId, precedingIxs, overrideIxCount);
3243
+ async placeAndMakeSwiftPerpOrder(signedSwiftOrderParams, swiftOrderUuid, takerInfo, orderParams, referrerInfo, txParams, subAccountId, precedingIxs = [], overrideIxCount) {
3244
+ const ixs = await this.getPlaceAndMakeSwiftPerpOrderIxs(signedSwiftOrderParams, swiftOrderUuid, takerInfo, orderParams, referrerInfo, subAccountId, precedingIxs, overrideIxCount);
3237
3245
  const { txSig, slot } = await this.sendTransaction(await this.buildTransaction(ixs, txParams), [], this.opts);
3238
3246
  this.perpMarketLastSlotCache.set(orderParams.marketIndex, slot);
3239
3247
  return txSig;
3240
3248
  }
3241
- async getPlaceAndMakeSwiftPerpOrderIxs(encodedSwiftOrderParamsMessage, swiftOrderParamsSignature, swiftOrderUuid, takerInfo, orderParams, referrerInfo, subAccountId, precedingIxs = [], overrideIxCount) {
3242
- const [swiftOrderSignatureIx, placeTakerSwiftPerpOrderIx] = await this.getPlaceSwiftTakerPerpOrderIxs(encodedSwiftOrderParamsMessage, swiftOrderParamsSignature, orderParams.marketIndex, takerInfo, undefined, precedingIxs, overrideIxCount);
3249
+ async getPlaceAndMakeSwiftPerpOrderIxs(signedSwiftOrderParams, swiftOrderUuid, takerInfo, orderParams, referrerInfo, subAccountId, precedingIxs = [], overrideIxCount) {
3250
+ const [swiftOrderSignatureIx, placeTakerSwiftPerpOrderIx] = await this.getPlaceSwiftTakerPerpOrderIxs(signedSwiftOrderParams, orderParams.marketIndex, takerInfo, undefined, precedingIxs, overrideIxCount);
3243
3251
  orderParams = (0, orderParams_1.getOrderParams)(orderParams, { marketType: types_1.MarketType.PERP });
3244
3252
  const userStatsPublicKey = this.getUserStatsAccountPublicKey();
3245
3253
  const user = await this.getUserAccountPublicKey(subAccountId);
@@ -14651,5 +14651,8 @@
14651
14651
  "name": "InvalidLiquidateSpotWithSwap",
14652
14652
  "msg": "InvalidLiquidateSpotWithSwap"
14653
14653
  }
14654
- ]
14654
+ ],
14655
+ "metadata": {
14656
+ "address": "dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH"
14657
+ }
14655
14658
  }
@@ -71,7 +71,7 @@ class SwiftOrderSubscriber {
71
71
  }
72
72
  if (message['order']) {
73
73
  const order = JSON.parse(message['order']);
74
- const swiftOrderParamsBuf = Buffer.from(order['order_message'], 'base64');
74
+ const swiftOrderParamsBuf = Buffer.from(order['order_message'], 'hex');
75
75
  const swiftOrderParamsMessage = this.driftClient.program.coder.types.decode('SwiftOrderParamsMessage', swiftOrderParamsBuf);
76
76
  if (!swiftOrderParamsMessage.swiftOrderParams.price) {
77
77
  console.error(`order has no price: ${JSON.stringify(swiftOrderParamsMessage.swiftOrderParams)}`);
@@ -91,11 +91,13 @@ class SwiftOrderSubscriber {
91
91
  });
92
92
  }
93
93
  async getPlaceAndMakeSwiftOrderIxs(orderMessageRaw, swiftOrderParamsMessage, makerOrderParams) {
94
- const swiftOrderParamsBuf = Buffer.from(orderMessageRaw['order_message'], 'base64');
95
94
  const takerAuthority = new web3_js_1.PublicKey(orderMessageRaw['taker_authority']);
96
95
  const takerUserPubkey = await (0, __1.getUserAccountPublicKey)(this.driftClient.program.programId, takerAuthority, swiftOrderParamsMessage.subAccountId);
97
96
  const takerUserAccount = (await this.userMap.mustGet(takerUserPubkey.toString())).getUserAccount();
98
- const ixs = await this.driftClient.getPlaceAndMakeSwiftPerpOrderIxs(swiftOrderParamsBuf, Buffer.from(orderMessageRaw['order_signature'], 'base64'), (0, tweetnacl_util_1.decodeUTF8)(orderMessageRaw['uuid']), {
97
+ const ixs = await this.driftClient.getPlaceAndMakeSwiftPerpOrderIxs({
98
+ orderParams: orderMessageRaw['order_message'],
99
+ signature: Buffer.from(orderMessageRaw['order_signature'], 'base64'),
100
+ }, (0, tweetnacl_util_1.decodeUTF8)(orderMessageRaw['uuid']), {
99
101
  taker: takerUserPubkey,
100
102
  takerUserAccount,
101
103
  takerStats: (0, __1.getUserStatsAccountPublicKey)(this.driftClient.program.programId, takerUserAccount.authority),
@@ -0,0 +1,17 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ import { Buffer } from 'buffer';
4
+ /**
5
+ * Represents proof of a swift taker order
6
+ * It can be provided to drift program to fill a swift order
7
+ */
8
+ export interface SignedSwiftOrderParams {
9
+ /**
10
+ * The encoded order params that were signed (borsh encoded then hexified).
11
+ */
12
+ orderParams: Buffer;
13
+ /**
14
+ * The signature generated for the orderParams
15
+ */
16
+ signature: Buffer;
17
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.107.0-beta.0",
3
+ "version": "2.107.0-beta.2",
4
4
  "main": "lib/node/index.js",
5
5
  "types": "lib/node/index.d.ts",
6
6
  "browser": "./lib/browser/index.js",
@@ -1092,6 +1092,18 @@ export const MainnetPerpMarkets: PerpMarketConfig[] = [
1092
1092
  pythFeedId:
1093
1093
  '0xbed3097008b9b5e3c93bec20be79cb43986b85a996475589351a21e67bae9b61',
1094
1094
  },
1095
+ {
1096
+ fullName: 'AI16Z',
1097
+ category: ['AI'],
1098
+ symbol: 'AI16Z-PERP',
1099
+ baseAssetSymbol: 'AI16Z',
1100
+ marketIndex: 63,
1101
+ oracle: new PublicKey('3gdGkrmBdYR7B1MRRdRVysqhZCvYvLGHonr9b7o9WVki'),
1102
+ launchTs: 1736384970000,
1103
+ oracleSource: OracleSource.PYTH_PULL,
1104
+ pythFeedId:
1105
+ '0x2551eca7784671173def2c41e6f3e51e11cd87494863f1d208fdd8c64a1f85ae',
1106
+ },
1095
1107
  ];
1096
1108
 
1097
1109
  export const PerpMarkets: { [key in DriftEnv]: PerpMarketConfig[] } = {
@@ -615,6 +615,19 @@ export const MainnetSpotMarkets: SpotMarketConfig[] = [
615
615
  '0xeaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a',
616
616
  launchTs: 1735255852000,
617
617
  },
618
+ {
619
+ symbol: 'AI16Z',
620
+ marketIndex: 35,
621
+ poolId: 0,
622
+ oracle: new PublicKey('3gdGkrmBdYR7B1MRRdRVysqhZCvYvLGHonr9b7o9WVki'),
623
+ oracleSource: OracleSource.PYTH_PULL,
624
+ mint: new PublicKey('HeLp6NuQkmYB4pYWo2zYs22mESHXPQYzXbB8n4V98jwC'),
625
+ precision: new BN(10).pow(NINE),
626
+ precisionExp: NINE,
627
+ pythFeedId:
628
+ '0x2551eca7784671173def2c41e6f3e51e11cd87494863f1d208fdd8c64a1f85ae',
629
+ launchTs: 1736384970000,
630
+ },
618
631
  ];
619
632
 
620
633
  export const SpotMarkets: { [key in DriftEnv]: SpotMarketConfig[] } = {
@@ -181,6 +181,7 @@ import { gprcDriftClientAccountSubscriber } from './accounts/grpcDriftClientAcco
181
181
  import nacl from 'tweetnacl';
182
182
  import { Slothash } from './slot/SlothashSubscriber';
183
183
  import { getOracleId } from './oracles/oracleId';
184
+ import { SignedSwiftOrderParams } from './swift/types';
184
185
 
185
186
  type RemainingAccountParams = {
186
187
  userAccounts: UserAccount[];
@@ -5882,23 +5883,30 @@ export class DriftClient {
5882
5883
 
5883
5884
  public signSwiftOrderParamsMessage(
5884
5885
  orderParamsMessage: SwiftOrderParamsMessage
5885
- ): Buffer {
5886
- const takerOrderParamsMessage =
5887
- this.encodeSwiftOrderParamsMessage(orderParamsMessage);
5888
- return this.signMessage(takerOrderParamsMessage);
5886
+ ): SignedSwiftOrderParams {
5887
+ const borshBuf = this.encodeSwiftOrderParamsMessage(orderParamsMessage);
5888
+ const orderParams = Buffer.from(borshBuf.toString('hex'));
5889
+ return {
5890
+ orderParams,
5891
+ signature: this.signMessage(Buffer.from(borshBuf.toString('hex'))),
5892
+ };
5889
5893
  }
5890
5894
 
5891
- // encode the swift order for use in program Ix/signing
5895
+ /*
5896
+ * Borsh encode swift taker order params
5897
+ */
5892
5898
  public encodeSwiftOrderParamsMessage(
5893
5899
  orderParamsMessage: SwiftOrderParamsMessage
5894
5900
  ): Buffer {
5895
- const borshBuf = this.program.coder.types.encode(
5901
+ return this.program.coder.types.encode(
5896
5902
  'SwiftOrderParamsMessage',
5897
5903
  orderParamsMessage
5898
5904
  );
5899
- return Buffer.from(borshBuf.toString('hex'));
5900
5905
  }
5901
5906
 
5907
+ /*
5908
+ * Decode swift taker order params from borsh buffer
5909
+ */
5902
5910
  public decodeSwiftOrderParamsMessage(
5903
5911
  encodedMessage: Buffer
5904
5912
  ): SwiftOrderParamsMessage {
@@ -5916,8 +5924,7 @@ export class DriftClient {
5916
5924
  }
5917
5925
 
5918
5926
  public async placeSwiftTakerOrder(
5919
- swiftOrderParamsMessage: Buffer,
5920
- swiftOrderParamsSignature: Buffer,
5927
+ signedSwiftOrderParams: SignedSwiftOrderParams,
5921
5928
  marketIndex: number,
5922
5929
  takerInfo: {
5923
5930
  taker: PublicKey;
@@ -5929,8 +5936,7 @@ export class DriftClient {
5929
5936
  txParams?: TxParams
5930
5937
  ): Promise<TransactionSignature> {
5931
5938
  const ixs = await this.getPlaceSwiftTakerPerpOrderIxs(
5932
- swiftOrderParamsMessage,
5933
- swiftOrderParamsSignature,
5939
+ signedSwiftOrderParams,
5934
5940
  marketIndex,
5935
5941
  takerInfo,
5936
5942
  undefined,
@@ -5946,8 +5952,7 @@ export class DriftClient {
5946
5952
  }
5947
5953
 
5948
5954
  public async getPlaceSwiftTakerPerpOrderIxs(
5949
- encodedSwiftOrderParamsMessage: Buffer,
5950
- swiftOrderParamsSignature: Buffer,
5955
+ signedSwiftOrderParams: SignedSwiftOrderParams,
5951
5956
  marketIndex: number,
5952
5957
  takerInfo: {
5953
5958
  taker: PublicKey;
@@ -5971,13 +5976,15 @@ export class DriftClient {
5971
5976
  const authorityToUse = authority || takerInfo.takerUserAccount.authority;
5972
5977
 
5973
5978
  const messageLengthBuffer = Buffer.alloc(2);
5974
- messageLengthBuffer.writeUInt16LE(encodedSwiftOrderParamsMessage.length);
5979
+ messageLengthBuffer.writeUInt16LE(
5980
+ signedSwiftOrderParams.orderParams.length
5981
+ );
5975
5982
 
5976
5983
  const swiftIxData = Buffer.concat([
5977
- swiftOrderParamsSignature,
5984
+ signedSwiftOrderParams.signature,
5978
5985
  authorityToUse.toBytes(),
5979
5986
  messageLengthBuffer,
5980
- encodedSwiftOrderParamsMessage,
5987
+ signedSwiftOrderParams.orderParams,
5981
5988
  ]);
5982
5989
 
5983
5990
  const swiftOrderParamsSignatureIx = createMinimalEd25519VerifyIx(
@@ -6007,8 +6014,7 @@ export class DriftClient {
6007
6014
  }
6008
6015
 
6009
6016
  public async placeAndMakeSwiftPerpOrder(
6010
- encodedSwiftOrderParamsMessage: Buffer,
6011
- swiftOrderParamsSignature: Buffer,
6017
+ signedSwiftOrderParams: SignedSwiftOrderParams,
6012
6018
  swiftOrderUuid: Uint8Array,
6013
6019
  takerInfo: {
6014
6020
  taker: PublicKey;
@@ -6023,8 +6029,7 @@ export class DriftClient {
6023
6029
  overrideIxCount?: number
6024
6030
  ): Promise<TransactionSignature> {
6025
6031
  const ixs = await this.getPlaceAndMakeSwiftPerpOrderIxs(
6026
- encodedSwiftOrderParamsMessage,
6027
- swiftOrderParamsSignature,
6032
+ signedSwiftOrderParams,
6028
6033
  swiftOrderUuid,
6029
6034
  takerInfo,
6030
6035
  orderParams,
@@ -6044,8 +6049,7 @@ export class DriftClient {
6044
6049
  }
6045
6050
 
6046
6051
  public async getPlaceAndMakeSwiftPerpOrderIxs(
6047
- encodedSwiftOrderParamsMessage: Buffer,
6048
- swiftOrderParamsSignature: Buffer,
6052
+ signedSwiftOrderParams: SignedSwiftOrderParams,
6049
6053
  swiftOrderUuid: Uint8Array,
6050
6054
  takerInfo: {
6051
6055
  taker: PublicKey;
@@ -6060,8 +6064,7 @@ export class DriftClient {
6060
6064
  ): Promise<TransactionInstruction[]> {
6061
6065
  const [swiftOrderSignatureIx, placeTakerSwiftPerpOrderIx] =
6062
6066
  await this.getPlaceSwiftTakerPerpOrderIxs(
6063
- encodedSwiftOrderParamsMessage,
6064
- swiftOrderParamsSignature,
6067
+ signedSwiftOrderParams,
6065
6068
  orderParams.marketIndex,
6066
6069
  takerInfo,
6067
6070
  undefined,
@@ -14651,5 +14651,8 @@
14651
14651
  "name": "InvalidLiquidateSpotWithSwap",
14652
14652
  "msg": "InvalidLiquidateSpotWithSwap"
14653
14653
  }
14654
- ]
14654
+ ],
14655
+ "metadata": {
14656
+ "address": "dRiftyHA39MWEi3m9aunc5MzRF1JYuBsbn6VPcn33UH"
14657
+ }
14655
14658
  }
@@ -115,7 +115,7 @@ export class SwiftOrderSubscriber {
115
115
  const order = JSON.parse(message['order']);
116
116
  const swiftOrderParamsBuf = Buffer.from(
117
117
  order['order_message'],
118
- 'base64'
118
+ 'hex'
119
119
  );
120
120
  const swiftOrderParamsMessage: SwiftOrderParamsMessage =
121
121
  this.driftClient.program.coder.types.decode(
@@ -153,10 +153,6 @@ export class SwiftOrderSubscriber {
153
153
  swiftOrderParamsMessage: SwiftOrderParamsMessage,
154
154
  makerOrderParams: OptionalOrderParams
155
155
  ): Promise<TransactionInstruction[]> {
156
- const swiftOrderParamsBuf = Buffer.from(
157
- orderMessageRaw['order_message'],
158
- 'base64'
159
- );
160
156
  const takerAuthority = new PublicKey(orderMessageRaw['taker_authority']);
161
157
  const takerUserPubkey = await getUserAccountPublicKey(
162
158
  this.driftClient.program.programId,
@@ -167,8 +163,10 @@ export class SwiftOrderSubscriber {
167
163
  await this.userMap.mustGet(takerUserPubkey.toString())
168
164
  ).getUserAccount();
169
165
  const ixs = await this.driftClient.getPlaceAndMakeSwiftPerpOrderIxs(
170
- swiftOrderParamsBuf,
171
- Buffer.from(orderMessageRaw['order_signature'], 'base64'),
166
+ {
167
+ orderParams: orderMessageRaw['order_message'],
168
+ signature: Buffer.from(orderMessageRaw['order_signature'], 'base64'),
169
+ },
172
170
  decodeUTF8(orderMessageRaw['uuid']),
173
171
  {
174
172
  taker: takerUserPubkey,
@@ -0,0 +1,16 @@
1
+ import { Buffer } from 'buffer';
2
+
3
+ /**
4
+ * Represents proof of a swift taker order
5
+ * It can be provided to drift program to fill a swift order
6
+ */
7
+ export interface SignedSwiftOrderParams {
8
+ /**
9
+ * The encoded order params that were signed (borsh encoded then hexified).
10
+ */
11
+ orderParams: Buffer;
12
+ /**
13
+ * The signature generated for the orderParams
14
+ */
15
+ signature: Buffer;
16
+ }
@@ -159,11 +159,16 @@ function printOrderNode(
159
159
  slot: number | undefined
160
160
  ) {
161
161
  console.log(
162
- ` . vAMMNode? ${node.isVammNode()},\t${node.order ? getVariant(node.order?.orderType) : '~'
163
- } ${node.order ? getVariant(node.order?.direction) : '~'}\t, slot: ${node.order?.slot.toString() || '~'
164
- }, orderId: ${node.order?.orderId.toString() || '~'},\tnode.getPrice: ${oracle ? node.getPrice(oracle, slot!) : '~'
165
- }, node.price: ${node.order?.price.toString() || '~'}, priceOffset: ${node.order?.oraclePriceOffset.toString() || '~'
166
- } quantity: ${node.order?.baseAssetAmountFilled.toString() || '~'}/${node.order?.baseAssetAmount.toString() || '~'
162
+ ` . vAMMNode? ${node.isVammNode()},\t${
163
+ node.order ? getVariant(node.order?.orderType) : '~'
164
+ } ${node.order ? getVariant(node.order?.direction) : '~'}\t, slot: ${
165
+ node.order?.slot.toString() || '~'
166
+ }, orderId: ${node.order?.orderId.toString() || '~'},\tnode.getPrice: ${
167
+ oracle ? node.getPrice(oracle, slot!) : '~'
168
+ }, node.price: ${node.order?.price.toString() || '~'}, priceOffset: ${
169
+ node.order?.oraclePriceOffset.toString() || '~'
170
+ } quantity: ${node.order?.baseAssetAmountFilled.toString() || '~'}/${
171
+ node.order?.baseAssetAmount.toString() || '~'
167
172
  }`
168
173
  );
169
174
  }
@@ -210,7 +215,8 @@ function printBookState(
210
215
 
211
216
  function printCrossedNodes(n: NodeToFill, slot: number) {
212
217
  console.log(
213
- `Cross Found, takerExists: ${n.node.order !== undefined}, makerExists: ${n.makerNodes !== undefined
218
+ `Cross Found, takerExists: ${n.node.order !== undefined}, makerExists: ${
219
+ n.makerNodes !== undefined
214
220
  }`
215
221
  );
216
222
  console.log(
@@ -232,8 +238,10 @@ function printCrossedNodes(n: NodeToFill, slot: number) {
232
238
  console.log(
233
239
  ` orderId: ${o.orderId}, ${getVariant(o.orderType)}, ${getVariant(
234
240
  o.direction
235
- )},\texpired: ${isOrderExpired(o, slot)}, postOnly: ${o.postOnly
236
- }, reduceOnly: ${o.reduceOnly
241
+ )},\texpired: ${isOrderExpired(o, slot)}, postOnly: ${
242
+ o.postOnly
243
+ }, reduceOnly: ${
244
+ o.reduceOnly
237
245
  }, price: ${o.price.toString()}, priceOffset: ${o.oraclePriceOffset.toString()}, baseAmtFileld: ${o.baseAssetAmountFilled.toString()}/${o.baseAssetAmount.toString()}`
238
246
  );
239
247
  };