@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 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 ScallopQuery = new ScallopQuery(
93
+ const scallopQuery = new ScallopQuery(
81
94
  addressId: '67c44a103fe1b8c454eb9699',
82
95
  ...
83
96
  );
84
- const ScallopBuilder = new ScallopBuilder(
97
+ const scallopBuilder = new ScallopBuilder(
85
98
  addressId: '67c44a103fe1b8c454eb9699',
86
99
  ...
87
100
  );
88
- const ScallopUtils = new ScallopUtils(
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 ScallopIndexer = new ScallopIndexer();
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 ScallopQuery.init();
101
- await ScallopBuilder.init();
102
- await ScallopUtils.init();
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 Indexer](./document/constants.md)
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
+ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/scallop-io/sui-scallop-sdk)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scallop-io/sui-scallop-sdk",
3
- "version": "2.2.1-sponsored-feeds-alpha.1",
3
+ "version": "2.2.1",
4
4
  "description": "Typescript sdk for interacting with Scallop contract on SUI",
5
5
  "keywords": [
6
6
  "sui",
@@ -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 notUsingPullButNotSponsored =
86
+ const notUsingPullAndNotSponsored =
87
87
  !usePythPullModel && !sponsoredFeeds.has(pythAssetCoinName);
88
88
 
89
- if (usePythPullModel || notUsingPullButNotSponsored) {
89
+ if (usePythPullModel || notUsingPullAndNotSponsored) {
90
90
  needToUpdatePythPriceFeeds.push(pythAssetCoinName);
91
91
  }
92
92
  }