flash-sdk 10.5.1 → 10.5.3-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 { 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,11 +15,12 @@ export declare class PositionAccount implements Position {
16
15
  lockedUsd: BN;
17
16
  collateralAmount: BN;
18
17
  collateralUsd: BN;
19
- unsettledAmount: BN;
18
+ unsettledValueUsd: BN;
20
19
  unsettledFeesUsd: BN;
21
20
  cumulativeLockFeeSnapshot: BN;
22
21
  degenSizeUsd: BN;
23
- buffer: BN;
22
+ referencePrice: ContractOraclePrice;
23
+ buffer: number;
24
24
  sizeDecimals: number;
25
25
  lockedDecimals: number;
26
26
  collateralDecimals: number;
@@ -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";
@@ -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.");
@@ -4,7 +4,6 @@ import { PoolConfig } from "./PoolConfig";
4
4
  import { BackupOracle } from "./types";
5
5
  import { Program } from "@coral-xyz/anchor";
6
6
  import { Perpetuals } from "./idl/perpetuals";
7
- export declare const API_ENDPOINT: string;
8
7
  export declare const pythPriceServiceConnection: PriceServiceConnection;
9
8
  export declare const getPythnetOraclePrices: (program: Program<Perpetuals>, poolConfig: PoolConfig, backupOracleSecretKey: string) => Promise<TransactionInstruction>;
10
9
  export declare const getBackupOracleInstruction: (program: Program<Perpetuals>, poolConfig: PoolConfig, backupOracleSecretKey: string, backupCaches: BackupOracle[]) => TransactionInstruction;
@@ -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,13 +40,14 @@ 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 = 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"));
47
48
  var bs58_1 = __importDefault(require("bs58"));
48
49
  var tweetnacl_1 = __importDefault(require("tweetnacl"));
49
- exports.API_ENDPOINT = (_a = process.env.NEXT_PUBLIC_API_ENDPOINT) !== null && _a !== void 0 ? _a : 'https://api.prod.flash.trade';
50
+ var API_ENDPOINT = (_a = process.env.NEXT_PUBLIC_API_ENDPOINT) !== null && _a !== void 0 ? _a : 'https://api.prod.flash.trade';
50
51
  exports.pythPriceServiceConnection = new price_service_client_1.PriceServiceConnection('https://hermes.pyth.network', {
51
52
  priceFeedRequestConfig: {},
52
53
  });
@@ -137,7 +138,7 @@ function createBackupOracleInstruction(poolAddress_1) {
137
138
  switch (_a.label) {
138
139
  case 0:
139
140
  _a.trys.push([0, 3, , 4]);
140
- return [4, fetch("".concat(exports.API_ENDPOINT, "/backup-oracle/prices?poolAddress=").concat(poolAddress))];
141
+ return [4, fetch("".concat(API_ENDPOINT, "/backup-oracle/prices?poolAddress=").concat(poolAddress))];
141
142
  case 1: return [4, (_a.sent()).json()];
142
143
  case 2:
143
144
  backupOracleData = _a.sent();
@@ -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;