flash-sdk 9.0.3 → 9.0.4-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,3 +1,4 @@
1
+ /// <reference types="bn.js" />
1
2
  import { BN } from "@coral-xyz/anchor";
2
3
  import { Mint } from "@solana/spl-token";
3
4
  import { CustodyAccount } from "./CustodyAccount";
@@ -1,3 +1,4 @@
1
+ /// <reference types="bn.js" />
1
2
  import { BN } from "@coral-xyz/anchor";
2
3
  import { PublicKey } from "@solana/web3.js";
3
4
  import { ContractOraclePrice, Position } from "./types";
@@ -15,11 +16,12 @@ export declare class PositionAccount implements Position {
15
16
  lockedUsd: BN;
16
17
  collateralAmount: BN;
17
18
  collateralUsd: BN;
18
- unsettledAmount: BN;
19
+ unsettledValueUsd: BN;
19
20
  unsettledFeesUsd: BN;
20
21
  cumulativeLockFeeSnapshot: BN;
21
22
  degenSizeUsd: BN;
22
- buffer: BN;
23
+ referencePrice: ContractOraclePrice;
24
+ buffer: number;
23
25
  sizeDecimals: number;
24
26
  lockedDecimals: number;
25
27
  collateralDecimals: number;
@@ -1,3 +1,4 @@
1
+ /// <reference types="bn.js" />
1
2
  import { TokenStake, WithdrawStakeLog } from "./types";
2
3
  import { BN } from "@coral-xyz/anchor";
3
4
  import { PublicKey } from "@solana/web3.js";
@@ -16,7 +17,7 @@ export declare class TokenStakeAccount implements TokenStake {
16
17
  rewardTokens: BN;
17
18
  unclaimedRevenueAmount: BN;
18
19
  revenueSnapshot: BN;
19
- padding: BN[];
20
+ claimableRebateUsd: BN;
20
21
  constructor(data: {
21
22
  owner: PublicKey;
22
23
  isInitialized: boolean;
@@ -32,7 +33,7 @@ export declare class TokenStakeAccount implements TokenStake {
32
33
  rewardTokens: BN;
33
34
  unclaimedRevenueAmount: BN;
34
35
  revenueSnapshot: BN;
35
- padding: BN[];
36
+ claimableRebateUsd: BN;
36
37
  });
37
38
  static from(decodedData: any): TokenStakeAccount;
38
39
  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,3 +1,4 @@
1
+ /// <reference types="bn.js" />
1
2
  import { BN } from "@coral-xyz/anchor";
2
3
  import { PublicKey } from "@solana/web3.js";
3
4
  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 = 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;
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;
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 = 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;
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;
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,14 +40,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
40
40
  };
41
41
  var _a;
42
42
  Object.defineProperty(exports, "__esModule", { value: true });
43
- exports.getBackupOracleInstruction = exports.getPythnetOraclePrices = exports.pythPriceServiceConnection = exports.API_ENDPOINT = void 0;
44
- exports.createBackupOracleInstruction = createBackupOracleInstruction;
43
+ exports.createBackupOracleInstruction = exports.getBackupOracleInstruction = exports.getPythnetOraclePrices = exports.pythPriceServiceConnection = void 0;
45
44
  var price_service_client_1 = require("@pythnetwork/price-service-client");
46
45
  var web3_js_1 = require("@solana/web3.js");
47
46
  var bn_js_1 = __importDefault(require("bn.js"));
48
47
  var bs58_1 = __importDefault(require("bs58"));
49
48
  var tweetnacl_1 = __importDefault(require("tweetnacl"));
50
- exports.API_ENDPOINT = (_a = process.env.NEXT_PUBLIC_API_ENDPOINT) !== null && _a !== void 0 ? _a : 'https://api.prod.flash.trade';
49
+ var API_ENDPOINT = (_a = process.env.NEXT_PUBLIC_API_ENDPOINT) !== null && _a !== void 0 ? _a : 'https://api.prod.flash.trade';
51
50
  exports.pythPriceServiceConnection = new price_service_client_1.PriceServiceConnection('https://hermes.pyth.network', {
52
51
  priceFeedRequestConfig: {},
53
52
  });
@@ -138,7 +137,7 @@ function createBackupOracleInstruction(poolAddress_1) {
138
137
  switch (_a.label) {
139
138
  case 0:
140
139
  _a.trys.push([0, 3, , 4]);
141
- return [4, fetch("".concat(exports.API_ENDPOINT, "/backup-oracle/prices?poolAddress=").concat(poolAddress))];
140
+ return [4, fetch("".concat(API_ENDPOINT, "/backup-oracle/prices?poolAddress=").concat(poolAddress))];
142
141
  case 1: return [4, (_a.sent()).json()];
143
142
  case 2:
144
143
  backupOracleData = _a.sent();
@@ -157,3 +156,4 @@ function createBackupOracleInstruction(poolAddress_1) {
157
156
  });
158
157
  });
159
158
  }
159
+ exports.createBackupOracleInstruction = createBackupOracleInstruction;
@@ -1,3 +1,4 @@
1
+ /// <reference types="bn.js" />
1
2
  import { PublicKey } from '@solana/web3.js';
2
3
  export declare const PERCENTAGE_DECIMALS = 4;
3
4
  export declare const USD_DECIMALS = 6;