@scallop-io/sui-scallop-sdk 0.44.6 → 0.44.8
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/README.md +8 -1
- package/dist/constants/common.d.ts +2 -1
- package/dist/index.js +488 -92
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +486 -92
- package/dist/index.mjs.map +1 -1
- package/dist/models/index.d.ts +1 -0
- package/dist/models/scallop.d.ts +9 -1
- package/dist/models/scallopAddress.d.ts +1 -1
- package/dist/models/scallopBuilder.d.ts +1 -1
- package/dist/models/scallopClient.d.ts +1 -1
- package/dist/models/scallopIndexer.d.ts +81 -0
- package/dist/models/scallopQuery.d.ts +31 -15
- package/dist/queries/borrowIncentiveQuery.d.ts +4 -1
- package/dist/queries/coreQuery.d.ts +10 -6
- package/dist/queries/portfolioQuery.d.ts +10 -5
- package/dist/queries/spoolQuery.d.ts +6 -3
- package/dist/types/query/portfolio.d.ts +2 -0
- package/dist/utils/query.d.ts +8 -0
- package/package.json +1 -1
- package/src/constants/common.ts +2 -1
- package/src/constants/enum.ts +1 -0
- package/src/models/index.ts +1 -0
- package/src/models/scallop.ts +14 -1
- package/src/models/scallopAddress.ts +1 -1
- package/src/models/scallopBuilder.ts +1 -1
- package/src/models/scallopClient.ts +36 -1
- package/src/models/scallopIndexer.ts +269 -0
- package/src/models/scallopQuery.ts +71 -28
- package/src/queries/borrowIncentiveQuery.ts +27 -6
- package/src/queries/coreQuery.ts +104 -18
- package/src/queries/portfolioQuery.ts +111 -52
- package/src/queries/spoolQuery.ts +67 -9
- package/src/types/query/portfolio.ts +2 -0
- package/src/utils/query.ts +26 -0
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
## Description
|
|
18
18
|
|
|
19
|
-
This SDK is used to interact with [sui-lending-protocal](https://github.com/scallop-io/sui-lending-protocol) and is written based on another sui-integrated tool, [sui-kit](https://github.com/scallop-io/sui-kit). It consists of
|
|
19
|
+
This SDK is used to interact with [sui-lending-protocal](https://github.com/scallop-io/sui-lending-protocol) and is written based on another sui-integrated tool, [sui-kit](https://github.com/scallop-io/sui-kit). It consists of seven main functional models, here's a brief introduction to each of them:
|
|
20
20
|
|
|
21
21
|
- **Scallop**: Provide an entry to quickly create an instance (client, address, query, builder, utils) and complete initialization at the same time.
|
|
22
22
|
|
|
@@ -30,6 +30,8 @@ This SDK is used to interact with [sui-lending-protocal](https://github.com/scal
|
|
|
30
30
|
|
|
31
31
|
- **ScallopUtils**: Used to encapsulate some useful methods that will be used when interacting with the scallop contract.
|
|
32
32
|
|
|
33
|
+
- **ScallopIndexer**: It is used to query the on-chain index data through the SDK API. It is mainly used in query instances, effectively reducing the number of RPC requests..
|
|
34
|
+
|
|
33
35
|
## Pre-requisites
|
|
34
36
|
|
|
35
37
|
- Installation:
|
|
@@ -50,6 +52,7 @@ This SDK is used to interact with [sui-lending-protocal](https://github.com/scal
|
|
|
50
52
|
const scallopBuilder = await scallopSDK.createScallopBuilder(...);
|
|
51
53
|
const scallopUtils = await scallopSDK.createScallopUtils(...);
|
|
52
54
|
const scallopClient = await scallopSDK.createScallopClient(...);
|
|
55
|
+
const scallopIndexer = await scallopSDK.createScallopIndexer();
|
|
53
56
|
|
|
54
57
|
// Or, you can choose to import the class directly to create an instance.
|
|
55
58
|
import {
|
|
@@ -57,6 +60,7 @@ This SDK is used to interact with [sui-lending-protocal](https://github.com/scal
|
|
|
57
60
|
ScallopBuilder,
|
|
58
61
|
ScallopQuery,
|
|
59
62
|
ScallopUtils,
|
|
63
|
+
ScallopIndexer,
|
|
60
64
|
ScallopClient,
|
|
61
65
|
} from '@scallop-io/sui-scallop-sdk'
|
|
62
66
|
|
|
@@ -65,6 +69,7 @@ This SDK is used to interact with [sui-lending-protocal](https://github.com/scal
|
|
|
65
69
|
const ScallopBuilder = new ScallopBuilder(...);
|
|
66
70
|
const ScallopUtils = new ScallopUtils(...);
|
|
67
71
|
const scallopClient = new ScallopClient(...);
|
|
72
|
+
const ScallopIndexer = new ScallopIndexer();
|
|
68
73
|
// Remember to initialize the instance before using it
|
|
69
74
|
await scallopAddress.read();
|
|
70
75
|
await ScallopQuery.init();
|
|
@@ -82,6 +87,7 @@ Below we will give a brief introduction to these instances respectively, and int
|
|
|
82
87
|
- [Use Scallop Address](./document/address.md)
|
|
83
88
|
- [Use Scallop Builder](./document/builder.md)
|
|
84
89
|
- [Use Scallop Utils](./document/utils.md)
|
|
90
|
+
- [Use Scallop Indexer](./document/indexer.md)
|
|
85
91
|
|
|
86
92
|
For the original codes, please refer to `test` folder.
|
|
87
93
|
|
|
@@ -95,6 +101,7 @@ You need to set up the `.env` file before testing. (Reference `.env.example`)
|
|
|
95
101
|
pnpm run test:unit test/builder.spec.ts
|
|
96
102
|
pnpm run test:unit test/query.spec.ts
|
|
97
103
|
pnpm run test:unit test/utils.spec.ts
|
|
104
|
+
pnpm run test:unit test/indexer.spec.ts
|
|
98
105
|
```
|
|
99
106
|
|
|
100
107
|
## License
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare const API_BASE_URL = "https://sui.api.scallop.io";
|
|
2
|
+
export declare const SDK_API_BASE_URL = "https://sui-scallop-sdk-api.vercel.app";
|
|
2
3
|
export declare const ADDRESSES_ID = "6462a088a7ace142bb6d7e9b";
|
|
3
4
|
export declare const PROTOCOL_OBJECT_ID = "0xefe8b36d5b2e43728cc323298626b83177803521d195cfb11e15b910e892fddf";
|
|
4
5
|
export declare const BORROW_FEE_PROTOCOL_ID = "0xc38f849e81cfe46d4e4320f508ea7dda42934a329d5a6571bb4c3cb6ea63f5da";
|
|
@@ -6,7 +7,7 @@ export declare const SUPPORT_POOLS: readonly ["eth", "btc", "usdc", "usdt", "sui
|
|
|
6
7
|
export declare const SUPPORT_COLLATERALS: readonly ["eth", "btc", "usdc", "usdt", "sui", "apt", "sol", "cetus", "afsui", "hasui", "vsui"];
|
|
7
8
|
export declare const SUPPORT_SPOOLS: readonly ["ssui", "susdc", "susdt"];
|
|
8
9
|
export declare const SUPPORT_SPOOLS_REWARDS: readonly ["sui"];
|
|
9
|
-
export declare const SUPPORT_BORROW_INCENTIVE_POOLS: readonly ["sui", "usdc"];
|
|
10
|
+
export declare const SUPPORT_BORROW_INCENTIVE_POOLS: readonly ["sui", "usdc", "usdt"];
|
|
10
11
|
export declare const SUPPORT_BORROW_INCENTIVE_REWARDS: readonly ["sui"];
|
|
11
12
|
export declare const SUPPORT_ORACLES: readonly ["supra", "switchboard", "pyth"];
|
|
12
13
|
export declare const SUPPORT_PACKAGES: readonly ["coinDecimalsRegistry", "math", "whitelist", "x", "protocol", "protocolWhitelist", "query", "supra", "pyth", "switchboard", "xOracle", "testCoin"];
|