@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/dist/index.d.mts +6 -3
- package/dist/index.d.ts +6 -3
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
- package/src/models/scallopClient.ts +17 -2
- package/src/models/scallopConstants.ts +2 -1
- package/src/models/scallopUtils.ts +11 -2
- package/src/types/constant/common.ts +1 -0
package/package.json
CHANGED
|
@@ -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
|
|
289
|
-
obligationKey
|
|
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
|
-
}
|
|
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:
|
|
70
|
+
isSuiBridgeAsset(coinName: string) {
|
|
71
71
|
return this.constants.whitelist.suiBridge.has(coinName);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
isWormholeAsset(coinName:
|
|
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;
|