flash-sdk 8.0.2 → 9.0.0-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.");
@@ -1120,6 +1120,7 @@ var PerpetualsClient = (function () {
1120
1120
  newLev: newLev,
1121
1121
  liquidationPrice: finalLiquidationPrice,
1122
1122
  collateralAmountRecieved: collateralAmountReceived,
1123
+ collateralAmountRecievedUsd: collateralAmountRecievedUsd,
1123
1124
  newCollateralAmount: newPosition.collateralAmount.add(diff),
1124
1125
  newPnl: finalPnlUsd
1125
1126
  };
@@ -2767,12 +2768,12 @@ var PerpetualsClient = (function () {
2767
2768
  });
2768
2769
  });
2769
2770
  };
2770
- this.swapAndOpen = function (targetTokenSymbol_1, collateralTokenSymbol_1, userInputTokenSymbol_1, amountIn_1, minCollateralAmountOut_1, priceWithSlippage_1, sizeAmount_1, side_1, poolConfig_1, privilege_1) {
2771
+ this.swapAndOpen = function (targetTokenSymbol_1, collateralTokenSymbol_1, userInputTokenSymbol_1, amountIn_1, priceWithSlippage_1, sizeAmount_1, side_1, poolConfig_1, privilege_1) {
2771
2772
  var args_1 = [];
2772
- for (var _i = 10; _i < arguments.length; _i++) {
2773
- args_1[_i - 10] = arguments[_i];
2773
+ for (var _i = 9; _i < arguments.length; _i++) {
2774
+ args_1[_i - 9] = arguments[_i];
2774
2775
  }
2775
- return __awaiter(_this, __spreadArray([targetTokenSymbol_1, collateralTokenSymbol_1, userInputTokenSymbol_1, amountIn_1, minCollateralAmountOut_1, priceWithSlippage_1, sizeAmount_1, side_1, poolConfig_1, privilege_1], args_1, true), void 0, function (targetTokenSymbol, collateralTokenSymbol, userInputTokenSymbol, amountIn, minCollateralAmountOut, priceWithSlippage, sizeAmount, side, poolConfig, privilege, tokenStakeAccount, userReferralAccount, rebateTokenAccount, skipBalanceChecks, ephemeralSignerPubkey) {
2776
+ return __awaiter(_this, __spreadArray([targetTokenSymbol_1, collateralTokenSymbol_1, userInputTokenSymbol_1, amountIn_1, priceWithSlippage_1, sizeAmount_1, side_1, poolConfig_1, privilege_1], args_1, true), void 0, function (targetTokenSymbol, collateralTokenSymbol, userInputTokenSymbol, amountIn, priceWithSlippage, sizeAmount, side, poolConfig, privilege, tokenStakeAccount, userReferralAccount, rebateTokenAccount, skipBalanceChecks, ephemeralSignerPubkey) {
2776
2777
  var publicKey, userInputCustodyConfig, collateralCustodyConfig, targetCustodyConfig, marketAccount, positionAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, targetToken, userInputTokenAccount, userInputToken, lamports, unWrappedSolBalance, _a, userOutputTokenAccount, tokenAccountBalance, _b, userOutputTokenAccount, rebateMintAccount, inx, err_3;
2777
2778
  if (tokenStakeAccount === void 0) { tokenStakeAccount = web3_js_1.PublicKey.default; }
2778
2779
  if (userReferralAccount === void 0) { userReferralAccount = web3_js_1.PublicKey.default; }
@@ -2881,7 +2882,6 @@ var PerpetualsClient = (function () {
2881
2882
  return [4, this.program.methods
2882
2883
  .swapAndOpen({
2883
2884
  amountIn: amountIn,
2884
- minCollateralAmountOut: minCollateralAmountOut,
2885
2885
  priceWithSlippage: priceWithSlippage,
2886
2886
  sizeAmount: sizeAmount,
2887
2887
  privilege: privilege
@@ -3166,12 +3166,12 @@ var PerpetualsClient = (function () {
3166
3166
  });
3167
3167
  });
3168
3168
  };
3169
- this.swapAndAddCollateral = function (targetSymbol_1, inputSymbol_1, collateralSymbol_1, amountIn_1, minCollateralAmountOut_1, side_1, positionPubKey_1, poolConfig_1) {
3169
+ this.swapAndAddCollateral = function (targetSymbol_1, inputSymbol_1, collateralSymbol_1, amountIn_1, side_1, positionPubKey_1, poolConfig_1) {
3170
3170
  var args_1 = [];
3171
- for (var _i = 8; _i < arguments.length; _i++) {
3172
- args_1[_i - 8] = arguments[_i];
3171
+ for (var _i = 7; _i < arguments.length; _i++) {
3172
+ args_1[_i - 7] = arguments[_i];
3173
3173
  }
3174
- return __awaiter(_this, __spreadArray([targetSymbol_1, inputSymbol_1, collateralSymbol_1, amountIn_1, minCollateralAmountOut_1, side_1, positionPubKey_1, poolConfig_1], args_1, true), void 0, function (targetSymbol, inputSymbol, collateralSymbol, amountIn, minCollateralAmountOut, side, positionPubKey, poolConfig, skipBalanceChecks, ephemeralSignerPubkey) {
3174
+ return __awaiter(_this, __spreadArray([targetSymbol_1, inputSymbol_1, collateralSymbol_1, amountIn_1, side_1, positionPubKey_1, poolConfig_1], args_1, true), void 0, function (targetSymbol, inputSymbol, collateralSymbol, amountIn, side, positionPubKey, poolConfig, skipBalanceChecks, ephemeralSignerPubkey) {
3175
3175
  var publicKey, collateralCustodyConfig, targetCustodyConfig, inputCustodyConfig, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, userInputTokenAccount, lamports, unWrappedSolBalance, _a, tokenAccountBalance, _b, userCollateralTokenAccount, marketAccount, instruction;
3176
3176
  if (skipBalanceChecks === void 0) { skipBalanceChecks = false; }
3177
3177
  if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
@@ -3250,7 +3250,6 @@ var PerpetualsClient = (function () {
3250
3250
  marketAccount = poolConfig.getMarketPk(targetCustodyConfig.custodyAccount, collateralCustodyConfig.custodyAccount, side);
3251
3251
  return [4, this.program.methods.swapAndAddCollateral({
3252
3252
  amountIn: amountIn,
3253
- minCollateralAmountOut: minCollateralAmountOut,
3254
3253
  }).accounts({
3255
3254
  owner: publicKey,
3256
3255
  feePayer: publicKey,
@@ -3286,12 +3285,12 @@ var PerpetualsClient = (function () {
3286
3285
  });
3287
3286
  });
3288
3287
  };
3289
- this.removeCollateral = function (collateralWithFee_1, marketSymbol_1, collateralSymbol_1, side_1, positionPubKey_1, poolConfig_1) {
3288
+ this.removeCollateral = function (collateralDeltaUsd_1, marketSymbol_1, collateralSymbol_1, side_1, positionPubKey_1, poolConfig_1) {
3290
3289
  var args_1 = [];
3291
3290
  for (var _i = 6; _i < arguments.length; _i++) {
3292
3291
  args_1[_i - 6] = arguments[_i];
3293
3292
  }
3294
- return __awaiter(_this, __spreadArray([collateralWithFee_1, marketSymbol_1, collateralSymbol_1, side_1, positionPubKey_1, poolConfig_1], args_1, true), void 0, function (collateralWithFee, marketSymbol, collateralSymbol, side, positionPubKey, poolConfig, createUserATA, closeUsersWSOLATA, ephemeralSignerPubkey) {
3293
+ return __awaiter(_this, __spreadArray([collateralDeltaUsd_1, marketSymbol_1, collateralSymbol_1, side_1, positionPubKey_1, poolConfig_1], args_1, true), void 0, function (collateralDeltaUsd, marketSymbol, collateralSymbol, side, positionPubKey, poolConfig, createUserATA, closeUsersWSOLATA, ephemeralSignerPubkey) {
3295
3294
  var publicKey, collateralCustodyConfig, targetCustodyConfig, userReceivingTokenAccount, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, lamports, _a, marketAccount, instruction, closeWsolATAIns, error_2;
3296
3295
  if (createUserATA === void 0) { createUserATA = true; }
3297
3296
  if (closeUsersWSOLATA === void 0) { closeUsersWSOLATA = false; }
@@ -3355,7 +3354,7 @@ var PerpetualsClient = (function () {
3355
3354
  marketAccount = poolConfig.getMarketPk(targetCustodyConfig.custodyAccount, collateralCustodyConfig.custodyAccount, side);
3356
3355
  return [4, this.program.methods
3357
3356
  .removeCollateral({
3358
- collateralDelta: collateralWithFee,
3357
+ collateralDeltaUsd: collateralDeltaUsd,
3359
3358
  })
3360
3359
  .accounts({
3361
3360
  owner: publicKey,
@@ -3397,12 +3396,12 @@ var PerpetualsClient = (function () {
3397
3396
  });
3398
3397
  });
3399
3398
  };
3400
- this.removeCollateralAndSwap = function (targetSymbol_1, collateralSymbol_1, outputSymbol_1, minSwapAmountOut_1, collateralDelta_1, side_1, poolConfig_1) {
3399
+ this.removeCollateralAndSwap = function (targetSymbol_1, collateralSymbol_1, outputSymbol_1, collateralDeltaUsd_1, side_1, poolConfig_1) {
3401
3400
  var args_1 = [];
3402
- for (var _i = 7; _i < arguments.length; _i++) {
3403
- args_1[_i - 7] = arguments[_i];
3401
+ for (var _i = 6; _i < arguments.length; _i++) {
3402
+ args_1[_i - 6] = arguments[_i];
3404
3403
  }
3405
- return __awaiter(_this, __spreadArray([targetSymbol_1, collateralSymbol_1, outputSymbol_1, minSwapAmountOut_1, collateralDelta_1, side_1, poolConfig_1], args_1, true), void 0, function (targetSymbol, collateralSymbol, outputSymbol, minSwapAmountOut, collateralDelta, side, poolConfig, ephemeralSignerPubkey) {
3404
+ return __awaiter(_this, __spreadArray([targetSymbol_1, collateralSymbol_1, outputSymbol_1, collateralDeltaUsd_1, side_1, poolConfig_1], args_1, true), void 0, function (targetSymbol, collateralSymbol, outputSymbol, collateralDeltaUsd, side, poolConfig, ephemeralSignerPubkey) {
3406
3405
  var publicKey, targetCustodyConfig, collateralCustodyConfig, outputCustodyConfig, wrappedSolAccount, preInstructions, instructions, postInstructions, additionalSigners, userReceivingTokenAccount, lamports, userCollateralTokenAccount, marketAccount, positionAccount, instruction;
3407
3406
  if (ephemeralSignerPubkey === void 0) { ephemeralSignerPubkey = undefined; }
3408
3407
  return __generator(this, function (_a) {
@@ -3459,8 +3458,7 @@ var PerpetualsClient = (function () {
3459
3458
  positionAccount = poolConfig.getPositionFromMarketPk(publicKey, marketAccount);
3460
3459
  return [4, this.program.methods
3461
3460
  .removeCollateralAndSwap({
3462
- collateralDelta: collateralDelta,
3463
- minSwapAmountOut: minSwapAmountOut,
3461
+ collateralDeltaUsd: collateralDeltaUsd,
3464
3462
  })
3465
3463
  .accounts({
3466
3464
  owner: publicKey,
@@ -7030,11 +7028,7 @@ var PerpetualsClient = (function () {
7030
7028
  rewardCustody: rewardCustody.custodyAccount,
7031
7029
  rewardCustodyOracleAccount: this.useExtOracleAccount ? rewardCustody.extOracleAccount : rewardCustody.intOracleAccount,
7032
7030
  rewardCustodyTokenAccount: rewardCustody.tokenAccount,
7033
- custody: custody.custodyAccount,
7034
- custodyOracleAccount: this.useExtOracleAccount ? custody.extOracleAccount : custody.intOracleAccount,
7035
- custodyTokenAccount: custody.tokenAccount,
7036
7031
  eventAuthority: this.eventAuthority.publicKey,
7037
- tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
7038
7032
  program: this.programId,
7039
7033
  ixSysvar: web3_js_1.SYSVAR_INSTRUCTIONS_PUBKEY
7040
7034
  })
@@ -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";
@@ -38,6 +37,9 @@ export declare class PoolAccount implements Pool {
38
37
  compoundingLpPrice: BN;
39
38
  lastUpdatedTimestamp: BN;
40
39
  padding2: BN[];
40
+ feesObligationUsd: BN;
41
+ rebateObligationUsd: BN;
42
+ thresholdUsd: BN;
41
43
  constructor(publicKey: PublicKey, parseData: Pool);
42
44
  static from(publicKey: PublicKey, parseData: Pool): PoolAccount;
43
45
  updatePoolData(parseData: Pool): void;
@@ -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";
@@ -16,7 +15,7 @@ export declare class PositionAccount implements Position {
16
15
  lockedUsd: BN;
17
16
  collateralAmount: BN;
18
17
  collateralUsd: BN;
19
- unsettledAmount: BN;
18
+ unsettledValue: BN;
20
19
  unsettledFeesUsd: BN;
21
20
  cumulativeLockFeeSnapshot: BN;
22
21
  degenSizeUsd: BN;
@@ -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";
@@ -17,7 +16,7 @@ export declare class TokenStakeAccount implements TokenStake {
17
16
  rewardTokens: BN;
18
17
  unclaimedRevenueAmount: BN;
19
18
  revenueSnapshot: BN;
20
- padding: BN[];
19
+ claimableRebateUsd: BN;
21
20
  constructor(data: {
22
21
  owner: PublicKey;
23
22
  isInitialized: boolean;
@@ -33,7 +32,7 @@ export declare class TokenStakeAccount implements TokenStake {
33
32
  rewardTokens: BN;
34
33
  unclaimedRevenueAmount: BN;
35
34
  revenueSnapshot: BN;
36
- padding: BN[];
35
+ claimableRebateUsd: BN;
37
36
  });
38
37
  static from(decodedData: any): TokenStakeAccount;
39
38
  updateData(newData: Partial<TokenStakeAccount>): void;
@@ -18,7 +18,7 @@ var TokenStakeAccount = (function () {
18
18
  this.lastRewardEpochCount = data.lastRewardEpochCount;
19
19
  this.unclaimedRevenueAmount = data.unclaimedRevenueAmount;
20
20
  this.revenueSnapshot = data.revenueSnapshot;
21
- this.padding = data.padding;
21
+ this.claimableRebateUsd = data.claimableRebateUsd;
22
22
  }
23
23
  TokenStakeAccount.from = function (decodedData) {
24
24
  return new TokenStakeAccount({
@@ -36,7 +36,7 @@ var TokenStakeAccount = (function () {
36
36
  lastRewardEpochCount: decodedData.lastRewardEpochCount,
37
37
  unclaimedRevenueAmount: decodedData.unclaimedRevenueAmount,
38
38
  revenueSnapshot: decodedData.revenueSnapshot,
39
- padding: decodedData.padding.map(function (p) { return new anchor_1.BN(p); }),
39
+ claimableRebateUsd: decodedData.claimableRebateUsd,
40
40
  });
41
41
  };
42
42
  TokenStakeAccount.prototype.updateData = function (newData) {
@@ -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";
@@ -1,4 +1,3 @@
1
- /// <reference types="bn.js" />
2
1
  import { BN } from "@coral-xyz/anchor";
3
2
  import { Trading, VoltageStats } from "./types";
4
3
  import { PublicKey } from "@solana/web3.js";
@@ -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.");
@@ -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.");
@@ -40,7 +40,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
40
40
  };
41
41
  var _a;
42
42
  Object.defineProperty(exports, "__esModule", { value: true });
43
- exports.createBackupOracleInstruction = exports.getBackupOracleInstruction = exports.getPythnetOraclePrices = exports.pythPriceServiceConnection = exports.API_ENDPOINT = void 0;
43
+ exports.getBackupOracleInstruction = exports.getPythnetOraclePrices = exports.pythPriceServiceConnection = exports.API_ENDPOINT = void 0;
44
+ exports.createBackupOracleInstruction = createBackupOracleInstruction;
44
45
  var price_service_client_1 = require("@pythnetwork/price-service-client");
45
46
  var web3_js_1 = require("@solana/web3.js");
46
47
  var bn_js_1 = __importDefault(require("bn.js"));
@@ -156,4 +157,3 @@ function createBackupOracleInstruction(poolAddress_1) {
156
157
  });
157
158
  });
158
159
  }
159
- exports.createBackupOracleInstruction = createBackupOracleInstruction;
@@ -1,4 +1,3 @@
1
- /// <reference types="bn.js" />
2
1
  import { PublicKey } from '@solana/web3.js';
3
2
  export declare const PERCENTAGE_DECIMALS = 4;
4
3
  export declare const USD_DECIMALS = 6;