@sodax/dapp-kit 1.0.0-rc.7 → 1.0.1-beta-rc1
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 +16 -9
- package/dist/index.d.ts +16 -9
- package/dist/index.js +13 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/hooks/bridge/useBridge.ts +8 -1
- package/src/hooks/migrate/types.ts +15 -15
- package/src/hooks/mm/useAToken.ts +1 -3
- package/src/hooks/provider/useSpokeProvider.ts +1 -1
- package/src/hooks/shared/index.ts +1 -1
- package/src/hooks/shared/useDeriveUserWalletAddress.ts +26 -17
- package/src/hooks/swap/useCancelSwap.ts +1 -1
- package/src/hooks/swap/useQuote.ts +2 -2
- package/src/hooks/swap/useStatus.ts +1 -1
- package/src/hooks/swap/useSwap.ts +1 -1
- package/src/hooks/swap/useSwapAllowance.ts +1 -1
- package/src/hooks/swap/useSwapApprove.ts +1 -1
package/dist/index.mjs
CHANGED
|
@@ -24,17 +24,18 @@ function useEstimateGas(spokeProvider) {
|
|
|
24
24
|
}
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
|
-
function useDeriveUserWalletAddress(
|
|
27
|
+
function useDeriveUserWalletAddress(spokeChainId, spokeAddress) {
|
|
28
28
|
const { sodax } = useSodaxContext();
|
|
29
29
|
return useQuery({
|
|
30
|
-
queryKey: ["deriveUserWalletAddress",
|
|
30
|
+
queryKey: ["deriveUserWalletAddress", spokeChainId, spokeAddress],
|
|
31
31
|
queryFn: async () => {
|
|
32
|
-
if (!
|
|
33
|
-
throw new Error("Spoke
|
|
32
|
+
if (!spokeChainId || !spokeAddress) {
|
|
33
|
+
throw new Error("Spoke chain id and address are required");
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
spokeChainId = typeof spokeChainId === "object" ? spokeChainId.chainConfig.chain.id : spokeChainId;
|
|
36
|
+
return await deriveUserWalletAddress(sodax.hubProvider, spokeChainId, spokeAddress);
|
|
36
37
|
},
|
|
37
|
-
enabled: !!
|
|
38
|
+
enabled: !!spokeChainId && !!spokeAddress,
|
|
38
39
|
refetchInterval: false
|
|
39
40
|
// This is a deterministic operation, no need to refetch
|
|
40
41
|
});
|
|
@@ -396,7 +397,7 @@ var useQuote = (payload) => {
|
|
|
396
397
|
if (!payload) {
|
|
397
398
|
return void 0;
|
|
398
399
|
}
|
|
399
|
-
return sodax.
|
|
400
|
+
return sodax.swaps.getQuote(payload);
|
|
400
401
|
},
|
|
401
402
|
enabled: !!payload,
|
|
402
403
|
refetchInterval: 3e3
|
|
@@ -410,7 +411,7 @@ function useSwap(spokeProvider) {
|
|
|
410
411
|
if (!spokeProvider) {
|
|
411
412
|
throw new Error("Spoke provider not found");
|
|
412
413
|
}
|
|
413
|
-
return sodax.
|
|
414
|
+
return sodax.swaps.swap({
|
|
414
415
|
intentParams: params,
|
|
415
416
|
spokeProvider
|
|
416
417
|
});
|
|
@@ -425,7 +426,7 @@ var useStatus = (intent_tx_hash) => {
|
|
|
425
426
|
return useQuery({
|
|
426
427
|
queryKey: [intent_tx_hash],
|
|
427
428
|
queryFn: async () => {
|
|
428
|
-
return sodax.
|
|
429
|
+
return sodax.swaps.getStatus({ intent_tx_hash });
|
|
429
430
|
},
|
|
430
431
|
refetchInterval: 3e3
|
|
431
432
|
// 3s
|
|
@@ -439,7 +440,7 @@ function useSwapAllowance(params, spokeProvider) {
|
|
|
439
440
|
if (!spokeProvider || !params) {
|
|
440
441
|
return false;
|
|
441
442
|
}
|
|
442
|
-
const allowance = await sodax.
|
|
443
|
+
const allowance = await sodax.swaps.isAllowanceValid({
|
|
443
444
|
intentParams: params,
|
|
444
445
|
spokeProvider
|
|
445
446
|
});
|
|
@@ -468,7 +469,7 @@ function useSwapApprove(params, spokeProvider) {
|
|
|
468
469
|
if (!params2) {
|
|
469
470
|
throw new Error("Swap Params not found");
|
|
470
471
|
}
|
|
471
|
-
const allowance = await sodax.
|
|
472
|
+
const allowance = await sodax.swaps.approve({
|
|
472
473
|
intentParams: params2,
|
|
473
474
|
spokeProvider
|
|
474
475
|
});
|
|
@@ -495,7 +496,7 @@ function useCancelSwap(spokeProvider) {
|
|
|
495
496
|
if (!spokeProvider) {
|
|
496
497
|
throw new Error("Spoke provider not found");
|
|
497
498
|
}
|
|
498
|
-
return sodax.
|
|
499
|
+
return sodax.swaps.cancelIntent(intent, spokeProvider, raw);
|
|
499
500
|
}
|
|
500
501
|
});
|
|
501
502
|
}
|