@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.js
CHANGED
|
@@ -71,9 +71,11 @@ __export(src_exports, {
|
|
|
71
71
|
ScallopQuery: () => ScallopQuery,
|
|
72
72
|
ScallopUtils: () => ScallopUtils,
|
|
73
73
|
TEST_ADDRESSES: () => TEST_ADDRESSES,
|
|
74
|
+
TokenBucket: () => TokenBucket,
|
|
74
75
|
UNLOCK_ROUND_DURATION: () => UNLOCK_ROUND_DURATION,
|
|
75
76
|
USE_TEST_ADDRESS: () => USE_TEST_ADDRESS,
|
|
76
77
|
assetCoins: () => assetCoins,
|
|
78
|
+
callWithRateLimit: () => callWithRateLimit,
|
|
77
79
|
coinDecimals: () => coinDecimals,
|
|
78
80
|
coinIds: () => coinIds,
|
|
79
81
|
marketCoins: () => marketCoins,
|
|
@@ -420,6 +422,21 @@ var FlashLoanFeeObjectMap = {
|
|
|
420
422
|
|
|
421
423
|
// src/constants/poolAddress.ts
|
|
422
424
|
var POOL_ADDRESSES = {
|
|
425
|
+
usdc: {
|
|
426
|
+
lendingPoolAddress: "0xd3be98bf540f7603eeb550c0c0a19dbfc78822f25158b5fa84ebd9609def415f",
|
|
427
|
+
collateralPoolAddress: "0x8f0d529ba179c5b3d508213003eab813aaae31f78226099639b9a69d1aec17af",
|
|
428
|
+
borrowDynamic: "0x77837ecd4f26fac9a410fff594f2c0bd3288904a15492ca77cb8a52684dbb866",
|
|
429
|
+
interestModel: "0xaae3f179d63009380cbdcb9acb12907afc9c3cb79cc3460be296a9c6d28f3ff3",
|
|
430
|
+
riskModel: "0x198b24db213bfeb8b3c80ae63dde92e32fd24984d25da8233ff777b851edd574",
|
|
431
|
+
borrowFeeKey: "0xd37c5316cfe0a5967d14264fa6b423f880518b294a1ee6581ccbb49ccc401fb8",
|
|
432
|
+
supplyLimitKey: "0x4be9ae54ac4d320f4f9c14cae78cb85c8e0e67791dd9bdba6d2db20614a28a24",
|
|
433
|
+
borrowLimitKey: "0x6b01093cba95b835181f00e3a2c31ed8dfc8d64fe3db0fb80933a09f66e1ccf1",
|
|
434
|
+
isolatedAssetKey: void 0,
|
|
435
|
+
spool: "0x0b5f5f413bd3799e4052c37311966c77f3a4545eb125d2e93e67a68478021918",
|
|
436
|
+
spoolReward: "0x85ed6ed72ea97c35dbf0cdc7ed6fbc48d8ec15de9b17c74bf4512df8a6d7f166",
|
|
437
|
+
sCoinTreasury: "0xbe6b63021f3d82e0e7e977cdd718ed7c019cf2eba374b7b546220402452f938e",
|
|
438
|
+
coinDecimalId: "0x69b7a7c3c200439c1b5f3b19d7d495d5966d5f08de66c69276152f8db3992ec6"
|
|
439
|
+
},
|
|
423
440
|
sbeth: {
|
|
424
441
|
lendingPoolAddress: "0xaa34c938e0394e5186c7dc626ad69be96af2194b23fdc6ac1c63090e399f5ba4",
|
|
425
442
|
collateralPoolAddress: "0xce0549a1cbe952e734f56646988e6b02bbae14667889a60e24d0d03540a6119f",
|
|
@@ -431,20 +448,24 @@ var POOL_ADDRESSES = {
|
|
|
431
448
|
borrowLimitKey: "0x165c274c67eda2b0d13563124741fffd0ce7d643f4c1c4b59d7e53a83796ae25",
|
|
432
449
|
isolatedAssetKey: void 0,
|
|
433
450
|
spool: void 0,
|
|
434
|
-
spoolReward: void 0
|
|
451
|
+
spoolReward: void 0,
|
|
452
|
+
sCoinTreasury: "0xfd0f02def6358a1f266acfa1493d4707ee8387460d434fb667d63d755ff907ed",
|
|
453
|
+
coinDecimalId: "0x89b04ba87f8832d4d76e17a1c9dce72eb3e64d372cf02012b8d2de5384faeef0"
|
|
435
454
|
},
|
|
436
|
-
|
|
437
|
-
lendingPoolAddress: "
|
|
438
|
-
collateralPoolAddress: "
|
|
439
|
-
borrowDynamic: "
|
|
440
|
-
interestModel: "
|
|
441
|
-
riskModel: "
|
|
442
|
-
borrowFeeKey: "
|
|
443
|
-
supplyLimitKey: "
|
|
444
|
-
borrowLimitKey: "
|
|
455
|
+
weth: {
|
|
456
|
+
lendingPoolAddress: "0xc8fcdff48efc265740ae0b74aae3faccae9ec00034039a113f3339798035108c",
|
|
457
|
+
collateralPoolAddress: "0xad7ced91ed6e7f2b81805561eee27fa6f3e72fdae561077334c7248583db4dbf",
|
|
458
|
+
borrowDynamic: "0xd1578e1d1c9c82eb4c5bf14beece8142a67a683b2647d7276e92984119fc1445",
|
|
459
|
+
interestModel: "0xa1dc08541cd2cb7cfb4e56272292d5c6a4780e80fd210c58abffae98268b5ed9",
|
|
460
|
+
riskModel: "0x9f05a25fd33a9e8cf33962126b175d038e184f0ee1b87dc41d4cedbe6abebbe5",
|
|
461
|
+
borrowFeeKey: "0x29672ba8ab4625b8181d8ed739e5344de22a97d417748c4d1276c7379283d7a3",
|
|
462
|
+
supplyLimitKey: "0x2b957941bdc9432bbc83ab74dc194b6ebb7c927bc4c6926a5492b5503499e509",
|
|
463
|
+
borrowLimitKey: "0x51f256d87e51a7ca2b1c482923096f4b6dac6beac89d8ecf4c65b7d5764115d6",
|
|
445
464
|
isolatedAssetKey: void 0,
|
|
446
|
-
spool: "
|
|
447
|
-
spoolReward: "
|
|
465
|
+
spool: "0xeec40beccb07c575bebd842eeaabb835f77cd3dab73add433477e57f583a6787",
|
|
466
|
+
spoolReward: "0x957de68a18d87817de8309b30c1ec269a4d87ae513abbeed86b5619cb9ce1077",
|
|
467
|
+
sCoinTreasury: "0x4b7f5da0e306c9d52490a0c1d4091e653d6b89778b9b4f23c877e534e4d9cd21",
|
|
468
|
+
coinDecimalId: "0x8900e4ceede3363bef086d6b50ca89d816d0e90bf6bc46efefe1f8455e08f50f"
|
|
448
469
|
},
|
|
449
470
|
wbtc: {
|
|
450
471
|
lendingPoolAddress: "0x65cc08a5aca0a0b8d72e1993ded8d145f06dd102fd0d8f285b92934faed564ab",
|
|
@@ -457,7 +478,9 @@ var POOL_ADDRESSES = {
|
|
|
457
478
|
borrowLimitKey: "0x231e13ba6b1eb26c562f4a125778d3152f9a77e31f124bd6012e234a73012169",
|
|
458
479
|
isolatedAssetKey: void 0,
|
|
459
480
|
spool: void 0,
|
|
460
|
-
spoolReward: void 0
|
|
481
|
+
spoolReward: void 0,
|
|
482
|
+
sCoinTreasury: "0xe2883934ea42c99bc998bbe0f01dd6d27aa0e27a56455707b1b34e6a41c20baa",
|
|
483
|
+
coinDecimalId: "0x5d3c6e60eeff8a05b693b481539e7847dfe33013e7070cdcb387f5c0cac05dfd"
|
|
461
484
|
},
|
|
462
485
|
wusdc: {
|
|
463
486
|
lendingPoolAddress: "0x2f4df5e1368fbbdaa5c712d28b837b3d41c2d3872979ccededcdfdac55ff8a93",
|
|
@@ -470,20 +493,9 @@ var POOL_ADDRESSES = {
|
|
|
470
493
|
borrowLimitKey: "0x97f1502ce994db0bcb15aac1760d174def9e88e97cd2262eed54521ee2c19f81",
|
|
471
494
|
isolatedAssetKey: void 0,
|
|
472
495
|
spool: "0x4ace6648ddc64e646ba47a957c562c32c9599b3bba8f5ac1aadb2ae23a2f8ca0",
|
|
473
|
-
spoolReward: "0xf4268cc9b9413b9bfe09e8966b8de650494c9e5784bf0930759cfef4904daff8"
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
lendingPoolAddress: "0xc8fcdff48efc265740ae0b74aae3faccae9ec00034039a113f3339798035108c",
|
|
477
|
-
collateralPoolAddress: "0xad7ced91ed6e7f2b81805561eee27fa6f3e72fdae561077334c7248583db4dbf",
|
|
478
|
-
borrowDynamic: "0xd1578e1d1c9c82eb4c5bf14beece8142a67a683b2647d7276e92984119fc1445",
|
|
479
|
-
interestModel: "0xa1dc08541cd2cb7cfb4e56272292d5c6a4780e80fd210c58abffae98268b5ed9",
|
|
480
|
-
riskModel: "0x9f05a25fd33a9e8cf33962126b175d038e184f0ee1b87dc41d4cedbe6abebbe5",
|
|
481
|
-
borrowFeeKey: "0x29672ba8ab4625b8181d8ed739e5344de22a97d417748c4d1276c7379283d7a3",
|
|
482
|
-
supplyLimitKey: "0x2b957941bdc9432bbc83ab74dc194b6ebb7c927bc4c6926a5492b5503499e509",
|
|
483
|
-
borrowLimitKey: "0x51f256d87e51a7ca2b1c482923096f4b6dac6beac89d8ecf4c65b7d5764115d6",
|
|
484
|
-
isolatedAssetKey: void 0,
|
|
485
|
-
spool: "0xeec40beccb07c575bebd842eeaabb835f77cd3dab73add433477e57f583a6787",
|
|
486
|
-
spoolReward: "0x957de68a18d87817de8309b30c1ec269a4d87ae513abbeed86b5619cb9ce1077"
|
|
496
|
+
spoolReward: "0xf4268cc9b9413b9bfe09e8966b8de650494c9e5784bf0930759cfef4904daff8",
|
|
497
|
+
sCoinTreasury: "0x50c5cfcbcca3aaacab0984e4d7ad9a6ad034265bebb440f0d1cd688ec20b2548",
|
|
498
|
+
coinDecimalId: "0x4fbf84f3029bd0c0b77164b587963be957f853eccf834a67bb9ecba6ec80f189"
|
|
487
499
|
},
|
|
488
500
|
wusdt: {
|
|
489
501
|
lendingPoolAddress: "0xfbc056f126dd35adc1f8fe985e2cedc8010e687e8e851e1c5b99fdf63cd1c879",
|
|
@@ -496,7 +508,9 @@ var POOL_ADDRESSES = {
|
|
|
496
508
|
borrowLimitKey: "0xa3278564fc613680a69c10972a0299965bf6e12e9ac171388842fc958de0f90e",
|
|
497
509
|
isolatedAssetKey: void 0,
|
|
498
510
|
spool: "0xcb328f7ffa7f9342ed85af3fdb2f22919e1a06dfb2f713c04c73543870d7548f",
|
|
499
|
-
spoolReward: "0x2c9f934d67a5baa586ceec2cc24163a2f049a6af3d5ba36b84d8ac40f25c4080"
|
|
511
|
+
spoolReward: "0x2c9f934d67a5baa586ceec2cc24163a2f049a6af3d5ba36b84d8ac40f25c4080",
|
|
512
|
+
sCoinTreasury: "0x1f02e2fed702b477732d4ad6044aaed04f2e8e586a169153694861a901379df0",
|
|
513
|
+
coinDecimalId: "0xfb0e3eb97dd158a5ae979dddfa24348063843c5b20eb8381dd5fa7c93699e45c"
|
|
500
514
|
},
|
|
501
515
|
sui: {
|
|
502
516
|
lendingPoolAddress: "0x9c9077abf7a29eebce41e33addbcd6f5246a5221dd733e56ea0f00ae1b25c9e8",
|
|
@@ -509,7 +523,9 @@ var POOL_ADDRESSES = {
|
|
|
509
523
|
borrowLimitKey: "0x2b33a7efdcf6a6df24f4d8a356dd52f58d75bc023c3f171d99502d4d008b53f0",
|
|
510
524
|
isolatedAssetKey: void 0,
|
|
511
525
|
spool: "0x4f0ba970d3c11db05c8f40c64a15b6a33322db3702d634ced6536960ab6f3ee4",
|
|
512
|
-
spoolReward: "0x162250ef72393a4ad3d46294c4e1bdfcb03f04c869d390e7efbfc995353a7ee9"
|
|
526
|
+
spoolReward: "0x162250ef72393a4ad3d46294c4e1bdfcb03f04c869d390e7efbfc995353a7ee9",
|
|
527
|
+
sCoinTreasury: "0x5c1678c8261ac9eec024d4d630006a9f55c80dc0b1aa38a003fcb1d425818c6b",
|
|
528
|
+
coinDecimalId: "0x9258181f5ceac8dbffb7030890243caed69a9599d2886d957a9cb7656af3bdb3"
|
|
513
529
|
},
|
|
514
530
|
wapt: {
|
|
515
531
|
lendingPoolAddress: "0xca8c14a24e0c32b198eaf479a3317461e3cc339097ce88eaf296a15df8dcfdf5",
|
|
@@ -522,20 +538,9 @@ var POOL_ADDRESSES = {
|
|
|
522
538
|
borrowLimitKey: void 0,
|
|
523
539
|
isolatedAssetKey: void 0,
|
|
524
540
|
spool: void 0,
|
|
525
|
-
spoolReward: void 0
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
lendingPoolAddress: "0x9b942a24ce390b7f5016d34a0217057bf9487b92aa6d7cc9894271dbbe62471a",
|
|
529
|
-
collateralPoolAddress: "0xe5e56f5c0e3072760b21f9d49a5cc793f37d736c412a9065c16e1265c74e6341",
|
|
530
|
-
borrowDynamic: "0x1c76d4df9506154a117bbac0f5e005d8a9c0d9ca60e3fe0c9d080006f6f54e81",
|
|
531
|
-
interestModel: "0xb155c536b37c9601baaa734ad1dd0ef335b2b597aceb8d3ecee41a43f94dcd70",
|
|
532
|
-
riskModel: "0x75371b1d04b5bebc0738af548ba64ea658e74f78228ec8014336d8eebb992312",
|
|
533
|
-
borrowFeeKey: "0xabc6422db2d4ee01635ddaeaa44ba68370eebd785d2c4632515f841ae9bc47d9",
|
|
534
|
-
supplyLimitKey: "0x61a2054eb37f543c0d774da57f2c9542aad8d79a197f748ac08ef5df6cc47028",
|
|
535
|
-
borrowLimitKey: "0x4459498a043872cd107ea917493fee0baf2d37a273c7538e1d6581cc61b92af8",
|
|
536
|
-
isolatedAssetKey: void 0,
|
|
537
|
-
spool: "0xeedf438abcaa6ce4d9625ffca110920592d5867e4c5637d84ad9f466c4feb800",
|
|
538
|
-
spoolReward: "0x89255a2f86ed7fbfef35ab8b7be48cc7667015975be2685dd9a55a9a64baf76e"
|
|
541
|
+
spoolReward: void 0,
|
|
542
|
+
sCoinTreasury: void 0,
|
|
543
|
+
coinDecimalId: "0xc969c5251f372c0f34c32759f1d315cf1ea0ee5e4454b52aea08778eacfdd0a8"
|
|
539
544
|
},
|
|
540
545
|
wsol: {
|
|
541
546
|
lendingPoolAddress: "0x985682c42984cdfb03f9ff7d8923344c2fe096b1ae4b82ea17721af19d22a21f",
|
|
@@ -548,7 +553,9 @@ var POOL_ADDRESSES = {
|
|
|
548
553
|
borrowLimitKey: "0x77d453c51948f32564c810bc73f9ba7abde880657b7f89e1c8a3bc28fa36ee87",
|
|
549
554
|
isolatedAssetKey: void 0,
|
|
550
555
|
spool: void 0,
|
|
551
|
-
spoolReward: void 0
|
|
556
|
+
spoolReward: void 0,
|
|
557
|
+
sCoinTreasury: "0x760fd66f5be869af4382fa32b812b3c67f0eca1bb1ed7a5578b21d56e1848819",
|
|
558
|
+
coinDecimalId: "0x4d2c39082b4477e3e79dc4562d939147ab90c42fc5f3e4acf03b94383cd69b6e"
|
|
552
559
|
},
|
|
553
560
|
cetus: {
|
|
554
561
|
lendingPoolAddress: "0xc09858f60e74a1b671635bec4e8a2c84a0ff313eb87f525fba3258e88c6b6282",
|
|
@@ -561,7 +568,24 @@ var POOL_ADDRESSES = {
|
|
|
561
568
|
borrowLimitKey: "0xf44218a5f0feb128e6fbe74b91d1e7e9ef859bd23a576ff0de151829e015a157",
|
|
562
569
|
isolatedAssetKey: void 0,
|
|
563
570
|
spool: "0xac1bb13bf4472a637c18c2415fb0e3c1227ea2bcf35242e50563c98215bd298e",
|
|
564
|
-
spoolReward: "0x6835c1224126a45086fc6406adc249e3f30df18d779ca4f4e570e38716a17f3f"
|
|
571
|
+
spoolReward: "0x6835c1224126a45086fc6406adc249e3f30df18d779ca4f4e570e38716a17f3f",
|
|
572
|
+
sCoinTreasury: "0xa283c63488773c916cb3d6c64109536160d5eb496caddc721eb39aad2977d735",
|
|
573
|
+
coinDecimalId: "0x4c0dce55eff2db5419bbd2d239d1aa22b4a400c01bbb648b058a9883989025da"
|
|
574
|
+
},
|
|
575
|
+
afsui: {
|
|
576
|
+
lendingPoolAddress: "0x9b942a24ce390b7f5016d34a0217057bf9487b92aa6d7cc9894271dbbe62471a",
|
|
577
|
+
collateralPoolAddress: "0xe5e56f5c0e3072760b21f9d49a5cc793f37d736c412a9065c16e1265c74e6341",
|
|
578
|
+
borrowDynamic: "0x1c76d4df9506154a117bbac0f5e005d8a9c0d9ca60e3fe0c9d080006f6f54e81",
|
|
579
|
+
interestModel: "0xb155c536b37c9601baaa734ad1dd0ef335b2b597aceb8d3ecee41a43f94dcd70",
|
|
580
|
+
riskModel: "0x75371b1d04b5bebc0738af548ba64ea658e74f78228ec8014336d8eebb992312",
|
|
581
|
+
borrowFeeKey: "0xabc6422db2d4ee01635ddaeaa44ba68370eebd785d2c4632515f841ae9bc47d9",
|
|
582
|
+
supplyLimitKey: "0x61a2054eb37f543c0d774da57f2c9542aad8d79a197f748ac08ef5df6cc47028",
|
|
583
|
+
borrowLimitKey: "0x4459498a043872cd107ea917493fee0baf2d37a273c7538e1d6581cc61b92af8",
|
|
584
|
+
isolatedAssetKey: void 0,
|
|
585
|
+
spool: "0xeedf438abcaa6ce4d9625ffca110920592d5867e4c5637d84ad9f466c4feb800",
|
|
586
|
+
spoolReward: "0x89255a2f86ed7fbfef35ab8b7be48cc7667015975be2685dd9a55a9a64baf76e",
|
|
587
|
+
sCoinTreasury: "0x55f4dfe9e40bc4cc11c70fcb1f3daefa2bdc330567c58d4f0792fbd9f9175a62",
|
|
588
|
+
coinDecimalId: "0x2f9217f533e51334873a39b8026a4aa6919497b47f49d0986a4f1aec66f8a34d"
|
|
565
589
|
},
|
|
566
590
|
hasui: {
|
|
567
591
|
lendingPoolAddress: "0x7ebc607f6bdeb659fb6506cb91c5cc1d47bb365cfd5d2e637ea765346ec84ed4",
|
|
@@ -574,7 +598,9 @@ var POOL_ADDRESSES = {
|
|
|
574
598
|
borrowLimitKey: "0x65333e606eead786a999c8267bc9886b0fdbc298a8a8635a48a9c9b8838d9395",
|
|
575
599
|
isolatedAssetKey: void 0,
|
|
576
600
|
spool: "0xa6148bc1b623e936d39a952ceb5bea79e8b37228a8f595067bf1852efd3c34aa",
|
|
577
|
-
spoolReward: "0x6f3563644d3e2ef13176dbf9d865bd93479df60ccbe07b7e66db57f6309f5a66"
|
|
601
|
+
spoolReward: "0x6f3563644d3e2ef13176dbf9d865bd93479df60ccbe07b7e66db57f6309f5a66",
|
|
602
|
+
sCoinTreasury: "0x404ccc1404d74a90eb6f9c9d4b6cda6d417fb03189f80d9070a35e5dab1df0f5",
|
|
603
|
+
coinDecimalId: "0x2c5f33af93f6511df699aaaa5822d823aac6ed99d4a0de2a4a50b3afa0172e24"
|
|
578
604
|
},
|
|
579
605
|
vsui: {
|
|
580
606
|
lendingPoolAddress: "0xda9257c0731d8822e8a438ebced13415850d705b779c79958dcf2aeb21fcb43d",
|
|
@@ -587,7 +613,9 @@ var POOL_ADDRESSES = {
|
|
|
587
613
|
borrowLimitKey: "0x4eb206b4417642cfc1b02f80bb5f5e366af2af2f9fb4ea4f4e898ae82367f8a0",
|
|
588
614
|
isolatedAssetKey: void 0,
|
|
589
615
|
spool: "0x69ce8e537e750a95381e6040794afa5ab1758353a1a2e1de7760391b01f91670",
|
|
590
|
-
spoolReward: "0xbca914adce058ad0902c7f3cfcd698392a475f00dcfdc3f76001d0370b98777a"
|
|
616
|
+
spoolReward: "0xbca914adce058ad0902c7f3cfcd698392a475f00dcfdc3f76001d0370b98777a",
|
|
617
|
+
sCoinTreasury: "0xc06688ee1af25abc286ffb1d18ce273d1d5907cd1064c25f4e8ca61ea989c1d1",
|
|
618
|
+
coinDecimalId: "0xabd84a23467b33854ab25cf862006fd97479f8f6f53e50fe732c43a274d939bd"
|
|
591
619
|
},
|
|
592
620
|
sca: {
|
|
593
621
|
lendingPoolAddress: "0x6fc7d4211fc7018b6c75e7b908b88f2e0536443239804a3d32af547637bd28d7",
|
|
@@ -600,20 +628,9 @@ var POOL_ADDRESSES = {
|
|
|
600
628
|
borrowLimitKey: "0x04c7de61c5b42972f9bf6a8b1848e5fea2d037ee8deba81741ecd4a70aa80d30",
|
|
601
629
|
isolatedAssetKey: void 0,
|
|
602
630
|
spool: void 0,
|
|
603
|
-
spoolReward: void 0
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
lendingPoolAddress: "0xf4a67ffb43da1e1c61c049f188f19463ea8dbbf2d5ef4722d6df854ff1b1cc03",
|
|
607
|
-
collateralPoolAddress: void 0,
|
|
608
|
-
borrowDynamic: "0x95e00d7466f97a100e70f08bd37788dc49335796f6f49fab996d40dd0681c6d3",
|
|
609
|
-
interestModel: "0x4143c298506a332d92ea8a995e6f3991ee3215f58f6fc6441752835d275b9a69",
|
|
610
|
-
riskModel: void 0,
|
|
611
|
-
borrowFeeKey: "0xb14ee43f4ad2a2c40bac8c4406a401690e93c982e289cf3802fedf74a159cab2",
|
|
612
|
-
supplyLimitKey: "0x599528fdfdc253e90dfd0acf4f4a166b391e2aac1ca6528abbff63225b548fee",
|
|
613
|
-
borrowLimitKey: "0xf4217e8ef9d9c32e8992092e910a77535a8124c19b8a762a673f227f5f765a4e",
|
|
614
|
-
isolatedAssetKey: "0x208d3a24ba369dcfc8f0387333d1512b98199eb150d2f2a69359ff708cf761e3",
|
|
615
|
-
spool: void 0,
|
|
616
|
-
spoolReward: void 0
|
|
631
|
+
spoolReward: void 0,
|
|
632
|
+
sCoinTreasury: "0xe04bfc95e00252bd654ee13c08edef9ac5e4b6ae4074e8390db39e9a0109c529",
|
|
633
|
+
coinDecimalId: "0x5d26a1e9a55c88147ac870bfa31b729d7f49f8804b8b3adfdf3582d301cca844"
|
|
617
634
|
},
|
|
618
635
|
fud: {
|
|
619
636
|
lendingPoolAddress: "0xefed2cbe76b344792ac724523c8b2236740d1cea2100d46a0ed0dc760c7f4231",
|
|
@@ -626,7 +643,24 @@ var POOL_ADDRESSES = {
|
|
|
626
643
|
borrowLimitKey: "0x3d928a001c453c50004baa54e14b0a0e1b0907d9c613dfd76064fd7ed4e8beb8",
|
|
627
644
|
isolatedAssetKey: "0xfcb533e9e4e31f9c9f32d6cbf7fbb3425f1d60474e229a363a2dc7f835d587e2",
|
|
628
645
|
spool: void 0,
|
|
629
|
-
spoolReward: void 0
|
|
646
|
+
spoolReward: void 0,
|
|
647
|
+
sCoinTreasury: "0xf25212f11d182decff7a86165699a73e3d5787aced203ca539f43cfbc10db867",
|
|
648
|
+
coinDecimalId: "0x01087411ef48aaac1eb6e24803213e3a60a03b147dac930e5e341f17a85e524e"
|
|
649
|
+
},
|
|
650
|
+
deep: {
|
|
651
|
+
lendingPoolAddress: "0xf4a67ffb43da1e1c61c049f188f19463ea8dbbf2d5ef4722d6df854ff1b1cc03",
|
|
652
|
+
collateralPoolAddress: void 0,
|
|
653
|
+
borrowDynamic: "0x95e00d7466f97a100e70f08bd37788dc49335796f6f49fab996d40dd0681c6d3",
|
|
654
|
+
interestModel: "0x4143c298506a332d92ea8a995e6f3991ee3215f58f6fc6441752835d275b9a69",
|
|
655
|
+
riskModel: void 0,
|
|
656
|
+
borrowFeeKey: "0xb14ee43f4ad2a2c40bac8c4406a401690e93c982e289cf3802fedf74a159cab2",
|
|
657
|
+
supplyLimitKey: "0x599528fdfdc253e90dfd0acf4f4a166b391e2aac1ca6528abbff63225b548fee",
|
|
658
|
+
borrowLimitKey: "0xf4217e8ef9d9c32e8992092e910a77535a8124c19b8a762a673f227f5f765a4e",
|
|
659
|
+
isolatedAssetKey: "0x208d3a24ba369dcfc8f0387333d1512b98199eb150d2f2a69359ff708cf761e3",
|
|
660
|
+
spool: void 0,
|
|
661
|
+
spoolReward: void 0,
|
|
662
|
+
sCoinTreasury: "0xc63838fabe37b25ad897392d89876d920f5e0c6a406bf3abcb84753d2829bc88",
|
|
663
|
+
coinDecimalId: "0x6e60b051a08fa836f5a7acd7c464c8d9825bc29c44657fe170fe9b8e1e4770c0"
|
|
630
664
|
}
|
|
631
665
|
};
|
|
632
666
|
|
|
@@ -1214,7 +1248,7 @@ var TEST_ADDRESSES = {
|
|
|
1214
1248
|
};
|
|
1215
1249
|
|
|
1216
1250
|
// src/constants/tokenBucket.ts
|
|
1217
|
-
var DEFAULT_TOKENS_PER_INTERVAL =
|
|
1251
|
+
var DEFAULT_TOKENS_PER_INTERVAL = 10;
|
|
1218
1252
|
var DEFAULT_INTERVAL_IN_MS = 250;
|
|
1219
1253
|
|
|
1220
1254
|
// src/constants/vesca.ts
|
|
@@ -1881,10 +1915,16 @@ function withIndexerFallback(method) {
|
|
|
1881
1915
|
var parseObjectAs = (object) => {
|
|
1882
1916
|
if (!(object && object.content && "fields" in object.content))
|
|
1883
1917
|
throw new Error(`Failed to parse object`);
|
|
1884
|
-
const
|
|
1885
|
-
if (typeof
|
|
1886
|
-
|
|
1887
|
-
|
|
1918
|
+
const fields = object.content.fields;
|
|
1919
|
+
if (typeof fields === "object" && "value" in fields) {
|
|
1920
|
+
const value = fields.value;
|
|
1921
|
+
if (typeof value === "object" && "fields" in value)
|
|
1922
|
+
return value.fields;
|
|
1923
|
+
return value;
|
|
1924
|
+
} else if (typeof fields === "object") {
|
|
1925
|
+
return fields;
|
|
1926
|
+
}
|
|
1927
|
+
return fields;
|
|
1888
1928
|
};
|
|
1889
1929
|
|
|
1890
1930
|
// src/models/scallopCache.ts
|
|
@@ -2039,10 +2079,33 @@ var ScallopCache = class {
|
|
|
2039
2079
|
retryDelay: 1e3,
|
|
2040
2080
|
queryKey: queryKeys.rpc.getOwnedObjects(input),
|
|
2041
2081
|
queryFn: async () => {
|
|
2042
|
-
|
|
2082
|
+
const results = await callWithRateLimit(
|
|
2043
2083
|
this.tokenBucket,
|
|
2044
2084
|
async () => await this.client.getOwnedObjects(input)
|
|
2045
2085
|
);
|
|
2086
|
+
if (results && results.data.length > 0) {
|
|
2087
|
+
results.data.filter(
|
|
2088
|
+
(result) => !!result.data
|
|
2089
|
+
).forEach((result) => {
|
|
2090
|
+
this.queryClient.setQueriesData(
|
|
2091
|
+
{
|
|
2092
|
+
exact: false,
|
|
2093
|
+
queryKey: queryKeys.rpc.getObject(
|
|
2094
|
+
result.data.objectId,
|
|
2095
|
+
input.options ?? {}
|
|
2096
|
+
)
|
|
2097
|
+
},
|
|
2098
|
+
{
|
|
2099
|
+
data: result.data,
|
|
2100
|
+
error: null
|
|
2101
|
+
},
|
|
2102
|
+
{
|
|
2103
|
+
updatedAt: Date.now()
|
|
2104
|
+
}
|
|
2105
|
+
);
|
|
2106
|
+
});
|
|
2107
|
+
}
|
|
2108
|
+
return results;
|
|
2046
2109
|
}
|
|
2047
2110
|
});
|
|
2048
2111
|
}
|
|
@@ -2065,10 +2128,29 @@ var ScallopCache = class {
|
|
|
2065
2128
|
retryDelay: (attemptIndex) => Math.min(1e3 * attemptIndex, 8e3),
|
|
2066
2129
|
queryKey: queryKeys.rpc.getDynamicFieldObject(input),
|
|
2067
2130
|
queryFn: async () => {
|
|
2068
|
-
|
|
2131
|
+
const result = await callWithRateLimit(
|
|
2069
2132
|
this.tokenBucket,
|
|
2070
2133
|
() => this.client.getDynamicFieldObject(input)
|
|
2071
2134
|
);
|
|
2135
|
+
if (result?.data) {
|
|
2136
|
+
this.queryClient.setQueriesData(
|
|
2137
|
+
{
|
|
2138
|
+
exact: false,
|
|
2139
|
+
queryKey: queryKeys.rpc.getObject(result?.data.objectId, {
|
|
2140
|
+
showContent: true,
|
|
2141
|
+
showOwner: true
|
|
2142
|
+
})
|
|
2143
|
+
},
|
|
2144
|
+
{
|
|
2145
|
+
data: result.data,
|
|
2146
|
+
error: null
|
|
2147
|
+
},
|
|
2148
|
+
{
|
|
2149
|
+
updatedAt: Date.now()
|
|
2150
|
+
}
|
|
2151
|
+
);
|
|
2152
|
+
}
|
|
2153
|
+
return result;
|
|
2072
2154
|
}
|
|
2073
2155
|
});
|
|
2074
2156
|
}
|
|
@@ -3706,14 +3788,26 @@ var getObligations = async ({
|
|
|
3706
3788
|
} while (hasNextPage);
|
|
3707
3789
|
const keyObjects = keyObjectsResponse.filter((ref) => !!ref.data);
|
|
3708
3790
|
const obligations = [];
|
|
3791
|
+
const obligationsObjects = await queryMultipleObjects(
|
|
3792
|
+
address.cache,
|
|
3793
|
+
keyObjects.map((ref) => ref.data?.content).filter(
|
|
3794
|
+
(content) => content?.dataType === "moveObject"
|
|
3795
|
+
).map((content) => content.fields.ownership.fields.of),
|
|
3796
|
+
{
|
|
3797
|
+
showContent: true
|
|
3798
|
+
}
|
|
3799
|
+
);
|
|
3709
3800
|
await Promise.allSettled(
|
|
3710
|
-
keyObjects.map(async ({ data }) => {
|
|
3801
|
+
keyObjects.map(async ({ data }, idx) => {
|
|
3711
3802
|
const keyId = data?.objectId;
|
|
3712
3803
|
const content = data?.content;
|
|
3713
3804
|
if (keyId && content && "fields" in content) {
|
|
3714
3805
|
const fields = content.fields;
|
|
3715
3806
|
const obligationId = String(fields.ownership.fields.of);
|
|
3716
|
-
const locked = await getObligationLocked(
|
|
3807
|
+
const locked = await getObligationLocked(
|
|
3808
|
+
address.cache,
|
|
3809
|
+
obligationsObjects[idx]
|
|
3810
|
+
);
|
|
3717
3811
|
obligations.push({ id: obligationId, keyId, locked });
|
|
3718
3812
|
}
|
|
3719
3813
|
})
|
|
@@ -3721,14 +3815,12 @@ var getObligations = async ({
|
|
|
3721
3815
|
return obligations;
|
|
3722
3816
|
};
|
|
3723
3817
|
var getObligationLocked = async (cache, obligation) => {
|
|
3724
|
-
const
|
|
3818
|
+
const obligationObjectData = typeof obligation === "string" ? (await cache.queryGetObject(obligation, {
|
|
3725
3819
|
showContent: true
|
|
3726
3820
|
}))?.data : obligation;
|
|
3727
3821
|
let obligationLocked = false;
|
|
3728
|
-
if (
|
|
3729
|
-
obligationLocked = Boolean(
|
|
3730
|
-
obligationObjectResponse.content.fields.lock_key
|
|
3731
|
-
);
|
|
3822
|
+
if (obligationObjectData && obligationObjectData?.content?.dataType === "moveObject" && "lock_key" in obligationObjectData.content.fields) {
|
|
3823
|
+
obligationLocked = Boolean(obligationObjectData.content.fields.lock_key);
|
|
3732
3824
|
}
|
|
3733
3825
|
return obligationLocked;
|
|
3734
3826
|
};
|
|
@@ -4113,7 +4205,7 @@ var getObligationAccount = async (query, obligationId, ownerAddress, indexer = f
|
|
|
4113
4205
|
];
|
|
4114
4206
|
market = market ?? await query.getMarketPools(void 0, { indexer });
|
|
4115
4207
|
coinPrices = coinPrices ?? await query.getAllCoinPrices({ marketPools: market.pools });
|
|
4116
|
-
coinAmounts = coinAmounts
|
|
4208
|
+
coinAmounts = coinAmounts ?? await query.getCoinAmounts(coinNames, ownerAddress);
|
|
4117
4209
|
const [obligationQuery, borrowIncentivePools, borrowIncentiveAccounts] = await Promise.all([
|
|
4118
4210
|
query.queryObligation(obligationId),
|
|
4119
4211
|
query.getBorrowIncentivePools(void 0, {
|
|
@@ -4649,12 +4741,80 @@ var getSCoinSwapRate = async (query, fromSCoin, toSCoin, underlyingCoinPrice) =>
|
|
|
4649
4741
|
|
|
4650
4742
|
// src/queries/spoolQuery.ts
|
|
4651
4743
|
var import_utils9 = require("@mysten/sui/utils");
|
|
4744
|
+
var queryRequiredSpoolObjects = async (query, stakePoolCoinNames) => {
|
|
4745
|
+
const tasks = stakePoolCoinNames.map((t, idx) => ({
|
|
4746
|
+
poolCoinName: stakePoolCoinNames[idx],
|
|
4747
|
+
spool: POOL_ADDRESSES[t]?.spool,
|
|
4748
|
+
spoolReward: POOL_ADDRESSES[t]?.spoolReward,
|
|
4749
|
+
sCoinTreasury: POOL_ADDRESSES[t]?.sCoinTreasury
|
|
4750
|
+
}));
|
|
4751
|
+
const [spoolObjects, spoolRewardObjects, sCoinTreasuryObjects] = await Promise.all([
|
|
4752
|
+
queryMultipleObjects(
|
|
4753
|
+
query.cache,
|
|
4754
|
+
tasks.map((task) => task.spool).filter((t) => !!t)
|
|
4755
|
+
),
|
|
4756
|
+
queryMultipleObjects(
|
|
4757
|
+
query.cache,
|
|
4758
|
+
tasks.map((task) => task.spoolReward).filter((t) => !!t)
|
|
4759
|
+
),
|
|
4760
|
+
queryMultipleObjects(
|
|
4761
|
+
query.cache,
|
|
4762
|
+
tasks.map((task) => task.sCoinTreasury).filter((t) => !!t)
|
|
4763
|
+
)
|
|
4764
|
+
]);
|
|
4765
|
+
const mapObjects = (tasks2, fetchedObjects) => {
|
|
4766
|
+
const resultMap = {};
|
|
4767
|
+
let fetchedIndex = 0;
|
|
4768
|
+
for (const task of tasks2) {
|
|
4769
|
+
const key = task[Object.keys(task)[1]];
|
|
4770
|
+
if (key) {
|
|
4771
|
+
resultMap[task.poolCoinName] = fetchedObjects[fetchedIndex];
|
|
4772
|
+
fetchedIndex++;
|
|
4773
|
+
}
|
|
4774
|
+
}
|
|
4775
|
+
return resultMap;
|
|
4776
|
+
};
|
|
4777
|
+
const spoolMap = mapObjects(tasks, spoolObjects);
|
|
4778
|
+
const spoolRewardMap = mapObjects(tasks, spoolRewardObjects);
|
|
4779
|
+
const sCoinTreasuryMap = mapObjects(tasks, sCoinTreasuryObjects);
|
|
4780
|
+
return stakePoolCoinNames.reduce(
|
|
4781
|
+
(acc, name) => {
|
|
4782
|
+
acc[name] = {
|
|
4783
|
+
spool: spoolMap[name],
|
|
4784
|
+
spoolReward: spoolRewardMap[name],
|
|
4785
|
+
sCoinTreasury: sCoinTreasuryMap[name]
|
|
4786
|
+
};
|
|
4787
|
+
return acc;
|
|
4788
|
+
},
|
|
4789
|
+
{}
|
|
4790
|
+
);
|
|
4791
|
+
};
|
|
4792
|
+
var parseSpoolObjects = ({
|
|
4793
|
+
spool,
|
|
4794
|
+
spoolReward
|
|
4795
|
+
}) => {
|
|
4796
|
+
const _spool = parseObjectAs(spool);
|
|
4797
|
+
const _spoolReward = parseObjectAs(spoolReward);
|
|
4798
|
+
return {
|
|
4799
|
+
stakeType: _spool.stake_type,
|
|
4800
|
+
maxDistributedPoint: _spool.max_distributed_point,
|
|
4801
|
+
distributedPoint: _spool.distributed_point,
|
|
4802
|
+
distributedPointPerPeriod: _spool.distributed_point_per_period,
|
|
4803
|
+
pointDistributionTime: _spool.point_distribution_time,
|
|
4804
|
+
maxStake: _spool.max_stakes,
|
|
4805
|
+
stakes: _spool.stakes,
|
|
4806
|
+
index: _spool.index,
|
|
4807
|
+
createdAt: _spool.created_at,
|
|
4808
|
+
lastUpdate: _spool.last_update,
|
|
4809
|
+
..._spoolReward
|
|
4810
|
+
};
|
|
4811
|
+
};
|
|
4652
4812
|
var getSpools = async (query, stakeMarketCoinNames = [...SUPPORT_SPOOLS], indexer = false, marketPools, coinPrices) => {
|
|
4653
4813
|
const stakeCoinNames = stakeMarketCoinNames.map(
|
|
4654
4814
|
(stakeMarketCoinName) => query.utils.parseCoinName(stakeMarketCoinName)
|
|
4655
4815
|
);
|
|
4656
|
-
coinPrices = coinPrices ?? await query.utils.getCoinPrices() ?? {};
|
|
4657
4816
|
marketPools = marketPools ?? (await query.getMarketPools(stakeCoinNames, { indexer })).pools;
|
|
4817
|
+
coinPrices = coinPrices ?? await query.getAllCoinPrices({ marketPools }) ?? {};
|
|
4658
4818
|
if (!marketPools)
|
|
4659
4819
|
throw new Error(`Fail to fetch marketPools for ${stakeCoinNames}`);
|
|
4660
4820
|
const spools = {};
|
|
@@ -4669,126 +4829,93 @@ var getSpools = async (query, stakeMarketCoinNames = [...SUPPORT_SPOOLS], indexe
|
|
|
4669
4829
|
const rewardCoinName = query.utils.getSpoolRewardCoinName(
|
|
4670
4830
|
spool.marketCoinName
|
|
4671
4831
|
);
|
|
4672
|
-
const marketPool = marketPools[coinName];
|
|
4673
4832
|
spool.coinPrice = coinPrices[coinName] ?? spool.coinPrice;
|
|
4674
|
-
spool.marketCoinPrice = coinPrices[
|
|
4833
|
+
spool.marketCoinPrice = coinPrices[spool.marketCoinName] ?? spool.marketCoinPrice;
|
|
4675
4834
|
spool.rewardCoinPrice = coinPrices[rewardCoinName] ?? spool.rewardCoinPrice;
|
|
4676
4835
|
spools[spool.marketCoinName] = spool;
|
|
4677
4836
|
};
|
|
4678
4837
|
Object.values(spoolsIndexer).forEach(updateSpools);
|
|
4679
4838
|
return spools;
|
|
4680
4839
|
}
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4840
|
+
const requiredObjects = await queryRequiredSpoolObjects(
|
|
4841
|
+
query,
|
|
4842
|
+
stakeCoinNames
|
|
4843
|
+
);
|
|
4844
|
+
await Promise.allSettled(
|
|
4845
|
+
stakeMarketCoinNames.map(async (stakeMarketCoinName, idx) => {
|
|
4846
|
+
try {
|
|
4847
|
+
const stakeCoinName = stakeCoinNames[idx];
|
|
4848
|
+
const spool = await getSpool(
|
|
4849
|
+
query,
|
|
4850
|
+
stakeMarketCoinName,
|
|
4851
|
+
indexer,
|
|
4852
|
+
coinPrices,
|
|
4853
|
+
requiredObjects[stakeCoinName]
|
|
4854
|
+
);
|
|
4855
|
+
if (spool) {
|
|
4856
|
+
spools[stakeMarketCoinName] = spool;
|
|
4857
|
+
}
|
|
4858
|
+
} catch (e) {
|
|
4859
|
+
console.error(e);
|
|
4860
|
+
}
|
|
4861
|
+
})
|
|
4862
|
+
);
|
|
4694
4863
|
return spools;
|
|
4695
4864
|
};
|
|
4696
|
-
var getSpool = async (query, marketCoinName, indexer = false,
|
|
4865
|
+
var getSpool = async (query, marketCoinName, indexer = false, coinPrices, requiredObjects) => {
|
|
4697
4866
|
const coinName = query.utils.parseCoinName(marketCoinName);
|
|
4698
|
-
|
|
4699
|
-
if (!marketPool) {
|
|
4700
|
-
throw new Error(`Failed to fetch marketPool for ${marketCoinName}`);
|
|
4701
|
-
}
|
|
4702
|
-
const poolId = query.address.get(`spool.pools.${marketCoinName}.id`);
|
|
4703
|
-
const rewardPoolId = query.address.get(
|
|
4704
|
-
`spool.pools.${marketCoinName}.rewardPoolId`
|
|
4705
|
-
);
|
|
4706
|
-
let spool = void 0;
|
|
4707
|
-
coinPrices = coinPrices || await query.utils.getCoinPrices();
|
|
4867
|
+
coinPrices = coinPrices || await query.getAllCoinPrices();
|
|
4708
4868
|
if (indexer) {
|
|
4709
4869
|
const spoolIndexer = await query.indexer.getSpool(marketCoinName);
|
|
4710
4870
|
const coinName2 = query.utils.parseCoinName(marketCoinName);
|
|
4711
4871
|
const rewardCoinName2 = query.utils.getSpoolRewardCoinName(marketCoinName);
|
|
4712
|
-
spoolIndexer.coinPrice = coinPrices?.[coinName2]
|
|
4713
|
-
spoolIndexer.marketCoinPrice =
|
|
4714
|
-
spoolIndexer.rewardCoinPrice = coinPrices?.[rewardCoinName2]
|
|
4872
|
+
spoolIndexer.coinPrice = coinPrices?.[coinName2] ?? spoolIndexer.coinPrice;
|
|
4873
|
+
spoolIndexer.marketCoinPrice = coinPrices?.[marketCoinName] ?? spoolIndexer.marketCoinPrice;
|
|
4874
|
+
spoolIndexer.rewardCoinPrice = coinPrices?.[rewardCoinName2] ?? spoolIndexer.rewardCoinPrice;
|
|
4715
4875
|
return spoolIndexer;
|
|
4716
4876
|
}
|
|
4717
|
-
|
|
4718
|
-
[poolId, rewardPoolId],
|
|
4719
|
-
{
|
|
4720
|
-
showContent: true
|
|
4721
|
-
}
|
|
4722
|
-
);
|
|
4723
|
-
if (!(spoolObjectResponse[0] && spoolObjectResponse[1])) {
|
|
4724
|
-
throw new Error("Fail to fetch spoolObjectResponse!");
|
|
4725
|
-
}
|
|
4877
|
+
requiredObjects ?? (requiredObjects = (await queryRequiredSpoolObjects(query, [coinName]))[coinName]);
|
|
4726
4878
|
const rewardCoinName = query.utils.getSpoolRewardCoinName(marketCoinName);
|
|
4727
4879
|
coinPrices = coinPrices || await query.utils.getCoinPrices();
|
|
4728
|
-
const
|
|
4729
|
-
const
|
|
4730
|
-
|
|
4731
|
-
|
|
4732
|
-
|
|
4733
|
-
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4737
|
-
|
|
4738
|
-
|
|
4739
|
-
|
|
4740
|
-
|
|
4741
|
-
|
|
4742
|
-
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4748
|
-
|
|
4749
|
-
|
|
4750
|
-
)
|
|
4751
|
-
|
|
4752
|
-
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
|
|
4756
|
-
|
|
4757
|
-
|
|
4758
|
-
|
|
4759
|
-
|
|
4760
|
-
|
|
4761
|
-
|
|
4762
|
-
|
|
4763
|
-
|
|
4764
|
-
|
|
4765
|
-
|
|
4766
|
-
|
|
4767
|
-
rewardCoinDecimal
|
|
4768
|
-
);
|
|
4769
|
-
spool = {
|
|
4770
|
-
marketCoinName,
|
|
4771
|
-
symbol: query.utils.parseSymbol(marketCoinName),
|
|
4772
|
-
coinType: query.utils.parseCoinType(coinName),
|
|
4773
|
-
marketCoinType: query.utils.parseMarketCoinType(coinName),
|
|
4774
|
-
rewardCoinType: isMarketCoin(rewardCoinName) ? query.utils.parseMarketCoinType(rewardCoinName) : query.utils.parseCoinType(rewardCoinName),
|
|
4775
|
-
sCoinType: marketPool.sCoinType,
|
|
4776
|
-
coinDecimal: query.utils.getCoinDecimal(coinName),
|
|
4777
|
-
rewardCoinDecimal: query.utils.getCoinDecimal(rewardCoinName),
|
|
4778
|
-
coinPrice: coinPrices?.[coinName] ?? 0,
|
|
4779
|
-
marketCoinPrice,
|
|
4780
|
-
rewardCoinPrice,
|
|
4781
|
-
maxPoint: parsedSpoolData.maxPoint,
|
|
4782
|
-
distributedPoint: parsedSpoolData.distributedPoint,
|
|
4783
|
-
maxStake: parsedSpoolData.maxStake,
|
|
4784
|
-
...calculatedSpoolData,
|
|
4785
|
-
exchangeRateNumerator: parsedSpoolRewardPoolData.exchangeRateNumerator,
|
|
4786
|
-
exchangeRateDenominator: parsedSpoolRewardPoolData.exchangeRateDenominator,
|
|
4787
|
-
...calculatedRewardPoolData
|
|
4788
|
-
};
|
|
4789
|
-
}
|
|
4790
|
-
}
|
|
4791
|
-
return spool;
|
|
4880
|
+
const parsedSpoolObjects = parseSpoolObjects(requiredObjects);
|
|
4881
|
+
const parsedSpoolData = parseOriginSpoolData(parsedSpoolObjects);
|
|
4882
|
+
const marketCoinPrice = coinPrices?.[marketCoinName] ?? 0;
|
|
4883
|
+
const marketCoinDecimal = query.utils.getCoinDecimal(marketCoinName);
|
|
4884
|
+
const calculatedSpoolData = calculateSpoolData(
|
|
4885
|
+
parsedSpoolData,
|
|
4886
|
+
marketCoinPrice,
|
|
4887
|
+
marketCoinDecimal
|
|
4888
|
+
);
|
|
4889
|
+
const parsedSpoolRewardPoolData = parseOriginSpoolRewardPoolData(parsedSpoolObjects);
|
|
4890
|
+
const rewardCoinPrice = coinPrices?.[rewardCoinName] ?? 0;
|
|
4891
|
+
const rewardCoinDecimal = query.utils.getCoinDecimal(rewardCoinName);
|
|
4892
|
+
const calculatedRewardPoolData = calculateSpoolRewardPoolData(
|
|
4893
|
+
parsedSpoolData,
|
|
4894
|
+
parsedSpoolRewardPoolData,
|
|
4895
|
+
calculatedSpoolData,
|
|
4896
|
+
rewardCoinPrice,
|
|
4897
|
+
rewardCoinDecimal
|
|
4898
|
+
);
|
|
4899
|
+
return {
|
|
4900
|
+
marketCoinName,
|
|
4901
|
+
symbol: query.utils.parseSymbol(marketCoinName),
|
|
4902
|
+
coinType: query.utils.parseCoinType(coinName),
|
|
4903
|
+
marketCoinType: query.utils.parseMarketCoinType(coinName),
|
|
4904
|
+
rewardCoinType: isMarketCoin(rewardCoinName) ? query.utils.parseMarketCoinType(rewardCoinName) : query.utils.parseCoinType(rewardCoinName),
|
|
4905
|
+
sCoinType: query.utils.parseSCoinType(marketCoinName),
|
|
4906
|
+
coinDecimal: query.utils.getCoinDecimal(coinName),
|
|
4907
|
+
rewardCoinDecimal: query.utils.getCoinDecimal(rewardCoinName),
|
|
4908
|
+
coinPrice: coinPrices?.[coinName] ?? 0,
|
|
4909
|
+
marketCoinPrice,
|
|
4910
|
+
rewardCoinPrice,
|
|
4911
|
+
maxPoint: parsedSpoolData.maxPoint,
|
|
4912
|
+
distributedPoint: parsedSpoolData.distributedPoint,
|
|
4913
|
+
maxStake: parsedSpoolData.maxStake,
|
|
4914
|
+
...calculatedSpoolData,
|
|
4915
|
+
exchangeRateNumerator: parsedSpoolRewardPoolData.exchangeRateNumerator,
|
|
4916
|
+
exchangeRateDenominator: parsedSpoolRewardPoolData.exchangeRateDenominator,
|
|
4917
|
+
...calculatedRewardPoolData
|
|
4918
|
+
};
|
|
4792
4919
|
};
|
|
4793
4920
|
var getStakeAccounts = async ({
|
|
4794
4921
|
utils
|
|
@@ -5209,6 +5336,13 @@ var getAllAddresses = async (query) => {
|
|
|
5209
5336
|
// @ts-ignore
|
|
5210
5337
|
`spool.pools.s${coinName}.rewardPoolId`
|
|
5211
5338
|
);
|
|
5339
|
+
const sCoinTreasury = query.address.get(
|
|
5340
|
+
// @ts-ignore
|
|
5341
|
+
`scoin.coins.s${coinName}.treasury`
|
|
5342
|
+
);
|
|
5343
|
+
const coinDecimalId = query.address.get(
|
|
5344
|
+
`core.coins.${coinName}.metaData`
|
|
5345
|
+
);
|
|
5212
5346
|
results[coinName] = {
|
|
5213
5347
|
lendingPoolAddress: addresses[0],
|
|
5214
5348
|
collateralPoolAddress: addresses[1],
|
|
@@ -5220,7 +5354,9 @@ var getAllAddresses = async (query) => {
|
|
|
5220
5354
|
borrowLimitKey: addresses[7],
|
|
5221
5355
|
isolatedAssetKey: addresses[8],
|
|
5222
5356
|
spool,
|
|
5223
|
-
spoolReward: rewardPool
|
|
5357
|
+
spoolReward: rewardPool,
|
|
5358
|
+
sCoinTreasury,
|
|
5359
|
+
coinDecimalId
|
|
5224
5360
|
};
|
|
5225
5361
|
await new Promise((resolve) => setTimeout(resolve, 200));
|
|
5226
5362
|
})
|
|
@@ -5996,7 +6132,7 @@ var generateCoreNormalMethod = ({
|
|
|
5996
6132
|
coreIds.market,
|
|
5997
6133
|
coreIds.coinDecimalsRegistry,
|
|
5998
6134
|
borrowReferral,
|
|
5999
|
-
txBlock.pure.u64(amount),
|
|
6135
|
+
typeof amount === "number" ? txBlock.pure.u64(amount) : amount,
|
|
6000
6136
|
coreIds.xOracle,
|
|
6001
6137
|
import_utils14.SUI_CLOCK_OBJECT_ID
|
|
6002
6138
|
],
|
|
@@ -7730,13 +7866,8 @@ var ScallopQuery = class {
|
|
|
7730
7866
|
* @return Spool data.
|
|
7731
7867
|
*/
|
|
7732
7868
|
async getSpool(stakeMarketCoinName, args) {
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
stakeMarketCoinName,
|
|
7736
|
-
args?.indexer,
|
|
7737
|
-
args?.marketPool,
|
|
7738
|
-
args?.coinPrices
|
|
7739
|
-
);
|
|
7869
|
+
const spools = await this.getSpools(void 0, args);
|
|
7870
|
+
return spools[stakeMarketCoinName];
|
|
7740
7871
|
}
|
|
7741
7872
|
/**
|
|
7742
7873
|
* Get stake accounts data for all stake pools (spools).
|
|
@@ -7902,11 +8033,9 @@ var ScallopQuery = class {
|
|
|
7902
8033
|
* @return Borrowing and collateral information.
|
|
7903
8034
|
*/
|
|
7904
8035
|
async getObligationAccount(obligationId, ownerAddress = this.walletAddress, args) {
|
|
7905
|
-
|
|
7906
|
-
|
|
7907
|
-
obligationId
|
|
7908
|
-
ownerAddress,
|
|
7909
|
-
args?.indexer
|
|
8036
|
+
const results = await this.getObligationAccounts(ownerAddress, args);
|
|
8037
|
+
return Object.values(results).find(
|
|
8038
|
+
(obligation) => obligation?.obligationId === obligationId
|
|
7910
8039
|
);
|
|
7911
8040
|
}
|
|
7912
8041
|
/**
|
|
@@ -8735,6 +8864,8 @@ var ScallopClient = class {
|
|
|
8735
8864
|
txBlock.setSender(sender);
|
|
8736
8865
|
const rewardCoinsCollection = {};
|
|
8737
8866
|
const obligationAccount = await this.query.getObligationAccount(obligationId);
|
|
8867
|
+
if (!obligationAccount)
|
|
8868
|
+
throw new Error("Obligation not found");
|
|
8738
8869
|
const rewardCoinNames = Object.values(obligationAccount.borrowIncentives).flatMap(
|
|
8739
8870
|
({ rewards }) => rewards.filter(({ availableClaimAmount }) => availableClaimAmount > 0)
|
|
8740
8871
|
).flatMap(({ coinName }) => coinName);
|
|
@@ -9066,9 +9197,11 @@ var Scallop = class {
|
|
|
9066
9197
|
ScallopQuery,
|
|
9067
9198
|
ScallopUtils,
|
|
9068
9199
|
TEST_ADDRESSES,
|
|
9200
|
+
TokenBucket,
|
|
9069
9201
|
UNLOCK_ROUND_DURATION,
|
|
9070
9202
|
USE_TEST_ADDRESS,
|
|
9071
9203
|
assetCoins,
|
|
9204
|
+
callWithRateLimit,
|
|
9072
9205
|
coinDecimals,
|
|
9073
9206
|
coinIds,
|
|
9074
9207
|
marketCoins,
|