flash-sdk 15.8.1 → 15.8.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.
@@ -6964,76 +6964,115 @@ var PerpetualsClient = (function () {
6964
6964
  }
6965
6965
  });
6966
6966
  }); };
6967
- this.addPool = function (name, maxAumUsd, permissions, metadataSymbol, metadataTitle, metadataUri, stakingFeeShareBps, vpVolumeFactor, stakingFeeBoostBps, minLpPriceUsd, maxLpPriceUsd, thresholdUsd) { return __awaiter(_this, void 0, void 0, function () {
6967
+ this.addPool = function (name, oracleAuthority, maxAumUsd, permissions, metadataSymbol, metadataTitle, metadataUri, stakingFeeShareBps, vpVolumeFactor, stakingFeeBoostBps, minLpPriceUsd, maxLpPriceUsd, thresholdUsd) { return __awaiter(_this, void 0, void 0, function () {
6968
+ var preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, metadataAccount, addPoolInstruction, err_44;
6968
6969
  return __generator(this, function (_a) {
6969
6970
  switch (_a.label) {
6970
- case 0: return [4, this.program.methods
6971
- .addPool({
6972
- name: name,
6973
- maxAumUsd: maxAumUsd,
6974
- permissions: permissions,
6975
- metadataSymbol: metadataSymbol,
6976
- metadataTitle: metadataTitle,
6977
- metadataUri: metadataUri,
6978
- stakingFeeShareBps: stakingFeeShareBps,
6979
- vpVolumeFactor: vpVolumeFactor,
6980
- stakingFeeBoostBps: stakingFeeBoostBps,
6981
- minLpPriceUsd: minLpPriceUsd,
6982
- maxLpPriceUsd: maxLpPriceUsd,
6983
- thresholdUsd: thresholdUsd
6984
- })
6985
- .accountsPartial({
6986
- admin: this.provider.wallet.publicKey,
6987
- multisig: this.multisig.publicKey,
6988
- transferAuthority: this.authority.publicKey,
6989
- perpetuals: this.perpetuals.publicKey,
6990
- pool: this.getPoolKey(name),
6991
- lpTokenMint: this.getPoolLpTokenKey(name),
6992
- systemProgram: web3_js_1.SystemProgram.programId,
6993
- tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
6994
- rent: web3_js_1.SYSVAR_RENT_PUBKEY,
6995
- })
6996
- .rpc()
6997
- .catch(function (err) {
6998
- console.error(err);
6999
- throw err;
7000
- })];
6971
+ case 0:
6972
+ preInstructions = [];
6973
+ instructions = [];
6974
+ postInstructions = [];
6975
+ additionalSigners = [];
6976
+ _a.label = 1;
7001
6977
  case 1:
7002
- _a.sent();
7003
- return [2];
6978
+ _a.trys.push([1, 3, , 4]);
6979
+ lpTokenMint = this.getPoolLpTokenKey(name);
6980
+ metadataAccount = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("metadata"), constants_1.METAPLEX_PROGRAM_ID.toBuffer(), lpTokenMint.toBuffer()], constants_1.METAPLEX_PROGRAM_ID)[0];
6981
+ return [4, this.program.methods
6982
+ .addPool({
6983
+ name: name,
6984
+ maxAumUsd: maxAumUsd,
6985
+ permissions: permissions,
6986
+ metadataSymbol: metadataSymbol,
6987
+ metadataTitle: metadataTitle,
6988
+ metadataUri: metadataUri,
6989
+ stakingFeeShareBps: stakingFeeShareBps,
6990
+ vpVolumeFactor: vpVolumeFactor,
6991
+ stakingFeeBoostBps: stakingFeeBoostBps,
6992
+ minLpPriceUsd: minLpPriceUsd,
6993
+ maxLpPriceUsd: maxLpPriceUsd,
6994
+ thresholdUsd: thresholdUsd
6995
+ })
6996
+ .accountsPartial({
6997
+ admin: this.provider.wallet.publicKey,
6998
+ oracleAuthority: oracleAuthority,
6999
+ multisig: this.multisig.publicKey,
7000
+ transferAuthority: this.authority.publicKey,
7001
+ perpetuals: this.perpetuals.publicKey,
7002
+ pool: this.getPoolKey(name),
7003
+ lpTokenMint: lpTokenMint,
7004
+ metadataAccount: metadataAccount,
7005
+ systemProgram: web3_js_1.SystemProgram.programId,
7006
+ tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
7007
+ metadataProgram: constants_1.METAPLEX_PROGRAM_ID,
7008
+ rent: web3_js_1.SYSVAR_RENT_PUBKEY,
7009
+ })
7010
+ .instruction()];
7011
+ case 2:
7012
+ addPoolInstruction = _a.sent();
7013
+ instructions.push(addPoolInstruction);
7014
+ return [3, 4];
7015
+ case 3:
7016
+ err_44 = _a.sent();
7017
+ console.log("perpClient addPool error:: ", err_44);
7018
+ throw err_44;
7019
+ case 4: return [2, {
7020
+ instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
7021
+ additionalSigners: additionalSigners
7022
+ }];
7004
7023
  }
7005
7024
  });
7006
7025
  }); };
7007
7026
  this.removePool = function (name) { return __awaiter(_this, void 0, void 0, function () {
7027
+ var preInstructions, instructions, postInstructions, additionalSigners, removePoolInstruction, err_45;
7008
7028
  return __generator(this, function (_a) {
7009
7029
  switch (_a.label) {
7010
- case 0: return [4, this.program.methods
7011
- .removePool({})
7012
- .accountsPartial({
7013
- admin: this.admin,
7014
- multisig: this.multisig.publicKey,
7015
- transferAuthority: this.authority.publicKey,
7016
- perpetuals: this.perpetuals.publicKey,
7017
- pool: this.getPoolKey(name),
7018
- systemProgram: web3_js_1.SystemProgram.programId,
7019
- })
7020
- .rpc()
7021
- .catch(function (err) {
7022
- console.error(err);
7023
- throw err;
7024
- })];
7030
+ case 0:
7031
+ preInstructions = [];
7032
+ instructions = [];
7033
+ postInstructions = [];
7034
+ additionalSigners = [];
7035
+ _a.label = 1;
7025
7036
  case 1:
7026
- _a.sent();
7027
- return [2];
7037
+ _a.trys.push([1, 3, , 4]);
7038
+ return [4, this.program.methods
7039
+ .removePool({})
7040
+ .accountsPartial({
7041
+ admin: this.admin,
7042
+ multisig: this.multisig.publicKey,
7043
+ transferAuthority: this.authority.publicKey,
7044
+ perpetuals: this.perpetuals.publicKey,
7045
+ pool: this.getPoolKey(name),
7046
+ systemProgram: web3_js_1.SystemProgram.programId,
7047
+ })
7048
+ .instruction()];
7049
+ case 2:
7050
+ removePoolInstruction = _a.sent();
7051
+ instructions.push(removePoolInstruction);
7052
+ return [3, 4];
7053
+ case 3:
7054
+ err_45 = _a.sent();
7055
+ console.log("perpClient removePool error:: ", err_45);
7056
+ throw err_45;
7057
+ case 4: return [2, {
7058
+ instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
7059
+ additionalSigners: additionalSigners
7060
+ }];
7028
7061
  }
7029
7062
  });
7030
7063
  }); };
7031
7064
  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 () {
7032
- var trx_id, error_3;
7065
+ var preInstructions, instructions, postInstructions, additionalSigners, addCustodyInstruction, err_46;
7033
7066
  return __generator(this, function (_a) {
7034
7067
  switch (_a.label) {
7035
7068
  case 0:
7036
- _a.trys.push([0, 2, , 3]);
7069
+ preInstructions = [];
7070
+ instructions = [];
7071
+ postInstructions = [];
7072
+ additionalSigners = [];
7073
+ _a.label = 1;
7074
+ case 1:
7075
+ _a.trys.push([1, 3, , 4]);
7037
7076
  return [4, this.program.methods
7038
7077
  .addCustody({
7039
7078
  isStable: isStable,
@@ -7061,67 +7100,78 @@ var PerpetualsClient = (function () {
7061
7100
  custodyTokenAccount: this.getCustodyTokenAccountKey(poolName, tokenMint),
7062
7101
  custodyTokenMint: tokenMint,
7063
7102
  systemProgram: web3_js_1.SystemProgram.programId,
7064
- tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
7103
+ tokenProgram: isToken22 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID,
7065
7104
  rent: web3_js_1.SYSVAR_RENT_PUBKEY,
7066
7105
  })
7067
- .rpc()
7068
- .catch(function (err) {
7069
- console.error(err);
7070
- throw err;
7071
- })];
7072
- case 1:
7073
- trx_id = _a.sent();
7074
- console.log("trx_id:", "https://explorer.solana.com/tx/".concat(trx_id, "?cluster=devnet"));
7075
- return [3, 3];
7106
+ .instruction()];
7076
7107
  case 2:
7077
- error_3 = _a.sent();
7078
- console.error("cli error :", error_3);
7079
- throw error_3;
7080
- case 3: return [2];
7108
+ addCustodyInstruction = _a.sent();
7109
+ instructions.push(addCustodyInstruction);
7110
+ return [3, 4];
7111
+ case 3:
7112
+ err_46 = _a.sent();
7113
+ console.log("perpClient addCustody error:: ", err_46);
7114
+ throw err_46;
7115
+ case 4: return [2, {
7116
+ instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
7117
+ additionalSigners: additionalSigners
7118
+ }];
7081
7119
  }
7082
7120
  });
7083
7121
  }); };
7084
7122
  this.editCustody = function (poolName, tokenMint, isStable, oracle, pricing, permissions, fees, borrowRate, ratios) { return __awaiter(_this, void 0, void 0, function () {
7085
- var trx_id;
7123
+ var preInstructions, instructions, postInstructions, additionalSigners, editCustodyInstruction, err_47;
7086
7124
  return __generator(this, function (_a) {
7087
7125
  switch (_a.label) {
7088
- case 0: return [4, this.program.methods
7089
- .testingEditCustody({
7090
- isStable: isStable,
7091
- oracle: oracle,
7092
- pricing: pricing,
7093
- permissions: permissions,
7094
- fees: fees,
7095
- borrowRate: borrowRate,
7096
- ratios: ratios,
7097
- })
7098
- .accountsPartial({
7099
- admin: this.admin,
7100
- multisig: this.multisig.publicKey,
7101
- transferAuthority: this.authority.publicKey,
7102
- perpetuals: this.perpetuals.publicKey,
7103
- pool: this.getPoolKey(poolName),
7104
- custody: this.getCustodyKey(poolName, tokenMint),
7105
- custodyTokenAccount: this.getCustodyTokenAccountKey(poolName, tokenMint),
7106
- custodyTokenMint: tokenMint,
7107
- systemProgram: web3_js_1.SystemProgram.programId,
7108
- tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
7109
- rent: web3_js_1.SYSVAR_RENT_PUBKEY,
7110
- })
7111
- .rpc()
7112
- .catch(function (err) {
7113
- console.error(err);
7114
- throw err;
7115
- })];
7126
+ case 0:
7127
+ preInstructions = [];
7128
+ instructions = [];
7129
+ postInstructions = [];
7130
+ additionalSigners = [];
7131
+ _a.label = 1;
7116
7132
  case 1:
7117
- trx_id = _a.sent();
7118
- console.log("trx_id:", "https://explorer.solana.com/tx/".concat(trx_id, "?cluster=devnet"));
7119
- return [2];
7133
+ _a.trys.push([1, 3, , 4]);
7134
+ return [4, this.program.methods
7135
+ .testingEditCustody({
7136
+ isStable: isStable,
7137
+ oracle: oracle,
7138
+ pricing: pricing,
7139
+ permissions: permissions,
7140
+ fees: fees,
7141
+ borrowRate: borrowRate,
7142
+ ratios: ratios,
7143
+ })
7144
+ .accountsPartial({
7145
+ admin: this.admin,
7146
+ multisig: this.multisig.publicKey,
7147
+ transferAuthority: this.authority.publicKey,
7148
+ perpetuals: this.perpetuals.publicKey,
7149
+ pool: this.getPoolKey(poolName),
7150
+ custody: this.getCustodyKey(poolName, tokenMint),
7151
+ custodyTokenAccount: this.getCustodyTokenAccountKey(poolName, tokenMint),
7152
+ custodyTokenMint: tokenMint,
7153
+ systemProgram: web3_js_1.SystemProgram.programId,
7154
+ tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
7155
+ rent: web3_js_1.SYSVAR_RENT_PUBKEY,
7156
+ })
7157
+ .instruction()];
7158
+ case 2:
7159
+ editCustodyInstruction = _a.sent();
7160
+ instructions.push(editCustodyInstruction);
7161
+ return [3, 4];
7162
+ case 3:
7163
+ err_47 = _a.sent();
7164
+ console.log("perpClient editCustody error:: ", err_47);
7165
+ throw err_47;
7166
+ case 4: return [2, {
7167
+ instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
7168
+ additionalSigners: additionalSigners
7169
+ }];
7120
7170
  }
7121
7171
  });
7122
7172
  }); };
7123
7173
  this.removeCustody = function (poolName, tokenMint, ratios, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7124
- var custodyConfig, token, tokenProgramId, preInstructions, userReceivingTokenAccount;
7174
+ var custodyConfig, token, tokenProgramId, preInstructions, instructions, postInstructions, additionalSigners, userReceivingTokenAccount, removeCustodyInstruction, err_48;
7125
7175
  return __generator(this, function (_a) {
7126
7176
  switch (_a.label) {
7127
7177
  case 0:
@@ -7132,15 +7182,20 @@ var PerpetualsClient = (function () {
7132
7182
  }
7133
7183
  tokenProgramId = token.isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID;
7134
7184
  preInstructions = [];
7185
+ instructions = [];
7186
+ postInstructions = [];
7187
+ additionalSigners = [];
7135
7188
  userReceivingTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(tokenMint, this.admin, true, tokenProgramId);
7136
7189
  return [4, (0, utils_1.checkIfAccountExists)(userReceivingTokenAccount, this.provider.connection)];
7137
7190
  case 1:
7138
7191
  if (!(_a.sent())) {
7139
7192
  preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(this.admin, userReceivingTokenAccount, this.admin, tokenMint, tokenProgramId));
7140
7193
  }
7194
+ _a.label = 2;
7195
+ case 2:
7196
+ _a.trys.push([2, 4, , 5]);
7141
7197
  return [4, this.program.methods
7142
7198
  .removeCustody({ ratios: ratios })
7143
- .preInstructions(preInstructions)
7144
7199
  .accountsPartial({
7145
7200
  admin: this.admin,
7146
7201
  receivingAccount: userReceivingTokenAccount,
@@ -7156,19 +7211,24 @@ var PerpetualsClient = (function () {
7156
7211
  ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
7157
7212
  receivingTokenMint: tokenMint,
7158
7213
  })
7159
- .rpc()
7160
- .catch(function (err) {
7161
- console.error(err);
7162
- throw err;
7163
- })];
7164
- case 2:
7165
- _a.sent();
7166
- return [2];
7214
+ .instruction()];
7215
+ case 3:
7216
+ removeCustodyInstruction = _a.sent();
7217
+ instructions.push(removeCustodyInstruction);
7218
+ return [3, 5];
7219
+ case 4:
7220
+ err_48 = _a.sent();
7221
+ console.log("perpClient removeCustody error:: ", err_48);
7222
+ throw err_48;
7223
+ case 5: return [2, {
7224
+ instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
7225
+ additionalSigners: additionalSigners
7226
+ }];
7167
7227
  }
7168
7228
  });
7169
7229
  }); };
7170
7230
  this.protocolWithdrawFees = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7171
- var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx, err_44;
7231
+ var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx, err_49;
7172
7232
  return __generator(this, function (_a) {
7173
7233
  switch (_a.label) {
7174
7234
  case 0:
@@ -7201,9 +7261,9 @@ var PerpetualsClient = (function () {
7201
7261
  instructions.push(withdrawFeesIx);
7202
7262
  return [3, 5];
7203
7263
  case 4:
7204
- err_44 = _a.sent();
7205
- console.log("perpClient setPool error:: ", err_44);
7206
- throw err_44;
7264
+ err_49 = _a.sent();
7265
+ console.log("perpClient setPool error:: ", err_49);
7266
+ throw err_49;
7207
7267
  case 5: return [2, {
7208
7268
  instructions: __spreadArray([], instructions, true),
7209
7269
  additionalSigners: additionalSigners
@@ -7212,7 +7272,7 @@ var PerpetualsClient = (function () {
7212
7272
  });
7213
7273
  }); };
7214
7274
  this.moveProtocolFees = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7215
- var publicKey, rewardCustodyConfig, instructions, additionalSigners, moveProtocolFeesIx, err_45;
7275
+ var publicKey, rewardCustodyConfig, instructions, additionalSigners, moveProtocolFeesIx, err_50;
7216
7276
  return __generator(this, function (_a) {
7217
7277
  switch (_a.label) {
7218
7278
  case 0:
@@ -7245,9 +7305,9 @@ var PerpetualsClient = (function () {
7245
7305
  instructions.push(moveProtocolFeesIx);
7246
7306
  return [3, 4];
7247
7307
  case 3:
7248
- err_45 = _a.sent();
7249
- console.log("perpClient setPool error:: ", err_45);
7250
- throw err_45;
7308
+ err_50 = _a.sent();
7309
+ console.log("perpClient setPool error:: ", err_50);
7310
+ throw err_50;
7251
7311
  case 4: return [2, {
7252
7312
  instructions: __spreadArray([], instructions, true),
7253
7313
  additionalSigners: additionalSigners
@@ -7256,7 +7316,7 @@ var PerpetualsClient = (function () {
7256
7316
  });
7257
7317
  }); };
7258
7318
  this.setProtocolFeeShareBps = function (feeShareBps, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7259
- var publicKey, setProtocolFeeShareBpsIx, err_46;
7319
+ var publicKey, setProtocolFeeShareBpsIx, err_51;
7260
7320
  return __generator(this, function (_a) {
7261
7321
  switch (_a.label) {
7262
7322
  case 0:
@@ -7276,15 +7336,15 @@ var PerpetualsClient = (function () {
7276
7336
  setProtocolFeeShareBpsIx = _a.sent();
7277
7337
  return [2, setProtocolFeeShareBpsIx];
7278
7338
  case 2:
7279
- err_46 = _a.sent();
7280
- console.log("perpClient setProtocolFeeShareBpsIx error:: ", err_46);
7281
- throw err_46;
7339
+ err_51 = _a.sent();
7340
+ console.log("perpClient setProtocolFeeShareBpsIx error:: ", err_51);
7341
+ throw err_51;
7282
7342
  case 3: return [2];
7283
7343
  }
7284
7344
  });
7285
7345
  }); };
7286
7346
  this.setPermissions = function (permissions) { return __awaiter(_this, void 0, void 0, function () {
7287
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction, err_47;
7347
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction, err_52;
7288
7348
  return __generator(this, function (_a) {
7289
7349
  switch (_a.label) {
7290
7350
  case 0:
@@ -7311,9 +7371,9 @@ var PerpetualsClient = (function () {
7311
7371
  instructions.push(setPermissionsInstruction);
7312
7372
  return [3, 4];
7313
7373
  case 3:
7314
- err_47 = _a.sent();
7315
- console.log("perpClient setPool error:: ", err_47);
7316
- throw err_47;
7374
+ err_52 = _a.sent();
7375
+ console.log("perpClient setPool error:: ", err_52);
7376
+ throw err_52;
7317
7377
  case 4: return [2, {
7318
7378
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
7319
7379
  additionalSigners: additionalSigners
@@ -7322,7 +7382,7 @@ var PerpetualsClient = (function () {
7322
7382
  });
7323
7383
  }); };
7324
7384
  this.reimburse = function (tokenMint, amountIn, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7325
- var custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, instructions, additionalSigners, custodyConfig, reimburse, _d, _e, err_48;
7385
+ var custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, instructions, additionalSigners, custodyConfig, reimburse, _d, _e, err_53;
7326
7386
  var _f;
7327
7387
  return __generator(this, function (_g) {
7328
7388
  switch (_g.label) {
@@ -7383,9 +7443,9 @@ var PerpetualsClient = (function () {
7383
7443
  instructions.push(reimburse);
7384
7444
  return [3, 5];
7385
7445
  case 4:
7386
- err_48 = _g.sent();
7387
- console.log("perpClient setPool error:: ", err_48);
7388
- throw err_48;
7446
+ err_53 = _g.sent();
7447
+ console.log("perpClient setPool error:: ", err_53);
7448
+ throw err_53;
7389
7449
  case 5: return [2, {
7390
7450
  instructions: __spreadArray([], instructions, true),
7391
7451
  additionalSigners: additionalSigners
@@ -7394,7 +7454,7 @@ var PerpetualsClient = (function () {
7394
7454
  });
7395
7455
  }); };
7396
7456
  this.setInternalOraclePriceBatch = function (useCurrentTime, tokenMintList, tokenInternalPrices, POOL_CONFIGS) { return __awaiter(_this, void 0, void 0, function () {
7397
- var ALL_CUSTODY_CONFIGS, accountMetas, _loop_1, _i, tokenMintList_1, tokenMint, instructions, additionalSigners, setInternalOraclePrice, err_49;
7457
+ var ALL_CUSTODY_CONFIGS, accountMetas, _loop_1, _i, tokenMintList_1, tokenMint, instructions, additionalSigners, setInternalOraclePrice, err_54;
7398
7458
  return __generator(this, function (_a) {
7399
7459
  switch (_a.label) {
7400
7460
  case 0:
@@ -7435,9 +7495,9 @@ var PerpetualsClient = (function () {
7435
7495
  instructions.push(setInternalOraclePrice);
7436
7496
  return [3, 4];
7437
7497
  case 3:
7438
- err_49 = _a.sent();
7439
- console.log("perpClient setInternalOracleAccount error:: ", err_49);
7440
- throw err_49;
7498
+ err_54 = _a.sent();
7499
+ console.log("perpClient setInternalOracleAccount error:: ", err_54);
7500
+ throw err_54;
7441
7501
  case 4: return [2, {
7442
7502
  instructions: __spreadArray([], instructions, true),
7443
7503
  additionalSigners: additionalSigners
@@ -7446,7 +7506,7 @@ var PerpetualsClient = (function () {
7446
7506
  });
7447
7507
  }); };
7448
7508
  this.setInternalLazerPriceBatch = function (messageData, tokenMintList, pythStorage, pythTreasury, POOL_CONFIGS) { return __awaiter(_this, void 0, void 0, function () {
7449
- var ALL_CUSTODY_CONFIGS, accountMetas, _loop_2, _i, tokenMintList_2, tokenMint, instructions, additionalSigners, setInternalLazerPrice, err_50;
7509
+ var ALL_CUSTODY_CONFIGS, accountMetas, _loop_2, _i, tokenMintList_2, tokenMint, instructions, additionalSigners, setInternalLazerPrice, err_55;
7450
7510
  return __generator(this, function (_a) {
7451
7511
  switch (_a.label) {
7452
7512
  case 0:
@@ -7487,9 +7547,9 @@ var PerpetualsClient = (function () {
7487
7547
  instructions.push(setInternalLazerPrice);
7488
7548
  return [3, 4];
7489
7549
  case 3:
7490
- err_50 = _a.sent();
7491
- console.log("perpClient setInternalLazerPriceBatch error:: ", err_50);
7492
- throw err_50;
7550
+ err_55 = _a.sent();
7551
+ console.log("perpClient setInternalLazerPriceBatch error:: ", err_55);
7552
+ throw err_55;
7493
7553
  case 4: return [2, {
7494
7554
  instructions: __spreadArray([], instructions, true),
7495
7555
  additionalSigners: additionalSigners
@@ -7498,7 +7558,7 @@ var PerpetualsClient = (function () {
7498
7558
  });
7499
7559
  }); };
7500
7560
  this.setInternalOracleEmaPriceBatch = function (tokenMintList, tokenInternalEmaPrices, POOL_CONFIGS) { return __awaiter(_this, void 0, void 0, function () {
7501
- var ALL_CUSTODY_CONFIGS, accountMetas, _loop_3, _i, tokenMintList_3, tokenMint, instructions, additionalSigners, setInternalOraclePrice, err_51;
7561
+ var ALL_CUSTODY_CONFIGS, accountMetas, _loop_3, _i, tokenMintList_3, tokenMint, instructions, additionalSigners, setInternalOraclePrice, err_56;
7502
7562
  return __generator(this, function (_a) {
7503
7563
  switch (_a.label) {
7504
7564
  case 0:
@@ -7538,9 +7598,9 @@ var PerpetualsClient = (function () {
7538
7598
  instructions.push(setInternalOraclePrice);
7539
7599
  return [3, 4];
7540
7600
  case 3:
7541
- err_51 = _a.sent();
7542
- console.log("perpClient setInternalOracleAccount error:: ", err_51);
7543
- throw err_51;
7601
+ err_56 = _a.sent();
7602
+ console.log("perpClient setInternalOracleAccount error:: ", err_56);
7603
+ throw err_56;
7544
7604
  case 4: return [2, {
7545
7605
  instructions: __spreadArray([], instructions, true),
7546
7606
  additionalSigners: additionalSigners
@@ -7549,7 +7609,7 @@ var PerpetualsClient = (function () {
7549
7609
  });
7550
7610
  }); };
7551
7611
  this.setPositionPriceImpact = function (positionPubkey, priceImpactUsd, penaltyAuthority) { return __awaiter(_this, void 0, void 0, function () {
7552
- var instructions, additionalSigners, setPositionPriceImpactIx, err_52;
7612
+ var instructions, additionalSigners, setPositionPriceImpactIx, err_57;
7553
7613
  return __generator(this, function (_a) {
7554
7614
  switch (_a.label) {
7555
7615
  case 0:
@@ -7573,9 +7633,9 @@ var PerpetualsClient = (function () {
7573
7633
  instructions.push(setPositionPriceImpactIx);
7574
7634
  return [3, 4];
7575
7635
  case 3:
7576
- err_52 = _a.sent();
7577
- console.log("perpClient setPositionPriceImpact error:: ", err_52);
7578
- throw err_52;
7636
+ err_57 = _a.sent();
7637
+ console.log("perpClient setPositionPriceImpact error:: ", err_57);
7638
+ throw err_57;
7579
7639
  case 4: return [2, {
7580
7640
  instructions: __spreadArray([], instructions, true),
7581
7641
  additionalSigners: additionalSigners
@@ -7584,7 +7644,7 @@ var PerpetualsClient = (function () {
7584
7644
  });
7585
7645
  }); };
7586
7646
  this.renameFlp = function (flag, lpTokenName, lpTokenSymbol, lpTokenUri, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7587
- var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp, err_53;
7647
+ var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp, err_58;
7588
7648
  return __generator(this, function (_a) {
7589
7649
  switch (_a.label) {
7590
7650
  case 0:
@@ -7622,8 +7682,8 @@ var PerpetualsClient = (function () {
7622
7682
  instructions.push(renameFlp);
7623
7683
  return [3, 4];
7624
7684
  case 3:
7625
- err_53 = _a.sent();
7626
- console.log("perpClient renameFlp error:: ", err_53);
7685
+ err_58 = _a.sent();
7686
+ console.log("perpClient renameFlp error:: ", err_58);
7627
7687
  return [3, 4];
7628
7688
  case 4: return [2, {
7629
7689
  instructions: __spreadArray([], instructions, true),
@@ -7633,7 +7693,7 @@ var PerpetualsClient = (function () {
7633
7693
  });
7634
7694
  }); };
7635
7695
  this.initStake = function (stakingFeeShareBps, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7636
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, stakedLpTokenAccount, rewardCustodyConfig, initStakeInstruction, err_54;
7696
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, lpTokenMint, stakedLpTokenAccount, rewardCustodyConfig, initStakeInstruction, err_59;
7637
7697
  return __generator(this, function (_a) {
7638
7698
  switch (_a.label) {
7639
7699
  case 0:
@@ -7671,9 +7731,9 @@ var PerpetualsClient = (function () {
7671
7731
  instructions.push(initStakeInstruction);
7672
7732
  return [3, 4];
7673
7733
  case 3:
7674
- err_54 = _a.sent();
7675
- console.log("perpClient InitStaking error:: ", err_54);
7676
- throw err_54;
7734
+ err_59 = _a.sent();
7735
+ console.log("perpClient InitStaking error:: ", err_59);
7736
+ throw err_59;
7677
7737
  case 4: return [2, {
7678
7738
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
7679
7739
  additionalSigners: additionalSigners
@@ -7682,7 +7742,7 @@ var PerpetualsClient = (function () {
7682
7742
  });
7683
7743
  }); };
7684
7744
  this.initCompounding = function (feeShareBps, metadataTitle, metadataSymbol, metadataUri, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7685
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, compoundingTokenMint, compoundingVault, metadataAccount, initCompoundingInstruction, err_55;
7745
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyConfig, compoundingTokenMint, compoundingVault, metadataAccount, initCompoundingInstruction, err_60;
7686
7746
  return __generator(this, function (_a) {
7687
7747
  switch (_a.label) {
7688
7748
  case 0:
@@ -7726,9 +7786,9 @@ var PerpetualsClient = (function () {
7726
7786
  instructions.push(initCompoundingInstruction);
7727
7787
  return [3, 4];
7728
7788
  case 3:
7729
- err_55 = _a.sent();
7730
- console.log("perpClient initCompounding error:: ", err_55);
7731
- throw err_55;
7789
+ err_60 = _a.sent();
7790
+ console.log("perpClient initCompounding error:: ", err_60);
7791
+ throw err_60;
7732
7792
  case 4: return [2, {
7733
7793
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
7734
7794
  additionalSigners: additionalSigners
@@ -7737,7 +7797,7 @@ var PerpetualsClient = (function () {
7737
7797
  });
7738
7798
  }); };
7739
7799
  this.initTokenVault = function (token_permissions, tokens_to_distribute, withdrawTimeLimit, withdrawInstantFee, stakeLevel, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7740
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenMint, fundingTokenAccount, initTokenVaultInstruction, err_56;
7800
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenMint, fundingTokenAccount, initTokenVaultInstruction, err_61;
7741
7801
  return __generator(this, function (_a) {
7742
7802
  switch (_a.label) {
7743
7803
  case 0:
@@ -7778,9 +7838,9 @@ var PerpetualsClient = (function () {
7778
7838
  instructions.push(initTokenVaultInstruction);
7779
7839
  return [3, 4];
7780
7840
  case 3:
7781
- err_56 = _a.sent();
7782
- console.log("perpClient InitTokenVaultInstruction error:: ", err_56);
7783
- throw err_56;
7841
+ err_61 = _a.sent();
7842
+ console.log("perpClient InitTokenVaultInstruction error:: ", err_61);
7843
+ throw err_61;
7784
7844
  case 4: return [2, {
7785
7845
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
7786
7846
  additionalSigners: additionalSigners
@@ -7789,7 +7849,7 @@ var PerpetualsClient = (function () {
7789
7849
  });
7790
7850
  }); };
7791
7851
  this.setTokenVaultConfig = function (token_permissions, withdrawTimeLimit, withdrawInstantFee, stakeLevel, unlockPeriod, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7792
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setTokenVaultConfigInstruction, err_57;
7852
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setTokenVaultConfigInstruction, err_62;
7793
7853
  return __generator(this, function (_a) {
7794
7854
  switch (_a.label) {
7795
7855
  case 0:
@@ -7821,9 +7881,9 @@ var PerpetualsClient = (function () {
7821
7881
  instructions.push(setTokenVaultConfigInstruction);
7822
7882
  return [3, 4];
7823
7883
  case 3:
7824
- err_57 = _a.sent();
7825
- console.log("perpClient setTokenVaultConfigInstruction error:: ", err_57);
7826
- throw err_57;
7884
+ err_62 = _a.sent();
7885
+ console.log("perpClient setTokenVaultConfigInstruction error:: ", err_62);
7886
+ throw err_62;
7827
7887
  case 4: return [2, {
7828
7888
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
7829
7889
  additionalSigners: additionalSigners
@@ -7832,7 +7892,7 @@ var PerpetualsClient = (function () {
7832
7892
  });
7833
7893
  }); };
7834
7894
  this.withdrawInstantFee = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7835
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawInstantFeeInstruction, err_58;
7895
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawInstantFeeInstruction, err_63;
7836
7896
  return __generator(this, function (_a) {
7837
7897
  switch (_a.label) {
7838
7898
  case 0:
@@ -7871,9 +7931,9 @@ var PerpetualsClient = (function () {
7871
7931
  instructions.push(withdrawInstantFeeInstruction);
7872
7932
  return [3, 6];
7873
7933
  case 5:
7874
- err_58 = _a.sent();
7875
- console.log("perpClient withdrawInstantFeeInstruction error:: ", err_58);
7876
- throw err_58;
7934
+ err_63 = _a.sent();
7935
+ console.log("perpClient withdrawInstantFeeInstruction error:: ", err_63);
7936
+ throw err_63;
7877
7937
  case 6: return [2, {
7878
7938
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
7879
7939
  additionalSigners: additionalSigners
@@ -7882,7 +7942,7 @@ var PerpetualsClient = (function () {
7882
7942
  });
7883
7943
  }); };
7884
7944
  this.withdrawUnclaimedTokens = function (poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7885
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawUnclaimedTokensInstruction, err_59;
7945
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, receivingTokenAccount, withdrawUnclaimedTokensInstruction, err_64;
7886
7946
  return __generator(this, function (_a) {
7887
7947
  switch (_a.label) {
7888
7948
  case 0:
@@ -7921,9 +7981,9 @@ var PerpetualsClient = (function () {
7921
7981
  instructions.push(withdrawUnclaimedTokensInstruction);
7922
7982
  return [3, 6];
7923
7983
  case 5:
7924
- err_59 = _a.sent();
7925
- console.log("perpClient withdrawUnclaimedTokensInstruction error:: ", err_59);
7926
- throw err_59;
7984
+ err_64 = _a.sent();
7985
+ console.log("perpClient withdrawUnclaimedTokensInstruction error:: ", err_64);
7986
+ throw err_64;
7927
7987
  case 6: return [2, {
7928
7988
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
7929
7989
  additionalSigners: additionalSigners
@@ -7932,7 +7992,7 @@ var PerpetualsClient = (function () {
7932
7992
  });
7933
7993
  }); };
7934
7994
  this.initRevenueTokenAccount = function (feeShareBps, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7935
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, initRevenueTokenAccountInstruction, err_60;
7995
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, initRevenueTokenAccountInstruction, err_65;
7936
7996
  return __generator(this, function (_a) {
7937
7997
  switch (_a.label) {
7938
7998
  case 0:
@@ -7969,9 +8029,9 @@ var PerpetualsClient = (function () {
7969
8029
  instructions.push(initRevenueTokenAccountInstruction);
7970
8030
  return [3, 4];
7971
8031
  case 3:
7972
- err_60 = _a.sent();
7973
- console.log("perpClient initRevenueTokenAccountInstruction error:: ", err_60);
7974
- throw err_60;
8032
+ err_65 = _a.sent();
8033
+ console.log("perpClient initRevenueTokenAccountInstruction error:: ", err_65);
8034
+ throw err_65;
7975
8035
  case 4: return [2, {
7976
8036
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
7977
8037
  additionalSigners: additionalSigners
@@ -7980,7 +8040,7 @@ var PerpetualsClient = (function () {
7980
8040
  });
7981
8041
  }); };
7982
8042
  this.initRebateVault = function (allowRebatePayout, rebateSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7983
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rebateCustodyMint, initRebateVaultInstruction, err_61;
8043
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rebateCustodyMint, initRebateVaultInstruction, err_66;
7984
8044
  return __generator(this, function (_a) {
7985
8045
  switch (_a.label) {
7986
8046
  case 0:
@@ -8015,9 +8075,9 @@ var PerpetualsClient = (function () {
8015
8075
  instructions.push(initRebateVaultInstruction);
8016
8076
  return [3, 4];
8017
8077
  case 3:
8018
- err_61 = _a.sent();
8019
- console.log("perpClient initRebateVaultInstruction error:: ", err_61);
8020
- throw err_61;
8078
+ err_66 = _a.sent();
8079
+ console.log("perpClient initRebateVaultInstruction error:: ", err_66);
8080
+ throw err_66;
8021
8081
  case 4: return [2, {
8022
8082
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8023
8083
  additionalSigners: additionalSigners
@@ -8026,7 +8086,7 @@ var PerpetualsClient = (function () {
8026
8086
  });
8027
8087
  }); };
8028
8088
  this.distributeTokenReward = function (amount, epochCount, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
8029
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, fundingTokenAccount, revenueFundingTokenAccount, distributeTokenRewardInstruction, err_62;
8089
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustodyMint, fundingTokenAccount, revenueFundingTokenAccount, distributeTokenRewardInstruction, err_67;
8030
8090
  return __generator(this, function (_a) {
8031
8091
  switch (_a.label) {
8032
8092
  case 0:
@@ -8063,9 +8123,9 @@ var PerpetualsClient = (function () {
8063
8123
  instructions.push(distributeTokenRewardInstruction);
8064
8124
  return [3, 4];
8065
8125
  case 3:
8066
- err_62 = _a.sent();
8067
- console.log("perpClient distributeTokenRewardInstruction error:: ", err_62);
8068
- throw err_62;
8126
+ err_67 = _a.sent();
8127
+ console.log("perpClient distributeTokenRewardInstruction error:: ", err_67);
8128
+ throw err_67;
8069
8129
  case 4: return [2, {
8070
8130
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8071
8131
  additionalSigners: additionalSigners
@@ -8074,7 +8134,7 @@ var PerpetualsClient = (function () {
8074
8134
  });
8075
8135
  }); };
8076
8136
  this.setTokenStakeLevel = function (owner, stakeLevel, isInitialized) { return __awaiter(_this, void 0, void 0, function () {
8077
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenStakeLevelInstruction, err_63;
8137
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenStakeLevelInstruction, err_68;
8078
8138
  return __generator(this, function (_a) {
8079
8139
  switch (_a.label) {
8080
8140
  case 0:
@@ -8103,9 +8163,9 @@ var PerpetualsClient = (function () {
8103
8163
  instructions.push(setTokenStakeLevelInstruction);
8104
8164
  return [3, 4];
8105
8165
  case 3:
8106
- err_63 = _a.sent();
8107
- console.log("perpClient setTokenStakeLevelInstruction error:: ", err_63);
8108
- throw err_63;
8166
+ err_68 = _a.sent();
8167
+ console.log("perpClient setTokenStakeLevelInstruction error:: ", err_68);
8168
+ throw err_68;
8109
8169
  case 4: return [2, {
8110
8170
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8111
8171
  additionalSigners: additionalSigners
@@ -8114,7 +8174,7 @@ var PerpetualsClient = (function () {
8114
8174
  });
8115
8175
  }); };
8116
8176
  this.setTokenReward = function (owner, amount, epochCount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
8117
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenRewardInstruction, err_64;
8177
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, setTokenRewardInstruction, err_69;
8118
8178
  return __generator(this, function (_a) {
8119
8179
  switch (_a.label) {
8120
8180
  case 0:
@@ -8145,9 +8205,9 @@ var PerpetualsClient = (function () {
8145
8205
  instructions.push(setTokenRewardInstruction);
8146
8206
  return [3, 4];
8147
8207
  case 3:
8148
- err_64 = _a.sent();
8149
- console.log("perpClient setTokenRewardInstruction error:: ", err_64);
8150
- throw err_64;
8208
+ err_69 = _a.sent();
8209
+ console.log("perpClient setTokenRewardInstruction error:: ", err_69);
8210
+ throw err_69;
8151
8211
  case 4: return [2, {
8152
8212
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8153
8213
  additionalSigners: additionalSigners
@@ -8156,7 +8216,7 @@ var PerpetualsClient = (function () {
8156
8216
  });
8157
8217
  }); };
8158
8218
  this.resizeInternalOracle = function (lazerFeedId, tokenMint, intOracleAccount) { return __awaiter(_this, void 0, void 0, function () {
8159
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, resizeInternalOracleInstruction, err_65;
8219
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, resizeInternalOracleInstruction, err_70;
8160
8220
  return __generator(this, function (_a) {
8161
8221
  switch (_a.label) {
8162
8222
  case 0:
@@ -8185,9 +8245,9 @@ var PerpetualsClient = (function () {
8185
8245
  instructions.push(resizeInternalOracleInstruction);
8186
8246
  return [3, 4];
8187
8247
  case 3:
8188
- err_65 = _a.sent();
8189
- console.log("perpClient resizeInternalOracleInstruction error:: ", err_65);
8190
- throw err_65;
8248
+ err_70 = _a.sent();
8249
+ console.log("perpClient resizeInternalOracleInstruction error:: ", err_70);
8250
+ throw err_70;
8191
8251
  case 4: return [2, {
8192
8252
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8193
8253
  additionalSigners: additionalSigners
@@ -8196,7 +8256,7 @@ var PerpetualsClient = (function () {
8196
8256
  });
8197
8257
  }); };
8198
8258
  this.createWhitelist = function (isSwapFeeExempt, isDepositFeeExempt, isWithdrawalFeeExempt, poolAddress, owner) { return __awaiter(_this, void 0, void 0, function () {
8199
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, createWhitelistInstruction, err_66;
8259
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, createWhitelistInstruction, err_71;
8200
8260
  return __generator(this, function (_a) {
8201
8261
  switch (_a.label) {
8202
8262
  case 0:
@@ -8229,9 +8289,9 @@ var PerpetualsClient = (function () {
8229
8289
  instructions.push(createWhitelistInstruction);
8230
8290
  return [3, 4];
8231
8291
  case 3:
8232
- err_66 = _a.sent();
8233
- console.log("perpClient createWhitelistInstruction error:: ", err_66);
8234
- throw err_66;
8292
+ err_71 = _a.sent();
8293
+ console.log("perpClient createWhitelistInstruction error:: ", err_71);
8294
+ throw err_71;
8235
8295
  case 4: return [2, {
8236
8296
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8237
8297
  additionalSigners: additionalSigners
@@ -8240,7 +8300,7 @@ var PerpetualsClient = (function () {
8240
8300
  });
8241
8301
  }); };
8242
8302
  this.setWhitelistConfig = function (isSwapFeeExempt, isDepositFeeExempt, isWithdrawalFeeExempt, poolAddress, owner) { return __awaiter(_this, void 0, void 0, function () {
8243
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, setWhitelistConfigInstruction, err_67;
8303
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, setWhitelistConfigInstruction, err_72;
8244
8304
  return __generator(this, function (_a) {
8245
8305
  switch (_a.label) {
8246
8306
  case 0:
@@ -8273,9 +8333,9 @@ var PerpetualsClient = (function () {
8273
8333
  instructions.push(setWhitelistConfigInstruction);
8274
8334
  return [3, 4];
8275
8335
  case 3:
8276
- err_67 = _a.sent();
8277
- console.log("perpClient setWhitelistConfigInstruction error:: ", err_67);
8278
- throw err_67;
8336
+ err_72 = _a.sent();
8337
+ console.log("perpClient setWhitelistConfigInstruction error:: ", err_72);
8338
+ throw err_72;
8279
8339
  case 4: return [2, {
8280
8340
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8281
8341
  additionalSigners: additionalSigners
@@ -8284,7 +8344,7 @@ var PerpetualsClient = (function () {
8284
8344
  });
8285
8345
  }); };
8286
8346
  this.setPerpetualsConfig = function (allowUngatedTrading, voltageMultiplier, tradingDiscount, referralRebate, defaultRebate, tradeLimit, triggerOrderLimit, rebateLimitUsd) { return __awaiter(_this, void 0, void 0, function () {
8287
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPerpetualsConfigInstruction, err_68;
8347
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPerpetualsConfigInstruction, err_73;
8288
8348
  return __generator(this, function (_a) {
8289
8349
  switch (_a.label) {
8290
8350
  case 0:
@@ -8318,9 +8378,9 @@ var PerpetualsClient = (function () {
8318
8378
  instructions.push(setPerpetualsConfigInstruction);
8319
8379
  return [3, 4];
8320
8380
  case 3:
8321
- err_68 = _a.sent();
8322
- console.log("perpClient setPerpetualsConfigInstruction error:: ", err_68);
8323
- throw err_68;
8381
+ err_73 = _a.sent();
8382
+ console.log("perpClient setPerpetualsConfigInstruction error:: ", err_73);
8383
+ throw err_73;
8324
8384
  case 4: return [2, {
8325
8385
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8326
8386
  additionalSigners: additionalSigners
@@ -8329,7 +8389,7 @@ var PerpetualsClient = (function () {
8329
8389
  });
8330
8390
  }); };
8331
8391
  this.setPoolConfig = function (name, permissions, maxAumUsd, oracleAuthority, stakingFeeShareBps, vpVolumeFactor, stakingFeeBoostBps, minLpPriceUsd, maxLpPriceUsd, thresholdUsd) { return __awaiter(_this, void 0, void 0, function () {
8332
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPoolConfigInstruction, err_69;
8392
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPoolConfigInstruction, err_74;
8333
8393
  return __generator(this, function (_a) {
8334
8394
  switch (_a.label) {
8335
8395
  case 0:
@@ -8357,9 +8417,9 @@ var PerpetualsClient = (function () {
8357
8417
  instructions.push(setPoolConfigInstruction);
8358
8418
  return [3, 4];
8359
8419
  case 3:
8360
- err_69 = _a.sent();
8361
- console.log("perpClient setPoolConfigInstruction error:: ", err_69);
8362
- throw err_69;
8420
+ err_74 = _a.sent();
8421
+ console.log("perpClient setPoolConfigInstruction error:: ", err_74);
8422
+ throw err_74;
8363
8423
  case 4: return [2, {
8364
8424
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8365
8425
  additionalSigners: additionalSigners
@@ -8368,7 +8428,7 @@ var PerpetualsClient = (function () {
8368
8428
  });
8369
8429
  }); };
8370
8430
  this.addCustodyToken22 = function (poolName, tokenMint, tokenAccountSpace, token22) { return __awaiter(_this, void 0, void 0, function () {
8371
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, addCustodyToken22Instruction, err_70;
8431
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, addCustodyToken22Instruction, err_75;
8372
8432
  return __generator(this, function (_a) {
8373
8433
  switch (_a.label) {
8374
8434
  case 0:
@@ -8402,9 +8462,9 @@ var PerpetualsClient = (function () {
8402
8462
  instructions.push(addCustodyToken22Instruction);
8403
8463
  return [3, 4];
8404
8464
  case 3:
8405
- err_70 = _a.sent();
8406
- console.log("perpClient addCustodyToken22Instruction error:: ", err_70);
8407
- throw err_70;
8465
+ err_75 = _a.sent();
8466
+ console.log("perpClient addCustodyToken22Instruction error:: ", err_75);
8467
+ throw err_75;
8408
8468
  case 4: return [2, {
8409
8469
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8410
8470
  additionalSigners: additionalSigners
@@ -8413,7 +8473,7 @@ var PerpetualsClient = (function () {
8413
8473
  });
8414
8474
  }); };
8415
8475
  this.addMarket = function (poolName, targetCustody, collateralCustody, side, correlation, maxPayoffBps, permissions) { return __awaiter(_this, void 0, void 0, function () {
8416
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, market, addMarketInstruction, err_71;
8476
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, market, addMarketInstruction, err_76;
8417
8477
  return __generator(this, function (_a) {
8418
8478
  switch (_a.label) {
8419
8479
  case 0:
@@ -8456,9 +8516,9 @@ var PerpetualsClient = (function () {
8456
8516
  instructions.push(addMarketInstruction);
8457
8517
  return [3, 4];
8458
8518
  case 3:
8459
- err_71 = _a.sent();
8460
- console.log("perpClient addMarketInstruction error:: ", err_71);
8461
- throw err_71;
8519
+ err_76 = _a.sent();
8520
+ console.log("perpClient addMarketInstruction error:: ", err_76);
8521
+ throw err_76;
8462
8522
  case 4: return [2, {
8463
8523
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8464
8524
  additionalSigners: additionalSigners
@@ -8467,7 +8527,7 @@ var PerpetualsClient = (function () {
8467
8527
  });
8468
8528
  }); };
8469
8529
  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 () {
8470
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setCustodyConfigInstruction, err_72;
8530
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setCustodyConfigInstruction, err_77;
8471
8531
  return __generator(this, function (_a) {
8472
8532
  switch (_a.label) {
8473
8533
  case 0:
@@ -8510,9 +8570,9 @@ var PerpetualsClient = (function () {
8510
8570
  instructions.push(setCustodyConfigInstruction);
8511
8571
  return [3, 4];
8512
8572
  case 3:
8513
- err_72 = _a.sent();
8514
- console.log("perpClient setCustodyConfigInstruction error:: ", err_72);
8515
- throw err_72;
8573
+ err_77 = _a.sent();
8574
+ console.log("perpClient setCustodyConfigInstruction error:: ", err_77);
8575
+ throw err_77;
8516
8576
  case 4: return [2, {
8517
8577
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8518
8578
  additionalSigners: additionalSigners
@@ -8521,7 +8581,7 @@ var PerpetualsClient = (function () {
8521
8581
  });
8522
8582
  }); };
8523
8583
  this.addInternalOracle = function (exponent, lazerFeedId, tokenMint, intOracleAccount) { return __awaiter(_this, void 0, void 0, function () {
8524
- var preInstructions, instructions, postInstructions, additionalSigners, addInternalOracleInstruction, err_73;
8584
+ var preInstructions, instructions, postInstructions, additionalSigners, addInternalOracleInstruction, err_78;
8525
8585
  return __generator(this, function (_a) {
8526
8586
  switch (_a.label) {
8527
8587
  case 0:
@@ -8551,9 +8611,9 @@ var PerpetualsClient = (function () {
8551
8611
  instructions.push(addInternalOracleInstruction);
8552
8612
  return [3, 4];
8553
8613
  case 3:
8554
- err_73 = _a.sent();
8555
- console.log("perpClient setCustodyConfigInstruction error:: ", err_73);
8556
- throw err_73;
8614
+ err_78 = _a.sent();
8615
+ console.log("perpClient setCustodyConfigInstruction error:: ", err_78);
8616
+ throw err_78;
8557
8617
  case 4: return [2, {
8558
8618
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8559
8619
  additionalSigners: additionalSigners
@@ -8562,7 +8622,7 @@ var PerpetualsClient = (function () {
8562
8622
  });
8563
8623
  }); };
8564
8624
  this.setMarket = function (poolName, targetCustody, collateralCustody, marketAccount, maxPayoffBps, permissions, correlation) { return __awaiter(_this, void 0, void 0, function () {
8565
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setMarketConfigInstruction, err_74;
8625
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setMarketConfigInstruction, err_79;
8566
8626
  return __generator(this, function (_a) {
8567
8627
  switch (_a.label) {
8568
8628
  case 0:
@@ -8593,9 +8653,9 @@ var PerpetualsClient = (function () {
8593
8653
  instructions.push(setMarketConfigInstruction);
8594
8654
  return [3, 4];
8595
8655
  case 3:
8596
- err_74 = _a.sent();
8597
- console.log("perpClient setCustodyConfigInstruction error:: ", err_74);
8598
- throw err_74;
8656
+ err_79 = _a.sent();
8657
+ console.log("perpClient setCustodyConfigInstruction error:: ", err_79);
8658
+ throw err_79;
8599
8659
  case 4: return [2, {
8600
8660
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8601
8661
  additionalSigners: additionalSigners
@@ -8604,7 +8664,7 @@ var PerpetualsClient = (function () {
8604
8664
  });
8605
8665
  }); };
8606
8666
  this.removeMarket = function (poolName, market, targetMint, collateralMint) { return __awaiter(_this, void 0, void 0, function () {
8607
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, removeMarketInstruction, err_75;
8667
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, removeMarketInstruction, err_80;
8608
8668
  return __generator(this, function (_a) {
8609
8669
  switch (_a.label) {
8610
8670
  case 0:
@@ -8636,9 +8696,9 @@ var PerpetualsClient = (function () {
8636
8696
  instructions.push(removeMarketInstruction);
8637
8697
  return [3, 4];
8638
8698
  case 3:
8639
- err_75 = _a.sent();
8640
- console.log("perpClient setCustodyConfigInstruction error:: ", err_75);
8641
- throw err_75;
8699
+ err_80 = _a.sent();
8700
+ console.log("perpClient setCustodyConfigInstruction error:: ", err_80);
8701
+ throw err_80;
8642
8702
  case 4: return [2, {
8643
8703
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8644
8704
  additionalSigners: additionalSigners
@@ -8647,7 +8707,7 @@ var PerpetualsClient = (function () {
8647
8707
  });
8648
8708
  }); };
8649
8709
  this.refreshPositionsStatus = function (positionAccounts) { return __awaiter(_this, void 0, void 0, function () {
8650
- var instructions, additionalSigners, remainingAccounts, refreshInstruction, err_76;
8710
+ var instructions, additionalSigners, remainingAccounts, refreshInstruction, err_81;
8651
8711
  return __generator(this, function (_a) {
8652
8712
  switch (_a.label) {
8653
8713
  case 0:
@@ -8674,9 +8734,9 @@ var PerpetualsClient = (function () {
8674
8734
  instructions.push(refreshInstruction);
8675
8735
  return [3, 4];
8676
8736
  case 3:
8677
- err_76 = _a.sent();
8678
- console.log("perpClient refreshPositionsStatus error:: ", err_76);
8679
- throw err_76;
8737
+ err_81 = _a.sent();
8738
+ console.log("perpClient refreshPositionsStatus error:: ", err_81);
8739
+ throw err_81;
8680
8740
  case 4: return [2, {
8681
8741
  instructions: __spreadArray([], instructions, true),
8682
8742
  additionalSigners: additionalSigners
@@ -8685,7 +8745,7 @@ var PerpetualsClient = (function () {
8685
8745
  });
8686
8746
  }); };
8687
8747
  this.refreshOrdersStatus = function (orderAccounts) { return __awaiter(_this, void 0, void 0, function () {
8688
- var instructions, additionalSigners, remainingAccounts, refreshInstruction, err_77;
8748
+ var instructions, additionalSigners, remainingAccounts, refreshInstruction, err_82;
8689
8749
  return __generator(this, function (_a) {
8690
8750
  switch (_a.label) {
8691
8751
  case 0:
@@ -8712,9 +8772,9 @@ var PerpetualsClient = (function () {
8712
8772
  instructions.push(refreshInstruction);
8713
8773
  return [3, 4];
8714
8774
  case 3:
8715
- err_77 = _a.sent();
8716
- console.log("perpClient refreshOrdersStatus error:: ", err_77);
8717
- throw err_77;
8775
+ err_82 = _a.sent();
8776
+ console.log("perpClient refreshOrdersStatus error:: ", err_82);
8777
+ throw err_82;
8718
8778
  case 4: return [2, {
8719
8779
  instructions: __spreadArray([], instructions, true),
8720
8780
  additionalSigners: additionalSigners
@@ -8723,7 +8783,7 @@ var PerpetualsClient = (function () {
8723
8783
  });
8724
8784
  }); };
8725
8785
  this.migrateMarketPosition = function (poolName, oldMarket, newMarket, oldCollateralCustody, newCollateralCustody, owner) { return __awaiter(_this, void 0, void 0, function () {
8726
- var preInstructions, instructions, postInstructions, additionalSigners, oldPosition, newPosition, oldCollateralCustodyAccount, newCollateralCustodyAccount, migrateMarketPositionInstruction, err_78;
8786
+ var preInstructions, instructions, postInstructions, additionalSigners, oldPosition, newPosition, oldCollateralCustodyAccount, newCollateralCustodyAccount, migrateMarketPositionInstruction, err_83;
8727
8787
  return __generator(this, function (_a) {
8728
8788
  switch (_a.label) {
8729
8789
  case 0:
@@ -8774,9 +8834,9 @@ var PerpetualsClient = (function () {
8774
8834
  instructions.push(migrateMarketPositionInstruction);
8775
8835
  return [3, 6];
8776
8836
  case 5:
8777
- err_78 = _a.sent();
8778
- console.log("perpClient migrateMarketPosition error:: ", err_78);
8779
- throw err_78;
8837
+ err_83 = _a.sent();
8838
+ console.log("perpClient migrateMarketPosition error:: ", err_83);
8839
+ throw err_83;
8780
8840
  case 6: return [2, {
8781
8841
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8782
8842
  additionalSigners: additionalSigners
@@ -8790,7 +8850,7 @@ var PerpetualsClient = (function () {
8790
8850
  args_1[_i - 5] = arguments[_i];
8791
8851
  }
8792
8852
  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) {
8793
- var preInstructions, instructions, postInstructions, additionalSigners, oldOrder, newOrder, migrateMarketOrderInstruction, err_79;
8853
+ var preInstructions, instructions, postInstructions, additionalSigners, oldOrder, newOrder, migrateMarketOrderInstruction, err_84;
8794
8854
  if (owner === void 0) { owner = this.provider.wallet.publicKey; }
8795
8855
  return __generator(this, function (_a) {
8796
8856
  switch (_a.label) {
@@ -8832,9 +8892,9 @@ var PerpetualsClient = (function () {
8832
8892
  instructions.push(migrateMarketOrderInstruction);
8833
8893
  return [3, 4];
8834
8894
  case 3:
8835
- err_79 = _a.sent();
8836
- console.log("perpClient migrateMarketOrder error:: ", err_79);
8837
- throw err_79;
8895
+ err_84 = _a.sent();
8896
+ console.log("perpClient migrateMarketOrder error:: ", err_84);
8897
+ throw err_84;
8838
8898
  case 4: return [2, {
8839
8899
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8840
8900
  additionalSigners: additionalSigners
@@ -8844,7 +8904,7 @@ var PerpetualsClient = (function () {
8844
8904
  });
8845
8905
  };
8846
8906
  this.forceSettlePosition = function (market, owner, receivingAccount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
8847
- var instructions, additionalSigners, marketAccount, targetCustody_1, collateralCustody_1, targetCustodyConfig, collateralCustodyConfig, positionAccount, orderAccount, remainingAccounts, orderAccountInfo, forceSettlePositionIx, err_80;
8907
+ var instructions, additionalSigners, marketAccount, targetCustody_1, collateralCustody_1, targetCustodyConfig, collateralCustodyConfig, positionAccount, orderAccount, remainingAccounts, orderAccountInfo, forceSettlePositionIx, err_85;
8848
8908
  return __generator(this, function (_a) {
8849
8909
  switch (_a.label) {
8850
8910
  case 0:
@@ -8908,9 +8968,9 @@ var PerpetualsClient = (function () {
8908
8968
  instructions.push(forceSettlePositionIx);
8909
8969
  return [3, 6];
8910
8970
  case 5:
8911
- err_80 = _a.sent();
8912
- console.log("perpClient forceSettlePosition error:: ", err_80);
8913
- throw err_80;
8971
+ err_85 = _a.sent();
8972
+ console.log("perpClient forceSettlePosition error:: ", err_85);
8973
+ throw err_85;
8914
8974
  case 6: return [2, {
8915
8975
  instructions: __spreadArray([], instructions, true),
8916
8976
  additionalSigners: additionalSigners
@@ -8919,7 +8979,7 @@ var PerpetualsClient = (function () {
8919
8979
  });
8920
8980
  }); };
8921
8981
  this.forceSettleOrder = function (market, owner, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
8922
- 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_81;
8982
+ 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;
8923
8983
  return __generator(this, function (_d) {
8924
8984
  switch (_d.label) {
8925
8985
  case 0:
@@ -9032,9 +9092,9 @@ var PerpetualsClient = (function () {
9032
9092
  _d.label = 15;
9033
9093
  case 15: return [3, 17];
9034
9094
  case 16:
9035
- err_81 = _d.sent();
9036
- console.log("perpClient forceSettleOrder error:: ", err_81);
9037
- throw err_81;
9095
+ err_86 = _d.sent();
9096
+ console.log("perpClient forceSettleOrder error:: ", err_86);
9097
+ throw err_86;
9038
9098
  case 17: return [2, {
9039
9099
  instructions: __spreadArray([], instructions, true),
9040
9100
  additionalSigners: additionalSigners