flash-sdk 10.10.5 → 10.100.1-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.
- package/dist/CustodyAccount.d.ts +2 -2
- package/dist/MarketAccount.d.ts +2 -2
- package/dist/MarketAccount.js +1 -1
- package/dist/OraclePrice.d.ts +4 -2
- package/dist/OraclePrice.js +23 -4
- package/dist/OrderAccount.d.ts +1 -1
- package/dist/PerpetualsClient.d.ts +385 -4332
- package/dist/PerpetualsClient.js +6254 -4927
- package/dist/PoolAccount.d.ts +3 -0
- package/dist/PoolConfig.d.ts +9 -2
- package/dist/PoolConfig.js +67 -4
- package/dist/PoolConfig.json +88 -4035
- package/dist/PoolDataClient.js +12 -11
- package/dist/PositionAccount.d.ts +6 -3
- package/dist/TokenStakeAccount.d.ts +24 -4
- package/dist/TokenStakeAccount.js +44 -2
- package/dist/TokenVaultAccount.d.ts +1 -0
- package/dist/ViewHelper.d.ts +2 -1
- package/dist/ViewHelper.js +17 -20
- package/dist/backupOracle.d.ts +0 -1
- package/dist/backupOracle.js +26 -5
- package/dist/constants/index.d.ts +1 -0
- package/dist/constants/index.js +2 -1
- package/dist/idl/perpetuals.d.ts +29233 -11115
- package/dist/idl/perpetuals.js +0 -16293
- package/dist/idl/perpetuals.json +34411 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +7 -3
- package/dist/remoraTokensWithPriceIds.d.ts +13 -0
- package/dist/remoraTokensWithPriceIds.js +265 -0
- package/dist/testPublkey.d.ts +0 -0
- package/dist/testPublkey.js +0 -0
- package/dist/testSize.d.ts +0 -0
- package/dist/testSize.js +0 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/generated.d.ts +2556 -0
- package/dist/types/generated.js +2 -0
- package/dist/types/index.d.ts +52 -144
- package/dist/types/index.js +22 -4
- package/dist/utils/IdlCoder.d.ts +3 -2
- package/dist/utils/IdlCoder.js +4 -2
- package/dist/utils/anchorCpiEvents.d.ts +1 -2
- package/dist/utils/anchorCpiEvents.js +10 -6
- package/dist/utils/getReferralAccounts.d.ts +1 -1
- package/dist/utils/getReferralAccounts.js +3 -8
- package/dist/xstocksTokensWithPriceIds.d.ts +13 -0
- package/dist/xstocksTokensWithPriceIds.js +369 -0
- package/package.json +9 -5
- package/readme.md +37 -3
- package/dist/TradingAccount.d.ts +0 -24
- package/dist/TradingAccount.js +0 -17
- package/dist/idl/fbnft_rewards.d.ts +0 -290
- package/dist/idl/fbnft_rewards.js +0 -292
- package/dist/idl/perp_composability.d.ts +0 -760
- package/dist/idl/perp_composability.js +0 -762
- package/dist/idl/reward_distribution.d.ts +0 -347
- package/dist/idl/reward_distribution.js +0 -349
package/dist/PoolAccount.d.ts
CHANGED
|
@@ -38,6 +38,9 @@ export declare class PoolAccount implements Pool {
|
|
|
38
38
|
compoundingLpPrice: BN;
|
|
39
39
|
lastUpdatedTimestamp: BN;
|
|
40
40
|
padding2: BN[];
|
|
41
|
+
feesObligationUsd: BN;
|
|
42
|
+
rebateObligationUsd: BN;
|
|
43
|
+
thresholdUsd: BN;
|
|
41
44
|
constructor(publicKey: PublicKey, parseData: Pool);
|
|
42
45
|
static from(publicKey: PublicKey, parseData: Pool): PoolAccount;
|
|
43
46
|
updatePoolData(parseData: Pool): void;
|
package/dist/PoolConfig.d.ts
CHANGED
|
@@ -54,6 +54,7 @@ export declare class PoolConfig {
|
|
|
54
54
|
fbNftRewardProgramId: PublicKey;
|
|
55
55
|
cluster: Cluster;
|
|
56
56
|
poolName: string;
|
|
57
|
+
isDeprecated: boolean;
|
|
57
58
|
poolAddress: PublicKey;
|
|
58
59
|
stakedLpTokenMint: PublicKey;
|
|
59
60
|
compoundingTokenMint: PublicKey;
|
|
@@ -67,6 +68,8 @@ export declare class PoolConfig {
|
|
|
67
68
|
tokenMint: PublicKey;
|
|
68
69
|
tokenVault: PublicKey;
|
|
69
70
|
tokenVaultTokenAccount: PublicKey;
|
|
71
|
+
rebateVault: PublicKey;
|
|
72
|
+
rebateTokenAccount: PublicKey;
|
|
70
73
|
revenueTokenAccount: PublicKey;
|
|
71
74
|
protocolVault: PublicKey;
|
|
72
75
|
protocolTokenAccount: PublicKey;
|
|
@@ -83,15 +86,18 @@ export declare class PoolConfig {
|
|
|
83
86
|
rewardTokenAccount: PublicKey;
|
|
84
87
|
};
|
|
85
88
|
tokens: Token[];
|
|
89
|
+
tokensDeprecated: Token[];
|
|
86
90
|
custodies: CustodyConfig[];
|
|
91
|
+
custodiesDeprecated: CustodyConfig[];
|
|
87
92
|
markets: MarketConfig[];
|
|
88
|
-
|
|
93
|
+
marketsDeprecated: MarketConfig[];
|
|
94
|
+
constructor(programId: PublicKey, perpComposibilityProgramId: PublicKey, fbNftRewardProgramId: PublicKey, cluster: Cluster, poolName: string, isDeprecated: boolean, poolAddress: PublicKey, stakedLpTokenMint: PublicKey, compoundingTokenMint: PublicKey, stakedLpVault: PublicKey, compoundingLpVault: PublicKey, lpDecimals: number, compoundingLpTokenSymbol: string, stakedLpTokenSymbol: string, perpetuals: PublicKey, transferAuthority: PublicKey, tokenMint: PublicKey, tokenVault: PublicKey, tokenVaultTokenAccount: PublicKey, rebateVault: PublicKey, rebateTokenAccount: PublicKey, revenueTokenAccount: PublicKey, protocolVault: PublicKey, protocolTokenAccount: PublicKey, multisig: PublicKey, addressLookupTableAddresses: PublicKey[], pusherAddressLookupTableAddress: PublicKey, backupOracle: PublicKey, nftCollectionAddress: PublicKey, rewardDistributionProgram: {
|
|
89
95
|
programId: PublicKey;
|
|
90
96
|
transferAuthority: PublicKey;
|
|
91
97
|
rewardVault: PublicKey;
|
|
92
98
|
rewardMint: PublicKey;
|
|
93
99
|
rewardTokenAccount: PublicKey;
|
|
94
|
-
}, tokens: Token[], custodies: CustodyConfig[], markets: MarketConfig[]);
|
|
100
|
+
}, tokens: Token[], tokensDeprecated: Token[], custodies: CustodyConfig[], custodiesDeprecated: CustodyConfig[], markets: MarketConfig[], marketsDeprecated: MarketConfig[]);
|
|
95
101
|
getAllTokenMints(): PublicKey[];
|
|
96
102
|
getMarketConfigByPk(marketAccountPk: PublicKey): MarketConfig;
|
|
97
103
|
getMarketConfig(targetCustody: PublicKey, collateralCustody: PublicKey, side: Side): MarketConfig | null;
|
|
@@ -99,6 +105,7 @@ export declare class PoolConfig {
|
|
|
99
105
|
getPositionFromMarketPk(owner: PublicKey, marketAccount: PublicKey): PublicKey;
|
|
100
106
|
getOrderFromMarketPk(owner: PublicKey, marketAccount: PublicKey): PublicKey;
|
|
101
107
|
getPositionFromCustodyPk(owner: PublicKey, targetCustody: PublicKey, collateralCustody: PublicKey, side: Side): PublicKey;
|
|
108
|
+
getOrderFromCustodyPk(owner: PublicKey, targetCustody: PublicKey, collateralCustody: PublicKey, side: Side): PublicKey;
|
|
102
109
|
doesMarketExist(pubkey: PublicKey): boolean;
|
|
103
110
|
getAllMarketPks(): PublicKey[];
|
|
104
111
|
getNonStableTokens(): PublicKey[];
|
package/dist/PoolConfig.js
CHANGED
|
@@ -19,13 +19,14 @@ var web3_js_1 = require("@solana/web3.js");
|
|
|
19
19
|
var PoolConfig_json_1 = __importDefault(require("./PoolConfig.json"));
|
|
20
20
|
var types_1 = require("./types");
|
|
21
21
|
var PoolConfig = (function () {
|
|
22
|
-
function PoolConfig(programId, perpComposibilityProgramId, fbNftRewardProgramId, cluster, poolName, poolAddress, stakedLpTokenMint, compoundingTokenMint, stakedLpVault, compoundingLpVault, lpDecimals, compoundingLpTokenSymbol, stakedLpTokenSymbol, perpetuals, transferAuthority, tokenMint, tokenVault, tokenVaultTokenAccount, revenueTokenAccount, protocolVault, protocolTokenAccount, multisig, addressLookupTableAddresses, pusherAddressLookupTableAddress, backupOracle, nftCollectionAddress, rewardDistributionProgram, tokens, custodies, markets) {
|
|
22
|
+
function PoolConfig(programId, perpComposibilityProgramId, fbNftRewardProgramId, cluster, poolName, isDeprecated, poolAddress, stakedLpTokenMint, compoundingTokenMint, stakedLpVault, compoundingLpVault, lpDecimals, compoundingLpTokenSymbol, stakedLpTokenSymbol, perpetuals, transferAuthority, tokenMint, tokenVault, tokenVaultTokenAccount, rebateVault, rebateTokenAccount, revenueTokenAccount, protocolVault, protocolTokenAccount, multisig, addressLookupTableAddresses, pusherAddressLookupTableAddress, backupOracle, nftCollectionAddress, rewardDistributionProgram, tokens, tokensDeprecated, custodies, custodiesDeprecated, markets, marketsDeprecated) {
|
|
23
23
|
var _this = this;
|
|
24
24
|
this.programId = programId;
|
|
25
25
|
this.perpComposibilityProgramId = perpComposibilityProgramId;
|
|
26
26
|
this.fbNftRewardProgramId = fbNftRewardProgramId;
|
|
27
27
|
this.cluster = cluster;
|
|
28
28
|
this.poolName = poolName;
|
|
29
|
+
this.isDeprecated = isDeprecated;
|
|
29
30
|
this.poolAddress = poolAddress;
|
|
30
31
|
this.stakedLpTokenMint = stakedLpTokenMint;
|
|
31
32
|
this.compoundingTokenMint = compoundingTokenMint;
|
|
@@ -39,6 +40,8 @@ var PoolConfig = (function () {
|
|
|
39
40
|
this.tokenMint = tokenMint;
|
|
40
41
|
this.tokenVault = tokenVault;
|
|
41
42
|
this.tokenVaultTokenAccount = tokenVaultTokenAccount;
|
|
43
|
+
this.rebateVault = rebateVault;
|
|
44
|
+
this.rebateTokenAccount = rebateTokenAccount;
|
|
42
45
|
this.revenueTokenAccount = revenueTokenAccount;
|
|
43
46
|
this.protocolVault = protocolVault;
|
|
44
47
|
this.protocolTokenAccount = protocolTokenAccount;
|
|
@@ -49,8 +52,11 @@ var PoolConfig = (function () {
|
|
|
49
52
|
this.nftCollectionAddress = nftCollectionAddress;
|
|
50
53
|
this.rewardDistributionProgram = rewardDistributionProgram;
|
|
51
54
|
this.tokens = tokens;
|
|
55
|
+
this.tokensDeprecated = tokensDeprecated;
|
|
52
56
|
this.custodies = custodies;
|
|
57
|
+
this.custodiesDeprecated = custodiesDeprecated;
|
|
53
58
|
this.markets = markets;
|
|
59
|
+
this.marketsDeprecated = marketsDeprecated;
|
|
54
60
|
this.getTokenFromSymbol = function (symbol) {
|
|
55
61
|
return _this.tokens.find(function (f) { return f.symbol.toUpperCase() === symbol.toUpperCase(); });
|
|
56
62
|
};
|
|
@@ -62,10 +68,15 @@ var PoolConfig = (function () {
|
|
|
62
68
|
};
|
|
63
69
|
}
|
|
64
70
|
PoolConfig.prototype.getAllTokenMints = function () {
|
|
65
|
-
|
|
71
|
+
var tokenList = Array.from(this.tokens.map(function (token) { return new web3_js_1.PublicKey(token.mintKey); }));
|
|
72
|
+
var deprecatedTokenList = Array.from(this.tokensDeprecated.map(function (token) { return new web3_js_1.PublicKey(token.mintKey); }));
|
|
73
|
+
return tokenList.concat(deprecatedTokenList);
|
|
66
74
|
};
|
|
67
75
|
PoolConfig.prototype.getMarketConfigByPk = function (marketAccountPk) {
|
|
68
76
|
var market = this.markets.find(function (f) { return f.marketAccount.equals(marketAccountPk); });
|
|
77
|
+
if (!market) {
|
|
78
|
+
market = this.marketsDeprecated.find(function (f) { return f.marketAccount.equals(marketAccountPk); });
|
|
79
|
+
}
|
|
69
80
|
if (!market)
|
|
70
81
|
throw new Error("No such market ".concat(marketAccountPk.toBase58(), " exists."));
|
|
71
82
|
return market;
|
|
@@ -73,6 +84,9 @@ var PoolConfig = (function () {
|
|
|
73
84
|
PoolConfig.prototype.getMarketConfig = function (targetCustody, collateralCustody, side) {
|
|
74
85
|
var marketAccountPk = this.getMarketPk(targetCustody, collateralCustody, side);
|
|
75
86
|
var market = this.markets.find(function (f) { return f.marketAccount.equals(marketAccountPk); });
|
|
87
|
+
if (!market) {
|
|
88
|
+
market = this.marketsDeprecated.find(function (f) { return f.marketAccount.equals(marketAccountPk); });
|
|
89
|
+
}
|
|
76
90
|
if (!market)
|
|
77
91
|
return null;
|
|
78
92
|
return market;
|
|
@@ -106,6 +120,13 @@ var PoolConfig = (function () {
|
|
|
106
120
|
this.getMarketPk(targetCustody, collateralCustody, side).toBuffer(),
|
|
107
121
|
], this.programId)[0];
|
|
108
122
|
};
|
|
123
|
+
PoolConfig.prototype.getOrderFromCustodyPk = function (owner, targetCustody, collateralCustody, side) {
|
|
124
|
+
return web3_js_1.PublicKey.findProgramAddressSync([
|
|
125
|
+
Buffer.from("order"),
|
|
126
|
+
owner.toBuffer(),
|
|
127
|
+
this.getMarketPk(targetCustody, collateralCustody, side).toBuffer(),
|
|
128
|
+
], this.programId)[0];
|
|
129
|
+
};
|
|
109
130
|
PoolConfig.prototype.doesMarketExist = function (pubkey) {
|
|
110
131
|
return;
|
|
111
132
|
};
|
|
@@ -153,6 +174,20 @@ var PoolConfig = (function () {
|
|
|
153
174
|
catch (error) {
|
|
154
175
|
console.log("ERROR: buildPoolconfigFromJson unable to load tokens ");
|
|
155
176
|
}
|
|
177
|
+
var tokensDeprecated;
|
|
178
|
+
try {
|
|
179
|
+
if (!poolConfig['tokensDeprecated']) {
|
|
180
|
+
tokensDeprecated = [];
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
tokensDeprecated = poolConfig['tokensDeprecated'].map(function (i) {
|
|
184
|
+
return __assign(__assign({}, i), { mintKey: new web3_js_1.PublicKey(i.mintKey) });
|
|
185
|
+
});
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
catch (error) {
|
|
189
|
+
console.log("ERROR: buildPoolconfigFromJson unable to load tokensDeprecated ");
|
|
190
|
+
}
|
|
156
191
|
var custodies;
|
|
157
192
|
try {
|
|
158
193
|
custodies = poolConfig['custodies'].map(function (i, index) {
|
|
@@ -162,6 +197,20 @@ var PoolConfig = (function () {
|
|
|
162
197
|
catch (error) {
|
|
163
198
|
console.log("ERROR: buildPoolconfigFromJson unable to load custodies ");
|
|
164
199
|
}
|
|
200
|
+
var custodiesDeprecated;
|
|
201
|
+
try {
|
|
202
|
+
if (!poolConfig['custodiesDeprecated']) {
|
|
203
|
+
custodiesDeprecated = [];
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
custodiesDeprecated = poolConfig['custodiesDeprecated'].map(function (i) {
|
|
207
|
+
return __assign(__assign({}, i), { custodyId: i.custodyId, custodyAccount: new web3_js_1.PublicKey(i.custodyAccount), tokenAccount: new web3_js_1.PublicKey(i.tokenAccount), mintKey: new web3_js_1.PublicKey(i.mintKey), intOracleAccount: new web3_js_1.PublicKey(i.intOracleAddress), extOracleAccount: new web3_js_1.PublicKey(i.extOracleAddress), usdPrecision: i.usdPrecision, tokenPrecision: i.tokenPrecision });
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
catch (error) {
|
|
212
|
+
console.log("ERROR: buildPoolconfigFromJson unable to load custodiesDeprecated ");
|
|
213
|
+
}
|
|
165
214
|
var addressLookupTableAddresses;
|
|
166
215
|
try {
|
|
167
216
|
addressLookupTableAddresses = poolConfig['addressLookupTableAddresses'].map(function (i) {
|
|
@@ -187,13 +236,27 @@ var PoolConfig = (function () {
|
|
|
187
236
|
catch (error) {
|
|
188
237
|
console.log("ERROR: buildPoolconfigFromJson unable to load markets ");
|
|
189
238
|
}
|
|
190
|
-
|
|
239
|
+
var marketsDeprecated;
|
|
240
|
+
try {
|
|
241
|
+
if (!poolConfig['marketsDeprecated']) {
|
|
242
|
+
marketsDeprecated = [];
|
|
243
|
+
}
|
|
244
|
+
else {
|
|
245
|
+
marketsDeprecated = poolConfig['marketsDeprecated'].map(function (i) {
|
|
246
|
+
return __assign(__assign({}, i), { marketAccount: new web3_js_1.PublicKey(i.marketAccount), marketCorrelation: i.marketCorrelation, pool: new web3_js_1.PublicKey(i.pool), targetCustody: new web3_js_1.PublicKey(i.targetCustody), collateralCustody: new web3_js_1.PublicKey(i.collateralCustody), side: i.side === 'long' ? types_1.Side.Long : types_1.Side.Short, maxLev: i.maxLev, degenMinLev: i.degenMinLev, degenMaxLev: i.degenMaxLev, targetMint: new web3_js_1.PublicKey(i.targetMint), collateralMint: new web3_js_1.PublicKey(i.collateralMint) });
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
catch (error) {
|
|
251
|
+
console.log("ERROR: buildPoolconfigFromJson unable to load markets ");
|
|
252
|
+
}
|
|
253
|
+
return new PoolConfig(new web3_js_1.PublicKey(poolConfig.programId), new web3_js_1.PublicKey(poolConfig.perpComposibilityProgramId), new web3_js_1.PublicKey(poolConfig.fbNftRewardProgramId), poolConfig.cluster, poolConfig.poolName, poolConfig.isDeprecated, new web3_js_1.PublicKey(poolConfig.poolAddress), new web3_js_1.PublicKey(poolConfig.stakedLpTokenMint), new web3_js_1.PublicKey(poolConfig.compoundingTokenMint), new web3_js_1.PublicKey(poolConfig.stakedLpVault), new web3_js_1.PublicKey(poolConfig.compoundingLpVault), poolConfig.lpDecimals, poolConfig.compoundingLpTokenSymbol, poolConfig.stakedLpTokenSymbol, new web3_js_1.PublicKey(poolConfig.perpetuals), new web3_js_1.PublicKey(poolConfig.transferAuthority), new web3_js_1.PublicKey(poolConfig.tokenMint), new web3_js_1.PublicKey(poolConfig.tokenVault), new web3_js_1.PublicKey(poolConfig.tokenVaultTokenAccount), new web3_js_1.PublicKey(poolConfig.rebateVault), new web3_js_1.PublicKey(poolConfig.rebateTokenAccount), new web3_js_1.PublicKey(poolConfig.revenueTokenAccount), new web3_js_1.PublicKey(poolConfig.protocolVault), new web3_js_1.PublicKey(poolConfig.protocolTokenAccount), new web3_js_1.PublicKey(poolConfig.multisig), addressLookupTableAddresses, pusherAddressLookupTableAddress, new web3_js_1.PublicKey(poolConfig.backupOracle), new web3_js_1.PublicKey(poolConfig.nftCollectionAddress), {
|
|
191
254
|
programId: new web3_js_1.PublicKey(poolConfig.rewardDistributionProgram.programId),
|
|
192
255
|
rewardMint: new web3_js_1.PublicKey(poolConfig.rewardDistributionProgram.rewardMint),
|
|
193
256
|
rewardTokenAccount: new web3_js_1.PublicKey(poolConfig.rewardDistributionProgram.rewardTokenAccount),
|
|
194
257
|
rewardVault: new web3_js_1.PublicKey(poolConfig.rewardDistributionProgram.rewardVault),
|
|
195
258
|
transferAuthority: new web3_js_1.PublicKey(poolConfig.rewardDistributionProgram.transferAuthority),
|
|
196
|
-
}, tokens, custodies, markets);
|
|
259
|
+
}, tokens, tokensDeprecated, custodies, custodiesDeprecated, markets, marketsDeprecated);
|
|
197
260
|
};
|
|
198
261
|
PoolConfig.fromIdsByName = function (name, cluster) {
|
|
199
262
|
var poolConfig = PoolConfig_json_1.default.pools.find(function (pool) { return pool['poolName'] === name && cluster === pool['cluster']; });
|