flash-sdk 15.11.3-alpha.0 → 15.11.4-alpha.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.
@@ -16,7 +16,7 @@ export declare class CustodyAccount implements Custody {
16
16
  permissions: Permissions;
17
17
  fees: Fees;
18
18
  borrowRate: BorrowRateParams;
19
- rewardThreshold: BN;
19
+ tokenAmountMultiplier: BN;
20
20
  assets: Assets;
21
21
  feesStats: FeesStats;
22
22
  borrowRateState: BorrowRateState;
@@ -847,7 +847,7 @@ export declare class PerpetualsClient {
847
847
  instructions: TransactionInstruction[];
848
848
  additionalSigners: Signer[];
849
849
  }>;
850
- addCustody: (poolName: string, tokenMint: PublicKey, isToken22: boolean, isStable: boolean, isVirtual: boolean, oracle: OracleParams, pricing: PricingParams, permissions: Permissions, fees: Fees, borrowRate: BorrowRateParams, ratios: TokenRatios[], depegAdjustment: boolean, rewardThreshold: BN, minReserveUsd: BN, limitPriceBufferBps: BN, inversePrice: boolean) => Promise<{
850
+ addCustody: (poolName: string, tokenMint: PublicKey, isToken22: boolean, isStable: boolean, isVirtual: boolean, oracle: OracleParams, pricing: PricingParams, permissions: Permissions, fees: Fees, borrowRate: BorrowRateParams, ratios: TokenRatios[], depegAdjustment: boolean, tokenAmountMultiplier: BN, minReserveUsd: BN, limitPriceBufferBps: BN, inversePrice: boolean) => Promise<{
851
851
  instructions: TransactionInstruction[];
852
852
  additionalSigners: Signer[];
853
853
  }>;
@@ -968,7 +968,11 @@ export declare class PerpetualsClient {
968
968
  instructions: TransactionInstruction[];
969
969
  additionalSigners: Signer[];
970
970
  }>;
971
- setCustody: (poolName: string, tokenMint: PublicKey, isVirtual: boolean, depegAdjustment: boolean, inversePrice: boolean, oracle: OracleParams, pricingConfig: PricingParams, permissions: Permissions, fees: Fees, borrowRate: BorrowRateParams, ratios: TokenRatios[], rewardThreshold: BN, minReserveUsd: BN, limitPriceBufferBps: BN, token22: boolean) => Promise<{
971
+ setCustody: (poolName: string, tokenMint: PublicKey, isVirtual: boolean, depegAdjustment: boolean, inversePrice: boolean, oracle: OracleParams, pricingConfig: PricingParams, permissions: Permissions, fees: Fees, borrowRate: BorrowRateParams, ratios: TokenRatios[], minReserveUsd: BN, limitPriceBufferBps: BN, token22: boolean) => Promise<{
972
+ instructions: TransactionInstruction[];
973
+ additionalSigners: Signer[];
974
+ }>;
975
+ setCustodyTokenMultiplier: (poolName: string, tokenMint: PublicKey) => Promise<{
972
976
  instructions: TransactionInstruction[];
973
977
  additionalSigners: Signer[];
974
978
  }>;
@@ -6676,7 +6676,7 @@ var PerpetualsClient = (function () {
6676
6676
  _e.label = 4;
6677
6677
  case 4:
6678
6678
  if (_a) {
6679
- preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(payerPubkey, userReceivingTokenAccount, owner, poolConfig.getTokenFromSymbol(receivingSymbol).mintKey));
6679
+ preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(payerPubkey, userReceivingTokenAccount, owner, poolConfig.getTokenFromSymbol(receivingSymbol).mintKey, poolConfig.getTokenFromSymbol(receivingSymbol).isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID));
6680
6680
  }
6681
6681
  userReceivingTokenAccountCollateral = (0, spl_token_1.getAssociatedTokenAddressSync)(poolConfig.getTokenFromSymbol(collateralSymbol).mintKey, owner, true, poolConfig.getTokenFromSymbol(collateralSymbol).isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID);
6682
6682
  _b = createUserATA;
@@ -6687,7 +6687,7 @@ var PerpetualsClient = (function () {
6687
6687
  _e.label = 6;
6688
6688
  case 6:
6689
6689
  if (_b) {
6690
- preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(payerPubkey, userReceivingTokenAccountCollateral, owner, poolConfig.getTokenFromSymbol(collateralSymbol).mintKey));
6690
+ preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(payerPubkey, userReceivingTokenAccountCollateral, owner, poolConfig.getTokenFromSymbol(collateralSymbol).mintKey, poolConfig.getTokenFromSymbol(collateralSymbol).isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID));
6691
6691
  }
6692
6692
  _e.label = 7;
6693
6693
  case 7:
@@ -7371,7 +7371,7 @@ var PerpetualsClient = (function () {
7371
7371
  }
7372
7372
  });
7373
7373
  }); };
7374
- this.addCustody = function (poolName, tokenMint, isToken22, isStable, isVirtual, oracle, pricing, permissions, fees, borrowRate, ratios, depegAdjustment, rewardThreshold, minReserveUsd, limitPriceBufferBps, inversePrice) { return __awaiter(_this, void 0, void 0, function () {
7374
+ this.addCustody = function (poolName, tokenMint, isToken22, isStable, isVirtual, oracle, pricing, permissions, fees, borrowRate, ratios, depegAdjustment, tokenAmountMultiplier, minReserveUsd, limitPriceBufferBps, inversePrice) { return __awaiter(_this, void 0, void 0, function () {
7375
7375
  var preInstructions, instructions, postInstructions, additionalSigners, addCustodyInstruction, err_45;
7376
7376
  return __generator(this, function (_a) {
7377
7377
  switch (_a.label) {
@@ -7396,7 +7396,7 @@ var PerpetualsClient = (function () {
7396
7396
  fees: fees,
7397
7397
  borrowRate: borrowRate,
7398
7398
  ratios: ratios,
7399
- rewardThreshold: rewardThreshold,
7399
+ tokenAmountMultiplier: tokenAmountMultiplier,
7400
7400
  minReserveUsd: minReserveUsd,
7401
7401
  limitPriceBufferBps: limitPriceBufferBps
7402
7402
  })
@@ -8836,7 +8836,7 @@ var PerpetualsClient = (function () {
8836
8836
  }
8837
8837
  });
8838
8838
  }); };
8839
- this.setCustody = function (poolName, tokenMint, isVirtual, depegAdjustment, inversePrice, oracle, pricingConfig, permissions, fees, borrowRate, ratios, rewardThreshold, minReserveUsd, limitPriceBufferBps, token22) { return __awaiter(_this, void 0, void 0, function () {
8839
+ this.setCustody = function (poolName, tokenMint, isVirtual, depegAdjustment, inversePrice, oracle, pricingConfig, permissions, fees, borrowRate, ratios, minReserveUsd, limitPriceBufferBps, token22) { return __awaiter(_this, void 0, void 0, function () {
8840
8840
  var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setCustodyConfigInstruction, err_76;
8841
8841
  return __generator(this, function (_a) {
8842
8842
  switch (_a.label) {
@@ -8860,7 +8860,6 @@ var PerpetualsClient = (function () {
8860
8860
  fees: fees,
8861
8861
  borrowRate: borrowRate,
8862
8862
  ratios: ratios,
8863
- rewardThreshold: rewardThreshold,
8864
8863
  minReserveUsd: minReserveUsd,
8865
8864
  limitPriceBufferBps: limitPriceBufferBps,
8866
8865
  token22: token22
@@ -8890,8 +8889,47 @@ var PerpetualsClient = (function () {
8890
8889
  }
8891
8890
  });
8892
8891
  }); };
8892
+ this.setCustodyTokenMultiplier = function (poolName, tokenMint) { return __awaiter(_this, void 0, void 0, function () {
8893
+ var preInstructions, instructions, postInstructions, additionalSigners, ix, err_77;
8894
+ return __generator(this, function (_a) {
8895
+ switch (_a.label) {
8896
+ case 0:
8897
+ preInstructions = [];
8898
+ instructions = [];
8899
+ postInstructions = [];
8900
+ additionalSigners = [];
8901
+ _a.label = 1;
8902
+ case 1:
8903
+ _a.trys.push([1, 3, , 4]);
8904
+ return [4, this.program.methods
8905
+ .setCustodyTokenMultiplier({})
8906
+ .accountsPartial({
8907
+ admin: this.admin,
8908
+ multisig: this.multisig.publicKey,
8909
+ perpetuals: this.perpetuals.publicKey,
8910
+ pool: this.getPoolKey(poolName),
8911
+ custody: this.getCustodyKey(poolName, tokenMint),
8912
+ custodyTokenMint: tokenMint,
8913
+ systemProgram: web3_js_1.SystemProgram.programId,
8914
+ })
8915
+ .instruction()];
8916
+ case 2:
8917
+ ix = _a.sent();
8918
+ instructions.push(ix);
8919
+ return [3, 4];
8920
+ case 3:
8921
+ err_77 = _a.sent();
8922
+ console.log("perpClient setCustodyTokenMultiplier error:: ", err_77);
8923
+ throw err_77;
8924
+ case 4: return [2, {
8925
+ instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8926
+ additionalSigners: additionalSigners
8927
+ }];
8928
+ }
8929
+ });
8930
+ }); };
8893
8931
  this.addInternalOracle = function (exponent, lazerFeedId, tokenMint, intOracleAccount) { return __awaiter(_this, void 0, void 0, function () {
8894
- var preInstructions, instructions, postInstructions, additionalSigners, addInternalOracleInstruction, err_77;
8932
+ var preInstructions, instructions, postInstructions, additionalSigners, addInternalOracleInstruction, err_78;
8895
8933
  return __generator(this, function (_a) {
8896
8934
  switch (_a.label) {
8897
8935
  case 0:
@@ -8921,9 +8959,9 @@ var PerpetualsClient = (function () {
8921
8959
  instructions.push(addInternalOracleInstruction);
8922
8960
  return [3, 4];
8923
8961
  case 3:
8924
- err_77 = _a.sent();
8925
- console.log("perpClient setCustodyConfigInstruction error:: ", err_77);
8926
- throw err_77;
8962
+ err_78 = _a.sent();
8963
+ console.log("perpClient setCustodyConfigInstruction error:: ", err_78);
8964
+ throw err_78;
8927
8965
  case 4: return [2, {
8928
8966
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8929
8967
  additionalSigners: additionalSigners
@@ -8932,7 +8970,7 @@ var PerpetualsClient = (function () {
8932
8970
  });
8933
8971
  }); };
8934
8972
  this.setMarket = function (poolName, targetCustody, collateralCustody, marketAccount, maxPayoffBps, permissions, correlation) { return __awaiter(_this, void 0, void 0, function () {
8935
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setMarketConfigInstruction, err_78;
8973
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setMarketConfigInstruction, err_79;
8936
8974
  return __generator(this, function (_a) {
8937
8975
  switch (_a.label) {
8938
8976
  case 0:
@@ -8963,9 +9001,9 @@ var PerpetualsClient = (function () {
8963
9001
  instructions.push(setMarketConfigInstruction);
8964
9002
  return [3, 4];
8965
9003
  case 3:
8966
- err_78 = _a.sent();
8967
- console.log("perpClient setCustodyConfigInstruction error:: ", err_78);
8968
- throw err_78;
9004
+ err_79 = _a.sent();
9005
+ console.log("perpClient setCustodyConfigInstruction error:: ", err_79);
9006
+ throw err_79;
8969
9007
  case 4: return [2, {
8970
9008
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8971
9009
  additionalSigners: additionalSigners
@@ -8974,7 +9012,7 @@ var PerpetualsClient = (function () {
8974
9012
  });
8975
9013
  }); };
8976
9014
  this.removeMarket = function (poolName, market, targetMint, collateralMint) { return __awaiter(_this, void 0, void 0, function () {
8977
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, removeMarketInstruction, err_79;
9015
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, removeMarketInstruction, err_80;
8978
9016
  return __generator(this, function (_a) {
8979
9017
  switch (_a.label) {
8980
9018
  case 0:
@@ -9006,9 +9044,9 @@ var PerpetualsClient = (function () {
9006
9044
  instructions.push(removeMarketInstruction);
9007
9045
  return [3, 4];
9008
9046
  case 3:
9009
- err_79 = _a.sent();
9010
- console.log("perpClient setCustodyConfigInstruction error:: ", err_79);
9011
- throw err_79;
9047
+ err_80 = _a.sent();
9048
+ console.log("perpClient setCustodyConfigInstruction error:: ", err_80);
9049
+ throw err_80;
9012
9050
  case 4: return [2, {
9013
9051
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
9014
9052
  additionalSigners: additionalSigners
@@ -9017,7 +9055,7 @@ var PerpetualsClient = (function () {
9017
9055
  });
9018
9056
  }); };
9019
9057
  this.refreshPositionsStatus = function (positionAccounts) { return __awaiter(_this, void 0, void 0, function () {
9020
- var instructions, additionalSigners, remainingAccounts, refreshInstruction, err_80;
9058
+ var instructions, additionalSigners, remainingAccounts, refreshInstruction, err_81;
9021
9059
  return __generator(this, function (_a) {
9022
9060
  switch (_a.label) {
9023
9061
  case 0:
@@ -9044,9 +9082,9 @@ var PerpetualsClient = (function () {
9044
9082
  instructions.push(refreshInstruction);
9045
9083
  return [3, 4];
9046
9084
  case 3:
9047
- err_80 = _a.sent();
9048
- console.log("perpClient refreshPositionsStatus error:: ", err_80);
9049
- throw err_80;
9085
+ err_81 = _a.sent();
9086
+ console.log("perpClient refreshPositionsStatus error:: ", err_81);
9087
+ throw err_81;
9050
9088
  case 4: return [2, {
9051
9089
  instructions: __spreadArray([], instructions, true),
9052
9090
  additionalSigners: additionalSigners
@@ -9055,7 +9093,7 @@ var PerpetualsClient = (function () {
9055
9093
  });
9056
9094
  }); };
9057
9095
  this.refreshOrdersStatus = function (orderAccounts) { return __awaiter(_this, void 0, void 0, function () {
9058
- var instructions, additionalSigners, remainingAccounts, refreshInstruction, err_81;
9096
+ var instructions, additionalSigners, remainingAccounts, refreshInstruction, err_82;
9059
9097
  return __generator(this, function (_a) {
9060
9098
  switch (_a.label) {
9061
9099
  case 0:
@@ -9082,9 +9120,9 @@ var PerpetualsClient = (function () {
9082
9120
  instructions.push(refreshInstruction);
9083
9121
  return [3, 4];
9084
9122
  case 3:
9085
- err_81 = _a.sent();
9086
- console.log("perpClient refreshOrdersStatus error:: ", err_81);
9087
- throw err_81;
9123
+ err_82 = _a.sent();
9124
+ console.log("perpClient refreshOrdersStatus error:: ", err_82);
9125
+ throw err_82;
9088
9126
  case 4: return [2, {
9089
9127
  instructions: __spreadArray([], instructions, true),
9090
9128
  additionalSigners: additionalSigners
@@ -9093,7 +9131,7 @@ var PerpetualsClient = (function () {
9093
9131
  });
9094
9132
  }); };
9095
9133
  this.migrateMarketPosition = function (poolName, oldMarket, newMarket, oldCollateralCustody, newCollateralCustody, owner) { return __awaiter(_this, void 0, void 0, function () {
9096
- var preInstructions, instructions, postInstructions, additionalSigners, oldPosition, newPosition, oldCollateralCustodyAccount, newCollateralCustodyAccount, migrateMarketPositionInstruction, err_82;
9134
+ var preInstructions, instructions, postInstructions, additionalSigners, oldPosition, newPosition, oldCollateralCustodyAccount, newCollateralCustodyAccount, migrateMarketPositionInstruction, err_83;
9097
9135
  return __generator(this, function (_a) {
9098
9136
  switch (_a.label) {
9099
9137
  case 0:
@@ -9144,9 +9182,9 @@ var PerpetualsClient = (function () {
9144
9182
  instructions.push(migrateMarketPositionInstruction);
9145
9183
  return [3, 6];
9146
9184
  case 5:
9147
- err_82 = _a.sent();
9148
- console.log("perpClient migrateMarketPosition error:: ", err_82);
9149
- throw err_82;
9185
+ err_83 = _a.sent();
9186
+ console.log("perpClient migrateMarketPosition error:: ", err_83);
9187
+ throw err_83;
9150
9188
  case 6: return [2, {
9151
9189
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
9152
9190
  additionalSigners: additionalSigners
@@ -9160,7 +9198,7 @@ var PerpetualsClient = (function () {
9160
9198
  args_1[_i - 5] = arguments[_i];
9161
9199
  }
9162
9200
  return __awaiter(_this, __spreadArray([poolName_1, oldMarket_1, newMarket_1, oldCollateralCustody_1, newCollateralCustody_1], args_1, true), void 0, function (poolName, oldMarket, newMarket, oldCollateralCustody, newCollateralCustody, owner) {
9163
- var preInstructions, instructions, postInstructions, additionalSigners, oldOrder, newOrder, migrateMarketOrderInstruction, err_83;
9201
+ var preInstructions, instructions, postInstructions, additionalSigners, oldOrder, newOrder, migrateMarketOrderInstruction, err_84;
9164
9202
  if (owner === void 0) { owner = this.provider.wallet.publicKey; }
9165
9203
  return __generator(this, function (_a) {
9166
9204
  switch (_a.label) {
@@ -9202,9 +9240,9 @@ var PerpetualsClient = (function () {
9202
9240
  instructions.push(migrateMarketOrderInstruction);
9203
9241
  return [3, 4];
9204
9242
  case 3:
9205
- err_83 = _a.sent();
9206
- console.log("perpClient migrateMarketOrder error:: ", err_83);
9207
- throw err_83;
9243
+ err_84 = _a.sent();
9244
+ console.log("perpClient migrateMarketOrder error:: ", err_84);
9245
+ throw err_84;
9208
9246
  case 4: return [2, {
9209
9247
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
9210
9248
  additionalSigners: additionalSigners
@@ -9214,7 +9252,7 @@ var PerpetualsClient = (function () {
9214
9252
  });
9215
9253
  };
9216
9254
  this.forceSettlePosition = function (market, owner, receivingAccount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
9217
- var instructions, additionalSigners, marketAccount, targetCustody_1, collateralCustody_1, targetCustodyConfig, collateralCustodyConfig, positionAccount, orderAccount, remainingAccounts, orderAccountInfo, forceSettlePositionIx, err_84;
9255
+ var instructions, additionalSigners, marketAccount, targetCustody_1, collateralCustody_1, targetCustodyConfig, collateralCustodyConfig, positionAccount, orderAccount, remainingAccounts, orderAccountInfo, forceSettlePositionIx, err_85;
9218
9256
  return __generator(this, function (_a) {
9219
9257
  switch (_a.label) {
9220
9258
  case 0:
@@ -9278,9 +9316,9 @@ var PerpetualsClient = (function () {
9278
9316
  instructions.push(forceSettlePositionIx);
9279
9317
  return [3, 6];
9280
9318
  case 5:
9281
- err_84 = _a.sent();
9282
- console.log("perpClient forceSettlePosition error:: ", err_84);
9283
- throw err_84;
9319
+ err_85 = _a.sent();
9320
+ console.log("perpClient forceSettlePosition error:: ", err_85);
9321
+ throw err_85;
9284
9322
  case 6: return [2, {
9285
9323
  instructions: __spreadArray([], instructions, true),
9286
9324
  additionalSigners: additionalSigners
@@ -9289,7 +9327,7 @@ var PerpetualsClient = (function () {
9289
9327
  });
9290
9328
  }); };
9291
9329
  this.forceSettleOrder = function (market, owner, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
9292
- var instructions, additionalSigners, marketAccount, targetCustody, orderKey, orderAccount, uidToCustodyConfig, _i, _a, custodyConfig, custody, _b, activeLimitOrders, uniqueUids, _c, uniqueUids_1, uid, reserveCustodyConfig, isToken2022, receivingAccount, forceSettleOrderIx, reserveCustodyConfig, isToken2022, receivingAccount, forceSettleOrderIx, err_85;
9330
+ var instructions, additionalSigners, marketAccount, targetCustody, orderKey, orderAccount, uidToCustodyConfig, _i, _a, custodyConfig, custody, _b, activeLimitOrders, uniqueUids, _c, uniqueUids_1, uid, reserveCustodyConfig, isToken2022, receivingAccount, forceSettleOrderIx, reserveCustodyConfig, isToken2022, receivingAccount, forceSettleOrderIx, err_86;
9293
9331
  return __generator(this, function (_d) {
9294
9332
  switch (_d.label) {
9295
9333
  case 0:
@@ -9402,9 +9440,9 @@ var PerpetualsClient = (function () {
9402
9440
  _d.label = 15;
9403
9441
  case 15: return [3, 17];
9404
9442
  case 16:
9405
- err_85 = _d.sent();
9406
- console.log("perpClient forceSettleOrder error:: ", err_85);
9407
- throw err_85;
9443
+ err_86 = _d.sent();
9444
+ console.log("perpClient forceSettleOrder error:: ", err_86);
9445
+ throw err_86;
9408
9446
  case 17: return [2, {
9409
9447
  instructions: __spreadArray([], instructions, true),
9410
9448
  additionalSigners: additionalSigners