@scallop-io/sui-scallop-sdk 1.4.14 → 1.4.15-rc.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/dist/constants/poolAddress.d.ts +14 -4
- package/dist/constants/queryKeys.d.ts +1 -2
- package/dist/constants/tokenBucket.d.ts +2 -2
- package/dist/index.js +719 -307
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +674 -262
- package/dist/index.mjs.map +1 -1
- package/dist/models/scallopCache.d.ts +1 -0
- package/dist/models/scallopQuery.d.ts +20 -17
- package/dist/queries/coreQuery.d.ts +18 -19
- package/dist/queries/index.d.ts +2 -0
- package/dist/queries/isolatedAssetQuery.d.ts +2 -2
- package/dist/queries/objectsQuery.d.ts +3 -0
- package/dist/queries/poolAddressesQuery.d.ts +15 -0
- package/dist/types/query/core.d.ts +22 -5
- package/dist/types/utils.d.ts +7 -2
- package/dist/utils/core.d.ts +2 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/util.d.ts +1 -0
- package/package.json +1 -1
- package/src/constants/poolAddress.ts +290 -29
- package/src/constants/queryKeys.ts +5 -5
- package/src/constants/tokenBucket.ts +2 -2
- package/src/models/scallopCache.ts +43 -11
- package/src/models/scallopQuery.ts +24 -12
- package/src/queries/borrowIncentiveQuery.ts +1 -1
- package/src/queries/coreQuery.ts +378 -248
- package/src/queries/index.ts +2 -0
- package/src/queries/isolatedAssetQuery.ts +37 -31
- package/src/queries/objectsQuery.ts +20 -0
- package/src/queries/poolAddressesQuery.ts +134 -0
- package/src/queries/portfolioQuery.ts +14 -7
- package/src/queries/priceQuery.ts +3 -1
- package/src/queries/spoolQuery.ts +3 -1
- package/src/types/query/core.ts +21 -5
- package/src/types/utils.ts +8 -3
- package/src/utils/core.ts +11 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/query.ts +16 -2
- package/src/utils/tokenBucket.ts +2 -2
- package/src/utils/util.ts +8 -0
|
@@ -1,102 +1,363 @@
|
|
|
1
|
-
import { SupportPoolCoins } from 'src/types';
|
|
1
|
+
import { OptionalKeys, SupportPoolCoins } from 'src/types';
|
|
2
2
|
|
|
3
|
-
export const POOL_ADDRESSES:
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
export const POOL_ADDRESSES: OptionalKeys<
|
|
4
|
+
Record<
|
|
5
|
+
SupportPoolCoins,
|
|
6
|
+
{
|
|
7
|
+
coinType?: string;
|
|
8
|
+
lendingPoolAddress?: string;
|
|
9
|
+
collateralPoolAddress?: string; // not all pool has collateral
|
|
10
|
+
spool?: string;
|
|
11
|
+
spoolReward?: string;
|
|
12
|
+
borrowDynamic?: string;
|
|
13
|
+
interestModel?: string;
|
|
14
|
+
riskModel?: string;
|
|
15
|
+
borrowFeeKey?: string;
|
|
16
|
+
supplyLimitKey?: string;
|
|
17
|
+
borrowLimitKey?: string;
|
|
18
|
+
isolatedAssetKey?: string;
|
|
19
|
+
}
|
|
20
|
+
>
|
|
9
21
|
> = {
|
|
10
|
-
usdc: {
|
|
11
|
-
lendingPoolAddress:
|
|
12
|
-
'0xd3be98bf540f7603eeb550c0c0a19dbfc78822f25158b5fa84ebd9609def415f',
|
|
13
|
-
collateralPoolAddress:
|
|
14
|
-
'0x8f0d529ba179c5b3d508213003eab813aaae31f78226099639b9a69d1aec17af',
|
|
15
|
-
},
|
|
16
22
|
sbeth: {
|
|
17
23
|
lendingPoolAddress:
|
|
18
|
-
'
|
|
24
|
+
'0xaa34c938e0394e5186c7dc626ad69be96af2194b23fdc6ac1c63090e399f5ba4',
|
|
19
25
|
collateralPoolAddress:
|
|
20
26
|
'0xce0549a1cbe952e734f56646988e6b02bbae14667889a60e24d0d03540a6119f',
|
|
27
|
+
borrowDynamic:
|
|
28
|
+
'0x7bbe75e8b924229f2f2110838ff612ea66e670fa3766759515dee78f617b1ea3',
|
|
29
|
+
interestModel:
|
|
30
|
+
'0x9e6cae260d05155785a1904d24e6abc98368509c5752c8a9cec15a35aabc1512',
|
|
31
|
+
riskModel:
|
|
32
|
+
'0xcf10334cfee675ecea2d2fee37b0f7cd2835c84b8b5692a853021debe6af80ab',
|
|
33
|
+
borrowFeeKey:
|
|
34
|
+
'0x4298c8b6afe7a42a8e3ff93773fb9769529fe6d37e085ab411acf2ba2a44a931',
|
|
35
|
+
supplyLimitKey:
|
|
36
|
+
'0x812fe508b78d3e0817149c0b39976221ddb267b5cc9514e81679f9b9a2f3624c',
|
|
37
|
+
borrowLimitKey:
|
|
38
|
+
'0x165c274c67eda2b0d13563124741fffd0ce7d643f4c1c4b59d7e53a83796ae25',
|
|
39
|
+
isolatedAssetKey: undefined,
|
|
40
|
+
spool: undefined,
|
|
41
|
+
spoolReward: undefined,
|
|
21
42
|
},
|
|
22
|
-
|
|
43
|
+
usdc: {
|
|
23
44
|
lendingPoolAddress:
|
|
24
|
-
'
|
|
45
|
+
'0xd3be98bf540f7603eeb550c0c0a19dbfc78822f25158b5fa84ebd9609def415f',
|
|
25
46
|
collateralPoolAddress:
|
|
26
|
-
'
|
|
47
|
+
'0x8f0d529ba179c5b3d508213003eab813aaae31f78226099639b9a69d1aec17af',
|
|
48
|
+
borrowDynamic:
|
|
49
|
+
'0x77837ecd4f26fac9a410fff594f2c0bd3288904a15492ca77cb8a52684dbb866',
|
|
50
|
+
interestModel:
|
|
51
|
+
'0xaae3f179d63009380cbdcb9acb12907afc9c3cb79cc3460be296a9c6d28f3ff3',
|
|
52
|
+
riskModel:
|
|
53
|
+
'0x198b24db213bfeb8b3c80ae63dde92e32fd24984d25da8233ff777b851edd574',
|
|
54
|
+
borrowFeeKey:
|
|
55
|
+
'0xd37c5316cfe0a5967d14264fa6b423f880518b294a1ee6581ccbb49ccc401fb8',
|
|
56
|
+
supplyLimitKey:
|
|
57
|
+
'0x4be9ae54ac4d320f4f9c14cae78cb85c8e0e67791dd9bdba6d2db20614a28a24',
|
|
58
|
+
borrowLimitKey:
|
|
59
|
+
'0x6b01093cba95b835181f00e3a2c31ed8dfc8d64fe3db0fb80933a09f66e1ccf1',
|
|
60
|
+
isolatedAssetKey: undefined,
|
|
61
|
+
spool: '0x0b5f5f413bd3799e4052c37311966c77f3a4545eb125d2e93e67a68478021918',
|
|
62
|
+
spoolReward:
|
|
63
|
+
'0x85ed6ed72ea97c35dbf0cdc7ed6fbc48d8ec15de9b17c74bf4512df8a6d7f166',
|
|
27
64
|
},
|
|
28
65
|
wbtc: {
|
|
29
66
|
lendingPoolAddress:
|
|
30
67
|
'0x65cc08a5aca0a0b8d72e1993ded8d145f06dd102fd0d8f285b92934faed564ab',
|
|
31
68
|
collateralPoolAddress:
|
|
32
69
|
'0x1aa4e5cf743cd797b4eb8bf1e614f80ae2cf556ced426cddaaf190ffcd0e59c3',
|
|
70
|
+
borrowDynamic:
|
|
71
|
+
'0x6f97dcf54158a5d08f359a213a41e347bc1e6316414288dc1e1b674dc008742e',
|
|
72
|
+
interestModel:
|
|
73
|
+
'0x582b915cca0ffca9576a7cedd505d0fd7cb146e9521ccf10e7453ed93705684d',
|
|
74
|
+
riskModel:
|
|
75
|
+
'0x1d0a242bf1682e259112239720da19d3155dd99d70b1f4b3b973eecbab858911',
|
|
76
|
+
borrowFeeKey:
|
|
77
|
+
'0x654ab7e8ff6d9ef04da697e1f12ca21eaf72ebb495daf877e0776e65187dcb92',
|
|
78
|
+
supplyLimitKey:
|
|
79
|
+
'0xac3b0d17df9f98aa2798c54405cf1d8d5356ef22f76f02d150cbe5195e9f3a36',
|
|
80
|
+
borrowLimitKey:
|
|
81
|
+
'0x231e13ba6b1eb26c562f4a125778d3152f9a77e31f124bd6012e234a73012169',
|
|
82
|
+
isolatedAssetKey: undefined,
|
|
83
|
+
spool: undefined,
|
|
84
|
+
spoolReward: undefined,
|
|
33
85
|
},
|
|
34
86
|
wusdc: {
|
|
35
87
|
lendingPoolAddress:
|
|
36
|
-
'
|
|
88
|
+
'0x2f4df5e1368fbbdaa5c712d28b837b3d41c2d3872979ccededcdfdac55ff8a93',
|
|
37
89
|
collateralPoolAddress:
|
|
38
|
-
'
|
|
90
|
+
'0x94cf69158114c5b242d2ee5d0149a335bddf3b9c9a6ba919cca58097a4814980',
|
|
91
|
+
borrowDynamic:
|
|
92
|
+
'0x0464d117908b52fc75f7f85322a47caa078ef56f48681bcfdcb630a66f2591e6',
|
|
93
|
+
interestModel:
|
|
94
|
+
'0xd72e2b5ba486752939d6dfb86a67b86ce9a60c83cb8fb893caac54a0f112577f',
|
|
95
|
+
riskModel:
|
|
96
|
+
'0xb74035de8f70c1531ceb8e2e8c152d6b8db24c8a9fe7bbf6f75dbf7c6700a0a3',
|
|
97
|
+
borrowFeeKey:
|
|
98
|
+
'0x76dcf1acbd9951fe3d1a3fe28403fec089ffe53a7c7d6c77e3ea97033a63581a',
|
|
99
|
+
supplyLimitKey:
|
|
100
|
+
'0x7b302196907e87c5d5872f2e6f40628d110170f994e0e08bc607bded001958c3',
|
|
101
|
+
borrowLimitKey:
|
|
102
|
+
'0x97f1502ce994db0bcb15aac1760d174def9e88e97cd2262eed54521ee2c19f81',
|
|
103
|
+
isolatedAssetKey: undefined,
|
|
104
|
+
spool: '0x4ace6648ddc64e646ba47a957c562c32c9599b3bba8f5ac1aadb2ae23a2f8ca0',
|
|
105
|
+
spoolReward:
|
|
106
|
+
'0xf4268cc9b9413b9bfe09e8966b8de650494c9e5784bf0930759cfef4904daff8',
|
|
107
|
+
},
|
|
108
|
+
weth: {
|
|
109
|
+
lendingPoolAddress:
|
|
110
|
+
'0xc8fcdff48efc265740ae0b74aae3faccae9ec00034039a113f3339798035108c',
|
|
111
|
+
collateralPoolAddress:
|
|
112
|
+
'0xad7ced91ed6e7f2b81805561eee27fa6f3e72fdae561077334c7248583db4dbf',
|
|
113
|
+
borrowDynamic:
|
|
114
|
+
'0xd1578e1d1c9c82eb4c5bf14beece8142a67a683b2647d7276e92984119fc1445',
|
|
115
|
+
interestModel:
|
|
116
|
+
'0xa1dc08541cd2cb7cfb4e56272292d5c6a4780e80fd210c58abffae98268b5ed9',
|
|
117
|
+
riskModel:
|
|
118
|
+
'0x9f05a25fd33a9e8cf33962126b175d038e184f0ee1b87dc41d4cedbe6abebbe5',
|
|
119
|
+
borrowFeeKey:
|
|
120
|
+
'0x29672ba8ab4625b8181d8ed739e5344de22a97d417748c4d1276c7379283d7a3',
|
|
121
|
+
supplyLimitKey:
|
|
122
|
+
'0x2b957941bdc9432bbc83ab74dc194b6ebb7c927bc4c6926a5492b5503499e509',
|
|
123
|
+
borrowLimitKey:
|
|
124
|
+
'0x51f256d87e51a7ca2b1c482923096f4b6dac6beac89d8ecf4c65b7d5764115d6',
|
|
125
|
+
isolatedAssetKey: undefined,
|
|
126
|
+
spool: '0xeec40beccb07c575bebd842eeaabb835f77cd3dab73add433477e57f583a6787',
|
|
127
|
+
spoolReward:
|
|
128
|
+
'0x957de68a18d87817de8309b30c1ec269a4d87ae513abbeed86b5619cb9ce1077',
|
|
39
129
|
},
|
|
40
130
|
wusdt: {
|
|
41
131
|
lendingPoolAddress:
|
|
42
132
|
'0xfbc056f126dd35adc1f8fe985e2cedc8010e687e8e851e1c5b99fdf63cd1c879',
|
|
43
133
|
collateralPoolAddress:
|
|
44
134
|
'0x2260cb5b24929dd20a1742f37a61ff3ce4fde5cdb023e2d3ce2e0ce2d90719e3',
|
|
135
|
+
borrowDynamic:
|
|
136
|
+
'0xb524030cc8f7cdbf13f1925a0a2b5e77cc52bab73b070f42c5e510f6083da1ba',
|
|
137
|
+
interestModel:
|
|
138
|
+
'0x92f93c4431b4c51774d6d964da516af2def18b78f49dbbf519e58449a8ba4659',
|
|
139
|
+
riskModel:
|
|
140
|
+
'0xdf89d66988cb506ddeff46f5dfd1d11aaece345e9a05a0c6a18a0788647de2a7',
|
|
141
|
+
borrowFeeKey:
|
|
142
|
+
'0xda8f8b3522fc4086eae4ae7ce8844d60aa0dc3eab8ffc91fe93e922a72639b2d',
|
|
143
|
+
supplyLimitKey:
|
|
144
|
+
'0xa9cb5ebb90ca6e808a2bd7728cca4a6fa8b565d4deeda96eb23c8322c477c24e',
|
|
145
|
+
borrowLimitKey:
|
|
146
|
+
'0xa3278564fc613680a69c10972a0299965bf6e12e9ac171388842fc958de0f90e',
|
|
147
|
+
isolatedAssetKey: undefined,
|
|
148
|
+
spool: '0xcb328f7ffa7f9342ed85af3fdb2f22919e1a06dfb2f713c04c73543870d7548f',
|
|
149
|
+
spoolReward:
|
|
150
|
+
'0x2c9f934d67a5baa586ceec2cc24163a2f049a6af3d5ba36b84d8ac40f25c4080',
|
|
45
151
|
},
|
|
46
152
|
sui: {
|
|
47
153
|
lendingPoolAddress:
|
|
48
154
|
'0x9c9077abf7a29eebce41e33addbcd6f5246a5221dd733e56ea0f00ae1b25c9e8',
|
|
49
155
|
collateralPoolAddress:
|
|
50
156
|
'0x75aacfb7dcbf92ee0111fc1bf975b12569e4ba632e81ed7ae5ac090d40cd3acb',
|
|
157
|
+
borrowDynamic:
|
|
158
|
+
'0xbf68e6159c99dcaf87717385f1143d2891c2d19663bd51f0bc9b6909e4bb7c27',
|
|
159
|
+
interestModel:
|
|
160
|
+
'0x0dad9baa89b863c15a0487575de7cc428b01f1aa3998ad7a9e9752d96e83ffa9',
|
|
161
|
+
riskModel:
|
|
162
|
+
'0xcd6675864690b5648a6e309f2f02a66914b2b2bd9c31936f4e0f7fc0f792bc86',
|
|
163
|
+
borrowFeeKey:
|
|
164
|
+
'0xda5ede87a05c0677b17511c859b22d0a2b0229ee374d5d7a1274cb836b9fe5f8',
|
|
165
|
+
supplyLimitKey:
|
|
166
|
+
'0x0602418e66fb7a73fa997077bd66f248ad5b090d43344a14b9f1db598ecc1d47',
|
|
167
|
+
borrowLimitKey:
|
|
168
|
+
'0x2b33a7efdcf6a6df24f4d8a356dd52f58d75bc023c3f171d99502d4d008b53f0',
|
|
169
|
+
isolatedAssetKey: undefined,
|
|
170
|
+
spool: '0x4f0ba970d3c11db05c8f40c64a15b6a33322db3702d634ced6536960ab6f3ee4',
|
|
171
|
+
spoolReward:
|
|
172
|
+
'0x162250ef72393a4ad3d46294c4e1bdfcb03f04c869d390e7efbfc995353a7ee9',
|
|
51
173
|
},
|
|
52
174
|
wapt: {
|
|
53
175
|
lendingPoolAddress:
|
|
54
176
|
'0xca8c14a24e0c32b198eaf479a3317461e3cc339097ce88eaf296a15df8dcfdf5',
|
|
55
177
|
collateralPoolAddress:
|
|
56
178
|
'0xde33f9ac5bb0ed34598da4e64b4983832716ced65f172fbf267bcfe859c4ad9c',
|
|
179
|
+
borrowDynamic:
|
|
180
|
+
'0xadda873fb6bf68e1ba3f2dfaa51cf75d4a1bef73d9627bd36e77d2baecb1f2dc',
|
|
181
|
+
interestModel:
|
|
182
|
+
'0xa4a29d07beecea5eb0c59745bb89d7a1380c6f206a7f1ca37046e05db6025c43',
|
|
183
|
+
riskModel:
|
|
184
|
+
'0x7ada83b473af30aed50d187de82a0912878b53ade7ac30e11ce23953cf739d84',
|
|
185
|
+
borrowFeeKey:
|
|
186
|
+
'0x768735df587c7e0f141dcd035fbbcbf9d2149a7b23888baed4e2baa160fa2eeb',
|
|
187
|
+
supplyLimitKey: undefined,
|
|
188
|
+
borrowLimitKey: undefined,
|
|
189
|
+
isolatedAssetKey: undefined,
|
|
190
|
+
spool: undefined,
|
|
191
|
+
spoolReward: undefined,
|
|
192
|
+
},
|
|
193
|
+
afsui: {
|
|
194
|
+
lendingPoolAddress:
|
|
195
|
+
'0x9b942a24ce390b7f5016d34a0217057bf9487b92aa6d7cc9894271dbbe62471a',
|
|
196
|
+
collateralPoolAddress:
|
|
197
|
+
'0xe5e56f5c0e3072760b21f9d49a5cc793f37d736c412a9065c16e1265c74e6341',
|
|
198
|
+
borrowDynamic:
|
|
199
|
+
'0x1c76d4df9506154a117bbac0f5e005d8a9c0d9ca60e3fe0c9d080006f6f54e81',
|
|
200
|
+
interestModel:
|
|
201
|
+
'0xb155c536b37c9601baaa734ad1dd0ef335b2b597aceb8d3ecee41a43f94dcd70',
|
|
202
|
+
riskModel:
|
|
203
|
+
'0x75371b1d04b5bebc0738af548ba64ea658e74f78228ec8014336d8eebb992312',
|
|
204
|
+
borrowFeeKey:
|
|
205
|
+
'0xabc6422db2d4ee01635ddaeaa44ba68370eebd785d2c4632515f841ae9bc47d9',
|
|
206
|
+
supplyLimitKey:
|
|
207
|
+
'0x61a2054eb37f543c0d774da57f2c9542aad8d79a197f748ac08ef5df6cc47028',
|
|
208
|
+
borrowLimitKey:
|
|
209
|
+
'0x4459498a043872cd107ea917493fee0baf2d37a273c7538e1d6581cc61b92af8',
|
|
210
|
+
isolatedAssetKey: undefined,
|
|
211
|
+
spool: '0xeedf438abcaa6ce4d9625ffca110920592d5867e4c5637d84ad9f466c4feb800',
|
|
212
|
+
spoolReward:
|
|
213
|
+
'0x89255a2f86ed7fbfef35ab8b7be48cc7667015975be2685dd9a55a9a64baf76e',
|
|
57
214
|
},
|
|
58
215
|
wsol: {
|
|
59
216
|
lendingPoolAddress:
|
|
60
217
|
'0x985682c42984cdfb03f9ff7d8923344c2fe096b1ae4b82ea17721af19d22a21f',
|
|
61
218
|
collateralPoolAddress:
|
|
62
219
|
'0xdc1cc2c371a043ae8e3c3fe2d013c35f1346960b7dbb4c072982c5b794ed144f',
|
|
220
|
+
borrowDynamic:
|
|
221
|
+
'0xe3f301e16d4f1273ea659dd82c5c3f124ca5a5883a5726c7ec0f77bf43b70895',
|
|
222
|
+
interestModel:
|
|
223
|
+
'0xd95affaee077006b8dbb4b108c1b087e95fc6e5143ef0682da345d5b35bc6356',
|
|
224
|
+
riskModel:
|
|
225
|
+
'0x8e0da6358073144ec3557400c87f04991ba3a13ca7e0d0a19daed45260b32f16',
|
|
226
|
+
borrowFeeKey:
|
|
227
|
+
'0x604bffbc817e8e12db15f2373a9e15b2c7adbc510649cdf2cc62a594af90671c',
|
|
228
|
+
supplyLimitKey:
|
|
229
|
+
'0xbd419b536b3f9c9d4adfc20372ca6feedc53cc31798ac860dbfc847bcf05f54b',
|
|
230
|
+
borrowLimitKey:
|
|
231
|
+
'0x77d453c51948f32564c810bc73f9ba7abde880657b7f89e1c8a3bc28fa36ee87',
|
|
232
|
+
isolatedAssetKey: undefined,
|
|
233
|
+
spool: undefined,
|
|
234
|
+
spoolReward: undefined,
|
|
63
235
|
},
|
|
64
236
|
cetus: {
|
|
65
237
|
lendingPoolAddress:
|
|
66
238
|
'0xc09858f60e74a1b671635bec4e8a2c84a0ff313eb87f525fba3258e88c6b6282',
|
|
67
239
|
collateralPoolAddress:
|
|
68
240
|
'0xe363967e29b7b9c1245d6d46d63e719de8f90b37e3358c545b55d945ea0b676a',
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
'
|
|
73
|
-
|
|
74
|
-
'
|
|
241
|
+
borrowDynamic:
|
|
242
|
+
'0xcc725fd5d71990cdccc7e16c88a2abde6dbcd0bf6e805ccc1c0cb83a106bbf4e',
|
|
243
|
+
interestModel:
|
|
244
|
+
'0x2f1258aab89d04d11834121599ab1317dfecb582b4246f106df399911125845a',
|
|
245
|
+
riskModel:
|
|
246
|
+
'0x03fed312dbba624dff5edaf4736891a1c7d864445fd268e7572b42ec7381132e',
|
|
247
|
+
borrowFeeKey:
|
|
248
|
+
'0xdf5fb0cc4ebbf5eebfae23dfa5b266f6a58c18a894a13054ae60c0eb6e79c382',
|
|
249
|
+
supplyLimitKey:
|
|
250
|
+
'0xa5ea3d4bf663d7bc667e82b40a98923590ff3851b9ea8e7afbc26c588c7007d3',
|
|
251
|
+
borrowLimitKey:
|
|
252
|
+
'0xf44218a5f0feb128e6fbe74b91d1e7e9ef859bd23a576ff0de151829e015a157',
|
|
253
|
+
isolatedAssetKey: undefined,
|
|
254
|
+
spool: '0xac1bb13bf4472a637c18c2415fb0e3c1227ea2bcf35242e50563c98215bd298e',
|
|
255
|
+
spoolReward:
|
|
256
|
+
'0x6835c1224126a45086fc6406adc249e3f30df18d779ca4f4e570e38716a17f3f',
|
|
75
257
|
},
|
|
76
258
|
hasui: {
|
|
77
259
|
lendingPoolAddress:
|
|
78
260
|
'0x7ebc607f6bdeb659fb6506cb91c5cc1d47bb365cfd5d2e637ea765346ec84ed4',
|
|
79
261
|
collateralPoolAddress:
|
|
80
262
|
'0xad9ed40d6486e4c26cec7370dffce8dc4821eb79178250b5938a34ccafd61e6d',
|
|
263
|
+
borrowDynamic:
|
|
264
|
+
'0x13ec1220b41c6e0f11dd6113199a2aff8e4cf2223047b5bd06d7a3ed5d23e1d2',
|
|
265
|
+
interestModel:
|
|
266
|
+
'0x987c58cbe48096618f4d9d83e0bde2ff638ce4753aba40dab7c302ac3e4b4519',
|
|
267
|
+
riskModel:
|
|
268
|
+
'0xe42d8497d423eca0d8df89850c2d77d3644e7f54a2d28f59c315903ea5ec8dec',
|
|
269
|
+
borrowFeeKey:
|
|
270
|
+
'0xef885c382d461c4fb14d1f3b3758c380c78a1a4b2a3d2fafe6e8649a60fdd7ab',
|
|
271
|
+
supplyLimitKey:
|
|
272
|
+
'0xc7385b1703693cbbc9c97227fe3fd5c91d7afda00e0da69d942c3260d78e45e0',
|
|
273
|
+
borrowLimitKey:
|
|
274
|
+
'0x65333e606eead786a999c8267bc9886b0fdbc298a8a8635a48a9c9b8838d9395',
|
|
275
|
+
isolatedAssetKey: undefined,
|
|
276
|
+
spool: '0xa6148bc1b623e936d39a952ceb5bea79e8b37228a8f595067bf1852efd3c34aa',
|
|
277
|
+
spoolReward:
|
|
278
|
+
'0x6f3563644d3e2ef13176dbf9d865bd93479df60ccbe07b7e66db57f6309f5a66',
|
|
81
279
|
},
|
|
82
280
|
vsui: {
|
|
83
281
|
lendingPoolAddress:
|
|
84
282
|
'0xda9257c0731d8822e8a438ebced13415850d705b779c79958dcf2aeb21fcb43d',
|
|
85
283
|
collateralPoolAddress:
|
|
86
284
|
'0x4435e8b8ec2a04094d863aa52deb6ab6f8f47ed8778f4d9f1b27afc4a6e85f1e',
|
|
285
|
+
borrowDynamic:
|
|
286
|
+
'0x8eae703505246f975e83f5af24780e5f1b89ef403d5a80ea15534624d6f1a503',
|
|
287
|
+
interestModel:
|
|
288
|
+
'0xaf6a52b5eaaa5af4d9e49d83de0d504c295ae21f3a37560c3f48e0e15a1d4625',
|
|
289
|
+
riskModel:
|
|
290
|
+
'0x1e862f27a6bd47c3041159a5cf392f549485c6605ed9aa937f16ecc951e82e65',
|
|
291
|
+
borrowFeeKey:
|
|
292
|
+
'0x5230de0f41a5e4c05b3d1187a90a9eeab491cec97b08b71512d9785e8af36aa6',
|
|
293
|
+
supplyLimitKey:
|
|
294
|
+
'0x1d40e34d1f365ec431fff020bd75c16b14b340b3ed6c139803cc15c2384621b2',
|
|
295
|
+
borrowLimitKey:
|
|
296
|
+
'0x4eb206b4417642cfc1b02f80bb5f5e366af2af2f9fb4ea4f4e898ae82367f8a0',
|
|
297
|
+
isolatedAssetKey: undefined,
|
|
298
|
+
spool: '0x69ce8e537e750a95381e6040794afa5ab1758353a1a2e1de7760391b01f91670',
|
|
299
|
+
spoolReward:
|
|
300
|
+
'0xbca914adce058ad0902c7f3cfcd698392a475f00dcfdc3f76001d0370b98777a',
|
|
87
301
|
},
|
|
88
302
|
sca: {
|
|
89
303
|
lendingPoolAddress:
|
|
90
304
|
'0x6fc7d4211fc7018b6c75e7b908b88f2e0536443239804a3d32af547637bd28d7',
|
|
91
305
|
collateralPoolAddress:
|
|
92
306
|
'0xff677a5d9e9dc8f08f0a8681ebfc7481d1c7d57bc441f2881974adcdd7b13c31',
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
'
|
|
307
|
+
borrowDynamic:
|
|
308
|
+
'0x4e24f52edd739dab59ca4c6353ca430b7ce57e7f333abd0957958570a7cd09ca',
|
|
309
|
+
interestModel:
|
|
310
|
+
'0xbdcd48cf5b1a814911dc2d5c72d393a980c87820199fe5d799289ce94f4c47df',
|
|
311
|
+
riskModel:
|
|
312
|
+
'0xc437c24b67b8e2676907700fa395af337ad6463d2c0b4f4fa2e9276414026089',
|
|
313
|
+
borrowFeeKey:
|
|
314
|
+
'0xee55ba0f9800a62d9e7aef667f87e658258f41814d2c9fa02e25590671b4e5ad',
|
|
315
|
+
supplyLimitKey:
|
|
316
|
+
'0x8dd938856b972a10ea27ecab2af7ed78e48fc5f6ccedaf2b2119959f747dc2e3',
|
|
317
|
+
borrowLimitKey:
|
|
318
|
+
'0x04c7de61c5b42972f9bf6a8b1848e5fea2d037ee8deba81741ecd4a70aa80d30',
|
|
319
|
+
isolatedAssetKey: undefined,
|
|
320
|
+
spool: undefined,
|
|
321
|
+
spoolReward: undefined,
|
|
97
322
|
},
|
|
98
323
|
deep: {
|
|
99
324
|
lendingPoolAddress:
|
|
100
325
|
'0xf4a67ffb43da1e1c61c049f188f19463ea8dbbf2d5ef4722d6df854ff1b1cc03',
|
|
326
|
+
collateralPoolAddress: undefined,
|
|
327
|
+
borrowDynamic:
|
|
328
|
+
'0x95e00d7466f97a100e70f08bd37788dc49335796f6f49fab996d40dd0681c6d3',
|
|
329
|
+
interestModel:
|
|
330
|
+
'0x4143c298506a332d92ea8a995e6f3991ee3215f58f6fc6441752835d275b9a69',
|
|
331
|
+
riskModel: undefined,
|
|
332
|
+
borrowFeeKey:
|
|
333
|
+
'0xb14ee43f4ad2a2c40bac8c4406a401690e93c982e289cf3802fedf74a159cab2',
|
|
334
|
+
supplyLimitKey:
|
|
335
|
+
'0x599528fdfdc253e90dfd0acf4f4a166b391e2aac1ca6528abbff63225b548fee',
|
|
336
|
+
borrowLimitKey:
|
|
337
|
+
'0xf4217e8ef9d9c32e8992092e910a77535a8124c19b8a762a673f227f5f765a4e',
|
|
338
|
+
isolatedAssetKey:
|
|
339
|
+
'0x208d3a24ba369dcfc8f0387333d1512b98199eb150d2f2a69359ff708cf761e3',
|
|
340
|
+
spool: undefined,
|
|
341
|
+
spoolReward: undefined,
|
|
342
|
+
},
|
|
343
|
+
fud: {
|
|
344
|
+
lendingPoolAddress:
|
|
345
|
+
'0xefed2cbe76b344792ac724523c8b2236740d1cea2100d46a0ed0dc760c7f4231',
|
|
346
|
+
collateralPoolAddress: undefined,
|
|
347
|
+
borrowDynamic:
|
|
348
|
+
'0x14367ddca30e2860cb89ed4eaca20c7ece260c5d59dd9990d2c85a8321326acb',
|
|
349
|
+
interestModel:
|
|
350
|
+
'0x2600ac100ef154eb2329ffd3aad47aca308ff9f9348de3e8e94aaeb906ec2303',
|
|
351
|
+
riskModel: undefined,
|
|
352
|
+
borrowFeeKey:
|
|
353
|
+
'0xa87e8b26e07ff35ac9fb57adcc779be2883080fc7d12de2d9e7e16d8d8d5e529',
|
|
354
|
+
supplyLimitKey:
|
|
355
|
+
'0xf98419aecc37a3c5de716f8ec590f8991a5be34da72ce1a2da09531ff45adf7d',
|
|
356
|
+
borrowLimitKey:
|
|
357
|
+
'0x3d928a001c453c50004baa54e14b0a0e1b0907d9c613dfd76064fd7ed4e8beb8',
|
|
358
|
+
isolatedAssetKey:
|
|
359
|
+
'0xfcb533e9e4e31f9c9f32d6cbf7fbb3425f1d60474e229a363a2dc7f835d587e2',
|
|
360
|
+
spool: undefined,
|
|
361
|
+
spoolReward: undefined,
|
|
101
362
|
},
|
|
102
363
|
};
|
|
@@ -34,11 +34,11 @@ export const queryKeys = {
|
|
|
34
34
|
typeArgs: !typeArgs ? undefined : JSON.stringify(typeArgs),
|
|
35
35
|
},
|
|
36
36
|
],
|
|
37
|
-
getObject: (
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
options
|
|
41
|
-
|
|
37
|
+
getObject: (objectId?: string, options?: SuiObjectDataOptions) => [
|
|
38
|
+
'rpc',
|
|
39
|
+
'getObject',
|
|
40
|
+
{ options, objectId },
|
|
41
|
+
],
|
|
42
42
|
getObjects: (
|
|
43
43
|
objectIds?: string[],
|
|
44
44
|
walletAddress?: string,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const DEFAULT_TOKENS_PER_INTERVAL =
|
|
2
|
-
export const DEFAULT_INTERVAL_IN_MS =
|
|
1
|
+
export const DEFAULT_TOKENS_PER_INTERVAL = 50;
|
|
2
|
+
export const DEFAULT_INTERVAL_IN_MS = 250;
|
|
@@ -106,6 +106,12 @@ export class ScallopCache {
|
|
|
106
106
|
);
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
+
private retryFn(errCount: number, e: any) {
|
|
110
|
+
if (errCount === 5) return false;
|
|
111
|
+
if (e.status === 429) return true;
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
|
|
109
115
|
/**
|
|
110
116
|
* @description Provides cache for inspectTxn of the SuiKit.
|
|
111
117
|
* @param QueryInspectTxnParams
|
|
@@ -119,10 +125,18 @@ export class ScallopCache {
|
|
|
119
125
|
}: QueryInspectTxnParams): Promise<DevInspectResults | null> {
|
|
120
126
|
const txBlock = new SuiTxBlock();
|
|
121
127
|
|
|
122
|
-
|
|
128
|
+
const resolvedArgs = await Promise.all(
|
|
129
|
+
args.map(async (arg) => {
|
|
130
|
+
if (typeof arg === 'string') {
|
|
131
|
+
return (await this.queryGetObject(arg))?.data;
|
|
132
|
+
}
|
|
133
|
+
return arg;
|
|
134
|
+
})
|
|
135
|
+
);
|
|
136
|
+
txBlock.moveCall(queryTarget, resolvedArgs, typeArgs);
|
|
123
137
|
|
|
124
138
|
const query = await this.queryClient.fetchQuery({
|
|
125
|
-
retry:
|
|
139
|
+
retry: this.retryFn,
|
|
126
140
|
retryDelay: 1000,
|
|
127
141
|
queryKey: queryKeys.rpc.getInspectTxn(queryTarget, args, typeArgs),
|
|
128
142
|
queryFn: async () => {
|
|
@@ -144,11 +158,11 @@ export class ScallopCache {
|
|
|
144
158
|
public async queryGetObject(
|
|
145
159
|
objectId: string,
|
|
146
160
|
options?: SuiObjectDataOptions
|
|
147
|
-
)
|
|
161
|
+
) {
|
|
148
162
|
return this.queryClient.fetchQuery({
|
|
149
|
-
retry:
|
|
163
|
+
retry: this.retryFn,
|
|
150
164
|
retryDelay: 1000,
|
|
151
|
-
queryKey: queryKeys.rpc.getObject(objectId,
|
|
165
|
+
queryKey: queryKeys.rpc.getObject(objectId, options),
|
|
152
166
|
queryFn: async () => {
|
|
153
167
|
return await callWithRateLimit(
|
|
154
168
|
this.tokenBucket,
|
|
@@ -177,7 +191,7 @@ export class ScallopCache {
|
|
|
177
191
|
// objectIds.sort();
|
|
178
192
|
|
|
179
193
|
return this.queryClient.fetchQuery({
|
|
180
|
-
retry:
|
|
194
|
+
retry: this.retryFn,
|
|
181
195
|
retryDelay: 1000,
|
|
182
196
|
queryKey: queryKeys.rpc.getObjects(
|
|
183
197
|
objectIds,
|
|
@@ -185,10 +199,28 @@ export class ScallopCache {
|
|
|
185
199
|
options
|
|
186
200
|
),
|
|
187
201
|
queryFn: async () => {
|
|
188
|
-
|
|
202
|
+
const results = await callWithRateLimit(
|
|
189
203
|
this.tokenBucket,
|
|
190
204
|
async () => await this.suiKit.getObjects(objectIds, options)
|
|
191
205
|
);
|
|
206
|
+
if (results) {
|
|
207
|
+
results.forEach((result) => {
|
|
208
|
+
this.queryClient.setQueriesData(
|
|
209
|
+
{
|
|
210
|
+
exact: false,
|
|
211
|
+
queryKey: queryKeys.rpc.getObject(result.objectId, options),
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
data: result,
|
|
215
|
+
error: null,
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
updatedAt: Date.now(),
|
|
219
|
+
}
|
|
220
|
+
);
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
return results;
|
|
192
224
|
},
|
|
193
225
|
});
|
|
194
226
|
}
|
|
@@ -200,7 +232,7 @@ export class ScallopCache {
|
|
|
200
232
|
*/
|
|
201
233
|
public async queryGetOwnedObjects(input: GetOwnedObjectsParams) {
|
|
202
234
|
return this.queryClient.fetchQuery({
|
|
203
|
-
retry:
|
|
235
|
+
retry: this.retryFn,
|
|
204
236
|
retryDelay: 1000,
|
|
205
237
|
queryKey: queryKeys.rpc.getOwnedObjects(input),
|
|
206
238
|
queryFn: async () => {
|
|
@@ -216,7 +248,7 @@ export class ScallopCache {
|
|
|
216
248
|
input: GetDynamicFieldsParams
|
|
217
249
|
): Promise<DynamicFieldPage | null> {
|
|
218
250
|
return this.queryClient.fetchQuery({
|
|
219
|
-
retry:
|
|
251
|
+
retry: this.retryFn,
|
|
220
252
|
retryDelay: 1000,
|
|
221
253
|
queryKey: queryKeys.rpc.getDynamicFields(input),
|
|
222
254
|
queryFn: async () => {
|
|
@@ -232,7 +264,7 @@ export class ScallopCache {
|
|
|
232
264
|
input: GetDynamicFieldObjectParams
|
|
233
265
|
): Promise<SuiObjectResponse | null> {
|
|
234
266
|
return this.queryClient.fetchQuery({
|
|
235
|
-
retry:
|
|
267
|
+
retry: this.retryFn,
|
|
236
268
|
retryDelay: (attemptIndex) => Math.min(1000 * attemptIndex, 8000),
|
|
237
269
|
queryKey: queryKeys.rpc.getDynamicFieldObject(input),
|
|
238
270
|
queryFn: async () => {
|
|
@@ -247,7 +279,7 @@ export class ScallopCache {
|
|
|
247
279
|
owner: string
|
|
248
280
|
): Promise<{ [k: string]: string }> {
|
|
249
281
|
return this.queryClient.fetchQuery({
|
|
250
|
-
retry:
|
|
282
|
+
retry: this.retryFn,
|
|
251
283
|
retryDelay: 1000,
|
|
252
284
|
queryKey: queryKeys.rpc.getAllCoinBalances(owner),
|
|
253
285
|
queryFn: async () => {
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
getStakeRewardPool,
|
|
15
15
|
getPythPrice,
|
|
16
16
|
getMarketPools,
|
|
17
|
-
getMarketPool,
|
|
17
|
+
// getMarketPool,
|
|
18
18
|
getMarketCollaterals,
|
|
19
19
|
getMarketCollateral,
|
|
20
20
|
getSpools,
|
|
@@ -41,13 +41,15 @@ import {
|
|
|
41
41
|
getBorrowIncentivePools,
|
|
42
42
|
getBorrowLimit,
|
|
43
43
|
getIsolatedAssets,
|
|
44
|
-
isIsolatedAsset,
|
|
44
|
+
// isIsolatedAsset,
|
|
45
45
|
getSupplyLimit,
|
|
46
46
|
getSCoinAmount,
|
|
47
47
|
getSCoinAmounts,
|
|
48
48
|
getSCoinSwapRate,
|
|
49
49
|
getSCoinTotalSupply,
|
|
50
50
|
getAllCoinPrices,
|
|
51
|
+
getAllAddresses,
|
|
52
|
+
isIsolatedAsset,
|
|
51
53
|
} from '../queries';
|
|
52
54
|
import {
|
|
53
55
|
ScallopQueryParams,
|
|
@@ -188,6 +190,7 @@ export class ScallopQuery {
|
|
|
188
190
|
/* ==================== Core Query Methods ==================== */
|
|
189
191
|
|
|
190
192
|
/**
|
|
193
|
+
* @deprecated use getMarketPools
|
|
191
194
|
* Query market data.
|
|
192
195
|
* @param indexer - Whether to use indexer.
|
|
193
196
|
* @return Market data.
|
|
@@ -211,7 +214,7 @@ export class ScallopQuery {
|
|
|
211
214
|
* @return Market pools data.
|
|
212
215
|
*/
|
|
213
216
|
public async getMarketPools(
|
|
214
|
-
poolCoinNames
|
|
217
|
+
poolCoinNames: SupportPoolCoins[] = [...SUPPORT_POOLS],
|
|
215
218
|
args?: {
|
|
216
219
|
coinPrices?: CoinPrices;
|
|
217
220
|
indexer?: boolean;
|
|
@@ -235,18 +238,19 @@ export class ScallopQuery {
|
|
|
235
238
|
public async getMarketPool(
|
|
236
239
|
poolCoinName: SupportPoolCoins,
|
|
237
240
|
args?: {
|
|
238
|
-
marketObject?: SuiObjectData | null;
|
|
239
241
|
coinPrice?: number;
|
|
240
242
|
indexer?: boolean;
|
|
241
243
|
}
|
|
242
244
|
) {
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
245
|
+
const marketPools = await this.getMarketPools(undefined, args);
|
|
246
|
+
return marketPools.pools[poolCoinName];
|
|
247
|
+
// return await getMarketPool(
|
|
248
|
+
// this,
|
|
249
|
+
// poolCoinName,
|
|
250
|
+
// args?.indexer,
|
|
251
|
+
// args?.marketObject,
|
|
252
|
+
// args?.coinPrice
|
|
253
|
+
// );
|
|
250
254
|
}
|
|
251
255
|
|
|
252
256
|
/**
|
|
@@ -812,7 +816,7 @@ export class ScallopQuery {
|
|
|
812
816
|
* Get list of isolated assets
|
|
813
817
|
*/
|
|
814
818
|
public async getIsolatedAssets() {
|
|
815
|
-
return await getIsolatedAssets(this
|
|
819
|
+
return await getIsolatedAssets(this);
|
|
816
820
|
}
|
|
817
821
|
|
|
818
822
|
/**
|
|
@@ -841,4 +845,12 @@ export class ScallopQuery {
|
|
|
841
845
|
}) {
|
|
842
846
|
return getAllCoinPrices(this, args?.marketPools, args?.coinPrices);
|
|
843
847
|
}
|
|
848
|
+
|
|
849
|
+
/**
|
|
850
|
+
* Query all address (lending pool, collateral pool, borrow dynamics, interest models) of all pool
|
|
851
|
+
* @returns
|
|
852
|
+
*/
|
|
853
|
+
public async getPoolAddresses() {
|
|
854
|
+
return getAllAddresses(this);
|
|
855
|
+
}
|
|
844
856
|
}
|
|
@@ -65,7 +65,7 @@ export const getBorrowIncentivePools = async (
|
|
|
65
65
|
const borrowIncentivePools: BorrowIncentivePools = {};
|
|
66
66
|
marketPools =
|
|
67
67
|
marketPools ??
|
|
68
|
-
(await query.getMarketPools(undefined, { coinPrices, indexer }));
|
|
68
|
+
(await query.getMarketPools(undefined, { coinPrices, indexer })).pools;
|
|
69
69
|
coinPrices = coinPrices ?? (await query.getAllCoinPrices({ marketPools }));
|
|
70
70
|
|
|
71
71
|
if (indexer) {
|