@skip-go/widget 3.12.10 → 3.12.11
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.
|
@@ -45486,7 +45486,7 @@ function walletConnect(parameters) {
|
|
|
45486
45486
|
const optionalChains = config2.chains.map((x2) => x2.id);
|
|
45487
45487
|
if (!optionalChains.length)
|
|
45488
45488
|
return;
|
|
45489
|
-
const { EthereumProvider } = await import("./index.es-
|
|
45489
|
+
const { EthereumProvider } = await import("./index.es-BhgJ58L0.js");
|
|
45490
45490
|
return await EthereumProvider.init({
|
|
45491
45491
|
...parameters,
|
|
45492
45492
|
disableProviderPing: true,
|
|
@@ -48069,9 +48069,9 @@ const useGetAccount = () => {
|
|
|
48069
48069
|
const getAccount = useCallback(
|
|
48070
48070
|
// if checkChainType is true, it only check wallet connected no chainId is dependent
|
|
48071
48071
|
(chainId, checkChainType, chainType) => {
|
|
48072
|
-
var _a;
|
|
48073
48072
|
if (!chainId) return;
|
|
48074
|
-
|
|
48073
|
+
const chain = chains2 == null ? void 0 : chains2.find((c) => c.chainId === chainId);
|
|
48074
|
+
chainType ?? (chainType = chain == null ? void 0 : chain.chainType);
|
|
48075
48075
|
if (connectedAddress && connectedAddress[chainId]) {
|
|
48076
48076
|
return {
|
|
48077
48077
|
address: connectedAddress[chainId],
|
|
@@ -48108,16 +48108,16 @@ const useGetAccount = () => {
|
|
|
48108
48108
|
if (!evmAccount.address) return;
|
|
48109
48109
|
if (!evmAccount.connector) return;
|
|
48110
48110
|
const getLogo = () => {
|
|
48111
|
-
var
|
|
48112
|
-
if (((
|
|
48111
|
+
var _a, _b, _c;
|
|
48112
|
+
if (((_a = evmAccount == null ? void 0 : evmAccount.connector) == null ? void 0 : _a.id) === "walletConnect") {
|
|
48113
48113
|
return (evmWallet == null ? void 0 : evmWallet.logo) ?? walletConnectLogo;
|
|
48114
48114
|
}
|
|
48115
48115
|
if ((_b = evmAccount == null ? void 0 : evmAccount.connector) == null ? void 0 : _b.id.includes("keplr")) {
|
|
48116
48116
|
return getCosmosWalletInfo(WalletType.KEPLR).imgSrc;
|
|
48117
48117
|
}
|
|
48118
48118
|
return (_c = connectors.find((item) => {
|
|
48119
|
-
var
|
|
48120
|
-
return item.id === ((
|
|
48119
|
+
var _a2;
|
|
48120
|
+
return item.id === ((_a2 = evmAccount.connector) == null ? void 0 : _a2.id);
|
|
48121
48121
|
})) == null ? void 0 : _c.icon;
|
|
48122
48122
|
};
|
|
48123
48123
|
return {
|
|
@@ -48636,7 +48636,7 @@ function getTotalFees(fees2) {
|
|
|
48636
48636
|
return {
|
|
48637
48637
|
assetAmount: totalAsset,
|
|
48638
48638
|
formattedAssetAmount: `${totalAsset.toFixed(6)} ${symbol}`,
|
|
48639
|
-
formattedUsdAmount: totalUsd > 0 ? formatUSD(totalUsd.toString()) :
|
|
48639
|
+
formattedUsdAmount: totalUsd > 0 ? formatUSD(totalUsd.toString()) : "< $0.01"
|
|
48640
48640
|
};
|
|
48641
48641
|
}
|
|
48642
48642
|
const QuestionMarkIcon = ({
|
|
@@ -49386,7 +49386,7 @@ const SwapPageAssetChainInput = ({
|
|
|
49386
49386
|
isWaitingToUpdateInputValue,
|
|
49387
49387
|
badPriceWarning,
|
|
49388
49388
|
disabled,
|
|
49389
|
-
|
|
49389
|
+
feeLabel,
|
|
49390
49390
|
feeWarning
|
|
49391
49391
|
}) => {
|
|
49392
49392
|
var _a;
|
|
@@ -49562,10 +49562,7 @@ const SwapPageAssetChainInput = ({
|
|
|
49562
49562
|
"%"
|
|
49563
49563
|
] })
|
|
49564
49564
|
] }) : /* @__PURE__ */ jsx(SmallText, { children: usdValue && formatUSD(usdValue) }),
|
|
49565
|
-
|
|
49566
|
-
feeAmountUsd,
|
|
49567
|
-
" in fees"
|
|
49568
|
-
] }) })
|
|
49565
|
+
usdValue && feeLabel && /* @__PURE__ */ jsx(Row, { align: "center", gap: 4, children: /* @__PURE__ */ jsx(SmallText, { color: feeColor, children: feeLabel }) })
|
|
49569
49566
|
] }),
|
|
49570
49567
|
(assetDetails == null ? void 0 : assetDetails.chainName) ? /* @__PURE__ */ jsx(
|
|
49571
49568
|
StyledOnChainGhostButton,
|
|
@@ -50711,6 +50708,7 @@ const SwapExecutionPageRouteSimpleRow = ({
|
|
|
50711
50708
|
case "source": {
|
|
50712
50709
|
const selected = chainAddressArray[0];
|
|
50713
50710
|
return {
|
|
50711
|
+
source: selected == null ? void 0 : selected.source,
|
|
50714
50712
|
address: selected == null ? void 0 : selected.address,
|
|
50715
50713
|
image: (selected == null ? void 0 : selected.source) === "wallet" && ((_a = selected == null ? void 0 : selected.wallet) == null ? void 0 : _a.walletInfo.logo) || void 0
|
|
50716
50714
|
};
|
|
@@ -50718,6 +50716,7 @@ const SwapExecutionPageRouteSimpleRow = ({
|
|
|
50718
50716
|
case "destination": {
|
|
50719
50717
|
const selected = chainAddressArray[chainAddressArray.length - 1];
|
|
50720
50718
|
return {
|
|
50719
|
+
source: selected == null ? void 0 : selected.source,
|
|
50721
50720
|
address: selected == null ? void 0 : selected.address,
|
|
50722
50721
|
image: (selected == null ? void 0 : selected.source) === "wallet" && ((_b = selected == null ? void 0 : selected.wallet) == null ? void 0 : _b.walletInfo.logo) || void 0
|
|
50723
50722
|
};
|
|
@@ -50726,10 +50725,11 @@ const SwapExecutionPageRouteSimpleRow = ({
|
|
|
50726
50725
|
}, [chainAddresses, context]);
|
|
50727
50726
|
const walletImage = useCroppedImage(source.image);
|
|
50728
50727
|
const renderWalletImage = useMemo(() => {
|
|
50728
|
+
if (source.source === "injected") return;
|
|
50729
50729
|
if (!source.address) return;
|
|
50730
50730
|
if (walletImage) return /* @__PURE__ */ jsx("img", { height: 12, width: 12, src: walletImage });
|
|
50731
50731
|
return /* @__PURE__ */ jsx(SkeletonElement, { height: 12, width: 12 });
|
|
50732
|
-
}, [source.address, walletImage]);
|
|
50732
|
+
}, [source.address, source.source, walletImage]);
|
|
50733
50733
|
const renderExplorerLink = useMemo(() => {
|
|
50734
50734
|
if (!explorerLink) return;
|
|
50735
50735
|
if (isMobileScreenSize) {
|
|
@@ -51219,6 +51219,7 @@ const useAutoSetAddress = () => {
|
|
|
51219
51219
|
const [isLoading, setIsLoading] = useState(true);
|
|
51220
51220
|
const [walletHasChanged, setWalletHasChanged] = useState(false);
|
|
51221
51221
|
const [currentSourceWallets, setCurrentSourceWallets] = useState();
|
|
51222
|
+
const [currentConnectedAddress, setCurrentConnectedAddress] = useState();
|
|
51222
51223
|
const { createCosmosWallets } = useCreateCosmosWallets();
|
|
51223
51224
|
const { createEvmWallets } = useCreateEvmWallets();
|
|
51224
51225
|
const { createSolanaWallets } = useCreateSolanaWallets();
|
|
@@ -51242,9 +51243,8 @@ const useAutoSetAddress = () => {
|
|
|
51242
51243
|
requiredChainAddresses.forEach(async (chainId, index) => {
|
|
51243
51244
|
var _a2, _b2;
|
|
51244
51245
|
const chain = chains2 == null ? void 0 : chains2.find((c) => c.chainId === chainId);
|
|
51245
|
-
if (!chain)
|
|
51246
|
-
|
|
51247
|
-
}
|
|
51246
|
+
if (!chain) return;
|
|
51247
|
+
const chainType = chain.chainType;
|
|
51248
51248
|
const showSetAddressModal = () => {
|
|
51249
51249
|
const isSignRequired = signRequiredChains == null ? void 0 : signRequiredChains.includes(chainId);
|
|
51250
51250
|
NiceModal.show(Modals.SetAddressModal, {
|
|
@@ -51254,14 +51254,39 @@ const useAutoSetAddress = () => {
|
|
|
51254
51254
|
});
|
|
51255
51255
|
};
|
|
51256
51256
|
if (chainAddresses[index].source === WalletSource.Input) return;
|
|
51257
|
+
const isInjectedWallet = connectedAddress == null ? void 0 : connectedAddress[chainId];
|
|
51258
|
+
if (isInjectedWallet) {
|
|
51259
|
+
setChainAddresses((prev2) => {
|
|
51260
|
+
return {
|
|
51261
|
+
...prev2,
|
|
51262
|
+
[index]: {
|
|
51263
|
+
chainId,
|
|
51264
|
+
address: connectedAddress == null ? void 0 : connectedAddress[chainId],
|
|
51265
|
+
chainType,
|
|
51266
|
+
source: WalletSource.Injected,
|
|
51267
|
+
wallet: {
|
|
51268
|
+
walletName: "injected",
|
|
51269
|
+
walletPrettyName: "injected",
|
|
51270
|
+
walletChainType: chainType,
|
|
51271
|
+
walletInfo: {
|
|
51272
|
+
logo: void 0
|
|
51273
|
+
}
|
|
51274
|
+
}
|
|
51275
|
+
}
|
|
51276
|
+
};
|
|
51277
|
+
});
|
|
51278
|
+
setIsLoading(false);
|
|
51279
|
+
return;
|
|
51280
|
+
}
|
|
51257
51281
|
try {
|
|
51258
|
-
const chainType = chain.chainType;
|
|
51259
51282
|
const wallets = createWallets[chainType](chainId);
|
|
51260
51283
|
const walletName = (_a2 = sourceWallet[chainType]) == null ? void 0 : _a2.walletName;
|
|
51261
51284
|
const wallet = wallets.find((w2) => w2.walletName === walletName);
|
|
51262
51285
|
const isSignRequired = signRequiredChains == null ? void 0 : signRequiredChains.includes(chainId);
|
|
51263
|
-
const response = await ((_b2 = wallet == null ? void 0 : wallet.getAddress) == null ? void 0 : _b2.call(wallet, {
|
|
51264
|
-
|
|
51286
|
+
const response = await ((_b2 = wallet == null ? void 0 : wallet.getAddress) == null ? void 0 : _b2.call(wallet, {
|
|
51287
|
+
signRequired: isSignRequired
|
|
51288
|
+
}));
|
|
51289
|
+
const isInjectedWallet2 = connectedAddress == null ? void 0 : connectedAddress[chainId];
|
|
51265
51290
|
const address = (connectedAddress == null ? void 0 : connectedAddress[chainId]) ?? (response == null ? void 0 : response.address);
|
|
51266
51291
|
if (!address) {
|
|
51267
51292
|
throw new Error(
|
|
@@ -51286,7 +51311,7 @@ const useAutoSetAddress = () => {
|
|
|
51286
51311
|
chainId,
|
|
51287
51312
|
address,
|
|
51288
51313
|
chainType,
|
|
51289
|
-
source:
|
|
51314
|
+
source: isInjectedWallet2 ? WalletSource.Injected : WalletSource.Wallet,
|
|
51290
51315
|
wallet: wallet ? {
|
|
51291
51316
|
walletName: wallet == null ? void 0 : wallet.walletName,
|
|
51292
51317
|
walletPrettyName: wallet == null ? void 0 : wallet.walletPrettyName,
|
|
@@ -51327,12 +51352,19 @@ const useAutoSetAddress = () => {
|
|
|
51327
51352
|
return;
|
|
51328
51353
|
}
|
|
51329
51354
|
const hasWalletChanged = ((_a2 = sourceWallet.cosmos) == null ? void 0 : _a2.id) !== ((_b2 = currentSourceWallets == null ? void 0 : currentSourceWallets.cosmos) == null ? void 0 : _b2.id) || ((_c2 = sourceWallet.evm) == null ? void 0 : _c2.id) !== ((_d = currentSourceWallets == null ? void 0 : currentSourceWallets.evm) == null ? void 0 : _d.id) || ((_e2 = sourceWallet.svm) == null ? void 0 : _e2.id) !== ((_f = currentSourceWallets == null ? void 0 : currentSourceWallets.svm) == null ? void 0 : _f.id);
|
|
51355
|
+
const hasConnectedAddressChanged = JSON.stringify(connectedAddress) !== JSON.stringify(currentConnectedAddress);
|
|
51356
|
+
if (hasConnectedAddressChanged) {
|
|
51357
|
+
setCurrentConnectedAddress(connectedAddress);
|
|
51358
|
+
setWalletHasChanged(true);
|
|
51359
|
+
}
|
|
51330
51360
|
if (hasWalletChanged) {
|
|
51331
51361
|
setCurrentSourceWallets(sourceWallet);
|
|
51332
51362
|
setWalletHasChanged(true);
|
|
51333
51363
|
}
|
|
51334
51364
|
}, [
|
|
51335
51365
|
connectRequiredChains,
|
|
51366
|
+
connectedAddress,
|
|
51367
|
+
currentConnectedAddress,
|
|
51336
51368
|
(_a = currentSourceWallets == null ? void 0 : currentSourceWallets.cosmos) == null ? void 0 : _a.id,
|
|
51337
51369
|
(_b = currentSourceWallets == null ? void 0 : currentSourceWallets.evm) == null ? void 0 : _b.id,
|
|
51338
51370
|
(_c = currentSourceWallets == null ? void 0 : currentSourceWallets.svm) == null ? void 0 : _c.id,
|
|
@@ -52533,7 +52565,7 @@ const ConnectedWalletContent = () => {
|
|
|
52533
52565
|
align: "center",
|
|
52534
52566
|
gap: 8,
|
|
52535
52567
|
children: [
|
|
52536
|
-
walletImage ? /* @__PURE__ */ jsx("img", { style: { objectFit: "cover" }, src: walletImage, height: 16, width: 16 }) : /* @__PURE__ */ jsx(SkeletonElement, { height: 16, width: 16 }),
|
|
52568
|
+
sourceAccount.wallet.name !== "injected" && (walletImage ? /* @__PURE__ */ jsx("img", { style: { objectFit: "cover" }, src: walletImage, height: 16, width: 16 }) : /* @__PURE__ */ jsx(SkeletonElement, { height: 16, width: 16 })),
|
|
52537
52569
|
isLoading ? /* @__PURE__ */ jsx(
|
|
52538
52570
|
"div",
|
|
52539
52571
|
{
|
|
@@ -52743,7 +52775,7 @@ const useConnectToMissingCosmosChain = () => {
|
|
|
52743
52775
|
return { isAskingToApproveConnection };
|
|
52744
52776
|
};
|
|
52745
52777
|
const SwapPage = () => {
|
|
52746
|
-
var _a
|
|
52778
|
+
var _a;
|
|
52747
52779
|
const { SettingsFooter, drawerOpen } = useSettingsDrawer();
|
|
52748
52780
|
useAtom(onRouteUpdatedEffect);
|
|
52749
52781
|
useAtom(preloadSigningStargateClientEffect);
|
|
@@ -52890,7 +52922,14 @@ const SwapPage = () => {
|
|
|
52890
52922
|
return calculatePercentageChange(route2.usdAmountIn, route2.usdAmountOut);
|
|
52891
52923
|
}, [isWaitingForNewRoute, route2 == null ? void 0 : route2.usdAmountIn, route2 == null ? void 0 : route2.usdAmountOut]);
|
|
52892
52924
|
const fees2 = useMemo(() => route2 ? getFeeList(route2) : [], [route2]);
|
|
52893
|
-
const
|
|
52925
|
+
const feeLabel = useMemo(() => {
|
|
52926
|
+
var _a2;
|
|
52927
|
+
const formattedUsdAmount = (_a2 = getTotalFees(fees2)) == null ? void 0 : _a2.formattedUsdAmount;
|
|
52928
|
+
if (formattedUsdAmount) {
|
|
52929
|
+
return `${formattedUsdAmount} in fees`;
|
|
52930
|
+
}
|
|
52931
|
+
return "no fees";
|
|
52932
|
+
}, [fees2]);
|
|
52894
52933
|
const feeWarning = useMemo(() => {
|
|
52895
52934
|
if (!(route2 == null ? void 0 : route2.usdAmountIn) || !(route2 == null ? void 0 : route2.usdAmountOut)) return false;
|
|
52896
52935
|
return parseFloat(route2.usdAmountOut) <= parseFloat(route2.usdAmountIn) * 0.9;
|
|
@@ -52954,7 +52993,7 @@ const SwapPage = () => {
|
|
|
52954
52993
|
return /* @__PURE__ */ jsx(MainButton, { label, disabled: true, icon: ICONS.swap, fontSize: computeFontSize(label) });
|
|
52955
52994
|
}
|
|
52956
52995
|
const onClick = () => {
|
|
52957
|
-
var _a3,
|
|
52996
|
+
var _a3, _b;
|
|
52958
52997
|
track("swap page: continue button - clicked", {
|
|
52959
52998
|
route: route2,
|
|
52960
52999
|
type: isSwapOperation ? "swap" : "send",
|
|
@@ -52999,7 +53038,7 @@ const SwapPage = () => {
|
|
|
52999
53038
|
});
|
|
53000
53039
|
return;
|
|
53001
53040
|
}
|
|
53002
|
-
if (((
|
|
53041
|
+
if (((_b = route2 == null ? void 0 : route2.warning) == null ? void 0 : _b.type) === "LOW_INFO_WARNING") {
|
|
53003
53042
|
track("warning page: low info", { route: route2 });
|
|
53004
53043
|
setError({
|
|
53005
53044
|
errorWarningType: ErrorWarningType.LowInfoWarning,
|
|
@@ -53103,8 +53142,8 @@ const SwapPage = () => {
|
|
|
53103
53142
|
usdValue: route2 == null ? void 0 : route2.usdAmountOut,
|
|
53104
53143
|
value: destinationAsset == null ? void 0 : destinationAsset.amount,
|
|
53105
53144
|
priceChangePercentage: Number(priceChangePercentage),
|
|
53106
|
-
badPriceWarning: ((
|
|
53107
|
-
|
|
53145
|
+
badPriceWarning: ((_a = route2 == null ? void 0 : route2.warning) == null ? void 0 : _a.type) === "BAD_PRICE_WARNING",
|
|
53146
|
+
feeLabel,
|
|
53108
53147
|
feeWarning,
|
|
53109
53148
|
onChangeValue: (v2) => {
|
|
53110
53149
|
track("swap page: destination asset amount input - changed", { amount: v2 });
|
|
@@ -54295,7 +54334,7 @@ const initSentry = () => {
|
|
|
54295
54334
|
};
|
|
54296
54335
|
const name = "@skip-go/widget";
|
|
54297
54336
|
const description = "Swap widget";
|
|
54298
|
-
const version = "3.12.
|
|
54337
|
+
const version = "3.12.11";
|
|
54299
54338
|
const repository = {
|
|
54300
54339
|
url: "https://github.com/skip-mev/skip-go",
|
|
54301
54340
|
directory: "packages/widget"
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as getAugmentedNamespace, c as commonjsGlobal, a as getDefaultExportFromCjs, p as process$1 } from "./index-
|
|
1
|
+
import { g as getAugmentedNamespace, c as commonjsGlobal, a as getDefaultExportFromCjs, p as process$1 } from "./index-CSCk_22k.js";
|
|
2
2
|
import qg, { PROPOSAL_EXPIRY_MESSAGE } from "@walletconnect/sign-client";
|
|
3
3
|
const global = globalThis || void 0 || self;
|
|
4
4
|
var buffer$1 = {};
|
package/build/index.js
CHANGED