flash-sdk 11.1.1-alpha.6 → 11.1.1-alpha.8

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.
@@ -2,7 +2,7 @@ import { Program, AnchorProvider, BN } from "@coral-xyz/anchor";
2
2
  import { PublicKey, TransactionInstruction, Commitment, Signer, AddressLookupTableAccount, VersionedTransaction } from "@solana/web3.js";
3
3
  import { PoolAccount } from "./PoolAccount";
4
4
  import { PositionAccount } from "./PositionAccount";
5
- import { AddLiquidityAmountAndFee, InternalPrice, BorrowRateParams, ExitPriceAndFee, Fees, OracleParams, Permissions, PricingParams, RemoveCollateralData, RemoveLiquidityAmountAndFee, Side, TokenRatios, MinAndMaxPrice, FeesAction, ContractOraclePrice, Privilege, PerpetualsAccount, EntryPriceAndFeeV2, TokenPermissions, TokenStake, InternalEmaPrice } from "./types";
5
+ import { AddLiquidityAmountAndFee, InternalPrice, BorrowRateParams, ExitPriceAndFee, Fees, OracleParams, Permissions, PricingParams, RemoveCollateralData, RemoveLiquidityAmountAndFee, Side, TokenRatios, MinAndMaxPrice, FeesAction, ContractOraclePrice, Privilege, PerpetualsAccount, EntryPriceAndFeeV2, TokenPermissions, TokenStake, InternalEmaPrice, Whitelist } from "./types";
6
6
  import { OraclePrice } from "./OraclePrice";
7
7
  import { CustodyAccount } from "./CustodyAccount";
8
8
  import { Perpetuals } from "./idl/perpetuals";
@@ -208,7 +208,7 @@ export declare class PerpetualsClient {
208
208
  reservedAmount: BN;
209
209
  minReserveUsd: BN;
210
210
  limitPriceBufferBps: BN;
211
- padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | BN[] | number[] | BN[];
211
+ padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | BN[] | number[];
212
212
  owner: PublicKey;
213
213
  stakeStats: {
214
214
  pendingActivation: BN;
@@ -564,7 +564,7 @@ export declare class PerpetualsClient {
564
564
  reservedAmount: BN;
565
565
  minReserveUsd: BN;
566
566
  limitPriceBufferBps: BN;
567
- padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | BN[] | number[] | BN[];
567
+ padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | BN[] | number[];
568
568
  owner: PublicKey;
569
569
  stakeStats: {
570
570
  pendingActivation: BN;
@@ -919,7 +919,7 @@ export declare class PerpetualsClient {
919
919
  reservedAmount: BN;
920
920
  minReserveUsd: BN;
921
921
  limitPriceBufferBps: BN;
922
- padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | BN[] | number[] | BN[];
922
+ padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | BN[] | number[];
923
923
  owner: PublicKey;
924
924
  stakeStats: {
925
925
  pendingActivation: BN;
@@ -1278,7 +1278,7 @@ export declare class PerpetualsClient {
1278
1278
  reservedAmount: BN;
1279
1279
  minReserveUsd: BN;
1280
1280
  limitPriceBufferBps: BN;
1281
- padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | BN[] | number[] | BN[];
1281
+ padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | BN[] | number[];
1282
1282
  owner: PublicKey;
1283
1283
  stakeStats: {
1284
1284
  pendingActivation: BN;
@@ -1636,7 +1636,7 @@ export declare class PerpetualsClient {
1636
1636
  reservedAmount: BN;
1637
1637
  minReserveUsd: BN;
1638
1638
  limitPriceBufferBps: BN;
1639
- padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | BN[] | number[] | BN[];
1639
+ padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | BN[] | number[];
1640
1640
  owner: PublicKey;
1641
1641
  stakeStats: {
1642
1642
  pendingActivation: BN;
@@ -1992,7 +1992,7 @@ export declare class PerpetualsClient {
1992
1992
  reservedAmount: BN;
1993
1993
  minReserveUsd: BN;
1994
1994
  limitPriceBufferBps: BN;
1995
- padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | BN[] | number[] | BN[];
1995
+ padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | BN[] | number[];
1996
1996
  owner: PublicKey;
1997
1997
  stakeStats: {
1998
1998
  pendingActivation: BN;
@@ -2347,7 +2347,7 @@ export declare class PerpetualsClient {
2347
2347
  reservedAmount: BN;
2348
2348
  minReserveUsd: BN;
2349
2349
  limitPriceBufferBps: BN;
2350
- padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | BN[] | number[] | BN[];
2350
+ padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | BN[] | number[];
2351
2351
  owner: PublicKey;
2352
2352
  stakeStats: {
2353
2353
  pendingActivation: BN;
@@ -2702,7 +2702,7 @@ export declare class PerpetualsClient {
2702
2702
  reservedAmount: BN;
2703
2703
  minReserveUsd: BN;
2704
2704
  limitPriceBufferBps: BN;
2705
- padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | BN[] | number[] | BN[];
2705
+ padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | BN[] | number[];
2706
2706
  owner: PublicKey;
2707
2707
  stakeStats: {
2708
2708
  pendingActivation: BN;
@@ -3108,7 +3108,7 @@ export declare class PerpetualsClient {
3108
3108
  reservedAmount: BN;
3109
3109
  minReserveUsd: BN;
3110
3110
  limitPriceBufferBps: BN;
3111
- padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | BN[] | number[] | BN[];
3111
+ padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | BN[] | number[];
3112
3112
  owner: PublicKey;
3113
3113
  stakeStats: {
3114
3114
  pendingActivation: BN;
@@ -3463,7 +3463,7 @@ export declare class PerpetualsClient {
3463
3463
  reservedAmount: BN;
3464
3464
  minReserveUsd: BN;
3465
3465
  limitPriceBufferBps: BN;
3466
- padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | BN[] | number[] | BN[];
3466
+ padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | BN[] | number[];
3467
3467
  owner: PublicKey;
3468
3468
  stakeStats: {
3469
3469
  pendingActivation: BN;
@@ -3818,7 +3818,7 @@ export declare class PerpetualsClient {
3818
3818
  reservedAmount: BN;
3819
3819
  minReserveUsd: BN;
3820
3820
  limitPriceBufferBps: BN;
3821
- padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | BN[] | number[] | BN[];
3821
+ padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | BN[] | number[];
3822
3822
  owner: PublicKey;
3823
3823
  stakeStats: {
3824
3824
  pendingActivation: BN;
@@ -4173,7 +4173,7 @@ export declare class PerpetualsClient {
4173
4173
  reservedAmount: BN;
4174
4174
  minReserveUsd: BN;
4175
4175
  limitPriceBufferBps: BN;
4176
- padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | BN[] | number[] | BN[];
4176
+ padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | BN[] | number[];
4177
4177
  owner: PublicKey;
4178
4178
  stakeStats: {
4179
4179
  pendingActivation: BN;
@@ -4528,7 +4528,7 @@ export declare class PerpetualsClient {
4528
4528
  reservedAmount: BN;
4529
4529
  minReserveUsd: BN;
4530
4530
  limitPriceBufferBps: BN;
4531
- padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | BN[] | number[] | BN[];
4531
+ padding: number[] | number[] | number[] | BN[] | number[] | number[] | BN[] | BN[] | BN[] | number[];
4532
4532
  owner: PublicKey;
4533
4533
  stakeStats: {
4534
4534
  pendingActivation: BN;
@@ -4828,7 +4828,7 @@ export declare class PerpetualsClient {
4828
4828
  profitUsd: BN;
4829
4829
  lossUsd: BN;
4830
4830
  };
4831
- getSwapAmountAndFeesSync: (amountIn: BN, amountOut: BN, poolAccount: PoolAccount, inputTokenPrice: OraclePrice, inputTokenEmaPrice: OraclePrice, inputTokenCustodyAccount: CustodyAccount, outputTokenPrice: OraclePrice, outputTokenEmaPrice: OraclePrice, outputTokenCustodyAccount: CustodyAccount, poolAumUsdMax: BN, poolConfig: PoolConfig, isWhitelistedUser?: boolean) => {
4831
+ getSwapAmountAndFeesSync: (amountIn: BN, amountOut: BN, poolAccount: PoolAccount, inputTokenPrice: OraclePrice, inputTokenEmaPrice: OraclePrice, inputTokenCustodyAccount: CustodyAccount, outputTokenPrice: OraclePrice, outputTokenEmaPrice: OraclePrice, outputTokenCustodyAccount: CustodyAccount, poolAumUsdMax: BN, poolConfig: PoolConfig, whitelistedUserAccount?: Whitelist | null) => {
4832
4832
  minAmountOut: BN;
4833
4833
  minAmountIn: BN;
4834
4834
  feeIn: BN;
@@ -4854,17 +4854,17 @@ export declare class PerpetualsClient {
4854
4854
  fee: BN | undefined;
4855
4855
  error?: string;
4856
4856
  }>;
4857
- getRemoveLiquidityAmountAndFeeView: (amount: BN, poolKey: PublicKey, removeTokenCustodyKey: PublicKey, POOL_CONFIG: PoolConfig, userPublicKey?: PublicKey | undefined, enableBackupOracle?: boolean, whitelist?: PublicKey | undefined) => Promise<{
4857
+ getRemoveLiquidityAmountAndFeeView: (amount: BN, poolKey: PublicKey, removeTokenCustodyKey: PublicKey, POOL_CONFIG: PoolConfig, userPublicKey?: PublicKey | undefined, enableBackupOracle?: boolean, whitelist?: PublicKey) => Promise<{
4858
4858
  amount: BN;
4859
4859
  fee: BN;
4860
4860
  error?: string;
4861
4861
  }>;
4862
4862
  getCompoundingLPTokenPrice: (poolKey: PublicKey, POOL_CONFIG: PoolConfig) => Promise<string>;
4863
- getAddCompoundingLiquidityAmountAndFeeView: (amount: BN, poolKey: PublicKey, depositCustodyKey: PublicKey, POOL_CONFIG: PoolConfig, userPublicKey?: PublicKey | undefined, enableBackupOracle?: boolean, whitelist?: PublicKey | undefined) => Promise<{
4863
+ getAddCompoundingLiquidityAmountAndFeeView: (amount: BN, poolKey: PublicKey, depositCustodyKey: PublicKey, POOL_CONFIG: PoolConfig, userPublicKey?: PublicKey | undefined, enableBackupOracle?: boolean, whitelist?: PublicKey) => Promise<{
4864
4864
  amount: BN;
4865
4865
  fee: BN;
4866
4866
  }>;
4867
- getRemoveCompoundingLiquidityAmountAndFeeView: (amount: BN, poolKey: PublicKey, removeTokenCustodyKey: PublicKey, POOL_CONFIG: PoolConfig, userPublicKey?: PublicKey | undefined, enableBackupOracle?: boolean, whitelist?: PublicKey | undefined) => Promise<{
4867
+ getRemoveCompoundingLiquidityAmountAndFeeView: (amount: BN, poolKey: PublicKey, removeTokenCustodyKey: PublicKey, POOL_CONFIG: PoolConfig, userPublicKey?: PublicKey | undefined, enableBackupOracle?: boolean, whitelist?: PublicKey) => Promise<{
4868
4868
  amount: BN;
4869
4869
  fee: BN;
4870
4870
  }>;
@@ -4912,15 +4912,15 @@ export declare class PerpetualsClient {
4912
4912
  instructions: TransactionInstruction[];
4913
4913
  additionalSigners: Signer[];
4914
4914
  }>;
4915
- addLiquidity: (payTokenSymbol: string, tokenAmountIn: BN, minLpAmountOut: BN, poolConfig: PoolConfig, skipBalanceChecks?: boolean, ephemeralSignerPubkey?: any, isWhitelistedUser?: boolean) => Promise<{
4915
+ addLiquidity: (payTokenSymbol: string, tokenAmountIn: BN, minLpAmountOut: BN, poolConfig: PoolConfig, skipBalanceChecks?: boolean, ephemeralSignerPubkey?: any) => Promise<{
4916
4916
  instructions: TransactionInstruction[];
4917
4917
  additionalSigners: Signer[];
4918
4918
  }>;
4919
- addLiquidityAndStake: (inputSymbol: string, amountIn: BN, minLpAmountOut: BN, poolConfig: PoolConfig, skipBalanceChecks?: boolean, ephemeralSignerPubkey?: any, userPublicKey?: PublicKey | undefined, isWhitelistedUser?: boolean) => Promise<{
4919
+ addLiquidityAndStake: (inputSymbol: string, amountIn: BN, minLpAmountOut: BN, poolConfig: PoolConfig, skipBalanceChecks?: boolean, ephemeralSignerPubkey?: any, userPublicKey?: PublicKey | undefined) => Promise<{
4920
4920
  instructions: TransactionInstruction[];
4921
4921
  additionalSigners: Signer[];
4922
4922
  }>;
4923
- removeLiquidity: (recieveTokenSymbol: string, liquidityAmountIn: BN, minTokenAmountOut: BN, poolConfig: PoolConfig, closeLpATA?: boolean, createUserATA?: boolean, closeUsersWSOLATA?: boolean, ephemeralSignerPubkey?: any, userPublicKey?: PublicKey | undefined, isWhitelistedUser?: boolean) => Promise<{
4923
+ removeLiquidity: (recieveTokenSymbol: string, liquidityAmountIn: BN, minTokenAmountOut: BN, poolConfig: PoolConfig, closeLpATA?: boolean, createUserATA?: boolean, closeUsersWSOLATA?: boolean, ephemeralSignerPubkey?: any, userPublicKey?: PublicKey | undefined) => Promise<{
4924
4924
  instructions: TransactionInstruction[];
4925
4925
  additionalSigners: Signer[];
4926
4926
  }>;
@@ -4951,11 +4951,11 @@ export declare class PerpetualsClient {
4951
4951
  instructions: TransactionInstruction[];
4952
4952
  additionalSigners: Signer[];
4953
4953
  }>;
4954
- addCompoundingLiquidity: (amountIn: BN, minCompoundingAmountOut: BN, inTokenSymbol: string, rewardTokenMint: PublicKey, poolConfig: PoolConfig, skipBalanceChecks?: boolean, ephemeralSignerPubkey?: any, userPublicKey?: PublicKey | undefined, enableHeapSizeIx?: boolean, isWhitelistedUser?: boolean, enableDebugLogs?: boolean) => Promise<{
4954
+ addCompoundingLiquidity: (amountIn: BN, minCompoundingAmountOut: BN, inTokenSymbol: string, rewardTokenMint: PublicKey, poolConfig: PoolConfig, skipBalanceChecks?: boolean, ephemeralSignerPubkey?: any, userPublicKey?: PublicKey | undefined, enableHeapSizeIx?: boolean, enableDebugLogs?: boolean) => Promise<{
4955
4955
  instructions: TransactionInstruction[];
4956
4956
  additionalSigners: Signer[];
4957
4957
  }>;
4958
- removeCompoundingLiquidity: (compoundingAmountIn: BN, minAmountOut: BN, outTokenSymbol: string, rewardTokenMint: PublicKey, poolConfig: PoolConfig, createUserATA?: boolean, ephemeralSignerPubkey?: any, userPublicKey?: PublicKey | undefined, enableHeapSizeIx?: boolean, isWhitelistedUser?: boolean, enableDebugLogs?: boolean) => Promise<{
4958
+ removeCompoundingLiquidity: (compoundingAmountIn: BN, minAmountOut: BN, outTokenSymbol: string, rewardTokenMint: PublicKey, poolConfig: PoolConfig, createUserATA?: boolean, ephemeralSignerPubkey?: any, userPublicKey?: PublicKey | undefined, enableHeapSizeIx?: boolean, enableDebugLogs?: boolean) => Promise<{
4959
4959
  instructions: TransactionInstruction[];
4960
4960
  additionalSigners: Signer[];
4961
4961
  }>;
@@ -5052,7 +5052,7 @@ export declare class PerpetualsClient {
5052
5052
  signature: string;
5053
5053
  versionedTransaction: VersionedTransaction;
5054
5054
  }>;
5055
- swap: (userInputTokenSymbol: string, userOutputTokenSymbol: string, amountIn: BN, minAmountOut: BN, poolConfig: PoolConfig, useFeesPool?: boolean, createUserATA?: boolean, unWrapSol?: boolean, skipBalanceChecks?: boolean, ephemeralSignerPubkey?: any, isWhitelistedUser?: boolean) => Promise<{
5055
+ swap: (userInputTokenSymbol: string, userOutputTokenSymbol: string, amountIn: BN, minAmountOut: BN, poolConfig: PoolConfig, useFeesPool?: boolean, createUserATA?: boolean, unWrapSol?: boolean, skipBalanceChecks?: boolean, ephemeralSignerPubkey?: any) => Promise<{
5056
5056
  instructions: TransactionInstruction[];
5057
5057
  additionalSigners: Signer[];
5058
5058
  }>;
@@ -5152,11 +5152,11 @@ export declare class PerpetualsClient {
5152
5152
  instructions: TransactionInstruction[];
5153
5153
  additionalSigners: Signer[];
5154
5154
  }>;
5155
- createWhitelist: (isSwapFeeExempt: boolean, isDepositFeeExempt: boolean, isWithdrawalFeeExempt: boolean, owner: PublicKey) => Promise<{
5155
+ createWhitelist: (isSwapFeeExempt: boolean, isDepositFeeExempt: boolean, isWithdrawalFeeExempt: boolean, poolAddress: PublicKey, owner: PublicKey) => Promise<{
5156
5156
  instructions: TransactionInstruction[];
5157
5157
  additionalSigners: Signer[];
5158
5158
  }>;
5159
- setWhitelistConfig: (isSwapFeeExempt: boolean, isDepositFeeExempt: boolean, isWithdrawalFeeExempt: boolean, owner: PublicKey) => Promise<{
5159
+ setWhitelistConfig: (isSwapFeeExempt: boolean, isDepositFeeExempt: boolean, isWithdrawalFeeExempt: boolean, poolAddress: PublicKey, owner: PublicKey) => Promise<{
5160
5160
  instructions: TransactionInstruction[];
5161
5161
  additionalSigners: Signer[];
5162
5162
  }>;
@@ -1676,8 +1676,8 @@ var PerpetualsClient = (function () {
1676
1676
  };
1677
1677
  }
1678
1678
  };
1679
- this.getSwapAmountAndFeesSync = function (amountIn, amountOut, poolAccount, inputTokenPrice, inputTokenEmaPrice, inputTokenCustodyAccount, outputTokenPrice, outputTokenEmaPrice, outputTokenCustodyAccount, poolAumUsdMax, poolConfig, isWhitelistedUser) {
1680
- if (isWhitelistedUser === void 0) { isWhitelistedUser = false; }
1679
+ this.getSwapAmountAndFeesSync = function (amountIn, amountOut, poolAccount, inputTokenPrice, inputTokenEmaPrice, inputTokenCustodyAccount, outputTokenPrice, outputTokenEmaPrice, outputTokenCustodyAccount, poolAumUsdMax, poolConfig, whitelistedUserAccount) {
1680
+ if (whitelistedUserAccount === void 0) { whitelistedUserAccount = null; }
1681
1681
  if (!amountIn.isZero() && !amountOut.isZero()) {
1682
1682
  throw new Error("both amountIn and amountOut cannot be non-zero");
1683
1683
  }
@@ -1689,6 +1689,12 @@ var PerpetualsClient = (function () {
1689
1689
  feeOut: constants_1.BN_ZERO,
1690
1690
  };
1691
1691
  }
1692
+ var isWhitelistedUser = false;
1693
+ if (whitelistedUserAccount && whitelistedUserAccount.isInitialized) {
1694
+ if (whitelistedUserAccount.pool.equals(poolAccount.publicKey) || whitelistedUserAccount.pool.equals(web3_js_1.PublicKey.default)) {
1695
+ isWhitelistedUser = true;
1696
+ }
1697
+ }
1692
1698
  var newInputTokenPrice, newInputTokenEmaPrice;
1693
1699
  var newOutputTokenPrice, newOutputTokenEmaPrice;
1694
1700
  if (inputTokenPrice.exponent.lte(outputTokenPrice.exponent)) {
@@ -2091,7 +2097,7 @@ var PerpetualsClient = (function () {
2091
2097
  var _e;
2092
2098
  if (userPublicKey === void 0) { userPublicKey = undefined; }
2093
2099
  if (enableBackupOracle === void 0) { enableBackupOracle = false; }
2094
- if (whitelist === void 0) { whitelist = undefined; }
2100
+ if (whitelist === void 0) { whitelist = web3_js_1.PublicKey.default; }
2095
2101
  return __generator(this, function (_f) {
2096
2102
  switch (_f.label) {
2097
2103
  case 0:
@@ -2134,7 +2140,7 @@ var PerpetualsClient = (function () {
2134
2140
  custodyOracleAccount: removeCustodyConfig.intOracleAccount,
2135
2141
  lpTokenMint: POOL_CONFIG.stakedLpTokenMint,
2136
2142
  ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
2137
- whitelist: whitelist
2143
+ whitelist: whitelist,
2138
2144
  })
2139
2145
  .remainingAccounts(__spreadArray(__spreadArray([], custodyMetas, true), marketMetas, true))
2140
2146
  .transaction()];
@@ -2240,7 +2246,7 @@ var PerpetualsClient = (function () {
2240
2246
  var _e;
2241
2247
  if (userPublicKey === void 0) { userPublicKey = undefined; }
2242
2248
  if (enableBackupOracle === void 0) { enableBackupOracle = false; }
2243
- if (whitelist === void 0) { whitelist = undefined; }
2249
+ if (whitelist === void 0) { whitelist = web3_js_1.PublicKey.default; }
2244
2250
  return __generator(this, function (_f) {
2245
2251
  switch (_f.label) {
2246
2252
  case 0:
@@ -2324,7 +2330,7 @@ var PerpetualsClient = (function () {
2324
2330
  var _e;
2325
2331
  if (userPublicKey === void 0) { userPublicKey = undefined; }
2326
2332
  if (enableBackupOracle === void 0) { enableBackupOracle = false; }
2327
- if (whitelist === void 0) { whitelist = undefined; }
2333
+ if (whitelist === void 0) { whitelist = web3_js_1.PublicKey.default; }
2328
2334
  return __generator(this, function (_f) {
2329
2335
  switch (_f.label) {
2330
2336
  case 0:
@@ -3639,11 +3645,10 @@ var PerpetualsClient = (function () {
3639
3645
  for (var _i = 4; _i < arguments.length; _i++) {
3640
3646
  args_1[_i - 4] = arguments[_i];
3641
3647
  }
3642
- return __awaiter(_this, __spreadArray([payTokenSymbol_1, tokenAmountIn_1, minLpAmountOut_1, poolConfig_1], args_1, true), void 0, function (payTokenSymbol, tokenAmountIn, minLpAmountOut, poolConfig, skipBalanceChecks, ephemeralSignerPubkey, isWhitelistedUser) {
3648
+ return __awaiter(_this, __spreadArray([payTokenSymbol_1, tokenAmountIn_1, minLpAmountOut_1, poolConfig_1], args_1, true), void 0, function (payTokenSymbol, tokenAmountIn, minLpAmountOut, poolConfig, skipBalanceChecks, ephemeralSignerPubkey) {
3643
3649
  var publicKey, payTokenCustodyConfig, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, payToken, userPayingTokenAccount, lpTokenAccount, custodyAccountMetas, custodyOracleAccountMetas, markets, _a, _b, custody, _c, _d, market, lamports, unWrappedSolBalance, _e, tokenAccountBalance, _f, whitelistPda, instruction, err_5;
3644
3650
  if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
3645
3651
  if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
3646
- if (isWhitelistedUser === void 0) { isWhitelistedUser = false; }
3647
3652
  return __generator(this, function (_g) {
3648
3653
  switch (_g.label) {
3649
3654
  case 0:
@@ -3744,7 +3749,25 @@ var PerpetualsClient = (function () {
3744
3749
  amountIn: tokenAmountIn,
3745
3750
  minLpAmountOut: minLpAmountOut
3746
3751
  })
3747
- .accounts(__assign({ owner: publicKey, fundingAccount: payTokenSymbol == 'SOL' ? (ephemeralSignerPubkey ? ephemeralSignerPubkey : wrappedSolAccount.publicKey) : userPayingTokenAccount, lpTokenAccount: lpTokenAccount, transferAuthority: poolConfig.transferAuthority, perpetuals: poolConfig.perpetuals, pool: poolConfig.poolAddress, custody: payTokenCustodyConfig.custodyAccount, custodyOracleAccount: this.useExtOracleAccount ? payTokenCustodyConfig.extOracleAccount : payTokenCustodyConfig.intOracleAccount, custodyTokenAccount: payTokenCustodyConfig.tokenAccount, lpTokenMint: poolConfig.stakedLpTokenMint, eventAuthority: this.eventAuthority.publicKey, tokenProgram: spl_token_1.TOKEN_PROGRAM_ID, program: this.programId, ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY, fundingMint: payTokenCustodyConfig.mintKey, fundingTokenProgram: payToken.isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID }, (isWhitelistedUser && { whitelist: whitelistPda })))
3752
+ .accounts({
3753
+ owner: publicKey,
3754
+ fundingAccount: payTokenSymbol == 'SOL' ? (ephemeralSignerPubkey ? ephemeralSignerPubkey : wrappedSolAccount.publicKey) : userPayingTokenAccount,
3755
+ lpTokenAccount: lpTokenAccount,
3756
+ transferAuthority: poolConfig.transferAuthority,
3757
+ perpetuals: poolConfig.perpetuals,
3758
+ pool: poolConfig.poolAddress,
3759
+ custody: payTokenCustodyConfig.custodyAccount,
3760
+ custodyOracleAccount: this.useExtOracleAccount ? payTokenCustodyConfig.extOracleAccount : payTokenCustodyConfig.intOracleAccount,
3761
+ custodyTokenAccount: payTokenCustodyConfig.tokenAccount,
3762
+ lpTokenMint: poolConfig.stakedLpTokenMint,
3763
+ eventAuthority: this.eventAuthority.publicKey,
3764
+ tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
3765
+ program: this.programId,
3766
+ ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
3767
+ fundingMint: payTokenCustodyConfig.mintKey,
3768
+ fundingTokenProgram: payToken.isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID,
3769
+ whitelist: whitelistPda,
3770
+ })
3748
3771
  .remainingAccounts(__spreadArray(__spreadArray(__spreadArray([], custodyAccountMetas, true), custodyOracleAccountMetas, true), markets, true))
3749
3772
  .instruction()];
3750
3773
  case 9:
@@ -3768,12 +3791,11 @@ var PerpetualsClient = (function () {
3768
3791
  for (var _i = 4; _i < arguments.length; _i++) {
3769
3792
  args_1[_i - 4] = arguments[_i];
3770
3793
  }
3771
- return __awaiter(_this, __spreadArray([inputSymbol_1, amountIn_1, minLpAmountOut_1, poolConfig_1], args_1, true), void 0, function (inputSymbol, amountIn, minLpAmountOut, poolConfig, skipBalanceChecks, ephemeralSignerPubkey, userPublicKey, isWhitelistedUser) {
3794
+ return __awaiter(_this, __spreadArray([inputSymbol_1, amountIn_1, minLpAmountOut_1, poolConfig_1], args_1, true), void 0, function (inputSymbol, amountIn, minLpAmountOut, poolConfig, skipBalanceChecks, ephemeralSignerPubkey, userPublicKey) {
3772
3795
  var publicKey, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, userInputTokenAccount, lpTokenMint, inputCustodyConfig, lpTokenAccount, inputToken, flpStakeAccount, poolStakedLpVault, lamports, unWrappedSolBalance, _a, tokenAccountBalance, _b, custodyAccountMetas, custodyOracleAccountMetas, markets, _c, _d, custody, _e, _f, market, whitelistPda, instruction;
3773
3796
  if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
3774
3797
  if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
3775
3798
  if (userPublicKey === void 0) { userPublicKey = undefined; }
3776
- if (isWhitelistedUser === void 0) { isWhitelistedUser = false; }
3777
3799
  return __generator(this, function (_g) {
3778
3800
  switch (_g.label) {
3779
3801
  case 0:
@@ -3869,7 +3891,28 @@ var PerpetualsClient = (function () {
3869
3891
  return [4, this.program.methods.addLiquidityAndStake({
3870
3892
  amountIn: amountIn,
3871
3893
  minLpAmountOut: minLpAmountOut,
3872
- }).accounts(__assign({ owner: publicKey, feePayer: publicKey, fundingAccount: inputSymbol == 'SOL' ? (ephemeralSignerPubkey ? ephemeralSignerPubkey : wrappedSolAccount.publicKey) : userInputTokenAccount, transferAuthority: poolConfig.transferAuthority, perpetuals: poolConfig.perpetuals, pool: poolConfig.poolAddress, custody: inputCustodyConfig.custodyAccount, custodyOracleAccount: this.useExtOracleAccount ? inputCustodyConfig.extOracleAccount : inputCustodyConfig.intOracleAccount, custodyTokenAccount: inputCustodyConfig.tokenAccount, lpTokenMint: lpTokenMint, flpStakeAccount: flpStakeAccount, poolStakedLpVault: poolStakedLpVault, systemProgram: web3_js_1.SystemProgram.programId, tokenProgram: spl_token_1.TOKEN_PROGRAM_ID, eventAuthority: this.eventAuthority.publicKey, program: this.programId, ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY, fundingMint: inputCustodyConfig.mintKey, fundingTokenProgram: inputToken.isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID }, (isWhitelistedUser && { whitelist: whitelistPda })))
3894
+ }).accounts({
3895
+ owner: publicKey,
3896
+ feePayer: publicKey,
3897
+ fundingAccount: inputSymbol == 'SOL' ? (ephemeralSignerPubkey ? ephemeralSignerPubkey : wrappedSolAccount.publicKey) : userInputTokenAccount,
3898
+ transferAuthority: poolConfig.transferAuthority,
3899
+ perpetuals: poolConfig.perpetuals,
3900
+ pool: poolConfig.poolAddress,
3901
+ custody: inputCustodyConfig.custodyAccount,
3902
+ custodyOracleAccount: this.useExtOracleAccount ? inputCustodyConfig.extOracleAccount : inputCustodyConfig.intOracleAccount,
3903
+ custodyTokenAccount: inputCustodyConfig.tokenAccount,
3904
+ lpTokenMint: lpTokenMint,
3905
+ flpStakeAccount: flpStakeAccount,
3906
+ poolStakedLpVault: poolStakedLpVault,
3907
+ systemProgram: web3_js_1.SystemProgram.programId,
3908
+ tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
3909
+ eventAuthority: this.eventAuthority.publicKey,
3910
+ program: this.programId,
3911
+ ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
3912
+ fundingMint: inputCustodyConfig.mintKey,
3913
+ fundingTokenProgram: inputToken.isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID,
3914
+ whitelist: whitelistPda,
3915
+ })
3873
3916
  .remainingAccounts(__spreadArray(__spreadArray(__spreadArray([], custodyAccountMetas, true), custodyOracleAccountMetas, true), markets, true))
3874
3917
  .instruction()];
3875
3918
  case 8:
@@ -3888,14 +3931,13 @@ var PerpetualsClient = (function () {
3888
3931
  for (var _i = 4; _i < arguments.length; _i++) {
3889
3932
  args_1[_i - 4] = arguments[_i];
3890
3933
  }
3891
- return __awaiter(_this, __spreadArray([recieveTokenSymbol_1, liquidityAmountIn_1, minTokenAmountOut_1, poolConfig_1], args_1, true), void 0, function (recieveTokenSymbol, liquidityAmountIn, minTokenAmountOut, poolConfig, closeLpATA, createUserATA, closeUsersWSOLATA, ephemeralSignerPubkey, userPublicKey, isWhitelistedUser) {
3934
+ return __awaiter(_this, __spreadArray([recieveTokenSymbol_1, liquidityAmountIn_1, minTokenAmountOut_1, poolConfig_1], args_1, true), void 0, function (recieveTokenSymbol, liquidityAmountIn, minTokenAmountOut, poolConfig, closeLpATA, createUserATA, closeUsersWSOLATA, ephemeralSignerPubkey, userPublicKey) {
3892
3935
  var recieveTokenCustodyConfig, publicKey, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, recieveToken, stakedLpTokenAccount, custodyAccountMetas, custodyOracleAccountMetas, markets, _a, _b, custody, _c, _d, market, lamports, _e, whitelistPda, removeLiquidityTx, closeInx, closeWsolATAIns, err_6;
3893
3936
  if (closeLpATA === void 0) { closeLpATA = false; }
3894
3937
  if (createUserATA === void 0) { createUserATA = true; }
3895
3938
  if (closeUsersWSOLATA === void 0) { closeUsersWSOLATA = false; }
3896
3939
  if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
3897
3940
  if (userPublicKey === void 0) { userPublicKey = undefined; }
3898
- if (isWhitelistedUser === void 0) { isWhitelistedUser = false; }
3899
3941
  return __generator(this, function (_f) {
3900
3942
  switch (_f.label) {
3901
3943
  case 0:
@@ -3977,7 +4019,25 @@ var PerpetualsClient = (function () {
3977
4019
  lpAmountIn: liquidityAmountIn,
3978
4020
  minAmountOut: minTokenAmountOut
3979
4021
  })
3980
- .accounts(__assign({ owner: publicKey, receivingAccount: recieveTokenSymbol == 'SOL' ? (ephemeralSignerPubkey ? ephemeralSignerPubkey : wrappedSolAccount.publicKey) : userReceivingTokenAccount, lpTokenAccount: stakedLpTokenAccount, transferAuthority: poolConfig.transferAuthority, perpetuals: poolConfig.perpetuals, pool: poolConfig.poolAddress, custody: recieveTokenCustodyConfig.custodyAccount, custodyOracleAccount: this.useExtOracleAccount ? recieveTokenCustodyConfig.extOracleAccount : recieveTokenCustodyConfig.intOracleAccount, custodyTokenAccount: recieveTokenCustodyConfig.tokenAccount, lpTokenMint: poolConfig.stakedLpTokenMint, eventAuthority: this.eventAuthority.publicKey, tokenProgram: spl_token_1.TOKEN_PROGRAM_ID, program: this.programId, ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY, receivingMint: recieveTokenCustodyConfig.mintKey, receivingTokenProgram: recieveToken.isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID }, (isWhitelistedUser && { whitelist: whitelistPda })))
4022
+ .accounts({
4023
+ owner: publicKey,
4024
+ receivingAccount: recieveTokenSymbol == 'SOL' ? (ephemeralSignerPubkey ? ephemeralSignerPubkey : wrappedSolAccount.publicKey) : userReceivingTokenAccount,
4025
+ lpTokenAccount: stakedLpTokenAccount,
4026
+ transferAuthority: poolConfig.transferAuthority,
4027
+ perpetuals: poolConfig.perpetuals,
4028
+ pool: poolConfig.poolAddress,
4029
+ custody: recieveTokenCustodyConfig.custodyAccount,
4030
+ custodyOracleAccount: this.useExtOracleAccount ? recieveTokenCustodyConfig.extOracleAccount : recieveTokenCustodyConfig.intOracleAccount,
4031
+ custodyTokenAccount: recieveTokenCustodyConfig.tokenAccount,
4032
+ lpTokenMint: poolConfig.stakedLpTokenMint,
4033
+ eventAuthority: this.eventAuthority.publicKey,
4034
+ tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
4035
+ program: this.programId,
4036
+ ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
4037
+ receivingMint: recieveTokenCustodyConfig.mintKey,
4038
+ receivingTokenProgram: recieveToken.isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID,
4039
+ whitelist: whitelistPda,
4040
+ })
3981
4041
  .remainingAccounts(__spreadArray(__spreadArray(__spreadArray([], custodyAccountMetas, true), custodyOracleAccountMetas, true), markets, true))
3982
4042
  .instruction()];
3983
4043
  case 6:
@@ -4534,13 +4594,12 @@ var PerpetualsClient = (function () {
4534
4594
  for (var _i = 5; _i < arguments.length; _i++) {
4535
4595
  args_1[_i - 5] = arguments[_i];
4536
4596
  }
4537
- return __awaiter(_this, __spreadArray([amountIn_1, minCompoundingAmountOut_1, inTokenSymbol_1, rewardTokenMint_1, poolConfig_1], args_1, true), void 0, function (amountIn, minCompoundingAmountOut, inTokenSymbol, rewardTokenMint, poolConfig, skipBalanceChecks, ephemeralSignerPubkey, userPublicKey, enableHeapSizeIx, isWhitelistedUser, enableDebugLogs) {
4597
+ return __awaiter(_this, __spreadArray([amountIn_1, minCompoundingAmountOut_1, inTokenSymbol_1, rewardTokenMint_1, poolConfig_1], args_1, true), void 0, function (amountIn, minCompoundingAmountOut, inTokenSymbol, rewardTokenMint, poolConfig, skipBalanceChecks, ephemeralSignerPubkey, userPublicKey, enableHeapSizeIx, enableDebugLogs) {
4538
4598
  var publicKey, preInstructions, instructions, additionalSigners, postInstructions, rewardCustody, inCustodyConfig, lpTokenMint, compoundingTokenMint, wrappedSolAccount, lpTokenAccount, compoundingTokenAccount, fundingAccount, custodyAccountMetas, custodyOracleAccountMetas, markets, _a, _b, custody, _c, _d, market, lamports, unWrappedSolBalance, _e, heapSizeIx, whitelistPda, addCompoundingLiquidity, err_16;
4539
4599
  if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
4540
4600
  if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
4541
4601
  if (userPublicKey === void 0) { userPublicKey = undefined; }
4542
4602
  if (enableHeapSizeIx === void 0) { enableHeapSizeIx = true; }
4543
- if (isWhitelistedUser === void 0) { isWhitelistedUser = false; }
4544
4603
  if (enableDebugLogs === void 0) { enableDebugLogs = false; }
4545
4604
  return __generator(this, function (_f) {
4546
4605
  switch (_f.label) {
@@ -4647,7 +4706,29 @@ var PerpetualsClient = (function () {
4647
4706
  amountIn: amountIn,
4648
4707
  minCompoundingAmountOut: minCompoundingAmountOut
4649
4708
  })
4650
- .accounts(__assign({ owner: publicKey, fundingAccount: inTokenSymbol == 'SOL' ? (ephemeralSignerPubkey ? ephemeralSignerPubkey : wrappedSolAccount.publicKey) : fundingAccount, compoundingTokenAccount: compoundingTokenAccount, poolCompoundingLpVault: poolConfig.compoundingLpVault, transferAuthority: poolConfig.transferAuthority, perpetuals: poolConfig.perpetuals, pool: poolConfig.poolAddress, inCustody: inCustodyConfig.custodyAccount, inCustodyOracleAccount: this.useExtOracleAccount ? inCustodyConfig.extOracleAccount : inCustodyConfig.intOracleAccount, inCustodyTokenAccount: inCustodyConfig.tokenAccount, rewardCustody: rewardCustody.custodyAccount, rewardCustodyOracleAccount: this.useExtOracleAccount ? rewardCustody.extOracleAccount : rewardCustody.intOracleAccount, lpTokenMint: lpTokenMint, compoundingTokenMint: compoundingTokenMint, tokenProgram: spl_token_1.TOKEN_PROGRAM_ID, eventAuthority: this.eventAuthority.publicKey, program: this.program.programId, ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY, fundingMint: inCustodyConfig.mintKey, fundingTokenProgram: poolConfig.getTokenFromSymbol(inTokenSymbol).isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID }, (isWhitelistedUser && { whitelist: whitelistPda })))
4709
+ .accounts({
4710
+ owner: publicKey,
4711
+ fundingAccount: inTokenSymbol == 'SOL' ? (ephemeralSignerPubkey ? ephemeralSignerPubkey : wrappedSolAccount.publicKey) : fundingAccount,
4712
+ compoundingTokenAccount: compoundingTokenAccount,
4713
+ poolCompoundingLpVault: poolConfig.compoundingLpVault,
4714
+ transferAuthority: poolConfig.transferAuthority,
4715
+ perpetuals: poolConfig.perpetuals,
4716
+ pool: poolConfig.poolAddress,
4717
+ inCustody: inCustodyConfig.custodyAccount,
4718
+ inCustodyOracleAccount: this.useExtOracleAccount ? inCustodyConfig.extOracleAccount : inCustodyConfig.intOracleAccount,
4719
+ inCustodyTokenAccount: inCustodyConfig.tokenAccount,
4720
+ rewardCustody: rewardCustody.custodyAccount,
4721
+ rewardCustodyOracleAccount: this.useExtOracleAccount ? rewardCustody.extOracleAccount : rewardCustody.intOracleAccount,
4722
+ lpTokenMint: lpTokenMint,
4723
+ compoundingTokenMint: compoundingTokenMint,
4724
+ tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
4725
+ eventAuthority: this.eventAuthority.publicKey,
4726
+ program: this.program.programId,
4727
+ ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
4728
+ fundingMint: inCustodyConfig.mintKey,
4729
+ fundingTokenProgram: poolConfig.getTokenFromSymbol(inTokenSymbol).isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID,
4730
+ whitelist: whitelistPda,
4731
+ })
4651
4732
  .remainingAccounts(__spreadArray(__spreadArray(__spreadArray([], custodyAccountMetas, true), custodyOracleAccountMetas, true), markets, true))
4652
4733
  .instruction()];
4653
4734
  case 8:
@@ -4671,13 +4752,12 @@ var PerpetualsClient = (function () {
4671
4752
  for (var _i = 5; _i < arguments.length; _i++) {
4672
4753
  args_1[_i - 5] = arguments[_i];
4673
4754
  }
4674
- return __awaiter(_this, __spreadArray([compoundingAmountIn_1, minAmountOut_1, outTokenSymbol_1, rewardTokenMint_1, poolConfig_1], args_1, true), void 0, function (compoundingAmountIn, minAmountOut, outTokenSymbol, rewardTokenMint, poolConfig, createUserATA, ephemeralSignerPubkey, userPublicKey, enableHeapSizeIx, isWhitelistedUser, enableDebugLogs) {
4755
+ return __awaiter(_this, __spreadArray([compoundingAmountIn_1, minAmountOut_1, outTokenSymbol_1, rewardTokenMint_1, poolConfig_1], args_1, true), void 0, function (compoundingAmountIn, minAmountOut, outTokenSymbol, rewardTokenMint, poolConfig, createUserATA, ephemeralSignerPubkey, userPublicKey, enableHeapSizeIx, enableDebugLogs) {
4675
4756
  var publicKey, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, rewardCustody, outCustodyConfig, lpTokenMint, compoundingTokenMint, lamports, _a, custodyAccountMetas, custodyOracleAccountMetas, markets, _b, _c, custody, _d, _e, market, compoundingTokenAccount, heapSizeIx, whitelistPda, removeCompoundingLiquidity, err_17;
4676
4757
  if (createUserATA === void 0) { createUserATA = true; }
4677
4758
  if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
4678
4759
  if (userPublicKey === void 0) { userPublicKey = undefined; }
4679
4760
  if (enableHeapSizeIx === void 0) { enableHeapSizeIx = true; }
4680
- if (isWhitelistedUser === void 0) { isWhitelistedUser = false; }
4681
4761
  if (enableDebugLogs === void 0) { enableDebugLogs = false; }
4682
4762
  return __generator(this, function (_f) {
4683
4763
  switch (_f.label) {
@@ -4768,7 +4848,29 @@ var PerpetualsClient = (function () {
4768
4848
  compoundingAmountIn: compoundingAmountIn,
4769
4849
  minAmountOut: minAmountOut
4770
4850
  })
4771
- .accounts(__assign({ owner: publicKey, receivingAccount: outCustodyConfig.symbol == 'SOL' ? (ephemeralSignerPubkey ? ephemeralSignerPubkey : wrappedSolAccount.publicKey) : userReceivingTokenAccount, compoundingTokenAccount: compoundingTokenAccount, poolCompoundingLpVault: poolConfig.compoundingLpVault, transferAuthority: poolConfig.transferAuthority, perpetuals: poolConfig.perpetuals, pool: poolConfig.poolAddress, outCustody: outCustodyConfig.custodyAccount, outCustodyOracleAccount: this.useExtOracleAccount ? outCustodyConfig.extOracleAccount : outCustodyConfig.intOracleAccount, outCustodyTokenAccount: outCustodyConfig.tokenAccount, rewardCustody: rewardCustody.custodyAccount, rewardCustodyOracleAccount: this.useExtOracleAccount ? rewardCustody.extOracleAccount : rewardCustody.intOracleAccount, lpTokenMint: lpTokenMint, compoundingTokenMint: compoundingTokenMint, tokenProgram: spl_token_1.TOKEN_PROGRAM_ID, eventAuthority: this.eventAuthority.publicKey, program: this.program.programId, ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY, receivingMint: outCustodyConfig.mintKey, receivingTokenProgram: poolConfig.getTokenFromSymbol(outTokenSymbol).isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID }, (isWhitelistedUser && { whitelist: whitelistPda })))
4851
+ .accounts({
4852
+ owner: publicKey,
4853
+ receivingAccount: outCustodyConfig.symbol == 'SOL' ? (ephemeralSignerPubkey ? ephemeralSignerPubkey : wrappedSolAccount.publicKey) : userReceivingTokenAccount,
4854
+ compoundingTokenAccount: compoundingTokenAccount,
4855
+ poolCompoundingLpVault: poolConfig.compoundingLpVault,
4856
+ transferAuthority: poolConfig.transferAuthority,
4857
+ perpetuals: poolConfig.perpetuals,
4858
+ pool: poolConfig.poolAddress,
4859
+ outCustody: outCustodyConfig.custodyAccount,
4860
+ outCustodyOracleAccount: this.useExtOracleAccount ? outCustodyConfig.extOracleAccount : outCustodyConfig.intOracleAccount,
4861
+ outCustodyTokenAccount: outCustodyConfig.tokenAccount,
4862
+ rewardCustody: rewardCustody.custodyAccount,
4863
+ rewardCustodyOracleAccount: this.useExtOracleAccount ? rewardCustody.extOracleAccount : rewardCustody.intOracleAccount,
4864
+ lpTokenMint: lpTokenMint,
4865
+ compoundingTokenMint: compoundingTokenMint,
4866
+ tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
4867
+ eventAuthority: this.eventAuthority.publicKey,
4868
+ program: this.program.programId,
4869
+ ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
4870
+ receivingMint: outCustodyConfig.mintKey,
4871
+ receivingTokenProgram: poolConfig.getTokenFromSymbol(outTokenSymbol).isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID,
4872
+ whitelist: whitelistPda,
4873
+ })
4772
4874
  .remainingAccounts(__spreadArray(__spreadArray(__spreadArray([], custodyAccountMetas, true), custodyOracleAccountMetas, true), markets, true))
4773
4875
  .instruction()];
4774
4876
  case 6:
@@ -6326,14 +6428,13 @@ var PerpetualsClient = (function () {
6326
6428
  for (var _i = 5; _i < arguments.length; _i++) {
6327
6429
  args_1[_i - 5] = arguments[_i];
6328
6430
  }
6329
- return __awaiter(_this, __spreadArray([userInputTokenSymbol_1, userOutputTokenSymbol_1, amountIn_1, minAmountOut_1, poolConfig_1], args_1, true), void 0, function (userInputTokenSymbol, userOutputTokenSymbol, amountIn, minAmountOut, poolConfig, useFeesPool, createUserATA, unWrapSol, skipBalanceChecks, ephemeralSignerPubkey, isWhitelistedUser) {
6431
+ return __awaiter(_this, __spreadArray([userInputTokenSymbol_1, userOutputTokenSymbol_1, amountIn_1, minAmountOut_1, poolConfig_1], args_1, true), void 0, function (userInputTokenSymbol, userOutputTokenSymbol, amountIn, minAmountOut, poolConfig, useFeesPool, createUserATA, unWrapSol, skipBalanceChecks, ephemeralSignerPubkey) {
6330
6432
  var userInputCustodyConfig, userOutputCustodyConfig, publicKey, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, userOutputTokenAccount, userInputTokenAccount, wsolAssociatedTokenAccount, wsolATAExist, unWrappedSolBalance, _a, wsolAssociatedTokenAccount, closeWsolATAIns, accCreationLamports, lamports, unWrappedSolBalance, _b, tokenAccountBalance, _c, lamports, _d, custodyAccountMetas, custodyOracleAccountMetas, _e, _f, custody, whitelistPda, params, inx, closeWsolATAIns, err_40;
6331
6433
  if (useFeesPool === void 0) { useFeesPool = false; }
6332
6434
  if (createUserATA === void 0) { createUserATA = true; }
6333
6435
  if (unWrapSol === void 0) { unWrapSol = false; }
6334
6436
  if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
6335
6437
  if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
6336
- if (isWhitelistedUser === void 0) { isWhitelistedUser = false; }
6337
6438
  return __generator(this, function (_g) {
6338
6439
  switch (_g.label) {
6339
6440
  case 0:
@@ -6502,7 +6603,28 @@ var PerpetualsClient = (function () {
6502
6603
  };
6503
6604
  return [4, this.program.methods
6504
6605
  .swap(params)
6505
- .accounts(__assign({ owner: publicKey, fundingAccount: userInputTokenSymbol == 'SOL' ? (ephemeralSignerPubkey ? ephemeralSignerPubkey : wrappedSolAccount.publicKey) : userInputTokenAccount, receivingAccount: userOutputTokenSymbol == 'SOL' ? (ephemeralSignerPubkey ? ephemeralSignerPubkey : wrappedSolAccount.publicKey) : userOutputTokenAccount, transferAuthority: poolConfig.transferAuthority, perpetuals: poolConfig.perpetuals, pool: poolConfig.poolAddress, receivingCustody: userInputCustodyConfig.custodyAccount, receivingCustodyOracleAccount: this.useExtOracleAccount ? userInputCustodyConfig.extOracleAccount : userInputCustodyConfig.intOracleAccount, receivingCustodyTokenAccount: userInputCustodyConfig.tokenAccount, dispensingCustody: userOutputCustodyConfig.custodyAccount, dispensingCustodyOracleAccount: this.useExtOracleAccount ? userOutputCustodyConfig.extOracleAccount : userOutputCustodyConfig.intOracleAccount, dispensingCustodyTokenAccount: userOutputCustodyConfig.tokenAccount, eventAuthority: this.eventAuthority.publicKey, program: this.programId, ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY, fundingMint: userInputCustodyConfig.mintKey, fundingTokenProgram: poolConfig.getTokenFromSymbol(userInputTokenSymbol).isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID, receivingMint: userOutputCustodyConfig.mintKey, receivingTokenProgram: poolConfig.getTokenFromSymbol(userOutputTokenSymbol).isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID }, (isWhitelistedUser && { whitelist: whitelistPda })))
6606
+ .accounts({
6607
+ owner: publicKey,
6608
+ fundingAccount: userInputTokenSymbol == 'SOL' ? (ephemeralSignerPubkey ? ephemeralSignerPubkey : wrappedSolAccount.publicKey) : userInputTokenAccount,
6609
+ receivingAccount: userOutputTokenSymbol == 'SOL' ? (ephemeralSignerPubkey ? ephemeralSignerPubkey : wrappedSolAccount.publicKey) : userOutputTokenAccount,
6610
+ transferAuthority: poolConfig.transferAuthority,
6611
+ perpetuals: poolConfig.perpetuals,
6612
+ pool: poolConfig.poolAddress,
6613
+ receivingCustody: userInputCustodyConfig.custodyAccount,
6614
+ receivingCustodyOracleAccount: this.useExtOracleAccount ? userInputCustodyConfig.extOracleAccount : userInputCustodyConfig.intOracleAccount,
6615
+ receivingCustodyTokenAccount: userInputCustodyConfig.tokenAccount,
6616
+ dispensingCustody: userOutputCustodyConfig.custodyAccount,
6617
+ dispensingCustodyOracleAccount: this.useExtOracleAccount ? userOutputCustodyConfig.extOracleAccount : userOutputCustodyConfig.intOracleAccount,
6618
+ dispensingCustodyTokenAccount: userOutputCustodyConfig.tokenAccount,
6619
+ eventAuthority: this.eventAuthority.publicKey,
6620
+ program: this.programId,
6621
+ ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
6622
+ fundingMint: userInputCustodyConfig.mintKey,
6623
+ fundingTokenProgram: poolConfig.getTokenFromSymbol(userInputTokenSymbol).isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID,
6624
+ receivingMint: userOutputCustodyConfig.mintKey,
6625
+ receivingTokenProgram: poolConfig.getTokenFromSymbol(userOutputTokenSymbol).isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID,
6626
+ whitelist: whitelistPda,
6627
+ })
6506
6628
  .remainingAccounts(__spreadArray(__spreadArray([], custodyAccountMetas, true), custodyOracleAccountMetas, true))
6507
6629
  .instruction()];
6508
6630
  case 18:
@@ -7913,7 +8035,7 @@ var PerpetualsClient = (function () {
7913
8035
  }
7914
8036
  });
7915
8037
  }); };
7916
- this.createWhitelist = function (isSwapFeeExempt, isDepositFeeExempt, isWithdrawalFeeExempt, owner) { return __awaiter(_this, void 0, void 0, function () {
8038
+ this.createWhitelist = function (isSwapFeeExempt, isDepositFeeExempt, isWithdrawalFeeExempt, poolAddress, owner) { return __awaiter(_this, void 0, void 0, function () {
7917
8039
  var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, createWhitelistInstruction, err_65;
7918
8040
  return __generator(this, function (_a) {
7919
8041
  switch (_a.label) {
@@ -7931,7 +8053,8 @@ var PerpetualsClient = (function () {
7931
8053
  .createWhitelist({
7932
8054
  isSwapFeeExempt: isSwapFeeExempt,
7933
8055
  isDepositFeeExempt: isDepositFeeExempt,
7934
- isWithdrawalFeeExempt: isWithdrawalFeeExempt
8056
+ isWithdrawalFeeExempt: isWithdrawalFeeExempt,
8057
+ poolAddress: poolAddress,
7935
8058
  })
7936
8059
  .accounts({
7937
8060
  admin: publicKey,
@@ -7956,7 +8079,7 @@ var PerpetualsClient = (function () {
7956
8079
  }
7957
8080
  });
7958
8081
  }); };
7959
- this.setWhitelistConfig = function (isSwapFeeExempt, isDepositFeeExempt, isWithdrawalFeeExempt, owner) { return __awaiter(_this, void 0, void 0, function () {
8082
+ this.setWhitelistConfig = function (isSwapFeeExempt, isDepositFeeExempt, isWithdrawalFeeExempt, poolAddress, owner) { return __awaiter(_this, void 0, void 0, function () {
7960
8083
  var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, setWhitelistConfigInstruction, err_66;
7961
8084
  return __generator(this, function (_a) {
7962
8085
  switch (_a.label) {
@@ -7974,7 +8097,8 @@ var PerpetualsClient = (function () {
7974
8097
  .setWhitelistConfig({
7975
8098
  isSwapFeeExempt: isSwapFeeExempt,
7976
8099
  isDepositFeeExempt: isDepositFeeExempt,
7977
- isWithdrawalFeeExempt: isWithdrawalFeeExempt
8100
+ isWithdrawalFeeExempt: isWithdrawalFeeExempt,
8101
+ poolAddress: poolAddress
7978
8102
  })
7979
8103
  .accounts({
7980
8104
  admin: publicKey,