@scallop-io/sui-scallop-sdk 0.47.0-alpha.1 → 0.47.0-alpha.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.
@@ -7,10 +7,10 @@ export declare const PROTOCOL_OBJECT_ID: "0xc9f859f98ca352a11b97a038c4b4162bee43
7
7
  export declare const BORROW_FEE_PROTOCOL_ID: "0xc9f859f98ca352a11b97a038c4b4162bee437b8df8caa047990fe9cb03d4f778" | "0xc38f849e81cfe46d4e4320f508ea7dda42934a329d5a6571bb4c3cb6ea63f5da";
8
8
  export declare const SCA_COIN_TYPE: "0x6cd813061a3adf3602b76545f076205f0c8e7ec1d3b1eab9a1da7992c18c0524::sca::SCA" | "0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6::sca::SCA";
9
9
  export declare const OLD_BORROW_INCENTIVE_PROTOCOL_ID: "0xc63072e7f5f4983a2efaf5bdba1480d5e7d74d57948e1c7cc436f8e22cbeb410";
10
- export declare const SUPPORT_POOLS: readonly ["weth", "wbtc", "wusdc", "wusdt", "sui", "wapt", "wsol", "cetus", "afsui", "hasui", "vsui", "sca"];
11
- export declare const SUPPORT_COLLATERALS: readonly ["weth", "wbtc", "wusdc", "wusdt", "sui", "wapt", "wsol", "cetus", "afsui", "hasui", "vsui", "sca"];
12
- export declare const SUPPORT_SPOOLS: readonly ["sweth", "ssui", "swusdc", "swusdt", "scetus", "safsui", "shasui", "svsui"];
13
- export declare const SUPPORT_SCOIN: readonly ["ssui", "swusdc", "swusdt", "safsui", "shasui", "svsui", "sweth", "ssca", "scetus", "swsol", "swbtc"];
10
+ export declare const SUPPORT_POOLS: readonly ["usdc", "weth", "wbtc", "wusdc", "wusdt", "sui", "wapt", "wsol", "cetus", "afsui", "hasui", "vsui", "sca"];
11
+ export declare const SUPPORT_COLLATERALS: readonly ["usdc", "weth", "wbtc", "wusdc", "wusdt", "sui", "wapt", "wsol", "cetus", "afsui", "hasui", "vsui", "sca"];
12
+ export declare const SUPPORT_SPOOLS: readonly ["susdc", "sweth", "ssui", "swusdc", "swusdt", "scetus", "safsui", "shasui", "svsui"];
13
+ export declare const SUPPORT_SCOIN: readonly ["susdc", "ssui", "swusdc", "swusdt", "safsui", "shasui", "svsui", "sweth", "ssca", "scetus", "swsol", "swbtc"];
14
14
  export declare const SUPPORT_SPOOLS_REWARDS: readonly ["sui"];
15
15
  export declare const SUPPORT_BORROW_INCENTIVE_POOLS: readonly ["sui", "wusdc", "wusdt", "afsui", "hasui", "vsui", "weth", "sca"];
16
16
  export declare const SUPPORT_BORROW_INCENTIVE_REWARDS: readonly ["sui", "sca"];
package/dist/index.js CHANGED
@@ -87,6 +87,8 @@ var BORROW_FEE_PROTOCOL_ID = IS_VE_SCA_TEST ? "0xc9f859f98ca352a11b97a038c4b4162
87
87
  var SCA_COIN_TYPE = IS_VE_SCA_TEST ? `0x6cd813061a3adf3602b76545f076205f0c8e7ec1d3b1eab9a1da7992c18c0524::sca::SCA` : "0x7016aae72cfc67f2fadf55769c0a7dd54291a583b63051a5ed71081cce836ac6::sca::SCA";
88
88
  var OLD_BORROW_INCENTIVE_PROTOCOL_ID = "0xc63072e7f5f4983a2efaf5bdba1480d5e7d74d57948e1c7cc436f8e22cbeb410";
89
89
  var SUPPORT_POOLS = [
90
+ "usdc",
91
+ // native USDC
90
92
  "weth",
91
93
  "wbtc",
92
94
  "wusdc",
@@ -101,6 +103,7 @@ var SUPPORT_POOLS = [
101
103
  "sca"
102
104
  ];
103
105
  var SUPPORT_COLLATERALS = [
106
+ "usdc",
104
107
  "weth",
105
108
  "wbtc",
106
109
  "wusdc",
@@ -115,6 +118,7 @@ var SUPPORT_COLLATERALS = [
115
118
  "sca"
116
119
  ];
117
120
  var SUPPORT_SPOOLS = [
121
+ "susdc",
118
122
  "sweth",
119
123
  "ssui",
120
124
  "swusdc",
@@ -125,6 +129,7 @@ var SUPPORT_SPOOLS = [
125
129
  "svsui"
126
130
  ];
127
131
  var SUPPORT_SCOIN = [
132
+ "susdc",
128
133
  "ssui",
129
134
  "swusdc",
130
135
  "swusdt",
@@ -167,6 +172,7 @@ var SUPPORT_PACKAGES = [
167
172
 
168
173
  // src/constants/enum.ts
169
174
  var coinDecimals = {
175
+ usdc: 6,
170
176
  weth: 8,
171
177
  wbtc: 8,
172
178
  wusdc: 6,
@@ -179,6 +185,7 @@ var coinDecimals = {
179
185
  hasui: 9,
180
186
  vsui: 9,
181
187
  sca: 9,
188
+ susdc: 6,
182
189
  sweth: 8,
183
190
  swbtc: 8,
184
191
  swusdc: 6,
@@ -193,6 +200,7 @@ var coinDecimals = {
193
200
  ssca: 9
194
201
  };
195
202
  var assetCoins = {
203
+ usdc: "usdc",
196
204
  weth: "weth",
197
205
  wbtc: "wbtc",
198
206
  wusdc: "wusdc",
@@ -207,6 +215,7 @@ var assetCoins = {
207
215
  sca: "sca"
208
216
  };
209
217
  var marketCoins = {
218
+ susdc: "susdc",
210
219
  sweth: "sweth",
211
220
  swbtc: "swbtc",
212
221
  swusdc: "swusdc",
@@ -221,6 +230,7 @@ var marketCoins = {
221
230
  ssca: "ssca"
222
231
  };
223
232
  var sCoins = {
233
+ susdc: "susdc",
224
234
  sweth: "sweth",
225
235
  swusdc: "swusdc",
226
236
  swusdt: "swusdt",
@@ -234,6 +244,7 @@ var sCoins = {
234
244
  swbtc: "swbtc"
235
245
  };
236
246
  var stakeMarketCoins = {
247
+ susdc: "susdc",
237
248
  sweth: "sweth",
238
249
  ssui: "ssui",
239
250
  swusdc: "swusdc",
@@ -251,7 +262,8 @@ var spoolRewardCoins = {
251
262
  scetus: "sui",
252
263
  safsui: "sui",
253
264
  shasui: "sui",
254
- svsui: "sui"
265
+ svsui: "sui",
266
+ susdc: "sui"
255
267
  };
256
268
  var borrowIncentiveRewardCoins = {
257
269
  sui: ["sui", "sca"],
@@ -264,6 +276,7 @@ var borrowIncentiveRewardCoins = {
264
276
  weth: ["sui"]
265
277
  };
266
278
  var coinIds = {
279
+ usdc: "0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7",
267
280
  sui: "0x0000000000000000000000000000000000000000000000000000000000000002",
268
281
  weth: "0xaf8cd5edc19c4512f4259f0bee101a40d41ebed738ade5874359610ef8eeced5",
269
282
  wbtc: "0x027792d9fed7f9844eb4839566001bb6f6cb4804f66aa2da6fe1ee242d896881",
@@ -289,6 +302,8 @@ var voloCoinIds = {
289
302
  vsui: "0x549e8b69270defbfafd4f94e17ec44cdbdd99820b33bda2278dea3b9a32d3f55"
290
303
  };
291
304
  var sCoinIds = {
305
+ susdc: "",
306
+ // TODO: sCoin contract
292
307
  ssui: "0xaafc4f740de0dd0dde642a31148fb94517087052f19afb0f7bed1dc41a50c77b::scallop_sui::SCALLOP_SUI",
293
308
  scetus: "0xea346ce428f91ab007210443efcea5f5cdbbb3aae7e9affc0ca93f9203c31f0c::scallop_cetus::SCALLOP_CETUS",
294
309
  ssca: "0x5ca17430c1d046fae9edeaa8fd76c7b4193a00d764a0ecfa9418d733ad27bc1e::scallop_sca::SCALLOP_SCA",
@@ -2792,14 +2807,14 @@ var getObligations = async ({
2792
2807
  );
2793
2808
  return obligations;
2794
2809
  };
2795
- var getObligationLocked = async (cache, obligationId) => {
2796
- const obligationObjectResponse = await cache.queryGetObject(obligationId, {
2810
+ var getObligationLocked = async (cache, obligation) => {
2811
+ const obligationObjectResponse = typeof obligation === "string" ? (await cache.queryGetObject(obligation, {
2797
2812
  showContent: true
2798
- });
2813
+ }))?.data : obligation;
2799
2814
  let obligationLocked = false;
2800
- if (obligationObjectResponse?.data && obligationObjectResponse?.data?.content?.dataType === "moveObject" && "lock_key" in obligationObjectResponse.data.content.fields) {
2815
+ if (obligationObjectResponse && obligationObjectResponse?.content?.dataType === "moveObject" && "lock_key" in obligationObjectResponse.content.fields) {
2801
2816
  obligationLocked = Boolean(
2802
- obligationObjectResponse.data.content.fields.lock_key
2817
+ obligationObjectResponse.content.fields.lock_key
2803
2818
  );
2804
2819
  }
2805
2820
  return obligationLocked;
@@ -3094,6 +3109,7 @@ var getStakeAccounts = async ({
3094
3109
  }
3095
3110
  } while (hasNextPage);
3096
3111
  const stakeAccounts = {
3112
+ susdc: [],
3097
3113
  sweth: [],
3098
3114
  ssui: [],
3099
3115
  swusdc: [],
@@ -6392,7 +6408,7 @@ var ScallopIndexer = class {
6392
6408
  const response = await this.cache.queryClient.fetchQuery({
6393
6409
  queryKey: ["market"],
6394
6410
  queryFn: async () => {
6395
- return await this._requestClient.get(`/api/market`);
6411
+ return await this._requestClient.get(`/api/market/migrate`);
6396
6412
  }
6397
6413
  });
6398
6414
  if (response.status === 200) {
@@ -6455,7 +6471,7 @@ var ScallopIndexer = class {
6455
6471
  const response = await this.cache.queryClient.fetchQuery({
6456
6472
  queryKey: ["spools"],
6457
6473
  queryFn: async () => {
6458
- return await this._requestClient.get(`/api/spools`);
6474
+ return await this._requestClient.get(`/api/spools/migrate`);
6459
6475
  }
6460
6476
  });
6461
6477
  if (response.status === 200) {
@@ -6484,7 +6500,7 @@ var ScallopIndexer = class {
6484
6500
  const response = await this.cache.queryClient.fetchQuery({
6485
6501
  queryKey: ["borrowIncentivePools"],
6486
6502
  queryFn: async () => {
6487
- return await this._requestClient.get(`/api/borrowIncentivePools`);
6503
+ return await this._requestClient.get(`/api/borrowIncentivePools/migrate`);
6488
6504
  }
6489
6505
  });
6490
6506
  if (response.status === 200) {
@@ -7685,7 +7701,7 @@ var ScallopClient = class {
7685
7701
  await this.utils.mergeSimilarCoins(
7686
7702
  txBlock,
7687
7703
  coin,
7688
- this.utils.parseCoinType(this.utils.parseCoinName(stakeCoinName)),
7704
+ this.utils.parseCoinType(stakeCoinName),
7689
7705
  requireSender(txBlock)
7690
7706
  );
7691
7707
  txBlock.transferObjects([coin], sender);