flash-sdk 1.0.0 → 1.0.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/lib/PoolAccount.js +0 -58
- package/lib/PoolConfig.d.ts +39 -0
- package/lib/PoolConfig.js +93 -0
- package/lib/PoolConfig.json +305 -0
- package/lib/PoolDisplayData.d.ts +13 -0
- package/lib/PoolDisplayData.js +9 -0
- package/lib/constants/index.d.ts +3 -0
- package/lib/constants/index.js +3 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +2 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/PoolAccount.ts +0 -63
- package/src/PoolConfig.json +307 -0
- package/src/PoolConfig.ts +158 -0
- package/src/PoolDisplayData.ts +23 -0
- package/src/constants/index.ts +4 -0
- package/src/index.ts +2 -0
- package/src/target/idl/perpetuals.json +3537 -0
- package/tsconfig.json +1 -1
package/lib/PoolAccount.js
CHANGED
@@ -45,64 +45,6 @@ var PoolAccount = /** @class */ (function () {
|
|
45
45
|
var ratios = this.ratios[tokenId];
|
46
46
|
var current_ratio = this.getCurrentRatio(custody, tokenPrice);
|
47
47
|
throw Error("TODODO");
|
48
|
-
// let new_ratio = self.get_new_ratio(amount_add, amount_remove, custody, token_price)?;
|
49
|
-
// let improved = match new_ratio.cmp(&ratios.target) {
|
50
|
-
// Ordering::Less => {
|
51
|
-
// new_ratio > current_ratio
|
52
|
-
// || (current_ratio > ratios.target
|
53
|
-
// && current_ratio - ratios.target > ratios.target - new_ratio)
|
54
|
-
// }
|
55
|
-
// Ordering::Greater => {
|
56
|
-
// new_ratio < current_ratio
|
57
|
-
// || (current_ratio < ratios.target
|
58
|
-
// && ratios.target - current_ratio > new_ratio - ratios.target)
|
59
|
-
// }
|
60
|
-
// Ordering::Equal => current_ratio != ratios.target,
|
61
|
-
// };
|
62
|
-
// let ratio_fee = if new_ratio <= ratios.target {
|
63
|
-
// if ratios.target == ratios.min {
|
64
|
-
// Perpetuals::BPS_POWER
|
65
|
-
// } else {
|
66
|
-
// math::checked_add(
|
67
|
-
// Perpetuals::BPS_POWER,
|
68
|
-
// math::checked_div(
|
69
|
-
// math::checked_mul(
|
70
|
-
// custody.fees.ratio_mult as u128,
|
71
|
-
// math::checked_sub(ratios.target, new_ratio)? as u128,
|
72
|
-
// )?,
|
73
|
-
// math::checked_sub(ratios.target, ratios.min)? as u128,
|
74
|
-
// )?,
|
75
|
-
// )?
|
76
|
-
// }
|
77
|
-
// } else if ratios.target == ratios.max {
|
78
|
-
// Perpetuals::BPS_POWER
|
79
|
-
// } else {
|
80
|
-
// math::checked_add(
|
81
|
-
// Perpetuals::BPS_POWER,
|
82
|
-
// math::checked_div(
|
83
|
-
// math::checked_mul(
|
84
|
-
// custody.fees.ratio_mult as u128,
|
85
|
-
// math::checked_sub(new_ratio, ratios.target)? as u128,
|
86
|
-
// )?,
|
87
|
-
// math::checked_sub(ratios.max, ratios.target)? as u128,
|
88
|
-
// )?,
|
89
|
-
// )?
|
90
|
-
// };
|
91
|
-
// let fee = if improved {
|
92
|
-
// math::checked_div(
|
93
|
-
// math::checked_mul(base_fee as u128, Perpetuals::BPS_POWER)?,
|
94
|
-
// ratio_fee,
|
95
|
-
// )?
|
96
|
-
// } else {
|
97
|
-
// math::checked_div(
|
98
|
-
// math::checked_mul(base_fee as u128, ratio_fee)?,
|
99
|
-
// Perpetuals::BPS_POWER,
|
100
|
-
// )?
|
101
|
-
// };
|
102
|
-
// Self::get_fee_amount(
|
103
|
-
// math::checked_as_u64(fee)?,
|
104
|
-
// std::cmp::max(amount_add, amount_remove),
|
105
|
-
// )
|
106
48
|
return new anchor_1.BN(0);
|
107
49
|
};
|
108
50
|
PoolAccount.prototype.getFeeAmount = function (fee, amount) {
|
@@ -0,0 +1,39 @@
|
|
1
|
+
import { Address } from '@project-serum/anchor';
|
2
|
+
import { Cluster, PublicKey } from '@solana/web3.js';
|
3
|
+
export interface CustodyConfig {
|
4
|
+
custodyAccount: PublicKey;
|
5
|
+
tokenAccount: PublicKey;
|
6
|
+
symbol: string;
|
7
|
+
mintKey: PublicKey;
|
8
|
+
decimals: number;
|
9
|
+
isStable: boolean;
|
10
|
+
oracleAddress: PublicKey;
|
11
|
+
}
|
12
|
+
type Token = {
|
13
|
+
symbol: string;
|
14
|
+
mintKey: PublicKey;
|
15
|
+
decimals: number;
|
16
|
+
isStable: boolean;
|
17
|
+
pythTicker: string;
|
18
|
+
};
|
19
|
+
export declare class PoolConfig {
|
20
|
+
programId: PublicKey;
|
21
|
+
cluster: Cluster;
|
22
|
+
poolName: string;
|
23
|
+
poolAddress: PublicKey;
|
24
|
+
lpTokenMint: PublicKey;
|
25
|
+
lpDecimals: number;
|
26
|
+
perpetuals: PublicKey;
|
27
|
+
tokens: Token[];
|
28
|
+
custodies: CustodyConfig[];
|
29
|
+
constructor(programId: PublicKey, cluster: Cluster, poolName: string, poolAddress: PublicKey, lpTokenMint: PublicKey, lpDecimals: number, perpetuals: PublicKey, tokens: Token[], custodies: CustodyConfig[]);
|
30
|
+
getAllTokenMints(): PublicKey[];
|
31
|
+
getNonStableTokens(): PublicKey[];
|
32
|
+
getAllCustodies(): PublicKey[];
|
33
|
+
getNonStableCustodies(): PublicKey[];
|
34
|
+
static getCustodyConfig(custodyAccountPk: Address, poolName: string, cluster: Cluster): CustodyConfig;
|
35
|
+
static getTokensInPool(name: string, cluster: Cluster): Token[];
|
36
|
+
static fromIdsByName(name: string, cluster: Cluster): PoolConfig;
|
37
|
+
static fromIdsByPk(poolPk: PublicKey, cluster: Cluster): PoolConfig;
|
38
|
+
}
|
39
|
+
export {};
|
@@ -0,0 +1,93 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
3
|
+
__assign = Object.assign || function(t) {
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
5
|
+
s = arguments[i];
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
7
|
+
t[p] = s[p];
|
8
|
+
}
|
9
|
+
return t;
|
10
|
+
};
|
11
|
+
return __assign.apply(this, arguments);
|
12
|
+
};
|
13
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
14
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
15
|
+
};
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
+
exports.PoolConfig = void 0;
|
18
|
+
var web3_js_1 = require("@solana/web3.js");
|
19
|
+
var PoolConfig_json_1 = __importDefault(require("./PoolConfig.json"));
|
20
|
+
var PoolConfig = /** @class */ (function () {
|
21
|
+
function PoolConfig(programId, cluster, poolName, poolAddress, lpTokenMint, lpDecimals, perpetuals,
|
22
|
+
// public perpMarketAccountKey: string,
|
23
|
+
// public multisigAccountKey: string,
|
24
|
+
// public transferAuthorityAccountKey: string,
|
25
|
+
tokens, custodies) {
|
26
|
+
this.programId = programId;
|
27
|
+
this.cluster = cluster;
|
28
|
+
this.poolName = poolName;
|
29
|
+
this.poolAddress = poolAddress;
|
30
|
+
this.lpTokenMint = lpTokenMint;
|
31
|
+
this.lpDecimals = lpDecimals;
|
32
|
+
this.perpetuals = perpetuals;
|
33
|
+
this.tokens = tokens;
|
34
|
+
this.custodies = custodies;
|
35
|
+
}
|
36
|
+
PoolConfig.prototype.getAllTokenMints = function () {
|
37
|
+
return Array.from(this.tokens.map(function (token) { return new web3_js_1.PublicKey(token.mintKey); }));
|
38
|
+
};
|
39
|
+
PoolConfig.prototype.getNonStableTokens = function () {
|
40
|
+
return Array.from(this.tokens
|
41
|
+
.filter(function (token) { return !token.isStable; })
|
42
|
+
.map(function (token) { return new web3_js_1.PublicKey(token.mintKey); }));
|
43
|
+
};
|
44
|
+
PoolConfig.prototype.getAllCustodies = function () {
|
45
|
+
return Array.from(this.custodies.map(function (custody) { return new web3_js_1.PublicKey(custody.custodyAccount); }));
|
46
|
+
};
|
47
|
+
PoolConfig.prototype.getNonStableCustodies = function () {
|
48
|
+
return Array.from(this.custodies
|
49
|
+
.filter(function (custody) { return !custody.isStable; })
|
50
|
+
.map(function (custody) { return new web3_js_1.PublicKey(custody.custodyAccount); }));
|
51
|
+
};
|
52
|
+
// static getAllPoolConfigs(cluster: Cluster): PoolConfig[] {
|
53
|
+
// return poolConfigs.pools.map(p => this.fromIdsByName(p.poolName, cluster))
|
54
|
+
// }
|
55
|
+
PoolConfig.getCustodyConfig = function (custodyAccountPk, poolName, cluster) {
|
56
|
+
return this.fromIdsByName(poolName, cluster).custodies.find(function (f) { return f.custodyAccount.toBase58() === custodyAccountPk.toString(); });
|
57
|
+
};
|
58
|
+
PoolConfig.getTokensInPool = function (name, cluster) {
|
59
|
+
var poolConfig = PoolConfig_json_1.default.pools.find(function (pool) { return pool['poolName'] === name && cluster === pool['cluster']; });
|
60
|
+
if (!poolConfig)
|
61
|
+
throw new Error("No pool config ".concat(name, " found in Ids!"));
|
62
|
+
var tokens = poolConfig['tokens'].map(function (i) {
|
63
|
+
return __assign(__assign({}, i), { mintKey: new web3_js_1.PublicKey(i.mintKey) });
|
64
|
+
});
|
65
|
+
return tokens;
|
66
|
+
};
|
67
|
+
PoolConfig.fromIdsByName = function (name, cluster) {
|
68
|
+
var poolConfig = PoolConfig_json_1.default.pools.find(function (pool) { return pool['poolName'] === name && cluster === pool['cluster']; });
|
69
|
+
if (!poolConfig)
|
70
|
+
throw new Error("No pool config ".concat(name, " found in Ids!"));
|
71
|
+
var tokens = poolConfig['tokens'].map(function (i) {
|
72
|
+
return __assign(__assign({}, i), { mintKey: new web3_js_1.PublicKey(i.mintKey) });
|
73
|
+
});
|
74
|
+
var custodies = poolConfig['custodies'].map(function (i) {
|
75
|
+
return __assign(__assign({}, i), { custodyAccount: new web3_js_1.PublicKey(i.custodyAccount), tokenAccount: new web3_js_1.PublicKey(i.tokenAccount), mintKey: new web3_js_1.PublicKey(i.mintKey), oracleAddress: new web3_js_1.PublicKey(i.oracleAddress) });
|
76
|
+
});
|
77
|
+
return new PoolConfig(new web3_js_1.PublicKey(poolConfig.programId), poolConfig.cluster, poolConfig.poolName, new web3_js_1.PublicKey(poolConfig.poolAddress), new web3_js_1.PublicKey(poolConfig.lpTokenMint), poolConfig.lpDecimals, new web3_js_1.PublicKey(poolConfig.perpetuals), tokens, custodies);
|
78
|
+
};
|
79
|
+
PoolConfig.fromIdsByPk = function (poolPk, cluster) {
|
80
|
+
var poolConfig = PoolConfig_json_1.default.pools.find(function (pool) { return pool['poolAddress'] === poolPk.toString() && cluster === pool['cluster']; });
|
81
|
+
if (!poolConfig)
|
82
|
+
throw new Error("No pool config ".concat(poolPk.toString(), " found in Ids!"));
|
83
|
+
var tokens = poolConfig['tokens'].map(function (i) {
|
84
|
+
return __assign(__assign({}, i), { mintKey: new web3_js_1.PublicKey(i.mintKey) });
|
85
|
+
});
|
86
|
+
var custodies = poolConfig['custodies'].map(function (i) {
|
87
|
+
return __assign(__assign({}, i), { custodyAccount: new web3_js_1.PublicKey(i.custodyAccount), tokenAccount: new web3_js_1.PublicKey(i.tokenAccount), mintKey: new web3_js_1.PublicKey(i.mintKey), oracleAddress: new web3_js_1.PublicKey(i.oracleAddress) });
|
88
|
+
});
|
89
|
+
return new PoolConfig(new web3_js_1.PublicKey(poolConfig.programId), poolConfig.cluster, poolConfig.poolName, new web3_js_1.PublicKey(poolConfig.poolAddress), new web3_js_1.PublicKey(poolConfig.lpTokenMint), poolConfig.lpDecimals, new web3_js_1.PublicKey(poolConfig.perpetuals), tokens, custodies);
|
90
|
+
};
|
91
|
+
return PoolConfig;
|
92
|
+
}());
|
93
|
+
exports.PoolConfig = PoolConfig;
|
@@ -0,0 +1,305 @@
|
|
1
|
+
{
|
2
|
+
"cluster_urls": {
|
3
|
+
"devnet": "https://api.devnet.solana.com",
|
4
|
+
"localnet": "http://127.0.0.1:8899",
|
5
|
+
"mainnet": "https://api.mainnet-beta.solana.com",
|
6
|
+
"testnet": "http://api.testnet.rpcpool.com"
|
7
|
+
},
|
8
|
+
"pools": [
|
9
|
+
{
|
10
|
+
"programId": "BPkaJkzjqZ3u3sMnK7oHup5GGV5EHp4hYthz9Yodvydj",
|
11
|
+
"cluster": "devnet",
|
12
|
+
"poolName": "pool1",
|
13
|
+
"poolAddress": "Goy1R4LyBbvrmzqdCAs5M8KUb3baMxFnZP3bYoEtLEjA",
|
14
|
+
"lpTokenMint": "8nw7Qg7t6wAvfLpQhUxyWhXUbdQ9QSMcLJsV1e5Ggom1",
|
15
|
+
"lpDecimals": 6,
|
16
|
+
"perpetuals": "GZTJamEMs5fhCh6y4fRskTA9n8UsXSAWpQNd2sesevLX",
|
17
|
+
"transferAuthority": "FidHtZMaZXzUBcfqTt9jHffNoydHP4RGiaVwwoE15mMu",
|
18
|
+
"multisig": "4cMawSeiiJe6JKxF4Qzc3NQ1ZAJ37gVdsd6LF27gZBv9",
|
19
|
+
"tokens": [
|
20
|
+
{
|
21
|
+
"symbol": "USDC",
|
22
|
+
"mintKey": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr",
|
23
|
+
"decimals": 6,
|
24
|
+
"isStable": true,
|
25
|
+
"pythTicker": "Crypto.USDC/USD"
|
26
|
+
},
|
27
|
+
{
|
28
|
+
"symbol": "SOL",
|
29
|
+
"mintKey": "So11111111111111111111111111111111111111112",
|
30
|
+
"decimals": 9,
|
31
|
+
"isStable": false,
|
32
|
+
"pythTicker": "Crypto.SOL/USD"
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"symbol": "BTC",
|
36
|
+
"mintKey": "B8DYqbh57aEPRbUq7reyueY6jaYoN75js5YsiM84tFfP",
|
37
|
+
"decimals": 6,
|
38
|
+
"isStable": false,
|
39
|
+
"pythTicker": "Crypto.BTC/USD"
|
40
|
+
},
|
41
|
+
{
|
42
|
+
"symbol": "ETH",
|
43
|
+
"mintKey": "BA17bkYW78GvnirtgRHcceQxZdwkhpzbvrwDU6voUXRz",
|
44
|
+
"decimals": 6,
|
45
|
+
"isStable": false,
|
46
|
+
"pythTicker": "Crypto.ETH/USD"
|
47
|
+
}
|
48
|
+
],
|
49
|
+
"custodies": [
|
50
|
+
{
|
51
|
+
"custodyAccount": "CkYddgaB8c5tvs9WP11B83HvMaU35ZFpTzLLGg4NviEj",
|
52
|
+
"tokenAccount": "DHy9BXo36hwKkvBJnPd11zH77BefA77mTiL7yu2LNWPx",
|
53
|
+
"symbol": "USDC",
|
54
|
+
"mintKey": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr",
|
55
|
+
"decimals": 6,
|
56
|
+
"isStable": true,
|
57
|
+
"oracleAddress": "5SSkXsEKQepHHAewytPVwdej4epN1nxgLVM84L4KXgy7"
|
58
|
+
},
|
59
|
+
{
|
60
|
+
"custodyAccount": "4ueMZBmpTMPykYwTENJs7diYfgx6UBCPQnRwb2F5UFgw",
|
61
|
+
"tokenAccount": "G9bJQdZkzXZsiwouZ8MsZw6p8Pg5vtM9hbVHjfqSrJZo",
|
62
|
+
"symbol": "SOL",
|
63
|
+
"mintKey": "So11111111111111111111111111111111111111112",
|
64
|
+
"decimals": 9,
|
65
|
+
"isStable": false,
|
66
|
+
"oracleAddress": "J83w4HKfqxwcq3BEMMkPFSppX3gqekLyLJBexebFVkix"
|
67
|
+
},
|
68
|
+
{
|
69
|
+
"custodyAccount": "F9qzX5pHGS5SFfP5M24a8dqXUHQdraexJ3P9TNGF2WFj",
|
70
|
+
"tokenAccount": "y5vPUaQdM3fJkEyn3oA8uFMRzwJYcNJsjBZyW1yRUar",
|
71
|
+
"symbol": "BTC",
|
72
|
+
"mintKey": "B8DYqbh57aEPRbUq7reyueY6jaYoN75js5YsiM84tFfP",
|
73
|
+
"decimals": 6,
|
74
|
+
"isStable": false,
|
75
|
+
"oracleAddress": "HovQMDrbAgAYPCmHVSrezcSmkMtXSSUsLDFANExrZh2J"
|
76
|
+
},
|
77
|
+
{
|
78
|
+
"custodyAccount": "BZggMsfpcpbB3tnhmtM2qJ1uMobKVBEmYZp2jmDrBHZD",
|
79
|
+
"tokenAccount": "HP4CcezCpCZqcoo8BsrroFEaykz2F4bz6sWBCCUJEBPy",
|
80
|
+
"symbol": "ETH",
|
81
|
+
"mintKey": "BA17bkYW78GvnirtgRHcceQxZdwkhpzbvrwDU6voUXRz",
|
82
|
+
"decimals": 6,
|
83
|
+
"isStable": false,
|
84
|
+
"oracleAddress": "EdVCmQ9FSPcVe5YySXDPCRmc8aDQLKJ9xvYBMZPie1Vw"
|
85
|
+
}
|
86
|
+
]
|
87
|
+
},
|
88
|
+
{
|
89
|
+
"programId": "f1avUCGxFGLbUTA8L64rMpRKw5KH6LxkTjGEzhWhAEo",
|
90
|
+
"cluster": "devnet",
|
91
|
+
"poolName": "F1aPool3",
|
92
|
+
"poolAddress": "EjrNsViX2JYLjcHhCjMUdn77SVMAps69N3gNyKTpTLfh",
|
93
|
+
"lpTokenMint": "CPUj8x9PVyLi1CuEY5CdxBgwZsq9wZkeMdgknBnbNpHq",
|
94
|
+
"lpDecimals": 6,
|
95
|
+
"perpetuals": "GKXKKi5bj9P2LsCBqFSKwhKfRM7MJrA4qyEMGXzNQcTz",
|
96
|
+
"transferAuthority": "xeizPZDpXPDfu939cxNS27AoAkgw7fJKY4gxbK8khFA",
|
97
|
+
"multisig": "84zJ1bS8w2Fn555qC7BkS8eNDMHpTKN48ZSyaSMSyjdT",
|
98
|
+
"tokens": [
|
99
|
+
{
|
100
|
+
"symbol": "USDC",
|
101
|
+
"mintKey": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr",
|
102
|
+
"decimals": 6,
|
103
|
+
"isStable": true,
|
104
|
+
"pythTicker": "Crypto.USDC/USD"
|
105
|
+
},
|
106
|
+
{
|
107
|
+
"symbol": "SOL",
|
108
|
+
"mintKey": "So11111111111111111111111111111111111111112",
|
109
|
+
"decimals": 9,
|
110
|
+
"isStable": false,
|
111
|
+
"pythTicker": "Crypto.SOL/USD"
|
112
|
+
},
|
113
|
+
{
|
114
|
+
"symbol": "BTC",
|
115
|
+
"mintKey": "B8DYqbh57aEPRbUq7reyueY6jaYoN75js5YsiM84tFfP",
|
116
|
+
"decimals": 6,
|
117
|
+
"isStable": false,
|
118
|
+
"pythTicker": "Crypto.BTC/USD"
|
119
|
+
},
|
120
|
+
{
|
121
|
+
"symbol": "ETH",
|
122
|
+
"mintKey": "BA17bkYW78GvnirtgRHcceQxZdwkhpzbvrwDU6voUXRz",
|
123
|
+
"decimals": 6,
|
124
|
+
"isStable": false,
|
125
|
+
"pythTicker": "Crypto.ETH/USD"
|
126
|
+
}
|
127
|
+
],
|
128
|
+
"custodies": [
|
129
|
+
{
|
130
|
+
"custodyAccount": "5n8Ga254uA4fy2UdCWwjHUvrRHGc3WwmmNsvjpbQYgwE",
|
131
|
+
"tokenAccount": "Ga1xofAe2EP3T2KTwL7KPEri9JGTwMTBwgrNmnchrGAg",
|
132
|
+
"symbol": "USDC",
|
133
|
+
"mintKey": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr",
|
134
|
+
"decimals": 6,
|
135
|
+
"isStable": true,
|
136
|
+
"oracleAddress": "5SSkXsEKQepHHAewytPVwdej4epN1nxgLVM84L4KXgy7"
|
137
|
+
},
|
138
|
+
{
|
139
|
+
"custodyAccount": "8NpLh7UknY7p43432ETcWZQYp8QK81tesxNqisDmnMNU",
|
140
|
+
"tokenAccount": "FDMmwmeQrZ6xWTdxXA2MZhZ9uggLgvwfKaW366WH2UAM",
|
141
|
+
"symbol": "SOL",
|
142
|
+
"mintKey": "So11111111111111111111111111111111111111112",
|
143
|
+
"decimals": 9,
|
144
|
+
"isStable": false,
|
145
|
+
"oracleAddress": "J83w4HKfqxwcq3BEMMkPFSppX3gqekLyLJBexebFVkix"
|
146
|
+
},
|
147
|
+
{
|
148
|
+
"custodyAccount": "BUkVeJxhkQMGJbibjTJUCG8afdudSpm5j2GpnyYrawQA",
|
149
|
+
"tokenAccount": "CrCSQpkug4uQCWiqET9AL4sXeBudy7t4RPZ5UPV1xti6",
|
150
|
+
"symbol": "BTC",
|
151
|
+
"mintKey": "B8DYqbh57aEPRbUq7reyueY6jaYoN75js5YsiM84tFfP",
|
152
|
+
"decimals": 6,
|
153
|
+
"isStable": false,
|
154
|
+
"oracleAddress": "HovQMDrbAgAYPCmHVSrezcSmkMtXSSUsLDFANExrZh2J"
|
155
|
+
},
|
156
|
+
{
|
157
|
+
"custodyAccount": "Hq1JffLuvj8XjBuL552aCFJkgoNWyMLfvQ2wUaNSX8yC",
|
158
|
+
"tokenAccount": "D8kDJSWVuMm9oERTJGwUHwLg34TtigYgSbCBAQ5LGvDd",
|
159
|
+
"symbol": "ETH",
|
160
|
+
"mintKey": "BA17bkYW78GvnirtgRHcceQxZdwkhpzbvrwDU6voUXRz",
|
161
|
+
"decimals": 6,
|
162
|
+
"isStable": false,
|
163
|
+
"oracleAddress": "EdVCmQ9FSPcVe5YySXDPCRmc8aDQLKJ9xvYBMZPie1Vw"
|
164
|
+
}
|
165
|
+
]
|
166
|
+
},
|
167
|
+
{
|
168
|
+
"programId": "FastuHRd9PRiuKGy2dHgH4zcSRjARKnPcHiQZnxpR5fD",
|
169
|
+
"cluster": "devnet",
|
170
|
+
"poolName": "FlashPool1",
|
171
|
+
"poolAddress": "98Z59gXJHFFmwmNTR7r2WCkcSiYhp7UTN64YrW6JxVuX",
|
172
|
+
"lpTokenMint": "8Kd733EK6ARFbGZXYZbcVTuzLufTTrDWVGLqPwJQabr",
|
173
|
+
"lpDecimals": 6,
|
174
|
+
"perpetuals": "23APwx3K4h7b2FwVYPCc6QUhjxq1HnfiLF5gJGzjjBug",
|
175
|
+
"transferAuthority": "HgM32odRRY36KSmGjAdypSuN5e4QnRdGqQMXMz3Vk26L",
|
176
|
+
"multisig": "CHi41aTYPbZf3M4hyT18oiafKQLZZNw8e9VRyUAr2Hgz",
|
177
|
+
"tokens": [
|
178
|
+
{
|
179
|
+
"symbol": "USDC",
|
180
|
+
"mintKey": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr",
|
181
|
+
"decimals": 6,
|
182
|
+
"isStable": true,
|
183
|
+
"pythTicker": "Crypto.USDC/USD"
|
184
|
+
},
|
185
|
+
{
|
186
|
+
"symbol": "SOL",
|
187
|
+
"mintKey": "So11111111111111111111111111111111111111112",
|
188
|
+
"decimals": 9,
|
189
|
+
"isStable": false,
|
190
|
+
"pythTicker": "Crypto.SOL/USD"
|
191
|
+
}
|
192
|
+
],
|
193
|
+
"custodies": [
|
194
|
+
{
|
195
|
+
"custodyAccount": "5P4mY4AYuzbm5VbbQvHwBrbrWTdTKrtFSGWSi1n6jcnE",
|
196
|
+
"tokenAccount": "EU7vvLZqoKcqaNwge1jEB5psvM1Fs4UnbqAzs8bsfeKU",
|
197
|
+
"symbol": "SOL",
|
198
|
+
"mintKey": "So11111111111111111111111111111111111111112",
|
199
|
+
"decimals": 9,
|
200
|
+
"isStable": false,
|
201
|
+
"oracleAddress": "J83w4HKfqxwcq3BEMMkPFSppX3gqekLyLJBexebFVkix"
|
202
|
+
},
|
203
|
+
{
|
204
|
+
"custodyAccount": "2oYSArUnXE2L9a9NTYPmgKCjwdTpcrXxMaoQDQfoo8sE",
|
205
|
+
"tokenAccount": "EUhfKyh2fuwgxJFr7abLscwsATn82M3rmuGGvfqxsDKc",
|
206
|
+
"symbol": "USDC",
|
207
|
+
"mintKey": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr",
|
208
|
+
"decimals": 6,
|
209
|
+
"isStable": true,
|
210
|
+
"oracleAddress": "5SSkXsEKQepHHAewytPVwdej4epN1nxgLVM84L4KXgy7"
|
211
|
+
}
|
212
|
+
]
|
213
|
+
},
|
214
|
+
{
|
215
|
+
"programId": "PERP9EeXeGnyEqGmxGSan4nGRAFNLwTufLJmiYsTJ8j",
|
216
|
+
"cluster": "devnet",
|
217
|
+
"poolName": "TestPool1",
|
218
|
+
"poolAddress": "GSa3BkjXpoUdd1Bw1EiuMLRY3jFZBwQJJivPNWgSiGJ3",
|
219
|
+
"lpTokenMint": "Han23mxQeHeoBbj4vYtYZNaB5bhwV3n4nxKezM6H6nbr",
|
220
|
+
"lpDecimals": 6,
|
221
|
+
"perpetuals": "5CpxhcrfvH8s9QDT2nMaPWqPoMwpuiPuP8e8x4YN61A2",
|
222
|
+
"tokens": [
|
223
|
+
{
|
224
|
+
"symbol": "USDC",
|
225
|
+
"mintKey": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr",
|
226
|
+
"decimals": 6,
|
227
|
+
"isStable": true,
|
228
|
+
"pythTicker": "Crypto.USDC/USD"
|
229
|
+
},
|
230
|
+
{
|
231
|
+
"symbol": "SOL",
|
232
|
+
"mintKey": "So11111111111111111111111111111111111111112",
|
233
|
+
"decimals": 9,
|
234
|
+
"isStable": false,
|
235
|
+
"pythTicker": "Crypto.SOL/USD"
|
236
|
+
}
|
237
|
+
],
|
238
|
+
"custodies": [
|
239
|
+
{
|
240
|
+
"custodyAccount": "GBrsFAWty2G2WfsP8XWmzDTrBj8Dafx8ZXpXHD1Th6Y9",
|
241
|
+
"tokenAccount": "EYYCHS8eGZYo7yWSwqL3dd2uY3Um5E8vLXjr6EE4zcQv",
|
242
|
+
"symbol": "SOL",
|
243
|
+
"mintKey": "So11111111111111111111111111111111111111112",
|
244
|
+
"decimals": 9,
|
245
|
+
"isStable": false,
|
246
|
+
"oracleAddress": "J83w4HKfqxwcq3BEMMkPFSppX3gqekLyLJBexebFVkix"
|
247
|
+
},
|
248
|
+
{
|
249
|
+
"custodyAccount": "BCuesBYYCUzfAHoLc1BeJo1Lq71Kacb2hMKJAi5FW9Be",
|
250
|
+
"tokenAccount": "BE9ih3oiCSNpMPhdJHzkQs73UUE6tHrdV7nRi3QkfHpi",
|
251
|
+
"symbol": "USDC",
|
252
|
+
"mintKey": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr",
|
253
|
+
"decimals": 6,
|
254
|
+
"isStable": true,
|
255
|
+
"oracleAddress": "5SSkXsEKQepHHAewytPVwdej4epN1nxgLVM84L4KXgy7"
|
256
|
+
}
|
257
|
+
]
|
258
|
+
},
|
259
|
+
{
|
260
|
+
"programId": "PERP9EeXeGnyEqGmxGSan4nGRAFNLwTufLJmiYsTJ8j",
|
261
|
+
"cluster": "devnet",
|
262
|
+
"poolName": "internal_test",
|
263
|
+
"poolAddress": "DXdPxx7mS1EtCPcEm2uoLioYdXoE2HoVrHaR4o8Kg2uh",
|
264
|
+
"lpTokenMint": "J1887XKSeZFRzD6ACyiWMurXZd8xtNyb1Edj2oAxKT9E",
|
265
|
+
"lpDecimals": 6,
|
266
|
+
"perpetuals": "5CpxhcrfvH8s9QDT2nMaPWqPoMwpuiPuP8e8x4YN61A2",
|
267
|
+
"tokens": [
|
268
|
+
{
|
269
|
+
"symbol": "Test",
|
270
|
+
"mintKey": "6QGdQbaZEgpXqqbGwXJZXwbZ9xJnthfyYNZ92ARzTdAX",
|
271
|
+
"decimals": 9,
|
272
|
+
"isStable": true,
|
273
|
+
"pythTicker": "Crypto.USDC/USD"
|
274
|
+
},
|
275
|
+
{
|
276
|
+
"symbol": "SOL",
|
277
|
+
"mintKey": "So11111111111111111111111111111111111111112",
|
278
|
+
"decimals": 9,
|
279
|
+
"isStable": false,
|
280
|
+
"pythTicker": "Crypto.SOL/USD"
|
281
|
+
}
|
282
|
+
],
|
283
|
+
"custodies": [
|
284
|
+
{
|
285
|
+
"custodyAccount": "5Yk9k7Gpyip9ySqYoXgRANVfPbmJdqhXBemancsV5QLJ",
|
286
|
+
"tokenAccount": "DmEf6bvLt9eTkRWGUhpmwhJjf7dZL31ziGqNqALYctvH",
|
287
|
+
"symbol": "SOL",
|
288
|
+
"mintKey": "So11111111111111111111111111111111111111112",
|
289
|
+
"decimals": 9,
|
290
|
+
"isStable": false,
|
291
|
+
"oracleAddress": "J83w4HKfqxwcq3BEMMkPFSppX3gqekLyLJBexebFVkix"
|
292
|
+
},
|
293
|
+
{
|
294
|
+
"custodyAccount": "AZCvUZ1qmbvnqebiYrExLoZtqyCgS33LN4XobAwwizR8",
|
295
|
+
"tokenAccount": "EuTHwLfV5pjtWE3sJTbjTgFb4BdLCwo6FZFAc8YdgxeM",
|
296
|
+
"symbol": "Test",
|
297
|
+
"mintKey": "6QGdQbaZEgpXqqbGwXJZXwbZ9xJnthfyYNZ92ARzTdAX",
|
298
|
+
"decimals": 9,
|
299
|
+
"isStable": true,
|
300
|
+
"oracleAddress": "HovQMDrbAgAYPCmHVSrezcSmkMtXSSUsLDFANExrZh2J"
|
301
|
+
}
|
302
|
+
]
|
303
|
+
}
|
304
|
+
]
|
305
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/// <reference types="bn.js" />
|
2
|
+
import { BN } from "@coral-xyz/anchor";
|
3
|
+
import { Mint } from "@solana/spl-token";
|
4
|
+
import { Pool } from "./types";
|
5
|
+
import { CustodyAccount } from "./CustodyAccount";
|
6
|
+
import { PoolConfig } from "./PoolConfig";
|
7
|
+
export declare class PoolDisplayData {
|
8
|
+
poolConfig: PoolConfig;
|
9
|
+
poolData: Pool;
|
10
|
+
lpTokenInfo: Mint;
|
11
|
+
custodies: CustodyAccount[];
|
12
|
+
totalPoolValueUsd: BN;
|
13
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.PoolDisplayData = void 0;
|
4
|
+
var PoolDisplayData = /** @class */ (function () {
|
5
|
+
function PoolDisplayData() {
|
6
|
+
}
|
7
|
+
return PoolDisplayData;
|
8
|
+
}()); // Pool
|
9
|
+
exports.PoolDisplayData = PoolDisplayData;
|
package/lib/constants/index.d.ts
CHANGED
@@ -1,4 +1,7 @@
|
|
1
1
|
/// <reference types="bn.js" />
|
2
|
+
import { Cluster } from "@solana/web3.js";
|
3
|
+
export declare const DEFAULT_CLUSTER: Cluster;
|
4
|
+
export declare const DEFAULT_POOL: string;
|
2
5
|
export declare const PERCENTAGE_DECIMALS = 4;
|
3
6
|
export declare const PRICE_DECIMALS = 6;
|
4
7
|
export declare const USD_DECIMALS = 6;
|
package/lib/constants/index.js
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.BN_ONE = exports.BN_ZERO = exports.RATE_POWER = exports.RATE_DECIMALS = exports.LP_DECIMALS = exports.BPS_POWER = exports.BPS_DECIMALS = exports.USD_DECIMALS = exports.PRICE_DECIMALS = exports.PERCENTAGE_DECIMALS = void 0;
|
3
|
+
exports.BN_ONE = exports.BN_ZERO = exports.RATE_POWER = exports.RATE_DECIMALS = exports.LP_DECIMALS = exports.BPS_POWER = exports.BPS_DECIMALS = exports.USD_DECIMALS = exports.PRICE_DECIMALS = exports.PERCENTAGE_DECIMALS = exports.DEFAULT_POOL = exports.DEFAULT_CLUSTER = void 0;
|
4
4
|
var bn_js_1 = require("bn.js");
|
5
|
+
exports.DEFAULT_CLUSTER = 'devnet';
|
6
|
+
exports.DEFAULT_POOL = 'pool1';
|
5
7
|
exports.PERCENTAGE_DECIMALS = 4; // stableCoinPercentage
|
6
8
|
exports.PRICE_DECIMALS = 6; //
|
7
9
|
exports.USD_DECIMALS = 6; //
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
@@ -22,3 +22,5 @@ __exportStar(require("./constants"), exports);
|
|
22
22
|
__exportStar(require("./types"), exports);
|
23
23
|
__exportStar(require("./utils"), exports);
|
24
24
|
__exportStar(require("./PerpetualsClient"), exports);
|
25
|
+
__exportStar(require("./PoolConfig"), exports);
|
26
|
+
// export { default as PoolConfigJson } from "./PoolConfig.json";
|