flash-sdk 1.0.133 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/CustodyAccount.d.ts +6 -8
- package/dist/CustodyAccount.js +0 -21
- package/dist/MarketAccount.d.ts +23 -0
- package/dist/MarketAccount.js +42 -0
- package/dist/OraclePrice.d.ts +2 -0
- package/dist/OraclePrice.js +12 -4
- package/dist/PerpetualsClient.d.ts +1500 -976
- package/dist/PerpetualsClient.js +1410 -825
- package/dist/PoolAccount.d.ts +13 -3
- package/dist/PoolConfig.d.ts +26 -1
- package/dist/PoolConfig.js +62 -18
- package/dist/PoolConfig.json +190 -203
- package/dist/PoolDataClient.d.ts +2 -9
- package/dist/PoolDataClient.js +1 -43
- package/dist/PositionAccount.d.ts +14 -12
- package/dist/TradingAccount.d.ts +20 -0
- package/dist/TradingAccount.js +17 -0
- package/dist/backupOracle.js +16 -3
- package/dist/constants/index.d.ts +2 -2
- package/dist/constants/index.js +3 -2
- package/dist/idl/perp_composability.d.ts +132 -86
- package/dist/idl/perp_composability.js +132 -86
- package/dist/idl/perpetuals.d.ts +2276 -1102
- package/dist/idl/perpetuals.js +2250 -1076
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/index.d.ts +24 -2
- package/dist/types/index.js +23 -12
- package/dist/utils/getNftAccounts.d.ts +7 -0
- package/dist/utils/getNftAccounts.js +28 -0
- package/package.json +1 -1
package/dist/PoolConfig.json
CHANGED
@@ -7,116 +7,21 @@
|
|
7
7
|
},
|
8
8
|
"pools": [
|
9
9
|
{
|
10
|
-
"programId": "
|
10
|
+
"programId": "FTN6rgbaaxwT8mpRuC55EFTwpHB3BwnHJ91Lqv4ZVCfW",
|
11
|
+
"perpComposibilityProgramId": "SWAP4AE4N1if9qKD7dgfQgmRBRv1CtWG8xDs4HP14ST",
|
11
12
|
"cluster": "devnet",
|
12
|
-
"poolName": "devnet.
|
13
|
-
"poolAddress": "
|
14
|
-
"lpTokenMint": "
|
13
|
+
"poolName": "devnet.1",
|
14
|
+
"poolAddress": "7jA4ZSGwaBxXk5EmPKDCSc5RtZNHxyoxy22iQt3D2mH9",
|
15
|
+
"lpTokenMint": "H4h7nsZaz53KZHMdSXc5byBjcbymEFYX6an8UVbh51yU",
|
16
|
+
"metadataAccount": "7NvA4CEqr9Tei1MDDKrbYFKV5D39fkPPEfRv5Z5ZXZEb",
|
15
17
|
"lpDecimals": 6,
|
16
|
-
"lpTokenSymbol": "FLP.
|
17
|
-
"perpetuals": "
|
18
|
-
"transferAuthority": "
|
19
|
-
"multisig": "
|
20
|
-
"addressLookupTableAddresses": ["
|
21
|
-
"backupOracle": "AHaKsRB4tsGSzFfFqAxUpfRRmsUj5EhwHSxSXK2UGRp5",
|
22
|
-
"tokens": [
|
23
|
-
{
|
24
|
-
"symbol": "USDC",
|
25
|
-
"mintKey": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr",
|
26
|
-
"decimals": 6,
|
27
|
-
"isStable": true,
|
28
|
-
"isVirtual": false,
|
29
|
-
"pythTicker": "Crypto.USDC/USD",
|
30
|
-
"pythPriceId": "0xeaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a"
|
31
|
-
},
|
32
|
-
{
|
33
|
-
"symbol": "XAU",
|
34
|
-
"mintKey": "xaucSYSxjZF4EbsLqAGRvPcuD1uXAj9awmsxYkUAavx",
|
35
|
-
"decimals": 6,
|
36
|
-
"isStable": false,
|
37
|
-
"isVirtual": true,
|
38
|
-
"pythTicker": "Metal.XAU/USD",
|
39
|
-
"pythPriceId": "0x765d2ba906dbc32ca17cc11f5310a89e9ee1f6420508c63861f2f8ba4ee34bb2"
|
40
|
-
},
|
41
|
-
{
|
42
|
-
"symbol": "COIN",
|
43
|
-
"mintKey": "coin5CDSu7E6t89hYjt22jinQTue2sXQUw4c54XKpxq",
|
44
|
-
"decimals": 6,
|
45
|
-
"isStable": false,
|
46
|
-
"isVirtual": true,
|
47
|
-
"pythTicker": "Equity.US.COIN/USD",
|
48
|
-
"pythPriceId": "0xfee33f2a978bf32dd6b662b65ba8083c6773b494f8401194ec1870c640860245"
|
49
|
-
},
|
50
|
-
{
|
51
|
-
"symbol": "EUR",
|
52
|
-
"mintKey": "eurExbEMAz5jq8r31EGc3gg9ddu7ftBJWg8A6hYsvng",
|
53
|
-
"decimals": 6,
|
54
|
-
"isStable": false,
|
55
|
-
"isVirtual": true,
|
56
|
-
"pythTicker": "FX.EUR/USD",
|
57
|
-
"pythPriceId": "0xa995d00bb36a63cef7fd2c287dc105fc8f3d93779f062f09551b0af3e81ec30b"
|
58
|
-
}
|
59
|
-
],
|
60
|
-
"custodies": [
|
61
|
-
{
|
62
|
-
"custodyId": 0,
|
63
|
-
"custodyAccount": "2NtToAmany39eyukB2uy88u8sgHC59964tR4Fpsp4NMv",
|
64
|
-
"tokenAccount": "4rvXQgs5n5kaEK9no9N5WV7NU7fMrAkyqGUvbN6v3VYB",
|
65
|
-
"symbol": "USDC",
|
66
|
-
"mintKey": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr",
|
67
|
-
"decimals": 6,
|
68
|
-
"isStable": true,
|
69
|
-
"isVirtual": false,
|
70
|
-
"oracleAddress": "5SSkXsEKQepHHAewytPVwdej4epN1nxgLVM84L4KXgy7"
|
71
|
-
},
|
72
|
-
{
|
73
|
-
"custodyId": 1,
|
74
|
-
"custodyAccount": "gMEhcsS6vjEd8dR9gQ18QPCZbtvF4K4tmDFDmwzHX3g",
|
75
|
-
"tokenAccount": "HqatH1tTT49AmfK1BwrJJohXeFVefcTSCP7jV2UF9H68",
|
76
|
-
"symbol": "XAU",
|
77
|
-
"mintKey": "xaucSYSxjZF4EbsLqAGRvPcuD1uXAj9awmsxYkUAavx",
|
78
|
-
"decimals": 6,
|
79
|
-
"isStable": false,
|
80
|
-
"isVirtual": true,
|
81
|
-
"oracleAddress": "4GqTjGm686yihQ1m1YdTsSvfm4mNfadv6xskzgCYWNC5"
|
82
|
-
},
|
83
|
-
{
|
84
|
-
"custodyId": 2,
|
85
|
-
"custodyAccount": "6xKwkSLL6yfCSK247gKGZTEci1ibjA3FW47XWnqrkSDN",
|
86
|
-
"tokenAccount": "Ek8XvjnpA2c2wvdTxQzB1fSpDXgZab9v2CyGnMuE9qSD",
|
87
|
-
"symbol": "COIN",
|
88
|
-
"mintKey": "coin5CDSu7E6t89hYjt22jinQTue2sXQUw4c54XKpxq",
|
89
|
-
"decimals": 6,
|
90
|
-
"isStable": false,
|
91
|
-
"isVirtual": true,
|
92
|
-
"oracleAddress": "BwkRMkWjfMvWeFLqfQzwhumQan4CxNtyQRbKxtkV4yzi"
|
93
|
-
},
|
94
|
-
{
|
95
|
-
"custodyId": 3,
|
96
|
-
"custodyAccount": "Cd2w3Eino1XqNpEBw4bzsm57BXwMpxgTiVdXVYA7ymZE",
|
97
|
-
"tokenAccount": "HRhHeY8zzEN4wD2ykwvfXtvY5rV1zQeLSbBj56UZyWrh",
|
98
|
-
"symbol": "EUR",
|
99
|
-
"mintKey": "eurExbEMAz5jq8r31EGc3gg9ddu7ftBJWg8A6hYsvng",
|
100
|
-
"decimals": 6,
|
101
|
-
"isStable": false,
|
102
|
-
"isVirtual": true,
|
103
|
-
"oracleAddress": "E36MyBbavhYKHVLWR79GiReNNnBDiHj6nWA7htbkNZbh"
|
104
|
-
}
|
105
|
-
]
|
106
|
-
},
|
107
|
-
{
|
108
|
-
"programId": "FT69jb9K5b6uUbvk2BczUoG5bUS9gDPNMRbSk4GRyqw9",
|
109
|
-
"cluster": "devnet",
|
110
|
-
"poolName": "devnet.5",
|
111
|
-
"poolAddress": "G4Pzz6ComzRJ7Tc2JvYWUzECedC8dmz9n2fZpj8hFWmK",
|
112
|
-
"lpTokenMint": "GmURGADRvNzCrV8BDVuG2qVn5JAUgiUuo8NqP7FPj2Yc",
|
113
|
-
"lpDecimals": 6,
|
114
|
-
"lpTokenSymbol": "FLP.5",
|
115
|
-
"perpetuals": "ArVyuoPszQtUJ55dLUbfSzgFEd51sGv6e9pa7mY28YSS",
|
116
|
-
"transferAuthority": "3SRkyahDfpKu7Z5pBpqqCh3BmNypdqTQTkPihwqJVHch",
|
117
|
-
"multisig": "H4qXpG1vtRC6k2FKQ1tCs2Ybu1JrFAAQhR3HpR17pNGk",
|
118
|
-
"addressLookupTableAddresses": ["73Tr8hBsgxQrugMQLsG5gSxBdHbnbhjh1VvgUgEz7MM3"],
|
18
|
+
"lpTokenSymbol": "FLP.1",
|
19
|
+
"perpetuals": "445GcRLAJ64DcxSRbvQTkbwXgWUyubAxzQUQ2wL73KLS",
|
20
|
+
"transferAuthority": "EPyHAAHUYnFATwd8CJ7owLnozFeS8pFsr3RNJD1eueYq",
|
21
|
+
"multisig": "Eu3cBFRo18AeN9BFb5ndzk2PEmBT7yWEhh3VkG21pyGo",
|
22
|
+
"addressLookupTableAddresses": ["Ejc8FEVsREUim6wb7Xwgf7nai3T3AWNCBWBM7pbWdbJa"],
|
119
23
|
"backupOracle": "AHaKsRB4tsGSzFfFqAxUpfRRmsUj5EhwHSxSXK2UGRp5",
|
24
|
+
"nftCollectionAddress": "3rkRzHdN7dXy5CQfX3Lz6UBBJ2F9n58VEpvDSmbaVHt9",
|
120
25
|
"tokens": [
|
121
26
|
{
|
122
27
|
"symbol": "USDC",
|
@@ -167,8 +72,8 @@
|
|
167
72
|
"custodies": [
|
168
73
|
{
|
169
74
|
"custodyId": 0,
|
170
|
-
"custodyAccount": "
|
171
|
-
"tokenAccount": "
|
75
|
+
"custodyAccount": "AqZSmo7tVgPrZ72kSpRugN8pTCBTHovw65qPikP15dmK",
|
76
|
+
"tokenAccount": "8q8f5sp7kwGktJzboffVcKhXanGcJJ9HbqFH1LU8B1Ux",
|
172
77
|
"symbol": "USDC",
|
173
78
|
"mintKey": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr",
|
174
79
|
"decimals": 6,
|
@@ -178,8 +83,8 @@
|
|
178
83
|
},
|
179
84
|
{
|
180
85
|
"custodyId": 1,
|
181
|
-
"custodyAccount": "
|
182
|
-
"tokenAccount": "
|
86
|
+
"custodyAccount": "8BHHyTJKvZXQkjCeigdkH7hAFcnfX5ecXwysjLnG18FT",
|
87
|
+
"tokenAccount": "8Qa3fV58Lu8WsiPRnkn4xx3PyA2wxE62ESHLXxhesWST",
|
183
88
|
"symbol": "SOL",
|
184
89
|
"mintKey": "So11111111111111111111111111111111111111112",
|
185
90
|
"decimals": 9,
|
@@ -189,8 +94,8 @@
|
|
189
94
|
},
|
190
95
|
{
|
191
96
|
"custodyId": 2,
|
192
|
-
"custodyAccount": "
|
193
|
-
"tokenAccount": "
|
97
|
+
"custodyAccount": "F8peHuGzRwLAgRXm9CGQNKqpWkxTkJQVZw6uLJPx12TV",
|
98
|
+
"tokenAccount": "CEgxrynA9ifMkbiGC8za4LgrvbvzZYSoh1iYQ1n7qMAJ",
|
194
99
|
"symbol": "BTC",
|
195
100
|
"mintKey": "B8DYqbh57aEPRbUq7reyueY6jaYoN75js5YsiM84tFfP",
|
196
101
|
"decimals": 6,
|
@@ -200,8 +105,8 @@
|
|
200
105
|
},
|
201
106
|
{
|
202
107
|
"custodyId": 3,
|
203
|
-
"custodyAccount": "
|
204
|
-
"tokenAccount": "
|
108
|
+
"custodyAccount": "4Xtj4GEPwHjeXeDRmcAyAoZyPH4bsEQ4qFyhcK8bBGgy",
|
109
|
+
"tokenAccount": "7rUd15esvCwMCQZfrr3s2WnPYkQtB75AvLNBoEZs5XHJ",
|
205
110
|
"symbol": "ETH",
|
206
111
|
"mintKey": "BA17bkYW78GvnirtgRHcceQxZdwkhpzbvrwDU6voUXRz",
|
207
112
|
"decimals": 6,
|
@@ -209,21 +114,98 @@
|
|
209
114
|
"isVirtual": false,
|
210
115
|
"oracleAddress": "EdVCmQ9FSPcVe5YySXDPCRmc8aDQLKJ9xvYBMZPie1Vw"
|
211
116
|
}
|
117
|
+
],
|
118
|
+
"markets": [
|
119
|
+
{
|
120
|
+
"marketId": 0,
|
121
|
+
"marketAccount": "7HkcVQpXAR9RB4aQhuV9TAXaSLWGbu5JMs6M3EWB3Gj2",
|
122
|
+
"pool": "7jA4ZSGwaBxXk5EmPKDCSc5RtZNHxyoxy22iQt3D2mH9",
|
123
|
+
"targetCustody": "8BHHyTJKvZXQkjCeigdkH7hAFcnfX5ecXwysjLnG18FT",
|
124
|
+
"collateralCustody": "8BHHyTJKvZXQkjCeigdkH7hAFcnfX5ecXwysjLnG18FT",
|
125
|
+
"side": "long",
|
126
|
+
"targetCustodyId": 1,
|
127
|
+
"collateralCustodyId": 1,
|
128
|
+
"targetMint": "So11111111111111111111111111111111111111112",
|
129
|
+
"collateralMint": "So11111111111111111111111111111111111111112"
|
130
|
+
},
|
131
|
+
{
|
132
|
+
"marketId": 1,
|
133
|
+
"marketAccount": "Fj1hwfeccqjSAKGkX6jEbJZ2auW2zWsoYPjzugwKBTpJ",
|
134
|
+
"pool": "7jA4ZSGwaBxXk5EmPKDCSc5RtZNHxyoxy22iQt3D2mH9",
|
135
|
+
"targetCustody": "8BHHyTJKvZXQkjCeigdkH7hAFcnfX5ecXwysjLnG18FT",
|
136
|
+
"collateralCustody": "AqZSmo7tVgPrZ72kSpRugN8pTCBTHovw65qPikP15dmK",
|
137
|
+
"side": "short",
|
138
|
+
"targetCustodyId": 1,
|
139
|
+
"collateralCustodyId": 0,
|
140
|
+
"targetMint": "So11111111111111111111111111111111111111112",
|
141
|
+
"collateralMint": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr"
|
142
|
+
},
|
143
|
+
{
|
144
|
+
"marketId": 2,
|
145
|
+
"marketAccount": "GZ9HHuNoz17Tj6xBks1ZRAN4k4h47E88iEeBoeZUTNbX",
|
146
|
+
"pool": "7jA4ZSGwaBxXk5EmPKDCSc5RtZNHxyoxy22iQt3D2mH9",
|
147
|
+
"targetCustody": "F8peHuGzRwLAgRXm9CGQNKqpWkxTkJQVZw6uLJPx12TV",
|
148
|
+
"collateralCustody": "F8peHuGzRwLAgRXm9CGQNKqpWkxTkJQVZw6uLJPx12TV",
|
149
|
+
"side": "long",
|
150
|
+
"targetCustodyId": 2,
|
151
|
+
"collateralCustodyId": 2,
|
152
|
+
"targetMint": "B8DYqbh57aEPRbUq7reyueY6jaYoN75js5YsiM84tFfP",
|
153
|
+
"collateralMint": "B8DYqbh57aEPRbUq7reyueY6jaYoN75js5YsiM84tFfP"
|
154
|
+
},
|
155
|
+
{
|
156
|
+
"marketId": 3,
|
157
|
+
"marketAccount": "FXVWNVv1y7vS7boZmTWq9TujhdZLfGmrWFDEqnTpg9zU",
|
158
|
+
"pool": "7jA4ZSGwaBxXk5EmPKDCSc5RtZNHxyoxy22iQt3D2mH9",
|
159
|
+
"targetCustody": "F8peHuGzRwLAgRXm9CGQNKqpWkxTkJQVZw6uLJPx12TV",
|
160
|
+
"collateralCustody": "AqZSmo7tVgPrZ72kSpRugN8pTCBTHovw65qPikP15dmK",
|
161
|
+
"side": "short",
|
162
|
+
"targetCustodyId": 2,
|
163
|
+
"collateralCustodyId": 0,
|
164
|
+
"targetMint": "B8DYqbh57aEPRbUq7reyueY6jaYoN75js5YsiM84tFfP",
|
165
|
+
"collateralMint": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr"
|
166
|
+
},
|
167
|
+
{
|
168
|
+
"marketId": 4,
|
169
|
+
"marketAccount": "4xZb6fic3bDcXG38tXzjQ5n7qRpPoQt7P2rRfEPfYYmz",
|
170
|
+
"pool": "7jA4ZSGwaBxXk5EmPKDCSc5RtZNHxyoxy22iQt3D2mH9",
|
171
|
+
"targetCustody": "4Xtj4GEPwHjeXeDRmcAyAoZyPH4bsEQ4qFyhcK8bBGgy",
|
172
|
+
"collateralCustody": "4Xtj4GEPwHjeXeDRmcAyAoZyPH4bsEQ4qFyhcK8bBGgy",
|
173
|
+
"side": "long",
|
174
|
+
"targetCustodyId": 3,
|
175
|
+
"collateralCustodyId": 3,
|
176
|
+
"targetMint": "BA17bkYW78GvnirtgRHcceQxZdwkhpzbvrwDU6voUXRz",
|
177
|
+
"collateralMint": "BA17bkYW78GvnirtgRHcceQxZdwkhpzbvrwDU6voUXRz"
|
178
|
+
},
|
179
|
+
{
|
180
|
+
"marketId": 5,
|
181
|
+
"marketAccount": "96GfXnGddBdZbFfbLAcpj4BLAvKj8VAoAti97vhvsizG",
|
182
|
+
"pool": "7jA4ZSGwaBxXk5EmPKDCSc5RtZNHxyoxy22iQt3D2mH9",
|
183
|
+
"targetCustody": "4Xtj4GEPwHjeXeDRmcAyAoZyPH4bsEQ4qFyhcK8bBGgy",
|
184
|
+
"collateralCustody": "AqZSmo7tVgPrZ72kSpRugN8pTCBTHovw65qPikP15dmK",
|
185
|
+
"side": "short",
|
186
|
+
"targetCustodyId": 3,
|
187
|
+
"collateralCustodyId": 0,
|
188
|
+
"targetMint": "BA17bkYW78GvnirtgRHcceQxZdwkhpzbvrwDU6voUXRz",
|
189
|
+
"collateralMint": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr"
|
190
|
+
}
|
212
191
|
]
|
213
192
|
},
|
214
193
|
{
|
215
|
-
"programId": "
|
194
|
+
"programId": "FTN6rgbaaxwT8mpRuC55EFTwpHB3BwnHJ91Lqv4ZVCfW",
|
195
|
+
"perpComposibilityProgramId": "SWAP4AE4N1if9qKD7dgfQgmRBRv1CtWG8xDs4HP14ST",
|
216
196
|
"cluster": "devnet",
|
217
|
-
"poolName": "devnet.
|
218
|
-
"poolAddress": "
|
219
|
-
"lpTokenMint": "
|
197
|
+
"poolName": "devnet.2",
|
198
|
+
"poolAddress": "5MCtcNsF3dxna8ArzMamyciWDV3TBkiAzY1NqLtNiXvw",
|
199
|
+
"lpTokenMint": "CEBnqSukYQjcRiKiZKmkbJSDYojtc4GdSipKJ5bSYvHd",
|
200
|
+
"metadataAccount": "CeUy9d6CGyj4mL3JVhYKK2A462yjpb4FGyWUyA7zDoWi",
|
220
201
|
"lpDecimals": 6,
|
221
|
-
"lpTokenSymbol": "FLP.
|
222
|
-
"perpetuals": "
|
223
|
-
"transferAuthority": "
|
224
|
-
"multisig": "
|
225
|
-
"addressLookupTableAddresses": ["
|
202
|
+
"lpTokenSymbol": "FLP.2",
|
203
|
+
"perpetuals": "445GcRLAJ64DcxSRbvQTkbwXgWUyubAxzQUQ2wL73KLS",
|
204
|
+
"transferAuthority": "EPyHAAHUYnFATwd8CJ7owLnozFeS8pFsr3RNJD1eueYq",
|
205
|
+
"multisig": "Eu3cBFRo18AeN9BFb5ndzk2PEmBT7yWEhh3VkG21pyGo",
|
206
|
+
"addressLookupTableAddresses": ["Ejc8FEVsREUim6wb7Xwgf7nai3T3AWNCBWBM7pbWdbJa"],
|
226
207
|
"backupOracle": "AHaKsRB4tsGSzFfFqAxUpfRRmsUj5EhwHSxSXK2UGRp5",
|
208
|
+
"nftCollectionAddress": "3rkRzHdN7dXy5CQfX3Lz6UBBJ2F9n58VEpvDSmbaVHt9",
|
227
209
|
"tokens": [
|
228
210
|
{
|
229
211
|
"symbol": "USDC",
|
@@ -234,42 +216,6 @@
|
|
234
216
|
"pythTicker": "Crypto.USDC/USD",
|
235
217
|
"pythPriceId": "0xeaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a"
|
236
218
|
},
|
237
|
-
{
|
238
|
-
"symbol": "SOL",
|
239
|
-
"mintKey": "So11111111111111111111111111111111111111112",
|
240
|
-
"decimals": 9,
|
241
|
-
"isStable": false,
|
242
|
-
"isVirtual": false,
|
243
|
-
"pythTicker": "Crypto.SOL/USD",
|
244
|
-
"pythPriceId": "0xef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d"
|
245
|
-
},
|
246
|
-
{
|
247
|
-
"symbol": "WSOL",
|
248
|
-
"mintKey": "So11111111111111111111111111111111111111112",
|
249
|
-
"decimals": 9,
|
250
|
-
"isStable": false,
|
251
|
-
"isVirtual": false,
|
252
|
-
"pythTicker": "Crypto.SOL/USD",
|
253
|
-
"pythPriceId": "0xef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d"
|
254
|
-
},
|
255
|
-
{
|
256
|
-
"symbol": "BTC",
|
257
|
-
"mintKey": "B8DYqbh57aEPRbUq7reyueY6jaYoN75js5YsiM84tFfP",
|
258
|
-
"decimals": 6,
|
259
|
-
"isStable": false,
|
260
|
-
"isVirtual": false,
|
261
|
-
"pythTicker": "Crypto.BTC/USD",
|
262
|
-
"pythPriceId": "0xe62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43"
|
263
|
-
},
|
264
|
-
{
|
265
|
-
"symbol": "ETH",
|
266
|
-
"mintKey": "BA17bkYW78GvnirtgRHcceQxZdwkhpzbvrwDU6voUXRz",
|
267
|
-
"decimals": 6,
|
268
|
-
"isStable": false,
|
269
|
-
"isVirtual": false,
|
270
|
-
"pythTicker": "Crypto.ETH/USD",
|
271
|
-
"pythPriceId": "0xff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace"
|
272
|
-
},
|
273
219
|
{
|
274
220
|
"symbol": "XAU",
|
275
221
|
"mintKey": "xaucSYSxjZF4EbsLqAGRvPcuD1uXAj9awmsxYkUAavx",
|
@@ -301,8 +247,8 @@
|
|
301
247
|
"custodies": [
|
302
248
|
{
|
303
249
|
"custodyId": 0,
|
304
|
-
"custodyAccount": "
|
305
|
-
"tokenAccount": "
|
250
|
+
"custodyAccount": "8DrHPGQq4dBrSYV2oy8oDi3sQDSgeCaAe1jq3s9tSh42",
|
251
|
+
"tokenAccount": "33GEjYtTbKXtBJSpR92DMqBUWUhgMXRUmRe5BaV5ximh",
|
306
252
|
"symbol": "USDC",
|
307
253
|
"mintKey": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr",
|
308
254
|
"decimals": 6,
|
@@ -312,41 +258,8 @@
|
|
312
258
|
},
|
313
259
|
{
|
314
260
|
"custodyId": 1,
|
315
|
-
"custodyAccount": "
|
316
|
-
"tokenAccount": "
|
317
|
-
"symbol": "SOL",
|
318
|
-
"mintKey": "So11111111111111111111111111111111111111112",
|
319
|
-
"decimals": 9,
|
320
|
-
"isStable": false,
|
321
|
-
"isVirtual": false,
|
322
|
-
"oracleAddress": "J83w4HKfqxwcq3BEMMkPFSppX3gqekLyLJBexebFVkix"
|
323
|
-
},
|
324
|
-
{
|
325
|
-
"custodyId": 2,
|
326
|
-
"custodyAccount": "APUEYEXeF2LtuuLHx4xAMVhaWQSpW4AFPaZqnzRBBB71",
|
327
|
-
"tokenAccount": "62nixm4GXVagnrJ9Fhz4TvzaY7SGzSxd5M64etndE2a6",
|
328
|
-
"symbol": "BTC",
|
329
|
-
"mintKey": "B8DYqbh57aEPRbUq7reyueY6jaYoN75js5YsiM84tFfP",
|
330
|
-
"decimals": 6,
|
331
|
-
"isStable": false,
|
332
|
-
"isVirtual": false,
|
333
|
-
"oracleAddress": "HovQMDrbAgAYPCmHVSrezcSmkMtXSSUsLDFANExrZh2J"
|
334
|
-
},
|
335
|
-
{
|
336
|
-
"custodyId": 3,
|
337
|
-
"custodyAccount": "FCiG7QmAZ2SKpoFtfaskHD7upaXKtcPLZuaaGZVYNpem",
|
338
|
-
"tokenAccount": "5vGRrHN1NRDqcf9b2EVVmpNvtN2dLMdk5miY17ThDFpA",
|
339
|
-
"symbol": "ETH",
|
340
|
-
"mintKey": "BA17bkYW78GvnirtgRHcceQxZdwkhpzbvrwDU6voUXRz",
|
341
|
-
"decimals": 6,
|
342
|
-
"isStable": false,
|
343
|
-
"isVirtual": false,
|
344
|
-
"oracleAddress": "EdVCmQ9FSPcVe5YySXDPCRmc8aDQLKJ9xvYBMZPie1Vw"
|
345
|
-
},
|
346
|
-
{
|
347
|
-
"custodyId": 4,
|
348
|
-
"custodyAccount": "CvLqzpDBN7tzQMdeibVJzZPzUxJtpyWh9tKLi3g7EuMs",
|
349
|
-
"tokenAccount": "FFpHEX4Ba26KRNbE5YHhQ5V9s2EJxaB4YmuJwZbCRHe9",
|
261
|
+
"custodyAccount": "3de6DnZhfv7TmuaAsfzBtkmueWxLQuJ772ATYB7GCguW",
|
262
|
+
"tokenAccount": "CQ33dxTZwEaqYMEzD2yJLW4U4z81YLiwZkoEhbeZ31zS",
|
350
263
|
"symbol": "XAU",
|
351
264
|
"mintKey": "xaucSYSxjZF4EbsLqAGRvPcuD1uXAj9awmsxYkUAavx",
|
352
265
|
"decimals": 6,
|
@@ -355,9 +268,9 @@
|
|
355
268
|
"oracleAddress": "4GqTjGm686yihQ1m1YdTsSvfm4mNfadv6xskzgCYWNC5"
|
356
269
|
},
|
357
270
|
{
|
358
|
-
"custodyId":
|
359
|
-
"custodyAccount": "
|
360
|
-
"tokenAccount": "
|
271
|
+
"custodyId": 2,
|
272
|
+
"custodyAccount": "JCwAVqhhYkFQxAoT6TMJFcQQzD4BqcswSo9tZSVTEB9r",
|
273
|
+
"tokenAccount": "EyTXjGLn7Bcs2T5qUbKszacGc9CQcjTid1BBq3zhwMrp",
|
361
274
|
"symbol": "COIN",
|
362
275
|
"mintKey": "coin5CDSu7E6t89hYjt22jinQTue2sXQUw4c54XKpxq",
|
363
276
|
"decimals": 6,
|
@@ -366,9 +279,9 @@
|
|
366
279
|
"oracleAddress": "BwkRMkWjfMvWeFLqfQzwhumQan4CxNtyQRbKxtkV4yzi"
|
367
280
|
},
|
368
281
|
{
|
369
|
-
"custodyId":
|
370
|
-
"custodyAccount": "
|
371
|
-
"tokenAccount": "
|
282
|
+
"custodyId": 3,
|
283
|
+
"custodyAccount": "EoCbHAPYhUPZY977AKU7j4XU5rgYnbjQMnB9nqZYCrrG",
|
284
|
+
"tokenAccount": "sYnuU1vKqGaU5V9A7F83yiGAKNVhpPHSHooAn4qqSWr",
|
372
285
|
"symbol": "EUR",
|
373
286
|
"mintKey": "eurExbEMAz5jq8r31EGc3gg9ddu7ftBJWg8A6hYsvng",
|
374
287
|
"decimals": 6,
|
@@ -376,6 +289,80 @@
|
|
376
289
|
"isVirtual": true,
|
377
290
|
"oracleAddress": "E36MyBbavhYKHVLWR79GiReNNnBDiHj6nWA7htbkNZbh"
|
378
291
|
}
|
292
|
+
],
|
293
|
+
"markets": [
|
294
|
+
{
|
295
|
+
"marketId": 0,
|
296
|
+
"marketAccount": "B71om3HUqZ64e9wRj1R8LbWUFvw6cde4yuU4yXvo4GYv",
|
297
|
+
"pool": "5MCtcNsF3dxna8ArzMamyciWDV3TBkiAzY1NqLtNiXvw",
|
298
|
+
"targetCustody": "3de6DnZhfv7TmuaAsfzBtkmueWxLQuJ772ATYB7GCguW",
|
299
|
+
"collateralCustody": "8DrHPGQq4dBrSYV2oy8oDi3sQDSgeCaAe1jq3s9tSh42",
|
300
|
+
"side": "long",
|
301
|
+
"targetCustodyId": 1,
|
302
|
+
"collateralCustodyId": 0,
|
303
|
+
"targetMint": "xaucSYSxjZF4EbsLqAGRvPcuD1uXAj9awmsxYkUAavx",
|
304
|
+
"collateralMint": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr"
|
305
|
+
},
|
306
|
+
{
|
307
|
+
"marketId": 1,
|
308
|
+
"marketAccount": "9wV2Y87ix64cFP6B3VNxuXiabTPYgAm65MuqgivXVUn7",
|
309
|
+
"pool": "5MCtcNsF3dxna8ArzMamyciWDV3TBkiAzY1NqLtNiXvw",
|
310
|
+
"targetCustody": "3de6DnZhfv7TmuaAsfzBtkmueWxLQuJ772ATYB7GCguW",
|
311
|
+
"collateralCustody": "8DrHPGQq4dBrSYV2oy8oDi3sQDSgeCaAe1jq3s9tSh42",
|
312
|
+
"side": "short",
|
313
|
+
"targetCustodyId": 1,
|
314
|
+
"collateralCustodyId": 0,
|
315
|
+
"targetMint": "xaucSYSxjZF4EbsLqAGRvPcuD1uXAj9awmsxYkUAavx",
|
316
|
+
"collateralMint": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr"
|
317
|
+
},
|
318
|
+
{
|
319
|
+
"marketId": 2,
|
320
|
+
"marketAccount": "9AiEn2s6DipDBesE84qWPmPwMAJpeYRBZtCaTy7D6DhA",
|
321
|
+
"pool": "5MCtcNsF3dxna8ArzMamyciWDV3TBkiAzY1NqLtNiXvw",
|
322
|
+
"targetCustody": "JCwAVqhhYkFQxAoT6TMJFcQQzD4BqcswSo9tZSVTEB9r",
|
323
|
+
"collateralCustody": "8DrHPGQq4dBrSYV2oy8oDi3sQDSgeCaAe1jq3s9tSh42",
|
324
|
+
"side": "long",
|
325
|
+
"targetCustodyId": 2,
|
326
|
+
"collateralCustodyId": 0,
|
327
|
+
"targetMint": "coin5CDSu7E6t89hYjt22jinQTue2sXQUw4c54XKpxq",
|
328
|
+
"collateralMint": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr"
|
329
|
+
},
|
330
|
+
{
|
331
|
+
"marketId": 3,
|
332
|
+
"marketAccount": "CmEEEnADVBkhdf9BRckynfyfU8epzy2Bzave8UnBdJRK",
|
333
|
+
"pool": "5MCtcNsF3dxna8ArzMamyciWDV3TBkiAzY1NqLtNiXvw",
|
334
|
+
"targetCustody": "JCwAVqhhYkFQxAoT6TMJFcQQzD4BqcswSo9tZSVTEB9r",
|
335
|
+
"collateralCustody": "8DrHPGQq4dBrSYV2oy8oDi3sQDSgeCaAe1jq3s9tSh42",
|
336
|
+
"side": "short",
|
337
|
+
"targetCustodyId": 2,
|
338
|
+
"collateralCustodyId": 0,
|
339
|
+
"targetMint": "coin5CDSu7E6t89hYjt22jinQTue2sXQUw4c54XKpxq",
|
340
|
+
"collateralMint": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr"
|
341
|
+
},
|
342
|
+
{
|
343
|
+
"marketId": 4,
|
344
|
+
"marketAccount": "4ryTFNWPE1J1X3akTrXjygS47b9agM9uGGByc1TvxbdN",
|
345
|
+
"pool": "5MCtcNsF3dxna8ArzMamyciWDV3TBkiAzY1NqLtNiXvw",
|
346
|
+
"targetCustody": "EoCbHAPYhUPZY977AKU7j4XU5rgYnbjQMnB9nqZYCrrG",
|
347
|
+
"collateralCustody": "8DrHPGQq4dBrSYV2oy8oDi3sQDSgeCaAe1jq3s9tSh42",
|
348
|
+
"side": "long",
|
349
|
+
"targetCustodyId": 3,
|
350
|
+
"collateralCustodyId": 0,
|
351
|
+
"targetMint": "eurExbEMAz5jq8r31EGc3gg9ddu7ftBJWg8A6hYsvng",
|
352
|
+
"collateralMint": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr"
|
353
|
+
},
|
354
|
+
{
|
355
|
+
"marketId": 5,
|
356
|
+
"marketAccount": "Cz3FVEBdQ2Ns2uorfM6ZjWbvqMNRSnSHaTFprAcKUzEJ",
|
357
|
+
"pool": "5MCtcNsF3dxna8ArzMamyciWDV3TBkiAzY1NqLtNiXvw",
|
358
|
+
"targetCustody": "EoCbHAPYhUPZY977AKU7j4XU5rgYnbjQMnB9nqZYCrrG",
|
359
|
+
"collateralCustody": "8DrHPGQq4dBrSYV2oy8oDi3sQDSgeCaAe1jq3s9tSh42",
|
360
|
+
"side": "short",
|
361
|
+
"targetCustodyId": 3,
|
362
|
+
"collateralCustodyId": 0,
|
363
|
+
"targetMint": "eurExbEMAz5jq8r31EGc3gg9ddu7ftBJWg8A6hYsvng",
|
364
|
+
"collateralMint": "Gh9ZwEmdLJ8DscKNTkTqPbNwLNNBjuSzaG9Vp2KGtKJr"
|
365
|
+
}
|
379
366
|
]
|
380
367
|
}
|
381
368
|
]
|
package/dist/PoolDataClient.d.ts
CHANGED
@@ -5,6 +5,7 @@ import { CustodyAccount } from "./CustodyAccount";
|
|
5
5
|
import { OraclePrice } from "./OraclePrice";
|
6
6
|
import { PoolConfig } from "./PoolConfig";
|
7
7
|
import { PoolAccount } from "./PoolAccount";
|
8
|
+
import { MarketAccount } from "./MarketAccount";
|
8
9
|
export interface LpStats {
|
9
10
|
lpTokenSupply: BN;
|
10
11
|
decimals: number;
|
@@ -37,23 +38,16 @@ export interface CustodyStats {
|
|
37
38
|
minCapacityAmountUi: string;
|
38
39
|
maxCapacityAmountUi: string;
|
39
40
|
}
|
40
|
-
export interface PoolStats {
|
41
|
-
totalFees: BN;
|
42
|
-
totalVolume: BN;
|
43
|
-
currentLongPositionsUsd: BN;
|
44
|
-
currentShortPositionsUsd: BN;
|
45
|
-
}
|
46
41
|
export declare class PoolDataClient {
|
47
42
|
poolConfig: PoolConfig;
|
48
43
|
pool: PoolAccount;
|
49
44
|
lpTokenInfo: Mint;
|
50
45
|
custodies: CustodyAccount[];
|
46
|
+
markets: MarketAccount[];
|
51
47
|
constructor(poolConfig: PoolConfig, pool: PoolAccount, lpTokenInfo: Mint, custodies: CustodyAccount[]);
|
52
48
|
loadCustodies(custodies: CustodyAccount[]): void;
|
53
49
|
loadPoolData(pool: PoolAccount): void;
|
54
50
|
loadLpData(lpTokenInfo: Mint): void;
|
55
|
-
getOiLongUI(): BN;
|
56
|
-
getOiShortUI(): BN;
|
57
51
|
getLpStats(pricesMap: Map<string, {
|
58
52
|
price: OraclePrice;
|
59
53
|
emaPrice: OraclePrice;
|
@@ -62,5 +56,4 @@ export declare class PoolDataClient {
|
|
62
56
|
price: OraclePrice;
|
63
57
|
emaPrice: OraclePrice;
|
64
58
|
}>): CustodyStats[];
|
65
|
-
getPoolStats(): PoolStats;
|
66
59
|
}
|
package/dist/PoolDataClient.js
CHANGED
@@ -24,20 +24,6 @@ var PoolDataClient = (function () {
|
|
24
24
|
PoolDataClient.prototype.loadLpData = function (lpTokenInfo) {
|
25
25
|
this.lpTokenInfo = lpTokenInfo;
|
26
26
|
};
|
27
|
-
PoolDataClient.prototype.getOiLongUI = function () {
|
28
|
-
var totalAmount = new anchor_1.BN('0');
|
29
|
-
this.custodies.forEach(function (i) {
|
30
|
-
totalAmount = totalAmount.add(i.tradeStats.oiLong);
|
31
|
-
});
|
32
|
-
return totalAmount;
|
33
|
-
};
|
34
|
-
PoolDataClient.prototype.getOiShortUI = function () {
|
35
|
-
var totalAmount = new anchor_1.BN('0');
|
36
|
-
this.custodies.forEach(function (i) {
|
37
|
-
totalAmount = totalAmount.add(i.tradeStats.oiShort);
|
38
|
-
});
|
39
|
-
return totalAmount;
|
40
|
-
};
|
41
27
|
PoolDataClient.prototype.getLpStats = function (pricesMap) {
|
42
28
|
var stableCoinAmountBni = new bignumber_js_1.default(0);
|
43
29
|
var totalPoolValueUsdBnUi = new bignumber_js_1.default(0);
|
@@ -78,7 +64,7 @@ var PoolDataClient = (function () {
|
|
78
64
|
};
|
79
65
|
PoolDataClient.prototype.getCustodyStats = function (pricesMap) {
|
80
66
|
var totalPoolValueUsd = this.getLpStats(pricesMap).totalPoolValueUsd;
|
81
|
-
var totalPoolValueUsdUi = totalPoolValueUsd.isZero() ? '0' : (0, utils_1.nativeToUiDecimals)(totalPoolValueUsd, constants_1.
|
67
|
+
var totalPoolValueUsdUi = totalPoolValueUsd.isZero() ? '0' : (0, utils_1.nativeToUiDecimals)(totalPoolValueUsd, constants_1.USD_DECIMALS, constants_1.USD_DECIMALS);
|
82
68
|
var custodyDetails = [];
|
83
69
|
var _loop_2 = function (i) {
|
84
70
|
var custodyConfig = this_2.poolConfig.custodies[i];
|
@@ -140,34 +126,6 @@ var PoolDataClient = (function () {
|
|
140
126
|
}
|
141
127
|
return custodyDetails;
|
142
128
|
};
|
143
|
-
PoolDataClient.prototype.getPoolStats = function () {
|
144
|
-
var totalFees = new anchor_1.BN(0);
|
145
|
-
var totalVolume = new anchor_1.BN(0);
|
146
|
-
var currentLongPositionsUsd = new anchor_1.BN(0);
|
147
|
-
var currentShortPositionsUsd = new anchor_1.BN(0);
|
148
|
-
var _loop_3 = function (custody) {
|
149
|
-
var custodyData = this_3.custodies.find(function (t) { return t.mint.toBase58() === custody.mintKey.toBase58(); });
|
150
|
-
if (custodyData) {
|
151
|
-
var custodyFeeTotal = Object.values(custodyData.collectedFees).reduce(function (a, b) { return a.add(b); }, new anchor_1.BN(0));
|
152
|
-
totalFees = totalFees.add(custodyFeeTotal);
|
153
|
-
var custodyVolume = Object.values(custodyData.volumeStats).reduce(function (a, b) { return a.add(b); }, new anchor_1.BN(0));
|
154
|
-
totalVolume = totalVolume.add(custodyVolume);
|
155
|
-
currentLongPositionsUsd = currentLongPositionsUsd.add(custodyData.tradeStats.oiLong);
|
156
|
-
currentShortPositionsUsd = currentShortPositionsUsd.add(custodyData.tradeStats.oiShort);
|
157
|
-
}
|
158
|
-
};
|
159
|
-
var this_3 = this;
|
160
|
-
for (var _i = 0, _a = this.poolConfig.custodies; _i < _a.length; _i++) {
|
161
|
-
var custody = _a[_i];
|
162
|
-
_loop_3(custody);
|
163
|
-
}
|
164
|
-
return {
|
165
|
-
totalFees: totalFees,
|
166
|
-
totalVolume: totalVolume,
|
167
|
-
currentLongPositionsUsd: currentLongPositionsUsd,
|
168
|
-
currentShortPositionsUsd: currentShortPositionsUsd
|
169
|
-
};
|
170
|
-
};
|
171
129
|
return PoolDataClient;
|
172
130
|
}());
|
173
131
|
exports.PoolDataClient = PoolDataClient;
|
@@ -1,27 +1,29 @@
|
|
1
1
|
/// <reference types="bn.js" />
|
2
2
|
import { BN } from "@coral-xyz/anchor";
|
3
3
|
import { PublicKey } from "@solana/web3.js";
|
4
|
-
import {
|
4
|
+
import { ContractOraclePrice, Position } from "./types";
|
5
5
|
export declare class PositionAccount implements Position {
|
6
6
|
publicKey: PublicKey;
|
7
7
|
owner: PublicKey;
|
8
|
+
market: PublicKey;
|
8
9
|
delegate: PublicKey;
|
9
|
-
pool: PublicKey;
|
10
|
-
custody: PublicKey;
|
11
|
-
collateralCustody: PublicKey;
|
12
10
|
openTime: BN;
|
13
11
|
updateTime: BN;
|
14
|
-
|
15
|
-
price: BN;
|
12
|
+
entryPrice: ContractOraclePrice;
|
16
13
|
sizeUsd: BN;
|
17
|
-
|
18
|
-
collateralUsd: BN;
|
19
|
-
unsettledAmount: BN;
|
20
|
-
unrealizedLossUsd: BN;
|
21
|
-
cumulativeInterestSnapshot: BN;
|
14
|
+
sizeAmount: BN;
|
22
15
|
lockedAmount: BN;
|
16
|
+
lockedUsd: BN;
|
23
17
|
collateralAmount: BN;
|
24
|
-
|
18
|
+
collateralUsd: BN;
|
19
|
+
unsettledAmount: BN;
|
20
|
+
unsettledFeesUsd: BN;
|
21
|
+
cumulativeLockFeeSnapshot: BN;
|
22
|
+
takeProfitPrice: ContractOraclePrice;
|
23
|
+
stopLossPrice: ContractOraclePrice;
|
24
|
+
sizeDecimals: number;
|
25
|
+
lockedDecimals: number;
|
26
|
+
collateralDecimals: number;
|
25
27
|
bump: number;
|
26
28
|
constructor(publicKey: PublicKey, parseData: Position);
|
27
29
|
static from(publicKey: PublicKey, parseData: Position): PositionAccount;
|
@@ -0,0 +1,20 @@
|
|
1
|
+
/// <reference types="bn.js" />
|
2
|
+
import { BN } from "@coral-xyz/anchor";
|
3
|
+
import { Trading, VoltageStats } from "./types";
|
4
|
+
import { PublicKey } from "@solana/web3.js";
|
5
|
+
export declare class TradingAccount implements Trading {
|
6
|
+
publicKey: PublicKey;
|
7
|
+
nftMint: PublicKey;
|
8
|
+
owner: PublicKey;
|
9
|
+
delegate: PublicKey;
|
10
|
+
isInitialized: boolean;
|
11
|
+
level: number;
|
12
|
+
bump: number;
|
13
|
+
voltagePoints: BN;
|
14
|
+
stats: VoltageStats;
|
15
|
+
snapshot: VoltageStats;
|
16
|
+
padding: BN[];
|
17
|
+
constructor(publicKey: PublicKey, parseData: Trading);
|
18
|
+
static from(publicKey: PublicKey, parseData: Trading): TradingAccount;
|
19
|
+
updatePoolData(parseData: Trading): void;
|
20
|
+
}
|