@scallop-io/sui-scallop-sdk 1.4.15-rc.1 → 1.4.15-rc.3
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 +2 -0
- package/dist/constants/tokenBucket.d.ts +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +327 -194
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +325 -194
- package/dist/index.mjs.map +1 -1
- package/dist/models/scallopQuery.d.ts +5 -2
- package/dist/queries/poolAddressesQuery.d.ts +3 -0
- package/dist/queries/spoolQuery.d.ts +6 -2
- package/dist/test.d.ts +1 -0
- package/dist/types/builder/core.d.ts +3 -3
- package/dist/types/query/spool.d.ts +20 -0
- package/dist/utils/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/builders/coreBuilder.ts +1 -1
- package/src/constants/poolAddress.ts +136 -71
- package/src/constants/tokenBucket.ts +1 -1
- package/src/index.ts +1 -0
- package/src/models/scallopCache.ts +50 -2
- package/src/models/scallopClient.ts +1 -0
- package/src/models/scallopQuery.ts +12 -16
- package/src/queries/coreQuery.ts +30 -10
- package/src/queries/poolAddressesQuery.ts +14 -2
- package/src/queries/portfolioQuery.ts +1 -1
- package/src/queries/spoolQuery.ts +186 -121
- package/src/test.ts +17 -0
- package/src/types/builder/core.ts +3 -2
- package/src/types/query/spool.ts +21 -0
- package/src/utils/core.ts +11 -4
- package/src/utils/index.ts +1 -0
package/dist/index.mjs
CHANGED
|
@@ -328,6 +328,21 @@ var FlashLoanFeeObjectMap = {
|
|
|
328
328
|
|
|
329
329
|
// src/constants/poolAddress.ts
|
|
330
330
|
var POOL_ADDRESSES = {
|
|
331
|
+
usdc: {
|
|
332
|
+
lendingPoolAddress: "0xd3be98bf540f7603eeb550c0c0a19dbfc78822f25158b5fa84ebd9609def415f",
|
|
333
|
+
collateralPoolAddress: "0x8f0d529ba179c5b3d508213003eab813aaae31f78226099639b9a69d1aec17af",
|
|
334
|
+
borrowDynamic: "0x77837ecd4f26fac9a410fff594f2c0bd3288904a15492ca77cb8a52684dbb866",
|
|
335
|
+
interestModel: "0xaae3f179d63009380cbdcb9acb12907afc9c3cb79cc3460be296a9c6d28f3ff3",
|
|
336
|
+
riskModel: "0x198b24db213bfeb8b3c80ae63dde92e32fd24984d25da8233ff777b851edd574",
|
|
337
|
+
borrowFeeKey: "0xd37c5316cfe0a5967d14264fa6b423f880518b294a1ee6581ccbb49ccc401fb8",
|
|
338
|
+
supplyLimitKey: "0x4be9ae54ac4d320f4f9c14cae78cb85c8e0e67791dd9bdba6d2db20614a28a24",
|
|
339
|
+
borrowLimitKey: "0x6b01093cba95b835181f00e3a2c31ed8dfc8d64fe3db0fb80933a09f66e1ccf1",
|
|
340
|
+
isolatedAssetKey: void 0,
|
|
341
|
+
spool: "0x0b5f5f413bd3799e4052c37311966c77f3a4545eb125d2e93e67a68478021918",
|
|
342
|
+
spoolReward: "0x85ed6ed72ea97c35dbf0cdc7ed6fbc48d8ec15de9b17c74bf4512df8a6d7f166",
|
|
343
|
+
sCoinTreasury: "0xbe6b63021f3d82e0e7e977cdd718ed7c019cf2eba374b7b546220402452f938e",
|
|
344
|
+
coinDecimalId: "0x69b7a7c3c200439c1b5f3b19d7d495d5966d5f08de66c69276152f8db3992ec6"
|
|
345
|
+
},
|
|
331
346
|
sbeth: {
|
|
332
347
|
lendingPoolAddress: "0xaa34c938e0394e5186c7dc626ad69be96af2194b23fdc6ac1c63090e399f5ba4",
|
|
333
348
|
collateralPoolAddress: "0xce0549a1cbe952e734f56646988e6b02bbae14667889a60e24d0d03540a6119f",
|
|
@@ -339,20 +354,24 @@ var POOL_ADDRESSES = {
|
|
|
339
354
|
borrowLimitKey: "0x165c274c67eda2b0d13563124741fffd0ce7d643f4c1c4b59d7e53a83796ae25",
|
|
340
355
|
isolatedAssetKey: void 0,
|
|
341
356
|
spool: void 0,
|
|
342
|
-
spoolReward: void 0
|
|
357
|
+
spoolReward: void 0,
|
|
358
|
+
sCoinTreasury: "0xfd0f02def6358a1f266acfa1493d4707ee8387460d434fb667d63d755ff907ed",
|
|
359
|
+
coinDecimalId: "0x89b04ba87f8832d4d76e17a1c9dce72eb3e64d372cf02012b8d2de5384faeef0"
|
|
343
360
|
},
|
|
344
|
-
|
|
345
|
-
lendingPoolAddress: "
|
|
346
|
-
collateralPoolAddress: "
|
|
347
|
-
borrowDynamic: "
|
|
348
|
-
interestModel: "
|
|
349
|
-
riskModel: "
|
|
350
|
-
borrowFeeKey: "
|
|
351
|
-
supplyLimitKey: "
|
|
352
|
-
borrowLimitKey: "
|
|
361
|
+
weth: {
|
|
362
|
+
lendingPoolAddress: "0xc8fcdff48efc265740ae0b74aae3faccae9ec00034039a113f3339798035108c",
|
|
363
|
+
collateralPoolAddress: "0xad7ced91ed6e7f2b81805561eee27fa6f3e72fdae561077334c7248583db4dbf",
|
|
364
|
+
borrowDynamic: "0xd1578e1d1c9c82eb4c5bf14beece8142a67a683b2647d7276e92984119fc1445",
|
|
365
|
+
interestModel: "0xa1dc08541cd2cb7cfb4e56272292d5c6a4780e80fd210c58abffae98268b5ed9",
|
|
366
|
+
riskModel: "0x9f05a25fd33a9e8cf33962126b175d038e184f0ee1b87dc41d4cedbe6abebbe5",
|
|
367
|
+
borrowFeeKey: "0x29672ba8ab4625b8181d8ed739e5344de22a97d417748c4d1276c7379283d7a3",
|
|
368
|
+
supplyLimitKey: "0x2b957941bdc9432bbc83ab74dc194b6ebb7c927bc4c6926a5492b5503499e509",
|
|
369
|
+
borrowLimitKey: "0x51f256d87e51a7ca2b1c482923096f4b6dac6beac89d8ecf4c65b7d5764115d6",
|
|
353
370
|
isolatedAssetKey: void 0,
|
|
354
|
-
spool: "
|
|
355
|
-
spoolReward: "
|
|
371
|
+
spool: "0xeec40beccb07c575bebd842eeaabb835f77cd3dab73add433477e57f583a6787",
|
|
372
|
+
spoolReward: "0x957de68a18d87817de8309b30c1ec269a4d87ae513abbeed86b5619cb9ce1077",
|
|
373
|
+
sCoinTreasury: "0x4b7f5da0e306c9d52490a0c1d4091e653d6b89778b9b4f23c877e534e4d9cd21",
|
|
374
|
+
coinDecimalId: "0x8900e4ceede3363bef086d6b50ca89d816d0e90bf6bc46efefe1f8455e08f50f"
|
|
356
375
|
},
|
|
357
376
|
wbtc: {
|
|
358
377
|
lendingPoolAddress: "0x65cc08a5aca0a0b8d72e1993ded8d145f06dd102fd0d8f285b92934faed564ab",
|
|
@@ -365,7 +384,9 @@ var POOL_ADDRESSES = {
|
|
|
365
384
|
borrowLimitKey: "0x231e13ba6b1eb26c562f4a125778d3152f9a77e31f124bd6012e234a73012169",
|
|
366
385
|
isolatedAssetKey: void 0,
|
|
367
386
|
spool: void 0,
|
|
368
|
-
spoolReward: void 0
|
|
387
|
+
spoolReward: void 0,
|
|
388
|
+
sCoinTreasury: "0xe2883934ea42c99bc998bbe0f01dd6d27aa0e27a56455707b1b34e6a41c20baa",
|
|
389
|
+
coinDecimalId: "0x5d3c6e60eeff8a05b693b481539e7847dfe33013e7070cdcb387f5c0cac05dfd"
|
|
369
390
|
},
|
|
370
391
|
wusdc: {
|
|
371
392
|
lendingPoolAddress: "0x2f4df5e1368fbbdaa5c712d28b837b3d41c2d3872979ccededcdfdac55ff8a93",
|
|
@@ -378,20 +399,9 @@ var POOL_ADDRESSES = {
|
|
|
378
399
|
borrowLimitKey: "0x97f1502ce994db0bcb15aac1760d174def9e88e97cd2262eed54521ee2c19f81",
|
|
379
400
|
isolatedAssetKey: void 0,
|
|
380
401
|
spool: "0x4ace6648ddc64e646ba47a957c562c32c9599b3bba8f5ac1aadb2ae23a2f8ca0",
|
|
381
|
-
spoolReward: "0xf4268cc9b9413b9bfe09e8966b8de650494c9e5784bf0930759cfef4904daff8"
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
lendingPoolAddress: "0xc8fcdff48efc265740ae0b74aae3faccae9ec00034039a113f3339798035108c",
|
|
385
|
-
collateralPoolAddress: "0xad7ced91ed6e7f2b81805561eee27fa6f3e72fdae561077334c7248583db4dbf",
|
|
386
|
-
borrowDynamic: "0xd1578e1d1c9c82eb4c5bf14beece8142a67a683b2647d7276e92984119fc1445",
|
|
387
|
-
interestModel: "0xa1dc08541cd2cb7cfb4e56272292d5c6a4780e80fd210c58abffae98268b5ed9",
|
|
388
|
-
riskModel: "0x9f05a25fd33a9e8cf33962126b175d038e184f0ee1b87dc41d4cedbe6abebbe5",
|
|
389
|
-
borrowFeeKey: "0x29672ba8ab4625b8181d8ed739e5344de22a97d417748c4d1276c7379283d7a3",
|
|
390
|
-
supplyLimitKey: "0x2b957941bdc9432bbc83ab74dc194b6ebb7c927bc4c6926a5492b5503499e509",
|
|
391
|
-
borrowLimitKey: "0x51f256d87e51a7ca2b1c482923096f4b6dac6beac89d8ecf4c65b7d5764115d6",
|
|
392
|
-
isolatedAssetKey: void 0,
|
|
393
|
-
spool: "0xeec40beccb07c575bebd842eeaabb835f77cd3dab73add433477e57f583a6787",
|
|
394
|
-
spoolReward: "0x957de68a18d87817de8309b30c1ec269a4d87ae513abbeed86b5619cb9ce1077"
|
|
402
|
+
spoolReward: "0xf4268cc9b9413b9bfe09e8966b8de650494c9e5784bf0930759cfef4904daff8",
|
|
403
|
+
sCoinTreasury: "0x50c5cfcbcca3aaacab0984e4d7ad9a6ad034265bebb440f0d1cd688ec20b2548",
|
|
404
|
+
coinDecimalId: "0x4fbf84f3029bd0c0b77164b587963be957f853eccf834a67bb9ecba6ec80f189"
|
|
395
405
|
},
|
|
396
406
|
wusdt: {
|
|
397
407
|
lendingPoolAddress: "0xfbc056f126dd35adc1f8fe985e2cedc8010e687e8e851e1c5b99fdf63cd1c879",
|
|
@@ -404,7 +414,9 @@ var POOL_ADDRESSES = {
|
|
|
404
414
|
borrowLimitKey: "0xa3278564fc613680a69c10972a0299965bf6e12e9ac171388842fc958de0f90e",
|
|
405
415
|
isolatedAssetKey: void 0,
|
|
406
416
|
spool: "0xcb328f7ffa7f9342ed85af3fdb2f22919e1a06dfb2f713c04c73543870d7548f",
|
|
407
|
-
spoolReward: "0x2c9f934d67a5baa586ceec2cc24163a2f049a6af3d5ba36b84d8ac40f25c4080"
|
|
417
|
+
spoolReward: "0x2c9f934d67a5baa586ceec2cc24163a2f049a6af3d5ba36b84d8ac40f25c4080",
|
|
418
|
+
sCoinTreasury: "0x1f02e2fed702b477732d4ad6044aaed04f2e8e586a169153694861a901379df0",
|
|
419
|
+
coinDecimalId: "0xfb0e3eb97dd158a5ae979dddfa24348063843c5b20eb8381dd5fa7c93699e45c"
|
|
408
420
|
},
|
|
409
421
|
sui: {
|
|
410
422
|
lendingPoolAddress: "0x9c9077abf7a29eebce41e33addbcd6f5246a5221dd733e56ea0f00ae1b25c9e8",
|
|
@@ -417,7 +429,9 @@ var POOL_ADDRESSES = {
|
|
|
417
429
|
borrowLimitKey: "0x2b33a7efdcf6a6df24f4d8a356dd52f58d75bc023c3f171d99502d4d008b53f0",
|
|
418
430
|
isolatedAssetKey: void 0,
|
|
419
431
|
spool: "0x4f0ba970d3c11db05c8f40c64a15b6a33322db3702d634ced6536960ab6f3ee4",
|
|
420
|
-
spoolReward: "0x162250ef72393a4ad3d46294c4e1bdfcb03f04c869d390e7efbfc995353a7ee9"
|
|
432
|
+
spoolReward: "0x162250ef72393a4ad3d46294c4e1bdfcb03f04c869d390e7efbfc995353a7ee9",
|
|
433
|
+
sCoinTreasury: "0x5c1678c8261ac9eec024d4d630006a9f55c80dc0b1aa38a003fcb1d425818c6b",
|
|
434
|
+
coinDecimalId: "0x9258181f5ceac8dbffb7030890243caed69a9599d2886d957a9cb7656af3bdb3"
|
|
421
435
|
},
|
|
422
436
|
wapt: {
|
|
423
437
|
lendingPoolAddress: "0xca8c14a24e0c32b198eaf479a3317461e3cc339097ce88eaf296a15df8dcfdf5",
|
|
@@ -430,20 +444,9 @@ var POOL_ADDRESSES = {
|
|
|
430
444
|
borrowLimitKey: void 0,
|
|
431
445
|
isolatedAssetKey: void 0,
|
|
432
446
|
spool: void 0,
|
|
433
|
-
spoolReward: void 0
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
lendingPoolAddress: "0x9b942a24ce390b7f5016d34a0217057bf9487b92aa6d7cc9894271dbbe62471a",
|
|
437
|
-
collateralPoolAddress: "0xe5e56f5c0e3072760b21f9d49a5cc793f37d736c412a9065c16e1265c74e6341",
|
|
438
|
-
borrowDynamic: "0x1c76d4df9506154a117bbac0f5e005d8a9c0d9ca60e3fe0c9d080006f6f54e81",
|
|
439
|
-
interestModel: "0xb155c536b37c9601baaa734ad1dd0ef335b2b597aceb8d3ecee41a43f94dcd70",
|
|
440
|
-
riskModel: "0x75371b1d04b5bebc0738af548ba64ea658e74f78228ec8014336d8eebb992312",
|
|
441
|
-
borrowFeeKey: "0xabc6422db2d4ee01635ddaeaa44ba68370eebd785d2c4632515f841ae9bc47d9",
|
|
442
|
-
supplyLimitKey: "0x61a2054eb37f543c0d774da57f2c9542aad8d79a197f748ac08ef5df6cc47028",
|
|
443
|
-
borrowLimitKey: "0x4459498a043872cd107ea917493fee0baf2d37a273c7538e1d6581cc61b92af8",
|
|
444
|
-
isolatedAssetKey: void 0,
|
|
445
|
-
spool: "0xeedf438abcaa6ce4d9625ffca110920592d5867e4c5637d84ad9f466c4feb800",
|
|
446
|
-
spoolReward: "0x89255a2f86ed7fbfef35ab8b7be48cc7667015975be2685dd9a55a9a64baf76e"
|
|
447
|
+
spoolReward: void 0,
|
|
448
|
+
sCoinTreasury: void 0,
|
|
449
|
+
coinDecimalId: "0xc969c5251f372c0f34c32759f1d315cf1ea0ee5e4454b52aea08778eacfdd0a8"
|
|
447
450
|
},
|
|
448
451
|
wsol: {
|
|
449
452
|
lendingPoolAddress: "0x985682c42984cdfb03f9ff7d8923344c2fe096b1ae4b82ea17721af19d22a21f",
|
|
@@ -456,7 +459,9 @@ var POOL_ADDRESSES = {
|
|
|
456
459
|
borrowLimitKey: "0x77d453c51948f32564c810bc73f9ba7abde880657b7f89e1c8a3bc28fa36ee87",
|
|
457
460
|
isolatedAssetKey: void 0,
|
|
458
461
|
spool: void 0,
|
|
459
|
-
spoolReward: void 0
|
|
462
|
+
spoolReward: void 0,
|
|
463
|
+
sCoinTreasury: "0x760fd66f5be869af4382fa32b812b3c67f0eca1bb1ed7a5578b21d56e1848819",
|
|
464
|
+
coinDecimalId: "0x4d2c39082b4477e3e79dc4562d939147ab90c42fc5f3e4acf03b94383cd69b6e"
|
|
460
465
|
},
|
|
461
466
|
cetus: {
|
|
462
467
|
lendingPoolAddress: "0xc09858f60e74a1b671635bec4e8a2c84a0ff313eb87f525fba3258e88c6b6282",
|
|
@@ -469,7 +474,24 @@ var POOL_ADDRESSES = {
|
|
|
469
474
|
borrowLimitKey: "0xf44218a5f0feb128e6fbe74b91d1e7e9ef859bd23a576ff0de151829e015a157",
|
|
470
475
|
isolatedAssetKey: void 0,
|
|
471
476
|
spool: "0xac1bb13bf4472a637c18c2415fb0e3c1227ea2bcf35242e50563c98215bd298e",
|
|
472
|
-
spoolReward: "0x6835c1224126a45086fc6406adc249e3f30df18d779ca4f4e570e38716a17f3f"
|
|
477
|
+
spoolReward: "0x6835c1224126a45086fc6406adc249e3f30df18d779ca4f4e570e38716a17f3f",
|
|
478
|
+
sCoinTreasury: "0xa283c63488773c916cb3d6c64109536160d5eb496caddc721eb39aad2977d735",
|
|
479
|
+
coinDecimalId: "0x4c0dce55eff2db5419bbd2d239d1aa22b4a400c01bbb648b058a9883989025da"
|
|
480
|
+
},
|
|
481
|
+
afsui: {
|
|
482
|
+
lendingPoolAddress: "0x9b942a24ce390b7f5016d34a0217057bf9487b92aa6d7cc9894271dbbe62471a",
|
|
483
|
+
collateralPoolAddress: "0xe5e56f5c0e3072760b21f9d49a5cc793f37d736c412a9065c16e1265c74e6341",
|
|
484
|
+
borrowDynamic: "0x1c76d4df9506154a117bbac0f5e005d8a9c0d9ca60e3fe0c9d080006f6f54e81",
|
|
485
|
+
interestModel: "0xb155c536b37c9601baaa734ad1dd0ef335b2b597aceb8d3ecee41a43f94dcd70",
|
|
486
|
+
riskModel: "0x75371b1d04b5bebc0738af548ba64ea658e74f78228ec8014336d8eebb992312",
|
|
487
|
+
borrowFeeKey: "0xabc6422db2d4ee01635ddaeaa44ba68370eebd785d2c4632515f841ae9bc47d9",
|
|
488
|
+
supplyLimitKey: "0x61a2054eb37f543c0d774da57f2c9542aad8d79a197f748ac08ef5df6cc47028",
|
|
489
|
+
borrowLimitKey: "0x4459498a043872cd107ea917493fee0baf2d37a273c7538e1d6581cc61b92af8",
|
|
490
|
+
isolatedAssetKey: void 0,
|
|
491
|
+
spool: "0xeedf438abcaa6ce4d9625ffca110920592d5867e4c5637d84ad9f466c4feb800",
|
|
492
|
+
spoolReward: "0x89255a2f86ed7fbfef35ab8b7be48cc7667015975be2685dd9a55a9a64baf76e",
|
|
493
|
+
sCoinTreasury: "0x55f4dfe9e40bc4cc11c70fcb1f3daefa2bdc330567c58d4f0792fbd9f9175a62",
|
|
494
|
+
coinDecimalId: "0x2f9217f533e51334873a39b8026a4aa6919497b47f49d0986a4f1aec66f8a34d"
|
|
473
495
|
},
|
|
474
496
|
hasui: {
|
|
475
497
|
lendingPoolAddress: "0x7ebc607f6bdeb659fb6506cb91c5cc1d47bb365cfd5d2e637ea765346ec84ed4",
|
|
@@ -482,7 +504,9 @@ var POOL_ADDRESSES = {
|
|
|
482
504
|
borrowLimitKey: "0x65333e606eead786a999c8267bc9886b0fdbc298a8a8635a48a9c9b8838d9395",
|
|
483
505
|
isolatedAssetKey: void 0,
|
|
484
506
|
spool: "0xa6148bc1b623e936d39a952ceb5bea79e8b37228a8f595067bf1852efd3c34aa",
|
|
485
|
-
spoolReward: "0x6f3563644d3e2ef13176dbf9d865bd93479df60ccbe07b7e66db57f6309f5a66"
|
|
507
|
+
spoolReward: "0x6f3563644d3e2ef13176dbf9d865bd93479df60ccbe07b7e66db57f6309f5a66",
|
|
508
|
+
sCoinTreasury: "0x404ccc1404d74a90eb6f9c9d4b6cda6d417fb03189f80d9070a35e5dab1df0f5",
|
|
509
|
+
coinDecimalId: "0x2c5f33af93f6511df699aaaa5822d823aac6ed99d4a0de2a4a50b3afa0172e24"
|
|
486
510
|
},
|
|
487
511
|
vsui: {
|
|
488
512
|
lendingPoolAddress: "0xda9257c0731d8822e8a438ebced13415850d705b779c79958dcf2aeb21fcb43d",
|
|
@@ -495,7 +519,9 @@ var POOL_ADDRESSES = {
|
|
|
495
519
|
borrowLimitKey: "0x4eb206b4417642cfc1b02f80bb5f5e366af2af2f9fb4ea4f4e898ae82367f8a0",
|
|
496
520
|
isolatedAssetKey: void 0,
|
|
497
521
|
spool: "0x69ce8e537e750a95381e6040794afa5ab1758353a1a2e1de7760391b01f91670",
|
|
498
|
-
spoolReward: "0xbca914adce058ad0902c7f3cfcd698392a475f00dcfdc3f76001d0370b98777a"
|
|
522
|
+
spoolReward: "0xbca914adce058ad0902c7f3cfcd698392a475f00dcfdc3f76001d0370b98777a",
|
|
523
|
+
sCoinTreasury: "0xc06688ee1af25abc286ffb1d18ce273d1d5907cd1064c25f4e8ca61ea989c1d1",
|
|
524
|
+
coinDecimalId: "0xabd84a23467b33854ab25cf862006fd97479f8f6f53e50fe732c43a274d939bd"
|
|
499
525
|
},
|
|
500
526
|
sca: {
|
|
501
527
|
lendingPoolAddress: "0x6fc7d4211fc7018b6c75e7b908b88f2e0536443239804a3d32af547637bd28d7",
|
|
@@ -508,20 +534,9 @@ var POOL_ADDRESSES = {
|
|
|
508
534
|
borrowLimitKey: "0x04c7de61c5b42972f9bf6a8b1848e5fea2d037ee8deba81741ecd4a70aa80d30",
|
|
509
535
|
isolatedAssetKey: void 0,
|
|
510
536
|
spool: void 0,
|
|
511
|
-
spoolReward: void 0
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
lendingPoolAddress: "0xf4a67ffb43da1e1c61c049f188f19463ea8dbbf2d5ef4722d6df854ff1b1cc03",
|
|
515
|
-
collateralPoolAddress: void 0,
|
|
516
|
-
borrowDynamic: "0x95e00d7466f97a100e70f08bd37788dc49335796f6f49fab996d40dd0681c6d3",
|
|
517
|
-
interestModel: "0x4143c298506a332d92ea8a995e6f3991ee3215f58f6fc6441752835d275b9a69",
|
|
518
|
-
riskModel: void 0,
|
|
519
|
-
borrowFeeKey: "0xb14ee43f4ad2a2c40bac8c4406a401690e93c982e289cf3802fedf74a159cab2",
|
|
520
|
-
supplyLimitKey: "0x599528fdfdc253e90dfd0acf4f4a166b391e2aac1ca6528abbff63225b548fee",
|
|
521
|
-
borrowLimitKey: "0xf4217e8ef9d9c32e8992092e910a77535a8124c19b8a762a673f227f5f765a4e",
|
|
522
|
-
isolatedAssetKey: "0x208d3a24ba369dcfc8f0387333d1512b98199eb150d2f2a69359ff708cf761e3",
|
|
523
|
-
spool: void 0,
|
|
524
|
-
spoolReward: void 0
|
|
537
|
+
spoolReward: void 0,
|
|
538
|
+
sCoinTreasury: "0xe04bfc95e00252bd654ee13c08edef9ac5e4b6ae4074e8390db39e9a0109c529",
|
|
539
|
+
coinDecimalId: "0x5d26a1e9a55c88147ac870bfa31b729d7f49f8804b8b3adfdf3582d301cca844"
|
|
525
540
|
},
|
|
526
541
|
fud: {
|
|
527
542
|
lendingPoolAddress: "0xefed2cbe76b344792ac724523c8b2236740d1cea2100d46a0ed0dc760c7f4231",
|
|
@@ -534,7 +549,24 @@ var POOL_ADDRESSES = {
|
|
|
534
549
|
borrowLimitKey: "0x3d928a001c453c50004baa54e14b0a0e1b0907d9c613dfd76064fd7ed4e8beb8",
|
|
535
550
|
isolatedAssetKey: "0xfcb533e9e4e31f9c9f32d6cbf7fbb3425f1d60474e229a363a2dc7f835d587e2",
|
|
536
551
|
spool: void 0,
|
|
537
|
-
spoolReward: void 0
|
|
552
|
+
spoolReward: void 0,
|
|
553
|
+
sCoinTreasury: "0xf25212f11d182decff7a86165699a73e3d5787aced203ca539f43cfbc10db867",
|
|
554
|
+
coinDecimalId: "0x01087411ef48aaac1eb6e24803213e3a60a03b147dac930e5e341f17a85e524e"
|
|
555
|
+
},
|
|
556
|
+
deep: {
|
|
557
|
+
lendingPoolAddress: "0xf4a67ffb43da1e1c61c049f188f19463ea8dbbf2d5ef4722d6df854ff1b1cc03",
|
|
558
|
+
collateralPoolAddress: void 0,
|
|
559
|
+
borrowDynamic: "0x95e00d7466f97a100e70f08bd37788dc49335796f6f49fab996d40dd0681c6d3",
|
|
560
|
+
interestModel: "0x4143c298506a332d92ea8a995e6f3991ee3215f58f6fc6441752835d275b9a69",
|
|
561
|
+
riskModel: void 0,
|
|
562
|
+
borrowFeeKey: "0xb14ee43f4ad2a2c40bac8c4406a401690e93c982e289cf3802fedf74a159cab2",
|
|
563
|
+
supplyLimitKey: "0x599528fdfdc253e90dfd0acf4f4a166b391e2aac1ca6528abbff63225b548fee",
|
|
564
|
+
borrowLimitKey: "0xf4217e8ef9d9c32e8992092e910a77535a8124c19b8a762a673f227f5f765a4e",
|
|
565
|
+
isolatedAssetKey: "0x208d3a24ba369dcfc8f0387333d1512b98199eb150d2f2a69359ff708cf761e3",
|
|
566
|
+
spool: void 0,
|
|
567
|
+
spoolReward: void 0,
|
|
568
|
+
sCoinTreasury: "0xc63838fabe37b25ad897392d89876d920f5e0c6a406bf3abcb84753d2829bc88",
|
|
569
|
+
coinDecimalId: "0x6e60b051a08fa836f5a7acd7c464c8d9825bc29c44657fe170fe9b8e1e4770c0"
|
|
538
570
|
}
|
|
539
571
|
};
|
|
540
572
|
|
|
@@ -1122,7 +1154,7 @@ var TEST_ADDRESSES = {
|
|
|
1122
1154
|
};
|
|
1123
1155
|
|
|
1124
1156
|
// src/constants/tokenBucket.ts
|
|
1125
|
-
var DEFAULT_TOKENS_PER_INTERVAL =
|
|
1157
|
+
var DEFAULT_TOKENS_PER_INTERVAL = 10;
|
|
1126
1158
|
var DEFAULT_INTERVAL_IN_MS = 250;
|
|
1127
1159
|
|
|
1128
1160
|
// src/constants/vesca.ts
|
|
@@ -1792,10 +1824,16 @@ function withIndexerFallback(method) {
|
|
|
1792
1824
|
var parseObjectAs = (object) => {
|
|
1793
1825
|
if (!(object && object.content && "fields" in object.content))
|
|
1794
1826
|
throw new Error(`Failed to parse object`);
|
|
1795
|
-
const
|
|
1796
|
-
if (typeof
|
|
1797
|
-
|
|
1798
|
-
|
|
1827
|
+
const fields = object.content.fields;
|
|
1828
|
+
if (typeof fields === "object" && "value" in fields) {
|
|
1829
|
+
const value = fields.value;
|
|
1830
|
+
if (typeof value === "object" && "fields" in value)
|
|
1831
|
+
return value.fields;
|
|
1832
|
+
return value;
|
|
1833
|
+
} else if (typeof fields === "object") {
|
|
1834
|
+
return fields;
|
|
1835
|
+
}
|
|
1836
|
+
return fields;
|
|
1799
1837
|
};
|
|
1800
1838
|
|
|
1801
1839
|
// src/models/scallopCache.ts
|
|
@@ -1950,10 +1988,33 @@ var ScallopCache = class {
|
|
|
1950
1988
|
retryDelay: 1e3,
|
|
1951
1989
|
queryKey: queryKeys.rpc.getOwnedObjects(input),
|
|
1952
1990
|
queryFn: async () => {
|
|
1953
|
-
|
|
1991
|
+
const results = await callWithRateLimit(
|
|
1954
1992
|
this.tokenBucket,
|
|
1955
1993
|
async () => await this.client.getOwnedObjects(input)
|
|
1956
1994
|
);
|
|
1995
|
+
if (results && results.data.length > 0) {
|
|
1996
|
+
results.data.filter(
|
|
1997
|
+
(result) => !!result.data
|
|
1998
|
+
).forEach((result) => {
|
|
1999
|
+
this.queryClient.setQueriesData(
|
|
2000
|
+
{
|
|
2001
|
+
exact: false,
|
|
2002
|
+
queryKey: queryKeys.rpc.getObject(
|
|
2003
|
+
result.data.objectId,
|
|
2004
|
+
input.options ?? {}
|
|
2005
|
+
)
|
|
2006
|
+
},
|
|
2007
|
+
{
|
|
2008
|
+
data: result.data,
|
|
2009
|
+
error: null
|
|
2010
|
+
},
|
|
2011
|
+
{
|
|
2012
|
+
updatedAt: Date.now()
|
|
2013
|
+
}
|
|
2014
|
+
);
|
|
2015
|
+
});
|
|
2016
|
+
}
|
|
2017
|
+
return results;
|
|
1957
2018
|
}
|
|
1958
2019
|
});
|
|
1959
2020
|
}
|
|
@@ -1976,10 +2037,29 @@ var ScallopCache = class {
|
|
|
1976
2037
|
retryDelay: (attemptIndex) => Math.min(1e3 * attemptIndex, 8e3),
|
|
1977
2038
|
queryKey: queryKeys.rpc.getDynamicFieldObject(input),
|
|
1978
2039
|
queryFn: async () => {
|
|
1979
|
-
|
|
2040
|
+
const result = await callWithRateLimit(
|
|
1980
2041
|
this.tokenBucket,
|
|
1981
2042
|
() => this.client.getDynamicFieldObject(input)
|
|
1982
2043
|
);
|
|
2044
|
+
if (result?.data) {
|
|
2045
|
+
this.queryClient.setQueriesData(
|
|
2046
|
+
{
|
|
2047
|
+
exact: false,
|
|
2048
|
+
queryKey: queryKeys.rpc.getObject(result?.data.objectId, {
|
|
2049
|
+
showContent: true,
|
|
2050
|
+
showOwner: true
|
|
2051
|
+
})
|
|
2052
|
+
},
|
|
2053
|
+
{
|
|
2054
|
+
data: result.data,
|
|
2055
|
+
error: null
|
|
2056
|
+
},
|
|
2057
|
+
{
|
|
2058
|
+
updatedAt: Date.now()
|
|
2059
|
+
}
|
|
2060
|
+
);
|
|
2061
|
+
}
|
|
2062
|
+
return result;
|
|
1983
2063
|
}
|
|
1984
2064
|
});
|
|
1985
2065
|
}
|
|
@@ -3617,14 +3697,26 @@ var getObligations = async ({
|
|
|
3617
3697
|
} while (hasNextPage);
|
|
3618
3698
|
const keyObjects = keyObjectsResponse.filter((ref) => !!ref.data);
|
|
3619
3699
|
const obligations = [];
|
|
3700
|
+
const obligationsObjects = await queryMultipleObjects(
|
|
3701
|
+
address.cache,
|
|
3702
|
+
keyObjects.map((ref) => ref.data?.content).filter(
|
|
3703
|
+
(content) => content?.dataType === "moveObject"
|
|
3704
|
+
).map((content) => content.fields.ownership.fields.of),
|
|
3705
|
+
{
|
|
3706
|
+
showContent: true
|
|
3707
|
+
}
|
|
3708
|
+
);
|
|
3620
3709
|
await Promise.allSettled(
|
|
3621
|
-
keyObjects.map(async ({ data }) => {
|
|
3710
|
+
keyObjects.map(async ({ data }, idx) => {
|
|
3622
3711
|
const keyId = data?.objectId;
|
|
3623
3712
|
const content = data?.content;
|
|
3624
3713
|
if (keyId && content && "fields" in content) {
|
|
3625
3714
|
const fields = content.fields;
|
|
3626
3715
|
const obligationId = String(fields.ownership.fields.of);
|
|
3627
|
-
const locked = await getObligationLocked(
|
|
3716
|
+
const locked = await getObligationLocked(
|
|
3717
|
+
address.cache,
|
|
3718
|
+
obligationsObjects[idx]
|
|
3719
|
+
);
|
|
3628
3720
|
obligations.push({ id: obligationId, keyId, locked });
|
|
3629
3721
|
}
|
|
3630
3722
|
})
|
|
@@ -3632,14 +3724,12 @@ var getObligations = async ({
|
|
|
3632
3724
|
return obligations;
|
|
3633
3725
|
};
|
|
3634
3726
|
var getObligationLocked = async (cache, obligation) => {
|
|
3635
|
-
const
|
|
3727
|
+
const obligationObjectData = typeof obligation === "string" ? (await cache.queryGetObject(obligation, {
|
|
3636
3728
|
showContent: true
|
|
3637
3729
|
}))?.data : obligation;
|
|
3638
3730
|
let obligationLocked = false;
|
|
3639
|
-
if (
|
|
3640
|
-
obligationLocked = Boolean(
|
|
3641
|
-
obligationObjectResponse.content.fields.lock_key
|
|
3642
|
-
);
|
|
3731
|
+
if (obligationObjectData && obligationObjectData?.content?.dataType === "moveObject" && "lock_key" in obligationObjectData.content.fields) {
|
|
3732
|
+
obligationLocked = Boolean(obligationObjectData.content.fields.lock_key);
|
|
3643
3733
|
}
|
|
3644
3734
|
return obligationLocked;
|
|
3645
3735
|
};
|
|
@@ -4024,7 +4114,7 @@ var getObligationAccount = async (query, obligationId, ownerAddress, indexer = f
|
|
|
4024
4114
|
];
|
|
4025
4115
|
market = market ?? await query.getMarketPools(void 0, { indexer });
|
|
4026
4116
|
coinPrices = coinPrices ?? await query.getAllCoinPrices({ marketPools: market.pools });
|
|
4027
|
-
coinAmounts = coinAmounts
|
|
4117
|
+
coinAmounts = coinAmounts ?? await query.getCoinAmounts(coinNames, ownerAddress);
|
|
4028
4118
|
const [obligationQuery, borrowIncentivePools, borrowIncentiveAccounts] = await Promise.all([
|
|
4029
4119
|
query.queryObligation(obligationId),
|
|
4030
4120
|
query.getBorrowIncentivePools(void 0, {
|
|
@@ -4560,12 +4650,80 @@ var getSCoinSwapRate = async (query, fromSCoin, toSCoin, underlyingCoinPrice) =>
|
|
|
4560
4650
|
|
|
4561
4651
|
// src/queries/spoolQuery.ts
|
|
4562
4652
|
import { normalizeStructTag as normalizeStructTag5 } from "@mysten/sui/utils";
|
|
4653
|
+
var queryRequiredSpoolObjects = async (query, stakePoolCoinNames) => {
|
|
4654
|
+
const tasks = stakePoolCoinNames.map((t, idx) => ({
|
|
4655
|
+
poolCoinName: stakePoolCoinNames[idx],
|
|
4656
|
+
spool: POOL_ADDRESSES[t]?.spool,
|
|
4657
|
+
spoolReward: POOL_ADDRESSES[t]?.spoolReward,
|
|
4658
|
+
sCoinTreasury: POOL_ADDRESSES[t]?.sCoinTreasury
|
|
4659
|
+
}));
|
|
4660
|
+
const [spoolObjects, spoolRewardObjects, sCoinTreasuryObjects] = await Promise.all([
|
|
4661
|
+
queryMultipleObjects(
|
|
4662
|
+
query.cache,
|
|
4663
|
+
tasks.map((task) => task.spool).filter((t) => !!t)
|
|
4664
|
+
),
|
|
4665
|
+
queryMultipleObjects(
|
|
4666
|
+
query.cache,
|
|
4667
|
+
tasks.map((task) => task.spoolReward).filter((t) => !!t)
|
|
4668
|
+
),
|
|
4669
|
+
queryMultipleObjects(
|
|
4670
|
+
query.cache,
|
|
4671
|
+
tasks.map((task) => task.sCoinTreasury).filter((t) => !!t)
|
|
4672
|
+
)
|
|
4673
|
+
]);
|
|
4674
|
+
const mapObjects = (tasks2, fetchedObjects) => {
|
|
4675
|
+
const resultMap = {};
|
|
4676
|
+
let fetchedIndex = 0;
|
|
4677
|
+
for (const task of tasks2) {
|
|
4678
|
+
const key = task[Object.keys(task)[1]];
|
|
4679
|
+
if (key) {
|
|
4680
|
+
resultMap[task.poolCoinName] = fetchedObjects[fetchedIndex];
|
|
4681
|
+
fetchedIndex++;
|
|
4682
|
+
}
|
|
4683
|
+
}
|
|
4684
|
+
return resultMap;
|
|
4685
|
+
};
|
|
4686
|
+
const spoolMap = mapObjects(tasks, spoolObjects);
|
|
4687
|
+
const spoolRewardMap = mapObjects(tasks, spoolRewardObjects);
|
|
4688
|
+
const sCoinTreasuryMap = mapObjects(tasks, sCoinTreasuryObjects);
|
|
4689
|
+
return stakePoolCoinNames.reduce(
|
|
4690
|
+
(acc, name) => {
|
|
4691
|
+
acc[name] = {
|
|
4692
|
+
spool: spoolMap[name],
|
|
4693
|
+
spoolReward: spoolRewardMap[name],
|
|
4694
|
+
sCoinTreasury: sCoinTreasuryMap[name]
|
|
4695
|
+
};
|
|
4696
|
+
return acc;
|
|
4697
|
+
},
|
|
4698
|
+
{}
|
|
4699
|
+
);
|
|
4700
|
+
};
|
|
4701
|
+
var parseSpoolObjects = ({
|
|
4702
|
+
spool,
|
|
4703
|
+
spoolReward
|
|
4704
|
+
}) => {
|
|
4705
|
+
const _spool = parseObjectAs(spool);
|
|
4706
|
+
const _spoolReward = parseObjectAs(spoolReward);
|
|
4707
|
+
return {
|
|
4708
|
+
stakeType: _spool.stake_type,
|
|
4709
|
+
maxDistributedPoint: _spool.max_distributed_point,
|
|
4710
|
+
distributedPoint: _spool.distributed_point,
|
|
4711
|
+
distributedPointPerPeriod: _spool.distributed_point_per_period,
|
|
4712
|
+
pointDistributionTime: _spool.point_distribution_time,
|
|
4713
|
+
maxStake: _spool.max_stakes,
|
|
4714
|
+
stakes: _spool.stakes,
|
|
4715
|
+
index: _spool.index,
|
|
4716
|
+
createdAt: _spool.created_at,
|
|
4717
|
+
lastUpdate: _spool.last_update,
|
|
4718
|
+
..._spoolReward
|
|
4719
|
+
};
|
|
4720
|
+
};
|
|
4563
4721
|
var getSpools = async (query, stakeMarketCoinNames = [...SUPPORT_SPOOLS], indexer = false, marketPools, coinPrices) => {
|
|
4564
4722
|
const stakeCoinNames = stakeMarketCoinNames.map(
|
|
4565
4723
|
(stakeMarketCoinName) => query.utils.parseCoinName(stakeMarketCoinName)
|
|
4566
4724
|
);
|
|
4567
|
-
coinPrices = coinPrices ?? await query.utils.getCoinPrices() ?? {};
|
|
4568
4725
|
marketPools = marketPools ?? (await query.getMarketPools(stakeCoinNames, { indexer })).pools;
|
|
4726
|
+
coinPrices = coinPrices ?? await query.getAllCoinPrices({ marketPools }) ?? {};
|
|
4569
4727
|
if (!marketPools)
|
|
4570
4728
|
throw new Error(`Fail to fetch marketPools for ${stakeCoinNames}`);
|
|
4571
4729
|
const spools = {};
|
|
@@ -4580,126 +4738,93 @@ var getSpools = async (query, stakeMarketCoinNames = [...SUPPORT_SPOOLS], indexe
|
|
|
4580
4738
|
const rewardCoinName = query.utils.getSpoolRewardCoinName(
|
|
4581
4739
|
spool.marketCoinName
|
|
4582
4740
|
);
|
|
4583
|
-
const marketPool = marketPools[coinName];
|
|
4584
4741
|
spool.coinPrice = coinPrices[coinName] ?? spool.coinPrice;
|
|
4585
|
-
spool.marketCoinPrice = coinPrices[
|
|
4742
|
+
spool.marketCoinPrice = coinPrices[spool.marketCoinName] ?? spool.marketCoinPrice;
|
|
4586
4743
|
spool.rewardCoinPrice = coinPrices[rewardCoinName] ?? spool.rewardCoinPrice;
|
|
4587
4744
|
spools[spool.marketCoinName] = spool;
|
|
4588
4745
|
};
|
|
4589
4746
|
Object.values(spoolsIndexer).forEach(updateSpools);
|
|
4590
4747
|
return spools;
|
|
4591
4748
|
}
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4749
|
+
const requiredObjects = await queryRequiredSpoolObjects(
|
|
4750
|
+
query,
|
|
4751
|
+
stakeCoinNames
|
|
4752
|
+
);
|
|
4753
|
+
await Promise.allSettled(
|
|
4754
|
+
stakeMarketCoinNames.map(async (stakeMarketCoinName, idx) => {
|
|
4755
|
+
try {
|
|
4756
|
+
const stakeCoinName = stakeCoinNames[idx];
|
|
4757
|
+
const spool = await getSpool(
|
|
4758
|
+
query,
|
|
4759
|
+
stakeMarketCoinName,
|
|
4760
|
+
indexer,
|
|
4761
|
+
coinPrices,
|
|
4762
|
+
requiredObjects[stakeCoinName]
|
|
4763
|
+
);
|
|
4764
|
+
if (spool) {
|
|
4765
|
+
spools[stakeMarketCoinName] = spool;
|
|
4766
|
+
}
|
|
4767
|
+
} catch (e) {
|
|
4768
|
+
console.error(e);
|
|
4769
|
+
}
|
|
4770
|
+
})
|
|
4771
|
+
);
|
|
4605
4772
|
return spools;
|
|
4606
4773
|
};
|
|
4607
|
-
var getSpool = async (query, marketCoinName, indexer = false,
|
|
4774
|
+
var getSpool = async (query, marketCoinName, indexer = false, coinPrices, requiredObjects) => {
|
|
4608
4775
|
const coinName = query.utils.parseCoinName(marketCoinName);
|
|
4609
|
-
|
|
4610
|
-
if (!marketPool) {
|
|
4611
|
-
throw new Error(`Failed to fetch marketPool for ${marketCoinName}`);
|
|
4612
|
-
}
|
|
4613
|
-
const poolId = query.address.get(`spool.pools.${marketCoinName}.id`);
|
|
4614
|
-
const rewardPoolId = query.address.get(
|
|
4615
|
-
`spool.pools.${marketCoinName}.rewardPoolId`
|
|
4616
|
-
);
|
|
4617
|
-
let spool = void 0;
|
|
4618
|
-
coinPrices = coinPrices || await query.utils.getCoinPrices();
|
|
4776
|
+
coinPrices = coinPrices || await query.getAllCoinPrices();
|
|
4619
4777
|
if (indexer) {
|
|
4620
4778
|
const spoolIndexer = await query.indexer.getSpool(marketCoinName);
|
|
4621
4779
|
const coinName2 = query.utils.parseCoinName(marketCoinName);
|
|
4622
4780
|
const rewardCoinName2 = query.utils.getSpoolRewardCoinName(marketCoinName);
|
|
4623
|
-
spoolIndexer.coinPrice = coinPrices?.[coinName2]
|
|
4624
|
-
spoolIndexer.marketCoinPrice =
|
|
4625
|
-
spoolIndexer.rewardCoinPrice = coinPrices?.[rewardCoinName2]
|
|
4781
|
+
spoolIndexer.coinPrice = coinPrices?.[coinName2] ?? spoolIndexer.coinPrice;
|
|
4782
|
+
spoolIndexer.marketCoinPrice = coinPrices?.[marketCoinName] ?? spoolIndexer.marketCoinPrice;
|
|
4783
|
+
spoolIndexer.rewardCoinPrice = coinPrices?.[rewardCoinName2] ?? spoolIndexer.rewardCoinPrice;
|
|
4626
4784
|
return spoolIndexer;
|
|
4627
4785
|
}
|
|
4628
|
-
|
|
4629
|
-
[poolId, rewardPoolId],
|
|
4630
|
-
{
|
|
4631
|
-
showContent: true
|
|
4632
|
-
}
|
|
4633
|
-
);
|
|
4634
|
-
if (!(spoolObjectResponse[0] && spoolObjectResponse[1])) {
|
|
4635
|
-
throw new Error("Fail to fetch spoolObjectResponse!");
|
|
4636
|
-
}
|
|
4786
|
+
requiredObjects ?? (requiredObjects = (await queryRequiredSpoolObjects(query, [coinName]))[coinName]);
|
|
4637
4787
|
const rewardCoinName = query.utils.getSpoolRewardCoinName(marketCoinName);
|
|
4638
4788
|
coinPrices = coinPrices || await query.utils.getCoinPrices();
|
|
4639
|
-
const
|
|
4640
|
-
const
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
)
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
rewardCoinDecimal
|
|
4679
|
-
);
|
|
4680
|
-
spool = {
|
|
4681
|
-
marketCoinName,
|
|
4682
|
-
symbol: query.utils.parseSymbol(marketCoinName),
|
|
4683
|
-
coinType: query.utils.parseCoinType(coinName),
|
|
4684
|
-
marketCoinType: query.utils.parseMarketCoinType(coinName),
|
|
4685
|
-
rewardCoinType: isMarketCoin(rewardCoinName) ? query.utils.parseMarketCoinType(rewardCoinName) : query.utils.parseCoinType(rewardCoinName),
|
|
4686
|
-
sCoinType: marketPool.sCoinType,
|
|
4687
|
-
coinDecimal: query.utils.getCoinDecimal(coinName),
|
|
4688
|
-
rewardCoinDecimal: query.utils.getCoinDecimal(rewardCoinName),
|
|
4689
|
-
coinPrice: coinPrices?.[coinName] ?? 0,
|
|
4690
|
-
marketCoinPrice,
|
|
4691
|
-
rewardCoinPrice,
|
|
4692
|
-
maxPoint: parsedSpoolData.maxPoint,
|
|
4693
|
-
distributedPoint: parsedSpoolData.distributedPoint,
|
|
4694
|
-
maxStake: parsedSpoolData.maxStake,
|
|
4695
|
-
...calculatedSpoolData,
|
|
4696
|
-
exchangeRateNumerator: parsedSpoolRewardPoolData.exchangeRateNumerator,
|
|
4697
|
-
exchangeRateDenominator: parsedSpoolRewardPoolData.exchangeRateDenominator,
|
|
4698
|
-
...calculatedRewardPoolData
|
|
4699
|
-
};
|
|
4700
|
-
}
|
|
4701
|
-
}
|
|
4702
|
-
return spool;
|
|
4789
|
+
const parsedSpoolObjects = parseSpoolObjects(requiredObjects);
|
|
4790
|
+
const parsedSpoolData = parseOriginSpoolData(parsedSpoolObjects);
|
|
4791
|
+
const marketCoinPrice = coinPrices?.[marketCoinName] ?? 0;
|
|
4792
|
+
const marketCoinDecimal = query.utils.getCoinDecimal(marketCoinName);
|
|
4793
|
+
const calculatedSpoolData = calculateSpoolData(
|
|
4794
|
+
parsedSpoolData,
|
|
4795
|
+
marketCoinPrice,
|
|
4796
|
+
marketCoinDecimal
|
|
4797
|
+
);
|
|
4798
|
+
const parsedSpoolRewardPoolData = parseOriginSpoolRewardPoolData(parsedSpoolObjects);
|
|
4799
|
+
const rewardCoinPrice = coinPrices?.[rewardCoinName] ?? 0;
|
|
4800
|
+
const rewardCoinDecimal = query.utils.getCoinDecimal(rewardCoinName);
|
|
4801
|
+
const calculatedRewardPoolData = calculateSpoolRewardPoolData(
|
|
4802
|
+
parsedSpoolData,
|
|
4803
|
+
parsedSpoolRewardPoolData,
|
|
4804
|
+
calculatedSpoolData,
|
|
4805
|
+
rewardCoinPrice,
|
|
4806
|
+
rewardCoinDecimal
|
|
4807
|
+
);
|
|
4808
|
+
return {
|
|
4809
|
+
marketCoinName,
|
|
4810
|
+
symbol: query.utils.parseSymbol(marketCoinName),
|
|
4811
|
+
coinType: query.utils.parseCoinType(coinName),
|
|
4812
|
+
marketCoinType: query.utils.parseMarketCoinType(coinName),
|
|
4813
|
+
rewardCoinType: isMarketCoin(rewardCoinName) ? query.utils.parseMarketCoinType(rewardCoinName) : query.utils.parseCoinType(rewardCoinName),
|
|
4814
|
+
sCoinType: query.utils.parseSCoinType(marketCoinName),
|
|
4815
|
+
coinDecimal: query.utils.getCoinDecimal(coinName),
|
|
4816
|
+
rewardCoinDecimal: query.utils.getCoinDecimal(rewardCoinName),
|
|
4817
|
+
coinPrice: coinPrices?.[coinName] ?? 0,
|
|
4818
|
+
marketCoinPrice,
|
|
4819
|
+
rewardCoinPrice,
|
|
4820
|
+
maxPoint: parsedSpoolData.maxPoint,
|
|
4821
|
+
distributedPoint: parsedSpoolData.distributedPoint,
|
|
4822
|
+
maxStake: parsedSpoolData.maxStake,
|
|
4823
|
+
...calculatedSpoolData,
|
|
4824
|
+
exchangeRateNumerator: parsedSpoolRewardPoolData.exchangeRateNumerator,
|
|
4825
|
+
exchangeRateDenominator: parsedSpoolRewardPoolData.exchangeRateDenominator,
|
|
4826
|
+
...calculatedRewardPoolData
|
|
4827
|
+
};
|
|
4703
4828
|
};
|
|
4704
4829
|
var getStakeAccounts = async ({
|
|
4705
4830
|
utils
|
|
@@ -5120,6 +5245,13 @@ var getAllAddresses = async (query) => {
|
|
|
5120
5245
|
// @ts-ignore
|
|
5121
5246
|
`spool.pools.s${coinName}.rewardPoolId`
|
|
5122
5247
|
);
|
|
5248
|
+
const sCoinTreasury = query.address.get(
|
|
5249
|
+
// @ts-ignore
|
|
5250
|
+
`scoin.coins.s${coinName}.treasury`
|
|
5251
|
+
);
|
|
5252
|
+
const coinDecimalId = query.address.get(
|
|
5253
|
+
`core.coins.${coinName}.metaData`
|
|
5254
|
+
);
|
|
5123
5255
|
results[coinName] = {
|
|
5124
5256
|
lendingPoolAddress: addresses[0],
|
|
5125
5257
|
collateralPoolAddress: addresses[1],
|
|
@@ -5131,7 +5263,9 @@ var getAllAddresses = async (query) => {
|
|
|
5131
5263
|
borrowLimitKey: addresses[7],
|
|
5132
5264
|
isolatedAssetKey: addresses[8],
|
|
5133
5265
|
spool,
|
|
5134
|
-
spoolReward: rewardPool
|
|
5266
|
+
spoolReward: rewardPool,
|
|
5267
|
+
sCoinTreasury,
|
|
5268
|
+
coinDecimalId
|
|
5135
5269
|
};
|
|
5136
5270
|
await new Promise((resolve) => setTimeout(resolve, 200));
|
|
5137
5271
|
})
|
|
@@ -5910,7 +6044,7 @@ var generateCoreNormalMethod = ({
|
|
|
5910
6044
|
coreIds.market,
|
|
5911
6045
|
coreIds.coinDecimalsRegistry,
|
|
5912
6046
|
borrowReferral,
|
|
5913
|
-
txBlock.pure.u64(amount),
|
|
6047
|
+
typeof amount === "number" ? txBlock.pure.u64(amount) : amount,
|
|
5914
6048
|
coreIds.xOracle,
|
|
5915
6049
|
SUI_CLOCK_OBJECT_ID3
|
|
5916
6050
|
],
|
|
@@ -7652,13 +7786,8 @@ var ScallopQuery = class {
|
|
|
7652
7786
|
* @return Spool data.
|
|
7653
7787
|
*/
|
|
7654
7788
|
async getSpool(stakeMarketCoinName, args) {
|
|
7655
|
-
|
|
7656
|
-
|
|
7657
|
-
stakeMarketCoinName,
|
|
7658
|
-
args?.indexer,
|
|
7659
|
-
args?.marketPool,
|
|
7660
|
-
args?.coinPrices
|
|
7661
|
-
);
|
|
7789
|
+
const spools = await this.getSpools(void 0, args);
|
|
7790
|
+
return spools[stakeMarketCoinName];
|
|
7662
7791
|
}
|
|
7663
7792
|
/**
|
|
7664
7793
|
* Get stake accounts data for all stake pools (spools).
|
|
@@ -7824,11 +7953,9 @@ var ScallopQuery = class {
|
|
|
7824
7953
|
* @return Borrowing and collateral information.
|
|
7825
7954
|
*/
|
|
7826
7955
|
async getObligationAccount(obligationId, ownerAddress = this.walletAddress, args) {
|
|
7827
|
-
|
|
7828
|
-
|
|
7829
|
-
obligationId
|
|
7830
|
-
ownerAddress,
|
|
7831
|
-
args?.indexer
|
|
7956
|
+
const results = await this.getObligationAccounts(ownerAddress, args);
|
|
7957
|
+
return Object.values(results).find(
|
|
7958
|
+
(obligation) => obligation?.obligationId === obligationId
|
|
7832
7959
|
);
|
|
7833
7960
|
}
|
|
7834
7961
|
/**
|
|
@@ -8657,6 +8784,8 @@ var ScallopClient = class {
|
|
|
8657
8784
|
txBlock.setSender(sender);
|
|
8658
8785
|
const rewardCoinsCollection = {};
|
|
8659
8786
|
const obligationAccount = await this.query.getObligationAccount(obligationId);
|
|
8787
|
+
if (!obligationAccount)
|
|
8788
|
+
throw new Error("Obligation not found");
|
|
8660
8789
|
const rewardCoinNames = Object.values(obligationAccount.borrowIncentives).flatMap(
|
|
8661
8790
|
({ rewards }) => rewards.filter(({ availableClaimAmount }) => availableClaimAmount > 0)
|
|
8662
8791
|
).flatMap(({ coinName }) => coinName);
|
|
@@ -8987,9 +9116,11 @@ export {
|
|
|
8987
9116
|
ScallopQuery,
|
|
8988
9117
|
ScallopUtils,
|
|
8989
9118
|
TEST_ADDRESSES,
|
|
9119
|
+
TokenBucket,
|
|
8990
9120
|
UNLOCK_ROUND_DURATION,
|
|
8991
9121
|
USE_TEST_ADDRESS,
|
|
8992
9122
|
assetCoins,
|
|
9123
|
+
callWithRateLimit,
|
|
8993
9124
|
coinDecimals,
|
|
8994
9125
|
coinIds,
|
|
8995
9126
|
marketCoins,
|