@sonarwatch/portfolio-plugins 0.12.35 → 0.12.37
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +10 -2
- package/package.json +1 -1
- package/src/index.js +8 -0
- package/src/index.js.map +1 -1
- package/src/orphanPlatorms.js +0 -8
- package/src/orphanPlatorms.js.map +1 -1
- package/src/plugins/01/depostisFetcher.js +1 -1
- package/src/plugins/01/depostisFetcher.js.map +1 -1
- package/src/plugins/aave/helpers.js +6 -1
- package/src/plugins/aave/helpers.js.map +1 -1
- package/src/plugins/allbridge/constants.d.ts +11 -0
- package/src/plugins/allbridge/constants.js +25 -0
- package/src/plugins/allbridge/constants.js.map +1 -0
- package/src/plugins/allbridge/helpers.d.ts +5 -0
- package/src/plugins/allbridge/helpers.js +25 -0
- package/src/plugins/allbridge/helpers.js.map +1 -0
- package/src/plugins/allbridge/idl.d.ts +58 -0
- package/src/plugins/allbridge/idl.js +476 -0
- package/src/plugins/allbridge/idl.js.map +1 -0
- package/src/plugins/allbridge/index.d.ts +6 -0
- package/src/plugins/allbridge/index.js +13 -0
- package/src/plugins/allbridge/index.js.map +1 -0
- package/src/plugins/allbridge/poolsJob.d.ts +3 -0
- package/src/plugins/allbridge/poolsJob.js +40 -0
- package/src/plugins/allbridge/poolsJob.js.map +1 -0
- package/src/plugins/allbridge/positionsFetcher.js +92 -0
- package/src/plugins/allbridge/positionsFetcher.js.map +1 -0
- package/src/plugins/allbridge/types.d.ts +38 -0
- package/src/plugins/allbridge/types.js +3 -0
- package/src/plugins/allbridge/types.js.map +1 -0
- package/src/plugins/aptin/depositsFetcher.js +6 -1
- package/src/plugins/aptin/depositsFetcher.js.map +1 -1
- package/src/plugins/aries/depositsFetcher.js +7 -1
- package/src/plugins/aries/depositsFetcher.js.map +1 -1
- package/src/plugins/banx/constants.d.ts +0 -1
- package/src/plugins/banx/constants.js +1 -2
- package/src/plugins/banx/constants.js.map +1 -1
- package/src/plugins/banx/{calculateLoanRepayValue.d.ts → helpers.d.ts} +1 -0
- package/src/plugins/banx/{calculateLoanRepayValue.js → helpers.js} +29 -2
- package/src/plugins/banx/helpers.js.map +1 -0
- package/src/plugins/banx/idl.d.ts +15 -7
- package/src/plugins/banx/idl.js +199 -268
- package/src/plugins/banx/idl.js.map +1 -1
- package/src/plugins/banx/loansFetcher.js +33 -28
- package/src/plugins/banx/loansFetcher.js.map +1 -1
- package/src/plugins/banx/offersFetcher.js +15 -16
- package/src/plugins/banx/offersFetcher.js.map +1 -1
- package/src/plugins/bucket/collateralFetcher.js +1 -1
- package/src/plugins/bucket/collateralFetcher.js.map +1 -1
- package/src/plugins/citrus/collectionsJob.js.map +1 -1
- package/src/plugins/citrus/constants.d.ts +0 -1
- package/src/plugins/citrus/constants.js +1 -2
- package/src/plugins/citrus/constants.js.map +1 -1
- package/src/plugins/citrus/loansFetcher.js +18 -20
- package/src/plugins/citrus/loansFetcher.js.map +1 -1
- package/src/plugins/clone/depositsFetcher.js +2 -2
- package/src/plugins/clone/depositsFetcher.js.map +1 -1
- package/src/plugins/compound/getPositionsV2Fetcher.js +1 -1
- package/src/plugins/compound/getPositionsV2Fetcher.js.map +1 -1
- package/src/plugins/compound/getPositionsV3Fetcher.js +5 -1
- package/src/plugins/compound/getPositionsV3Fetcher.js.map +1 -1
- package/src/plugins/drift/depositsFetcher.d.ts +3 -0
- package/src/plugins/drift/{deposits.js → depositsFetcher.js} +4 -4
- package/src/plugins/drift/depositsFetcher.js.map +1 -0
- package/src/plugins/drift/index.js +2 -2
- package/src/plugins/drift/index.js.map +1 -1
- package/src/plugins/flash/perpetualFetcher.js +1 -1
- package/src/plugins/flash/perpetualFetcher.js.map +1 -1
- package/src/plugins/flexlend/depositsFetcher.js +2 -2
- package/src/plugins/flexlend/depositsFetcher.js.map +1 -1
- package/src/plugins/jupiter/exchange/constants.d.ts +1 -0
- package/src/plugins/jupiter/exchange/constants.js +2 -1
- package/src/plugins/jupiter/exchange/constants.js.map +1 -1
- package/src/plugins/jupiter/exchange/limitFetcher.js +9 -6
- package/src/plugins/jupiter/exchange/limitFetcher.js.map +1 -1
- package/src/plugins/jupiter/exchange/perpetualFetcher.js +8 -8
- package/src/plugins/jupiter/exchange/perpetualFetcher.js.map +1 -1
- package/src/plugins/jupiter/exchange/structs.d.ts +21 -0
- package/src/plugins/jupiter/exchange/structs.js +21 -1
- package/src/plugins/jupiter/exchange/structs.js.map +1 -1
- package/src/plugins/jupiter/pricingJob.js +7 -22
- package/src/plugins/jupiter/pricingJob.js.map +1 -1
- package/src/plugins/kamino/lendsFetcher.js +21 -3
- package/src/plugins/kamino/lendsFetcher.js.map +1 -1
- package/src/plugins/maker/vaultsFetcher.js +1 -1
- package/src/plugins/maker/vaultsFetcher.js.map +1 -1
- package/src/plugins/mango/boostFetcher.js +1 -1
- package/src/plugins/mango/boostFetcher.js.map +1 -1
- package/src/plugins/mango/collateralFetcher.js +1 -1
- package/src/plugins/mango/collateralFetcher.js.map +1 -1
- package/src/plugins/mango/redeemFetcher.js +1 -1
- package/src/plugins/mango/redeemFetcher.js.map +1 -1
- package/src/plugins/maple/ethereumFetcher.js +1 -1
- package/src/plugins/maple/ethereumFetcher.js.map +1 -1
- package/src/plugins/marginfi/helpers.js +7 -1
- package/src/plugins/marginfi/helpers.js.map +1 -1
- package/src/plugins/mole/farmsFetcher.js +5 -1
- package/src/plugins/mole/farmsFetcher.js.map +1 -1
- package/src/plugins/morpho/aaveV3CollateralFetcher.js +1 -1
- package/src/plugins/morpho/aaveV3CollateralFetcher.js.map +1 -1
- package/src/plugins/native-stake/solana/solanaFetcher.js +2 -0
- package/src/plugins/native-stake/solana/solanaFetcher.js.map +1 -1
- package/src/plugins/navi/collateralFetcher.js +6 -1
- package/src/plugins/navi/collateralFetcher.js.map +1 -1
- package/src/plugins/nosana/stakingFetcher.js +8 -2
- package/src/plugins/nosana/stakingFetcher.js.map +1 -1
- package/src/plugins/port/obligationsFetcher.js +1 -1
- package/src/plugins/port/obligationsFetcher.js.map +1 -1
- package/src/plugins/rain/collectionsJob.js +6 -10
- package/src/plugins/rain/collectionsJob.js.map +1 -1
- package/src/plugins/rain/helpers.js +3 -1
- package/src/plugins/rain/helpers.js.map +1 -1
- package/src/plugins/rain/index.js +2 -1
- package/src/plugins/rain/index.js.map +1 -1
- package/src/plugins/rain/loansFetcher.js +61 -26
- package/src/plugins/rain/loansFetcher.js.map +1 -1
- package/src/plugins/rain/poolsFetcher.js +1 -1
- package/src/plugins/rain/poolsFetcher.js.map +1 -1
- package/src/plugins/rain/types.d.ts +3 -0
- package/src/plugins/sanctum/constants.d.ts +4 -0
- package/src/plugins/sanctum/constants.js +14 -0
- package/src/plugins/sanctum/constants.js.map +1 -0
- package/src/plugins/sanctum/index.d.ts +6 -0
- package/src/plugins/sanctum/index.js +12 -0
- package/src/plugins/sanctum/index.js.map +1 -0
- package/src/plugins/sanctum/lstsJob.d.ts +3 -0
- package/src/plugins/sanctum/lstsJob.js +36 -0
- package/src/plugins/sanctum/lstsJob.js.map +1 -0
- package/src/plugins/scallop/lendingsFetcher.js +1 -1
- package/src/plugins/scallop/lendingsFetcher.js.map +1 -1
- package/src/plugins/scallop/obligationsFetcher.js +1 -1
- package/src/plugins/scallop/obligationsFetcher.js.map +1 -1
- package/src/plugins/sharky/constants.d.ts +0 -1
- package/src/plugins/sharky/constants.js +3 -4
- package/src/plugins/sharky/constants.js.map +1 -1
- package/src/plugins/sharky/loansFetcher.js +21 -20
- package/src/plugins/sharky/loansFetcher.js.map +1 -1
- package/src/plugins/solend/helpers.js +7 -1
- package/src/plugins/solend/helpers.js.map +1 -1
- package/src/plugins/suilend/obligationsFetcher.js +7 -1
- package/src/plugins/suilend/obligationsFetcher.js.map +1 -1
- package/src/plugins/thala/vaultsFetcher.js +1 -1
- package/src/plugins/thala/vaultsFetcher.js.map +1 -1
- package/src/plugins/zeta/airdropFetcher.d.ts +3 -0
- package/src/plugins/zeta/airdropFetcher.js +105 -0
- package/src/plugins/zeta/airdropFetcher.js.map +1 -0
- package/src/plugins/zeta/constants.d.ts +3 -0
- package/src/plugins/zeta/constants.js +4 -1
- package/src/plugins/zeta/constants.js.map +1 -1
- package/src/plugins/zeta/index.js +2 -1
- package/src/plugins/zeta/index.js.map +1 -1
- package/src/plugins/zeta/types.d.ts +14 -0
- package/src/plugins/zeta/types.js +3 -0
- package/src/plugins/zeta/types.js.map +1 -0
- package/src/utils/misc/MemoizedCache.d.ts +12 -0
- package/src/utils/misc/MemoizedCache.js +35 -0
- package/src/utils/misc/MemoizedCache.js.map +1 -0
- package/src/utils/misc/arrayToMap.d.ts +1 -0
- package/src/utils/misc/arrayToMap.js +12 -0
- package/src/utils/misc/arrayToMap.js.map +1 -0
- package/src/utils/misc/pick.d.ts +2 -0
- package/src/utils/misc/pick.js +16 -0
- package/src/utils/misc/pick.js.map +1 -0
- package/src/utils/solana/getAutoParsedMultipleAccountsInfo.js +8 -3
- package/src/utils/solana/getAutoParsedMultipleAccountsInfo.js.map +1 -1
- package/src/plugins/banx/calculateLoanRepayValue.js.map +0 -1
- package/src/plugins/drift/deposits.js.map +0 -1
- /package/src/plugins/{drift/deposits.d.ts → allbridge/positionsFetcher.d.ts} +0 -0
@@ -0,0 +1,476 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.AllbridgeIDL = void 0;
|
4
|
+
exports.AllbridgeIDL = {
|
5
|
+
version: '0.1.0',
|
6
|
+
name: 'bridge',
|
7
|
+
accounts: [
|
8
|
+
{
|
9
|
+
name: 'chainBridge',
|
10
|
+
type: {
|
11
|
+
kind: 'struct',
|
12
|
+
fields: [
|
13
|
+
{
|
14
|
+
name: 'address',
|
15
|
+
type: {
|
16
|
+
array: ['u8', 32],
|
17
|
+
},
|
18
|
+
},
|
19
|
+
{
|
20
|
+
name: 'chainId',
|
21
|
+
type: 'u8',
|
22
|
+
},
|
23
|
+
{
|
24
|
+
name: 'gasUsage',
|
25
|
+
type: 'u64',
|
26
|
+
},
|
27
|
+
],
|
28
|
+
},
|
29
|
+
},
|
30
|
+
{
|
31
|
+
name: 'config',
|
32
|
+
type: {
|
33
|
+
kind: 'struct',
|
34
|
+
fields: [
|
35
|
+
{
|
36
|
+
name: 'admin',
|
37
|
+
type: 'publicKey',
|
38
|
+
},
|
39
|
+
{
|
40
|
+
name: 'allbridgeMessengerProgramId',
|
41
|
+
type: 'publicKey',
|
42
|
+
},
|
43
|
+
{
|
44
|
+
name: 'wormholeMessengerProgramId',
|
45
|
+
type: 'publicKey',
|
46
|
+
},
|
47
|
+
{
|
48
|
+
name: 'gasOracleProgramId',
|
49
|
+
type: 'publicKey',
|
50
|
+
},
|
51
|
+
{
|
52
|
+
name: 'rebalancer',
|
53
|
+
type: 'publicKey',
|
54
|
+
},
|
55
|
+
{
|
56
|
+
name: 'stopAuthority',
|
57
|
+
type: 'publicKey',
|
58
|
+
},
|
59
|
+
{
|
60
|
+
name: 'authorityBumpSeed',
|
61
|
+
type: 'u8',
|
62
|
+
},
|
63
|
+
{
|
64
|
+
name: 'canSwap',
|
65
|
+
type: 'bool',
|
66
|
+
},
|
67
|
+
{
|
68
|
+
name: 'canDeposit',
|
69
|
+
type: 'bool',
|
70
|
+
},
|
71
|
+
{
|
72
|
+
name: 'canWithdraw',
|
73
|
+
type: 'bool',
|
74
|
+
},
|
75
|
+
],
|
76
|
+
},
|
77
|
+
},
|
78
|
+
{
|
79
|
+
name: 'lock',
|
80
|
+
type: {
|
81
|
+
kind: 'struct',
|
82
|
+
fields: [
|
83
|
+
{
|
84
|
+
name: 'sender',
|
85
|
+
type: 'publicKey',
|
86
|
+
},
|
87
|
+
{
|
88
|
+
name: 'sentTokenAddress',
|
89
|
+
type: 'publicKey',
|
90
|
+
},
|
91
|
+
{
|
92
|
+
name: 'amount',
|
93
|
+
type: 'u64',
|
94
|
+
},
|
95
|
+
{
|
96
|
+
name: 'vusdAmount',
|
97
|
+
type: 'u64',
|
98
|
+
},
|
99
|
+
{
|
100
|
+
name: 'recipient',
|
101
|
+
type: {
|
102
|
+
array: ['u8', 32],
|
103
|
+
},
|
104
|
+
},
|
105
|
+
{
|
106
|
+
name: 'destinationChainId',
|
107
|
+
type: 'u8',
|
108
|
+
},
|
109
|
+
{
|
110
|
+
name: 'receiveToken',
|
111
|
+
type: {
|
112
|
+
array: ['u8', 32],
|
113
|
+
},
|
114
|
+
},
|
115
|
+
{
|
116
|
+
name: 'nonce',
|
117
|
+
type: {
|
118
|
+
array: ['u8', 32],
|
119
|
+
},
|
120
|
+
},
|
121
|
+
{
|
122
|
+
name: 'messenger',
|
123
|
+
type: {
|
124
|
+
defined: 'Messenger',
|
125
|
+
},
|
126
|
+
},
|
127
|
+
{
|
128
|
+
name: 'slot',
|
129
|
+
type: 'u64',
|
130
|
+
},
|
131
|
+
{
|
132
|
+
name: 'fee',
|
133
|
+
type: 'u64',
|
134
|
+
},
|
135
|
+
],
|
136
|
+
},
|
137
|
+
},
|
138
|
+
{
|
139
|
+
name: 'otherBridgeToken',
|
140
|
+
type: {
|
141
|
+
kind: 'struct',
|
142
|
+
fields: [],
|
143
|
+
},
|
144
|
+
},
|
145
|
+
{
|
146
|
+
name: 'pool',
|
147
|
+
type: {
|
148
|
+
kind: 'struct',
|
149
|
+
fields: [
|
150
|
+
{
|
151
|
+
name: 'mint',
|
152
|
+
type: 'publicKey',
|
153
|
+
},
|
154
|
+
{
|
155
|
+
name: 'a',
|
156
|
+
type: 'u64',
|
157
|
+
},
|
158
|
+
{
|
159
|
+
name: 'd',
|
160
|
+
type: 'u64',
|
161
|
+
},
|
162
|
+
{
|
163
|
+
name: 'tokenBalance',
|
164
|
+
type: 'u64',
|
165
|
+
},
|
166
|
+
{
|
167
|
+
name: 'vUsdBalance',
|
168
|
+
type: 'u64',
|
169
|
+
},
|
170
|
+
{
|
171
|
+
name: 'reserves',
|
172
|
+
type: 'u64',
|
173
|
+
},
|
174
|
+
{
|
175
|
+
name: 'decimals',
|
176
|
+
type: 'u8',
|
177
|
+
},
|
178
|
+
{
|
179
|
+
name: 'totalLpAmount',
|
180
|
+
type: 'u64',
|
181
|
+
},
|
182
|
+
{
|
183
|
+
name: 'feeShareBp',
|
184
|
+
type: 'u64',
|
185
|
+
},
|
186
|
+
{
|
187
|
+
name: 'adminFeeShareBp',
|
188
|
+
type: 'u64',
|
189
|
+
},
|
190
|
+
{
|
191
|
+
name: 'accRewardPerShareP',
|
192
|
+
type: 'u128',
|
193
|
+
},
|
194
|
+
{
|
195
|
+
name: 'adminFeeAmount',
|
196
|
+
type: 'u64',
|
197
|
+
},
|
198
|
+
{
|
199
|
+
name: 'balanceRatioMinBp',
|
200
|
+
type: 'u16',
|
201
|
+
},
|
202
|
+
],
|
203
|
+
},
|
204
|
+
},
|
205
|
+
{
|
206
|
+
name: 'unlock',
|
207
|
+
type: {
|
208
|
+
kind: 'struct',
|
209
|
+
fields: [
|
210
|
+
{
|
211
|
+
name: 'hash',
|
212
|
+
type: {
|
213
|
+
array: ['u8', 32],
|
214
|
+
},
|
215
|
+
},
|
216
|
+
{
|
217
|
+
name: 'amount',
|
218
|
+
type: 'u64',
|
219
|
+
},
|
220
|
+
{
|
221
|
+
name: 'fee',
|
222
|
+
type: 'u64',
|
223
|
+
},
|
224
|
+
{
|
225
|
+
name: 'vUsdAmount',
|
226
|
+
type: 'u64',
|
227
|
+
},
|
228
|
+
{
|
229
|
+
name: 'slot',
|
230
|
+
type: 'u64',
|
231
|
+
},
|
232
|
+
],
|
233
|
+
},
|
234
|
+
},
|
235
|
+
{
|
236
|
+
name: 'userDeposit',
|
237
|
+
type: {
|
238
|
+
kind: 'struct',
|
239
|
+
fields: [
|
240
|
+
{
|
241
|
+
name: 'userAddress',
|
242
|
+
type: 'publicKey',
|
243
|
+
},
|
244
|
+
{
|
245
|
+
name: 'mint',
|
246
|
+
type: 'publicKey',
|
247
|
+
},
|
248
|
+
{
|
249
|
+
name: 'lpAmount',
|
250
|
+
type: 'u64',
|
251
|
+
},
|
252
|
+
{
|
253
|
+
name: 'rewardDebt',
|
254
|
+
type: 'u64',
|
255
|
+
},
|
256
|
+
],
|
257
|
+
},
|
258
|
+
},
|
259
|
+
],
|
260
|
+
types: [
|
261
|
+
{
|
262
|
+
name: 'RegisterChainBridgeArgs',
|
263
|
+
type: {
|
264
|
+
kind: 'struct',
|
265
|
+
fields: [
|
266
|
+
{
|
267
|
+
name: 'chainBridgeAddress',
|
268
|
+
type: {
|
269
|
+
array: ['u8', 32],
|
270
|
+
},
|
271
|
+
},
|
272
|
+
{
|
273
|
+
name: 'chainId',
|
274
|
+
type: 'u8',
|
275
|
+
},
|
276
|
+
{
|
277
|
+
name: 'gasUsage',
|
278
|
+
type: 'u64',
|
279
|
+
},
|
280
|
+
],
|
281
|
+
},
|
282
|
+
},
|
283
|
+
{
|
284
|
+
name: 'UpdateChainBridgeArgs',
|
285
|
+
type: {
|
286
|
+
kind: 'struct',
|
287
|
+
fields: [
|
288
|
+
{
|
289
|
+
name: 'chainBridgeAddress',
|
290
|
+
type: {
|
291
|
+
array: ['u8', 32],
|
292
|
+
},
|
293
|
+
},
|
294
|
+
{
|
295
|
+
name: 'chainId',
|
296
|
+
type: 'u8',
|
297
|
+
},
|
298
|
+
{
|
299
|
+
name: 'gasUsage',
|
300
|
+
type: 'u64',
|
301
|
+
},
|
302
|
+
],
|
303
|
+
},
|
304
|
+
},
|
305
|
+
{
|
306
|
+
name: 'InitializeArgs',
|
307
|
+
type: {
|
308
|
+
kind: 'struct',
|
309
|
+
fields: [
|
310
|
+
{
|
311
|
+
name: 'allbridgeMessengerProgramId',
|
312
|
+
type: 'publicKey',
|
313
|
+
},
|
314
|
+
{
|
315
|
+
name: 'wormholeMessengerProgramId',
|
316
|
+
type: 'publicKey',
|
317
|
+
},
|
318
|
+
{
|
319
|
+
name: 'gasOracleProgramId',
|
320
|
+
type: 'publicKey',
|
321
|
+
},
|
322
|
+
],
|
323
|
+
},
|
324
|
+
},
|
325
|
+
{
|
326
|
+
name: 'InitializePoolArgs',
|
327
|
+
type: {
|
328
|
+
kind: 'struct',
|
329
|
+
fields: [
|
330
|
+
{
|
331
|
+
name: 'a',
|
332
|
+
type: 'u64',
|
333
|
+
},
|
334
|
+
{
|
335
|
+
name: 'feeShareBp',
|
336
|
+
type: 'u64',
|
337
|
+
},
|
338
|
+
{
|
339
|
+
name: 'adminFeeShareBp',
|
340
|
+
type: 'u64',
|
341
|
+
},
|
342
|
+
{
|
343
|
+
name: 'balanceRatioMinBp',
|
344
|
+
type: 'u16',
|
345
|
+
},
|
346
|
+
],
|
347
|
+
},
|
348
|
+
},
|
349
|
+
{
|
350
|
+
name: 'BridgeArgs',
|
351
|
+
type: {
|
352
|
+
kind: 'struct',
|
353
|
+
fields: [
|
354
|
+
{
|
355
|
+
name: 'nonce',
|
356
|
+
type: {
|
357
|
+
array: ['u8', 32],
|
358
|
+
},
|
359
|
+
},
|
360
|
+
{
|
361
|
+
name: 'recipient',
|
362
|
+
type: {
|
363
|
+
array: ['u8', 32],
|
364
|
+
},
|
365
|
+
},
|
366
|
+
{
|
367
|
+
name: 'destinationChainId',
|
368
|
+
type: 'u8',
|
369
|
+
},
|
370
|
+
{
|
371
|
+
name: 'receiveToken',
|
372
|
+
type: {
|
373
|
+
array: ['u8', 32],
|
374
|
+
},
|
375
|
+
},
|
376
|
+
{
|
377
|
+
name: 'vusdAmount',
|
378
|
+
type: 'u64',
|
379
|
+
},
|
380
|
+
],
|
381
|
+
},
|
382
|
+
},
|
383
|
+
{
|
384
|
+
name: 'UnlockArgs',
|
385
|
+
type: {
|
386
|
+
kind: 'struct',
|
387
|
+
fields: [
|
388
|
+
{
|
389
|
+
name: 'nonce',
|
390
|
+
type: {
|
391
|
+
array: ['u8', 32],
|
392
|
+
},
|
393
|
+
},
|
394
|
+
{
|
395
|
+
name: 'amount',
|
396
|
+
type: 'u64',
|
397
|
+
},
|
398
|
+
{
|
399
|
+
name: 'recipient',
|
400
|
+
type: 'publicKey',
|
401
|
+
},
|
402
|
+
{
|
403
|
+
name: 'sourceChainId',
|
404
|
+
type: 'u8',
|
405
|
+
},
|
406
|
+
{
|
407
|
+
name: 'receiveToken',
|
408
|
+
type: 'publicKey',
|
409
|
+
},
|
410
|
+
{
|
411
|
+
name: 'messenger',
|
412
|
+
type: {
|
413
|
+
defined: 'Messenger',
|
414
|
+
},
|
415
|
+
},
|
416
|
+
{
|
417
|
+
name: 'hash',
|
418
|
+
type: {
|
419
|
+
array: ['u8', 32],
|
420
|
+
},
|
421
|
+
},
|
422
|
+
{
|
423
|
+
name: 'receiveAmountMin',
|
424
|
+
type: 'u64',
|
425
|
+
},
|
426
|
+
],
|
427
|
+
},
|
428
|
+
},
|
429
|
+
{
|
430
|
+
name: 'RewardError',
|
431
|
+
type: {
|
432
|
+
kind: 'enum',
|
433
|
+
variants: [
|
434
|
+
{
|
435
|
+
name: 'FeeTooHigh',
|
436
|
+
},
|
437
|
+
],
|
438
|
+
},
|
439
|
+
},
|
440
|
+
{
|
441
|
+
name: 'Messenger',
|
442
|
+
type: {
|
443
|
+
kind: 'enum',
|
444
|
+
variants: [
|
445
|
+
{
|
446
|
+
name: 'None',
|
447
|
+
},
|
448
|
+
{
|
449
|
+
name: 'Allbridge',
|
450
|
+
},
|
451
|
+
{
|
452
|
+
name: 'Wormhole',
|
453
|
+
},
|
454
|
+
],
|
455
|
+
},
|
456
|
+
},
|
457
|
+
{
|
458
|
+
name: 'ActionType',
|
459
|
+
type: {
|
460
|
+
kind: 'enum',
|
461
|
+
variants: [
|
462
|
+
{
|
463
|
+
name: 'Deposit',
|
464
|
+
},
|
465
|
+
{
|
466
|
+
name: 'Withdraw',
|
467
|
+
},
|
468
|
+
{
|
469
|
+
name: 'Swap',
|
470
|
+
},
|
471
|
+
],
|
472
|
+
},
|
473
|
+
},
|
474
|
+
],
|
475
|
+
};
|
476
|
+
//# sourceMappingURL=idl.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"idl.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/allbridge/idl.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAA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d,IAAI,EAAE,KAAK;qBACZ;oBACD;wBACE,IAAI,EAAE,WAAW;wBACjB,IAAI,EAAE,WAAW;qBAClB;oBACD;wBACE,IAAI,EAAE,eAAe;wBACrB,IAAI,EAAE,IAAI;qBACX;oBACD;wBACE,IAAI,EAAE,cAAc;wBACpB,IAAI,EAAE,WAAW;qBAClB;oBACD;wBACE,IAAI,EAAE,WAAW;wBACjB,IAAI,EAAE;4BACJ,OAAO,EAAE,WAAW;yBACrB;qBACF;oBACD;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE;4BACJ,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC;yBAClB;qBACF;oBACD;wBACE,IAAI,EAAE,kBAAkB;wBACxB,IAAI,EAAE,KAAK;qBACZ;iBACF;aACF;SACF;QACD;YACE,IAAI,EAAE,aAAa;YACnB,IAAI,EAAE;gBACJ,IAAI,EAAE,MAAM;gBACZ,QAAQ,EAAE;oBACR;wBACE,IAAI,EAAE,YAAY;qBACnB;iBACF;aACF;SACF;QACD;YACE,IAAI,EAAE,WAAW;YACjB,IAAI,EAAE;gBACJ,IAAI,EAAE,MAAM;gBACZ,QAAQ,EAAE;oBACR;wBACE,IAAI,EAAE,MAAM;qBACb;oBACD;wBACE,IAAI,EAAE,WAAW;qBAClB;oBACD;wBACE,IAAI,EAAE,UAAU;qBACjB;iBACF;aACF;SACF;QACD;YACE,IAAI,EAAE,YAAY;YAClB,IAAI,EAAE;gBACJ,IAAI,EAAE,MAAM;gBACZ,QAAQ,EAAE;oBACR;wBACE,IAAI,EAAE,SAAS;qBAChB;oBACD;wBACE,IAAI,EAAE,UAAU;qBACjB;oBACD;wBACE,IAAI,EAAE,MAAM;qBACb;iBACF;aACF;SACF;KACF;CACF,CAAC"}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
exports.fetchers = exports.jobs = exports.platforms = void 0;
|
7
|
+
const constants_1 = require("./constants");
|
8
|
+
const positionsFetcher_1 = __importDefault(require("./positionsFetcher"));
|
9
|
+
const poolsJob_1 = __importDefault(require("./poolsJob"));
|
10
|
+
exports.platforms = [constants_1.platform];
|
11
|
+
exports.jobs = [poolsJob_1.default];
|
12
|
+
exports.fetchers = [positionsFetcher_1.default];
|
13
|
+
//# sourceMappingURL=index.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/allbridge/index.ts"],"names":[],"mappings":";;;;;;AAGA,2CAAuC;AACvC,0EAAkD;AAClD,0DAAkC;AAErB,QAAA,SAAS,GAAe,CAAC,oBAAQ,CAAC,CAAC;AACnC,QAAA,IAAI,GAAU,CAAC,kBAAQ,CAAC,CAAC;AACzB,QAAA,QAAQ,GAAc,CAAC,0BAAgB,CAAC,CAAC"}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
+
};
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
16
|
+
const axios_1 = __importDefault(require("axios"));
|
17
|
+
const constants_1 = require("./constants");
|
18
|
+
const executor = (cache) => __awaiter(void 0, void 0, void 0, function* () {
|
19
|
+
const res = yield axios_1.default
|
20
|
+
.get(constants_1.apiPoolInfoUrl, {
|
21
|
+
timeout: 5000,
|
22
|
+
})
|
23
|
+
.catch((err) => {
|
24
|
+
throw Error(`ALLBRIDGE_API ERR: ${err}`);
|
25
|
+
});
|
26
|
+
if (!res) {
|
27
|
+
throw Error(`ALLBRIDGE_API NO RESPONSE`);
|
28
|
+
}
|
29
|
+
yield cache.setItem(constants_1.poolsCacheKey, res.data.SOL, {
|
30
|
+
prefix: constants_1.cachePrefix,
|
31
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
32
|
+
});
|
33
|
+
});
|
34
|
+
const job = {
|
35
|
+
id: `${constants_1.platformId}-pools`,
|
36
|
+
executor,
|
37
|
+
label: 'normal',
|
38
|
+
};
|
39
|
+
exports.default = job;
|
40
|
+
//# sourceMappingURL=poolsJob.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"poolsJob.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/allbridge/poolsJob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAAuD;AACvD,kDAA0B;AAG1B,2CAKqB;AAGrB,MAAM,QAAQ,GAAgB,CAAO,KAAY,EAAE,EAAE;IACnD,MAAM,GAAG,GAAG,MAAM,eAAK;SACpB,GAAG,CAAW,0BAAc,EAAE;QAC7B,OAAO,EAAE,IAAI;KACd,CAAC;SACD,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QACb,MAAM,KAAK,CAAC,sBAAsB,GAAG,EAAE,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;IAEL,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC3C,CAAC;IAED,MAAM,KAAK,CAAC,OAAO,CAAC,yBAAa,EAAE,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE;QAC/C,MAAM,EAAE,uBAAW;QACnB,SAAS,EAAE,0BAAS,CAAC,MAAM;KAC5B,CAAC,CAAC;AACL,CAAC,CAAA,CAAC;AAEF,MAAM,GAAG,GAAQ;IACf,EAAE,EAAE,GAAG,sBAAU,QAAQ;IACzB,QAAQ;IACR,KAAK,EAAE,QAAQ;CAChB,CAAC;AAEF,kBAAe,GAAG,CAAC"}
|
@@ -0,0 +1,92 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
+
});
|
10
|
+
};
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
13
|
+
};
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
+
const portfolio_core_1 = require("@sonarwatch/portfolio-core");
|
16
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
17
|
+
const constants_1 = require("./constants");
|
18
|
+
const clients_1 = require("../../utils/clients");
|
19
|
+
const solana_1 = require("../../utils/solana");
|
20
|
+
const tokenPriceToAssetToken_1 = __importDefault(require("../../utils/misc/tokenPriceToAssetToken"));
|
21
|
+
const helpers_1 = require("./helpers");
|
22
|
+
const MemoizedCache_1 = require("../../utils/misc/MemoizedCache");
|
23
|
+
const poolInfoMemo = new MemoizedCache_1.MemoizedCache(constants_1.poolsCacheKey, {
|
24
|
+
prefix: constants_1.cachePrefix,
|
25
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
26
|
+
});
|
27
|
+
const executor = (owner, cache) => __awaiter(void 0, void 0, void 0, function* () {
|
28
|
+
const connection = (0, clients_1.getClientSolana)();
|
29
|
+
const poolInfo = yield poolInfoMemo.getItem(cache);
|
30
|
+
if (!poolInfo)
|
31
|
+
return [];
|
32
|
+
const userDepositPublicKeys = (0, helpers_1.getUserDepositPublicKeys)(poolInfo, owner);
|
33
|
+
const userDeposits = (yield (0, solana_1.getAutoParsedMultipleAccountsInfo)(connection, constants_1.allbridgeIdlItem, userDepositPublicKeys)).filter((userDeposit) => (userDeposit === null || userDeposit === void 0 ? void 0 : userDeposit.lpAmount) !== '0');
|
34
|
+
if (userDeposits.length === 0)
|
35
|
+
return [];
|
36
|
+
const tokenPrices = yield cache.getTokenPricesAsMap(poolInfo.tokens.map((pi) => pi.tokenAddress), portfolio_core_1.NetworkId.solana);
|
37
|
+
const elements = [];
|
38
|
+
userDeposits.forEach((userDeposit) => {
|
39
|
+
const tokenPool = poolInfo.tokens.find((tp, i) => userDepositPublicKeys[i] === userDeposit.pubkey);
|
40
|
+
if (!tokenPool)
|
41
|
+
return;
|
42
|
+
const tokenPrice = tokenPrices.get(tokenPool.tokenAddress);
|
43
|
+
if (!tokenPrice)
|
44
|
+
return;
|
45
|
+
const lpAsset = (0, tokenPriceToAssetToken_1.default)(tokenPool.tokenAddress, new bignumber_js_1.default(userDeposit.lpAmount)
|
46
|
+
.dividedBy(Math.pow(10, constants_1.SYSTEM_PRECISION))
|
47
|
+
.toNumber(), portfolio_core_1.NetworkId.solana, tokenPrice);
|
48
|
+
const rewardValue = (0, helpers_1.getEarned)(userDeposit.lpAmount, userDeposit.rewardDebt, tokenPool.poolInfo.accRewardPerShareP, tokenPool.poolInfo.p)
|
49
|
+
.dividedBy(Math.pow(10, tokenPool.decimals))
|
50
|
+
.toNumber();
|
51
|
+
const rewardsAssets = [];
|
52
|
+
if (rewardValue > 0)
|
53
|
+
rewardsAssets.push((0, tokenPriceToAssetToken_1.default)(tokenPool.tokenAddress, rewardValue, portfolio_core_1.NetworkId.solana, tokenPrice));
|
54
|
+
const value = (0, portfolio_core_1.getUsdValueSum)([
|
55
|
+
lpAsset.value,
|
56
|
+
...rewardsAssets.map((ra) => ra.value),
|
57
|
+
]);
|
58
|
+
elements.push({
|
59
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
60
|
+
label: 'LiquidityPool',
|
61
|
+
platformId: constants_1.platformId,
|
62
|
+
type: portfolio_core_1.PortfolioElementType.liquidity,
|
63
|
+
value,
|
64
|
+
data: {
|
65
|
+
liquidities: [
|
66
|
+
{
|
67
|
+
assets: [lpAsset],
|
68
|
+
assetsValue: lpAsset.value,
|
69
|
+
rewardAssets: rewardsAssets,
|
70
|
+
rewardAssetsValue: (0, portfolio_core_1.getUsdValueSum)(rewardsAssets.map((ra) => ra.value)),
|
71
|
+
value,
|
72
|
+
yields: [
|
73
|
+
{
|
74
|
+
apy: (0, portfolio_core_1.aprToApy)(Number(tokenPool.apr)),
|
75
|
+
apr: Number(tokenPool.apr),
|
76
|
+
},
|
77
|
+
],
|
78
|
+
},
|
79
|
+
],
|
80
|
+
},
|
81
|
+
name: tokenPool.name,
|
82
|
+
});
|
83
|
+
});
|
84
|
+
return elements;
|
85
|
+
});
|
86
|
+
const fetcher = {
|
87
|
+
id: `${constants_1.platformId}-positions`,
|
88
|
+
networkId: portfolio_core_1.NetworkId.solana,
|
89
|
+
executor,
|
90
|
+
};
|
91
|
+
exports.default = fetcher;
|
92
|
+
//# sourceMappingURL=positionsFetcher.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"positionsFetcher.js","sourceRoot":"","sources":["../../../../../../packages/plugins/src/plugins/allbridge/positionsFetcher.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,+DAMoC;AACpC,gEAAqC;AAErC,2CAMqB;AAErB,iDAAsD;AACtD,+CAG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