flash-sdk 1.0.80 → 1.0.81
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/CustodyAccount.js +1 -1
- package/dist/OraclePrice.d.ts +5 -1
- package/dist/OraclePrice.js +14 -1
- package/dist/PerpetualsClient.d.ts +56 -224
- package/dist/PerpetualsClient.js +96 -9
- package/dist/PoolAccount.js +4 -2
- package/dist/PoolConfig.json +100 -0
- package/dist/idl/perpetuals.d.ts +2 -18
- package/dist/idl/perpetuals.js +2 -18
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +61 -191
- package/dist/types/index.js +30 -20
- package/package.json +1 -1
package/dist/types/index.d.ts
CHANGED
@@ -1,8 +1,34 @@
|
|
1
1
|
/// <reference types="bn.js" />
|
2
|
-
import {
|
3
|
-
import {
|
4
|
-
import { BN } from "@coral-xyz/anchor";
|
2
|
+
import { MethodsNamespace, IdlTypes, IdlAccounts, BN } from "@coral-xyz/anchor";
|
3
|
+
import { Perpetuals } from "../idl/perpetuals";
|
5
4
|
export type PositionSide = "long" | "short";
|
5
|
+
export type Methods = MethodsNamespace<Perpetuals>;
|
6
|
+
export type Accounts = IdlAccounts<Perpetuals>;
|
7
|
+
export type Types = IdlTypes<Perpetuals>;
|
8
|
+
export type InitParams = Types["InitParams"];
|
9
|
+
export type OracleParams = Types["OracleParams"];
|
10
|
+
export type PricingParams = Types["PricingParams"];
|
11
|
+
export type Permissions = Types["Permissions"];
|
12
|
+
export type Fees = Types["Fees"];
|
13
|
+
export type BorrowRateParams = Types["BorrowRateParams"];
|
14
|
+
export type TokenRatios = Types["TokenRatios"];
|
15
|
+
export type SetCustomOraclePriceParams = Types["SetCustomOraclePriceParams"];
|
16
|
+
export type AmountAndFee = Types["AmountAndFee"];
|
17
|
+
export type NewPositionPricesAndFee = Types["NewPositionPricesAndFee"];
|
18
|
+
export type PriceAndFee = Types["PriceAndFee"];
|
19
|
+
export type ProfitAndLoss = Types["ProfitAndLoss"];
|
20
|
+
export type SwapAmountAndFees = Types["SwapAmountAndFees"];
|
21
|
+
export type RatioFee = Types["RatioFees"];
|
22
|
+
export type Assets = Types["Assets"];
|
23
|
+
export type FeesStats = Types["FeesStats"];
|
24
|
+
export type TradeStats = Types["TradeStats"];
|
25
|
+
export type VolumeStats = Types["VolumeStats"];
|
26
|
+
export type PositionStats = Types["PositionStats"];
|
27
|
+
export type BorrowRateState = Types["BorrowRateState"];
|
28
|
+
export type Custody = Accounts["custody"];
|
29
|
+
export type Pool = Accounts["pool"];
|
30
|
+
export type Position = Accounts["position"];
|
31
|
+
export type PerpetualsAccount = Accounts["perpetuals"];
|
6
32
|
export declare function isVariant(object: any, type: string): any;
|
7
33
|
export declare function isOneOfVariant(object: any, types: string[]): any;
|
8
34
|
export declare class Side {
|
@@ -16,6 +42,17 @@ export declare class Side {
|
|
16
42
|
short: {};
|
17
43
|
};
|
18
44
|
}
|
45
|
+
export declare class OracleType {
|
46
|
+
static None: {
|
47
|
+
none: {};
|
48
|
+
};
|
49
|
+
static Test: {
|
50
|
+
test: {};
|
51
|
+
};
|
52
|
+
static Pyth: {
|
53
|
+
pyth: {};
|
54
|
+
};
|
55
|
+
}
|
19
56
|
export declare class AumCalcMode {
|
20
57
|
static Min: {
|
21
58
|
min: {};
|
@@ -23,134 +60,6 @@ export declare class AumCalcMode {
|
|
23
60
|
static Max: {
|
24
61
|
max: {};
|
25
62
|
};
|
26
|
-
static Last: {
|
27
|
-
last: {};
|
28
|
-
};
|
29
|
-
static EMA: {
|
30
|
-
ema: {};
|
31
|
-
};
|
32
|
-
}
|
33
|
-
export interface Position {
|
34
|
-
owner: PublicKey;
|
35
|
-
delegate: PublicKey;
|
36
|
-
pool: PublicKey;
|
37
|
-
custody: PublicKey;
|
38
|
-
collateralCustody: PublicKey;
|
39
|
-
openTime: BN;
|
40
|
-
updateTime: BN;
|
41
|
-
side: Side;
|
42
|
-
price: BN;
|
43
|
-
sizeUsd: BN;
|
44
|
-
borrowSizeUsd: BN;
|
45
|
-
collateralUsd: BN;
|
46
|
-
unrealizedProfitUsd: BN;
|
47
|
-
unrealizedLossUsd: BN;
|
48
|
-
cumulativeInterestSnapshot: BN;
|
49
|
-
lockedAmount: BN;
|
50
|
-
collateralAmount: BN;
|
51
|
-
sizeAmount: BN;
|
52
|
-
bump: number;
|
53
|
-
}
|
54
|
-
export declare const DEFAULT_POSITION: Position;
|
55
|
-
export interface Pool {
|
56
|
-
name: string;
|
57
|
-
custodies: PublicKey[];
|
58
|
-
ratios: TokenRatios[];
|
59
|
-
aumUsd: BN;
|
60
|
-
bump: number;
|
61
|
-
lpTokenBump: number;
|
62
|
-
inceptionTime: BN;
|
63
|
-
}
|
64
|
-
export interface TokenRatios {
|
65
|
-
target: BN;
|
66
|
-
min: BN;
|
67
|
-
max: BN;
|
68
|
-
}
|
69
|
-
export interface Custody {
|
70
|
-
pool: PublicKey;
|
71
|
-
mint: PublicKey;
|
72
|
-
tokenAccount: PublicKey;
|
73
|
-
decimals: number;
|
74
|
-
isStable: boolean;
|
75
|
-
oracle: OracleParams;
|
76
|
-
pricing: PricingParams;
|
77
|
-
permissions: Permissions;
|
78
|
-
fees: Fees;
|
79
|
-
borrowRate: BorrowRateParams;
|
80
|
-
assets: Assets;
|
81
|
-
collectedFees: FeesStats;
|
82
|
-
volumeStats: VolumeStats;
|
83
|
-
tradeStats: TradeStats;
|
84
|
-
longPositions: PositionStats;
|
85
|
-
shortPositions: PositionStats;
|
86
|
-
borrowRateState: BorrowRateState;
|
87
|
-
bump: number;
|
88
|
-
tokenAccountBump: number;
|
89
|
-
}
|
90
|
-
export interface BorrowRateParams {
|
91
|
-
baseRate: BN;
|
92
|
-
slope1: BN;
|
93
|
-
slope2: BN;
|
94
|
-
optimalUtilization: BN;
|
95
|
-
}
|
96
|
-
export interface BorrowRateState {
|
97
|
-
currentRate: BN;
|
98
|
-
cumulativeInterest: BN;
|
99
|
-
lastUpdate: BN;
|
100
|
-
}
|
101
|
-
export interface PositionStats {
|
102
|
-
openPositions: BN;
|
103
|
-
collateralUsd: BN;
|
104
|
-
sizeUsd: BN;
|
105
|
-
lockedAmount: BN;
|
106
|
-
weightedPrice: BN;
|
107
|
-
totalQuantity: BN;
|
108
|
-
cumulativeInterestUsd: BN;
|
109
|
-
cumulativeInterestSnapshot: BN;
|
110
|
-
}
|
111
|
-
export interface Assets {
|
112
|
-
collateral: BN;
|
113
|
-
protocolFees: BN;
|
114
|
-
owned: BN;
|
115
|
-
locked: BN;
|
116
|
-
}
|
117
|
-
export interface FeesStats {
|
118
|
-
swapUsd: BN;
|
119
|
-
addLiquidityUsd: BN;
|
120
|
-
removeLiquidityUsd: BN;
|
121
|
-
openPositionUsd: BN;
|
122
|
-
closePositionUsd: BN;
|
123
|
-
liquidationUsd: BN;
|
124
|
-
}
|
125
|
-
export interface VolumeStats {
|
126
|
-
swapUsd: BN;
|
127
|
-
addLiquidityUsd: BN;
|
128
|
-
removeLiquidityUsd: BN;
|
129
|
-
openPositionUsd: BN;
|
130
|
-
closePositionUsd: BN;
|
131
|
-
liquidationUsd: BN;
|
132
|
-
}
|
133
|
-
export interface RatioFees {
|
134
|
-
baseRate: BN;
|
135
|
-
slope1: BN;
|
136
|
-
constant1: BN;
|
137
|
-
slope2: BN;
|
138
|
-
constant2: BN;
|
139
|
-
minFee: BN;
|
140
|
-
maxFee: BN;
|
141
|
-
}
|
142
|
-
export interface Fees {
|
143
|
-
mode: FeesMode;
|
144
|
-
ratioMult: BN;
|
145
|
-
utilizationMult: BN;
|
146
|
-
swapIn: RatioFees;
|
147
|
-
swapOut: RatioFees;
|
148
|
-
addLiquidity: RatioFees;
|
149
|
-
removeLiquidity: RatioFees;
|
150
|
-
openPosition: BN;
|
151
|
-
closePosition: BN;
|
152
|
-
liquidation: BN;
|
153
|
-
protocolShare: BN;
|
154
63
|
}
|
155
64
|
export declare class FeesMode {
|
156
65
|
static Fixed: {
|
@@ -160,63 +69,37 @@ export declare class FeesMode {
|
|
160
69
|
linear: {};
|
161
70
|
};
|
162
71
|
}
|
163
|
-
export
|
164
|
-
|
165
|
-
|
166
|
-
maxPriceError: BN;
|
167
|
-
maxPriceAgeSec: number;
|
168
|
-
}
|
169
|
-
export declare class OracleType {
|
170
|
-
static None: {
|
171
|
-
none: {};
|
72
|
+
export declare class FeesAction {
|
73
|
+
static AddLiquidity: {
|
74
|
+
addLiquidity: {};
|
172
75
|
};
|
173
|
-
static
|
174
|
-
|
76
|
+
static RemoveLiquidity: {
|
77
|
+
removeLiquidity: {};
|
175
78
|
};
|
176
|
-
static
|
177
|
-
|
79
|
+
static SwapIn: {
|
80
|
+
swapIn: {};
|
81
|
+
};
|
82
|
+
static SwapOut: {
|
83
|
+
swapOut: {};
|
84
|
+
};
|
85
|
+
static StableSwapIn: {
|
86
|
+
stableSwapIn: {};
|
87
|
+
};
|
88
|
+
static StableSwapOut: {
|
89
|
+
stableSwapOut: {};
|
178
90
|
};
|
179
91
|
}
|
180
|
-
export
|
181
|
-
allowSwap: boolean;
|
182
|
-
allowAddLiquidity: boolean;
|
183
|
-
allowRemoveLiquidity: boolean;
|
184
|
-
allowOpenPosition: boolean;
|
185
|
-
allowClosePosition: boolean;
|
186
|
-
allowPnlWithdrawal: boolean;
|
187
|
-
allowCollateralWithdrawal: boolean;
|
188
|
-
allowSizeChange: boolean;
|
189
|
-
}
|
190
|
-
export interface PricingParams {
|
191
|
-
useEma: boolean;
|
192
|
-
useUnrealizedPnlInAum: boolean;
|
193
|
-
tradeSpreadLong: BN;
|
194
|
-
tradeSpreadShort: BN;
|
195
|
-
swapSpread: BN;
|
196
|
-
minInitialLeverage: BN;
|
197
|
-
maxInitialLeverage: BN;
|
198
|
-
maxLeverage: BN;
|
199
|
-
maxPayoffMult: BN;
|
200
|
-
maxUtilization: BN;
|
201
|
-
maxPositionLockedUsd: BN;
|
202
|
-
maxTotalLockedUsd: BN;
|
203
|
-
}
|
204
|
-
export interface TradeStats {
|
205
|
-
profitUsd: BN;
|
206
|
-
lossUsd: BN;
|
207
|
-
oiLong: BN;
|
208
|
-
oiShort: BN;
|
209
|
-
}
|
210
|
-
export interface PriceFeed {
|
211
|
-
price: OraclePrice;
|
212
|
-
ema_price: OraclePrice;
|
213
|
-
}
|
92
|
+
export declare const DEFAULT_POSITION: Position;
|
214
93
|
export interface ExitPriceAndFee {
|
215
94
|
price: BN;
|
216
95
|
fee: BN;
|
217
96
|
exitAmount: BN;
|
218
97
|
liquidationPrice: BN;
|
219
98
|
}
|
99
|
+
export interface MinAndMaxPrice {
|
100
|
+
min: BN;
|
101
|
+
max: BN;
|
102
|
+
}
|
220
103
|
export interface EntryPriceAndFee {
|
221
104
|
price: BN;
|
222
105
|
fee: BN;
|
@@ -226,19 +109,6 @@ export interface RemoveCollateralData {
|
|
226
109
|
collateralAmountRecieved: BN;
|
227
110
|
newCollateralAmount: BN;
|
228
111
|
}
|
229
|
-
export interface ProfitAndLoss {
|
230
|
-
profit: BN;
|
231
|
-
loss: BN;
|
232
|
-
}
|
233
|
-
export interface SwapAmountAndFees {
|
234
|
-
amountOut: BN;
|
235
|
-
feeIn: BN;
|
236
|
-
feeOut: BN;
|
237
|
-
}
|
238
|
-
export interface AmountAndFee {
|
239
|
-
amount: BN;
|
240
|
-
fee: BN;
|
241
|
-
}
|
242
112
|
export interface AddLiquidityAmountAndFee {
|
243
113
|
lpAmountOut: BN;
|
244
114
|
fee: BN;
|
package/dist/types/index.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.DEFAULT_POSITION = exports.FeesAction = exports.FeesMode = exports.AumCalcMode = exports.OracleType = exports.Side = exports.isOneOfVariant = exports.isVariant = void 0;
|
4
4
|
var web3_js_1 = require("@solana/web3.js");
|
5
5
|
var constants_1 = require("../constants");
|
6
6
|
function isVariant(object, type) {
|
@@ -22,16 +22,43 @@ var Side = (function () {
|
|
22
22
|
return Side;
|
23
23
|
}());
|
24
24
|
exports.Side = Side;
|
25
|
+
var OracleType = (function () {
|
26
|
+
function OracleType() {
|
27
|
+
}
|
28
|
+
OracleType.None = { none: {} };
|
29
|
+
OracleType.Test = { test: {} };
|
30
|
+
OracleType.Pyth = { pyth: {} };
|
31
|
+
return OracleType;
|
32
|
+
}());
|
33
|
+
exports.OracleType = OracleType;
|
25
34
|
var AumCalcMode = (function () {
|
26
35
|
function AumCalcMode() {
|
27
36
|
}
|
28
37
|
AumCalcMode.Min = { min: {} };
|
29
38
|
AumCalcMode.Max = { max: {} };
|
30
|
-
AumCalcMode.Last = { last: {} };
|
31
|
-
AumCalcMode.EMA = { ema: {} };
|
32
39
|
return AumCalcMode;
|
33
40
|
}());
|
34
41
|
exports.AumCalcMode = AumCalcMode;
|
42
|
+
var FeesMode = (function () {
|
43
|
+
function FeesMode() {
|
44
|
+
}
|
45
|
+
FeesMode.Fixed = { fixed: {} };
|
46
|
+
FeesMode.Linear = { linear: {} };
|
47
|
+
return FeesMode;
|
48
|
+
}());
|
49
|
+
exports.FeesMode = FeesMode;
|
50
|
+
var FeesAction = (function () {
|
51
|
+
function FeesAction() {
|
52
|
+
}
|
53
|
+
FeesAction.AddLiquidity = { addLiquidity: {} };
|
54
|
+
FeesAction.RemoveLiquidity = { removeLiquidity: {} };
|
55
|
+
FeesAction.SwapIn = { swapIn: {} };
|
56
|
+
FeesAction.SwapOut = { swapOut: {} };
|
57
|
+
FeesAction.StableSwapIn = { stableSwapIn: {} };
|
58
|
+
FeesAction.StableSwapOut = { stableSwapOut: {} };
|
59
|
+
return FeesAction;
|
60
|
+
}());
|
61
|
+
exports.FeesAction = FeesAction;
|
35
62
|
exports.DEFAULT_POSITION = {
|
36
63
|
owner: web3_js_1.PublicKey.default,
|
37
64
|
delegate: web3_js_1.PublicKey.default,
|
@@ -53,20 +80,3 @@ exports.DEFAULT_POSITION = {
|
|
53
80
|
sizeAmount: constants_1.BN_ZERO,
|
54
81
|
bump: 0
|
55
82
|
};
|
56
|
-
var FeesMode = (function () {
|
57
|
-
function FeesMode() {
|
58
|
-
}
|
59
|
-
FeesMode.Fixed = { fixed: {} };
|
60
|
-
FeesMode.Linear = { linear: {} };
|
61
|
-
return FeesMode;
|
62
|
-
}());
|
63
|
-
exports.FeesMode = FeesMode;
|
64
|
-
var OracleType = (function () {
|
65
|
-
function OracleType() {
|
66
|
-
}
|
67
|
-
OracleType.None = { none: {} };
|
68
|
-
OracleType.Test = { test: {} };
|
69
|
-
OracleType.Pyth = { pyth: {} };
|
70
|
-
return OracleType;
|
71
|
-
}());
|
72
|
-
exports.OracleType = OracleType;
|