flash-sdk 9.0.2 → 9.0.3-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.
- package/dist/MarketAccount.js +1 -1
- package/dist/OraclePrice.d.ts +0 -1
- package/dist/OrderAccount.d.ts +0 -1
- package/dist/PerpetualsClient.d.ts +303 -146
- package/dist/PerpetualsClient.js +720 -1078
- package/dist/PoolAccount.d.ts +3 -1
- package/dist/PoolConfig.d.ts +3 -1
- package/dist/PoolConfig.js +4 -2
- package/dist/PoolConfig.json +186 -3238
- package/dist/PoolDataClient.d.ts +0 -1
- package/dist/PositionAccount.d.ts +3 -3
- package/dist/TokenStakeAccount.d.ts +2 -3
- package/dist/TokenStakeAccount.js +2 -2
- package/dist/TokenVaultAccount.d.ts +0 -1
- package/dist/ViewHelper.js +2 -2
- package/dist/backupOracle.d.ts +0 -1
- package/dist/backupOracle.js +6 -6
- package/dist/constants/index.d.ts +0 -1
- package/dist/idl/perpetuals.d.ts +3041 -1714
- package/dist/idl/perpetuals.js +3041 -1714
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/testSize.d.ts +0 -0
- package/dist/testSize.js +0 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +18 -5
- package/dist/types/index.js +6 -5
- package/dist/utils/IdlCoder.js +17 -7
- package/dist/utils/alt.js +5 -6
- package/dist/utils/anchorCpiEvents.d.ts +0 -1
- package/dist/utils/anchorCpiEvents.js +4 -4
- package/dist/utils/getReferralAccounts.d.ts +1 -1
- package/dist/utils/getReferralAccounts.js +3 -8
- package/dist/utils/index.js +6 -6
- package/dist/utils/rpc.js +9 -9
- package/package.json +1 -1
- package/dist/TradingAccount.d.ts +0 -24
- package/dist/TradingAccount.js +0 -17
package/dist/PoolDataClient.d.ts
CHANGED
|
@@ -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
|
-
|
|
18
|
+
unsettledValueUsd: BN;
|
|
20
19
|
unsettledFeesUsd: BN;
|
|
21
20
|
cumulativeLockFeeSnapshot: BN;
|
|
22
21
|
degenSizeUsd: BN;
|
|
23
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
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
|
-
|
|
39
|
+
claimableRebateUsd: decodedData.claimableRebateUsd,
|
|
40
40
|
});
|
|
41
41
|
};
|
|
42
42
|
TokenStakeAccount.prototype.updateData = function (newData) {
|
package/dist/ViewHelper.js
CHANGED
|
@@ -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 =
|
|
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.");
|
package/dist/backupOracle.d.ts
CHANGED
|
@@ -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;
|
package/dist/backupOracle.js
CHANGED
|
@@ -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 =
|
|
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.
|
|
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
|
-
|
|
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(
|
|
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;
|