flash-sdk 11.1.0 → 11.1.1-alpha.1

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.
@@ -20,8 +20,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
20
20
  });
21
21
  };
22
22
  var __generator = (this && this.__generator) || function (thisArg, body) {
23
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
24
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
25
  function verb(n) { return function (v) { return step([n, v]); }; }
26
26
  function step(op) {
27
27
  if (f) throw new TypeError("Generator is already executing.");
@@ -1993,11 +1993,12 @@ var PerpetualsClient = (function () {
1993
1993
  for (var _i = 4; _i < arguments.length; _i++) {
1994
1994
  args_1[_i - 4] = arguments[_i];
1995
1995
  }
1996
- return __awaiter(_this, __spreadArray([amount_1, poolKey_1, depositCustodyKey_1, POOL_CONFIG_1], args_1, true), void 0, function (amount, poolKey, depositCustodyKey, POOL_CONFIG, userPublicKey, enableBackupOracle) {
1996
+ return __awaiter(_this, __spreadArray([amount_1, poolKey_1, depositCustodyKey_1, POOL_CONFIG_1], args_1, true), void 0, function (amount, poolKey, depositCustodyKey, POOL_CONFIG, userPublicKey, enableBackupOracle, whitelist) {
1997
1997
  var custodies, custodyMetas, marketMetas, _a, custodies_5, token, _b, custodies_6, custody, _c, _d, market, depositCustodyConfig, transaction, setCULimitIx, backUpOracleInstruction, result, index, res;
1998
1998
  var _e;
1999
1999
  if (userPublicKey === void 0) { userPublicKey = undefined; }
2000
2000
  if (enableBackupOracle === void 0) { enableBackupOracle = false; }
2001
+ if (whitelist === void 0) { whitelist = undefined; }
2001
2002
  return __generator(this, function (_f) {
2002
2003
  switch (_f.label) {
2003
2004
  case 0:
@@ -2040,6 +2041,7 @@ var PerpetualsClient = (function () {
2040
2041
  custodyOracleAccount: depositCustodyConfig.intOracleAccount,
2041
2042
  lpTokenMint: POOL_CONFIG.stakedLpTokenMint,
2042
2043
  ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
2044
+ whitelist: whitelist
2043
2045
  })
2044
2046
  .remainingAccounts(__spreadArray(__spreadArray([], custodyMetas, true), marketMetas, true))
2045
2047
  .transaction()];
@@ -2079,11 +2081,12 @@ var PerpetualsClient = (function () {
2079
2081
  for (var _i = 4; _i < arguments.length; _i++) {
2080
2082
  args_1[_i - 4] = arguments[_i];
2081
2083
  }
2082
- return __awaiter(_this, __spreadArray([amount_1, poolKey_1, removeTokenCustodyKey_1, POOL_CONFIG_1], args_1, true), void 0, function (amount, poolKey, removeTokenCustodyKey, POOL_CONFIG, userPublicKey, enableBackupOracle) {
2084
+ return __awaiter(_this, __spreadArray([amount_1, poolKey_1, removeTokenCustodyKey_1, POOL_CONFIG_1], args_1, true), void 0, function (amount, poolKey, removeTokenCustodyKey, POOL_CONFIG, userPublicKey, enableBackupOracle, whitelist) {
2083
2085
  var custodies, custodyMetas, marketMetas, _a, custodies_7, token, _b, custodies_8, custody, _c, _d, market, removeCustodyConfig, transaction, setCULimitIx, backUpOracleInstruction, result, index, res;
2084
2086
  var _e;
2085
2087
  if (userPublicKey === void 0) { userPublicKey = undefined; }
2086
2088
  if (enableBackupOracle === void 0) { enableBackupOracle = false; }
2089
+ if (whitelist === void 0) { whitelist = undefined; }
2087
2090
  return __generator(this, function (_f) {
2088
2091
  switch (_f.label) {
2089
2092
  case 0:
@@ -2126,6 +2129,7 @@ var PerpetualsClient = (function () {
2126
2129
  custodyOracleAccount: removeCustodyConfig.intOracleAccount,
2127
2130
  lpTokenMint: POOL_CONFIG.stakedLpTokenMint,
2128
2131
  ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
2132
+ whitelist: whitelist
2129
2133
  })
2130
2134
  .remainingAccounts(__spreadArray(__spreadArray([], custodyMetas, true), marketMetas, true))
2131
2135
  .transaction()];
@@ -2226,11 +2230,12 @@ var PerpetualsClient = (function () {
2226
2230
  for (var _i = 4; _i < arguments.length; _i++) {
2227
2231
  args_1[_i - 4] = arguments[_i];
2228
2232
  }
2229
- return __awaiter(_this, __spreadArray([amount_1, poolKey_1, depositCustodyKey_1, POOL_CONFIG_1], args_1, true), void 0, function (amount, poolKey, depositCustodyKey, POOL_CONFIG, userPublicKey, enableBackupOracle) {
2233
+ return __awaiter(_this, __spreadArray([amount_1, poolKey_1, depositCustodyKey_1, POOL_CONFIG_1], args_1, true), void 0, function (amount, poolKey, depositCustodyKey, POOL_CONFIG, userPublicKey, enableBackupOracle, whitelist) {
2230
2234
  var custodies, custodyMetas, marketMetas, _a, custodies_11, token, _b, custodies_12, custody, _c, _d, market, depositCustodyConfig, rewardCustody, transaction, setCULimitIx, backUpOracleInstruction, result, index, res;
2231
2235
  var _e;
2232
2236
  if (userPublicKey === void 0) { userPublicKey = undefined; }
2233
2237
  if (enableBackupOracle === void 0) { enableBackupOracle = false; }
2238
+ if (whitelist === void 0) { whitelist = undefined; }
2234
2239
  return __generator(this, function (_f) {
2235
2240
  switch (_f.label) {
2236
2241
  case 0:
@@ -2277,6 +2282,7 @@ var PerpetualsClient = (function () {
2277
2282
  lpTokenMint: POOL_CONFIG.stakedLpTokenMint,
2278
2283
  compoundingTokenMint: POOL_CONFIG.compoundingTokenMint,
2279
2284
  ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
2285
+ whitelist: whitelist
2280
2286
  })
2281
2287
  .remainingAccounts(__spreadArray(__spreadArray([], custodyMetas, true), marketMetas, true))
2282
2288
  .transaction()];
@@ -2308,11 +2314,12 @@ var PerpetualsClient = (function () {
2308
2314
  for (var _i = 4; _i < arguments.length; _i++) {
2309
2315
  args_1[_i - 4] = arguments[_i];
2310
2316
  }
2311
- return __awaiter(_this, __spreadArray([amount_1, poolKey_1, removeTokenCustodyKey_1, POOL_CONFIG_1], args_1, true), void 0, function (amount, poolKey, removeTokenCustodyKey, POOL_CONFIG, userPublicKey, enableBackupOracle) {
2317
+ return __awaiter(_this, __spreadArray([amount_1, poolKey_1, removeTokenCustodyKey_1, POOL_CONFIG_1], args_1, true), void 0, function (amount, poolKey, removeTokenCustodyKey, POOL_CONFIG, userPublicKey, enableBackupOracle, whitelist) {
2312
2318
  var custodies, custodyMetas, marketMetas, _a, custodies_13, token, _b, custodies_14, custody, _c, _d, market, removeCustodyConfig, rewardCustody, transaction, setCULimitIx, backUpOracleInstruction, result, index, res;
2313
2319
  var _e;
2314
2320
  if (userPublicKey === void 0) { userPublicKey = undefined; }
2315
2321
  if (enableBackupOracle === void 0) { enableBackupOracle = false; }
2322
+ if (whitelist === void 0) { whitelist = undefined; }
2316
2323
  return __generator(this, function (_f) {
2317
2324
  switch (_f.label) {
2318
2325
  case 0:
@@ -2359,6 +2366,7 @@ var PerpetualsClient = (function () {
2359
2366
  compoundingTokenMint: POOL_CONFIG.compoundingTokenMint,
2360
2367
  lpTokenMint: POOL_CONFIG.stakedLpTokenMint,
2361
2368
  ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
2369
+ whitelist: whitelist
2362
2370
  })
2363
2371
  .remainingAccounts(__spreadArray(__spreadArray([], custodyMetas, true), marketMetas, true))
2364
2372
  .transaction()];
@@ -3627,7 +3635,7 @@ var PerpetualsClient = (function () {
3627
3635
  args_1[_i - 4] = arguments[_i];
3628
3636
  }
3629
3637
  return __awaiter(_this, __spreadArray([payTokenSymbol_1, tokenAmountIn_1, minLpAmountOut_1, poolConfig_1], args_1, true), void 0, function (payTokenSymbol, tokenAmountIn, minLpAmountOut, poolConfig, skipBalanceChecks, ephemeralSignerPubkey) {
3630
- 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, instruction, err_5;
3638
+ 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, whitelistExists, instruction, err_5;
3631
3639
  if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
3632
3640
  if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
3633
3641
  return __generator(this, function (_g) {
@@ -3645,7 +3653,7 @@ var PerpetualsClient = (function () {
3645
3653
  payToken = poolConfig.getTokenFromSymbol(payTokenSymbol);
3646
3654
  _g.label = 1;
3647
3655
  case 1:
3648
- _g.trys.push([1, 10, , 11]);
3656
+ _g.trys.push([1, 11, , 12]);
3649
3657
  userPayingTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(payTokenCustodyConfig.mintKey, publicKey, true, payToken.isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID);
3650
3658
  lpTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(poolConfig.stakedLpTokenMint, publicKey, true);
3651
3659
  custodyAccountMetas = [];
@@ -3723,40 +3731,46 @@ var PerpetualsClient = (function () {
3723
3731
  throw "Insufficient Funds need more ".concat(tokenAmountIn.sub(tokenAccountBalance), " tokens");
3724
3732
  }
3725
3733
  _g.label = 8;
3726
- case 8: return [4, this.program.methods
3727
- .addLiquidity({
3728
- amountIn: tokenAmountIn,
3729
- minLpAmountOut: minLpAmountOut
3730
- })
3731
- .accounts({
3732
- owner: publicKey,
3733
- fundingAccount: payTokenSymbol == 'SOL' ? (ephemeralSignerPubkey ? ephemeralSignerPubkey : wrappedSolAccount.publicKey) : userPayingTokenAccount,
3734
- lpTokenAccount: lpTokenAccount,
3735
- transferAuthority: poolConfig.transferAuthority,
3736
- perpetuals: poolConfig.perpetuals,
3737
- pool: poolConfig.poolAddress,
3738
- custody: payTokenCustodyConfig.custodyAccount,
3739
- custodyOracleAccount: this.useExtOracleAccount ? payTokenCustodyConfig.extOracleAccount : payTokenCustodyConfig.intOracleAccount,
3740
- custodyTokenAccount: payTokenCustodyConfig.tokenAccount,
3741
- lpTokenMint: poolConfig.stakedLpTokenMint,
3742
- eventAuthority: this.eventAuthority.publicKey,
3743
- tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
3744
- program: this.programId,
3745
- ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
3746
- fundingMint: payTokenCustodyConfig.mintKey,
3747
- fundingTokenProgram: payToken.isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID
3748
- })
3749
- .remainingAccounts(__spreadArray(__spreadArray(__spreadArray([], custodyAccountMetas, true), custodyOracleAccountMetas, true), markets, true))
3750
- .instruction()];
3734
+ case 8:
3735
+ whitelistPda = this.findProgramAddress("whitelist", publicKey).publicKey;
3736
+ return [4, (0, utils_1.checkIfAccountExists)(whitelistPda, this.provider.connection)];
3751
3737
  case 9:
3738
+ whitelistExists = _g.sent();
3739
+ return [4, this.program.methods
3740
+ .addLiquidity({
3741
+ amountIn: tokenAmountIn,
3742
+ minLpAmountOut: minLpAmountOut
3743
+ })
3744
+ .accounts({
3745
+ owner: publicKey,
3746
+ fundingAccount: payTokenSymbol == 'SOL' ? (ephemeralSignerPubkey ? ephemeralSignerPubkey : wrappedSolAccount.publicKey) : userPayingTokenAccount,
3747
+ lpTokenAccount: lpTokenAccount,
3748
+ transferAuthority: poolConfig.transferAuthority,
3749
+ perpetuals: poolConfig.perpetuals,
3750
+ pool: poolConfig.poolAddress,
3751
+ custody: payTokenCustodyConfig.custodyAccount,
3752
+ custodyOracleAccount: this.useExtOracleAccount ? payTokenCustodyConfig.extOracleAccount : payTokenCustodyConfig.intOracleAccount,
3753
+ custodyTokenAccount: payTokenCustodyConfig.tokenAccount,
3754
+ lpTokenMint: poolConfig.stakedLpTokenMint,
3755
+ eventAuthority: this.eventAuthority.publicKey,
3756
+ tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
3757
+ program: this.programId,
3758
+ ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
3759
+ fundingMint: payTokenCustodyConfig.mintKey,
3760
+ fundingTokenProgram: payToken.isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID,
3761
+ whitelist: whitelistExists ? whitelistPda : undefined,
3762
+ })
3763
+ .remainingAccounts(__spreadArray(__spreadArray(__spreadArray([], custodyAccountMetas, true), custodyOracleAccountMetas, true), markets, true))
3764
+ .instruction()];
3765
+ case 10:
3752
3766
  instruction = _g.sent();
3753
3767
  instructions.push(instruction);
3754
- return [3, 11];
3755
- case 10:
3768
+ return [3, 12];
3769
+ case 11:
3756
3770
  err_5 = _g.sent();
3757
3771
  console.error("perpClient addLiquidity error:: ", err_5);
3758
3772
  throw err_5;
3759
- case 11: return [2, {
3773
+ case 12: return [2, {
3760
3774
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
3761
3775
  additionalSigners: additionalSigners
3762
3776
  }];
@@ -3770,7 +3784,7 @@ var PerpetualsClient = (function () {
3770
3784
  args_1[_i - 4] = arguments[_i];
3771
3785
  }
3772
3786
  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) {
3773
- 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, instruction;
3787
+ 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, whitelistExists, instruction;
3774
3788
  if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
3775
3789
  if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
3776
3790
  if (userPublicKey === void 0) { userPublicKey = undefined; }
@@ -3865,6 +3879,10 @@ var PerpetualsClient = (function () {
3865
3879
  isWritable: false,
3866
3880
  });
3867
3881
  }
3882
+ whitelistPda = this.findProgramAddress("whitelist", publicKey).publicKey;
3883
+ return [4, (0, utils_1.checkIfAccountExists)(whitelistPda, this.provider.connection)];
3884
+ case 8:
3885
+ whitelistExists = _g.sent();
3868
3886
  return [4, this.program.methods.addLiquidityAndStake({
3869
3887
  amountIn: amountIn,
3870
3888
  minLpAmountOut: minLpAmountOut,
@@ -3887,11 +3905,12 @@ var PerpetualsClient = (function () {
3887
3905
  program: this.programId,
3888
3906
  ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
3889
3907
  fundingMint: inputCustodyConfig.mintKey,
3890
- fundingTokenProgram: inputToken.isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID
3908
+ fundingTokenProgram: inputToken.isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID,
3909
+ whitelist: whitelistExists ? whitelistPda : undefined,
3891
3910
  })
3892
3911
  .remainingAccounts(__spreadArray(__spreadArray(__spreadArray([], custodyAccountMetas, true), custodyOracleAccountMetas, true), markets, true))
3893
3912
  .instruction()];
3894
- case 8:
3913
+ case 9:
3895
3914
  instruction = _g.sent();
3896
3915
  instructions.push(instruction);
3897
3916
  return [2, {
@@ -3908,7 +3927,7 @@ var PerpetualsClient = (function () {
3908
3927
  args_1[_i - 4] = arguments[_i];
3909
3928
  }
3910
3929
  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) {
3911
- var recieveTokenCustodyConfig, publicKey, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, recieveToken, stakedLpTokenAccount, custodyAccountMetas, custodyOracleAccountMetas, markets, _a, _b, custody, _c, _d, market, lamports, _e, removeLiquidityTx, closeInx, closeWsolATAIns, err_6;
3930
+ var recieveTokenCustodyConfig, publicKey, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, recieveToken, stakedLpTokenAccount, custodyAccountMetas, custodyOracleAccountMetas, markets, _a, _b, custody, _c, _d, market, lamports, _e, whitelistPda, whitelistExists, removeLiquidityTx, closeInx, closeWsolATAIns, err_6;
3912
3931
  if (closeLpATA === void 0) { closeLpATA = false; }
3913
3932
  if (createUserATA === void 0) { createUserATA = true; }
3914
3933
  if (closeUsersWSOLATA === void 0) { closeUsersWSOLATA = false; }
@@ -3929,7 +3948,7 @@ var PerpetualsClient = (function () {
3929
3948
  recieveToken = poolConfig.getTokenFromSymbol(recieveTokenSymbol);
3930
3949
  _f.label = 1;
3931
3950
  case 1:
3932
- _f.trys.push([1, 7, , 8]);
3951
+ _f.trys.push([1, 8, , 9]);
3933
3952
  stakedLpTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(poolConfig.stakedLpTokenMint, publicKey, true);
3934
3953
  custodyAccountMetas = [];
3935
3954
  custodyOracleAccountMetas = [];
@@ -3988,32 +4007,38 @@ var PerpetualsClient = (function () {
3988
4007
  preInstructions.push((0, spl_token_1.createAssociatedTokenAccountInstruction)(publicKey, userReceivingTokenAccount, publicKey, recieveToken.mintKey, recieveToken.isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID));
3989
4008
  }
3990
4009
  _f.label = 5;
3991
- case 5: return [4, this.program.methods
3992
- .removeLiquidity({
3993
- lpAmountIn: liquidityAmountIn,
3994
- minAmountOut: minTokenAmountOut
3995
- })
3996
- .accounts({
3997
- owner: publicKey,
3998
- receivingAccount: recieveTokenSymbol == 'SOL' ? (ephemeralSignerPubkey ? ephemeralSignerPubkey : wrappedSolAccount.publicKey) : userReceivingTokenAccount,
3999
- lpTokenAccount: stakedLpTokenAccount,
4000
- transferAuthority: poolConfig.transferAuthority,
4001
- perpetuals: poolConfig.perpetuals,
4002
- pool: poolConfig.poolAddress,
4003
- custody: recieveTokenCustodyConfig.custodyAccount,
4004
- custodyOracleAccount: this.useExtOracleAccount ? recieveTokenCustodyConfig.extOracleAccount : recieveTokenCustodyConfig.intOracleAccount,
4005
- custodyTokenAccount: recieveTokenCustodyConfig.tokenAccount,
4006
- lpTokenMint: poolConfig.stakedLpTokenMint,
4007
- eventAuthority: this.eventAuthority.publicKey,
4008
- tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
4009
- program: this.programId,
4010
- ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
4011
- receivingMint: recieveTokenCustodyConfig.mintKey,
4012
- receivingTokenProgram: recieveToken.isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID
4013
- })
4014
- .remainingAccounts(__spreadArray(__spreadArray(__spreadArray([], custodyAccountMetas, true), custodyOracleAccountMetas, true), markets, true))
4015
- .instruction()];
4010
+ case 5:
4011
+ whitelistPda = this.findProgramAddress("whitelist", publicKey).publicKey;
4012
+ return [4, (0, utils_1.checkIfAccountExists)(whitelistPda, this.provider.connection)];
4016
4013
  case 6:
4014
+ whitelistExists = _f.sent();
4015
+ return [4, this.program.methods
4016
+ .removeLiquidity({
4017
+ lpAmountIn: liquidityAmountIn,
4018
+ minAmountOut: minTokenAmountOut
4019
+ })
4020
+ .accounts({
4021
+ owner: publicKey,
4022
+ receivingAccount: recieveTokenSymbol == 'SOL' ? (ephemeralSignerPubkey ? ephemeralSignerPubkey : wrappedSolAccount.publicKey) : userReceivingTokenAccount,
4023
+ lpTokenAccount: stakedLpTokenAccount,
4024
+ transferAuthority: poolConfig.transferAuthority,
4025
+ perpetuals: poolConfig.perpetuals,
4026
+ pool: poolConfig.poolAddress,
4027
+ custody: recieveTokenCustodyConfig.custodyAccount,
4028
+ custodyOracleAccount: this.useExtOracleAccount ? recieveTokenCustodyConfig.extOracleAccount : recieveTokenCustodyConfig.intOracleAccount,
4029
+ custodyTokenAccount: recieveTokenCustodyConfig.tokenAccount,
4030
+ lpTokenMint: poolConfig.stakedLpTokenMint,
4031
+ eventAuthority: this.eventAuthority.publicKey,
4032
+ tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
4033
+ program: this.programId,
4034
+ ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
4035
+ receivingMint: recieveTokenCustodyConfig.mintKey,
4036
+ receivingTokenProgram: recieveToken.isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID,
4037
+ whitelist: whitelistExists ? whitelistPda : undefined,
4038
+ })
4039
+ .remainingAccounts(__spreadArray(__spreadArray(__spreadArray([], custodyAccountMetas, true), custodyOracleAccountMetas, true), markets, true))
4040
+ .instruction()];
4041
+ case 7:
4017
4042
  removeLiquidityTx = _f.sent();
4018
4043
  instructions.push(removeLiquidityTx);
4019
4044
  if (closeLpATA) {
@@ -4024,12 +4049,12 @@ var PerpetualsClient = (function () {
4024
4049
  closeWsolATAIns = (0, spl_token_1.createCloseAccountInstruction)(userReceivingTokenAccount, publicKey, publicKey);
4025
4050
  postInstructions.push(closeWsolATAIns);
4026
4051
  }
4027
- return [3, 8];
4028
- case 7:
4052
+ return [3, 9];
4053
+ case 8:
4029
4054
  err_6 = _f.sent();
4030
4055
  console.log("perpClient removeLiquidity error:: ", err_6);
4031
4056
  throw err_6;
4032
- case 8: return [2, {
4057
+ case 9: return [2, {
4033
4058
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
4034
4059
  additionalSigners: additionalSigners
4035
4060
  }];
@@ -4568,7 +4593,7 @@ var PerpetualsClient = (function () {
4568
4593
  args_1[_i - 5] = arguments[_i];
4569
4594
  }
4570
4595
  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) {
4571
- 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, addCompoundingLiquidity, err_16;
4596
+ 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, whitelistExists, addCompoundingLiquidity, err_16;
4572
4597
  if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
4573
4598
  if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
4574
4599
  if (userPublicKey === void 0) { userPublicKey = undefined; }
@@ -4663,7 +4688,7 @@ var PerpetualsClient = (function () {
4663
4688
  }
4664
4689
  _f.label = 7;
4665
4690
  case 7:
4666
- _f.trys.push([7, 9, , 10]);
4691
+ _f.trys.push([7, 10, , 11]);
4667
4692
  if (enableHeapSizeIx) {
4668
4693
  heapSizeIx = web3_js_1.ComputeBudgetProgram.requestHeapFrame({
4669
4694
  bytes: 64 * 1024,
@@ -4673,6 +4698,10 @@ var PerpetualsClient = (function () {
4673
4698
  }
4674
4699
  preInstructions.push(heapSizeIx);
4675
4700
  }
4701
+ whitelistPda = this.findProgramAddress("whitelist", publicKey).publicKey;
4702
+ return [4, (0, utils_1.checkIfAccountExists)(whitelistPda, this.provider.connection)];
4703
+ case 8:
4704
+ whitelistExists = _f.sent();
4676
4705
  return [4, this.program.methods
4677
4706
  .addCompoundingLiquidity({
4678
4707
  amountIn: amountIn,
@@ -4699,18 +4728,19 @@ var PerpetualsClient = (function () {
4699
4728
  ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
4700
4729
  fundingMint: inCustodyConfig.mintKey,
4701
4730
  fundingTokenProgram: poolConfig.getTokenFromSymbol(inTokenSymbol).isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID,
4731
+ whitelist: whitelistExists ? whitelistPda : undefined,
4702
4732
  })
4703
4733
  .remainingAccounts(__spreadArray(__spreadArray(__spreadArray([], custodyAccountMetas, true), custodyOracleAccountMetas, true), markets, true))
4704
4734
  .instruction()];
4705
- case 8:
4735
+ case 9:
4706
4736
  addCompoundingLiquidity = _f.sent();
4707
4737
  instructions.push(addCompoundingLiquidity);
4708
- return [3, 10];
4709
- case 9:
4738
+ return [3, 11];
4739
+ case 10:
4710
4740
  err_16 = _f.sent();
4711
4741
  console.log("perpClient addCompoundingLiquidity error:: ", err_16);
4712
- return [3, 10];
4713
- case 10: return [2, {
4742
+ return [3, 11];
4743
+ case 11: return [2, {
4714
4744
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
4715
4745
  additionalSigners: additionalSigners
4716
4746
  }];
@@ -4724,7 +4754,7 @@ var PerpetualsClient = (function () {
4724
4754
  args_1[_i - 5] = arguments[_i];
4725
4755
  }
4726
4756
  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) {
4727
- 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, removeCompoundingLiquidity, err_17;
4757
+ 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, whitelistExists, removeCompoundingLiquidity, err_17;
4728
4758
  if (createUserATA === void 0) { createUserATA = true; }
4729
4759
  if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
4730
4760
  if (userPublicKey === void 0) { userPublicKey = undefined; }
@@ -4803,7 +4833,7 @@ var PerpetualsClient = (function () {
4803
4833
  compoundingTokenAccount = (0, spl_token_1.getAssociatedTokenAddressSync)(compoundingTokenMint, publicKey, true);
4804
4834
  _f.label = 5;
4805
4835
  case 5:
4806
- _f.trys.push([5, 7, , 8]);
4836
+ _f.trys.push([5, 8, , 9]);
4807
4837
  if (enableHeapSizeIx) {
4808
4838
  heapSizeIx = web3_js_1.ComputeBudgetProgram.requestHeapFrame({
4809
4839
  bytes: 64 * 1024,
@@ -4813,6 +4843,10 @@ var PerpetualsClient = (function () {
4813
4843
  }
4814
4844
  preInstructions.push(heapSizeIx);
4815
4845
  }
4846
+ whitelistPda = this.findProgramAddress("whitelist", publicKey).publicKey;
4847
+ return [4, (0, utils_1.checkIfAccountExists)(whitelistPda, this.provider.connection)];
4848
+ case 6:
4849
+ whitelistExists = _f.sent();
4816
4850
  return [4, this.program.methods
4817
4851
  .removeCompoundingLiquidity({
4818
4852
  compoundingAmountIn: compoundingAmountIn,
@@ -4838,19 +4872,20 @@ var PerpetualsClient = (function () {
4838
4872
  program: this.program.programId,
4839
4873
  ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY,
4840
4874
  receivingMint: outCustodyConfig.mintKey,
4841
- receivingTokenProgram: poolConfig.getTokenFromSymbol(outTokenSymbol).isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID
4875
+ receivingTokenProgram: poolConfig.getTokenFromSymbol(outTokenSymbol).isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID,
4876
+ whitelist: whitelistExists ? whitelistPda : undefined,
4842
4877
  })
4843
4878
  .remainingAccounts(__spreadArray(__spreadArray(__spreadArray([], custodyAccountMetas, true), custodyOracleAccountMetas, true), markets, true))
4844
4879
  .instruction()];
4845
- case 6:
4880
+ case 7:
4846
4881
  removeCompoundingLiquidity = _f.sent();
4847
4882
  instructions.push(removeCompoundingLiquidity);
4848
- return [3, 8];
4849
- case 7:
4883
+ return [3, 9];
4884
+ case 8:
4850
4885
  err_17 = _f.sent();
4851
4886
  console.log("perpClient removeCompoundingLiquidity error:: ", err_17);
4852
- return [3, 8];
4853
- case 8: return [2, {
4887
+ return [3, 9];
4888
+ case 9: return [2, {
4854
4889
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
4855
4890
  additionalSigners: additionalSigners
4856
4891
  }];
@@ -6398,7 +6433,7 @@ var PerpetualsClient = (function () {
6398
6433
  args_1[_i - 5] = arguments[_i];
6399
6434
  }
6400
6435
  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) {
6401
- 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, params, inx, closeWsolATAIns, err_40;
6436
+ 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, whitelistExists, params, inx, closeWsolATAIns, err_40;
6402
6437
  if (useFeesPool === void 0) { useFeesPool = false; }
6403
6438
  if (createUserATA === void 0) { createUserATA = true; }
6404
6439
  if (unWrapSol === void 0) { unWrapSol = false; }
@@ -6462,7 +6497,7 @@ var PerpetualsClient = (function () {
6462
6497
  }
6463
6498
  _g.label = 6;
6464
6499
  case 6:
6465
- _g.trys.push([6, 19, , 20]);
6500
+ _g.trys.push([6, 20, , 21]);
6466
6501
  if (!(userInputTokenSymbol == 'SOL')) return [3, 9];
6467
6502
  console.log("userInputTokenSymbol === sol", userInputTokenSymbol);
6468
6503
  return [4, (0, spl_token_1.getMinimumBalanceForRentExemptAccount)(this.provider.connection)];
@@ -6564,6 +6599,10 @@ var PerpetualsClient = (function () {
6564
6599
  isWritable: false,
6565
6600
  });
6566
6601
  }
6602
+ whitelistPda = this.findProgramAddress("whitelist", publicKey).publicKey;
6603
+ return [4, (0, utils_1.checkIfAccountExists)(whitelistPda, this.provider.connection)];
6604
+ case 18:
6605
+ whitelistExists = _g.sent();
6567
6606
  params = {
6568
6607
  amountIn: amountIn,
6569
6608
  minAmountOut: minAmountOut,
@@ -6591,22 +6630,23 @@ var PerpetualsClient = (function () {
6591
6630
  fundingTokenProgram: poolConfig.getTokenFromSymbol(userInputTokenSymbol).isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID,
6592
6631
  receivingMint: userOutputCustodyConfig.mintKey,
6593
6632
  receivingTokenProgram: poolConfig.getTokenFromSymbol(userOutputTokenSymbol).isToken2022 ? spl_token_1.TOKEN_2022_PROGRAM_ID : spl_token_1.TOKEN_PROGRAM_ID,
6633
+ whitelist: whitelistExists ? whitelistPda : undefined,
6594
6634
  })
6595
6635
  .remainingAccounts(__spreadArray(__spreadArray([], custodyAccountMetas, true), custodyOracleAccountMetas, true))
6596
6636
  .instruction()];
6597
- case 18:
6637
+ case 19:
6598
6638
  inx = _g.sent();
6599
6639
  instructions.push(inx);
6600
6640
  if (userOutputTokenSymbol == 'SOL' && unWrapSol) {
6601
6641
  closeWsolATAIns = (0, spl_token_1.createCloseAccountInstruction)(userOutputTokenAccount, publicKey, publicKey);
6602
6642
  instructions.push(closeWsolATAIns);
6603
6643
  }
6604
- return [3, 20];
6605
- case 19:
6644
+ return [3, 21];
6645
+ case 20:
6606
6646
  err_40 = _g.sent();
6607
6647
  console.error("perpClient Swap error:: ", err_40);
6608
6648
  throw err_40;
6609
- case 20: return [2, {
6649
+ case 21: return [2, {
6610
6650
  instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
6611
6651
  additionalSigners: additionalSigners
6612
6652
  }];
@@ -8002,6 +8042,92 @@ var PerpetualsClient = (function () {
8002
8042
  }
8003
8043
  });
8004
8044
  }); };
8045
+ this.createWhitelist = function (isSwapFeeExempt, isDepositFeeExempt, isWithdrawalFeeExempt, owner) { return __awaiter(_this, void 0, void 0, function () {
8046
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, createWhitelistInstruction, err_65;
8047
+ return __generator(this, function (_a) {
8048
+ switch (_a.label) {
8049
+ case 0:
8050
+ publicKey = this.provider.wallet.publicKey;
8051
+ preInstructions = [];
8052
+ instructions = [];
8053
+ postInstructions = [];
8054
+ additionalSigners = [];
8055
+ _a.label = 1;
8056
+ case 1:
8057
+ _a.trys.push([1, 3, , 4]);
8058
+ whitelist = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("whitelist"), owner.toBuffer()], this.programId)[0];
8059
+ return [4, this.program.methods
8060
+ .createWhitelist({
8061
+ isSwapFeeExempt: isSwapFeeExempt,
8062
+ isDepositFeeExempt: isDepositFeeExempt,
8063
+ isWithdrawalFeeExempt: isWithdrawalFeeExempt
8064
+ })
8065
+ .accounts({
8066
+ admin: publicKey,
8067
+ multisig: this.multisig.publicKey,
8068
+ owner: owner,
8069
+ whitelist: whitelist,
8070
+ systemProgram: web3_js_1.SystemProgram.programId,
8071
+ })
8072
+ .instruction()];
8073
+ case 2:
8074
+ createWhitelistInstruction = _a.sent();
8075
+ instructions.push(createWhitelistInstruction);
8076
+ return [3, 4];
8077
+ case 3:
8078
+ err_65 = _a.sent();
8079
+ console.log("perpClient createWhitelistInstruction error:: ", err_65);
8080
+ throw err_65;
8081
+ case 4: return [2, {
8082
+ instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8083
+ additionalSigners: additionalSigners
8084
+ }];
8085
+ }
8086
+ });
8087
+ }); };
8088
+ this.setWhitelistConfig = function (isSwapFeeExempt, isDepositFeeExempt, isWithdrawalFeeExempt, owner) { return __awaiter(_this, void 0, void 0, function () {
8089
+ var publicKey, preInstructions, instructions, postInstructions, additionalSigners, whitelist, setWhitelistConfigInstruction, err_66;
8090
+ return __generator(this, function (_a) {
8091
+ switch (_a.label) {
8092
+ case 0:
8093
+ publicKey = this.provider.wallet.publicKey;
8094
+ preInstructions = [];
8095
+ instructions = [];
8096
+ postInstructions = [];
8097
+ additionalSigners = [];
8098
+ _a.label = 1;
8099
+ case 1:
8100
+ _a.trys.push([1, 3, , 4]);
8101
+ whitelist = web3_js_1.PublicKey.findProgramAddressSync([Buffer.from("whitelist"), owner.toBuffer()], this.programId)[0];
8102
+ return [4, this.program.methods
8103
+ .setWhitelistConfig({
8104
+ isSwapFeeExempt: isSwapFeeExempt,
8105
+ isDepositFeeExempt: isDepositFeeExempt,
8106
+ isWithdrawalFeeExempt: isWithdrawalFeeExempt
8107
+ })
8108
+ .accounts({
8109
+ admin: publicKey,
8110
+ multisig: this.multisig.publicKey,
8111
+ owner: owner,
8112
+ whitelist: whitelist,
8113
+ systemProgram: web3_js_1.SystemProgram.programId,
8114
+ })
8115
+ .instruction()];
8116
+ case 2:
8117
+ setWhitelistConfigInstruction = _a.sent();
8118
+ instructions.push(setWhitelistConfigInstruction);
8119
+ return [3, 4];
8120
+ case 3:
8121
+ err_66 = _a.sent();
8122
+ console.log("perpClient setWhitelistConfigInstruction error:: ", err_66);
8123
+ throw err_66;
8124
+ case 4: return [2, {
8125
+ instructions: __spreadArray(__spreadArray(__spreadArray([], preInstructions, true), instructions, true), postInstructions, true),
8126
+ additionalSigners: additionalSigners
8127
+ }];
8128
+ }
8129
+ });
8130
+ }); };
8005
8131
  this.provider = provider;
8006
8132
  (0, anchor_1.setProvider)(provider);
8007
8133
  this.program = new anchor_1.Program(perpetuals_1.IDL, programId);
@@ -1,4 +1,3 @@
1
- /// <reference types="bn.js" />
2
1
  import { BN } from "@coral-xyz/anchor";
3
2
  import { Pool, TokenRatios, StakeStats, CompoundingStats, Permissions } from "./types";
4
3
  import { PublicKey } from "@solana/web3.js";
@@ -1,4 +1,3 @@
1
- /// <reference types="bn.js" />
2
1
  import { BN } from "@coral-xyz/anchor";
3
2
  import { Mint } from "@solana/spl-token";
4
3
  import { CustodyAccount } from "./CustodyAccount";
@@ -1,4 +1,3 @@
1
- /// <reference types="bn.js" />
2
1
  import { BN } from "@coral-xyz/anchor";
3
2
  import { PublicKey } from "@solana/web3.js";
4
3
  import { ContractOraclePrice, Position } from "./types";
@@ -1,4 +1,3 @@
1
- /// <reference types="bn.js" />
2
1
  import { TokenStake, WithdrawStakeLog } from "./types";
3
2
  import { BN } from "@coral-xyz/anchor";
4
3
  import { PublicKey } from "@solana/web3.js";
@@ -1,4 +1,3 @@
1
- /// <reference types="bn.js" />
2
1
  import { BN } from "@coral-xyz/anchor";
3
2
  import { PublicKey } from "@solana/web3.js";
4
3
  import { TokenVault } from "./types";
@@ -9,8 +9,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
+ return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
14
  function verb(n) { return function (v) { return step([n, v]); }; }
15
15
  function step(op) {
16
16
  if (f) throw new TypeError("Generator is already executing.");