@scallop-io/sui-scallop-sdk 2.2.0 → 2.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -14
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
- package/src/builders/oracles/index.ts +40 -9
- package/src/models/scallopBuilder.ts +3 -0
package/README.md
CHANGED
|
@@ -47,17 +47,30 @@ This SDK is used to interact with [sui-lending-protocol](https://github.com/scal
|
|
|
47
47
|
const scallopSDK = new Scallop({
|
|
48
48
|
addressId: '67c44a103fe1b8c454eb9699',
|
|
49
49
|
networkType: 'mainnet',
|
|
50
|
+
secretKey: [secretKey]
|
|
50
51
|
...
|
|
51
52
|
});
|
|
52
53
|
|
|
53
|
-
const scallopAddress = await scallopSDK.getScallopAddress(
|
|
54
|
-
const scallopConstants = await scallopSDK.getScallopConstants(
|
|
55
|
-
const scallopQuery = await scallopSDK.createScallopQuery(
|
|
56
|
-
const scallopBuilder = await scallopSDK.createScallopBuilder(
|
|
57
|
-
const scallopUtils = await scallopSDK.createScallopUtils(
|
|
58
|
-
const scallopClient = await scallopSDK.createScallopClient(
|
|
54
|
+
const scallopAddress = await scallopSDK.getScallopAddress();
|
|
55
|
+
const scallopConstants = await scallopSDK.getScallopConstants();
|
|
56
|
+
const scallopQuery = await scallopSDK.createScallopQuery();
|
|
57
|
+
const scallopBuilder = await scallopSDK.createScallopBuilder();
|
|
58
|
+
const scallopUtils = await scallopSDK.createScallopUtils();
|
|
59
|
+
const scallopClient = await scallopSDK.createScallopClient();
|
|
59
60
|
const scallopIndexer = await scallopSDK.createScallopIndexer();
|
|
60
61
|
|
|
62
|
+
// Or with single init
|
|
63
|
+
await scallopSDK.init();
|
|
64
|
+
const scallopClient = scallopSDK.client;
|
|
65
|
+
const {
|
|
66
|
+
query,
|
|
67
|
+
builder,
|
|
68
|
+
constants,
|
|
69
|
+
address,
|
|
70
|
+
indexer
|
|
71
|
+
} = scallopClient;
|
|
72
|
+
const { indexer } = query;
|
|
73
|
+
|
|
61
74
|
// Or, you can choose to import the class directly to create an instance.
|
|
62
75
|
import {
|
|
63
76
|
ScallopAddress,
|
|
@@ -77,15 +90,15 @@ This SDK is used to interact with [sui-lending-protocol](https://github.com/scal
|
|
|
77
90
|
addressId: '67c44a103fe1b8c454eb9699',
|
|
78
91
|
...
|
|
79
92
|
);
|
|
80
|
-
const
|
|
93
|
+
const scallopQuery = new ScallopQuery(
|
|
81
94
|
addressId: '67c44a103fe1b8c454eb9699',
|
|
82
95
|
...
|
|
83
96
|
);
|
|
84
|
-
const
|
|
97
|
+
const scallopBuilder = new ScallopBuilder(
|
|
85
98
|
addressId: '67c44a103fe1b8c454eb9699',
|
|
86
99
|
...
|
|
87
100
|
);
|
|
88
|
-
const
|
|
101
|
+
const scallopUtils = new ScallopUtils(
|
|
89
102
|
addressId: '67c44a103fe1b8c454eb9699',
|
|
90
103
|
...
|
|
91
104
|
);
|
|
@@ -93,13 +106,14 @@ This SDK is used to interact with [sui-lending-protocol](https://github.com/scal
|
|
|
93
106
|
addressId: '67c44a103fe1b8c454eb9699',
|
|
94
107
|
...
|
|
95
108
|
);
|
|
96
|
-
const
|
|
109
|
+
const scallopIndexer = new ScallopIndexer();
|
|
110
|
+
|
|
97
111
|
// Remember to initialize the instance before using it
|
|
98
112
|
await scallopAddress.read();
|
|
99
113
|
await scallopConstants.init();
|
|
100
|
-
await
|
|
101
|
-
await
|
|
102
|
-
await
|
|
114
|
+
await scallopQuery.init();
|
|
115
|
+
await scallopBuilder.init();
|
|
116
|
+
await scallopUtils.init();
|
|
103
117
|
await scallopClient.init();
|
|
104
118
|
```
|
|
105
119
|
|
|
@@ -113,7 +127,7 @@ Below we will give a brief introduction to these instances respectively, and int
|
|
|
113
127
|
- [Use Scallop Builder](./document/builder.md)
|
|
114
128
|
- [Use Scallop Utils](./document/utils.md)
|
|
115
129
|
- [Use Scallop Indexer](./document/indexer.md)
|
|
116
|
-
- [Use Scallop
|
|
130
|
+
- [Use Scallop Constants](./document/constants.md)
|
|
117
131
|
|
|
118
132
|
For the original codes, please refer to `test` folder.
|
|
119
133
|
|
|
@@ -128,8 +142,13 @@ You need to set up the `.env` file before testing. (Reference `.env.example`)
|
|
|
128
142
|
pnpm run test:unit test/query.spec.ts
|
|
129
143
|
pnpm run test:unit test/utils.spec.ts
|
|
130
144
|
pnpm run test:unit test/indexer.spec.ts
|
|
145
|
+
pnpm run test:unit test/constants.spec.ts
|
|
146
|
+
pnpm run test:unit test/rate-limiter.spec.ts
|
|
131
147
|
```
|
|
132
148
|
|
|
133
149
|
## License
|
|
134
150
|
|
|
135
151
|
[APACHE-2.0](https://www.apache.org/licenses/LICENSE-2.0)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
[](https://deepwiki.com/scallop-io/sui-scallop-sdk)
|
package/dist/index.d.mts
CHANGED
|
@@ -1062,6 +1062,7 @@ declare class ScallopQuery implements ScallopQueryInterface {
|
|
|
1062
1062
|
type ScallopBuilderParams = {
|
|
1063
1063
|
query?: ScallopQuery;
|
|
1064
1064
|
usePythPullModel?: boolean;
|
|
1065
|
+
sponsoredFeeds?: string[];
|
|
1065
1066
|
useOnChainXOracleList?: boolean;
|
|
1066
1067
|
} & ScallopQueryParams;
|
|
1067
1068
|
/**
|
|
@@ -1079,6 +1080,7 @@ declare class ScallopBuilder implements ScallopBuilderInterface {
|
|
|
1079
1080
|
readonly query: ScallopQuery;
|
|
1080
1081
|
readonly usePythPullModel: boolean;
|
|
1081
1082
|
readonly useOnChainXOracleList: boolean;
|
|
1083
|
+
readonly sponsoredFeeds: string[];
|
|
1082
1084
|
constructor(params: ScallopBuilderParams);
|
|
1083
1085
|
get utils(): ScallopUtils;
|
|
1084
1086
|
get constants(): ScallopConstants;
|
package/dist/index.d.ts
CHANGED
|
@@ -1062,6 +1062,7 @@ declare class ScallopQuery implements ScallopQueryInterface {
|
|
|
1062
1062
|
type ScallopBuilderParams = {
|
|
1063
1063
|
query?: ScallopQuery;
|
|
1064
1064
|
usePythPullModel?: boolean;
|
|
1065
|
+
sponsoredFeeds?: string[];
|
|
1065
1066
|
useOnChainXOracleList?: boolean;
|
|
1066
1067
|
} & ScallopQueryParams;
|
|
1067
1068
|
/**
|
|
@@ -1079,6 +1080,7 @@ declare class ScallopBuilder implements ScallopBuilderInterface {
|
|
|
1079
1080
|
readonly query: ScallopQuery;
|
|
1080
1081
|
readonly usePythPullModel: boolean;
|
|
1081
1082
|
readonly useOnChainXOracleList: boolean;
|
|
1083
|
+
readonly sponsoredFeeds: string[];
|
|
1082
1084
|
constructor(params: ScallopBuilderParams);
|
|
1083
1085
|
get utils(): ScallopUtils;
|
|
1084
1086
|
get constants(): ScallopConstants;
|