flash-sdk 2.13.10 → 2.14.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.
@@ -2220,7 +2220,10 @@ var PerpetualsClient = (function () {
2220
2220
  }
2221
2221
  });
2222
2222
  }); };
2223
- this.openPosition = function (targetSymbol, collateralSymbol, priceWithSlippage, collateralWithfee, size, side, poolConfig, nftTradingAccount, nftReferralAccount, nftRebateTokenAccount, privilege, skipBalanceChecks) {
2223
+ this.openPosition = function (targetSymbol, collateralSymbol, priceWithSlippage, collateralWithfee, size, side, poolConfig, privilege, nftTradingAccount, nftReferralAccount, nftRebateTokenAccount, skipBalanceChecks) {
2224
+ if (nftTradingAccount === void 0) { nftTradingAccount = web3_js_1.PublicKey.default; }
2225
+ if (nftReferralAccount === void 0) { nftReferralAccount = web3_js_1.PublicKey.default; }
2226
+ if (nftRebateTokenAccount === void 0) { nftRebateTokenAccount = web3_js_1.PublicKey.default; }
2224
2227
  if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
2225
2228
  return __awaiter(_this, void 0, void 0, function () {
2226
2229
  var publicKey, targetCustodyConfig, collateralCustodyConfig, marketAccount, userCollateralTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, accCreationLamports, lamports, unWrappedSolBalance, _a, tokenAccountBalance, _b, positionAccount, params, instruction;
@@ -2325,7 +2328,10 @@ var PerpetualsClient = (function () {
2325
2328
  });
2326
2329
  });
2327
2330
  };
2328
- this.openPositionWithSwap = function (targetSymbol, collateralSymbol, inputSymbol, amountIn, minAmountOut, priceWithSlippage, size, side, swapPoolConfig, positionPoolConfig, nftTradingAccount, nftReferralAccount, nftRebateTokenAccount, privilege, skipBalanceChecks) {
2331
+ this.openPositionWithSwap = function (targetSymbol, collateralSymbol, inputSymbol, amountIn, minAmountOut, priceWithSlippage, size, side, swapPoolConfig, positionPoolConfig, privilege, nftTradingAccount, nftReferralAccount, nftRebateTokenAccount, skipBalanceChecks) {
2332
+ if (nftTradingAccount === void 0) { nftTradingAccount = web3_js_1.PublicKey.default; }
2333
+ if (nftReferralAccount === void 0) { nftReferralAccount = web3_js_1.PublicKey.default; }
2334
+ if (nftRebateTokenAccount === void 0) { nftRebateTokenAccount = web3_js_1.PublicKey.default; }
2329
2335
  if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
2330
2336
  return __awaiter(_this, void 0, void 0, function () {
2331
2337
  var publicKey, targetCustodyConfig, collateralCustodyConfig, swapOutCustodyConfig, swapInCustodyConfig, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, userInputTokenAccount, accCreationLamports, lamports, unWrappedSolBalance, _a, tokenAccountBalance, _b, userOutputTokenAccount, marketAccount, positionAccount, custodyAccountMetas, custodyOracleAccountMetas, _i, _c, custody, instruction;
@@ -2463,7 +2469,10 @@ var PerpetualsClient = (function () {
2463
2469
  });
2464
2470
  });
2465
2471
  };
2466
- this.closePosition = function (marketSymbol, collateralSymbol, priceWithSlippage, side, poolConfig, nftTradingAccount, nftReferralAccount, nftRebateTokenAccount, privilege, createUserATA, closeUsersWSOLATA) {
2472
+ this.closePosition = function (marketSymbol, collateralSymbol, priceWithSlippage, side, poolConfig, privilege, nftTradingAccount, nftReferralAccount, nftRebateTokenAccount, createUserATA, closeUsersWSOLATA) {
2473
+ if (nftTradingAccount === void 0) { nftTradingAccount = web3_js_1.PublicKey.default; }
2474
+ if (nftReferralAccount === void 0) { nftReferralAccount = web3_js_1.PublicKey.default; }
2475
+ if (nftRebateTokenAccount === void 0) { nftRebateTokenAccount = web3_js_1.PublicKey.default; }
2467
2476
  if (createUserATA === void 0) { createUserATA = true; }
2468
2477
  if (closeUsersWSOLATA === void 0) { closeUsersWSOLATA = false; }
2469
2478
  return __awaiter(_this, void 0, void 0, function () {
@@ -2565,121 +2574,126 @@ var PerpetualsClient = (function () {
2565
2574
  });
2566
2575
  });
2567
2576
  };
2568
- this.closePositionWithSwap = function (targetSymbol, outputSymbol, collateralSymbol, minAmountOut, priceAfterSlippage, side, swapPoolConfig, positionPoolConfig, nftTradingAccount, nftReferralAccount, nftRebateTokenAccount, privilege) { return __awaiter(_this, void 0, void 0, function () {
2569
- var publicKey, targetCustodyConfig, collateralCustodyConfig, swapInCustodyConfig, swapOutCustodyConfig, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, userReceivingTokenAccount, lamports, userCollateralTokenAccount, marketAccount, positionAccount, custodyAccountMetas, custodyOracleAccountMetas, _i, _a, custody, instruction;
2570
- return __generator(this, function (_b) {
2571
- switch (_b.label) {
2572
- case 0:
2573
- publicKey = this.provider.wallet.publicKey;
2574
- targetCustodyConfig = positionPoolConfig.custodies.find(function (i) { return i.mintKey.equals(positionPoolConfig.getTokenFromSymbol(targetSymbol).mintKey); });
2575
- collateralCustodyConfig = positionPoolConfig.custodies.find(function (i) { return i.mintKey.equals(positionPoolConfig.getTokenFromSymbol(collateralSymbol).mintKey); });
2576
- swapInCustodyConfig = swapPoolConfig.custodies.find(function (i) { return i.mintKey.equals(swapPoolConfig.getTokenFromSymbol(collateralSymbol).mintKey); });
2577
- swapOutCustodyConfig = swapPoolConfig.custodies.find(function (i) { return i.mintKey.equals(swapPoolConfig.getTokenFromSymbol(outputSymbol).mintKey); });
2578
- if (swapOutCustodyConfig.mintKey.equals(collateralCustodyConfig.mintKey)) {
2579
- throw "Dont use swap, just call close position";
2580
- }
2581
- preInstructions = [];
2582
- instructions = [];
2583
- postInstructions = [];
2584
- additionalSigners = [];
2585
- if (!(outputSymbol == 'SOL')) return [3, 2];
2586
- console.log("outputSymbol === SOL", outputSymbol);
2587
- wrappedSolAccount = new web3_js_1.Keypair();
2588
- return [4, (0, spl_token_1.getMinimumBalanceForRentExemptAccount)(this.provider.connection)];
2589
- case 1:
2590
- lamports = (_b.sent());
2591
- preInstructions = [
2592
- web3_js_1.SystemProgram.createAccount({
2593
- fromPubkey: publicKey,
2594
- newAccountPubkey: wrappedSolAccount.publicKey,
2595
- lamports: lamports,
2596
- space: 165,
2597
- programId: spl_token_1.TOKEN_PROGRAM_ID,
2598
- }),
2599
- (0, spl_token_1.createInitializeAccount3Instruction)(wrappedSolAccount.publicKey, spl_token_1.NATIVE_MINT, publicKey),
2600
- ];
2601
- postInstructions = [
2602
- (0, spl_token_1.createCloseAccountInstruction)(wrappedSolAccount.publicKey, publicKey, publicKey),
2603
- ];
2604
- additionalSigners.push(wrappedSolAccount);
2605
- return [3, 5];
2606
- case 2: return [4, (0, spl_token_1.getAssociatedTokenAddress)(swapPoolConfig.getTokenFromSymbol(outputSymbol).mintKey, publicKey)];
2607
- case 3:
2608
- userReceivingTokenAccount = _b.sent();
2609
- return [4, (0, utils_1.checkIfAccountExists)(userReceivingTokenAccount, this.provider.connection)];
2610
- case 4:
2611
- if (!(_b.sent())) {
2612
- preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(publicKey, userReceivingTokenAccount, publicKey, swapPoolConfig.getTokenFromSymbol(outputSymbol).mintKey));
2613
- }
2614
- _b.label = 5;
2615
- case 5:
2616
- userCollateralTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(positionPoolConfig.getTokenFromSymbol(collateralSymbol).mintKey, publicKey, true);
2617
- return [4, (0, utils_1.checkIfAccountExists)(userCollateralTokenAccount, this.provider.connection)];
2618
- case 6:
2619
- if (!(_b.sent())) {
2620
- preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(publicKey, userCollateralTokenAccount, publicKey, positionPoolConfig.getTokenFromSymbol(collateralSymbol).mintKey));
2621
- }
2622
- marketAccount = positionPoolConfig.getMarketPk(targetCustodyConfig.custodyAccount, collateralCustodyConfig.custodyAccount, side);
2623
- positionAccount = positionPoolConfig.getPositionFromMarketPk(publicKey, marketAccount);
2624
- custodyAccountMetas = [];
2625
- custodyOracleAccountMetas = [];
2626
- for (_i = 0, _a = swapPoolConfig.custodies; _i < _a.length; _i++) {
2627
- custody = _a[_i];
2628
- custodyAccountMetas.push({
2629
- pubkey: custody.custodyAccount,
2630
- isSigner: false,
2631
- isWritable: false,
2632
- });
2633
- custodyOracleAccountMetas.push({
2634
- pubkey: this.useExtOracleAccount ? custody.extOracleAccount : custody.intOracleAccount,
2635
- isSigner: false,
2636
- isWritable: false,
2637
- });
2638
- }
2639
- return [4, this.programPerpComposability.methods
2640
- .closeAndSwap({
2641
- minAmountOut: minAmountOut,
2642
- closePriceWithSlippage: priceAfterSlippage,
2643
- privilege: privilege,
2644
- })
2645
- .accounts({
2646
- perpProgram: this.programId,
2647
- owner: publicKey,
2648
- fundingAccount: userCollateralTokenAccount,
2649
- receivingAccount: outputSymbol == 'SOL' ? wrappedSolAccount.publicKey : userReceivingTokenAccount,
2650
- transferAuthority: swapPoolConfig.transferAuthority,
2651
- perpetuals: swapPoolConfig.perpetuals,
2652
- swapPool: swapPoolConfig.poolAddress,
2653
- receivingCustody: swapInCustodyConfig.custodyAccount,
2654
- receivingCustodyOracleAccount: this.useExtOracleAccount ? swapInCustodyConfig.extOracleAccount : swapInCustodyConfig.intOracleAccount,
2655
- receivingCustodyTokenAccount: swapInCustodyConfig.tokenAccount,
2656
- dispensingCustody: swapOutCustodyConfig.custodyAccount,
2657
- dispensingCustodyOracleAccount: this.useExtOracleAccount ? swapOutCustodyConfig.extOracleAccount : swapOutCustodyConfig.intOracleAccount,
2658
- dispensingCustodyTokenAccount: swapOutCustodyConfig.tokenAccount,
2659
- positionPool: positionPoolConfig.poolAddress,
2660
- position: positionAccount,
2661
- market: marketAccount,
2662
- targetCustody: targetCustodyConfig.custodyAccount,
2663
- targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
2664
- collateralCustody: collateralCustodyConfig.custodyAccount,
2665
- collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
2666
- collateralCustodyTokenAccount: collateralCustodyConfig.tokenAccount,
2667
- eventAuthority: this.eventAuthority.publicKey,
2668
- tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
2669
- ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
2670
- })
2671
- .remainingAccounts(__spreadArray(__spreadArray(__spreadArray([], (0, getNftAccounts_1.getNftAccounts)(nftTradingAccount, nftReferralAccount, nftRebateTokenAccount, privilege), true), custodyAccountMetas, true), custodyOracleAccountMetas, true))
2672
- .instruction()];
2673
- case 7:
2674
- instruction = _b.sent();
2675
- instructions.push(instruction);
2676
- return [2, {
2677
- instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
2678
- additionalSigners: additionalSigners
2679
- }];
2680
- }
2577
+ this.closePositionWithSwap = function (targetSymbol, outputSymbol, collateralSymbol, minAmountOut, priceAfterSlippage, side, swapPoolConfig, positionPoolConfig, privilege, nftTradingAccount, nftReferralAccount, nftRebateTokenAccount) {
2578
+ if (nftTradingAccount === void 0) { nftTradingAccount = web3_js_1.PublicKey.default; }
2579
+ if (nftReferralAccount === void 0) { nftReferralAccount = web3_js_1.PublicKey.default; }
2580
+ if (nftRebateTokenAccount === void 0) { nftRebateTokenAccount = web3_js_1.PublicKey.default; }
2581
+ return __awaiter(_this, void 0, void 0, function () {
2582
+ var publicKey, targetCustodyConfig, collateralCustodyConfig, swapInCustodyConfig, swapOutCustodyConfig, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, userReceivingTokenAccount, lamports, userCollateralTokenAccount, marketAccount, positionAccount, custodyAccountMetas, custodyOracleAccountMetas, _i, _a, custody, instruction;
2583
+ return __generator(this, function (_b) {
2584
+ switch (_b.label) {
2585
+ case 0:
2586
+ publicKey = this.provider.wallet.publicKey;
2587
+ targetCustodyConfig = positionPoolConfig.custodies.find(function (i) { return i.mintKey.equals(positionPoolConfig.getTokenFromSymbol(targetSymbol).mintKey); });
2588
+ collateralCustodyConfig = positionPoolConfig.custodies.find(function (i) { return i.mintKey.equals(positionPoolConfig.getTokenFromSymbol(collateralSymbol).mintKey); });
2589
+ swapInCustodyConfig = swapPoolConfig.custodies.find(function (i) { return i.mintKey.equals(swapPoolConfig.getTokenFromSymbol(collateralSymbol).mintKey); });
2590
+ swapOutCustodyConfig = swapPoolConfig.custodies.find(function (i) { return i.mintKey.equals(swapPoolConfig.getTokenFromSymbol(outputSymbol).mintKey); });
2591
+ if (swapOutCustodyConfig.mintKey.equals(collateralCustodyConfig.mintKey)) {
2592
+ throw "Dont use swap, just call close position";
2593
+ }
2594
+ preInstructions = [];
2595
+ instructions = [];
2596
+ postInstructions = [];
2597
+ additionalSigners = [];
2598
+ if (!(outputSymbol == 'SOL')) return [3, 2];
2599
+ console.log("outputSymbol === SOL", outputSymbol);
2600
+ wrappedSolAccount = new web3_js_1.Keypair();
2601
+ return [4, (0, spl_token_1.getMinimumBalanceForRentExemptAccount)(this.provider.connection)];
2602
+ case 1:
2603
+ lamports = (_b.sent());
2604
+ preInstructions = [
2605
+ web3_js_1.SystemProgram.createAccount({
2606
+ fromPubkey: publicKey,
2607
+ newAccountPubkey: wrappedSolAccount.publicKey,
2608
+ lamports: lamports,
2609
+ space: 165,
2610
+ programId: spl_token_1.TOKEN_PROGRAM_ID,
2611
+ }),
2612
+ (0, spl_token_1.createInitializeAccount3Instruction)(wrappedSolAccount.publicKey, spl_token_1.NATIVE_MINT, publicKey),
2613
+ ];
2614
+ postInstructions = [
2615
+ (0, spl_token_1.createCloseAccountInstruction)(wrappedSolAccount.publicKey, publicKey, publicKey),
2616
+ ];
2617
+ additionalSigners.push(wrappedSolAccount);
2618
+ return [3, 5];
2619
+ case 2: return [4, (0, spl_token_1.getAssociatedTokenAddress)(swapPoolConfig.getTokenFromSymbol(outputSymbol).mintKey, publicKey)];
2620
+ case 3:
2621
+ userReceivingTokenAccount = _b.sent();
2622
+ return [4, (0, utils_1.checkIfAccountExists)(userReceivingTokenAccount, this.provider.connection)];
2623
+ case 4:
2624
+ if (!(_b.sent())) {
2625
+ preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(publicKey, userReceivingTokenAccount, publicKey, swapPoolConfig.getTokenFromSymbol(outputSymbol).mintKey));
2626
+ }
2627
+ _b.label = 5;
2628
+ case 5:
2629
+ userCollateralTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(positionPoolConfig.getTokenFromSymbol(collateralSymbol).mintKey, publicKey, true);
2630
+ return [4, (0, utils_1.checkIfAccountExists)(userCollateralTokenAccount, this.provider.connection)];
2631
+ case 6:
2632
+ if (!(_b.sent())) {
2633
+ preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(publicKey, userCollateralTokenAccount, publicKey, positionPoolConfig.getTokenFromSymbol(collateralSymbol).mintKey));
2634
+ }
2635
+ marketAccount = positionPoolConfig.getMarketPk(targetCustodyConfig.custodyAccount, collateralCustodyConfig.custodyAccount, side);
2636
+ positionAccount = positionPoolConfig.getPositionFromMarketPk(publicKey, marketAccount);
2637
+ custodyAccountMetas = [];
2638
+ custodyOracleAccountMetas = [];
2639
+ for (_i = 0, _a = swapPoolConfig.custodies; _i < _a.length; _i++) {
2640
+ custody = _a[_i];
2641
+ custodyAccountMetas.push({
2642
+ pubkey: custody.custodyAccount,
2643
+ isSigner: false,
2644
+ isWritable: false,
2645
+ });
2646
+ custodyOracleAccountMetas.push({
2647
+ pubkey: this.useExtOracleAccount ? custody.extOracleAccount : custody.intOracleAccount,
2648
+ isSigner: false,
2649
+ isWritable: false,
2650
+ });
2651
+ }
2652
+ return [4, this.programPerpComposability.methods
2653
+ .closeAndSwap({
2654
+ minAmountOut: minAmountOut,
2655
+ closePriceWithSlippage: priceAfterSlippage,
2656
+ privilege: privilege,
2657
+ })
2658
+ .accounts({
2659
+ perpProgram: this.programId,
2660
+ owner: publicKey,
2661
+ fundingAccount: userCollateralTokenAccount,
2662
+ receivingAccount: outputSymbol == 'SOL' ? wrappedSolAccount.publicKey : userReceivingTokenAccount,
2663
+ transferAuthority: swapPoolConfig.transferAuthority,
2664
+ perpetuals: swapPoolConfig.perpetuals,
2665
+ swapPool: swapPoolConfig.poolAddress,
2666
+ receivingCustody: swapInCustodyConfig.custodyAccount,
2667
+ receivingCustodyOracleAccount: this.useExtOracleAccount ? swapInCustodyConfig.extOracleAccount : swapInCustodyConfig.intOracleAccount,
2668
+ receivingCustodyTokenAccount: swapInCustodyConfig.tokenAccount,
2669
+ dispensingCustody: swapOutCustodyConfig.custodyAccount,
2670
+ dispensingCustodyOracleAccount: this.useExtOracleAccount ? swapOutCustodyConfig.extOracleAccount : swapOutCustodyConfig.intOracleAccount,
2671
+ dispensingCustodyTokenAccount: swapOutCustodyConfig.tokenAccount,
2672
+ positionPool: positionPoolConfig.poolAddress,
2673
+ position: positionAccount,
2674
+ market: marketAccount,
2675
+ targetCustody: targetCustodyConfig.custodyAccount,
2676
+ targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
2677
+ collateralCustody: collateralCustodyConfig.custodyAccount,
2678
+ collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
2679
+ collateralCustodyTokenAccount: collateralCustodyConfig.tokenAccount,
2680
+ eventAuthority: this.eventAuthority.publicKey,
2681
+ tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
2682
+ ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
2683
+ })
2684
+ .remainingAccounts(__spreadArray(__spreadArray(__spreadArray([], (0, getNftAccounts_1.getNftAccounts)(nftTradingAccount, nftReferralAccount, nftRebateTokenAccount, privilege), true), custodyAccountMetas, true), custodyOracleAccountMetas, true))
2685
+ .instruction()];
2686
+ case 7:
2687
+ instruction = _b.sent();
2688
+ instructions.push(instruction);
2689
+ return [2, {
2690
+ instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
2691
+ additionalSigners: additionalSigners
2692
+ }];
2693
+ }
2694
+ });
2681
2695
  });
2682
- }); };
2696
+ };
2683
2697
  this.swap = function (userInputTokenSymbol, userOutputTokenSymbol, amountIn, minAmountOut, poolConfig, useFeesPool, createUserATA, unWrapSol, skipBalanceChecks) {
2684
2698
  if (useFeesPool === void 0) { useFeesPool = false; }
2685
2699
  if (createUserATA === void 0) { createUserATA = true; }
@@ -3413,116 +3427,126 @@ var PerpetualsClient = (function () {
3413
3427
  }
3414
3428
  });
3415
3429
  }); };
3416
- this.increaseSize = function (targetSymbol, collateralSymbol, positionPubKey, side, poolConfig, priceWithSlippage, sizeDelta, nftTradingAccount, nftReferralAccount, nftRebateTokenAccount, privilege) { return __awaiter(_this, void 0, void 0, function () {
3417
- var publicKey, collateralCustodyConfig, targetCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, instruction;
3418
- return __generator(this, function (_a) {
3419
- switch (_a.label) {
3420
- case 0:
3421
- publicKey = this.provider.wallet.publicKey;
3422
- collateralCustodyConfig = poolConfig.custodies.find(function (i) {
3423
- return i.mintKey.equals(poolConfig.getTokenFromSymbol(collateralSymbol).mintKey);
3424
- });
3425
- targetCustodyConfig = poolConfig.custodies.find(function (i) {
3426
- return i.mintKey.equals(poolConfig.getTokenFromSymbol(targetSymbol).mintKey);
3427
- });
3428
- marketAccount = poolConfig.getMarketPk(targetCustodyConfig.custodyAccount, collateralCustodyConfig.custodyAccount, side);
3429
- if (!collateralCustodyConfig || !targetCustodyConfig) {
3430
- throw "collateralCustodyConfig/marketCustodyConfig not found";
3431
- }
3432
- preInstructions = [];
3433
- instructions = [];
3434
- postInstructions = [];
3435
- additionalSigners = [];
3436
- return [4, this.program.methods
3437
- .increaseSize({
3438
- priceWithSlippage: priceWithSlippage,
3439
- sizeDelta: sizeDelta,
3440
- privilege: privilege
3441
- })
3442
- .accounts({
3443
- owner: publicKey,
3444
- transferAuthority: poolConfig.transferAuthority,
3445
- perpetuals: poolConfig.perpetuals,
3446
- pool: poolConfig.poolAddress,
3447
- position: positionPubKey,
3448
- market: marketAccount,
3449
- targetCustody: targetCustodyConfig.custodyAccount,
3450
- targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
3451
- collateralCustody: collateralCustodyConfig.custodyAccount,
3452
- collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
3453
- collateralCustodyTokenAccount: collateralCustodyConfig.tokenAccount,
3454
- tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
3455
- eventAuthority: this.eventAuthority.publicKey,
3456
- program: this.programId,
3457
- ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
3458
- })
3459
- .remainingAccounts(__spreadArray([], (0, getNftAccounts_1.getNftAccounts)(nftTradingAccount, nftReferralAccount, nftRebateTokenAccount, privilege), true))
3460
- .instruction()];
3461
- case 1:
3462
- instruction = _a.sent();
3463
- instructions.push(instruction);
3464
- return [2, {
3465
- instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
3466
- additionalSigners: additionalSigners
3467
- }];
3468
- }
3430
+ this.increaseSize = function (targetSymbol, collateralSymbol, positionPubKey, side, poolConfig, priceWithSlippage, sizeDelta, privilege, nftTradingAccount, nftReferralAccount, nftRebateTokenAccount) {
3431
+ if (nftTradingAccount === void 0) { nftTradingAccount = web3_js_1.PublicKey.default; }
3432
+ if (nftReferralAccount === void 0) { nftReferralAccount = web3_js_1.PublicKey.default; }
3433
+ if (nftRebateTokenAccount === void 0) { nftRebateTokenAccount = web3_js_1.PublicKey.default; }
3434
+ return __awaiter(_this, void 0, void 0, function () {
3435
+ var publicKey, collateralCustodyConfig, targetCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, instruction;
3436
+ return __generator(this, function (_a) {
3437
+ switch (_a.label) {
3438
+ case 0:
3439
+ publicKey = this.provider.wallet.publicKey;
3440
+ collateralCustodyConfig = poolConfig.custodies.find(function (i) {
3441
+ return i.mintKey.equals(poolConfig.getTokenFromSymbol(collateralSymbol).mintKey);
3442
+ });
3443
+ targetCustodyConfig = poolConfig.custodies.find(function (i) {
3444
+ return i.mintKey.equals(poolConfig.getTokenFromSymbol(targetSymbol).mintKey);
3445
+ });
3446
+ marketAccount = poolConfig.getMarketPk(targetCustodyConfig.custodyAccount, collateralCustodyConfig.custodyAccount, side);
3447
+ if (!collateralCustodyConfig || !targetCustodyConfig) {
3448
+ throw "collateralCustodyConfig/marketCustodyConfig not found";
3449
+ }
3450
+ preInstructions = [];
3451
+ instructions = [];
3452
+ postInstructions = [];
3453
+ additionalSigners = [];
3454
+ return [4, this.program.methods
3455
+ .increaseSize({
3456
+ priceWithSlippage: priceWithSlippage,
3457
+ sizeDelta: sizeDelta,
3458
+ privilege: privilege
3459
+ })
3460
+ .accounts({
3461
+ owner: publicKey,
3462
+ transferAuthority: poolConfig.transferAuthority,
3463
+ perpetuals: poolConfig.perpetuals,
3464
+ pool: poolConfig.poolAddress,
3465
+ position: positionPubKey,
3466
+ market: marketAccount,
3467
+ targetCustody: targetCustodyConfig.custodyAccount,
3468
+ targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
3469
+ collateralCustody: collateralCustodyConfig.custodyAccount,
3470
+ collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
3471
+ collateralCustodyTokenAccount: collateralCustodyConfig.tokenAccount,
3472
+ tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
3473
+ eventAuthority: this.eventAuthority.publicKey,
3474
+ program: this.programId,
3475
+ ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
3476
+ })
3477
+ .remainingAccounts(__spreadArray([], (0, getNftAccounts_1.getNftAccounts)(nftTradingAccount, nftReferralAccount, nftRebateTokenAccount, privilege), true))
3478
+ .instruction()];
3479
+ case 1:
3480
+ instruction = _a.sent();
3481
+ instructions.push(instruction);
3482
+ return [2, {
3483
+ instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
3484
+ additionalSigners: additionalSigners
3485
+ }];
3486
+ }
3487
+ });
3469
3488
  });
3470
- }); };
3471
- this.decreaseSize = function (targetSymbol, collateralSymbol, side, positionPubKey, poolConfig, priceWithSlippage, sizeDelta, nftTradingAccount, nftReferralAccount, nftRebateTokenAccount, privilege) { return __awaiter(_this, void 0, void 0, function () {
3472
- var publicKey, collateralCustodyConfig, targetCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, instruction;
3473
- return __generator(this, function (_a) {
3474
- switch (_a.label) {
3475
- case 0:
3476
- publicKey = this.provider.wallet.publicKey;
3477
- collateralCustodyConfig = poolConfig.custodies.find(function (i) {
3478
- return i.mintKey.equals(poolConfig.getTokenFromSymbol(collateralSymbol).mintKey);
3479
- });
3480
- targetCustodyConfig = poolConfig.custodies.find(function (i) {
3481
- return i.mintKey.equals(poolConfig.getTokenFromSymbol(targetSymbol).mintKey);
3482
- });
3483
- marketAccount = poolConfig.getMarketPk(targetCustodyConfig.custodyAccount, collateralCustodyConfig.custodyAccount, side);
3484
- if (!collateralCustodyConfig || !targetCustodyConfig) {
3485
- throw "collateralCustodyConfig/marketCustodyConfig not found";
3486
- }
3487
- preInstructions = [];
3488
- instructions = [];
3489
- postInstructions = [];
3490
- additionalSigners = [];
3491
- return [4, this.program.methods
3492
- .decreaseSize({
3493
- priceWithSlippage: priceWithSlippage,
3494
- sizeDelta: sizeDelta,
3495
- privilege: privilege
3496
- })
3497
- .accounts({
3498
- owner: publicKey,
3499
- transferAuthority: poolConfig.transferAuthority,
3500
- perpetuals: poolConfig.perpetuals,
3501
- pool: poolConfig.poolAddress,
3502
- position: positionPubKey,
3503
- market: marketAccount,
3504
- targetCustody: targetCustodyConfig.custodyAccount,
3505
- targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
3506
- collateralCustody: collateralCustodyConfig.custodyAccount,
3507
- collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
3508
- collateralCustodyTokenAccount: collateralCustodyConfig.tokenAccount,
3509
- tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
3510
- eventAuthority: this.eventAuthority.publicKey,
3511
- program: this.programId,
3512
- ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
3513
- })
3514
- .remainingAccounts(__spreadArray([], (0, getNftAccounts_1.getNftAccounts)(nftTradingAccount, nftReferralAccount, nftRebateTokenAccount, privilege), true))
3515
- .instruction()];
3516
- case 1:
3517
- instruction = _a.sent();
3518
- instructions.push(instruction);
3519
- return [2, {
3520
- instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
3521
- additionalSigners: additionalSigners
3522
- }];
3523
- }
3489
+ };
3490
+ this.decreaseSize = function (targetSymbol, collateralSymbol, side, positionPubKey, poolConfig, priceWithSlippage, sizeDelta, privilege, nftTradingAccount, nftReferralAccount, nftRebateTokenAccount) {
3491
+ if (nftTradingAccount === void 0) { nftTradingAccount = web3_js_1.PublicKey.default; }
3492
+ if (nftReferralAccount === void 0) { nftReferralAccount = web3_js_1.PublicKey.default; }
3493
+ if (nftRebateTokenAccount === void 0) { nftRebateTokenAccount = web3_js_1.PublicKey.default; }
3494
+ return __awaiter(_this, void 0, void 0, function () {
3495
+ var publicKey, collateralCustodyConfig, targetCustodyConfig, marketAccount, preInstructions, instructions, postInstructions, additionalSigners, instruction;
3496
+ return __generator(this, function (_a) {
3497
+ switch (_a.label) {
3498
+ case 0:
3499
+ publicKey = this.provider.wallet.publicKey;
3500
+ collateralCustodyConfig = poolConfig.custodies.find(function (i) {
3501
+ return i.mintKey.equals(poolConfig.getTokenFromSymbol(collateralSymbol).mintKey);
3502
+ });
3503
+ targetCustodyConfig = poolConfig.custodies.find(function (i) {
3504
+ return i.mintKey.equals(poolConfig.getTokenFromSymbol(targetSymbol).mintKey);
3505
+ });
3506
+ marketAccount = poolConfig.getMarketPk(targetCustodyConfig.custodyAccount, collateralCustodyConfig.custodyAccount, side);
3507
+ if (!collateralCustodyConfig || !targetCustodyConfig) {
3508
+ throw "collateralCustodyConfig/marketCustodyConfig not found";
3509
+ }
3510
+ preInstructions = [];
3511
+ instructions = [];
3512
+ postInstructions = [];
3513
+ additionalSigners = [];
3514
+ return [4, this.program.methods
3515
+ .decreaseSize({
3516
+ priceWithSlippage: priceWithSlippage,
3517
+ sizeDelta: sizeDelta,
3518
+ privilege: privilege
3519
+ })
3520
+ .accounts({
3521
+ owner: publicKey,
3522
+ transferAuthority: poolConfig.transferAuthority,
3523
+ perpetuals: poolConfig.perpetuals,
3524
+ pool: poolConfig.poolAddress,
3525
+ position: positionPubKey,
3526
+ market: marketAccount,
3527
+ targetCustody: targetCustodyConfig.custodyAccount,
3528
+ targetOracleAccount: this.useExtOracleAccount ? targetCustodyConfig.extOracleAccount : targetCustodyConfig.intOracleAccount,
3529
+ collateralCustody: collateralCustodyConfig.custodyAccount,
3530
+ collateralOracleAccount: this.useExtOracleAccount ? collateralCustodyConfig.extOracleAccount : collateralCustodyConfig.intOracleAccount,
3531
+ collateralCustodyTokenAccount: collateralCustodyConfig.tokenAccount,
3532
+ tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
3533
+ eventAuthority: this.eventAuthority.publicKey,
3534
+ program: this.programId,
3535
+ ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
3536
+ })
3537
+ .remainingAccounts(__spreadArray([], (0, getNftAccounts_1.getNftAccounts)(nftTradingAccount, nftReferralAccount, nftRebateTokenAccount, privilege), true))
3538
+ .instruction()];
3539
+ case 1:
3540
+ instruction = _a.sent();
3541
+ instructions.push(instruction);
3542
+ return [2, {
3543
+ instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
3544
+ additionalSigners: additionalSigners
3545
+ }];
3546
+ }
3547
+ });
3524
3548
  });
3525
- }); };
3549
+ };
3526
3550
  this.addLiquidity = function (payTokenSymbol, tokenAmountIn, minLpAmountOut, poolConfig, skipBalanceChecks) {
3527
3551
  if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
3528
3552
  return __awaiter(_this, void 0, void 0, function () {
@@ -5617,7 +5641,7 @@ var PerpetualsClient = (function () {
5617
5641
  pool: poolConfig.poolAddress,
5618
5642
  flpStakeAccount: flpStakeAccount,
5619
5643
  rewardCustody: rewardCustody.custodyAccount,
5620
- rewardCustodyOracleAccount: this.useExtOracleAccount ? rewardCustody.extOracleAccount : rewardCustody.intOracleAccount,
5644
+ rewardCustodyOracleAccount: rewardCustody.intOracleAccount,
5621
5645
  poolStakedLpVault: poolStakedLpVault,
5622
5646
  poolCompoundingLpVault: poolConfig.compoundingLpVault,
5623
5647
  lpTokenMint: lpTokenMint,
@@ -5645,95 +5669,10 @@ var PerpetualsClient = (function () {
5645
5669
  });
5646
5670
  });
5647
5671
  };
5648
- this.migrateFlp = function (amount, rewardTokenMint, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
5649
- var publicKey, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, lpTokenMint, compoundingTokenMint, compoudingTokenAccount, flpStakeAccount, poolStakedLpVault, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, migrateFlp, err_33;
5650
- return __generator(this, function (_d) {
5651
- switch (_d.label) {
5652
- case 0:
5653
- publicKey = this.provider.wallet.publicKey;
5654
- preInstructions = [];
5655
- instructions = [];
5656
- postInstructions = [];
5657
- additionalSigners = [];
5658
- rewardCustody = poolConfig.custodies.find(function (i) { return i.mintKey.equals(rewardTokenMint); });
5659
- lpTokenMint = poolConfig.stakedLpTokenMint;
5660
- compoundingTokenMint = poolConfig.compoundingTokenMint;
5661
- return [4, (0, spl_token_1.getAssociatedTokenAddress)(compoundingTokenMint, publicKey)];
5662
- case 1:
5663
- compoudingTokenAccount = _d.sent();
5664
- flpStakeAccount = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("stake"), publicKey.toBuffer(), poolConfig.poolAddress.toBuffer()], this.programId)[0];
5665
- poolStakedLpVault = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("staked_lp_token_account"), poolConfig.poolAddress.toBuffer(), lpTokenMint.toBuffer()], this.programId)[0];
5666
- custodyAccountMetas = [];
5667
- custodyOracleAccountMetas = [];
5668
- markets = [];
5669
- for (_i = 0, _a = poolConfig.custodies; _i < _a.length; _i++) {
5670
- custody = _a[_i];
5671
- custodyAccountMetas.push({
5672
- pubkey: custody.custodyAccount,
5673
- isSigner: false,
5674
- isWritable: false,
5675
- });
5676
- custodyOracleAccountMetas.push({
5677
- pubkey: this.useExtOracleAccount ? custody.extOracleAccount : custody.intOracleAccount,
5678
- isSigner: false,
5679
- isWritable: false,
5680
- });
5681
- }
5682
- for (_b = 0, _c = poolConfig.markets; _b < _c.length; _b++) {
5683
- market = _c[_b];
5684
- markets.push({
5685
- pubkey: market.marketAccount,
5686
- isSigner: false,
5687
- isWritable: false,
5688
- });
5689
- }
5690
- _d.label = 2;
5691
- case 2:
5692
- _d.trys.push([2, 4, , 5]);
5693
- return [4, this.program.methods
5694
- .migrateFlp({
5695
- compoundingTokenAmount: amount
5696
- })
5697
- .accounts({
5698
- owner: publicKey,
5699
- compoundingTokenAccount: compoudingTokenAccount,
5700
- transferAuthority: poolConfig.transferAuthority,
5701
- perpetuals: poolConfig.perpetuals,
5702
- pool: poolConfig.poolAddress,
5703
- flpStakeAccount: flpStakeAccount,
5704
- rewardCustody: rewardCustody.custodyAccount,
5705
- rewardCustodyOracleAccount: this.useExtOracleAccount ? rewardCustody.extOracleAccount : rewardCustody.intOracleAccount,
5706
- poolStakedLpVault: poolStakedLpVault,
5707
- poolCompoundingLpVault: poolConfig.compoundingLpVault,
5708
- lpTokenMint: lpTokenMint,
5709
- compoundingTokenMint: compoundingTokenMint,
5710
- systemProgram: web3_js_1.SystemProgram.programId,
5711
- tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
5712
- eventAuthority: this.eventAuthority.publicKey,
5713
- program: this.program.programId,
5714
- ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
5715
- })
5716
- .remainingAccounts(__spreadArray(__spreadArray(__spreadArray([], custodyAccountMetas, true), custodyOracleAccountMetas, true), markets, true))
5717
- .instruction()];
5718
- case 3:
5719
- migrateFlp = _d.sent();
5720
- instructions.push(migrateFlp);
5721
- return [3, 5];
5722
- case 4:
5723
- err_33 = _d.sent();
5724
- console.log("perpClient migrateFlp error:: ", err_33);
5725
- return [3, 5];
5726
- case 5: return [2, {
5727
- instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
5728
- additionalSigners: additionalSigners
5729
- }];
5730
- }
5731
- });
5732
- }); };
5733
5672
  this.compoundingFee = function (poolConfig, rewardTokenSymbol) {
5734
5673
  if (rewardTokenSymbol === void 0) { rewardTokenSymbol = 'USDC'; }
5735
5674
  return __awaiter(_this, void 0, void 0, function () {
5736
- var instructions, additionalSigners, rewardCustody, lpTokenMint, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, compoundingFee, err_34;
5675
+ var instructions, additionalSigners, rewardCustody, lpTokenMint, custodyAccountMetas, custodyOracleAccountMetas, markets, _i, _a, custody, _b, _c, market, compoundingFee, err_33;
5737
5676
  return __generator(this, function (_d) {
5738
5677
  switch (_d.label) {
5739
5678
  case 0:
@@ -5790,8 +5729,8 @@ var PerpetualsClient = (function () {
5790
5729
  instructions.push(compoundingFee);
5791
5730
  return [3, 4];
5792
5731
  case 3:
5793
- err_34 = _d.sent();
5794
- console.log("perpClient compoundingFee error:: ", err_34);
5732
+ err_33 = _d.sent();
5733
+ console.log("perpClient compoundingFee error:: ", err_33);
5795
5734
  return [3, 4];
5796
5735
  case 4: return [2, {
5797
5736
  instructions: __spreadArray([], instructions, true),
@@ -5802,7 +5741,7 @@ var PerpetualsClient = (function () {
5802
5741
  });
5803
5742
  };
5804
5743
  this.renameFlp = function (flag, lpTokenName, lpTokenSymbol, lpTokenUri, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
5805
- var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp, err_35;
5744
+ var publicKey, instructions, additionalSigners, lpTokenMint, lpMetadataAccount, renameFlp, err_34;
5806
5745
  return __generator(this, function (_a) {
5807
5746
  switch (_a.label) {
5808
5747
  case 0:
@@ -5840,8 +5779,8 @@ var PerpetualsClient = (function () {
5840
5779
  instructions.push(renameFlp);
5841
5780
  return [3, 4];
5842
5781
  case 3:
5843
- err_35 = _a.sent();
5844
- console.log("perpClient renameFlp error:: ", err_35);
5782
+ err_34 = _a.sent();
5783
+ console.log("perpClient renameFlp error:: ", err_34);
5845
5784
  return [3, 4];
5846
5785
  case 4: return [2, {
5847
5786
  instructions: __spreadArray([], instructions, true),
@@ -5851,7 +5790,7 @@ var PerpetualsClient = (function () {
5851
5790
  });
5852
5791
  }); };
5853
5792
  this.initRewardDistribution = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
5854
- var publicKey, rewardMint, instructions, additionalSigners, fbNftProgramData, rewardVault, rewardTokenAccount, transferAuthority, initRewardVault, err_36;
5793
+ var publicKey, rewardMint, instructions, additionalSigners, fbNftProgramData, rewardVault, rewardTokenAccount, transferAuthority, initRewardVault, err_35;
5855
5794
  return __generator(this, function (_a) {
5856
5795
  switch (_a.label) {
5857
5796
  case 0:
@@ -5885,9 +5824,9 @@ var PerpetualsClient = (function () {
5885
5824
  instructions.push(initRewardVault);
5886
5825
  return [3, 4];
5887
5826
  case 3:
5888
- err_36 = _a.sent();
5889
- console.log("rewardDistribution InitRewardVault error:: ", err_36);
5890
- throw err_36;
5827
+ err_35 = _a.sent();
5828
+ console.log("rewardDistribution InitRewardVault error:: ", err_35);
5829
+ throw err_35;
5891
5830
  case 4: return [2, {
5892
5831
  instructions: __spreadArray([], instructions, true),
5893
5832
  additionalSigners: additionalSigners
@@ -5896,7 +5835,7 @@ var PerpetualsClient = (function () {
5896
5835
  });
5897
5836
  }); };
5898
5837
  this.updateCounterReward = function () { return __awaiter(_this, void 0, void 0, function () {
5899
- var publicKey, instructions, additionalSigners, rewardVault, updateCounter, err_37;
5838
+ var publicKey, instructions, additionalSigners, rewardVault, updateCounter, err_36;
5900
5839
  return __generator(this, function (_a) {
5901
5840
  switch (_a.label) {
5902
5841
  case 0:
@@ -5919,9 +5858,9 @@ var PerpetualsClient = (function () {
5919
5858
  instructions.push(updateCounter);
5920
5859
  return [3, 4];
5921
5860
  case 3:
5922
- err_37 = _a.sent();
5923
- console.log("rewardDistribution updateCounter error:: ", err_37);
5924
- throw err_37;
5861
+ err_36 = _a.sent();
5862
+ console.log("rewardDistribution updateCounter error:: ", err_36);
5863
+ throw err_36;
5925
5864
  case 4: return [2, {
5926
5865
  instructions: __spreadArray([], instructions, true),
5927
5866
  additionalSigners: additionalSigners
@@ -5930,7 +5869,7 @@ var PerpetualsClient = (function () {
5930
5869
  });
5931
5870
  }); };
5932
5871
  this.rewardDistribution = function (counter, owner, rewardAmount, rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
5933
- var publicKey, rewardCustodyMint, instructions, additionalSigners, fundingAccount, rewardVault, rewardTokenAccount, rewardRecord, distributeReward, err_38;
5872
+ var publicKey, rewardCustodyMint, instructions, additionalSigners, fundingAccount, rewardVault, rewardTokenAccount, rewardRecord, distributeReward, err_37;
5934
5873
  return __generator(this, function (_a) {
5935
5874
  switch (_a.label) {
5936
5875
  case 0:
@@ -5971,9 +5910,9 @@ var PerpetualsClient = (function () {
5971
5910
  instructions.push(distributeReward);
5972
5911
  return [3, 5];
5973
5912
  case 4:
5974
- err_38 = _a.sent();
5975
- console.log("rewardDistribution distributeReward error:: ", err_38);
5976
- throw err_38;
5913
+ err_37 = _a.sent();
5914
+ console.log("rewardDistribution distributeReward error:: ", err_37);
5915
+ throw err_37;
5977
5916
  case 5: return [2, {
5978
5917
  instructions: __spreadArray([], instructions, true),
5979
5918
  additionalSigners: additionalSigners
@@ -5984,7 +5923,7 @@ var PerpetualsClient = (function () {
5984
5923
  this.collectReward = function (counter, owner, rewardSymbol, poolConfig, createUserATA) {
5985
5924
  if (createUserATA === void 0) { createUserATA = true; }
5986
5925
  return __awaiter(_this, void 0, void 0, function () {
5987
- var publicKey, rewardCustodyMint, instructions, additionalSigners, receivingTokenAccount, _a, rewardVault, rewardTokenAccount, rewardRecord, transferAuthority, collectNftReward, err_39;
5926
+ var publicKey, rewardCustodyMint, instructions, additionalSigners, receivingTokenAccount, _a, rewardVault, rewardTokenAccount, rewardRecord, transferAuthority, collectNftReward, err_38;
5988
5927
  return __generator(this, function (_b) {
5989
5928
  switch (_b.label) {
5990
5929
  case 0:
@@ -6032,8 +5971,8 @@ var PerpetualsClient = (function () {
6032
5971
  instructions.push(collectNftReward);
6033
5972
  return [3, 7];
6034
5973
  case 6:
6035
- err_39 = _b.sent();
6036
- throw err_39;
5974
+ err_38 = _b.sent();
5975
+ throw err_38;
6037
5976
  case 7: return [2, {
6038
5977
  instructions: __spreadArray([], instructions, true),
6039
5978
  additionalSigners: additionalSigners