flash-sdk 2.19.7 → 2.20.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -5420,7 +5420,7 @@ var PerpetualsClient = (function () {
5420
5420
  });
5421
5421
  });
5422
5422
  };
5423
- this.editLimitOrder = function (targetSymbol, collateralSymbol, reserveSymbol, side, orderId, limitPrice, sizeAmount, stopLossPrice, takeProfitPrice, receiveCustodyId, poolConfig, createUserATA, ephemeralSignerPubkey) {
5423
+ this.editLimitOrder = function (targetSymbol, collateralSymbol, reserveSymbol, side, orderId, limitPrice, sizeAmount, stopLossPrice, takeProfitPrice, poolConfig, createUserATA, ephemeralSignerPubkey) {
5424
5424
  if (createUserATA === void 0) { createUserATA = true; }
5425
5425
  if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
5426
5426
  return __awaiter(_this, void 0, void 0, function () {
@@ -5482,8 +5482,7 @@ var PerpetualsClient = (function () {
5482
5482
  limitPrice: limitPrice,
5483
5483
  sizeAmount: sizeAmount,
5484
5484
  stopLossPrice: stopLossPrice,
5485
- takeProfitPrice: takeProfitPrice,
5486
- receiveCustodyId: receiveCustodyId
5485
+ takeProfitPrice: takeProfitPrice
5487
5486
  })
5488
5487
  .accounts({
5489
5488
  owner: publicKey,
@@ -5584,88 +5583,8 @@ var PerpetualsClient = (function () {
5584
5583
  });
5585
5584
  });
5586
5585
  };
5587
- this.executeLimitWithSwap = function (userPubkey, targetSymbol, collateralSymbol, reserveSymbol, side, orderId, poolConfig, privilege, nftTradingAccount, nftReferralAccount, nftRebateTokenAccount) {
5588
- if (nftTradingAccount === void 0) { nftTradingAccount = web3_js_1.PublicKey.default; }
5589
- if (nftReferralAccount === void 0) { nftReferralAccount = web3_js_1.PublicKey.default; }
5590
- if (nftRebateTokenAccount === void 0) { nftRebateTokenAccount = web3_js_1.PublicKey.default; }
5591
- return __awaiter(_this, void 0, void 0, function () {
5592
- var publicKey, targetCustodyConfig, collateralCustodyConfig, reserveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, _i, _a, custody, positionAccount, orderAccount, executeLimitWithSwap, err_28;
5593
- return __generator(this, function (_b) {
5594
- switch (_b.label) {
5595
- case 0:
5596
- publicKey = this.provider.wallet.publicKey;
5597
- targetCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(targetSymbol).mintKey); });
5598
- collateralCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(collateralSymbol).mintKey); });
5599
- reserveCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(reserveSymbol).mintKey); });
5600
- marketAccount = poolConfig.getMarketPk(targetCustodyConfig.custodyAccount, collateralCustodyConfig.custodyAccount, side);
5601
- preInstructions = [];
5602
- instructions = [];
5603
- postInstructions = [];
5604
- additionalSigners = [];
5605
- custodyAccountMetas = [];
5606
- custodyOracleAccountMetas = [];
5607
- for (_i = 0, _a = poolConfig.custodies; _i < _a.length; _i++) {
5608
- custody = _a[_i];
5609
- custodyAccountMetas.push({
5610
- pubkey: custody.custodyAccount,
5611
- isSigner: false,
5612
- isWritable: false,
5613
- });
5614
- custodyOracleAccountMetas.push({
5615
- pubkey: this.useExtOracleAccount ? custody.extOracleAccount : custody.intOracleAccount,
5616
- isSigner: false,
5617
- isWritable: false,
5618
- });
5619
- }
5620
- _b.label = 1;
5621
- case 1:
5622
- _b.trys.push([1, 3, , 4]);
5623
- positionAccount = poolConfig.getPositionFromMarketPk(userPubkey, marketAccount);
5624
- orderAccount = poolConfig.getOrderFromMarketPk(userPubkey, marketAccount);
5625
- return [4, this.program.methods
5626
- .executeLimitWithSwap({
5627
- orderId: orderId,
5628
- privilege: privilege
5629
- })
5630
- .accounts({
5631
- feePayer: publicKey,
5632
- perpetuals: poolConfig.perpetuals,
5633
- pool: poolConfig.poolAddress,
5634
- reserveCustody: reserveCustodyConfig.custodyAccount,
5635
- reserveCustodyOracleAccount: this.useExtOracleAccount ? reserveCustodyConfig.extOracleAccount : reserveCustodyConfig.intOracleAccount,
5636
- position: positionAccount,
5637
- order: orderAccount,
5638
- market: marketAccount,
5639
- targetCustody: targetCustodyConfig.custodyAccount,
5640
- targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
5641
- collateralCustody: collateralCustodyConfig.custodyAccount,
5642
- collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
5643
- systemProgram: web3_js_1.SystemProgram.programId,
5644
- tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
5645
- eventAuthority: this.eventAuthority.publicKey,
5646
- program: this.programId,
5647
- ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
5648
- })
5649
- .remainingAccounts(__spreadArray(__spreadArray(__spreadArray([], (0, getNftAccounts_1.getNftAccounts)(nftTradingAccount, nftReferralAccount, nftRebateTokenAccount, privilege), true), custodyAccountMetas, true), custodyOracleAccountMetas, true))
5650
- .instruction()];
5651
- case 2:
5652
- executeLimitWithSwap = _b.sent();
5653
- instructions.push(executeLimitWithSwap);
5654
- return [3, 4];
5655
- case 3:
5656
- err_28 = _b.sent();
5657
- console.log("perpClient executeLimitWithSwap error:: ", err_28);
5658
- throw err_28;
5659
- case 4: return [2, {
5660
- instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
5661
- additionalSigners: additionalSigners
5662
- }];
5663
- }
5664
- });
5665
- });
5666
- };
5667
5586
  this.placeTriggerOrder = function (targetSymbol, collateralSymbol, side, triggerPrice, deltaSizeAmount, isStopLoss, receiveCustodyId, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
5668
- var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, placeTriggerOrder, err_29;
5587
+ var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, placeTriggerOrder, err_28;
5669
5588
  return __generator(this, function (_a) {
5670
5589
  switch (_a.label) {
5671
5590
  case 0:
@@ -5712,9 +5631,9 @@ var PerpetualsClient = (function () {
5712
5631
  instructions.push(placeTriggerOrder);
5713
5632
  return [3, 4];
5714
5633
  case 3:
5715
- err_29 = _a.sent();
5716
- console.log("perpClient placeTriggerOrder error:: ", err_29);
5717
- throw err_29;
5634
+ err_28 = _a.sent();
5635
+ console.log("perpClient placeTriggerOrder error:: ", err_28);
5636
+ throw err_28;
5718
5637
  case 4: return [2, {
5719
5638
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
5720
5639
  additionalSigners: additionalSigners
@@ -5723,7 +5642,7 @@ var PerpetualsClient = (function () {
5723
5642
  });
5724
5643
  }); };
5725
5644
  this.editTriggerOrder = function (targetSymbol, collateralSymbol, side, orderId, triggerPrice, deltaSizeAmount, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
5726
- var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, editTriggerOrder, err_30;
5645
+ var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, editTriggerOrder, err_29;
5727
5646
  return __generator(this, function (_a) {
5728
5647
  switch (_a.label) {
5729
5648
  case 0:
@@ -5768,9 +5687,9 @@ var PerpetualsClient = (function () {
5768
5687
  instructions.push(editTriggerOrder);
5769
5688
  return [3, 4];
5770
5689
  case 3:
5771
- err_30 = _a.sent();
5772
- console.log("perpClient editTriggerOrder error:: ", err_30);
5773
- throw err_30;
5690
+ err_29 = _a.sent();
5691
+ console.log("perpClient editTriggerOrder error:: ", err_29);
5692
+ throw err_29;
5774
5693
  case 4: return [2, {
5775
5694
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
5776
5695
  additionalSigners: additionalSigners
@@ -5779,7 +5698,7 @@ var PerpetualsClient = (function () {
5779
5698
  });
5780
5699
  }); };
5781
5700
  this.cancelTriggerOrder = function (targetSymbol, collateralSymbol, side, orderId, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
5782
- var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, cancelTriggerOrder, err_31;
5701
+ var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, cancelTriggerOrder, err_30;
5783
5702
  return __generator(this, function (_a) {
5784
5703
  switch (_a.label) {
5785
5704
  case 0:
@@ -5812,9 +5731,9 @@ var PerpetualsClient = (function () {
5812
5731
  instructions.push(cancelTriggerOrder);
5813
5732
  return [3, 4];
5814
5733
  case 3:
5815
- err_31 = _a.sent();
5816
- console.log("perpClient cancelTriggerOrder error:: ", err_31);
5817
- throw err_31;
5734
+ err_30 = _a.sent();
5735
+ console.log("perpClient cancelTriggerOrder error:: ", err_30);
5736
+ throw err_30;
5818
5737
  case 4: return [2, {
5819
5738
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
5820
5739
  additionalSigners: additionalSigners
@@ -5822,121 +5741,11 @@ var PerpetualsClient = (function () {
5822
5741
  }
5823
5742
  });
5824
5743
  }); };
5825
- this.executeTriggerWithSwap = function (owner, targetSymbol, collateralSymbol, receivingSymbol, side, orderId, isStopLoss, poolConfig, createUserATA, ephemeralSignerPubkey) {
5826
- if (createUserATA === void 0) { createUserATA = true; }
5827
- if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
5828
- return __awaiter(_this, void 0, void 0, function () {
5829
- var payerPubkey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, userReceivingTokenAccount, userReceivingTokenAccountCollateral, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, _b, positionAccount, orderAccount, custodyAccountMetas, custodyOracleAccountMetas, _i, _c, custody, executeTriggerWithSwap, err_32;
5830
- return __generator(this, function (_d) {
5831
- switch (_d.label) {
5832
- case 0:
5833
- payerPubkey = this.provider.wallet.publicKey;
5834
- targetCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(targetSymbol).mintKey); });
5835
- collateralCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(collateralSymbol).mintKey); });
5836
- receivingCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(receivingSymbol).mintKey); });
5837
- marketAccount = poolConfig.getMarketPk(targetCustodyConfig.custodyAccount, collateralCustodyConfig.custodyAccount, side);
5838
- preInstructions = [];
5839
- instructions = [];
5840
- postInstructions = [];
5841
- additionalSigners = [];
5842
- _d.label = 1;
5843
- case 1:
5844
- _d.trys.push([1, 9, , 10]);
5845
- if (!false) return [3, 2];
5846
- return [3, 7];
5847
- case 2:
5848
- userReceivingTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(poolConfig.getTokenFromSymbol(receivingSymbol).mintKey, owner, true);
5849
- _a = createUserATA;
5850
- if (!_a) return [3, 4];
5851
- return [4, (0, utils_1.checkIfAccountExists)(userReceivingTokenAccount, this.provider.connection)];
5852
- case 3:
5853
- _a = !(_d.sent());
5854
- _d.label = 4;
5855
- case 4:
5856
- if (_a) {
5857
- preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(payerPubkey, userReceivingTokenAccount, owner, poolConfig.getTokenFromSymbol(receivingSymbol).mintKey));
5858
- }
5859
- userReceivingTokenAccountCollateral = (0, spl_token_1.getAssociatedTokenAddressSync)(poolConfig.getTokenFromSymbol(collateralSymbol).mintKey, owner, true);
5860
- _b = createUserATA;
5861
- if (!_b) return [3, 6];
5862
- return [4, (0, utils_1.checkIfAccountExists)(userReceivingTokenAccountCollateral, this.provider.connection)];
5863
- case 5:
5864
- _b = !(_d.sent());
5865
- _d.label = 6;
5866
- case 6:
5867
- if (_b) {
5868
- preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(payerPubkey, userReceivingTokenAccountCollateral, owner, poolConfig.getTokenFromSymbol(collateralSymbol).mintKey));
5869
- }
5870
- _d.label = 7;
5871
- case 7:
5872
- positionAccount = poolConfig.getPositionFromMarketPk(owner, marketAccount);
5873
- orderAccount = poolConfig.getOrderFromMarketPk(owner, marketAccount);
5874
- custodyAccountMetas = [];
5875
- custodyOracleAccountMetas = [];
5876
- for (_i = 0, _c = poolConfig.custodies; _i < _c.length; _i++) {
5877
- custody = _c[_i];
5878
- custodyAccountMetas.push({
5879
- pubkey: custody.custodyAccount,
5880
- isSigner: false,
5881
- isWritable: false,
5882
- });
5883
- custodyOracleAccountMetas.push({
5884
- pubkey: this.useExtOracleAccount ? custody.extOracleAccount : custody.intOracleAccount,
5885
- isSigner: false,
5886
- isWritable: false,
5887
- });
5888
- }
5889
- return [4, this.program.methods
5890
- .executeTriggerWithSwap({
5891
- isStopLoss: isStopLoss,
5892
- orderId: orderId
5893
- })
5894
- .accounts({
5895
- feePayer: payerPubkey,
5896
- receivingAccount: userReceivingTokenAccount,
5897
- collateralAccount: userReceivingTokenAccountCollateral,
5898
- transferAuthority: poolConfig.transferAuthority,
5899
- perpetuals: poolConfig.perpetuals,
5900
- pool: poolConfig.poolAddress,
5901
- position: positionAccount,
5902
- order: orderAccount,
5903
- market: marketAccount,
5904
- targetCustody: targetCustodyConfig.custodyAccount,
5905
- targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
5906
- collateralCustody: collateralCustodyConfig.custodyAccount,
5907
- collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
5908
- collateralCustodyTokenAccount: collateralCustodyConfig.tokenAccount,
5909
- dispensingCustody: receivingCustodyConfig.custodyAccount,
5910
- dispensingOracleAccount: this.useExtOracleAccount ? receivingCustodyConfig.extOracleAccount : receivingCustodyConfig.intOracleAccount,
5911
- dispensingCustodyTokenAccount: receivingCustodyConfig.tokenAccount,
5912
- tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
5913
- eventAuthority: this.eventAuthority.publicKey,
5914
- program: this.programId,
5915
- ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
5916
- })
5917
- .remainingAccounts(__spreadArray(__spreadArray([], custodyAccountMetas, true), custodyOracleAccountMetas, true))
5918
- .instruction()];
5919
- case 8:
5920
- executeTriggerWithSwap = _d.sent();
5921
- instructions.push(executeTriggerWithSwap);
5922
- return [3, 10];
5923
- case 9:
5924
- err_32 = _d.sent();
5925
- console.log("perpClient executeTriggerWithSwap error:: ", err_32);
5926
- throw err_32;
5927
- case 10: return [2, {
5928
- instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
5929
- additionalSigners: additionalSigners
5930
- }];
5931
- }
5932
- });
5933
- });
5934
- };
5935
5744
  this.executeTriggerOrder = function (owner, targetSymbol, collateralSymbol, side, orderId, isStopLoss, poolConfig, createUserATA, ephemeralSignerPubkey) {
5936
5745
  if (createUserATA === void 0) { createUserATA = true; }
5937
5746
  if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
5938
5747
  return __awaiter(_this, void 0, void 0, function () {
5939
- var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, positionAccount, orderAccount, executeTriggerOrder, err_33;
5748
+ var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, positionAccount, orderAccount, executeTriggerOrder, err_31;
5940
5749
  return __generator(this, function (_b) {
5941
5750
  switch (_b.label) {
5942
5751
  case 0:
@@ -5999,9 +5808,9 @@ var PerpetualsClient = (function () {
5999
5808
  instructions.push(executeTriggerOrder);
6000
5809
  return [3, 8];
6001
5810
  case 7:
6002
- err_33 = _b.sent();
6003
- console.log("perpClient executeTriggerOrder error:: ", err_33);
6004
- throw err_33;
5811
+ err_31 = _b.sent();
5812
+ console.log("perpClient executeTriggerOrder error:: ", err_31);
5813
+ throw err_31;
6005
5814
  case 8: return [2, {
6006
5815
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
6007
5816
  additionalSigners: additionalSigners
@@ -6010,12 +5819,15 @@ var PerpetualsClient = (function () {
6010
5819
  });
6011
5820
  });
6012
5821
  };
6013
- this.migrateTriggerOrder = function (owner, marketAccount, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
6014
- var payerPubkey, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, migrateTriggerOrder, err_34;
5822
+ this.migrateTriggerOrder = function (owner, targetSymbol, collateralSymbol, side, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
5823
+ var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, migrateTriggerOrder, err_32;
6015
5824
  return __generator(this, function (_a) {
6016
5825
  switch (_a.label) {
6017
5826
  case 0:
6018
5827
  payerPubkey = this.provider.wallet.publicKey;
5828
+ targetCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(targetSymbol).mintKey); });
5829
+ collateralCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(collateralSymbol).mintKey); });
5830
+ marketAccount = poolConfig.getMarketPk(targetCustodyConfig.custodyAccount, collateralCustodyConfig.custodyAccount, side);
6019
5831
  preInstructions = [];
6020
5832
  instructions = [];
6021
5833
  postInstructions = [];
@@ -6041,9 +5853,9 @@ var PerpetualsClient = (function () {
6041
5853
  instructions.push(migrateTriggerOrder);
6042
5854
  return [3, 4];
6043
5855
  case 3:
6044
- err_34 = _a.sent();
6045
- console.log("perpClient migrateTriggerOrder error:: ", err_34);
6046
- throw err_34;
5856
+ err_32 = _a.sent();
5857
+ console.log("perpClient migrateTriggerOrder error:: ", err_32);
5858
+ throw err_32;
6047
5859
  case 4: return [2, {
6048
5860
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
6049
5861
  additionalSigners: additionalSigners
@@ -6052,7 +5864,7 @@ var PerpetualsClient = (function () {
6052
5864
  });
6053
5865
  }); };
6054
5866
  this.getPositionData = function (position, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
6055
- var marketConfig, targetCustodyConfig, collateralCustodyConfig, getPositionData, err_35;
5867
+ var marketConfig, targetCustodyConfig, collateralCustodyConfig, getPositionData, err_33;
6056
5868
  return __generator(this, function (_a) {
6057
5869
  switch (_a.label) {
6058
5870
  case 0:
@@ -6081,15 +5893,15 @@ var PerpetualsClient = (function () {
6081
5893
  console.log(getPositionData);
6082
5894
  return [2, getPositionData];
6083
5895
  case 3:
6084
- err_35 = _a.sent();
6085
- console.log("perpClient setPool error:: ", err_35);
6086
- throw err_35;
5896
+ err_33 = _a.sent();
5897
+ console.log("perpClient setPool error:: ", err_33);
5898
+ throw err_33;
6087
5899
  case 4: return [2];
6088
5900
  }
6089
5901
  });
6090
5902
  }); };
6091
5903
  this.protocolWithdrawFees = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
6092
- var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx, err_36;
5904
+ var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx, err_34;
6093
5905
  return __generator(this, function (_a) {
6094
5906
  switch (_a.label) {
6095
5907
  case 0:
@@ -6122,9 +5934,9 @@ var PerpetualsClient = (function () {
6122
5934
  instructions.push(withdrawFeesIx);
6123
5935
  return [3, 5];
6124
5936
  case 4:
6125
- err_36 = _a.sent();
6126
- console.log("perpClient setPool error:: ", err_36);
6127
- throw err_36;
5937
+ err_34 = _a.sent();
5938
+ console.log("perpClient setPool error:: ", err_34);
5939
+ throw err_34;
6128
5940
  case 5: return [2, {
6129
5941
  instructions: __spreadArray([], instructions, true),
6130
5942
  additionalSigners: additionalSigners
@@ -6133,7 +5945,7 @@ var PerpetualsClient = (function () {
6133
5945
  });
6134
5946
  }); };
6135
5947
  this.setPermissions = function (permissions) { return __awaiter(_this, void 0, void 0, function () {
6136
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction, err_37;
5948
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction, err_35;
6137
5949
  return __generator(this, function (_a) {
6138
5950
  switch (_a.label) {
6139
5951
  case 0:
@@ -6160,9 +5972,9 @@ var PerpetualsClient = (function () {
6160
5972
  instructions.push(setPermissionsInstruction);
6161
5973
  return [3, 4];
6162
5974
  case 3:
6163
- err_37 = _a.sent();
6164
- console.log("perpClient setPool error:: ", err_37);
6165
- throw err_37;
5975
+ err_35 = _a.sent();
5976
+ console.log("perpClient setPool error:: ", err_35);
5977
+ throw err_35;
6166
5978
  case 4: return [2, {
6167
5979
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
6168
5980
  additionalSigners: additionalSigners
@@ -6171,7 +5983,7 @@ var PerpetualsClient = (function () {
6171
5983
  });
6172
5984
  }); };
6173
5985
  this.reimburse = function (tokenMint, amountIn, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
6174
- var custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, instructions, additionalSigners, custodyConfig, reimburse, _d, _e, err_38;
5986
+ var custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, instructions, additionalSigners, custodyConfig, reimburse, _d, _e, err_36;
6175
5987
  var _f;
6176
5988
  return __generator(this, function (_g) {
6177
5989
  switch (_g.label) {
@@ -6231,9 +6043,9 @@ var PerpetualsClient = (function () {
6231
6043
  instructions.push(reimburse);
6232
6044
  return [3, 5];
6233
6045
  case 4:
6234
- err_38 = _g.sent();
6235
- console.log("perpClient setPool error:: ", err_38);
6236
- throw err_38;
6046
+ err_36 = _g.sent();
6047
+ console.log("perpClient setPool error:: ", err_36);
6048
+ throw err_36;
6237
6049
  case 5: return [2, {
6238
6050
  instructions: __spreadArray([], instructions, true),
6239
6051
  additionalSigners: additionalSigners
@@ -6242,7 +6054,7 @@ var PerpetualsClient = (function () {
6242
6054
  });
6243
6055
  }); };
6244
6056
  this.setInternalOraclePrice = function (tokenMint, price, expo, conf, ema, publishTime, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
6245
- var instructions, additionalSigners, custodyConfig, setInternalOraclePrice, err_39;
6057
+ var instructions, additionalSigners, custodyConfig, setInternalOraclePrice, err_37;
6246
6058
  return __generator(this, function (_a) {
6247
6059
  switch (_a.label) {
6248
6060
  case 0:
@@ -6275,9 +6087,9 @@ var PerpetualsClient = (function () {
6275
6087
  instructions.push(setInternalOraclePrice);
6276
6088
  return [3, 4];
6277
6089
  case 3:
6278
- err_39 = _a.sent();
6279
- console.log("perpClient setInternalOracleAccount error:: ", err_39);
6280
- throw err_39;
6090
+ err_37 = _a.sent();
6091
+ console.log("perpClient setInternalOracleAccount error:: ", err_37);
6092
+ throw err_37;
6281
6093
  case 4: return [2, {
6282
6094
  instructions: __spreadArray([], instructions, true),
6283
6095
  additionalSigners: additionalSigners
@@ -6289,7 +6101,7 @@ var PerpetualsClient = (function () {
6289
6101
  if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
6290
6102
  if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
6291
6103
  return __awaiter(_this, void 0, void 0, function () {
6292
- var publicKey, preInstructions, instructions, additionalSigners, postInstructions, rewardCustody, inCustodyConfig, lpTokenMint, compoundingTokenMint, wrappedSolAccount, lpTokenAccount, compoundingTokenAccount, fundingAccount, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, lamports, unWrappedSolBalance, _d, addCompoundingLiquidity, err_40;
6104
+ var publicKey, preInstructions, instructions, additionalSigners, postInstructions, rewardCustody, inCustodyConfig, lpTokenMint, compoundingTokenMint, wrappedSolAccount, lpTokenAccount, compoundingTokenAccount, fundingAccount, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, lamports, unWrappedSolBalance, _d, addCompoundingLiquidity, err_38;
6293
6105
  return __generator(this, function (_e) {
6294
6106
  switch (_e.label) {
6295
6107
  case 0:
@@ -6412,8 +6224,8 @@ var PerpetualsClient = (function () {
6412
6224
  instructions.push(addCompoundingLiquidity);
6413
6225
  return [3, 10];
6414
6226
  case 9:
6415
- err_40 = _e.sent();
6416
- console.log("perpClient addCompoundingLiquidity error:: ", err_40);
6227
+ err_38 = _e.sent();
6228
+ console.log("perpClient addCompoundingLiquidity error:: ", err_38);
6417
6229
  return [3, 10];
6418
6230
  case 10: return [2, {
6419
6231
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
@@ -6427,7 +6239,7 @@ var PerpetualsClient = (function () {
6427
6239
  if (createUserATA === void 0) { createUserATA = true; }
6428
6240
  if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
6429
6241
  return __awaiter(_this, void 0, void 0, function () {
6430
- var publicKey, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, outCustodyConfig, lpTokenMint, compoundingTokenMint, lamports, _a, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _b, custody, _c, _d, market, compoundingTokenAccount, removeCompoundingLiquidity, err_41;
6242
+ var publicKey, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, outCustodyConfig, lpTokenMint, compoundingTokenMint, lamports, _a, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _b, custody, _c, _d, market, compoundingTokenAccount, removeCompoundingLiquidity, err_39;
6431
6243
  return __generator(this, function (_e) {
6432
6244
  switch (_e.label) {
6433
6245
  case 0:
@@ -6534,8 +6346,8 @@ var PerpetualsClient = (function () {
6534
6346
  instructions.push(removeCompoundingLiquidity);
6535
6347
  return [3, 8];
6536
6348
  case 7:
6537
- err_41 = _e.sent();
6538
- console.log("perpClient removeCompoundingLiquidity error:: ", err_41);
6349
+ err_39 = _e.sent();
6350
+ console.log("perpClient removeCompoundingLiquidity error:: ", err_39);
6539
6351
  return [3, 8];
6540
6352
  case 8: return [2, {
6541
6353
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
@@ -6548,7 +6360,7 @@ var PerpetualsClient = (function () {
6548
6360
  this.migrateStake = function (amount, rewardTokenMint, poolConfig, createUserATA) {
6549
6361
  if (createUserATA === void 0) { createUserATA = true; }
6550
6362
  return __awaiter(_this, void 0, void 0, function () {
6551
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoudingTokenAccount, _a, flpStakeAccount, poolStakedLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _b, custody, _c, _d, market, migrateStake, err_42;
6363
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoudingTokenAccount, _a, flpStakeAccount, poolStakedLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _b, custody, _c, _d, market, migrateStake, err_40;
6552
6364
  return __generator(this, function (_e) {
6553
6365
  switch (_e.label) {
6554
6366
  case 0:
@@ -6629,8 +6441,8 @@ var PerpetualsClient = (function () {
6629
6441
  instructions.push(migrateStake);
6630
6442
  return [3, 6];
6631
6443
  case 5:
6632
- err_42 = _e.sent();
6633
- console.log("perpClient migrateStake error:: ", err_42);
6444
+ err_40 = _e.sent();
6445
+ console.log("perpClient migrateStake error:: ", err_40);
6634
6446
  return [3, 6];
6635
6447
  case 6: return [2, {
6636
6448
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
@@ -6641,7 +6453,7 @@ var PerpetualsClient = (function () {
6641
6453
  });
6642
6454
  };
6643
6455
  this.migrateFlp = function (amount, rewardTokenMint, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
6644
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoudingTokenAccount, flpStakeAccount, poolStakedLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, migrateFlp, err_43;
6456
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoudingTokenAccount, flpStakeAccount, poolStakedLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, migrateFlp, err_41;
6645
6457
  return __generator(this, function (_d) {
6646
6458
  switch (_d.label) {
6647
6459
  case 0:
@@ -6713,8 +6525,8 @@ var PerpetualsClient = (function () {
6713
6525
  instructions.push(migrateFlp);
6714
6526
  return [3, 4];
6715
6527
  case 3:
6716
- err_43 = _d.sent();
6717
- console.log("perpClient migrateFlp error:: ", err_43);
6528
+ err_41 = _d.sent();
6529
+ console.log("perpClient migrateFlp error:: ", err_41);
6718
6530
  return [3, 4];
6719
6531
  case 4: return [2, {
6720
6532
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
@@ -6726,7 +6538,7 @@ var PerpetualsClient = (function () {
6726
6538
  this.compoundingFee = function (poolConfig, rewardTokenSymbol) {
6727
6539
  if (rewardTokenSymbol === void 0) { rewardTokenSymbol = 'USDC'; }
6728
6540
  return __awaiter(_this, void 0, void 0, function () {
6729
- var instructions, additionalSigners, rewardCustody, lpTokenMint, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, compoundingFee, err_44;
6541
+ var instructions, additionalSigners, rewardCustody, lpTokenMint, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, compoundingFee, err_42;
6730
6542
  return __generator(this, function (_d) {
6731
6543
  switch (_d.label) {
6732
6544
  case 0:
@@ -6783,8 +6595,8 @@ var PerpetualsClient = (function () {
6783
6595
  instructions.push(compoundingFee);
6784
6596
  return [3, 4];
6785
6597
  case 3:
6786
- err_44 = _d.sent();
6787
- console.log("perpClient compoundingFee error:: ", err_44);
6598
+ err_42 = _d.sent();
6599
+ console.log("perpClient compoundingFee error:: ", err_42);
6788
6600
  return [3, 4];
6789
6601
  case 4: return [2, {
6790
6602
  instructions: __spreadArray([], instructions, true),
@@ -6795,7 +6607,7 @@ var PerpetualsClient = (function () {
6795
6607
  });
6796
6608
  };
6797
6609
  this.renameFlp = function (flag, lpTokenName, lpTokenSymbol, lpTokenUri, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
6798
- var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp, err_45;
6610
+ var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp, err_43;
6799
6611
  return __generator(this, function (_a) {
6800
6612
  switch (_a.label) {
6801
6613
  case 0:
@@ -6833,8 +6645,8 @@ var PerpetualsClient = (function () {
6833
6645
  instructions.push(renameFlp);
6834
6646
  return [3, 4];
6835
6647
  case 3:
6836
- err_45 = _a.sent();
6837
- console.log("perpClient renameFlp error:: ", err_45);
6648
+ err_43 = _a.sent();
6649
+ console.log("perpClient renameFlp error:: ", err_43);
6838
6650
  return [3, 4];
6839
6651
  case 4: return [2, {
6840
6652
  instructions: __spreadArray([], instructions, true),
@@ -6844,7 +6656,7 @@ var PerpetualsClient = (function () {
6844
6656
  });
6845
6657
  }); };
6846
6658
  this.initRewardDistribution = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
6847
- var publicKey, rewardMint, instructions, additionalSigners, fbNftProgramData, rewardVault, rewardTokenAccount, transferAuthority, initRewardVault, err_46;
6659
+ var publicKey, rewardMint, instructions, additionalSigners, fbNftProgramData, rewardVault, rewardTokenAccount, transferAuthority, initRewardVault, err_44;
6848
6660
  return __generator(this, function (_a) {
6849
6661
  switch (_a.label) {
6850
6662
  case 0:
@@ -6878,9 +6690,9 @@ var PerpetualsClient = (function () {
6878
6690
  instructions.push(initRewardVault);
6879
6691
  return [3, 4];
6880
6692
  case 3:
6881
- err_46 = _a.sent();
6882
- console.log("rewardDistribution InitRewardVault error:: ", err_46);
6883
- throw err_46;
6693
+ err_44 = _a.sent();
6694
+ console.log("rewardDistribution InitRewardVault error:: ", err_44);
6695
+ throw err_44;
6884
6696
  case 4: return [2, {
6885
6697
  instructions: __spreadArray([], instructions, true),
6886
6698
  additionalSigners: additionalSigners
@@ -6889,7 +6701,7 @@ var PerpetualsClient = (function () {
6889
6701
  });
6890
6702
  }); };
6891
6703
  this.updateCounterReward = function () { return __awaiter(_this, void 0, void 0, function () {
6892
- var publicKey, instructions, additionalSigners, rewardVault, updateCounter, err_47;
6704
+ var publicKey, instructions, additionalSigners, rewardVault, updateCounter, err_45;
6893
6705
  return __generator(this, function (_a) {
6894
6706
  switch (_a.label) {
6895
6707
  case 0:
@@ -6912,9 +6724,9 @@ var PerpetualsClient = (function () {
6912
6724
  instructions.push(updateCounter);
6913
6725
  return [3, 4];
6914
6726
  case 3:
6915
- err_47 = _a.sent();
6916
- console.log("rewardDistribution updateCounter error:: ", err_47);
6917
- throw err_47;
6727
+ err_45 = _a.sent();
6728
+ console.log("rewardDistribution updateCounter error:: ", err_45);
6729
+ throw err_45;
6918
6730
  case 4: return [2, {
6919
6731
  instructions: __spreadArray([], instructions, true),
6920
6732
  additionalSigners: additionalSigners
@@ -6923,7 +6735,7 @@ var PerpetualsClient = (function () {
6923
6735
  });
6924
6736
  }); };
6925
6737
  this.rewardDistribution = function (counter, owner, rewardAmount, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
6926
- var publicKey, rewardCustodyMint, instructions, additionalSigners, fundingAccount, rewardVault, rewardTokenAccount, rewardRecord, distributeReward, err_48;
6738
+ var publicKey, rewardCustodyMint, instructions, additionalSigners, fundingAccount, rewardVault, rewardTokenAccount, rewardRecord, distributeReward, err_46;
6927
6739
  return __generator(this, function (_a) {
6928
6740
  switch (_a.label) {
6929
6741
  case 0:
@@ -6962,9 +6774,9 @@ var PerpetualsClient = (function () {
6962
6774
  instructions.push(distributeReward);
6963
6775
  return [3, 4];
6964
6776
  case 3:
6965
- err_48 = _a.sent();
6966
- console.log("rewardDistribution distributeReward error:: ", err_48);
6967
- throw err_48;
6777
+ err_46 = _a.sent();
6778
+ console.log("rewardDistribution distributeReward error:: ", err_46);
6779
+ throw err_46;
6968
6780
  case 4: return [2, {
6969
6781
  instructions: __spreadArray([], instructions, true),
6970
6782
  additionalSigners: additionalSigners
@@ -6975,7 +6787,7 @@ var PerpetualsClient = (function () {
6975
6787
  this.collectReward = function (counter, owner, rewardSymbol, poolConfig, createUserATA) {
6976
6788
  if (createUserATA === void 0) { createUserATA = true; }
6977
6789
  return __awaiter(_this, void 0, void 0, function () {
6978
- var publicKey, rewardCustodyMint, instructions, additionalSigners, receivingTokenAccount, _a, rewardVault, rewardTokenAccount, rewardRecord, transferAuthority, collectRaffleReward, err_49;
6790
+ var publicKey, rewardCustodyMint, instructions, additionalSigners, receivingTokenAccount, _a, rewardVault, rewardTokenAccount, rewardRecord, transferAuthority, collectRaffleReward, err_47;
6979
6791
  return __generator(this, function (_b) {
6980
6792
  switch (_b.label) {
6981
6793
  case 0:
@@ -7023,8 +6835,8 @@ var PerpetualsClient = (function () {
7023
6835
  instructions.push(collectRaffleReward);
7024
6836
  return [3, 6];
7025
6837
  case 5:
7026
- err_49 = _b.sent();
7027
- throw err_49;
6838
+ err_47 = _b.sent();
6839
+ throw err_47;
7028
6840
  case 6: return [2, {
7029
6841
  instructions: __spreadArray([], instructions, true),
7030
6842
  additionalSigners: additionalSigners