@kimafinance/kima-transaction-widget 1.5.30 → 1.5.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -18
- package/dist/index.cjs +1106 -999
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +139 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.cts +15 -58
- package/dist/index.d.ts +15 -58
- package/dist/index.js +1021 -916
- package/dist/index.js.map +1 -1
- package/dist/metafile-cjs.json +1 -1
- package/dist/metafile-esm.json +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -49,8 +49,6 @@ __export(index_exports, {
|
|
|
49
49
|
NetworkOptions: () => NetworkOptions,
|
|
50
50
|
SOLANA_HOST: () => SOLANA_HOST,
|
|
51
51
|
TransactionStatus: () => TransactionStatus,
|
|
52
|
-
isSolProvider: () => isSolProvider,
|
|
53
|
-
isTronProvider: () => isTronProvider,
|
|
54
52
|
lightDemoAccounts: () => lightDemoAccounts,
|
|
55
53
|
lightDemoNetworks: () => lightDemoNetworks
|
|
56
54
|
});
|
|
@@ -61,8 +59,6 @@ var React4 = __toESM(require("react"), 1);
|
|
|
61
59
|
var import_react44 = require("react");
|
|
62
60
|
var import_react_redux31 = require("react-redux");
|
|
63
61
|
var import_react_query17 = require("@tanstack/react-query");
|
|
64
|
-
var import_web310 = require("@solana/web3.js");
|
|
65
|
-
var import_ethers3 = require("ethers");
|
|
66
62
|
|
|
67
63
|
// src/shared/types/app.ts
|
|
68
64
|
var NetworkOptions = /* @__PURE__ */ ((NetworkOptions3) => {
|
|
@@ -3745,16 +3741,6 @@ var TransactionStatus = /* @__PURE__ */ ((TransactionStatus2) => {
|
|
|
3745
3741
|
return TransactionStatus2;
|
|
3746
3742
|
})(TransactionStatus || {});
|
|
3747
3743
|
|
|
3748
|
-
// src/shared/types/providers.ts
|
|
3749
|
-
var import_web32 = require("@solana/web3.js");
|
|
3750
|
-
var import_tronweb = require("tronweb");
|
|
3751
|
-
var isSolProvider = (provider) => {
|
|
3752
|
-
return provider && provider.connection instanceof import_web32.Connection && typeof provider.signTransaction === "function";
|
|
3753
|
-
};
|
|
3754
|
-
var isTronProvider = (provider) => {
|
|
3755
|
-
return provider && provider.tronWeb instanceof import_tronweb.TronWeb && typeof provider.signTransaction === "function";
|
|
3756
|
-
};
|
|
3757
|
-
|
|
3758
3744
|
// src/shared/types/plugin.ts
|
|
3759
3745
|
var ChainCompatibility = /* @__PURE__ */ ((ChainCompatibility2) => {
|
|
3760
3746
|
ChainCompatibility2["BTC"] = "BTC";
|
|
@@ -3823,7 +3809,8 @@ var getEnvOptions = async ({
|
|
|
3823
3809
|
env: "testnet" /* testnet */,
|
|
3824
3810
|
kimaExplorer: "https://explorer.sardis.kima.network",
|
|
3825
3811
|
paymentPartnerId: "KimaTest",
|
|
3826
|
-
transferLimitMaxUSDT: null
|
|
3812
|
+
transferLimitMaxUSDT: null,
|
|
3813
|
+
backendVersion: null
|
|
3827
3814
|
};
|
|
3828
3815
|
return response;
|
|
3829
3816
|
};
|
|
@@ -3836,73 +3823,6 @@ var useGetEnvOptions = ({
|
|
|
3836
3823
|
});
|
|
3837
3824
|
};
|
|
3838
3825
|
|
|
3839
|
-
// src/shared/lib/bigint.ts
|
|
3840
|
-
var import_viem = require("viem");
|
|
3841
|
-
|
|
3842
|
-
// src/shared/lib/format.ts
|
|
3843
|
-
var formatterInt = new Intl.NumberFormat("en-US", {
|
|
3844
|
-
maximumFractionDigits: 0
|
|
3845
|
-
});
|
|
3846
|
-
var formatterFloat = new Intl.NumberFormat("en-US", {
|
|
3847
|
-
maximumFractionDigits: 6,
|
|
3848
|
-
useGrouping: false
|
|
3849
|
-
});
|
|
3850
|
-
|
|
3851
|
-
// src/shared/lib/bigint.ts
|
|
3852
|
-
var import_ethers = require("ethers");
|
|
3853
|
-
var import_web33 = require("@solana/web3.js");
|
|
3854
|
-
var bigIntToNumber = (inputs) => {
|
|
3855
|
-
const { value, decimals } = inputs || {};
|
|
3856
|
-
if (!value || !decimals) return 0;
|
|
3857
|
-
const valBigInt = BigInt(value);
|
|
3858
|
-
const valNumberStr = (0, import_viem.formatUnits)(valBigInt, decimals);
|
|
3859
|
-
return Number(valNumberStr);
|
|
3860
|
-
};
|
|
3861
|
-
var bigIntChangeDecimals = (inputs) => {
|
|
3862
|
-
const { value, decimals, newDecimals } = inputs || {};
|
|
3863
|
-
const valBigInt = BigInt(value);
|
|
3864
|
-
if (decimals === newDecimals) return { value: valBigInt, decimals };
|
|
3865
|
-
if (decimals > newDecimals) {
|
|
3866
|
-
const diff2 = decimals - newDecimals;
|
|
3867
|
-
return { value: valBigInt / 10n ** BigInt(diff2), decimals: newDecimals };
|
|
3868
|
-
}
|
|
3869
|
-
const diff = newDecimals - decimals;
|
|
3870
|
-
return { value: valBigInt * 10n ** BigInt(diff), decimals: newDecimals };
|
|
3871
|
-
};
|
|
3872
|
-
var formatBigInt = (inputs) => {
|
|
3873
|
-
return formatterFloat.format(bigIntToNumber(inputs));
|
|
3874
|
-
};
|
|
3875
|
-
var toBigintAmount = (data) => {
|
|
3876
|
-
return {
|
|
3877
|
-
// bigint values constructed from numbers can have rounding errors!
|
|
3878
|
-
// so need to convert to string and then to bigint
|
|
3879
|
-
value: BigInt(data.value.toString()),
|
|
3880
|
-
decimals: data.decimals
|
|
3881
|
-
};
|
|
3882
|
-
};
|
|
3883
|
-
var isValidExternalProvider = (externalProvider) => {
|
|
3884
|
-
const { type, provider, signer } = externalProvider;
|
|
3885
|
-
if (type === "evm") {
|
|
3886
|
-
if (!(provider instanceof import_ethers.BrowserProvider) || !(signer instanceof import_ethers.JsonRpcSigner))
|
|
3887
|
-
return false;
|
|
3888
|
-
}
|
|
3889
|
-
if (type === "solana") {
|
|
3890
|
-
if (!isSolProvider(provider) || !(signer instanceof import_web33.PublicKey))
|
|
3891
|
-
return false;
|
|
3892
|
-
}
|
|
3893
|
-
if (type === "tron") {
|
|
3894
|
-
if (!isTronProvider(provider) || typeof signer !== "string")
|
|
3895
|
-
return false;
|
|
3896
|
-
}
|
|
3897
|
-
if (type === "btc") {
|
|
3898
|
-
const btcSigner = signer;
|
|
3899
|
-
const hasAddress = typeof btcSigner === "string" || typeof btcSigner === "object" && typeof btcSigner.address === "string";
|
|
3900
|
-
if (!hasAddress) return false;
|
|
3901
|
-
if (provider && typeof provider !== "object") return false;
|
|
3902
|
-
}
|
|
3903
|
-
return true;
|
|
3904
|
-
};
|
|
3905
|
-
|
|
3906
3826
|
// src/shared/logger.ts
|
|
3907
3827
|
var import_loglevel = __toESM(require("loglevel"), 1);
|
|
3908
3828
|
var import_meta = {};
|
|
@@ -4563,35 +4483,124 @@ var isAddressCompatible = (address, shortName) => {
|
|
|
4563
4483
|
var getFeeSideValues = (feeDeduct, transactionValues) => feeDeduct ? transactionValues.feeFromTarget : transactionValues.feeFromOrigin;
|
|
4564
4484
|
|
|
4565
4485
|
// src/features/allowances/evm/useApproveErc20.ts
|
|
4566
|
-
var
|
|
4486
|
+
var import_ethers = require("ethers");
|
|
4567
4487
|
|
|
4568
4488
|
// src/features/connect-wallet/evm/useEvmAddress.ts
|
|
4569
4489
|
var import_react = require("react");
|
|
4570
4490
|
var import_react2 = require("@reown/appkit/react");
|
|
4571
4491
|
var useEvmAddress = (mode) => {
|
|
4572
|
-
const { externalProvider } = useKimaContext();
|
|
4573
4492
|
const { address: appkitAddress } = (0, import_react2.useAppKitAccount)() || {};
|
|
4574
4493
|
return (0, import_react.useMemo)(() => {
|
|
4575
4494
|
if (mode === "light" /* light */) return lightDemoAccounts.EVM;
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
}, [mode, externalProvider, appkitAddress]);
|
|
4495
|
+
return appkitAddress || "";
|
|
4496
|
+
}, [mode, appkitAddress]);
|
|
4579
4497
|
};
|
|
4580
4498
|
|
|
4581
4499
|
// src/features/allowances/evm/useApproveErc20.ts
|
|
4582
4500
|
var import_react6 = require("@reown/appkit/react");
|
|
4583
4501
|
|
|
4502
|
+
// src/features/connect-wallet/evm/appkit.ts
|
|
4503
|
+
var import_detect_provider = __toESM(require("@metamask/detect-provider"), 1);
|
|
4504
|
+
var getAppKitEip1193Provider = (appkitProvider) => {
|
|
4505
|
+
const provider = appkitProvider;
|
|
4506
|
+
if (provider?.request) return provider;
|
|
4507
|
+
const nestedProvider = provider?.provider;
|
|
4508
|
+
if (nestedProvider?.request) return nestedProvider;
|
|
4509
|
+
return null;
|
|
4510
|
+
};
|
|
4511
|
+
var describeAppKitProvider = (appkitProvider) => {
|
|
4512
|
+
const provider = appkitProvider;
|
|
4513
|
+
const nestedProvider = provider?.provider;
|
|
4514
|
+
return {
|
|
4515
|
+
hasDirectRequest: typeof provider?.request === "function",
|
|
4516
|
+
hasDirectSend: typeof provider?.send === "function",
|
|
4517
|
+
directConstructor: provider?.constructor && typeof provider.constructor === "function" ? provider.constructor.name : void 0,
|
|
4518
|
+
directKeys: provider ? Object.keys(provider).slice(0, 12) : [],
|
|
4519
|
+
hasNestedProvider: !!nestedProvider,
|
|
4520
|
+
hasNestedRequest: typeof nestedProvider?.request === "function",
|
|
4521
|
+
hasNestedSend: typeof nestedProvider?.send === "function",
|
|
4522
|
+
nestedConstructor: nestedProvider?.constructor && typeof nestedProvider.constructor === "function" ? nestedProvider.constructor.name : void 0,
|
|
4523
|
+
nestedKeys: nestedProvider ? Object.keys(nestedProvider).slice(0, 12) : []
|
|
4524
|
+
};
|
|
4525
|
+
};
|
|
4526
|
+
var readAppKitRpcDebug = async (provider) => {
|
|
4527
|
+
const out = {};
|
|
4528
|
+
try {
|
|
4529
|
+
out.ethChainId = await provider.request?.({ method: "eth_chainId" });
|
|
4530
|
+
} catch (err) {
|
|
4531
|
+
out.ethChainIdError = String(err?.message ?? err);
|
|
4532
|
+
}
|
|
4533
|
+
try {
|
|
4534
|
+
out.ethAccounts = await provider.request?.({ method: "eth_accounts" });
|
|
4535
|
+
} catch (err) {
|
|
4536
|
+
out.ethAccountsError = String(err?.message ?? err);
|
|
4537
|
+
}
|
|
4538
|
+
return out;
|
|
4539
|
+
};
|
|
4540
|
+
var isMetaMaskWalletInfo = (walletInfo) => {
|
|
4541
|
+
const name = String(walletInfo?.name ?? "").toLowerCase();
|
|
4542
|
+
const rdns = String(walletInfo?.rdns ?? "").toLowerCase();
|
|
4543
|
+
return name.includes("metamask") || rdns.includes("metamask");
|
|
4544
|
+
};
|
|
4545
|
+
var isUsableMetaMaskInjectedProvider = (provider) => !!provider?.request && provider?.isMetaMask === true && provider?.isTronLink !== true;
|
|
4546
|
+
var getDirectMetaMaskProvider = async () => {
|
|
4547
|
+
if (typeof window === "undefined") {
|
|
4548
|
+
return { provider: null, source: "none" };
|
|
4549
|
+
}
|
|
4550
|
+
const ethereum = window?.ethereum;
|
|
4551
|
+
const providerFromList = Array.isArray(ethereum?.providers) ? ethereum.providers.find(isUsableMetaMaskInjectedProvider) : null;
|
|
4552
|
+
if (providerFromList) {
|
|
4553
|
+
return { provider: providerFromList, source: "metamask-window" };
|
|
4554
|
+
}
|
|
4555
|
+
try {
|
|
4556
|
+
const detected = await (0, import_detect_provider.default)({
|
|
4557
|
+
mustBeMetaMask: true,
|
|
4558
|
+
silent: true,
|
|
4559
|
+
timeout: 300
|
|
4560
|
+
});
|
|
4561
|
+
if (isUsableMetaMaskInjectedProvider(detected)) {
|
|
4562
|
+
return { provider: detected, source: "metamask-detect" };
|
|
4563
|
+
}
|
|
4564
|
+
} catch {
|
|
4565
|
+
}
|
|
4566
|
+
if (isUsableMetaMaskInjectedProvider(ethereum)) {
|
|
4567
|
+
return { provider: ethereum, source: "metamask-window" };
|
|
4568
|
+
}
|
|
4569
|
+
return {
|
|
4570
|
+
provider: null,
|
|
4571
|
+
source: "none"
|
|
4572
|
+
};
|
|
4573
|
+
};
|
|
4574
|
+
var getPreferredEvmWriteProvider = async ({
|
|
4575
|
+
appkitProvider,
|
|
4576
|
+
walletInfo
|
|
4577
|
+
}) => {
|
|
4578
|
+
if (isMetaMaskWalletInfo(walletInfo)) {
|
|
4579
|
+
const metamask = await getDirectMetaMaskProvider();
|
|
4580
|
+
if (metamask.provider) {
|
|
4581
|
+
return {
|
|
4582
|
+
provider: metamask.provider,
|
|
4583
|
+
source: metamask.source
|
|
4584
|
+
};
|
|
4585
|
+
}
|
|
4586
|
+
}
|
|
4587
|
+
return {
|
|
4588
|
+
provider: getAppKitEip1193Provider(appkitProvider),
|
|
4589
|
+
source: "appkit"
|
|
4590
|
+
};
|
|
4591
|
+
};
|
|
4592
|
+
|
|
4584
4593
|
// src/features/allowances/evm/useEvmSignPermit2.ts
|
|
4585
4594
|
var import_react3 = require("react");
|
|
4586
4595
|
var import_react_redux = require("react-redux");
|
|
4587
4596
|
var import_react4 = require("@reown/appkit/react");
|
|
4588
|
-
var
|
|
4597
|
+
var import_viem = require("viem");
|
|
4589
4598
|
var safeEnv2 = typeof process !== "undefined" && process.env || {};
|
|
4590
4599
|
var DEFAULT_TTL_SECONDS = 3600;
|
|
4591
4600
|
var rawPermitTtl = safeEnv2.KIMA_PERMIT2_TTL_SECONDS || safeEnv2.NEXT_PUBLIC_KIMA_PERMIT2_TTL_SECONDS || safeEnv2.VITE_KIMA_PERMIT2_TTL_SECONDS;
|
|
4592
4601
|
var parsedPermitTtl = Number.parseInt(String(rawPermitTtl ?? ""), 10);
|
|
4593
4602
|
var PERMIT2_TTL_SECONDS = Number.isInteger(parsedPermitTtl) && parsedPermitTtl > 0 ? parsedPermitTtl : DEFAULT_TTL_SECONDS;
|
|
4594
|
-
var permitAbi = (0,
|
|
4603
|
+
var permitAbi = (0, import_viem.parseAbi)([
|
|
4595
4604
|
"function name() view returns (string)",
|
|
4596
4605
|
"function nonces(address owner) view returns (uint256)"
|
|
4597
4606
|
]);
|
|
@@ -4639,28 +4648,28 @@ var useEvmSignPermit2 = () => {
|
|
|
4639
4648
|
if (!tokenAddress || !poolAddress || allowanceNeeded <= 0n) {
|
|
4640
4649
|
throw new Error("Permit signing data is incomplete");
|
|
4641
4650
|
}
|
|
4642
|
-
if (!(0,
|
|
4651
|
+
if (!(0, import_viem.isAddress)(tokenAddress) || !(0, import_viem.isAddress)(poolAddress)) {
|
|
4643
4652
|
throw new Error("Invalid token or spender address");
|
|
4644
4653
|
}
|
|
4645
|
-
const eip1193 = appkitProvider
|
|
4654
|
+
const eip1193 = getAppKitEip1193Provider(appkitProvider);
|
|
4646
4655
|
if (!eip1193?.request) {
|
|
4647
|
-
throw new Error("No EIP-1193 provider available");
|
|
4656
|
+
throw new Error("No AppKit EIP-1193 provider available");
|
|
4648
4657
|
}
|
|
4649
4658
|
const preferredAccount = userAddress && userAddress !== "" ? userAddress : appkitAddress;
|
|
4650
|
-
const walletClient = (0,
|
|
4659
|
+
const walletClient = (0, import_viem.createWalletClient)({
|
|
4651
4660
|
account: preferredAccount,
|
|
4652
4661
|
chain: sourceChain,
|
|
4653
|
-
transport: (0,
|
|
4662
|
+
transport: (0, import_viem.custom)(eip1193)
|
|
4654
4663
|
});
|
|
4655
4664
|
const fallbackAccount = (await walletClient.getAddresses())?.[0];
|
|
4656
4665
|
const account = preferredAccount || fallbackAccount;
|
|
4657
|
-
if (!account || !(0,
|
|
4666
|
+
if (!account || !(0, import_viem.isAddress)(account)) {
|
|
4658
4667
|
throw new Error("No connected EVM account");
|
|
4659
4668
|
}
|
|
4660
4669
|
const rpc = sourceChain?.rpcUrls?.default?.http?.[0];
|
|
4661
|
-
const publicClient = (0,
|
|
4670
|
+
const publicClient = (0, import_viem.createPublicClient)({
|
|
4662
4671
|
chain: sourceChain,
|
|
4663
|
-
transport: (0,
|
|
4672
|
+
transport: (0, import_viem.http)(rpc)
|
|
4664
4673
|
});
|
|
4665
4674
|
const [tokenNameRaw, nonce] = await Promise.all([
|
|
4666
4675
|
publicClient.readContract({
|
|
@@ -4769,6 +4778,7 @@ var useEvmSignPermit2 = () => {
|
|
|
4769
4778
|
};
|
|
4770
4779
|
|
|
4771
4780
|
// src/features/allowances/evm/useApproveErc20.ts
|
|
4781
|
+
var erc20ApproveAbi = ["function approve(address spender, uint256 amount)"];
|
|
4772
4782
|
var useApproveErc20 = () => {
|
|
4773
4783
|
const dispatch = (0, import_react_redux2.useDispatch)();
|
|
4774
4784
|
const qc = (0, import_react_query3.useQueryClient)();
|
|
@@ -4796,9 +4806,19 @@ var useApproveErc20 = () => {
|
|
|
4796
4806
|
);
|
|
4797
4807
|
const userAddress = useEvmAddress(mode);
|
|
4798
4808
|
const { address: appkitAddress } = (0, import_react6.useAppKitAccount)() || {};
|
|
4799
|
-
const {
|
|
4809
|
+
const { walletInfo } = (0, import_react6.useWalletInfo)();
|
|
4810
|
+
const { walletProvider: appkitProvider, walletProviderType } = (0, import_react6.useAppKitProvider)("eip155");
|
|
4800
4811
|
const approve = (0, import_react5.useCallback)(
|
|
4801
4812
|
async (isCancel = false) => {
|
|
4813
|
+
const approvalDebug = {
|
|
4814
|
+
walletProviderType,
|
|
4815
|
+
provider: describeAppKitProvider(appkitProvider),
|
|
4816
|
+
walletInfo,
|
|
4817
|
+
sourceChainId: sourceChain?.id,
|
|
4818
|
+
sourceChainName: sourceChain?.name,
|
|
4819
|
+
tokenAddress,
|
|
4820
|
+
poolAddress
|
|
4821
|
+
};
|
|
4802
4822
|
try {
|
|
4803
4823
|
if (isPermit2Required) {
|
|
4804
4824
|
if (isCancel) {
|
|
@@ -4816,36 +4836,47 @@ var useApproveErc20 = () => {
|
|
|
4816
4836
|
});
|
|
4817
4837
|
return;
|
|
4818
4838
|
}
|
|
4819
|
-
const eip1193 =
|
|
4839
|
+
const { provider: eip1193, source: providerSource } = await getPreferredEvmWriteProvider({
|
|
4840
|
+
appkitProvider,
|
|
4841
|
+
walletInfo
|
|
4842
|
+
});
|
|
4843
|
+
approvalDebug.eip1193Resolved = !!eip1193;
|
|
4844
|
+
approvalDebug.providerSource = providerSource;
|
|
4820
4845
|
if (!eip1193?.request) {
|
|
4821
|
-
|
|
4822
|
-
return;
|
|
4846
|
+
throw new Error("No AppKit EIP-1193 provider available");
|
|
4823
4847
|
}
|
|
4848
|
+
approvalDebug.rpc = await readAppKitRpcDebug(eip1193);
|
|
4824
4849
|
const account = userAddress ?? appkitAddress ?? null;
|
|
4850
|
+
approvalDebug.account = account;
|
|
4825
4851
|
if (!account) {
|
|
4826
4852
|
throw new Error("No connected EVM account");
|
|
4827
4853
|
}
|
|
4828
|
-
const
|
|
4829
|
-
|
|
4830
|
-
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
|
|
4834
|
-
|
|
4835
|
-
|
|
4836
|
-
|
|
4854
|
+
const browserProvider = new import_ethers.BrowserProvider(
|
|
4855
|
+
eip1193,
|
|
4856
|
+
Number(sourceChain.id)
|
|
4857
|
+
);
|
|
4858
|
+
approvalDebug.browserProvider = {
|
|
4859
|
+
constructor: browserProvider.constructor && typeof browserProvider.constructor === "function" ? browserProvider.constructor.name : void 0
|
|
4860
|
+
};
|
|
4861
|
+
const signer = await browserProvider.getSigner(account);
|
|
4862
|
+
approvalDebug.signerAddress = await signer.getAddress();
|
|
4863
|
+
const contract = new import_ethers.Contract(
|
|
4864
|
+
tokenAddress,
|
|
4865
|
+
erc20ApproveAbi,
|
|
4866
|
+
signer
|
|
4867
|
+
);
|
|
4837
4868
|
const finalAmount = isCancel ? 0n : allowanceNeeded;
|
|
4838
|
-
const
|
|
4839
|
-
|
|
4840
|
-
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4844
|
-
|
|
4845
|
-
}
|
|
4869
|
+
const tx = await contract.approve(
|
|
4870
|
+
poolAddress,
|
|
4871
|
+
finalAmount
|
|
4872
|
+
);
|
|
4873
|
+
const hash = tx?.hash;
|
|
4874
|
+
if (!hash) {
|
|
4875
|
+
throw new Error("Approval transaction hash missing");
|
|
4876
|
+
}
|
|
4846
4877
|
logger_default.info("[useApproveErc20] tx sent, waiting receipt", hash);
|
|
4847
|
-
const receipt = await
|
|
4848
|
-
if (receipt.status !==
|
|
4878
|
+
const receipt = await tx.wait();
|
|
4879
|
+
if (!receipt || receipt.status !== 1) {
|
|
4849
4880
|
logger_default.error("[useApproveErc20] tx failed", receipt);
|
|
4850
4881
|
throw new Error("Approval transaction failed");
|
|
4851
4882
|
}
|
|
@@ -4856,6 +4887,7 @@ var useApproveErc20 = () => {
|
|
|
4856
4887
|
if (err?.code === 4001 || /UserRejected/i.test(String(err?.message))) {
|
|
4857
4888
|
err._kimaUserRejected = true;
|
|
4858
4889
|
}
|
|
4890
|
+
logger_default.error("[useApproveErc20] debug", approvalDebug);
|
|
4859
4891
|
logger_default.error("[useApproveErc20] error", err);
|
|
4860
4892
|
throw err;
|
|
4861
4893
|
}
|
|
@@ -4869,6 +4901,8 @@ var useApproveErc20 = () => {
|
|
|
4869
4901
|
signPermit2,
|
|
4870
4902
|
dispatch,
|
|
4871
4903
|
appkitProvider,
|
|
4904
|
+
walletProviderType,
|
|
4905
|
+
walletInfo,
|
|
4872
4906
|
userAddress,
|
|
4873
4907
|
appkitAddress,
|
|
4874
4908
|
qc
|
|
@@ -4881,7 +4915,7 @@ var useApproveErc20 = () => {
|
|
|
4881
4915
|
var import_react7 = require("react");
|
|
4882
4916
|
var import_react_query4 = require("@tanstack/react-query");
|
|
4883
4917
|
var import_react_redux3 = require("react-redux");
|
|
4884
|
-
var
|
|
4918
|
+
var import_viem2 = require("viem");
|
|
4885
4919
|
var useErc20Allowance = () => {
|
|
4886
4920
|
const mode = (0, import_react_redux3.useSelector)(selectMode);
|
|
4887
4921
|
const sourceChain = (0, import_react_redux3.useSelector)(selectSourceChain);
|
|
@@ -4903,7 +4937,7 @@ var useErc20Allowance = () => {
|
|
|
4903
4937
|
const publicClient = (0, import_react7.useMemo)(() => {
|
|
4904
4938
|
const rpc = sourceChain?.rpcUrls?.default?.http?.[0];
|
|
4905
4939
|
if (!rpc) return void 0;
|
|
4906
|
-
return (0,
|
|
4940
|
+
return (0, import_viem2.createPublicClient)({ chain: sourceChain, transport: (0, import_viem2.http)(rpc) });
|
|
4907
4941
|
}, [sourceChain]);
|
|
4908
4942
|
const enabled = !!publicClient && !!owner && !!tokenAddress && !!spender && isEVMChain(sourceChain.shortName);
|
|
4909
4943
|
return (0, import_react_query4.useQuery)({
|
|
@@ -4921,12 +4955,12 @@ var useErc20Allowance = () => {
|
|
|
4921
4955
|
try {
|
|
4922
4956
|
const decimals = await publicClient.readContract({
|
|
4923
4957
|
address: tokenAddress,
|
|
4924
|
-
abi:
|
|
4958
|
+
abi: import_viem2.erc20Abi,
|
|
4925
4959
|
functionName: "decimals"
|
|
4926
4960
|
});
|
|
4927
4961
|
const allowance = await publicClient.readContract({
|
|
4928
4962
|
address: tokenAddress,
|
|
4929
|
-
abi:
|
|
4963
|
+
abi: import_viem2.erc20Abi,
|
|
4930
4964
|
functionName: "allowance",
|
|
4931
4965
|
args: [owner, spender]
|
|
4932
4966
|
});
|
|
@@ -4951,7 +4985,7 @@ var useErc20Allowance = () => {
|
|
|
4951
4985
|
var import_react8 = require("react");
|
|
4952
4986
|
var import_react_redux4 = require("react-redux");
|
|
4953
4987
|
var import_react9 = require("@reown/appkit/react");
|
|
4954
|
-
var
|
|
4988
|
+
var import_viem3 = require("viem");
|
|
4955
4989
|
var useEvmSignMessage = () => {
|
|
4956
4990
|
const mode = (0, import_react_redux4.useSelector)(selectMode);
|
|
4957
4991
|
const sourceChain = (0, import_react_redux4.useSelector)(selectSourceChain);
|
|
@@ -4963,10 +4997,9 @@ var useEvmSignMessage = () => {
|
|
|
4963
4997
|
const { message } = getFeeSideValues(feeDeduct, transactionValues);
|
|
4964
4998
|
const signMessage = (0, import_react8.useCallback)(async () => {
|
|
4965
4999
|
try {
|
|
4966
|
-
const eip1193 = appkitProvider
|
|
5000
|
+
const eip1193 = getAppKitEip1193Provider(appkitProvider);
|
|
4967
5001
|
if (!eip1193?.request) {
|
|
4968
|
-
|
|
4969
|
-
return void 0;
|
|
5002
|
+
throw new Error("No AppKit EIP-1193 provider available");
|
|
4970
5003
|
}
|
|
4971
5004
|
const preferredAccount = userAddress && userAddress !== "" ? userAddress : appkitAddress;
|
|
4972
5005
|
logger_default.debug("[useEvmSignMessage] inputs", {
|
|
@@ -4976,10 +5009,10 @@ var useEvmSignMessage = () => {
|
|
|
4976
5009
|
preferredAccount,
|
|
4977
5010
|
chain: sourceChain
|
|
4978
5011
|
});
|
|
4979
|
-
const walletClient = (0,
|
|
5012
|
+
const walletClient = (0, import_viem3.createWalletClient)({
|
|
4980
5013
|
account: preferredAccount,
|
|
4981
5014
|
chain: sourceChain,
|
|
4982
|
-
transport: (0,
|
|
5015
|
+
transport: (0, import_viem3.custom)(eip1193)
|
|
4983
5016
|
});
|
|
4984
5017
|
const fallbackAccount = (await walletClient.getAddresses())?.[0];
|
|
4985
5018
|
const account = preferredAccount || fallbackAccount;
|
|
@@ -4989,7 +5022,7 @@ var useEvmSignMessage = () => {
|
|
|
4989
5022
|
account,
|
|
4990
5023
|
walletClientAccount: walletClient?.account
|
|
4991
5024
|
});
|
|
4992
|
-
if (!account || !(0,
|
|
5025
|
+
if (!account || !(0, import_viem3.isAddress)(account)) {
|
|
4993
5026
|
logger_default.warn("[useEvmSignMessage] Missing or invalid account", {
|
|
4994
5027
|
preferredAccount,
|
|
4995
5028
|
fallbackAccount
|
|
@@ -5084,139 +5117,9 @@ var useAllowance = () => {
|
|
|
5084
5117
|
};
|
|
5085
5118
|
|
|
5086
5119
|
// src/features/connect-wallet/evm/useEvmProvider.ts
|
|
5087
|
-
var import_ethers2 = require("ethers");
|
|
5088
|
-
var import_react14 = require("@reown/appkit/react");
|
|
5089
|
-
|
|
5090
|
-
// src/app/providers/EvmWalletProvider.tsx
|
|
5091
|
-
var import_react12 = require("react");
|
|
5092
|
-
|
|
5093
|
-
// src/features/connect-wallet/evm/setupAppkit.ts
|
|
5094
5120
|
var import_react11 = require("@reown/appkit/react");
|
|
5095
|
-
var import_appkit_adapter_ethers = require("@reown/appkit-adapter-ethers");
|
|
5096
|
-
var import_networks = require("@reown/appkit/networks");
|
|
5097
|
-
var appKitModel = null;
|
|
5098
|
-
var setupAppKit = (projectId, networkOption) => {
|
|
5099
|
-
if (appKitModel) return appKitModel;
|
|
5100
|
-
const MAINNETS = [
|
|
5101
|
-
import_networks.mainnet,
|
|
5102
|
-
import_networks.bsc,
|
|
5103
|
-
import_networks.polygon,
|
|
5104
|
-
import_networks.base,
|
|
5105
|
-
import_networks.arbitrum,
|
|
5106
|
-
import_networks.optimism,
|
|
5107
|
-
import_networks.avalanche,
|
|
5108
|
-
import_networks.confluxESpace
|
|
5109
|
-
];
|
|
5110
|
-
const TESTNETS = [
|
|
5111
|
-
import_networks.sepolia,
|
|
5112
|
-
import_networks.bscTestnet,
|
|
5113
|
-
import_networks.baseSepolia,
|
|
5114
|
-
import_networks.polygonAmoy,
|
|
5115
|
-
import_networks.arbitrumSepolia,
|
|
5116
|
-
import_networks.optimismSepolia,
|
|
5117
|
-
import_networks.avalancheFuji,
|
|
5118
|
-
import_networks.berachainBepolia,
|
|
5119
|
-
import_networks.confluxESpaceTestnet
|
|
5120
|
-
];
|
|
5121
|
-
const networks = networkOption === "mainnet" /* mainnet */ ? MAINNETS : TESTNETS;
|
|
5122
|
-
appKitModel = (0, import_react11.createAppKit)({
|
|
5123
|
-
adapters: [new import_appkit_adapter_ethers.EthersAdapter()],
|
|
5124
|
-
projectId,
|
|
5125
|
-
networks,
|
|
5126
|
-
metadata: {
|
|
5127
|
-
name: "Kima Transaction Widget",
|
|
5128
|
-
description: "Frontend widget for Kima integration for dApps",
|
|
5129
|
-
url: "https://kima.network",
|
|
5130
|
-
icons: ["https://avatars.githubusercontent.com/u/37784886"]
|
|
5131
|
-
},
|
|
5132
|
-
features: {
|
|
5133
|
-
analytics: false,
|
|
5134
|
-
swaps: false,
|
|
5135
|
-
onramp: false,
|
|
5136
|
-
email: false,
|
|
5137
|
-
socials: false,
|
|
5138
|
-
history: false
|
|
5139
|
-
}
|
|
5140
|
-
});
|
|
5141
|
-
return appKitModel;
|
|
5142
|
-
};
|
|
5143
|
-
|
|
5144
|
-
// src/app/providers/EvmWalletProvider.tsx
|
|
5145
|
-
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
5146
|
-
var EvmWalletProvider = ({
|
|
5147
|
-
children,
|
|
5148
|
-
networkOption,
|
|
5149
|
-
projectId,
|
|
5150
|
-
isLoading
|
|
5151
|
-
}) => {
|
|
5152
|
-
(0, import_react12.useEffect)(() => {
|
|
5153
|
-
if (!isLoading && networkOption && projectId) {
|
|
5154
|
-
setupAppKit(projectId, networkOption);
|
|
5155
|
-
}
|
|
5156
|
-
}, [isLoading, networkOption, projectId]);
|
|
5157
|
-
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_jsx_runtime48.Fragment, { children });
|
|
5158
|
-
};
|
|
5159
|
-
|
|
5160
|
-
// src/app/providers/SolanaWalletProvider.tsx
|
|
5161
|
-
var import_wallet_adapter_react = require("@solana/wallet-adapter-react");
|
|
5162
|
-
var import_wallet_adapter_wallets = require("@solana/wallet-adapter-wallets");
|
|
5163
|
-
var import_web34 = require("@solana/web3.js");
|
|
5164
|
-
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
5165
|
-
var SolanaWalletProvider = ({
|
|
5166
|
-
children,
|
|
5167
|
-
networkOption
|
|
5168
|
-
}) => {
|
|
5169
|
-
const { solRPC } = useKimaContext();
|
|
5170
|
-
const endpoint = networkOption === "testnet" /* testnet */ ? (0, import_web34.clusterApiUrl)("testnet") : solRPC ?? "https://go.getblock.us/86aac42ad4484f3c813079afc201451c";
|
|
5171
|
-
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_wallet_adapter_react.ConnectionProvider, { endpoint, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
5172
|
-
import_wallet_adapter_react.WalletProvider,
|
|
5173
|
-
{
|
|
5174
|
-
autoConnect: false,
|
|
5175
|
-
wallets: [
|
|
5176
|
-
new import_wallet_adapter_wallets.PhantomWalletAdapter(),
|
|
5177
|
-
new import_wallet_adapter_wallets.SolflareWalletAdapter(),
|
|
5178
|
-
new import_wallet_adapter_wallets.CloverWalletAdapter(),
|
|
5179
|
-
new import_wallet_adapter_wallets.Coin98WalletAdapter(),
|
|
5180
|
-
new import_wallet_adapter_wallets.SolongWalletAdapter(),
|
|
5181
|
-
new import_wallet_adapter_wallets.TorusWalletAdapter()
|
|
5182
|
-
],
|
|
5183
|
-
children
|
|
5184
|
-
}
|
|
5185
|
-
) });
|
|
5186
|
-
};
|
|
5187
|
-
|
|
5188
|
-
// src/app/providers/TronWalletProvider.tsx
|
|
5189
|
-
var import_react13 = require("react");
|
|
5190
|
-
var import_tronwallet_adapter_react_hooks = require("@tronweb3/tronwallet-adapter-react-hooks");
|
|
5191
|
-
var import_tronwallet_adapter_ledger = require("@tronweb3/tronwallet-adapter-ledger");
|
|
5192
|
-
var import_tronwallet_adapter_tronlink = require("@tronweb3/tronwallet-adapter-tronlink");
|
|
5193
|
-
var import_tronwallet_adapter_okxwallet = require("@tronweb3/tronwallet-adapter-okxwallet");
|
|
5194
|
-
var import_tronwallet_adapter_tokenpocket = require("@tronweb3/tronwallet-adapter-tokenpocket");
|
|
5195
|
-
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
5196
|
-
var TronWalletProvider = ({ children }) => {
|
|
5197
|
-
const adapters = (0, import_react13.useMemo)(
|
|
5198
|
-
() => [
|
|
5199
|
-
new import_tronwallet_adapter_tronlink.TronLinkAdapter(),
|
|
5200
|
-
new import_tronwallet_adapter_ledger.LedgerAdapter({ accountNumber: 2 }),
|
|
5201
|
-
new import_tronwallet_adapter_tokenpocket.TokenPocketAdapter(),
|
|
5202
|
-
new import_tronwallet_adapter_okxwallet.OkxWalletAdapter()
|
|
5203
|
-
],
|
|
5204
|
-
[]
|
|
5205
|
-
);
|
|
5206
|
-
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_tronwallet_adapter_react_hooks.WalletProvider, { adapters, autoConnect: false, children });
|
|
5207
|
-
};
|
|
5208
|
-
|
|
5209
|
-
// src/features/connect-wallet/evm/useEvmProvider.ts
|
|
5210
5121
|
var useEvmProvider = () => {
|
|
5211
|
-
const {
|
|
5212
|
-
const { walletProvider: appkitProvider } = (0, import_react14.useAppKitProvider)("eip155");
|
|
5213
|
-
if (externalProvider?.type === "evm" && externalProvider.provider instanceof import_ethers2.BrowserProvider) {
|
|
5214
|
-
return {
|
|
5215
|
-
provider: externalProvider.provider,
|
|
5216
|
-
signer: externalProvider.signer,
|
|
5217
|
-
address: externalProvider.signer?.address
|
|
5218
|
-
};
|
|
5219
|
-
}
|
|
5122
|
+
const { walletProvider: appkitProvider } = (0, import_react11.useAppKitProvider)("eip155");
|
|
5220
5123
|
if (appkitProvider) {
|
|
5221
5124
|
return { provider: appkitProvider };
|
|
5222
5125
|
}
|
|
@@ -5224,9 +5127,9 @@ var useEvmProvider = () => {
|
|
|
5224
5127
|
};
|
|
5225
5128
|
|
|
5226
5129
|
// src/features/connect-wallet/evm/useIsWalletReady.ts
|
|
5227
|
-
var
|
|
5130
|
+
var import_react12 = require("react");
|
|
5228
5131
|
var import_react_redux7 = require("react-redux");
|
|
5229
|
-
var
|
|
5132
|
+
var import_react13 = require("@reown/appkit/react");
|
|
5230
5133
|
|
|
5231
5134
|
// src/shared/lib/hooks/useChainData.ts
|
|
5232
5135
|
var import_react_query5 = require("@tanstack/react-query");
|
|
@@ -5280,7 +5183,7 @@ function getChainAndTokensOptions(chains) {
|
|
|
5280
5183
|
}
|
|
5281
5184
|
|
|
5282
5185
|
// src/features/connect-wallet/evm/switchNetwork.ts
|
|
5283
|
-
var
|
|
5186
|
+
var import_viem4 = require("viem");
|
|
5284
5187
|
var switchNetworkSmart = async ({
|
|
5285
5188
|
chainId,
|
|
5286
5189
|
chains = [],
|
|
@@ -5288,7 +5191,7 @@ var switchNetworkSmart = async ({
|
|
|
5288
5191
|
browserProvider,
|
|
5289
5192
|
appKitSwitch
|
|
5290
5193
|
}) => {
|
|
5291
|
-
const hexId = (0,
|
|
5194
|
+
const hexId = (0, import_viem4.toHex)(chainId);
|
|
5292
5195
|
logger_default.debug("[switchNetworkSmart] start", { chainId, hexId });
|
|
5293
5196
|
const request = async (method, params) => {
|
|
5294
5197
|
if (eip1193?.request) return eip1193.request({ method, params });
|
|
@@ -5315,7 +5218,7 @@ var switchNetworkSmart = async ({
|
|
|
5315
5218
|
decimals: 18
|
|
5316
5219
|
};
|
|
5317
5220
|
const payload = {
|
|
5318
|
-
chainId: (0,
|
|
5221
|
+
chainId: (0, import_viem4.toHex)(net.id),
|
|
5319
5222
|
chainName: net.name,
|
|
5320
5223
|
rpcUrls: rpcUrls.length ? rpcUrls : void 0,
|
|
5321
5224
|
blockExplorerUrls: blockExplorerUrls.length ? blockExplorerUrls : void 0,
|
|
@@ -5372,33 +5275,32 @@ var switchNetworkSmart = async ({
|
|
|
5372
5275
|
// src/features/connect-wallet/evm/useIsWalletReady.ts
|
|
5373
5276
|
var useIsWalletReady = () => {
|
|
5374
5277
|
const dispatch = (0, import_react_redux7.useDispatch)();
|
|
5375
|
-
const { externalProvider } = useKimaContext();
|
|
5376
5278
|
const backendUrl = (0, import_react_redux7.useSelector)(selectBackendUrl);
|
|
5377
5279
|
const mode = (0, import_react_redux7.useSelector)(selectMode);
|
|
5378
5280
|
const sourceChain = (0, import_react_redux7.useSelector)(selectSourceChain);
|
|
5379
5281
|
const { data: chains } = useChainData(backendUrl);
|
|
5380
|
-
const { walletProvider: appkitProvider } = (0,
|
|
5381
|
-
const appkitAccountInfo = (0,
|
|
5382
|
-
const { chainId: walletChainId } = (0,
|
|
5282
|
+
const { walletProvider: appkitProvider } = (0, import_react13.useAppKitProvider)("eip155");
|
|
5283
|
+
const appkitAccountInfo = (0, import_react13.useAppKitAccount)();
|
|
5284
|
+
const { chainId: walletChainId } = (0, import_react13.useAppKitNetwork)();
|
|
5383
5285
|
const { address: walletAddress, isConnected: appkitIsConnected } = appkitAccountInfo || {};
|
|
5384
5286
|
const isConnected = !!appkitIsConnected && walletAddress !== void 0;
|
|
5385
|
-
const [isReady, setIsReady] = (0,
|
|
5386
|
-
const [statusMessage, setStatusMessage] = (0,
|
|
5387
|
-
const [connectedAddress, setConnectedAddress] = (0,
|
|
5388
|
-
const [isSwitching, setIsSwitching] = (0,
|
|
5389
|
-
const trySwitch = (0,
|
|
5287
|
+
const [isReady, setIsReady] = (0, import_react12.useState)(false);
|
|
5288
|
+
const [statusMessage, setStatusMessage] = (0, import_react12.useState)("Wallet not connected");
|
|
5289
|
+
const [connectedAddress, setConnectedAddress] = (0, import_react12.useState)("");
|
|
5290
|
+
const [isSwitching, setIsSwitching] = (0, import_react12.useState)(false);
|
|
5291
|
+
const trySwitch = (0, import_react12.useCallback)(async () => {
|
|
5390
5292
|
if (!sourceChain || sourceChain.compatibility !== "EVM" /* EVM */)
|
|
5391
5293
|
return;
|
|
5392
|
-
const eip1193 =
|
|
5393
|
-
const browserProvider =
|
|
5294
|
+
const eip1193 = getAppKitEip1193Provider(appkitProvider);
|
|
5295
|
+
const browserProvider = appkitProvider || null;
|
|
5394
5296
|
await switchNetworkSmart({
|
|
5395
5297
|
chainId: sourceChain.id,
|
|
5396
5298
|
chains: chains || [],
|
|
5397
5299
|
eip1193,
|
|
5398
5300
|
browserProvider
|
|
5399
5301
|
});
|
|
5400
|
-
}, [sourceChain,
|
|
5401
|
-
const resolveConnection = (0,
|
|
5302
|
+
}, [sourceChain, appkitProvider, chains]);
|
|
5303
|
+
const resolveConnection = (0, import_react12.useCallback)(async () => {
|
|
5402
5304
|
if (mode === "light" /* light */) {
|
|
5403
5305
|
const demoAddress = lightDemoAccounts.EVM;
|
|
5404
5306
|
setIsReady(true);
|
|
@@ -5408,43 +5310,7 @@ var useIsWalletReady = () => {
|
|
|
5408
5310
|
dispatch(setSourceAddress(demoAddress));
|
|
5409
5311
|
return;
|
|
5410
5312
|
}
|
|
5411
|
-
if (
|
|
5412
|
-
try {
|
|
5413
|
-
const provider = externalProvider.provider;
|
|
5414
|
-
const network = await provider.getNetwork();
|
|
5415
|
-
const externalChainId = Number(network.chainId);
|
|
5416
|
-
if (externalChainId === sourceChain.id) {
|
|
5417
|
-
const signer = await provider.getSigner();
|
|
5418
|
-
const externalAddress = await signer.getAddress();
|
|
5419
|
-
setIsReady(true);
|
|
5420
|
-
setConnectedAddress(externalAddress);
|
|
5421
|
-
setStatusMessage("Connected with external provider");
|
|
5422
|
-
setIsSwitching(false);
|
|
5423
|
-
dispatch(setSourceAddress(externalAddress));
|
|
5424
|
-
} else {
|
|
5425
|
-
setIsReady(false);
|
|
5426
|
-
setConnectedAddress("");
|
|
5427
|
-
setStatusMessage("Switching to correct network...");
|
|
5428
|
-
setIsSwitching(true);
|
|
5429
|
-
dispatch(setSourceAddress(""));
|
|
5430
|
-
try {
|
|
5431
|
-
await trySwitch();
|
|
5432
|
-
} finally {
|
|
5433
|
-
setIsSwitching(false);
|
|
5434
|
-
}
|
|
5435
|
-
}
|
|
5436
|
-
return;
|
|
5437
|
-
} catch (error) {
|
|
5438
|
-
logger_default.error("[useIsWalletReady] external provider error", error);
|
|
5439
|
-
setIsReady(false);
|
|
5440
|
-
setConnectedAddress("");
|
|
5441
|
-
setStatusMessage("Failed to connect external provider");
|
|
5442
|
-
setIsSwitching(false);
|
|
5443
|
-
dispatch(setSourceAddress(""));
|
|
5444
|
-
return;
|
|
5445
|
-
}
|
|
5446
|
-
}
|
|
5447
|
-
if (!externalProvider && isConnected) {
|
|
5313
|
+
if (isConnected) {
|
|
5448
5314
|
if (walletChainId === sourceChain?.id) {
|
|
5449
5315
|
setIsReady(true);
|
|
5450
5316
|
setConnectedAddress(walletAddress ?? "");
|
|
@@ -5472,7 +5338,6 @@ var useIsWalletReady = () => {
|
|
|
5472
5338
|
dispatch(setSourceAddress(""));
|
|
5473
5339
|
}, [
|
|
5474
5340
|
mode,
|
|
5475
|
-
externalProvider,
|
|
5476
5341
|
sourceChain,
|
|
5477
5342
|
isConnected,
|
|
5478
5343
|
walletAddress,
|
|
@@ -5480,34 +5345,34 @@ var useIsWalletReady = () => {
|
|
|
5480
5345
|
trySwitch,
|
|
5481
5346
|
dispatch
|
|
5482
5347
|
]);
|
|
5483
|
-
(0,
|
|
5348
|
+
(0, import_react12.useEffect)(() => {
|
|
5484
5349
|
resolveConnection();
|
|
5485
5350
|
}, [resolveConnection]);
|
|
5486
|
-
return (0,
|
|
5351
|
+
return (0, import_react12.useMemo)(
|
|
5487
5352
|
() => ({ isReady, statusMessage, connectedAddress, isSwitching }),
|
|
5488
5353
|
[isReady, statusMessage, connectedAddress, isSwitching]
|
|
5489
5354
|
);
|
|
5490
5355
|
};
|
|
5491
5356
|
|
|
5492
5357
|
// src/features/balances/evm/useErc20Balance.ts
|
|
5493
|
-
var
|
|
5358
|
+
var import_react14 = require("react");
|
|
5494
5359
|
var import_react_query6 = require("@tanstack/react-query");
|
|
5495
5360
|
var import_react_redux8 = require("react-redux");
|
|
5496
|
-
var
|
|
5361
|
+
var import_viem5 = require("viem");
|
|
5497
5362
|
var useErc20Balance = () => {
|
|
5498
5363
|
const mode = (0, import_react_redux8.useSelector)(selectMode);
|
|
5499
5364
|
const sourceChain = (0, import_react_redux8.useSelector)(selectSourceChain);
|
|
5500
5365
|
const selectedCoin = (0, import_react_redux8.useSelector)(selectSourceCurrency);
|
|
5501
5366
|
const tokenOptions = (0, import_react_redux8.useSelector)(selectTokenOptions);
|
|
5502
5367
|
const owner = useEvmAddress(mode);
|
|
5503
|
-
const tokenAddress = (0,
|
|
5368
|
+
const tokenAddress = (0, import_react14.useMemo)(() => {
|
|
5504
5369
|
const a = getTokenAddress(tokenOptions, selectedCoin, sourceChain.shortName);
|
|
5505
5370
|
return a && /^0x[0-9a-fA-F]{40}$/.test(a) ? a : void 0;
|
|
5506
5371
|
}, [tokenOptions, selectedCoin, sourceChain.shortName]);
|
|
5507
|
-
const publicClient = (0,
|
|
5372
|
+
const publicClient = (0, import_react14.useMemo)(() => {
|
|
5508
5373
|
const rpc = sourceChain?.rpcUrls?.default?.http?.[0];
|
|
5509
5374
|
if (!rpc) return void 0;
|
|
5510
|
-
return (0,
|
|
5375
|
+
return (0, import_viem5.createPublicClient)({ chain: sourceChain, transport: (0, import_viem5.http)(rpc) });
|
|
5511
5376
|
}, [sourceChain]);
|
|
5512
5377
|
const enabled = !!publicClient && !!owner && !!tokenAddress && isEVMChain(sourceChain.shortName);
|
|
5513
5378
|
const query = (0, import_react_query6.useQuery)({
|
|
@@ -5525,12 +5390,12 @@ var useErc20Balance = () => {
|
|
|
5525
5390
|
try {
|
|
5526
5391
|
const decimals = await publicClient.readContract({
|
|
5527
5392
|
address: tokenAddress,
|
|
5528
|
-
abi:
|
|
5393
|
+
abi: import_viem5.erc20Abi,
|
|
5529
5394
|
functionName: "decimals"
|
|
5530
5395
|
});
|
|
5531
5396
|
const balance = await publicClient.readContract({
|
|
5532
5397
|
address: tokenAddress,
|
|
5533
|
-
abi:
|
|
5398
|
+
abi: import_viem5.erc20Abi,
|
|
5534
5399
|
functionName: "balanceOf",
|
|
5535
5400
|
args: [owner]
|
|
5536
5401
|
});
|
|
@@ -5557,7 +5422,7 @@ var useErc20Balance = () => {
|
|
|
5557
5422
|
};
|
|
5558
5423
|
|
|
5559
5424
|
// src/features/balances/evm/useEvmNativeBalance.ts
|
|
5560
|
-
var
|
|
5425
|
+
var import_react15 = require("react");
|
|
5561
5426
|
var import_react_query7 = require("@tanstack/react-query");
|
|
5562
5427
|
var import_react_redux9 = require("react-redux");
|
|
5563
5428
|
var useEvmNativeBalance = () => {
|
|
@@ -5565,7 +5430,7 @@ var useEvmNativeBalance = () => {
|
|
|
5565
5430
|
const sourceChain = (0, import_react_redux9.useSelector)(selectSourceChain);
|
|
5566
5431
|
const { provider } = useEvmProvider();
|
|
5567
5432
|
const address = useEvmAddress(mode);
|
|
5568
|
-
const enabled = (0,
|
|
5433
|
+
const enabled = (0, import_react15.useMemo)(
|
|
5569
5434
|
() => !!address && !!provider && isEVMChain(sourceChain.shortName),
|
|
5570
5435
|
[address, provider, sourceChain.shortName]
|
|
5571
5436
|
);
|
|
@@ -5585,39 +5450,140 @@ var useEvmNativeBalance = () => {
|
|
|
5585
5450
|
};
|
|
5586
5451
|
|
|
5587
5452
|
// src/features/connect-wallet/evm/useDisconnectWallet.ts
|
|
5588
|
-
var
|
|
5589
|
-
var
|
|
5453
|
+
var import_react16 = require("react");
|
|
5454
|
+
var import_react17 = require("@reown/appkit/react");
|
|
5590
5455
|
var useDisconnectWallet = () => {
|
|
5591
|
-
const {
|
|
5592
|
-
const
|
|
5593
|
-
const disconnectWallet = (0, import_react19.useCallback)(async () => {
|
|
5594
|
-
try {
|
|
5595
|
-
if (externalProvider?.type === "evm") {
|
|
5596
|
-
const prov = externalProvider.provider;
|
|
5597
|
-
if (typeof prov?.disconnect === "function") {
|
|
5598
|
-
await prov.disconnect();
|
|
5599
|
-
} else if (typeof prov?.provider?.disconnect === "function") {
|
|
5600
|
-
await prov.provider.disconnect();
|
|
5601
|
-
} else if (typeof prov?.request === "function") {
|
|
5602
|
-
try {
|
|
5603
|
-
await prov.request({
|
|
5604
|
-
method: "wallet_revokePermissions",
|
|
5605
|
-
params: [{ eth_accounts: {} }]
|
|
5606
|
-
});
|
|
5607
|
-
} catch {
|
|
5608
|
-
}
|
|
5609
|
-
}
|
|
5610
|
-
}
|
|
5611
|
-
} catch {
|
|
5612
|
-
}
|
|
5456
|
+
const { disconnect: appkitDisconnect } = (0, import_react17.useDisconnect)();
|
|
5457
|
+
const disconnectWallet = (0, import_react16.useCallback)(async () => {
|
|
5613
5458
|
try {
|
|
5614
5459
|
await appkitDisconnect?.();
|
|
5615
5460
|
} catch {
|
|
5616
5461
|
}
|
|
5617
|
-
}, [
|
|
5462
|
+
}, [appkitDisconnect]);
|
|
5618
5463
|
return { disconnectWallet };
|
|
5619
5464
|
};
|
|
5620
5465
|
|
|
5466
|
+
// src/app/providers/EvmWalletProvider.tsx
|
|
5467
|
+
var import_react19 = require("react");
|
|
5468
|
+
|
|
5469
|
+
// src/features/connect-wallet/evm/setupAppkit.ts
|
|
5470
|
+
var import_react18 = require("@reown/appkit/react");
|
|
5471
|
+
var import_appkit_adapter_ethers = require("@reown/appkit-adapter-ethers");
|
|
5472
|
+
var import_networks = require("@reown/appkit/networks");
|
|
5473
|
+
var appKitModel = null;
|
|
5474
|
+
var setupAppKit = (projectId, networkOption) => {
|
|
5475
|
+
if (appKitModel) return appKitModel;
|
|
5476
|
+
const MAINNETS = [
|
|
5477
|
+
import_networks.mainnet,
|
|
5478
|
+
import_networks.bsc,
|
|
5479
|
+
import_networks.polygon,
|
|
5480
|
+
import_networks.base,
|
|
5481
|
+
import_networks.arbitrum,
|
|
5482
|
+
import_networks.optimism,
|
|
5483
|
+
import_networks.avalanche,
|
|
5484
|
+
import_networks.confluxESpace
|
|
5485
|
+
];
|
|
5486
|
+
const TESTNETS = [
|
|
5487
|
+
import_networks.sepolia,
|
|
5488
|
+
import_networks.bscTestnet,
|
|
5489
|
+
import_networks.baseSepolia,
|
|
5490
|
+
import_networks.polygonAmoy,
|
|
5491
|
+
import_networks.arbitrumSepolia,
|
|
5492
|
+
import_networks.optimismSepolia,
|
|
5493
|
+
import_networks.avalancheFuji,
|
|
5494
|
+
import_networks.berachainBepolia,
|
|
5495
|
+
import_networks.confluxESpaceTestnet
|
|
5496
|
+
];
|
|
5497
|
+
const networks = networkOption === "mainnet" /* mainnet */ ? MAINNETS : TESTNETS;
|
|
5498
|
+
appKitModel = (0, import_react18.createAppKit)({
|
|
5499
|
+
adapters: [new import_appkit_adapter_ethers.EthersAdapter()],
|
|
5500
|
+
projectId,
|
|
5501
|
+
networks,
|
|
5502
|
+
enableInjected: true,
|
|
5503
|
+
enableEIP6963: true,
|
|
5504
|
+
metadata: {
|
|
5505
|
+
name: "Kima Transaction Widget",
|
|
5506
|
+
description: "Frontend widget for Kima integration for dApps",
|
|
5507
|
+
url: "https://kima.network",
|
|
5508
|
+
icons: ["https://avatars.githubusercontent.com/u/37784886"]
|
|
5509
|
+
},
|
|
5510
|
+
features: {
|
|
5511
|
+
analytics: false,
|
|
5512
|
+
swaps: false,
|
|
5513
|
+
onramp: false,
|
|
5514
|
+
email: false,
|
|
5515
|
+
socials: false,
|
|
5516
|
+
history: false
|
|
5517
|
+
}
|
|
5518
|
+
});
|
|
5519
|
+
return appKitModel;
|
|
5520
|
+
};
|
|
5521
|
+
|
|
5522
|
+
// src/app/providers/EvmWalletProvider.tsx
|
|
5523
|
+
var import_jsx_runtime48 = require("react/jsx-runtime");
|
|
5524
|
+
var EvmWalletProvider = ({
|
|
5525
|
+
children,
|
|
5526
|
+
networkOption,
|
|
5527
|
+
projectId,
|
|
5528
|
+
isLoading
|
|
5529
|
+
}) => {
|
|
5530
|
+
(0, import_react19.useEffect)(() => {
|
|
5531
|
+
if (!isLoading && networkOption && projectId) {
|
|
5532
|
+
setupAppKit(projectId, networkOption);
|
|
5533
|
+
}
|
|
5534
|
+
}, [isLoading, networkOption, projectId]);
|
|
5535
|
+
return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_jsx_runtime48.Fragment, { children });
|
|
5536
|
+
};
|
|
5537
|
+
|
|
5538
|
+
// src/app/providers/SolanaWalletProvider.tsx
|
|
5539
|
+
var import_wallet_adapter_react = require("@solana/wallet-adapter-react");
|
|
5540
|
+
var import_wallet_adapter_wallets = require("@solana/wallet-adapter-wallets");
|
|
5541
|
+
var import_web32 = require("@solana/web3.js");
|
|
5542
|
+
var import_jsx_runtime49 = require("react/jsx-runtime");
|
|
5543
|
+
var SolanaWalletProvider = ({
|
|
5544
|
+
children,
|
|
5545
|
+
networkOption
|
|
5546
|
+
}) => {
|
|
5547
|
+
const { solRPC } = useKimaContext();
|
|
5548
|
+
const endpoint = networkOption === "testnet" /* testnet */ ? (0, import_web32.clusterApiUrl)("testnet") : solRPC ?? "https://go.getblock.us/86aac42ad4484f3c813079afc201451c";
|
|
5549
|
+
return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_wallet_adapter_react.ConnectionProvider, { endpoint, children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
|
|
5550
|
+
import_wallet_adapter_react.WalletProvider,
|
|
5551
|
+
{
|
|
5552
|
+
autoConnect: false,
|
|
5553
|
+
wallets: [
|
|
5554
|
+
new import_wallet_adapter_wallets.PhantomWalletAdapter(),
|
|
5555
|
+
new import_wallet_adapter_wallets.SolflareWalletAdapter(),
|
|
5556
|
+
new import_wallet_adapter_wallets.CloverWalletAdapter(),
|
|
5557
|
+
new import_wallet_adapter_wallets.Coin98WalletAdapter(),
|
|
5558
|
+
new import_wallet_adapter_wallets.SolongWalletAdapter(),
|
|
5559
|
+
new import_wallet_adapter_wallets.TorusWalletAdapter()
|
|
5560
|
+
],
|
|
5561
|
+
children
|
|
5562
|
+
}
|
|
5563
|
+
) });
|
|
5564
|
+
};
|
|
5565
|
+
|
|
5566
|
+
// src/app/providers/TronWalletProvider.tsx
|
|
5567
|
+
var import_react20 = require("react");
|
|
5568
|
+
var import_tronwallet_adapter_react_hooks = require("@tronweb3/tronwallet-adapter-react-hooks");
|
|
5569
|
+
var import_tronwallet_adapter_ledger = require("@tronweb3/tronwallet-adapter-ledger");
|
|
5570
|
+
var import_tronwallet_adapter_tronlink = require("@tronweb3/tronwallet-adapter-tronlink");
|
|
5571
|
+
var import_tronwallet_adapter_okxwallet = require("@tronweb3/tronwallet-adapter-okxwallet");
|
|
5572
|
+
var import_tronwallet_adapter_tokenpocket = require("@tronweb3/tronwallet-adapter-tokenpocket");
|
|
5573
|
+
var import_jsx_runtime50 = require("react/jsx-runtime");
|
|
5574
|
+
var TronWalletProvider = ({ children }) => {
|
|
5575
|
+
const adapters = (0, import_react20.useMemo)(
|
|
5576
|
+
() => [
|
|
5577
|
+
new import_tronwallet_adapter_tronlink.TronLinkAdapter(),
|
|
5578
|
+
new import_tronwallet_adapter_ledger.LedgerAdapter({ accountNumber: 2 }),
|
|
5579
|
+
new import_tronwallet_adapter_tokenpocket.TokenPocketAdapter(),
|
|
5580
|
+
new import_tronwallet_adapter_okxwallet.OkxWalletAdapter()
|
|
5581
|
+
],
|
|
5582
|
+
[]
|
|
5583
|
+
);
|
|
5584
|
+
return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(import_tronwallet_adapter_react_hooks.WalletProvider, { adapters, autoConnect: false, children });
|
|
5585
|
+
};
|
|
5586
|
+
|
|
5621
5587
|
// src/shared/plugins/createPluginDescriptor.tsx
|
|
5622
5588
|
var createPluginDescriptor = (plugin) => plugin;
|
|
5623
5589
|
|
|
@@ -5652,7 +5618,7 @@ var adapter_default = evmPlugin;
|
|
|
5652
5618
|
// src/features/allowances/solana/useSPLAllowance.ts
|
|
5653
5619
|
var import_react_query8 = require("@tanstack/react-query");
|
|
5654
5620
|
var import_react_redux13 = require("react-redux");
|
|
5655
|
-
var
|
|
5621
|
+
var import_web34 = require("@solana/web3.js");
|
|
5656
5622
|
var import_spl_token2 = require("@solana/spl-token");
|
|
5657
5623
|
|
|
5658
5624
|
// src/features/connect-wallet/solana/useSolAddress.ts
|
|
@@ -5662,31 +5628,15 @@ var import_react_redux11 = require("react-redux");
|
|
|
5662
5628
|
// src/features/connect-wallet/solana/useSolProvider.ts
|
|
5663
5629
|
var import_react21 = require("react");
|
|
5664
5630
|
var import_react_redux10 = require("react-redux");
|
|
5665
|
-
var
|
|
5631
|
+
var import_web33 = require("@solana/web3.js");
|
|
5666
5632
|
var import_wallet_adapter_react2 = require("@solana/wallet-adapter-react");
|
|
5667
5633
|
var useSolProvider = () => {
|
|
5668
5634
|
const net = (0, import_react_redux10.useSelector)(selectNetworkOption);
|
|
5669
|
-
const {
|
|
5635
|
+
const { solRPC } = useKimaContext();
|
|
5670
5636
|
const wallet = (0, import_wallet_adapter_react2.useWallet)();
|
|
5671
5637
|
return (0, import_react21.useMemo)(() => {
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
const signer = externalProvider.signer;
|
|
5675
|
-
const pk2 = signer?.toBase58 ? signer.toBase58() : void 0;
|
|
5676
|
-
logger_default.debug("[useSolProvider] using externalProvider", {
|
|
5677
|
-
hasProvider: !!prov,
|
|
5678
|
-
hasSigner: !!signer,
|
|
5679
|
-
publicKey: pk2
|
|
5680
|
-
});
|
|
5681
|
-
return {
|
|
5682
|
-
connection: prov.connection,
|
|
5683
|
-
publicKey: pk2,
|
|
5684
|
-
signTransaction: prov.signTransaction,
|
|
5685
|
-
signMessage: prov.signMessage
|
|
5686
|
-
};
|
|
5687
|
-
}
|
|
5688
|
-
const endpoint = net === "testnet" /* testnet */ ? (0, import_web35.clusterApiUrl)("devnet") : solRPC ?? "https://solana-rpc.publicnode.com";
|
|
5689
|
-
const connection = new import_web35.Connection(endpoint, "confirmed");
|
|
5638
|
+
const endpoint = net === "testnet" /* testnet */ ? (0, import_web33.clusterApiUrl)("devnet") : solRPC ?? "https://solana-rpc.publicnode.com";
|
|
5639
|
+
const connection = new import_web33.Connection(endpoint, "confirmed");
|
|
5690
5640
|
const pk = wallet.publicKey?.toBase58();
|
|
5691
5641
|
const signTransaction = wallet.signTransaction;
|
|
5692
5642
|
const signMessage = wallet.signMessage;
|
|
@@ -5702,31 +5652,26 @@ var useSolProvider = () => {
|
|
|
5702
5652
|
signTransaction,
|
|
5703
5653
|
signMessage
|
|
5704
5654
|
};
|
|
5705
|
-
}, [
|
|
5655
|
+
}, [net, solRPC, wallet]);
|
|
5706
5656
|
};
|
|
5707
5657
|
|
|
5708
5658
|
// src/features/connect-wallet/solana/useSolAddress.ts
|
|
5709
5659
|
var useSolAddress = () => {
|
|
5710
5660
|
const mode = (0, import_react_redux11.useSelector)(selectMode);
|
|
5711
|
-
const { externalProvider } = useKimaContext();
|
|
5712
5661
|
const { publicKey } = useSolProvider();
|
|
5713
5662
|
return (0, import_react22.useMemo)(() => {
|
|
5714
5663
|
let resolved;
|
|
5715
5664
|
if (mode === "light" /* light */) resolved = lightDemoAccounts.SOL;
|
|
5716
|
-
else if (
|
|
5717
|
-
const pk = externalProvider.signer;
|
|
5718
|
-
resolved = pk?.toBase58 ? pk.toBase58() : void 0;
|
|
5719
|
-
} else if (publicKey) {
|
|
5665
|
+
else if (publicKey) {
|
|
5720
5666
|
resolved = publicKey;
|
|
5721
5667
|
}
|
|
5722
5668
|
logger_default.debug("[useSolAddress] resolved", {
|
|
5723
5669
|
mode,
|
|
5724
|
-
fromExternal: externalProvider?.type === "solana",
|
|
5725
5670
|
fromWalletAdapter: !!publicKey,
|
|
5726
5671
|
address: resolved
|
|
5727
5672
|
});
|
|
5728
5673
|
return resolved;
|
|
5729
|
-
}, [mode,
|
|
5674
|
+
}, [mode, publicKey]);
|
|
5730
5675
|
};
|
|
5731
5676
|
|
|
5732
5677
|
// src/features/connect-wallet/solana/useIsWalletReady.ts
|
|
@@ -5830,7 +5775,7 @@ var useSPLAllowance = () => {
|
|
|
5830
5775
|
const selectedCoin = (0, import_react_redux13.useSelector)(selectSourceCurrency);
|
|
5831
5776
|
const tokenOptions = (0, import_react_redux13.useSelector)(selectTokenOptions);
|
|
5832
5777
|
const { pools } = useGetPools_default(backendUrl, networkOption);
|
|
5833
|
-
const ownerPk = mode === "light" /* light */ ? new
|
|
5778
|
+
const ownerPk = mode === "light" /* light */ ? new import_web34.PublicKey(lightDemoAccounts.SOL) : publicKey ? new import_web34.PublicKey(publicKey) : void 0;
|
|
5834
5779
|
const enabled = !!connection && !!ownerPk && !!selectedCoin && !!tokenOptions && !!pools?.length && sourceChain.shortName === "SOL";
|
|
5835
5780
|
const { data } = (0, import_react_query8.useQuery)({
|
|
5836
5781
|
queryKey: [
|
|
@@ -5866,7 +5811,7 @@ var useSPLAllowance = () => {
|
|
|
5866
5811
|
});
|
|
5867
5812
|
return { allowance: 0n, decimals: 0 };
|
|
5868
5813
|
}
|
|
5869
|
-
const mint = new
|
|
5814
|
+
const mint = new import_web34.PublicKey(mintAddr);
|
|
5870
5815
|
const { programId, isToken2022 } = await getTokenProgramForMint(
|
|
5871
5816
|
connection,
|
|
5872
5817
|
mint
|
|
@@ -5916,7 +5861,7 @@ var useSPLAllowance = () => {
|
|
|
5916
5861
|
var import_react24 = require("react");
|
|
5917
5862
|
var import_react_query9 = require("@tanstack/react-query");
|
|
5918
5863
|
var import_react_redux14 = require("react-redux");
|
|
5919
|
-
var
|
|
5864
|
+
var import_web35 = require("@solana/web3.js");
|
|
5920
5865
|
var import_spl_token3 = require("@solana/spl-token");
|
|
5921
5866
|
var useApproveSPL = () => {
|
|
5922
5867
|
const qc = (0, import_react_query9.useQueryClient)();
|
|
@@ -5930,7 +5875,7 @@ var useApproveSPL = () => {
|
|
|
5930
5875
|
const feeDeduct = (0, import_react_redux14.useSelector)(selectFeeDeduct);
|
|
5931
5876
|
const { allowanceAmount } = getFeeSideValues(feeDeduct, transactionValues);
|
|
5932
5877
|
const allowanceNumber = BigInt(allowanceAmount.value);
|
|
5933
|
-
const ownerPk = mode === "light" /* light */ ? new
|
|
5878
|
+
const ownerPk = mode === "light" /* light */ ? new import_web35.PublicKey(lightDemoAccounts.SOL) : publicKey ? new import_web35.PublicKey(publicKey) : void 0;
|
|
5934
5879
|
const { pools } = useGetPools_default(backendUrl, networkOption);
|
|
5935
5880
|
const approve = (0, import_react24.useCallback)(
|
|
5936
5881
|
async (isCancel = false) => {
|
|
@@ -5942,7 +5887,7 @@ var useApproveSPL = () => {
|
|
|
5942
5887
|
const poolAddress = getPoolAddress(pools, "SOL");
|
|
5943
5888
|
const tokenAddress = getTokenAddress(tokenOptions, selectedCoin, "SOL");
|
|
5944
5889
|
if (!poolAddress || !tokenAddress) return;
|
|
5945
|
-
const mint = new
|
|
5890
|
+
const mint = new import_web35.PublicKey(tokenAddress);
|
|
5946
5891
|
const { programId, isToken2022 } = await getTokenProgramForMint(
|
|
5947
5892
|
connection,
|
|
5948
5893
|
mint
|
|
@@ -5959,14 +5904,14 @@ var useApproveSPL = () => {
|
|
|
5959
5904
|
);
|
|
5960
5905
|
const ix = isCancel ? (0, import_spl_token3.createRevokeInstruction)(ata, ownerPk, [], programId) : (0, import_spl_token3.createApproveInstruction)(
|
|
5961
5906
|
ata,
|
|
5962
|
-
new
|
|
5907
|
+
new import_web35.PublicKey(poolAddress),
|
|
5963
5908
|
ownerPk,
|
|
5964
5909
|
allowanceNumber,
|
|
5965
5910
|
[],
|
|
5966
5911
|
programId
|
|
5967
5912
|
);
|
|
5968
5913
|
const recent = await connection.getLatestBlockhash("finalized");
|
|
5969
|
-
const tx = new
|
|
5914
|
+
const tx = new import_web35.Transaction().add(ix);
|
|
5970
5915
|
tx.feePayer = ownerPk;
|
|
5971
5916
|
tx.recentBlockhash = recent.blockhash;
|
|
5972
5917
|
const signed = await signTransaction(tx);
|
|
@@ -6069,7 +6014,7 @@ var useAllowance2 = () => {
|
|
|
6069
6014
|
|
|
6070
6015
|
// src/features/balances/solana/useSolNativeBalance.ts
|
|
6071
6016
|
var import_react_query10 = require("@tanstack/react-query");
|
|
6072
|
-
var
|
|
6017
|
+
var import_web36 = require("@solana/web3.js");
|
|
6073
6018
|
var import_react_redux17 = require("react-redux");
|
|
6074
6019
|
var useSolNativeBalance = () => {
|
|
6075
6020
|
const { connection } = useSolProvider();
|
|
@@ -6086,7 +6031,7 @@ var useSolNativeBalance = () => {
|
|
|
6086
6031
|
try {
|
|
6087
6032
|
logger_default.debug("[useSolNativeBalance] start", { owner, enabled });
|
|
6088
6033
|
if (!owner) return { balance: 0n, decimals: 9 };
|
|
6089
|
-
const lamports = await connection.getBalance(new
|
|
6034
|
+
const lamports = await connection.getBalance(new import_web36.PublicKey(owner));
|
|
6090
6035
|
const res = { balance: BigInt(lamports), decimals: 9 };
|
|
6091
6036
|
logger_default.debug("[useSolNativeBalance] result", res);
|
|
6092
6037
|
return res;
|
|
@@ -6108,7 +6053,7 @@ var useSolNativeBalance = () => {
|
|
|
6108
6053
|
// src/features/balances/solana/useSolTokenBalance.ts
|
|
6109
6054
|
var import_react_redux18 = require("react-redux");
|
|
6110
6055
|
var import_react_query11 = require("@tanstack/react-query");
|
|
6111
|
-
var
|
|
6056
|
+
var import_web37 = require("@solana/web3.js");
|
|
6112
6057
|
var import_spl_token4 = require("@solana/spl-token");
|
|
6113
6058
|
var getMintAddressForSymbol = (tokenOptions, symbol) => tokenOptions?.[symbol]?.SOL || "";
|
|
6114
6059
|
var useSolTokenBalance = () => {
|
|
@@ -6139,8 +6084,8 @@ var useSolTokenBalance = () => {
|
|
|
6139
6084
|
logger_default.debug("[useSolTokenBalance] missing mint for symbol", { symbol });
|
|
6140
6085
|
return { amount: 0n, decimals: 0 };
|
|
6141
6086
|
}
|
|
6142
|
-
const mint = new
|
|
6143
|
-
const ownerPk = new
|
|
6087
|
+
const mint = new import_web37.PublicKey(mintAddr);
|
|
6088
|
+
const ownerPk = new import_web37.PublicKey(owner);
|
|
6144
6089
|
const { programId, isToken2022 } = await getTokenProgramForMint(
|
|
6145
6090
|
connection,
|
|
6146
6091
|
mint
|
|
@@ -6190,19 +6135,12 @@ var import_react26 = require("react");
|
|
|
6190
6135
|
var import_wallet_adapter_react4 = require("@solana/wallet-adapter-react");
|
|
6191
6136
|
var useDisconnectWallet2 = () => {
|
|
6192
6137
|
const { disconnect: adapterDisconnect } = (0, import_wallet_adapter_react4.useWallet)();
|
|
6193
|
-
const { externalProvider } = useKimaContext();
|
|
6194
6138
|
const disconnectWallet = (0, import_react26.useCallback)(async () => {
|
|
6195
|
-
const maybeExt = externalProvider;
|
|
6196
|
-
const extDisconnect = maybeExt?.disconnect ?? maybeExt?.provider?.disconnect;
|
|
6197
|
-
if (typeof extDisconnect === "function") {
|
|
6198
|
-
await extDisconnect();
|
|
6199
|
-
return;
|
|
6200
|
-
}
|
|
6201
6139
|
if (typeof adapterDisconnect === "function") {
|
|
6202
6140
|
await adapterDisconnect();
|
|
6203
6141
|
return;
|
|
6204
6142
|
}
|
|
6205
|
-
}, [
|
|
6143
|
+
}, [adapterDisconnect]);
|
|
6206
6144
|
return { disconnectWallet };
|
|
6207
6145
|
};
|
|
6208
6146
|
|
|
@@ -6231,11 +6169,11 @@ var import_react27 = require("react");
|
|
|
6231
6169
|
var import_react_redux19 = require("react-redux");
|
|
6232
6170
|
|
|
6233
6171
|
// src/shared/crypto/tron/tronweb.tsx
|
|
6234
|
-
var
|
|
6235
|
-
var tronWebTestnet = new
|
|
6172
|
+
var import_tronweb = require("tronweb");
|
|
6173
|
+
var tronWebTestnet = new import_tronweb.TronWeb({
|
|
6236
6174
|
fullHost: "https://api.nileex.io"
|
|
6237
6175
|
});
|
|
6238
|
-
var tronWebMainnet = new
|
|
6176
|
+
var tronWebMainnet = new import_tronweb.TronWeb({
|
|
6239
6177
|
fullHost: "https://api.trongrid.io"
|
|
6240
6178
|
});
|
|
6241
6179
|
|
|
@@ -6243,7 +6181,6 @@ var tronWebMainnet = new import_tronweb2.TronWeb({
|
|
|
6243
6181
|
var import_tronwallet_adapter_react_hooks2 = require("@tronweb3/tronwallet-adapter-react-hooks");
|
|
6244
6182
|
var useTronProvider = () => {
|
|
6245
6183
|
const net = (0, import_react_redux19.useSelector)(selectNetworkOption);
|
|
6246
|
-
const { externalProvider } = useKimaContext();
|
|
6247
6184
|
const {
|
|
6248
6185
|
connected: adapterConnected,
|
|
6249
6186
|
address: adapterAddr,
|
|
@@ -6254,23 +6191,8 @@ var useTronProvider = () => {
|
|
|
6254
6191
|
const tw = net === "testnet" /* testnet */ ? tronWebTestnet : tronWebMainnet;
|
|
6255
6192
|
logger_default.debug("[useTronProvider] network", {
|
|
6256
6193
|
net,
|
|
6257
|
-
endpoint: tw?.fullHost
|
|
6258
|
-
});
|
|
6259
|
-
if (externalProvider?.type === "tron") {
|
|
6260
|
-
const prov = externalProvider.provider;
|
|
6261
|
-
const addr = externalProvider.signer || void 0;
|
|
6262
|
-
logger_default.debug("[useTronProvider] externalProvider", {
|
|
6263
|
-
hasProvider: !!prov,
|
|
6264
|
-
hasTronWeb: !!prov?.tronWeb,
|
|
6265
|
-
address: addr
|
|
6266
|
-
});
|
|
6267
|
-
return {
|
|
6268
|
-
tronWeb: prov?.tronWeb ?? tw,
|
|
6269
|
-
signTransaction: prov?.signTransaction,
|
|
6270
|
-
signMessage: prov?.signMessage,
|
|
6271
|
-
address: addr
|
|
6272
|
-
};
|
|
6273
|
-
}
|
|
6194
|
+
endpoint: tw?.fullHost
|
|
6195
|
+
});
|
|
6274
6196
|
if (adapterConnected && (adapterSignMessage || adapterSignTransaction)) {
|
|
6275
6197
|
const normalizedAddr = adapterAddr ?? void 0;
|
|
6276
6198
|
logger_default.debug("[useTronProvider] wallet-adapter signer", {
|
|
@@ -6289,7 +6211,6 @@ var useTronProvider = () => {
|
|
|
6289
6211
|
logger_default.debug("[useTronProvider] readonly", { net });
|
|
6290
6212
|
return { tronWeb: tw };
|
|
6291
6213
|
}, [
|
|
6292
|
-
externalProvider,
|
|
6293
6214
|
adapterConnected,
|
|
6294
6215
|
adapterAddr,
|
|
6295
6216
|
adapterSignMessage,
|
|
@@ -6302,25 +6223,21 @@ var useTronProvider = () => {
|
|
|
6302
6223
|
var import_react28 = require("react");
|
|
6303
6224
|
var import_tronwallet_adapter_react_hooks3 = require("@tronweb3/tronwallet-adapter-react-hooks");
|
|
6304
6225
|
var useTronAddress = (mode) => {
|
|
6305
|
-
const { externalProvider } = useKimaContext();
|
|
6306
6226
|
const { address: adapterAddr, connected } = (0, import_tronwallet_adapter_react_hooks3.useWallet)();
|
|
6307
6227
|
return (0, import_react28.useMemo)(() => {
|
|
6308
6228
|
let resolved;
|
|
6309
6229
|
if (mode === "light" /* light */) {
|
|
6310
6230
|
resolved = lightDemoAccounts.TRX;
|
|
6311
|
-
} else if (externalProvider?.type === "tron") {
|
|
6312
|
-
resolved = externalProvider.signer || void 0;
|
|
6313
6231
|
} else if (connected && adapterAddr) {
|
|
6314
6232
|
resolved = adapterAddr;
|
|
6315
6233
|
}
|
|
6316
6234
|
logger_default.debug("[useTronAddress] resolved", {
|
|
6317
6235
|
mode,
|
|
6318
|
-
fromExternal: externalProvider?.type === "tron",
|
|
6319
6236
|
fromAdapter: connected && !!adapterAddr,
|
|
6320
6237
|
address: resolved
|
|
6321
6238
|
});
|
|
6322
6239
|
return resolved;
|
|
6323
|
-
}, [mode,
|
|
6240
|
+
}, [mode, connected, adapterAddr]);
|
|
6324
6241
|
};
|
|
6325
6242
|
|
|
6326
6243
|
// src/features/allowances/tron/useTrc20Allowance.ts
|
|
@@ -7078,19 +6995,12 @@ var import_react36 = require("react");
|
|
|
7078
6995
|
var import_tronwallet_adapter_react_hooks4 = require("@tronweb3/tronwallet-adapter-react-hooks");
|
|
7079
6996
|
var useDisconnectWallet3 = () => {
|
|
7080
6997
|
const { disconnect: adapterDisconnect } = (0, import_tronwallet_adapter_react_hooks4.useWallet)();
|
|
7081
|
-
const { externalProvider } = useKimaContext();
|
|
7082
6998
|
const disconnectWallet = (0, import_react36.useCallback)(async () => {
|
|
7083
|
-
const maybeExt = externalProvider;
|
|
7084
|
-
const extDisconnect = maybeExt?.disconnect ?? maybeExt?.provider?.disconnect;
|
|
7085
|
-
if (typeof extDisconnect === "function") {
|
|
7086
|
-
await extDisconnect();
|
|
7087
|
-
return;
|
|
7088
|
-
}
|
|
7089
6999
|
if (typeof adapterDisconnect === "function") {
|
|
7090
7000
|
await adapterDisconnect();
|
|
7091
7001
|
return;
|
|
7092
7002
|
}
|
|
7093
|
-
}, [
|
|
7003
|
+
}, [adapterDisconnect]);
|
|
7094
7004
|
return { disconnectWallet };
|
|
7095
7005
|
};
|
|
7096
7006
|
|
|
@@ -7215,7 +7125,7 @@ var adapter_default5 = bankPlugin;
|
|
|
7215
7125
|
|
|
7216
7126
|
// src/features/allowances/btc/useAllowance.ts
|
|
7217
7127
|
var import_react39 = require("react");
|
|
7218
|
-
var
|
|
7128
|
+
var import_viem6 = require("viem");
|
|
7219
7129
|
var import_react_redux27 = require("react-redux");
|
|
7220
7130
|
|
|
7221
7131
|
// src/features/connect-wallet/btc/unisat.ts
|
|
@@ -7331,7 +7241,7 @@ var useAllowance6 = () => {
|
|
|
7331
7241
|
if (allowanceSats != null) return allowanceSats;
|
|
7332
7242
|
if (!amount) return 0n;
|
|
7333
7243
|
try {
|
|
7334
|
-
return (0,
|
|
7244
|
+
return (0, import_viem6.parseUnits)(amount, 8);
|
|
7335
7245
|
} catch {
|
|
7336
7246
|
return 0n;
|
|
7337
7247
|
}
|
|
@@ -7979,24 +7889,14 @@ var getBtcAccountFromProvider = async (provider, {
|
|
|
7979
7889
|
// src/features/connect-wallet/btc/useIsWalletReady.ts
|
|
7980
7890
|
var useIsWalletReady6 = () => {
|
|
7981
7891
|
const dispatch = (0, import_react_redux29.useDispatch)();
|
|
7982
|
-
const { externalProvider } = useKimaContext();
|
|
7983
7892
|
const mode = (0, import_react_redux29.useSelector)(selectMode);
|
|
7984
7893
|
const networkOption = (0, import_react_redux29.useSelector)(selectNetworkOption);
|
|
7985
7894
|
const sourceChain = (0, import_react_redux29.useSelector)(selectSourceChain);
|
|
7986
7895
|
const storedAddress = (0, import_react_redux29.useSelector)(selectBitcoinAddress);
|
|
7987
7896
|
const storedPubkey = (0, import_react_redux29.useSelector)(selectBitcoinPubkey);
|
|
7988
7897
|
const resolved = (0, import_react41.useMemo)(() => {
|
|
7989
|
-
if (externalProvider?.type === "btc") {
|
|
7990
|
-
const signer = externalProvider.signer;
|
|
7991
|
-
const address = typeof signer === "string" ? signer : signer?.address ?? "";
|
|
7992
|
-
const providerPubkey = externalProvider.provider?.publicKey ?? externalProvider.provider?.pubkey;
|
|
7993
|
-
const pubkey = normalizeBtcPubkeyHex(
|
|
7994
|
-
typeof signer === "object" && signer?.publicKey || providerPubkey || ""
|
|
7995
|
-
) || "";
|
|
7996
|
-
return { address, pubkey };
|
|
7997
|
-
}
|
|
7998
7898
|
return { address: storedAddress, pubkey: storedPubkey };
|
|
7999
|
-
}, [
|
|
7899
|
+
}, [storedAddress, storedPubkey]);
|
|
8000
7900
|
const addressNetwork = (0, import_react41.useMemo)(
|
|
8001
7901
|
() => getBtcAddressNetwork(resolved.address),
|
|
8002
7902
|
[resolved.address]
|
|
@@ -8036,7 +7936,6 @@ var useIsWalletReady6 = () => {
|
|
|
8036
7936
|
(0, import_react41.useEffect)(() => {
|
|
8037
7937
|
if (mode === "light" /* light */) return;
|
|
8038
7938
|
if (sourceChain.shortName !== "BTC" /* BTC */) return;
|
|
8039
|
-
if (externalProvider?.type === "btc") return;
|
|
8040
7939
|
if (storedAddress) return;
|
|
8041
7940
|
const unisat = getUnisat();
|
|
8042
7941
|
if (!unisat) return;
|
|
@@ -8058,7 +7957,6 @@ var useIsWalletReady6 = () => {
|
|
|
8058
7957
|
}, [
|
|
8059
7958
|
mode,
|
|
8060
7959
|
sourceChain.shortName,
|
|
8061
|
-
externalProvider,
|
|
8062
7960
|
storedAddress,
|
|
8063
7961
|
dispatch
|
|
8064
7962
|
]);
|
|
@@ -8114,14 +8012,7 @@ var import_react42 = require("react");
|
|
|
8114
8012
|
var import_react_redux30 = require("react-redux");
|
|
8115
8013
|
var useDisconnectWallet6 = () => {
|
|
8116
8014
|
const dispatch = (0, import_react_redux30.useDispatch)();
|
|
8117
|
-
const { externalProvider } = useKimaContext();
|
|
8118
8015
|
const disconnectWallet = (0, import_react42.useCallback)(async () => {
|
|
8119
|
-
if (externalProvider?.type === "btc") {
|
|
8120
|
-
const disconnect = externalProvider.provider?.disconnect;
|
|
8121
|
-
if (typeof disconnect === "function") {
|
|
8122
|
-
await disconnect();
|
|
8123
|
-
}
|
|
8124
|
-
}
|
|
8125
8016
|
const unisat = getUnisat();
|
|
8126
8017
|
if (unisat?.disconnect) {
|
|
8127
8018
|
await unisat.disconnect();
|
|
@@ -8130,7 +8021,7 @@ var useDisconnectWallet6 = () => {
|
|
|
8130
8021
|
dispatch(setBitcoinPubkey(""));
|
|
8131
8022
|
dispatch(setBtcWalletType(""));
|
|
8132
8023
|
dispatch(setSourceAddress(""));
|
|
8133
|
-
}, [dispatch
|
|
8024
|
+
}, [dispatch]);
|
|
8134
8025
|
return { disconnectWallet };
|
|
8135
8026
|
};
|
|
8136
8027
|
|
|
@@ -8241,7 +8132,6 @@ var InternalKimaProvider = React4.memo(({ kimaBackendUrl, solRPC, projectId, chi
|
|
|
8241
8132
|
var KimaProvider = ({
|
|
8242
8133
|
projectId = "e579511a495b5c312b572b036e60555a",
|
|
8243
8134
|
children = /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_jsx_runtime58.Fragment, {}),
|
|
8244
|
-
externalProvider,
|
|
8245
8135
|
kimaBackendUrl = "http://localhost:3001",
|
|
8246
8136
|
solRPC,
|
|
8247
8137
|
logLevel,
|
|
@@ -8255,27 +8145,7 @@ var KimaProvider = ({
|
|
|
8255
8145
|
logger_default.debug("KimaProvider: setting log level to:", logLevel);
|
|
8256
8146
|
logger_default.setLevel(logLevel, false);
|
|
8257
8147
|
}
|
|
8258
|
-
let validExternalProvider;
|
|
8259
|
-
let sourceAddress;
|
|
8260
|
-
if (externalProvider && isValidExternalProvider(externalProvider)) {
|
|
8261
|
-
validExternalProvider = externalProvider;
|
|
8262
|
-
if (externalProvider.type === "evm" && externalProvider.signer instanceof import_ethers3.JsonRpcSigner) {
|
|
8263
|
-
sourceAddress = externalProvider.signer.address;
|
|
8264
|
-
}
|
|
8265
|
-
if (externalProvider.type === "solana" && externalProvider.signer instanceof import_web310.PublicKey) {
|
|
8266
|
-
sourceAddress = externalProvider.signer.toBase58();
|
|
8267
|
-
}
|
|
8268
|
-
if (externalProvider.type === "tron" && typeof externalProvider.signer === "string") {
|
|
8269
|
-
sourceAddress = externalProvider.signer;
|
|
8270
|
-
}
|
|
8271
|
-
if (externalProvider.type === "btc") {
|
|
8272
|
-
const btcSigner = externalProvider.signer;
|
|
8273
|
-
sourceAddress = typeof btcSigner === "string" ? btcSigner : btcSigner?.address;
|
|
8274
|
-
}
|
|
8275
|
-
}
|
|
8276
8148
|
const kimaContext = {
|
|
8277
|
-
externalProvider: validExternalProvider,
|
|
8278
|
-
sourceAddress,
|
|
8279
8149
|
solRPC,
|
|
8280
8150
|
kimaBackendUrl,
|
|
8281
8151
|
keplrHandler,
|
|
@@ -8297,7 +8167,7 @@ var KimaProvider = ({
|
|
|
8297
8167
|
var KimaProvider_default = KimaProvider;
|
|
8298
8168
|
|
|
8299
8169
|
// src/widgets/common/KimaTransactionWidget.tsx
|
|
8300
|
-
var
|
|
8170
|
+
var import_react83 = require("react");
|
|
8301
8171
|
var import_react_redux68 = require("react-redux");
|
|
8302
8172
|
|
|
8303
8173
|
// src/assets/loading/180-ring.tsx
|
|
@@ -8710,6 +8580,49 @@ var CopyButton = ({ text }) => {
|
|
|
8710
8580
|
};
|
|
8711
8581
|
var CopyButton_default = CopyButton;
|
|
8712
8582
|
|
|
8583
|
+
// src/shared/lib/bigint.ts
|
|
8584
|
+
var import_viem7 = require("viem");
|
|
8585
|
+
|
|
8586
|
+
// src/shared/lib/format.ts
|
|
8587
|
+
var formatterInt = new Intl.NumberFormat("en-US", {
|
|
8588
|
+
maximumFractionDigits: 0
|
|
8589
|
+
});
|
|
8590
|
+
var formatterFloat = new Intl.NumberFormat("en-US", {
|
|
8591
|
+
maximumFractionDigits: 6,
|
|
8592
|
+
useGrouping: false
|
|
8593
|
+
});
|
|
8594
|
+
|
|
8595
|
+
// src/shared/lib/bigint.ts
|
|
8596
|
+
var bigIntToNumber = (inputs) => {
|
|
8597
|
+
const { value, decimals } = inputs || {};
|
|
8598
|
+
if (!value || !decimals) return 0;
|
|
8599
|
+
const valBigInt = BigInt(value);
|
|
8600
|
+
const valNumberStr = (0, import_viem7.formatUnits)(valBigInt, decimals);
|
|
8601
|
+
return Number(valNumberStr);
|
|
8602
|
+
};
|
|
8603
|
+
var bigIntChangeDecimals = (inputs) => {
|
|
8604
|
+
const { value, decimals, newDecimals } = inputs || {};
|
|
8605
|
+
const valBigInt = BigInt(value);
|
|
8606
|
+
if (decimals === newDecimals) return { value: valBigInt, decimals };
|
|
8607
|
+
if (decimals > newDecimals) {
|
|
8608
|
+
const diff2 = decimals - newDecimals;
|
|
8609
|
+
return { value: valBigInt / 10n ** BigInt(diff2), decimals: newDecimals };
|
|
8610
|
+
}
|
|
8611
|
+
const diff = newDecimals - decimals;
|
|
8612
|
+
return { value: valBigInt * 10n ** BigInt(diff), decimals: newDecimals };
|
|
8613
|
+
};
|
|
8614
|
+
var formatBigInt = (inputs) => {
|
|
8615
|
+
return formatterFloat.format(bigIntToNumber(inputs));
|
|
8616
|
+
};
|
|
8617
|
+
var toBigintAmount = (data) => {
|
|
8618
|
+
return {
|
|
8619
|
+
// bigint values constructed from numbers can have rounding errors!
|
|
8620
|
+
// so need to convert to string and then to bigint
|
|
8621
|
+
value: BigInt(data.value.toString()),
|
|
8622
|
+
decimals: data.decimals
|
|
8623
|
+
};
|
|
8624
|
+
};
|
|
8625
|
+
|
|
8713
8626
|
// src/hooks/useHideActivityTab.tsx
|
|
8714
8627
|
var import_react50 = require("react");
|
|
8715
8628
|
function useHideWuiListItem(isModalOpen) {
|
|
@@ -8785,7 +8698,6 @@ var WalletButton = ({
|
|
|
8785
8698
|
const targetNetwork = (0, import_react_redux33.useSelector)(selectTargetChain);
|
|
8786
8699
|
const targetAddress = (0, import_react_redux33.useSelector)(selectTargetAddress);
|
|
8787
8700
|
const dAppOption = (0, import_react_redux33.useSelector)(selectDappOption);
|
|
8788
|
-
const { externalProvider } = useKimaContext();
|
|
8789
8701
|
const { connected: isSolanaConnected } = (0, import_wallet_adapter_react5.useWallet)();
|
|
8790
8702
|
const { connected: isTronConnected } = (0, import_tronwallet_adapter_react_hooks5.useWallet)();
|
|
8791
8703
|
const { isReady, statusMessage, connectedAddress } = useIsWalletReady_default();
|
|
@@ -8831,10 +8743,9 @@ var WalletButton = ({
|
|
|
8831
8743
|
logger_default.debug(`${TAG} wallet state`, {
|
|
8832
8744
|
isReady,
|
|
8833
8745
|
statusMessage,
|
|
8834
|
-
connectedAddress
|
|
8835
|
-
externalProvider
|
|
8746
|
+
connectedAddress
|
|
8836
8747
|
});
|
|
8837
|
-
}, [isReady, statusMessage, connectedAddress
|
|
8748
|
+
}, [isReady, statusMessage, connectedAddress]);
|
|
8838
8749
|
const demoSourceAddress = (0, import_react51.useMemo)(() => {
|
|
8839
8750
|
if (mode !== "light" /* light */) return "";
|
|
8840
8751
|
const short = sourceNetwork?.shortName;
|
|
@@ -9232,7 +9143,7 @@ var CoinDropdown_default = CoinDropdown;
|
|
|
9232
9143
|
// src/components/reusable/ConfirmDetails.tsx
|
|
9233
9144
|
var import_react55 = require("react");
|
|
9234
9145
|
var import_react_redux37 = require("react-redux");
|
|
9235
|
-
var
|
|
9146
|
+
var import_viem8 = require("viem");
|
|
9236
9147
|
|
|
9237
9148
|
// src/components/reusable/ChainIcon.tsx
|
|
9238
9149
|
var import_jsx_runtime71 = require("react/jsx-runtime");
|
|
@@ -9337,7 +9248,7 @@ var sumBigAmts = (amts) => {
|
|
|
9337
9248
|
var formatFeeAmount = (amt, maxDecimals) => {
|
|
9338
9249
|
if (!amt) return "0";
|
|
9339
9250
|
if (amt.value === 0n) return "0";
|
|
9340
|
-
const raw = (0,
|
|
9251
|
+
const raw = (0, import_viem8.formatUnits)(amt.value, amt.decimals);
|
|
9341
9252
|
const numeric = Number(raw);
|
|
9342
9253
|
if (!Number.isFinite(numeric)) return raw;
|
|
9343
9254
|
if (numeric === 0) return "0";
|
|
@@ -9396,7 +9307,7 @@ var ConfirmDetails = ({
|
|
|
9396
9307
|
const inputAmountBig = (0, import_react55.useMemo)(() => {
|
|
9397
9308
|
if (!amount) return void 0;
|
|
9398
9309
|
try {
|
|
9399
|
-
return { value: (0,
|
|
9310
|
+
return { value: (0, import_viem8.parseUnits)(amount, sourceDecimals), decimals: sourceDecimals };
|
|
9400
9311
|
} catch {
|
|
9401
9312
|
return void 0;
|
|
9402
9313
|
}
|
|
@@ -9795,9 +9706,220 @@ var StepBox = ({ step, errorStep, loadingStep, data, steps }) => {
|
|
|
9795
9706
|
};
|
|
9796
9707
|
var StepBox_default = StepBox;
|
|
9797
9708
|
|
|
9709
|
+
// src/components/reusable/VersionInfo.tsx
|
|
9710
|
+
var import_react58 = require("react");
|
|
9711
|
+
|
|
9712
|
+
// package.json
|
|
9713
|
+
var package_default = {
|
|
9714
|
+
name: "@kimafinance/kima-transaction-widget",
|
|
9715
|
+
version: "1.5.32",
|
|
9716
|
+
description: "Kima Transaction Widget",
|
|
9717
|
+
author: "",
|
|
9718
|
+
license: "MIT",
|
|
9719
|
+
repository: "https://github.com/kima-finance/kima-transaction-widget",
|
|
9720
|
+
main: "dist/index.cjs",
|
|
9721
|
+
module: "dist/index.js",
|
|
9722
|
+
types: "dist/index.d.ts",
|
|
9723
|
+
type: "module",
|
|
9724
|
+
source: "src/index.tsx",
|
|
9725
|
+
exports: {
|
|
9726
|
+
".": {
|
|
9727
|
+
types: "./dist/index.d.ts",
|
|
9728
|
+
import: "./dist/index.js",
|
|
9729
|
+
require: "./dist/index.cjs"
|
|
9730
|
+
},
|
|
9731
|
+
"./index.css": {
|
|
9732
|
+
default: "./dist/index.css"
|
|
9733
|
+
}
|
|
9734
|
+
},
|
|
9735
|
+
scripts: {
|
|
9736
|
+
build: "npm run build:tsup && npm run build:sass && npm run move:fonts",
|
|
9737
|
+
"build:sass": "sass src/styles/main.scss dist/index.css",
|
|
9738
|
+
"build:tsup": "tsup",
|
|
9739
|
+
"move:fonts": "mkdir -p dist/fonts && find dist -maxdepth 1 -type f \\( -iname '*.woff' -o -iname '*.woff2' -o -iname '*.eot' -o -iname '*.ttf' -o -iname '*.otf' \\) -exec mv {} dist/fonts/ \\;",
|
|
9740
|
+
prepare: "npm run build",
|
|
9741
|
+
dev: "tsup --watch",
|
|
9742
|
+
sass: "sass src/styles/main.scss src/index.css -w",
|
|
9743
|
+
test: "jest --runInBand",
|
|
9744
|
+
docs: "typedoc --options typedoc.json"
|
|
9745
|
+
},
|
|
9746
|
+
peerDependencies: {
|
|
9747
|
+
react: ">=17.0.0",
|
|
9748
|
+
"react-dom": ">=17.0.1",
|
|
9749
|
+
"react-redux": ">=7.2.2",
|
|
9750
|
+
redux: ">=4.1.2"
|
|
9751
|
+
},
|
|
9752
|
+
devDependencies: {
|
|
9753
|
+
"@babel/plugin-proposal-unicode-property-regex": "^7.18.6",
|
|
9754
|
+
"@testing-library/jest-dom": "^5.17.0",
|
|
9755
|
+
"@testing-library/react": "^13.4.0",
|
|
9756
|
+
"@testing-library/react-hooks": "^7.0.2",
|
|
9757
|
+
"@types/bn.js": "^5.1.6",
|
|
9758
|
+
"@types/crypto-js": "^4.2.2",
|
|
9759
|
+
"@types/jest": "^29.5.14",
|
|
9760
|
+
"@types/mocha": "^10.0.10",
|
|
9761
|
+
"@types/node": "^20.17.10",
|
|
9762
|
+
"@types/react": "^18.3.1",
|
|
9763
|
+
"@types/react-dom": "^18.3.1",
|
|
9764
|
+
"@types/react-redux": "^7.1.34",
|
|
9765
|
+
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
9766
|
+
"@typescript-eslint/parser": "^6.21.0",
|
|
9767
|
+
"cross-env": "^7.0.3",
|
|
9768
|
+
eslint: "^8.57.1",
|
|
9769
|
+
"eslint-config-prettier": "^9.1.0",
|
|
9770
|
+
"eslint-plugin-react": "^7.37.2",
|
|
9771
|
+
"eslint-plugin-react-hooks": "^4.6.2",
|
|
9772
|
+
jest: "^29.7.0",
|
|
9773
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
9774
|
+
"npm-run-all": "^4.1.5",
|
|
9775
|
+
prettier: "^3.4.2",
|
|
9776
|
+
react: "^18.3.1",
|
|
9777
|
+
"react-dom": "^18.3.1",
|
|
9778
|
+
serve: "^14.2.4",
|
|
9779
|
+
"ts-jest": "^29.2.5",
|
|
9780
|
+
"ts-node": "^10.9.2",
|
|
9781
|
+
typedoc: "^0.27.7",
|
|
9782
|
+
"typedoc-plugin-markdown": "^4.2.10",
|
|
9783
|
+
typescript: "^5.7.3"
|
|
9784
|
+
},
|
|
9785
|
+
dependencies: {
|
|
9786
|
+
"@kimafinance/btc-signer": "^1.3.4",
|
|
9787
|
+
"@metamask/detect-provider": "^2.0.0",
|
|
9788
|
+
"@noble/secp256k1": "^2.1.0",
|
|
9789
|
+
"@reduxjs/toolkit": "^2.5.0",
|
|
9790
|
+
"@reown/appkit": "^1.7.1",
|
|
9791
|
+
"@reown/appkit-adapter-ethers": "^1.7.1",
|
|
9792
|
+
"@scure/base": "^1.2.1",
|
|
9793
|
+
"@solana/spl-token": "^0.3.5",
|
|
9794
|
+
"@solana/wallet-adapter-base": "^0.9.18",
|
|
9795
|
+
"@solana/wallet-adapter-react": "^0.15.20",
|
|
9796
|
+
"@solana/wallet-adapter-wallets": "^0.19.3",
|
|
9797
|
+
"@solana/web3.js": "^1.98.0",
|
|
9798
|
+
"@tanstack/react-query": "^5.62.8",
|
|
9799
|
+
"@tronweb3/tronwallet-abstract-adapter": "^1.1.8",
|
|
9800
|
+
"@tronweb3/tronwallet-adapter-ledger": "^1.1.10",
|
|
9801
|
+
"@tronweb3/tronwallet-adapter-okxwallet": "^1.0.5",
|
|
9802
|
+
"@tronweb3/tronwallet-adapter-react-hooks": "^1.1.9",
|
|
9803
|
+
"@tronweb3/tronwallet-adapter-tokenpocket": "^1.0.5",
|
|
9804
|
+
"@tronweb3/tronwallet-adapter-tronlink": "^1.1.11",
|
|
9805
|
+
"@tronweb3/tronwallet-adapter-walletconnect": "^2.0.2",
|
|
9806
|
+
"bitcoinjs-lib": "^6.1.7",
|
|
9807
|
+
"browserify-zlib": "^0.2.0",
|
|
9808
|
+
buffer: "^6.0.3",
|
|
9809
|
+
"buffer-layout": "^1.2.2",
|
|
9810
|
+
"crypto-browserify": "^3.12.1",
|
|
9811
|
+
"crypto-js": "^4.2.0",
|
|
9812
|
+
ethers: "^6.13.5",
|
|
9813
|
+
hex64: "^0.4.0",
|
|
9814
|
+
"https-browserify": "^1.0.0",
|
|
9815
|
+
"json-bigint": "^1.0.0",
|
|
9816
|
+
loglevel: "^1.9.2",
|
|
9817
|
+
"os-browserify": "^0.3.0",
|
|
9818
|
+
"path-browserify": "^1.0.1",
|
|
9819
|
+
"pino-pretty": "^13.0.0",
|
|
9820
|
+
"react-hot-toast": "^2.4.1",
|
|
9821
|
+
"react-redux": ">=7.2.2",
|
|
9822
|
+
"react-tooltip": "^5.28.0",
|
|
9823
|
+
redux: ">=4.1.2",
|
|
9824
|
+
sass: "^1.83.0",
|
|
9825
|
+
"sats-connect": "2.8.3",
|
|
9826
|
+
"stream-browserify": "^3.0.0",
|
|
9827
|
+
"stream-http": "^3.2.0",
|
|
9828
|
+
tronweb: "^6.0.0",
|
|
9829
|
+
tsup: "^8.3.5",
|
|
9830
|
+
url: "^0.11.0",
|
|
9831
|
+
uuid: "^11.1.0",
|
|
9832
|
+
viem: "^2.23.2",
|
|
9833
|
+
"vm-browserify": "^1.1.2"
|
|
9834
|
+
},
|
|
9835
|
+
files: [
|
|
9836
|
+
"dist"
|
|
9837
|
+
]
|
|
9838
|
+
};
|
|
9839
|
+
|
|
9840
|
+
// src/shared/config/version.ts
|
|
9841
|
+
var WIDGET_VERSION = package_default.version;
|
|
9842
|
+
|
|
9843
|
+
// src/components/reusable/VersionInfo.tsx
|
|
9844
|
+
var import_jsx_runtime77 = require("react/jsx-runtime");
|
|
9845
|
+
var VersionInfo = ({ theme }) => {
|
|
9846
|
+
const [isOpen, setIsOpen] = (0, import_react58.useState)(false);
|
|
9847
|
+
const { kimaBackendUrl } = useKimaContext();
|
|
9848
|
+
const { data: envOptions } = useGetEnvOptions({ kimaBackendUrl });
|
|
9849
|
+
(0, import_react58.useEffect)(() => {
|
|
9850
|
+
if (!isOpen) return;
|
|
9851
|
+
const handleKeyDown = (event) => {
|
|
9852
|
+
if (event.key === "Escape") {
|
|
9853
|
+
setIsOpen(false);
|
|
9854
|
+
}
|
|
9855
|
+
};
|
|
9856
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
9857
|
+
return () => {
|
|
9858
|
+
window.removeEventListener("keydown", handleKeyDown);
|
|
9859
|
+
};
|
|
9860
|
+
}, [isOpen]);
|
|
9861
|
+
const backendVersion = envOptions?.backendVersion ?? "Unavailable";
|
|
9862
|
+
return /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(import_jsx_runtime77.Fragment, { children: [
|
|
9863
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("div", { className: "version-info", children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
9864
|
+
"button",
|
|
9865
|
+
{
|
|
9866
|
+
type: "button",
|
|
9867
|
+
className: "version-info-trigger",
|
|
9868
|
+
"aria-label": "Open version information",
|
|
9869
|
+
onClick: () => setIsOpen(true),
|
|
9870
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { className: "version-info-glyph", "aria-hidden": "true", children: "i" })
|
|
9871
|
+
}
|
|
9872
|
+
) }),
|
|
9873
|
+
isOpen && /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
9874
|
+
"div",
|
|
9875
|
+
{
|
|
9876
|
+
className: "version-info-overlay",
|
|
9877
|
+
role: "presentation",
|
|
9878
|
+
onClick: () => setIsOpen(false),
|
|
9879
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsxs)(
|
|
9880
|
+
"div",
|
|
9881
|
+
{
|
|
9882
|
+
className: `version-info-modal ${theme.colorMode}`,
|
|
9883
|
+
role: "dialog",
|
|
9884
|
+
"aria-modal": "true",
|
|
9885
|
+
"aria-label": "Version information",
|
|
9886
|
+
onClick: (event) => event.stopPropagation(),
|
|
9887
|
+
children: [
|
|
9888
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "version-info-modal-header", children: [
|
|
9889
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("h3", { children: "Version Information" }),
|
|
9890
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)(
|
|
9891
|
+
"button",
|
|
9892
|
+
{
|
|
9893
|
+
type: "button",
|
|
9894
|
+
className: "version-info-close",
|
|
9895
|
+
"aria-label": "Close version information",
|
|
9896
|
+
onClick: () => setIsOpen(false),
|
|
9897
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime77.jsx)(Cross_default, {})
|
|
9898
|
+
}
|
|
9899
|
+
)
|
|
9900
|
+
] }),
|
|
9901
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "version-info-list", children: [
|
|
9902
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "version-info-row", children: [
|
|
9903
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { children: "Current widget version" }),
|
|
9904
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("strong", { children: WIDGET_VERSION })
|
|
9905
|
+
] }),
|
|
9906
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsxs)("div", { className: "version-info-row", children: [
|
|
9907
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("span", { children: "Current backend version" }),
|
|
9908
|
+
/* @__PURE__ */ (0, import_jsx_runtime77.jsx)("strong", { children: backendVersion })
|
|
9909
|
+
] })
|
|
9910
|
+
] })
|
|
9911
|
+
]
|
|
9912
|
+
}
|
|
9913
|
+
)
|
|
9914
|
+
}
|
|
9915
|
+
)
|
|
9916
|
+
] });
|
|
9917
|
+
};
|
|
9918
|
+
var VersionInfo_default = VersionInfo;
|
|
9919
|
+
|
|
9798
9920
|
// src/widgets/common/ErrorWidget.tsx
|
|
9799
9921
|
var import_react_redux41 = require("react-redux");
|
|
9800
|
-
var
|
|
9922
|
+
var import_jsx_runtime78 = require("react/jsx-runtime");
|
|
9801
9923
|
var ErrorWidget = ({
|
|
9802
9924
|
theme,
|
|
9803
9925
|
title,
|
|
@@ -9809,22 +9931,22 @@ var ErrorWidget = ({
|
|
|
9809
9931
|
const ccTransactionId = (0, import_react_redux41.useSelector)(selectCCTransactionId);
|
|
9810
9932
|
const isCreditCardSource = sourceChain.shortName === "CC";
|
|
9811
9933
|
const isRetrying = (0, import_react_redux41.useSelector)(selectCCTransactionRetrying);
|
|
9812
|
-
return /* @__PURE__ */ (0,
|
|
9934
|
+
return /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
9813
9935
|
"div",
|
|
9814
9936
|
{
|
|
9815
9937
|
className: `kima-card ${theme.colorMode}`,
|
|
9816
9938
|
style: {
|
|
9817
9939
|
background: theme.colorMode === "light" /* light */ ? theme.backgroundColorLight : theme.backgroundColorDark
|
|
9818
9940
|
},
|
|
9819
|
-
children: /* @__PURE__ */ (0,
|
|
9820
|
-
/* @__PURE__ */ (0,
|
|
9821
|
-
/* @__PURE__ */ (0,
|
|
9822
|
-
/* @__PURE__ */ (0,
|
|
9941
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "transfer-card", children: [
|
|
9942
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "kima-card-header", children: [
|
|
9943
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "topbar", children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "title", children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("h3", { children: title }) }) }),
|
|
9944
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("h4", { className: "subtitle" })
|
|
9823
9945
|
] }),
|
|
9824
|
-
/* @__PURE__ */ (0,
|
|
9825
|
-
isCreditCardSource && !isRetrying && /* @__PURE__ */ (0,
|
|
9826
|
-
message && message !== "" && /* @__PURE__ */ (0,
|
|
9827
|
-
isCreditCardSource && /* @__PURE__ */ (0,
|
|
9946
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: "kima-card-content error", children: [
|
|
9947
|
+
isCreditCardSource && !isRetrying && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(Error_default, { width: 40, height: 40 }),
|
|
9948
|
+
message && message !== "" && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("h2", { children: message }),
|
|
9949
|
+
isCreditCardSource && /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
|
|
9828
9950
|
"div",
|
|
9829
9951
|
{
|
|
9830
9952
|
style: {
|
|
@@ -9833,8 +9955,8 @@ var ErrorWidget = ({
|
|
|
9833
9955
|
flexDirection: "column"
|
|
9834
9956
|
},
|
|
9835
9957
|
children: [
|
|
9836
|
-
isRetrying ? /* @__PURE__ */ (0,
|
|
9837
|
-
ccTransactionId && /* @__PURE__ */ (0,
|
|
9958
|
+
isRetrying ? /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("p", { children: "The transaction is being retried in the background. This may take a few moments. If the issue persists, please contact support and provide the transaction ID below for reference." }) : /* @__PURE__ */ (0, import_jsx_runtime78.jsx)("p", { children: "This credit card transaction has failed. Please check the details and try again. If the issue persists, please contact support and provide the transaction ID below for reference." }),
|
|
9959
|
+
ccTransactionId && /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)(
|
|
9838
9960
|
"div",
|
|
9839
9961
|
{
|
|
9840
9962
|
style: {
|
|
@@ -9844,7 +9966,7 @@ var ErrorWidget = ({
|
|
|
9844
9966
|
justifyContent: "center"
|
|
9845
9967
|
},
|
|
9846
9968
|
children: [
|
|
9847
|
-
/* @__PURE__ */ (0,
|
|
9969
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
9848
9970
|
"code",
|
|
9849
9971
|
{
|
|
9850
9972
|
style: {
|
|
@@ -9855,16 +9977,16 @@ var ErrorWidget = ({
|
|
|
9855
9977
|
children: ccTransactionId
|
|
9856
9978
|
}
|
|
9857
9979
|
),
|
|
9858
|
-
/* @__PURE__ */ (0,
|
|
9980
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(CopyButton_default, { text: ccTransactionId })
|
|
9859
9981
|
]
|
|
9860
9982
|
}
|
|
9861
9983
|
),
|
|
9862
|
-
isRetrying && /* @__PURE__ */ (0,
|
|
9984
|
+
isRetrying && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(ring_default, { width: 30, height: 30, fill: "#86b8ce" })
|
|
9863
9985
|
]
|
|
9864
9986
|
}
|
|
9865
9987
|
)
|
|
9866
9988
|
] }),
|
|
9867
|
-
backButtonEnabled && /* @__PURE__ */ (0,
|
|
9989
|
+
backButtonEnabled && /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(
|
|
9868
9990
|
"div",
|
|
9869
9991
|
{
|
|
9870
9992
|
style: {
|
|
@@ -9872,14 +9994,14 @@ var ErrorWidget = ({
|
|
|
9872
9994
|
justifyContent: "flex-end",
|
|
9873
9995
|
marginTop: 16
|
|
9874
9996
|
},
|
|
9875
|
-
children: /* @__PURE__ */ (0,
|
|
9997
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime78.jsx)(PrimaryButton_default, { clickHandler: backButtonFunction, children: "Back" })
|
|
9876
9998
|
}
|
|
9877
9999
|
),
|
|
9878
|
-
/* @__PURE__ */ (0,
|
|
9879
|
-
/* @__PURE__ */ (0,
|
|
9880
|
-
/* @__PURE__ */ (0,
|
|
9881
|
-
/* @__PURE__ */ (0,
|
|
9882
|
-
/* @__PURE__ */ (0,
|
|
10000
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "kima-card-footer" }),
|
|
10001
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("div", { className: "floating-footer", children: /* @__PURE__ */ (0, import_jsx_runtime78.jsxs)("div", { className: `items ${theme.colorMode}`, children: [
|
|
10002
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("span", { children: "Powered by" }),
|
|
10003
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)(FooterLogo_default, { width: 50, fill: "black" }),
|
|
10004
|
+
/* @__PURE__ */ (0, import_jsx_runtime78.jsx)("strong", { children: "Network" })
|
|
9883
10005
|
] }) })
|
|
9884
10006
|
] })
|
|
9885
10007
|
}
|
|
@@ -9888,11 +10010,11 @@ var ErrorWidget = ({
|
|
|
9888
10010
|
var ErrorWidget_default = ErrorWidget;
|
|
9889
10011
|
|
|
9890
10012
|
// src/hooks/useDebugMode.ts
|
|
9891
|
-
var
|
|
10013
|
+
var import_react59 = require("react");
|
|
9892
10014
|
var useDebugCode = (sequence = ["D", "E", "B", "U", "G"]) => {
|
|
9893
|
-
const [debugMode, setDebugMode] = (0,
|
|
9894
|
-
const [, setInputSequence] = (0,
|
|
9895
|
-
(0,
|
|
10015
|
+
const [debugMode, setDebugMode] = (0, import_react59.useState)(false);
|
|
10016
|
+
const [, setInputSequence] = (0, import_react59.useState)([]);
|
|
10017
|
+
(0, import_react59.useEffect)(() => {
|
|
9896
10018
|
const onKeyDown = (e) => {
|
|
9897
10019
|
setInputSequence((prev) => {
|
|
9898
10020
|
const next = [...prev, e.key].slice(-sequence.length);
|
|
@@ -9919,17 +10041,17 @@ var useDebugCode = (sequence = ["D", "E", "B", "U", "G"]) => {
|
|
|
9919
10041
|
};
|
|
9920
10042
|
|
|
9921
10043
|
// src/widgets/common/KimaWidgetWrapper.tsx
|
|
9922
|
-
var
|
|
9923
|
-
var
|
|
10044
|
+
var import_react81 = require("@reown/appkit/react");
|
|
10045
|
+
var import_react82 = require("react");
|
|
9924
10046
|
var import_react_redux67 = require("react-redux");
|
|
9925
10047
|
|
|
9926
10048
|
// src/widgets/transaction/components/TransactionWidget.tsx
|
|
9927
|
-
var
|
|
10049
|
+
var import_react63 = require("react");
|
|
9928
10050
|
|
|
9929
10051
|
// src/components/reusable/Progressbar.tsx
|
|
9930
|
-
var
|
|
10052
|
+
var import_react60 = require("react");
|
|
9931
10053
|
var import_react_redux42 = require("react-redux");
|
|
9932
|
-
var
|
|
10054
|
+
var import_jsx_runtime79 = require("react/jsx-runtime");
|
|
9933
10055
|
var DEFAULT_STEPS2 = [
|
|
9934
10056
|
{ title: "Initialize" },
|
|
9935
10057
|
{ title: "Source Transfer" },
|
|
@@ -9947,14 +10069,14 @@ var Progressbar = ({
|
|
|
9947
10069
|
const theme = (0, import_react_redux42.useSelector)(selectTheme);
|
|
9948
10070
|
const stepInfo = steps ?? DEFAULT_STEPS2;
|
|
9949
10071
|
const lastIndex = stepInfo.length - 1;
|
|
9950
|
-
const pct = (0,
|
|
10072
|
+
const pct = (0, import_react60.useMemo)(() => {
|
|
9951
10073
|
if (lastIndex <= 0) return 0;
|
|
9952
10074
|
const clamped = Math.max(0, Math.min(step, lastIndex));
|
|
9953
10075
|
return clamped * 100 / lastIndex;
|
|
9954
10076
|
}, [step, lastIndex]);
|
|
9955
|
-
return /* @__PURE__ */ (0,
|
|
9956
|
-
/* @__PURE__ */ (0,
|
|
9957
|
-
/* @__PURE__ */ (0,
|
|
10077
|
+
return /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "kima-progressbar", children: [
|
|
10078
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: "value", style: { width: `${pct}%` } }),
|
|
10079
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("div", { className: "step-indicators", children: stepInfo.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(
|
|
9958
10080
|
"div",
|
|
9959
10081
|
{
|
|
9960
10082
|
className: `step ${step === index && "active"}
|
|
@@ -9963,10 +10085,10 @@ var Progressbar = ({
|
|
|
9963
10085
|
onClick: () => {
|
|
9964
10086
|
if (index < lastIndex) setFocus(index);
|
|
9965
10087
|
},
|
|
9966
|
-
children: /* @__PURE__ */ (0,
|
|
9967
|
-
step < index && /* @__PURE__ */ (0,
|
|
9968
|
-
step >= index ? index === loadingStep ? /* @__PURE__ */ (0,
|
|
9969
|
-
/* @__PURE__ */ (0,
|
|
10088
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime79.jsxs)("div", { className: "step-info", children: [
|
|
10089
|
+
step < index && /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Lock_default, {}),
|
|
10090
|
+
step >= index ? index === loadingStep ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Loader_default, { className: "loader" }) : index === errorStep ? /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Warning_default, {}) : /* @__PURE__ */ (0, import_jsx_runtime79.jsx)(Check_default, {}) : null,
|
|
10091
|
+
/* @__PURE__ */ (0, import_jsx_runtime79.jsx)("span", { children: item.title })
|
|
9970
10092
|
] })
|
|
9971
10093
|
},
|
|
9972
10094
|
`${item.title}-${index}`
|
|
@@ -9982,7 +10104,7 @@ var import_react_redux47 = require("react-redux");
|
|
|
9982
10104
|
var import_react_hot_toast4 = require("react-hot-toast");
|
|
9983
10105
|
|
|
9984
10106
|
// src/widgets/transaction/hooks/useTxData.ts
|
|
9985
|
-
var
|
|
10107
|
+
var import_react61 = require("react");
|
|
9986
10108
|
var import_react_query18 = require("@tanstack/react-query");
|
|
9987
10109
|
|
|
9988
10110
|
// src/services/transactionApi.ts
|
|
@@ -10121,7 +10243,7 @@ var getTxData = async ({
|
|
|
10121
10243
|
// src/widgets/transaction/hooks/useTxData.ts
|
|
10122
10244
|
var POLLING_INTERVAL_MS = 1e3 * 10;
|
|
10123
10245
|
var useTxData = (txId, dAppOption, backendUrl, isSwap) => {
|
|
10124
|
-
const refPollForUpdates = (0,
|
|
10246
|
+
const refPollForUpdates = (0, import_react61.useRef)(false);
|
|
10125
10247
|
const isLP = dAppOption === "LPAdd" /* LPAdd */ || dAppOption === "LPDrain" /* LPDrain */;
|
|
10126
10248
|
const validTxId = typeof txId === "number" ? txId > 0 : txId.toString().length > 0;
|
|
10127
10249
|
return (0, import_react_query18.useQuery)({
|
|
@@ -10142,31 +10264,31 @@ var useTxData = (txId, dAppOption, backendUrl, isSwap) => {
|
|
|
10142
10264
|
var useTxData_default = useTxData;
|
|
10143
10265
|
|
|
10144
10266
|
// src/components/reusable/TransactionStatusMessage.tsx
|
|
10145
|
-
var
|
|
10267
|
+
var import_jsx_runtime80 = require("react/jsx-runtime");
|
|
10146
10268
|
var TransactionStatusMessage = ({
|
|
10147
10269
|
isCompleted,
|
|
10148
10270
|
transactionId
|
|
10149
10271
|
}) => {
|
|
10150
|
-
return /* @__PURE__ */ (0,
|
|
10151
|
-
/* @__PURE__ */ (0,
|
|
10272
|
+
return /* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("div", { className: "transaction-status-message", children: [
|
|
10273
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("h2", { children: [
|
|
10152
10274
|
isCompleted !== "Completed" /* COMPLETED */ && "Your transaction is currently being processed.",
|
|
10153
10275
|
" ",
|
|
10154
10276
|
"Please copy the Transaction ID below for future reference. You can use this ID to track the transaction status or resolve any issues if needed."
|
|
10155
10277
|
] }),
|
|
10156
|
-
/* @__PURE__ */ (0,
|
|
10157
|
-
/* @__PURE__ */ (0,
|
|
10158
|
-
/* @__PURE__ */ (0,
|
|
10278
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsxs)("span", { className: "transaction-copy", children: [
|
|
10279
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)("h3", { children: transactionId }),
|
|
10280
|
+
/* @__PURE__ */ (0, import_jsx_runtime80.jsx)(CopyButton_default, { text: transactionId })
|
|
10159
10281
|
] })
|
|
10160
10282
|
] });
|
|
10161
10283
|
};
|
|
10162
10284
|
var TransactionStatusMessage_default = TransactionStatusMessage;
|
|
10163
10285
|
|
|
10164
10286
|
// src/components/reusable/TransactionSearch.tsx
|
|
10165
|
-
var
|
|
10287
|
+
var import_react62 = require("react");
|
|
10166
10288
|
var import_react_redux43 = require("react-redux");
|
|
10167
10289
|
var import_react_redux44 = require("react-redux");
|
|
10168
10290
|
var import_react_hot_toast3 = __toESM(require("react-hot-toast"), 1);
|
|
10169
|
-
var
|
|
10291
|
+
var import_jsx_runtime81 = require("react/jsx-runtime");
|
|
10170
10292
|
var TransactionSearch = ({
|
|
10171
10293
|
isSwap,
|
|
10172
10294
|
onTypeChange
|
|
@@ -10174,12 +10296,12 @@ var TransactionSearch = ({
|
|
|
10174
10296
|
const theme = (0, import_react_redux43.useSelector)(selectTheme);
|
|
10175
10297
|
const backendUrl = (0, import_react_redux43.useSelector)(selectBackendUrl);
|
|
10176
10298
|
const dispatch = (0, import_react_redux44.useDispatch)();
|
|
10177
|
-
const [transactionId, setTransactionId] = (0,
|
|
10178
|
-
const refPollForUpdates = (0,
|
|
10299
|
+
const [transactionId, setTransactionId] = (0, import_react62.useState)("");
|
|
10300
|
+
const refPollForUpdates = (0, import_react62.useRef)(false);
|
|
10179
10301
|
const handleSearch = async () => {
|
|
10180
10302
|
if (transactionId.length <= 0)
|
|
10181
10303
|
return import_react_hot_toast3.default.error("You must provide a valid transaction id", {
|
|
10182
|
-
icon: /* @__PURE__ */ (0,
|
|
10304
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Error_default, {})
|
|
10183
10305
|
});
|
|
10184
10306
|
try {
|
|
10185
10307
|
const data = await getTxData({
|
|
@@ -10197,14 +10319,14 @@ var TransactionSearch = ({
|
|
|
10197
10319
|
logger_default.error("Error searching transaction: ", error);
|
|
10198
10320
|
return import_react_hot_toast3.default.error(
|
|
10199
10321
|
"Transaction not found. Please check for the proper transaction id.",
|
|
10200
|
-
{ icon: /* @__PURE__ */ (0,
|
|
10322
|
+
{ icon: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(Error_default, {}) }
|
|
10201
10323
|
);
|
|
10202
10324
|
}
|
|
10203
10325
|
};
|
|
10204
|
-
return /* @__PURE__ */ (0,
|
|
10205
|
-
/* @__PURE__ */ (0,
|
|
10206
|
-
/* @__PURE__ */ (0,
|
|
10207
|
-
/* @__PURE__ */ (0,
|
|
10326
|
+
return /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "form-item transaction-search", children: [
|
|
10327
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "transaction-input", children: [
|
|
10328
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { className: "label", children: "Search Transaction:" }),
|
|
10329
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
10208
10330
|
"input",
|
|
10209
10331
|
{
|
|
10210
10332
|
className: `${theme.colorMode}`,
|
|
@@ -10216,10 +10338,10 @@ var TransactionSearch = ({
|
|
|
10216
10338
|
}
|
|
10217
10339
|
)
|
|
10218
10340
|
] }),
|
|
10219
|
-
/* @__PURE__ */ (0,
|
|
10220
|
-
/* @__PURE__ */ (0,
|
|
10221
|
-
/* @__PURE__ */ (0,
|
|
10222
|
-
/* @__PURE__ */ (0,
|
|
10341
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "tx-type-toggle", children: [
|
|
10342
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)("span", { className: "label", children: "Type:" }),
|
|
10343
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { className: "toggle-buttons", children: [
|
|
10344
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
10223
10345
|
"button",
|
|
10224
10346
|
{
|
|
10225
10347
|
type: "button",
|
|
@@ -10228,7 +10350,7 @@ var TransactionSearch = ({
|
|
|
10228
10350
|
children: "Transfer"
|
|
10229
10351
|
}
|
|
10230
10352
|
),
|
|
10231
|
-
/* @__PURE__ */ (0,
|
|
10353
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
|
|
10232
10354
|
"button",
|
|
10233
10355
|
{
|
|
10234
10356
|
type: "button",
|
|
@@ -10239,7 +10361,7 @@ var TransactionSearch = ({
|
|
|
10239
10361
|
)
|
|
10240
10362
|
] })
|
|
10241
10363
|
] }),
|
|
10242
|
-
/* @__PURE__ */ (0,
|
|
10364
|
+
/* @__PURE__ */ (0, import_jsx_runtime81.jsx)(SecondaryButton_default, { clickHandler: handleSearch, children: "Search" })
|
|
10243
10365
|
] });
|
|
10244
10366
|
};
|
|
10245
10367
|
var TransactionSearch_default = TransactionSearch;
|
|
@@ -10299,20 +10421,20 @@ var resolveTransactionResetTarget = ({
|
|
|
10299
10421
|
};
|
|
10300
10422
|
|
|
10301
10423
|
// src/widgets/transaction/components/TransactionWidget.tsx
|
|
10302
|
-
var
|
|
10424
|
+
var import_jsx_runtime82 = require("react/jsx-runtime");
|
|
10303
10425
|
var TransactionWidget = ({ theme }) => {
|
|
10304
|
-
const [step, setStep] = (0,
|
|
10305
|
-
const [focus, setFocus] = (0,
|
|
10306
|
-
const [errorStep, setErrorStep] = (0,
|
|
10307
|
-
const [errorMessage, setErrorMessage] = (0,
|
|
10308
|
-
const [loadingStep, setLoadingStep] = (0,
|
|
10309
|
-
const [minimized, setMinimized] = (0,
|
|
10310
|
-
const [isComplete, setIsComplete] = (0,
|
|
10311
|
-
const [statusTxType, setStatusTxType] = (0,
|
|
10426
|
+
const [step, setStep] = (0, import_react63.useState)(0);
|
|
10427
|
+
const [focus, setFocus] = (0, import_react63.useState)(-1);
|
|
10428
|
+
const [errorStep, setErrorStep] = (0, import_react63.useState)(-1);
|
|
10429
|
+
const [errorMessage, setErrorMessage] = (0, import_react63.useState)("");
|
|
10430
|
+
const [loadingStep, setLoadingStep] = (0, import_react63.useState)(-1);
|
|
10431
|
+
const [minimized, setMinimized] = (0, import_react63.useState)(false);
|
|
10432
|
+
const [isComplete, setIsComplete] = (0, import_react63.useState)(false);
|
|
10433
|
+
const [statusTxType, setStatusTxType] = (0, import_react63.useState)(
|
|
10312
10434
|
"transfer"
|
|
10313
10435
|
);
|
|
10314
|
-
const previousStatusRef = (0,
|
|
10315
|
-
const previousErrorRef = (0,
|
|
10436
|
+
const previousStatusRef = (0, import_react63.useRef)(null);
|
|
10437
|
+
const previousErrorRef = (0, import_react63.useRef)(null);
|
|
10316
10438
|
const dispatch = (0, import_react_redux47.useDispatch)();
|
|
10317
10439
|
const explorerUrl = (0, import_react_redux46.useSelector)(selectKimaExplorer);
|
|
10318
10440
|
const mode = (0, import_react_redux46.useSelector)(selectMode);
|
|
@@ -10332,7 +10454,7 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10332
10454
|
const backendUrl = (0, import_react_redux46.useSelector)(selectBackendUrl);
|
|
10333
10455
|
const isSwapByPegged = sourceSymbol !== targetSymbol && !isSamePeggedToken(sourceChain, sourceSymbol, targetChain, targetSymbol);
|
|
10334
10456
|
const widgetIsSwap = mode === "status" /* status */ ? statusTxType === "swap" : isSwapByPegged;
|
|
10335
|
-
const steps = (0,
|
|
10457
|
+
const steps = (0, import_react63.useMemo)(
|
|
10336
10458
|
() => widgetIsSwap ? SWAP_STEPS : TRANSFER_STEPS,
|
|
10337
10459
|
[widgetIsSwap]
|
|
10338
10460
|
);
|
|
@@ -10344,7 +10466,7 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10344
10466
|
panelRef,
|
|
10345
10467
|
formatTime: formatToastTime
|
|
10346
10468
|
} = useToastHistory();
|
|
10347
|
-
(0,
|
|
10469
|
+
(0, import_react63.useEffect)(() => {
|
|
10348
10470
|
windowWidth === 0 && updateWidth(window.innerWidth);
|
|
10349
10471
|
}, [windowWidth, updateWidth]);
|
|
10350
10472
|
const safeTxId = typeof txId === "string" || typeof txId === "number" ? txId : -1;
|
|
@@ -10354,49 +10476,49 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10354
10476
|
backendUrl,
|
|
10355
10477
|
widgetIsSwap
|
|
10356
10478
|
);
|
|
10357
|
-
const transactionSourceChain = (0,
|
|
10479
|
+
const transactionSourceChain = (0, import_react63.useMemo)(
|
|
10358
10480
|
() => networks.find(
|
|
10359
10481
|
(network) => network.shortName === (mode === "status" /* status */ ? data?.sourceChain : sourceChain.shortName)
|
|
10360
10482
|
),
|
|
10361
10483
|
[data, mode, sourceChain, networks]
|
|
10362
10484
|
);
|
|
10363
|
-
const transactionTargetChain = (0,
|
|
10485
|
+
const transactionTargetChain = (0, import_react63.useMemo)(
|
|
10364
10486
|
() => networks.find(
|
|
10365
10487
|
(network) => network.shortName === (mode === "status" /* status */ ? data?.targetChain : targetChain.shortName)
|
|
10366
10488
|
),
|
|
10367
10489
|
[data, mode, targetChain, networks]
|
|
10368
10490
|
);
|
|
10369
|
-
const isValidTxId = (0,
|
|
10491
|
+
const isValidTxId = (0, import_react63.useMemo)(() => {
|
|
10370
10492
|
return !(safeTxId === -1 || typeof safeTxId === "string" && safeTxId.length === 0);
|
|
10371
10493
|
}, [safeTxId]);
|
|
10372
|
-
const isEmptyStatus = (0,
|
|
10494
|
+
const isEmptyStatus = (0, import_react63.useMemo)(() => {
|
|
10373
10495
|
if (!data) return true;
|
|
10374
10496
|
return data?.amount === "";
|
|
10375
10497
|
}, [data]);
|
|
10376
10498
|
const showFetchingTitle = isValidTxId && isEmptyStatus;
|
|
10377
|
-
(0,
|
|
10499
|
+
(0, import_react63.useEffect)(() => {
|
|
10378
10500
|
if (!data || data.status !== "Completed" /* COMPLETED */) return;
|
|
10379
10501
|
successHandler && successHandler({
|
|
10380
10502
|
txId: safeTxId
|
|
10381
10503
|
});
|
|
10382
10504
|
}, [data, successHandler, safeTxId]);
|
|
10383
|
-
(0,
|
|
10505
|
+
(0, import_react63.useEffect)(() => {
|
|
10384
10506
|
if (!data) return;
|
|
10385
10507
|
if (data.status === "Completed" /* COMPLETED */) {
|
|
10386
10508
|
setIsComplete(true);
|
|
10387
10509
|
}
|
|
10388
10510
|
}, [data]);
|
|
10389
|
-
(0,
|
|
10511
|
+
(0, import_react63.useEffect)(() => {
|
|
10390
10512
|
const nextError = error ? String(error) : null;
|
|
10391
10513
|
if (!nextError || previousErrorRef.current === nextError) return;
|
|
10392
10514
|
previousErrorRef.current = nextError;
|
|
10393
10515
|
if (error)
|
|
10394
10516
|
import_react_hot_toast4.toast.error(
|
|
10395
10517
|
"The provided transaction id is not valid, please use a different one or contact support for further assistance",
|
|
10396
|
-
{ icon: /* @__PURE__ */ (0,
|
|
10518
|
+
{ icon: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Error_default, {}) }
|
|
10397
10519
|
);
|
|
10398
10520
|
}, [error]);
|
|
10399
|
-
(0,
|
|
10521
|
+
(0, import_react63.useEffect)(() => {
|
|
10400
10522
|
const raw = normalizeStatus(data?.status);
|
|
10401
10523
|
const s = compactStatus(raw);
|
|
10402
10524
|
const statusChanged = didStatusChange(previousStatusRef.current, raw);
|
|
@@ -10424,7 +10546,7 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10424
10546
|
setStep(1);
|
|
10425
10547
|
setErrorStep(1);
|
|
10426
10548
|
setLoadingStep(-1);
|
|
10427
|
-
if (statusChanged) import_react_hot_toast4.toast.error("Unavailable", { icon: /* @__PURE__ */ (0,
|
|
10549
|
+
if (statusChanged) import_react_hot_toast4.toast.error("Unavailable", { icon: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Error_default, {}) });
|
|
10428
10550
|
setErrorMessage("Unavailable");
|
|
10429
10551
|
previousStatusRef.current = raw;
|
|
10430
10552
|
return;
|
|
@@ -10435,7 +10557,7 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10435
10557
|
setLoadingStep(-1);
|
|
10436
10558
|
if (statusChanged) {
|
|
10437
10559
|
import_react_hot_toast4.toast.error("Failed to pull tokens from source!", {
|
|
10438
|
-
icon: /* @__PURE__ */ (0,
|
|
10560
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Error_default, {})
|
|
10439
10561
|
});
|
|
10440
10562
|
}
|
|
10441
10563
|
setErrorMessage("Failed to pull tokens from source!");
|
|
@@ -10448,7 +10570,7 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10448
10570
|
setLoadingStep(-1);
|
|
10449
10571
|
if (statusChanged) {
|
|
10450
10572
|
import_react_hot_toast4.toast.error("Failed to release tokens to target!", {
|
|
10451
|
-
icon: /* @__PURE__ */ (0,
|
|
10573
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Error_default, {})
|
|
10452
10574
|
});
|
|
10453
10575
|
}
|
|
10454
10576
|
setErrorMessage("Failed to release tokens to target!");
|
|
@@ -10461,7 +10583,7 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10461
10583
|
if (statusChanged) {
|
|
10462
10584
|
import_react_hot_toast4.toast.error(
|
|
10463
10585
|
"Failed to release tokens to target! Starting refund process.",
|
|
10464
|
-
{ icon: /* @__PURE__ */ (0,
|
|
10586
|
+
{ icon: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Error_default, {}) }
|
|
10465
10587
|
);
|
|
10466
10588
|
}
|
|
10467
10589
|
setErrorMessage(
|
|
@@ -10476,7 +10598,7 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10476
10598
|
setLoadingStep(-1);
|
|
10477
10599
|
if (statusChanged) {
|
|
10478
10600
|
import_react_hot_toast4.toast.error("Failed to refund tokens to source!", {
|
|
10479
|
-
icon: /* @__PURE__ */ (0,
|
|
10601
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Error_default, {})
|
|
10480
10602
|
});
|
|
10481
10603
|
}
|
|
10482
10604
|
setErrorMessage("Failed to refund tokens to source!");
|
|
@@ -10488,7 +10610,7 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10488
10610
|
setErrorStep(3);
|
|
10489
10611
|
setLoadingStep(-1);
|
|
10490
10612
|
if (statusChanged) {
|
|
10491
|
-
import_react_hot_toast4.toast.success("Refund completed!", { icon: /* @__PURE__ */ (0,
|
|
10613
|
+
import_react_hot_toast4.toast.success("Refund completed!", { icon: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Error_default, {}) });
|
|
10492
10614
|
}
|
|
10493
10615
|
setErrorMessage("Refund completed!");
|
|
10494
10616
|
previousStatusRef.current = raw;
|
|
@@ -10543,14 +10665,14 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10543
10665
|
}
|
|
10544
10666
|
previousStatusRef.current = raw;
|
|
10545
10667
|
}, [data?.status, widgetIsSwap]);
|
|
10546
|
-
const verb = (0,
|
|
10668
|
+
const verb = (0, import_react63.useMemo)(() => {
|
|
10547
10669
|
if (mode === "status" /* status */) {
|
|
10548
10670
|
if (isEmptyStatus) return "Fetching transaction status ";
|
|
10549
10671
|
return data?.status?.toUpperCase?.() === "Completed" /* COMPLETED */ ? widgetIsSwap ? "Swapped " : "Transferred " : widgetIsSwap ? "Swapping " : "Transfering ";
|
|
10550
10672
|
}
|
|
10551
10673
|
return data?.status?.toUpperCase?.() === "Completed" /* COMPLETED */ ? widgetIsSwap ? "Swapped " : "Transferred " : widgetIsSwap ? "Swapping " : "Transfering ";
|
|
10552
10674
|
}, [mode, data?.status, isEmptyStatus, widgetIsSwap]);
|
|
10553
|
-
const originChargeAmount = (0,
|
|
10675
|
+
const originChargeAmount = (0, import_react63.useMemo)(() => {
|
|
10554
10676
|
const submit = txValues.submitAmount;
|
|
10555
10677
|
const feeInSubmitDec = bigIntChangeDecimals({
|
|
10556
10678
|
...totalFee,
|
|
@@ -10559,7 +10681,7 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10559
10681
|
const val = feeDeduct ? submit.value : submit.value + feeInSubmitDec.value;
|
|
10560
10682
|
return { value: val, decimals: submit.decimals };
|
|
10561
10683
|
}, [txValues.submitAmount, totalFee, feeDeduct]);
|
|
10562
|
-
const { leftAmt, rightAmt, leftSym, rightSym } = (0,
|
|
10684
|
+
const { leftAmt, rightAmt, leftSym, rightSym } = (0, import_react63.useMemo)(() => {
|
|
10563
10685
|
if (mode === "status" /* status */) {
|
|
10564
10686
|
if (widgetIsSwap) {
|
|
10565
10687
|
const amountIn = data?.amountIn;
|
|
@@ -10657,7 +10779,7 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10657
10779
|
logger_default.debug("[TransactionWidget] reset failed", e);
|
|
10658
10780
|
import_react_hot_toast4.toast.error(
|
|
10659
10781
|
"Unable to reset the transaction view. Please contact support for assistance.",
|
|
10660
|
-
{ icon: /* @__PURE__ */ (0,
|
|
10782
|
+
{ icon: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Error_default, {}) }
|
|
10661
10783
|
);
|
|
10662
10784
|
}
|
|
10663
10785
|
};
|
|
@@ -10667,7 +10789,7 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10667
10789
|
const swapDstAmtLabel = formatTruncMaxDecimals(swapDstAmt, 4);
|
|
10668
10790
|
const swapSrcSymLabel = displaySymbol(data?.sourceSymbol ?? sourceSymbol);
|
|
10669
10791
|
const swapDstSymLabel = displaySymbol(data?.targetSymbol ?? targetSymbol);
|
|
10670
|
-
return /* @__PURE__ */ (0,
|
|
10792
|
+
return /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_react_redux45.Provider, { store: store_default, children: /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(
|
|
10671
10793
|
"div",
|
|
10672
10794
|
{
|
|
10673
10795
|
className: `kima-card transaction-card ${isComplete ? "transaction-complete" : ""} ${theme.colorMode} ${minimized ? "minimized" : ""}`,
|
|
@@ -10675,9 +10797,10 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10675
10797
|
background: theme.colorMode === "light" /* light */ ? theme.backgroundColorLight : theme.backgroundColorDark
|
|
10676
10798
|
},
|
|
10677
10799
|
children: [
|
|
10678
|
-
/* @__PURE__ */ (0,
|
|
10679
|
-
|
|
10680
|
-
|
|
10800
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(VersionInfo_default, { theme }),
|
|
10801
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "kima-card-header", children: [
|
|
10802
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "topbar", children: [
|
|
10803
|
+
!isComplete && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "title", children: isValidTxId && !error ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "transaction-title", children: showFetchingTitle ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(import_jsx_runtime82.Fragment, { children: "Getting transaction details\u2026" }) : /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(import_jsx_runtime82.Fragment, { children: [
|
|
10681
10804
|
verb,
|
|
10682
10805
|
leftAmt,
|
|
10683
10806
|
" ",
|
|
@@ -10686,13 +10809,13 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10686
10809
|
rightAmt,
|
|
10687
10810
|
" ",
|
|
10688
10811
|
rightSym
|
|
10689
|
-
] }) }) : /* @__PURE__ */ (0,
|
|
10690
|
-
!minimized ? /* @__PURE__ */ (0,
|
|
10812
|
+
] }) }) : /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("h3", { className: "transaction", children: "Transaction Status" }) }) }),
|
|
10813
|
+
!minimized ? /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(
|
|
10691
10814
|
"div",
|
|
10692
10815
|
{
|
|
10693
10816
|
className: `control-buttons ${isComplete ? "complete" : ""}`,
|
|
10694
10817
|
children: [
|
|
10695
|
-
isComplete && /* @__PURE__ */ (0,
|
|
10818
|
+
isComplete && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
10696
10819
|
"button",
|
|
10697
10820
|
{
|
|
10698
10821
|
className: "menu-button",
|
|
@@ -10701,41 +10824,41 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10701
10824
|
children: "< Back"
|
|
10702
10825
|
}
|
|
10703
10826
|
),
|
|
10704
|
-
/* @__PURE__ */ (0,
|
|
10827
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
10705
10828
|
"button",
|
|
10706
10829
|
{
|
|
10707
10830
|
className: "icon-button minimize",
|
|
10708
10831
|
onClick: () => setMinimized(true),
|
|
10709
|
-
children: /* @__PURE__ */ (0,
|
|
10832
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Minimize_default, {})
|
|
10710
10833
|
}
|
|
10711
10834
|
),
|
|
10712
|
-
!isComplete && (!isValidTxId || loadingStep < 0 || error && dAppOption !== "none" /* None */) ? /* @__PURE__ */ (0,
|
|
10713
|
-
toastHistory.length > 0 && /* @__PURE__ */ (0,
|
|
10835
|
+
!isComplete && (!isValidTxId || loadingStep < 0 || error && dAppOption !== "none" /* None */) ? /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("button", { className: "reset-button", onClick: resetForm, children: "Reset" }) : null,
|
|
10836
|
+
toastHistory.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(
|
|
10714
10837
|
"div",
|
|
10715
10838
|
{
|
|
10716
10839
|
ref: panelRef,
|
|
10717
10840
|
className: `toast-history ${theme.colorMode}`,
|
|
10718
10841
|
children: [
|
|
10719
|
-
/* @__PURE__ */ (0,
|
|
10842
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
10720
10843
|
"button",
|
|
10721
10844
|
{
|
|
10722
10845
|
className: "toast-history-button",
|
|
10723
10846
|
onClick: () => setToastPanelOpen(true),
|
|
10724
10847
|
"aria-label": "Notifications",
|
|
10725
|
-
children: /* @__PURE__ */ (0,
|
|
10848
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Notification_default, {})
|
|
10726
10849
|
}
|
|
10727
10850
|
),
|
|
10728
|
-
toastPanelOpen && /* @__PURE__ */ (0,
|
|
10729
|
-
/* @__PURE__ */ (0,
|
|
10730
|
-
/* @__PURE__ */ (0,
|
|
10731
|
-
/* @__PURE__ */ (0,
|
|
10732
|
-
/* @__PURE__ */ (0,
|
|
10851
|
+
toastPanelOpen && /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: `toast-history-panel ${theme.colorMode}`, children: [
|
|
10852
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "toast-history-header", children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("span", { children: "Notifications" }) }),
|
|
10853
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "toast-history-list", children: toastHistory.map((item) => /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "toast-history-item", children: [
|
|
10854
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("span", { className: "toast-history-message", children: item.message }),
|
|
10855
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("span", { className: "toast-history-time", children: formatToastTime(item.time) })
|
|
10733
10856
|
] }, item.id)) })
|
|
10734
10857
|
] })
|
|
10735
10858
|
]
|
|
10736
10859
|
}
|
|
10737
10860
|
),
|
|
10738
|
-
closeHandler && /* @__PURE__ */ (0,
|
|
10861
|
+
closeHandler && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
10739
10862
|
"button",
|
|
10740
10863
|
{
|
|
10741
10864
|
className: "cross-icon-button",
|
|
@@ -10743,44 +10866,44 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10743
10866
|
resetForm();
|
|
10744
10867
|
closeHandler(0);
|
|
10745
10868
|
},
|
|
10746
|
-
children: /* @__PURE__ */ (0,
|
|
10869
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Cross_default, {})
|
|
10747
10870
|
}
|
|
10748
10871
|
)
|
|
10749
10872
|
]
|
|
10750
10873
|
}
|
|
10751
|
-
) : /* @__PURE__ */ (0,
|
|
10874
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "control-buttons", children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "maximize", onClick: () => setMinimized(false), children: "View" }) })
|
|
10752
10875
|
] }),
|
|
10753
|
-
data && !isComplete && /* @__PURE__ */ (0,
|
|
10754
|
-
/* @__PURE__ */ (0,
|
|
10755
|
-
/* @__PURE__ */ (0,
|
|
10876
|
+
data && !isComplete && /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "header-network-labels", children: [
|
|
10877
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: `kima-card-network-label ${theme.colorMode}`, children: [
|
|
10878
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
10756
10879
|
ChainIcon,
|
|
10757
10880
|
{
|
|
10758
10881
|
symbol: transactionSourceChain?.shortName
|
|
10759
10882
|
}
|
|
10760
10883
|
),
|
|
10761
|
-
windowWidth > 450 && /* @__PURE__ */ (0,
|
|
10884
|
+
windowWidth > 450 && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("h3", { children: transactionSourceChain?.name })
|
|
10762
10885
|
] }),
|
|
10763
|
-
/* @__PURE__ */ (0,
|
|
10886
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
10764
10887
|
"div",
|
|
10765
10888
|
{
|
|
10766
10889
|
style: { display: "inline-block", transform: "rotate(-90deg)" },
|
|
10767
|
-
children: /* @__PURE__ */ (0,
|
|
10890
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Arrow_default, { width: 25, height: 25 })
|
|
10768
10891
|
}
|
|
10769
10892
|
),
|
|
10770
|
-
/* @__PURE__ */ (0,
|
|
10771
|
-
/* @__PURE__ */ (0,
|
|
10893
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: `kima-card-network-label ${theme.colorMode}`, children: [
|
|
10894
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
10772
10895
|
ChainIcon,
|
|
10773
10896
|
{
|
|
10774
10897
|
symbol: transactionTargetChain?.shortName
|
|
10775
10898
|
}
|
|
10776
10899
|
),
|
|
10777
|
-
windowWidth > 450 && /* @__PURE__ */ (0,
|
|
10900
|
+
windowWidth > 450 && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("h3", { children: transactionTargetChain?.name })
|
|
10778
10901
|
] })
|
|
10779
10902
|
] })
|
|
10780
10903
|
] }),
|
|
10781
|
-
isValidTxId && (mode !== "status" /* status */ || !error) ? /* @__PURE__ */ (0,
|
|
10782
|
-
!isComplete ? /* @__PURE__ */ (0,
|
|
10783
|
-
/* @__PURE__ */ (0,
|
|
10904
|
+
isValidTxId && (mode !== "status" /* status */ || !error) ? /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "kima-card-content", children: [
|
|
10905
|
+
!isComplete ? /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "transaction-content", children: [
|
|
10906
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
10784
10907
|
Progressbar_default,
|
|
10785
10908
|
{
|
|
10786
10909
|
step,
|
|
@@ -10791,7 +10914,7 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10791
10914
|
steps
|
|
10792
10915
|
}
|
|
10793
10916
|
),
|
|
10794
|
-
/* @__PURE__ */ (0,
|
|
10917
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
10795
10918
|
StepBox_default,
|
|
10796
10919
|
{
|
|
10797
10920
|
step,
|
|
@@ -10801,15 +10924,15 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10801
10924
|
steps
|
|
10802
10925
|
}
|
|
10803
10926
|
)
|
|
10804
|
-
] }) : /* @__PURE__ */ (0,
|
|
10805
|
-
/* @__PURE__ */ (0,
|
|
10806
|
-
/* @__PURE__ */ (0,
|
|
10807
|
-
/* @__PURE__ */ (0,
|
|
10927
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "transaction-content transaction-complete", children: [
|
|
10928
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(TransactionComplete_default, {}),
|
|
10929
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("h2", { children: widgetIsSwap ? "Swap Complete" : "Transaction Complete" }),
|
|
10930
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "kima-stepbox", children: /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(
|
|
10808
10931
|
"div",
|
|
10809
10932
|
{
|
|
10810
10933
|
className: `content-wrapper transaction-complete ${theme.colorMode}`,
|
|
10811
10934
|
children: [
|
|
10812
|
-
/* @__PURE__ */ (0,
|
|
10935
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("p", { children: widgetIsSwap ? /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(import_jsx_runtime82.Fragment, { children: [
|
|
10813
10936
|
"You just swapped ",
|
|
10814
10937
|
swapSrcAmtLabel,
|
|
10815
10938
|
" ",
|
|
@@ -10819,50 +10942,50 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10819
10942
|
swapDstAmtLabel,
|
|
10820
10943
|
" ",
|
|
10821
10944
|
swapDstSymLabel
|
|
10822
|
-
] }) : /* @__PURE__ */ (0,
|
|
10945
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(import_jsx_runtime82.Fragment, { children: [
|
|
10823
10946
|
"You just transferred ",
|
|
10824
10947
|
data?.amount,
|
|
10825
10948
|
" ",
|
|
10826
10949
|
displaySymbol(data?.sourceSymbol)
|
|
10827
10950
|
] }) }),
|
|
10828
|
-
/* @__PURE__ */ (0,
|
|
10829
|
-
/* @__PURE__ */ (0,
|
|
10951
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "header-network-labels", children: [
|
|
10952
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(
|
|
10830
10953
|
"div",
|
|
10831
10954
|
{
|
|
10832
10955
|
className: `kima-card-network-label ${theme.colorMode}`,
|
|
10833
10956
|
children: [
|
|
10834
|
-
/* @__PURE__ */ (0,
|
|
10957
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
10835
10958
|
ChainIcon,
|
|
10836
10959
|
{
|
|
10837
10960
|
symbol: transactionSourceChain?.shortName
|
|
10838
10961
|
}
|
|
10839
10962
|
),
|
|
10840
|
-
windowWidth > 450 && /* @__PURE__ */ (0,
|
|
10963
|
+
windowWidth > 450 && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("h3", { children: transactionSourceChain?.name })
|
|
10841
10964
|
]
|
|
10842
10965
|
}
|
|
10843
10966
|
),
|
|
10844
|
-
/* @__PURE__ */ (0,
|
|
10967
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
10845
10968
|
"div",
|
|
10846
10969
|
{
|
|
10847
10970
|
style: {
|
|
10848
10971
|
display: "inline-block",
|
|
10849
10972
|
transform: "rotate(-90deg)"
|
|
10850
10973
|
},
|
|
10851
|
-
children: /* @__PURE__ */ (0,
|
|
10974
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(Arrow_default, { width: 25, height: 25 })
|
|
10852
10975
|
}
|
|
10853
10976
|
),
|
|
10854
|
-
/* @__PURE__ */ (0,
|
|
10977
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)(
|
|
10855
10978
|
"div",
|
|
10856
10979
|
{
|
|
10857
10980
|
className: `kima-card-network-label ${theme.colorMode}`,
|
|
10858
10981
|
children: [
|
|
10859
|
-
/* @__PURE__ */ (0,
|
|
10982
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
10860
10983
|
ChainIcon,
|
|
10861
10984
|
{
|
|
10862
10985
|
symbol: transactionTargetChain?.shortName
|
|
10863
10986
|
}
|
|
10864
10987
|
),
|
|
10865
|
-
windowWidth > 450 && /* @__PURE__ */ (0,
|
|
10988
|
+
windowWidth > 450 && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)("h3", { children: transactionTargetChain?.name })
|
|
10866
10989
|
]
|
|
10867
10990
|
}
|
|
10868
10991
|
)
|
|
@@ -10870,8 +10993,8 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10870
10993
|
]
|
|
10871
10994
|
}
|
|
10872
10995
|
) }),
|
|
10873
|
-
/* @__PURE__ */ (0,
|
|
10874
|
-
/* @__PURE__ */ (0,
|
|
10996
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "transaction-buttons", children: [
|
|
10997
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
10875
10998
|
SecondaryButton_default,
|
|
10876
10999
|
{
|
|
10877
11000
|
clickHandler: resetForm,
|
|
@@ -10879,25 +11002,25 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10879
11002
|
children: "New Transaction"
|
|
10880
11003
|
}
|
|
10881
11004
|
),
|
|
10882
|
-
/* @__PURE__ */ (0,
|
|
11005
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
10883
11006
|
ExternalLink_default,
|
|
10884
11007
|
{
|
|
10885
11008
|
to: `${explorerUrl}/transactions/?tx=${data?.kimaTxHash}`,
|
|
10886
|
-
children: /* @__PURE__ */ (0,
|
|
11009
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(PrimaryButton_default, { children: "View Details" })
|
|
10887
11010
|
}
|
|
10888
11011
|
)
|
|
10889
11012
|
] })
|
|
10890
11013
|
] }),
|
|
10891
|
-
!error && !isEmptyStatus && !isComplete && /* @__PURE__ */ (0,
|
|
11014
|
+
!error && !isEmptyStatus && !isComplete && /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
10892
11015
|
TransactionStatusMessage_default,
|
|
10893
11016
|
{
|
|
10894
11017
|
isCompleted: data?.status,
|
|
10895
11018
|
transactionId: String(safeTxId)
|
|
10896
11019
|
}
|
|
10897
11020
|
)
|
|
10898
|
-
] }) : /* @__PURE__ */ (0,
|
|
10899
|
-
/* @__PURE__ */ (0,
|
|
10900
|
-
/* @__PURE__ */ (0,
|
|
11021
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: "kima-card-content", children: [
|
|
11022
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("h4", { className: "subtitle", children: "You can follow the status of a previous submitted transaction by entering the provided transaction id" }),
|
|
11023
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("div", { className: "single-form", children: /* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
10901
11024
|
TransactionSearch_default,
|
|
10902
11025
|
{
|
|
10903
11026
|
isSwap: statusTxType === "swap",
|
|
@@ -10905,7 +11028,7 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10905
11028
|
}
|
|
10906
11029
|
) })
|
|
10907
11030
|
] }),
|
|
10908
|
-
/* @__PURE__ */ (0,
|
|
11031
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
10909
11032
|
import_react_hot_toast4.Toaster,
|
|
10910
11033
|
{
|
|
10911
11034
|
position: "top-right",
|
|
@@ -10930,13 +11053,13 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10930
11053
|
}
|
|
10931
11054
|
}
|
|
10932
11055
|
),
|
|
10933
|
-
/* @__PURE__ */ (0,
|
|
11056
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(
|
|
10934
11057
|
"div",
|
|
10935
11058
|
{
|
|
10936
11059
|
className: `floating-footer ${isComplete ? "complete" : "status"}`,
|
|
10937
|
-
children: /* @__PURE__ */ (0,
|
|
10938
|
-
/* @__PURE__ */ (0,
|
|
10939
|
-
/* @__PURE__ */ (0,
|
|
11060
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime82.jsxs)("div", { className: `items ${theme.colorMode}`, children: [
|
|
11061
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)("span", { children: "Powered by" }),
|
|
11062
|
+
/* @__PURE__ */ (0, import_jsx_runtime82.jsx)(KimaNetwork_default, {})
|
|
10940
11063
|
] })
|
|
10941
11064
|
}
|
|
10942
11065
|
)
|
|
@@ -10950,7 +11073,7 @@ var import_react_query19 = require("@tanstack/react-query");
|
|
|
10950
11073
|
var import_react_redux48 = require("react-redux");
|
|
10951
11074
|
|
|
10952
11075
|
// src/services/feesApi.ts
|
|
10953
|
-
var
|
|
11076
|
+
var import_viem9 = require("viem");
|
|
10954
11077
|
var getFees = async (amount, originChain, originAddress, originSymbol, targetChain, targetAddress, targetSymbol, backendUrl) => {
|
|
10955
11078
|
const originAddrParam = ["BANK", "CC"].includes(originChain) ? targetAddress : originAddress;
|
|
10956
11079
|
const url = `${backendUrl}/submit/fees?amount=${amount}&originChain=${originChain}&originAddress=${originAddrParam}&originSymbol=${originSymbol}&targetChain=${targetChain}&targetAddress=${targetAddress}&targetSymbol=${targetSymbol}`;
|
|
@@ -11032,7 +11155,7 @@ var getFees = async (amount, originChain, originAddress, originSymbol, targetCha
|
|
|
11032
11155
|
decimals: originDecimals
|
|
11033
11156
|
},
|
|
11034
11157
|
submitAmount: normalizedOriginSubmit,
|
|
11035
|
-
message: `I approve the transfer of ${(0,
|
|
11158
|
+
message: `I approve the transfer of ${(0, import_viem9.formatUnits)(
|
|
11036
11159
|
normalizedOriginSubmit.value + normalizedTotalFee.value,
|
|
11037
11160
|
originDecimals
|
|
11038
11161
|
)} ${originSymbol} from ${originChain} to ${targetAddress} on ${targetChain}.`
|
|
@@ -11040,7 +11163,7 @@ var getFees = async (amount, originChain, originAddress, originSymbol, targetCha
|
|
|
11040
11163
|
const btcFeeFromTarget = originChain === "BTC" ? {
|
|
11041
11164
|
allowanceAmount: normalizedOriginSubmit,
|
|
11042
11165
|
submitAmount: normalizedOriginSubmit,
|
|
11043
|
-
message: `I approve the transfer of ${(0,
|
|
11166
|
+
message: `I approve the transfer of ${(0, import_viem9.formatUnits)(
|
|
11044
11167
|
normalizedOriginSubmit.value,
|
|
11045
11168
|
originDecimals
|
|
11046
11169
|
)} ${originSymbol} from ${originChain} to ${targetAddress} on ${targetChain}.`
|
|
@@ -11152,7 +11275,7 @@ var import_react_redux49 = require("react-redux");
|
|
|
11152
11275
|
var import_react_query20 = require("@tanstack/react-query");
|
|
11153
11276
|
|
|
11154
11277
|
// src/widgets/transfer/lib/submission.ts
|
|
11155
|
-
var
|
|
11278
|
+
var import_viem10 = require("viem");
|
|
11156
11279
|
var resolveTransferDecimals = (originChainData, sourceCurrency) => {
|
|
11157
11280
|
const token = originChainData.supportedTokens?.find(
|
|
11158
11281
|
(candidate) => candidate.symbol === sourceCurrency
|
|
@@ -11171,7 +11294,7 @@ var buildFallbackSubmitValues = ({
|
|
|
11171
11294
|
targetCurrency
|
|
11172
11295
|
}) => {
|
|
11173
11296
|
const decimals = resolveTransferDecimals(originChainData, sourceCurrency);
|
|
11174
|
-
const amountBig = amount.trim() ? (0,
|
|
11297
|
+
const amountBig = amount.trim() ? (0, import_viem10.parseUnits)(amount.trim(), decimals) : 0n;
|
|
11175
11298
|
return {
|
|
11176
11299
|
originChain: originChainData.shortName,
|
|
11177
11300
|
originAddress: sourceAddress,
|
|
@@ -11422,11 +11545,11 @@ var useSubmitTransaction = (isSubmitting, setIsSubmitting) => {
|
|
|
11422
11545
|
var useSubmitTransaction_default = useSubmitTransaction;
|
|
11423
11546
|
|
|
11424
11547
|
// src/widgets/transfer/hooks/useValidateTransaction.tsx
|
|
11425
|
-
var
|
|
11548
|
+
var import_react64 = require("react");
|
|
11426
11549
|
var import_react_redux50 = require("react-redux");
|
|
11427
11550
|
|
|
11428
11551
|
// src/widgets/transfer/lib/validation.ts
|
|
11429
|
-
var
|
|
11552
|
+
var import_viem11 = require("viem");
|
|
11430
11553
|
var calculateTransferMaxValue = ({
|
|
11431
11554
|
balance = 0n,
|
|
11432
11555
|
totalFee,
|
|
@@ -11508,7 +11631,7 @@ var validateTransferInputs = ({
|
|
|
11508
11631
|
message: "Amount must be greater than zero"
|
|
11509
11632
|
};
|
|
11510
11633
|
}
|
|
11511
|
-
if (!isBtcFlow && amount > (0,
|
|
11634
|
+
if (!isBtcFlow && amount > (0, import_viem11.parseUnits)(envTransferLimitMaxUSDT || "100", decimals) && networkOption === "testnet" /* testnet */) {
|
|
11512
11635
|
return {
|
|
11513
11636
|
error: "ValidationError" /* Error */,
|
|
11514
11637
|
message: "Testnet transfers for USD stablecoins are capped to $100 per transaction"
|
|
@@ -11564,7 +11687,7 @@ var validateTransferInputs = ({
|
|
|
11564
11687
|
pools,
|
|
11565
11688
|
targetChain,
|
|
11566
11689
|
targetCurrency,
|
|
11567
|
-
amount: (0,
|
|
11690
|
+
amount: (0, import_viem11.formatUnits)(amount, decimals)
|
|
11568
11691
|
});
|
|
11569
11692
|
if (!isPoolAvailable) {
|
|
11570
11693
|
return {
|
|
@@ -11607,11 +11730,11 @@ var useValidateTransaction = (inputs) => {
|
|
|
11607
11730
|
const tgtNet = (0, import_react_redux50.useSelector)(selectTargetChain);
|
|
11608
11731
|
const srcCur = (0, import_react_redux50.useSelector)(selectSourceCurrency);
|
|
11609
11732
|
const tgtCur = (0, import_react_redux50.useSelector)(selectTargetCurrency);
|
|
11610
|
-
const isSwap = (0,
|
|
11733
|
+
const isSwap = (0, import_react64.useMemo)(
|
|
11611
11734
|
() => srcCur !== tgtCur && !isSamePeggedToken(srcNet, srcCur, tgtNet, tgtCur),
|
|
11612
11735
|
[srcNet, srcCur, tgtNet, tgtCur]
|
|
11613
11736
|
);
|
|
11614
|
-
const sourceToken = (0,
|
|
11737
|
+
const sourceToken = (0, import_react64.useMemo)(
|
|
11615
11738
|
() => srcNet.supportedTokens?.find((token) => token.symbol === srcCur),
|
|
11616
11739
|
[srcNet, srcCur]
|
|
11617
11740
|
);
|
|
@@ -11650,13 +11773,13 @@ var useValidateTransaction = (inputs) => {
|
|
|
11650
11773
|
var useValidateTransaction_default = useValidateTransaction;
|
|
11651
11774
|
|
|
11652
11775
|
// src/widgets/transfer/components/TransferWidget.tsx
|
|
11653
|
-
var
|
|
11776
|
+
var import_react80 = require("react");
|
|
11654
11777
|
var import_react_hot_toast12 = __toESM(require("react-hot-toast"), 1);
|
|
11655
11778
|
var import_react_redux66 = require("react-redux");
|
|
11656
|
-
var
|
|
11779
|
+
var import_viem13 = require("viem");
|
|
11657
11780
|
|
|
11658
11781
|
// src/components/reusable/WarningModal.tsx
|
|
11659
|
-
var
|
|
11782
|
+
var import_jsx_runtime83 = require("react/jsx-runtime");
|
|
11660
11783
|
var WarningModal = ({
|
|
11661
11784
|
message,
|
|
11662
11785
|
cancelButtonText = "Cancel",
|
|
@@ -11664,11 +11787,11 @@ var WarningModal = ({
|
|
|
11664
11787
|
onAcknowledge,
|
|
11665
11788
|
onCancel
|
|
11666
11789
|
}) => {
|
|
11667
|
-
return /* @__PURE__ */ (0,
|
|
11668
|
-
/* @__PURE__ */ (0,
|
|
11669
|
-
/* @__PURE__ */ (0,
|
|
11670
|
-
/* @__PURE__ */ (0,
|
|
11671
|
-
/* @__PURE__ */ (0,
|
|
11790
|
+
return /* @__PURE__ */ (0, import_jsx_runtime83.jsx)("div", { className: "warning-modal-overlay", children: /* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "warning-modal", children: [
|
|
11791
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("h3", { children: "Warning" }),
|
|
11792
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)("p", { children: message }),
|
|
11793
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsxs)("div", { className: "warning-modal-buttons", children: [
|
|
11794
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
11672
11795
|
SecondaryButton_default,
|
|
11673
11796
|
{
|
|
11674
11797
|
className: "warning-modal-cancel",
|
|
@@ -11676,7 +11799,7 @@ var WarningModal = ({
|
|
|
11676
11799
|
children: cancelButtonText
|
|
11677
11800
|
}
|
|
11678
11801
|
),
|
|
11679
|
-
/* @__PURE__ */ (0,
|
|
11802
|
+
/* @__PURE__ */ (0, import_jsx_runtime83.jsx)(
|
|
11680
11803
|
PrimaryButton_default,
|
|
11681
11804
|
{
|
|
11682
11805
|
className: "warning-modal-acknowledge",
|
|
@@ -11690,22 +11813,22 @@ var WarningModal = ({
|
|
|
11690
11813
|
var WarningModal_default = WarningModal;
|
|
11691
11814
|
|
|
11692
11815
|
// src/components/reusable/SingleForm.tsx
|
|
11693
|
-
var
|
|
11694
|
-
var
|
|
11816
|
+
var import_viem12 = require("viem");
|
|
11817
|
+
var import_react66 = require("react");
|
|
11695
11818
|
var import_react_hot_toast5 = require("react-hot-toast");
|
|
11696
11819
|
var import_react_redux52 = require("react-redux");
|
|
11697
11820
|
|
|
11698
11821
|
// src/components/primary/NetworkSelector.tsx
|
|
11699
|
-
var
|
|
11822
|
+
var import_react65 = __toESM(require("react"), 1);
|
|
11700
11823
|
var import_react_redux51 = require("react-redux");
|
|
11701
|
-
var
|
|
11824
|
+
var import_jsx_runtime84 = require("react/jsx-runtime");
|
|
11702
11825
|
var NetworkSelector = ({
|
|
11703
11826
|
type,
|
|
11704
11827
|
initialSelection,
|
|
11705
11828
|
setInitialSelection
|
|
11706
11829
|
}) => {
|
|
11707
|
-
const [collapsed, setCollapsed] = (0,
|
|
11708
|
-
const ref = (0,
|
|
11830
|
+
const [collapsed, setCollapsed] = (0, import_react65.useState)(true);
|
|
11831
|
+
const ref = (0, import_react65.useRef)(null);
|
|
11709
11832
|
const dispatch = (0, import_react_redux51.useDispatch)();
|
|
11710
11833
|
const theme = (0, import_react_redux51.useSelector)(selectTheme);
|
|
11711
11834
|
const networkOptions = (0, import_react_redux51.useSelector)(selectNetworks);
|
|
@@ -11721,7 +11844,7 @@ var NetworkSelector = ({
|
|
|
11721
11844
|
const currentTargetAddr = (0, import_react_redux51.useSelector)(selectTargetAddress);
|
|
11722
11845
|
const { switchChainHandler } = useKimaContext();
|
|
11723
11846
|
const isOriginSelector = type === "origin";
|
|
11724
|
-
(0,
|
|
11847
|
+
(0, import_react65.useEffect)(() => {
|
|
11725
11848
|
logger_default.info("[NetworkSelector] mount", {
|
|
11726
11849
|
type,
|
|
11727
11850
|
mode,
|
|
@@ -11730,7 +11853,7 @@ var NetworkSelector = ({
|
|
|
11730
11853
|
targetShort: targetNetwork?.shortName
|
|
11731
11854
|
});
|
|
11732
11855
|
}, []);
|
|
11733
|
-
const networks = (0,
|
|
11856
|
+
const networks = (0, import_react65.useMemo)(() => {
|
|
11734
11857
|
const result = networkOptions.filter((network) => {
|
|
11735
11858
|
if (dAppOption !== "none" /* None */ && network.shortName === "CC")
|
|
11736
11859
|
return false;
|
|
@@ -11758,7 +11881,7 @@ var NetworkSelector = ({
|
|
|
11758
11881
|
isOriginSelector
|
|
11759
11882
|
]);
|
|
11760
11883
|
const shouldLockSourceNetwork = isOriginSelector && mode === "payment" /* payment */ && dAppOption !== "none" /* None */ && !!transactionOption?.targetChain;
|
|
11761
|
-
const selectedNetwork = (0,
|
|
11884
|
+
const selectedNetwork = (0, import_react65.useMemo)(() => {
|
|
11762
11885
|
if (shouldLockSourceNetwork) {
|
|
11763
11886
|
const forced = networks.find(
|
|
11764
11887
|
(n) => n.shortName === transactionOption.targetChain
|
|
@@ -11797,8 +11920,8 @@ var NetworkSelector = ({
|
|
|
11797
11920
|
shouldLockSourceNetwork,
|
|
11798
11921
|
transactionOption?.targetChain
|
|
11799
11922
|
]);
|
|
11800
|
-
const lastForcedShort = (0,
|
|
11801
|
-
(0,
|
|
11923
|
+
const lastForcedShort = (0, import_react65.useRef)();
|
|
11924
|
+
(0, import_react65.useEffect)(() => {
|
|
11802
11925
|
if (!shouldLockSourceNetwork || !isOriginSelector || !transactionOption?.targetChain)
|
|
11803
11926
|
return;
|
|
11804
11927
|
const forcedNetwork = networks.find(
|
|
@@ -11913,7 +12036,7 @@ var NetworkSelector = ({
|
|
|
11913
12036
|
}
|
|
11914
12037
|
setCollapsed(true);
|
|
11915
12038
|
};
|
|
11916
|
-
(0,
|
|
12039
|
+
(0, import_react65.useEffect)(() => {
|
|
11917
12040
|
const handleOutsideClick = (e) => {
|
|
11918
12041
|
if (ref.current && !ref.current.contains(e.target)) {
|
|
11919
12042
|
setCollapsed(true);
|
|
@@ -11922,7 +12045,7 @@ var NetworkSelector = ({
|
|
|
11922
12045
|
document.addEventListener("mousedown", handleOutsideClick);
|
|
11923
12046
|
return () => document.removeEventListener("mousedown", handleOutsideClick);
|
|
11924
12047
|
}, []);
|
|
11925
|
-
(0,
|
|
12048
|
+
(0, import_react65.useEffect)(() => {
|
|
11926
12049
|
if (mode !== "light" /* light */) return;
|
|
11927
12050
|
let srcDemo = "";
|
|
11928
12051
|
if (isEVMChain(sourceNetwork.shortName)) srcDemo = lightDemoAccounts.EVM;
|
|
@@ -11954,7 +12077,7 @@ var NetworkSelector = ({
|
|
|
11954
12077
|
currentTargetAddr,
|
|
11955
12078
|
dispatch
|
|
11956
12079
|
]);
|
|
11957
|
-
return /* @__PURE__ */ (0,
|
|
12080
|
+
return /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
|
|
11958
12081
|
"div",
|
|
11959
12082
|
{
|
|
11960
12083
|
className: `network-dropdown ${theme?.colorMode ?? ""} ${collapsed ? "collapsed" : "toggled"} ${shouldLockSourceNetwork ? "disabled" : ""}`,
|
|
@@ -11963,15 +12086,15 @@ var NetworkSelector = ({
|
|
|
11963
12086
|
},
|
|
11964
12087
|
ref,
|
|
11965
12088
|
children: [
|
|
11966
|
-
/* @__PURE__ */ (0,
|
|
11967
|
-
/* @__PURE__ */ (0,
|
|
11968
|
-
/* @__PURE__ */ (0,
|
|
12089
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsxs)("div", { className: "network-wrapper", children: [
|
|
12090
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(ChainIcon, { symbol: selectedNetwork.shortName }),
|
|
12091
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("span", { children: selectedNetwork.name })
|
|
11969
12092
|
] }),
|
|
11970
|
-
/* @__PURE__ */ (0,
|
|
12093
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)(
|
|
11971
12094
|
"div",
|
|
11972
12095
|
{
|
|
11973
12096
|
className: `network-menu custom-scrollbar ${theme?.colorMode ?? ""} ${collapsed ? "collapsed" : "toggled"}`,
|
|
11974
|
-
children: networks.filter((network) => network.shortName !== selectedNetwork.shortName).map((network) => /* @__PURE__ */ (0,
|
|
12097
|
+
children: networks.filter((network) => network.shortName !== selectedNetwork.shortName).map((network) => /* @__PURE__ */ (0, import_jsx_runtime84.jsxs)(
|
|
11975
12098
|
"div",
|
|
11976
12099
|
{
|
|
11977
12100
|
className: `network-menu-item ${theme?.colorMode ?? ""} ${network.disabled ? "disabled has-tooltip" : "enabled"}`,
|
|
@@ -11980,24 +12103,24 @@ var NetworkSelector = ({
|
|
|
11980
12103
|
if (!network.disabled) handleNetworkChange(network);
|
|
11981
12104
|
},
|
|
11982
12105
|
children: [
|
|
11983
|
-
network.disabled ? /* @__PURE__ */ (0,
|
|
11984
|
-
/* @__PURE__ */ (0,
|
|
11985
|
-
network.disabled && /* @__PURE__ */ (0,
|
|
12106
|
+
network.disabled ? /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Warning_default, { width: 25, height: 25 }) : /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(ChainIcon, { symbol: network.shortName }),
|
|
12107
|
+
/* @__PURE__ */ (0, import_jsx_runtime84.jsx)("p", { children: network.name }),
|
|
12108
|
+
network.disabled && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("span", { className: "tooltip", children: "Temporarily unavailable" })
|
|
11986
12109
|
]
|
|
11987
12110
|
},
|
|
11988
12111
|
`${network.shortName}-${network.name}`
|
|
11989
12112
|
))
|
|
11990
12113
|
}
|
|
11991
12114
|
),
|
|
11992
|
-
!shouldLockSourceNetwork && /* @__PURE__ */ (0,
|
|
12115
|
+
!shouldLockSourceNetwork && /* @__PURE__ */ (0, import_jsx_runtime84.jsx)("div", { className: `dropdown-icon ${collapsed ? "toggled" : "collapsed"}`, children: /* @__PURE__ */ (0, import_jsx_runtime84.jsx)(Arrow_default, { fill: "none" }) })
|
|
11993
12116
|
]
|
|
11994
12117
|
}
|
|
11995
12118
|
);
|
|
11996
12119
|
};
|
|
11997
|
-
var NetworkSelector_default =
|
|
12120
|
+
var NetworkSelector_default = import_react65.default.memo(NetworkSelector);
|
|
11998
12121
|
|
|
11999
12122
|
// src/components/reusable/SingleForm.tsx
|
|
12000
|
-
var
|
|
12123
|
+
var import_jsx_runtime85 = require("react/jsx-runtime");
|
|
12001
12124
|
var SingleForm = ({
|
|
12002
12125
|
isLoadingFees,
|
|
12003
12126
|
feeError,
|
|
@@ -12017,7 +12140,7 @@ var SingleForm = ({
|
|
|
12017
12140
|
const targetNetwork = (0, import_react_redux52.useSelector)(selectTargetChain);
|
|
12018
12141
|
const targetAddress = (0, import_react_redux52.useSelector)(selectTargetAddress);
|
|
12019
12142
|
const { isReady } = useIsWalletReady_default();
|
|
12020
|
-
const [amountValue, setAmountValue] = (0,
|
|
12143
|
+
const [amountValue, setAmountValue] = (0, import_react66.useState)("");
|
|
12021
12144
|
const amount = (0, import_react_redux52.useSelector)(selectAmount);
|
|
12022
12145
|
const sourceCurrency = (0, import_react_redux52.useSelector)(selectSourceCurrency);
|
|
12023
12146
|
const targetCurrency = (0, import_react_redux52.useSelector)(selectTargetCurrency);
|
|
@@ -12025,25 +12148,25 @@ var SingleForm = ({
|
|
|
12025
12148
|
const { balance, decimals } = useBalance_default();
|
|
12026
12149
|
const { kimaBackendUrl } = useKimaContext();
|
|
12027
12150
|
const { data: envOptions } = useGetEnvOptions({ kimaBackendUrl });
|
|
12028
|
-
const errorMessage = (0,
|
|
12151
|
+
const errorMessage = (0, import_react66.useMemo)(
|
|
12029
12152
|
() => compliantOption && targetCompliant !== null && !targetCompliant?.isCompliant ? `Target address has ${targetCompliant.results?.[0].result.risk_score} risk` : "",
|
|
12030
12153
|
[compliantOption, targetCompliant]
|
|
12031
12154
|
);
|
|
12032
|
-
const maxValue = (0,
|
|
12155
|
+
const maxValue = (0, import_react66.useMemo)(() => {
|
|
12033
12156
|
if (mode === "light" /* light */) {
|
|
12034
12157
|
const limit = envOptions?.transferLimitMaxUSDT ? parseFloat(envOptions.transferLimitMaxUSDT) : 1e3;
|
|
12035
12158
|
return BigInt(limit);
|
|
12036
12159
|
}
|
|
12037
12160
|
if (!balance) return 0n;
|
|
12038
12161
|
if (totalFee.value === 0n) return balance;
|
|
12039
|
-
const intAmount = (0,
|
|
12162
|
+
const intAmount = (0, import_viem12.parseUnits)(amount || "0", totalFee.decimals);
|
|
12040
12163
|
return balance - intAmount;
|
|
12041
12164
|
}, [mode, envOptions?.transferLimitMaxUSDT, balance, totalFee, amount]);
|
|
12042
|
-
const feeTokenSymbol = (0,
|
|
12165
|
+
const feeTokenSymbol = (0, import_react66.useMemo)(() => {
|
|
12043
12166
|
if (!sourceCurrency) return "USD";
|
|
12044
12167
|
return uiTokenSymbol(sourceCurrency);
|
|
12045
12168
|
}, [sourceCurrency]);
|
|
12046
|
-
const canQuoteFees = (0,
|
|
12169
|
+
const canQuoteFees = (0, import_react66.useMemo)(() => {
|
|
12047
12170
|
const haveBasics = !!backendUrl && !!amount && !!sourceNetwork?.shortName && !!sourceCurrency && !!targetNetwork?.shortName && !!targetCurrency;
|
|
12048
12171
|
if (!haveBasics) return false;
|
|
12049
12172
|
const requiresSourceAddress = !["BANK", "CC"].includes(
|
|
@@ -12062,11 +12185,11 @@ var SingleForm = ({
|
|
|
12062
12185
|
sourceAddress,
|
|
12063
12186
|
targetAddress
|
|
12064
12187
|
]);
|
|
12065
|
-
(0,
|
|
12188
|
+
(0, import_react66.useEffect)(() => {
|
|
12066
12189
|
if (!errorMessage) return;
|
|
12067
12190
|
import_react_hot_toast5.toast.error(errorMessage);
|
|
12068
12191
|
}, [errorMessage]);
|
|
12069
|
-
(0,
|
|
12192
|
+
(0, import_react66.useEffect)(() => {
|
|
12070
12193
|
if (amountValue && amount !== "") return;
|
|
12071
12194
|
setAmountValue(amount);
|
|
12072
12195
|
}, [amount, amountValue]);
|
|
@@ -12105,7 +12228,7 @@ var SingleForm = ({
|
|
|
12105
12228
|
);
|
|
12106
12229
|
}
|
|
12107
12230
|
};
|
|
12108
|
-
const demoSourceAddress = (0,
|
|
12231
|
+
const demoSourceAddress = (0, import_react66.useMemo)(() => {
|
|
12109
12232
|
if (mode !== "light" /* light */) return "";
|
|
12110
12233
|
const short = sourceNetwork?.shortName;
|
|
12111
12234
|
if (!short) return "";
|
|
@@ -12114,7 +12237,7 @@ var SingleForm = ({
|
|
|
12114
12237
|
if (lightDemoNetworks.includes(short)) return lightDemoAccounts.EVM;
|
|
12115
12238
|
return "";
|
|
12116
12239
|
}, [mode, sourceNetwork?.shortName]);
|
|
12117
|
-
const isConnectedSourceWrapper = (0,
|
|
12240
|
+
const isConnectedSourceWrapper = (0, import_react66.useMemo)(() => {
|
|
12118
12241
|
if (mode === "light" /* light */) {
|
|
12119
12242
|
const on2 = !!demoSourceAddress;
|
|
12120
12243
|
logger_default.debug("[SingleForm] source wrapper connected (LIGHT)?", {
|
|
@@ -12147,7 +12270,7 @@ var SingleForm = ({
|
|
|
12147
12270
|
demoSourceAddress,
|
|
12148
12271
|
sourceNetwork?.shortName
|
|
12149
12272
|
]);
|
|
12150
|
-
const isConnectedTargetWrapper = (0,
|
|
12273
|
+
const isConnectedTargetWrapper = (0, import_react66.useMemo)(() => {
|
|
12151
12274
|
if (mode !== "light" /* light */) return false;
|
|
12152
12275
|
const on = !!targetAddress;
|
|
12153
12276
|
logger_default.debug("[SingleForm] target wrapper connected (LIGHT)?", {
|
|
@@ -12157,13 +12280,13 @@ var SingleForm = ({
|
|
|
12157
12280
|
});
|
|
12158
12281
|
return on;
|
|
12159
12282
|
}, [mode, targetAddress, targetNetwork?.shortName]);
|
|
12160
|
-
const isConnected = (0,
|
|
12283
|
+
const isConnected = (0, import_react66.useMemo)(() => {
|
|
12161
12284
|
if (mode === "payment" /* payment */ && dAppOption !== "none" /* None */) {
|
|
12162
12285
|
return isReady;
|
|
12163
12286
|
}
|
|
12164
12287
|
return isReady && !initialSelection.sourceSelection;
|
|
12165
12288
|
}, [isReady, initialSelection, mode, dAppOption]);
|
|
12166
|
-
(0,
|
|
12289
|
+
(0, import_react66.useEffect)(() => {
|
|
12167
12290
|
logger_default.debug("[SingleForm] snapshot", {
|
|
12168
12291
|
mode,
|
|
12169
12292
|
srcShort: sourceNetwork?.shortName,
|
|
@@ -12190,14 +12313,14 @@ var SingleForm = ({
|
|
|
12190
12313
|
demoSourceAddress,
|
|
12191
12314
|
feeDeduct
|
|
12192
12315
|
]);
|
|
12193
|
-
return /* @__PURE__ */ (0,
|
|
12194
|
-
/* @__PURE__ */ (0,
|
|
12195
|
-
/* @__PURE__ */ (0,
|
|
12316
|
+
return /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "single-form", children: [
|
|
12317
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "form-item", children: [
|
|
12318
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("span", { className: "label", children: [
|
|
12196
12319
|
dAppOption === "none" /* None */ && "Source",
|
|
12197
12320
|
" Network:"
|
|
12198
12321
|
] }),
|
|
12199
|
-
/* @__PURE__ */ (0,
|
|
12200
|
-
/* @__PURE__ */ (0,
|
|
12322
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "items", children: [
|
|
12323
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
12201
12324
|
NetworkSelector_default,
|
|
12202
12325
|
{
|
|
12203
12326
|
type: "origin",
|
|
@@ -12207,10 +12330,10 @@ var SingleForm = ({
|
|
|
12207
12330
|
}
|
|
12208
12331
|
}
|
|
12209
12332
|
),
|
|
12210
|
-
/* @__PURE__ */ (0,
|
|
12333
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(CoinDropdown_default, { isSourceChain: true })
|
|
12211
12334
|
] })
|
|
12212
12335
|
] }),
|
|
12213
|
-
/* @__PURE__ */ (0,
|
|
12336
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
|
|
12214
12337
|
"div",
|
|
12215
12338
|
{
|
|
12216
12339
|
className: `dynamic-area ${["CC" /* CC */, "BANK" /* BANK */].includes(
|
|
@@ -12219,20 +12342,20 @@ var SingleForm = ({
|
|
|
12219
12342
|
children: [
|
|
12220
12343
|
!["CC" /* CC */, "BANK" /* BANK */].includes(
|
|
12221
12344
|
sourceNetwork.compatibility
|
|
12222
|
-
) && /* @__PURE__ */ (0,
|
|
12345
|
+
) && /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
|
|
12223
12346
|
"div",
|
|
12224
12347
|
{
|
|
12225
12348
|
className: `form-item wallet-button-item ${isConnectedSourceWrapper ? "connected" : ""}`,
|
|
12226
12349
|
children: [
|
|
12227
|
-
/* @__PURE__ */ (0,
|
|
12228
|
-
/* @__PURE__ */ (0,
|
|
12350
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "label", children: "Wallet:" }),
|
|
12351
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(WalletButton_default, { initialSelection: initialSelection.sourceSelection })
|
|
12229
12352
|
]
|
|
12230
12353
|
}
|
|
12231
12354
|
),
|
|
12232
|
-
mode !== "payment" /* payment */ && /* @__PURE__ */ (0,
|
|
12233
|
-
/* @__PURE__ */ (0,
|
|
12234
|
-
/* @__PURE__ */ (0,
|
|
12235
|
-
/* @__PURE__ */ (0,
|
|
12355
|
+
mode !== "payment" /* payment */ && /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "form-item", children: [
|
|
12356
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "label", children: "Target Network:" }),
|
|
12357
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "items", children: [
|
|
12358
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
12236
12359
|
NetworkSelector_default,
|
|
12237
12360
|
{
|
|
12238
12361
|
type: "target",
|
|
@@ -12242,15 +12365,15 @@ var SingleForm = ({
|
|
|
12242
12365
|
}
|
|
12243
12366
|
}
|
|
12244
12367
|
),
|
|
12245
|
-
/* @__PURE__ */ (0,
|
|
12368
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(CoinDropdown_default, { isSourceChain: false })
|
|
12246
12369
|
] })
|
|
12247
12370
|
] })
|
|
12248
12371
|
]
|
|
12249
12372
|
}
|
|
12250
12373
|
),
|
|
12251
|
-
mode === "bridge" /* bridge */ && /* @__PURE__ */ (0,
|
|
12252
|
-
/* @__PURE__ */ (0,
|
|
12253
|
-
/* @__PURE__ */ (0,
|
|
12374
|
+
mode === "bridge" /* bridge */ && /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: `form-item ${theme.colorMode}`, children: [
|
|
12375
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "label", children: "Target Address:" }),
|
|
12376
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
12254
12377
|
AddressInput_default,
|
|
12255
12378
|
{
|
|
12256
12379
|
theme: theme.colorMode,
|
|
@@ -12258,14 +12381,14 @@ var SingleForm = ({
|
|
|
12258
12381
|
}
|
|
12259
12382
|
)
|
|
12260
12383
|
] }),
|
|
12261
|
-
mode === "light" /* light */ && /* @__PURE__ */ (0,
|
|
12384
|
+
mode === "light" /* light */ && /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)(
|
|
12262
12385
|
"div",
|
|
12263
12386
|
{
|
|
12264
12387
|
className: `form-item wallet-button-item ${isConnectedTargetWrapper ? "connected" : ""}`,
|
|
12265
12388
|
style: { display: "flex", alignItems: "center" },
|
|
12266
12389
|
children: [
|
|
12267
|
-
/* @__PURE__ */ (0,
|
|
12268
|
-
/* @__PURE__ */ (0,
|
|
12390
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "label", children: "Target Wallet:" }),
|
|
12391
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
12269
12392
|
WalletButton_default,
|
|
12270
12393
|
{
|
|
12271
12394
|
initialSelection: initialSelection.targetSelection,
|
|
@@ -12275,10 +12398,10 @@ var SingleForm = ({
|
|
|
12275
12398
|
]
|
|
12276
12399
|
}
|
|
12277
12400
|
),
|
|
12278
|
-
/* @__PURE__ */ (0,
|
|
12279
|
-
/* @__PURE__ */ (0,
|
|
12280
|
-
/* @__PURE__ */ (0,
|
|
12281
|
-
/* @__PURE__ */ (0,
|
|
12401
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: `form-item ${theme.colorMode}`, children: [
|
|
12402
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "label", children: "Amount:" }),
|
|
12403
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: `amount-label-container items ${theme.colorMode}`, children: [
|
|
12404
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)(
|
|
12282
12405
|
"input",
|
|
12283
12406
|
{
|
|
12284
12407
|
className: `${theme.colorMode}`,
|
|
@@ -12289,20 +12412,20 @@ var SingleForm = ({
|
|
|
12289
12412
|
disabled: mode === "payment" /* payment */
|
|
12290
12413
|
}
|
|
12291
12414
|
),
|
|
12292
|
-
/* @__PURE__ */ (0,
|
|
12293
|
-
sourceNetwork.shortName !== "CC" && mode !== "payment" /* payment */ && /* @__PURE__ */ (0,
|
|
12294
|
-
dAppOption === "none" /* None */ && canQuoteFees && /* @__PURE__ */ (0,
|
|
12415
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("div", { className: "max-disclaimer", children: [
|
|
12416
|
+
sourceNetwork.shortName !== "CC" && mode !== "payment" /* payment */ && /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "max-button", onClick: onMaxClick, children: "Max" }),
|
|
12417
|
+
dAppOption === "none" /* None */ && canQuoteFees && /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("p", { className: "fee-amount", children: [
|
|
12295
12418
|
"Est fees:",
|
|
12296
12419
|
" ",
|
|
12297
|
-
isLoadingFees ? /* @__PURE__ */ (0,
|
|
12298
|
-
/* @__PURE__ */ (0,
|
|
12299
|
-
/* @__PURE__ */ (0,
|
|
12300
|
-
/* @__PURE__ */ (0,
|
|
12301
|
-
] }) : feeError ? /* @__PURE__ */ (0,
|
|
12420
|
+
isLoadingFees ? /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("span", { className: "inline-spinner loading", "aria-live": "polite", children: [
|
|
12421
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "dot" }),
|
|
12422
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "dot" }),
|
|
12423
|
+
/* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "dot" })
|
|
12424
|
+
] }) : feeError ? /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "fee-value fee-error", children: "Fee unavailable" }) : totalFee.value >= 0n ? /* @__PURE__ */ (0, import_jsx_runtime85.jsxs)("span", { className: "fee-value", children: [
|
|
12302
12425
|
formatBigInt(totalFee),
|
|
12303
12426
|
" ",
|
|
12304
12427
|
feeTokenSymbol
|
|
12305
|
-
] }) : /* @__PURE__ */ (0,
|
|
12428
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime85.jsx)("span", { className: "fee-value", children: "\u2014" })
|
|
12306
12429
|
] })
|
|
12307
12430
|
] })
|
|
12308
12431
|
] })
|
|
@@ -12312,7 +12435,7 @@ var SingleForm = ({
|
|
|
12312
12435
|
var SingleForm_default = SingleForm;
|
|
12313
12436
|
|
|
12314
12437
|
// src/components/reusable/FiatWidget.tsx
|
|
12315
|
-
var
|
|
12438
|
+
var import_react67 = require("react");
|
|
12316
12439
|
var import_react_redux53 = require("react-redux");
|
|
12317
12440
|
var import_uuid = require("uuid");
|
|
12318
12441
|
|
|
@@ -12340,7 +12463,7 @@ var useCCTransactionId = (backendUrl, transactionIdSeed) => {
|
|
|
12340
12463
|
};
|
|
12341
12464
|
|
|
12342
12465
|
// src/components/reusable/FiatWidget.tsx
|
|
12343
|
-
var
|
|
12466
|
+
var import_jsx_runtime86 = require("react/jsx-runtime");
|
|
12344
12467
|
var FiatWidget = ({ submitCallback }) => {
|
|
12345
12468
|
const dispatch = (0, import_react_redux53.useDispatch)();
|
|
12346
12469
|
const feeDeduct = (0, import_react_redux53.useSelector)(selectFeeDeduct);
|
|
@@ -12350,9 +12473,9 @@ var FiatWidget = ({ submitCallback }) => {
|
|
|
12350
12473
|
const sourceCurrency = (0, import_react_redux53.useSelector)(selectSourceCurrency);
|
|
12351
12474
|
const sourceChain = (0, import_react_redux53.useSelector)(selectSourceChain);
|
|
12352
12475
|
const { transactionValues } = (0, import_react_redux53.useSelector)(selectServiceFee);
|
|
12353
|
-
const ccTransactionIdSeedRef = (0,
|
|
12354
|
-
const identificationUuidRef = (0,
|
|
12355
|
-
const ccTransactionSubmittedRef = (0,
|
|
12476
|
+
const ccTransactionIdSeedRef = (0, import_react67.useRef)((0, import_uuid.v4)());
|
|
12477
|
+
const identificationUuidRef = (0, import_react67.useRef)((0, import_uuid.v4)());
|
|
12478
|
+
const ccTransactionSubmittedRef = (0, import_react67.useRef)(false);
|
|
12356
12479
|
const { data: envOptions, isLoading: isEnvLoading } = useGetEnvOptions({
|
|
12357
12480
|
kimaBackendUrl: backendUrl
|
|
12358
12481
|
});
|
|
@@ -12362,25 +12485,25 @@ var FiatWidget = ({ submitCallback }) => {
|
|
|
12362
12485
|
isLoading: isTransactionIdLoading,
|
|
12363
12486
|
error
|
|
12364
12487
|
} = useCCTransactionId(backendUrl, ccTransactionIdSeedRef.current);
|
|
12365
|
-
(0,
|
|
12488
|
+
(0, import_react67.useEffect)(() => {
|
|
12366
12489
|
dispatch(setCCTransactionIdSeed(ccTransactionIdSeedRef.current));
|
|
12367
12490
|
dispatch(setCCTransactionId(data?.transactionId));
|
|
12368
12491
|
}, [dispatch, data, isTransactionIdLoading]);
|
|
12369
12492
|
const txValues = feeDeduct ? transactionValues.feeFromTarget : transactionValues.feeFromOrigin;
|
|
12370
|
-
const allowanceAmount = (0,
|
|
12493
|
+
const allowanceAmount = (0, import_react67.useMemo)(
|
|
12371
12494
|
() => formatBigInt(txValues.allowanceAmount),
|
|
12372
12495
|
[txValues]
|
|
12373
12496
|
);
|
|
12374
|
-
const [isLoading, setIsLoading] = (0,
|
|
12375
|
-
const baseUrl = (0,
|
|
12497
|
+
const [isLoading, setIsLoading] = (0, import_react67.useState)(true);
|
|
12498
|
+
const baseUrl = (0, import_react67.useMemo)(
|
|
12376
12499
|
() => networkOption === "testnet" /* testnet */ ? "https://widget2-sandbox.depa.wtf" : "https://widget.depa.finance",
|
|
12377
12500
|
[networkOption]
|
|
12378
12501
|
);
|
|
12379
|
-
const scenario = (0,
|
|
12502
|
+
const scenario = (0, import_react67.useMemo)(
|
|
12380
12503
|
() => sourceChain.shortName === "CC" ? "direct_card_payment" : "direct_bank_payment",
|
|
12381
12504
|
[sourceChain]
|
|
12382
12505
|
);
|
|
12383
|
-
const iframeSrc = (0,
|
|
12506
|
+
const iframeSrc = (0, import_react67.useMemo)(() => {
|
|
12384
12507
|
const searchParams = new URLSearchParams({
|
|
12385
12508
|
partner: partnerId ?? "",
|
|
12386
12509
|
amount: allowanceAmount,
|
|
@@ -12399,7 +12522,7 @@ var FiatWidget = ({ submitCallback }) => {
|
|
|
12399
12522
|
scenario,
|
|
12400
12523
|
sourceCurrency
|
|
12401
12524
|
]);
|
|
12402
|
-
(0,
|
|
12525
|
+
(0, import_react67.useEffect)(() => {
|
|
12403
12526
|
const handleMessage = (event) => {
|
|
12404
12527
|
if (event.origin !== baseUrl) {
|
|
12405
12528
|
return;
|
|
@@ -12428,12 +12551,12 @@ var FiatWidget = ({ submitCallback }) => {
|
|
|
12428
12551
|
window.addEventListener("message", handleMessage);
|
|
12429
12552
|
return () => window.removeEventListener("message", handleMessage);
|
|
12430
12553
|
}, []);
|
|
12431
|
-
(0,
|
|
12554
|
+
(0, import_react67.useEffect)(() => {
|
|
12432
12555
|
if (error) dispatch(setCCTransactionStatus("error-id"));
|
|
12433
12556
|
}, [dispatch, error]);
|
|
12434
|
-
return /* @__PURE__ */ (0,
|
|
12435
|
-
(isLoading || isTransactionIdLoading || isEnvLoading || ccTransactionStatus === "success") && /* @__PURE__ */ (0,
|
|
12436
|
-
/* @__PURE__ */ (0,
|
|
12557
|
+
return /* @__PURE__ */ (0, import_jsx_runtime86.jsxs)("div", { className: `cc-widget ${isLoading ? "loading" : ""}`, children: [
|
|
12558
|
+
(isLoading || isTransactionIdLoading || isEnvLoading || ccTransactionStatus === "success") && /* @__PURE__ */ (0, import_jsx_runtime86.jsx)("div", { className: "cc-widget-loader", children: /* @__PURE__ */ (0, import_jsx_runtime86.jsx)(ring_default, { width: 50, height: 50, fill: "#86b8ce" }) }),
|
|
12559
|
+
/* @__PURE__ */ (0, import_jsx_runtime86.jsx)(
|
|
12437
12560
|
"iframe",
|
|
12438
12561
|
{
|
|
12439
12562
|
width: isLoading || isTransactionIdLoading || ccTransactionStatus === "success" || error ? 0 : "100%",
|
|
@@ -12528,12 +12651,12 @@ var useDisconnectWallet7 = () => {
|
|
|
12528
12651
|
var useDisconnectWallet_default = useDisconnectWallet7;
|
|
12529
12652
|
|
|
12530
12653
|
// src/widgets/transfer/components/solana/SolanaConnectModal.tsx
|
|
12531
|
-
var
|
|
12654
|
+
var import_react72 = __toESM(require("react"), 1);
|
|
12532
12655
|
var import_react_redux59 = require("react-redux");
|
|
12533
12656
|
var import_wallet_adapter_react8 = require("@solana/wallet-adapter-react");
|
|
12534
12657
|
|
|
12535
12658
|
// src/widgets/transfer/components/solana/SolanaWalletSelect.tsx
|
|
12536
|
-
var
|
|
12659
|
+
var import_react70 = require("react");
|
|
12537
12660
|
var import_react_redux55 = require("react-redux");
|
|
12538
12661
|
var import_wallet_adapter_react6 = require("@solana/wallet-adapter-react");
|
|
12539
12662
|
var import_wallet_adapter_base = require("@solana/wallet-adapter-base");
|
|
@@ -12549,13 +12672,13 @@ var isUserRejected2 = (err) => {
|
|
|
12549
12672
|
};
|
|
12550
12673
|
|
|
12551
12674
|
// src/widgets/transfer/components/WalletOptionList.tsx
|
|
12552
|
-
var
|
|
12675
|
+
var import_react69 = require("react");
|
|
12553
12676
|
var import_react_redux54 = require("react-redux");
|
|
12554
12677
|
|
|
12555
12678
|
// src/shared/lib/hooks/useHorizontalDragScroll.ts
|
|
12556
|
-
var
|
|
12679
|
+
var import_react68 = require("react");
|
|
12557
12680
|
var useHorizontalDragScroll = (ref) => {
|
|
12558
|
-
(0,
|
|
12681
|
+
(0, import_react68.useEffect)(() => {
|
|
12559
12682
|
const el = ref.current;
|
|
12560
12683
|
if (!el) return;
|
|
12561
12684
|
let isDown = false;
|
|
@@ -12596,7 +12719,7 @@ var useHorizontalDragScroll = (ref) => {
|
|
|
12596
12719
|
};
|
|
12597
12720
|
|
|
12598
12721
|
// src/widgets/transfer/components/WalletOptionList.tsx
|
|
12599
|
-
var
|
|
12722
|
+
var import_jsx_runtime87 = require("react/jsx-runtime");
|
|
12600
12723
|
var WalletOptionList = ({
|
|
12601
12724
|
options,
|
|
12602
12725
|
onSelect,
|
|
@@ -12604,13 +12727,13 @@ var WalletOptionList = ({
|
|
|
12604
12727
|
disabled = false
|
|
12605
12728
|
}) => {
|
|
12606
12729
|
const theme = (0, import_react_redux54.useSelector)(selectTheme);
|
|
12607
|
-
const sliderRef = (0,
|
|
12730
|
+
const sliderRef = (0, import_react69.useRef)(null);
|
|
12608
12731
|
useHorizontalDragScroll(sliderRef);
|
|
12609
12732
|
const detected = options.filter((wallet) => wallet.installed);
|
|
12610
12733
|
const undetected = options.filter((wallet) => !wallet.installed);
|
|
12611
|
-
const renderIcon = (icon, alt) => typeof icon === "string" ? /* @__PURE__ */ (0,
|
|
12612
|
-
return /* @__PURE__ */ (0,
|
|
12613
|
-
detected.map((wallet) => /* @__PURE__ */ (0,
|
|
12734
|
+
const renderIcon = (icon, alt) => typeof icon === "string" ? /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("img", { src: icon, alt }) : icon;
|
|
12735
|
+
return /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "wallet-select", children: /* @__PURE__ */ (0, import_jsx_runtime87.jsx)("div", { className: "slide-area hide-scrollbar", ref: sliderRef, children: /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "wallet-container", children: [
|
|
12736
|
+
detected.map((wallet) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
12614
12737
|
"div",
|
|
12615
12738
|
{
|
|
12616
12739
|
className: `card-item ${theme.colorMode} ${selectedWallet === wallet.id ? "selected" : ""}`,
|
|
@@ -12618,21 +12741,21 @@ var WalletOptionList = ({
|
|
|
12618
12741
|
if (disabled) return;
|
|
12619
12742
|
onSelect(wallet.id);
|
|
12620
12743
|
},
|
|
12621
|
-
children: /* @__PURE__ */ (0,
|
|
12744
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "wallet-item", children: [
|
|
12622
12745
|
renderIcon(wallet.icon, wallet.name),
|
|
12623
|
-
/* @__PURE__ */ (0,
|
|
12746
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsx)("span", { children: wallet.name })
|
|
12624
12747
|
] })
|
|
12625
12748
|
},
|
|
12626
12749
|
wallet.id
|
|
12627
12750
|
)),
|
|
12628
|
-
undetected.map((wallet) => /* @__PURE__ */ (0,
|
|
12751
|
+
undetected.map((wallet) => /* @__PURE__ */ (0, import_jsx_runtime87.jsx)(
|
|
12629
12752
|
ExternalLink_default,
|
|
12630
12753
|
{
|
|
12631
12754
|
to: wallet.installUrl || "#",
|
|
12632
12755
|
className: `card-item ${theme.colorMode}`,
|
|
12633
|
-
children: /* @__PURE__ */ (0,
|
|
12756
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("div", { className: "wallet-item", children: [
|
|
12634
12757
|
renderIcon(wallet.icon, wallet.name),
|
|
12635
|
-
/* @__PURE__ */ (0,
|
|
12758
|
+
/* @__PURE__ */ (0, import_jsx_runtime87.jsxs)("span", { children: [
|
|
12636
12759
|
"Install ",
|
|
12637
12760
|
wallet.name
|
|
12638
12761
|
] })
|
|
@@ -12645,12 +12768,12 @@ var WalletOptionList = ({
|
|
|
12645
12768
|
var WalletOptionList_default = WalletOptionList;
|
|
12646
12769
|
|
|
12647
12770
|
// src/widgets/transfer/components/solana/SolanaWalletSelect.tsx
|
|
12648
|
-
var
|
|
12771
|
+
var import_jsx_runtime88 = require("react/jsx-runtime");
|
|
12649
12772
|
var SolanaWalletSelect = () => {
|
|
12650
12773
|
const sourceChain = (0, import_react_redux55.useSelector)(selectSourceChain);
|
|
12651
12774
|
const dispatch = (0, import_react_redux55.useDispatch)();
|
|
12652
12775
|
const { wallet, wallets, select, connect, connected } = (0, import_wallet_adapter_react6.useWallet)();
|
|
12653
|
-
const options = (0,
|
|
12776
|
+
const options = (0, import_react70.useMemo)(() => {
|
|
12654
12777
|
return wallets.map((candidate) => ({
|
|
12655
12778
|
id: candidate.adapter.name,
|
|
12656
12779
|
name: candidate.adapter.name,
|
|
@@ -12659,13 +12782,13 @@ var SolanaWalletSelect = () => {
|
|
|
12659
12782
|
installed: candidate.readyState === import_wallet_adapter_base.WalletReadyState.Installed || candidate.readyState === import_wallet_adapter_base.WalletReadyState.Loadable
|
|
12660
12783
|
}));
|
|
12661
12784
|
}, [wallets]);
|
|
12662
|
-
const handleWalletClick = (0,
|
|
12785
|
+
const handleWalletClick = (0, import_react70.useCallback)(
|
|
12663
12786
|
(walletName) => {
|
|
12664
12787
|
select(walletName);
|
|
12665
12788
|
},
|
|
12666
12789
|
[select]
|
|
12667
12790
|
);
|
|
12668
|
-
(0,
|
|
12791
|
+
(0, import_react70.useEffect)(() => {
|
|
12669
12792
|
if (!wallet) return;
|
|
12670
12793
|
if (sourceChain.shortName !== "SOL") {
|
|
12671
12794
|
return;
|
|
@@ -12687,12 +12810,12 @@ var SolanaWalletSelect = () => {
|
|
|
12687
12810
|
});
|
|
12688
12811
|
}
|
|
12689
12812
|
}, [wallet, sourceChain]);
|
|
12690
|
-
return /* @__PURE__ */ (0,
|
|
12813
|
+
return /* @__PURE__ */ (0, import_jsx_runtime88.jsx)(WalletOptionList_default, { options, onSelect: handleWalletClick });
|
|
12691
12814
|
};
|
|
12692
12815
|
var SolanaWalletSelect_default = SolanaWalletSelect;
|
|
12693
12816
|
|
|
12694
12817
|
// src/widgets/transfer/components/solana/AccountDetailsModal.tsx
|
|
12695
|
-
var
|
|
12818
|
+
var import_react71 = require("react");
|
|
12696
12819
|
var import_react_redux57 = require("react-redux");
|
|
12697
12820
|
var import_wallet_adapter_react7 = require("@solana/wallet-adapter-react");
|
|
12698
12821
|
|
|
@@ -12712,7 +12835,7 @@ var getBtcAccountExplorerUrl = (address, networkOption) => {
|
|
|
12712
12835
|
|
|
12713
12836
|
// src/widgets/transfer/components/WalletModalShell.tsx
|
|
12714
12837
|
var import_react_redux56 = require("react-redux");
|
|
12715
|
-
var
|
|
12838
|
+
var import_jsx_runtime89 = require("react/jsx-runtime");
|
|
12716
12839
|
var WalletModalShell = ({
|
|
12717
12840
|
isOpen,
|
|
12718
12841
|
title,
|
|
@@ -12723,18 +12846,18 @@ var WalletModalShell = ({
|
|
|
12723
12846
|
}) => {
|
|
12724
12847
|
const theme = (0, import_react_redux56.useSelector)(selectTheme);
|
|
12725
12848
|
if (!isOpen) return null;
|
|
12726
|
-
return /* @__PURE__ */ (0,
|
|
12849
|
+
return /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)(
|
|
12727
12850
|
"div",
|
|
12728
12851
|
{
|
|
12729
12852
|
className: `kima-modal ${theme.colorMode} ${isOpen ? "open" : ""} ${className}`,
|
|
12730
12853
|
children: [
|
|
12731
|
-
/* @__PURE__ */ (0,
|
|
12732
|
-
/* @__PURE__ */ (0,
|
|
12733
|
-
/* @__PURE__ */ (0,
|
|
12734
|
-
/* @__PURE__ */ (0,
|
|
12735
|
-
/* @__PURE__ */ (0,
|
|
12854
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "modal-overlay", onClick: onClose }),
|
|
12855
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: `modal-content-container ${theme.colorMode}`, children: [
|
|
12856
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "kima-card-header", children: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { className: "topbar", children: [
|
|
12857
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "title", children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("h3", { children: title }) }),
|
|
12858
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "control-buttons", children: rightHeader })
|
|
12736
12859
|
] }) }),
|
|
12737
|
-
/* @__PURE__ */ (0,
|
|
12860
|
+
/* @__PURE__ */ (0, import_jsx_runtime89.jsx)("div", { className: "modal-content", children })
|
|
12738
12861
|
] })
|
|
12739
12862
|
]
|
|
12740
12863
|
}
|
|
@@ -12743,7 +12866,7 @@ var WalletModalShell = ({
|
|
|
12743
12866
|
var WalletModalShell_default = WalletModalShell;
|
|
12744
12867
|
|
|
12745
12868
|
// src/widgets/transfer/components/AccountDetailsModalBase.tsx
|
|
12746
|
-
var
|
|
12869
|
+
var import_jsx_runtime90 = require("react/jsx-runtime");
|
|
12747
12870
|
var AccountDetailsModalBase = ({
|
|
12748
12871
|
isOpen,
|
|
12749
12872
|
onClose,
|
|
@@ -12760,32 +12883,32 @@ var AccountDetailsModalBase = ({
|
|
|
12760
12883
|
closeButtonClassName = "cross-icon-button"
|
|
12761
12884
|
}) => {
|
|
12762
12885
|
const isLight = themeMode ? themeMode === "light" : true;
|
|
12763
|
-
return /* @__PURE__ */ (0,
|
|
12886
|
+
return /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(
|
|
12764
12887
|
WalletModalShell_default,
|
|
12765
12888
|
{
|
|
12766
12889
|
isOpen: !!isOpen,
|
|
12767
12890
|
title: "Account Details",
|
|
12768
12891
|
onClose,
|
|
12769
|
-
rightHeader: /* @__PURE__ */ (0,
|
|
12892
|
+
rightHeader: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("button", { className: closeButtonClassName, onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Cross_default, { fill: isLight ? "black" : "white" }) }),
|
|
12770
12893
|
children: [
|
|
12771
|
-
/* @__PURE__ */ (0,
|
|
12772
|
-
iconSymbol ? /* @__PURE__ */ (0,
|
|
12773
|
-
/* @__PURE__ */ (0,
|
|
12774
|
-
/* @__PURE__ */ (0,
|
|
12775
|
-
address && /* @__PURE__ */ (0,
|
|
12894
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "summary", children: [
|
|
12895
|
+
iconSymbol ? /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: "summary-icon", children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(ChainIcon, { width: 100, height: 100, symbol: iconSymbol }) }) : null,
|
|
12896
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("div", { className: "address", children: [
|
|
12897
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("h2", { children: address ? getShortenedAddress(address) : "\u2014" }),
|
|
12898
|
+
address && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(CopyButton_default, { text: address })
|
|
12776
12899
|
] }),
|
|
12777
|
-
isBalanceLoading ? /* @__PURE__ */ (0,
|
|
12900
|
+
isBalanceLoading ? /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: "balance-skeleton", "aria-label": "balance-loading" }) : /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)("h3", { children: [
|
|
12778
12901
|
balance == null ? "0" : decimals == null ? balance.toString() : formatBigInt({ value: balance, decimals }),
|
|
12779
12902
|
" ",
|
|
12780
12903
|
symbol
|
|
12781
12904
|
] })
|
|
12782
12905
|
] }),
|
|
12783
|
-
/* @__PURE__ */ (0,
|
|
12784
|
-
/* @__PURE__ */ (0,
|
|
12785
|
-
/* @__PURE__ */ (0,
|
|
12786
|
-
/* @__PURE__ */ (0,
|
|
12906
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(SecondaryButton_default, { className: "block-explorer", children: /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(ExternalLink_default, { className: "link", to: explorerUrl, children: [
|
|
12907
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(Explorer_default, { fill: "#778DA3" }),
|
|
12908
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)("p", { children: "Block explorer" }),
|
|
12909
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(ExternalUrl_default, { fill: "#778DA3" })
|
|
12787
12910
|
] }) }),
|
|
12788
|
-
/* @__PURE__ */ (0,
|
|
12911
|
+
/* @__PURE__ */ (0, import_jsx_runtime90.jsx)(PrimaryButton_default, { clickHandler: onDisconnect, disabled: disableDisconnect, children: "Disconnect" })
|
|
12789
12912
|
]
|
|
12790
12913
|
}
|
|
12791
12914
|
);
|
|
@@ -12794,7 +12917,7 @@ var AccountDetailsModalBase_default = AccountDetailsModalBase;
|
|
|
12794
12917
|
|
|
12795
12918
|
// src/widgets/transfer/components/solana/AccountDetailsModal.tsx
|
|
12796
12919
|
var import_react_hot_toast7 = __toESM(require("react-hot-toast"), 1);
|
|
12797
|
-
var
|
|
12920
|
+
var import_jsx_runtime91 = require("react/jsx-runtime");
|
|
12798
12921
|
var AccountDetailsModal = () => {
|
|
12799
12922
|
const dispatch = (0, import_react_redux57.useDispatch)();
|
|
12800
12923
|
const theme = (0, import_react_redux57.useSelector)(selectTheme);
|
|
@@ -12811,7 +12934,7 @@ var AccountDetailsModal = () => {
|
|
|
12811
12934
|
} = useSolNativeBalance();
|
|
12812
12935
|
const isSol = sourceChain.shortName === "SOL" /* SOLANA */;
|
|
12813
12936
|
if (!isSol) return null;
|
|
12814
|
-
const explorerUrl = (0,
|
|
12937
|
+
const explorerUrl = (0, import_react71.useMemo)(
|
|
12815
12938
|
() => getSolanaAccountExplorerUrl(sourceAddress, networkOption),
|
|
12816
12939
|
[sourceAddress, networkOption]
|
|
12817
12940
|
);
|
|
@@ -12829,13 +12952,13 @@ var AccountDetailsModal = () => {
|
|
|
12829
12952
|
if (isUserRejected2(e)) {
|
|
12830
12953
|
(0, import_react_hot_toast7.default)("Wallet disconnect was cancelled.");
|
|
12831
12954
|
} else {
|
|
12832
|
-
import_react_hot_toast7.default.error("Failed to disconnect wallet.", { icon: /* @__PURE__ */ (0,
|
|
12955
|
+
import_react_hot_toast7.default.error("Failed to disconnect wallet.", { icon: /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(Error_default, {}) });
|
|
12833
12956
|
}
|
|
12834
12957
|
} finally {
|
|
12835
12958
|
close();
|
|
12836
12959
|
}
|
|
12837
12960
|
};
|
|
12838
|
-
return /* @__PURE__ */ (0,
|
|
12961
|
+
return /* @__PURE__ */ (0, import_jsx_runtime91.jsx)(
|
|
12839
12962
|
AccountDetailsModalBase_default,
|
|
12840
12963
|
{
|
|
12841
12964
|
isOpen: !!isOpen,
|
|
@@ -12857,7 +12980,7 @@ var AccountDetailsModal_default = AccountDetailsModal;
|
|
|
12857
12980
|
|
|
12858
12981
|
// src/widgets/transfer/components/WalletConnectModalBase.tsx
|
|
12859
12982
|
var import_react_redux58 = require("react-redux");
|
|
12860
|
-
var
|
|
12983
|
+
var import_jsx_runtime92 = require("react/jsx-runtime");
|
|
12861
12984
|
var WalletConnectModalBase = ({
|
|
12862
12985
|
isOpen,
|
|
12863
12986
|
mode,
|
|
@@ -12867,14 +12990,14 @@ var WalletConnectModalBase = ({
|
|
|
12867
12990
|
children
|
|
12868
12991
|
}) => {
|
|
12869
12992
|
const dispatch = (0, import_react_redux58.useDispatch)();
|
|
12870
|
-
return /* @__PURE__ */ (0,
|
|
12993
|
+
return /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)(
|
|
12871
12994
|
WalletModalShell_default,
|
|
12872
12995
|
{
|
|
12873
12996
|
isOpen,
|
|
12874
12997
|
title: "Connect Wallet",
|
|
12875
12998
|
onClose,
|
|
12876
12999
|
className: "wallet-connect",
|
|
12877
|
-
rightHeader: /* @__PURE__ */ (0,
|
|
13000
|
+
rightHeader: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("button", { className: "cross-icon-button", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
12878
13001
|
Cross_default,
|
|
12879
13002
|
{
|
|
12880
13003
|
width: 30,
|
|
@@ -12883,9 +13006,9 @@ var WalletConnectModalBase = ({
|
|
|
12883
13006
|
}
|
|
12884
13007
|
) }),
|
|
12885
13008
|
children: [
|
|
12886
|
-
demoMessage && /* @__PURE__ */ (0,
|
|
12887
|
-
mode !== "light" /* light */ ? children : /* @__PURE__ */ (0,
|
|
12888
|
-
/* @__PURE__ */ (0,
|
|
13009
|
+
demoMessage && /* @__PURE__ */ (0, import_jsx_runtime92.jsx)("p", { className: "muted", children: demoMessage }),
|
|
13010
|
+
mode !== "light" /* light */ ? children : /* @__PURE__ */ (0, import_jsx_runtime92.jsxs)("div", { className: "wallet-modal-actions", children: [
|
|
13011
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
|
|
12889
13012
|
"button",
|
|
12890
13013
|
{
|
|
12891
13014
|
className: "secondary",
|
|
@@ -12893,7 +13016,7 @@ var WalletConnectModalBase = ({
|
|
|
12893
13016
|
children: "View Account"
|
|
12894
13017
|
}
|
|
12895
13018
|
),
|
|
12896
|
-
/* @__PURE__ */ (0,
|
|
13019
|
+
/* @__PURE__ */ (0, import_jsx_runtime92.jsx)("button", { className: "primary", onClick: onClose, children: "Close" })
|
|
12897
13020
|
] })
|
|
12898
13021
|
]
|
|
12899
13022
|
}
|
|
@@ -12902,30 +13025,30 @@ var WalletConnectModalBase = ({
|
|
|
12902
13025
|
var WalletConnectModalBase_default = WalletConnectModalBase;
|
|
12903
13026
|
|
|
12904
13027
|
// src/widgets/transfer/components/solana/SolanaConnectModal.tsx
|
|
12905
|
-
var
|
|
13028
|
+
var import_jsx_runtime93 = require("react/jsx-runtime");
|
|
12906
13029
|
var SolanaWalletConnectModal = () => {
|
|
12907
13030
|
const dispatch = (0, import_react_redux59.useDispatch)();
|
|
12908
13031
|
const theme = (0, import_react_redux59.useSelector)(selectTheme);
|
|
12909
13032
|
const isOpen = (0, import_react_redux59.useSelector)(selectSolanaConnectModal);
|
|
12910
13033
|
const mode = (0, import_react_redux59.useSelector)(selectMode);
|
|
12911
13034
|
const { connecting, connected, publicKey } = (0, import_wallet_adapter_react8.useWallet)();
|
|
12912
|
-
const close = (0,
|
|
13035
|
+
const close = (0, import_react72.useCallback)(() => {
|
|
12913
13036
|
dispatch(setSolanaConnectModal(false));
|
|
12914
13037
|
}, [dispatch]);
|
|
12915
|
-
|
|
13038
|
+
import_react72.default.useEffect(() => {
|
|
12916
13039
|
logger_default.debug("[SolanaConnectModal] wallet-adapter state", {
|
|
12917
13040
|
connecting,
|
|
12918
13041
|
connected,
|
|
12919
13042
|
publicKey: publicKey?.toBase58?.()
|
|
12920
13043
|
});
|
|
12921
13044
|
}, [connecting, connected, publicKey]);
|
|
12922
|
-
const demoMsg = (0,
|
|
13045
|
+
const demoMsg = (0, import_react72.useMemo)(
|
|
12923
13046
|
() => mode === "light" /* light */ ? `Light mode uses a demo Solana address (${lightDemoAccounts.SOL}).` : "",
|
|
12924
13047
|
[mode]
|
|
12925
13048
|
);
|
|
12926
|
-
return /* @__PURE__ */ (0,
|
|
12927
|
-
/* @__PURE__ */ (0,
|
|
12928
|
-
/* @__PURE__ */ (0,
|
|
13049
|
+
return /* @__PURE__ */ (0, import_jsx_runtime93.jsxs)(import_jsx_runtime93.Fragment, { children: [
|
|
13050
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(AccountDetailsModal_default, {}),
|
|
13051
|
+
/* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
|
|
12929
13052
|
WalletConnectModalBase_default,
|
|
12930
13053
|
{
|
|
12931
13054
|
isOpen: !!isOpen,
|
|
@@ -12933,7 +13056,7 @@ var SolanaWalletConnectModal = () => {
|
|
|
12933
13056
|
themeMode: theme.colorMode ?? "light" /* light */,
|
|
12934
13057
|
demoMessage: demoMsg,
|
|
12935
13058
|
onClose: close,
|
|
12936
|
-
children: /* @__PURE__ */ (0,
|
|
13059
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(SolanaWalletSelect_default, {})
|
|
12937
13060
|
}
|
|
12938
13061
|
)
|
|
12939
13062
|
] });
|
|
@@ -12941,15 +13064,15 @@ var SolanaWalletConnectModal = () => {
|
|
|
12941
13064
|
var SolanaConnectModal_default = SolanaWalletConnectModal;
|
|
12942
13065
|
|
|
12943
13066
|
// src/widgets/transfer/components/tron/TronWalletConnectModal.tsx
|
|
12944
|
-
var
|
|
13067
|
+
var import_react75 = require("react");
|
|
12945
13068
|
var import_react_redux62 = require("react-redux");
|
|
12946
13069
|
|
|
12947
13070
|
// src/widgets/transfer/components/tron/AccountDetailsModal.tsx
|
|
12948
|
-
var
|
|
13071
|
+
var import_react73 = require("react");
|
|
12949
13072
|
var import_react_redux60 = require("react-redux");
|
|
12950
13073
|
var import_tronwallet_adapter_react_hooks6 = require("@tronweb3/tronwallet-adapter-react-hooks");
|
|
12951
13074
|
var import_react_hot_toast8 = __toESM(require("react-hot-toast"), 1);
|
|
12952
|
-
var
|
|
13075
|
+
var import_jsx_runtime94 = require("react/jsx-runtime");
|
|
12953
13076
|
var AccountDetailsModal2 = () => {
|
|
12954
13077
|
const dispatch = (0, import_react_redux60.useDispatch)();
|
|
12955
13078
|
const theme = (0, import_react_redux60.useSelector)(selectTheme);
|
|
@@ -12966,7 +13089,7 @@ var AccountDetailsModal2 = () => {
|
|
|
12966
13089
|
} = useTronNativeBalance();
|
|
12967
13090
|
const isTrx = sourceChain.shortName === "TRX" /* TRON */;
|
|
12968
13091
|
if (!isTrx) return null;
|
|
12969
|
-
const explorerUrl = (0,
|
|
13092
|
+
const explorerUrl = (0, import_react73.useMemo)(
|
|
12970
13093
|
() => getTronAccountExplorerUrl(sourceAddress, networkOption),
|
|
12971
13094
|
[sourceAddress, networkOption]
|
|
12972
13095
|
);
|
|
@@ -12984,13 +13107,13 @@ var AccountDetailsModal2 = () => {
|
|
|
12984
13107
|
if (isUserRejected2(e)) {
|
|
12985
13108
|
(0, import_react_hot_toast8.default)("Wallet disconnect was cancelled.");
|
|
12986
13109
|
} else {
|
|
12987
|
-
import_react_hot_toast8.default.error("Failed to disconnect wallet.", { icon: /* @__PURE__ */ (0,
|
|
13110
|
+
import_react_hot_toast8.default.error("Failed to disconnect wallet.", { icon: /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(Error_default, {}) });
|
|
12988
13111
|
}
|
|
12989
13112
|
} finally {
|
|
12990
13113
|
close();
|
|
12991
13114
|
}
|
|
12992
13115
|
};
|
|
12993
|
-
return /* @__PURE__ */ (0,
|
|
13116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(
|
|
12994
13117
|
AccountDetailsModalBase_default,
|
|
12995
13118
|
{
|
|
12996
13119
|
isOpen: !!isOpen,
|
|
@@ -13011,12 +13134,12 @@ var AccountDetailsModal2 = () => {
|
|
|
13011
13134
|
var AccountDetailsModal_default2 = AccountDetailsModal2;
|
|
13012
13135
|
|
|
13013
13136
|
// src/widgets/transfer/components/tron/TronWalletSelect.tsx
|
|
13014
|
-
var
|
|
13137
|
+
var import_react74 = require("react");
|
|
13015
13138
|
var import_react_redux61 = require("react-redux");
|
|
13016
13139
|
var import_tronwallet_adapter_react_hooks7 = require("@tronweb3/tronwallet-adapter-react-hooks");
|
|
13017
13140
|
var import_tronwallet_abstract_adapter = require("@tronweb3/tronwallet-abstract-adapter");
|
|
13018
13141
|
var import_react_hot_toast9 = __toESM(require("react-hot-toast"), 1);
|
|
13019
|
-
var
|
|
13142
|
+
var import_jsx_runtime95 = require("react/jsx-runtime");
|
|
13020
13143
|
var TronWalletSelect = () => {
|
|
13021
13144
|
const dispatch = (0, import_react_redux61.useDispatch)();
|
|
13022
13145
|
const {
|
|
@@ -13026,7 +13149,7 @@ var TronWalletSelect = () => {
|
|
|
13026
13149
|
connect,
|
|
13027
13150
|
connected
|
|
13028
13151
|
} = (0, import_tronwallet_adapter_react_hooks7.useWallet)();
|
|
13029
|
-
const options = (0,
|
|
13152
|
+
const options = (0, import_react74.useMemo)(() => {
|
|
13030
13153
|
return wallets.map((wallet) => ({
|
|
13031
13154
|
id: wallet.adapter.name,
|
|
13032
13155
|
name: wallet.adapter.name,
|
|
@@ -13035,7 +13158,7 @@ var TronWalletSelect = () => {
|
|
|
13035
13158
|
installed: wallet.state === import_tronwallet_abstract_adapter.AdapterState.Connected || wallet.state === import_tronwallet_abstract_adapter.AdapterState.Disconnect || wallet.state === import_tronwallet_abstract_adapter.AdapterState.Loading
|
|
13036
13159
|
}));
|
|
13037
13160
|
}, [wallets]);
|
|
13038
|
-
(0,
|
|
13161
|
+
(0, import_react74.useEffect)(() => {
|
|
13039
13162
|
connected && dispatch(setTronConnectModal(false));
|
|
13040
13163
|
}, [connected]);
|
|
13041
13164
|
const connectWallet = async (walletName) => {
|
|
@@ -13053,27 +13176,27 @@ var TronWalletSelect = () => {
|
|
|
13053
13176
|
}
|
|
13054
13177
|
}
|
|
13055
13178
|
};
|
|
13056
|
-
return /* @__PURE__ */ (0,
|
|
13179
|
+
return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(WalletOptionList_default, { options, onSelect: connectWallet });
|
|
13057
13180
|
};
|
|
13058
13181
|
var TronWalletSelect_default = TronWalletSelect;
|
|
13059
13182
|
|
|
13060
13183
|
// src/widgets/transfer/components/tron/TronWalletConnectModal.tsx
|
|
13061
|
-
var
|
|
13184
|
+
var import_jsx_runtime96 = require("react/jsx-runtime");
|
|
13062
13185
|
var TronWalletConnectModal = () => {
|
|
13063
13186
|
const dispatch = (0, import_react_redux62.useDispatch)();
|
|
13064
13187
|
const theme = (0, import_react_redux62.useSelector)(selectTheme);
|
|
13065
13188
|
const isOpen = (0, import_react_redux62.useSelector)(selectTronConnectModal);
|
|
13066
13189
|
const mode = (0, import_react_redux62.useSelector)(selectMode);
|
|
13067
|
-
const close = (0,
|
|
13190
|
+
const close = (0, import_react75.useCallback)(() => {
|
|
13068
13191
|
dispatch(setTronConnectModal(false));
|
|
13069
13192
|
}, [dispatch]);
|
|
13070
|
-
const demoMsg = (0,
|
|
13193
|
+
const demoMsg = (0, import_react75.useMemo)(
|
|
13071
13194
|
() => mode === "light" /* light */ ? `Light mode uses a demo Tron address (${lightDemoAccounts.TRX}).` : "",
|
|
13072
13195
|
[mode]
|
|
13073
13196
|
);
|
|
13074
|
-
return /* @__PURE__ */ (0,
|
|
13075
|
-
/* @__PURE__ */ (0,
|
|
13076
|
-
/* @__PURE__ */ (0,
|
|
13197
|
+
return /* @__PURE__ */ (0, import_jsx_runtime96.jsxs)(import_jsx_runtime96.Fragment, { children: [
|
|
13198
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(AccountDetailsModal_default2, {}),
|
|
13199
|
+
/* @__PURE__ */ (0, import_jsx_runtime96.jsx)(
|
|
13077
13200
|
WalletConnectModalBase_default,
|
|
13078
13201
|
{
|
|
13079
13202
|
isOpen: !!isOpen,
|
|
@@ -13081,7 +13204,7 @@ var TronWalletConnectModal = () => {
|
|
|
13081
13204
|
themeMode: theme.colorMode ?? "light" /* light */,
|
|
13082
13205
|
demoMessage: demoMsg,
|
|
13083
13206
|
onClose: close,
|
|
13084
|
-
children: /* @__PURE__ */ (0,
|
|
13207
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime96.jsx)(TronWalletSelect_default, {})
|
|
13085
13208
|
}
|
|
13086
13209
|
)
|
|
13087
13210
|
] });
|
|
@@ -13089,18 +13212,17 @@ var TronWalletConnectModal = () => {
|
|
|
13089
13212
|
var TronWalletConnectModal_default = TronWalletConnectModal;
|
|
13090
13213
|
|
|
13091
13214
|
// src/widgets/transfer/components/btc/BtcConnectModal.tsx
|
|
13092
|
-
var
|
|
13215
|
+
var import_react79 = require("react");
|
|
13093
13216
|
var import_react_redux65 = require("react-redux");
|
|
13094
13217
|
var import_react_hot_toast11 = __toESM(require("react-hot-toast"), 1);
|
|
13095
13218
|
|
|
13096
13219
|
// src/features/connect-wallet/btc/useBtcWallet.ts
|
|
13097
|
-
var
|
|
13220
|
+
var import_react76 = require("react");
|
|
13098
13221
|
var import_react_redux63 = require("react-redux");
|
|
13099
13222
|
var useBtcWallet = () => {
|
|
13100
13223
|
const dispatch = (0, import_react_redux63.useDispatch)();
|
|
13101
|
-
const { externalProvider } = useKimaContext();
|
|
13102
13224
|
const networkOption = (0, import_react_redux63.useSelector)(selectNetworkOption);
|
|
13103
|
-
const ensureNetworkMatch = (0,
|
|
13225
|
+
const ensureNetworkMatch = (0, import_react76.useCallback)(
|
|
13104
13226
|
(address) => {
|
|
13105
13227
|
if (!address) return;
|
|
13106
13228
|
if (isBtcAddressOnNetwork(address, networkOption)) return;
|
|
@@ -13114,22 +13236,8 @@ var useBtcWallet = () => {
|
|
|
13114
13236
|
},
|
|
13115
13237
|
[networkOption]
|
|
13116
13238
|
);
|
|
13117
|
-
const connect = (0,
|
|
13239
|
+
const connect = (0, import_react76.useCallback)(
|
|
13118
13240
|
async (options) => {
|
|
13119
|
-
if (externalProvider?.type === "btc") {
|
|
13120
|
-
const signer = externalProvider.signer;
|
|
13121
|
-
const address2 = typeof signer === "string" ? signer : signer?.address ?? "";
|
|
13122
|
-
const pubkey2 = normalizeBtcPubkeyHex(
|
|
13123
|
-
typeof signer === "object" && signer?.publicKey || externalProvider.provider?.publicKey || ""
|
|
13124
|
-
) || "";
|
|
13125
|
-
ensureNetworkMatch(address2);
|
|
13126
|
-
if (address2) {
|
|
13127
|
-
dispatch(setBitcoinAddress(address2));
|
|
13128
|
-
dispatch(setSourceAddress(address2));
|
|
13129
|
-
}
|
|
13130
|
-
if (pubkey2) dispatch(setBitcoinPubkey(pubkey2));
|
|
13131
|
-
return { address: address2, pubkey: pubkey2 };
|
|
13132
|
-
}
|
|
13133
13241
|
const walletType = options?.wallet;
|
|
13134
13242
|
const unisat = walletType === "unisat" || !walletType ? getUnisat() : null;
|
|
13135
13243
|
if (walletType === "unisat" && !unisat) {
|
|
@@ -13177,9 +13285,9 @@ var useBtcWallet = () => {
|
|
|
13177
13285
|
});
|
|
13178
13286
|
return { address, pubkey };
|
|
13179
13287
|
},
|
|
13180
|
-
[dispatch, ensureNetworkMatch
|
|
13288
|
+
[dispatch, ensureNetworkMatch]
|
|
13181
13289
|
);
|
|
13182
|
-
const disconnect = (0,
|
|
13290
|
+
const disconnect = (0, import_react76.useCallback)(async () => {
|
|
13183
13291
|
const unisat = getUnisat();
|
|
13184
13292
|
if (unisat?.disconnect) {
|
|
13185
13293
|
await unisat.disconnect();
|
|
@@ -13193,14 +13301,14 @@ var useBtcWallet = () => {
|
|
|
13193
13301
|
};
|
|
13194
13302
|
|
|
13195
13303
|
// src/widgets/transfer/components/btc/BtcWalletSelect.tsx
|
|
13196
|
-
var
|
|
13197
|
-
var
|
|
13304
|
+
var import_react77 = require("react");
|
|
13305
|
+
var import_jsx_runtime97 = require("react/jsx-runtime");
|
|
13198
13306
|
var BtcWalletSelect = ({
|
|
13199
13307
|
selectedWallet,
|
|
13200
13308
|
onSelect,
|
|
13201
13309
|
disabled = false
|
|
13202
13310
|
}) => {
|
|
13203
|
-
const wallets = (0,
|
|
13311
|
+
const wallets = (0, import_react77.useMemo)(() => {
|
|
13204
13312
|
const unisatInstalled = !!getUnisat();
|
|
13205
13313
|
const list = [
|
|
13206
13314
|
{
|
|
@@ -13208,12 +13316,12 @@ var BtcWalletSelect = ({
|
|
|
13208
13316
|
name: "UniSat",
|
|
13209
13317
|
installUrl: "https://unisat.io/download",
|
|
13210
13318
|
installed: unisatInstalled,
|
|
13211
|
-
icon: /* @__PURE__ */ (0,
|
|
13319
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(UniSat_default, {})
|
|
13212
13320
|
}
|
|
13213
13321
|
];
|
|
13214
13322
|
return list;
|
|
13215
13323
|
}, []);
|
|
13216
|
-
return /* @__PURE__ */ (0,
|
|
13324
|
+
return /* @__PURE__ */ (0, import_jsx_runtime97.jsx)(
|
|
13217
13325
|
WalletOptionList_default,
|
|
13218
13326
|
{
|
|
13219
13327
|
options: wallets,
|
|
@@ -13226,10 +13334,10 @@ var BtcWalletSelect = ({
|
|
|
13226
13334
|
var BtcWalletSelect_default = BtcWalletSelect;
|
|
13227
13335
|
|
|
13228
13336
|
// src/widgets/transfer/components/btc/AccountDetailsModal.tsx
|
|
13229
|
-
var
|
|
13337
|
+
var import_react78 = require("react");
|
|
13230
13338
|
var import_react_redux64 = require("react-redux");
|
|
13231
13339
|
var import_react_hot_toast10 = __toESM(require("react-hot-toast"), 1);
|
|
13232
|
-
var
|
|
13340
|
+
var import_jsx_runtime98 = require("react/jsx-runtime");
|
|
13233
13341
|
var AccountDetailsModal3 = () => {
|
|
13234
13342
|
const dispatch = (0, import_react_redux64.useDispatch)();
|
|
13235
13343
|
const theme = (0, import_react_redux64.useSelector)(selectTheme);
|
|
@@ -13246,7 +13354,7 @@ var AccountDetailsModal3 = () => {
|
|
|
13246
13354
|
} = useBtcBalance();
|
|
13247
13355
|
const isBtc2 = sourceChain.shortName === "BTC" /* BTC */;
|
|
13248
13356
|
if (!isBtc2) return null;
|
|
13249
|
-
const explorerUrl = (0,
|
|
13357
|
+
const explorerUrl = (0, import_react78.useMemo)(
|
|
13250
13358
|
() => getBtcAccountExplorerUrl(sourceAddress, networkOption),
|
|
13251
13359
|
[sourceAddress, networkOption]
|
|
13252
13360
|
);
|
|
@@ -13264,13 +13372,13 @@ var AccountDetailsModal3 = () => {
|
|
|
13264
13372
|
if (isUserRejected2(e)) {
|
|
13265
13373
|
(0, import_react_hot_toast10.default)("Wallet disconnect was cancelled.");
|
|
13266
13374
|
} else {
|
|
13267
|
-
import_react_hot_toast10.default.error("Failed to disconnect wallet.", { icon: /* @__PURE__ */ (0,
|
|
13375
|
+
import_react_hot_toast10.default.error("Failed to disconnect wallet.", { icon: /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(Error_default, {}) });
|
|
13268
13376
|
}
|
|
13269
13377
|
} finally {
|
|
13270
13378
|
close();
|
|
13271
13379
|
}
|
|
13272
13380
|
};
|
|
13273
|
-
return /* @__PURE__ */ (0,
|
|
13381
|
+
return /* @__PURE__ */ (0, import_jsx_runtime98.jsx)(
|
|
13274
13382
|
AccountDetailsModalBase_default,
|
|
13275
13383
|
{
|
|
13276
13384
|
isOpen: !!isOpen,
|
|
@@ -13291,7 +13399,7 @@ var AccountDetailsModal3 = () => {
|
|
|
13291
13399
|
var AccountDetailsModal_default3 = AccountDetailsModal3;
|
|
13292
13400
|
|
|
13293
13401
|
// src/widgets/transfer/components/btc/BtcConnectModal.tsx
|
|
13294
|
-
var
|
|
13402
|
+
var import_jsx_runtime99 = require("react/jsx-runtime");
|
|
13295
13403
|
var BtcConnectModal = () => {
|
|
13296
13404
|
const dispatch = (0, import_react_redux65.useDispatch)();
|
|
13297
13405
|
const theme = (0, import_react_redux65.useSelector)(selectTheme);
|
|
@@ -13299,13 +13407,13 @@ var BtcConnectModal = () => {
|
|
|
13299
13407
|
const mode = (0, import_react_redux65.useSelector)(selectMode);
|
|
13300
13408
|
const sourceChain = (0, import_react_redux65.useSelector)(selectSourceChain);
|
|
13301
13409
|
const { connect } = useBtcWallet();
|
|
13302
|
-
const [selectedWallet, setSelectedWallet] = (0,
|
|
13303
|
-
const [connecting, setConnecting] = (0,
|
|
13410
|
+
const [selectedWallet, setSelectedWallet] = (0, import_react79.useState)(null);
|
|
13411
|
+
const [connecting, setConnecting] = (0, import_react79.useState)(false);
|
|
13304
13412
|
const isBtc2 = sourceChain.shortName === "BTC" /* BTC */;
|
|
13305
|
-
const close = (0,
|
|
13413
|
+
const close = (0, import_react79.useCallback)(() => {
|
|
13306
13414
|
dispatch(setBtcConnectModal(false));
|
|
13307
13415
|
}, [dispatch]);
|
|
13308
|
-
(0,
|
|
13416
|
+
(0, import_react79.useEffect)(() => {
|
|
13309
13417
|
if (!isOpen) return;
|
|
13310
13418
|
if (selectedWallet) return;
|
|
13311
13419
|
if (getUnisat()) {
|
|
@@ -13313,7 +13421,7 @@ var BtcConnectModal = () => {
|
|
|
13313
13421
|
return;
|
|
13314
13422
|
}
|
|
13315
13423
|
}, [isOpen, selectedWallet]);
|
|
13316
|
-
const onSelectWallet = (0,
|
|
13424
|
+
const onSelectWallet = (0, import_react79.useCallback)(
|
|
13317
13425
|
async (walletId) => {
|
|
13318
13426
|
if (!isBtc2) return;
|
|
13319
13427
|
setSelectedWallet(walletId);
|
|
@@ -13331,22 +13439,22 @@ var BtcConnectModal = () => {
|
|
|
13331
13439
|
if (isUserRejected2(e)) {
|
|
13332
13440
|
(0, import_react_hot_toast11.default)("Wallet connection was cancelled.");
|
|
13333
13441
|
} else if (e?.error?.message) {
|
|
13334
|
-
import_react_hot_toast11.default.error(e.error.message, { icon: /* @__PURE__ */ (0,
|
|
13442
|
+
import_react_hot_toast11.default.error(e.error.message, { icon: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(Error_default, {}) });
|
|
13335
13443
|
} else if (e?.code === "UNISAT_NOT_FOUND") {
|
|
13336
|
-
import_react_hot_toast11.default.error("UniSat wallet not found.", { icon: /* @__PURE__ */ (0,
|
|
13444
|
+
import_react_hot_toast11.default.error("UniSat wallet not found.", { icon: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(Error_default, {}) });
|
|
13337
13445
|
} else if (e?.code === "BTC_WALLET_NOT_FOUND") {
|
|
13338
|
-
import_react_hot_toast11.default.error("Bitcoin wallet not found.", { icon: /* @__PURE__ */ (0,
|
|
13446
|
+
import_react_hot_toast11.default.error("Bitcoin wallet not found.", { icon: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(Error_default, {}) });
|
|
13339
13447
|
} else if (e?.code === "BTC_NO_ACCOUNT") {
|
|
13340
13448
|
import_react_hot_toast11.default.error("No Bitcoin account returned. Please try again.", {
|
|
13341
|
-
icon: /* @__PURE__ */ (0,
|
|
13449
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(Error_default, {})
|
|
13342
13450
|
});
|
|
13343
13451
|
} else if (e?.code === "BTC_WRONG_NETWORK") {
|
|
13344
13452
|
const expected = e?.expectedNetwork ? String(e.expectedNetwork) : "";
|
|
13345
13453
|
const detected = e?.detectedNetwork ? String(e.detectedNetwork) : "";
|
|
13346
13454
|
const detail = expected && detected ? `Wallet is on ${detected}. Switch to ${expected}.` : "Wallet network mismatch. Please switch networks.";
|
|
13347
|
-
import_react_hot_toast11.default.error(detail, { icon: /* @__PURE__ */ (0,
|
|
13455
|
+
import_react_hot_toast11.default.error(detail, { icon: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(Error_default, {}) });
|
|
13348
13456
|
} else {
|
|
13349
|
-
import_react_hot_toast11.default.error("Failed to connect wallet.", { icon: /* @__PURE__ */ (0,
|
|
13457
|
+
import_react_hot_toast11.default.error("Failed to connect wallet.", { icon: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(Error_default, {}) });
|
|
13350
13458
|
}
|
|
13351
13459
|
logger_default.error("[BtcConnectModal] connect error", e);
|
|
13352
13460
|
} finally {
|
|
@@ -13355,10 +13463,10 @@ var BtcConnectModal = () => {
|
|
|
13355
13463
|
},
|
|
13356
13464
|
[connect, connecting, dispatch, isBtc2, mode]
|
|
13357
13465
|
);
|
|
13358
|
-
const demoMsg = (0,
|
|
13359
|
-
return /* @__PURE__ */ (0,
|
|
13360
|
-
/* @__PURE__ */ (0,
|
|
13361
|
-
/* @__PURE__ */ (0,
|
|
13466
|
+
const demoMsg = (0, import_react79.useMemo)(() => "", []);
|
|
13467
|
+
return /* @__PURE__ */ (0, import_jsx_runtime99.jsxs)(import_jsx_runtime99.Fragment, { children: [
|
|
13468
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(AccountDetailsModal_default3, {}),
|
|
13469
|
+
/* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
13362
13470
|
WalletConnectModalBase_default,
|
|
13363
13471
|
{
|
|
13364
13472
|
isOpen: !!isOpen,
|
|
@@ -13366,7 +13474,7 @@ var BtcConnectModal = () => {
|
|
|
13366
13474
|
themeMode: theme.colorMode ?? "light" /* light */,
|
|
13367
13475
|
demoMessage: demoMsg,
|
|
13368
13476
|
onClose: close,
|
|
13369
|
-
children: /* @__PURE__ */ (0,
|
|
13477
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime99.jsx)(
|
|
13370
13478
|
BtcWalletSelect_default,
|
|
13371
13479
|
{
|
|
13372
13480
|
selectedWallet,
|
|
@@ -13381,7 +13489,7 @@ var BtcConnectModal = () => {
|
|
|
13381
13489
|
var BtcConnectModal_default = BtcConnectModal;
|
|
13382
13490
|
|
|
13383
13491
|
// src/widgets/transfer/components/TransferWidget.tsx
|
|
13384
|
-
var
|
|
13492
|
+
var import_jsx_runtime100 = require("react/jsx-runtime");
|
|
13385
13493
|
var PERMIT2_INFO_MESSAGE = "This approval uses Permit2, so you can skip a separate approval transaction and save gas.";
|
|
13386
13494
|
var PERMIT2_DOCS_URL = "https://docs.kima.network/kima-network/the-kima-sdk/use-kima-sdk-without-widget/message-signing#permit2-tokens";
|
|
13387
13495
|
var TransferWidget = ({
|
|
@@ -13392,18 +13500,18 @@ var TransferWidget = ({
|
|
|
13392
13500
|
}) => {
|
|
13393
13501
|
logger_default.debug("[TransferWidget] mount");
|
|
13394
13502
|
const dispatch = (0, import_react_redux66.useDispatch)();
|
|
13395
|
-
const mainRef = (0,
|
|
13396
|
-
const [signature, setSignature2] = (0,
|
|
13397
|
-
const [isSubmitting, setIsSubmitting] = (0,
|
|
13398
|
-
const [formStep, setFormStep] = (0,
|
|
13399
|
-
const [warningModalOpen, setWarningModalOpen] = (0,
|
|
13400
|
-
const [resetModalOpen, setResetModalOpen] = (0,
|
|
13401
|
-
const [isPermit2TooltipOpen, setPermit2TooltipOpen] = (0,
|
|
13402
|
-
const permit2TooltipRef = (0,
|
|
13403
|
-
const [isCancellingApprove, setCancellingApprove] = (0,
|
|
13404
|
-
const [isApproving, setApproving] = (0,
|
|
13405
|
-
const [isSigning, setSigning] = (0,
|
|
13406
|
-
const [feeOptionDisabled, setFeeOptionDisabled] = (0,
|
|
13503
|
+
const mainRef = (0, import_react80.useRef)(null);
|
|
13504
|
+
const [signature, setSignature2] = (0, import_react80.useState)("");
|
|
13505
|
+
const [isSubmitting, setIsSubmitting] = (0, import_react80.useState)(false);
|
|
13506
|
+
const [formStep, setFormStep] = (0, import_react80.useState)(0);
|
|
13507
|
+
const [warningModalOpen, setWarningModalOpen] = (0, import_react80.useState)(null);
|
|
13508
|
+
const [resetModalOpen, setResetModalOpen] = (0, import_react80.useState)(false);
|
|
13509
|
+
const [isPermit2TooltipOpen, setPermit2TooltipOpen] = (0, import_react80.useState)(false);
|
|
13510
|
+
const permit2TooltipRef = (0, import_react80.useRef)(null);
|
|
13511
|
+
const [isCancellingApprove, setCancellingApprove] = (0, import_react80.useState)(false);
|
|
13512
|
+
const [isApproving, setApproving] = (0, import_react80.useState)(false);
|
|
13513
|
+
const [isSigning, setSigning] = (0, import_react80.useState)(false);
|
|
13514
|
+
const [feeOptionDisabled, setFeeOptionDisabled] = (0, import_react80.useState)(false);
|
|
13407
13515
|
const networkOption = (0, import_react_redux66.useSelector)(selectNetworkOption);
|
|
13408
13516
|
const dAppOption = (0, import_react_redux66.useSelector)(selectDappOption);
|
|
13409
13517
|
const mode = (0, import_react_redux66.useSelector)(selectMode);
|
|
@@ -13436,7 +13544,7 @@ var TransferWidget = ({
|
|
|
13436
13544
|
panelRef: toastPanelRef,
|
|
13437
13545
|
formatTime: formatToastTime
|
|
13438
13546
|
} = useToastHistory();
|
|
13439
|
-
(0,
|
|
13547
|
+
(0, import_react80.useEffect)(() => {
|
|
13440
13548
|
if (!isPermit2TooltipOpen) return;
|
|
13441
13549
|
const handler = (event) => {
|
|
13442
13550
|
const target = event.target;
|
|
@@ -13479,7 +13587,7 @@ var TransferWidget = ({
|
|
|
13479
13587
|
targetSymbol: targetCurrency,
|
|
13480
13588
|
backendUrl
|
|
13481
13589
|
});
|
|
13482
|
-
const isSwap = (0,
|
|
13590
|
+
const isSwap = (0, import_react80.useMemo)(
|
|
13483
13591
|
() => sourceCurrency !== targetCurrency && !isSamePeggedToken(
|
|
13484
13592
|
sourceChain,
|
|
13485
13593
|
sourceCurrency,
|
|
@@ -13488,8 +13596,8 @@ var TransferWidget = ({
|
|
|
13488
13596
|
),
|
|
13489
13597
|
[sourceChain, sourceCurrency, targetChain, targetCurrency]
|
|
13490
13598
|
);
|
|
13491
|
-
const prevAmountRef = (0,
|
|
13492
|
-
(0,
|
|
13599
|
+
const prevAmountRef = (0, import_react80.useRef)("");
|
|
13600
|
+
(0, import_react80.useEffect)(() => {
|
|
13493
13601
|
setSignature2("");
|
|
13494
13602
|
setFeeOptionDisabled(false);
|
|
13495
13603
|
setApproving(false);
|
|
@@ -13502,7 +13610,7 @@ var TransferWidget = ({
|
|
|
13502
13610
|
targetChain.shortName,
|
|
13503
13611
|
targetCurrency
|
|
13504
13612
|
]);
|
|
13505
|
-
(0,
|
|
13613
|
+
(0, import_react80.useEffect)(() => {
|
|
13506
13614
|
const prevAmount = prevAmountRef.current;
|
|
13507
13615
|
if (prevAmount !== "" && amount !== prevAmount) {
|
|
13508
13616
|
dispatch(clearPermit2Signature());
|
|
@@ -13512,10 +13620,10 @@ var TransferWidget = ({
|
|
|
13512
13620
|
}
|
|
13513
13621
|
prevAmountRef.current = amount;
|
|
13514
13622
|
}, [amount, dispatch, isBtcOrigin]);
|
|
13515
|
-
(0,
|
|
13623
|
+
(0, import_react80.useEffect)(() => {
|
|
13516
13624
|
dispatch(clearPermit2Signature());
|
|
13517
13625
|
}, [dispatch, feeDeduct]);
|
|
13518
|
-
(0,
|
|
13626
|
+
(0, import_react80.useEffect)(() => {
|
|
13519
13627
|
try {
|
|
13520
13628
|
if (fees) dispatch(setServiceFee(fees));
|
|
13521
13629
|
if (mode === "payment" /* payment */ && transactionOption?.sourceChain) {
|
|
@@ -13531,11 +13639,11 @@ var TransferWidget = ({
|
|
|
13531
13639
|
);
|
|
13532
13640
|
import_react_hot_toast12.default.error(
|
|
13533
13641
|
"An unexpected error occurred while preparing the transfer. Please contact support for assistance.",
|
|
13534
|
-
{ icon: /* @__PURE__ */ (0,
|
|
13642
|
+
{ icon: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(Error_default, {}) }
|
|
13535
13643
|
);
|
|
13536
13644
|
}
|
|
13537
13645
|
}, [fees, mode, transactionOption, dispatch]);
|
|
13538
|
-
const isBackButtonEnabled = (0,
|
|
13646
|
+
const isBackButtonEnabled = (0, import_react80.useMemo)(() => {
|
|
13539
13647
|
if (formStep !== 0) {
|
|
13540
13648
|
if (["BANK", "CC"].includes(sourceChain.shortName)) {
|
|
13541
13649
|
return ccTransactionStatus === "idle" || ccTransactionStatus === "failed";
|
|
@@ -13544,20 +13652,20 @@ var TransferWidget = ({
|
|
|
13544
13652
|
}
|
|
13545
13653
|
return false;
|
|
13546
13654
|
}, [ccTransactionStatus, sourceChain, formStep]);
|
|
13547
|
-
const isSubmitButtonEnabled = (0,
|
|
13655
|
+
const isSubmitButtonEnabled = (0, import_react80.useMemo)(() => {
|
|
13548
13656
|
if (submitted) return false;
|
|
13549
13657
|
if (["BANK", "CC"].includes(sourceChain.shortName)) {
|
|
13550
13658
|
return ccTransactionStatus === "idle";
|
|
13551
13659
|
}
|
|
13552
13660
|
return true;
|
|
13553
13661
|
}, [sourceChain, ccTransactionStatus, submitted]);
|
|
13554
|
-
const [initialSelection, setInitialSelection] = (0,
|
|
13662
|
+
const [initialSelection, setInitialSelection] = (0, import_react80.useState)({
|
|
13555
13663
|
sourceSelection: true,
|
|
13556
13664
|
targetSelection: true
|
|
13557
13665
|
});
|
|
13558
13666
|
const isBtcFlow = sourceChain.shortName === "BTC" /* BTC */ || targetChain.shortName === "BTC" /* BTC */;
|
|
13559
13667
|
const allowanceDecimals = isBtcFlow ? 8 : txValues.allowanceAmount.decimals;
|
|
13560
|
-
const amountBigInt = (0,
|
|
13668
|
+
const amountBigInt = (0, import_viem13.parseUnits)(amount, allowanceDecimals);
|
|
13561
13669
|
const totalFeeForValidation = bigIntChangeDecimals({
|
|
13562
13670
|
...totalFee,
|
|
13563
13671
|
newDecimals: allowanceDecimals
|
|
@@ -13586,17 +13694,17 @@ var TransferWidget = ({
|
|
|
13586
13694
|
isSubmitting,
|
|
13587
13695
|
setIsSubmitting
|
|
13588
13696
|
);
|
|
13589
|
-
const submit = (0,
|
|
13697
|
+
const submit = (0, import_react80.useCallback)(async () => {
|
|
13590
13698
|
try {
|
|
13591
13699
|
await submitTransaction(signature);
|
|
13592
13700
|
} catch (err) {
|
|
13593
13701
|
logger_default.error("[TransferWidget] submit failed", err);
|
|
13594
13702
|
const message = err instanceof Error && err.message ? err.message : "Failed to submit your transaction. Please contact support for assistance.";
|
|
13595
|
-
import_react_hot_toast12.default.error(message, { icon: /* @__PURE__ */ (0,
|
|
13703
|
+
import_react_hot_toast12.default.error(message, { icon: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(Error_default, {}) });
|
|
13596
13704
|
dispatch(setCCTransactionStatus("error-generic"));
|
|
13597
13705
|
}
|
|
13598
13706
|
}, [signature, submitTransaction, dispatch]);
|
|
13599
|
-
const requestSignature = (0,
|
|
13707
|
+
const requestSignature = (0, import_react80.useCallback)(async () => {
|
|
13600
13708
|
let sig;
|
|
13601
13709
|
setSigning(true);
|
|
13602
13710
|
setFeeOptionDisabled(true);
|
|
@@ -13620,7 +13728,7 @@ var TransferWidget = ({
|
|
|
13620
13728
|
logger_default.error("[TransferWidget] signing failed", err);
|
|
13621
13729
|
import_react_hot_toast12.default.error(
|
|
13622
13730
|
"Failed to sign the message. Please contact support for assistance.",
|
|
13623
|
-
{ icon: /* @__PURE__ */ (0,
|
|
13731
|
+
{ icon: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(Error_default, {}) }
|
|
13624
13732
|
);
|
|
13625
13733
|
}
|
|
13626
13734
|
return void 0;
|
|
@@ -13638,7 +13746,7 @@ var TransferWidget = ({
|
|
|
13638
13746
|
const handleSubmit = async () => {
|
|
13639
13747
|
const { error, message: validationMessage } = validate(true);
|
|
13640
13748
|
if (error === "ValidationError" /* Error */) {
|
|
13641
|
-
import_react_hot_toast12.default.error(validationMessage, { icon: /* @__PURE__ */ (0,
|
|
13749
|
+
import_react_hot_toast12.default.error(validationMessage, { icon: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(Error_default, {}) });
|
|
13642
13750
|
return;
|
|
13643
13751
|
}
|
|
13644
13752
|
if (["BANK", "CC"].includes(sourceChain.shortName)) {
|
|
@@ -13665,7 +13773,7 @@ var TransferWidget = ({
|
|
|
13665
13773
|
if (msg.includes("ChainMismatch")) {
|
|
13666
13774
|
import_react_hot_toast12.default.error(
|
|
13667
13775
|
`Your wallet is on the wrong network. Please switch to ${sourceChain.name} and try again.`,
|
|
13668
|
-
{ icon: /* @__PURE__ */ (0,
|
|
13776
|
+
{ icon: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(Error_default, {}) }
|
|
13669
13777
|
);
|
|
13670
13778
|
return;
|
|
13671
13779
|
}
|
|
@@ -13673,14 +13781,14 @@ var TransferWidget = ({
|
|
|
13673
13781
|
if (/internal json-rpc error|internal rpc error/i.test(errMessage)) {
|
|
13674
13782
|
import_react_hot_toast12.default.error(
|
|
13675
13783
|
"Internal RPC error while approving. Please try again. If this keeps happening, contact support for assistance.",
|
|
13676
|
-
{ icon: /* @__PURE__ */ (0,
|
|
13784
|
+
{ icon: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(Error_default, {}) }
|
|
13677
13785
|
);
|
|
13678
13786
|
return;
|
|
13679
13787
|
}
|
|
13680
13788
|
logger_default.error("[TransferWidget] approval failed", err);
|
|
13681
13789
|
import_react_hot_toast12.default.error(
|
|
13682
13790
|
"Failed to approve the token allowance. Please contact support for assistance.",
|
|
13683
|
-
{ icon: /* @__PURE__ */ (0,
|
|
13791
|
+
{ icon: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(Error_default, {}) }
|
|
13684
13792
|
);
|
|
13685
13793
|
} finally {
|
|
13686
13794
|
setApproving(false);
|
|
@@ -13707,11 +13815,11 @@ var TransferWidget = ({
|
|
|
13707
13815
|
logger_default.error("[TransferWidget] handleSubmit failed", err);
|
|
13708
13816
|
const msg = err?.message;
|
|
13709
13817
|
if (msg && String(msg).includes("Fees unavailable")) {
|
|
13710
|
-
import_react_hot_toast12.default.error(String(msg), { icon: /* @__PURE__ */ (0,
|
|
13818
|
+
import_react_hot_toast12.default.error(String(msg), { icon: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(Error_default, {}) });
|
|
13711
13819
|
} else {
|
|
13712
13820
|
import_react_hot_toast12.default.error(
|
|
13713
13821
|
"An unexpected error occurred while submitting. Please contact support for assistance.",
|
|
13714
|
-
{ icon: /* @__PURE__ */ (0,
|
|
13822
|
+
{ icon: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(Error_default, {}) }
|
|
13715
13823
|
);
|
|
13716
13824
|
}
|
|
13717
13825
|
setIsSubmitting(false);
|
|
@@ -13732,7 +13840,7 @@ var TransferWidget = ({
|
|
|
13732
13840
|
void handleSubmit();
|
|
13733
13841
|
return;
|
|
13734
13842
|
}
|
|
13735
|
-
import_react_hot_toast12.default.error(validationMessage, { icon: /* @__PURE__ */ (0,
|
|
13843
|
+
import_react_hot_toast12.default.error(validationMessage, { icon: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(Error_default, {}) });
|
|
13736
13844
|
mainRef.current?.click();
|
|
13737
13845
|
};
|
|
13738
13846
|
const onBack = () => {
|
|
@@ -13760,7 +13868,7 @@ var TransferWidget = ({
|
|
|
13760
13868
|
logger_default.error("[TransferWidget] cancel approve failed", err);
|
|
13761
13869
|
import_react_hot_toast12.default.error(
|
|
13762
13870
|
"Unable to cancel the approval. Please contact support for assistance.",
|
|
13763
|
-
{ icon: /* @__PURE__ */ (0,
|
|
13871
|
+
{ icon: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(Error_default, {}) }
|
|
13764
13872
|
);
|
|
13765
13873
|
}
|
|
13766
13874
|
} finally {
|
|
@@ -13787,8 +13895,8 @@ var TransferWidget = ({
|
|
|
13787
13895
|
const primaryButtonLabel = getButtonLabel();
|
|
13788
13896
|
const isSmallScreen = windowWidth > 0 && windowWidth <= 500;
|
|
13789
13897
|
const showPermit2Info = formStep === 1 && isPermit2Required && mode !== "light" /* light */ && dAppOption === "none" /* None */ && signature && !isApproved && (primaryButtonLabel === "Approve" || primaryButtonLabel === "Approving...");
|
|
13790
|
-
const permit2InfoTooltip = showPermit2Info ? /* @__PURE__ */ (0,
|
|
13791
|
-
/* @__PURE__ */ (0,
|
|
13898
|
+
const permit2InfoTooltip = showPermit2Info ? /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "permit2-button-info", ref: permit2TooltipRef, children: [
|
|
13899
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
13792
13900
|
"button",
|
|
13793
13901
|
{
|
|
13794
13902
|
type: "button",
|
|
@@ -13805,23 +13913,23 @@ var TransferWidget = ({
|
|
|
13805
13913
|
children: "i"
|
|
13806
13914
|
}
|
|
13807
13915
|
),
|
|
13808
|
-
/* @__PURE__ */ (0,
|
|
13916
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(
|
|
13809
13917
|
"div",
|
|
13810
13918
|
{
|
|
13811
13919
|
className: `permit2-tooltip ${theme.colorMode} ${isPermit2TooltipOpen ? "open" : ""}`,
|
|
13812
13920
|
children: [
|
|
13813
|
-
/* @__PURE__ */ (0,
|
|
13814
|
-
/* @__PURE__ */ (0,
|
|
13921
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("p", { children: PERMIT2_INFO_MESSAGE }),
|
|
13922
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(ExternalLink_default, { className: "permit2-tooltip-link", to: PERMIT2_DOCS_URL, children: "Learn more" })
|
|
13815
13923
|
]
|
|
13816
13924
|
}
|
|
13817
13925
|
)
|
|
13818
13926
|
] }) : null;
|
|
13819
|
-
(0,
|
|
13927
|
+
(0, import_react80.useEffect)(() => {
|
|
13820
13928
|
if (!showPermit2Info && isPermit2TooltipOpen) {
|
|
13821
13929
|
setPermit2TooltipOpen(false);
|
|
13822
13930
|
}
|
|
13823
13931
|
}, [showPermit2Info, isPermit2TooltipOpen]);
|
|
13824
|
-
(0,
|
|
13932
|
+
(0, import_react80.useEffect)(() => {
|
|
13825
13933
|
if (!isSmallScreen && isPermit2TooltipOpen) {
|
|
13826
13934
|
setPermit2TooltipOpen(false);
|
|
13827
13935
|
}
|
|
@@ -13852,11 +13960,11 @@ var TransferWidget = ({
|
|
|
13852
13960
|
logger_default.error("[TransferWidget] reset failed", e);
|
|
13853
13961
|
import_react_hot_toast12.default.error(
|
|
13854
13962
|
"Unable to reset the form. Please contact support for assistance.",
|
|
13855
|
-
{ icon: /* @__PURE__ */ (0,
|
|
13963
|
+
{ icon: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(Error_default, {}) }
|
|
13856
13964
|
);
|
|
13857
13965
|
}
|
|
13858
13966
|
};
|
|
13859
|
-
return /* @__PURE__ */ (0,
|
|
13967
|
+
return /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(
|
|
13860
13968
|
"div",
|
|
13861
13969
|
{
|
|
13862
13970
|
className: `kima-card ${theme.colorMode}`,
|
|
@@ -13864,7 +13972,7 @@ var TransferWidget = ({
|
|
|
13864
13972
|
background: theme.colorMode === "light" /* light */ ? theme.backgroundColorLight : theme.backgroundColorDark
|
|
13865
13973
|
},
|
|
13866
13974
|
children: [
|
|
13867
|
-
resetModalOpen && /* @__PURE__ */ (0,
|
|
13975
|
+
resetModalOpen && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
13868
13976
|
WarningModal_default,
|
|
13869
13977
|
{
|
|
13870
13978
|
message: "Are you sure you want to reset the widget?",
|
|
@@ -13876,7 +13984,7 @@ var TransferWidget = ({
|
|
|
13876
13984
|
onCancel: () => setResetModalOpen(false)
|
|
13877
13985
|
}
|
|
13878
13986
|
),
|
|
13879
|
-
warningModalOpen && /* @__PURE__ */ (0,
|
|
13987
|
+
warningModalOpen && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
13880
13988
|
WarningModal_default,
|
|
13881
13989
|
{
|
|
13882
13990
|
message: warningModalOpen.message,
|
|
@@ -13890,21 +13998,22 @@ var TransferWidget = ({
|
|
|
13890
13998
|
}
|
|
13891
13999
|
}
|
|
13892
14000
|
),
|
|
13893
|
-
mode === "payment" /* payment */ && !transactionOption && /* @__PURE__ */ (0,
|
|
13894
|
-
/* @__PURE__ */ (0,
|
|
13895
|
-
|
|
13896
|
-
|
|
13897
|
-
|
|
13898
|
-
/* @__PURE__ */ (0,
|
|
13899
|
-
|
|
14001
|
+
mode === "payment" /* payment */ && !transactionOption && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("h2", { className: "invalid-option-banner", children: "We're unable to process your payment. Please ensure the necessary transaction details are provided. Contact support if the issue persists." }),
|
|
14002
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(VersionInfo_default, { theme }),
|
|
14003
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "transfer-card", children: [
|
|
14004
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "kima-card-header", children: [
|
|
14005
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "topbar", children: [
|
|
14006
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "title", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("h3", { style: { marginRight: "5px" }, children: formStep === 0 ? titleOption?.initialTitle ?? (mode === "payment" /* payment */ ? "New Purchase" : "New Transfer") : titleOption?.confirmTitle ?? (mode === "payment" /* payment */ ? "Confirm Purchase" : isSwap ? "Swap Details" : "Transfer Details") }) }),
|
|
14007
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "control-buttons", children: [
|
|
14008
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
13900
14009
|
ExternalLink_default,
|
|
13901
14010
|
{
|
|
13902
14011
|
to: helpURL ? helpURL : networkOption === "testnet" /* testnet */ ? "https://docs.kima.network/kima-network/try-kima-with-the-demo-app" : "https://support.kima.network",
|
|
13903
|
-
children: /* @__PURE__ */ (0,
|
|
14012
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "menu-button", children: "I need help" })
|
|
13904
14013
|
}
|
|
13905
14014
|
),
|
|
13906
|
-
["BANK", "CC"].includes(sourceChain.shortName) && formStep > 0 && /* @__PURE__ */ (0,
|
|
13907
|
-
formStep === 0 && mode !== "payment" /* payment */ && /* @__PURE__ */ (0,
|
|
14015
|
+
["BANK", "CC"].includes(sourceChain.shortName) && formStep > 0 && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(ExternalLink_default, { to: "https://docs.kima.network/kima-network/supported-fiat#unsupported-countries-credit-cards", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "menu-button", children: "Unsupported Countries" }) }),
|
|
14016
|
+
formStep === 0 && mode !== "payment" /* payment */ && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
13908
14017
|
"button",
|
|
13909
14018
|
{
|
|
13910
14019
|
className: "reset-button",
|
|
@@ -13913,32 +14022,32 @@ var TransferWidget = ({
|
|
|
13913
14022
|
children: "Reset"
|
|
13914
14023
|
}
|
|
13915
14024
|
),
|
|
13916
|
-
toastHistory.length > 0 && /* @__PURE__ */ (0,
|
|
14025
|
+
toastHistory.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)(
|
|
13917
14026
|
"div",
|
|
13918
14027
|
{
|
|
13919
14028
|
ref: toastPanelRef,
|
|
13920
14029
|
className: `toast-history ${theme.colorMode}`,
|
|
13921
14030
|
children: [
|
|
13922
|
-
/* @__PURE__ */ (0,
|
|
14031
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
13923
14032
|
"button",
|
|
13924
14033
|
{
|
|
13925
14034
|
className: "toast-history-button",
|
|
13926
14035
|
onClick: () => setToastPanelOpen(true),
|
|
13927
14036
|
"aria-label": "Notifications",
|
|
13928
|
-
children: /* @__PURE__ */ (0,
|
|
14037
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(Notification_default, { width: 30, height: 30 })
|
|
13929
14038
|
}
|
|
13930
14039
|
),
|
|
13931
|
-
toastPanelOpen && /* @__PURE__ */ (0,
|
|
13932
|
-
/* @__PURE__ */ (0,
|
|
13933
|
-
/* @__PURE__ */ (0,
|
|
13934
|
-
/* @__PURE__ */ (0,
|
|
13935
|
-
/* @__PURE__ */ (0,
|
|
14040
|
+
toastPanelOpen && /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: `toast-history-panel ${theme.colorMode}`, children: [
|
|
14041
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "toast-history-header", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("span", { children: "Notifications" }) }),
|
|
14042
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "toast-history-list", children: toastHistory.map((item) => /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "toast-history-item", children: [
|
|
14043
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("span", { className: "toast-history-message", children: item.message }),
|
|
14044
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("span", { className: "toast-history-time", children: formatToastTime(item.time) })
|
|
13936
14045
|
] }, item.id)) })
|
|
13937
14046
|
] })
|
|
13938
14047
|
]
|
|
13939
14048
|
}
|
|
13940
14049
|
),
|
|
13941
|
-
closeHandler && /* @__PURE__ */ (0,
|
|
14050
|
+
closeHandler && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
13942
14051
|
"button",
|
|
13943
14052
|
{
|
|
13944
14053
|
className: "cross-icon-button",
|
|
@@ -13946,18 +14055,18 @@ var TransferWidget = ({
|
|
|
13946
14055
|
resetForm();
|
|
13947
14056
|
closeHandler(0);
|
|
13948
14057
|
},
|
|
13949
|
-
children: /* @__PURE__ */ (0,
|
|
14058
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(Cross_default, {})
|
|
13950
14059
|
}
|
|
13951
14060
|
)
|
|
13952
14061
|
] })
|
|
13953
14062
|
] }),
|
|
13954
|
-
mode === "payment" /* payment */ && paymentTitleOption?.title && /* @__PURE__ */ (0,
|
|
14063
|
+
mode === "payment" /* payment */ && paymentTitleOption?.title && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)("h4", { className: "subtitle", children: paymentTitleOption.title })
|
|
13955
14064
|
] }),
|
|
13956
|
-
/* @__PURE__ */ (0,
|
|
14065
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "kima-card-content", ref: mainRef, children: formStep === 0 ? /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
13957
14066
|
SingleForm_default,
|
|
13958
14067
|
{
|
|
13959
14068
|
...{
|
|
13960
|
-
allowance: (0,
|
|
14069
|
+
allowance: (0, import_viem13.parseUnits)(
|
|
13961
14070
|
allowance?.toString() ?? "0",
|
|
13962
14071
|
decimals ?? 18
|
|
13963
14072
|
),
|
|
@@ -13967,7 +14076,7 @@ var TransferWidget = ({
|
|
|
13967
14076
|
setInitialSelection
|
|
13968
14077
|
}
|
|
13969
14078
|
}
|
|
13970
|
-
) : ccTransactionStatus !== "idle" ? /* @__PURE__ */ (0,
|
|
14079
|
+
) : ccTransactionStatus !== "idle" ? /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(FiatWidget_default, { submitCallback: submit }) : /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
13971
14080
|
ConfirmDetails_default,
|
|
13972
14081
|
{
|
|
13973
14082
|
...{
|
|
@@ -13976,12 +14085,12 @@ var TransferWidget = ({
|
|
|
13976
14085
|
}
|
|
13977
14086
|
}
|
|
13978
14087
|
) }),
|
|
13979
|
-
/* @__PURE__ */ (0,
|
|
14088
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
13980
14089
|
"div",
|
|
13981
14090
|
{
|
|
13982
14091
|
className: `kima-card-footer ${mode === "bridge" /* bridge */ && formStep !== 0 && "confirm"}`,
|
|
13983
|
-
children: /* @__PURE__ */ (0,
|
|
13984
|
-
isBackButtonEnabled && /* @__PURE__ */ (0,
|
|
14092
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: "button-group", children: [
|
|
14093
|
+
isBackButtonEnabled && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
13985
14094
|
SecondaryButton_default,
|
|
13986
14095
|
{
|
|
13987
14096
|
clickHandler: onBack,
|
|
@@ -13990,7 +14099,7 @@ var TransferWidget = ({
|
|
|
13990
14099
|
children: formStep > 0 && ccTransactionStatus !== "initialized" ? "Back" : "Cancel"
|
|
13991
14100
|
}
|
|
13992
14101
|
),
|
|
13993
|
-
(!!allowance && allowance > 0n || isPermit2Required && !!permit2Signature) && formStep !== 0 && !["BANK", "CC", "BTC"].includes(sourceChain.shortName) && mode !== "light" /* light */ && /* @__PURE__ */ (0,
|
|
14102
|
+
(!!allowance && allowance > 0n || isPermit2Required && !!permit2Signature) && formStep !== 0 && !["BANK", "CC", "BTC"].includes(sourceChain.shortName) && mode !== "light" /* light */ && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
13994
14103
|
SecondaryButton_default,
|
|
13995
14104
|
{
|
|
13996
14105
|
clickHandler: onCancelApprove,
|
|
@@ -14000,7 +14109,7 @@ var TransferWidget = ({
|
|
|
14000
14109
|
children: isCancellingApprove ? "Cancelling Approval" : "Cancel Approve"
|
|
14001
14110
|
}
|
|
14002
14111
|
),
|
|
14003
|
-
isSubmitButtonEnabled && /* @__PURE__ */ (0,
|
|
14112
|
+
isSubmitButtonEnabled && /* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
14004
14113
|
PrimaryButton_default,
|
|
14005
14114
|
{
|
|
14006
14115
|
clickHandler: onNext,
|
|
@@ -14013,10 +14122,10 @@ var TransferWidget = ({
|
|
|
14013
14122
|
] })
|
|
14014
14123
|
}
|
|
14015
14124
|
),
|
|
14016
|
-
/* @__PURE__ */ (0,
|
|
14017
|
-
/* @__PURE__ */ (0,
|
|
14018
|
-
/* @__PURE__ */ (0,
|
|
14019
|
-
/* @__PURE__ */ (0,
|
|
14125
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(SolanaConnectModal_default, {}),
|
|
14126
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(TronWalletConnectModal_default, {}),
|
|
14127
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(BtcConnectModal_default, {}),
|
|
14128
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(
|
|
14020
14129
|
import_react_hot_toast12.Toaster,
|
|
14021
14130
|
{
|
|
14022
14131
|
position: "top-right",
|
|
@@ -14040,9 +14149,9 @@ var TransferWidget = ({
|
|
|
14040
14149
|
}
|
|
14041
14150
|
}
|
|
14042
14151
|
),
|
|
14043
|
-
/* @__PURE__ */ (0,
|
|
14044
|
-
/* @__PURE__ */ (0,
|
|
14045
|
-
/* @__PURE__ */ (0,
|
|
14152
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("div", { className: "floating-footer", children: /* @__PURE__ */ (0, import_jsx_runtime100.jsxs)("div", { className: `items ${theme.colorMode}`, children: [
|
|
14153
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)("span", { children: "Powered by" }),
|
|
14154
|
+
/* @__PURE__ */ (0, import_jsx_runtime100.jsx)(KimaNetwork_default, {})
|
|
14046
14155
|
] }) })
|
|
14047
14156
|
] })
|
|
14048
14157
|
]
|
|
@@ -14051,7 +14160,7 @@ var TransferWidget = ({
|
|
|
14051
14160
|
};
|
|
14052
14161
|
|
|
14053
14162
|
// src/widgets/common/KimaWidgetWrapper.tsx
|
|
14054
|
-
var
|
|
14163
|
+
var import_jsx_runtime101 = require("react/jsx-runtime");
|
|
14055
14164
|
var KimaWidgetWrapper = ({
|
|
14056
14165
|
mode,
|
|
14057
14166
|
txId,
|
|
@@ -14070,7 +14179,7 @@ var KimaWidgetWrapper = ({
|
|
|
14070
14179
|
useDebugCode();
|
|
14071
14180
|
const { kimaBackendUrl } = useKimaContext();
|
|
14072
14181
|
const dispatch = (0, import_react_redux67.useDispatch)();
|
|
14073
|
-
const { setThemeMode, setThemeVariables } = (0,
|
|
14182
|
+
const { setThemeMode, setThemeVariables } = (0, import_react81.useAppKitTheme)();
|
|
14074
14183
|
const submitted = (0, import_react_redux67.useSelector)(selectSubmitted);
|
|
14075
14184
|
const sourceChain = (0, import_react_redux67.useSelector)(selectSourceChain);
|
|
14076
14185
|
const ccTransactionStatus = (0, import_react_redux67.useSelector)(selectCCTransactionStatus);
|
|
@@ -14079,8 +14188,8 @@ var KimaWidgetWrapper = ({
|
|
|
14079
14188
|
const networkOption = envOptions?.env;
|
|
14080
14189
|
const kimaExplorer = envOptions?.kimaExplorer || "https://explorer.sardis.kima.network";
|
|
14081
14190
|
const { currentPlugin } = useGetCurrentPlugin_default();
|
|
14082
|
-
const prevColorMode = (0,
|
|
14083
|
-
(0,
|
|
14191
|
+
const prevColorMode = (0, import_react82.useRef)(void 0);
|
|
14192
|
+
(0, import_react82.useEffect)(() => {
|
|
14084
14193
|
if (prevColorMode.current !== theme?.colorMode) {
|
|
14085
14194
|
dispatch(setTheme(theme));
|
|
14086
14195
|
setThemeMode(
|
|
@@ -14093,7 +14202,7 @@ var KimaWidgetWrapper = ({
|
|
|
14093
14202
|
prevColorMode.current = theme?.colorMode;
|
|
14094
14203
|
}
|
|
14095
14204
|
}, [theme?.colorMode, dispatch, setThemeMode, setThemeVariables, theme]);
|
|
14096
|
-
const prevConfigRef = (0,
|
|
14205
|
+
const prevConfigRef = (0, import_react82.useRef)({
|
|
14097
14206
|
compliantOption: void 0,
|
|
14098
14207
|
backendUrl: void 0,
|
|
14099
14208
|
mode: void 0,
|
|
@@ -14103,7 +14212,7 @@ var KimaWidgetWrapper = ({
|
|
|
14103
14212
|
excludedSourceNetworksJson: "",
|
|
14104
14213
|
excludedTargetNetworksJson: ""
|
|
14105
14214
|
});
|
|
14106
|
-
(0,
|
|
14215
|
+
(0, import_react82.useEffect)(() => {
|
|
14107
14216
|
const excludedSourceNetworksJson = JSON.stringify(excludedSourceNetworks);
|
|
14108
14217
|
const excludedTargetNetworksJson = JSON.stringify(excludedTargetNetworks);
|
|
14109
14218
|
if (prevConfigRef.current.compliantOption !== compliantOption) {
|
|
@@ -14149,7 +14258,7 @@ var KimaWidgetWrapper = ({
|
|
|
14149
14258
|
excludedTargetNetworks,
|
|
14150
14259
|
dispatch
|
|
14151
14260
|
]);
|
|
14152
|
-
(0,
|
|
14261
|
+
(0, import_react82.useEffect)(() => {
|
|
14153
14262
|
const activeTransactionOption = mode === "payment" /* payment */ ? transactionOption : void 0;
|
|
14154
14263
|
const nextJson = activeTransactionOption ? JSON.stringify(transactionOption) : null;
|
|
14155
14264
|
const storedJson = storedTransactionOption ? JSON.stringify(storedTransactionOption) : null;
|
|
@@ -14178,9 +14287,9 @@ var KimaWidgetWrapper = ({
|
|
|
14178
14287
|
dispatch(setAmount(String(activeTransactionOption.amount)));
|
|
14179
14288
|
}
|
|
14180
14289
|
}, [transactionOption, storedTransactionOption, mode, chainData, dispatch]);
|
|
14181
|
-
const prevModeRef = (0,
|
|
14182
|
-
const prevTxIdRef = (0,
|
|
14183
|
-
(0,
|
|
14290
|
+
const prevModeRef = (0, import_react82.useRef)(void 0);
|
|
14291
|
+
const prevTxIdRef = (0, import_react82.useRef)(void 0);
|
|
14292
|
+
(0, import_react82.useEffect)(() => {
|
|
14184
14293
|
const modeChanged = prevModeRef.current !== mode;
|
|
14185
14294
|
const txChanged = prevTxIdRef.current !== txId;
|
|
14186
14295
|
if (mode === "payment" /* payment */ && !transactionOption) {
|
|
@@ -14211,7 +14320,7 @@ var KimaWidgetWrapper = ({
|
|
|
14211
14320
|
prevTxIdRef.current = txId;
|
|
14212
14321
|
}
|
|
14213
14322
|
}, [mode, txId, transactionOption, dispatch]);
|
|
14214
|
-
(0,
|
|
14323
|
+
(0, import_react82.useEffect)(() => {
|
|
14215
14324
|
logger_default.debug("[KimaWidgetWrapper] render", {
|
|
14216
14325
|
mode,
|
|
14217
14326
|
dAppOption,
|
|
@@ -14221,16 +14330,16 @@ var KimaWidgetWrapper = ({
|
|
|
14221
14330
|
sourceChain: sourceChain?.shortName
|
|
14222
14331
|
});
|
|
14223
14332
|
});
|
|
14224
|
-
const pluginKey = (0,
|
|
14333
|
+
const pluginKey = (0, import_react82.useMemo)(() => {
|
|
14225
14334
|
if (!currentPlugin?.id) return null;
|
|
14226
14335
|
return `transfer-${currentPlugin.id}-${sourceChain?.shortName ?? "unknown"}`;
|
|
14227
14336
|
}, [currentPlugin?.id, sourceChain?.shortName]);
|
|
14228
|
-
const content = (0,
|
|
14337
|
+
const content = (0, import_react82.useMemo)(() => {
|
|
14229
14338
|
if (mode === "status" /* status */) {
|
|
14230
|
-
return /* @__PURE__ */ (0,
|
|
14339
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(TransactionWidget, { theme });
|
|
14231
14340
|
}
|
|
14232
14341
|
if (!currentPlugin && !sourceChain?.shortName) {
|
|
14233
|
-
return /* @__PURE__ */ (0,
|
|
14342
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
14234
14343
|
TransferWidget,
|
|
14235
14344
|
{
|
|
14236
14345
|
theme,
|
|
@@ -14242,15 +14351,15 @@ var KimaWidgetWrapper = ({
|
|
|
14242
14351
|
);
|
|
14243
14352
|
}
|
|
14244
14353
|
if (!currentPlugin) {
|
|
14245
|
-
return /* @__PURE__ */ (0,
|
|
14354
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(SkeletonLoader_default, { theme });
|
|
14246
14355
|
}
|
|
14247
14356
|
if (sourceChain.shortName === "CC") {
|
|
14248
14357
|
if (submitted) {
|
|
14249
14358
|
logger_default.debug("[KimaWidgetWrapper] CC mode -> TransactionWidget");
|
|
14250
|
-
return /* @__PURE__ */ (0,
|
|
14359
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(TransactionWidget, { theme });
|
|
14251
14360
|
}
|
|
14252
14361
|
if (ccTransactionStatus === "error-id") {
|
|
14253
|
-
return /* @__PURE__ */ (0,
|
|
14362
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
14254
14363
|
ErrorWidget_default,
|
|
14255
14364
|
{
|
|
14256
14365
|
theme,
|
|
@@ -14265,7 +14374,7 @@ var KimaWidgetWrapper = ({
|
|
|
14265
14374
|
);
|
|
14266
14375
|
}
|
|
14267
14376
|
if (ccTransactionStatus === "error-generic") {
|
|
14268
|
-
return /* @__PURE__ */ (0,
|
|
14377
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
14269
14378
|
ErrorWidget_default,
|
|
14270
14379
|
{
|
|
14271
14380
|
theme,
|
|
@@ -14279,7 +14388,7 @@ var KimaWidgetWrapper = ({
|
|
|
14279
14388
|
}
|
|
14280
14389
|
);
|
|
14281
14390
|
}
|
|
14282
|
-
return /* @__PURE__ */ (0,
|
|
14391
|
+
return /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
14283
14392
|
TransferWidget,
|
|
14284
14393
|
{
|
|
14285
14394
|
theme,
|
|
@@ -14294,7 +14403,7 @@ var KimaWidgetWrapper = ({
|
|
|
14294
14403
|
"[KimaWidgetWrapper] rendering TransferWidget with plugin",
|
|
14295
14404
|
currentPlugin?.id
|
|
14296
14405
|
);
|
|
14297
|
-
return submitted ? /* @__PURE__ */ (0,
|
|
14406
|
+
return submitted ? /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(TransactionWidget, { theme }) : /* @__PURE__ */ (0, import_jsx_runtime101.jsx)(
|
|
14298
14407
|
TransferWidget,
|
|
14299
14408
|
{
|
|
14300
14409
|
theme,
|
|
@@ -14323,7 +14432,7 @@ var KimaWidgetWrapper = ({
|
|
|
14323
14432
|
var KimaWidgetWrapper_default = KimaWidgetWrapper;
|
|
14324
14433
|
|
|
14325
14434
|
// src/widgets/common/KimaTransactionWidget.tsx
|
|
14326
|
-
var
|
|
14435
|
+
var import_jsx_runtime102 = require("react/jsx-runtime");
|
|
14327
14436
|
var KimaTransactionWidget = ({
|
|
14328
14437
|
mode,
|
|
14329
14438
|
txId,
|
|
@@ -14339,7 +14448,7 @@ var KimaTransactionWidget = ({
|
|
|
14339
14448
|
}) => {
|
|
14340
14449
|
const dispatch = (0, import_react_redux68.useDispatch)();
|
|
14341
14450
|
const { kimaBackendUrl } = useKimaContext();
|
|
14342
|
-
const [hydrated, setHydrated] = (0,
|
|
14451
|
+
const [hydrated, setHydrated] = (0, import_react83.useState)(false);
|
|
14343
14452
|
const {
|
|
14344
14453
|
data: envOptions,
|
|
14345
14454
|
error: envOptionsError,
|
|
@@ -14350,20 +14459,20 @@ var KimaTransactionWidget = ({
|
|
|
14350
14459
|
error: chainDataError,
|
|
14351
14460
|
isLoading: isLoadingChainData
|
|
14352
14461
|
} = useChainData(kimaBackendUrl);
|
|
14353
|
-
(0,
|
|
14462
|
+
(0, import_react83.useEffect)(() => {
|
|
14354
14463
|
if (typeof window !== "undefined") setHydrated(true);
|
|
14355
14464
|
}, []);
|
|
14356
|
-
(0,
|
|
14465
|
+
(0, import_react83.useEffect)(() => {
|
|
14357
14466
|
if (theme?.colorMode) {
|
|
14358
14467
|
dispatch(setTheme(theme));
|
|
14359
14468
|
}
|
|
14360
14469
|
}, [theme?.colorMode, dispatch, theme]);
|
|
14361
14470
|
if (!hydrated || !theme?.colorMode)
|
|
14362
|
-
return /* @__PURE__ */ (0,
|
|
14471
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(ring_default, { width: 20, height: 20, fill: "#86b8ce" });
|
|
14363
14472
|
if (isLoadingEnvs || isLoadingChainData)
|
|
14364
|
-
return /* @__PURE__ */ (0,
|
|
14473
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(SkeletonLoader_default, { theme });
|
|
14365
14474
|
if (envOptionsError || !envOptions)
|
|
14366
|
-
return /* @__PURE__ */ (0,
|
|
14475
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
14367
14476
|
ErrorWidget_default,
|
|
14368
14477
|
{
|
|
14369
14478
|
theme,
|
|
@@ -14372,7 +14481,7 @@ var KimaTransactionWidget = ({
|
|
|
14372
14481
|
}
|
|
14373
14482
|
);
|
|
14374
14483
|
if (chainDataError || !chainData)
|
|
14375
|
-
return /* @__PURE__ */ (0,
|
|
14484
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
14376
14485
|
ErrorWidget_default,
|
|
14377
14486
|
{
|
|
14378
14487
|
theme,
|
|
@@ -14380,7 +14489,7 @@ var KimaTransactionWidget = ({
|
|
|
14380
14489
|
message: "There was an error loading the chain data from the backend. Please check that the backend is running properly and the widget points to the corresponding url." /* ChainLoadingError */
|
|
14381
14490
|
}
|
|
14382
14491
|
);
|
|
14383
|
-
return /* @__PURE__ */ (0,
|
|
14492
|
+
return /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(ToastHistoryProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime102.jsx)(
|
|
14384
14493
|
KimaWidgetWrapper_default,
|
|
14385
14494
|
{
|
|
14386
14495
|
...{
|
|
@@ -14422,8 +14531,6 @@ var KimaTransactionWidget_default = KimaTransactionWidget;
|
|
|
14422
14531
|
NetworkOptions,
|
|
14423
14532
|
SOLANA_HOST,
|
|
14424
14533
|
TransactionStatus,
|
|
14425
|
-
isSolProvider,
|
|
14426
|
-
isTronProvider,
|
|
14427
14534
|
lightDemoAccounts,
|
|
14428
14535
|
lightDemoNetworks
|
|
14429
14536
|
});
|