@scallop-io/sui-scallop-sdk 2.2.1-sponsored-feeds-alpha.1 → 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/package.json +1 -1
- package/src/builders/oracles/index.ts +2 -2
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/package.json
CHANGED
|
@@ -83,10 +83,10 @@ export const updateOracles = async (
|
|
|
83
83
|
* Check if the Pyth pull model is not used but the feed is not sponsored.
|
|
84
84
|
* This is used to determine if we should update the Pyth price feeds.
|
|
85
85
|
*/
|
|
86
|
-
const
|
|
86
|
+
const notUsingPullAndNotSponsored =
|
|
87
87
|
!usePythPullModel && !sponsoredFeeds.has(pythAssetCoinName);
|
|
88
88
|
|
|
89
|
-
if (usePythPullModel ||
|
|
89
|
+
if (usePythPullModel || notUsingPullAndNotSponsored) {
|
|
90
90
|
needToUpdatePythPriceFeeds.push(pythAssetCoinName);
|
|
91
91
|
}
|
|
92
92
|
}
|