@scallop-io/sui-scallop-sdk 2.3.13 → 2.3.14-rc.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scallop-io/sui-scallop-sdk",
3
- "version": "2.3.13",
3
+ "version": "2.3.14-rc.2",
4
4
  "description": "Typescript sdk for interacting with Scallop contract on SUI",
5
5
  "keywords": [
6
6
  "sui",
@@ -281,12 +281,27 @@ class ScallopClient implements ScallopClientInterface {
281
281
  * @param isSponsoredTx - Whether the transaction is sponsored.
282
282
  * @return Transaction block response or transaction block.
283
283
  */
284
+ async withdrawCollateral(
285
+ collateralCoinName: string,
286
+ amount: number
287
+ ): Promise<SuiTransactionBlockResponse>;
288
+
289
+ async withdrawCollateral<S extends boolean>(
290
+ collateralCoinName: string,
291
+ amount: number,
292
+ sign?: S,
293
+ obligationId?: string,
294
+ obligationKey?: string,
295
+ walletAddress?: string,
296
+ isSponsoredTx?: boolean
297
+ ): Promise<ScallopClientFnReturnType<S>>;
298
+
284
299
  async withdrawCollateral<S extends boolean>(
285
300
  collateralCoinName: string,
286
301
  amount: number,
287
302
  sign: S = true as S,
288
- obligationId: string,
289
- obligationKey: string,
303
+ obligationId?: string,
304
+ obligationKey?: string,
290
305
  walletAddress?: string,
291
306
  isSponsoredTx?: boolean
292
307
  ): Promise<ScallopClientFnReturnType<S>> {
@@ -47,11 +47,12 @@ const DEFAULT_WHITELIST = {
47
47
  rewardsAsPoint: new Set(),
48
48
  suiBridge: new Set(),
49
49
  wormhole: new Set(),
50
+ layerZero: new Set(),
50
51
  oracles: new Set(),
51
52
  pythEndpoints: new Set(),
52
53
  deprecated: new Set(),
53
54
  emerging: new Set(),
54
- } as Whitelist;
55
+ } satisfies Whitelist;
55
56
 
56
57
  const parseWhitelistParams = (params: Record<string, any> | Whitelist) => {
57
58
  return Object.entries(params)
@@ -67,14 +67,18 @@ class ScallopUtils implements ScallopUtilsInterface {
67
67
  }
68
68
 
69
69
  // -------------- TYPE GUARDS --------------
70
- isSuiBridgeAsset(coinName: any) {
70
+ isSuiBridgeAsset(coinName: string) {
71
71
  return this.constants.whitelist.suiBridge.has(coinName);
72
72
  }
73
73
 
74
- isWormholeAsset(coinName: any) {
74
+ isWormholeAsset(coinName: string) {
75
75
  return this.constants.whitelist.wormhole.has(coinName);
76
76
  }
77
77
 
78
+ isLayerZeroAsset(coinName: string) {
79
+ return this.constants.whitelist.layerZero.has(coinName);
80
+ }
81
+
78
82
  isMarketCoin(coinName: string) {
79
83
  const assetCoinName = coinName.slice(1).toLowerCase() as string;
80
84
  return (
@@ -258,6 +262,11 @@ class ScallopUtils implements ScallopUtilsInterface {
258
262
  from: 'Wormhole',
259
263
  type: 'Portal from Ethereum',
260
264
  };
265
+ } else if (this.isLayerZeroAsset(assetCoinName)) {
266
+ return {
267
+ from: 'LayerZero',
268
+ type: 'Ominchain Fungible Token from LayerZero',
269
+ };
261
270
  }
262
271
 
263
272
  return undefined;
@@ -38,6 +38,7 @@ export type Whitelist = {
38
38
  scoin: Set<string>;
39
39
  suiBridge: Set<string>;
40
40
  wormhole: Set<string>;
41
+ layerZero: Set<string>;
41
42
  oracles: Set<string>;
42
43
  borrowIncentiveRewards: Set<string>;
43
44
  rewardsAsPoint: Set<string>;