@skip-go/widget 3.10.10 → 3.11.0
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.
|
@@ -6,11 +6,14 @@ import NiceModal, { useModal } from "@ebay/nice-modal-react";
|
|
|
6
6
|
import { assets, chains, bridges, venues, transactionStatus, ChainType, getSigningStargateClient, route, executeRoute, balances, FeeType, GAS_STATION_CHAIN_IDS, setClientOptions } from "@skip-go/client";
|
|
7
7
|
import { atomWithQuery, atomWithMutation } from "jotai-tanstack-query";
|
|
8
8
|
import pluralize from "pluralize";
|
|
9
|
-
import { track, init, add
|
|
10
|
-
import { setTag, setUser, getReplay, init
|
|
9
|
+
import { track, setUserId, init as init$1, add } from "@amplitude/analytics-browser";
|
|
10
|
+
import { setTag, setUser, getReplay, init, breadcrumbsIntegration, dedupeIntegration, functionToStringIntegration, httpContextIntegration, inboundFiltersIntegration, linkedErrorsIntegration, browserSessionIntegration, replayIntegration } from "@sentry/react";
|
|
11
11
|
import { useQuery, useMutation, QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
12
12
|
import { atomEffect } from "jotai-effect";
|
|
13
|
-
import {
|
|
13
|
+
import { WalletType, isWalletConnect, useActiveWalletType, useDisconnect, getWallet, checkWallet, connect, useAccount as useAccount$1, getChainInfo as getChainInfo$1, GrazProvider } from "graz";
|
|
14
|
+
import { createPenumbraClient } from "@penumbra-zone/client";
|
|
15
|
+
import { ViewService } from "@penumbra-zone/protobuf";
|
|
16
|
+
import { bech32m, bech32 } from "bech32";
|
|
14
17
|
import { createClient, custom, walletActions, getAddress as getAddress$1, UserRejectedRequestError, SwitchChainError, numberToHex as numberToHex$1, defineChain as defineChain$1, http, createPublicClient, isAddress as isAddress$1, fallback } from "viem";
|
|
15
18
|
import { createConfig, createStorage, useAccount, useConnect, useConnectors, WagmiProvider } from "wagmi";
|
|
16
19
|
import { BackpackWalletAdapter } from "@solana/wallet-adapter-backpack";
|
|
@@ -23,9 +26,6 @@ import { WalletConnectWalletAdapter } from "@walletconnect/solana-adapter";
|
|
|
23
26
|
import { ErrorBoundary } from "react-error-boundary";
|
|
24
27
|
import { createPortal } from "react-dom";
|
|
25
28
|
import List from "rc-virtual-list";
|
|
26
|
-
import { createPenumbraClient } from "@penumbra-zone/client";
|
|
27
|
-
import { ViewService } from "@penumbra-zone/protobuf";
|
|
28
|
-
import { bech32m, bech32 } from "bech32";
|
|
29
29
|
import { PublicKey } from "@solana/web3.js";
|
|
30
30
|
import { CosmWasmClient } from "@cosmjs/cosmwasm-stargate";
|
|
31
31
|
import { Decimal } from "@cosmjs/math";
|
|
@@ -4252,7 +4252,7 @@ const WarningPageBadPrice = ({
|
|
|
4252
4252
|
if (hasUsdValues && swapDifferencePercentage) {
|
|
4253
4253
|
return {
|
|
4254
4254
|
title: `Warning: Bad trade (-${swapDifferencePercentage})`,
|
|
4255
|
-
descriptionContent: /* @__PURE__ */ jsxs(
|
|
4255
|
+
descriptionContent: /* @__PURE__ */ jsxs(StyledDescriptionContent, { children: [
|
|
4256
4256
|
"You will lose ",
|
|
4257
4257
|
swapDifferencePercentage,
|
|
4258
4258
|
" of your input value with this trade",
|
|
@@ -4261,7 +4261,7 @@ const WarningPageBadPrice = ({
|
|
|
4261
4261
|
sourceDetails == null ? void 0 : sourceDetails.amount,
|
|
4262
4262
|
" ",
|
|
4263
4263
|
sourceDetails == null ? void 0 : sourceDetails.symbol,
|
|
4264
|
-
" (",
|
|
4264
|
+
" ($",
|
|
4265
4265
|
usdAmountIn,
|
|
4266
4266
|
")",
|
|
4267
4267
|
/* @__PURE__ */ jsx("br", {}),
|
|
@@ -4269,7 +4269,7 @@ const WarningPageBadPrice = ({
|
|
|
4269
4269
|
destinationDetails == null ? void 0 : destinationDetails.amount,
|
|
4270
4270
|
" ",
|
|
4271
4271
|
destinationDetails == null ? void 0 : destinationDetails.symbol,
|
|
4272
|
-
" (",
|
|
4272
|
+
" ($",
|
|
4273
4273
|
usdAmountOut,
|
|
4274
4274
|
")"
|
|
4275
4275
|
] })
|
|
@@ -4356,6 +4356,9 @@ const WarningPageBadPrice = ({
|
|
|
4356
4356
|
)
|
|
4357
4357
|
] });
|
|
4358
4358
|
};
|
|
4359
|
+
const StyledDescriptionContent = dt.div`
|
|
4360
|
+
line-height: 1.5;
|
|
4361
|
+
`;
|
|
4359
4362
|
const ExpectedErrorPageAuthFailed = ({ onClickBack }) => {
|
|
4360
4363
|
const setErrorWarningAtom = useSetAtom(errorWarningAtom);
|
|
4361
4364
|
const theme = nt();
|
|
@@ -4953,441 +4956,270 @@ var LOCAL_STORAGE_KEYS = /* @__PURE__ */ ((LOCAL_STORAGE_KEYS2) => {
|
|
|
4953
4956
|
LOCAL_STORAGE_KEYS2["destinationAsset"] = "destinationAsset";
|
|
4954
4957
|
LOCAL_STORAGE_KEYS2["transactionHistory"] = "transactionHistory";
|
|
4955
4958
|
LOCAL_STORAGE_KEYS2["swapExecutionState"] = "swapExecutionState";
|
|
4959
|
+
LOCAL_STORAGE_KEYS2["extraCosmosChainIdsToConnectPerWallet"] = "extraCosmosChainIdsToConnectPerWallet";
|
|
4956
4960
|
return LOCAL_STORAGE_KEYS2;
|
|
4957
4961
|
})(LOCAL_STORAGE_KEYS || {});
|
|
4958
|
-
const {
|
|
4959
|
-
|
|
4960
|
-
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
|
|
4962
|
+
const StringLength = {
|
|
4963
|
+
passet: 65,
|
|
4964
|
+
pauctid: 66,
|
|
4965
|
+
penumbra: 143,
|
|
4966
|
+
penumbrafullviewingkey: 132,
|
|
4967
|
+
penumbragovern: 73,
|
|
4968
|
+
penumbraspendkey: 75,
|
|
4969
|
+
penumbravalid: 72,
|
|
4970
|
+
penumbrawalletid: 75,
|
|
4971
|
+
plpid: 64,
|
|
4972
|
+
penumbracompat1: 150,
|
|
4973
|
+
tpenumbra: 68
|
|
4974
|
+
};
|
|
4975
|
+
const ByteLength = {
|
|
4976
|
+
passet: 32,
|
|
4977
|
+
pauctid: 32,
|
|
4978
|
+
penumbra: 80,
|
|
4979
|
+
penumbracompat1: 80,
|
|
4980
|
+
penumbrafullviewingkey: 64,
|
|
4981
|
+
penumbragovern: 32,
|
|
4982
|
+
penumbraspendkey: 32,
|
|
4983
|
+
penumbravalid: 32,
|
|
4984
|
+
penumbrawalletid: 32,
|
|
4985
|
+
plpid: 32,
|
|
4986
|
+
tpenumbra: 32
|
|
4987
|
+
};
|
|
4988
|
+
const toBech32m = (bData, prefix2) => to({
|
|
4989
|
+
bechLib: bech32m,
|
|
4990
|
+
bData,
|
|
4991
|
+
prefix: prefix2,
|
|
4992
|
+
expectLength: StringLength[prefix2],
|
|
4993
|
+
expectBytes: ByteLength[prefix2]
|
|
4984
4994
|
});
|
|
4985
|
-
const
|
|
4986
|
-
|
|
4987
|
-
|
|
4988
|
-
const wallets = get(walletsAtom);
|
|
4989
|
-
const getSigners = get(getConnectedSignersAtom);
|
|
4990
|
-
const wallet = ((_a = wallets == null ? void 0 : wallets.cosmos) == null ? void 0 : _a.walletName) && getWallet(wallets.cosmos.walletName);
|
|
4991
|
-
const signer = (getSigners == null ? void 0 : getSigners.getCosmosSigner) ?? wallet;
|
|
4992
|
-
if ((sourceAsset == null ? void 0 : sourceAsset.chainId) && wallets.cosmos && signer) {
|
|
4993
|
-
getSigningStargateClient({
|
|
4994
|
-
chainId: sourceAsset == null ? void 0 : sourceAsset.chainId,
|
|
4995
|
-
getOfflineSigner: async (chainId) => {
|
|
4996
|
-
if (getSigners == null ? void 0 : getSigners.getCosmosSigner) {
|
|
4997
|
-
return getSigners.getCosmosSigner(chainId);
|
|
4998
|
-
}
|
|
4999
|
-
if (!wallets.cosmos) {
|
|
5000
|
-
throw new Error("getCosmosSigner error: no cosmos wallet");
|
|
5001
|
-
}
|
|
5002
|
-
const wallet2 = getWallet(wallets.cosmos.walletName);
|
|
5003
|
-
if (!wallet2) {
|
|
5004
|
-
throw new Error("getCosmosSigner error: wallet not found");
|
|
5005
|
-
}
|
|
5006
|
-
const key = await wallet2.getKey(chainId);
|
|
5007
|
-
return key.isNanoLedger ? wallet2.getOfflineSignerOnlyAmino(chainId) : wallet2.getOfflineSigner(chainId);
|
|
5008
|
-
}
|
|
5009
|
-
});
|
|
4995
|
+
const to = ({ bechLib, bData, prefix: prefix2, expectLength, expectBytes }) => {
|
|
4996
|
+
if (bData.length !== expectBytes) {
|
|
4997
|
+
throw new TypeError(`Invalid data length: expected ${expectBytes}, got ${bData.length}`);
|
|
5010
4998
|
}
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
void 0
|
|
5015
|
-
);
|
|
5016
|
-
const resetWidget = ({ onlyClearInputValues } = {}) => {
|
|
5017
|
-
const { set } = jotaiStore;
|
|
5018
|
-
if (onlyClearInputValues) {
|
|
5019
|
-
set(clearAssetInputAmountsAtom);
|
|
5020
|
-
} else {
|
|
5021
|
-
set(sourceAssetAtom, void 0);
|
|
5022
|
-
set(debouncedSourceAssetAmountAtom, "", void 0, true);
|
|
5023
|
-
set(destinationAssetAtom, void 0);
|
|
5024
|
-
set(debouncedDestinationAssetAmountAtom, "", void 0, true);
|
|
4999
|
+
const bStr = bechLib.encode(prefix2, bechLib.toWords(bData), expectLength);
|
|
5000
|
+
if (bStr.length !== expectLength) {
|
|
5001
|
+
throw new TypeError("Unexpected string length");
|
|
5025
5002
|
}
|
|
5026
|
-
|
|
5027
|
-
set(currentPageAtom, Routes.SwapPage);
|
|
5028
|
-
set(errorWarningAtom, void 0);
|
|
5003
|
+
return bStr;
|
|
5029
5004
|
};
|
|
5030
|
-
const
|
|
5031
|
-
|
|
5032
|
-
|
|
5033
|
-
|
|
5005
|
+
const Inner = {
|
|
5006
|
+
passet: "inner",
|
|
5007
|
+
pauctid: "inner",
|
|
5008
|
+
penumbra: "inner",
|
|
5009
|
+
penumbrafullviewingkey: "inner",
|
|
5010
|
+
penumbragovern: "gk",
|
|
5011
|
+
penumbraspendkey: "inner",
|
|
5012
|
+
penumbravalid: "ik",
|
|
5013
|
+
penumbrawalletid: "inner",
|
|
5014
|
+
plpid: "inner",
|
|
5015
|
+
penumbracompat1: "inner",
|
|
5016
|
+
tpenumbra: "inner"
|
|
5017
|
+
};
|
|
5018
|
+
const Prefixes = {
|
|
5019
|
+
passet: "passet",
|
|
5020
|
+
pauctid: "pauctid",
|
|
5021
|
+
penumbra: "penumbra",
|
|
5022
|
+
penumbrafullviewingkey: "penumbrafullviewingkey",
|
|
5023
|
+
penumbragovern: "penumbragovern",
|
|
5024
|
+
penumbraspendkey: "penumbraspendkey",
|
|
5025
|
+
penumbravalid: "penumbravalid",
|
|
5026
|
+
penumbrawalletid: "penumbrawalletid",
|
|
5027
|
+
plpid: "plpid",
|
|
5028
|
+
penumbracompat1: "penumbracompat1",
|
|
5029
|
+
tpenumbra: "tpenumbra"
|
|
5030
|
+
};
|
|
5031
|
+
const innerName = Inner.penumbra;
|
|
5032
|
+
const prefix = Prefixes.penumbra;
|
|
5033
|
+
const bech32mAddress = ({ [innerName]: bytes }) => toBech32m(bytes, prefix);
|
|
5034
|
+
const okxWalletChainIdsInitialConnect = [
|
|
5035
|
+
"axelar-dojo-1",
|
|
5036
|
+
"celestia",
|
|
5037
|
+
"cosmoshub-4",
|
|
5038
|
+
"dydx-mainnet-1",
|
|
5039
|
+
"injective-1",
|
|
5040
|
+
"juno-1",
|
|
5041
|
+
"kava_2222-10",
|
|
5042
|
+
"osmosis-1",
|
|
5043
|
+
"stargaze-1"
|
|
5044
|
+
];
|
|
5045
|
+
const keplrMainnetChainIdsInitialConnect = [
|
|
5046
|
+
"akashnet-2",
|
|
5047
|
+
"axelar-dojo-1",
|
|
5048
|
+
"celestia",
|
|
5049
|
+
"chihuahua-1",
|
|
5050
|
+
"columbus-5",
|
|
5051
|
+
"core-1",
|
|
5052
|
+
"cosmoshub-4",
|
|
5053
|
+
"crypto-org-chain-mainnet-1",
|
|
5054
|
+
"dydx-mainnet-1",
|
|
5055
|
+
"dymension_1100-1",
|
|
5056
|
+
"evmos_9001-2",
|
|
5057
|
+
"injective-1",
|
|
5058
|
+
"juno-1",
|
|
5059
|
+
"kava_2222-10",
|
|
5060
|
+
"kyve-1",
|
|
5061
|
+
"neutron-1",
|
|
5062
|
+
"noble-1",
|
|
5063
|
+
"omniflixhub-1",
|
|
5064
|
+
"osmosis-1",
|
|
5065
|
+
"passage-2",
|
|
5066
|
+
"phoenix-1",
|
|
5067
|
+
"pryzm-1",
|
|
5068
|
+
"quicksilver-2",
|
|
5069
|
+
"regen-1",
|
|
5070
|
+
"secret-4",
|
|
5071
|
+
"seda-1",
|
|
5072
|
+
"sentinelhub-2",
|
|
5073
|
+
"sommelier-3",
|
|
5074
|
+
"ssc-1",
|
|
5075
|
+
"stargaze-1",
|
|
5076
|
+
"stride-1",
|
|
5077
|
+
"umee-1"
|
|
5078
|
+
];
|
|
5079
|
+
const walletMainnetChainIdsInitialConnect = [
|
|
5080
|
+
"cosmoshub-4",
|
|
5081
|
+
"injective-1",
|
|
5082
|
+
"pacific-1",
|
|
5083
|
+
"noble-1",
|
|
5084
|
+
"osmosis-1",
|
|
5085
|
+
"neutron-1",
|
|
5086
|
+
"pryzm-1",
|
|
5087
|
+
"axelar-dojo-1",
|
|
5088
|
+
"chihuahua-1"
|
|
5089
|
+
];
|
|
5090
|
+
const keplrMainnetWithoutEthermintChainIdsInitialConnect = [
|
|
5091
|
+
"akashnet-2",
|
|
5092
|
+
"axelar-dojo-1",
|
|
5093
|
+
"celestia",
|
|
5094
|
+
"chihuahua-1",
|
|
5095
|
+
"columbus-5",
|
|
5096
|
+
"core-1",
|
|
5097
|
+
"cosmoshub-4",
|
|
5098
|
+
"crypto-org-chain-mainnet-1",
|
|
5099
|
+
"dydx-mainnet-1",
|
|
5100
|
+
"juno-1",
|
|
5101
|
+
"kava_2222-10",
|
|
5102
|
+
"kyve-1",
|
|
5103
|
+
"lava-mainnet-1",
|
|
5104
|
+
"neutron-1",
|
|
5105
|
+
"noble-1",
|
|
5106
|
+
"omniflixhub-1",
|
|
5107
|
+
"osmosis-1",
|
|
5108
|
+
"passage-2",
|
|
5109
|
+
"phoenix-1",
|
|
5110
|
+
"pryzm-1",
|
|
5111
|
+
"quicksilver-2",
|
|
5112
|
+
"regen-1",
|
|
5113
|
+
"secret-4",
|
|
5114
|
+
"seda-1",
|
|
5115
|
+
"sentinelhub-2",
|
|
5116
|
+
"sommelier-3",
|
|
5117
|
+
"ssc-1",
|
|
5118
|
+
"stargaze-1",
|
|
5119
|
+
"stride-1",
|
|
5120
|
+
"umee-1",
|
|
5121
|
+
"wormchain"
|
|
5122
|
+
];
|
|
5123
|
+
const walletInfo = {
|
|
5124
|
+
[WalletType.OKX]: {
|
|
5125
|
+
name: "OKX",
|
|
5126
|
+
imgSrc: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJDSURBVHgB7Zq9jtpAEMfHlhEgQLiioXEkoAGECwoKxMcTRHmC5E3IoyRPkPAEkI7unJYmTgEFTYwA8a3NTKScLnCHN6c9r1e3P2llWQy7M/s1Gv1twCP0ej37dDq9x+Zut1t3t9vZjDEHIiSRSPg4ZpDL5fxkMvn1cDh8m0wmfugfO53OoFQq/crn8wxfY9EymQyrVCqMfHvScZx1p9ls3pFxXBy/bKlUipGPrVbLuQqAfsCliq3zl0H84zwtjQrOw4Mt1W63P5LvBm2d+Xz+YzqdgkqUy+WgWCy+Mc/nc282m4FqLBYL+3g8fjDxenq72WxANZbLJeA13zDX67UDioL5ybXwafMYu64Ltn3bdDweQ5R97fd7GyhBQMipx4POeEDHIu2LfDdBIGGz+hJ9CQ1ABjoA2egAZPM6AgiCAEQhsi/C4jHyPA/6/f5NG3Ks2+3CYDC4aTccDrn6ojG54MnEvG00GoVmWLIRNZ7wTCwDHYBsdACy0QHIhiuRETxlICWpMMhGZHmqS8qH6JLyGegAZKMDkI0uKf8X4SWlaZo+Pp1bRrwlJU8ZKLIvUjKh0WiQ3sRUbNVq9c5Ebew7KEo2m/1p4jJ4qAmDaqDQBzj5XyiAT4VCQezJigAU+IDU+z8vJFnGWeC+bKQV/5VZ71FV6L7PA3gg3tXrdQ+DgLhC+75Wq3no69P3MC0NFQpx2lL04Ql9gHK1bRDjsSBIvScBnDTk1WrlGIZBorIDEYJj+rhdgnQ67VmWRe0zlplXl81vcyEt0rSoYDUAAAAASUVORK5CYII="
|
|
5034
5127
|
},
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
set(swapDirectionAtom, "swap-in");
|
|
5039
|
-
if (newAmount === "") {
|
|
5040
|
-
set(destinationAssetAtom, (prev2) => ({ ...prev2, amount: newAmount }));
|
|
5041
|
-
set(debouncedDestinationAssetAmountAtom, newAmount, void 0, true);
|
|
5042
|
-
}
|
|
5043
|
-
}
|
|
5044
|
-
);
|
|
5045
|
-
const destinationAssetAtom = atomWithStorageNoCrossTabSync(
|
|
5046
|
-
LOCAL_STORAGE_KEYS.destinationAsset,
|
|
5047
|
-
void 0
|
|
5048
|
-
);
|
|
5049
|
-
const destinationAssetAmountAtom = atom$1(
|
|
5050
|
-
(get) => {
|
|
5051
|
-
var _a;
|
|
5052
|
-
return ((_a = get(destinationAssetAtom)) == null ? void 0 : _a.amount) ?? "";
|
|
5128
|
+
[WalletType.KEPLR]: {
|
|
5129
|
+
name: "Keplr",
|
|
5130
|
+
imgSrc: "https://raw.githubusercontent.com/graz-sh/graz/dev/example/starter/public/assets/wallet-icon-keplr.png"
|
|
5053
5131
|
},
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
}
|
|
5070
|
-
|
|
5071
|
-
|
|
5072
|
-
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5132
|
+
[WalletType.LEAP]: {
|
|
5133
|
+
name: "Leap",
|
|
5134
|
+
imgSrc: "https://raw.githubusercontent.com/graz-sh/graz/dev/example/starter/public/assets/wallet-icon-leap.png"
|
|
5135
|
+
},
|
|
5136
|
+
[WalletType.COSMOSTATION]: {
|
|
5137
|
+
name: "Cosmostation",
|
|
5138
|
+
imgSrc: "https://raw.githubusercontent.com/graz-sh/graz/dev/example/starter/public/assets/wallet-icon-cosmostation.png"
|
|
5139
|
+
},
|
|
5140
|
+
[WalletType.VECTIS]: {
|
|
5141
|
+
name: "Vectis",
|
|
5142
|
+
imgSrc: "https://raw.githubusercontent.com/graz-sh/graz/dev/example/starter/public/assets/wallet-icon-vectis.svg"
|
|
5143
|
+
},
|
|
5144
|
+
[WalletType.STATION]: {
|
|
5145
|
+
name: "Station",
|
|
5146
|
+
imgSrc: "https://raw.githubusercontent.com/graz-sh/graz/dev/example/starter/public/assets/wallet-icon-station.svg"
|
|
5147
|
+
},
|
|
5148
|
+
[WalletType.XDEFI]: {
|
|
5149
|
+
name: "XDefi",
|
|
5150
|
+
imgSrc: "https://raw.githubusercontent.com/graz-sh/graz/dev/example/starter/public/assets/wallet-icon-xdefi.jpeg"
|
|
5151
|
+
},
|
|
5152
|
+
[WalletType.METAMASK_SNAP_LEAP]: {
|
|
5153
|
+
name: "Metamask Snap Leap",
|
|
5154
|
+
imgSrc: "https://raw.githubusercontent.com/graz-sh/graz/dev/example/starter/public/assets/wallet-icon-metamask.png"
|
|
5155
|
+
},
|
|
5156
|
+
[WalletType.METAMASK_SNAP_COSMOS]: {
|
|
5157
|
+
name: "Metamask Snap Cosmos",
|
|
5158
|
+
imgSrc: "https://raw.githubusercontent.com/graz-sh/graz/dev/example/starter/public/assets/wallet-icon-metamask.png"
|
|
5159
|
+
},
|
|
5160
|
+
[WalletType.WALLETCONNECT]: {
|
|
5161
|
+
name: "WalletConnect",
|
|
5162
|
+
imgSrc: "https://raw.githubusercontent.com/graz-sh/graz/dev/example/starter/public/assets/wallet-icon-walletconnect.png"
|
|
5163
|
+
},
|
|
5164
|
+
[WalletType.WC_KEPLR_MOBILE]: {
|
|
5165
|
+
name: "Keplr Mobile",
|
|
5166
|
+
imgSrc: "https://raw.githubusercontent.com/graz-sh/graz/dev/example/starter/public/assets/wallet-icon-keplr.png",
|
|
5167
|
+
mobile: true
|
|
5168
|
+
},
|
|
5169
|
+
[WalletType.WC_LEAP_MOBILE]: {
|
|
5170
|
+
name: "Leap Mobile",
|
|
5171
|
+
imgSrc: "https://raw.githubusercontent.com/graz-sh/graz/dev/example/starter/public/assets/wallet-icon-leap.png",
|
|
5172
|
+
mobile: true
|
|
5173
|
+
},
|
|
5174
|
+
[WalletType.WC_COSMOSTATION_MOBILE]: {
|
|
5175
|
+
name: "Cosmostation Mobile",
|
|
5176
|
+
imgSrc: "https://raw.githubusercontent.com/graz-sh/graz/dev/example/starter/public/assets/wallet-icon-cosmostation.png",
|
|
5177
|
+
mobile: true
|
|
5178
|
+
},
|
|
5179
|
+
[WalletType.COSMIFRAME]: {
|
|
5180
|
+
name: "DAO DAO",
|
|
5181
|
+
imgSrc: "https://raw.githubusercontent.com/graz-sh/graz/dev/example/starter/public/assets/wallet-icon-daodao.png"
|
|
5182
|
+
},
|
|
5183
|
+
[WalletType.COMPASS]: {
|
|
5184
|
+
name: "Compass",
|
|
5185
|
+
imgSrc: "https://raw.githubusercontent.com/graz-sh/graz/dev/example/starter/public/assets/wallet-icon-compass.png"
|
|
5086
5186
|
}
|
|
5087
|
-
});
|
|
5088
|
-
const swapDirectionAtom = atomWithStorageNoCrossTabSync(
|
|
5089
|
-
"swapDirection",
|
|
5090
|
-
"swap-in"
|
|
5091
|
-
);
|
|
5092
|
-
const isInvertingSwapAtom = atom$1(false);
|
|
5093
|
-
const invertSwapAtom = atom$1(null, (get, set) => {
|
|
5094
|
-
const sourceAsset = get(sourceAssetAtom);
|
|
5095
|
-
const destinationAsset = get(destinationAssetAtom);
|
|
5096
|
-
const clonedSourceAsset = { ...sourceAsset };
|
|
5097
|
-
const clonedDestinationAsset = { ...destinationAsset };
|
|
5098
|
-
const swapDirection = get(swapDirectionAtom);
|
|
5099
|
-
const callbacks = get(callbacksAtom);
|
|
5100
|
-
set(isInvertingSwapAtom, true);
|
|
5101
|
-
set(sourceAssetAtom, clonedDestinationAsset);
|
|
5102
|
-
set(sourceAssetAmountAtom, (destinationAsset == null ? void 0 : destinationAsset.amount) ?? "");
|
|
5103
|
-
set(destinationAssetAtom, clonedSourceAsset);
|
|
5104
|
-
set(destinationAssetAmountAtom, (sourceAsset == null ? void 0 : sourceAsset.amount) ?? "", () => {
|
|
5105
|
-
var _a;
|
|
5106
|
-
const newSwapDirection = swapDirection === "swap-in" ? "swap-out" : "swap-in";
|
|
5107
|
-
set(swapDirectionAtom, newSwapDirection);
|
|
5108
|
-
set(isInvertingSwapAtom, false);
|
|
5109
|
-
(_a = callbacks == null ? void 0 : callbacks.onSourceAndDestinationSwapped) == null ? void 0 : _a.call(callbacks, {
|
|
5110
|
-
srcChainId: clonedDestinationAsset == null ? void 0 : clonedDestinationAsset.chainId,
|
|
5111
|
-
srcAssetDenom: clonedDestinationAsset == null ? void 0 : clonedDestinationAsset.denom,
|
|
5112
|
-
destChainId: clonedSourceAsset == null ? void 0 : clonedSourceAsset.chainId,
|
|
5113
|
-
destAssetDenom: clonedSourceAsset == null ? void 0 : clonedSourceAsset.denom,
|
|
5114
|
-
amountIn: clonedDestinationAsset == null ? void 0 : clonedDestinationAsset.amount,
|
|
5115
|
-
amountOut: clonedSourceAsset == null ? void 0 : clonedSourceAsset.amount
|
|
5116
|
-
});
|
|
5117
|
-
});
|
|
5118
|
-
});
|
|
5119
|
-
atom$1();
|
|
5120
|
-
atom$1();
|
|
5121
|
-
const EVM_GAS_AMOUNT = 15e4;
|
|
5122
|
-
const COSMOS_GAS_AMOUNT = {
|
|
5123
|
-
DEFAULT: 3e5,
|
|
5124
|
-
SWAP: 28e5,
|
|
5125
|
-
CARBON: 1e6
|
|
5126
5187
|
};
|
|
5127
|
-
const
|
|
5128
|
-
|
|
5129
|
-
routePreference: RoutePreference.FASTEST,
|
|
5130
|
-
useUnlimitedApproval: false
|
|
5188
|
+
const getCosmosWalletInfo = (walletType) => {
|
|
5189
|
+
return walletInfo[walletType];
|
|
5131
5190
|
};
|
|
5132
|
-
const
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
}
|
|
5141
|
-
);
|
|
5142
|
-
const routePreferenceAtom = atom$1(
|
|
5143
|
-
(get) => get(swapSettingsAtom).routePreference,
|
|
5144
|
-
(_get, set, newRoutePreference) => {
|
|
5145
|
-
set(swapSettingsAtom, (prev2) => ({ ...prev2, routePreference: newRoutePreference }));
|
|
5146
|
-
}
|
|
5147
|
-
);
|
|
5148
|
-
const goFastWarningAtom = atomWithStorageNoCrossTabSync("showGoFastWarning", true);
|
|
5149
|
-
const initializeDebounceValuesEffect = atomEffect(
|
|
5150
|
-
(get, set) => {
|
|
5151
|
-
const sourceAsset = get(sourceAssetAtom);
|
|
5152
|
-
const destinationAsset = get(destinationAssetAtom);
|
|
5153
|
-
const defaultRoute = get(defaultRouteAtom);
|
|
5154
|
-
const debouncedSourceAssetInitialized = get(debouncedSourceAssetAmountValueInitializedAtom);
|
|
5155
|
-
const debouncedDestinationAssetInitialized = get(
|
|
5156
|
-
debouncedDestinationAssetAmountValueInitializedAtom
|
|
5157
|
-
);
|
|
5158
|
-
if (!debouncedSourceAssetInitialized && (sourceAsset == null ? void 0 : sourceAsset.amount)) {
|
|
5159
|
-
set(debouncedSourceAssetAmountAtom, sourceAsset.amount, void 0, true);
|
|
5160
|
-
set(sourceAssetAtom, (prev2) => ({ ...prev2, locked: defaultRoute == null ? void 0 : defaultRoute.srcLocked }));
|
|
5161
|
-
}
|
|
5162
|
-
if (!debouncedDestinationAssetInitialized && (destinationAsset == null ? void 0 : destinationAsset.amount)) {
|
|
5163
|
-
set(debouncedDestinationAssetAmountAtom, destinationAsset.amount, void 0, true);
|
|
5164
|
-
set(destinationAssetAtom, (prev2) => ({ ...prev2, locked: defaultRoute == null ? void 0 : defaultRoute.destLocked }));
|
|
5165
|
-
}
|
|
5166
|
-
}
|
|
5167
|
-
);
|
|
5168
|
-
const skipRouteRequestAtom = atom$1((get) => {
|
|
5169
|
-
const sourceAsset = get(sourceAssetAtom);
|
|
5170
|
-
const destinationAsset = get(destinationAssetAtom);
|
|
5171
|
-
const direction = get(swapDirectionAtom);
|
|
5172
|
-
const sourceAssetAmount = get(debouncedSourceAssetAmountAtom);
|
|
5173
|
-
const destinationAssetAmount = get(debouncedDestinationAssetAmountAtom);
|
|
5174
|
-
get(initializeDebounceValuesEffect);
|
|
5175
|
-
if (!(sourceAsset == null ? void 0 : sourceAsset.chainId) || !sourceAsset.denom || !(destinationAsset == null ? void 0 : destinationAsset.chainId) || !destinationAsset.denom) {
|
|
5176
|
-
return void 0;
|
|
5177
|
-
}
|
|
5178
|
-
const amount = direction === "swap-in" ? {
|
|
5179
|
-
amountIn: convertHumanReadableAmountToCryptoAmount(
|
|
5180
|
-
sourceAssetAmount ?? "0",
|
|
5181
|
-
sourceAsset.decimals
|
|
5182
|
-
)
|
|
5183
|
-
} : {
|
|
5184
|
-
amountOut: convertHumanReadableAmountToCryptoAmount(
|
|
5185
|
-
destinationAssetAmount ?? "0",
|
|
5186
|
-
destinationAsset.decimals
|
|
5187
|
-
)
|
|
5188
|
-
};
|
|
5189
|
-
return {
|
|
5190
|
-
...amount,
|
|
5191
|
-
sourceAssetChainId: sourceAsset.chainId,
|
|
5192
|
-
sourceAssetDenom: sourceAsset.denom,
|
|
5193
|
-
destAssetChainId: destinationAsset.chainId,
|
|
5194
|
-
destAssetDenom: destinationAsset.denom
|
|
5195
|
-
};
|
|
5196
|
-
});
|
|
5197
|
-
const routeConfigAtom = atom$1({
|
|
5198
|
-
experimentalFeatures: ["stargate", "eureka", "layer_zero"],
|
|
5199
|
-
allowMultiTx: true,
|
|
5200
|
-
allowUnsafe: true,
|
|
5201
|
-
smartSwapOptions: {
|
|
5202
|
-
splitRoutes: true,
|
|
5203
|
-
evmSwaps: true
|
|
5204
|
-
},
|
|
5205
|
-
goFast: true,
|
|
5206
|
-
timeoutSeconds: void 0
|
|
5207
|
-
});
|
|
5208
|
-
const _skipRouteAtom = atomWithQuery((get) => {
|
|
5209
|
-
const params = get(skipRouteRequestAtom);
|
|
5210
|
-
const currentPage = get(currentPageAtom);
|
|
5211
|
-
const isInvertingSwap = get(isInvertingSwapAtom);
|
|
5212
|
-
const errorWarning = get(errorWarningAtom);
|
|
5213
|
-
const routeConfig = get(routeConfigAtom);
|
|
5214
|
-
const swapSettings = get(swapSettingsAtom);
|
|
5215
|
-
const queryEnabled = params !== void 0 && (Number(params.amountIn) > 0 || Number(params.amountOut) > 0) && !isInvertingSwap && currentPage === Routes.SwapPage && errorWarning === void 0;
|
|
5216
|
-
return {
|
|
5217
|
-
queryKey: ["skipRoute", params, routeConfig, swapSettings],
|
|
5218
|
-
queryFn: async () => {
|
|
5219
|
-
if (!params) {
|
|
5220
|
-
throw new Error("No route request provided");
|
|
5191
|
+
const _mainnetChains = [
|
|
5192
|
+
{
|
|
5193
|
+
chainId: "aaronetwork",
|
|
5194
|
+
currencies: [
|
|
5195
|
+
{
|
|
5196
|
+
coinDenom: "AARON",
|
|
5197
|
+
coinMinimalDenom: "uaaron",
|
|
5198
|
+
coinDecimals: 6
|
|
5221
5199
|
}
|
|
5222
|
-
|
|
5223
|
-
|
|
5224
|
-
|
|
5225
|
-
|
|
5226
|
-
|
|
5227
|
-
|
|
5228
|
-
|
|
5229
|
-
|
|
5230
|
-
|
|
5231
|
-
|
|
5232
|
-
|
|
5233
|
-
|
|
5234
|
-
|
|
5235
|
-
|
|
5200
|
+
],
|
|
5201
|
+
rest: "https://mainnet-api.aaronetwork.xyz",
|
|
5202
|
+
rpc: "https://mainnet-rpc.aaronetwork.xyz",
|
|
5203
|
+
bech32Config: {
|
|
5204
|
+
bech32PrefixAccAddr: "aaron",
|
|
5205
|
+
bech32PrefixAccPub: "aaronpub",
|
|
5206
|
+
bech32PrefixValAddr: "aaronvaloper",
|
|
5207
|
+
bech32PrefixValPub: "aaronvaloperpub",
|
|
5208
|
+
bech32PrefixConsAddr: "aaronvalcons",
|
|
5209
|
+
bech32PrefixConsPub: "aaronvalconspub"
|
|
5210
|
+
},
|
|
5211
|
+
chainName: "aaronetwork",
|
|
5212
|
+
feeCurrencies: [
|
|
5213
|
+
{
|
|
5214
|
+
coinDenom: "AARON",
|
|
5215
|
+
coinMinimalDenom: "uaaron",
|
|
5216
|
+
coinDecimals: 6
|
|
5236
5217
|
}
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
});
|
|
5243
|
-
const skipRouteAtom = atom$1((get) => {
|
|
5244
|
-
const { data, isError, error, isFetching, isPending } = get(_skipRouteAtom);
|
|
5245
|
-
const caughtError = data;
|
|
5246
|
-
const routeResponse = data;
|
|
5247
|
-
if (caughtError == null ? void 0 : caughtError.isError) {
|
|
5248
|
-
return {
|
|
5249
|
-
data: void 0,
|
|
5250
|
-
isError: true,
|
|
5251
|
-
error: caughtError.error,
|
|
5252
|
-
isLoading: false
|
|
5253
|
-
};
|
|
5254
|
-
}
|
|
5255
|
-
return {
|
|
5256
|
-
data: routeResponse,
|
|
5257
|
-
isError,
|
|
5258
|
-
error,
|
|
5259
|
-
isLoading: isFetching && isPending
|
|
5260
|
-
};
|
|
5261
|
-
});
|
|
5262
|
-
const defaultRouteAtom = atom$1();
|
|
5263
|
-
const setRouteToDefaultRouteAtom = atom$1(null, (get, set, assets2) => {
|
|
5264
|
-
const defaultRoute = get(defaultRouteAtom);
|
|
5265
|
-
const { data } = get(skipAssetsAtom);
|
|
5266
|
-
assets2 ?? (assets2 = data);
|
|
5267
|
-
const getClientAsset = (denom, chainId) => {
|
|
5268
|
-
if (!denom || !chainId) return;
|
|
5269
|
-
if (!assets2) return;
|
|
5270
|
-
return assets2.find(
|
|
5271
|
-
(a) => a.denom.toLowerCase() === denom.toLowerCase() && a.chainId === chainId
|
|
5272
|
-
);
|
|
5273
|
-
};
|
|
5274
|
-
if (!defaultRoute || !assets2) return;
|
|
5275
|
-
const { srcAssetDenom, srcChainId, destAssetDenom, destChainId, amountIn, amountOut } = defaultRoute;
|
|
5276
|
-
const sourceAsset = getClientAsset(srcAssetDenom, srcChainId);
|
|
5277
|
-
const destinationAsset = getClientAsset(destAssetDenom, destChainId);
|
|
5278
|
-
set(destinationAssetAtom, {
|
|
5279
|
-
...destinationAsset,
|
|
5280
|
-
locked: defaultRoute == null ? void 0 : defaultRoute.destLocked,
|
|
5281
|
-
amount: amountOut == null ? void 0 : amountOut.toString()
|
|
5282
|
-
});
|
|
5283
|
-
set(sourceAssetAtom, {
|
|
5284
|
-
...sourceAsset,
|
|
5285
|
-
locked: defaultRoute == null ? void 0 : defaultRoute.srcLocked,
|
|
5286
|
-
amount: amountIn == null ? void 0 : amountIn.toString()
|
|
5287
|
-
});
|
|
5288
|
-
if (amountIn) {
|
|
5289
|
-
set(sourceAssetAmountAtom, amountIn == null ? void 0 : amountIn.toString());
|
|
5290
|
-
} else if (amountOut) {
|
|
5291
|
-
set(destinationAssetAmountAtom, amountOut == null ? void 0 : amountOut.toString());
|
|
5292
|
-
}
|
|
5293
|
-
});
|
|
5294
|
-
const transactionHistoryAtom = atomWithStorage(
|
|
5295
|
-
LOCAL_STORAGE_KEYS.transactionHistory,
|
|
5296
|
-
[],
|
|
5297
|
-
void 0
|
|
5298
|
-
);
|
|
5299
|
-
const setTransactionHistoryAtom = atom$1(
|
|
5300
|
-
null,
|
|
5301
|
-
(get, set, index, historyItem) => {
|
|
5302
|
-
const history = get(transactionHistoryAtom);
|
|
5303
|
-
const newHistory = [...history];
|
|
5304
|
-
const oldHistoryItem = newHistory[index] ?? {};
|
|
5305
|
-
newHistory[index] = { ...oldHistoryItem, ...historyItem };
|
|
5306
|
-
set(transactionHistoryAtom, newHistory);
|
|
5307
|
-
}
|
|
5308
|
-
);
|
|
5309
|
-
const removeTransactionHistoryItemAtom = atom$1(null, (get, set, index) => {
|
|
5310
|
-
const history = get(transactionHistoryAtom);
|
|
5311
|
-
if (!history) return;
|
|
5312
|
-
if (index < 0) return;
|
|
5313
|
-
if (index >= history.length) return;
|
|
5314
|
-
const newHistory = history.filter((_2, i) => i !== index);
|
|
5315
|
-
set(transactionHistoryAtom, newHistory);
|
|
5316
|
-
});
|
|
5317
|
-
atomWithQuery((get) => {
|
|
5318
|
-
const transactionHistory = get(transactionHistoryAtom);
|
|
5319
|
-
const pendingTransactionHistoryItemsFound = transactionHistory.find(
|
|
5320
|
-
(transactionHistoryItem) => transactionHistoryItem.status !== "completed" && transactionHistoryItem.status !== "failed"
|
|
5321
|
-
);
|
|
5322
|
-
return {
|
|
5323
|
-
queryKey: ["skipPendingTxHistoryStatus", transactionHistory],
|
|
5324
|
-
queryFn: async () => {
|
|
5325
|
-
const nestedTransactionHistoryPromises = transactionHistory.map(
|
|
5326
|
-
async (transactionHistoryItem) => {
|
|
5327
|
-
var _a;
|
|
5328
|
-
const transactionDetailsPromises = await Promise.all(
|
|
5329
|
-
(_a = transactionHistoryItem.transactionDetails) == null ? void 0 : _a.map(async (transactionDetail) => {
|
|
5330
|
-
if (transactionHistoryItem.status !== "completed" && transactionHistoryItem.status !== "failed") {
|
|
5331
|
-
return await transactionStatus(transactionDetail);
|
|
5332
|
-
}
|
|
5333
|
-
return new Promise((resolve) => resolve(null));
|
|
5334
|
-
})
|
|
5335
|
-
);
|
|
5336
|
-
return transactionDetailsPromises;
|
|
5337
|
-
}
|
|
5338
|
-
);
|
|
5339
|
-
return nestedTransactionHistoryPromises;
|
|
5340
|
-
},
|
|
5341
|
-
enabled: !!pendingTransactionHistoryItemsFound,
|
|
5342
|
-
refetchInterval: 1e3 * 2,
|
|
5343
|
-
keepPreviousData: true
|
|
5344
|
-
};
|
|
5345
|
-
});
|
|
5346
|
-
function isUserRejectedRequestError(input) {
|
|
5347
|
-
if (input instanceof Error) {
|
|
5348
|
-
if (
|
|
5349
|
-
// keplr | metamask
|
|
5350
|
-
input.message.toLowerCase().includes("rejected") || // leap
|
|
5351
|
-
input.message.toLowerCase().includes("declined") || input.message.toLowerCase().includes("denied") || // @ts-expect-error common user rejected request error code
|
|
5352
|
-
input.code === 4001
|
|
5353
|
-
) {
|
|
5354
|
-
return true;
|
|
5355
|
-
}
|
|
5356
|
-
}
|
|
5357
|
-
return false;
|
|
5358
|
-
}
|
|
5359
|
-
const _mainnetChains = [
|
|
5360
|
-
{
|
|
5361
|
-
chainId: "aaronetwork",
|
|
5362
|
-
currencies: [
|
|
5363
|
-
{
|
|
5364
|
-
coinDenom: "AARON",
|
|
5365
|
-
coinMinimalDenom: "uaaron",
|
|
5366
|
-
coinDecimals: 6
|
|
5367
|
-
}
|
|
5368
|
-
],
|
|
5369
|
-
rest: "https://mainnet-api.aaronetwork.xyz",
|
|
5370
|
-
rpc: "https://mainnet-rpc.aaronetwork.xyz",
|
|
5371
|
-
bech32Config: {
|
|
5372
|
-
bech32PrefixAccAddr: "aaron",
|
|
5373
|
-
bech32PrefixAccPub: "aaronpub",
|
|
5374
|
-
bech32PrefixValAddr: "aaronvaloper",
|
|
5375
|
-
bech32PrefixValPub: "aaronvaloperpub",
|
|
5376
|
-
bech32PrefixConsAddr: "aaronvalcons",
|
|
5377
|
-
bech32PrefixConsPub: "aaronvalconspub"
|
|
5378
|
-
},
|
|
5379
|
-
chainName: "aaronetwork",
|
|
5380
|
-
feeCurrencies: [
|
|
5381
|
-
{
|
|
5382
|
-
coinDenom: "AARON",
|
|
5383
|
-
coinMinimalDenom: "uaaron",
|
|
5384
|
-
coinDecimals: 6
|
|
5385
|
-
}
|
|
5386
|
-
],
|
|
5387
|
-
stakeCurrency: {
|
|
5388
|
-
coinDenom: "AARON",
|
|
5389
|
-
coinMinimalDenom: "uaaron",
|
|
5390
|
-
coinDecimals: 6
|
|
5218
|
+
],
|
|
5219
|
+
stakeCurrency: {
|
|
5220
|
+
coinDenom: "AARON",
|
|
5221
|
+
coinMinimalDenom: "uaaron",
|
|
5222
|
+
coinDecimals: 6
|
|
5391
5223
|
},
|
|
5392
5224
|
bip44: {
|
|
5393
5225
|
coinType: 118
|
|
@@ -39607,129 +39439,926 @@ const getChainInfo = (chainId) => {
|
|
|
39607
39439
|
if (!chain) return void 0;
|
|
39608
39440
|
return chain;
|
|
39609
39441
|
};
|
|
39610
|
-
|
|
39611
|
-
|
|
39612
|
-
|
|
39613
|
-
|
|
39614
|
-
|
|
39615
|
-
|
|
39442
|
+
const useUpdateSourceAssetToDefaultForChainType = () => {
|
|
39443
|
+
const { data: chains2 } = useAtomValue(skipChainsAtom);
|
|
39444
|
+
const { data: assets2 } = useAtomValue(skipAssetsAtom);
|
|
39445
|
+
const setSourceAsset = useSetAtom(sourceAssetAtom);
|
|
39446
|
+
return (chainType) => {
|
|
39447
|
+
switch (chainType) {
|
|
39448
|
+
case ChainType.Cosmos: {
|
|
39449
|
+
const chain = chains2 == null ? void 0 : chains2.find((x2) => x2.chainId === "cosmoshub-4");
|
|
39450
|
+
const asset = assets2 == null ? void 0 : assets2.find((x2) => x2.denom === "uatom");
|
|
39451
|
+
setSourceAsset({
|
|
39452
|
+
chainId: chain == null ? void 0 : chain.chainId,
|
|
39453
|
+
chainName: chain == null ? void 0 : chain.chainName,
|
|
39454
|
+
...asset
|
|
39455
|
+
});
|
|
39456
|
+
return;
|
|
39457
|
+
}
|
|
39458
|
+
case ChainType.Evm: {
|
|
39459
|
+
const chain = chains2 == null ? void 0 : chains2.find((chain2) => chain2.chainId === "1");
|
|
39460
|
+
const asset = assets2 == null ? void 0 : assets2.find((asset2) => asset2.denom === "ethereum-native");
|
|
39461
|
+
setSourceAsset({
|
|
39462
|
+
chainId: chain == null ? void 0 : chain.chainId,
|
|
39463
|
+
chainName: chain == null ? void 0 : chain.chainName,
|
|
39464
|
+
...asset
|
|
39465
|
+
});
|
|
39466
|
+
return;
|
|
39467
|
+
}
|
|
39468
|
+
case ChainType.Svm: {
|
|
39469
|
+
const chain = chains2 == null ? void 0 : chains2.find((x2) => x2.chainId === "solana");
|
|
39470
|
+
const asset = assets2 == null ? void 0 : assets2.find(
|
|
39471
|
+
(x2) => x2.denom.toLowerCase() === "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v".toLowerCase()
|
|
39472
|
+
);
|
|
39473
|
+
setSourceAsset({
|
|
39474
|
+
chainId: chain == null ? void 0 : chain.chainId,
|
|
39475
|
+
chainName: chain == null ? void 0 : chain.chainName,
|
|
39476
|
+
...asset
|
|
39477
|
+
});
|
|
39478
|
+
}
|
|
39479
|
+
}
|
|
39616
39480
|
};
|
|
39617
|
-
}
|
|
39618
|
-
const version$2 = "2.21.55";
|
|
39619
|
-
let errorConfig = {
|
|
39620
|
-
getDocsUrl: ({ docsBaseUrl, docsPath = "", docsSlug }) => docsPath ? `${docsBaseUrl ?? "https://viem.sh"}${docsPath}${docsSlug ? `#${docsSlug}` : ""}` : void 0,
|
|
39621
|
-
version: `viem@${version$2}`
|
|
39622
39481
|
};
|
|
39623
|
-
|
|
39624
|
-
|
|
39625
|
-
|
|
39626
|
-
|
|
39627
|
-
|
|
39628
|
-
|
|
39629
|
-
|
|
39630
|
-
|
|
39631
|
-
|
|
39632
|
-
|
|
39633
|
-
|
|
39634
|
-
|
|
39635
|
-
|
|
39636
|
-
|
|
39637
|
-
|
|
39638
|
-
|
|
39639
|
-
|
|
39640
|
-
|
|
39641
|
-
|
|
39642
|
-
|
|
39643
|
-
|
|
39644
|
-
|
|
39645
|
-
|
|
39646
|
-
|
|
39647
|
-
|
|
39648
|
-
|
|
39649
|
-
|
|
39650
|
-
|
|
39651
|
-
|
|
39652
|
-
|
|
39653
|
-
|
|
39654
|
-
|
|
39655
|
-
|
|
39656
|
-
|
|
39657
|
-
|
|
39658
|
-
|
|
39659
|
-
|
|
39660
|
-
|
|
39661
|
-
|
|
39662
|
-
|
|
39663
|
-
|
|
39664
|
-
|
|
39665
|
-
|
|
39666
|
-
|
|
39667
|
-
|
|
39668
|
-
|
|
39669
|
-
|
|
39670
|
-
|
|
39671
|
-
|
|
39672
|
-
|
|
39673
|
-
|
|
39674
|
-
|
|
39675
|
-
|
|
39676
|
-
|
|
39677
|
-
|
|
39482
|
+
const useCreateCosmosWallets = () => {
|
|
39483
|
+
const { data: chains2 } = useAtomValue(skipChainsAtom);
|
|
39484
|
+
const [cosmosWallet, setCosmosWallet] = useAtom(cosmosWalletAtom);
|
|
39485
|
+
const sourceAsset = useAtomValue(sourceAssetAtom);
|
|
39486
|
+
const callbacks = useAtomValue(callbacksAtom);
|
|
39487
|
+
const { walletType: currentWallet } = useActiveWalletType();
|
|
39488
|
+
const extraCosmosChainIdsToConnectPerWallet = useAtomValue(
|
|
39489
|
+
extraCosmosChainIdsToConnectPerWalletAtom
|
|
39490
|
+
);
|
|
39491
|
+
const addExtraChainIdsToConnectForWalletType = useSetAtom(
|
|
39492
|
+
addExtraChainIdsToConnectForWalletTypeAtom
|
|
39493
|
+
);
|
|
39494
|
+
const clearCosmosChainIdsToConnectForWalletType = useSetAtom(
|
|
39495
|
+
clearCosmosChainIdsToConnectForWalletTypeAtom
|
|
39496
|
+
);
|
|
39497
|
+
const setDefaultSourceAsset = useUpdateSourceAssetToDefaultForChainType();
|
|
39498
|
+
const { disconnectAsync } = useDisconnect();
|
|
39499
|
+
const createCosmosWallets = useCallback(
|
|
39500
|
+
(chainId) => {
|
|
39501
|
+
const mobile = isMobile();
|
|
39502
|
+
const cosmosWallets = getAvailableWallets();
|
|
39503
|
+
const isPenumbra = chainId == null ? void 0 : chainId.includes("penumbra");
|
|
39504
|
+
if (isPenumbra && !mobile) {
|
|
39505
|
+
return handlePenumbraNetwork(callbacks == null ? void 0 : callbacks.onWalletDisconnected);
|
|
39506
|
+
}
|
|
39507
|
+
const wallets = [];
|
|
39508
|
+
for (const wallet of cosmosWallets) {
|
|
39509
|
+
const isWC = isWalletConnect(wallet);
|
|
39510
|
+
const mobile2 = isMobile();
|
|
39511
|
+
const walletInfo2 = getCosmosWalletInfo(wallet);
|
|
39512
|
+
const initialChainIds = filterValidChainIds(
|
|
39513
|
+
[...getInitialChainIds(wallet), ...extraCosmosChainIdsToConnectPerWallet[wallet] ?? []],
|
|
39514
|
+
chains2
|
|
39515
|
+
);
|
|
39516
|
+
const connectWallet = async ({ chainIdToConnect }) => {
|
|
39517
|
+
var _a, _b, _c, _d, _e2, _f, _g, _h, _i;
|
|
39518
|
+
const connectToInitialChainId = !chainIdToConnect || chainIdToConnect && initialChainIds.includes(chainIdToConnect);
|
|
39519
|
+
try {
|
|
39520
|
+
if (chainIdToConnect) {
|
|
39521
|
+
const chainInfo = getChainInfo(chainIdToConnect);
|
|
39522
|
+
if (!chainInfo)
|
|
39523
|
+
throw new Error(`connect: Chain info not found for chainId: ${chainId}`);
|
|
39524
|
+
if (!mobile2 && !isWC) {
|
|
39525
|
+
await getWallet(wallet).experimentalSuggestChain(chainInfo);
|
|
39526
|
+
}
|
|
39527
|
+
}
|
|
39528
|
+
const response = await connect({
|
|
39529
|
+
chainId: connectToInitialChainId ? initialChainIds : [...initialChainIds, chainIdToConnect],
|
|
39530
|
+
walletType: wallet,
|
|
39531
|
+
autoReconnect: false
|
|
39532
|
+
});
|
|
39533
|
+
if (!(response == null ? void 0 : response.accounts)) {
|
|
39534
|
+
throw new Error("failed to get accounts from wallet");
|
|
39535
|
+
}
|
|
39536
|
+
if (sourceAsset === void 0) {
|
|
39537
|
+
setDefaultSourceAsset(ChainType.Cosmos);
|
|
39538
|
+
}
|
|
39539
|
+
const chainIdToAddressMap = Object.fromEntries(
|
|
39540
|
+
Object.entries(response.accounts).map(([key, value]) => [key, value == null ? void 0 : value.bech32Address])
|
|
39541
|
+
);
|
|
39542
|
+
const address = chainIdToConnect && ((_b = (_a = response == null ? void 0 : response.accounts) == null ? void 0 : _a[chainIdToConnect]) == null ? void 0 : _b.bech32Address);
|
|
39543
|
+
if (cosmosWallet === void 0) {
|
|
39544
|
+
(_c = callbacks == null ? void 0 : callbacks.onWalletConnected) == null ? void 0 : _c.call(callbacks, {
|
|
39545
|
+
walletName: wallet,
|
|
39546
|
+
chainIdToAddressMap,
|
|
39547
|
+
address
|
|
39548
|
+
});
|
|
39549
|
+
const currentCosmosId = (_e2 = response == null ? void 0 : response.accounts[(_d = Object.keys(response == null ? void 0 : response.accounts)) == null ? void 0 : _d[0]]) == null ? void 0 : _e2.bech32Address;
|
|
39550
|
+
setCosmosWallet({
|
|
39551
|
+
id: currentCosmosId,
|
|
39552
|
+
walletName: wallet,
|
|
39553
|
+
chainType: ChainType.Cosmos
|
|
39554
|
+
});
|
|
39555
|
+
}
|
|
39556
|
+
addExtraChainIdsToConnectForWalletType({
|
|
39557
|
+
walletName: wallet,
|
|
39558
|
+
chainId: chainIdToConnect ?? ""
|
|
39559
|
+
});
|
|
39560
|
+
track("wallet connected", {
|
|
39561
|
+
walletName: wallet,
|
|
39562
|
+
chainId: chainIdToConnect,
|
|
39563
|
+
chainType: ChainType.Cosmos,
|
|
39564
|
+
address
|
|
39565
|
+
});
|
|
39566
|
+
return { address };
|
|
39567
|
+
} catch (e) {
|
|
39568
|
+
const error = e;
|
|
39569
|
+
track("connect wallet error", {
|
|
39570
|
+
walletName: wallet,
|
|
39571
|
+
chainId: chainIdToConnect,
|
|
39572
|
+
ChainType: ChainType.Cosmos,
|
|
39573
|
+
errorMessage: error == null ? void 0 : error.message
|
|
39574
|
+
});
|
|
39575
|
+
if ((_f = error == null ? void 0 : error.message) == null ? void 0 : _f.toLowerCase().includes("no ethereum public key")) {
|
|
39576
|
+
const response = await connect({
|
|
39577
|
+
chainId: keplrMainnetWithoutEthermintChainIdsInitialConnect,
|
|
39578
|
+
walletType: wallet,
|
|
39579
|
+
autoReconnect: false
|
|
39580
|
+
});
|
|
39581
|
+
return {
|
|
39582
|
+
address: chainIdToConnect ? response == null ? void 0 : response.accounts[chainIdToConnect].bech32Address : void 0
|
|
39583
|
+
};
|
|
39584
|
+
}
|
|
39585
|
+
if (((_g = extraCosmosChainIdsToConnectPerWallet == null ? void 0 : extraCosmosChainIdsToConnectPerWallet[wallet]) == null ? void 0 : _g.length) > 0) {
|
|
39586
|
+
clearCosmosChainIdsToConnectForWalletType(wallet);
|
|
39587
|
+
const retryChainIds = filterValidChainIds([...getInitialChainIds(wallet)], chains2);
|
|
39588
|
+
const response = await connect({
|
|
39589
|
+
chainId: connectToInitialChainId ? retryChainIds : [...retryChainIds, chainIdToConnect],
|
|
39590
|
+
walletType: wallet,
|
|
39591
|
+
autoReconnect: false
|
|
39592
|
+
});
|
|
39593
|
+
const address = chainIdToConnect && ((_h = response == null ? void 0 : response.accounts[chainIdToConnect]) == null ? void 0 : _h.bech32Address);
|
|
39594
|
+
return { address };
|
|
39595
|
+
}
|
|
39596
|
+
if ((_i = error == null ? void 0 : error.message) == null ? void 0 : _i.toLowerCase().includes("no chain info")) {
|
|
39597
|
+
throw new Error(
|
|
39598
|
+
`There is no chain info for ${chainIdToConnect}. Please add the ${chainIdToConnect} chain to your wallet`
|
|
39599
|
+
);
|
|
39600
|
+
}
|
|
39601
|
+
throw e;
|
|
39602
|
+
}
|
|
39603
|
+
};
|
|
39604
|
+
const minimalWallet = {
|
|
39605
|
+
walletName: wallet,
|
|
39606
|
+
walletPrettyName: walletInfo2 == null ? void 0 : walletInfo2.name,
|
|
39607
|
+
walletChainType: ChainType.Cosmos,
|
|
39608
|
+
walletInfo: {
|
|
39609
|
+
logo: walletInfo2 == null ? void 0 : walletInfo2.imgSrc
|
|
39610
|
+
},
|
|
39611
|
+
connect: async (chainId2) => {
|
|
39612
|
+
await connectWallet({ chainIdToConnect: chainId2 });
|
|
39613
|
+
},
|
|
39614
|
+
disconnect: async () => {
|
|
39615
|
+
var _a;
|
|
39616
|
+
await disconnectAsync();
|
|
39617
|
+
track("wallet disconnected", {
|
|
39618
|
+
walletName: wallet,
|
|
39619
|
+
ChainType: ChainType.Cosmos
|
|
39620
|
+
});
|
|
39621
|
+
setCosmosWallet(void 0);
|
|
39622
|
+
(_a = callbacks == null ? void 0 : callbacks.onWalletDisconnected) == null ? void 0 : _a.call(callbacks, {
|
|
39623
|
+
walletName: wallet,
|
|
39624
|
+
chainType: ChainType.Cosmos
|
|
39625
|
+
});
|
|
39626
|
+
},
|
|
39627
|
+
getAddress: async ({ signRequired }) => {
|
|
39628
|
+
try {
|
|
39629
|
+
const getAddressWithoutConnectingWallet = cosmosWallet && !signRequired && chainId;
|
|
39630
|
+
if (getAddressWithoutConnectingWallet) {
|
|
39631
|
+
const address = (await getWallet(wallet).getKey(chainId)).bech32Address;
|
|
39632
|
+
return { address };
|
|
39633
|
+
}
|
|
39634
|
+
throw new Error("connect wallet");
|
|
39635
|
+
} catch (_error) {
|
|
39636
|
+
return connectWallet({ chainIdToConnect: chainId });
|
|
39637
|
+
}
|
|
39638
|
+
},
|
|
39639
|
+
isWalletConnected: currentWallet === wallet,
|
|
39640
|
+
isAvailable: (() => {
|
|
39641
|
+
if (mobile2) return void 0;
|
|
39642
|
+
try {
|
|
39643
|
+
const w2 = getWallet(wallet);
|
|
39644
|
+
return Boolean(w2);
|
|
39645
|
+
} catch (_error) {
|
|
39646
|
+
return false;
|
|
39647
|
+
}
|
|
39648
|
+
})()
|
|
39649
|
+
};
|
|
39650
|
+
wallets.push(minimalWallet);
|
|
39651
|
+
}
|
|
39652
|
+
return wallets;
|
|
39653
|
+
},
|
|
39654
|
+
[
|
|
39655
|
+
callbacks,
|
|
39656
|
+
extraCosmosChainIdsToConnectPerWallet,
|
|
39657
|
+
chains2,
|
|
39658
|
+
currentWallet,
|
|
39659
|
+
sourceAsset,
|
|
39660
|
+
cosmosWallet,
|
|
39661
|
+
addExtraChainIdsToConnectForWalletType,
|
|
39662
|
+
setDefaultSourceAsset,
|
|
39663
|
+
setCosmosWallet,
|
|
39664
|
+
clearCosmosChainIdsToConnectForWalletType,
|
|
39665
|
+
disconnectAsync
|
|
39666
|
+
]
|
|
39667
|
+
);
|
|
39668
|
+
return { createCosmosWallets };
|
|
39669
|
+
};
|
|
39670
|
+
const extraCosmosChainIdsToConnectPerWalletAtom = atomWithStorage(
|
|
39671
|
+
LOCAL_STORAGE_KEYS.extraCosmosChainIdsToConnectPerWallet,
|
|
39672
|
+
{}
|
|
39673
|
+
);
|
|
39674
|
+
const addExtraChainIdsToConnectForWalletTypeAtom = atom$1(
|
|
39675
|
+
null,
|
|
39676
|
+
(_get, set, { walletName, chainId }) => {
|
|
39677
|
+
set(extraCosmosChainIdsToConnectPerWalletAtom, (prev2) => {
|
|
39678
|
+
const extraCosmosChainIds = prev2[walletName] ?? [];
|
|
39679
|
+
const isInitialChainId = getInitialChainIds(walletName).includes(chainId);
|
|
39680
|
+
const isAlreadyAdded = extraCosmosChainIds.includes(chainId);
|
|
39681
|
+
if (!chainId || isInitialChainId || isAlreadyAdded) {
|
|
39682
|
+
return prev2;
|
|
39683
|
+
}
|
|
39684
|
+
return {
|
|
39685
|
+
...prev2,
|
|
39686
|
+
[walletName]: [...extraCosmosChainIds, chainId]
|
|
39687
|
+
};
|
|
39678
39688
|
});
|
|
39679
|
-
|
|
39680
|
-
|
|
39681
|
-
|
|
39682
|
-
|
|
39683
|
-
|
|
39689
|
+
}
|
|
39690
|
+
);
|
|
39691
|
+
const clearCosmosChainIdsToConnectForWalletTypeAtom = atom$1(
|
|
39692
|
+
null,
|
|
39693
|
+
(_get, set, wallet) => {
|
|
39694
|
+
set(extraCosmosChainIdsToConnectPerWalletAtom, (prev2) => {
|
|
39695
|
+
const current = prev2[wallet] ?? [];
|
|
39696
|
+
if (current.length === 0) return prev2;
|
|
39697
|
+
return {
|
|
39698
|
+
...prev2,
|
|
39699
|
+
[wallet]: []
|
|
39700
|
+
};
|
|
39684
39701
|
});
|
|
39685
|
-
this.details = details;
|
|
39686
|
-
this.docsPath = docsPath;
|
|
39687
|
-
this.metaMessages = args.metaMessages;
|
|
39688
|
-
this.name = args.name ?? this.name;
|
|
39689
|
-
this.shortMessage = shortMessage;
|
|
39690
|
-
this.version = version$2;
|
|
39691
39702
|
}
|
|
39692
|
-
|
|
39693
|
-
|
|
39703
|
+
);
|
|
39704
|
+
const getInitialChainIds = (wallet) => {
|
|
39705
|
+
const isWC = isWalletConnect(wallet);
|
|
39706
|
+
const mobile = isMobile();
|
|
39707
|
+
if (isWC) return keplrMainnetChainIdsInitialConnect.filter((chainId) => chainId !== "wormchain");
|
|
39708
|
+
switch (wallet) {
|
|
39709
|
+
case WalletType.OKX:
|
|
39710
|
+
return okxWalletChainIdsInitialConnect;
|
|
39711
|
+
case WalletType.KEPLR:
|
|
39712
|
+
return mobile ? keplrMainnetChainIdsInitialConnect.filter((chainId) => chainId !== "wormchain") : keplrMainnetChainIdsInitialConnect;
|
|
39713
|
+
default:
|
|
39714
|
+
return walletMainnetChainIdsInitialConnect;
|
|
39694
39715
|
}
|
|
39695
39716
|
};
|
|
39696
|
-
|
|
39697
|
-
|
|
39698
|
-
|
|
39699
|
-
|
|
39700
|
-
|
|
39701
|
-
|
|
39702
|
-
}
|
|
39703
|
-
|
|
39704
|
-
|
|
39705
|
-
|
|
39706
|
-
|
|
39707
|
-
|
|
39708
|
-
|
|
39709
|
-
|
|
39710
|
-
|
|
39717
|
+
const filterValidChainIds = (chainIds, chains2) => {
|
|
39718
|
+
const cosmosChainIds = chains2 == null ? void 0 : chains2.filter((chain) => chain.chainType === ChainType.Cosmos).map((chain) => chain.chainId);
|
|
39719
|
+
const mainnetChainIds = mainnetChains.map((chain) => chain.chainId);
|
|
39720
|
+
return chainIds.filter(
|
|
39721
|
+
(chainId) => (cosmosChainIds == null ? void 0 : cosmosChainIds.includes(chainId)) && mainnetChainIds.includes(chainId)
|
|
39722
|
+
);
|
|
39723
|
+
};
|
|
39724
|
+
const getAvailableWallets = () => {
|
|
39725
|
+
const mobile = isMobile();
|
|
39726
|
+
const browserWallets = [
|
|
39727
|
+
WalletType.KEPLR,
|
|
39728
|
+
WalletType.LEAP,
|
|
39729
|
+
WalletType.COSMOSTATION,
|
|
39730
|
+
WalletType.XDEFI,
|
|
39731
|
+
WalletType.STATION,
|
|
39732
|
+
WalletType.VECTIS,
|
|
39733
|
+
WalletType.WALLETCONNECT
|
|
39734
|
+
];
|
|
39735
|
+
if (typeof window !== "undefined" && window.keplr && (window == null ? void 0 : window.keplr).isOkxWallet) {
|
|
39736
|
+
browserWallets[0] = WalletType.OKX;
|
|
39711
39737
|
}
|
|
39712
|
-
|
|
39713
|
-
|
|
39714
|
-
|
|
39715
|
-
|
|
39716
|
-
|
|
39717
|
-
|
|
39718
|
-
|
|
39719
|
-
|
|
39720
|
-
|
|
39721
|
-
|
|
39722
|
-
|
|
39723
|
-
|
|
39724
|
-
|
|
39725
|
-
|
|
39726
|
-
|
|
39727
|
-
|
|
39728
|
-
|
|
39729
|
-
|
|
39730
|
-
|
|
39731
|
-
|
|
39732
|
-
|
|
39738
|
+
const isIframeAvailable = checkWallet(WalletType.COSMIFRAME);
|
|
39739
|
+
if (isIframeAvailable) {
|
|
39740
|
+
browserWallets.push(WalletType.COSMIFRAME);
|
|
39741
|
+
}
|
|
39742
|
+
const mobileCosmosWallets = [WalletType.WC_KEPLR_MOBILE];
|
|
39743
|
+
const availableMobileCosmosWallets = [...browserWallets, ...mobileCosmosWallets].filter(
|
|
39744
|
+
(wallet) => {
|
|
39745
|
+
try {
|
|
39746
|
+
const keplrWalletExists = checkWallet(WalletType.KEPLR);
|
|
39747
|
+
if (mobile && [WalletType.WC_KEPLR_MOBILE, WalletType.WALLETCONNECT].includes(wallet) && keplrWalletExists) {
|
|
39748
|
+
return false;
|
|
39749
|
+
}
|
|
39750
|
+
return Boolean(getWallet(wallet));
|
|
39751
|
+
} catch (_error) {
|
|
39752
|
+
return false;
|
|
39753
|
+
}
|
|
39754
|
+
}
|
|
39755
|
+
);
|
|
39756
|
+
return mobile ? availableMobileCosmosWallets : browserWallets;
|
|
39757
|
+
};
|
|
39758
|
+
const handlePenumbraNetwork = (onWalletDisconnected) => {
|
|
39759
|
+
const praxWallet = {
|
|
39760
|
+
walletName: "prax",
|
|
39761
|
+
walletPrettyName: "Prax Wallet",
|
|
39762
|
+
walletChainType: ChainType.Cosmos,
|
|
39763
|
+
walletInfo: {
|
|
39764
|
+
logo: "https://raw.githubusercontent.com/prax-wallet/web/e8b18f9b997708eab04f57e7a6c44f18b3cf13a8/apps/extension/public/prax-white-vertical.svg"
|
|
39765
|
+
},
|
|
39766
|
+
connect: async () => {
|
|
39767
|
+
console.error("Prax wallet is not supported");
|
|
39768
|
+
throw new Error("Prax wallet is not supported");
|
|
39769
|
+
},
|
|
39770
|
+
getAddress: async ({ praxWallet: praxWallet2 }) => {
|
|
39771
|
+
const penumbraSubaccountIndex = praxWallet2 == null ? void 0 : praxWallet2.index;
|
|
39772
|
+
const prax_id = "lkpmkhpnhknhmibgnmmhdhgdilepfghe";
|
|
39773
|
+
const prax_origin = `chrome-extension://${prax_id}`;
|
|
39774
|
+
const client = createPenumbraClient(prax_origin);
|
|
39775
|
+
try {
|
|
39776
|
+
await client.connect();
|
|
39777
|
+
const viewService = client.service(ViewService);
|
|
39778
|
+
const ephemeralAddress = await viewService.ephemeralAddress({
|
|
39779
|
+
addressIndex: {
|
|
39780
|
+
// This is the subaccount of the wallet.
|
|
39781
|
+
// Default is zero.
|
|
39782
|
+
account: penumbraSubaccountIndex ? penumbraSubaccountIndex : 0
|
|
39783
|
+
}
|
|
39784
|
+
});
|
|
39785
|
+
if (!ephemeralAddress.address) throw new Error("No address found");
|
|
39786
|
+
return { address: bech32mAddress(ephemeralAddress.address) };
|
|
39787
|
+
} catch (e) {
|
|
39788
|
+
const error = e;
|
|
39789
|
+
track("get address error", {
|
|
39790
|
+
walletName: "prax",
|
|
39791
|
+
ChainType: ChainType.Cosmos,
|
|
39792
|
+
chainId: "penumbra",
|
|
39793
|
+
errorMessage: error == null ? void 0 : error.message
|
|
39794
|
+
});
|
|
39795
|
+
console.error(error);
|
|
39796
|
+
throw error;
|
|
39797
|
+
}
|
|
39798
|
+
},
|
|
39799
|
+
disconnect: async () => {
|
|
39800
|
+
console.error("Prax wallet is not supported");
|
|
39801
|
+
onWalletDisconnected == null ? void 0 : onWalletDisconnected({
|
|
39802
|
+
walletName: "Prax Wallet",
|
|
39803
|
+
chainType: ChainType.Cosmos
|
|
39804
|
+
});
|
|
39805
|
+
throw new Error("Prax wallet is not supported");
|
|
39806
|
+
},
|
|
39807
|
+
isWalletConnected: false
|
|
39808
|
+
};
|
|
39809
|
+
return [praxWallet];
|
|
39810
|
+
};
|
|
39811
|
+
const {
|
|
39812
|
+
debouncedValueAtom: debouncedSourceAssetAmountAtom,
|
|
39813
|
+
valueInitialized: debouncedSourceAssetAmountValueInitializedAtom,
|
|
39814
|
+
clearTimeoutAtom: cleanupDebouncedSourceAssetAmountAtom
|
|
39815
|
+
} = atomWithDebounce();
|
|
39816
|
+
const {
|
|
39817
|
+
debouncedValueAtom: debouncedDestinationAssetAmountAtom,
|
|
39818
|
+
valueInitialized: debouncedDestinationAssetAmountValueInitializedAtom,
|
|
39819
|
+
clearTimeoutAtom: cleanupDebouncedDestinationAssetAmountAtom
|
|
39820
|
+
} = atomWithDebounce();
|
|
39821
|
+
const onRouteUpdatedEffect = atomEffect((get) => {
|
|
39822
|
+
const sourceAsset = get(sourceAssetAtom);
|
|
39823
|
+
const destinationAsset = get(destinationAssetAtom);
|
|
39824
|
+
const { data } = get(skipRouteAtom);
|
|
39825
|
+
const callbacks = get(callbacksAtom);
|
|
39826
|
+
if (callbacks == null ? void 0 : callbacks.onRouteUpdated) {
|
|
39827
|
+
callbacks == null ? void 0 : callbacks.onRouteUpdated({
|
|
39828
|
+
srcChainId: sourceAsset == null ? void 0 : sourceAsset.chainId,
|
|
39829
|
+
srcAssetDenom: sourceAsset == null ? void 0 : sourceAsset.denom,
|
|
39830
|
+
destChainId: destinationAsset == null ? void 0 : destinationAsset.chainId,
|
|
39831
|
+
destAssetDenom: destinationAsset == null ? void 0 : destinationAsset.denom,
|
|
39832
|
+
amountIn: sourceAsset == null ? void 0 : sourceAsset.amount,
|
|
39833
|
+
amountOut: destinationAsset == null ? void 0 : destinationAsset.amount,
|
|
39834
|
+
requiredChainAddresses: data == null ? void 0 : data.requiredChainAddresses
|
|
39835
|
+
});
|
|
39836
|
+
}
|
|
39837
|
+
});
|
|
39838
|
+
const preloadSigningStargateClientEffect = atomEffect(
|
|
39839
|
+
(get) => {
|
|
39840
|
+
(async () => {
|
|
39841
|
+
var _a;
|
|
39842
|
+
const sourceAsset = get(sourceAssetAtom);
|
|
39843
|
+
const wallets = get(walletsAtom);
|
|
39844
|
+
const getSigners = get(getConnectedSignersAtom);
|
|
39845
|
+
const extraChainIdsToConnect = get(extraCosmosChainIdsToConnectPerWalletAtom);
|
|
39846
|
+
const walletName = (_a = wallets == null ? void 0 : wallets.cosmos) == null ? void 0 : _a.walletName;
|
|
39847
|
+
const signer = (getSigners == null ? void 0 : getSigners.getCosmosSigner) ?? (walletName && getWallet(walletName));
|
|
39848
|
+
if (!(sourceAsset == null ? void 0 : sourceAsset.chainId) || !wallets.cosmos || !signer || !walletName) return;
|
|
39849
|
+
const additionalChainIds = extraChainIdsToConnect[walletName] ?? [];
|
|
39850
|
+
const chainIdsToConnect = [...getInitialChainIds(walletName), ...additionalChainIds];
|
|
39851
|
+
if (!chainIdsToConnect.includes(sourceAsset.chainId)) return;
|
|
39852
|
+
await getSigningStargateClient({
|
|
39853
|
+
chainId: sourceAsset.chainId,
|
|
39854
|
+
getOfflineSigner: async (chainId) => {
|
|
39855
|
+
var _a2;
|
|
39856
|
+
if ((_a2 = getSigners == null ? void 0 : getSigners.getCosmosSigner) == null ? void 0 : _a2.call(getSigners, chainId)) {
|
|
39857
|
+
return getSigners.getCosmosSigner(chainId);
|
|
39858
|
+
}
|
|
39859
|
+
if (!wallets.cosmos) throw new Error("getCosmosSigner error: no cosmos wallet");
|
|
39860
|
+
const wallet = getWallet(wallets.cosmos.walletName);
|
|
39861
|
+
if (!wallet) throw new Error("getCosmosSigner error: wallet not found");
|
|
39862
|
+
if (!(wallet == null ? void 0 : wallet.getKey)) throw new Error("getCosmosSigner error: getKey not found");
|
|
39863
|
+
const key = await wallet.getKey(chainId);
|
|
39864
|
+
return key.isNanoLedger ? wallet.getOfflineSignerOnlyAmino(chainId) : wallet.getOfflineSigner(chainId);
|
|
39865
|
+
}
|
|
39866
|
+
});
|
|
39867
|
+
})();
|
|
39868
|
+
}
|
|
39869
|
+
);
|
|
39870
|
+
const sourceAssetAtom = atomWithStorageNoCrossTabSync(
|
|
39871
|
+
LOCAL_STORAGE_KEYS.sourceAsset,
|
|
39872
|
+
void 0
|
|
39873
|
+
);
|
|
39874
|
+
const resetWidget = ({ onlyClearInputValues } = {}) => {
|
|
39875
|
+
const { set } = jotaiStore;
|
|
39876
|
+
if (onlyClearInputValues) {
|
|
39877
|
+
set(clearAssetInputAmountsAtom);
|
|
39878
|
+
} else {
|
|
39879
|
+
set(sourceAssetAtom, void 0);
|
|
39880
|
+
set(debouncedSourceAssetAmountAtom, "", void 0, true);
|
|
39881
|
+
set(destinationAssetAtom, void 0);
|
|
39882
|
+
set(debouncedDestinationAssetAmountAtom, "", void 0, true);
|
|
39883
|
+
}
|
|
39884
|
+
set(setRouteToDefaultRouteAtom);
|
|
39885
|
+
set(currentPageAtom, Routes.SwapPage);
|
|
39886
|
+
set(errorWarningAtom, void 0);
|
|
39887
|
+
};
|
|
39888
|
+
const setAsset = ({ type: type2, ...assetDetails }) => {
|
|
39889
|
+
var _a;
|
|
39890
|
+
const { set, get } = jotaiStore;
|
|
39891
|
+
const { data: skipAssets } = get(skipAssetsAtom);
|
|
39892
|
+
const assetFound = skipAssets == null ? void 0 : skipAssets.find(
|
|
39893
|
+
(asset) => (asset == null ? void 0 : asset.chainId) === assetDetails.chainId && (asset == null ? void 0 : asset.denom) === (assetDetails == null ? void 0 : assetDetails.denom)
|
|
39894
|
+
);
|
|
39895
|
+
const assetAmount = (_a = assetDetails == null ? void 0 : assetDetails.amount) == null ? void 0 : _a.toString();
|
|
39896
|
+
switch (type2) {
|
|
39897
|
+
case "source":
|
|
39898
|
+
set(sourceAssetAtom, { ...assetFound, amount: assetAmount });
|
|
39899
|
+
if (assetAmount) {
|
|
39900
|
+
set(sourceAssetAmountAtom, assetAmount);
|
|
39901
|
+
}
|
|
39902
|
+
break;
|
|
39903
|
+
case "destination":
|
|
39904
|
+
set(destinationAssetAtom, { ...assetFound, amount: assetAmount });
|
|
39905
|
+
if (assetAmount) {
|
|
39906
|
+
set(destinationAssetAmountAtom, assetAmount);
|
|
39907
|
+
}
|
|
39908
|
+
}
|
|
39909
|
+
};
|
|
39910
|
+
const sourceAssetAmountAtom = atom$1(
|
|
39911
|
+
(get) => {
|
|
39912
|
+
var _a;
|
|
39913
|
+
return ((_a = get(sourceAssetAtom)) == null ? void 0 : _a.amount) ?? "";
|
|
39914
|
+
},
|
|
39915
|
+
(_get, set, newAmount) => {
|
|
39916
|
+
set(sourceAssetAtom, (prev2) => ({ ...prev2, amount: newAmount }));
|
|
39917
|
+
set(debouncedSourceAssetAmountAtom, newAmount);
|
|
39918
|
+
set(swapDirectionAtom, "swap-in");
|
|
39919
|
+
if (newAmount === "") {
|
|
39920
|
+
set(destinationAssetAtom, (prev2) => ({ ...prev2, amount: newAmount }));
|
|
39921
|
+
set(debouncedDestinationAssetAmountAtom, newAmount, void 0, true);
|
|
39922
|
+
}
|
|
39923
|
+
}
|
|
39924
|
+
);
|
|
39925
|
+
const destinationAssetAtom = atomWithStorageNoCrossTabSync(
|
|
39926
|
+
LOCAL_STORAGE_KEYS.destinationAsset,
|
|
39927
|
+
void 0
|
|
39928
|
+
);
|
|
39929
|
+
const destinationAssetAmountAtom = atom$1(
|
|
39930
|
+
(get) => {
|
|
39931
|
+
var _a;
|
|
39932
|
+
return ((_a = get(destinationAssetAtom)) == null ? void 0 : _a.amount) ?? "";
|
|
39933
|
+
},
|
|
39934
|
+
(_get, set, newAmount, callback) => {
|
|
39935
|
+
set(destinationAssetAtom, (prev2) => ({ ...prev2, amount: newAmount }));
|
|
39936
|
+
set(debouncedDestinationAssetAmountAtom, newAmount, callback);
|
|
39937
|
+
set(swapDirectionAtom, "swap-out");
|
|
39938
|
+
if (newAmount === "") {
|
|
39939
|
+
set(sourceAssetAtom, (prev2) => ({ ...prev2, amount: newAmount }));
|
|
39940
|
+
set(debouncedSourceAssetAmountAtom, newAmount, void 0, true);
|
|
39941
|
+
}
|
|
39942
|
+
}
|
|
39943
|
+
);
|
|
39944
|
+
const clearAssetInputAmountsAtom = atom$1(null, (_get, set) => {
|
|
39945
|
+
set(sourceAssetAtom, (prev2) => ({ ...prev2, amount: "" }));
|
|
39946
|
+
set(debouncedSourceAssetAmountAtom, "", void 0, true);
|
|
39947
|
+
set(destinationAssetAtom, (prev2) => ({ ...prev2, amount: "" }));
|
|
39948
|
+
set(debouncedDestinationAssetAmountAtom, "", void 0, true);
|
|
39949
|
+
});
|
|
39950
|
+
const isWaitingForNewRouteAtom = atom$1((get) => {
|
|
39951
|
+
const sourceAmount = get(sourceAssetAmountAtom);
|
|
39952
|
+
const destinationAmount = get(destinationAssetAmountAtom);
|
|
39953
|
+
const debouncedSourceAmount = get(debouncedSourceAssetAmountAtom);
|
|
39954
|
+
const debouncedDestinationAmount = get(debouncedDestinationAssetAmountAtom);
|
|
39955
|
+
const { isLoading } = get(skipRouteAtom);
|
|
39956
|
+
if (isLoading) return true;
|
|
39957
|
+
const direction = get(swapDirectionAtom);
|
|
39958
|
+
const sourceAmountIsValidNumber = !isNaN(parseFloat(sourceAmount));
|
|
39959
|
+
const destinationAmountIsValidNumber = !isNaN(parseFloat(destinationAmount));
|
|
39960
|
+
const sourceAmountHasChanged = sourceAmount !== debouncedSourceAmount;
|
|
39961
|
+
const destinationAmountHasChanged = destinationAmount !== debouncedDestinationAmount;
|
|
39962
|
+
if (direction === "swap-in") {
|
|
39963
|
+
return sourceAmountHasChanged && sourceAmountIsValidNumber;
|
|
39964
|
+
} else if (direction === "swap-out") {
|
|
39965
|
+
return destinationAmountHasChanged && destinationAmountIsValidNumber;
|
|
39966
|
+
}
|
|
39967
|
+
});
|
|
39968
|
+
const swapDirectionAtom = atomWithStorageNoCrossTabSync(
|
|
39969
|
+
"swapDirection",
|
|
39970
|
+
"swap-in"
|
|
39971
|
+
);
|
|
39972
|
+
const isInvertingSwapAtom = atom$1(false);
|
|
39973
|
+
const invertSwapAtom = atom$1(null, (get, set) => {
|
|
39974
|
+
const sourceAsset = get(sourceAssetAtom);
|
|
39975
|
+
const destinationAsset = get(destinationAssetAtom);
|
|
39976
|
+
const clonedSourceAsset = { ...sourceAsset };
|
|
39977
|
+
const clonedDestinationAsset = { ...destinationAsset };
|
|
39978
|
+
const swapDirection = get(swapDirectionAtom);
|
|
39979
|
+
const callbacks = get(callbacksAtom);
|
|
39980
|
+
set(isInvertingSwapAtom, true);
|
|
39981
|
+
set(sourceAssetAtom, clonedDestinationAsset);
|
|
39982
|
+
set(sourceAssetAmountAtom, (destinationAsset == null ? void 0 : destinationAsset.amount) ?? "");
|
|
39983
|
+
set(destinationAssetAtom, clonedSourceAsset);
|
|
39984
|
+
set(destinationAssetAmountAtom, (sourceAsset == null ? void 0 : sourceAsset.amount) ?? "", () => {
|
|
39985
|
+
var _a;
|
|
39986
|
+
const newSwapDirection = swapDirection === "swap-in" ? "swap-out" : "swap-in";
|
|
39987
|
+
set(swapDirectionAtom, newSwapDirection);
|
|
39988
|
+
set(isInvertingSwapAtom, false);
|
|
39989
|
+
(_a = callbacks == null ? void 0 : callbacks.onSourceAndDestinationSwapped) == null ? void 0 : _a.call(callbacks, {
|
|
39990
|
+
srcChainId: clonedDestinationAsset == null ? void 0 : clonedDestinationAsset.chainId,
|
|
39991
|
+
srcAssetDenom: clonedDestinationAsset == null ? void 0 : clonedDestinationAsset.denom,
|
|
39992
|
+
destChainId: clonedSourceAsset == null ? void 0 : clonedSourceAsset.chainId,
|
|
39993
|
+
destAssetDenom: clonedSourceAsset == null ? void 0 : clonedSourceAsset.denom,
|
|
39994
|
+
amountIn: clonedDestinationAsset == null ? void 0 : clonedDestinationAsset.amount,
|
|
39995
|
+
amountOut: clonedSourceAsset == null ? void 0 : clonedSourceAsset.amount
|
|
39996
|
+
});
|
|
39997
|
+
});
|
|
39998
|
+
});
|
|
39999
|
+
atom$1();
|
|
40000
|
+
atom$1();
|
|
40001
|
+
const EVM_GAS_AMOUNT = 15e4;
|
|
40002
|
+
const COSMOS_GAS_AMOUNT = {
|
|
40003
|
+
DEFAULT: 3e5,
|
|
40004
|
+
SWAP: 28e5,
|
|
40005
|
+
CARBON: 1e6
|
|
40006
|
+
};
|
|
40007
|
+
const defaultSwapSettings = {
|
|
40008
|
+
slippage: 1,
|
|
40009
|
+
routePreference: RoutePreference.FASTEST,
|
|
40010
|
+
useUnlimitedApproval: false
|
|
40011
|
+
};
|
|
40012
|
+
const swapSettingsAtom = atomWithStorageNoCrossTabSync(
|
|
40013
|
+
"swapSettingsAtom",
|
|
40014
|
+
defaultSwapSettings
|
|
40015
|
+
);
|
|
40016
|
+
const slippageAtom = atom$1(
|
|
40017
|
+
(get) => get(swapSettingsAtom).slippage,
|
|
40018
|
+
(_get, set, newSlippage) => {
|
|
40019
|
+
set(swapSettingsAtom, (prev2) => ({ ...prev2, slippage: newSlippage }));
|
|
40020
|
+
}
|
|
40021
|
+
);
|
|
40022
|
+
const routePreferenceAtom = atom$1(
|
|
40023
|
+
(get) => get(swapSettingsAtom).routePreference,
|
|
40024
|
+
(_get, set, newRoutePreference) => {
|
|
40025
|
+
set(swapSettingsAtom, (prev2) => ({ ...prev2, routePreference: newRoutePreference }));
|
|
40026
|
+
}
|
|
40027
|
+
);
|
|
40028
|
+
const goFastWarningAtom = atomWithStorageNoCrossTabSync("showGoFastWarning", true);
|
|
40029
|
+
const initializeDebounceValuesEffect = atomEffect(
|
|
40030
|
+
(get, set) => {
|
|
40031
|
+
const sourceAsset = get(sourceAssetAtom);
|
|
40032
|
+
const destinationAsset = get(destinationAssetAtom);
|
|
40033
|
+
const defaultRoute = get(defaultRouteAtom);
|
|
40034
|
+
const debouncedSourceAssetInitialized = get(debouncedSourceAssetAmountValueInitializedAtom);
|
|
40035
|
+
const debouncedDestinationAssetInitialized = get(
|
|
40036
|
+
debouncedDestinationAssetAmountValueInitializedAtom
|
|
40037
|
+
);
|
|
40038
|
+
if (!debouncedSourceAssetInitialized && (sourceAsset == null ? void 0 : sourceAsset.amount)) {
|
|
40039
|
+
set(debouncedSourceAssetAmountAtom, sourceAsset.amount, void 0, true);
|
|
40040
|
+
set(sourceAssetAtom, (prev2) => ({ ...prev2, locked: defaultRoute == null ? void 0 : defaultRoute.srcLocked }));
|
|
40041
|
+
}
|
|
40042
|
+
if (!debouncedDestinationAssetInitialized && (destinationAsset == null ? void 0 : destinationAsset.amount)) {
|
|
40043
|
+
set(debouncedDestinationAssetAmountAtom, destinationAsset.amount, void 0, true);
|
|
40044
|
+
set(destinationAssetAtom, (prev2) => ({ ...prev2, locked: defaultRoute == null ? void 0 : defaultRoute.destLocked }));
|
|
40045
|
+
}
|
|
40046
|
+
}
|
|
40047
|
+
);
|
|
40048
|
+
const skipRouteRequestAtom = atom$1((get) => {
|
|
40049
|
+
const sourceAsset = get(sourceAssetAtom);
|
|
40050
|
+
const destinationAsset = get(destinationAssetAtom);
|
|
40051
|
+
const direction = get(swapDirectionAtom);
|
|
40052
|
+
const sourceAssetAmount = get(debouncedSourceAssetAmountAtom);
|
|
40053
|
+
const destinationAssetAmount = get(debouncedDestinationAssetAmountAtom);
|
|
40054
|
+
get(initializeDebounceValuesEffect);
|
|
40055
|
+
if (!(sourceAsset == null ? void 0 : sourceAsset.chainId) || !sourceAsset.denom || !(destinationAsset == null ? void 0 : destinationAsset.chainId) || !destinationAsset.denom) {
|
|
40056
|
+
return void 0;
|
|
40057
|
+
}
|
|
40058
|
+
const amount = direction === "swap-in" ? {
|
|
40059
|
+
amountIn: convertHumanReadableAmountToCryptoAmount(
|
|
40060
|
+
sourceAssetAmount ?? "0",
|
|
40061
|
+
sourceAsset.decimals
|
|
40062
|
+
)
|
|
40063
|
+
} : {
|
|
40064
|
+
amountOut: convertHumanReadableAmountToCryptoAmount(
|
|
40065
|
+
destinationAssetAmount ?? "0",
|
|
40066
|
+
destinationAsset.decimals
|
|
40067
|
+
)
|
|
40068
|
+
};
|
|
40069
|
+
return {
|
|
40070
|
+
...amount,
|
|
40071
|
+
sourceAssetChainId: sourceAsset.chainId,
|
|
40072
|
+
sourceAssetDenom: sourceAsset.denom,
|
|
40073
|
+
destAssetChainId: destinationAsset.chainId,
|
|
40074
|
+
destAssetDenom: destinationAsset.denom
|
|
40075
|
+
};
|
|
40076
|
+
});
|
|
40077
|
+
const routeConfigAtom = atom$1({
|
|
40078
|
+
experimentalFeatures: ["stargate", "eureka", "layer_zero"],
|
|
40079
|
+
allowMultiTx: true,
|
|
40080
|
+
allowUnsafe: true,
|
|
40081
|
+
smartSwapOptions: {
|
|
40082
|
+
splitRoutes: true,
|
|
40083
|
+
evmSwaps: true
|
|
40084
|
+
},
|
|
40085
|
+
goFast: true,
|
|
40086
|
+
timeoutSeconds: void 0
|
|
40087
|
+
});
|
|
40088
|
+
const _skipRouteAtom = atomWithQuery((get) => {
|
|
40089
|
+
const params = get(skipRouteRequestAtom);
|
|
40090
|
+
const currentPage = get(currentPageAtom);
|
|
40091
|
+
const isInvertingSwap = get(isInvertingSwapAtom);
|
|
40092
|
+
const errorWarning = get(errorWarningAtom);
|
|
40093
|
+
const routeConfig = get(routeConfigAtom);
|
|
40094
|
+
const swapSettings = get(swapSettingsAtom);
|
|
40095
|
+
const queryEnabled = params !== void 0 && (Number(params.amountIn) > 0 || Number(params.amountOut) > 0) && !isInvertingSwap && currentPage === Routes.SwapPage && errorWarning === void 0;
|
|
40096
|
+
return {
|
|
40097
|
+
queryKey: ["skipRoute", params, routeConfig, swapSettings],
|
|
40098
|
+
queryFn: async () => {
|
|
40099
|
+
if (!params) {
|
|
40100
|
+
throw new Error("No route request provided");
|
|
40101
|
+
}
|
|
40102
|
+
try {
|
|
40103
|
+
const response = await route({
|
|
40104
|
+
...params,
|
|
40105
|
+
smartRelay: true,
|
|
40106
|
+
...routeConfig,
|
|
40107
|
+
goFast: swapSettings.routePreference === RoutePreference.FASTEST,
|
|
40108
|
+
abortDuplicateRequests: true
|
|
40109
|
+
});
|
|
40110
|
+
return response;
|
|
40111
|
+
} catch (error) {
|
|
40112
|
+
return {
|
|
40113
|
+
isError: true,
|
|
40114
|
+
error
|
|
40115
|
+
};
|
|
40116
|
+
}
|
|
40117
|
+
},
|
|
40118
|
+
retry: 1,
|
|
40119
|
+
enabled: queryEnabled,
|
|
40120
|
+
refetchInterval: 1e3 * 30
|
|
40121
|
+
};
|
|
40122
|
+
});
|
|
40123
|
+
const skipRouteAtom = atom$1((get) => {
|
|
40124
|
+
const { data, isError, error, isFetching, isPending } = get(_skipRouteAtom);
|
|
40125
|
+
const caughtError = data;
|
|
40126
|
+
const routeResponse = data;
|
|
40127
|
+
if (caughtError == null ? void 0 : caughtError.isError) {
|
|
40128
|
+
return {
|
|
40129
|
+
data: void 0,
|
|
40130
|
+
isError: true,
|
|
40131
|
+
error: caughtError.error,
|
|
40132
|
+
isLoading: false
|
|
40133
|
+
};
|
|
40134
|
+
}
|
|
40135
|
+
return {
|
|
40136
|
+
data: routeResponse,
|
|
40137
|
+
isError,
|
|
40138
|
+
error,
|
|
40139
|
+
isLoading: isFetching && isPending
|
|
40140
|
+
};
|
|
40141
|
+
});
|
|
40142
|
+
const defaultRouteAtom = atom$1();
|
|
40143
|
+
const setRouteToDefaultRouteAtom = atom$1(null, (get, set, assets2) => {
|
|
40144
|
+
const defaultRoute = get(defaultRouteAtom);
|
|
40145
|
+
const { data } = get(skipAssetsAtom);
|
|
40146
|
+
assets2 ?? (assets2 = data);
|
|
40147
|
+
const getClientAsset = (denom, chainId) => {
|
|
40148
|
+
if (!denom || !chainId) return;
|
|
40149
|
+
if (!assets2) return;
|
|
40150
|
+
return assets2.find(
|
|
40151
|
+
(a) => a.denom.toLowerCase() === denom.toLowerCase() && a.chainId === chainId
|
|
40152
|
+
);
|
|
40153
|
+
};
|
|
40154
|
+
if (!defaultRoute || !assets2) return;
|
|
40155
|
+
const { srcAssetDenom, srcChainId, destAssetDenom, destChainId, amountIn, amountOut } = defaultRoute;
|
|
40156
|
+
const sourceAsset = getClientAsset(srcAssetDenom, srcChainId);
|
|
40157
|
+
const destinationAsset = getClientAsset(destAssetDenom, destChainId);
|
|
40158
|
+
set(destinationAssetAtom, {
|
|
40159
|
+
...destinationAsset,
|
|
40160
|
+
locked: defaultRoute == null ? void 0 : defaultRoute.destLocked,
|
|
40161
|
+
amount: amountOut == null ? void 0 : amountOut.toString()
|
|
40162
|
+
});
|
|
40163
|
+
set(sourceAssetAtom, {
|
|
40164
|
+
...sourceAsset,
|
|
40165
|
+
locked: defaultRoute == null ? void 0 : defaultRoute.srcLocked,
|
|
40166
|
+
amount: amountIn == null ? void 0 : amountIn.toString()
|
|
40167
|
+
});
|
|
40168
|
+
if (amountIn) {
|
|
40169
|
+
set(sourceAssetAmountAtom, amountIn == null ? void 0 : amountIn.toString());
|
|
40170
|
+
} else if (amountOut) {
|
|
40171
|
+
set(destinationAssetAmountAtom, amountOut == null ? void 0 : amountOut.toString());
|
|
40172
|
+
}
|
|
40173
|
+
});
|
|
40174
|
+
const transactionHistoryAtom = atomWithStorage(
|
|
40175
|
+
LOCAL_STORAGE_KEYS.transactionHistory,
|
|
40176
|
+
[],
|
|
40177
|
+
void 0
|
|
40178
|
+
);
|
|
40179
|
+
const setTransactionHistoryAtom = atom$1(
|
|
40180
|
+
null,
|
|
40181
|
+
(get, set, index, historyItem) => {
|
|
40182
|
+
const history = get(transactionHistoryAtom);
|
|
40183
|
+
const newHistory = [...history];
|
|
40184
|
+
const oldHistoryItem = newHistory[index] ?? {};
|
|
40185
|
+
newHistory[index] = { ...oldHistoryItem, ...historyItem };
|
|
40186
|
+
set(transactionHistoryAtom, newHistory);
|
|
40187
|
+
}
|
|
40188
|
+
);
|
|
40189
|
+
const removeTransactionHistoryItemAtom = atom$1(null, (get, set, index) => {
|
|
40190
|
+
const history = get(transactionHistoryAtom);
|
|
40191
|
+
if (!history) return;
|
|
40192
|
+
if (index < 0) return;
|
|
40193
|
+
if (index >= history.length) return;
|
|
40194
|
+
const newHistory = history.filter((_2, i) => i !== index);
|
|
40195
|
+
set(transactionHistoryAtom, newHistory);
|
|
40196
|
+
});
|
|
40197
|
+
atomWithQuery((get) => {
|
|
40198
|
+
const transactionHistory = get(transactionHistoryAtom);
|
|
40199
|
+
const pendingTransactionHistoryItemsFound = transactionHistory.find(
|
|
40200
|
+
(transactionHistoryItem) => transactionHistoryItem.status !== "completed" && transactionHistoryItem.status !== "failed"
|
|
40201
|
+
);
|
|
40202
|
+
return {
|
|
40203
|
+
queryKey: ["skipPendingTxHistoryStatus", transactionHistory],
|
|
40204
|
+
queryFn: async () => {
|
|
40205
|
+
const nestedTransactionHistoryPromises = transactionHistory.map(
|
|
40206
|
+
async (transactionHistoryItem) => {
|
|
40207
|
+
var _a;
|
|
40208
|
+
const transactionDetailsPromises = await Promise.all(
|
|
40209
|
+
(_a = transactionHistoryItem.transactionDetails) == null ? void 0 : _a.map(async (transactionDetail) => {
|
|
40210
|
+
if (transactionHistoryItem.status !== "completed" && transactionHistoryItem.status !== "failed") {
|
|
40211
|
+
return await transactionStatus(transactionDetail);
|
|
40212
|
+
}
|
|
40213
|
+
return new Promise((resolve) => resolve(null));
|
|
40214
|
+
})
|
|
40215
|
+
);
|
|
40216
|
+
return transactionDetailsPromises;
|
|
40217
|
+
}
|
|
40218
|
+
);
|
|
40219
|
+
return nestedTransactionHistoryPromises;
|
|
40220
|
+
},
|
|
40221
|
+
enabled: !!pendingTransactionHistoryItemsFound,
|
|
40222
|
+
refetchInterval: 1e3 * 2,
|
|
40223
|
+
keepPreviousData: true
|
|
40224
|
+
};
|
|
40225
|
+
});
|
|
40226
|
+
function isUserRejectedRequestError(input) {
|
|
40227
|
+
if (input instanceof Error) {
|
|
40228
|
+
if (
|
|
40229
|
+
// keplr | metamask
|
|
40230
|
+
input.message.toLowerCase().includes("rejected") || // leap
|
|
40231
|
+
input.message.toLowerCase().includes("declined") || input.message.toLowerCase().includes("denied") || // @ts-expect-error common user rejected request error code
|
|
40232
|
+
input.code === 4001
|
|
40233
|
+
) {
|
|
40234
|
+
return true;
|
|
40235
|
+
}
|
|
40236
|
+
}
|
|
40237
|
+
return false;
|
|
40238
|
+
}
|
|
40239
|
+
function defineChain(chain) {
|
|
40240
|
+
return {
|
|
40241
|
+
formatters: void 0,
|
|
40242
|
+
fees: void 0,
|
|
40243
|
+
serializers: void 0,
|
|
40244
|
+
...chain
|
|
40245
|
+
};
|
|
40246
|
+
}
|
|
40247
|
+
const version$2 = "2.21.55";
|
|
40248
|
+
let errorConfig = {
|
|
40249
|
+
getDocsUrl: ({ docsBaseUrl, docsPath = "", docsSlug }) => docsPath ? `${docsBaseUrl ?? "https://viem.sh"}${docsPath}${docsSlug ? `#${docsSlug}` : ""}` : void 0,
|
|
40250
|
+
version: `viem@${version$2}`
|
|
40251
|
+
};
|
|
40252
|
+
let BaseError$1 = class BaseError extends Error {
|
|
40253
|
+
constructor(shortMessage, args = {}) {
|
|
40254
|
+
var _a;
|
|
40255
|
+
const details = (() => {
|
|
40256
|
+
var _a2;
|
|
40257
|
+
if (args.cause instanceof BaseError)
|
|
40258
|
+
return args.cause.details;
|
|
40259
|
+
if ((_a2 = args.cause) == null ? void 0 : _a2.message)
|
|
40260
|
+
return args.cause.message;
|
|
40261
|
+
return args.details;
|
|
40262
|
+
})();
|
|
40263
|
+
const docsPath = (() => {
|
|
40264
|
+
if (args.cause instanceof BaseError)
|
|
40265
|
+
return args.cause.docsPath || args.docsPath;
|
|
40266
|
+
return args.docsPath;
|
|
40267
|
+
})();
|
|
40268
|
+
const docsUrl = (_a = errorConfig.getDocsUrl) == null ? void 0 : _a.call(errorConfig, { ...args, docsPath });
|
|
40269
|
+
const message = [
|
|
40270
|
+
shortMessage || "An error occurred.",
|
|
40271
|
+
"",
|
|
40272
|
+
...args.metaMessages ? [...args.metaMessages, ""] : [],
|
|
40273
|
+
...docsUrl ? [`Docs: ${docsUrl}`] : [],
|
|
40274
|
+
...details ? [`Details: ${details}`] : [],
|
|
40275
|
+
...errorConfig.version ? [`Version: ${errorConfig.version}`] : []
|
|
40276
|
+
].join("\n");
|
|
40277
|
+
super(message, args.cause ? { cause: args.cause } : void 0);
|
|
40278
|
+
Object.defineProperty(this, "details", {
|
|
40279
|
+
enumerable: true,
|
|
40280
|
+
configurable: true,
|
|
40281
|
+
writable: true,
|
|
40282
|
+
value: void 0
|
|
40283
|
+
});
|
|
40284
|
+
Object.defineProperty(this, "docsPath", {
|
|
40285
|
+
enumerable: true,
|
|
40286
|
+
configurable: true,
|
|
40287
|
+
writable: true,
|
|
40288
|
+
value: void 0
|
|
40289
|
+
});
|
|
40290
|
+
Object.defineProperty(this, "metaMessages", {
|
|
40291
|
+
enumerable: true,
|
|
40292
|
+
configurable: true,
|
|
40293
|
+
writable: true,
|
|
40294
|
+
value: void 0
|
|
40295
|
+
});
|
|
40296
|
+
Object.defineProperty(this, "shortMessage", {
|
|
40297
|
+
enumerable: true,
|
|
40298
|
+
configurable: true,
|
|
40299
|
+
writable: true,
|
|
40300
|
+
value: void 0
|
|
40301
|
+
});
|
|
40302
|
+
Object.defineProperty(this, "version", {
|
|
40303
|
+
enumerable: true,
|
|
40304
|
+
configurable: true,
|
|
40305
|
+
writable: true,
|
|
40306
|
+
value: void 0
|
|
40307
|
+
});
|
|
40308
|
+
Object.defineProperty(this, "name", {
|
|
40309
|
+
enumerable: true,
|
|
40310
|
+
configurable: true,
|
|
40311
|
+
writable: true,
|
|
40312
|
+
value: "BaseError"
|
|
40313
|
+
});
|
|
40314
|
+
this.details = details;
|
|
40315
|
+
this.docsPath = docsPath;
|
|
40316
|
+
this.metaMessages = args.metaMessages;
|
|
40317
|
+
this.name = args.name ?? this.name;
|
|
40318
|
+
this.shortMessage = shortMessage;
|
|
40319
|
+
this.version = version$2;
|
|
40320
|
+
}
|
|
40321
|
+
walk(fn) {
|
|
40322
|
+
return walk(this, fn);
|
|
40323
|
+
}
|
|
40324
|
+
};
|
|
40325
|
+
function walk(err, fn) {
|
|
40326
|
+
if (fn == null ? void 0 : fn(err))
|
|
40327
|
+
return err;
|
|
40328
|
+
if (err && typeof err === "object" && "cause" in err && err.cause !== void 0)
|
|
40329
|
+
return walk(err.cause, fn);
|
|
40330
|
+
return fn ? null : err;
|
|
40331
|
+
}
|
|
40332
|
+
class IntegerOutOfRangeError extends BaseError$1 {
|
|
40333
|
+
constructor({ max, min, signed, size: size2, value }) {
|
|
40334
|
+
super(`Number "${value}" is not in safe ${size2 ? `${size2 * 8}-bit ${signed ? "signed" : "unsigned"} ` : ""}integer range ${max ? `(${min} to ${max})` : `(above ${min})`}`, { name: "IntegerOutOfRangeError" });
|
|
40335
|
+
}
|
|
40336
|
+
}
|
|
40337
|
+
class SizeOverflowError extends BaseError$1 {
|
|
40338
|
+
constructor({ givenSize, maxSize }) {
|
|
40339
|
+
super(`Size cannot exceed ${maxSize} bytes. Given size: ${givenSize} bytes.`, { name: "SizeOverflowError" });
|
|
40340
|
+
}
|
|
40341
|
+
}
|
|
40342
|
+
function isHex(value, { strict = true } = {}) {
|
|
40343
|
+
if (!value)
|
|
40344
|
+
return false;
|
|
40345
|
+
if (typeof value !== "string")
|
|
40346
|
+
return false;
|
|
40347
|
+
return strict ? /^0x[0-9a-fA-F]*$/.test(value) : value.startsWith("0x");
|
|
40348
|
+
}
|
|
40349
|
+
function size(value) {
|
|
40350
|
+
if (isHex(value, { strict: false }))
|
|
40351
|
+
return Math.ceil((value.length - 2) / 2);
|
|
40352
|
+
return value.length;
|
|
40353
|
+
}
|
|
40354
|
+
function trim(hexOrBytes, { dir = "left" } = {}) {
|
|
40355
|
+
let data = typeof hexOrBytes === "string" ? hexOrBytes.replace("0x", "") : hexOrBytes;
|
|
40356
|
+
let sliceLength = 0;
|
|
40357
|
+
for (let i = 0; i < data.length - 1; i++) {
|
|
40358
|
+
if (data[dir === "left" ? i : data.length - i - 1].toString() === "0")
|
|
40359
|
+
sliceLength++;
|
|
40360
|
+
else
|
|
40361
|
+
break;
|
|
39733
40362
|
}
|
|
39734
40363
|
data = dir === "left" ? data.slice(sliceLength) : data.slice(0, data.length - sliceLength);
|
|
39735
40364
|
if (typeof hexOrBytes === "string") {
|
|
@@ -43519,7 +44148,7 @@ function walletConnect(parameters) {
|
|
|
43519
44148
|
const optionalChains = config2.chains.map((x2) => x2.id);
|
|
43520
44149
|
if (!optionalChains.length)
|
|
43521
44150
|
return;
|
|
43522
|
-
const { EthereumProvider } = await import("./index.es-
|
|
44151
|
+
const { EthereumProvider } = await import("./index.es-HOYUFFSy.js");
|
|
43523
44152
|
return await EthereumProvider.init({
|
|
43524
44153
|
...parameters,
|
|
43525
44154
|
disableProviderPing: true,
|
|
@@ -43952,7 +44581,6 @@ const setSwapExecutionStateAtom = atom$1(null, (get, set) => {
|
|
|
43952
44581
|
onTransactionBroadcast: async (txInfo) => {
|
|
43953
44582
|
var _a2;
|
|
43954
44583
|
track("execute route: transaction broadcasted", { txInfo });
|
|
43955
|
-
set(setValidatingGasBalanceAtom, { status: "completed" });
|
|
43956
44584
|
setUser({ id: txInfo == null ? void 0 : txInfo.txHash });
|
|
43957
44585
|
const chain = chains2 == null ? void 0 : chains2.find((chain2) => chain2.chainId === txInfo.chainId);
|
|
43958
44586
|
const explorerLink = createExplorerLink({
|
|
@@ -44063,7 +44691,12 @@ const setSwapExecutionStateAtom = atom$1(null, (get, set) => {
|
|
|
44063
44691
|
},
|
|
44064
44692
|
onValidateGasBalance: async (props) => {
|
|
44065
44693
|
track("execute route: validate gas balance", { props });
|
|
44066
|
-
|
|
44694
|
+
if (props.status === "pending") {
|
|
44695
|
+
set(setValidatingGasBalanceAtom, { status: "pending" });
|
|
44696
|
+
} else if (props.status === "completed") {
|
|
44697
|
+
set(setValidatingGasBalanceAtom, { status: "completed" });
|
|
44698
|
+
set(setOverallStatusAtom, "signing");
|
|
44699
|
+
}
|
|
44067
44700
|
}
|
|
44068
44701
|
});
|
|
44069
44702
|
});
|
|
@@ -44126,11 +44759,13 @@ const chainAddressEffectAtom = atomEffect((get, set) => {
|
|
|
44126
44759
|
});
|
|
44127
44760
|
const submitSwapExecutionCallbacksAtom = atom$1();
|
|
44128
44761
|
const simulateTxAtom = atom$1();
|
|
44762
|
+
const batchSignTxsAtom = atom$1(true);
|
|
44129
44763
|
const skipSubmitSwapExecutionAtom = atomWithMutation((get) => {
|
|
44130
44764
|
var _a;
|
|
44131
44765
|
const { route: route2, userAddresses, transactionDetailsArray } = get(swapExecutionStateAtom);
|
|
44132
44766
|
const submitSwapExecutionCallbacks = get(submitSwapExecutionCallbacksAtom);
|
|
44133
44767
|
const simulateTx = get(simulateTxAtom);
|
|
44768
|
+
const batchSignTxs = get(batchSignTxsAtom);
|
|
44134
44769
|
const swapSettings = get(swapSettingsAtom);
|
|
44135
44770
|
const getSigners = get(getConnectedSignersAtom);
|
|
44136
44771
|
const wallets = get(walletsAtom);
|
|
@@ -44163,9 +44798,11 @@ const skipSubmitSwapExecutionAtom = atomWithMutation((get) => {
|
|
|
44163
44798
|
slippageTolerancePercent: swapSettings.slippage.toString(),
|
|
44164
44799
|
useUnlimitedApproval: swapSettings.useUnlimitedApproval,
|
|
44165
44800
|
simulate: simulateTx !== void 0 ? simulateTx : route2.sourceAssetChainId !== "984122",
|
|
44801
|
+
batchSignTxs: batchSignTxs !== void 0 ? batchSignTxs : true,
|
|
44166
44802
|
...submitSwapExecutionCallbacks,
|
|
44167
44803
|
getCosmosSigner: async (chainId) => {
|
|
44168
|
-
|
|
44804
|
+
var _a3;
|
|
44805
|
+
if ((_a3 = getSigners == null ? void 0 : getSigners.getCosmosSigner) == null ? void 0 : _a3.call(getSigners, chainId)) {
|
|
44169
44806
|
return getSigners.getCosmosSigner(chainId);
|
|
44170
44807
|
}
|
|
44171
44808
|
if (!wallets.cosmos) {
|
|
@@ -44179,7 +44816,8 @@ const skipSubmitSwapExecutionAtom = atomWithMutation((get) => {
|
|
|
44179
44816
|
return key.isNanoLedger ? wallet.getOfflineSignerOnlyAmino(chainId) : wallet.getOfflineSigner(chainId);
|
|
44180
44817
|
},
|
|
44181
44818
|
getEvmSigner: async (chainId) => {
|
|
44182
|
-
|
|
44819
|
+
var _a3;
|
|
44820
|
+
if ((_a3 = getSigners == null ? void 0 : getSigners.getEvmSigner) == null ? void 0 : _a3.call(getSigners, chainId)) {
|
|
44183
44821
|
return getSigners.getEvmSigner(chainId);
|
|
44184
44822
|
}
|
|
44185
44823
|
const evmWalletClient = await getWalletClient(config, {
|
|
@@ -45432,769 +46070,235 @@ const StyledChainName$1 = dt(SmallText)`
|
|
|
45432
46070
|
}
|
|
45433
46071
|
|
|
45434
46072
|
@media (min-width: 400px) and (max-width: 500px) {
|
|
45435
|
-
${({ renderingEditDestinationWalletOrExplorerLink }) => renderingEditDestinationWalletOrExplorerLink ? lt`
|
|
45436
|
-
max-width: 55px;
|
|
45437
|
-
` : lt`
|
|
45438
|
-
max-width: 85px;
|
|
45439
|
-
`};
|
|
45440
|
-
}
|
|
45441
|
-
|
|
45442
|
-
@media (max-width: 400px) {
|
|
45443
|
-
${({ renderingEditDestinationWalletOrExplorerLink }) => renderingEditDestinationWalletOrExplorerLink ? lt`
|
|
45444
|
-
max-width: 65px;
|
|
45445
|
-
` : lt`
|
|
45446
|
-
max-width: 100px;
|
|
45447
|
-
`};
|
|
45448
|
-
}
|
|
45449
|
-
`;
|
|
45450
|
-
const ModalHeader = ({ title, onClickBackButton, rightContent }) => {
|
|
45451
|
-
const theme = nt();
|
|
45452
|
-
return /* @__PURE__ */ jsxs(StyledHeader, { align: "center", justify: "space-between", children: [
|
|
45453
|
-
/* @__PURE__ */ jsx(Button, { onClick: () => onClickBackButton(), children: /* @__PURE__ */ jsx(StyledLeftArrowIcon$1, { color: theme == null ? void 0 : theme.primary.text.normal }) }),
|
|
45454
|
-
/* @__PURE__ */ jsx(StyledCenteredTitle, { textAlign: "center", children: title }),
|
|
45455
|
-
rightContent
|
|
45456
|
-
] });
|
|
45457
|
-
};
|
|
45458
|
-
const StyledModalContainer = dt(Column)`
|
|
45459
|
-
position: relative;
|
|
45460
|
-
padding: 10px;
|
|
45461
|
-
gap: 10px;
|
|
45462
|
-
width: calc(100% - 20px);
|
|
45463
|
-
border-radius: 20px;
|
|
45464
|
-
background: ${({ theme }) => theme.primary.background.normal};
|
|
45465
|
-
height: 100%;
|
|
45466
|
-
`;
|
|
45467
|
-
const StyledModalInnerContainer = dt(Column)`
|
|
45468
|
-
width: 100%;
|
|
45469
|
-
align-items: center;
|
|
45470
|
-
justify-content: center;
|
|
45471
|
-
`;
|
|
45472
|
-
const StyledHeader = dt(Row)`
|
|
45473
|
-
height: 40px;
|
|
45474
|
-
margin-top: 10px;
|
|
45475
|
-
padding: 0 12px;
|
|
45476
|
-
`;
|
|
45477
|
-
const StyledLeftArrowIcon$1 = dt(LeftArrowIcon)`
|
|
45478
|
-
opacity: 0.2;
|
|
45479
|
-
transform: rotate(180deg);
|
|
45480
|
-
`;
|
|
45481
|
-
const StyledCenteredTitle = dt(Text)`
|
|
45482
|
-
position: absolute;
|
|
45483
|
-
left: 50%;
|
|
45484
|
-
transform: translateX(-50%);
|
|
45485
|
-
margin: 0;
|
|
45486
|
-
`;
|
|
45487
|
-
const isManualWalletEntry = (wallet) => {
|
|
45488
|
-
return wallet.onSelect !== void 0;
|
|
45489
|
-
};
|
|
45490
|
-
const isMinimalWallet = (wallet) => {
|
|
45491
|
-
return wallet.connect !== void 0;
|
|
45492
|
-
};
|
|
45493
|
-
const ITEM_HEIGHT$3 = 60;
|
|
45494
|
-
const ITEM_GAP$2 = 5;
|
|
45495
|
-
const RenderWalletList = ({
|
|
45496
|
-
title,
|
|
45497
|
-
walletList,
|
|
45498
|
-
onClickBackButton,
|
|
45499
|
-
onSelectWallet,
|
|
45500
|
-
chainId,
|
|
45501
|
-
isConnectEco,
|
|
45502
|
-
onWalletConnected,
|
|
45503
|
-
bottomContent,
|
|
45504
|
-
headerRightContent
|
|
45505
|
-
}) => {
|
|
45506
|
-
var _a, _b, _c;
|
|
45507
|
-
const theme = nt();
|
|
45508
|
-
const [selectedWallet, setSelectedWallet] = useState();
|
|
45509
|
-
const displayWallets = useMemo(() => {
|
|
45510
|
-
const filteredWallets = walletList.filter(
|
|
45511
|
-
(wallet) => isManualWalletEntry(wallet) || (wallet == null ? void 0 : wallet.isAvailable) !== false
|
|
45512
|
-
);
|
|
45513
|
-
return filteredWallets.length === 1 ? walletList : filteredWallets;
|
|
45514
|
-
}, [walletList]);
|
|
45515
|
-
const clearAssetInputAmounts = useSetAtom(clearAssetInputAmountsAtom);
|
|
45516
|
-
const connectMutation = useMutation({
|
|
45517
|
-
mutationKey: ["connectWallet"],
|
|
45518
|
-
mutationFn: async (wallet) => {
|
|
45519
|
-
if (chainId) {
|
|
45520
|
-
return await wallet.connect(chainId);
|
|
45521
|
-
}
|
|
45522
|
-
return await wallet.connect();
|
|
45523
|
-
},
|
|
45524
|
-
onSuccess: () => {
|
|
45525
|
-
if (isConnectEco) {
|
|
45526
|
-
clearAssetInputAmounts();
|
|
45527
|
-
}
|
|
45528
|
-
NiceModal.remove(Modals.SetAddressModal);
|
|
45529
|
-
NiceModal.remove(Modals.WalletSelectorModal);
|
|
45530
|
-
if (selectedWallet) {
|
|
45531
|
-
onWalletConnected == null ? void 0 : onWalletConnected(selectedWallet);
|
|
45532
|
-
}
|
|
45533
|
-
}
|
|
45534
|
-
});
|
|
45535
|
-
const renderItem = useCallback(
|
|
45536
|
-
(wallet) => {
|
|
45537
|
-
var _a2;
|
|
45538
|
-
const name2 = isMinimalWallet(wallet) ? wallet.walletPrettyName ?? wallet.walletName : wallet.walletName;
|
|
45539
|
-
const imageUrl = isMinimalWallet(wallet) ? (_a2 = wallet == null ? void 0 : wallet.walletInfo) == null ? void 0 : _a2.logo : void 0;
|
|
45540
|
-
const rightContent = isManualWalletEntry(wallet) ? wallet == null ? void 0 : wallet.rightContent : void 0;
|
|
45541
|
-
const isAvailable = isMinimalWallet(wallet) ? wallet == null ? void 0 : wallet.isAvailable : void 0;
|
|
45542
|
-
const renderedRightContent = (rightContent == null ? void 0 : rightContent()) ?? /* @__PURE__ */ jsx(Fragment, {});
|
|
45543
|
-
const imageElement = imageUrl ? /* @__PURE__ */ jsx(
|
|
45544
|
-
"img",
|
|
45545
|
-
{
|
|
45546
|
-
height: 35,
|
|
45547
|
-
width: 35,
|
|
45548
|
-
style: { objectFit: "cover" },
|
|
45549
|
-
src: imageUrl,
|
|
45550
|
-
alt: `${name2}-logo`
|
|
45551
|
-
}
|
|
45552
|
-
) : null;
|
|
45553
|
-
const onClickConnectWallet = () => {
|
|
45554
|
-
if (!isMinimalWallet(wallet)) {
|
|
45555
|
-
wallet.onSelect();
|
|
45556
|
-
} else if (onSelectWallet) {
|
|
45557
|
-
onSelectWallet(wallet);
|
|
45558
|
-
NiceModal.remove(Modals.SetAddressModal);
|
|
45559
|
-
NiceModal.remove(Modals.WalletSelectorModal);
|
|
45560
|
-
} else {
|
|
45561
|
-
setSelectedWallet(wallet);
|
|
45562
|
-
connectMutation.mutate(wallet);
|
|
45563
|
-
}
|
|
45564
|
-
};
|
|
45565
|
-
const leftContent = /* @__PURE__ */ jsxs(Row, { style: { width: "100%" }, align: "center", justify: "space-between", children: [
|
|
45566
|
-
/* @__PURE__ */ jsxs(Row, { align: "center", gap: 10, children: [
|
|
45567
|
-
imageElement,
|
|
45568
|
-
/* @__PURE__ */ jsx(Text, { children: name2 })
|
|
45569
|
-
] }),
|
|
45570
|
-
isAvailable !== void 0 && /* @__PURE__ */ jsx(SmallText, { children: isAvailable ? "Installed" : "Not Installed" })
|
|
45571
|
-
] });
|
|
45572
|
-
return /* @__PURE__ */ jsx(
|
|
45573
|
-
ModalRowItem,
|
|
45574
|
-
{
|
|
45575
|
-
onClick: onClickConnectWallet,
|
|
45576
|
-
style: { marginTop: ITEM_GAP$2 },
|
|
45577
|
-
leftContent,
|
|
45578
|
-
rightContent: renderedRightContent
|
|
45579
|
-
},
|
|
45580
|
-
name2
|
|
45581
|
-
);
|
|
45582
|
-
},
|
|
45583
|
-
[connectMutation, onSelectWallet]
|
|
45584
|
-
);
|
|
45585
|
-
const height = useMemo(() => {
|
|
45586
|
-
return Math.min(530, displayWallets.length * (ITEM_HEIGHT$3 + ITEM_GAP$2));
|
|
45587
|
-
}, [displayWallets.length]);
|
|
45588
|
-
const renderWalletListOrWalletConnectionStatus = useMemo(() => {
|
|
45589
|
-
var _a2, _b2, _c2, _d;
|
|
45590
|
-
if (connectMutation.isError || connectMutation.isPending) {
|
|
45591
|
-
const titleText = connectMutation.isError ? "Failed to connect" : "Connecting to";
|
|
45592
|
-
return /* @__PURE__ */ jsx(StyledModalInnerContainer, { children: /* @__PURE__ */ jsxs(StyledLoadingContainer, { children: [
|
|
45593
|
-
/* @__PURE__ */ jsx(
|
|
45594
|
-
StyledAnimatedBorder,
|
|
45595
|
-
{
|
|
45596
|
-
width: 80,
|
|
45597
|
-
height: 80,
|
|
45598
|
-
backgroundColor: theme.primary.text.normal,
|
|
45599
|
-
status: connectMutation.isError ? "failed" : "pending",
|
|
45600
|
-
borderSize: 8,
|
|
45601
|
-
children: ((_b2 = (_a2 = connectMutation.variables) == null ? void 0 : _a2.walletInfo) == null ? void 0 : _b2.logo) && /* @__PURE__ */ jsx(
|
|
45602
|
-
"img",
|
|
45603
|
-
{
|
|
45604
|
-
style: { objectFit: "cover" },
|
|
45605
|
-
src: connectMutation.variables.walletInfo.logo,
|
|
45606
|
-
alt: `${(_c2 = connectMutation.variables) == null ? void 0 : _c2.walletPrettyName} logo`
|
|
45607
|
-
}
|
|
45608
|
-
)
|
|
45609
|
-
}
|
|
45610
|
-
),
|
|
45611
|
-
/* @__PURE__ */ jsxs(Text, { color: theme.primary.text.lowContrast, textAlign: "center", children: [
|
|
45612
|
-
titleText,
|
|
45613
|
-
" ",
|
|
45614
|
-
(_d = connectMutation.variables) == null ? void 0 : _d.walletPrettyName
|
|
45615
|
-
] }),
|
|
45616
|
-
connectMutation.error && /* @__PURE__ */ jsx(Text, { textAlign: "center", fontSize: 14, color: theme.primary.text.lowContrast, children: connectMutation.error.message })
|
|
45617
|
-
] }) });
|
|
45618
|
-
}
|
|
45619
|
-
return /* @__PURE__ */ jsx(
|
|
45620
|
-
VirtualList,
|
|
45621
|
-
{
|
|
45622
|
-
height,
|
|
45623
|
-
listItems: displayWallets,
|
|
45624
|
-
itemHeight: ITEM_HEIGHT$3 + ITEM_GAP$2,
|
|
45625
|
-
renderItem,
|
|
45626
|
-
itemKey: (item) => item.walletName,
|
|
45627
|
-
empty: {
|
|
45628
|
-
header: "No wallets available"
|
|
45629
|
-
}
|
|
45630
|
-
}
|
|
45631
|
-
);
|
|
45632
|
-
}, [
|
|
45633
|
-
connectMutation.error,
|
|
45634
|
-
connectMutation.isError,
|
|
45635
|
-
connectMutation.isPending,
|
|
45636
|
-
(_b = (_a = connectMutation.variables) == null ? void 0 : _a.walletInfo) == null ? void 0 : _b.logo,
|
|
45637
|
-
(_c = connectMutation.variables) == null ? void 0 : _c.walletPrettyName,
|
|
45638
|
-
height,
|
|
45639
|
-
renderItem,
|
|
45640
|
-
theme.primary.text.lowContrast,
|
|
45641
|
-
theme.primary.text.normal,
|
|
45642
|
-
displayWallets
|
|
45643
|
-
]);
|
|
45644
|
-
return /* @__PURE__ */ jsxs(StyledModalContainer, { gap: 15, children: [
|
|
45645
|
-
/* @__PURE__ */ jsx(
|
|
45646
|
-
ModalHeader,
|
|
45647
|
-
{
|
|
45648
|
-
title,
|
|
45649
|
-
onClickBackButton: connectMutation.isPending || connectMutation.isError ? connectMutation.reset : onClickBackButton,
|
|
45650
|
-
rightContent: headerRightContent
|
|
45651
|
-
}
|
|
45652
|
-
),
|
|
45653
|
-
renderWalletListOrWalletConnectionStatus,
|
|
45654
|
-
bottomContent
|
|
45655
|
-
] });
|
|
45656
|
-
};
|
|
45657
|
-
const StyledLoadingContainer = dt(Column)`
|
|
45658
|
-
align-items: center;
|
|
45659
|
-
justify-content: center;
|
|
45660
|
-
gap: 10px;
|
|
45661
|
-
padding-bottom: 10px;
|
|
45662
|
-
padding: 20px;
|
|
45663
|
-
`;
|
|
45664
|
-
const StringLength = {
|
|
45665
|
-
passet: 65,
|
|
45666
|
-
pauctid: 66,
|
|
45667
|
-
penumbra: 143,
|
|
45668
|
-
penumbrafullviewingkey: 132,
|
|
45669
|
-
penumbragovern: 73,
|
|
45670
|
-
penumbraspendkey: 75,
|
|
45671
|
-
penumbravalid: 72,
|
|
45672
|
-
penumbrawalletid: 75,
|
|
45673
|
-
plpid: 64,
|
|
45674
|
-
penumbracompat1: 150,
|
|
45675
|
-
tpenumbra: 68
|
|
45676
|
-
};
|
|
45677
|
-
const ByteLength = {
|
|
45678
|
-
passet: 32,
|
|
45679
|
-
pauctid: 32,
|
|
45680
|
-
penumbra: 80,
|
|
45681
|
-
penumbracompat1: 80,
|
|
45682
|
-
penumbrafullviewingkey: 64,
|
|
45683
|
-
penumbragovern: 32,
|
|
45684
|
-
penumbraspendkey: 32,
|
|
45685
|
-
penumbravalid: 32,
|
|
45686
|
-
penumbrawalletid: 32,
|
|
45687
|
-
plpid: 32,
|
|
45688
|
-
tpenumbra: 32
|
|
45689
|
-
};
|
|
45690
|
-
const toBech32m = (bData, prefix2) => to({
|
|
45691
|
-
bechLib: bech32m,
|
|
45692
|
-
bData,
|
|
45693
|
-
prefix: prefix2,
|
|
45694
|
-
expectLength: StringLength[prefix2],
|
|
45695
|
-
expectBytes: ByteLength[prefix2]
|
|
45696
|
-
});
|
|
45697
|
-
const to = ({ bechLib, bData, prefix: prefix2, expectLength, expectBytes }) => {
|
|
45698
|
-
if (bData.length !== expectBytes) {
|
|
45699
|
-
throw new TypeError(`Invalid data length: expected ${expectBytes}, got ${bData.length}`);
|
|
45700
|
-
}
|
|
45701
|
-
const bStr = bechLib.encode(prefix2, bechLib.toWords(bData), expectLength);
|
|
45702
|
-
if (bStr.length !== expectLength) {
|
|
45703
|
-
throw new TypeError("Unexpected string length");
|
|
45704
|
-
}
|
|
45705
|
-
return bStr;
|
|
45706
|
-
};
|
|
45707
|
-
const Inner = {
|
|
45708
|
-
passet: "inner",
|
|
45709
|
-
pauctid: "inner",
|
|
45710
|
-
penumbra: "inner",
|
|
45711
|
-
penumbrafullviewingkey: "inner",
|
|
45712
|
-
penumbragovern: "gk",
|
|
45713
|
-
penumbraspendkey: "inner",
|
|
45714
|
-
penumbravalid: "ik",
|
|
45715
|
-
penumbrawalletid: "inner",
|
|
45716
|
-
plpid: "inner",
|
|
45717
|
-
penumbracompat1: "inner",
|
|
45718
|
-
tpenumbra: "inner"
|
|
45719
|
-
};
|
|
45720
|
-
const Prefixes = {
|
|
45721
|
-
passet: "passet",
|
|
45722
|
-
pauctid: "pauctid",
|
|
45723
|
-
penumbra: "penumbra",
|
|
45724
|
-
penumbrafullviewingkey: "penumbrafullviewingkey",
|
|
45725
|
-
penumbragovern: "penumbragovern",
|
|
45726
|
-
penumbraspendkey: "penumbraspendkey",
|
|
45727
|
-
penumbravalid: "penumbravalid",
|
|
45728
|
-
penumbrawalletid: "penumbrawalletid",
|
|
45729
|
-
plpid: "plpid",
|
|
45730
|
-
penumbracompat1: "penumbracompat1",
|
|
45731
|
-
tpenumbra: "tpenumbra"
|
|
45732
|
-
};
|
|
45733
|
-
const innerName = Inner.penumbra;
|
|
45734
|
-
const prefix = Prefixes.penumbra;
|
|
45735
|
-
const bech32mAddress = ({ [innerName]: bytes }) => toBech32m(bytes, prefix);
|
|
45736
|
-
const okxWalletChainIdsInitialConnect = [
|
|
45737
|
-
"axelar-dojo-1",
|
|
45738
|
-
"celestia",
|
|
45739
|
-
"cosmoshub-4",
|
|
45740
|
-
"dydx-mainnet-1",
|
|
45741
|
-
"injective-1",
|
|
45742
|
-
"juno-1",
|
|
45743
|
-
"kava_2222-10",
|
|
45744
|
-
"osmosis-1",
|
|
45745
|
-
"stargaze-1"
|
|
45746
|
-
];
|
|
45747
|
-
const keplrMainnetChainIdsInitialConnect = [
|
|
45748
|
-
"akashnet-2",
|
|
45749
|
-
"axelar-dojo-1",
|
|
45750
|
-
"celestia",
|
|
45751
|
-
"chihuahua-1",
|
|
45752
|
-
"columbus-5",
|
|
45753
|
-
"core-1",
|
|
45754
|
-
"cosmoshub-4",
|
|
45755
|
-
"crypto-org-chain-mainnet-1",
|
|
45756
|
-
"dydx-mainnet-1",
|
|
45757
|
-
"dymension_1100-1",
|
|
45758
|
-
"evmos_9001-2",
|
|
45759
|
-
"injective-1",
|
|
45760
|
-
"juno-1",
|
|
45761
|
-
"kava_2222-10",
|
|
45762
|
-
"kyve-1",
|
|
45763
|
-
"neutron-1",
|
|
45764
|
-
"noble-1",
|
|
45765
|
-
"omniflixhub-1",
|
|
45766
|
-
"osmosis-1",
|
|
45767
|
-
"passage-2",
|
|
45768
|
-
"phoenix-1",
|
|
45769
|
-
"pryzm-1",
|
|
45770
|
-
"quicksilver-2",
|
|
45771
|
-
"regen-1",
|
|
45772
|
-
"secret-4",
|
|
45773
|
-
"seda-1",
|
|
45774
|
-
"sentinelhub-2",
|
|
45775
|
-
"sommelier-3",
|
|
45776
|
-
"ssc-1",
|
|
45777
|
-
"stargaze-1",
|
|
45778
|
-
"stride-1",
|
|
45779
|
-
"umee-1"
|
|
45780
|
-
];
|
|
45781
|
-
const walletMainnetChainIdsInitialConnect = [
|
|
45782
|
-
"cosmoshub-4",
|
|
45783
|
-
"injective-1",
|
|
45784
|
-
"pacific-1",
|
|
45785
|
-
"noble-1",
|
|
45786
|
-
"osmosis-1",
|
|
45787
|
-
"neutron-1",
|
|
45788
|
-
"pryzm-1",
|
|
45789
|
-
"axelar-dojo-1",
|
|
45790
|
-
"chihuahua-1"
|
|
45791
|
-
];
|
|
45792
|
-
const keplrMainnetWithoutEthermintChainIdsInitialConnect = [
|
|
45793
|
-
"akashnet-2",
|
|
45794
|
-
"axelar-dojo-1",
|
|
45795
|
-
"celestia",
|
|
45796
|
-
"chihuahua-1",
|
|
45797
|
-
"columbus-5",
|
|
45798
|
-
"core-1",
|
|
45799
|
-
"cosmoshub-4",
|
|
45800
|
-
"crypto-org-chain-mainnet-1",
|
|
45801
|
-
"dydx-mainnet-1",
|
|
45802
|
-
"juno-1",
|
|
45803
|
-
"kava_2222-10",
|
|
45804
|
-
"kyve-1",
|
|
45805
|
-
"lava-mainnet-1",
|
|
45806
|
-
"neutron-1",
|
|
45807
|
-
"noble-1",
|
|
45808
|
-
"omniflixhub-1",
|
|
45809
|
-
"osmosis-1",
|
|
45810
|
-
"passage-2",
|
|
45811
|
-
"phoenix-1",
|
|
45812
|
-
"pryzm-1",
|
|
45813
|
-
"quicksilver-2",
|
|
45814
|
-
"regen-1",
|
|
45815
|
-
"secret-4",
|
|
45816
|
-
"seda-1",
|
|
45817
|
-
"sentinelhub-2",
|
|
45818
|
-
"sommelier-3",
|
|
45819
|
-
"ssc-1",
|
|
45820
|
-
"stargaze-1",
|
|
45821
|
-
"stride-1",
|
|
45822
|
-
"umee-1",
|
|
45823
|
-
"wormchain"
|
|
45824
|
-
];
|
|
45825
|
-
const walletInfo = {
|
|
45826
|
-
[WalletType.OKX]: {
|
|
45827
|
-
name: "OKX",
|
|
45828
|
-
imgSrc: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAJDSURBVHgB7Zq9jtpAEMfHlhEgQLiioXEkoAGECwoKxMcTRHmC5E3IoyRPkPAEkI7unJYmTgEFTYwA8a3NTKScLnCHN6c9r1e3P2llWQy7M/s1Gv1twCP0ej37dDq9x+Zut1t3t9vZjDEHIiSRSPg4ZpDL5fxkMvn1cDh8m0wmfugfO53OoFQq/crn8wxfY9EymQyrVCqMfHvScZx1p9ls3pFxXBy/bKlUipGPrVbLuQqAfsCliq3zl0H84zwtjQrOw4Mt1W63P5LvBm2d+Xz+YzqdgkqUy+WgWCy+Mc/nc282m4FqLBYL+3g8fjDxenq72WxANZbLJeA13zDX67UDioL5ybXwafMYu64Ltn3bdDweQ5R97fd7GyhBQMipx4POeEDHIu2LfDdBIGGz+hJ9CQ1ABjoA2egAZPM6AgiCAEQhsi/C4jHyPA/6/f5NG3Ks2+3CYDC4aTccDrn6ojG54MnEvG00GoVmWLIRNZ7wTCwDHYBsdACy0QHIhiuRETxlICWpMMhGZHmqS8qH6JLyGegAZKMDkI0uKf8X4SWlaZo+Pp1bRrwlJU8ZKLIvUjKh0WiQ3sRUbNVq9c5Ebew7KEo2m/1p4jJ4qAmDaqDQBzj5XyiAT4VCQezJigAU+IDU+z8vJFnGWeC+bKQV/5VZ71FV6L7PA3gg3tXrdQ+DgLhC+75Wq3no69P3MC0NFQpx2lL04Ql9gHK1bRDjsSBIvScBnDTk1WrlGIZBorIDEYJj+rhdgnQ67VmWRe0zlplXl81vcyEt0rSoYDUAAAAASUVORK5CYII="
|
|
45829
|
-
},
|
|
45830
|
-
[WalletType.KEPLR]: {
|
|
45831
|
-
name: "Keplr",
|
|
45832
|
-
imgSrc: "https://raw.githubusercontent.com/graz-sh/graz/dev/example/starter/public/assets/wallet-icon-keplr.png"
|
|
45833
|
-
},
|
|
45834
|
-
[WalletType.LEAP]: {
|
|
45835
|
-
name: "Leap",
|
|
45836
|
-
imgSrc: "https://raw.githubusercontent.com/graz-sh/graz/dev/example/starter/public/assets/wallet-icon-leap.png"
|
|
45837
|
-
},
|
|
45838
|
-
[WalletType.COSMOSTATION]: {
|
|
45839
|
-
name: "Cosmostation",
|
|
45840
|
-
imgSrc: "https://raw.githubusercontent.com/graz-sh/graz/dev/example/starter/public/assets/wallet-icon-cosmostation.png"
|
|
45841
|
-
},
|
|
45842
|
-
[WalletType.VECTIS]: {
|
|
45843
|
-
name: "Vectis",
|
|
45844
|
-
imgSrc: "https://raw.githubusercontent.com/graz-sh/graz/dev/example/starter/public/assets/wallet-icon-vectis.svg"
|
|
45845
|
-
},
|
|
45846
|
-
[WalletType.STATION]: {
|
|
45847
|
-
name: "Station",
|
|
45848
|
-
imgSrc: "https://raw.githubusercontent.com/graz-sh/graz/dev/example/starter/public/assets/wallet-icon-station.svg"
|
|
45849
|
-
},
|
|
45850
|
-
[WalletType.XDEFI]: {
|
|
45851
|
-
name: "XDefi",
|
|
45852
|
-
imgSrc: "https://raw.githubusercontent.com/graz-sh/graz/dev/example/starter/public/assets/wallet-icon-xdefi.jpeg"
|
|
45853
|
-
},
|
|
45854
|
-
[WalletType.METAMASK_SNAP_LEAP]: {
|
|
45855
|
-
name: "Metamask Snap Leap",
|
|
45856
|
-
imgSrc: "https://raw.githubusercontent.com/graz-sh/graz/dev/example/starter/public/assets/wallet-icon-metamask.png"
|
|
45857
|
-
},
|
|
45858
|
-
[WalletType.METAMASK_SNAP_COSMOS]: {
|
|
45859
|
-
name: "Metamask Snap Cosmos",
|
|
45860
|
-
imgSrc: "https://raw.githubusercontent.com/graz-sh/graz/dev/example/starter/public/assets/wallet-icon-metamask.png"
|
|
45861
|
-
},
|
|
45862
|
-
[WalletType.WALLETCONNECT]: {
|
|
45863
|
-
name: "WalletConnect",
|
|
45864
|
-
imgSrc: "https://raw.githubusercontent.com/graz-sh/graz/dev/example/starter/public/assets/wallet-icon-walletconnect.png"
|
|
45865
|
-
},
|
|
45866
|
-
[WalletType.WC_KEPLR_MOBILE]: {
|
|
45867
|
-
name: "Keplr Mobile",
|
|
45868
|
-
imgSrc: "https://raw.githubusercontent.com/graz-sh/graz/dev/example/starter/public/assets/wallet-icon-keplr.png",
|
|
45869
|
-
mobile: true
|
|
45870
|
-
},
|
|
45871
|
-
[WalletType.WC_LEAP_MOBILE]: {
|
|
45872
|
-
name: "Leap Mobile",
|
|
45873
|
-
imgSrc: "https://raw.githubusercontent.com/graz-sh/graz/dev/example/starter/public/assets/wallet-icon-leap.png",
|
|
45874
|
-
mobile: true
|
|
45875
|
-
},
|
|
45876
|
-
[WalletType.WC_COSMOSTATION_MOBILE]: {
|
|
45877
|
-
name: "Cosmostation Mobile",
|
|
45878
|
-
imgSrc: "https://raw.githubusercontent.com/graz-sh/graz/dev/example/starter/public/assets/wallet-icon-cosmostation.png",
|
|
45879
|
-
mobile: true
|
|
45880
|
-
},
|
|
45881
|
-
[WalletType.COSMIFRAME]: {
|
|
45882
|
-
name: "DAO DAO",
|
|
45883
|
-
imgSrc: "https://raw.githubusercontent.com/graz-sh/graz/dev/example/starter/public/assets/wallet-icon-daodao.png"
|
|
45884
|
-
},
|
|
45885
|
-
[WalletType.COMPASS]: {
|
|
45886
|
-
name: "Compass",
|
|
45887
|
-
imgSrc: "https://raw.githubusercontent.com/graz-sh/graz/dev/example/starter/public/assets/wallet-icon-compass.png"
|
|
46073
|
+
${({ renderingEditDestinationWalletOrExplorerLink }) => renderingEditDestinationWalletOrExplorerLink ? lt`
|
|
46074
|
+
max-width: 55px;
|
|
46075
|
+
` : lt`
|
|
46076
|
+
max-width: 85px;
|
|
46077
|
+
`};
|
|
46078
|
+
}
|
|
46079
|
+
|
|
46080
|
+
@media (max-width: 400px) {
|
|
46081
|
+
${({ renderingEditDestinationWalletOrExplorerLink }) => renderingEditDestinationWalletOrExplorerLink ? lt`
|
|
46082
|
+
max-width: 65px;
|
|
46083
|
+
` : lt`
|
|
46084
|
+
max-width: 100px;
|
|
46085
|
+
`};
|
|
45888
46086
|
}
|
|
46087
|
+
`;
|
|
46088
|
+
const ModalHeader = ({ title, onClickBackButton, rightContent }) => {
|
|
46089
|
+
const theme = nt();
|
|
46090
|
+
return /* @__PURE__ */ jsxs(StyledHeader, { align: "center", justify: "space-between", children: [
|
|
46091
|
+
/* @__PURE__ */ jsx(Button, { onClick: () => onClickBackButton(), children: /* @__PURE__ */ jsx(StyledLeftArrowIcon$1, { color: theme == null ? void 0 : theme.primary.text.normal }) }),
|
|
46092
|
+
/* @__PURE__ */ jsx(StyledCenteredTitle, { textAlign: "center", children: title }),
|
|
46093
|
+
rightContent
|
|
46094
|
+
] });
|
|
45889
46095
|
};
|
|
45890
|
-
const
|
|
45891
|
-
|
|
46096
|
+
const StyledModalContainer = dt(Column)`
|
|
46097
|
+
position: relative;
|
|
46098
|
+
padding: 10px;
|
|
46099
|
+
gap: 10px;
|
|
46100
|
+
width: calc(100% - 20px);
|
|
46101
|
+
border-radius: 20px;
|
|
46102
|
+
background: ${({ theme }) => theme.primary.background.normal};
|
|
46103
|
+
height: 100%;
|
|
46104
|
+
`;
|
|
46105
|
+
const StyledModalInnerContainer = dt(Column)`
|
|
46106
|
+
width: 100%;
|
|
46107
|
+
align-items: center;
|
|
46108
|
+
justify-content: center;
|
|
46109
|
+
`;
|
|
46110
|
+
const StyledHeader = dt(Row)`
|
|
46111
|
+
height: 40px;
|
|
46112
|
+
margin-top: 10px;
|
|
46113
|
+
padding: 0 12px;
|
|
46114
|
+
`;
|
|
46115
|
+
const StyledLeftArrowIcon$1 = dt(LeftArrowIcon)`
|
|
46116
|
+
opacity: 0.2;
|
|
46117
|
+
transform: rotate(180deg);
|
|
46118
|
+
`;
|
|
46119
|
+
const StyledCenteredTitle = dt(Text)`
|
|
46120
|
+
position: absolute;
|
|
46121
|
+
left: 50%;
|
|
46122
|
+
transform: translateX(-50%);
|
|
46123
|
+
margin: 0;
|
|
46124
|
+
`;
|
|
46125
|
+
const isManualWalletEntry = (wallet) => {
|
|
46126
|
+
return wallet.onSelect !== void 0;
|
|
45892
46127
|
};
|
|
45893
|
-
const
|
|
45894
|
-
|
|
45895
|
-
|
|
45896
|
-
|
|
45897
|
-
|
|
45898
|
-
|
|
45899
|
-
|
|
45900
|
-
|
|
45901
|
-
|
|
45902
|
-
|
|
45903
|
-
|
|
45904
|
-
|
|
45905
|
-
|
|
45906
|
-
|
|
45907
|
-
|
|
46128
|
+
const isMinimalWallet = (wallet) => {
|
|
46129
|
+
return wallet.connect !== void 0;
|
|
46130
|
+
};
|
|
46131
|
+
const ITEM_HEIGHT$3 = 60;
|
|
46132
|
+
const ITEM_GAP$2 = 5;
|
|
46133
|
+
const RenderWalletList = ({
|
|
46134
|
+
title,
|
|
46135
|
+
walletList,
|
|
46136
|
+
onClickBackButton,
|
|
46137
|
+
onSelectWallet,
|
|
46138
|
+
chainId,
|
|
46139
|
+
isConnectEco,
|
|
46140
|
+
onWalletConnected,
|
|
46141
|
+
bottomContent,
|
|
46142
|
+
headerRightContent
|
|
46143
|
+
}) => {
|
|
46144
|
+
var _a, _b, _c;
|
|
46145
|
+
const theme = nt();
|
|
46146
|
+
const [selectedWallet, setSelectedWallet] = useState();
|
|
46147
|
+
const displayWallets = useMemo(() => {
|
|
46148
|
+
const filteredWallets = walletList.filter(
|
|
46149
|
+
(wallet) => isManualWalletEntry(wallet) || (wallet == null ? void 0 : wallet.isAvailable) !== false
|
|
46150
|
+
);
|
|
46151
|
+
return filteredWallets.length === 1 ? walletList : filteredWallets;
|
|
46152
|
+
}, [walletList]);
|
|
46153
|
+
const clearAssetInputAmounts = useSetAtom(clearAssetInputAmountsAtom);
|
|
46154
|
+
const connectMutation = useMutation({
|
|
46155
|
+
mutationKey: ["connectWallet"],
|
|
46156
|
+
mutationFn: async (wallet) => {
|
|
46157
|
+
if (chainId) {
|
|
46158
|
+
return await wallet.connect(chainId);
|
|
45908
46159
|
}
|
|
45909
|
-
|
|
45910
|
-
|
|
45911
|
-
|
|
45912
|
-
|
|
45913
|
-
|
|
45914
|
-
chainName: chain == null ? void 0 : chain.chainName,
|
|
45915
|
-
...asset
|
|
45916
|
-
});
|
|
45917
|
-
return;
|
|
46160
|
+
return await wallet.connect();
|
|
46161
|
+
},
|
|
46162
|
+
onSuccess: () => {
|
|
46163
|
+
if (isConnectEco) {
|
|
46164
|
+
clearAssetInputAmounts();
|
|
45918
46165
|
}
|
|
45919
|
-
|
|
45920
|
-
|
|
45921
|
-
|
|
45922
|
-
|
|
45923
|
-
);
|
|
45924
|
-
setSourceAsset({
|
|
45925
|
-
chainId: chain == null ? void 0 : chain.chainId,
|
|
45926
|
-
chainName: chain == null ? void 0 : chain.chainName,
|
|
45927
|
-
...asset
|
|
45928
|
-
});
|
|
46166
|
+
NiceModal.remove(Modals.SetAddressModal);
|
|
46167
|
+
NiceModal.remove(Modals.WalletSelectorModal);
|
|
46168
|
+
if (selectedWallet) {
|
|
46169
|
+
onWalletConnected == null ? void 0 : onWalletConnected(selectedWallet);
|
|
45929
46170
|
}
|
|
45930
46171
|
}
|
|
45931
|
-
};
|
|
45932
|
-
|
|
45933
|
-
const useCreateCosmosWallets = () => {
|
|
45934
|
-
const { data: chains2 } = useAtomValue(skipChainsAtom);
|
|
45935
|
-
const [cosmosWallet, setCosmosWallet] = useAtom(cosmosWalletAtom);
|
|
45936
|
-
const sourceAsset = useAtomValue(sourceAssetAtom);
|
|
45937
|
-
const callbacks = useAtomValue(callbacksAtom);
|
|
45938
|
-
const { walletType: currentWallet } = useActiveWalletType();
|
|
45939
|
-
const setDefaultSourceAsset = useUpdateSourceAssetToDefaultForChainType();
|
|
45940
|
-
const { disconnectAsync } = useDisconnect();
|
|
45941
|
-
const createCosmosWallets = useCallback(
|
|
45942
|
-
(chainId) => {
|
|
45943
|
-
const mobile = isMobile();
|
|
45944
|
-
const cosmosWallets = getAvailableWallets();
|
|
45945
|
-
const isPenumbra = chainId == null ? void 0 : chainId.includes("penumbra");
|
|
45946
|
-
if (isPenumbra && !mobile) {
|
|
45947
|
-
return handlePenumbraNetwork(callbacks == null ? void 0 : callbacks.onWalletDisconnected);
|
|
45948
|
-
}
|
|
45949
|
-
const wallets = [];
|
|
45950
|
-
for (const wallet of cosmosWallets) {
|
|
45951
|
-
const isWC = isWalletConnect(wallet);
|
|
45952
|
-
const mobile2 = isMobile();
|
|
45953
|
-
const walletInfo2 = getCosmosWalletInfo(wallet);
|
|
45954
|
-
const initialChainIds = filterValidChainIds(getInitialChainIds(wallet), chains2);
|
|
45955
|
-
const connectWallet = async ({ chainIdToConnect }) => {
|
|
45956
|
-
var _a, _b, _c, _d;
|
|
45957
|
-
const connectToInitialChainId = !chainIdToConnect || chainIdToConnect && initialChainIds.includes(chainIdToConnect);
|
|
45958
|
-
try {
|
|
45959
|
-
if (chainIdToConnect) {
|
|
45960
|
-
const chainInfo = getChainInfo(chainIdToConnect);
|
|
45961
|
-
if (!chainInfo)
|
|
45962
|
-
throw new Error(`connect: Chain info not found for chainId: ${chainId}`);
|
|
45963
|
-
if (!mobile2 && !isWC) {
|
|
45964
|
-
await getWallet(wallet).experimentalSuggestChain(chainInfo);
|
|
45965
|
-
}
|
|
45966
|
-
}
|
|
45967
|
-
const response = await connect({
|
|
45968
|
-
chainId: connectToInitialChainId ? initialChainIds : chainIdToConnect,
|
|
45969
|
-
walletType: wallet,
|
|
45970
|
-
autoReconnect: false
|
|
45971
|
-
});
|
|
45972
|
-
if (!(response == null ? void 0 : response.accounts)) {
|
|
45973
|
-
throw new Error("failed to get accounts from wallet");
|
|
45974
|
-
}
|
|
45975
|
-
if (sourceAsset === void 0) {
|
|
45976
|
-
setDefaultSourceAsset(ChainType.Cosmos);
|
|
45977
|
-
}
|
|
45978
|
-
const chainIdToAddressMap = Object.fromEntries(
|
|
45979
|
-
Object.entries(response.accounts).map(([key, value]) => [key, value.bech32Address])
|
|
45980
|
-
);
|
|
45981
|
-
const address = chainIdToConnect && (response == null ? void 0 : response.accounts[chainIdToConnect].bech32Address);
|
|
45982
|
-
if (cosmosWallet === void 0) {
|
|
45983
|
-
(_a = callbacks == null ? void 0 : callbacks.onWalletConnected) == null ? void 0 : _a.call(callbacks, {
|
|
45984
|
-
walletName: wallet,
|
|
45985
|
-
chainIdToAddressMap,
|
|
45986
|
-
address
|
|
45987
|
-
});
|
|
45988
|
-
const currentCosmosId = (_b = response == null ? void 0 : response.accounts[Object.keys(response == null ? void 0 : response.accounts)[0]]) == null ? void 0 : _b.bech32Address;
|
|
45989
|
-
setCosmosWallet({
|
|
45990
|
-
id: currentCosmosId,
|
|
45991
|
-
walletName: wallet,
|
|
45992
|
-
chainType: ChainType.Cosmos
|
|
45993
|
-
});
|
|
45994
|
-
}
|
|
45995
|
-
track("wallet connected", {
|
|
45996
|
-
walletName: wallet,
|
|
45997
|
-
chainId: chainIdToConnect,
|
|
45998
|
-
chainType: ChainType.Cosmos,
|
|
45999
|
-
address
|
|
46000
|
-
});
|
|
46001
|
-
return { address };
|
|
46002
|
-
} catch (e) {
|
|
46003
|
-
const error = e;
|
|
46004
|
-
track("connect wallet error", {
|
|
46005
|
-
walletName: wallet,
|
|
46006
|
-
chainId: chainIdToConnect,
|
|
46007
|
-
ChainType: ChainType.Cosmos,
|
|
46008
|
-
errorMessage: error == null ? void 0 : error.message
|
|
46009
|
-
});
|
|
46010
|
-
if ((_c = error == null ? void 0 : error.message) == null ? void 0 : _c.toLowerCase().includes("no chain info")) {
|
|
46011
|
-
throw new Error(
|
|
46012
|
-
`There is no chain info for ${chainId}. Please add the ${chainId} chain to your wallet`
|
|
46013
|
-
);
|
|
46014
|
-
}
|
|
46015
|
-
if ((_d = error == null ? void 0 : error.message) == null ? void 0 : _d.toLowerCase().includes("no ethereum public key")) {
|
|
46016
|
-
const response = await connect({
|
|
46017
|
-
chainId: keplrMainnetWithoutEthermintChainIdsInitialConnect,
|
|
46018
|
-
walletType: wallet,
|
|
46019
|
-
autoReconnect: false
|
|
46020
|
-
});
|
|
46021
|
-
return {
|
|
46022
|
-
address: chainIdToConnect ? response == null ? void 0 : response.accounts[chainIdToConnect].bech32Address : void 0
|
|
46023
|
-
};
|
|
46024
|
-
}
|
|
46025
|
-
throw e;
|
|
46026
|
-
}
|
|
46027
|
-
};
|
|
46028
|
-
const minimalWallet = {
|
|
46029
|
-
walletName: wallet,
|
|
46030
|
-
walletPrettyName: walletInfo2 == null ? void 0 : walletInfo2.name,
|
|
46031
|
-
walletChainType: ChainType.Cosmos,
|
|
46032
|
-
walletInfo: {
|
|
46033
|
-
logo: walletInfo2 == null ? void 0 : walletInfo2.imgSrc
|
|
46034
|
-
},
|
|
46035
|
-
connect: async (chainId2) => {
|
|
46036
|
-
await connectWallet({ chainIdToConnect: chainId2 });
|
|
46037
|
-
},
|
|
46038
|
-
disconnect: async () => {
|
|
46039
|
-
var _a;
|
|
46040
|
-
await disconnectAsync();
|
|
46041
|
-
track("wallet disconnected", {
|
|
46042
|
-
walletName: wallet,
|
|
46043
|
-
ChainType: ChainType.Cosmos
|
|
46044
|
-
});
|
|
46045
|
-
setCosmosWallet(void 0);
|
|
46046
|
-
(_a = callbacks == null ? void 0 : callbacks.onWalletDisconnected) == null ? void 0 : _a.call(callbacks, {
|
|
46047
|
-
walletName: wallet,
|
|
46048
|
-
chainType: ChainType.Cosmos
|
|
46049
|
-
});
|
|
46050
|
-
},
|
|
46051
|
-
getAddress: async ({ signRequired }) => {
|
|
46052
|
-
try {
|
|
46053
|
-
const getAddressWithoutConnectingWallet = cosmosWallet && !signRequired && chainId;
|
|
46054
|
-
if (getAddressWithoutConnectingWallet) {
|
|
46055
|
-
const address = (await getWallet(wallet).getKey(chainId)).bech32Address;
|
|
46056
|
-
return { address };
|
|
46057
|
-
}
|
|
46058
|
-
throw new Error("connect wallet");
|
|
46059
|
-
} catch (_error) {
|
|
46060
|
-
return connectWallet({ chainIdToConnect: chainId });
|
|
46061
|
-
}
|
|
46062
|
-
},
|
|
46063
|
-
isWalletConnected: currentWallet === wallet,
|
|
46064
|
-
isAvailable: (() => {
|
|
46065
|
-
if (mobile2) return void 0;
|
|
46066
|
-
try {
|
|
46067
|
-
const w2 = getWallet(wallet);
|
|
46068
|
-
return Boolean(w2);
|
|
46069
|
-
} catch (_error) {
|
|
46070
|
-
return false;
|
|
46071
|
-
}
|
|
46072
|
-
})()
|
|
46073
|
-
};
|
|
46074
|
-
wallets.push(minimalWallet);
|
|
46075
|
-
}
|
|
46076
|
-
return wallets;
|
|
46077
|
-
},
|
|
46078
|
-
[
|
|
46079
|
-
callbacks,
|
|
46080
|
-
chains2,
|
|
46081
|
-
currentWallet,
|
|
46082
|
-
sourceAsset,
|
|
46083
|
-
cosmosWallet,
|
|
46084
|
-
setDefaultSourceAsset,
|
|
46085
|
-
setCosmosWallet,
|
|
46086
|
-
disconnectAsync
|
|
46087
|
-
]
|
|
46088
|
-
);
|
|
46089
|
-
return { createCosmosWallets };
|
|
46090
|
-
};
|
|
46091
|
-
const getInitialChainIds = (wallet) => {
|
|
46092
|
-
const isWC = isWalletConnect(wallet);
|
|
46093
|
-
const mobile = isMobile();
|
|
46094
|
-
if (isWC) return keplrMainnetChainIdsInitialConnect.filter((chainId) => chainId !== "wormchain");
|
|
46095
|
-
switch (wallet) {
|
|
46096
|
-
case WalletType.OKX:
|
|
46097
|
-
return okxWalletChainIdsInitialConnect;
|
|
46098
|
-
case WalletType.KEPLR:
|
|
46099
|
-
return mobile ? keplrMainnetChainIdsInitialConnect.filter((chainId) => chainId !== "wormchain") : keplrMainnetChainIdsInitialConnect;
|
|
46100
|
-
default:
|
|
46101
|
-
return walletMainnetChainIdsInitialConnect;
|
|
46102
|
-
}
|
|
46103
|
-
};
|
|
46104
|
-
const filterValidChainIds = (chainIds, chains2) => {
|
|
46105
|
-
const cosmosChainIds = chains2 == null ? void 0 : chains2.filter((chain) => chain.chainType === ChainType.Cosmos).map((chain) => chain.chainId);
|
|
46106
|
-
const mainnetChainIds = mainnetChains.map((chain) => chain.chainId);
|
|
46107
|
-
return chainIds.filter(
|
|
46108
|
-
(chainId) => (cosmosChainIds == null ? void 0 : cosmosChainIds.includes(chainId)) && mainnetChainIds.includes(chainId)
|
|
46109
|
-
);
|
|
46110
|
-
};
|
|
46111
|
-
const getAvailableWallets = () => {
|
|
46112
|
-
const mobile = isMobile();
|
|
46113
|
-
const browserWallets = [
|
|
46114
|
-
WalletType.KEPLR,
|
|
46115
|
-
WalletType.LEAP,
|
|
46116
|
-
WalletType.COSMOSTATION,
|
|
46117
|
-
WalletType.XDEFI,
|
|
46118
|
-
WalletType.STATION,
|
|
46119
|
-
WalletType.VECTIS,
|
|
46120
|
-
WalletType.WALLETCONNECT
|
|
46121
|
-
];
|
|
46122
|
-
if (typeof window !== "undefined" && window.keplr && (window == null ? void 0 : window.keplr).isOkxWallet) {
|
|
46123
|
-
browserWallets[0] = WalletType.OKX;
|
|
46124
|
-
}
|
|
46125
|
-
const isIframeAvailable = checkWallet(WalletType.COSMIFRAME);
|
|
46126
|
-
if (isIframeAvailable) {
|
|
46127
|
-
browserWallets.push(WalletType.COSMIFRAME);
|
|
46128
|
-
}
|
|
46129
|
-
const mobileCosmosWallets = [WalletType.WC_KEPLR_MOBILE];
|
|
46130
|
-
const availableMobileCosmosWallets = [...browserWallets, ...mobileCosmosWallets].filter(
|
|
46172
|
+
});
|
|
46173
|
+
const renderItem = useCallback(
|
|
46131
46174
|
(wallet) => {
|
|
46132
|
-
|
|
46133
|
-
|
|
46134
|
-
|
|
46135
|
-
|
|
46175
|
+
var _a2;
|
|
46176
|
+
const name2 = isMinimalWallet(wallet) ? wallet.walletPrettyName ?? wallet.walletName : wallet.walletName;
|
|
46177
|
+
const imageUrl = isMinimalWallet(wallet) ? (_a2 = wallet == null ? void 0 : wallet.walletInfo) == null ? void 0 : _a2.logo : void 0;
|
|
46178
|
+
const rightContent = isManualWalletEntry(wallet) ? wallet == null ? void 0 : wallet.rightContent : void 0;
|
|
46179
|
+
const isAvailable = isMinimalWallet(wallet) ? wallet == null ? void 0 : wallet.isAvailable : void 0;
|
|
46180
|
+
const renderedRightContent = (rightContent == null ? void 0 : rightContent()) ?? /* @__PURE__ */ jsx(Fragment, {});
|
|
46181
|
+
const imageElement = imageUrl ? /* @__PURE__ */ jsx(
|
|
46182
|
+
"img",
|
|
46183
|
+
{
|
|
46184
|
+
height: 35,
|
|
46185
|
+
width: 35,
|
|
46186
|
+
style: { objectFit: "cover" },
|
|
46187
|
+
src: imageUrl,
|
|
46188
|
+
alt: `${name2}-logo`
|
|
46136
46189
|
}
|
|
46137
|
-
|
|
46138
|
-
|
|
46139
|
-
|
|
46140
|
-
|
|
46141
|
-
|
|
46142
|
-
|
|
46143
|
-
|
|
46144
|
-
|
|
46145
|
-
|
|
46146
|
-
|
|
46147
|
-
|
|
46148
|
-
|
|
46149
|
-
|
|
46150
|
-
|
|
46151
|
-
|
|
46152
|
-
|
|
46153
|
-
|
|
46154
|
-
|
|
46155
|
-
|
|
46190
|
+
) : null;
|
|
46191
|
+
const onClickConnectWallet = () => {
|
|
46192
|
+
if (!isMinimalWallet(wallet)) {
|
|
46193
|
+
wallet.onSelect();
|
|
46194
|
+
} else if (onSelectWallet) {
|
|
46195
|
+
onSelectWallet(wallet);
|
|
46196
|
+
NiceModal.remove(Modals.SetAddressModal);
|
|
46197
|
+
NiceModal.remove(Modals.WalletSelectorModal);
|
|
46198
|
+
} else {
|
|
46199
|
+
setSelectedWallet(wallet);
|
|
46200
|
+
connectMutation.mutate(wallet);
|
|
46201
|
+
}
|
|
46202
|
+
};
|
|
46203
|
+
const leftContent = /* @__PURE__ */ jsxs(Row, { style: { width: "100%" }, align: "center", justify: "space-between", children: [
|
|
46204
|
+
/* @__PURE__ */ jsxs(Row, { align: "center", gap: 10, children: [
|
|
46205
|
+
imageElement,
|
|
46206
|
+
/* @__PURE__ */ jsx(Text, { children: name2 })
|
|
46207
|
+
] }),
|
|
46208
|
+
isAvailable !== void 0 && /* @__PURE__ */ jsx(SmallText, { children: isAvailable ? "Installed" : "Not Installed" })
|
|
46209
|
+
] });
|
|
46210
|
+
return /* @__PURE__ */ jsx(
|
|
46211
|
+
ModalRowItem,
|
|
46212
|
+
{
|
|
46213
|
+
onClick: onClickConnectWallet,
|
|
46214
|
+
style: { marginTop: ITEM_GAP$2 },
|
|
46215
|
+
leftContent,
|
|
46216
|
+
rightContent: renderedRightContent
|
|
46217
|
+
},
|
|
46218
|
+
name2
|
|
46219
|
+
);
|
|
46156
46220
|
},
|
|
46157
|
-
|
|
46158
|
-
|
|
46159
|
-
|
|
46160
|
-
|
|
46161
|
-
|
|
46162
|
-
|
|
46163
|
-
|
|
46164
|
-
|
|
46165
|
-
|
|
46166
|
-
|
|
46167
|
-
|
|
46168
|
-
|
|
46169
|
-
|
|
46221
|
+
[connectMutation, onSelectWallet]
|
|
46222
|
+
);
|
|
46223
|
+
const height = useMemo(() => {
|
|
46224
|
+
return Math.min(530, displayWallets.length * (ITEM_HEIGHT$3 + ITEM_GAP$2));
|
|
46225
|
+
}, [displayWallets.length]);
|
|
46226
|
+
const renderWalletListOrWalletConnectionStatus = useMemo(() => {
|
|
46227
|
+
var _a2, _b2, _c2, _d;
|
|
46228
|
+
if (connectMutation.isError || connectMutation.isPending) {
|
|
46229
|
+
const titleText = connectMutation.isError ? "Failed to connect" : "Connecting to";
|
|
46230
|
+
return /* @__PURE__ */ jsx(StyledModalInnerContainer, { children: /* @__PURE__ */ jsxs(StyledLoadingContainer, { children: [
|
|
46231
|
+
/* @__PURE__ */ jsx(
|
|
46232
|
+
StyledAnimatedBorder,
|
|
46233
|
+
{
|
|
46234
|
+
width: 80,
|
|
46235
|
+
height: 80,
|
|
46236
|
+
backgroundColor: theme.primary.text.normal,
|
|
46237
|
+
status: connectMutation.isError ? "failed" : "pending",
|
|
46238
|
+
borderSize: 8,
|
|
46239
|
+
children: ((_b2 = (_a2 = connectMutation.variables) == null ? void 0 : _a2.walletInfo) == null ? void 0 : _b2.logo) && /* @__PURE__ */ jsx(
|
|
46240
|
+
"img",
|
|
46241
|
+
{
|
|
46242
|
+
style: { objectFit: "cover" },
|
|
46243
|
+
src: connectMutation.variables.walletInfo.logo,
|
|
46244
|
+
alt: `${(_c2 = connectMutation.variables) == null ? void 0 : _c2.walletPrettyName} logo`
|
|
46245
|
+
}
|
|
46246
|
+
)
|
|
46170
46247
|
}
|
|
46171
|
-
|
|
46172
|
-
|
|
46173
|
-
|
|
46174
|
-
|
|
46175
|
-
|
|
46176
|
-
|
|
46177
|
-
|
|
46178
|
-
|
|
46179
|
-
|
|
46180
|
-
|
|
46181
|
-
|
|
46182
|
-
|
|
46183
|
-
|
|
46248
|
+
),
|
|
46249
|
+
/* @__PURE__ */ jsxs(Text, { color: theme.primary.text.lowContrast, textAlign: "center", children: [
|
|
46250
|
+
titleText,
|
|
46251
|
+
" ",
|
|
46252
|
+
(_d = connectMutation.variables) == null ? void 0 : _d.walletPrettyName
|
|
46253
|
+
] }),
|
|
46254
|
+
connectMutation.error && /* @__PURE__ */ jsx(Text, { textAlign: "center", fontSize: 14, color: theme.primary.text.lowContrast, children: connectMutation.error.message })
|
|
46255
|
+
] }) });
|
|
46256
|
+
}
|
|
46257
|
+
return /* @__PURE__ */ jsx(
|
|
46258
|
+
VirtualList,
|
|
46259
|
+
{
|
|
46260
|
+
height,
|
|
46261
|
+
listItems: displayWallets,
|
|
46262
|
+
itemHeight: ITEM_HEIGHT$3 + ITEM_GAP$2,
|
|
46263
|
+
renderItem,
|
|
46264
|
+
itemKey: (item) => item.walletName,
|
|
46265
|
+
empty: {
|
|
46266
|
+
header: "No wallets available"
|
|
46267
|
+
}
|
|
46184
46268
|
}
|
|
46185
|
-
|
|
46186
|
-
|
|
46187
|
-
|
|
46188
|
-
|
|
46189
|
-
|
|
46190
|
-
|
|
46191
|
-
|
|
46192
|
-
|
|
46193
|
-
|
|
46194
|
-
|
|
46195
|
-
|
|
46196
|
-
|
|
46269
|
+
);
|
|
46270
|
+
}, [
|
|
46271
|
+
connectMutation.error,
|
|
46272
|
+
connectMutation.isError,
|
|
46273
|
+
connectMutation.isPending,
|
|
46274
|
+
(_b = (_a = connectMutation.variables) == null ? void 0 : _a.walletInfo) == null ? void 0 : _b.logo,
|
|
46275
|
+
(_c = connectMutation.variables) == null ? void 0 : _c.walletPrettyName,
|
|
46276
|
+
height,
|
|
46277
|
+
renderItem,
|
|
46278
|
+
theme.primary.text.lowContrast,
|
|
46279
|
+
theme.primary.text.normal,
|
|
46280
|
+
displayWallets
|
|
46281
|
+
]);
|
|
46282
|
+
return /* @__PURE__ */ jsxs(StyledModalContainer, { gap: 15, children: [
|
|
46283
|
+
/* @__PURE__ */ jsx(
|
|
46284
|
+
ModalHeader,
|
|
46285
|
+
{
|
|
46286
|
+
title,
|
|
46287
|
+
onClickBackButton: connectMutation.isPending || connectMutation.isError ? connectMutation.reset : onClickBackButton,
|
|
46288
|
+
rightContent: headerRightContent
|
|
46289
|
+
}
|
|
46290
|
+
),
|
|
46291
|
+
renderWalletListOrWalletConnectionStatus,
|
|
46292
|
+
bottomContent
|
|
46293
|
+
] });
|
|
46197
46294
|
};
|
|
46295
|
+
const StyledLoadingContainer = dt(Column)`
|
|
46296
|
+
align-items: center;
|
|
46297
|
+
justify-content: center;
|
|
46298
|
+
gap: 10px;
|
|
46299
|
+
padding-bottom: 10px;
|
|
46300
|
+
padding: 20px;
|
|
46301
|
+
`;
|
|
46198
46302
|
const seiPrecompileAddrABI = [
|
|
46199
46303
|
{
|
|
46200
46304
|
inputs: [
|
|
@@ -49867,7 +49971,7 @@ const useHandleTransactionTimeout = (swapExecutionState) => {
|
|
|
49867
49971
|
onClickBack: () => {
|
|
49868
49972
|
setOverallStatus("unconfirmed");
|
|
49869
49973
|
},
|
|
49870
|
-
explorerLink: (
|
|
49974
|
+
explorerLink: createSkipExplorerLink(transactionDetailsArray),
|
|
49871
49975
|
txHash: lastTransaction == null ? void 0 : lastTransaction.txHash
|
|
49872
49976
|
});
|
|
49873
49977
|
},
|
|
@@ -49907,14 +50011,11 @@ const useSyncTxStatus = ({
|
|
|
49907
50011
|
return getClientOperations(route2.operations);
|
|
49908
50012
|
}, [route2 == null ? void 0 : route2.operations]);
|
|
49909
50013
|
const computedSwapStatus = useMemo(() => {
|
|
49910
|
-
if ((statusData == null ? void 0 : statusData.lastTxStatus) === "pending"
|
|
49911
|
-
|
|
49912
|
-
|
|
49913
|
-
if ((transferEvents == null ? void 0 : transferEvents.length) === 0 && !(statusData == null ? void 0 : statusData.isSettled)) {
|
|
49914
|
-
if (isPending && overallStatus !== "pending") {
|
|
49915
|
-
return "signing";
|
|
50014
|
+
if ((statusData == null ? void 0 : statusData.lastTxStatus) === "pending") {
|
|
50015
|
+
if (isPending) {
|
|
50016
|
+
setOverallStatus("pending");
|
|
49916
50017
|
}
|
|
49917
|
-
return;
|
|
50018
|
+
return "pending";
|
|
49918
50019
|
}
|
|
49919
50020
|
if (!transferEvents) return;
|
|
49920
50021
|
if (statusData.isSuccess) {
|
|
@@ -49930,12 +50031,12 @@ const useSyncTxStatus = ({
|
|
|
49930
50031
|
return "unconfirmed";
|
|
49931
50032
|
}
|
|
49932
50033
|
}, [
|
|
49933
|
-
|
|
50034
|
+
statusData == null ? void 0 : statusData.lastTxStatus,
|
|
49934
50035
|
statusData == null ? void 0 : statusData.isSettled,
|
|
49935
50036
|
statusData == null ? void 0 : statusData.isSuccess,
|
|
49936
|
-
statusData == null ? void 0 : statusData.lastTxStatus,
|
|
49937
50037
|
transferEvents,
|
|
49938
|
-
|
|
50038
|
+
isPending,
|
|
50039
|
+
setOverallStatus
|
|
49939
50040
|
]);
|
|
49940
50041
|
useEffect(() => {
|
|
49941
50042
|
if (computedSwapStatus) {
|
|
@@ -50079,15 +50180,13 @@ function createCountdownTimer({
|
|
|
50079
50180
|
}
|
|
50080
50181
|
const useCountdown = ({
|
|
50081
50182
|
estimatedRouteDurationSeconds,
|
|
50082
|
-
|
|
50183
|
+
enabled
|
|
50083
50184
|
}) => {
|
|
50084
50185
|
const [countdown, setCountdown] = useState(estimatedRouteDurationSeconds);
|
|
50085
50186
|
const [timer, setTimer] = useState();
|
|
50086
50187
|
useEffect(() => {
|
|
50087
50188
|
const estimatedDurationSeconds = estimatedRouteDurationSeconds;
|
|
50088
|
-
if (!timer && estimatedDurationSeconds &&
|
|
50089
|
-
swapExecutionState
|
|
50090
|
-
)) {
|
|
50189
|
+
if (!timer && estimatedDurationSeconds && enabled) {
|
|
50091
50190
|
const countdownTimer = createCountdownTimer({
|
|
50092
50191
|
duration: estimatedDurationSeconds * 1e3,
|
|
50093
50192
|
onUpdate: (remainingTime) => {
|
|
@@ -50100,7 +50199,7 @@ const useCountdown = ({
|
|
|
50100
50199
|
return () => {
|
|
50101
50200
|
timer == null ? void 0 : timer.stopCountdown();
|
|
50102
50201
|
};
|
|
50103
|
-
}, [estimatedRouteDurationSeconds,
|
|
50202
|
+
}, [estimatedRouteDurationSeconds, enabled, timer]);
|
|
50104
50203
|
return countdown;
|
|
50105
50204
|
};
|
|
50106
50205
|
const SwapExecutionButton = ({
|
|
@@ -50113,7 +50212,7 @@ const SwapExecutionButton = ({
|
|
|
50113
50212
|
}) => {
|
|
50114
50213
|
const countdown = useCountdown({
|
|
50115
50214
|
estimatedRouteDurationSeconds: route2 == null ? void 0 : route2.estimatedRouteDurationSeconds,
|
|
50116
|
-
swapExecutionState
|
|
50215
|
+
enabled: swapExecutionState === SwapExecutionState.pending
|
|
50117
50216
|
});
|
|
50118
50217
|
const theme = nt();
|
|
50119
50218
|
const setErrorWarning = useSetAtom(errorWarningAtom);
|
|
@@ -50156,7 +50255,7 @@ const SwapExecutionButton = ({
|
|
|
50156
50255
|
const destinationChainId = route2 == null ? void 0 : route2.destAssetChainId;
|
|
50157
50256
|
if (!destinationChainId) return;
|
|
50158
50257
|
NiceModal.show(Modals.SetAddressModal, {
|
|
50159
|
-
signRequired: lastOperation.signRequired,
|
|
50258
|
+
signRequired: lastOperation.signRequired && lastOperation.fromChain === destinationChainId,
|
|
50160
50259
|
chainId: destinationChainId,
|
|
50161
50260
|
chainAddressIndex: route2.requiredChainAddresses.length - 1
|
|
50162
50261
|
});
|
|
@@ -50383,9 +50482,9 @@ const SwapExecutionPage = () => {
|
|
|
50383
50482
|
signaturesRemaining,
|
|
50384
50483
|
isLoading
|
|
50385
50484
|
});
|
|
50485
|
+
const isSafeToleave = (route2 == null ? void 0 : route2.txsRequired) === transactionDetailsArray.length;
|
|
50386
50486
|
usePreventPageUnload(
|
|
50387
|
-
swapExecutionState === 5 || swapExecutionState === 4 || swapExecutionState === 8 || swapExecutionState === 7
|
|
50388
|
-
/* validatingGasBalance */
|
|
50487
|
+
swapExecutionState === 5 || swapExecutionState === 4 || swapExecutionState === 8 || swapExecutionState === 7 || !isSafeToleave
|
|
50389
50488
|
);
|
|
50390
50489
|
useHandleTransactionFailed(error, statusData);
|
|
50391
50490
|
useHandleTransactionTimeout(swapExecutionState);
|
|
@@ -50422,11 +50521,12 @@ const SwapExecutionPage = () => {
|
|
|
50422
50521
|
}
|
|
50423
50522
|
return () => {
|
|
50424
50523
|
NiceModal.show(Modals.SetAddressModal, {
|
|
50524
|
+
signRequired: lastOperation.signRequired && lastOperation.fromChain === (route2 == null ? void 0 : route2.destAssetChainId),
|
|
50425
50525
|
chainId: route2 == null ? void 0 : route2.destAssetChainId,
|
|
50426
50526
|
chainAddressIndex: route2 ? (route2 == null ? void 0 : route2.requiredChainAddresses.length) - 1 : void 0
|
|
50427
50527
|
});
|
|
50428
50528
|
};
|
|
50429
|
-
}, [swapExecutionState, route2]);
|
|
50529
|
+
}, [swapExecutionState, lastOperation.signRequired, lastOperation.fromChain, route2]);
|
|
50430
50530
|
const SwapExecutionPageRoute = simpleRoute ? SwapExecutionPageRouteSimple : SwapExecutionPageRouteDetailed;
|
|
50431
50531
|
const shouldRenderTrackProgressButton = lastTxHash && lastTxChainId && (route2 == null ? void 0 : route2.txsRequired) === transactionDetailsArray.length;
|
|
50432
50532
|
return /* @__PURE__ */ jsxs(Column, { gap: 5, children: [
|
|
@@ -50938,20 +51038,12 @@ const useUpdateAmountWhenRouteChanges = () => {
|
|
|
50938
51038
|
if (direction === "swap-in" && swapInAmountChanged) {
|
|
50939
51039
|
setDestinationAsset((old) => ({
|
|
50940
51040
|
...old,
|
|
50941
|
-
amount:
|
|
50942
|
-
decimals: destinationAsset.decimals,
|
|
50943
|
-
showLessThanSign: false,
|
|
50944
|
-
abbreviate: false
|
|
50945
|
-
})
|
|
51041
|
+
amount: swapInAmount
|
|
50946
51042
|
}));
|
|
50947
51043
|
} else if (direction === "swap-out" && swapOutAmountChanged) {
|
|
50948
51044
|
setSourceAsset((old) => ({
|
|
50949
51045
|
...old,
|
|
50950
|
-
amount:
|
|
50951
|
-
decimals: sourceAsset.decimals,
|
|
50952
|
-
showLessThanSign: false,
|
|
50953
|
-
abbreviate: false
|
|
50954
|
-
})
|
|
51046
|
+
amount: swapOutAmount
|
|
50955
51047
|
}));
|
|
50956
51048
|
}
|
|
50957
51049
|
}, [route2.data, sourceAsset, destinationAsset, direction, setSourceAsset, setDestinationAsset]);
|
|
@@ -50971,177 +51063,6 @@ const useShowCosmosLedgerWarning = () => {
|
|
|
50971
51063
|
return !!(account == null ? void 0 : account.wallet.isLedger);
|
|
50972
51064
|
}, [sourceAsset == null ? void 0 : sourceAsset.chainId, chainType, getAccount]);
|
|
50973
51065
|
};
|
|
50974
|
-
const name = "@skip-go/widget";
|
|
50975
|
-
const description = "Swap widget";
|
|
50976
|
-
const version = "3.10.10";
|
|
50977
|
-
const repository = {
|
|
50978
|
-
url: "https://github.com/skip-mev/skip-go",
|
|
50979
|
-
directory: "packages/widget"
|
|
50980
|
-
};
|
|
50981
|
-
const type = "module";
|
|
50982
|
-
const scripts = {
|
|
50983
|
-
dev: "vite --force --host",
|
|
50984
|
-
"dev:storybook": "storybook dev -p 6006",
|
|
50985
|
-
build: "npm run generate-chains && NODE_OPTIONS=--max-old-space-size=16384 vite build",
|
|
50986
|
-
"watch:build": "vite build --watch",
|
|
50987
|
-
lint: "NODE_OPTIONS=--max-old-space-size=32384 eslint . --fix",
|
|
50988
|
-
preview: "vite preview",
|
|
50989
|
-
"build:web-component": "NODE_OPTIONS=--max-old-space-size=32384 webpack --config webpack.config.js",
|
|
50990
|
-
"publish:web-component": "npm run build:web-component && cd web-component && npm publish && cd ..",
|
|
50991
|
-
prepack: "yarn run pre",
|
|
50992
|
-
postpack: "yarn run post",
|
|
50993
|
-
pre: "npm run build && node scripts/prepublish.cjs",
|
|
50994
|
-
post: "git checkout -- package.json",
|
|
50995
|
-
"generate-chains": "node scripts/generate-chains.cjs",
|
|
50996
|
-
"update-registries": "yarn up @initia/initia-registry chain-registry",
|
|
50997
|
-
test: "yarn playwright test"
|
|
50998
|
-
};
|
|
50999
|
-
const exports = {
|
|
51000
|
-
".": {
|
|
51001
|
-
types: "./build/index.d.ts",
|
|
51002
|
-
"import": "./build/index.js"
|
|
51003
|
-
}
|
|
51004
|
-
};
|
|
51005
|
-
const types = "./build/index.d.ts";
|
|
51006
|
-
const files = [
|
|
51007
|
-
"build",
|
|
51008
|
-
"README.md"
|
|
51009
|
-
];
|
|
51010
|
-
const devDependencies = {
|
|
51011
|
-
"@chromatic-com/storybook": "^1.6.1",
|
|
51012
|
-
"@eslint/js": "^9.9.0",
|
|
51013
|
-
"@initia/initia-registry": "^1.0.6",
|
|
51014
|
-
"@keplr-wallet/types": "^0.12.125",
|
|
51015
|
-
"@playwright/test": "^1.51.1",
|
|
51016
|
-
"@storybook/addon-essentials": "^8.2.6",
|
|
51017
|
-
"@storybook/addon-interactions": "^8.2.6",
|
|
51018
|
-
"@storybook/addon-links": "^8.2.6",
|
|
51019
|
-
"@storybook/addon-onboarding": "^8.2.6",
|
|
51020
|
-
"@storybook/blocks": "^8.2.6",
|
|
51021
|
-
"@storybook/react": "^8.2.6",
|
|
51022
|
-
"@storybook/react-vite": "^8.2.6",
|
|
51023
|
-
"@storybook/test": "^8.2.6",
|
|
51024
|
-
"@testing-library/dom": "^10.4.0",
|
|
51025
|
-
"@testing-library/react": "^16.2.0",
|
|
51026
|
-
"@types/eslint__js": "^8.42.3",
|
|
51027
|
-
"@types/pluralize": "^0.0.33",
|
|
51028
|
-
"@types/react": "^19.0.10",
|
|
51029
|
-
"@types/react-dom": "^19.0.4",
|
|
51030
|
-
"@typescript-eslint/eslint-plugin": "^7.15.0",
|
|
51031
|
-
"@typescript-eslint/parser": "^7.15.0",
|
|
51032
|
-
"@vitejs/plugin-react": "^4.3.1",
|
|
51033
|
-
buffer: "^6.0.3",
|
|
51034
|
-
"chain-registry": "^1.69.222",
|
|
51035
|
-
download: "^8.0.0",
|
|
51036
|
-
eslint: "^9.9.0",
|
|
51037
|
-
"eslint-config-prettier": "^9.1.0",
|
|
51038
|
-
"eslint-plugin-prettier": "^5.2.1",
|
|
51039
|
-
"eslint-plugin-react-hooks": "^4.6.2",
|
|
51040
|
-
"fs-extra": "^11.3.0",
|
|
51041
|
-
"node-polyfill-webpack-plugin": "^4.0.0",
|
|
51042
|
-
"pino-pretty": "^13.0.0",
|
|
51043
|
-
"postcss-loader": "^8.1.1",
|
|
51044
|
-
prettier: "^3.4.2",
|
|
51045
|
-
process: "^0.11.10",
|
|
51046
|
-
"raw-loader": "^4.0.2",
|
|
51047
|
-
react: ">=17.0.0",
|
|
51048
|
-
"react-dom": ">=17.0.0",
|
|
51049
|
-
starknet: "6.11.0",
|
|
51050
|
-
storybook: "^8.2.6",
|
|
51051
|
-
"ts-loader": "^9.5.1",
|
|
51052
|
-
typescript: "^5.5.4",
|
|
51053
|
-
"typescript-eslint": "^8.2.0",
|
|
51054
|
-
"url-loader": "^4.1.1",
|
|
51055
|
-
vite: "^5.3.4",
|
|
51056
|
-
"vite-plugin-dts": "^4.0.0-beta.1",
|
|
51057
|
-
"vite-plugin-node-polyfills": "^0.22.0",
|
|
51058
|
-
webpack: "^5.94.0",
|
|
51059
|
-
"webpack-cli": "^5.1.4"
|
|
51060
|
-
};
|
|
51061
|
-
const peerDependencies = {
|
|
51062
|
-
"@tanstack/react-query": "^5.51.21",
|
|
51063
|
-
react: ">=17.0.0",
|
|
51064
|
-
"react-dom": ">=17.0.0",
|
|
51065
|
-
viem: "^2.21.55",
|
|
51066
|
-
wagmi: "^2.14.1"
|
|
51067
|
-
};
|
|
51068
|
-
const dependencies = {
|
|
51069
|
-
"@amplitude/analytics-browser": "^2.11.12",
|
|
51070
|
-
"@amplitude/plugin-session-replay-browser": "^1.16.5",
|
|
51071
|
-
"@cosmjs/amino": "0.33.1",
|
|
51072
|
-
"@cosmjs/cosmwasm-stargate": "0.33.1",
|
|
51073
|
-
"@cosmjs/encoding": "0.33.1",
|
|
51074
|
-
"@cosmjs/math": "0.33.1",
|
|
51075
|
-
"@cosmjs/proto-signing": "0.33.1",
|
|
51076
|
-
"@cosmjs/stargate": "0.33.1",
|
|
51077
|
-
"@ebay/nice-modal-react": "^1.2.13",
|
|
51078
|
-
"@eslint/compat": "^1.1.1",
|
|
51079
|
-
"@penumbra-zone/bech32m": "^13.0.0",
|
|
51080
|
-
"@penumbra-zone/client": "^24.0.0",
|
|
51081
|
-
"@penumbra-zone/protobuf": "^7.2.0",
|
|
51082
|
-
"@penumbra-zone/transport-dom": "^7.5.0",
|
|
51083
|
-
"@r2wc/react-to-web-component": "^2.0.3",
|
|
51084
|
-
"@sentry/react": "^8.46.0",
|
|
51085
|
-
"@skip-go/client": "workspace:^",
|
|
51086
|
-
"@solana/spl-token": "^0.4.8",
|
|
51087
|
-
"@solana/wallet-adapter-backpack": "^0.1.14",
|
|
51088
|
-
"@solana/wallet-adapter-coinbase": "^0.1.19",
|
|
51089
|
-
"@solana/wallet-adapter-ledger": "^0.9.25",
|
|
51090
|
-
"@solana/wallet-adapter-phantom": "^0.9.24",
|
|
51091
|
-
"@solana/wallet-adapter-solflare": "^0.6.28",
|
|
51092
|
-
"@solana/wallet-adapter-trust": "^0.1.13",
|
|
51093
|
-
"@solana/web3.js": "^1.95.8",
|
|
51094
|
-
"@tanstack/query-core": "^5.51.21",
|
|
51095
|
-
"@walletconnect/modal": "^2.7.0",
|
|
51096
|
-
"@walletconnect/sign-client": "^2.20.3",
|
|
51097
|
-
"@walletconnect/solana-adapter": "^0.0.8",
|
|
51098
|
-
add: "^2.0.6",
|
|
51099
|
-
bech32: "^2.0.0",
|
|
51100
|
-
graz: "0.3.2",
|
|
51101
|
-
jotai: "^2.10.1",
|
|
51102
|
-
"jotai-effect": "^1.0.2",
|
|
51103
|
-
"jotai-tanstack-query": "^0.8.6",
|
|
51104
|
-
"lodash.debounce": "^4.0.8",
|
|
51105
|
-
pluralize: "^8.0.0",
|
|
51106
|
-
"rc-virtual-list": "^3.14.5",
|
|
51107
|
-
"react-error-boundary": "^4.0.13",
|
|
51108
|
-
"react-shadow-scope": "^1.0.5",
|
|
51109
|
-
"styled-components": "^6.1.13",
|
|
51110
|
-
yarn: "^1.22.22",
|
|
51111
|
-
zod: "^3.23.8"
|
|
51112
|
-
};
|
|
51113
|
-
const publishConfig = {
|
|
51114
|
-
access: "public"
|
|
51115
|
-
};
|
|
51116
|
-
const packageJson = {
|
|
51117
|
-
name,
|
|
51118
|
-
description,
|
|
51119
|
-
version,
|
|
51120
|
-
repository,
|
|
51121
|
-
type,
|
|
51122
|
-
scripts,
|
|
51123
|
-
exports,
|
|
51124
|
-
types,
|
|
51125
|
-
files,
|
|
51126
|
-
devDependencies,
|
|
51127
|
-
peerDependencies,
|
|
51128
|
-
dependencies,
|
|
51129
|
-
publishConfig
|
|
51130
|
-
};
|
|
51131
|
-
let isAmplitudeInitialized = false;
|
|
51132
|
-
const initAmplitude = () => {
|
|
51133
|
-
if (isAmplitudeInitialized) return;
|
|
51134
|
-
init("14616a575f32087cf0403ab8f3ea3ce0", {
|
|
51135
|
-
appVersion: version
|
|
51136
|
-
});
|
|
51137
|
-
isAmplitudeInitialized = true;
|
|
51138
|
-
};
|
|
51139
|
-
const startAmplitudeSessionReplay = () => {
|
|
51140
|
-
if (isAmplitudeInitialized) {
|
|
51141
|
-
const plugin = sessionReplayPlugin({});
|
|
51142
|
-
add(plugin);
|
|
51143
|
-
}
|
|
51144
|
-
};
|
|
51145
51066
|
const SpinnerIcon = (props) => {
|
|
51146
51067
|
return /* @__PURE__ */ jsxs("svg", { fill: "none", viewBox: "0 0 24 24", xmlns: "http://www.w3.org/2000/svg", ...props, children: [
|
|
51147
51068
|
/* @__PURE__ */ jsx("circle", { cx: "12", cy: "12", opacity: ".25", r: "10", stroke: "currentColor", strokeWidth: "4" }),
|
|
@@ -51352,11 +51273,17 @@ const SwapPageHeader = memo(() => {
|
|
|
51352
51273
|
});
|
|
51353
51274
|
const TrackLatestTxHistoryItemStatus = memo(() => {
|
|
51354
51275
|
const transactionhistory = useAtomValue(transactionHistoryAtom);
|
|
51276
|
+
const setOverallStatus = useSetAtom(setOverallStatusAtom);
|
|
51277
|
+
const { transactionsSigned, transactionDetailsArray } = useAtomValue(swapExecutionStateAtom);
|
|
51278
|
+
const { isPending } = useAtomValue(skipSubmitSwapExecutionAtom);
|
|
51355
51279
|
const lastTxHistoryItem = transactionhistory.at(-1);
|
|
51356
|
-
useTxHistory({
|
|
51280
|
+
const { transferAssetRelease } = useTxHistory({
|
|
51357
51281
|
txHistoryItem: lastTxHistoryItem,
|
|
51358
51282
|
index: transactionhistory.length - 1
|
|
51359
51283
|
});
|
|
51284
|
+
if (transferAssetRelease && transactionsSigned !== transactionDetailsArray.length && !isPending) {
|
|
51285
|
+
setOverallStatus("failed");
|
|
51286
|
+
}
|
|
51360
51287
|
return null;
|
|
51361
51288
|
});
|
|
51362
51289
|
const noHistoryItemsAtom = atom$1((get) => {
|
|
@@ -51364,14 +51291,57 @@ const noHistoryItemsAtom = atom$1((get) => {
|
|
|
51364
51291
|
return (txHistoryItems == null ? void 0 : txHistoryItems.length) === 0;
|
|
51365
51292
|
});
|
|
51366
51293
|
const isFetchingLastTransactionStatusAtom = atom$1((get) => {
|
|
51294
|
+
var _a;
|
|
51367
51295
|
const { overallStatus, route: route2, transactionsSigned } = get(swapExecutionStateAtom);
|
|
51368
|
-
|
|
51296
|
+
const lastTxHistoryItem = get(transactionHistoryAtom).at(-1);
|
|
51297
|
+
return overallStatus === "pending" && transactionsSigned === (route2 == null ? void 0 : route2.txsRequired) || (lastTxHistoryItem == null ? void 0 : lastTxHistoryItem.isSettled) !== true && ((_a = lastTxHistoryItem == null ? void 0 : lastTxHistoryItem.route) == null ? void 0 : _a.txsRequired) === 1;
|
|
51369
51298
|
});
|
|
51299
|
+
const useConnectToMissingCosmosChain = () => {
|
|
51300
|
+
const sourceAsset = useAtomValue(sourceAssetAtom);
|
|
51301
|
+
const wallets = useAtomValue(walletsAtom);
|
|
51302
|
+
const extraChainIdsToConnect = useAtomValue(extraCosmosChainIdsToConnectPerWalletAtom);
|
|
51303
|
+
const [isAskingToApproveConnection, setIsAskingToApproveConnection] = useState(false);
|
|
51304
|
+
const addExtraChainIdsToConnectForWalletType = useSetAtom(
|
|
51305
|
+
addExtraChainIdsToConnectForWalletTypeAtom
|
|
51306
|
+
);
|
|
51307
|
+
useEffect(() => {
|
|
51308
|
+
const connectToMissingCosmosChain = async () => {
|
|
51309
|
+
var _a;
|
|
51310
|
+
const walletName = (_a = wallets == null ? void 0 : wallets.cosmos) == null ? void 0 : _a.walletName;
|
|
51311
|
+
if (!(sourceAsset == null ? void 0 : sourceAsset.chainId) || !walletName || sourceAsset.isEvm || sourceAsset.isSvm) return;
|
|
51312
|
+
const wallet = getWallet(walletName);
|
|
51313
|
+
const additionalChainIds = extraChainIdsToConnect[walletName] ?? [];
|
|
51314
|
+
const chainIdsToConnect = [...getInitialChainIds(walletName), ...additionalChainIds];
|
|
51315
|
+
if (chainIdsToConnect.includes(sourceAsset.chainId)) return;
|
|
51316
|
+
setIsAskingToApproveConnection(true);
|
|
51317
|
+
try {
|
|
51318
|
+
const chainInfo = getChainInfo$1({ chainId: sourceAsset.chainId });
|
|
51319
|
+
if (chainInfo) {
|
|
51320
|
+
await wallet.experimentalSuggestChain(chainInfo);
|
|
51321
|
+
await connect({
|
|
51322
|
+
chainId: sourceAsset.chainId,
|
|
51323
|
+
walletType: walletName,
|
|
51324
|
+
autoReconnect: false
|
|
51325
|
+
});
|
|
51326
|
+
addExtraChainIdsToConnectForWalletType({
|
|
51327
|
+
walletName,
|
|
51328
|
+
chainId: sourceAsset.chainId
|
|
51329
|
+
});
|
|
51330
|
+
}
|
|
51331
|
+
} finally {
|
|
51332
|
+
setIsAskingToApproveConnection(false);
|
|
51333
|
+
}
|
|
51334
|
+
};
|
|
51335
|
+
connectToMissingCosmosChain();
|
|
51336
|
+
}, [sourceAsset, wallets, extraChainIdsToConnect, addExtraChainIdsToConnectForWalletType]);
|
|
51337
|
+
return { isAskingToApproveConnection };
|
|
51338
|
+
};
|
|
51370
51339
|
const SwapPage = () => {
|
|
51371
51340
|
var _a;
|
|
51372
51341
|
const { SettingsFooter, drawerOpen } = useSettingsDrawer();
|
|
51373
51342
|
useAtom(onRouteUpdatedEffect);
|
|
51374
|
-
useAtom(
|
|
51343
|
+
useAtom(preloadSigningStargateClientEffect);
|
|
51344
|
+
const { isAskingToApproveConnection } = useConnectToMissingCosmosChain();
|
|
51375
51345
|
const [sourceAsset, setSourceAsset] = useAtom(sourceAssetAtom);
|
|
51376
51346
|
const setSourceAssetAmount = useSetAtom(sourceAssetAmountAtom);
|
|
51377
51347
|
const setDestinationAssetAmount = useSetAtom(destinationAssetAmountAtom);
|
|
@@ -51394,6 +51364,7 @@ const SwapPage = () => {
|
|
|
51394
51364
|
const slippage = useAtomValue(slippageAtom);
|
|
51395
51365
|
const maxAmountMinusFees = useMaxAmountTokenMinusFees();
|
|
51396
51366
|
const getBalance = useGetBalance();
|
|
51367
|
+
const callbacks = useAtomValue(callbacksAtom);
|
|
51397
51368
|
const setChainAddresses = useSetAtom(chainAddressesAtom);
|
|
51398
51369
|
useFetchAllBalances();
|
|
51399
51370
|
useCleanupDebouncedAtoms();
|
|
@@ -51420,65 +51391,92 @@ const SwapPage = () => {
|
|
|
51420
51391
|
NiceModal.show(Modals.AssetAndChainSelectorModal, {
|
|
51421
51392
|
context: "source",
|
|
51422
51393
|
onSelect: (asset) => {
|
|
51394
|
+
var _a2;
|
|
51423
51395
|
track("swap page: source asset selected", { asset });
|
|
51424
51396
|
setSourceAsset((old) => ({
|
|
51425
51397
|
...old,
|
|
51426
51398
|
...asset
|
|
51427
51399
|
}));
|
|
51400
|
+
(_a2 = callbacks == null ? void 0 : callbacks.onSourceAssetUpdated) == null ? void 0 : _a2.call(callbacks, { chainId: asset == null ? void 0 : asset.chainId, denom: asset == null ? void 0 : asset.denom });
|
|
51428
51401
|
switchEvmchainId(asset == null ? void 0 : asset.chainId);
|
|
51429
51402
|
setSourceAssetAmount("");
|
|
51430
51403
|
setDestinationAssetAmount("");
|
|
51431
51404
|
NiceModal.hide(Modals.AssetAndChainSelectorModal);
|
|
51432
51405
|
}
|
|
51433
51406
|
});
|
|
51434
|
-
}, [
|
|
51407
|
+
}, [
|
|
51408
|
+
callbacks,
|
|
51409
|
+
setDestinationAssetAmount,
|
|
51410
|
+
setSourceAsset,
|
|
51411
|
+
setSourceAssetAmount,
|
|
51412
|
+
switchEvmchainId
|
|
51413
|
+
]);
|
|
51435
51414
|
const handleChangeSourceChain = useCallback(() => {
|
|
51436
51415
|
track("swap page: source chain button - clicked");
|
|
51437
51416
|
NiceModal.show(Modals.AssetAndChainSelectorModal, {
|
|
51438
51417
|
context: "source",
|
|
51439
51418
|
onSelect: (asset) => {
|
|
51419
|
+
var _a2;
|
|
51440
51420
|
track("swap page: source chain selected", { asset });
|
|
51441
51421
|
setSourceAsset((old) => ({
|
|
51442
51422
|
...old,
|
|
51443
51423
|
...asset
|
|
51444
51424
|
}));
|
|
51425
|
+
(_a2 = callbacks == null ? void 0 : callbacks.onSourceAssetUpdated) == null ? void 0 : _a2.call(callbacks, { chainId: asset == null ? void 0 : asset.chainId, denom: asset == null ? void 0 : asset.denom });
|
|
51445
51426
|
switchEvmchainId(asset == null ? void 0 : asset.chainId);
|
|
51446
51427
|
NiceModal.hide(Modals.AssetAndChainSelectorModal);
|
|
51447
51428
|
},
|
|
51448
51429
|
selectedAsset: getClientAsset(sourceAsset == null ? void 0 : sourceAsset.denom, sourceAsset == null ? void 0 : sourceAsset.chainId),
|
|
51449
51430
|
selectChain: true
|
|
51450
51431
|
});
|
|
51451
|
-
}, [
|
|
51432
|
+
}, [
|
|
51433
|
+
callbacks,
|
|
51434
|
+
getClientAsset,
|
|
51435
|
+
setSourceAsset,
|
|
51436
|
+
sourceAsset == null ? void 0 : sourceAsset.chainId,
|
|
51437
|
+
sourceAsset == null ? void 0 : sourceAsset.denom,
|
|
51438
|
+
switchEvmchainId
|
|
51439
|
+
]);
|
|
51452
51440
|
const handleChangeDestinationAsset = useCallback(() => {
|
|
51453
51441
|
track("swap page: destination asset button - clicked");
|
|
51454
51442
|
NiceModal.show(Modals.AssetAndChainSelectorModal, {
|
|
51455
51443
|
context: "destination",
|
|
51456
51444
|
onSelect: (asset) => {
|
|
51445
|
+
var _a2;
|
|
51457
51446
|
track("swap page: destination asset selected", { asset });
|
|
51458
51447
|
setDestinationAsset((old) => ({
|
|
51459
51448
|
...old,
|
|
51460
51449
|
...asset
|
|
51461
51450
|
}));
|
|
51451
|
+
(_a2 = callbacks == null ? void 0 : callbacks.onDestinationAssetUpdated) == null ? void 0 : _a2.call(callbacks, { chainId: asset == null ? void 0 : asset.chainId, denom: asset == null ? void 0 : asset.denom });
|
|
51462
51452
|
NiceModal.hide(Modals.AssetAndChainSelectorModal);
|
|
51463
51453
|
}
|
|
51464
51454
|
});
|
|
51465
|
-
}, [setDestinationAsset]);
|
|
51455
|
+
}, [callbacks, setDestinationAsset]);
|
|
51466
51456
|
const handleChangeDestinationChain = useCallback(() => {
|
|
51467
51457
|
track("swap page: destination chain button - clicked");
|
|
51468
51458
|
NiceModal.show(Modals.AssetAndChainSelectorModal, {
|
|
51469
51459
|
context: "destination",
|
|
51470
51460
|
onSelect: (asset) => {
|
|
51461
|
+
var _a2;
|
|
51471
51462
|
track("swap page: destination chain selected", { asset });
|
|
51472
51463
|
setDestinationAsset((old) => ({
|
|
51473
51464
|
...old,
|
|
51474
51465
|
...asset
|
|
51475
51466
|
}));
|
|
51467
|
+
(_a2 = callbacks == null ? void 0 : callbacks.onDestinationAssetUpdated) == null ? void 0 : _a2.call(callbacks, { chainId: asset == null ? void 0 : asset.chainId, denom: asset == null ? void 0 : asset.denom });
|
|
51476
51468
|
NiceModal.hide(Modals.AssetAndChainSelectorModal);
|
|
51477
51469
|
},
|
|
51478
51470
|
selectedAsset: getClientAsset(destinationAsset == null ? void 0 : destinationAsset.denom, destinationAsset == null ? void 0 : destinationAsset.chainId),
|
|
51479
51471
|
selectChain: true
|
|
51480
51472
|
});
|
|
51481
|
-
}, [
|
|
51473
|
+
}, [
|
|
51474
|
+
callbacks,
|
|
51475
|
+
destinationAsset == null ? void 0 : destinationAsset.chainId,
|
|
51476
|
+
destinationAsset == null ? void 0 : destinationAsset.denom,
|
|
51477
|
+
getClientAsset,
|
|
51478
|
+
setDestinationAsset
|
|
51479
|
+
]);
|
|
51482
51480
|
const priceChangePercentage = useMemo(() => {
|
|
51483
51481
|
if (!(route2 == null ? void 0 : route2.usdAmountIn) || !(route2 == null ? void 0 : route2.usdAmountOut) || isWaitingForNewRoute) {
|
|
51484
51482
|
return;
|
|
@@ -51488,6 +51486,9 @@ const SwapPage = () => {
|
|
|
51488
51486
|
const swapButton = useMemo(() => {
|
|
51489
51487
|
var _a2;
|
|
51490
51488
|
const computeFontSize = (label) => label.length > 36 ? 18 : 24;
|
|
51489
|
+
if (isAskingToApproveConnection) {
|
|
51490
|
+
return /* @__PURE__ */ jsx(MainButton, { label: "Approving connection...", loading: true });
|
|
51491
|
+
}
|
|
51491
51492
|
if (!(sourceAccount == null ? void 0 : sourceAccount.address) && !isInvertingSwap) {
|
|
51492
51493
|
return /* @__PURE__ */ jsx(
|
|
51493
51494
|
MainButton,
|
|
@@ -51614,7 +51615,6 @@ const SwapPage = () => {
|
|
|
51614
51615
|
setCurrentPage(Routes.SwapExecutionPage);
|
|
51615
51616
|
setUser({ username: sourceAccount == null ? void 0 : sourceAccount.address });
|
|
51616
51617
|
if (sourceAccount == null ? void 0 : sourceAccount.address) {
|
|
51617
|
-
startAmplitudeSessionReplay();
|
|
51618
51618
|
const replay = getReplay();
|
|
51619
51619
|
replay == null ? void 0 : replay.start();
|
|
51620
51620
|
}
|
|
@@ -51630,11 +51630,12 @@ const SwapPage = () => {
|
|
|
51630
51630
|
}
|
|
51631
51631
|
);
|
|
51632
51632
|
}, [
|
|
51633
|
+
isAskingToApproveConnection,
|
|
51634
|
+
sourceAccount == null ? void 0 : sourceAccount.address,
|
|
51635
|
+
isInvertingSwap,
|
|
51633
51636
|
sourceAsset == null ? void 0 : sourceAsset.chainId,
|
|
51634
51637
|
sourceAsset == null ? void 0 : sourceAsset.amount,
|
|
51635
51638
|
sourceAsset == null ? void 0 : sourceAsset.denom,
|
|
51636
|
-
sourceAccount == null ? void 0 : sourceAccount.address,
|
|
51637
|
-
isInvertingSwap,
|
|
51638
51639
|
destinationAsset == null ? void 0 : destinationAsset.chainId,
|
|
51639
51640
|
destinationAsset == null ? void 0 : destinationAsset.amount,
|
|
51640
51641
|
isWaitingForNewRoute,
|
|
@@ -51644,14 +51645,14 @@ const SwapPage = () => {
|
|
|
51644
51645
|
isSwapOperation,
|
|
51645
51646
|
route2,
|
|
51646
51647
|
routeError == null ? void 0 : routeError.message,
|
|
51648
|
+
getBalance,
|
|
51649
|
+
maxAmountMinusFees,
|
|
51647
51650
|
routePreference,
|
|
51648
51651
|
slippage,
|
|
51649
51652
|
showCosmosLedgerWarning,
|
|
51650
51653
|
showGoFastWarning,
|
|
51651
51654
|
isGoFast,
|
|
51652
|
-
maxAmountMinusFees,
|
|
51653
51655
|
setChainAddresses,
|
|
51654
|
-
getBalance,
|
|
51655
51656
|
setCurrentPage,
|
|
51656
51657
|
setSwapExecutionState,
|
|
51657
51658
|
setError
|
|
@@ -52843,7 +52844,7 @@ const useInitDefaultRoute = (defaultRoute) => {
|
|
|
52843
52844
|
let isSentryInitialized = false;
|
|
52844
52845
|
const initSentry = () => {
|
|
52845
52846
|
if (isSentryInitialized) return;
|
|
52846
|
-
init
|
|
52847
|
+
init({
|
|
52847
52848
|
dsn: "https://10ce608bdd1c68a13d3849d6b242333c@o4504768725909504.ingest.us.sentry.io/4508485201231872",
|
|
52848
52849
|
tunnel: "https://go.skip.build/api/sentry",
|
|
52849
52850
|
defaultIntegrations: false,
|
|
@@ -52868,6 +52869,163 @@ const initSentry = () => {
|
|
|
52868
52869
|
});
|
|
52869
52870
|
isSentryInitialized = true;
|
|
52870
52871
|
};
|
|
52872
|
+
const name = "@skip-go/widget";
|
|
52873
|
+
const description = "Swap widget";
|
|
52874
|
+
const version = "3.11.0";
|
|
52875
|
+
const repository = {
|
|
52876
|
+
url: "https://github.com/skip-mev/skip-go",
|
|
52877
|
+
directory: "packages/widget"
|
|
52878
|
+
};
|
|
52879
|
+
const type = "module";
|
|
52880
|
+
const scripts = {
|
|
52881
|
+
dev: "vite --force --host",
|
|
52882
|
+
"dev:storybook": "storybook dev -p 6006",
|
|
52883
|
+
build: "npm run generate-chains && NODE_OPTIONS=--max-old-space-size=16384 vite build",
|
|
52884
|
+
"watch:build": "vite build --watch",
|
|
52885
|
+
lint: "NODE_OPTIONS=--max-old-space-size=32384 eslint . --fix",
|
|
52886
|
+
preview: "vite preview",
|
|
52887
|
+
"build:web-component": "NODE_OPTIONS=--max-old-space-size=32384 webpack --config webpack.config.js",
|
|
52888
|
+
"publish:web-component": "npm run build:web-component && cd web-component && npm publish && cd ..",
|
|
52889
|
+
prepack: "yarn run pre",
|
|
52890
|
+
postpack: "yarn run post",
|
|
52891
|
+
pre: "npm run build && node scripts/prepublish.cjs",
|
|
52892
|
+
post: "git checkout -- package.json",
|
|
52893
|
+
"generate-chains": "node scripts/generate-chains.cjs",
|
|
52894
|
+
"update-registries": "yarn up @initia/initia-registry chain-registry",
|
|
52895
|
+
test: "yarn playwright test"
|
|
52896
|
+
};
|
|
52897
|
+
const exports = {
|
|
52898
|
+
".": {
|
|
52899
|
+
types: "./build/index.d.ts",
|
|
52900
|
+
"import": "./build/index.js"
|
|
52901
|
+
}
|
|
52902
|
+
};
|
|
52903
|
+
const types = "./build/index.d.ts";
|
|
52904
|
+
const files = [
|
|
52905
|
+
"build",
|
|
52906
|
+
"README.md"
|
|
52907
|
+
];
|
|
52908
|
+
const devDependencies = {
|
|
52909
|
+
"@chromatic-com/storybook": "^1.6.1",
|
|
52910
|
+
"@eslint/js": "^9.9.0",
|
|
52911
|
+
"@initia/initia-registry": "^1.0.6",
|
|
52912
|
+
"@keplr-wallet/types": "^0.12.125",
|
|
52913
|
+
"@playwright/test": "^1.51.1",
|
|
52914
|
+
"@storybook/addon-essentials": "^8.2.6",
|
|
52915
|
+
"@storybook/addon-interactions": "^8.2.6",
|
|
52916
|
+
"@storybook/addon-links": "^8.2.6",
|
|
52917
|
+
"@storybook/addon-onboarding": "^8.2.6",
|
|
52918
|
+
"@storybook/blocks": "^8.2.6",
|
|
52919
|
+
"@storybook/react": "^8.2.6",
|
|
52920
|
+
"@storybook/react-vite": "^8.2.6",
|
|
52921
|
+
"@storybook/test": "^8.2.6",
|
|
52922
|
+
"@testing-library/dom": "^10.4.0",
|
|
52923
|
+
"@testing-library/react": "^16.2.0",
|
|
52924
|
+
"@types/eslint__js": "^8.42.3",
|
|
52925
|
+
"@types/pluralize": "^0.0.33",
|
|
52926
|
+
"@types/react": "^19.0.10",
|
|
52927
|
+
"@types/react-dom": "^19.0.4",
|
|
52928
|
+
"@typescript-eslint/eslint-plugin": "^7.15.0",
|
|
52929
|
+
"@typescript-eslint/parser": "^7.15.0",
|
|
52930
|
+
"@vitejs/plugin-react": "^4.3.1",
|
|
52931
|
+
buffer: "^6.0.3",
|
|
52932
|
+
"chain-registry": "^1.69.222",
|
|
52933
|
+
download: "^8.0.0",
|
|
52934
|
+
eslint: "^9.9.0",
|
|
52935
|
+
"eslint-config-prettier": "^9.1.0",
|
|
52936
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
52937
|
+
"eslint-plugin-react-hooks": "^4.6.2",
|
|
52938
|
+
"fs-extra": "^11.3.0",
|
|
52939
|
+
"node-polyfill-webpack-plugin": "^4.0.0",
|
|
52940
|
+
"pino-pretty": "^13.0.0",
|
|
52941
|
+
"postcss-loader": "^8.1.1",
|
|
52942
|
+
prettier: "^3.4.2",
|
|
52943
|
+
process: "^0.11.10",
|
|
52944
|
+
"raw-loader": "^4.0.2",
|
|
52945
|
+
react: ">=17.0.0",
|
|
52946
|
+
"react-dom": ">=17.0.0",
|
|
52947
|
+
starknet: "6.11.0",
|
|
52948
|
+
storybook: "^8.2.6",
|
|
52949
|
+
"ts-loader": "^9.5.1",
|
|
52950
|
+
typescript: "^5.5.4",
|
|
52951
|
+
"typescript-eslint": "^8.2.0",
|
|
52952
|
+
"url-loader": "^4.1.1",
|
|
52953
|
+
vite: "^5.3.4",
|
|
52954
|
+
"vite-plugin-dts": "^4.0.0-beta.1",
|
|
52955
|
+
"vite-plugin-node-polyfills": "^0.22.0",
|
|
52956
|
+
webpack: "^5.94.0",
|
|
52957
|
+
"webpack-cli": "^5.1.4"
|
|
52958
|
+
};
|
|
52959
|
+
const peerDependencies = {
|
|
52960
|
+
"@tanstack/react-query": "^5.51.21",
|
|
52961
|
+
react: ">=17.0.0",
|
|
52962
|
+
"react-dom": ">=17.0.0",
|
|
52963
|
+
viem: "^2.21.55",
|
|
52964
|
+
wagmi: "^2.14.1"
|
|
52965
|
+
};
|
|
52966
|
+
const dependencies = {
|
|
52967
|
+
"@amplitude/analytics-browser": "^2.11.12",
|
|
52968
|
+
"@amplitude/plugin-session-replay-browser": "^1.16.5",
|
|
52969
|
+
"@cosmjs/amino": "0.33.1",
|
|
52970
|
+
"@cosmjs/cosmwasm-stargate": "0.33.1",
|
|
52971
|
+
"@cosmjs/encoding": "0.33.1",
|
|
52972
|
+
"@cosmjs/math": "0.33.1",
|
|
52973
|
+
"@cosmjs/proto-signing": "0.33.1",
|
|
52974
|
+
"@cosmjs/stargate": "0.33.1",
|
|
52975
|
+
"@ebay/nice-modal-react": "^1.2.13",
|
|
52976
|
+
"@eslint/compat": "^1.1.1",
|
|
52977
|
+
"@penumbra-zone/bech32m": "^13.0.0",
|
|
52978
|
+
"@penumbra-zone/client": "^24.0.0",
|
|
52979
|
+
"@penumbra-zone/protobuf": "^7.2.0",
|
|
52980
|
+
"@penumbra-zone/transport-dom": "^7.5.0",
|
|
52981
|
+
"@r2wc/react-to-web-component": "^2.0.3",
|
|
52982
|
+
"@sentry/react": "^8.46.0",
|
|
52983
|
+
"@skip-go/client": "workspace:^",
|
|
52984
|
+
"@solana/spl-token": "^0.4.8",
|
|
52985
|
+
"@solana/wallet-adapter-backpack": "^0.1.14",
|
|
52986
|
+
"@solana/wallet-adapter-coinbase": "^0.1.19",
|
|
52987
|
+
"@solana/wallet-adapter-ledger": "^0.9.25",
|
|
52988
|
+
"@solana/wallet-adapter-phantom": "^0.9.24",
|
|
52989
|
+
"@solana/wallet-adapter-solflare": "^0.6.28",
|
|
52990
|
+
"@solana/wallet-adapter-trust": "^0.1.13",
|
|
52991
|
+
"@solana/web3.js": "^1.95.8",
|
|
52992
|
+
"@tanstack/query-core": "^5.51.21",
|
|
52993
|
+
"@walletconnect/modal": "^2.7.0",
|
|
52994
|
+
"@walletconnect/sign-client": "^2.20.3",
|
|
52995
|
+
"@walletconnect/solana-adapter": "^0.0.8",
|
|
52996
|
+
add: "^2.0.6",
|
|
52997
|
+
bech32: "^2.0.0",
|
|
52998
|
+
graz: "0.3.2",
|
|
52999
|
+
jotai: "^2.10.1",
|
|
53000
|
+
"jotai-effect": "^1.0.2",
|
|
53001
|
+
"jotai-tanstack-query": "^0.8.6",
|
|
53002
|
+
"lodash.debounce": "^4.0.8",
|
|
53003
|
+
pluralize: "^8.0.0",
|
|
53004
|
+
"rc-virtual-list": "^3.14.5",
|
|
53005
|
+
"react-error-boundary": "^4.0.13",
|
|
53006
|
+
"react-shadow-scope": "^1.0.5",
|
|
53007
|
+
"styled-components": "^6.1.13",
|
|
53008
|
+
yarn: "^1.22.22",
|
|
53009
|
+
zod: "^3.23.8"
|
|
53010
|
+
};
|
|
53011
|
+
const publishConfig = {
|
|
53012
|
+
access: "public"
|
|
53013
|
+
};
|
|
53014
|
+
const packageJson = {
|
|
53015
|
+
name,
|
|
53016
|
+
description,
|
|
53017
|
+
version,
|
|
53018
|
+
repository,
|
|
53019
|
+
type,
|
|
53020
|
+
scripts,
|
|
53021
|
+
exports,
|
|
53022
|
+
types,
|
|
53023
|
+
files,
|
|
53024
|
+
devDependencies,
|
|
53025
|
+
peerDependencies,
|
|
53026
|
+
dependencies,
|
|
53027
|
+
publishConfig
|
|
53028
|
+
};
|
|
52871
53029
|
const useMobileRouteConfig = () => {
|
|
52872
53030
|
const isMobile2 = useIsMobileScreenSize();
|
|
52873
53031
|
const setRouteConfig = useSetAtom(routeConfigAtom);
|
|
@@ -52878,6 +53036,15 @@ const useMobileRouteConfig = () => {
|
|
|
52878
53036
|
}));
|
|
52879
53037
|
}, [isMobile2, setRouteConfig]);
|
|
52880
53038
|
};
|
|
53039
|
+
const initAmplitude = () => {
|
|
53040
|
+
init$1("14616a575f32087cf0403ab8f3ea3ce0", {
|
|
53041
|
+
appVersion: version
|
|
53042
|
+
});
|
|
53043
|
+
const plugin = sessionReplayPlugin({
|
|
53044
|
+
sampleRate: 1
|
|
53045
|
+
});
|
|
53046
|
+
add(plugin);
|
|
53047
|
+
};
|
|
52881
53048
|
const useInitWidget = (props) => {
|
|
52882
53049
|
var _a, _b;
|
|
52883
53050
|
if (props.enableSentrySessionReplays) {
|
|
@@ -52901,6 +53068,7 @@ const useInitWidget = (props) => {
|
|
|
52901
53068
|
const setWalletConnect = useSetAtom(walletConnectAtom);
|
|
52902
53069
|
const setCallbacks = useSetAtom(callbacksAtom);
|
|
52903
53070
|
const setSimulateTx = useSetAtom(simulateTxAtom);
|
|
53071
|
+
const setBatchSignTxs = useSetAtom(batchSignTxsAtom);
|
|
52904
53072
|
const setDisableShadowDom = useSetAtom(disableShadowDomAtom);
|
|
52905
53073
|
const setIbcEurekaHighlightedAssets = useSetAtom(ibcEurekaHighlightedAssetsAtom);
|
|
52906
53074
|
const setAssetSymbolsSortedToTop = useSetAtom(assetSymbolsSortedToTopAtom);
|
|
@@ -52978,6 +53146,9 @@ const useInitWidget = (props) => {
|
|
|
52978
53146
|
if (props.simulate !== void 0) {
|
|
52979
53147
|
setSimulateTx(props.simulate);
|
|
52980
53148
|
}
|
|
53149
|
+
if (props.batchSignTxs !== void 0) {
|
|
53150
|
+
setBatchSignTxs(props.batchSignTxs);
|
|
53151
|
+
}
|
|
52981
53152
|
if (props.disableShadowDom !== void 0) {
|
|
52982
53153
|
setDisableShadowDom(props.disableShadowDom);
|
|
52983
53154
|
}
|
|
@@ -52997,7 +53168,9 @@ const useInitWidget = (props) => {
|
|
|
52997
53168
|
onTransactionComplete: props.onTransactionComplete,
|
|
52998
53169
|
onTransactionFailed: props.onTransactionFailed,
|
|
52999
53170
|
onRouteUpdated: props.onRouteUpdated,
|
|
53000
|
-
onSourceAndDestinationSwapped: props.onSourceAndDestinationSwapped
|
|
53171
|
+
onSourceAndDestinationSwapped: props.onSourceAndDestinationSwapped,
|
|
53172
|
+
onSourceAssetUpdated: props.onSourceAssetUpdated,
|
|
53173
|
+
onDestinationAssetUpdated: props.onDestinationAssetUpdated
|
|
53001
53174
|
};
|
|
53002
53175
|
if (Object.values(callbacks).some((callback) => callback !== void 0)) {
|
|
53003
53176
|
setCallbacks(callbacks);
|
|
@@ -53035,7 +53208,11 @@ const useInitWidget = (props) => {
|
|
|
53035
53208
|
setHideAssetsUnlessWalletTypeConnected,
|
|
53036
53209
|
props.filterOutUnlessUserHasBalance,
|
|
53037
53210
|
setFilterOutUnlessUserHasBalanceAtom,
|
|
53038
|
-
props.onSourceAndDestinationSwapped
|
|
53211
|
+
props.onSourceAndDestinationSwapped,
|
|
53212
|
+
props.onSourceAssetUpdated,
|
|
53213
|
+
props.onDestinationAssetUpdated,
|
|
53214
|
+
props.batchSignTxs,
|
|
53215
|
+
setBatchSignTxs
|
|
53039
53216
|
]);
|
|
53040
53217
|
return { theme: mergedTheme };
|
|
53041
53218
|
};
|
|
@@ -53061,10 +53238,22 @@ const migrateOldLocalStorageValues = () => {
|
|
|
53061
53238
|
const raw = localStorage.getItem(key);
|
|
53062
53239
|
if (!raw) return;
|
|
53063
53240
|
const parsed = JSON.parse(raw);
|
|
53064
|
-
|
|
53065
|
-
if (
|
|
53066
|
-
|
|
53067
|
-
|
|
53241
|
+
let newLocalStorageValue = toCamelCase(parsed);
|
|
53242
|
+
if (key === LOCAL_STORAGE_KEYS.transactionHistory) {
|
|
53243
|
+
newLocalStorageValue = newLocalStorageValue.filter(
|
|
53244
|
+
(txHistoryItem) => {
|
|
53245
|
+
var _a, _b, _c, _d;
|
|
53246
|
+
const chainId = (_b = (_a = txHistoryItem == null ? void 0 : txHistoryItem.transactionDetails) == null ? void 0 : _a[0]) == null ? void 0 : _b.chainId;
|
|
53247
|
+
const txHash = (_d = (_c = txHistoryItem == null ? void 0 : txHistoryItem.transactionDetails) == null ? void 0 : _c[0]) == null ? void 0 : _d.txHash;
|
|
53248
|
+
if (chainId !== void 0 && txHash !== void 0) {
|
|
53249
|
+
return true;
|
|
53250
|
+
}
|
|
53251
|
+
}
|
|
53252
|
+
);
|
|
53253
|
+
}
|
|
53254
|
+
if (JSON.stringify(parsed) !== JSON.stringify(newLocalStorageValue)) {
|
|
53255
|
+
localStorage.setItem(key, JSON.stringify(newLocalStorageValue));
|
|
53256
|
+
console.info("updated old localStorage values");
|
|
53068
53257
|
}
|
|
53069
53258
|
} catch (err) {
|
|
53070
53259
|
console.warn(`Failed to migrate localStorage key "${key}":`, err);
|
|
@@ -53184,5 +53373,6 @@ export {
|
|
|
53184
53373
|
lightTheme as l,
|
|
53185
53374
|
openAssetAndChainSelectorModal as o,
|
|
53186
53375
|
process$1 as p,
|
|
53187
|
-
resetWidget as r
|
|
53376
|
+
resetWidget as r,
|
|
53377
|
+
setAsset as s
|
|
53188
53378
|
};
|