flash-sdk 11.3.6 → 11.4.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,3 @@
1
- /// <reference types="bn.js" />
2
1
  import { BN } from "@coral-xyz/anchor";
3
2
  import { ContractOraclePrice } from "./types";
4
3
  export declare class OraclePrice {
@@ -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 { LimitOrder, Order, TriggerOrder } from "./types";
@@ -1,5 +1,3 @@
1
- /// <reference types="bn.js" />
2
- /// <reference types="node" />
3
1
  import { Program, AnchorProvider, BN } from "@coral-xyz/anchor";
4
2
  import { PublicKey, TransactionInstruction, Commitment, Signer, AddressLookupTableAccount, VersionedTransaction } from "@solana/web3.js";
5
3
  import { PoolAccount } from "./PoolAccount";
@@ -8,9 +6,6 @@ import { AddLiquidityAmountAndFee, InternalPrice, BorrowRateParams, ExitPriceAnd
8
6
  import { OraclePrice } from "./OraclePrice";
9
7
  import { CustodyAccount } from "./CustodyAccount";
10
8
  import { Perpetuals } from "./idl/perpetuals";
11
- import { PerpComposability } from "./idl/perp_composability";
12
- import { FbnftRewards } from "./idl/fbnft_rewards";
13
- import { RewardDistribution } from "./idl/reward_distribution";
14
9
  import { SendTransactionOpts } from "./utils/rpc";
15
10
  import { MarketConfig, PoolConfig, Token } from "./PoolConfig";
16
11
  import { MarketAccount } from "./MarketAccount";
@@ -24,12 +19,8 @@ export type PerpClientOptions = {
24
19
  export declare class PerpetualsClient {
25
20
  provider: AnchorProvider;
26
21
  program: Program<Perpetuals>;
27
- programPerpComposability: Program<PerpComposability>;
28
- programFbnftReward: Program<FbnftRewards>;
29
- programRewardDistribution: Program<RewardDistribution>;
30
22
  admin: PublicKey;
31
23
  programId: PublicKey;
32
- composabilityProgramId: PublicKey;
33
24
  multisig: {
34
25
  publicKey: PublicKey;
35
26
  bump: number;
@@ -50,10 +41,6 @@ export declare class PerpetualsClient {
50
41
  publicKey: PublicKey;
51
42
  bump: number;
52
43
  };
53
- eventAuthorityRewardDistribution: {
54
- publicKey: PublicKey;
55
- bump: number;
56
- };
57
44
  prioritizationFee: number;
58
45
  minimumBalanceForRentExemptAccountLamports: number;
59
46
  private postSendTxCallback?;
@@ -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.");
@@ -69,9 +69,6 @@ var PositionAccount_1 = require("./PositionAccount");
69
69
  var types_1 = require("./types");
70
70
  var OraclePrice_1 = require("./OraclePrice");
71
71
  var perpetuals_1 = require("./idl/perpetuals");
72
- var perp_composability_1 = require("./idl/perp_composability");
73
- var fbnft_rewards_1 = require("./idl/fbnft_rewards");
74
- var reward_distribution_1 = require("./idl/reward_distribution");
75
72
  var rpc_1 = require("./utils/rpc");
76
73
  var utils_1 = require("./utils");
77
74
  var constants_1 = require("./constants");
@@ -7125,12 +7122,12 @@ var PerpetualsClient = (function () {
7125
7122
  });
7126
7123
  }); };
7127
7124
  this.moveProtocolFees = function (rewardSymbol, poolConfig) { return __awaiter(_this, void 0, void 0, function () {
7128
- var publicKey, custodyConfig, instructions, additionalSigners, moveProtocolFeesIx, err_45;
7125
+ var publicKey, rewardCustodyConfig, instructions, additionalSigners, moveProtocolFeesIx, err_45;
7129
7126
  return __generator(this, function (_a) {
7130
7127
  switch (_a.label) {
7131
7128
  case 0:
7132
7129
  publicKey = this.provider.wallet.publicKey;
7133
- custodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(rewardSymbol).mintKey); });
7130
+ rewardCustodyConfig = poolConfig.custodies.find(function (i) { return i.mintKey.equals(poolConfig.getTokenFromSymbol(rewardSymbol).mintKey); });
7134
7131
  instructions = [];
7135
7132
  additionalSigners = [];
7136
7133
  _a.label = 1;
@@ -7143,15 +7140,15 @@ var PerpetualsClient = (function () {
7143
7140
  perpetuals: this.perpetuals.publicKey,
7144
7141
  tokenVault: poolConfig.tokenVault,
7145
7142
  pool: poolConfig.poolAddress,
7146
- custody: custodyConfig.custodyAccount,
7147
- custodyTokenAccount: custodyConfig.tokenAccount,
7143
+ rewardCustody: rewardCustodyConfig.custodyAccount,
7144
+ rewardCustodyTokenAccount: rewardCustodyConfig.tokenAccount,
7148
7145
  revenueTokenAccount: poolConfig.revenueTokenAccount,
7149
7146
  protocolVault: poolConfig.protocolVault,
7150
7147
  protocolTokenAccount: poolConfig.protocolTokenAccount,
7151
7148
  tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
7152
7149
  eventAuthority: this.eventAuthority.publicKey,
7153
7150
  program: this.program.programId,
7154
- tokenMint: custodyConfig.mintKey,
7151
+ tokenMint: rewardCustodyConfig.mintKey,
7155
7152
  })
7156
7153
  .instruction()];
7157
7154
  case 2:
@@ -8164,17 +8161,12 @@ var PerpetualsClient = (function () {
8164
8161
  this.provider = provider;
8165
8162
  (0, anchor_1.setProvider)(provider);
8166
8163
  this.program = new anchor_1.Program(perpetuals_1.IDL, programId);
8167
- this.programPerpComposability = new anchor_1.Program(perp_composability_1.IDL, composabilityProgramId);
8168
- this.programFbnftReward = new anchor_1.Program(fbnft_rewards_1.IDL, fbNftRewardProgramId);
8169
- this.programRewardDistribution = new anchor_1.Program(reward_distribution_1.IDL, rewardDistributionProgramId);
8170
8164
  this.programId = programId;
8171
- this.composabilityProgramId = composabilityProgramId;
8172
8165
  this.admin = this.provider.wallet.publicKey;
8173
8166
  this.multisig = this.findProgramAddress("multisig");
8174
8167
  this.authority = this.findProgramAddress("transfer_authority");
8175
8168
  this.perpetuals = this.findProgramAddress("perpetuals");
8176
8169
  this.eventAuthority = this.findProgramAddress("__event_authority");
8177
- this.eventAuthorityRewardDistribution = this.findProgramAddressFromProgramId("__event_authority", null, this.programRewardDistribution.programId);
8178
8170
  this.minimumBalanceForRentExemptAccountLamports = 2039280;
8179
8171
  this.prioritizationFee = (opts === null || opts === void 0 ? void 0 : opts.prioritizationFee) || 0;
8180
8172
  this.useExtOracleAccount = useExtOracleAccount;
@@ -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";
@@ -2939,6 +2939,19 @@
2939
2939
  "pythTicker": "Commodities.WTIG6/USD",
2940
2940
  "pythPriceId": "0x7e91242dfd2cea64715b26edaa3e51bafc712a56ac4228a77bd53b51fd66db52",
2941
2941
  "isToken2022": false
2942
+ },
2943
+ {
2944
+ "symbol": "XAUt",
2945
+ "mintKey": "xaut1dB1uihYCwjReVgwZ4mBBJzwkXn4picqqmk4v2H",
2946
+ "decimals": 6,
2947
+ "usdPrecision": 4,
2948
+ "tokenPrecision": 4,
2949
+ "isStable": false,
2950
+ "isVirtual": false,
2951
+ "lazerId": 172,
2952
+ "pythTicker": "Crypto.XAUT/USD",
2953
+ "pythPriceId": "0x44465e17d2e9d390e70c999d5a11fda4f092847fcd2e3e5aa089d96c98a30e67",
2954
+ "isToken2022": false
2942
2955
  }
2943
2956
  ],
2944
2957
  "custodies": [
@@ -3043,25 +3056,26 @@
3043
3056
  "lazerId": 2691,
3044
3057
  "pythTicker": "Commodities.WTIG6/USD",
3045
3058
  "pythPriceId": "0x7e91242dfd2cea64715b26edaa3e51bafc712a56ac4228a77bd53b51fd66db52"
3059
+ },
3060
+ {
3061
+ "custodyId": 7,
3062
+ "custodyAccount": "8sriDinQT789N7AJrEtQ2Q1jvVm7jGHhkdw4zTLKZxGe",
3063
+ "tokenAccount": "DpnfaMR5kJhVyy5SGk6yB1JHXYuqJhsm53wdewd8gNd1",
3064
+ "symbol": "XAUt",
3065
+ "mintKey": "xaut1dB1uihYCwjReVgwZ4mBBJzwkXn4picqqmk4v2H",
3066
+ "decimals": 6,
3067
+ "usdPrecision": 4,
3068
+ "tokenPrecision": 4,
3069
+ "isStable": false,
3070
+ "isVirtual": false,
3071
+ "intOracleAddress": "6fCDXgCYMnY29RENXKE2yGxvtMVUCMU59kkmS212MjMc",
3072
+ "extOracleAddress": "2uPQGpm8X4ZkxMHxrAW1QuhXcse1AHEgPih6Xp9NuEWW",
3073
+ "lazerId": 172,
3074
+ "pythTicker": "Crypto.XAUT/USD",
3075
+ "pythPriceId": "0x44465e17d2e9d390e70c999d5a11fda4f092847fcd2e3e5aa089d96c98a30e67"
3046
3076
  }
3047
3077
  ],
3048
3078
  "markets": [
3049
- {
3050
- "marketId": 0,
3051
- "marketAccount": "6VaKMhU9mtWUVXSj73VMj5RAXfLiE7mRn1myyWEwBC6S",
3052
- "marketCorrelation": false,
3053
- "pool": "Ar7yp9PJkRpvXasLB4NYdbDHnuvAZ1gDA8ALnkPKivbb",
3054
- "targetCustody": "EXumu4qqjXYpv1RUzTGiVJAvjvL3BWzn592SSwxrtZwW",
3055
- "collateralCustody": "4nkiPSMJb4hpLhpaXbebkYF73Ub5vjeked8mWkPafMBm",
3056
- "side": "long",
3057
- "maxLev": 100,
3058
- "degenMinLev": 1,
3059
- "degenMaxLev": 100,
3060
- "targetCustodyId": 1,
3061
- "collateralCustodyId": 0,
3062
- "targetMint": "xaucSYSxjZF4EbsLqAGRvPcuD1uXAj9awmsxYkUAavx",
3063
- "collateralMint": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr"
3064
- },
3065
3079
  {
3066
3080
  "marketId": 1,
3067
3081
  "marketAccount": "HH56JHJojhexo4eAE6dCC8XAKKoHiUzEg5fkFRmVGh2S",
@@ -3078,22 +3092,6 @@
3078
3092
  "targetMint": "xaucSYSxjZF4EbsLqAGRvPcuD1uXAj9awmsxYkUAavx",
3079
3093
  "collateralMint": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr"
3080
3094
  },
3081
- {
3082
- "marketId": 2,
3083
- "marketAccount": "F2ro3DdrYJB59JS18wekPKU8yKG5YKFejypPkEX7wYzK",
3084
- "marketCorrelation": false,
3085
- "pool": "Ar7yp9PJkRpvXasLB4NYdbDHnuvAZ1gDA8ALnkPKivbb",
3086
- "targetCustody": "H9KvJwG7qB5hcuqdx5Ac3mVFiSdTsms92NLQnGC9eGkx",
3087
- "collateralCustody": "4nkiPSMJb4hpLhpaXbebkYF73Ub5vjeked8mWkPafMBm",
3088
- "side": "long",
3089
- "maxLev": 100,
3090
- "degenMinLev": 1,
3091
- "degenMaxLev": 100,
3092
- "targetCustodyId": 2,
3093
- "collateralCustodyId": 0,
3094
- "targetMint": "xagGMhSCG8WDsf3zFep6sGtvyY1D78roKCHTJtEWg4Z",
3095
- "collateralMint": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr"
3096
- },
3097
3095
  {
3098
3096
  "marketId": 3,
3099
3097
  "marketAccount": "GofqHEVEZDEEzLtsGzHszvQAjEuByXR2jK5d7Y94ioQ3",
@@ -3205,6 +3203,38 @@
3205
3203
  "collateralCustodyId": 0,
3206
3204
  "targetMint": "oi1DkCGa5CVm379ZuznLMevqjg7KGWnDDFB96JXAi7a",
3207
3205
  "collateralMint": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr"
3206
+ },
3207
+ {
3208
+ "marketId": 12,
3209
+ "marketAccount": "HCHwtnbLgZPPkYqrbXF1oF688dxHW6cbhfU7yFLgfCpY",
3210
+ "marketCorrelation": true,
3211
+ "pool": "Ar7yp9PJkRpvXasLB4NYdbDHnuvAZ1gDA8ALnkPKivbb",
3212
+ "targetCustody": "EXumu4qqjXYpv1RUzTGiVJAvjvL3BWzn592SSwxrtZwW",
3213
+ "collateralCustody": "8sriDinQT789N7AJrEtQ2Q1jvVm7jGHhkdw4zTLKZxGe",
3214
+ "side": "long",
3215
+ "maxLev": 50,
3216
+ "degenMinLev": 1,
3217
+ "degenMaxLev": 50,
3218
+ "targetCustodyId": 1,
3219
+ "collateralCustodyId": 7,
3220
+ "targetMint": "xaucSYSxjZF4EbsLqAGRvPcuD1uXAj9awmsxYkUAavx",
3221
+ "collateralMint": "xaut1dB1uihYCwjReVgwZ4mBBJzwkXn4picqqmk4v2H"
3222
+ },
3223
+ {
3224
+ "marketId": 13,
3225
+ "marketAccount": "6L3TrWrCSVq46N6zyTufVV6hpmMaLQgohkXntkf2fkzc",
3226
+ "marketCorrelation": false,
3227
+ "pool": "Ar7yp9PJkRpvXasLB4NYdbDHnuvAZ1gDA8ALnkPKivbb",
3228
+ "targetCustody": "H9KvJwG7qB5hcuqdx5Ac3mVFiSdTsms92NLQnGC9eGkx",
3229
+ "collateralCustody": "8sriDinQT789N7AJrEtQ2Q1jvVm7jGHhkdw4zTLKZxGe",
3230
+ "side": "long",
3231
+ "maxLev": 50,
3232
+ "degenMinLev": 1,
3233
+ "degenMaxLev": 50,
3234
+ "targetCustodyId": 2,
3235
+ "collateralCustodyId": 7,
3236
+ "targetMint": "xagGMhSCG8WDsf3zFep6sGtvyY1D78roKCHTJtEWg4Z",
3237
+ "collateralMint": "xaut1dB1uihYCwjReVgwZ4mBBJzwkXn4picqqmk4v2H"
3208
3238
  }
3209
3239
  ]
3210
3240
  },
@@ -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.");
@@ -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 = void 0;
43
+ exports.getBackupOracleInstruction = exports.getPythnetOraclePrices = exports.pythPriceServiceConnection = 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;