flash-sdk 15.11.2 → 15.11.3-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
- tokenAmountMultiplier: BN;
19
+ rewardThreshold: 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, tokenAmountMultiplier: 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, rewardThreshold: BN, minReserveUsd: BN, limitPriceBufferBps: BN, inversePrice: boolean) => Promise<{
851
851
  instructions: TransactionInstruction[];
852
852
  additionalSigners: Signer[];
853
853
  }>;
@@ -968,11 +968,7 @@ 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[], tokenAmountMultiplier: BN, minReserveUsd: BN, limitPriceBufferBps: BN, token22: boolean) => Promise<{
972
- instructions: TransactionInstruction[];
973
- additionalSigners: Signer[];
974
- }>;
975
- setCustodyTokenMultiplier: (poolName: string, tokenMint: PublicKey) => 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[], rewardThreshold: BN, minReserveUsd: BN, limitPriceBufferBps: BN, token22: boolean) => Promise<{
976
972
  instructions: TransactionInstruction[];
977
973
  additionalSigners: Signer[];
978
974
  }>;
@@ -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, poolConfig.getTokenFromSymbol(receivingSymbol).isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID));
6679
+ preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(payerPubkey, userReceivingTokenAccount, owner, poolConfig.getTokenFromSymbol(receivingSymbol).mintKey));
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, poolConfig.getTokenFromSymbol(collateralSymbol).isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID));
6690
+ preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(payerPubkey, userReceivingTokenAccountCollateral, owner, poolConfig.getTokenFromSymbol(collateralSymbol).mintKey));
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, tokenAmountMultiplier, 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, rewardThreshold, 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
- tokenAmountMultiplier: tokenAmountMultiplier,
7399
+ rewardThreshold: rewardThreshold,
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, tokenAmountMultiplier, 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, rewardThreshold, 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,7 @@ var PerpetualsClient = (function () {
8860
8860
  fees: fees,
8861
8861
  borrowRate: borrowRate,
8862
8862
  ratios: ratios,
8863
- tokenAmountMultiplier: tokenAmountMultiplier,
8863
+ rewardThreshold: rewardThreshold,
8864
8864
  minReserveUsd: minReserveUsd,
8865
8865
  limitPriceBufferBps: limitPriceBufferBps,
8866
8866
  token22: token22
@@ -8890,47 +8890,8 @@ var PerpetualsClient = (function () {
8890
8890
  }
8891
8891
  });
8892
8892
  }); };
8893
- this.setCustodyTokenMultiplier = function (poolName, tokenMint) { return __awaiter(_this, void 0, void 0, function () {
8894
- var preInstructions, instructions, postInstructions, additionalSigners, ix, err_77;
8895
- return __generator(this, function (_a) {
8896
- switch (_a.label) {
8897
- case 0:
8898
- preInstructions = [];
8899
- instructions = [];
8900
- postInstructions = [];
8901
- additionalSigners = [];
8902
- _a.label = 1;
8903
- case 1:
8904
- _a.trys.push([1, 3, , 4]);
8905
- return [4, this.program.methods
8906
- .setCustodyTokenMultiplier({})
8907
- .accountsPartial({
8908
- admin: this.admin,
8909
- multisig: this.multisig.publicKey,
8910
- perpetuals: this.perpetuals.publicKey,
8911
- pool: this.getPoolKey(poolName),
8912
- custody: this.getCustodyKey(poolName, tokenMint),
8913
- custodyTokenMint: tokenMint,
8914
- systemProgram: web3_js_1.SystemProgram.programId,
8915
- })
8916
- .instruction()];
8917
- case 2:
8918
- ix = _a.sent();
8919
- instructions.push(ix);
8920
- return [3, 4];
8921
- case 3:
8922
- err_77 = _a.sent();
8923
- console.log("perpClient setCustodyTokenMultiplier error:: ", err_77);
8924
- throw err_77;
8925
- case 4: return [2, {
8926
- instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8927
- additionalSigners: additionalSigners
8928
- }];
8929
- }
8930
- });
8931
- }); };
8932
8893
  this.addInternalOracle = function (exponent, lazerFeedId, tokenMint, intOracleAccount) { return __awaiter(_this, void 0, void 0, function () {
8933
- var preInstructions, instructions, postInstructions, additionalSigners, addInternalOracleInstruction, err_78;
8894
+ var preInstructions, instructions, postInstructions, additionalSigners, addInternalOracleInstruction, err_77;
8934
8895
  return __generator(this, function (_a) {
8935
8896
  switch (_a.label) {
8936
8897
  case 0:
@@ -8960,9 +8921,9 @@ var PerpetualsClient = (function () {
8960
8921
  instructions.push(addInternalOracleInstruction);
8961
8922
  return [3, 4];
8962
8923
  case 3:
8963
- err_78 = _a.sent();
8964
- console.log("perpClient setCustodyConfigInstruction error:: ", err_78);
8965
- throw err_78;
8924
+ err_77 = _a.sent();
8925
+ console.log("perpClient setCustodyConfigInstruction error:: ", err_77);
8926
+ throw err_77;
8966
8927
  case 4: return [2, {
8967
8928
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8968
8929
  additionalSigners: additionalSigners
@@ -8971,7 +8932,7 @@ var PerpetualsClient = (function () {
8971
8932
  });
8972
8933
  }); };
8973
8934
  this.setMarket = function (poolName, targetCustody, collateralCustody, marketAccount, maxPayoffBps, permissions, correlation) { return __awaiter(_this, void 0, void 0, function () {
8974
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setMarketConfigInstruction, err_79;
8935
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setMarketConfigInstruction, err_78;
8975
8936
  return __generator(this, function (_a) {
8976
8937
  switch (_a.label) {
8977
8938
  case 0:
@@ -9002,9 +8963,9 @@ var PerpetualsClient = (function () {
9002
8963
  instructions.push(setMarketConfigInstruction);
9003
8964
  return [3, 4];
9004
8965
  case 3:
9005
- err_79 = _a.sent();
9006
- console.log("perpClient setCustodyConfigInstruction error:: ", err_79);
9007
- throw err_79;
8966
+ err_78 = _a.sent();
8967
+ console.log("perpClient setCustodyConfigInstruction error:: ", err_78);
8968
+ throw err_78;
9008
8969
  case 4: return [2, {
9009
8970
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
9010
8971
  additionalSigners: additionalSigners
@@ -9013,7 +8974,7 @@ var PerpetualsClient = (function () {
9013
8974
  });
9014
8975
  }); };
9015
8976
  this.removeMarket = function (poolName, market, targetMint, collateralMint) { return __awaiter(_this, void 0, void 0, function () {
9016
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, removeMarketInstruction, err_80;
8977
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, removeMarketInstruction, err_79;
9017
8978
  return __generator(this, function (_a) {
9018
8979
  switch (_a.label) {
9019
8980
  case 0:
@@ -9045,9 +9006,9 @@ var PerpetualsClient = (function () {
9045
9006
  instructions.push(removeMarketInstruction);
9046
9007
  return [3, 4];
9047
9008
  case 3:
9048
- err_80 = _a.sent();
9049
- console.log("perpClient setCustodyConfigInstruction error:: ", err_80);
9050
- throw err_80;
9009
+ err_79 = _a.sent();
9010
+ console.log("perpClient setCustodyConfigInstruction error:: ", err_79);
9011
+ throw err_79;
9051
9012
  case 4: return [2, {
9052
9013
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
9053
9014
  additionalSigners: additionalSigners
@@ -9056,7 +9017,7 @@ var PerpetualsClient = (function () {
9056
9017
  });
9057
9018
  }); };
9058
9019
  this.refreshPositionsStatus = function (positionAccounts) { return __awaiter(_this, void 0, void 0, function () {
9059
- var instructions, additionalSigners, remainingAccounts, refreshInstruction, err_81;
9020
+ var instructions, additionalSigners, remainingAccounts, refreshInstruction, err_80;
9060
9021
  return __generator(this, function (_a) {
9061
9022
  switch (_a.label) {
9062
9023
  case 0:
@@ -9083,9 +9044,9 @@ var PerpetualsClient = (function () {
9083
9044
  instructions.push(refreshInstruction);
9084
9045
  return [3, 4];
9085
9046
  case 3:
9086
- err_81 = _a.sent();
9087
- console.log("perpClient refreshPositionsStatus error:: ", err_81);
9088
- throw err_81;
9047
+ err_80 = _a.sent();
9048
+ console.log("perpClient refreshPositionsStatus error:: ", err_80);
9049
+ throw err_80;
9089
9050
  case 4: return [2, {
9090
9051
  instructions: __spreadArray([], instructions, true),
9091
9052
  additionalSigners: additionalSigners
@@ -9094,7 +9055,7 @@ var PerpetualsClient = (function () {
9094
9055
  });
9095
9056
  }); };
9096
9057
  this.refreshOrdersStatus = function (orderAccounts) { return __awaiter(_this, void 0, void 0, function () {
9097
- var instructions, additionalSigners, remainingAccounts, refreshInstruction, err_82;
9058
+ var instructions, additionalSigners, remainingAccounts, refreshInstruction, err_81;
9098
9059
  return __generator(this, function (_a) {
9099
9060
  switch (_a.label) {
9100
9061
  case 0:
@@ -9121,9 +9082,9 @@ var PerpetualsClient = (function () {
9121
9082
  instructions.push(refreshInstruction);
9122
9083
  return [3, 4];
9123
9084
  case 3:
9124
- err_82 = _a.sent();
9125
- console.log("perpClient refreshOrdersStatus error:: ", err_82);
9126
- throw err_82;
9085
+ err_81 = _a.sent();
9086
+ console.log("perpClient refreshOrdersStatus error:: ", err_81);
9087
+ throw err_81;
9127
9088
  case 4: return [2, {
9128
9089
  instructions: __spreadArray([], instructions, true),
9129
9090
  additionalSigners: additionalSigners
@@ -9132,7 +9093,7 @@ var PerpetualsClient = (function () {
9132
9093
  });
9133
9094
  }); };
9134
9095
  this.migrateMarketPosition = function (poolName, oldMarket, newMarket, oldCollateralCustody, newCollateralCustody, owner) { return __awaiter(_this, void 0, void 0, function () {
9135
- var preInstructions, instructions, postInstructions, additionalSigners, oldPosition, newPosition, oldCollateralCustodyAccount, newCollateralCustodyAccount, migrateMarketPositionInstruction, err_83;
9096
+ var preInstructions, instructions, postInstructions, additionalSigners, oldPosition, newPosition, oldCollateralCustodyAccount, newCollateralCustodyAccount, migrateMarketPositionInstruction, err_82;
9136
9097
  return __generator(this, function (_a) {
9137
9098
  switch (_a.label) {
9138
9099
  case 0:
@@ -9183,9 +9144,9 @@ var PerpetualsClient = (function () {
9183
9144
  instructions.push(migrateMarketPositionInstruction);
9184
9145
  return [3, 6];
9185
9146
  case 5:
9186
- err_83 = _a.sent();
9187
- console.log("perpClient migrateMarketPosition error:: ", err_83);
9188
- throw err_83;
9147
+ err_82 = _a.sent();
9148
+ console.log("perpClient migrateMarketPosition error:: ", err_82);
9149
+ throw err_82;
9189
9150
  case 6: return [2, {
9190
9151
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
9191
9152
  additionalSigners: additionalSigners
@@ -9199,7 +9160,7 @@ var PerpetualsClient = (function () {
9199
9160
  args_1[_i - 5] = arguments[_i];
9200
9161
  }
9201
9162
  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) {
9202
- var preInstructions, instructions, postInstructions, additionalSigners, oldOrder, newOrder, migrateMarketOrderInstruction, err_84;
9163
+ var preInstructions, instructions, postInstructions, additionalSigners, oldOrder, newOrder, migrateMarketOrderInstruction, err_83;
9203
9164
  if (owner === void 0) { owner = this.provider.wallet.publicKey; }
9204
9165
  return __generator(this, function (_a) {
9205
9166
  switch (_a.label) {
@@ -9241,9 +9202,9 @@ var PerpetualsClient = (function () {
9241
9202
  instructions.push(migrateMarketOrderInstruction);
9242
9203
  return [3, 4];
9243
9204
  case 3:
9244
- err_84 = _a.sent();
9245
- console.log("perpClient migrateMarketOrder error:: ", err_84);
9246
- throw err_84;
9205
+ err_83 = _a.sent();
9206
+ console.log("perpClient migrateMarketOrder error:: ", err_83);
9207
+ throw err_83;
9247
9208
  case 4: return [2, {
9248
9209
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
9249
9210
  additionalSigners: additionalSigners
@@ -9253,7 +9214,7 @@ var PerpetualsClient = (function () {
9253
9214
  });
9254
9215
  };
9255
9216
  this.forceSettlePosition = function (market, owner, receivingAccount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
9256
- var instructions, additionalSigners, marketAccount, targetCustody_1, collateralCustody_1, targetCustodyConfig, collateralCustodyConfig, positionAccount, orderAccount, remainingAccounts, orderAccountInfo, forceSettlePositionIx, err_85;
9217
+ var instructions, additionalSigners, marketAccount, targetCustody_1, collateralCustody_1, targetCustodyConfig, collateralCustodyConfig, positionAccount, orderAccount, remainingAccounts, orderAccountInfo, forceSettlePositionIx, err_84;
9257
9218
  return __generator(this, function (_a) {
9258
9219
  switch (_a.label) {
9259
9220
  case 0:
@@ -9317,9 +9278,9 @@ var PerpetualsClient = (function () {
9317
9278
  instructions.push(forceSettlePositionIx);
9318
9279
  return [3, 6];
9319
9280
  case 5:
9320
- err_85 = _a.sent();
9321
- console.log("perpClient forceSettlePosition error:: ", err_85);
9322
- throw err_85;
9281
+ err_84 = _a.sent();
9282
+ console.log("perpClient forceSettlePosition error:: ", err_84);
9283
+ throw err_84;
9323
9284
  case 6: return [2, {
9324
9285
  instructions: __spreadArray([], instructions, true),
9325
9286
  additionalSigners: additionalSigners
@@ -9328,7 +9289,7 @@ var PerpetualsClient = (function () {
9328
9289
  });
9329
9290
  }); };
9330
9291
  this.forceSettleOrder = function (market, owner, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
9331
- 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;
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;
9332
9293
  return __generator(this, function (_d) {
9333
9294
  switch (_d.label) {
9334
9295
  case 0:
@@ -9441,9 +9402,9 @@ var PerpetualsClient = (function () {
9441
9402
  _d.label = 15;
9442
9403
  case 15: return [3, 17];
9443
9404
  case 16:
9444
- err_86 = _d.sent();
9445
- console.log("perpClient forceSettleOrder error:: ", err_86);
9446
- throw err_86;
9405
+ err_85 = _d.sent();
9406
+ console.log("perpClient forceSettleOrder error:: ", err_85);
9407
+ throw err_85;
9447
9408
  case 17: return [2, {
9448
9409
  instructions: __spreadArray([], instructions, true),
9449
9410
  additionalSigners: additionalSigners