@scallop-io/sui-scallop-sdk 0.46.36 → 0.46.38

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.
Files changed (45) hide show
  1. package/dist/builders/loyaltyProgramBuilder.d.ts +12 -0
  2. package/dist/builders/referralBuilder.d.ts +1 -1
  3. package/dist/constants/testAddress.d.ts +2 -0
  4. package/dist/index.js +684 -172
  5. package/dist/index.js.map +1 -1
  6. package/dist/index.mjs +674 -162
  7. package/dist/index.mjs.map +1 -1
  8. package/dist/models/scallopQuery.d.ts +10 -3
  9. package/dist/models/scallopUtils.d.ts +1 -1
  10. package/dist/queries/index.d.ts +1 -0
  11. package/dist/queries/loyaltyProgramQuery.d.ts +10 -0
  12. package/dist/queries/vescaQuery.d.ts +8 -6
  13. package/dist/types/address.d.ts +6 -0
  14. package/dist/types/builder/index.d.ts +3 -1
  15. package/dist/types/builder/loyaltyProgram.d.ts +23 -0
  16. package/dist/types/builder/vesca.d.ts +16 -0
  17. package/dist/types/query/index.d.ts +1 -0
  18. package/dist/types/query/loyaltyProgram.d.ts +5 -0
  19. package/dist/types/query/vesca.d.ts +18 -0
  20. package/dist/utils/builder.d.ts +6 -5
  21. package/package.json +7 -6
  22. package/src/builders/index.ts +6 -1
  23. package/src/builders/loyaltyProgramBuilder.ts +115 -0
  24. package/src/builders/referralBuilder.ts +1 -1
  25. package/src/builders/vescaBuilder.ts +5 -1
  26. package/src/constants/testAddress.ts +383 -0
  27. package/src/models/scallopAddress.ts +12 -2
  28. package/src/models/scallopCache.ts +0 -1
  29. package/src/models/scallopQuery.ts +28 -16
  30. package/src/models/scallopUtils.ts +3 -3
  31. package/src/queries/borrowIncentiveQuery.ts +9 -8
  32. package/src/queries/coreQuery.ts +70 -66
  33. package/src/queries/index.ts +1 -0
  34. package/src/queries/loyaltyProgramQuery.ts +77 -0
  35. package/src/queries/portfolioQuery.ts +36 -28
  36. package/src/queries/vescaQuery.ts +70 -15
  37. package/src/types/address.ts +6 -0
  38. package/src/types/builder/index.ts +3 -0
  39. package/src/types/builder/loyaltyProgram.ts +35 -0
  40. package/src/types/builder/vesca.ts +16 -0
  41. package/src/types/query/index.ts +1 -0
  42. package/src/types/query/loyaltyProgram.ts +5 -0
  43. package/src/types/query/vesca.ts +21 -0
  44. package/src/utils/builder.ts +69 -53
  45. package/src/utils/query.ts +6 -5
@@ -0,0 +1,383 @@
1
+ import { AddressesInterface } from 'src/types';
2
+
3
+ export const TEST_ADDRESSES: AddressesInterface = {
4
+ core: {
5
+ version:
6
+ '0x07871c4b3c847a0f674510d4978d5cf6f960452795e8ff6f189fd2088a3f6ac7',
7
+ versionCap:
8
+ '0x590a4011cb649b3878f3ea14b3a78674642a9548d79b7e091ef679574b158a07',
9
+ object:
10
+ '0xefe8b36d5b2e43728cc323298626b83177803521d195cfb11e15b910e892fddf',
11
+ market:
12
+ '0xa757975255146dc9686aa823b7838b507f315d704f428cbadad2f4ea061939d9',
13
+ adminCap:
14
+ '0x09689d018e71c337d9db6d67cbca06b74ed92196103624028ccc3ecea411777c',
15
+ coinDecimalsRegistry:
16
+ '0x200abe9bf19751cc566ae35aa58e2b7e4ff688fc1130f8d8909ea09bc137d668',
17
+ obligationAccessStore:
18
+ '0x733e30b7c94d619d78cb8f5bc4bfbb759ced9a531239028caabb2474e5be59c9',
19
+ coins: {
20
+ cetus: {
21
+ id: '0x06864a6f921804860930db6ddbe2e16acdf8504495ea7481637a1c8b9a8fe54b',
22
+ metaData:
23
+ '0x4c0dce55eff2db5419bbd2d239d1aa22b4a400c01bbb648b058a9883989025da',
24
+ treasury: '',
25
+ oracle: {
26
+ supra: '',
27
+ switchboard: '',
28
+ pyth: {
29
+ feed: 'e5b274b2611143df055d6e7cd8d93fe1961716bcd4dca1cad87a83bc1e78c1ef',
30
+ feedObject:
31
+ '0x24c0247fb22457a719efac7f670cdc79be321b521460bd6bd2ccfa9f80713b14',
32
+ },
33
+ },
34
+ },
35
+ apt: {
36
+ id: '0x3a5143bb1196e3bcdfab6203d1683ae29edd26294fc8bfeafe4aaa9d2704df37',
37
+ metaData:
38
+ '0xc969c5251f372c0f34c32759f1d315cf1ea0ee5e4454b52aea08778eacfdd0a8',
39
+ treasury: '',
40
+ oracle: {
41
+ supra: '',
42
+ switchboard: '',
43
+ pyth: {
44
+ feed: '03ae4db29ed4ae33d323568895aa00337e658e348b37509f5372ae51f0af00d5',
45
+ feedObject:
46
+ '0x7c5b7837c44a69b469325463ac0673ac1aa8435ff44ddb4191c9ae380463647f',
47
+ },
48
+ },
49
+ },
50
+ sol: {
51
+ id: '0xb7844e289a8410e50fb3ca48d69eb9cf29e27d223ef90353fe1bd8e27ff8f3f8',
52
+ metaData:
53
+ '0x4d2c39082b4477e3e79dc4562d939147ab90c42fc5f3e4acf03b94383cd69b6e',
54
+ treasury: '',
55
+ oracle: {
56
+ supra: '',
57
+ switchboard: '',
58
+ pyth: {
59
+ feed: 'ef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d',
60
+ feedObject:
61
+ '0x9d0d275efbd37d8a8855f6f2c761fa5983293dd8ce202ee5196626de8fcd4469',
62
+ },
63
+ },
64
+ },
65
+ btc: {
66
+ id: '0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881',
67
+ metaData:
68
+ '0x5d3c6e60eeff8a05b693b481539e7847dfe33013e7070cdcb387f5c0cac05dfd',
69
+ treasury: '',
70
+ oracle: {
71
+ supra: '',
72
+ switchboard: '',
73
+ pyth: {
74
+ feed: 'e62df6c8b4a85fe1a67db44dc12de5db330f7ac66b72dc658afedf0f4a415b43',
75
+ feedObject:
76
+ '0x9a62b4863bdeaabdc9500fce769cf7e72d5585eeb28a6d26e4cafadc13f76ab2',
77
+ },
78
+ },
79
+ },
80
+ eth: {
81
+ id: '0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5',
82
+ metaData:
83
+ '0x8900e4ceede3363bef086d6b50ca89d816d0e90bf6bc46efefe1f8455e08f50f',
84
+ treasury: '',
85
+ oracle: {
86
+ supra: '',
87
+ switchboard: '',
88
+ pyth: {
89
+ feed: 'ff61491a931112ddf1bd8147cd1b641375f79f5825126d665480874634fd0ace',
90
+ feedObject:
91
+ '0x9193fd47f9a0ab99b6e365a464c8a9ae30e6150fc37ed2a89c1586631f6fc4ab',
92
+ },
93
+ },
94
+ },
95
+ usdc: {
96
+ id: '0x5d4b302506645c37ff133b98c4b50a5ae14841659738d6d733d59d0d217a93bf',
97
+ metaData:
98
+ '0x4fbf84f3029bd0c0b77164b587963be957f853eccf834a67bb9ecba6ec80f189',
99
+ treasury: '',
100
+ oracle: {
101
+ supra: '',
102
+ switchboard: '',
103
+ pyth: {
104
+ feed: 'eaa020c61cc479712813461ce153894a96a6c00b21ed0cfc2798d1f9a9e9c94a',
105
+ feedObject:
106
+ '0x5dec622733a204ca27f5a90d8c2fad453cc6665186fd5dff13a83d0b6c9027ab',
107
+ },
108
+ },
109
+ },
110
+ usdt: {
111
+ id: '0xc060006111016b8a020ad5b33834984a437aaa7d3c74c18e09a95d48aceab08c',
112
+ metaData:
113
+ '0xfb0e3eb97dd158a5ae979dddfa24348063843c5b20eb8381dd5fa7c93699e45c',
114
+ treasury: '',
115
+ oracle: {
116
+ supra: '',
117
+ switchboard: '',
118
+ pyth: {
119
+ feed: '2b89b9dc8fdf9f34709a5b106b472f0f39bb6ca9ce04b0fd7f2e971688e2e53b',
120
+ feedObject:
121
+ '0x985e3db9f93f76ee8bace7c3dd5cc676a096accd5d9e09e9ae0fb6e492b14572',
122
+ },
123
+ },
124
+ },
125
+ sui: {
126
+ id: '0x0000000000000000000000000000000000000000000000000000000000000002',
127
+ metaData:
128
+ '0x9258181f5ceac8dbffb7030890243caed69a9599d2886d957a9cb7656af3bdb3',
129
+ treasury: '',
130
+ oracle: {
131
+ supra: '',
132
+ switchboard:
133
+ '0xbca474133638352ba83ccf7b5c931d50f764b09550e16612c9f70f1e21f3f594',
134
+ pyth: {
135
+ feed: '23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744',
136
+ feedObject:
137
+ '0x801dbc2f0053d34734814b2d6df491ce7807a725fe9a01ad74a07e9c51396c37',
138
+ },
139
+ },
140
+ },
141
+ afsui: {
142
+ id: '0xf325ce1300e8dac124071d3152c5c5ee6174914f8bc2161e88329cf579246efc',
143
+ metaData:
144
+ '0x2f9217f533e51334873a39b8026a4aa6919497b47f49d0986a4f1aec66f8a34d',
145
+ treasury: '',
146
+ oracle: {
147
+ supra: '',
148
+ switchboard: '',
149
+ pyth: {
150
+ feed: '23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744',
151
+ feedObject:
152
+ '0x801dbc2f0053d34734814b2d6df491ce7807a725fe9a01ad74a07e9c51396c37',
153
+ },
154
+ },
155
+ },
156
+ hasui: {
157
+ id: '0xbde4ba4c2e274a60ce15c1cfff9e5c42e41654ac8b6d906a57efa4bd3c29f47d',
158
+ metaData:
159
+ '0x2c5f33af93f6511df699aaaa5822d823aac6ed99d4a0de2a4a50b3afa0172e24',
160
+ treasury: '',
161
+ oracle: {
162
+ supra: '',
163
+ switchboard: '',
164
+ pyth: {
165
+ feed: '23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744',
166
+ feedObject:
167
+ '0x801dbc2f0053d34734814b2d6df491ce7807a725fe9a01ad74a07e9c51396c37',
168
+ },
169
+ },
170
+ },
171
+ vsui: {
172
+ id: '0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55',
173
+ metaData:
174
+ '0xabd84a23467b33854ab25cf862006fd97479f8f6f53e50fe732c43a274d939bd',
175
+ treasury: '',
176
+ oracle: {
177
+ supra: '',
178
+ switchboard: '',
179
+ pyth: {
180
+ feed: '23d7315113f5b1d3ba7a83604c44b94d79f4fd69af77f804fc7f920a6dc65744',
181
+ feedObject:
182
+ '0x801dbc2f0053d34734814b2d6df491ce7807a725fe9a01ad74a07e9c51396c37',
183
+ },
184
+ },
185
+ },
186
+ sca: {
187
+ id: '0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6',
188
+ metaData:
189
+ '0x5d26a1e9a55c88147ac870bfa31b729d7f49f8804b8b3adfdf3582d301cca844',
190
+ treasury: '',
191
+ oracle: {
192
+ supra: '',
193
+ switchboard: '',
194
+ pyth: {
195
+ feed: '7e17f0ac105abe9214deb9944c30264f5986bf292869c6bd8e8da3ccd92d79bc',
196
+ feedObject:
197
+ '0xf6de1d3279a269a597d813cbaca59aa906543ab9a8c64e84a4722f1a20863985',
198
+ },
199
+ },
200
+ },
201
+ },
202
+ oracles: {
203
+ xOracle:
204
+ '0x93d5bf0936b71eb27255941e532fac33b5a5c7759e377b4923af0a1359ad494f',
205
+ xOracleCap:
206
+ '0x1edeae568fde99e090dbdec4bcdbd33a15f53a1ce1f87aeef1a560dedf4b4a90',
207
+ supra: { registry: '', registryCap: '', holder: '' },
208
+ switchboard: { registry: '', registryCap: '' },
209
+ pyth: {
210
+ registry:
211
+ '0xedc293f9413a5a7a5d53bdba1fd889d0a4030894469228f0acdae4aa3c55a213',
212
+ registryCap:
213
+ '0xbcb07141eb1f7e01fbda4130ecf5f5adaeabb77f5d9c32158b7532bcd2197acd',
214
+ state:
215
+ '0x1f9310238ee9298fb703c3419030b35b22bb1cc37113e3bb5007c99aec79e5b8',
216
+ wormhole:
217
+ '0x5306f64e312b581766351c07af79c72fcb1cd25147157fdc2f8ad76de9a3fb6a',
218
+ wormholeState:
219
+ '0xaeab97f96cf9877fee2883315d459552b2b921edc16d7ceac6eab944dd88919c',
220
+ },
221
+ },
222
+ packages: {
223
+ coinDecimalsRegistry: {
224
+ id: '0xca5a5a62f01c79a104bf4d31669e29daa387f325c241de4edbe30986a9bc8b0d',
225
+ upgradeCap:
226
+ '0x34e76a945d29f195bc53ca704fa70877d1cf3a5d7bbfdda1b13e633fff13c0f6',
227
+ },
228
+ math: {
229
+ id: '0xad013d5fde39e15eabda32b3dbdafd67dac32b798ce63237c27a8f73339b9b6f',
230
+ upgradeCap:
231
+ '0x3a329598231de02e6135c62284b66005b41cad1d9ab7ca2dc79c08293aba2ec6',
232
+ },
233
+ whitelist: {
234
+ id: '0x1318fdc90319ec9c24df1456d960a447521b0a658316155895014a6e39b5482f',
235
+ upgradeCap:
236
+ '0xf5a22aea23db664f7b69855b6a546747f17c1ec4230319cfc17225e462b05761',
237
+ },
238
+ x: {
239
+ id: '0x779b5c547976899f5474f3a5bc0db36ddf4697ad7e5a901db0415c2281d28162',
240
+ upgradeCap:
241
+ '0x3f203f6fff6a69d151e4f1cd931f22b68c489ef2759765662fc7baf673943c9e',
242
+ },
243
+ protocol: {
244
+ id: '0x6e641f0dca8aedab3101d047e96439178f16301bf0b57fe8745086ff1195eb3e',
245
+ upgradeCap:
246
+ '0x38527d154618d1fd5a644b90717fe07cf0e9f26b46b63e9568e611a3f86d5c1a',
247
+ },
248
+ protocolWhitelist: {
249
+ id: '0x4c262d9343dac53ecb28f482a2a3f62c73d0ebac5b5f03d57383d56ff219acdf',
250
+ upgradeCap:
251
+ '0x4a5e88a75039b00988f633f811f58117f31b8627a46bf822aa114d9010049449',
252
+ },
253
+ query: {
254
+ id: '0xb8d603a39114a5efef3dd0bf84df0bed1be1fbd39b78b7dd6e8a61ccc5e6006f',
255
+ upgradeCap:
256
+ '0x0d535c35f608b9b01b7ccce11acf43b1dd80c1b72bf8b541744a6e28e8d2745f',
257
+ },
258
+ supra: { id: '', upgradeCap: '' },
259
+ pyth: {
260
+ id: '0x910f30cbc7f601f75a5141a01265cd47c62d468707c5e1aecb32a18f448cb25a',
261
+ upgradeCap:
262
+ '0xdf0ffbae1ea5bb25fbca5efba433dcf00c7cced65679af2f04728901275c6157',
263
+ },
264
+ switchboard: { id: '', upgradeCap: '' },
265
+ xOracle: {
266
+ id: '0x1478a432123e4b3d61878b629f2c692969fdb375644f1251cd278a4b1e7d7cd6',
267
+ upgradeCap:
268
+ '0x0f928a6b2e26b73330fecaf9b44acfc9800a4a9794d6415c2a3153bc70e3c1f0',
269
+ },
270
+ testCoin: { id: '', upgradeCap: '' },
271
+ },
272
+ },
273
+ spool: {
274
+ id: '0x7c4fdabe81c31b19a45d1e572a52a539997a90903fbb5bfab71480abe0fa62c3',
275
+ adminCap:
276
+ '0xdd8a047cbbf802bfcde5288b8ef1910965d789cc614da11d39af05fca0bd020a',
277
+ object:
278
+ '0xe87f1b2d498106a2c61421cec75b7b5c5e348512b0dc263949a0e7a3c256571a',
279
+ pools: {
280
+ seth: {
281
+ id: '0xeec40beccb07c575bebd842eeaabb835f77cd3dab73add433477e57f583a6787',
282
+ rewardPoolId:
283
+ '0x957de68a18d87817de8309b30c1ec269a4d87ae513abbeed86b5619cb9ce1077',
284
+ },
285
+ ssui: {
286
+ id: '0x4f0ba970d3c11db05c8f40c64a15b6a33322db3702d634ced6536960ab6f3ee4',
287
+ rewardPoolId:
288
+ '0x162250ef72393a4ad3d46294c4e1bdfcb03f04c869d390e7efbfc995353a7ee9',
289
+ },
290
+ susdc: {
291
+ id: '0x4ace6648ddc64e646ba47a957c562c32c9599b3bba8f5ac1aadb2ae23a2f8ca0',
292
+ rewardPoolId:
293
+ '0xf4268cc9b9413b9bfe09e8966b8de650494c9e5784bf0930759cfef4904daff8',
294
+ },
295
+ susdt: {
296
+ id: '0xcb328f7ffa7f9342ed85af3fdb2f22919e1a06dfb2f713c04c73543870d7548f',
297
+ rewardPoolId:
298
+ '0x2c9f934d67a5baa586ceec2cc24163a2f049a6af3d5ba36b84d8ac40f25c4080',
299
+ },
300
+ scetus: {
301
+ id: '0xac1bb13bf4472a637c18c2415fb0e3c1227ea2bcf35242e50563c98215bd298e',
302
+ rewardPoolId:
303
+ '0x6835c1224126a45086fc6406adc249e3f30df18d779ca4f4e570e38716a17f3f',
304
+ },
305
+ safsui: {
306
+ id: '0xeedf438abcaa6ce4d9625ffca110920592d5867e4c5637d84ad9f466c4feb800',
307
+ rewardPoolId:
308
+ '0x89255a2f86ed7fbfef35ab8b7be48cc7667015975be2685dd9a55a9a64baf76e',
309
+ },
310
+ shasui: {
311
+ id: '0xa6148bc1b623e936d39a952ceb5bea79e8b37228a8f595067bf1852efd3c34aa',
312
+ rewardPoolId:
313
+ '0x6f3563644d3e2ef13176dbf9d865bd93479df60ccbe07b7e66db57f6309f5a66',
314
+ },
315
+ svsui: {
316
+ id: '0x69ce8e537e750a95381e6040794afa5ab1758353a1a2e1de7760391b01f91670',
317
+ rewardPoolId:
318
+ '0xbca914adce058ad0902c7f3cfcd698392a475f00dcfdc3f76001d0370b98777a',
319
+ },
320
+ },
321
+ config: '',
322
+ },
323
+ borrowIncentive: {
324
+ id: '0x6152f696fc3a658f33c4b891764731a59153125ffedfa8bff7167c42823f58a9',
325
+ adminCap:
326
+ '0xc486afa253646f4d381e81d7f1df8aa4723b845a6bb356f69bad635ffefffe2c',
327
+ object:
328
+ '0x002875153e09f8145ab63527bc85c00f2bd102e12f9573c47f8cdf1a1cb62934',
329
+ query: '0x529edc54a3dce2207703ceebbccb0ac14133f7825c1f528775ba0d85a4063489',
330
+ incentivePools:
331
+ '0x6547e143d406b5ccd5f46aae482497de279cc1a68c406f701df70a05f9212ab4',
332
+ incentiveAccounts:
333
+ '0xc4701fdbc1c92f9a636d334d66012b3027659e9fb8aff27279a82edfb6b77d02',
334
+ config:
335
+ '0xdf5d04b4691cc67e82fd4db8394d89ff44823a9de29716c924f74bb4f11cc1f7',
336
+ },
337
+ referral: {
338
+ id: '0xa3654ebb63eb06c0f4ff52f8aa6512df9f164f7772bdf15dac3709bd3798dda9',
339
+ object:
340
+ '0x5658d4bf5ddcba27e4337b4262108b3ad1716643cac8c2054ac341538adc72ec',
341
+ adminCap:
342
+ '0xc5dc06b9074291259f2cac460c940012c781c4430e42125c541cc43101c3bcbd',
343
+ referralBindings:
344
+ '0xf63299d58789d99de94092b9011323466e55ca0c1ea1a7a3786a589af46e1c09',
345
+ bindingTableId:
346
+ '0x1c8202b17267ec8d6cf97ca013615354181a04f179570e42601ff2dae19294b1',
347
+ referralRevenuePool:
348
+ '0x6abd852caf90769c1b185cdf636d841673fa95528f0550f018b8a138bd283c07',
349
+ revenueTableId:
350
+ '0x595baa3654c297bff84ab7786a2d250f019cefc66e8df8e89fd9d41e02bd30dd',
351
+ referralTiers:
352
+ '0x962cb903d8d7346190c5204785ccbb91b61086aa764f674c8145df82335cf83e',
353
+ tiersTableId:
354
+ '0xeac755a7a8b7798530905ac79e8c114f19d0f130f6eab012954f08faac29c75d',
355
+ authorizedWitnessList:
356
+ '0xf21b0ed043c9bb70842c0129159f4943dbcc3c9ef2f2f808af65f8be25cfd20e',
357
+ version:
358
+ '0x1bd4b7285f72e11c316b828c7c47b3f4da18dcec9f9b3dba6d8629cbb6f93e5e',
359
+ },
360
+ vesca: {
361
+ id: '0xb15b6e0cdd85afb5028bea851dd249405e734d800a259147bbc24980629723a4',
362
+ object:
363
+ '0xb15b6e0cdd85afb5028bea851dd249405e734d800a259147bbc24980629723a4',
364
+ adminCap:
365
+ '0x8ffa76135c5b85c5fbd73a6448a4a733d826cb63a267ab817656acb77c72d4a5',
366
+ tableId:
367
+ '0xe3153b2bf124be0b86cb8bd468346a861efd0da52fc42197b54d2f616488a311',
368
+ table: '0x611cb8d9d4d90867467b5ebdf4cc447a0047ed5b01334a28a29fcfe733e3d609',
369
+ treasury:
370
+ '0xe8c112c09b88158dc6c8e23d1fbae5b3c7136cdee54b7dafc08e65db28c4a5bc',
371
+ config:
372
+ '0xe0a2ff281e73c1d53cfa85807080f87e833e4f1a7f93dcf8800b3865269a76b9',
373
+ },
374
+ loyaltyProgram: {
375
+ id: '0xd17bcf8b5a59652c36225d478564a8593ae0ed7d650bcacdda1d6fe179127907',
376
+ object:
377
+ '0xd17bcf8b5a59652c36225d478564a8593ae0ed7d650bcacdda1d6fe179127907',
378
+ rewardPool:
379
+ '0xf9c090492ef476bd542109d0913ffe871cbfa28578b7114eca2a8c0e5671786f',
380
+ userRewardTableId:
381
+ '0x748a80395849ed37db1b0e14f2ab5d1d96458d2359ab3a84eb079d0f4ac7cf2e',
382
+ },
383
+ };
@@ -1,4 +1,4 @@
1
- import { API_BASE_URL } from '../constants';
1
+ import { API_BASE_URL, IS_VE_SCA_TEST } from '../constants';
2
2
  import type { NetworkType } from '@scallop-io/sui-kit';
3
3
  import type {
4
4
  ScallopAddressParams,
@@ -8,6 +8,7 @@ import type {
8
8
  import { ScallopCache } from './scallopCache';
9
9
  import { DEFAULT_CACHE_OPTIONS } from 'src/constants/cache';
10
10
  import axios, { AxiosInstance } from 'axios';
11
+ import { TEST_ADDRESSES } from 'src/constants/testAddress';
11
12
 
12
13
  const EMPTY_ADDRESSES: AddressesInterface = {
13
14
  core: {
@@ -302,6 +303,12 @@ const EMPTY_ADDRESSES: AddressesInterface = {
302
303
  tiersTableId: '',
303
304
  authorizedWitnessList: '',
304
305
  },
306
+ loyaltyProgram: {
307
+ id: '',
308
+ object: '',
309
+ rewardPool: '',
310
+ userRewardTableId: '',
311
+ },
305
312
  };
306
313
  /**
307
314
  * @description
@@ -338,7 +345,10 @@ export class ScallopAddress {
338
345
  if (auth) this._auth = auth;
339
346
  this._id = id;
340
347
  this._network = network || 'mainnet';
341
- this._addressesMap = new Map();
348
+ this._addressesMap = IS_VE_SCA_TEST
349
+ ? new Map([['mainnet', TEST_ADDRESSES]])
350
+ : new Map();
351
+ if (IS_VE_SCA_TEST) this._currentAddresses = TEST_ADDRESSES;
342
352
  }
343
353
 
344
354
  /**
@@ -124,7 +124,6 @@ export class ScallopCache {
124
124
  queryFn: async () => {
125
125
  return await this.suiKit.inspectTxn(txBytes);
126
126
  },
127
- staleTime: 8000, // make stale time longer for inspectTxn results
128
127
  });
129
128
  return query;
130
129
  }
@@ -30,7 +30,8 @@ import {
30
30
  getBindedVeScaKey,
31
31
  getVeScas,
32
32
  getPythPrices,
33
- getTotalVeScaTreasuryAmount,
33
+ getVeScaTreasuryInfo,
34
+ getLoyaltyProgramInformations,
34
35
  } from '../queries';
35
36
  import {
36
37
  ScallopQueryParams,
@@ -49,6 +50,7 @@ import { ScallopUtils } from './scallopUtils';
49
50
  import { ScallopIndexer } from './scallopIndexer';
50
51
  import { ScallopCache } from './scallopCache';
51
52
  import { DEFAULT_CACHE_OPTIONS } from 'src/constants/cache';
53
+ import { SuiObjectData } from '@mysten/sui.js/src/client';
52
54
 
53
55
  /**
54
56
  * @description
@@ -394,17 +396,18 @@ export class ScallopQuery {
394
396
  ) {
395
397
  stakeMarketCoinNames = stakeMarketCoinNames ?? [...SUPPORT_SPOOLS];
396
398
  const stakeRewardPools: StakeRewardPools = {};
397
- for (const stakeMarketCoinName of stakeMarketCoinNames) {
398
- const stakeRewardPool = await getStakeRewardPool(
399
- this,
400
- stakeMarketCoinName
401
- );
402
-
403
- if (stakeRewardPool) {
404
- stakeRewardPools[stakeMarketCoinName] = stakeRewardPool;
405
- }
406
- }
407
-
399
+ await Promise.allSettled(
400
+ stakeMarketCoinNames.map(async (stakeMarketCoinName) => {
401
+ const stakeRewardPool = await getStakeRewardPool(
402
+ this,
403
+ stakeMarketCoinName
404
+ );
405
+
406
+ if (stakeRewardPool) {
407
+ stakeRewardPools[stakeMarketCoinName] = stakeRewardPool;
408
+ }
409
+ })
410
+ );
408
411
  return stakeRewardPools;
409
412
  }
410
413
 
@@ -543,7 +546,7 @@ export class ScallopQuery {
543
546
  * @param walletAddress
544
547
  * @returns array of veSca
545
548
  */
546
- public async getVeScas(walletAddress: string) {
549
+ public async getVeScas(walletAddress?: string) {
547
550
  return await getVeScas(this, walletAddress);
548
551
  }
549
552
 
@@ -551,12 +554,12 @@ export class ScallopQuery {
551
554
  * Get total vesca treasury with movecall
552
555
  * @returns Promise<string | undefined>
553
556
  */
554
- public async getTotalVeScaTreasuryAmount() {
555
- return await getTotalVeScaTreasuryAmount(this);
557
+ public async getVeScaTreasuryInfo() {
558
+ return await getVeScaTreasuryInfo(this);
556
559
  }
557
560
 
558
561
  /**
559
- * Return binded veScaKeyId of walletAddress if exist
562
+ * Return binded referrer veScaKeyId of referee walletAddress if exist
560
563
  * @param walletAddress
561
564
  * @returns veScaKeyId
562
565
  */
@@ -581,4 +584,13 @@ export class ScallopQuery {
581
584
  public async getBindedVeScaKey(obligationId: string) {
582
585
  return await getBindedVeScaKey(this, obligationId);
583
586
  }
587
+
588
+ /**
589
+ * Get user's veSCA loyalty program informations
590
+ * @param walletAddress
591
+ * @returns Loyalty program information
592
+ */
593
+ public async getLoyaltyProgramInfos(veScaKey?: string | SuiObjectData) {
594
+ return await getLoyaltyProgramInformations(this, veScaKey);
595
+ }
584
596
  }
@@ -513,11 +513,11 @@ export class ScallopUtils {
513
513
  */
514
514
  public getUnlockAt(
515
515
  extendLockPeriodInDay?: number,
516
- unlockAtInSecondTimestamp?: number
516
+ unlockAtInMillisTimestamp?: number
517
517
  ) {
518
518
  const now = Math.floor(new Date().getTime() / 1000);
519
- const remainingLockPeriod = unlockAtInSecondTimestamp
520
- ? Math.max(unlockAtInSecondTimestamp - now, 0)
519
+ const remainingLockPeriod = unlockAtInMillisTimestamp
520
+ ? Math.max(Math.floor(unlockAtInMillisTimestamp / 1000) - now, 0)
521
521
  : 0;
522
522
 
523
523
  let newUnlockAtInSecondTimestamp = 0;
@@ -37,14 +37,6 @@ export const queryBorrowIncentivePools = async (
37
37
  borrowIncentiveCoinNames = borrowIncentiveCoinNames || [
38
38
  ...SUPPORT_BORROW_INCENTIVE_POOLS,
39
39
  ];
40
- const queryPkgId = query.address.get('borrowIncentive.query');
41
- const incentivePoolsId = query.address.get('borrowIncentive.incentivePools');
42
-
43
- const queryTarget = `${queryPkgId}::incentive_pools_query::incentive_pools_data`;
44
- const args = [incentivePoolsId];
45
- const queryResult = await query.cache.queryInspectTxn({ queryTarget, args });
46
- const borrowIncentivePoolsQueryData = queryResult.events[0]
47
- .parsedJson as BorrowIncentivePoolsQueryInterface;
48
40
 
49
41
  const borrowIncentivePools: BorrowIncentivePools = {};
50
42
 
@@ -75,6 +67,15 @@ export const queryBorrowIncentivePools = async (
75
67
  return borrowIncentivePools;
76
68
  }
77
69
 
70
+ const queryPkgId = query.address.get('borrowIncentive.query');
71
+ const incentivePoolsId = query.address.get('borrowIncentive.incentivePools');
72
+
73
+ const queryTarget = `${queryPkgId}::incentive_pools_query::incentive_pools_data`;
74
+ const args = [incentivePoolsId];
75
+ const queryResult = await query.cache.queryInspectTxn({ queryTarget, args });
76
+ const borrowIncentivePoolsQueryData = queryResult.events[0]
77
+ .parsedJson as BorrowIncentivePoolsQueryInterface;
78
+
78
79
  for (const pool of borrowIncentivePoolsQueryData.incentive_pools) {
79
80
  const borrowIncentivePoolPoints: OptionalKeys<
80
81
  Record<SupportBorrowIncentiveRewardCoins, BorrowIncentivePoolPoints>