flash-sdk 2.18.2 → 2.19.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.
- package/dist/PerpetualsClient.d.ts +8 -0
- package/dist/PerpetualsClient.js +234 -73
- package/dist/idl/perpetuals.d.ts +481 -1
- package/dist/idl/perpetuals.js +481 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utils/alt.d.ts +1 -0
- package/package.json +1 -1
@@ -4106,6 +4106,10 @@ 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
|
+
}>;
|
4109
4113
|
placeTriggerOrder: (targetSymbol: string, collateralSymbol: string, side: Side, triggerPrice: ContractOraclePrice, deltaSizeAmount: BN, isStopLoss: boolean, receiveCustodyId: number, poolConfig: PoolConfig) => Promise<{
|
4110
4114
|
instructions: TransactionInstruction[];
|
4111
4115
|
additionalSigners: Signer[];
|
@@ -4118,6 +4122,10 @@ export declare class PerpetualsClient {
|
|
4118
4122
|
instructions: TransactionInstruction[];
|
4119
4123
|
additionalSigners: Signer[];
|
4120
4124
|
}>;
|
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
|
+
}>;
|
4121
4129
|
executeTriggerOrder: (owner: PublicKey, targetSymbol: string, collateralSymbol: string, side: Side, orderId: number, isStopLoss: boolean, poolConfig: PoolConfig, createUserATA?: boolean, ephemeralSignerPubkey?: any) => Promise<{
|
4122
4130
|
instructions: TransactionInstruction[];
|
4123
4131
|
additionalSigners: Signer[];
|
package/dist/PerpetualsClient.js
CHANGED
@@ -5583,8 +5583,72 @@ 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, positionAccount, orderAccount, executeLimitWithSwap, err_28;
|
5592
|
+
return __generator(this, function (_a) {
|
5593
|
+
switch (_a.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
|
+
_a.label = 1;
|
5605
|
+
case 1:
|
5606
|
+
_a.trys.push([1, 3, , 4]);
|
5607
|
+
positionAccount = poolConfig.getPositionFromMarketPk(userPubkey, marketAccount);
|
5608
|
+
orderAccount = poolConfig.getOrderFromMarketPk(userPubkey, marketAccount);
|
5609
|
+
return [4, this.program.methods
|
5610
|
+
.executeLimitWithSwap({
|
5611
|
+
orderId: orderId,
|
5612
|
+
privilege: privilege
|
5613
|
+
})
|
5614
|
+
.accounts({
|
5615
|
+
feePayer: publicKey,
|
5616
|
+
perpetuals: poolConfig.perpetuals,
|
5617
|
+
pool: poolConfig.poolAddress,
|
5618
|
+
reserveCustody: reserveCustodyConfig.custodyAccount,
|
5619
|
+
reserveCustodyOracleAccount: this.useExtOracleAccount ? reserveCustodyConfig.extOracleAccount : reserveCustodyConfig.intOracleAccount,
|
5620
|
+
position: positionAccount,
|
5621
|
+
order: orderAccount,
|
5622
|
+
market: marketAccount,
|
5623
|
+
targetCustody: targetCustodyConfig.custodyAccount,
|
5624
|
+
targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
|
5625
|
+
collateralCustody: collateralCustodyConfig.custodyAccount,
|
5626
|
+
collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
|
5627
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
5628
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
5629
|
+
eventAuthority: this.eventAuthority.publicKey,
|
5630
|
+
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
|
5631
|
+
})
|
5632
|
+
.remainingAccounts(__spreadArray([], (0, getNftAccounts_1.getNftAccounts)(nftTradingAccount, nftReferralAccount, nftRebateTokenAccount, privilege), true))
|
5633
|
+
.instruction()];
|
5634
|
+
case 2:
|
5635
|
+
executeLimitWithSwap = _a.sent();
|
5636
|
+
instructions.push(executeLimitWithSwap);
|
5637
|
+
return [3, 4];
|
5638
|
+
case 3:
|
5639
|
+
err_28 = _a.sent();
|
5640
|
+
console.log("perpClient executeLimitWithSwap error:: ", err_28);
|
5641
|
+
throw err_28;
|
5642
|
+
case 4: return [2, {
|
5643
|
+
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5644
|
+
additionalSigners: additionalSigners
|
5645
|
+
}];
|
5646
|
+
}
|
5647
|
+
});
|
5648
|
+
});
|
5649
|
+
};
|
5586
5650
|
this.placeTriggerOrder = function (targetSymbol, collateralSymbol, side, triggerPrice, deltaSizeAmount, isStopLoss, receiveCustodyId, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5587
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, placeTriggerOrder,
|
5651
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, placeTriggerOrder, err_29;
|
5588
5652
|
return __generator(this, function (_a) {
|
5589
5653
|
switch (_a.label) {
|
5590
5654
|
case 0:
|
@@ -5631,9 +5695,9 @@ var PerpetualsClient = (function () {
|
|
5631
5695
|
instructions.push(placeTriggerOrder);
|
5632
5696
|
return [3, 4];
|
5633
5697
|
case 3:
|
5634
|
-
|
5635
|
-
console.log("perpClient placeTriggerOrder error:: ",
|
5636
|
-
throw
|
5698
|
+
err_29 = _a.sent();
|
5699
|
+
console.log("perpClient placeTriggerOrder error:: ", err_29);
|
5700
|
+
throw err_29;
|
5637
5701
|
case 4: return [2, {
|
5638
5702
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5639
5703
|
additionalSigners: additionalSigners
|
@@ -5642,7 +5706,7 @@ var PerpetualsClient = (function () {
|
|
5642
5706
|
});
|
5643
5707
|
}); };
|
5644
5708
|
this.editTriggerOrder = function (targetSymbol, collateralSymbol, side, orderId, triggerPrice, deltaSizeAmount, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5645
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, editTriggerOrder,
|
5709
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, editTriggerOrder, err_30;
|
5646
5710
|
return __generator(this, function (_a) {
|
5647
5711
|
switch (_a.label) {
|
5648
5712
|
case 0:
|
@@ -5687,9 +5751,9 @@ var PerpetualsClient = (function () {
|
|
5687
5751
|
instructions.push(editTriggerOrder);
|
5688
5752
|
return [3, 4];
|
5689
5753
|
case 3:
|
5690
|
-
|
5691
|
-
console.log("perpClient editTriggerOrder error:: ",
|
5692
|
-
throw
|
5754
|
+
err_30 = _a.sent();
|
5755
|
+
console.log("perpClient editTriggerOrder error:: ", err_30);
|
5756
|
+
throw err_30;
|
5693
5757
|
case 4: return [2, {
|
5694
5758
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5695
5759
|
additionalSigners: additionalSigners
|
@@ -5698,7 +5762,7 @@ var PerpetualsClient = (function () {
|
|
5698
5762
|
});
|
5699
5763
|
}); };
|
5700
5764
|
this.cancelTriggerOrder = function (targetSymbol, collateralSymbol, side, orderId, isStopLoss, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5701
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, cancelTriggerOrder,
|
5765
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, orderAccount, cancelTriggerOrder, err_31;
|
5702
5766
|
return __generator(this, function (_a) {
|
5703
5767
|
switch (_a.label) {
|
5704
5768
|
case 0:
|
@@ -5731,9 +5795,9 @@ var PerpetualsClient = (function () {
|
|
5731
5795
|
instructions.push(cancelTriggerOrder);
|
5732
5796
|
return [3, 4];
|
5733
5797
|
case 3:
|
5734
|
-
|
5735
|
-
console.log("perpClient cancelTriggerOrder error:: ",
|
5736
|
-
throw
|
5798
|
+
err_31 = _a.sent();
|
5799
|
+
console.log("perpClient cancelTriggerOrder error:: ", err_31);
|
5800
|
+
throw err_31;
|
5737
5801
|
case 4: return [2, {
|
5738
5802
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5739
5803
|
additionalSigners: additionalSigners
|
@@ -5741,11 +5805,108 @@ var PerpetualsClient = (function () {
|
|
5741
5805
|
}
|
5742
5806
|
});
|
5743
5807
|
}); };
|
5808
|
+
this.executeTriggerWithSwap = function (owner, targetSymbol, collateralSymbol, receivingSymbol, side, orderId, isStopLoss, poolConfig, createUserATA, ephemeralSignerPubkey) {
|
5809
|
+
if (createUserATA === void 0) { createUserATA = true; }
|
5810
|
+
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
5811
|
+
return __awaiter(_this, void 0, void 0, function () {
|
5812
|
+
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, positionAccount, orderAccount, custodyAccountMetas, custodyOracleAccountMetas, _i, _b, custody, executeTriggerWithSwap, err_32;
|
5813
|
+
return __generator(this, function (_c) {
|
5814
|
+
switch (_c.label) {
|
5815
|
+
case 0:
|
5816
|
+
payerPubkey = this.provider.wallet.publicKey;
|
5817
|
+
targetCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(targetSymbol).mintKey); });
|
5818
|
+
collateralCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(collateralSymbol).mintKey); });
|
5819
|
+
receivingCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(receivingSymbol).mintKey); });
|
5820
|
+
marketAccount = poolConfig.getMarketPk(targetCustodyConfig.custodyAccount, collateralCustodyConfig.custodyAccount, side);
|
5821
|
+
preInstructions = [];
|
5822
|
+
instructions = [];
|
5823
|
+
postInstructions = [];
|
5824
|
+
additionalSigners = [];
|
5825
|
+
_c.label = 1;
|
5826
|
+
case 1:
|
5827
|
+
_c.trys.push([1, 7, , 8]);
|
5828
|
+
if (!false) return [3, 2];
|
5829
|
+
return [3, 5];
|
5830
|
+
case 2:
|
5831
|
+
userReceivingTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(poolConfig.getTokenFromSymbol(collateralSymbol).mintKey, owner, true);
|
5832
|
+
_a = createUserATA;
|
5833
|
+
if (!_a) return [3, 4];
|
5834
|
+
return [4, (0, utils_1.checkIfAccountExists)(userReceivingTokenAccount, this.provider.connection)];
|
5835
|
+
case 3:
|
5836
|
+
_a = !(_c.sent());
|
5837
|
+
_c.label = 4;
|
5838
|
+
case 4:
|
5839
|
+
if (_a) {
|
5840
|
+
preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(payerPubkey, userReceivingTokenAccount, owner, poolConfig.getTokenFromSymbol(collateralSymbol).mintKey));
|
5841
|
+
}
|
5842
|
+
_c.label = 5;
|
5843
|
+
case 5:
|
5844
|
+
positionAccount = poolConfig.getPositionFromMarketPk(owner, marketAccount);
|
5845
|
+
orderAccount = poolConfig.getOrderFromMarketPk(owner, marketAccount);
|
5846
|
+
custodyAccountMetas = [];
|
5847
|
+
custodyOracleAccountMetas = [];
|
5848
|
+
for (_i = 0, _b = poolConfig.custodies; _i < _b.length; _i++) {
|
5849
|
+
custody = _b[_i];
|
5850
|
+
custodyAccountMetas.push({
|
5851
|
+
pubkey: custody.custodyAccount,
|
5852
|
+
isSigner: false,
|
5853
|
+
isWritable: false,
|
5854
|
+
});
|
5855
|
+
custodyOracleAccountMetas.push({
|
5856
|
+
pubkey: this.useExtOracleAccount ? custody.extOracleAccount : custody.intOracleAccount,
|
5857
|
+
isSigner: false,
|
5858
|
+
isWritable: false,
|
5859
|
+
});
|
5860
|
+
}
|
5861
|
+
return [4, this.program.methods
|
5862
|
+
.executeTriggerWithSwap({
|
5863
|
+
isStopLoss: isStopLoss,
|
5864
|
+
orderId: orderId
|
5865
|
+
})
|
5866
|
+
.accounts({
|
5867
|
+
feePayer: payerPubkey,
|
5868
|
+
receivingAccount: userReceivingTokenAccount,
|
5869
|
+
transferAuthority: poolConfig.transferAuthority,
|
5870
|
+
perpetuals: poolConfig.perpetuals,
|
5871
|
+
pool: poolConfig.poolAddress,
|
5872
|
+
position: positionAccount,
|
5873
|
+
order: orderAccount,
|
5874
|
+
market: marketAccount,
|
5875
|
+
targetCustody: targetCustodyConfig.custodyAccount,
|
5876
|
+
targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
|
5877
|
+
collateralCustody: collateralCustodyConfig.custodyAccount,
|
5878
|
+
collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
|
5879
|
+
receivingCustody: receivingCustodyConfig.custodyAccount,
|
5880
|
+
receivingOracleAccount: this.useExtOracleAccount ? receivingCustodyConfig.extOracleAccount : receivingCustodyConfig.intOracleAccount,
|
5881
|
+
receivingCustodyTokenAccount: receivingCustodyConfig.tokenAccount,
|
5882
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
5883
|
+
eventAuthority: this.eventAuthority.publicKey,
|
5884
|
+
program: this.programId,
|
5885
|
+
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
|
5886
|
+
})
|
5887
|
+
.remainingAccounts(__spreadArray(__spreadArray([], custodyAccountMetas, true), custodyOracleAccountMetas, true))
|
5888
|
+
.instruction()];
|
5889
|
+
case 6:
|
5890
|
+
executeTriggerWithSwap = _c.sent();
|
5891
|
+
instructions.push(executeTriggerWithSwap);
|
5892
|
+
return [3, 8];
|
5893
|
+
case 7:
|
5894
|
+
err_32 = _c.sent();
|
5895
|
+
console.log("perpClient executeTriggerWithSwap error:: ", err_32);
|
5896
|
+
throw err_32;
|
5897
|
+
case 8: return [2, {
|
5898
|
+
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5899
|
+
additionalSigners: additionalSigners
|
5900
|
+
}];
|
5901
|
+
}
|
5902
|
+
});
|
5903
|
+
});
|
5904
|
+
};
|
5744
5905
|
this.executeTriggerOrder = function (owner, targetSymbol, collateralSymbol, side, orderId, isStopLoss, poolConfig, createUserATA, ephemeralSignerPubkey) {
|
5745
5906
|
if (createUserATA === void 0) { createUserATA = true; }
|
5746
5907
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
5747
5908
|
return __awaiter(_this, void 0, void 0, function () {
|
5748
|
-
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, positionAccount, orderAccount, executeTriggerOrder,
|
5909
|
+
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, positionAccount, orderAccount, executeTriggerOrder, err_33;
|
5749
5910
|
return __generator(this, function (_b) {
|
5750
5911
|
switch (_b.label) {
|
5751
5912
|
case 0:
|
@@ -5808,9 +5969,9 @@ var PerpetualsClient = (function () {
|
|
5808
5969
|
instructions.push(executeTriggerOrder);
|
5809
5970
|
return [3, 8];
|
5810
5971
|
case 7:
|
5811
|
-
|
5812
|
-
console.log("perpClient executeTriggerOrder error:: ",
|
5813
|
-
throw
|
5972
|
+
err_33 = _b.sent();
|
5973
|
+
console.log("perpClient executeTriggerOrder error:: ", err_33);
|
5974
|
+
throw err_33;
|
5814
5975
|
case 8: return [2, {
|
5815
5976
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5816
5977
|
additionalSigners: additionalSigners
|
@@ -5820,7 +5981,7 @@ var PerpetualsClient = (function () {
|
|
5820
5981
|
});
|
5821
5982
|
};
|
5822
5983
|
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,
|
5984
|
+
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, migrateTriggerOrder, err_34;
|
5824
5985
|
return __generator(this, function (_a) {
|
5825
5986
|
switch (_a.label) {
|
5826
5987
|
case 0:
|
@@ -5853,9 +6014,9 @@ var PerpetualsClient = (function () {
|
|
5853
6014
|
instructions.push(migrateTriggerOrder);
|
5854
6015
|
return [3, 4];
|
5855
6016
|
case 3:
|
5856
|
-
|
5857
|
-
console.log("perpClient migrateTriggerOrder error:: ",
|
5858
|
-
throw
|
6017
|
+
err_34 = _a.sent();
|
6018
|
+
console.log("perpClient migrateTriggerOrder error:: ", err_34);
|
6019
|
+
throw err_34;
|
5859
6020
|
case 4: return [2, {
|
5860
6021
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5861
6022
|
additionalSigners: additionalSigners
|
@@ -5864,7 +6025,7 @@ var PerpetualsClient = (function () {
|
|
5864
6025
|
});
|
5865
6026
|
}); };
|
5866
6027
|
this.getPositionData = function (position, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5867
|
-
var marketConfig, targetCustodyConfig, collateralCustodyConfig, getPositionData,
|
6028
|
+
var marketConfig, targetCustodyConfig, collateralCustodyConfig, getPositionData, err_35;
|
5868
6029
|
return __generator(this, function (_a) {
|
5869
6030
|
switch (_a.label) {
|
5870
6031
|
case 0:
|
@@ -5893,15 +6054,15 @@ var PerpetualsClient = (function () {
|
|
5893
6054
|
console.log(getPositionData);
|
5894
6055
|
return [2, getPositionData];
|
5895
6056
|
case 3:
|
5896
|
-
|
5897
|
-
console.log("perpClient setPool error:: ",
|
5898
|
-
throw
|
6057
|
+
err_35 = _a.sent();
|
6058
|
+
console.log("perpClient setPool error:: ", err_35);
|
6059
|
+
throw err_35;
|
5899
6060
|
case 4: return [2];
|
5900
6061
|
}
|
5901
6062
|
});
|
5902
6063
|
}); };
|
5903
6064
|
this.protocolWithdrawFees = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5904
|
-
var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx,
|
6065
|
+
var publicKey, custodyConfig, receivingTokenAccount, instructions, additionalSigners, withdrawFeesIx, err_36;
|
5905
6066
|
return __generator(this, function (_a) {
|
5906
6067
|
switch (_a.label) {
|
5907
6068
|
case 0:
|
@@ -5934,9 +6095,9 @@ var PerpetualsClient = (function () {
|
|
5934
6095
|
instructions.push(withdrawFeesIx);
|
5935
6096
|
return [3, 5];
|
5936
6097
|
case 4:
|
5937
|
-
|
5938
|
-
console.log("perpClient setPool error:: ",
|
5939
|
-
throw
|
6098
|
+
err_36 = _a.sent();
|
6099
|
+
console.log("perpClient setPool error:: ", err_36);
|
6100
|
+
throw err_36;
|
5940
6101
|
case 5: return [2, {
|
5941
6102
|
instructions: __spreadArray([], instructions, true),
|
5942
6103
|
additionalSigners: additionalSigners
|
@@ -5945,7 +6106,7 @@ var PerpetualsClient = (function () {
|
|
5945
6106
|
});
|
5946
6107
|
}); };
|
5947
6108
|
this.setPermissions = function (permissions) { return __awaiter(_this, void 0, void 0, function () {
|
5948
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction,
|
6109
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, setPermissionsInstruction, err_37;
|
5949
6110
|
return __generator(this, function (_a) {
|
5950
6111
|
switch (_a.label) {
|
5951
6112
|
case 0:
|
@@ -5972,9 +6133,9 @@ var PerpetualsClient = (function () {
|
|
5972
6133
|
instructions.push(setPermissionsInstruction);
|
5973
6134
|
return [3, 4];
|
5974
6135
|
case 3:
|
5975
|
-
|
5976
|
-
console.log("perpClient setPool error:: ",
|
5977
|
-
throw
|
6136
|
+
err_37 = _a.sent();
|
6137
|
+
console.log("perpClient setPool error:: ", err_37);
|
6138
|
+
throw err_37;
|
5978
6139
|
case 4: return [2, {
|
5979
6140
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5980
6141
|
additionalSigners: additionalSigners
|
@@ -5983,7 +6144,7 @@ var PerpetualsClient = (function () {
|
|
5983
6144
|
});
|
5984
6145
|
}); };
|
5985
6146
|
this.reimburse = function (tokenMint, amountIn, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5986
|
-
var custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, instructions, additionalSigners, custodyConfig, reimburse, _d, _e,
|
6147
|
+
var custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, instructions, additionalSigners, custodyConfig, reimburse, _d, _e, err_38;
|
5987
6148
|
var _f;
|
5988
6149
|
return __generator(this, function (_g) {
|
5989
6150
|
switch (_g.label) {
|
@@ -6043,9 +6204,9 @@ var PerpetualsClient = (function () {
|
|
6043
6204
|
instructions.push(reimburse);
|
6044
6205
|
return [3, 5];
|
6045
6206
|
case 4:
|
6046
|
-
|
6047
|
-
console.log("perpClient setPool error:: ",
|
6048
|
-
throw
|
6207
|
+
err_38 = _g.sent();
|
6208
|
+
console.log("perpClient setPool error:: ", err_38);
|
6209
|
+
throw err_38;
|
6049
6210
|
case 5: return [2, {
|
6050
6211
|
instructions: __spreadArray([], instructions, true),
|
6051
6212
|
additionalSigners: additionalSigners
|
@@ -6054,7 +6215,7 @@ var PerpetualsClient = (function () {
|
|
6054
6215
|
});
|
6055
6216
|
}); };
|
6056
6217
|
this.setInternalOraclePrice = function (tokenMint, price, expo, conf, ema, publishTime, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6057
|
-
var instructions, additionalSigners, custodyConfig, setInternalOraclePrice,
|
6218
|
+
var instructions, additionalSigners, custodyConfig, setInternalOraclePrice, err_39;
|
6058
6219
|
return __generator(this, function (_a) {
|
6059
6220
|
switch (_a.label) {
|
6060
6221
|
case 0:
|
@@ -6087,9 +6248,9 @@ var PerpetualsClient = (function () {
|
|
6087
6248
|
instructions.push(setInternalOraclePrice);
|
6088
6249
|
return [3, 4];
|
6089
6250
|
case 3:
|
6090
|
-
|
6091
|
-
console.log("perpClient setInternalOracleAccount error:: ",
|
6092
|
-
throw
|
6251
|
+
err_39 = _a.sent();
|
6252
|
+
console.log("perpClient setInternalOracleAccount error:: ", err_39);
|
6253
|
+
throw err_39;
|
6093
6254
|
case 4: return [2, {
|
6094
6255
|
instructions: __spreadArray([], instructions, true),
|
6095
6256
|
additionalSigners: additionalSigners
|
@@ -6101,7 +6262,7 @@ var PerpetualsClient = (function () {
|
|
6101
6262
|
if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
|
6102
6263
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
6103
6264
|
return __awaiter(_this, void 0, void 0, function () {
|
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,
|
6265
|
+
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;
|
6105
6266
|
return __generator(this, function (_e) {
|
6106
6267
|
switch (_e.label) {
|
6107
6268
|
case 0:
|
@@ -6224,8 +6385,8 @@ var PerpetualsClient = (function () {
|
|
6224
6385
|
instructions.push(addCompoundingLiquidity);
|
6225
6386
|
return [3, 10];
|
6226
6387
|
case 9:
|
6227
|
-
|
6228
|
-
console.log("perpClient addCompoundingLiquidity error:: ",
|
6388
|
+
err_40 = _e.sent();
|
6389
|
+
console.log("perpClient addCompoundingLiquidity error:: ", err_40);
|
6229
6390
|
return [3, 10];
|
6230
6391
|
case 10: return [2, {
|
6231
6392
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
@@ -6239,7 +6400,7 @@ var PerpetualsClient = (function () {
|
|
6239
6400
|
if (createUserATA === void 0) { createUserATA = true; }
|
6240
6401
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
6241
6402
|
return __awaiter(_this, void 0, void 0, function () {
|
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,
|
6403
|
+
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;
|
6243
6404
|
return __generator(this, function (_e) {
|
6244
6405
|
switch (_e.label) {
|
6245
6406
|
case 0:
|
@@ -6346,8 +6507,8 @@ var PerpetualsClient = (function () {
|
|
6346
6507
|
instructions.push(removeCompoundingLiquidity);
|
6347
6508
|
return [3, 8];
|
6348
6509
|
case 7:
|
6349
|
-
|
6350
|
-
console.log("perpClient removeCompoundingLiquidity error:: ",
|
6510
|
+
err_41 = _e.sent();
|
6511
|
+
console.log("perpClient removeCompoundingLiquidity error:: ", err_41);
|
6351
6512
|
return [3, 8];
|
6352
6513
|
case 8: return [2, {
|
6353
6514
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
@@ -6360,7 +6521,7 @@ var PerpetualsClient = (function () {
|
|
6360
6521
|
this.migrateStake = function (amount, rewardTokenMint, poolConfig, createUserATA) {
|
6361
6522
|
if (createUserATA === void 0) { createUserATA = true; }
|
6362
6523
|
return __awaiter(_this, void 0, void 0, function () {
|
6363
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoudingTokenAccount, _a, flpStakeAccount, poolStakedLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _b, custody, _c, _d, market, migrateStake,
|
6524
|
+
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;
|
6364
6525
|
return __generator(this, function (_e) {
|
6365
6526
|
switch (_e.label) {
|
6366
6527
|
case 0:
|
@@ -6441,8 +6602,8 @@ var PerpetualsClient = (function () {
|
|
6441
6602
|
instructions.push(migrateStake);
|
6442
6603
|
return [3, 6];
|
6443
6604
|
case 5:
|
6444
|
-
|
6445
|
-
console.log("perpClient migrateStake error:: ",
|
6605
|
+
err_42 = _e.sent();
|
6606
|
+
console.log("perpClient migrateStake error:: ", err_42);
|
6446
6607
|
return [3, 6];
|
6447
6608
|
case 6: return [2, {
|
6448
6609
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
@@ -6453,7 +6614,7 @@ var PerpetualsClient = (function () {
|
|
6453
6614
|
});
|
6454
6615
|
};
|
6455
6616
|
this.migrateFlp = function (amount, rewardTokenMint, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6456
|
-
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoudingTokenAccount, flpStakeAccount, poolStakedLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, migrateFlp,
|
6617
|
+
var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoudingTokenAccount, flpStakeAccount, poolStakedLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, migrateFlp, err_43;
|
6457
6618
|
return __generator(this, function (_d) {
|
6458
6619
|
switch (_d.label) {
|
6459
6620
|
case 0:
|
@@ -6525,8 +6686,8 @@ var PerpetualsClient = (function () {
|
|
6525
6686
|
instructions.push(migrateFlp);
|
6526
6687
|
return [3, 4];
|
6527
6688
|
case 3:
|
6528
|
-
|
6529
|
-
console.log("perpClient migrateFlp error:: ",
|
6689
|
+
err_43 = _d.sent();
|
6690
|
+
console.log("perpClient migrateFlp error:: ", err_43);
|
6530
6691
|
return [3, 4];
|
6531
6692
|
case 4: return [2, {
|
6532
6693
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
@@ -6538,7 +6699,7 @@ var PerpetualsClient = (function () {
|
|
6538
6699
|
this.compoundingFee = function (poolConfig, rewardTokenSymbol) {
|
6539
6700
|
if (rewardTokenSymbol === void 0) { rewardTokenSymbol = 'USDC'; }
|
6540
6701
|
return __awaiter(_this, void 0, void 0, function () {
|
6541
|
-
var instructions, additionalSigners, rewardCustody, lpTokenMint, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, compoundingFee,
|
6702
|
+
var instructions, additionalSigners, rewardCustody, lpTokenMint, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, compoundingFee, err_44;
|
6542
6703
|
return __generator(this, function (_d) {
|
6543
6704
|
switch (_d.label) {
|
6544
6705
|
case 0:
|
@@ -6595,8 +6756,8 @@ var PerpetualsClient = (function () {
|
|
6595
6756
|
instructions.push(compoundingFee);
|
6596
6757
|
return [3, 4];
|
6597
6758
|
case 3:
|
6598
|
-
|
6599
|
-
console.log("perpClient compoundingFee error:: ",
|
6759
|
+
err_44 = _d.sent();
|
6760
|
+
console.log("perpClient compoundingFee error:: ", err_44);
|
6600
6761
|
return [3, 4];
|
6601
6762
|
case 4: return [2, {
|
6602
6763
|
instructions: __spreadArray([], instructions, true),
|
@@ -6607,7 +6768,7 @@ var PerpetualsClient = (function () {
|
|
6607
6768
|
});
|
6608
6769
|
};
|
6609
6770
|
this.renameFlp = function (flag, lpTokenName, lpTokenSymbol, lpTokenUri, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6610
|
-
var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp,
|
6771
|
+
var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp, err_45;
|
6611
6772
|
return __generator(this, function (_a) {
|
6612
6773
|
switch (_a.label) {
|
6613
6774
|
case 0:
|
@@ -6645,8 +6806,8 @@ var PerpetualsClient = (function () {
|
|
6645
6806
|
instructions.push(renameFlp);
|
6646
6807
|
return [3, 4];
|
6647
6808
|
case 3:
|
6648
|
-
|
6649
|
-
console.log("perpClient renameFlp error:: ",
|
6809
|
+
err_45 = _a.sent();
|
6810
|
+
console.log("perpClient renameFlp error:: ", err_45);
|
6650
6811
|
return [3, 4];
|
6651
6812
|
case 4: return [2, {
|
6652
6813
|
instructions: __spreadArray([], instructions, true),
|
@@ -6656,7 +6817,7 @@ var PerpetualsClient = (function () {
|
|
6656
6817
|
});
|
6657
6818
|
}); };
|
6658
6819
|
this.initRewardDistribution = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6659
|
-
var publicKey, rewardMint, instructions, additionalSigners, fbNftProgramData, rewardVault, rewardTokenAccount, transferAuthority, initRewardVault,
|
6820
|
+
var publicKey, rewardMint, instructions, additionalSigners, fbNftProgramData, rewardVault, rewardTokenAccount, transferAuthority, initRewardVault, err_46;
|
6660
6821
|
return __generator(this, function (_a) {
|
6661
6822
|
switch (_a.label) {
|
6662
6823
|
case 0:
|
@@ -6690,9 +6851,9 @@ var PerpetualsClient = (function () {
|
|
6690
6851
|
instructions.push(initRewardVault);
|
6691
6852
|
return [3, 4];
|
6692
6853
|
case 3:
|
6693
|
-
|
6694
|
-
console.log("rewardDistribution InitRewardVault error:: ",
|
6695
|
-
throw
|
6854
|
+
err_46 = _a.sent();
|
6855
|
+
console.log("rewardDistribution InitRewardVault error:: ", err_46);
|
6856
|
+
throw err_46;
|
6696
6857
|
case 4: return [2, {
|
6697
6858
|
instructions: __spreadArray([], instructions, true),
|
6698
6859
|
additionalSigners: additionalSigners
|
@@ -6701,7 +6862,7 @@ var PerpetualsClient = (function () {
|
|
6701
6862
|
});
|
6702
6863
|
}); };
|
6703
6864
|
this.updateCounterReward = function () { return __awaiter(_this, void 0, void 0, function () {
|
6704
|
-
var publicKey, instructions, additionalSigners, rewardVault, updateCounter,
|
6865
|
+
var publicKey, instructions, additionalSigners, rewardVault, updateCounter, err_47;
|
6705
6866
|
return __generator(this, function (_a) {
|
6706
6867
|
switch (_a.label) {
|
6707
6868
|
case 0:
|
@@ -6724,9 +6885,9 @@ var PerpetualsClient = (function () {
|
|
6724
6885
|
instructions.push(updateCounter);
|
6725
6886
|
return [3, 4];
|
6726
6887
|
case 3:
|
6727
|
-
|
6728
|
-
console.log("rewardDistribution updateCounter error:: ",
|
6729
|
-
throw
|
6888
|
+
err_47 = _a.sent();
|
6889
|
+
console.log("rewardDistribution updateCounter error:: ", err_47);
|
6890
|
+
throw err_47;
|
6730
6891
|
case 4: return [2, {
|
6731
6892
|
instructions: __spreadArray([], instructions, true),
|
6732
6893
|
additionalSigners: additionalSigners
|
@@ -6735,7 +6896,7 @@ var PerpetualsClient = (function () {
|
|
6735
6896
|
});
|
6736
6897
|
}); };
|
6737
6898
|
this.rewardDistribution = function (counter, owner, rewardAmount, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
6738
|
-
var publicKey, rewardCustodyMint, instructions, additionalSigners, fundingAccount, rewardVault, rewardTokenAccount, rewardRecord, distributeReward,
|
6899
|
+
var publicKey, rewardCustodyMint, instructions, additionalSigners, fundingAccount, rewardVault, rewardTokenAccount, rewardRecord, distributeReward, err_48;
|
6739
6900
|
return __generator(this, function (_a) {
|
6740
6901
|
switch (_a.label) {
|
6741
6902
|
case 0:
|
@@ -6774,9 +6935,9 @@ var PerpetualsClient = (function () {
|
|
6774
6935
|
instructions.push(distributeReward);
|
6775
6936
|
return [3, 4];
|
6776
6937
|
case 3:
|
6777
|
-
|
6778
|
-
console.log("rewardDistribution distributeReward error:: ",
|
6779
|
-
throw
|
6938
|
+
err_48 = _a.sent();
|
6939
|
+
console.log("rewardDistribution distributeReward error:: ", err_48);
|
6940
|
+
throw err_48;
|
6780
6941
|
case 4: return [2, {
|
6781
6942
|
instructions: __spreadArray([], instructions, true),
|
6782
6943
|
additionalSigners: additionalSigners
|
@@ -6787,7 +6948,7 @@ var PerpetualsClient = (function () {
|
|
6787
6948
|
this.collectReward = function (counter, owner, rewardSymbol, poolConfig, createUserATA) {
|
6788
6949
|
if (createUserATA === void 0) { createUserATA = true; }
|
6789
6950
|
return __awaiter(_this, void 0, void 0, function () {
|
6790
|
-
var publicKey, rewardCustodyMint, instructions, additionalSigners, receivingTokenAccount, _a, rewardVault, rewardTokenAccount, rewardRecord, transferAuthority, collectRaffleReward,
|
6951
|
+
var publicKey, rewardCustodyMint, instructions, additionalSigners, receivingTokenAccount, _a, rewardVault, rewardTokenAccount, rewardRecord, transferAuthority, collectRaffleReward, err_49;
|
6791
6952
|
return __generator(this, function (_b) {
|
6792
6953
|
switch (_b.label) {
|
6793
6954
|
case 0:
|
@@ -6835,8 +6996,8 @@ var PerpetualsClient = (function () {
|
|
6835
6996
|
instructions.push(collectRaffleReward);
|
6836
6997
|
return [3, 6];
|
6837
6998
|
case 5:
|
6838
|
-
|
6839
|
-
throw
|
6999
|
+
err_49 = _b.sent();
|
7000
|
+
throw err_49;
|
6840
7001
|
case 6: return [2, {
|
6841
7002
|
instructions: __spreadArray([], instructions, true),
|
6842
7003
|
additionalSigners: additionalSigners
|