flash-sdk 2.19.4 → 2.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4106,10 +4106,6 @@ export declare class PerpetualsClient {
4106
4106
  instructions: TransactionInstruction[];
4107
4107
  additionalSigners: Signer[];
4108
4108
  }>;
4109
- executeLimitWithSwap: (userPubkey: PublicKey, targetSymbol: string, collateralSymbol: string, reserveSymbol: string, side: Side, orderId: number, poolConfig: PoolConfig, privilege: Privilege, nftTradingAccount?: PublicKey, nftReferralAccount?: PublicKey, nftRebateTokenAccount?: PublicKey) => Promise<{
4110
- instructions: TransactionInstruction[];
4111
- additionalSigners: Signer[];
4112
- }>;
4113
4109
  placeTriggerOrder: (targetSymbol: string, collateralSymbol: string, side: Side, triggerPrice: ContractOraclePrice, deltaSizeAmount: BN, isStopLoss: boolean, receiveCustodyId: number, poolConfig: PoolConfig) => Promise<{
4114
4110
  instructions: TransactionInstruction[];
4115
4111
  additionalSigners: Signer[];
@@ -4122,10 +4118,6 @@ export declare class PerpetualsClient {
4122
4118
  instructions: TransactionInstruction[];
4123
4119
  additionalSigners: Signer[];
4124
4120
  }>;
4125
- executeTriggerWithSwap: (owner: PublicKey, targetSymbol: string, collateralSymbol: string, receivingSymbol: string, side: Side, orderId: number, isStopLoss: boolean, poolConfig: PoolConfig, createUserATA?: boolean, ephemeralSignerPubkey?: any) => Promise<{
4126
- instructions: TransactionInstruction[];
4127
- additionalSigners: Signer[];
4128
- }>;
4129
4121
  executeTriggerOrder: (owner: PublicKey, targetSymbol: string, collateralSymbol: string, side: Side, orderId: number, isStopLoss: boolean, poolConfig: PoolConfig, createUserATA?: boolean, ephemeralSignerPubkey?: any) => Promise<{
4130
4122
  instructions: TransactionInstruction[];
4131
4123
  additionalSigners: Signer[];
@@ -5583,88 +5583,8 @@ var PerpetualsClient = (function () {
5583
5583
  });
5584
5584
  });
5585
5585
  };
5586
- this.executeLimitWithSwap = function (userPubkey, targetSymbol, collateralSymbol, reserveSymbol, side, orderId, poolConfig, privilege, nftTradingAccount, nftReferralAccount, nftRebateTokenAccount) {
5587
- if (nftTradingAccount === void 0) { nftTradingAccount = web3_js_1.PublicKey.default; }
5588
- if (nftReferralAccount === void 0) { nftReferralAccount = web3_js_1.PublicKey.default; }
5589
- if (nftRebateTokenAccount === void 0) { nftRebateTokenAccount = web3_js_1.PublicKey.default; }
5590
- return __awaiter(_this, void 0, void 0, function () {
5591
- var publicKey, targetCustodyConfig, collateralCustodyConfig, reserveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, custodyAccountMetas, custodyOracleAccountMetas, _i, _a, custody, positionAccount, orderAccount, executeLimitWithSwap, err_28;
5592
- return __generator(this, function (_b) {
5593
- switch (_b.label) {
5594
- case 0:
5595
- publicKey = this.provider.wallet.publicKey;
5596
- targetCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(targetSymbol).mintKey); });
5597
- collateralCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(collateralSymbol).mintKey); });
5598
- reserveCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(reserveSymbol).mintKey); });
5599
- marketAccount = poolConfig.getMarketPk(targetCustodyConfig.custodyAccount, collateralCustodyConfig.custodyAccount, side);
5600
- preInstructions = [];
5601
- instructions = [];
5602
- postInstructions = [];
5603
- additionalSigners = [];
5604
- custodyAccountMetas = [];
5605
- custodyOracleAccountMetas = [];
5606
- for (_i = 0, _a = poolConfig.custodies; _i < _a.length; _i++) {
5607
- custody = _a[_i];
5608
- custodyAccountMetas.push({
5609
- pubkey: custody.custodyAccount,
5610
- isSigner: false,
5611
- isWritable: false,
5612
- });
5613
- custodyOracleAccountMetas.push({
5614
- pubkey: this.useExtOracleAccount ? custody.extOracleAccount : custody.intOracleAccount,
5615
- isSigner: false,
5616
- isWritable: false,
5617
- });
5618
- }
5619
- _b.label = 1;
5620
- case 1:
5621
- _b.trys.push([1, 3, , 4]);
5622
- positionAccount = poolConfig.getPositionFromMarketPk(userPubkey, marketAccount);
5623
- orderAccount = poolConfig.getOrderFromMarketPk(userPubkey, marketAccount);
5624
- return [4, this.program.methods
5625
- .executeLimitWithSwap({
5626
- orderId: orderId,
5627
- privilege: privilege
5628
- })
5629
- .accounts({
5630
- feePayer: publicKey,
5631
- perpetuals: poolConfig.perpetuals,
5632
- pool: poolConfig.poolAddress,
5633
- reserveCustody: reserveCustodyConfig.custodyAccount,
5634
- reserveCustodyOracleAccount: this.useExtOracleAccount ? reserveCustodyConfig.extOracleAccount : reserveCustodyConfig.intOracleAccount,
5635
- position: positionAccount,
5636
- order: orderAccount,
5637
- market: marketAccount,
5638
- targetCustody: targetCustodyConfig.custodyAccount,
5639
- targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
5640
- collateralCustody: collateralCustodyConfig.custodyAccount,
5641
- collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
5642
- systemProgram: web3_js_1.SystemProgram.programId,
5643
- tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
5644
- eventAuthority: this.eventAuthority.publicKey,
5645
- program: this.programId,
5646
- ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
5647
- })
5648
- .remainingAccounts(__spreadArray(__spreadArray(__spreadArray([], (0, getNftAccounts_1.getNftAccounts)(nftTradingAccount, nftReferralAccount, nftRebateTokenAccount, privilege), true), custodyAccountMetas, true), custodyOracleAccountMetas, true))
5649
- .instruction()];
5650
- case 2:
5651
- executeLimitWithSwap = _b.sent();
5652
- instructions.push(executeLimitWithSwap);
5653
- return [3, 4];
5654
- case 3:
5655
- err_28 = _b.sent();
5656
- console.log("perpClient executeLimitWithSwap error:: ", err_28);
5657
- throw err_28;
5658
- case 4: return [2, {
5659
- instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
5660
- additionalSigners: additionalSigners
5661
- }];
5662
- }
5663
- });
5664
- });
5665
- };
5666
5586
  this.placeTriggerOrder = function (targetSymbol, collateralSymbol, side, triggerPrice, deltaSizeAmount, isStopLoss, receiveCustodyId, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
5667
- 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;
5668
5588
  return __generator(this, function (_a) {
5669
5589
  switch (_a.label) {
5670
5590
  case 0:
@@ -5711,9 +5631,9 @@ var PerpetualsClient = (function () {
5711
5631
  instructions.push(placeTriggerOrder);
5712
5632
  return [3, 4];
5713
5633
  case 3:
5714
- err_29 = _a.sent();
5715
- console.log("perpClient placeTriggerOrder error:: ", err_29);
5716
- throw err_29;
5634
+ err_28 = _a.sent();
5635
+ console.log("perpClient placeTriggerOrder error:: ", err_28);
5636
+ throw err_28;
5717
5637
  case 4: return [2, {
5718
5638
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
5719
5639
  additionalSigners: additionalSigners
@@ -5722,7 +5642,7 @@ var PerpetualsClient = (function () {
5722
5642
  });
5723
5643
  }); };
5724
5644
  this.editTriggerOrder = function (targetSymbol, collateralSymbol, side, orderId, triggerPrice, deltaSizeAmount, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
5725
- 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;
5726
5646
  return __generator(this, function (_a) {
5727
5647
  switch (_a.label) {
5728
5648
  case 0:
@@ -5767,9 +5687,9 @@ var PerpetualsClient = (function () {
5767
5687
  instructions.push(editTriggerOrder);
5768
5688
  return [3, 4];
5769
5689
  case 3:
5770
- err_30 = _a.sent();
5771
- console.log("perpClient editTriggerOrder error:: ", err_30);
5772
- throw err_30;
5690
+ err_29 = _a.sent();
5691
+ console.log("perpClient editTriggerOrder error:: ", err_29);
5692
+ throw err_29;
5773
5693
  case 4: return [2, {
5774
5694
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
5775
5695
  additionalSigners: additionalSigners
@@ -5778,7 +5698,7 @@ var PerpetualsClient = (function () {
5778
5698
  });
5779
5699
  }); };
5780
5700
  this.cancelTriggerOrder = function (targetSymbol, collateralSymbol, side, orderId, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
5781
- 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;
5782
5702
  return __generator(this, function (_a) {
5783
5703
  switch (_a.label) {
5784
5704
  case 0:
@@ -5811,9 +5731,9 @@ var PerpetualsClient = (function () {
5811
5731
  instructions.push(cancelTriggerOrder);
5812
5732
  return [3, 4];
5813
5733
  case 3:
5814
- err_31 = _a.sent();
5815
- console.log("perpClient cancelTriggerOrder error:: ", err_31);
5816
- throw err_31;
5734
+ err_30 = _a.sent();
5735
+ console.log("perpClient cancelTriggerOrder error:: ", err_30);
5736
+ throw err_30;
5817
5737
  case 4: return [2, {
5818
5738
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
5819
5739
  additionalSigners: additionalSigners
@@ -5821,121 +5741,11 @@ var PerpetualsClient = (function () {
5821
5741
  }
5822
5742
  });
5823
5743
  }); };
5824
- this.executeTriggerWithSwap = function (owner, targetSymbol, collateralSymbol, receivingSymbol, side, orderId, isStopLoss, poolConfig, createUserATA, ephemeralSignerPubkey) {
5825
- if (createUserATA === void 0) { createUserATA = true; }
5826
- if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
5827
- return __awaiter(_this, void 0, void 0, function () {
5828
- 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;
5829
- return __generator(this, function (_d) {
5830
- switch (_d.label) {
5831
- case 0:
5832
- payerPubkey = this.provider.wallet.publicKey;
5833
- targetCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(targetSymbol).mintKey); });
5834
- collateralCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(collateralSymbol).mintKey); });
5835
- receivingCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(receivingSymbol).mintKey); });
5836
- marketAccount = poolConfig.getMarketPk(targetCustodyConfig.custodyAccount, collateralCustodyConfig.custodyAccount, side);
5837
- preInstructions = [];
5838
- instructions = [];
5839
- postInstructions = [];
5840
- additionalSigners = [];
5841
- _d.label = 1;
5842
- case 1:
5843
- _d.trys.push([1, 9, , 10]);
5844
- if (!false) return [3, 2];
5845
- return [3, 7];
5846
- case 2:
5847
- userReceivingTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(poolConfig.getTokenFromSymbol(receivingSymbol).mintKey, owner, true);
5848
- _a = createUserATA;
5849
- if (!_a) return [3, 4];
5850
- return [4, (0, utils_1.checkIfAccountExists)(userReceivingTokenAccount, this.provider.connection)];
5851
- case 3:
5852
- _a = !(_d.sent());
5853
- _d.label = 4;
5854
- case 4:
5855
- if (_a) {
5856
- preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(payerPubkey, userReceivingTokenAccount, owner, poolConfig.getTokenFromSymbol(receivingSymbol).mintKey));
5857
- }
5858
- userReceivingTokenAccountCollateral = (0, spl_token_1.getAssociatedTokenAddressSync)(poolConfig.getTokenFromSymbol(collateralSymbol).mintKey, owner, true);
5859
- _b = createUserATA;
5860
- if (!_b) return [3, 6];
5861
- return [4, (0, utils_1.checkIfAccountExists)(userReceivingTokenAccountCollateral, this.provider.connection)];
5862
- case 5:
5863
- _b = !(_d.sent());
5864
- _d.label = 6;
5865
- case 6:
5866
- if (_b) {
5867
- preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(payerPubkey, userReceivingTokenAccountCollateral, owner, poolConfig.getTokenFromSymbol(collateralSymbol).mintKey));
5868
- }
5869
- _d.label = 7;
5870
- case 7:
5871
- positionAccount = poolConfig.getPositionFromMarketPk(owner, marketAccount);
5872
- orderAccount = poolConfig.getOrderFromMarketPk(owner, marketAccount);
5873
- custodyAccountMetas = [];
5874
- custodyOracleAccountMetas = [];
5875
- for (_i = 0, _c = poolConfig.custodies; _i < _c.length; _i++) {
5876
- custody = _c[_i];
5877
- custodyAccountMetas.push({
5878
- pubkey: custody.custodyAccount,
5879
- isSigner: false,
5880
- isWritable: false,
5881
- });
5882
- custodyOracleAccountMetas.push({
5883
- pubkey: this.useExtOracleAccount ? custody.extOracleAccount : custody.intOracleAccount,
5884
- isSigner: false,
5885
- isWritable: false,
5886
- });
5887
- }
5888
- return [4, this.program.methods
5889
- .executeTriggerWithSwap({
5890
- isStopLoss: isStopLoss,
5891
- orderId: orderId
5892
- })
5893
- .accounts({
5894
- feePayer: payerPubkey,
5895
- receivingAccount: userReceivingTokenAccount,
5896
- receivingAccountCollateral: userReceivingTokenAccountCollateral,
5897
- transferAuthority: poolConfig.transferAuthority,
5898
- perpetuals: poolConfig.perpetuals,
5899
- pool: poolConfig.poolAddress,
5900
- position: positionAccount,
5901
- order: orderAccount,
5902
- market: marketAccount,
5903
- targetCustody: targetCustodyConfig.custodyAccount,
5904
- targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
5905
- collateralCustody: collateralCustodyConfig.custodyAccount,
5906
- collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
5907
- collateralCustodyTokenAccount: collateralCustodyConfig.tokenAccount,
5908
- receivingCustody: receivingCustodyConfig.custodyAccount,
5909
- receivingOracleAccount: this.useExtOracleAccount ? receivingCustodyConfig.extOracleAccount : receivingCustodyConfig.intOracleAccount,
5910
- receivingCustodyTokenAccount: receivingCustodyConfig.tokenAccount,
5911
- tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
5912
- eventAuthority: this.eventAuthority.publicKey,
5913
- program: this.programId,
5914
- ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
5915
- })
5916
- .remainingAccounts(__spreadArray(__spreadArray([], custodyAccountMetas, true), custodyOracleAccountMetas, true))
5917
- .instruction()];
5918
- case 8:
5919
- executeTriggerWithSwap = _d.sent();
5920
- instructions.push(executeTriggerWithSwap);
5921
- return [3, 10];
5922
- case 9:
5923
- err_32 = _d.sent();
5924
- console.log("perpClient executeTriggerWithSwap error:: ", err_32);
5925
- throw err_32;
5926
- case 10: return [2, {
5927
- instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
5928
- additionalSigners: additionalSigners
5929
- }];
5930
- }
5931
- });
5932
- });
5933
- };
5934
5744
  this.executeTriggerOrder = function (owner, targetSymbol, collateralSymbol, side, orderId, isStopLoss, poolConfig, createUserATA, ephemeralSignerPubkey) {
5935
5745
  if (createUserATA === void 0) { createUserATA = true; }
5936
5746
  if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
5937
5747
  return __awaiter(_this, void 0, void 0, function () {
5938
- 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;
5939
5749
  return __generator(this, function (_b) {
5940
5750
  switch (_b.label) {
5941
5751
  case 0:
@@ -5998,9 +5808,9 @@ var PerpetualsClient = (function () {
5998
5808
  instructions.push(executeTriggerOrder);
5999
5809
  return [3, 8];
6000
5810
  case 7:
6001
- err_33 = _b.sent();
6002
- console.log("perpClient executeTriggerOrder error:: ", err_33);
6003
- throw err_33;
5811
+ err_31 = _b.sent();
5812
+ console.log("perpClient executeTriggerOrder error:: ", err_31);
5813
+ throw err_31;
6004
5814
  case 8: return [2, {
6005
5815
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
6006
5816
  additionalSigners: additionalSigners
@@ -6010,7 +5820,7 @@ var PerpetualsClient = (function () {
6010
5820
  });
6011
5821
  };
6012
5822
  this.migrateTriggerOrder = function (owner, targetSymbol, collateralSymbol, side, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
6013
- var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, migrateTriggerOrder, err_34;
5823
+ var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, migrateTriggerOrder, err_32;
6014
5824
  return __generator(this, function (_a) {
6015
5825
  switch (_a.label) {
6016
5826
  case 0:
@@ -6043,9 +5853,9 @@ var PerpetualsClient = (function () {
6043
5853
  instructions.push(migrateTriggerOrder);
6044
5854
  return [3, 4];
6045
5855
  case 3:
6046
- err_34 = _a.sent();
6047
- console.log("perpClient migrateTriggerOrder error:: ", err_34);
6048
- throw err_34;
5856
+ err_32 = _a.sent();
5857
+ console.log("perpClient migrateTriggerOrder error:: ", err_32);
5858
+ throw err_32;
6049
5859
  case 4: return [2, {
6050
5860
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
6051
5861
  additionalSigners: additionalSigners
@@ -6054,7 +5864,7 @@ var PerpetualsClient = (function () {
6054
5864
  });
6055
5865
  }); };
6056
5866
  this.getPositionData = function (position, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
6057
- var marketConfig, targetCustodyConfig, collateralCustodyConfig, getPositionData, err_35;
5867
+ var marketConfig, targetCustodyConfig, collateralCustodyConfig, getPositionData, err_33;
6058
5868
  return __generator(this, function (_a) {
6059
5869
  switch (_a.label) {
6060
5870
  case 0:
@@ -6083,15 +5893,15 @@ var PerpetualsClient = (function () {
6083
5893
  console.log(getPositionData);
6084
5894
  return [2, getPositionData];
6085
5895
  case 3:
6086
- err_35 = _a.sent();
6087
- console.log("perpClient setPool error:: ", err_35);
6088
- throw err_35;
5896
+ err_33 = _a.sent();
5897
+ console.log("perpClient setPool error:: ", err_33);
5898
+ throw err_33;
6089
5899
  case 4: return [2];
6090
5900
  }
6091
5901
  });
6092
5902
  }); };
6093
5903
  this.protocolWithdrawFees = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
6094
- var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx, err_36;
5904
+ var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx, err_34;
6095
5905
  return __generator(this, function (_a) {
6096
5906
  switch (_a.label) {
6097
5907
  case 0:
@@ -6124,9 +5934,9 @@ var PerpetualsClient = (function () {
6124
5934
  instructions.push(withdrawFeesIx);
6125
5935
  return [3, 5];
6126
5936
  case 4:
6127
- err_36 = _a.sent();
6128
- console.log("perpClient setPool error:: ", err_36);
6129
- throw err_36;
5937
+ err_34 = _a.sent();
5938
+ console.log("perpClient setPool error:: ", err_34);
5939
+ throw err_34;
6130
5940
  case 5: return [2, {
6131
5941
  instructions: __spreadArray([], instructions, true),
6132
5942
  additionalSigners: additionalSigners
@@ -6135,7 +5945,7 @@ var PerpetualsClient = (function () {
6135
5945
  });
6136
5946
  }); };
6137
5947
  this.setPermissions = function (permissions) { return __awaiter(_this, void 0, void 0, function () {
6138
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction, err_37;
5948
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction, err_35;
6139
5949
  return __generator(this, function (_a) {
6140
5950
  switch (_a.label) {
6141
5951
  case 0:
@@ -6162,9 +5972,9 @@ var PerpetualsClient = (function () {
6162
5972
  instructions.push(setPermissionsInstruction);
6163
5973
  return [3, 4];
6164
5974
  case 3:
6165
- err_37 = _a.sent();
6166
- console.log("perpClient setPool error:: ", err_37);
6167
- throw err_37;
5975
+ err_35 = _a.sent();
5976
+ console.log("perpClient setPool error:: ", err_35);
5977
+ throw err_35;
6168
5978
  case 4: return [2, {
6169
5979
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
6170
5980
  additionalSigners: additionalSigners
@@ -6173,7 +5983,7 @@ var PerpetualsClient = (function () {
6173
5983
  });
6174
5984
  }); };
6175
5985
  this.reimburse = function (tokenMint, amountIn, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
6176
- 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;
6177
5987
  var _f;
6178
5988
  return __generator(this, function (_g) {
6179
5989
  switch (_g.label) {
@@ -6233,9 +6043,9 @@ var PerpetualsClient = (function () {
6233
6043
  instructions.push(reimburse);
6234
6044
  return [3, 5];
6235
6045
  case 4:
6236
- err_38 = _g.sent();
6237
- console.log("perpClient setPool error:: ", err_38);
6238
- throw err_38;
6046
+ err_36 = _g.sent();
6047
+ console.log("perpClient setPool error:: ", err_36);
6048
+ throw err_36;
6239
6049
  case 5: return [2, {
6240
6050
  instructions: __spreadArray([], instructions, true),
6241
6051
  additionalSigners: additionalSigners
@@ -6244,7 +6054,7 @@ var PerpetualsClient = (function () {
6244
6054
  });
6245
6055
  }); };
6246
6056
  this.setInternalOraclePrice = function (tokenMint, price, expo, conf, ema, publishTime, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
6247
- var instructions, additionalSigners, custodyConfig, setInternalOraclePrice, err_39;
6057
+ var instructions, additionalSigners, custodyConfig, setInternalOraclePrice, err_37;
6248
6058
  return __generator(this, function (_a) {
6249
6059
  switch (_a.label) {
6250
6060
  case 0:
@@ -6277,9 +6087,9 @@ var PerpetualsClient = (function () {
6277
6087
  instructions.push(setInternalOraclePrice);
6278
6088
  return [3, 4];
6279
6089
  case 3:
6280
- err_39 = _a.sent();
6281
- console.log("perpClient setInternalOracleAccount error:: ", err_39);
6282
- throw err_39;
6090
+ err_37 = _a.sent();
6091
+ console.log("perpClient setInternalOracleAccount error:: ", err_37);
6092
+ throw err_37;
6283
6093
  case 4: return [2, {
6284
6094
  instructions: __spreadArray([], instructions, true),
6285
6095
  additionalSigners: additionalSigners
@@ -6291,7 +6101,7 @@ var PerpetualsClient = (function () {
6291
6101
  if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
6292
6102
  if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
6293
6103
  return __awaiter(_this, void 0, void 0, function () {
6294
- 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;
6295
6105
  return __generator(this, function (_e) {
6296
6106
  switch (_e.label) {
6297
6107
  case 0:
@@ -6414,8 +6224,8 @@ var PerpetualsClient = (function () {
6414
6224
  instructions.push(addCompoundingLiquidity);
6415
6225
  return [3, 10];
6416
6226
  case 9:
6417
- err_40 = _e.sent();
6418
- console.log("perpClient addCompoundingLiquidity error:: ", err_40);
6227
+ err_38 = _e.sent();
6228
+ console.log("perpClient addCompoundingLiquidity error:: ", err_38);
6419
6229
  return [3, 10];
6420
6230
  case 10: return [2, {
6421
6231
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
@@ -6429,7 +6239,7 @@ var PerpetualsClient = (function () {
6429
6239
  if (createUserATA === void 0) { createUserATA = true; }
6430
6240
  if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
6431
6241
  return __awaiter(_this, void 0, void 0, function () {
6432
- 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;
6433
6243
  return __generator(this, function (_e) {
6434
6244
  switch (_e.label) {
6435
6245
  case 0:
@@ -6536,8 +6346,8 @@ var PerpetualsClient = (function () {
6536
6346
  instructions.push(removeCompoundingLiquidity);
6537
6347
  return [3, 8];
6538
6348
  case 7:
6539
- err_41 = _e.sent();
6540
- console.log("perpClient removeCompoundingLiquidity error:: ", err_41);
6349
+ err_39 = _e.sent();
6350
+ console.log("perpClient removeCompoundingLiquidity error:: ", err_39);
6541
6351
  return [3, 8];
6542
6352
  case 8: return [2, {
6543
6353
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
@@ -6550,7 +6360,7 @@ var PerpetualsClient = (function () {
6550
6360
  this.migrateStake = function (amount, rewardTokenMint, poolConfig, createUserATA) {
6551
6361
  if (createUserATA === void 0) { createUserATA = true; }
6552
6362
  return __awaiter(_this, void 0, void 0, function () {
6553
- 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;
6554
6364
  return __generator(this, function (_e) {
6555
6365
  switch (_e.label) {
6556
6366
  case 0:
@@ -6631,8 +6441,8 @@ var PerpetualsClient = (function () {
6631
6441
  instructions.push(migrateStake);
6632
6442
  return [3, 6];
6633
6443
  case 5:
6634
- err_42 = _e.sent();
6635
- console.log("perpClient migrateStake error:: ", err_42);
6444
+ err_40 = _e.sent();
6445
+ console.log("perpClient migrateStake error:: ", err_40);
6636
6446
  return [3, 6];
6637
6447
  case 6: return [2, {
6638
6448
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
@@ -6643,7 +6453,7 @@ var PerpetualsClient = (function () {
6643
6453
  });
6644
6454
  };
6645
6455
  this.migrateFlp = function (amount, rewardTokenMint, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
6646
- 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;
6647
6457
  return __generator(this, function (_d) {
6648
6458
  switch (_d.label) {
6649
6459
  case 0:
@@ -6715,8 +6525,8 @@ var PerpetualsClient = (function () {
6715
6525
  instructions.push(migrateFlp);
6716
6526
  return [3, 4];
6717
6527
  case 3:
6718
- err_43 = _d.sent();
6719
- console.log("perpClient migrateFlp error:: ", err_43);
6528
+ err_41 = _d.sent();
6529
+ console.log("perpClient migrateFlp error:: ", err_41);
6720
6530
  return [3, 4];
6721
6531
  case 4: return [2, {
6722
6532
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
@@ -6728,7 +6538,7 @@ var PerpetualsClient = (function () {
6728
6538
  this.compoundingFee = function (poolConfig, rewardTokenSymbol) {
6729
6539
  if (rewardTokenSymbol === void 0) { rewardTokenSymbol = 'USDC'; }
6730
6540
  return __awaiter(_this, void 0, void 0, function () {
6731
- 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;
6732
6542
  return __generator(this, function (_d) {
6733
6543
  switch (_d.label) {
6734
6544
  case 0:
@@ -6785,8 +6595,8 @@ var PerpetualsClient = (function () {
6785
6595
  instructions.push(compoundingFee);
6786
6596
  return [3, 4];
6787
6597
  case 3:
6788
- err_44 = _d.sent();
6789
- console.log("perpClient compoundingFee error:: ", err_44);
6598
+ err_42 = _d.sent();
6599
+ console.log("perpClient compoundingFee error:: ", err_42);
6790
6600
  return [3, 4];
6791
6601
  case 4: return [2, {
6792
6602
  instructions: __spreadArray([], instructions, true),
@@ -6797,7 +6607,7 @@ var PerpetualsClient = (function () {
6797
6607
  });
6798
6608
  };
6799
6609
  this.renameFlp = function (flag, lpTokenName, lpTokenSymbol, lpTokenUri, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
6800
- var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp, err_45;
6610
+ var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp, err_43;
6801
6611
  return __generator(this, function (_a) {
6802
6612
  switch (_a.label) {
6803
6613
  case 0:
@@ -6835,8 +6645,8 @@ var PerpetualsClient = (function () {
6835
6645
  instructions.push(renameFlp);
6836
6646
  return [3, 4];
6837
6647
  case 3:
6838
- err_45 = _a.sent();
6839
- console.log("perpClient renameFlp error:: ", err_45);
6648
+ err_43 = _a.sent();
6649
+ console.log("perpClient renameFlp error:: ", err_43);
6840
6650
  return [3, 4];
6841
6651
  case 4: return [2, {
6842
6652
  instructions: __spreadArray([], instructions, true),
@@ -6846,7 +6656,7 @@ var PerpetualsClient = (function () {
6846
6656
  });
6847
6657
  }); };
6848
6658
  this.initRewardDistribution = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
6849
- 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;
6850
6660
  return __generator(this, function (_a) {
6851
6661
  switch (_a.label) {
6852
6662
  case 0:
@@ -6880,9 +6690,9 @@ var PerpetualsClient = (function () {
6880
6690
  instructions.push(initRewardVault);
6881
6691
  return [3, 4];
6882
6692
  case 3:
6883
- err_46 = _a.sent();
6884
- console.log("rewardDistribution InitRewardVault error:: ", err_46);
6885
- throw err_46;
6693
+ err_44 = _a.sent();
6694
+ console.log("rewardDistribution InitRewardVault error:: ", err_44);
6695
+ throw err_44;
6886
6696
  case 4: return [2, {
6887
6697
  instructions: __spreadArray([], instructions, true),
6888
6698
  additionalSigners: additionalSigners
@@ -6891,7 +6701,7 @@ var PerpetualsClient = (function () {
6891
6701
  });
6892
6702
  }); };
6893
6703
  this.updateCounterReward = function () { return __awaiter(_this, void 0, void 0, function () {
6894
- var publicKey, instructions, additionalSigners, rewardVault, updateCounter, err_47;
6704
+ var publicKey, instructions, additionalSigners, rewardVault, updateCounter, err_45;
6895
6705
  return __generator(this, function (_a) {
6896
6706
  switch (_a.label) {
6897
6707
  case 0:
@@ -6914,9 +6724,9 @@ var PerpetualsClient = (function () {
6914
6724
  instructions.push(updateCounter);
6915
6725
  return [3, 4];
6916
6726
  case 3:
6917
- err_47 = _a.sent();
6918
- console.log("rewardDistribution updateCounter error:: ", err_47);
6919
- throw err_47;
6727
+ err_45 = _a.sent();
6728
+ console.log("rewardDistribution updateCounter error:: ", err_45);
6729
+ throw err_45;
6920
6730
  case 4: return [2, {
6921
6731
  instructions: __spreadArray([], instructions, true),
6922
6732
  additionalSigners: additionalSigners
@@ -6925,7 +6735,7 @@ var PerpetualsClient = (function () {
6925
6735
  });
6926
6736
  }); };
6927
6737
  this.rewardDistribution = function (counter, owner, rewardAmount, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
6928
- 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;
6929
6739
  return __generator(this, function (_a) {
6930
6740
  switch (_a.label) {
6931
6741
  case 0:
@@ -6964,9 +6774,9 @@ var PerpetualsClient = (function () {
6964
6774
  instructions.push(distributeReward);
6965
6775
  return [3, 4];
6966
6776
  case 3:
6967
- err_48 = _a.sent();
6968
- console.log("rewardDistribution distributeReward error:: ", err_48);
6969
- throw err_48;
6777
+ err_46 = _a.sent();
6778
+ console.log("rewardDistribution distributeReward error:: ", err_46);
6779
+ throw err_46;
6970
6780
  case 4: return [2, {
6971
6781
  instructions: __spreadArray([], instructions, true),
6972
6782
  additionalSigners: additionalSigners
@@ -6977,7 +6787,7 @@ var PerpetualsClient = (function () {
6977
6787
  this.collectReward = function (counter, owner, rewardSymbol, poolConfig, createUserATA) {
6978
6788
  if (createUserATA === void 0) { createUserATA = true; }
6979
6789
  return __awaiter(_this, void 0, void 0, function () {
6980
- 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;
6981
6791
  return __generator(this, function (_b) {
6982
6792
  switch (_b.label) {
6983
6793
  case 0:
@@ -7025,8 +6835,8 @@ var PerpetualsClient = (function () {
7025
6835
  instructions.push(collectRaffleReward);
7026
6836
  return [3, 6];
7027
6837
  case 5:
7028
- err_49 = _b.sent();
7029
- throw err_49;
6838
+ err_47 = _b.sent();
6839
+ throw err_47;
7030
6840
  case 6: return [2, {
7031
6841
  instructions: __spreadArray([], instructions, true),
7032
6842
  additionalSigners: additionalSigners