@skip-go/widget 2.3.1-alpha.0 → 2.3.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/build/index.es.js +26 -5
- package/build/index.es.js.map +1 -1
- package/package.json +1 -1
- package/build/utils/chain.d.ts +0 -6
- package/build/utils/explorer.d.ts +0 -5
package/build/index.es.js
CHANGED
|
@@ -2340,7 +2340,15 @@ function useSwapWidget(persistSwapWidgetState = true) {
|
|
|
2340
2340
|
return;
|
|
2341
2341
|
const feeAsset = (_a = srcChain.feeAssets) === null || _a === void 0 ? void 0 : _a[0];
|
|
2342
2342
|
const gas = `${(_b = feeAsset === null || feeAsset === void 0 ? void 0 : feeAsset.gasPrice) === null || _b === void 0 ? void 0 : _b.average}${feeAsset.denom}`;
|
|
2343
|
-
const gasPrice =
|
|
2343
|
+
const gasPrice = (() => {
|
|
2344
|
+
try {
|
|
2345
|
+
return GasPrice.fromString(gas);
|
|
2346
|
+
}
|
|
2347
|
+
catch (error) {
|
|
2348
|
+
toast.error('Unable to parse gas price asset');
|
|
2349
|
+
return undefined;
|
|
2350
|
+
}
|
|
2351
|
+
})();
|
|
2344
2352
|
let srcGasPrice = (feeAsset === null || feeAsset === void 0 ? void 0 : feeAsset.gasPrice) && gasPrice;
|
|
2345
2353
|
if (!srcFeeAsset || srcFeeAsset.chainID !== srcChain.chainID) {
|
|
2346
2354
|
if (srcGasPrice) {
|
|
@@ -2370,7 +2378,19 @@ function useSwapWidget(persistSwapWidgetState = true) {
|
|
|
2370
2378
|
toast.error(`Unable to find gas prices for ${srcFeeAsset.denom} on ${srcChain.chainName}`);
|
|
2371
2379
|
return;
|
|
2372
2380
|
}
|
|
2373
|
-
|
|
2381
|
+
const _gasPrice = (() => {
|
|
2382
|
+
try {
|
|
2383
|
+
return GasPrice.fromString(`${feeDenomPrices.gasPrice.average}${feeDenomPrices.denom}`);
|
|
2384
|
+
}
|
|
2385
|
+
catch (error) {
|
|
2386
|
+
return undefined;
|
|
2387
|
+
}
|
|
2388
|
+
})();
|
|
2389
|
+
if (!_gasPrice) {
|
|
2390
|
+
toast.error(`Unable to parse gas price for ${srcFeeAsset.denom} on ${srcChain.chainName}`);
|
|
2391
|
+
return;
|
|
2392
|
+
}
|
|
2393
|
+
srcGasPrice = _gasPrice;
|
|
2374
2394
|
selectedGasPrice = BigNumber(feeDenomPrices.gasPrice.average);
|
|
2375
2395
|
}
|
|
2376
2396
|
const gasRequired = selectedGasPrice
|
|
@@ -4017,7 +4037,7 @@ const SetAddressDialog = ({ open, onOpen, chain, index, signRequired, isDestinat
|
|
|
4017
4037
|
wallets.map((wallet) => {
|
|
4018
4038
|
// currently only svm chainType that have isAvailable
|
|
4019
4039
|
return (jsxs(WalletListItem, { chainType: chainType, walletName: wallet.walletName, className: cn('group relative mb-2 data-[unsupported=true]:opacity-30', 'data-[unsupported=true]:before:absolute data-[unsupported=true]:before:inset-0 data-[unsupported=true]:before:cursor-not-allowed'), children: [jsxs(StyledThemedButton, { className: cn('flex w-full items-center gap-2 rounded-lg p-2 transition-colors focus:-outline-offset-2'), onClick: async () => {
|
|
4020
|
-
var _a;
|
|
4040
|
+
var _a, _b;
|
|
4021
4041
|
const resAddress = await ((_a = wallet.getAddress) === null || _a === void 0 ? void 0 : _a.call(wallet, {
|
|
4022
4042
|
signRequired,
|
|
4023
4043
|
context: isDestination ? 'destination' : 'recovery',
|
|
@@ -4025,7 +4045,8 @@ const SetAddressDialog = ({ open, onOpen, chain, index, signRequired, isDestinat
|
|
|
4025
4045
|
index: wallet.walletName === 'prax'
|
|
4026
4046
|
? praxWalletIndex
|
|
4027
4047
|
: undefined,
|
|
4028
|
-
|
|
4048
|
+
// chain id of the previous chain
|
|
4049
|
+
sourceChainID: (_b = chainAddresses[index - 1]) === null || _b === void 0 ? void 0 : _b.chainID,
|
|
4029
4050
|
},
|
|
4030
4051
|
}));
|
|
4031
4052
|
if (resAddress) {
|
|
@@ -4044,7 +4065,7 @@ const SetAddressDialog = ({ open, onOpen, chain, index, signRequired, isDestinat
|
|
|
4044
4065
|
: wallet.walletInfo.logo.major, "aria-hidden": "true" })), jsx("p", { className: "flex-1 text-left font-semibold", children: wallet.walletPrettyName === 'Leap Cosmos MetaMask'
|
|
4045
4066
|
? 'Metamask (Leap Snap)'
|
|
4046
4067
|
: wallet.walletPrettyName }), wallet.walletName === 'prax' && (jsx(PraxWalletIndex, { praxWalletIndex: praxWalletIndex, setPraxWalletIndex: setPraxWalletIndex }))] }), chainType === 'svm' && wallet.isAvailable !== true && (jsx("div", { className: "absolute right-4 top-1/2 flex -translate-y-1/2 items-center gap-1 rounded-lg bg-[#c2c2c2]/20 px-2.5 py-1 text-xs font-semibold text-[#909090] transition-colors focus:outline-none group-hover:bg-[#c2c2c2]/30", children: "Not Installed" }))] }, wallet.walletName));
|
|
4047
|
-
}), !signRequired && (jsx("div", { className: "group relative mb-2 data-[unsupported=true]:opacity-30", children: isEditing ? (jsxs("div", { className: "flex items-center space-x-2 py-2 px-1", children: [jsx(StyledBorderDiv, { as: "input", type: "text", className: cn(`w-full rounded-md border px-2 py-1`, !isValid && 'border-red-500'), placeholder: placeholder, value: address, onChange: (e) => setAddress(e.target.value) }), jsx(StyledApproveButton, { as: "button", className: cn('flex w-12 items-center justify-center rounded-md border-2 text-sm text-white', 'disabled:cursor-not-allowed'), onClick: () => save(), disabled: !isValid, children: jsx(MdCheck, { className: "size-6" }) }), jsx(StyledCancelButton, { className: cn('flex w-12 items-center justify-center rounded-md border-2'), onClick: () => cancel(), children: jsx(MdClose, { className: "size-6" }) })] })) : (jsxs(StyledThemedButton, { onClick: () => setIsEditing(true), className: cn('flex w-full items-center gap-2 rounded-lg p-2 py-3 transition-colors focus:-outline-offset-2'), children: [jsx(FaKeyboard, { className: "mx-[6px] h-[24px] w-[24px] text-neutral-400" }), jsx("p", { className: "flex-1 text-left font-semibold", children: "Set Manually" })] })) }))] }), jsx(ScrollArea.Scrollbar, { className: "z-20 flex touch-none select-none py-4 transition-colors ease-out data-[orientation=horizontal]:h-2 data-[orientation=vertical]:w-2 data-[orientation=horizontal]:flex-col", orientation: "vertical", children: jsx(ScrollArea.Thumb, { className: "relative flex-1 rounded-[10px] bg-neutral-500/50 transition-colors before:absolute before:left-1/2 before:top-1/2 before:h-2 before:w-2 before:-translate-x-1/2 before:-translate-y-1/2 before:content-[''] hover:bg-neutral-500" }) }), jsx(ScrollArea.Corner, {})] })] }) }) }, chainID));
|
|
4068
|
+
}), !chain.chainID.includes('penumbra') && !signRequired && (jsx("div", { className: "group relative mb-2 data-[unsupported=true]:opacity-30", children: isEditing ? (jsxs("div", { className: "flex items-center space-x-2 py-2 px-1", children: [jsx(StyledBorderDiv, { as: "input", type: "text", className: cn(`w-full rounded-md border px-2 py-1`, !isValid && 'border-red-500'), placeholder: placeholder, value: address, onChange: (e) => setAddress(e.target.value) }), jsx(StyledApproveButton, { as: "button", className: cn('flex w-12 items-center justify-center rounded-md border-2 text-sm text-white', 'disabled:cursor-not-allowed'), onClick: () => save(), disabled: !isValid, children: jsx(MdCheck, { className: "size-6" }) }), jsx(StyledCancelButton, { className: cn('flex w-12 items-center justify-center rounded-md border-2'), onClick: () => cancel(), children: jsx(MdClose, { className: "size-6" }) })] })) : (jsxs(StyledThemedButton, { onClick: () => setIsEditing(true), className: cn('flex w-full items-center gap-2 rounded-lg p-2 py-3 transition-colors focus:-outline-offset-2'), children: [jsx(FaKeyboard, { className: "mx-[6px] h-[24px] w-[24px] text-neutral-400" }), jsx("p", { className: "flex-1 text-left font-semibold", children: "Set Manually" })] })) }))] }), jsx(ScrollArea.Scrollbar, { className: "z-20 flex touch-none select-none py-4 transition-colors ease-out data-[orientation=horizontal]:h-2 data-[orientation=vertical]:w-2 data-[orientation=horizontal]:flex-col", orientation: "vertical", children: jsx(ScrollArea.Thumb, { className: "relative flex-1 rounded-[10px] bg-neutral-500/50 transition-colors before:absolute before:left-1/2 before:top-1/2 before:h-2 before:w-2 before:-translate-x-1/2 before:-translate-y-1/2 before:content-[''] hover:bg-neutral-500" }) }), jsx(ScrollArea.Corner, {})] })] }) }) }, chainID));
|
|
4048
4069
|
};
|
|
4049
4070
|
|
|
4050
4071
|
function useBridges(args = {}) {
|