flash-sdk 2.40.8 → 2.40.10
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 +44 -44
- package/dist/PerpetualsClient.js +54 -48
- package/dist/idl/perpetuals.d.ts +393 -11
- package/dist/idl/perpetuals.js +393 -11
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +9 -0
- package/dist/utils/alt.d.ts +1 -0
- package/package.json +1 -1
@@ -343,11 +343,11 @@ export declare class PerpetualsClient {
|
|
343
343
|
sizeDecimals: number;
|
344
344
|
lockedDecimals: number;
|
345
345
|
collateralDecimals: number;
|
346
|
-
|
346
|
+
refererTokenStakeAccount: PublicKey;
|
347
347
|
refererBoosterAccount: PublicKey;
|
348
348
|
level: number;
|
349
|
-
|
350
|
-
|
349
|
+
withdrawRequestCount: number;
|
350
|
+
withdrawRequest: unknown;
|
351
351
|
activeStakeAmount: BN;
|
352
352
|
updateTimestamp: BN;
|
353
353
|
tradeTimestamp: BN;
|
@@ -660,11 +660,11 @@ export declare class PerpetualsClient {
|
|
660
660
|
sizeDecimals: number;
|
661
661
|
lockedDecimals: number;
|
662
662
|
collateralDecimals: number;
|
663
|
-
|
663
|
+
refererTokenStakeAccount: PublicKey;
|
664
664
|
refererBoosterAccount: PublicKey;
|
665
665
|
level: number;
|
666
|
-
|
667
|
-
|
666
|
+
withdrawRequestCount: number;
|
667
|
+
withdrawRequest: unknown;
|
668
668
|
activeStakeAmount: BN;
|
669
669
|
updateTimestamp: BN;
|
670
670
|
tradeTimestamp: BN;
|
@@ -976,11 +976,11 @@ export declare class PerpetualsClient {
|
|
976
976
|
sizeDecimals: number;
|
977
977
|
lockedDecimals: number;
|
978
978
|
collateralDecimals: number;
|
979
|
-
|
979
|
+
refererTokenStakeAccount: PublicKey;
|
980
980
|
refererBoosterAccount: PublicKey;
|
981
981
|
level: number;
|
982
|
-
|
983
|
-
|
982
|
+
withdrawRequestCount: number;
|
983
|
+
withdrawRequest: unknown;
|
984
984
|
activeStakeAmount: BN;
|
985
985
|
updateTimestamp: BN;
|
986
986
|
tradeTimestamp: BN;
|
@@ -1296,11 +1296,11 @@ export declare class PerpetualsClient {
|
|
1296
1296
|
sizeDecimals: number;
|
1297
1297
|
lockedDecimals: number;
|
1298
1298
|
collateralDecimals: number;
|
1299
|
-
|
1299
|
+
refererTokenStakeAccount: PublicKey;
|
1300
1300
|
refererBoosterAccount: PublicKey;
|
1301
1301
|
level: number;
|
1302
|
-
|
1303
|
-
|
1302
|
+
withdrawRequestCount: number;
|
1303
|
+
withdrawRequest: unknown;
|
1304
1304
|
activeStakeAmount: BN;
|
1305
1305
|
updateTimestamp: BN;
|
1306
1306
|
tradeTimestamp: BN;
|
@@ -1615,11 +1615,11 @@ export declare class PerpetualsClient {
|
|
1615
1615
|
sizeDecimals: number;
|
1616
1616
|
lockedDecimals: number;
|
1617
1617
|
collateralDecimals: number;
|
1618
|
-
|
1618
|
+
refererTokenStakeAccount: PublicKey;
|
1619
1619
|
refererBoosterAccount: PublicKey;
|
1620
1620
|
level: number;
|
1621
|
-
|
1622
|
-
|
1621
|
+
withdrawRequestCount: number;
|
1622
|
+
withdrawRequest: unknown;
|
1623
1623
|
activeStakeAmount: BN;
|
1624
1624
|
updateTimestamp: BN;
|
1625
1625
|
tradeTimestamp: BN;
|
@@ -1931,11 +1931,11 @@ export declare class PerpetualsClient {
|
|
1931
1931
|
sizeDecimals: number;
|
1932
1932
|
lockedDecimals: number;
|
1933
1933
|
collateralDecimals: number;
|
1934
|
-
|
1934
|
+
refererTokenStakeAccount: PublicKey;
|
1935
1935
|
refererBoosterAccount: PublicKey;
|
1936
1936
|
level: number;
|
1937
|
-
|
1938
|
-
|
1937
|
+
withdrawRequestCount: number;
|
1938
|
+
withdrawRequest: unknown;
|
1939
1939
|
activeStakeAmount: BN;
|
1940
1940
|
updateTimestamp: BN;
|
1941
1941
|
tradeTimestamp: BN;
|
@@ -2247,11 +2247,11 @@ export declare class PerpetualsClient {
|
|
2247
2247
|
sizeDecimals: number;
|
2248
2248
|
lockedDecimals: number;
|
2249
2249
|
collateralDecimals: number;
|
2250
|
-
|
2250
|
+
refererTokenStakeAccount: PublicKey;
|
2251
2251
|
refererBoosterAccount: PublicKey;
|
2252
2252
|
level: number;
|
2253
|
-
|
2254
|
-
|
2253
|
+
withdrawRequestCount: number;
|
2254
|
+
withdrawRequest: unknown;
|
2255
2255
|
activeStakeAmount: BN;
|
2256
2256
|
updateTimestamp: BN;
|
2257
2257
|
tradeTimestamp: BN;
|
@@ -2563,11 +2563,11 @@ export declare class PerpetualsClient {
|
|
2563
2563
|
sizeDecimals: number;
|
2564
2564
|
lockedDecimals: number;
|
2565
2565
|
collateralDecimals: number;
|
2566
|
-
|
2566
|
+
refererTokenStakeAccount: PublicKey;
|
2567
2567
|
refererBoosterAccount: PublicKey;
|
2568
2568
|
level: number;
|
2569
|
-
|
2570
|
-
|
2569
|
+
withdrawRequestCount: number;
|
2570
|
+
withdrawRequest: unknown;
|
2571
2571
|
activeStakeAmount: BN;
|
2572
2572
|
updateTimestamp: BN;
|
2573
2573
|
tradeTimestamp: BN;
|
@@ -2929,11 +2929,11 @@ export declare class PerpetualsClient {
|
|
2929
2929
|
sizeDecimals: number;
|
2930
2930
|
lockedDecimals: number;
|
2931
2931
|
collateralDecimals: number;
|
2932
|
-
|
2932
|
+
refererTokenStakeAccount: PublicKey;
|
2933
2933
|
refererBoosterAccount: PublicKey;
|
2934
2934
|
level: number;
|
2935
|
-
|
2936
|
-
|
2935
|
+
withdrawRequestCount: number;
|
2936
|
+
withdrawRequest: unknown;
|
2937
2937
|
activeStakeAmount: BN;
|
2938
2938
|
updateTimestamp: BN;
|
2939
2939
|
tradeTimestamp: BN;
|
@@ -3245,11 +3245,11 @@ export declare class PerpetualsClient {
|
|
3245
3245
|
sizeDecimals: number;
|
3246
3246
|
lockedDecimals: number;
|
3247
3247
|
collateralDecimals: number;
|
3248
|
-
|
3248
|
+
refererTokenStakeAccount: PublicKey;
|
3249
3249
|
refererBoosterAccount: PublicKey;
|
3250
3250
|
level: number;
|
3251
|
-
|
3252
|
-
|
3251
|
+
withdrawRequestCount: number;
|
3252
|
+
withdrawRequest: unknown;
|
3253
3253
|
activeStakeAmount: BN;
|
3254
3254
|
updateTimestamp: BN;
|
3255
3255
|
tradeTimestamp: BN;
|
@@ -3561,11 +3561,11 @@ export declare class PerpetualsClient {
|
|
3561
3561
|
sizeDecimals: number;
|
3562
3562
|
lockedDecimals: number;
|
3563
3563
|
collateralDecimals: number;
|
3564
|
-
|
3564
|
+
refererTokenStakeAccount: PublicKey;
|
3565
3565
|
refererBoosterAccount: PublicKey;
|
3566
3566
|
level: number;
|
3567
|
-
|
3568
|
-
|
3567
|
+
withdrawRequestCount: number;
|
3568
|
+
withdrawRequest: unknown;
|
3569
3569
|
activeStakeAmount: BN;
|
3570
3570
|
updateTimestamp: BN;
|
3571
3571
|
tradeTimestamp: BN;
|
@@ -3877,11 +3877,11 @@ export declare class PerpetualsClient {
|
|
3877
3877
|
sizeDecimals: number;
|
3878
3878
|
lockedDecimals: number;
|
3879
3879
|
collateralDecimals: number;
|
3880
|
-
|
3880
|
+
refererTokenStakeAccount: PublicKey;
|
3881
3881
|
refererBoosterAccount: PublicKey;
|
3882
3882
|
level: number;
|
3883
|
-
|
3884
|
-
|
3883
|
+
withdrawRequestCount: number;
|
3884
|
+
withdrawRequest: unknown;
|
3885
3885
|
activeStakeAmount: BN;
|
3886
3886
|
updateTimestamp: BN;
|
3887
3887
|
tradeTimestamp: BN;
|
@@ -4193,11 +4193,11 @@ export declare class PerpetualsClient {
|
|
4193
4193
|
sizeDecimals: number;
|
4194
4194
|
lockedDecimals: number;
|
4195
4195
|
collateralDecimals: number;
|
4196
|
-
|
4196
|
+
refererTokenStakeAccount: PublicKey;
|
4197
4197
|
refererBoosterAccount: PublicKey;
|
4198
4198
|
level: number;
|
4199
|
-
|
4200
|
-
|
4199
|
+
withdrawRequestCount: number;
|
4200
|
+
withdrawRequest: unknown;
|
4201
4201
|
activeStakeAmount: BN;
|
4202
4202
|
updateTimestamp: BN;
|
4203
4203
|
tradeTimestamp: BN;
|
@@ -4461,7 +4461,7 @@ export declare class PerpetualsClient {
|
|
4461
4461
|
instructions: TransactionInstruction[];
|
4462
4462
|
additionalSigners: Signer[];
|
4463
4463
|
}>;
|
4464
|
-
burnAndClaim: (owner: PublicKey, nftMint: PublicKey, poolConfig: PoolConfig) => Promise<{
|
4464
|
+
burnAndClaim: (owner: PublicKey, nftMint: PublicKey, poolConfig: PoolConfig, createAta: boolean) => Promise<{
|
4465
4465
|
instructions: TransactionInstruction[];
|
4466
4466
|
additionalSigners: Signer[];
|
4467
4467
|
}>;
|
@@ -4481,11 +4481,11 @@ export declare class PerpetualsClient {
|
|
4481
4481
|
instructions: TransactionInstruction[];
|
4482
4482
|
additionalSigners: Signer[];
|
4483
4483
|
}>;
|
4484
|
-
withdrawToken: (owner: PublicKey,
|
4484
|
+
withdrawToken: (owner: PublicKey, withdrawRequestId: number, poolConfig: PoolConfig) => Promise<{
|
4485
4485
|
instructions: TransactionInstruction[];
|
4486
4486
|
additionalSigners: Signer[];
|
4487
4487
|
}>;
|
4488
|
-
cancelUnstakeRequest: (owner: PublicKey,
|
4488
|
+
cancelUnstakeRequest: (owner: PublicKey, withdrawRequestId: number, poolConfig: PoolConfig) => Promise<{
|
4489
4489
|
instructions: TransactionInstruction[];
|
4490
4490
|
additionalSigners: Signer[];
|
4491
4491
|
}>;
|
@@ -4541,11 +4541,11 @@ export declare class PerpetualsClient {
|
|
4541
4541
|
instructions: TransactionInstruction[];
|
4542
4542
|
additionalSigners: Signer[];
|
4543
4543
|
}>;
|
4544
|
-
executeTriggerWithSwap: (owner: PublicKey, targetSymbol: string, collateralSymbol: string, receivingSymbol: string, side: Side, orderId: number, isStopLoss: boolean, poolConfig: PoolConfig, createUserATA?: boolean, ephemeralSignerPubkey?: any) => Promise<{
|
4544
|
+
executeTriggerWithSwap: (owner: PublicKey, targetSymbol: string, collateralSymbol: string, receivingSymbol: string, side: Side, orderId: number, isStopLoss: boolean, privilege: Privilege, poolConfig: PoolConfig, createUserATA?: boolean, ephemeralSignerPubkey?: any, nftTradingAccount?: PublicKey, nftReferralAccount?: PublicKey, nftRebateTokenAccount?: PublicKey) => Promise<{
|
4545
4545
|
instructions: TransactionInstruction[];
|
4546
4546
|
additionalSigners: Signer[];
|
4547
4547
|
}>;
|
4548
|
-
executeTriggerOrder: (owner: PublicKey, targetSymbol: string, collateralSymbol: string, side: Side, orderId: number, isStopLoss: boolean, poolConfig: PoolConfig, createUserATA?: boolean, ephemeralSignerPubkey?: any) => Promise<{
|
4548
|
+
executeTriggerOrder: (owner: PublicKey, targetSymbol: string, collateralSymbol: string, side: Side, orderId: number, isStopLoss: boolean, privilege: Privilege, poolConfig: PoolConfig, createUserATA?: boolean, ephemeralSignerPubkey?: any, nftTradingAccount?: PublicKey, nftReferralAccount?: PublicKey, nftRebateTokenAccount?: PublicKey) => Promise<{
|
4549
4549
|
instructions: TransactionInstruction[];
|
4550
4550
|
additionalSigners: Signer[];
|
4551
4551
|
}>;
|
package/dist/PerpetualsClient.js
CHANGED
@@ -5129,29 +5129,34 @@ var PerpetualsClient = (function () {
|
|
5129
5129
|
}
|
5130
5130
|
});
|
5131
5131
|
}); };
|
5132
|
-
this.burnAndClaim = function (owner, nftMint, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5133
|
-
var preInstructions, instructions, postInstructions, additionalSigners, userTokenAccount, nftTokenAccount, nftTradingAccount, metadataAccount, collectionMetadata, edition, tokenRecord, burnAndClaimInstruction, err_24;
|
5134
|
-
return __generator(this, function (
|
5135
|
-
switch (
|
5132
|
+
this.burnAndClaim = function (owner, nftMint, poolConfig, createAta) { return __awaiter(_this, void 0, void 0, function () {
|
5133
|
+
var preInstructions, instructions, postInstructions, additionalSigners, userTokenAccount, _a, nftTokenAccount, nftTradingAccount, metadataAccount, collectionMetadata, edition, tokenRecord, burnAndClaimInstruction, err_24;
|
5134
|
+
return __generator(this, function (_b) {
|
5135
|
+
switch (_b.label) {
|
5136
5136
|
case 0:
|
5137
5137
|
preInstructions = [];
|
5138
5138
|
instructions = [];
|
5139
5139
|
postInstructions = [];
|
5140
5140
|
additionalSigners = [];
|
5141
|
-
|
5141
|
+
_b.label = 1;
|
5142
5142
|
case 1:
|
5143
|
-
|
5143
|
+
_b.trys.push([1, 7, , 8]);
|
5144
5144
|
return [4, (0, spl_token_1.getAssociatedTokenAddress)(poolConfig.tokenMint, owner, true)];
|
5145
5145
|
case 2:
|
5146
|
-
userTokenAccount =
|
5146
|
+
userTokenAccount = _b.sent();
|
5147
|
+
_a = createAta;
|
5148
|
+
if (!_a) return [3, 4];
|
5147
5149
|
return [4, (0, utils_1.checkIfAccountExists)(userTokenAccount, this.provider.connection)];
|
5148
5150
|
case 3:
|
5149
|
-
|
5151
|
+
_a = !(_b.sent());
|
5152
|
+
_b.label = 4;
|
5153
|
+
case 4:
|
5154
|
+
if (_a) {
|
5150
5155
|
preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(owner, userTokenAccount, owner, poolConfig.tokenMint));
|
5151
5156
|
}
|
5152
5157
|
return [4, (0, spl_token_1.getAssociatedTokenAddress)(nftMint, owner, true)];
|
5153
|
-
case
|
5154
|
-
nftTokenAccount =
|
5158
|
+
case 5:
|
5159
|
+
nftTokenAccount = _b.sent();
|
5155
5160
|
nftTradingAccount = web3_js_1.PublicKey.findProgramAddressSync([
|
5156
5161
|
Buffer.from("trading"),
|
5157
5162
|
nftMint.toBuffer(),
|
@@ -5184,15 +5189,15 @@ var PerpetualsClient = (function () {
|
|
5184
5189
|
program: this.programId
|
5185
5190
|
})
|
5186
5191
|
.instruction()];
|
5187
|
-
case 5:
|
5188
|
-
burnAndClaimInstruction = _a.sent();
|
5189
|
-
instructions.push(burnAndClaimInstruction);
|
5190
|
-
return [3, 7];
|
5191
5192
|
case 6:
|
5192
|
-
|
5193
|
+
burnAndClaimInstruction = _b.sent();
|
5194
|
+
instructions.push(burnAndClaimInstruction);
|
5195
|
+
return [3, 8];
|
5196
|
+
case 7:
|
5197
|
+
err_24 = _b.sent();
|
5193
5198
|
console.log("perpClient burnAndClaimInstruction error:: ", err_24);
|
5194
5199
|
throw err_24;
|
5195
|
-
case
|
5200
|
+
case 8: return [2, {
|
5196
5201
|
instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
|
5197
5202
|
additionalSigners: additionalSigners
|
5198
5203
|
}];
|
@@ -5404,7 +5409,7 @@ var PerpetualsClient = (function () {
|
|
5404
5409
|
}
|
5405
5410
|
});
|
5406
5411
|
}); };
|
5407
|
-
this.withdrawToken = function (owner,
|
5412
|
+
this.withdrawToken = function (owner, withdrawRequestId, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5408
5413
|
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, userTokenAccount, withdrawTokenInstruction, err_29;
|
5409
5414
|
return __generator(this, function (_a) {
|
5410
5415
|
switch (_a.label) {
|
@@ -5425,7 +5430,7 @@ var PerpetualsClient = (function () {
|
|
5425
5430
|
}
|
5426
5431
|
return [4, this.program.methods
|
5427
5432
|
.withdrawToken({
|
5428
|
-
|
5433
|
+
withdrawRequestId: withdrawRequestId
|
5429
5434
|
})
|
5430
5435
|
.accounts({
|
5431
5436
|
owner: owner,
|
@@ -5455,7 +5460,7 @@ var PerpetualsClient = (function () {
|
|
5455
5460
|
}
|
5456
5461
|
});
|
5457
5462
|
}); };
|
5458
|
-
this.cancelUnstakeRequest = function (owner,
|
5463
|
+
this.cancelUnstakeRequest = function (owner, withdrawRequestId, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
|
5459
5464
|
var preInstructions, instructions, postInstructions, additionalSigners, tokenStakeAccount, cancelUnstakeRequestInstruction, err_30;
|
5460
5465
|
return __generator(this, function (_a) {
|
5461
5466
|
switch (_a.label) {
|
@@ -5470,7 +5475,7 @@ var PerpetualsClient = (function () {
|
|
5470
5475
|
tokenStakeAccount = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("token_stake"), owner.toBuffer()], this.programId)[0];
|
5471
5476
|
return [4, this.program.methods
|
5472
5477
|
.cancelUnstakeTokenRequest({
|
5473
|
-
|
5478
|
+
withdrawRequestId: withdrawRequestId
|
5474
5479
|
})
|
5475
5480
|
.accounts({
|
5476
5481
|
owner: owner,
|
@@ -6102,7 +6107,9 @@ var PerpetualsClient = (function () {
|
|
6102
6107
|
privilege: privilege
|
6103
6108
|
})
|
6104
6109
|
.accounts({
|
6110
|
+
positionOwner: userPubkey,
|
6105
6111
|
feePayer: publicKey,
|
6112
|
+
transferAuthority: poolConfig.transferAuthority,
|
6106
6113
|
perpetuals: poolConfig.perpetuals,
|
6107
6114
|
pool: poolConfig.poolAddress,
|
6108
6115
|
position: positionAccount,
|
@@ -6112,6 +6119,7 @@ var PerpetualsClient = (function () {
|
|
6112
6119
|
targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
|
6113
6120
|
collateralCustody: collateralCustodyConfig.custodyAccount,
|
6114
6121
|
collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
|
6122
|
+
collateralCustodyTokenAccount: collateralCustodyConfig.tokenAccount,
|
6115
6123
|
systemProgram: web3_js_1.SystemProgram.programId,
|
6116
6124
|
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
6117
6125
|
eventAuthority: this.eventAuthority.publicKey,
|
@@ -6141,9 +6149,9 @@ var PerpetualsClient = (function () {
|
|
6141
6149
|
if (nftReferralAccount === void 0) { nftReferralAccount = web3_js_1.PublicKey.default; }
|
6142
6150
|
if (nftRebateTokenAccount === void 0) { nftRebateTokenAccount = web3_js_1.PublicKey.default; }
|
6143
6151
|
return __awaiter(_this, void 0, void 0, function () {
|
6144
|
-
var publicKey, targetCustodyConfig, collateralCustodyConfig, reserveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners,
|
6145
|
-
return __generator(this, function (
|
6146
|
-
switch (
|
6152
|
+
var publicKey, targetCustodyConfig, collateralCustodyConfig, reserveCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, positionAccount, orderAccount, executeLimitWithSwap, err_40;
|
6153
|
+
return __generator(this, function (_a) {
|
6154
|
+
switch (_a.label) {
|
6147
6155
|
case 0:
|
6148
6156
|
publicKey = this.provider.wallet.publicKey;
|
6149
6157
|
targetCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(targetSymbol).mintKey); });
|
@@ -6154,24 +6162,9 @@ var PerpetualsClient = (function () {
|
|
6154
6162
|
instructions = [];
|
6155
6163
|
postInstructions = [];
|
6156
6164
|
additionalSigners = [];
|
6157
|
-
|
6158
|
-
custodyOracleAccountMetas = [];
|
6159
|
-
for (_i = 0, _a = poolConfig.custodies; _i < _a.length; _i++) {
|
6160
|
-
custody = _a[_i];
|
6161
|
-
custodyAccountMetas.push({
|
6162
|
-
pubkey: custody.custodyAccount,
|
6163
|
-
isSigner: false,
|
6164
|
-
isWritable: false,
|
6165
|
-
});
|
6166
|
-
custodyOracleAccountMetas.push({
|
6167
|
-
pubkey: this.useExtOracleAccount ? custody.extOracleAccount : custody.intOracleAccount,
|
6168
|
-
isSigner: false,
|
6169
|
-
isWritable: false,
|
6170
|
-
});
|
6171
|
-
}
|
6172
|
-
_b.label = 1;
|
6165
|
+
_a.label = 1;
|
6173
6166
|
case 1:
|
6174
|
-
|
6167
|
+
_a.trys.push([1, 3, , 4]);
|
6175
6168
|
positionAccount = poolConfig.getPositionFromMarketPk(userPubkey, marketAccount);
|
6176
6169
|
orderAccount = poolConfig.getOrderFromMarketPk(userPubkey, marketAccount);
|
6177
6170
|
return [4, this.program.methods
|
@@ -6180,7 +6173,9 @@ var PerpetualsClient = (function () {
|
|
6180
6173
|
privilege: privilege
|
6181
6174
|
})
|
6182
6175
|
.accounts({
|
6176
|
+
positionOwner: userPubkey,
|
6183
6177
|
feePayer: publicKey,
|
6178
|
+
transferAuthority: poolConfig.transferAuthority,
|
6184
6179
|
perpetuals: poolConfig.perpetuals,
|
6185
6180
|
pool: poolConfig.poolAddress,
|
6186
6181
|
reserveCustody: reserveCustodyConfig.custodyAccount,
|
@@ -6192,20 +6187,21 @@ var PerpetualsClient = (function () {
|
|
6192
6187
|
targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
|
6193
6188
|
collateralCustody: collateralCustodyConfig.custodyAccount,
|
6194
6189
|
collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
|
6190
|
+
collateralCustodyTokenAccount: collateralCustodyConfig.tokenAccount,
|
6195
6191
|
systemProgram: web3_js_1.SystemProgram.programId,
|
6196
6192
|
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
6197
6193
|
eventAuthority: this.eventAuthority.publicKey,
|
6198
6194
|
program: this.programId,
|
6199
6195
|
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
|
6200
6196
|
})
|
6201
|
-
.remainingAccounts(__spreadArray(
|
6197
|
+
.remainingAccounts(__spreadArray([], (0, getNftAccounts_1.getNftAccounts)(nftTradingAccount, nftReferralAccount, nftRebateTokenAccount, privilege), true))
|
6202
6198
|
.instruction()];
|
6203
6199
|
case 2:
|
6204
|
-
executeLimitWithSwap =
|
6200
|
+
executeLimitWithSwap = _a.sent();
|
6205
6201
|
instructions.push(executeLimitWithSwap);
|
6206
6202
|
return [3, 4];
|
6207
6203
|
case 3:
|
6208
|
-
err_40 =
|
6204
|
+
err_40 = _a.sent();
|
6209
6205
|
console.log("perpClient executeLimitWithSwap error:: ", err_40);
|
6210
6206
|
throw err_40;
|
6211
6207
|
case 4: return [2, {
|
@@ -6374,9 +6370,12 @@ var PerpetualsClient = (function () {
|
|
6374
6370
|
}
|
6375
6371
|
});
|
6376
6372
|
}); };
|
6377
|
-
this.executeTriggerWithSwap = function (owner, targetSymbol, collateralSymbol, receivingSymbol, side, orderId, isStopLoss, poolConfig, createUserATA, ephemeralSignerPubkey) {
|
6373
|
+
this.executeTriggerWithSwap = function (owner, targetSymbol, collateralSymbol, receivingSymbol, side, orderId, isStopLoss, privilege, poolConfig, createUserATA, ephemeralSignerPubkey, nftTradingAccount, nftReferralAccount, nftRebateTokenAccount) {
|
6378
6374
|
if (createUserATA === void 0) { createUserATA = true; }
|
6379
6375
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
6376
|
+
if (nftTradingAccount === void 0) { nftTradingAccount = web3_js_1.PublicKey.default; }
|
6377
|
+
if (nftReferralAccount === void 0) { nftReferralAccount = web3_js_1.PublicKey.default; }
|
6378
|
+
if (nftRebateTokenAccount === void 0) { nftRebateTokenAccount = web3_js_1.PublicKey.default; }
|
6380
6379
|
return __awaiter(_this, void 0, void 0, function () {
|
6381
6380
|
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, receivingCustodyConfig, marketAccount, userReceivingTokenAccount, userReceivingTokenAccountCollateral, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, _b, positionAccount, orderAccount, custodyAccountMetas, custodyOracleAccountMetas, _i, _c, custody, executeTriggerWithSwap, err_44;
|
6382
6381
|
return __generator(this, function (_d) {
|
@@ -6441,9 +6440,11 @@ var PerpetualsClient = (function () {
|
|
6441
6440
|
return [4, this.program.methods
|
6442
6441
|
.executeTriggerWithSwap({
|
6443
6442
|
isStopLoss: isStopLoss,
|
6444
|
-
orderId: orderId
|
6443
|
+
orderId: orderId,
|
6444
|
+
privilege: privilege
|
6445
6445
|
})
|
6446
6446
|
.accounts({
|
6447
|
+
positionOwner: owner,
|
6447
6448
|
feePayer: payerPubkey,
|
6448
6449
|
receivingAccount: userReceivingTokenAccount,
|
6449
6450
|
collateralAccount: userReceivingTokenAccountCollateral,
|
@@ -6466,7 +6467,7 @@ var PerpetualsClient = (function () {
|
|
6466
6467
|
program: this.programId,
|
6467
6468
|
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
|
6468
6469
|
})
|
6469
|
-
.remainingAccounts(__spreadArray(
|
6470
|
+
.remainingAccounts(__spreadArray([], (0, getNftAccounts_1.getNftAccounts)(nftTradingAccount, nftReferralAccount, nftRebateTokenAccount, privilege), true))
|
6470
6471
|
.instruction()];
|
6471
6472
|
case 8:
|
6472
6473
|
executeTriggerWithSwap = _d.sent();
|
@@ -6484,9 +6485,12 @@ var PerpetualsClient = (function () {
|
|
6484
6485
|
});
|
6485
6486
|
});
|
6486
6487
|
};
|
6487
|
-
this.executeTriggerOrder = function (owner, targetSymbol, collateralSymbol, side, orderId, isStopLoss, poolConfig, createUserATA, ephemeralSignerPubkey) {
|
6488
|
+
this.executeTriggerOrder = function (owner, targetSymbol, collateralSymbol, side, orderId, isStopLoss, privilege, poolConfig, createUserATA, ephemeralSignerPubkey, nftTradingAccount, nftReferralAccount, nftRebateTokenAccount) {
|
6488
6489
|
if (createUserATA === void 0) { createUserATA = true; }
|
6489
6490
|
if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
|
6491
|
+
if (nftTradingAccount === void 0) { nftTradingAccount = web3_js_1.PublicKey.default; }
|
6492
|
+
if (nftReferralAccount === void 0) { nftReferralAccount = web3_js_1.PublicKey.default; }
|
6493
|
+
if (nftRebateTokenAccount === void 0) { nftRebateTokenAccount = web3_js_1.PublicKey.default; }
|
6490
6494
|
return __awaiter(_this, void 0, void 0, function () {
|
6491
6495
|
var payerPubkey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, _a, positionAccount, orderAccount, executeTriggerOrder, err_45;
|
6492
6496
|
return __generator(this, function (_b) {
|
@@ -6524,7 +6528,8 @@ var PerpetualsClient = (function () {
|
|
6524
6528
|
return [4, this.program.methods
|
6525
6529
|
.executeTriggerOrder({
|
6526
6530
|
isStopLoss: isStopLoss,
|
6527
|
-
orderId: orderId
|
6531
|
+
orderId: orderId,
|
6532
|
+
privilege: privilege
|
6528
6533
|
})
|
6529
6534
|
.accounts({
|
6530
6535
|
feePayer: payerPubkey,
|
@@ -6545,6 +6550,7 @@ var PerpetualsClient = (function () {
|
|
6545
6550
|
program: this.programId,
|
6546
6551
|
ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
|
6547
6552
|
})
|
6553
|
+
.remainingAccounts(__spreadArray([], (0, getNftAccounts_1.getNftAccounts)(nftTradingAccount, nftReferralAccount, nftRebateTokenAccount, privilege), true))
|
6548
6554
|
.instruction()];
|
6549
6555
|
case 6:
|
6550
6556
|
executeTriggerOrder = _b.sent();
|