@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.js
CHANGED
|
@@ -10,8 +10,6 @@ import {
|
|
|
10
10
|
} from "react";
|
|
11
11
|
import { Provider } from "react-redux";
|
|
12
12
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
13
|
-
import { PublicKey as PublicKey7 } from "@solana/web3.js";
|
|
14
|
-
import { JsonRpcSigner as JsonRpcSigner3 } from "ethers";
|
|
15
13
|
|
|
16
14
|
// src/shared/types/app.ts
|
|
17
15
|
var NetworkOptions = /* @__PURE__ */ ((NetworkOptions3) => {
|
|
@@ -3694,18 +3692,6 @@ var TransactionStatus = /* @__PURE__ */ ((TransactionStatus2) => {
|
|
|
3694
3692
|
return TransactionStatus2;
|
|
3695
3693
|
})(TransactionStatus || {});
|
|
3696
3694
|
|
|
3697
|
-
// src/shared/types/providers.ts
|
|
3698
|
-
import {
|
|
3699
|
-
Connection
|
|
3700
|
-
} from "@solana/web3.js";
|
|
3701
|
-
import { TronWeb } from "tronweb";
|
|
3702
|
-
var isSolProvider = (provider) => {
|
|
3703
|
-
return provider && provider.connection instanceof Connection && typeof provider.signTransaction === "function";
|
|
3704
|
-
};
|
|
3705
|
-
var isTronProvider = (provider) => {
|
|
3706
|
-
return provider && provider.tronWeb instanceof TronWeb && typeof provider.signTransaction === "function";
|
|
3707
|
-
};
|
|
3708
|
-
|
|
3709
3695
|
// src/shared/types/plugin.ts
|
|
3710
3696
|
var ChainCompatibility = /* @__PURE__ */ ((ChainCompatibility2) => {
|
|
3711
3697
|
ChainCompatibility2["BTC"] = "BTC";
|
|
@@ -3774,7 +3760,8 @@ var getEnvOptions = async ({
|
|
|
3774
3760
|
env: "testnet" /* testnet */,
|
|
3775
3761
|
kimaExplorer: "https://explorer.sardis.kima.network",
|
|
3776
3762
|
paymentPartnerId: "KimaTest",
|
|
3777
|
-
transferLimitMaxUSDT: null
|
|
3763
|
+
transferLimitMaxUSDT: null,
|
|
3764
|
+
backendVersion: null
|
|
3778
3765
|
};
|
|
3779
3766
|
return response;
|
|
3780
3767
|
};
|
|
@@ -3787,73 +3774,6 @@ var useGetEnvOptions = ({
|
|
|
3787
3774
|
});
|
|
3788
3775
|
};
|
|
3789
3776
|
|
|
3790
|
-
// src/shared/lib/bigint.ts
|
|
3791
|
-
import { formatUnits, parseUnits } from "viem";
|
|
3792
|
-
|
|
3793
|
-
// src/shared/lib/format.ts
|
|
3794
|
-
var formatterInt = new Intl.NumberFormat("en-US", {
|
|
3795
|
-
maximumFractionDigits: 0
|
|
3796
|
-
});
|
|
3797
|
-
var formatterFloat = new Intl.NumberFormat("en-US", {
|
|
3798
|
-
maximumFractionDigits: 6,
|
|
3799
|
-
useGrouping: false
|
|
3800
|
-
});
|
|
3801
|
-
|
|
3802
|
-
// src/shared/lib/bigint.ts
|
|
3803
|
-
import { BrowserProvider, JsonRpcSigner } from "ethers";
|
|
3804
|
-
import { PublicKey as PublicKey2 } from "@solana/web3.js";
|
|
3805
|
-
var bigIntToNumber = (inputs) => {
|
|
3806
|
-
const { value, decimals } = inputs || {};
|
|
3807
|
-
if (!value || !decimals) return 0;
|
|
3808
|
-
const valBigInt = BigInt(value);
|
|
3809
|
-
const valNumberStr = formatUnits(valBigInt, decimals);
|
|
3810
|
-
return Number(valNumberStr);
|
|
3811
|
-
};
|
|
3812
|
-
var bigIntChangeDecimals = (inputs) => {
|
|
3813
|
-
const { value, decimals, newDecimals } = inputs || {};
|
|
3814
|
-
const valBigInt = BigInt(value);
|
|
3815
|
-
if (decimals === newDecimals) return { value: valBigInt, decimals };
|
|
3816
|
-
if (decimals > newDecimals) {
|
|
3817
|
-
const diff2 = decimals - newDecimals;
|
|
3818
|
-
return { value: valBigInt / 10n ** BigInt(diff2), decimals: newDecimals };
|
|
3819
|
-
}
|
|
3820
|
-
const diff = newDecimals - decimals;
|
|
3821
|
-
return { value: valBigInt * 10n ** BigInt(diff), decimals: newDecimals };
|
|
3822
|
-
};
|
|
3823
|
-
var formatBigInt = (inputs) => {
|
|
3824
|
-
return formatterFloat.format(bigIntToNumber(inputs));
|
|
3825
|
-
};
|
|
3826
|
-
var toBigintAmount = (data) => {
|
|
3827
|
-
return {
|
|
3828
|
-
// bigint values constructed from numbers can have rounding errors!
|
|
3829
|
-
// so need to convert to string and then to bigint
|
|
3830
|
-
value: BigInt(data.value.toString()),
|
|
3831
|
-
decimals: data.decimals
|
|
3832
|
-
};
|
|
3833
|
-
};
|
|
3834
|
-
var isValidExternalProvider = (externalProvider) => {
|
|
3835
|
-
const { type, provider, signer } = externalProvider;
|
|
3836
|
-
if (type === "evm") {
|
|
3837
|
-
if (!(provider instanceof BrowserProvider) || !(signer instanceof JsonRpcSigner))
|
|
3838
|
-
return false;
|
|
3839
|
-
}
|
|
3840
|
-
if (type === "solana") {
|
|
3841
|
-
if (!isSolProvider(provider) || !(signer instanceof PublicKey2))
|
|
3842
|
-
return false;
|
|
3843
|
-
}
|
|
3844
|
-
if (type === "tron") {
|
|
3845
|
-
if (!isTronProvider(provider) || typeof signer !== "string")
|
|
3846
|
-
return false;
|
|
3847
|
-
}
|
|
3848
|
-
if (type === "btc") {
|
|
3849
|
-
const btcSigner = signer;
|
|
3850
|
-
const hasAddress = typeof btcSigner === "string" || typeof btcSigner === "object" && typeof btcSigner.address === "string";
|
|
3851
|
-
if (!hasAddress) return false;
|
|
3852
|
-
if (provider && typeof provider !== "object") return false;
|
|
3853
|
-
}
|
|
3854
|
-
return true;
|
|
3855
|
-
};
|
|
3856
|
-
|
|
3857
3777
|
// src/shared/logger.ts
|
|
3858
3778
|
import log from "loglevel";
|
|
3859
3779
|
var safeEnv = typeof process !== "undefined" && process.env || (import.meta.env ?? {}) || {};
|
|
@@ -4513,29 +4433,116 @@ var isAddressCompatible = (address, shortName) => {
|
|
|
4513
4433
|
var getFeeSideValues = (feeDeduct, transactionValues) => feeDeduct ? transactionValues.feeFromTarget : transactionValues.feeFromOrigin;
|
|
4514
4434
|
|
|
4515
4435
|
// src/features/allowances/evm/useApproveErc20.ts
|
|
4516
|
-
import {
|
|
4517
|
-
createPublicClient as createPublicClient2,
|
|
4518
|
-
createWalletClient as createWalletClient2,
|
|
4519
|
-
custom as custom2,
|
|
4520
|
-
erc20Abi,
|
|
4521
|
-
http as http2
|
|
4522
|
-
} from "viem";
|
|
4436
|
+
import { BrowserProvider, Contract } from "ethers";
|
|
4523
4437
|
|
|
4524
4438
|
// src/features/connect-wallet/evm/useEvmAddress.ts
|
|
4525
4439
|
import { useMemo } from "react";
|
|
4526
4440
|
import { useAppKitAccount } from "@reown/appkit/react";
|
|
4527
4441
|
var useEvmAddress = (mode) => {
|
|
4528
|
-
const { externalProvider } = useKimaContext();
|
|
4529
4442
|
const { address: appkitAddress } = useAppKitAccount() || {};
|
|
4530
4443
|
return useMemo(() => {
|
|
4531
4444
|
if (mode === "light" /* light */) return lightDemoAccounts.EVM;
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
}, [mode, externalProvider, appkitAddress]);
|
|
4445
|
+
return appkitAddress || "";
|
|
4446
|
+
}, [mode, appkitAddress]);
|
|
4535
4447
|
};
|
|
4536
4448
|
|
|
4537
4449
|
// src/features/allowances/evm/useApproveErc20.ts
|
|
4538
|
-
import {
|
|
4450
|
+
import {
|
|
4451
|
+
useAppKitAccount as useAppKitAccount3,
|
|
4452
|
+
useAppKitProvider as useAppKitProvider2,
|
|
4453
|
+
useWalletInfo
|
|
4454
|
+
} from "@reown/appkit/react";
|
|
4455
|
+
|
|
4456
|
+
// src/features/connect-wallet/evm/appkit.ts
|
|
4457
|
+
import detectEthereumProvider from "@metamask/detect-provider";
|
|
4458
|
+
var getAppKitEip1193Provider = (appkitProvider) => {
|
|
4459
|
+
const provider = appkitProvider;
|
|
4460
|
+
if (provider?.request) return provider;
|
|
4461
|
+
const nestedProvider = provider?.provider;
|
|
4462
|
+
if (nestedProvider?.request) return nestedProvider;
|
|
4463
|
+
return null;
|
|
4464
|
+
};
|
|
4465
|
+
var describeAppKitProvider = (appkitProvider) => {
|
|
4466
|
+
const provider = appkitProvider;
|
|
4467
|
+
const nestedProvider = provider?.provider;
|
|
4468
|
+
return {
|
|
4469
|
+
hasDirectRequest: typeof provider?.request === "function",
|
|
4470
|
+
hasDirectSend: typeof provider?.send === "function",
|
|
4471
|
+
directConstructor: provider?.constructor && typeof provider.constructor === "function" ? provider.constructor.name : void 0,
|
|
4472
|
+
directKeys: provider ? Object.keys(provider).slice(0, 12) : [],
|
|
4473
|
+
hasNestedProvider: !!nestedProvider,
|
|
4474
|
+
hasNestedRequest: typeof nestedProvider?.request === "function",
|
|
4475
|
+
hasNestedSend: typeof nestedProvider?.send === "function",
|
|
4476
|
+
nestedConstructor: nestedProvider?.constructor && typeof nestedProvider.constructor === "function" ? nestedProvider.constructor.name : void 0,
|
|
4477
|
+
nestedKeys: nestedProvider ? Object.keys(nestedProvider).slice(0, 12) : []
|
|
4478
|
+
};
|
|
4479
|
+
};
|
|
4480
|
+
var readAppKitRpcDebug = async (provider) => {
|
|
4481
|
+
const out = {};
|
|
4482
|
+
try {
|
|
4483
|
+
out.ethChainId = await provider.request?.({ method: "eth_chainId" });
|
|
4484
|
+
} catch (err) {
|
|
4485
|
+
out.ethChainIdError = String(err?.message ?? err);
|
|
4486
|
+
}
|
|
4487
|
+
try {
|
|
4488
|
+
out.ethAccounts = await provider.request?.({ method: "eth_accounts" });
|
|
4489
|
+
} catch (err) {
|
|
4490
|
+
out.ethAccountsError = String(err?.message ?? err);
|
|
4491
|
+
}
|
|
4492
|
+
return out;
|
|
4493
|
+
};
|
|
4494
|
+
var isMetaMaskWalletInfo = (walletInfo) => {
|
|
4495
|
+
const name = String(walletInfo?.name ?? "").toLowerCase();
|
|
4496
|
+
const rdns = String(walletInfo?.rdns ?? "").toLowerCase();
|
|
4497
|
+
return name.includes("metamask") || rdns.includes("metamask");
|
|
4498
|
+
};
|
|
4499
|
+
var isUsableMetaMaskInjectedProvider = (provider) => !!provider?.request && provider?.isMetaMask === true && provider?.isTronLink !== true;
|
|
4500
|
+
var getDirectMetaMaskProvider = async () => {
|
|
4501
|
+
if (typeof window === "undefined") {
|
|
4502
|
+
return { provider: null, source: "none" };
|
|
4503
|
+
}
|
|
4504
|
+
const ethereum = window?.ethereum;
|
|
4505
|
+
const providerFromList = Array.isArray(ethereum?.providers) ? ethereum.providers.find(isUsableMetaMaskInjectedProvider) : null;
|
|
4506
|
+
if (providerFromList) {
|
|
4507
|
+
return { provider: providerFromList, source: "metamask-window" };
|
|
4508
|
+
}
|
|
4509
|
+
try {
|
|
4510
|
+
const detected = await detectEthereumProvider({
|
|
4511
|
+
mustBeMetaMask: true,
|
|
4512
|
+
silent: true,
|
|
4513
|
+
timeout: 300
|
|
4514
|
+
});
|
|
4515
|
+
if (isUsableMetaMaskInjectedProvider(detected)) {
|
|
4516
|
+
return { provider: detected, source: "metamask-detect" };
|
|
4517
|
+
}
|
|
4518
|
+
} catch {
|
|
4519
|
+
}
|
|
4520
|
+
if (isUsableMetaMaskInjectedProvider(ethereum)) {
|
|
4521
|
+
return { provider: ethereum, source: "metamask-window" };
|
|
4522
|
+
}
|
|
4523
|
+
return {
|
|
4524
|
+
provider: null,
|
|
4525
|
+
source: "none"
|
|
4526
|
+
};
|
|
4527
|
+
};
|
|
4528
|
+
var getPreferredEvmWriteProvider = async ({
|
|
4529
|
+
appkitProvider,
|
|
4530
|
+
walletInfo
|
|
4531
|
+
}) => {
|
|
4532
|
+
if (isMetaMaskWalletInfo(walletInfo)) {
|
|
4533
|
+
const metamask = await getDirectMetaMaskProvider();
|
|
4534
|
+
if (metamask.provider) {
|
|
4535
|
+
return {
|
|
4536
|
+
provider: metamask.provider,
|
|
4537
|
+
source: metamask.source
|
|
4538
|
+
};
|
|
4539
|
+
}
|
|
4540
|
+
}
|
|
4541
|
+
return {
|
|
4542
|
+
provider: getAppKitEip1193Provider(appkitProvider),
|
|
4543
|
+
source: "appkit"
|
|
4544
|
+
};
|
|
4545
|
+
};
|
|
4539
4546
|
|
|
4540
4547
|
// src/features/allowances/evm/useEvmSignPermit2.ts
|
|
4541
4548
|
import { useCallback, useMemo as useMemo2 } from "react";
|
|
@@ -4598,9 +4605,9 @@ var useEvmSignPermit2 = () => {
|
|
|
4598
4605
|
if (!isAddress(tokenAddress) || !isAddress(poolAddress)) {
|
|
4599
4606
|
throw new Error("Invalid token or spender address");
|
|
4600
4607
|
}
|
|
4601
|
-
const eip1193 = appkitProvider
|
|
4608
|
+
const eip1193 = getAppKitEip1193Provider(appkitProvider);
|
|
4602
4609
|
if (!eip1193?.request) {
|
|
4603
|
-
throw new Error("No EIP-1193 provider available");
|
|
4610
|
+
throw new Error("No AppKit EIP-1193 provider available");
|
|
4604
4611
|
}
|
|
4605
4612
|
const preferredAccount = userAddress && userAddress !== "" ? userAddress : appkitAddress;
|
|
4606
4613
|
const walletClient = createWalletClient({
|
|
@@ -4725,6 +4732,7 @@ var useEvmSignPermit2 = () => {
|
|
|
4725
4732
|
};
|
|
4726
4733
|
|
|
4727
4734
|
// src/features/allowances/evm/useApproveErc20.ts
|
|
4735
|
+
var erc20ApproveAbi = ["function approve(address spender, uint256 amount)"];
|
|
4728
4736
|
var useApproveErc20 = () => {
|
|
4729
4737
|
const dispatch = useDispatch2();
|
|
4730
4738
|
const qc = useQueryClient();
|
|
@@ -4752,9 +4760,19 @@ var useApproveErc20 = () => {
|
|
|
4752
4760
|
);
|
|
4753
4761
|
const userAddress = useEvmAddress(mode);
|
|
4754
4762
|
const { address: appkitAddress } = useAppKitAccount3() || {};
|
|
4755
|
-
const {
|
|
4763
|
+
const { walletInfo } = useWalletInfo();
|
|
4764
|
+
const { walletProvider: appkitProvider, walletProviderType } = useAppKitProvider2("eip155");
|
|
4756
4765
|
const approve = useCallback2(
|
|
4757
4766
|
async (isCancel = false) => {
|
|
4767
|
+
const approvalDebug = {
|
|
4768
|
+
walletProviderType,
|
|
4769
|
+
provider: describeAppKitProvider(appkitProvider),
|
|
4770
|
+
walletInfo,
|
|
4771
|
+
sourceChainId: sourceChain?.id,
|
|
4772
|
+
sourceChainName: sourceChain?.name,
|
|
4773
|
+
tokenAddress,
|
|
4774
|
+
poolAddress
|
|
4775
|
+
};
|
|
4758
4776
|
try {
|
|
4759
4777
|
if (isPermit2Required) {
|
|
4760
4778
|
if (isCancel) {
|
|
@@ -4772,36 +4790,47 @@ var useApproveErc20 = () => {
|
|
|
4772
4790
|
});
|
|
4773
4791
|
return;
|
|
4774
4792
|
}
|
|
4775
|
-
const eip1193 =
|
|
4793
|
+
const { provider: eip1193, source: providerSource } = await getPreferredEvmWriteProvider({
|
|
4794
|
+
appkitProvider,
|
|
4795
|
+
walletInfo
|
|
4796
|
+
});
|
|
4797
|
+
approvalDebug.eip1193Resolved = !!eip1193;
|
|
4798
|
+
approvalDebug.providerSource = providerSource;
|
|
4776
4799
|
if (!eip1193?.request) {
|
|
4777
|
-
|
|
4778
|
-
return;
|
|
4800
|
+
throw new Error("No AppKit EIP-1193 provider available");
|
|
4779
4801
|
}
|
|
4802
|
+
approvalDebug.rpc = await readAppKitRpcDebug(eip1193);
|
|
4780
4803
|
const account = userAddress ?? appkitAddress ?? null;
|
|
4804
|
+
approvalDebug.account = account;
|
|
4781
4805
|
if (!account) {
|
|
4782
4806
|
throw new Error("No connected EVM account");
|
|
4783
4807
|
}
|
|
4784
|
-
const
|
|
4785
|
-
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4808
|
+
const browserProvider = new BrowserProvider(
|
|
4809
|
+
eip1193,
|
|
4810
|
+
Number(sourceChain.id)
|
|
4811
|
+
);
|
|
4812
|
+
approvalDebug.browserProvider = {
|
|
4813
|
+
constructor: browserProvider.constructor && typeof browserProvider.constructor === "function" ? browserProvider.constructor.name : void 0
|
|
4814
|
+
};
|
|
4815
|
+
const signer = await browserProvider.getSigner(account);
|
|
4816
|
+
approvalDebug.signerAddress = await signer.getAddress();
|
|
4817
|
+
const contract = new Contract(
|
|
4818
|
+
tokenAddress,
|
|
4819
|
+
erc20ApproveAbi,
|
|
4820
|
+
signer
|
|
4821
|
+
);
|
|
4793
4822
|
const finalAmount = isCancel ? 0n : allowanceNeeded;
|
|
4794
|
-
const
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4798
|
-
|
|
4799
|
-
|
|
4800
|
-
|
|
4801
|
-
}
|
|
4823
|
+
const tx = await contract.approve(
|
|
4824
|
+
poolAddress,
|
|
4825
|
+
finalAmount
|
|
4826
|
+
);
|
|
4827
|
+
const hash = tx?.hash;
|
|
4828
|
+
if (!hash) {
|
|
4829
|
+
throw new Error("Approval transaction hash missing");
|
|
4830
|
+
}
|
|
4802
4831
|
logger_default.info("[useApproveErc20] tx sent, waiting receipt", hash);
|
|
4803
|
-
const receipt = await
|
|
4804
|
-
if (receipt.status !==
|
|
4832
|
+
const receipt = await tx.wait();
|
|
4833
|
+
if (!receipt || receipt.status !== 1) {
|
|
4805
4834
|
logger_default.error("[useApproveErc20] tx failed", receipt);
|
|
4806
4835
|
throw new Error("Approval transaction failed");
|
|
4807
4836
|
}
|
|
@@ -4812,6 +4841,7 @@ var useApproveErc20 = () => {
|
|
|
4812
4841
|
if (err?.code === 4001 || /UserRejected/i.test(String(err?.message))) {
|
|
4813
4842
|
err._kimaUserRejected = true;
|
|
4814
4843
|
}
|
|
4844
|
+
logger_default.error("[useApproveErc20] debug", approvalDebug);
|
|
4815
4845
|
logger_default.error("[useApproveErc20] error", err);
|
|
4816
4846
|
throw err;
|
|
4817
4847
|
}
|
|
@@ -4825,6 +4855,8 @@ var useApproveErc20 = () => {
|
|
|
4825
4855
|
signPermit2,
|
|
4826
4856
|
dispatch,
|
|
4827
4857
|
appkitProvider,
|
|
4858
|
+
walletProviderType,
|
|
4859
|
+
walletInfo,
|
|
4828
4860
|
userAddress,
|
|
4829
4861
|
appkitAddress,
|
|
4830
4862
|
qc
|
|
@@ -4838,9 +4870,9 @@ import { useMemo as useMemo4 } from "react";
|
|
|
4838
4870
|
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
4839
4871
|
import { useSelector as useSelector3 } from "react-redux";
|
|
4840
4872
|
import {
|
|
4841
|
-
createPublicClient as
|
|
4842
|
-
http as
|
|
4843
|
-
erc20Abi
|
|
4873
|
+
createPublicClient as createPublicClient2,
|
|
4874
|
+
http as http2,
|
|
4875
|
+
erc20Abi
|
|
4844
4876
|
} from "viem";
|
|
4845
4877
|
var useErc20Allowance = () => {
|
|
4846
4878
|
const mode = useSelector3(selectMode);
|
|
@@ -4863,7 +4895,7 @@ var useErc20Allowance = () => {
|
|
|
4863
4895
|
const publicClient = useMemo4(() => {
|
|
4864
4896
|
const rpc = sourceChain?.rpcUrls?.default?.http?.[0];
|
|
4865
4897
|
if (!rpc) return void 0;
|
|
4866
|
-
return
|
|
4898
|
+
return createPublicClient2({ chain: sourceChain, transport: http2(rpc) });
|
|
4867
4899
|
}, [sourceChain]);
|
|
4868
4900
|
const enabled = !!publicClient && !!owner && !!tokenAddress && !!spender && isEVMChain(sourceChain.shortName);
|
|
4869
4901
|
return useQuery3({
|
|
@@ -4881,12 +4913,12 @@ var useErc20Allowance = () => {
|
|
|
4881
4913
|
try {
|
|
4882
4914
|
const decimals = await publicClient.readContract({
|
|
4883
4915
|
address: tokenAddress,
|
|
4884
|
-
abi:
|
|
4916
|
+
abi: erc20Abi,
|
|
4885
4917
|
functionName: "decimals"
|
|
4886
4918
|
});
|
|
4887
4919
|
const allowance = await publicClient.readContract({
|
|
4888
4920
|
address: tokenAddress,
|
|
4889
|
-
abi:
|
|
4921
|
+
abi: erc20Abi,
|
|
4890
4922
|
functionName: "allowance",
|
|
4891
4923
|
args: [owner, spender]
|
|
4892
4924
|
});
|
|
@@ -4911,7 +4943,7 @@ var useErc20Allowance = () => {
|
|
|
4911
4943
|
import { useCallback as useCallback3 } from "react";
|
|
4912
4944
|
import { useSelector as useSelector4 } from "react-redux";
|
|
4913
4945
|
import { useAppKitAccount as useAppKitAccount4, useAppKitProvider as useAppKitProvider3 } from "@reown/appkit/react";
|
|
4914
|
-
import { createWalletClient as
|
|
4946
|
+
import { createWalletClient as createWalletClient2, custom as custom2, isAddress as isAddress2 } from "viem";
|
|
4915
4947
|
var useEvmSignMessage = () => {
|
|
4916
4948
|
const mode = useSelector4(selectMode);
|
|
4917
4949
|
const sourceChain = useSelector4(selectSourceChain);
|
|
@@ -4923,10 +4955,9 @@ var useEvmSignMessage = () => {
|
|
|
4923
4955
|
const { message } = getFeeSideValues(feeDeduct, transactionValues);
|
|
4924
4956
|
const signMessage = useCallback3(async () => {
|
|
4925
4957
|
try {
|
|
4926
|
-
const eip1193 = appkitProvider
|
|
4958
|
+
const eip1193 = getAppKitEip1193Provider(appkitProvider);
|
|
4927
4959
|
if (!eip1193?.request) {
|
|
4928
|
-
|
|
4929
|
-
return void 0;
|
|
4960
|
+
throw new Error("No AppKit EIP-1193 provider available");
|
|
4930
4961
|
}
|
|
4931
4962
|
const preferredAccount = userAddress && userAddress !== "" ? userAddress : appkitAddress;
|
|
4932
4963
|
logger_default.debug("[useEvmSignMessage] inputs", {
|
|
@@ -4936,10 +4967,10 @@ var useEvmSignMessage = () => {
|
|
|
4936
4967
|
preferredAccount,
|
|
4937
4968
|
chain: sourceChain
|
|
4938
4969
|
});
|
|
4939
|
-
const walletClient =
|
|
4970
|
+
const walletClient = createWalletClient2({
|
|
4940
4971
|
account: preferredAccount,
|
|
4941
4972
|
chain: sourceChain,
|
|
4942
|
-
transport:
|
|
4973
|
+
transport: custom2(eip1193)
|
|
4943
4974
|
});
|
|
4944
4975
|
const fallbackAccount = (await walletClient.getAddresses())?.[0];
|
|
4945
4976
|
const account = preferredAccount || fallbackAccount;
|
|
@@ -5044,167 +5075,9 @@ var useAllowance = () => {
|
|
|
5044
5075
|
};
|
|
5045
5076
|
|
|
5046
5077
|
// src/features/connect-wallet/evm/useEvmProvider.ts
|
|
5047
|
-
import { BrowserProvider as BrowserProvider2 } from "ethers";
|
|
5048
5078
|
import { useAppKitProvider as useAppKitProvider4 } from "@reown/appkit/react";
|
|
5049
|
-
|
|
5050
|
-
// src/app/providers/EvmWalletProvider.tsx
|
|
5051
|
-
import { useEffect } from "react";
|
|
5052
|
-
|
|
5053
|
-
// src/features/connect-wallet/evm/setupAppkit.ts
|
|
5054
|
-
import { createAppKit } from "@reown/appkit/react";
|
|
5055
|
-
import { EthersAdapter } from "@reown/appkit-adapter-ethers";
|
|
5056
|
-
import {
|
|
5057
|
-
mainnet,
|
|
5058
|
-
bsc,
|
|
5059
|
-
polygon,
|
|
5060
|
-
base,
|
|
5061
|
-
arbitrum,
|
|
5062
|
-
optimism,
|
|
5063
|
-
avalanche,
|
|
5064
|
-
confluxESpace,
|
|
5065
|
-
sepolia,
|
|
5066
|
-
bscTestnet,
|
|
5067
|
-
baseSepolia,
|
|
5068
|
-
polygonAmoy,
|
|
5069
|
-
arbitrumSepolia,
|
|
5070
|
-
optimismSepolia,
|
|
5071
|
-
avalancheFuji,
|
|
5072
|
-
berachainBepolia,
|
|
5073
|
-
confluxESpaceTestnet
|
|
5074
|
-
} from "@reown/appkit/networks";
|
|
5075
|
-
var appKitModel = null;
|
|
5076
|
-
var setupAppKit = (projectId, networkOption) => {
|
|
5077
|
-
if (appKitModel) return appKitModel;
|
|
5078
|
-
const MAINNETS = [
|
|
5079
|
-
mainnet,
|
|
5080
|
-
bsc,
|
|
5081
|
-
polygon,
|
|
5082
|
-
base,
|
|
5083
|
-
arbitrum,
|
|
5084
|
-
optimism,
|
|
5085
|
-
avalanche,
|
|
5086
|
-
confluxESpace
|
|
5087
|
-
];
|
|
5088
|
-
const TESTNETS = [
|
|
5089
|
-
sepolia,
|
|
5090
|
-
bscTestnet,
|
|
5091
|
-
baseSepolia,
|
|
5092
|
-
polygonAmoy,
|
|
5093
|
-
arbitrumSepolia,
|
|
5094
|
-
optimismSepolia,
|
|
5095
|
-
avalancheFuji,
|
|
5096
|
-
berachainBepolia,
|
|
5097
|
-
confluxESpaceTestnet
|
|
5098
|
-
];
|
|
5099
|
-
const networks = networkOption === "mainnet" /* mainnet */ ? MAINNETS : TESTNETS;
|
|
5100
|
-
appKitModel = createAppKit({
|
|
5101
|
-
adapters: [new EthersAdapter()],
|
|
5102
|
-
projectId,
|
|
5103
|
-
networks,
|
|
5104
|
-
metadata: {
|
|
5105
|
-
name: "Kima Transaction Widget",
|
|
5106
|
-
description: "Frontend widget for Kima integration for dApps",
|
|
5107
|
-
url: "https://kima.network",
|
|
5108
|
-
icons: ["https://avatars.githubusercontent.com/u/37784886"]
|
|
5109
|
-
},
|
|
5110
|
-
features: {
|
|
5111
|
-
analytics: false,
|
|
5112
|
-
swaps: false,
|
|
5113
|
-
onramp: false,
|
|
5114
|
-
email: false,
|
|
5115
|
-
socials: false,
|
|
5116
|
-
history: false
|
|
5117
|
-
}
|
|
5118
|
-
});
|
|
5119
|
-
return appKitModel;
|
|
5120
|
-
};
|
|
5121
|
-
|
|
5122
|
-
// src/app/providers/EvmWalletProvider.tsx
|
|
5123
|
-
import { Fragment, jsx as jsx48 } from "react/jsx-runtime";
|
|
5124
|
-
var EvmWalletProvider = ({
|
|
5125
|
-
children,
|
|
5126
|
-
networkOption,
|
|
5127
|
-
projectId,
|
|
5128
|
-
isLoading
|
|
5129
|
-
}) => {
|
|
5130
|
-
useEffect(() => {
|
|
5131
|
-
if (!isLoading && networkOption && projectId) {
|
|
5132
|
-
setupAppKit(projectId, networkOption);
|
|
5133
|
-
}
|
|
5134
|
-
}, [isLoading, networkOption, projectId]);
|
|
5135
|
-
return /* @__PURE__ */ jsx48(Fragment, { children });
|
|
5136
|
-
};
|
|
5137
|
-
|
|
5138
|
-
// src/app/providers/SolanaWalletProvider.tsx
|
|
5139
|
-
import {
|
|
5140
|
-
ConnectionProvider,
|
|
5141
|
-
WalletProvider
|
|
5142
|
-
} from "@solana/wallet-adapter-react";
|
|
5143
|
-
import {
|
|
5144
|
-
PhantomWalletAdapter,
|
|
5145
|
-
SolflareWalletAdapter,
|
|
5146
|
-
CloverWalletAdapter,
|
|
5147
|
-
Coin98WalletAdapter,
|
|
5148
|
-
SolongWalletAdapter,
|
|
5149
|
-
TorusWalletAdapter
|
|
5150
|
-
} from "@solana/wallet-adapter-wallets";
|
|
5151
|
-
import { clusterApiUrl as clusterApiUrl2 } from "@solana/web3.js";
|
|
5152
|
-
import { jsx as jsx49 } from "react/jsx-runtime";
|
|
5153
|
-
var SolanaWalletProvider = ({
|
|
5154
|
-
children,
|
|
5155
|
-
networkOption
|
|
5156
|
-
}) => {
|
|
5157
|
-
const { solRPC } = useKimaContext();
|
|
5158
|
-
const endpoint = networkOption === "testnet" /* testnet */ ? clusterApiUrl2("testnet") : solRPC ?? "https://go.getblock.us/86aac42ad4484f3c813079afc201451c";
|
|
5159
|
-
return /* @__PURE__ */ jsx49(ConnectionProvider, { endpoint, children: /* @__PURE__ */ jsx49(
|
|
5160
|
-
WalletProvider,
|
|
5161
|
-
{
|
|
5162
|
-
autoConnect: false,
|
|
5163
|
-
wallets: [
|
|
5164
|
-
new PhantomWalletAdapter(),
|
|
5165
|
-
new SolflareWalletAdapter(),
|
|
5166
|
-
new CloverWalletAdapter(),
|
|
5167
|
-
new Coin98WalletAdapter(),
|
|
5168
|
-
new SolongWalletAdapter(),
|
|
5169
|
-
new TorusWalletAdapter()
|
|
5170
|
-
],
|
|
5171
|
-
children
|
|
5172
|
-
}
|
|
5173
|
-
) });
|
|
5174
|
-
};
|
|
5175
|
-
|
|
5176
|
-
// src/app/providers/TronWalletProvider.tsx
|
|
5177
|
-
import { useMemo as useMemo6 } from "react";
|
|
5178
|
-
import { WalletProvider as WalletProvider2 } from "@tronweb3/tronwallet-adapter-react-hooks";
|
|
5179
|
-
import { LedgerAdapter } from "@tronweb3/tronwallet-adapter-ledger";
|
|
5180
|
-
import { TronLinkAdapter } from "@tronweb3/tronwallet-adapter-tronlink";
|
|
5181
|
-
import { OkxWalletAdapter } from "@tronweb3/tronwallet-adapter-okxwallet";
|
|
5182
|
-
import { TokenPocketAdapter } from "@tronweb3/tronwallet-adapter-tokenpocket";
|
|
5183
|
-
import { jsx as jsx50 } from "react/jsx-runtime";
|
|
5184
|
-
var TronWalletProvider = ({ children }) => {
|
|
5185
|
-
const adapters = useMemo6(
|
|
5186
|
-
() => [
|
|
5187
|
-
new TronLinkAdapter(),
|
|
5188
|
-
new LedgerAdapter({ accountNumber: 2 }),
|
|
5189
|
-
new TokenPocketAdapter(),
|
|
5190
|
-
new OkxWalletAdapter()
|
|
5191
|
-
],
|
|
5192
|
-
[]
|
|
5193
|
-
);
|
|
5194
|
-
return /* @__PURE__ */ jsx50(WalletProvider2, { adapters, autoConnect: false, children });
|
|
5195
|
-
};
|
|
5196
|
-
|
|
5197
|
-
// src/features/connect-wallet/evm/useEvmProvider.ts
|
|
5198
5079
|
var useEvmProvider = () => {
|
|
5199
|
-
const { externalProvider } = useKimaContext();
|
|
5200
5080
|
const { walletProvider: appkitProvider } = useAppKitProvider4("eip155");
|
|
5201
|
-
if (externalProvider?.type === "evm" && externalProvider.provider instanceof BrowserProvider2) {
|
|
5202
|
-
return {
|
|
5203
|
-
provider: externalProvider.provider,
|
|
5204
|
-
signer: externalProvider.signer,
|
|
5205
|
-
address: externalProvider.signer?.address
|
|
5206
|
-
};
|
|
5207
|
-
}
|
|
5208
5081
|
if (appkitProvider) {
|
|
5209
5082
|
return { provider: appkitProvider };
|
|
5210
5083
|
}
|
|
@@ -5212,7 +5085,7 @@ var useEvmProvider = () => {
|
|
|
5212
5085
|
};
|
|
5213
5086
|
|
|
5214
5087
|
// src/features/connect-wallet/evm/useIsWalletReady.ts
|
|
5215
|
-
import { useCallback as useCallback4, useEffect
|
|
5088
|
+
import { useCallback as useCallback4, useEffect, useMemo as useMemo6, useState } from "react";
|
|
5216
5089
|
import { useDispatch as useDispatch4, useSelector as useSelector6 } from "react-redux";
|
|
5217
5090
|
import {
|
|
5218
5091
|
useAppKitAccount as useAppKitAccount5,
|
|
@@ -5364,7 +5237,6 @@ var switchNetworkSmart = async ({
|
|
|
5364
5237
|
// src/features/connect-wallet/evm/useIsWalletReady.ts
|
|
5365
5238
|
var useIsWalletReady = () => {
|
|
5366
5239
|
const dispatch = useDispatch4();
|
|
5367
|
-
const { externalProvider } = useKimaContext();
|
|
5368
5240
|
const backendUrl = useSelector6(selectBackendUrl);
|
|
5369
5241
|
const mode = useSelector6(selectMode);
|
|
5370
5242
|
const sourceChain = useSelector6(selectSourceChain);
|
|
@@ -5381,15 +5253,15 @@ var useIsWalletReady = () => {
|
|
|
5381
5253
|
const trySwitch = useCallback4(async () => {
|
|
5382
5254
|
if (!sourceChain || sourceChain.compatibility !== "EVM" /* EVM */)
|
|
5383
5255
|
return;
|
|
5384
|
-
const eip1193 =
|
|
5385
|
-
const browserProvider =
|
|
5256
|
+
const eip1193 = getAppKitEip1193Provider(appkitProvider);
|
|
5257
|
+
const browserProvider = appkitProvider || null;
|
|
5386
5258
|
await switchNetworkSmart({
|
|
5387
5259
|
chainId: sourceChain.id,
|
|
5388
5260
|
chains: chains || [],
|
|
5389
5261
|
eip1193,
|
|
5390
5262
|
browserProvider
|
|
5391
5263
|
});
|
|
5392
|
-
}, [sourceChain,
|
|
5264
|
+
}, [sourceChain, appkitProvider, chains]);
|
|
5393
5265
|
const resolveConnection = useCallback4(async () => {
|
|
5394
5266
|
if (mode === "light" /* light */) {
|
|
5395
5267
|
const demoAddress = lightDemoAccounts.EVM;
|
|
@@ -5400,43 +5272,7 @@ var useIsWalletReady = () => {
|
|
|
5400
5272
|
dispatch(setSourceAddress(demoAddress));
|
|
5401
5273
|
return;
|
|
5402
5274
|
}
|
|
5403
|
-
if (
|
|
5404
|
-
try {
|
|
5405
|
-
const provider = externalProvider.provider;
|
|
5406
|
-
const network = await provider.getNetwork();
|
|
5407
|
-
const externalChainId = Number(network.chainId);
|
|
5408
|
-
if (externalChainId === sourceChain.id) {
|
|
5409
|
-
const signer = await provider.getSigner();
|
|
5410
|
-
const externalAddress = await signer.getAddress();
|
|
5411
|
-
setIsReady(true);
|
|
5412
|
-
setConnectedAddress(externalAddress);
|
|
5413
|
-
setStatusMessage("Connected with external provider");
|
|
5414
|
-
setIsSwitching(false);
|
|
5415
|
-
dispatch(setSourceAddress(externalAddress));
|
|
5416
|
-
} else {
|
|
5417
|
-
setIsReady(false);
|
|
5418
|
-
setConnectedAddress("");
|
|
5419
|
-
setStatusMessage("Switching to correct network...");
|
|
5420
|
-
setIsSwitching(true);
|
|
5421
|
-
dispatch(setSourceAddress(""));
|
|
5422
|
-
try {
|
|
5423
|
-
await trySwitch();
|
|
5424
|
-
} finally {
|
|
5425
|
-
setIsSwitching(false);
|
|
5426
|
-
}
|
|
5427
|
-
}
|
|
5428
|
-
return;
|
|
5429
|
-
} catch (error) {
|
|
5430
|
-
logger_default.error("[useIsWalletReady] external provider error", error);
|
|
5431
|
-
setIsReady(false);
|
|
5432
|
-
setConnectedAddress("");
|
|
5433
|
-
setStatusMessage("Failed to connect external provider");
|
|
5434
|
-
setIsSwitching(false);
|
|
5435
|
-
dispatch(setSourceAddress(""));
|
|
5436
|
-
return;
|
|
5437
|
-
}
|
|
5438
|
-
}
|
|
5439
|
-
if (!externalProvider && isConnected) {
|
|
5275
|
+
if (isConnected) {
|
|
5440
5276
|
if (walletChainId === sourceChain?.id) {
|
|
5441
5277
|
setIsReady(true);
|
|
5442
5278
|
setConnectedAddress(walletAddress ?? "");
|
|
@@ -5464,7 +5300,6 @@ var useIsWalletReady = () => {
|
|
|
5464
5300
|
dispatch(setSourceAddress(""));
|
|
5465
5301
|
}, [
|
|
5466
5302
|
mode,
|
|
5467
|
-
externalProvider,
|
|
5468
5303
|
sourceChain,
|
|
5469
5304
|
isConnected,
|
|
5470
5305
|
walletAddress,
|
|
@@ -5472,23 +5307,23 @@ var useIsWalletReady = () => {
|
|
|
5472
5307
|
trySwitch,
|
|
5473
5308
|
dispatch
|
|
5474
5309
|
]);
|
|
5475
|
-
|
|
5310
|
+
useEffect(() => {
|
|
5476
5311
|
resolveConnection();
|
|
5477
5312
|
}, [resolveConnection]);
|
|
5478
|
-
return
|
|
5313
|
+
return useMemo6(
|
|
5479
5314
|
() => ({ isReady, statusMessage, connectedAddress, isSwitching }),
|
|
5480
5315
|
[isReady, statusMessage, connectedAddress, isSwitching]
|
|
5481
5316
|
);
|
|
5482
5317
|
};
|
|
5483
5318
|
|
|
5484
5319
|
// src/features/balances/evm/useErc20Balance.ts
|
|
5485
|
-
import { useMemo as
|
|
5320
|
+
import { useMemo as useMemo7 } from "react";
|
|
5486
5321
|
import { useQuery as useQuery5 } from "@tanstack/react-query";
|
|
5487
5322
|
import { useSelector as useSelector7 } from "react-redux";
|
|
5488
5323
|
import {
|
|
5489
|
-
createPublicClient as
|
|
5490
|
-
http as
|
|
5491
|
-
erc20Abi as
|
|
5324
|
+
createPublicClient as createPublicClient3,
|
|
5325
|
+
http as http3,
|
|
5326
|
+
erc20Abi as erc20Abi2
|
|
5492
5327
|
} from "viem";
|
|
5493
5328
|
var useErc20Balance = () => {
|
|
5494
5329
|
const mode = useSelector7(selectMode);
|
|
@@ -5496,14 +5331,14 @@ var useErc20Balance = () => {
|
|
|
5496
5331
|
const selectedCoin = useSelector7(selectSourceCurrency);
|
|
5497
5332
|
const tokenOptions = useSelector7(selectTokenOptions);
|
|
5498
5333
|
const owner = useEvmAddress(mode);
|
|
5499
|
-
const tokenAddress =
|
|
5334
|
+
const tokenAddress = useMemo7(() => {
|
|
5500
5335
|
const a = getTokenAddress(tokenOptions, selectedCoin, sourceChain.shortName);
|
|
5501
5336
|
return a && /^0x[0-9a-fA-F]{40}$/.test(a) ? a : void 0;
|
|
5502
5337
|
}, [tokenOptions, selectedCoin, sourceChain.shortName]);
|
|
5503
|
-
const publicClient =
|
|
5338
|
+
const publicClient = useMemo7(() => {
|
|
5504
5339
|
const rpc = sourceChain?.rpcUrls?.default?.http?.[0];
|
|
5505
5340
|
if (!rpc) return void 0;
|
|
5506
|
-
return
|
|
5341
|
+
return createPublicClient3({ chain: sourceChain, transport: http3(rpc) });
|
|
5507
5342
|
}, [sourceChain]);
|
|
5508
5343
|
const enabled = !!publicClient && !!owner && !!tokenAddress && isEVMChain(sourceChain.shortName);
|
|
5509
5344
|
const query = useQuery5({
|
|
@@ -5521,12 +5356,12 @@ var useErc20Balance = () => {
|
|
|
5521
5356
|
try {
|
|
5522
5357
|
const decimals = await publicClient.readContract({
|
|
5523
5358
|
address: tokenAddress,
|
|
5524
|
-
abi:
|
|
5359
|
+
abi: erc20Abi2,
|
|
5525
5360
|
functionName: "decimals"
|
|
5526
5361
|
});
|
|
5527
5362
|
const balance = await publicClient.readContract({
|
|
5528
5363
|
address: tokenAddress,
|
|
5529
|
-
abi:
|
|
5364
|
+
abi: erc20Abi2,
|
|
5530
5365
|
functionName: "balanceOf",
|
|
5531
5366
|
args: [owner]
|
|
5532
5367
|
});
|
|
@@ -5553,7 +5388,7 @@ var useErc20Balance = () => {
|
|
|
5553
5388
|
};
|
|
5554
5389
|
|
|
5555
5390
|
// src/features/balances/evm/useEvmNativeBalance.ts
|
|
5556
|
-
import { useMemo as
|
|
5391
|
+
import { useMemo as useMemo8 } from "react";
|
|
5557
5392
|
import { useQuery as useQuery6 } from "@tanstack/react-query";
|
|
5558
5393
|
import { useSelector as useSelector8 } from "react-redux";
|
|
5559
5394
|
var useEvmNativeBalance = () => {
|
|
@@ -5561,7 +5396,7 @@ var useEvmNativeBalance = () => {
|
|
|
5561
5396
|
const sourceChain = useSelector8(selectSourceChain);
|
|
5562
5397
|
const { provider } = useEvmProvider();
|
|
5563
5398
|
const address = useEvmAddress(mode);
|
|
5564
|
-
const enabled =
|
|
5399
|
+
const enabled = useMemo8(
|
|
5565
5400
|
() => !!address && !!provider && isEVMChain(sourceChain.shortName),
|
|
5566
5401
|
[address, provider, sourceChain.shortName]
|
|
5567
5402
|
);
|
|
@@ -5584,34 +5419,163 @@ var useEvmNativeBalance = () => {
|
|
|
5584
5419
|
import { useCallback as useCallback5 } from "react";
|
|
5585
5420
|
import { useDisconnect } from "@reown/appkit/react";
|
|
5586
5421
|
var useDisconnectWallet = () => {
|
|
5587
|
-
const { externalProvider } = useKimaContext();
|
|
5588
5422
|
const { disconnect: appkitDisconnect } = useDisconnect();
|
|
5589
5423
|
const disconnectWallet = useCallback5(async () => {
|
|
5590
|
-
try {
|
|
5591
|
-
if (externalProvider?.type === "evm") {
|
|
5592
|
-
const prov = externalProvider.provider;
|
|
5593
|
-
if (typeof prov?.disconnect === "function") {
|
|
5594
|
-
await prov.disconnect();
|
|
5595
|
-
} else if (typeof prov?.provider?.disconnect === "function") {
|
|
5596
|
-
await prov.provider.disconnect();
|
|
5597
|
-
} else if (typeof prov?.request === "function") {
|
|
5598
|
-
try {
|
|
5599
|
-
await prov.request({
|
|
5600
|
-
method: "wallet_revokePermissions",
|
|
5601
|
-
params: [{ eth_accounts: {} }]
|
|
5602
|
-
});
|
|
5603
|
-
} catch {
|
|
5604
|
-
}
|
|
5605
|
-
}
|
|
5606
|
-
}
|
|
5607
|
-
} catch {
|
|
5608
|
-
}
|
|
5609
5424
|
try {
|
|
5610
5425
|
await appkitDisconnect?.();
|
|
5611
5426
|
} catch {
|
|
5612
5427
|
}
|
|
5613
|
-
}, [
|
|
5614
|
-
return { disconnectWallet };
|
|
5428
|
+
}, [appkitDisconnect]);
|
|
5429
|
+
return { disconnectWallet };
|
|
5430
|
+
};
|
|
5431
|
+
|
|
5432
|
+
// src/app/providers/EvmWalletProvider.tsx
|
|
5433
|
+
import { useEffect as useEffect2 } from "react";
|
|
5434
|
+
|
|
5435
|
+
// src/features/connect-wallet/evm/setupAppkit.ts
|
|
5436
|
+
import { createAppKit } from "@reown/appkit/react";
|
|
5437
|
+
import { EthersAdapter } from "@reown/appkit-adapter-ethers";
|
|
5438
|
+
import {
|
|
5439
|
+
mainnet,
|
|
5440
|
+
bsc,
|
|
5441
|
+
polygon,
|
|
5442
|
+
base,
|
|
5443
|
+
arbitrum,
|
|
5444
|
+
optimism,
|
|
5445
|
+
avalanche,
|
|
5446
|
+
confluxESpace,
|
|
5447
|
+
sepolia,
|
|
5448
|
+
bscTestnet,
|
|
5449
|
+
baseSepolia,
|
|
5450
|
+
polygonAmoy,
|
|
5451
|
+
arbitrumSepolia,
|
|
5452
|
+
optimismSepolia,
|
|
5453
|
+
avalancheFuji,
|
|
5454
|
+
berachainBepolia,
|
|
5455
|
+
confluxESpaceTestnet
|
|
5456
|
+
} from "@reown/appkit/networks";
|
|
5457
|
+
var appKitModel = null;
|
|
5458
|
+
var setupAppKit = (projectId, networkOption) => {
|
|
5459
|
+
if (appKitModel) return appKitModel;
|
|
5460
|
+
const MAINNETS = [
|
|
5461
|
+
mainnet,
|
|
5462
|
+
bsc,
|
|
5463
|
+
polygon,
|
|
5464
|
+
base,
|
|
5465
|
+
arbitrum,
|
|
5466
|
+
optimism,
|
|
5467
|
+
avalanche,
|
|
5468
|
+
confluxESpace
|
|
5469
|
+
];
|
|
5470
|
+
const TESTNETS = [
|
|
5471
|
+
sepolia,
|
|
5472
|
+
bscTestnet,
|
|
5473
|
+
baseSepolia,
|
|
5474
|
+
polygonAmoy,
|
|
5475
|
+
arbitrumSepolia,
|
|
5476
|
+
optimismSepolia,
|
|
5477
|
+
avalancheFuji,
|
|
5478
|
+
berachainBepolia,
|
|
5479
|
+
confluxESpaceTestnet
|
|
5480
|
+
];
|
|
5481
|
+
const networks = networkOption === "mainnet" /* mainnet */ ? MAINNETS : TESTNETS;
|
|
5482
|
+
appKitModel = createAppKit({
|
|
5483
|
+
adapters: [new EthersAdapter()],
|
|
5484
|
+
projectId,
|
|
5485
|
+
networks,
|
|
5486
|
+
enableInjected: true,
|
|
5487
|
+
enableEIP6963: true,
|
|
5488
|
+
metadata: {
|
|
5489
|
+
name: "Kima Transaction Widget",
|
|
5490
|
+
description: "Frontend widget for Kima integration for dApps",
|
|
5491
|
+
url: "https://kima.network",
|
|
5492
|
+
icons: ["https://avatars.githubusercontent.com/u/37784886"]
|
|
5493
|
+
},
|
|
5494
|
+
features: {
|
|
5495
|
+
analytics: false,
|
|
5496
|
+
swaps: false,
|
|
5497
|
+
onramp: false,
|
|
5498
|
+
email: false,
|
|
5499
|
+
socials: false,
|
|
5500
|
+
history: false
|
|
5501
|
+
}
|
|
5502
|
+
});
|
|
5503
|
+
return appKitModel;
|
|
5504
|
+
};
|
|
5505
|
+
|
|
5506
|
+
// src/app/providers/EvmWalletProvider.tsx
|
|
5507
|
+
import { Fragment, jsx as jsx48 } from "react/jsx-runtime";
|
|
5508
|
+
var EvmWalletProvider = ({
|
|
5509
|
+
children,
|
|
5510
|
+
networkOption,
|
|
5511
|
+
projectId,
|
|
5512
|
+
isLoading
|
|
5513
|
+
}) => {
|
|
5514
|
+
useEffect2(() => {
|
|
5515
|
+
if (!isLoading && networkOption && projectId) {
|
|
5516
|
+
setupAppKit(projectId, networkOption);
|
|
5517
|
+
}
|
|
5518
|
+
}, [isLoading, networkOption, projectId]);
|
|
5519
|
+
return /* @__PURE__ */ jsx48(Fragment, { children });
|
|
5520
|
+
};
|
|
5521
|
+
|
|
5522
|
+
// src/app/providers/SolanaWalletProvider.tsx
|
|
5523
|
+
import {
|
|
5524
|
+
ConnectionProvider,
|
|
5525
|
+
WalletProvider
|
|
5526
|
+
} from "@solana/wallet-adapter-react";
|
|
5527
|
+
import {
|
|
5528
|
+
PhantomWalletAdapter,
|
|
5529
|
+
SolflareWalletAdapter,
|
|
5530
|
+
CloverWalletAdapter,
|
|
5531
|
+
Coin98WalletAdapter,
|
|
5532
|
+
SolongWalletAdapter,
|
|
5533
|
+
TorusWalletAdapter
|
|
5534
|
+
} from "@solana/wallet-adapter-wallets";
|
|
5535
|
+
import { clusterApiUrl as clusterApiUrl2 } from "@solana/web3.js";
|
|
5536
|
+
import { jsx as jsx49 } from "react/jsx-runtime";
|
|
5537
|
+
var SolanaWalletProvider = ({
|
|
5538
|
+
children,
|
|
5539
|
+
networkOption
|
|
5540
|
+
}) => {
|
|
5541
|
+
const { solRPC } = useKimaContext();
|
|
5542
|
+
const endpoint = networkOption === "testnet" /* testnet */ ? clusterApiUrl2("testnet") : solRPC ?? "https://go.getblock.us/86aac42ad4484f3c813079afc201451c";
|
|
5543
|
+
return /* @__PURE__ */ jsx49(ConnectionProvider, { endpoint, children: /* @__PURE__ */ jsx49(
|
|
5544
|
+
WalletProvider,
|
|
5545
|
+
{
|
|
5546
|
+
autoConnect: false,
|
|
5547
|
+
wallets: [
|
|
5548
|
+
new PhantomWalletAdapter(),
|
|
5549
|
+
new SolflareWalletAdapter(),
|
|
5550
|
+
new CloverWalletAdapter(),
|
|
5551
|
+
new Coin98WalletAdapter(),
|
|
5552
|
+
new SolongWalletAdapter(),
|
|
5553
|
+
new TorusWalletAdapter()
|
|
5554
|
+
],
|
|
5555
|
+
children
|
|
5556
|
+
}
|
|
5557
|
+
) });
|
|
5558
|
+
};
|
|
5559
|
+
|
|
5560
|
+
// src/app/providers/TronWalletProvider.tsx
|
|
5561
|
+
import { useMemo as useMemo9 } from "react";
|
|
5562
|
+
import { WalletProvider as WalletProvider2 } from "@tronweb3/tronwallet-adapter-react-hooks";
|
|
5563
|
+
import { LedgerAdapter } from "@tronweb3/tronwallet-adapter-ledger";
|
|
5564
|
+
import { TronLinkAdapter } from "@tronweb3/tronwallet-adapter-tronlink";
|
|
5565
|
+
import { OkxWalletAdapter } from "@tronweb3/tronwallet-adapter-okxwallet";
|
|
5566
|
+
import { TokenPocketAdapter } from "@tronweb3/tronwallet-adapter-tokenpocket";
|
|
5567
|
+
import { jsx as jsx50 } from "react/jsx-runtime";
|
|
5568
|
+
var TronWalletProvider = ({ children }) => {
|
|
5569
|
+
const adapters = useMemo9(
|
|
5570
|
+
() => [
|
|
5571
|
+
new TronLinkAdapter(),
|
|
5572
|
+
new LedgerAdapter({ accountNumber: 2 }),
|
|
5573
|
+
new TokenPocketAdapter(),
|
|
5574
|
+
new OkxWalletAdapter()
|
|
5575
|
+
],
|
|
5576
|
+
[]
|
|
5577
|
+
);
|
|
5578
|
+
return /* @__PURE__ */ jsx50(WalletProvider2, { adapters, autoConnect: false, children });
|
|
5615
5579
|
};
|
|
5616
5580
|
|
|
5617
5581
|
// src/shared/plugins/createPluginDescriptor.tsx
|
|
@@ -5648,7 +5612,7 @@ var adapter_default = evmPlugin;
|
|
|
5648
5612
|
// src/features/allowances/solana/useSPLAllowance.ts
|
|
5649
5613
|
import { useQuery as useQuery7 } from "@tanstack/react-query";
|
|
5650
5614
|
import { useSelector as useSelector12 } from "react-redux";
|
|
5651
|
-
import { PublicKey
|
|
5615
|
+
import { PublicKey } from "@solana/web3.js";
|
|
5652
5616
|
import { getAssociatedTokenAddress, getMint } from "@solana/spl-token";
|
|
5653
5617
|
|
|
5654
5618
|
// src/features/connect-wallet/solana/useSolAddress.ts
|
|
@@ -5658,31 +5622,15 @@ import { useSelector as useSelector10 } from "react-redux";
|
|
|
5658
5622
|
// src/features/connect-wallet/solana/useSolProvider.ts
|
|
5659
5623
|
import { useMemo as useMemo10 } from "react";
|
|
5660
5624
|
import { useSelector as useSelector9 } from "react-redux";
|
|
5661
|
-
import { Connection
|
|
5625
|
+
import { Connection, clusterApiUrl as clusterApiUrl3 } from "@solana/web3.js";
|
|
5662
5626
|
import { useWallet } from "@solana/wallet-adapter-react";
|
|
5663
5627
|
var useSolProvider = () => {
|
|
5664
5628
|
const net = useSelector9(selectNetworkOption);
|
|
5665
|
-
const {
|
|
5629
|
+
const { solRPC } = useKimaContext();
|
|
5666
5630
|
const wallet = useWallet();
|
|
5667
5631
|
return useMemo10(() => {
|
|
5668
|
-
if (externalProvider?.type === "solana") {
|
|
5669
|
-
const prov = externalProvider.provider;
|
|
5670
|
-
const signer = externalProvider.signer;
|
|
5671
|
-
const pk2 = signer?.toBase58 ? signer.toBase58() : void 0;
|
|
5672
|
-
logger_default.debug("[useSolProvider] using externalProvider", {
|
|
5673
|
-
hasProvider: !!prov,
|
|
5674
|
-
hasSigner: !!signer,
|
|
5675
|
-
publicKey: pk2
|
|
5676
|
-
});
|
|
5677
|
-
return {
|
|
5678
|
-
connection: prov.connection,
|
|
5679
|
-
publicKey: pk2,
|
|
5680
|
-
signTransaction: prov.signTransaction,
|
|
5681
|
-
signMessage: prov.signMessage
|
|
5682
|
-
};
|
|
5683
|
-
}
|
|
5684
5632
|
const endpoint = net === "testnet" /* testnet */ ? clusterApiUrl3("devnet") : solRPC ?? "https://solana-rpc.publicnode.com";
|
|
5685
|
-
const connection = new
|
|
5633
|
+
const connection = new Connection(endpoint, "confirmed");
|
|
5686
5634
|
const pk = wallet.publicKey?.toBase58();
|
|
5687
5635
|
const signTransaction = wallet.signTransaction;
|
|
5688
5636
|
const signMessage = wallet.signMessage;
|
|
@@ -5698,31 +5646,26 @@ var useSolProvider = () => {
|
|
|
5698
5646
|
signTransaction,
|
|
5699
5647
|
signMessage
|
|
5700
5648
|
};
|
|
5701
|
-
}, [
|
|
5649
|
+
}, [net, solRPC, wallet]);
|
|
5702
5650
|
};
|
|
5703
5651
|
|
|
5704
5652
|
// src/features/connect-wallet/solana/useSolAddress.ts
|
|
5705
5653
|
var useSolAddress = () => {
|
|
5706
5654
|
const mode = useSelector10(selectMode);
|
|
5707
|
-
const { externalProvider } = useKimaContext();
|
|
5708
5655
|
const { publicKey } = useSolProvider();
|
|
5709
5656
|
return useMemo11(() => {
|
|
5710
5657
|
let resolved;
|
|
5711
5658
|
if (mode === "light" /* light */) resolved = lightDemoAccounts.SOL;
|
|
5712
|
-
else if (
|
|
5713
|
-
const pk = externalProvider.signer;
|
|
5714
|
-
resolved = pk?.toBase58 ? pk.toBase58() : void 0;
|
|
5715
|
-
} else if (publicKey) {
|
|
5659
|
+
else if (publicKey) {
|
|
5716
5660
|
resolved = publicKey;
|
|
5717
5661
|
}
|
|
5718
5662
|
logger_default.debug("[useSolAddress] resolved", {
|
|
5719
5663
|
mode,
|
|
5720
|
-
fromExternal: externalProvider?.type === "solana",
|
|
5721
5664
|
fromWalletAdapter: !!publicKey,
|
|
5722
5665
|
address: resolved
|
|
5723
5666
|
});
|
|
5724
5667
|
return resolved;
|
|
5725
|
-
}, [mode,
|
|
5668
|
+
}, [mode, publicKey]);
|
|
5726
5669
|
};
|
|
5727
5670
|
|
|
5728
5671
|
// src/features/connect-wallet/solana/useIsWalletReady.ts
|
|
@@ -5826,7 +5769,7 @@ var useSPLAllowance = () => {
|
|
|
5826
5769
|
const selectedCoin = useSelector12(selectSourceCurrency);
|
|
5827
5770
|
const tokenOptions = useSelector12(selectTokenOptions);
|
|
5828
5771
|
const { pools } = useGetPools_default(backendUrl, networkOption);
|
|
5829
|
-
const ownerPk = mode === "light" /* light */ ? new
|
|
5772
|
+
const ownerPk = mode === "light" /* light */ ? new PublicKey(lightDemoAccounts.SOL) : publicKey ? new PublicKey(publicKey) : void 0;
|
|
5830
5773
|
const enabled = !!connection && !!ownerPk && !!selectedCoin && !!tokenOptions && !!pools?.length && sourceChain.shortName === "SOL";
|
|
5831
5774
|
const { data } = useQuery7({
|
|
5832
5775
|
queryKey: [
|
|
@@ -5862,7 +5805,7 @@ var useSPLAllowance = () => {
|
|
|
5862
5805
|
});
|
|
5863
5806
|
return { allowance: 0n, decimals: 0 };
|
|
5864
5807
|
}
|
|
5865
|
-
const mint = new
|
|
5808
|
+
const mint = new PublicKey(mintAddr);
|
|
5866
5809
|
const { programId, isToken2022 } = await getTokenProgramForMint(
|
|
5867
5810
|
connection,
|
|
5868
5811
|
mint
|
|
@@ -5912,7 +5855,7 @@ var useSPLAllowance = () => {
|
|
|
5912
5855
|
import { useCallback as useCallback6 } from "react";
|
|
5913
5856
|
import { useQueryClient as useQueryClient2 } from "@tanstack/react-query";
|
|
5914
5857
|
import { useSelector as useSelector13 } from "react-redux";
|
|
5915
|
-
import { PublicKey as
|
|
5858
|
+
import { PublicKey as PublicKey2, Transaction } from "@solana/web3.js";
|
|
5916
5859
|
import {
|
|
5917
5860
|
getAssociatedTokenAddress as getAssociatedTokenAddress2,
|
|
5918
5861
|
createApproveInstruction,
|
|
@@ -5930,7 +5873,7 @@ var useApproveSPL = () => {
|
|
|
5930
5873
|
const feeDeduct = useSelector13(selectFeeDeduct);
|
|
5931
5874
|
const { allowanceAmount } = getFeeSideValues(feeDeduct, transactionValues);
|
|
5932
5875
|
const allowanceNumber = BigInt(allowanceAmount.value);
|
|
5933
|
-
const ownerPk = mode === "light" /* light */ ? new
|
|
5876
|
+
const ownerPk = mode === "light" /* light */ ? new PublicKey2(lightDemoAccounts.SOL) : publicKey ? new PublicKey2(publicKey) : void 0;
|
|
5934
5877
|
const { pools } = useGetPools_default(backendUrl, networkOption);
|
|
5935
5878
|
const approve = useCallback6(
|
|
5936
5879
|
async (isCancel = false) => {
|
|
@@ -5942,7 +5885,7 @@ var useApproveSPL = () => {
|
|
|
5942
5885
|
const poolAddress = getPoolAddress(pools, "SOL");
|
|
5943
5886
|
const tokenAddress = getTokenAddress(tokenOptions, selectedCoin, "SOL");
|
|
5944
5887
|
if (!poolAddress || !tokenAddress) return;
|
|
5945
|
-
const mint = new
|
|
5888
|
+
const mint = new PublicKey2(tokenAddress);
|
|
5946
5889
|
const { programId, isToken2022 } = await getTokenProgramForMint(
|
|
5947
5890
|
connection,
|
|
5948
5891
|
mint
|
|
@@ -5959,14 +5902,14 @@ var useApproveSPL = () => {
|
|
|
5959
5902
|
);
|
|
5960
5903
|
const ix = isCancel ? createRevokeInstruction(ata, ownerPk, [], programId) : createApproveInstruction(
|
|
5961
5904
|
ata,
|
|
5962
|
-
new
|
|
5905
|
+
new PublicKey2(poolAddress),
|
|
5963
5906
|
ownerPk,
|
|
5964
5907
|
allowanceNumber,
|
|
5965
5908
|
[],
|
|
5966
5909
|
programId
|
|
5967
5910
|
);
|
|
5968
5911
|
const recent = await connection.getLatestBlockhash("finalized");
|
|
5969
|
-
const tx = new
|
|
5912
|
+
const tx = new Transaction().add(ix);
|
|
5970
5913
|
tx.feePayer = ownerPk;
|
|
5971
5914
|
tx.recentBlockhash = recent.blockhash;
|
|
5972
5915
|
const signed = await signTransaction(tx);
|
|
@@ -6069,7 +6012,7 @@ var useAllowance2 = () => {
|
|
|
6069
6012
|
|
|
6070
6013
|
// src/features/balances/solana/useSolNativeBalance.ts
|
|
6071
6014
|
import { useQuery as useQuery8 } from "@tanstack/react-query";
|
|
6072
|
-
import { PublicKey as
|
|
6015
|
+
import { PublicKey as PublicKey3 } from "@solana/web3.js";
|
|
6073
6016
|
import { useSelector as useSelector16 } from "react-redux";
|
|
6074
6017
|
var useSolNativeBalance = () => {
|
|
6075
6018
|
const { connection } = useSolProvider();
|
|
@@ -6086,7 +6029,7 @@ var useSolNativeBalance = () => {
|
|
|
6086
6029
|
try {
|
|
6087
6030
|
logger_default.debug("[useSolNativeBalance] start", { owner, enabled });
|
|
6088
6031
|
if (!owner) return { balance: 0n, decimals: 9 };
|
|
6089
|
-
const lamports = await connection.getBalance(new
|
|
6032
|
+
const lamports = await connection.getBalance(new PublicKey3(owner));
|
|
6090
6033
|
const res = { balance: BigInt(lamports), decimals: 9 };
|
|
6091
6034
|
logger_default.debug("[useSolNativeBalance] result", res);
|
|
6092
6035
|
return res;
|
|
@@ -6108,7 +6051,7 @@ var useSolNativeBalance = () => {
|
|
|
6108
6051
|
// src/features/balances/solana/useSolTokenBalance.ts
|
|
6109
6052
|
import { useSelector as useSelector17 } from "react-redux";
|
|
6110
6053
|
import { useQuery as useQuery9 } from "@tanstack/react-query";
|
|
6111
|
-
import { PublicKey as
|
|
6054
|
+
import { PublicKey as PublicKey4 } from "@solana/web3.js";
|
|
6112
6055
|
import { getAssociatedTokenAddress as getAssociatedTokenAddress3, getMint as getMint2 } from "@solana/spl-token";
|
|
6113
6056
|
var getMintAddressForSymbol = (tokenOptions, symbol) => tokenOptions?.[symbol]?.SOL || "";
|
|
6114
6057
|
var useSolTokenBalance = () => {
|
|
@@ -6139,8 +6082,8 @@ var useSolTokenBalance = () => {
|
|
|
6139
6082
|
logger_default.debug("[useSolTokenBalance] missing mint for symbol", { symbol });
|
|
6140
6083
|
return { amount: 0n, decimals: 0 };
|
|
6141
6084
|
}
|
|
6142
|
-
const mint = new
|
|
6143
|
-
const ownerPk = new
|
|
6085
|
+
const mint = new PublicKey4(mintAddr);
|
|
6086
|
+
const ownerPk = new PublicKey4(owner);
|
|
6144
6087
|
const { programId, isToken2022 } = await getTokenProgramForMint(
|
|
6145
6088
|
connection,
|
|
6146
6089
|
mint
|
|
@@ -6190,19 +6133,12 @@ import { useCallback as useCallback8 } from "react";
|
|
|
6190
6133
|
import { useWallet as useWallet3 } from "@solana/wallet-adapter-react";
|
|
6191
6134
|
var useDisconnectWallet2 = () => {
|
|
6192
6135
|
const { disconnect: adapterDisconnect } = useWallet3();
|
|
6193
|
-
const { externalProvider } = useKimaContext();
|
|
6194
6136
|
const disconnectWallet = useCallback8(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
6137
|
if (typeof adapterDisconnect === "function") {
|
|
6202
6138
|
await adapterDisconnect();
|
|
6203
6139
|
return;
|
|
6204
6140
|
}
|
|
6205
|
-
}, [
|
|
6141
|
+
}, [adapterDisconnect]);
|
|
6206
6142
|
return { disconnectWallet };
|
|
6207
6143
|
};
|
|
6208
6144
|
|
|
@@ -6231,11 +6167,11 @@ import { useMemo as useMemo13 } from "react";
|
|
|
6231
6167
|
import { useSelector as useSelector18 } from "react-redux";
|
|
6232
6168
|
|
|
6233
6169
|
// src/shared/crypto/tron/tronweb.tsx
|
|
6234
|
-
import { TronWeb
|
|
6235
|
-
var tronWebTestnet = new
|
|
6170
|
+
import { TronWeb } from "tronweb";
|
|
6171
|
+
var tronWebTestnet = new TronWeb({
|
|
6236
6172
|
fullHost: "https://api.nileex.io"
|
|
6237
6173
|
});
|
|
6238
|
-
var tronWebMainnet = new
|
|
6174
|
+
var tronWebMainnet = new TronWeb({
|
|
6239
6175
|
fullHost: "https://api.trongrid.io"
|
|
6240
6176
|
});
|
|
6241
6177
|
|
|
@@ -6243,7 +6179,6 @@ var tronWebMainnet = new TronWeb2({
|
|
|
6243
6179
|
import { useWallet as useTronWallet } from "@tronweb3/tronwallet-adapter-react-hooks";
|
|
6244
6180
|
var useTronProvider = () => {
|
|
6245
6181
|
const net = useSelector18(selectNetworkOption);
|
|
6246
|
-
const { externalProvider } = useKimaContext();
|
|
6247
6182
|
const {
|
|
6248
6183
|
connected: adapterConnected,
|
|
6249
6184
|
address: adapterAddr,
|
|
@@ -6256,21 +6191,6 @@ var useTronProvider = () => {
|
|
|
6256
6191
|
net,
|
|
6257
6192
|
endpoint: tw?.fullHost
|
|
6258
6193
|
});
|
|
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
|
-
}
|
|
6274
6194
|
if (adapterConnected && (adapterSignMessage || adapterSignTransaction)) {
|
|
6275
6195
|
const normalizedAddr = adapterAddr ?? void 0;
|
|
6276
6196
|
logger_default.debug("[useTronProvider] wallet-adapter signer", {
|
|
@@ -6289,7 +6209,6 @@ var useTronProvider = () => {
|
|
|
6289
6209
|
logger_default.debug("[useTronProvider] readonly", { net });
|
|
6290
6210
|
return { tronWeb: tw };
|
|
6291
6211
|
}, [
|
|
6292
|
-
externalProvider,
|
|
6293
6212
|
adapterConnected,
|
|
6294
6213
|
adapterAddr,
|
|
6295
6214
|
adapterSignMessage,
|
|
@@ -6302,25 +6221,21 @@ var useTronProvider = () => {
|
|
|
6302
6221
|
import { useMemo as useMemo14 } from "react";
|
|
6303
6222
|
import { useWallet as useTronWallet2 } from "@tronweb3/tronwallet-adapter-react-hooks";
|
|
6304
6223
|
var useTronAddress = (mode) => {
|
|
6305
|
-
const { externalProvider } = useKimaContext();
|
|
6306
6224
|
const { address: adapterAddr, connected } = useTronWallet2();
|
|
6307
6225
|
return useMemo14(() => {
|
|
6308
6226
|
let resolved;
|
|
6309
6227
|
if (mode === "light" /* light */) {
|
|
6310
6228
|
resolved = lightDemoAccounts.TRX;
|
|
6311
|
-
} else if (externalProvider?.type === "tron") {
|
|
6312
|
-
resolved = externalProvider.signer || void 0;
|
|
6313
6229
|
} else if (connected && adapterAddr) {
|
|
6314
6230
|
resolved = adapterAddr;
|
|
6315
6231
|
}
|
|
6316
6232
|
logger_default.debug("[useTronAddress] resolved", {
|
|
6317
6233
|
mode,
|
|
6318
|
-
fromExternal: externalProvider?.type === "tron",
|
|
6319
6234
|
fromAdapter: connected && !!adapterAddr,
|
|
6320
6235
|
address: resolved
|
|
6321
6236
|
});
|
|
6322
6237
|
return resolved;
|
|
6323
|
-
}, [mode,
|
|
6238
|
+
}, [mode, connected, adapterAddr]);
|
|
6324
6239
|
};
|
|
6325
6240
|
|
|
6326
6241
|
// src/features/allowances/tron/useTrc20Allowance.ts
|
|
@@ -7078,19 +6993,12 @@ import { useCallback as useCallback11 } from "react";
|
|
|
7078
6993
|
import { useWallet as useWallet4 } from "@tronweb3/tronwallet-adapter-react-hooks";
|
|
7079
6994
|
var useDisconnectWallet3 = () => {
|
|
7080
6995
|
const { disconnect: adapterDisconnect } = useWallet4();
|
|
7081
|
-
const { externalProvider } = useKimaContext();
|
|
7082
6996
|
const disconnectWallet = useCallback11(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
6997
|
if (typeof adapterDisconnect === "function") {
|
|
7090
6998
|
await adapterDisconnect();
|
|
7091
6999
|
return;
|
|
7092
7000
|
}
|
|
7093
|
-
}, [
|
|
7001
|
+
}, [adapterDisconnect]);
|
|
7094
7002
|
return { disconnectWallet };
|
|
7095
7003
|
};
|
|
7096
7004
|
|
|
@@ -7215,7 +7123,7 @@ var adapter_default5 = bankPlugin;
|
|
|
7215
7123
|
|
|
7216
7124
|
// src/features/allowances/btc/useAllowance.ts
|
|
7217
7125
|
import { useCallback as useCallback12, useMemo as useMemo22 } from "react";
|
|
7218
|
-
import { parseUnits
|
|
7126
|
+
import { parseUnits } from "viem";
|
|
7219
7127
|
import { useDispatch as useDispatch7, useSelector as useSelector26 } from "react-redux";
|
|
7220
7128
|
|
|
7221
7129
|
// src/features/connect-wallet/btc/unisat.ts
|
|
@@ -7331,7 +7239,7 @@ var useAllowance6 = () => {
|
|
|
7331
7239
|
if (allowanceSats != null) return allowanceSats;
|
|
7332
7240
|
if (!amount) return 0n;
|
|
7333
7241
|
try {
|
|
7334
|
-
return
|
|
7242
|
+
return parseUnits(amount, 8);
|
|
7335
7243
|
} catch {
|
|
7336
7244
|
return 0n;
|
|
7337
7245
|
}
|
|
@@ -7979,24 +7887,14 @@ var getBtcAccountFromProvider = async (provider, {
|
|
|
7979
7887
|
// src/features/connect-wallet/btc/useIsWalletReady.ts
|
|
7980
7888
|
var useIsWalletReady6 = () => {
|
|
7981
7889
|
const dispatch = useDispatch8();
|
|
7982
|
-
const { externalProvider } = useKimaContext();
|
|
7983
7890
|
const mode = useSelector28(selectMode);
|
|
7984
7891
|
const networkOption = useSelector28(selectNetworkOption);
|
|
7985
7892
|
const sourceChain = useSelector28(selectSourceChain);
|
|
7986
7893
|
const storedAddress = useSelector28(selectBitcoinAddress);
|
|
7987
7894
|
const storedPubkey = useSelector28(selectBitcoinPubkey);
|
|
7988
7895
|
const resolved = useMemo24(() => {
|
|
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
7896
|
return { address: storedAddress, pubkey: storedPubkey };
|
|
7999
|
-
}, [
|
|
7897
|
+
}, [storedAddress, storedPubkey]);
|
|
8000
7898
|
const addressNetwork = useMemo24(
|
|
8001
7899
|
() => getBtcAddressNetwork(resolved.address),
|
|
8002
7900
|
[resolved.address]
|
|
@@ -8036,7 +7934,6 @@ var useIsWalletReady6 = () => {
|
|
|
8036
7934
|
useEffect8(() => {
|
|
8037
7935
|
if (mode === "light" /* light */) return;
|
|
8038
7936
|
if (sourceChain.shortName !== "BTC" /* BTC */) return;
|
|
8039
|
-
if (externalProvider?.type === "btc") return;
|
|
8040
7937
|
if (storedAddress) return;
|
|
8041
7938
|
const unisat = getUnisat();
|
|
8042
7939
|
if (!unisat) return;
|
|
@@ -8058,7 +7955,6 @@ var useIsWalletReady6 = () => {
|
|
|
8058
7955
|
}, [
|
|
8059
7956
|
mode,
|
|
8060
7957
|
sourceChain.shortName,
|
|
8061
|
-
externalProvider,
|
|
8062
7958
|
storedAddress,
|
|
8063
7959
|
dispatch
|
|
8064
7960
|
]);
|
|
@@ -8114,14 +8010,7 @@ import { useCallback as useCallback13 } from "react";
|
|
|
8114
8010
|
import { useDispatch as useDispatch9 } from "react-redux";
|
|
8115
8011
|
var useDisconnectWallet6 = () => {
|
|
8116
8012
|
const dispatch = useDispatch9();
|
|
8117
|
-
const { externalProvider } = useKimaContext();
|
|
8118
8013
|
const disconnectWallet = useCallback13(async () => {
|
|
8119
|
-
if (externalProvider?.type === "btc") {
|
|
8120
|
-
const disconnect = externalProvider.provider?.disconnect;
|
|
8121
|
-
if (typeof disconnect === "function") {
|
|
8122
|
-
await disconnect();
|
|
8123
|
-
}
|
|
8124
|
-
}
|
|
8125
8014
|
const unisat = getUnisat();
|
|
8126
8015
|
if (unisat?.disconnect) {
|
|
8127
8016
|
await unisat.disconnect();
|
|
@@ -8130,7 +8019,7 @@ var useDisconnectWallet6 = () => {
|
|
|
8130
8019
|
dispatch(setBitcoinPubkey(""));
|
|
8131
8020
|
dispatch(setBtcWalletType(""));
|
|
8132
8021
|
dispatch(setSourceAddress(""));
|
|
8133
|
-
}, [dispatch
|
|
8022
|
+
}, [dispatch]);
|
|
8134
8023
|
return { disconnectWallet };
|
|
8135
8024
|
};
|
|
8136
8025
|
|
|
@@ -8241,7 +8130,6 @@ var InternalKimaProvider = React4.memo(({ kimaBackendUrl, solRPC, projectId, chi
|
|
|
8241
8130
|
var KimaProvider = ({
|
|
8242
8131
|
projectId = "e579511a495b5c312b572b036e60555a",
|
|
8243
8132
|
children = /* @__PURE__ */ jsx58(Fragment5, {}),
|
|
8244
|
-
externalProvider,
|
|
8245
8133
|
kimaBackendUrl = "http://localhost:3001",
|
|
8246
8134
|
solRPC,
|
|
8247
8135
|
logLevel,
|
|
@@ -8255,27 +8143,7 @@ var KimaProvider = ({
|
|
|
8255
8143
|
logger_default.debug("KimaProvider: setting log level to:", logLevel);
|
|
8256
8144
|
logger_default.setLevel(logLevel, false);
|
|
8257
8145
|
}
|
|
8258
|
-
let validExternalProvider;
|
|
8259
|
-
let sourceAddress;
|
|
8260
|
-
if (externalProvider && isValidExternalProvider(externalProvider)) {
|
|
8261
|
-
validExternalProvider = externalProvider;
|
|
8262
|
-
if (externalProvider.type === "evm" && externalProvider.signer instanceof JsonRpcSigner3) {
|
|
8263
|
-
sourceAddress = externalProvider.signer.address;
|
|
8264
|
-
}
|
|
8265
|
-
if (externalProvider.type === "solana" && externalProvider.signer instanceof PublicKey7) {
|
|
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
8146
|
const kimaContext = {
|
|
8277
|
-
externalProvider: validExternalProvider,
|
|
8278
|
-
sourceAddress,
|
|
8279
8147
|
solRPC,
|
|
8280
8148
|
kimaBackendUrl,
|
|
8281
8149
|
keplrHandler,
|
|
@@ -8297,7 +8165,7 @@ var KimaProvider = ({
|
|
|
8297
8165
|
var KimaProvider_default = KimaProvider;
|
|
8298
8166
|
|
|
8299
8167
|
// src/widgets/common/KimaTransactionWidget.tsx
|
|
8300
|
-
import { useEffect as
|
|
8168
|
+
import { useEffect as useEffect31, useState as useState17 } from "react";
|
|
8301
8169
|
import { useDispatch as useDispatch33 } from "react-redux";
|
|
8302
8170
|
|
|
8303
8171
|
// src/assets/loading/180-ring.tsx
|
|
@@ -8718,6 +8586,49 @@ var CopyButton = ({ text }) => {
|
|
|
8718
8586
|
};
|
|
8719
8587
|
var CopyButton_default = CopyButton;
|
|
8720
8588
|
|
|
8589
|
+
// src/shared/lib/bigint.ts
|
|
8590
|
+
import { formatUnits, parseUnits as parseUnits2 } from "viem";
|
|
8591
|
+
|
|
8592
|
+
// src/shared/lib/format.ts
|
|
8593
|
+
var formatterInt = new Intl.NumberFormat("en-US", {
|
|
8594
|
+
maximumFractionDigits: 0
|
|
8595
|
+
});
|
|
8596
|
+
var formatterFloat = new Intl.NumberFormat("en-US", {
|
|
8597
|
+
maximumFractionDigits: 6,
|
|
8598
|
+
useGrouping: false
|
|
8599
|
+
});
|
|
8600
|
+
|
|
8601
|
+
// src/shared/lib/bigint.ts
|
|
8602
|
+
var bigIntToNumber = (inputs) => {
|
|
8603
|
+
const { value, decimals } = inputs || {};
|
|
8604
|
+
if (!value || !decimals) return 0;
|
|
8605
|
+
const valBigInt = BigInt(value);
|
|
8606
|
+
const valNumberStr = formatUnits(valBigInt, decimals);
|
|
8607
|
+
return Number(valNumberStr);
|
|
8608
|
+
};
|
|
8609
|
+
var bigIntChangeDecimals = (inputs) => {
|
|
8610
|
+
const { value, decimals, newDecimals } = inputs || {};
|
|
8611
|
+
const valBigInt = BigInt(value);
|
|
8612
|
+
if (decimals === newDecimals) return { value: valBigInt, decimals };
|
|
8613
|
+
if (decimals > newDecimals) {
|
|
8614
|
+
const diff2 = decimals - newDecimals;
|
|
8615
|
+
return { value: valBigInt / 10n ** BigInt(diff2), decimals: newDecimals };
|
|
8616
|
+
}
|
|
8617
|
+
const diff = newDecimals - decimals;
|
|
8618
|
+
return { value: valBigInt * 10n ** BigInt(diff), decimals: newDecimals };
|
|
8619
|
+
};
|
|
8620
|
+
var formatBigInt = (inputs) => {
|
|
8621
|
+
return formatterFloat.format(bigIntToNumber(inputs));
|
|
8622
|
+
};
|
|
8623
|
+
var toBigintAmount = (data) => {
|
|
8624
|
+
return {
|
|
8625
|
+
// bigint values constructed from numbers can have rounding errors!
|
|
8626
|
+
// so need to convert to string and then to bigint
|
|
8627
|
+
value: BigInt(data.value.toString()),
|
|
8628
|
+
decimals: data.decimals
|
|
8629
|
+
};
|
|
8630
|
+
};
|
|
8631
|
+
|
|
8721
8632
|
// src/hooks/useHideActivityTab.tsx
|
|
8722
8633
|
import { useEffect as useEffect13, useRef as useRef2 } from "react";
|
|
8723
8634
|
function useHideWuiListItem(isModalOpen) {
|
|
@@ -8793,7 +8704,6 @@ var WalletButton = ({
|
|
|
8793
8704
|
const targetNetwork = useSelector30(selectTargetChain);
|
|
8794
8705
|
const targetAddress = useSelector30(selectTargetAddress);
|
|
8795
8706
|
const dAppOption = useSelector30(selectDappOption);
|
|
8796
|
-
const { externalProvider } = useKimaContext();
|
|
8797
8707
|
const { connected: isSolanaConnected } = useSolanaWallet();
|
|
8798
8708
|
const { connected: isTronConnected } = useTronWallet3();
|
|
8799
8709
|
const { isReady, statusMessage, connectedAddress } = useIsWalletReady_default();
|
|
@@ -8839,10 +8749,9 @@ var WalletButton = ({
|
|
|
8839
8749
|
logger_default.debug(`${TAG} wallet state`, {
|
|
8840
8750
|
isReady,
|
|
8841
8751
|
statusMessage,
|
|
8842
|
-
connectedAddress
|
|
8843
|
-
externalProvider
|
|
8752
|
+
connectedAddress
|
|
8844
8753
|
});
|
|
8845
|
-
}, [isReady, statusMessage, connectedAddress
|
|
8754
|
+
}, [isReady, statusMessage, connectedAddress]);
|
|
8846
8755
|
const demoSourceAddress = useMemo29(() => {
|
|
8847
8756
|
if (mode !== "light" /* light */) return "";
|
|
8848
8757
|
const short = sourceNetwork?.shortName;
|
|
@@ -9803,9 +9712,220 @@ var StepBox = ({ step, errorStep, loadingStep, data, steps }) => {
|
|
|
9803
9712
|
};
|
|
9804
9713
|
var StepBox_default = StepBox;
|
|
9805
9714
|
|
|
9715
|
+
// src/components/reusable/VersionInfo.tsx
|
|
9716
|
+
import { useEffect as useEffect19, useState as useState8 } from "react";
|
|
9717
|
+
|
|
9718
|
+
// package.json
|
|
9719
|
+
var package_default = {
|
|
9720
|
+
name: "@kimafinance/kima-transaction-widget",
|
|
9721
|
+
version: "1.5.32",
|
|
9722
|
+
description: "Kima Transaction Widget",
|
|
9723
|
+
author: "",
|
|
9724
|
+
license: "MIT",
|
|
9725
|
+
repository: "https://github.com/kima-finance/kima-transaction-widget",
|
|
9726
|
+
main: "dist/index.cjs",
|
|
9727
|
+
module: "dist/index.js",
|
|
9728
|
+
types: "dist/index.d.ts",
|
|
9729
|
+
type: "module",
|
|
9730
|
+
source: "src/index.tsx",
|
|
9731
|
+
exports: {
|
|
9732
|
+
".": {
|
|
9733
|
+
types: "./dist/index.d.ts",
|
|
9734
|
+
import: "./dist/index.js",
|
|
9735
|
+
require: "./dist/index.cjs"
|
|
9736
|
+
},
|
|
9737
|
+
"./index.css": {
|
|
9738
|
+
default: "./dist/index.css"
|
|
9739
|
+
}
|
|
9740
|
+
},
|
|
9741
|
+
scripts: {
|
|
9742
|
+
build: "npm run build:tsup && npm run build:sass && npm run move:fonts",
|
|
9743
|
+
"build:sass": "sass src/styles/main.scss dist/index.css",
|
|
9744
|
+
"build:tsup": "tsup",
|
|
9745
|
+
"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/ \\;",
|
|
9746
|
+
prepare: "npm run build",
|
|
9747
|
+
dev: "tsup --watch",
|
|
9748
|
+
sass: "sass src/styles/main.scss src/index.css -w",
|
|
9749
|
+
test: "jest --runInBand",
|
|
9750
|
+
docs: "typedoc --options typedoc.json"
|
|
9751
|
+
},
|
|
9752
|
+
peerDependencies: {
|
|
9753
|
+
react: ">=17.0.0",
|
|
9754
|
+
"react-dom": ">=17.0.1",
|
|
9755
|
+
"react-redux": ">=7.2.2",
|
|
9756
|
+
redux: ">=4.1.2"
|
|
9757
|
+
},
|
|
9758
|
+
devDependencies: {
|
|
9759
|
+
"@babel/plugin-proposal-unicode-property-regex": "^7.18.6",
|
|
9760
|
+
"@testing-library/jest-dom": "^5.17.0",
|
|
9761
|
+
"@testing-library/react": "^13.4.0",
|
|
9762
|
+
"@testing-library/react-hooks": "^7.0.2",
|
|
9763
|
+
"@types/bn.js": "^5.1.6",
|
|
9764
|
+
"@types/crypto-js": "^4.2.2",
|
|
9765
|
+
"@types/jest": "^29.5.14",
|
|
9766
|
+
"@types/mocha": "^10.0.10",
|
|
9767
|
+
"@types/node": "^20.17.10",
|
|
9768
|
+
"@types/react": "^18.3.1",
|
|
9769
|
+
"@types/react-dom": "^18.3.1",
|
|
9770
|
+
"@types/react-redux": "^7.1.34",
|
|
9771
|
+
"@typescript-eslint/eslint-plugin": "^6.21.0",
|
|
9772
|
+
"@typescript-eslint/parser": "^6.21.0",
|
|
9773
|
+
"cross-env": "^7.0.3",
|
|
9774
|
+
eslint: "^8.57.1",
|
|
9775
|
+
"eslint-config-prettier": "^9.1.0",
|
|
9776
|
+
"eslint-plugin-react": "^7.37.2",
|
|
9777
|
+
"eslint-plugin-react-hooks": "^4.6.2",
|
|
9778
|
+
jest: "^29.7.0",
|
|
9779
|
+
"jest-environment-jsdom": "^29.7.0",
|
|
9780
|
+
"npm-run-all": "^4.1.5",
|
|
9781
|
+
prettier: "^3.4.2",
|
|
9782
|
+
react: "^18.3.1",
|
|
9783
|
+
"react-dom": "^18.3.1",
|
|
9784
|
+
serve: "^14.2.4",
|
|
9785
|
+
"ts-jest": "^29.2.5",
|
|
9786
|
+
"ts-node": "^10.9.2",
|
|
9787
|
+
typedoc: "^0.27.7",
|
|
9788
|
+
"typedoc-plugin-markdown": "^4.2.10",
|
|
9789
|
+
typescript: "^5.7.3"
|
|
9790
|
+
},
|
|
9791
|
+
dependencies: {
|
|
9792
|
+
"@kimafinance/btc-signer": "^1.3.4",
|
|
9793
|
+
"@metamask/detect-provider": "^2.0.0",
|
|
9794
|
+
"@noble/secp256k1": "^2.1.0",
|
|
9795
|
+
"@reduxjs/toolkit": "^2.5.0",
|
|
9796
|
+
"@reown/appkit": "^1.7.1",
|
|
9797
|
+
"@reown/appkit-adapter-ethers": "^1.7.1",
|
|
9798
|
+
"@scure/base": "^1.2.1",
|
|
9799
|
+
"@solana/spl-token": "^0.3.5",
|
|
9800
|
+
"@solana/wallet-adapter-base": "^0.9.18",
|
|
9801
|
+
"@solana/wallet-adapter-react": "^0.15.20",
|
|
9802
|
+
"@solana/wallet-adapter-wallets": "^0.19.3",
|
|
9803
|
+
"@solana/web3.js": "^1.98.0",
|
|
9804
|
+
"@tanstack/react-query": "^5.62.8",
|
|
9805
|
+
"@tronweb3/tronwallet-abstract-adapter": "^1.1.8",
|
|
9806
|
+
"@tronweb3/tronwallet-adapter-ledger": "^1.1.10",
|
|
9807
|
+
"@tronweb3/tronwallet-adapter-okxwallet": "^1.0.5",
|
|
9808
|
+
"@tronweb3/tronwallet-adapter-react-hooks": "^1.1.9",
|
|
9809
|
+
"@tronweb3/tronwallet-adapter-tokenpocket": "^1.0.5",
|
|
9810
|
+
"@tronweb3/tronwallet-adapter-tronlink": "^1.1.11",
|
|
9811
|
+
"@tronweb3/tronwallet-adapter-walletconnect": "^2.0.2",
|
|
9812
|
+
"bitcoinjs-lib": "^6.1.7",
|
|
9813
|
+
"browserify-zlib": "^0.2.0",
|
|
9814
|
+
buffer: "^6.0.3",
|
|
9815
|
+
"buffer-layout": "^1.2.2",
|
|
9816
|
+
"crypto-browserify": "^3.12.1",
|
|
9817
|
+
"crypto-js": "^4.2.0",
|
|
9818
|
+
ethers: "^6.13.5",
|
|
9819
|
+
hex64: "^0.4.0",
|
|
9820
|
+
"https-browserify": "^1.0.0",
|
|
9821
|
+
"json-bigint": "^1.0.0",
|
|
9822
|
+
loglevel: "^1.9.2",
|
|
9823
|
+
"os-browserify": "^0.3.0",
|
|
9824
|
+
"path-browserify": "^1.0.1",
|
|
9825
|
+
"pino-pretty": "^13.0.0",
|
|
9826
|
+
"react-hot-toast": "^2.4.1",
|
|
9827
|
+
"react-redux": ">=7.2.2",
|
|
9828
|
+
"react-tooltip": "^5.28.0",
|
|
9829
|
+
redux: ">=4.1.2",
|
|
9830
|
+
sass: "^1.83.0",
|
|
9831
|
+
"sats-connect": "2.8.3",
|
|
9832
|
+
"stream-browserify": "^3.0.0",
|
|
9833
|
+
"stream-http": "^3.2.0",
|
|
9834
|
+
tronweb: "^6.0.0",
|
|
9835
|
+
tsup: "^8.3.5",
|
|
9836
|
+
url: "^0.11.0",
|
|
9837
|
+
uuid: "^11.1.0",
|
|
9838
|
+
viem: "^2.23.2",
|
|
9839
|
+
"vm-browserify": "^1.1.2"
|
|
9840
|
+
},
|
|
9841
|
+
files: [
|
|
9842
|
+
"dist"
|
|
9843
|
+
]
|
|
9844
|
+
};
|
|
9845
|
+
|
|
9846
|
+
// src/shared/config/version.ts
|
|
9847
|
+
var WIDGET_VERSION = package_default.version;
|
|
9848
|
+
|
|
9849
|
+
// src/components/reusable/VersionInfo.tsx
|
|
9850
|
+
import { Fragment as Fragment10, jsx as jsx77, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
9851
|
+
var VersionInfo = ({ theme }) => {
|
|
9852
|
+
const [isOpen, setIsOpen] = useState8(false);
|
|
9853
|
+
const { kimaBackendUrl } = useKimaContext();
|
|
9854
|
+
const { data: envOptions } = useGetEnvOptions({ kimaBackendUrl });
|
|
9855
|
+
useEffect19(() => {
|
|
9856
|
+
if (!isOpen) return;
|
|
9857
|
+
const handleKeyDown = (event) => {
|
|
9858
|
+
if (event.key === "Escape") {
|
|
9859
|
+
setIsOpen(false);
|
|
9860
|
+
}
|
|
9861
|
+
};
|
|
9862
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
9863
|
+
return () => {
|
|
9864
|
+
window.removeEventListener("keydown", handleKeyDown);
|
|
9865
|
+
};
|
|
9866
|
+
}, [isOpen]);
|
|
9867
|
+
const backendVersion = envOptions?.backendVersion ?? "Unavailable";
|
|
9868
|
+
return /* @__PURE__ */ jsxs44(Fragment10, { children: [
|
|
9869
|
+
/* @__PURE__ */ jsx77("div", { className: "version-info", children: /* @__PURE__ */ jsx77(
|
|
9870
|
+
"button",
|
|
9871
|
+
{
|
|
9872
|
+
type: "button",
|
|
9873
|
+
className: "version-info-trigger",
|
|
9874
|
+
"aria-label": "Open version information",
|
|
9875
|
+
onClick: () => setIsOpen(true),
|
|
9876
|
+
children: /* @__PURE__ */ jsx77("span", { className: "version-info-glyph", "aria-hidden": "true", children: "i" })
|
|
9877
|
+
}
|
|
9878
|
+
) }),
|
|
9879
|
+
isOpen && /* @__PURE__ */ jsx77(
|
|
9880
|
+
"div",
|
|
9881
|
+
{
|
|
9882
|
+
className: "version-info-overlay",
|
|
9883
|
+
role: "presentation",
|
|
9884
|
+
onClick: () => setIsOpen(false),
|
|
9885
|
+
children: /* @__PURE__ */ jsxs44(
|
|
9886
|
+
"div",
|
|
9887
|
+
{
|
|
9888
|
+
className: `version-info-modal ${theme.colorMode}`,
|
|
9889
|
+
role: "dialog",
|
|
9890
|
+
"aria-modal": "true",
|
|
9891
|
+
"aria-label": "Version information",
|
|
9892
|
+
onClick: (event) => event.stopPropagation(),
|
|
9893
|
+
children: [
|
|
9894
|
+
/* @__PURE__ */ jsxs44("div", { className: "version-info-modal-header", children: [
|
|
9895
|
+
/* @__PURE__ */ jsx77("h3", { children: "Version Information" }),
|
|
9896
|
+
/* @__PURE__ */ jsx77(
|
|
9897
|
+
"button",
|
|
9898
|
+
{
|
|
9899
|
+
type: "button",
|
|
9900
|
+
className: "version-info-close",
|
|
9901
|
+
"aria-label": "Close version information",
|
|
9902
|
+
onClick: () => setIsOpen(false),
|
|
9903
|
+
children: /* @__PURE__ */ jsx77(Cross_default, {})
|
|
9904
|
+
}
|
|
9905
|
+
)
|
|
9906
|
+
] }),
|
|
9907
|
+
/* @__PURE__ */ jsxs44("div", { className: "version-info-list", children: [
|
|
9908
|
+
/* @__PURE__ */ jsxs44("div", { className: "version-info-row", children: [
|
|
9909
|
+
/* @__PURE__ */ jsx77("span", { children: "Current widget version" }),
|
|
9910
|
+
/* @__PURE__ */ jsx77("strong", { children: WIDGET_VERSION })
|
|
9911
|
+
] }),
|
|
9912
|
+
/* @__PURE__ */ jsxs44("div", { className: "version-info-row", children: [
|
|
9913
|
+
/* @__PURE__ */ jsx77("span", { children: "Current backend version" }),
|
|
9914
|
+
/* @__PURE__ */ jsx77("strong", { children: backendVersion })
|
|
9915
|
+
] })
|
|
9916
|
+
] })
|
|
9917
|
+
]
|
|
9918
|
+
}
|
|
9919
|
+
)
|
|
9920
|
+
}
|
|
9921
|
+
)
|
|
9922
|
+
] });
|
|
9923
|
+
};
|
|
9924
|
+
var VersionInfo_default = VersionInfo;
|
|
9925
|
+
|
|
9806
9926
|
// src/widgets/common/ErrorWidget.tsx
|
|
9807
9927
|
import { useSelector as useSelector38 } from "react-redux";
|
|
9808
|
-
import { jsx as
|
|
9928
|
+
import { jsx as jsx78, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
9809
9929
|
var ErrorWidget = ({
|
|
9810
9930
|
theme,
|
|
9811
9931
|
title,
|
|
@@ -9817,22 +9937,22 @@ var ErrorWidget = ({
|
|
|
9817
9937
|
const ccTransactionId = useSelector38(selectCCTransactionId);
|
|
9818
9938
|
const isCreditCardSource = sourceChain.shortName === "CC";
|
|
9819
9939
|
const isRetrying = useSelector38(selectCCTransactionRetrying);
|
|
9820
|
-
return /* @__PURE__ */
|
|
9940
|
+
return /* @__PURE__ */ jsx78(
|
|
9821
9941
|
"div",
|
|
9822
9942
|
{
|
|
9823
9943
|
className: `kima-card ${theme.colorMode}`,
|
|
9824
9944
|
style: {
|
|
9825
9945
|
background: theme.colorMode === "light" /* light */ ? theme.backgroundColorLight : theme.backgroundColorDark
|
|
9826
9946
|
},
|
|
9827
|
-
children: /* @__PURE__ */
|
|
9828
|
-
/* @__PURE__ */
|
|
9829
|
-
/* @__PURE__ */
|
|
9830
|
-
/* @__PURE__ */
|
|
9947
|
+
children: /* @__PURE__ */ jsxs45("div", { className: "transfer-card", children: [
|
|
9948
|
+
/* @__PURE__ */ jsxs45("div", { className: "kima-card-header", children: [
|
|
9949
|
+
/* @__PURE__ */ jsx78("div", { className: "topbar", children: /* @__PURE__ */ jsx78("div", { className: "title", children: /* @__PURE__ */ jsx78("h3", { children: title }) }) }),
|
|
9950
|
+
/* @__PURE__ */ jsx78("h4", { className: "subtitle" })
|
|
9831
9951
|
] }),
|
|
9832
|
-
/* @__PURE__ */
|
|
9833
|
-
isCreditCardSource && !isRetrying && /* @__PURE__ */
|
|
9834
|
-
message && message !== "" && /* @__PURE__ */
|
|
9835
|
-
isCreditCardSource && /* @__PURE__ */
|
|
9952
|
+
/* @__PURE__ */ jsxs45("div", { className: "kima-card-content error", children: [
|
|
9953
|
+
isCreditCardSource && !isRetrying && /* @__PURE__ */ jsx78(Error_default, { width: 40, height: 40 }),
|
|
9954
|
+
message && message !== "" && /* @__PURE__ */ jsx78("h2", { children: message }),
|
|
9955
|
+
isCreditCardSource && /* @__PURE__ */ jsxs45(
|
|
9836
9956
|
"div",
|
|
9837
9957
|
{
|
|
9838
9958
|
style: {
|
|
@@ -9841,8 +9961,8 @@ var ErrorWidget = ({
|
|
|
9841
9961
|
flexDirection: "column"
|
|
9842
9962
|
},
|
|
9843
9963
|
children: [
|
|
9844
|
-
isRetrying ? /* @__PURE__ */
|
|
9845
|
-
ccTransactionId && /* @__PURE__ */
|
|
9964
|
+
isRetrying ? /* @__PURE__ */ jsx78("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__ */ jsx78("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." }),
|
|
9965
|
+
ccTransactionId && /* @__PURE__ */ jsxs45(
|
|
9846
9966
|
"div",
|
|
9847
9967
|
{
|
|
9848
9968
|
style: {
|
|
@@ -9852,7 +9972,7 @@ var ErrorWidget = ({
|
|
|
9852
9972
|
justifyContent: "center"
|
|
9853
9973
|
},
|
|
9854
9974
|
children: [
|
|
9855
|
-
/* @__PURE__ */
|
|
9975
|
+
/* @__PURE__ */ jsx78(
|
|
9856
9976
|
"code",
|
|
9857
9977
|
{
|
|
9858
9978
|
style: {
|
|
@@ -9863,16 +9983,16 @@ var ErrorWidget = ({
|
|
|
9863
9983
|
children: ccTransactionId
|
|
9864
9984
|
}
|
|
9865
9985
|
),
|
|
9866
|
-
/* @__PURE__ */
|
|
9986
|
+
/* @__PURE__ */ jsx78(CopyButton_default, { text: ccTransactionId })
|
|
9867
9987
|
]
|
|
9868
9988
|
}
|
|
9869
9989
|
),
|
|
9870
|
-
isRetrying && /* @__PURE__ */
|
|
9990
|
+
isRetrying && /* @__PURE__ */ jsx78(ring_default, { width: 30, height: 30, fill: "#86b8ce" })
|
|
9871
9991
|
]
|
|
9872
9992
|
}
|
|
9873
9993
|
)
|
|
9874
9994
|
] }),
|
|
9875
|
-
backButtonEnabled && /* @__PURE__ */
|
|
9995
|
+
backButtonEnabled && /* @__PURE__ */ jsx78(
|
|
9876
9996
|
"div",
|
|
9877
9997
|
{
|
|
9878
9998
|
style: {
|
|
@@ -9880,14 +10000,14 @@ var ErrorWidget = ({
|
|
|
9880
10000
|
justifyContent: "flex-end",
|
|
9881
10001
|
marginTop: 16
|
|
9882
10002
|
},
|
|
9883
|
-
children: /* @__PURE__ */
|
|
10003
|
+
children: /* @__PURE__ */ jsx78(PrimaryButton_default, { clickHandler: backButtonFunction, children: "Back" })
|
|
9884
10004
|
}
|
|
9885
10005
|
),
|
|
9886
|
-
/* @__PURE__ */
|
|
9887
|
-
/* @__PURE__ */
|
|
9888
|
-
/* @__PURE__ */
|
|
9889
|
-
/* @__PURE__ */
|
|
9890
|
-
/* @__PURE__ */
|
|
10006
|
+
/* @__PURE__ */ jsx78("div", { className: "kima-card-footer" }),
|
|
10007
|
+
/* @__PURE__ */ jsx78("div", { className: "floating-footer", children: /* @__PURE__ */ jsxs45("div", { className: `items ${theme.colorMode}`, children: [
|
|
10008
|
+
/* @__PURE__ */ jsx78("span", { children: "Powered by" }),
|
|
10009
|
+
/* @__PURE__ */ jsx78(FooterLogo_default, { width: 50, fill: "black" }),
|
|
10010
|
+
/* @__PURE__ */ jsx78("strong", { children: "Network" })
|
|
9891
10011
|
] }) })
|
|
9892
10012
|
] })
|
|
9893
10013
|
}
|
|
@@ -9896,11 +10016,11 @@ var ErrorWidget = ({
|
|
|
9896
10016
|
var ErrorWidget_default = ErrorWidget;
|
|
9897
10017
|
|
|
9898
10018
|
// src/hooks/useDebugMode.ts
|
|
9899
|
-
import { useEffect as
|
|
10019
|
+
import { useEffect as useEffect20, useState as useState9 } from "react";
|
|
9900
10020
|
var useDebugCode = (sequence = ["D", "E", "B", "U", "G"]) => {
|
|
9901
|
-
const [debugMode, setDebugMode] =
|
|
9902
|
-
const [, setInputSequence] =
|
|
9903
|
-
|
|
10021
|
+
const [debugMode, setDebugMode] = useState9(false);
|
|
10022
|
+
const [, setInputSequence] = useState9([]);
|
|
10023
|
+
useEffect20(() => {
|
|
9904
10024
|
const onKeyDown = (e) => {
|
|
9905
10025
|
setInputSequence((prev) => {
|
|
9906
10026
|
const next = [...prev, e.key].slice(-sequence.length);
|
|
@@ -9928,21 +10048,21 @@ var useDebugCode = (sequence = ["D", "E", "B", "U", "G"]) => {
|
|
|
9928
10048
|
|
|
9929
10049
|
// src/widgets/common/KimaWidgetWrapper.tsx
|
|
9930
10050
|
import { useAppKitTheme } from "@reown/appkit/react";
|
|
9931
|
-
import { useEffect as
|
|
10051
|
+
import { useEffect as useEffect30, useMemo as useMemo49, useRef as useRef12 } from "react";
|
|
9932
10052
|
import { useDispatch as useDispatch32, useSelector as useSelector59 } from "react-redux";
|
|
9933
10053
|
|
|
9934
10054
|
// src/widgets/transaction/components/TransactionWidget.tsx
|
|
9935
10055
|
import {
|
|
9936
|
-
useEffect as
|
|
10056
|
+
useEffect as useEffect21,
|
|
9937
10057
|
useMemo as useMemo34,
|
|
9938
10058
|
useRef as useRef7,
|
|
9939
|
-
useState as
|
|
10059
|
+
useState as useState11
|
|
9940
10060
|
} from "react";
|
|
9941
10061
|
|
|
9942
10062
|
// src/components/reusable/Progressbar.tsx
|
|
9943
10063
|
import { useMemo as useMemo33 } from "react";
|
|
9944
10064
|
import { useSelector as useSelector39 } from "react-redux";
|
|
9945
|
-
import { jsx as
|
|
10065
|
+
import { jsx as jsx79, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
9946
10066
|
var DEFAULT_STEPS2 = [
|
|
9947
10067
|
{ title: "Initialize" },
|
|
9948
10068
|
{ title: "Source Transfer" },
|
|
@@ -9965,9 +10085,9 @@ var Progressbar = ({
|
|
|
9965
10085
|
const clamped = Math.max(0, Math.min(step, lastIndex));
|
|
9966
10086
|
return clamped * 100 / lastIndex;
|
|
9967
10087
|
}, [step, lastIndex]);
|
|
9968
|
-
return /* @__PURE__ */
|
|
9969
|
-
/* @__PURE__ */
|
|
9970
|
-
/* @__PURE__ */
|
|
10088
|
+
return /* @__PURE__ */ jsxs46("div", { className: "kima-progressbar", children: [
|
|
10089
|
+
/* @__PURE__ */ jsx79("div", { className: "value", style: { width: `${pct}%` } }),
|
|
10090
|
+
/* @__PURE__ */ jsx79("div", { className: "step-indicators", children: stepInfo.map((item, index) => /* @__PURE__ */ jsx79(
|
|
9971
10091
|
"div",
|
|
9972
10092
|
{
|
|
9973
10093
|
className: `step ${step === index && "active"}
|
|
@@ -9976,10 +10096,10 @@ var Progressbar = ({
|
|
|
9976
10096
|
onClick: () => {
|
|
9977
10097
|
if (index < lastIndex) setFocus(index);
|
|
9978
10098
|
},
|
|
9979
|
-
children: /* @__PURE__ */
|
|
9980
|
-
step < index && /* @__PURE__ */
|
|
9981
|
-
step >= index ? index === loadingStep ? /* @__PURE__ */
|
|
9982
|
-
/* @__PURE__ */
|
|
10099
|
+
children: /* @__PURE__ */ jsxs46("div", { className: "step-info", children: [
|
|
10100
|
+
step < index && /* @__PURE__ */ jsx79(Lock_default, {}),
|
|
10101
|
+
step >= index ? index === loadingStep ? /* @__PURE__ */ jsx79(Loader_default, { className: "loader" }) : index === errorStep ? /* @__PURE__ */ jsx79(Warning_default, {}) : /* @__PURE__ */ jsx79(Check_default, {}) : null,
|
|
10102
|
+
/* @__PURE__ */ jsx79("span", { children: item.title })
|
|
9983
10103
|
] })
|
|
9984
10104
|
},
|
|
9985
10105
|
`${item.title}-${index}`
|
|
@@ -10155,31 +10275,31 @@ var useTxData = (txId, dAppOption, backendUrl, isSwap) => {
|
|
|
10155
10275
|
var useTxData_default = useTxData;
|
|
10156
10276
|
|
|
10157
10277
|
// src/components/reusable/TransactionStatusMessage.tsx
|
|
10158
|
-
import { jsx as
|
|
10278
|
+
import { jsx as jsx80, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
10159
10279
|
var TransactionStatusMessage = ({
|
|
10160
10280
|
isCompleted,
|
|
10161
10281
|
transactionId
|
|
10162
10282
|
}) => {
|
|
10163
|
-
return /* @__PURE__ */
|
|
10164
|
-
/* @__PURE__ */
|
|
10283
|
+
return /* @__PURE__ */ jsxs47("div", { className: "transaction-status-message", children: [
|
|
10284
|
+
/* @__PURE__ */ jsxs47("h2", { children: [
|
|
10165
10285
|
isCompleted !== "Completed" /* COMPLETED */ && "Your transaction is currently being processed.",
|
|
10166
10286
|
" ",
|
|
10167
10287
|
"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."
|
|
10168
10288
|
] }),
|
|
10169
|
-
/* @__PURE__ */
|
|
10170
|
-
/* @__PURE__ */
|
|
10171
|
-
/* @__PURE__ */
|
|
10289
|
+
/* @__PURE__ */ jsxs47("span", { className: "transaction-copy", children: [
|
|
10290
|
+
/* @__PURE__ */ jsx80("h3", { children: transactionId }),
|
|
10291
|
+
/* @__PURE__ */ jsx80(CopyButton_default, { text: transactionId })
|
|
10172
10292
|
] })
|
|
10173
10293
|
] });
|
|
10174
10294
|
};
|
|
10175
10295
|
var TransactionStatusMessage_default = TransactionStatusMessage;
|
|
10176
10296
|
|
|
10177
10297
|
// src/components/reusable/TransactionSearch.tsx
|
|
10178
|
-
import { useRef as useRef6, useState as
|
|
10298
|
+
import { useRef as useRef6, useState as useState10 } from "react";
|
|
10179
10299
|
import { useSelector as useSelector40 } from "react-redux";
|
|
10180
10300
|
import { useDispatch as useDispatch15 } from "react-redux";
|
|
10181
10301
|
import toast2 from "react-hot-toast";
|
|
10182
|
-
import { jsx as
|
|
10302
|
+
import { jsx as jsx81, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
10183
10303
|
var TransactionSearch = ({
|
|
10184
10304
|
isSwap,
|
|
10185
10305
|
onTypeChange
|
|
@@ -10187,12 +10307,12 @@ var TransactionSearch = ({
|
|
|
10187
10307
|
const theme = useSelector40(selectTheme);
|
|
10188
10308
|
const backendUrl = useSelector40(selectBackendUrl);
|
|
10189
10309
|
const dispatch = useDispatch15();
|
|
10190
|
-
const [transactionId, setTransactionId] =
|
|
10310
|
+
const [transactionId, setTransactionId] = useState10("");
|
|
10191
10311
|
const refPollForUpdates = useRef6(false);
|
|
10192
10312
|
const handleSearch = async () => {
|
|
10193
10313
|
if (transactionId.length <= 0)
|
|
10194
10314
|
return toast2.error("You must provide a valid transaction id", {
|
|
10195
|
-
icon: /* @__PURE__ */
|
|
10315
|
+
icon: /* @__PURE__ */ jsx81(Error_default, {})
|
|
10196
10316
|
});
|
|
10197
10317
|
try {
|
|
10198
10318
|
const data = await getTxData({
|
|
@@ -10210,14 +10330,14 @@ var TransactionSearch = ({
|
|
|
10210
10330
|
logger_default.error("Error searching transaction: ", error);
|
|
10211
10331
|
return toast2.error(
|
|
10212
10332
|
"Transaction not found. Please check for the proper transaction id.",
|
|
10213
|
-
{ icon: /* @__PURE__ */
|
|
10333
|
+
{ icon: /* @__PURE__ */ jsx81(Error_default, {}) }
|
|
10214
10334
|
);
|
|
10215
10335
|
}
|
|
10216
10336
|
};
|
|
10217
|
-
return /* @__PURE__ */
|
|
10218
|
-
/* @__PURE__ */
|
|
10219
|
-
/* @__PURE__ */
|
|
10220
|
-
/* @__PURE__ */
|
|
10337
|
+
return /* @__PURE__ */ jsxs48("div", { className: "form-item transaction-search", children: [
|
|
10338
|
+
/* @__PURE__ */ jsxs48("div", { className: "transaction-input", children: [
|
|
10339
|
+
/* @__PURE__ */ jsx81("span", { className: "label", children: "Search Transaction:" }),
|
|
10340
|
+
/* @__PURE__ */ jsx81(
|
|
10221
10341
|
"input",
|
|
10222
10342
|
{
|
|
10223
10343
|
className: `${theme.colorMode}`,
|
|
@@ -10229,10 +10349,10 @@ var TransactionSearch = ({
|
|
|
10229
10349
|
}
|
|
10230
10350
|
)
|
|
10231
10351
|
] }),
|
|
10232
|
-
/* @__PURE__ */
|
|
10233
|
-
/* @__PURE__ */
|
|
10234
|
-
/* @__PURE__ */
|
|
10235
|
-
/* @__PURE__ */
|
|
10352
|
+
/* @__PURE__ */ jsxs48("div", { className: "tx-type-toggle", children: [
|
|
10353
|
+
/* @__PURE__ */ jsx81("span", { className: "label", children: "Type:" }),
|
|
10354
|
+
/* @__PURE__ */ jsxs48("div", { className: "toggle-buttons", children: [
|
|
10355
|
+
/* @__PURE__ */ jsx81(
|
|
10236
10356
|
"button",
|
|
10237
10357
|
{
|
|
10238
10358
|
type: "button",
|
|
@@ -10241,7 +10361,7 @@ var TransactionSearch = ({
|
|
|
10241
10361
|
children: "Transfer"
|
|
10242
10362
|
}
|
|
10243
10363
|
),
|
|
10244
|
-
/* @__PURE__ */
|
|
10364
|
+
/* @__PURE__ */ jsx81(
|
|
10245
10365
|
"button",
|
|
10246
10366
|
{
|
|
10247
10367
|
type: "button",
|
|
@@ -10252,7 +10372,7 @@ var TransactionSearch = ({
|
|
|
10252
10372
|
)
|
|
10253
10373
|
] })
|
|
10254
10374
|
] }),
|
|
10255
|
-
/* @__PURE__ */
|
|
10375
|
+
/* @__PURE__ */ jsx81(SecondaryButton_default, { clickHandler: handleSearch, children: "Search" })
|
|
10256
10376
|
] });
|
|
10257
10377
|
};
|
|
10258
10378
|
var TransactionSearch_default = TransactionSearch;
|
|
@@ -10312,16 +10432,16 @@ var resolveTransactionResetTarget = ({
|
|
|
10312
10432
|
};
|
|
10313
10433
|
|
|
10314
10434
|
// src/widgets/transaction/components/TransactionWidget.tsx
|
|
10315
|
-
import { Fragment as
|
|
10435
|
+
import { Fragment as Fragment11, jsx as jsx82, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
10316
10436
|
var TransactionWidget = ({ theme }) => {
|
|
10317
|
-
const [step, setStep] =
|
|
10318
|
-
const [focus, setFocus] =
|
|
10319
|
-
const [errorStep, setErrorStep] =
|
|
10320
|
-
const [errorMessage, setErrorMessage] =
|
|
10321
|
-
const [loadingStep, setLoadingStep] =
|
|
10322
|
-
const [minimized, setMinimized] =
|
|
10323
|
-
const [isComplete, setIsComplete] =
|
|
10324
|
-
const [statusTxType, setStatusTxType] =
|
|
10437
|
+
const [step, setStep] = useState11(0);
|
|
10438
|
+
const [focus, setFocus] = useState11(-1);
|
|
10439
|
+
const [errorStep, setErrorStep] = useState11(-1);
|
|
10440
|
+
const [errorMessage, setErrorMessage] = useState11("");
|
|
10441
|
+
const [loadingStep, setLoadingStep] = useState11(-1);
|
|
10442
|
+
const [minimized, setMinimized] = useState11(false);
|
|
10443
|
+
const [isComplete, setIsComplete] = useState11(false);
|
|
10444
|
+
const [statusTxType, setStatusTxType] = useState11(
|
|
10325
10445
|
"transfer"
|
|
10326
10446
|
);
|
|
10327
10447
|
const previousStatusRef = useRef7(null);
|
|
@@ -10357,7 +10477,7 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10357
10477
|
panelRef,
|
|
10358
10478
|
formatTime: formatToastTime
|
|
10359
10479
|
} = useToastHistory();
|
|
10360
|
-
|
|
10480
|
+
useEffect21(() => {
|
|
10361
10481
|
windowWidth === 0 && updateWidth(window.innerWidth);
|
|
10362
10482
|
}, [windowWidth, updateWidth]);
|
|
10363
10483
|
const safeTxId = typeof txId === "string" || typeof txId === "number" ? txId : -1;
|
|
@@ -10387,29 +10507,29 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10387
10507
|
return data?.amount === "";
|
|
10388
10508
|
}, [data]);
|
|
10389
10509
|
const showFetchingTitle = isValidTxId && isEmptyStatus;
|
|
10390
|
-
|
|
10510
|
+
useEffect21(() => {
|
|
10391
10511
|
if (!data || data.status !== "Completed" /* COMPLETED */) return;
|
|
10392
10512
|
successHandler && successHandler({
|
|
10393
10513
|
txId: safeTxId
|
|
10394
10514
|
});
|
|
10395
10515
|
}, [data, successHandler, safeTxId]);
|
|
10396
|
-
|
|
10516
|
+
useEffect21(() => {
|
|
10397
10517
|
if (!data) return;
|
|
10398
10518
|
if (data.status === "Completed" /* COMPLETED */) {
|
|
10399
10519
|
setIsComplete(true);
|
|
10400
10520
|
}
|
|
10401
10521
|
}, [data]);
|
|
10402
|
-
|
|
10522
|
+
useEffect21(() => {
|
|
10403
10523
|
const nextError = error ? String(error) : null;
|
|
10404
10524
|
if (!nextError || previousErrorRef.current === nextError) return;
|
|
10405
10525
|
previousErrorRef.current = nextError;
|
|
10406
10526
|
if (error)
|
|
10407
10527
|
toast3.error(
|
|
10408
10528
|
"The provided transaction id is not valid, please use a different one or contact support for further assistance",
|
|
10409
|
-
{ icon: /* @__PURE__ */
|
|
10529
|
+
{ icon: /* @__PURE__ */ jsx82(Error_default, {}) }
|
|
10410
10530
|
);
|
|
10411
10531
|
}, [error]);
|
|
10412
|
-
|
|
10532
|
+
useEffect21(() => {
|
|
10413
10533
|
const raw = normalizeStatus(data?.status);
|
|
10414
10534
|
const s = compactStatus(raw);
|
|
10415
10535
|
const statusChanged = didStatusChange(previousStatusRef.current, raw);
|
|
@@ -10437,7 +10557,7 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10437
10557
|
setStep(1);
|
|
10438
10558
|
setErrorStep(1);
|
|
10439
10559
|
setLoadingStep(-1);
|
|
10440
|
-
if (statusChanged) toast3.error("Unavailable", { icon: /* @__PURE__ */
|
|
10560
|
+
if (statusChanged) toast3.error("Unavailable", { icon: /* @__PURE__ */ jsx82(Error_default, {}) });
|
|
10441
10561
|
setErrorMessage("Unavailable");
|
|
10442
10562
|
previousStatusRef.current = raw;
|
|
10443
10563
|
return;
|
|
@@ -10448,7 +10568,7 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10448
10568
|
setLoadingStep(-1);
|
|
10449
10569
|
if (statusChanged) {
|
|
10450
10570
|
toast3.error("Failed to pull tokens from source!", {
|
|
10451
|
-
icon: /* @__PURE__ */
|
|
10571
|
+
icon: /* @__PURE__ */ jsx82(Error_default, {})
|
|
10452
10572
|
});
|
|
10453
10573
|
}
|
|
10454
10574
|
setErrorMessage("Failed to pull tokens from source!");
|
|
@@ -10461,7 +10581,7 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10461
10581
|
setLoadingStep(-1);
|
|
10462
10582
|
if (statusChanged) {
|
|
10463
10583
|
toast3.error("Failed to release tokens to target!", {
|
|
10464
|
-
icon: /* @__PURE__ */
|
|
10584
|
+
icon: /* @__PURE__ */ jsx82(Error_default, {})
|
|
10465
10585
|
});
|
|
10466
10586
|
}
|
|
10467
10587
|
setErrorMessage("Failed to release tokens to target!");
|
|
@@ -10474,7 +10594,7 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10474
10594
|
if (statusChanged) {
|
|
10475
10595
|
toast3.error(
|
|
10476
10596
|
"Failed to release tokens to target! Starting refund process.",
|
|
10477
|
-
{ icon: /* @__PURE__ */
|
|
10597
|
+
{ icon: /* @__PURE__ */ jsx82(Error_default, {}) }
|
|
10478
10598
|
);
|
|
10479
10599
|
}
|
|
10480
10600
|
setErrorMessage(
|
|
@@ -10489,7 +10609,7 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10489
10609
|
setLoadingStep(-1);
|
|
10490
10610
|
if (statusChanged) {
|
|
10491
10611
|
toast3.error("Failed to refund tokens to source!", {
|
|
10492
|
-
icon: /* @__PURE__ */
|
|
10612
|
+
icon: /* @__PURE__ */ jsx82(Error_default, {})
|
|
10493
10613
|
});
|
|
10494
10614
|
}
|
|
10495
10615
|
setErrorMessage("Failed to refund tokens to source!");
|
|
@@ -10501,7 +10621,7 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10501
10621
|
setErrorStep(3);
|
|
10502
10622
|
setLoadingStep(-1);
|
|
10503
10623
|
if (statusChanged) {
|
|
10504
|
-
toast3.success("Refund completed!", { icon: /* @__PURE__ */
|
|
10624
|
+
toast3.success("Refund completed!", { icon: /* @__PURE__ */ jsx82(Error_default, {}) });
|
|
10505
10625
|
}
|
|
10506
10626
|
setErrorMessage("Refund completed!");
|
|
10507
10627
|
previousStatusRef.current = raw;
|
|
@@ -10670,7 +10790,7 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10670
10790
|
logger_default.debug("[TransactionWidget] reset failed", e);
|
|
10671
10791
|
toast3.error(
|
|
10672
10792
|
"Unable to reset the transaction view. Please contact support for assistance.",
|
|
10673
|
-
{ icon: /* @__PURE__ */
|
|
10793
|
+
{ icon: /* @__PURE__ */ jsx82(Error_default, {}) }
|
|
10674
10794
|
);
|
|
10675
10795
|
}
|
|
10676
10796
|
};
|
|
@@ -10680,7 +10800,7 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10680
10800
|
const swapDstAmtLabel = formatTruncMaxDecimals(swapDstAmt, 4);
|
|
10681
10801
|
const swapSrcSymLabel = displaySymbol(data?.sourceSymbol ?? sourceSymbol);
|
|
10682
10802
|
const swapDstSymLabel = displaySymbol(data?.targetSymbol ?? targetSymbol);
|
|
10683
|
-
return /* @__PURE__ */
|
|
10803
|
+
return /* @__PURE__ */ jsx82(Provider2, { store: store_default, children: /* @__PURE__ */ jsxs49(
|
|
10684
10804
|
"div",
|
|
10685
10805
|
{
|
|
10686
10806
|
className: `kima-card transaction-card ${isComplete ? "transaction-complete" : ""} ${theme.colorMode} ${minimized ? "minimized" : ""}`,
|
|
@@ -10688,9 +10808,10 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10688
10808
|
background: theme.colorMode === "light" /* light */ ? theme.backgroundColorLight : theme.backgroundColorDark
|
|
10689
10809
|
},
|
|
10690
10810
|
children: [
|
|
10691
|
-
/* @__PURE__ */
|
|
10692
|
-
|
|
10693
|
-
|
|
10811
|
+
/* @__PURE__ */ jsx82(VersionInfo_default, { theme }),
|
|
10812
|
+
/* @__PURE__ */ jsxs49("div", { className: "kima-card-header", children: [
|
|
10813
|
+
/* @__PURE__ */ jsxs49("div", { className: "topbar", children: [
|
|
10814
|
+
!isComplete && /* @__PURE__ */ jsx82("div", { className: "title", children: isValidTxId && !error ? /* @__PURE__ */ jsx82("div", { className: "transaction-title", children: showFetchingTitle ? /* @__PURE__ */ jsx82(Fragment11, { children: "Getting transaction details\u2026" }) : /* @__PURE__ */ jsxs49(Fragment11, { children: [
|
|
10694
10815
|
verb,
|
|
10695
10816
|
leftAmt,
|
|
10696
10817
|
" ",
|
|
@@ -10699,13 +10820,13 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10699
10820
|
rightAmt,
|
|
10700
10821
|
" ",
|
|
10701
10822
|
rightSym
|
|
10702
|
-
] }) }) : /* @__PURE__ */
|
|
10703
|
-
!minimized ? /* @__PURE__ */
|
|
10823
|
+
] }) }) : /* @__PURE__ */ jsx82("div", { children: /* @__PURE__ */ jsx82("h3", { className: "transaction", children: "Transaction Status" }) }) }),
|
|
10824
|
+
!minimized ? /* @__PURE__ */ jsxs49(
|
|
10704
10825
|
"div",
|
|
10705
10826
|
{
|
|
10706
10827
|
className: `control-buttons ${isComplete ? "complete" : ""}`,
|
|
10707
10828
|
children: [
|
|
10708
|
-
isComplete && /* @__PURE__ */
|
|
10829
|
+
isComplete && /* @__PURE__ */ jsx82(
|
|
10709
10830
|
"button",
|
|
10710
10831
|
{
|
|
10711
10832
|
className: "menu-button",
|
|
@@ -10714,41 +10835,41 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10714
10835
|
children: "< Back"
|
|
10715
10836
|
}
|
|
10716
10837
|
),
|
|
10717
|
-
/* @__PURE__ */
|
|
10838
|
+
/* @__PURE__ */ jsx82(
|
|
10718
10839
|
"button",
|
|
10719
10840
|
{
|
|
10720
10841
|
className: "icon-button minimize",
|
|
10721
10842
|
onClick: () => setMinimized(true),
|
|
10722
|
-
children: /* @__PURE__ */
|
|
10843
|
+
children: /* @__PURE__ */ jsx82(Minimize_default, {})
|
|
10723
10844
|
}
|
|
10724
10845
|
),
|
|
10725
|
-
!isComplete && (!isValidTxId || loadingStep < 0 || error && dAppOption !== "none" /* None */) ? /* @__PURE__ */
|
|
10726
|
-
toastHistory.length > 0 && /* @__PURE__ */
|
|
10846
|
+
!isComplete && (!isValidTxId || loadingStep < 0 || error && dAppOption !== "none" /* None */) ? /* @__PURE__ */ jsx82("button", { className: "reset-button", onClick: resetForm, children: "Reset" }) : null,
|
|
10847
|
+
toastHistory.length > 0 && /* @__PURE__ */ jsxs49(
|
|
10727
10848
|
"div",
|
|
10728
10849
|
{
|
|
10729
10850
|
ref: panelRef,
|
|
10730
10851
|
className: `toast-history ${theme.colorMode}`,
|
|
10731
10852
|
children: [
|
|
10732
|
-
/* @__PURE__ */
|
|
10853
|
+
/* @__PURE__ */ jsx82(
|
|
10733
10854
|
"button",
|
|
10734
10855
|
{
|
|
10735
10856
|
className: "toast-history-button",
|
|
10736
10857
|
onClick: () => setToastPanelOpen(true),
|
|
10737
10858
|
"aria-label": "Notifications",
|
|
10738
|
-
children: /* @__PURE__ */
|
|
10859
|
+
children: /* @__PURE__ */ jsx82(Notification_default, {})
|
|
10739
10860
|
}
|
|
10740
10861
|
),
|
|
10741
|
-
toastPanelOpen && /* @__PURE__ */
|
|
10742
|
-
/* @__PURE__ */
|
|
10743
|
-
/* @__PURE__ */
|
|
10744
|
-
/* @__PURE__ */
|
|
10745
|
-
/* @__PURE__ */
|
|
10862
|
+
toastPanelOpen && /* @__PURE__ */ jsxs49("div", { className: `toast-history-panel ${theme.colorMode}`, children: [
|
|
10863
|
+
/* @__PURE__ */ jsx82("div", { className: "toast-history-header", children: /* @__PURE__ */ jsx82("span", { children: "Notifications" }) }),
|
|
10864
|
+
/* @__PURE__ */ jsx82("div", { className: "toast-history-list", children: toastHistory.map((item) => /* @__PURE__ */ jsxs49("div", { className: "toast-history-item", children: [
|
|
10865
|
+
/* @__PURE__ */ jsx82("span", { className: "toast-history-message", children: item.message }),
|
|
10866
|
+
/* @__PURE__ */ jsx82("span", { className: "toast-history-time", children: formatToastTime(item.time) })
|
|
10746
10867
|
] }, item.id)) })
|
|
10747
10868
|
] })
|
|
10748
10869
|
]
|
|
10749
10870
|
}
|
|
10750
10871
|
),
|
|
10751
|
-
closeHandler && /* @__PURE__ */
|
|
10872
|
+
closeHandler && /* @__PURE__ */ jsx82(
|
|
10752
10873
|
"button",
|
|
10753
10874
|
{
|
|
10754
10875
|
className: "cross-icon-button",
|
|
@@ -10756,44 +10877,44 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10756
10877
|
resetForm();
|
|
10757
10878
|
closeHandler(0);
|
|
10758
10879
|
},
|
|
10759
|
-
children: /* @__PURE__ */
|
|
10880
|
+
children: /* @__PURE__ */ jsx82(Cross_default, {})
|
|
10760
10881
|
}
|
|
10761
10882
|
)
|
|
10762
10883
|
]
|
|
10763
10884
|
}
|
|
10764
|
-
) : /* @__PURE__ */
|
|
10885
|
+
) : /* @__PURE__ */ jsx82("div", { className: "control-buttons", children: /* @__PURE__ */ jsx82("div", { className: "maximize", onClick: () => setMinimized(false), children: "View" }) })
|
|
10765
10886
|
] }),
|
|
10766
|
-
data && !isComplete && /* @__PURE__ */
|
|
10767
|
-
/* @__PURE__ */
|
|
10768
|
-
/* @__PURE__ */
|
|
10887
|
+
data && !isComplete && /* @__PURE__ */ jsxs49("div", { className: "header-network-labels", children: [
|
|
10888
|
+
/* @__PURE__ */ jsxs49("div", { className: `kima-card-network-label ${theme.colorMode}`, children: [
|
|
10889
|
+
/* @__PURE__ */ jsx82(
|
|
10769
10890
|
ChainIcon,
|
|
10770
10891
|
{
|
|
10771
10892
|
symbol: transactionSourceChain?.shortName
|
|
10772
10893
|
}
|
|
10773
10894
|
),
|
|
10774
|
-
windowWidth > 450 && /* @__PURE__ */
|
|
10895
|
+
windowWidth > 450 && /* @__PURE__ */ jsx82("h3", { children: transactionSourceChain?.name })
|
|
10775
10896
|
] }),
|
|
10776
|
-
/* @__PURE__ */
|
|
10897
|
+
/* @__PURE__ */ jsx82(
|
|
10777
10898
|
"div",
|
|
10778
10899
|
{
|
|
10779
10900
|
style: { display: "inline-block", transform: "rotate(-90deg)" },
|
|
10780
|
-
children: /* @__PURE__ */
|
|
10901
|
+
children: /* @__PURE__ */ jsx82(Arrow_default, { width: 25, height: 25 })
|
|
10781
10902
|
}
|
|
10782
10903
|
),
|
|
10783
|
-
/* @__PURE__ */
|
|
10784
|
-
/* @__PURE__ */
|
|
10904
|
+
/* @__PURE__ */ jsxs49("div", { className: `kima-card-network-label ${theme.colorMode}`, children: [
|
|
10905
|
+
/* @__PURE__ */ jsx82(
|
|
10785
10906
|
ChainIcon,
|
|
10786
10907
|
{
|
|
10787
10908
|
symbol: transactionTargetChain?.shortName
|
|
10788
10909
|
}
|
|
10789
10910
|
),
|
|
10790
|
-
windowWidth > 450 && /* @__PURE__ */
|
|
10911
|
+
windowWidth > 450 && /* @__PURE__ */ jsx82("h3", { children: transactionTargetChain?.name })
|
|
10791
10912
|
] })
|
|
10792
10913
|
] })
|
|
10793
10914
|
] }),
|
|
10794
|
-
isValidTxId && (mode !== "status" /* status */ || !error) ? /* @__PURE__ */
|
|
10795
|
-
!isComplete ? /* @__PURE__ */
|
|
10796
|
-
/* @__PURE__ */
|
|
10915
|
+
isValidTxId && (mode !== "status" /* status */ || !error) ? /* @__PURE__ */ jsxs49("div", { className: "kima-card-content", children: [
|
|
10916
|
+
!isComplete ? /* @__PURE__ */ jsxs49("div", { className: "transaction-content", children: [
|
|
10917
|
+
/* @__PURE__ */ jsx82(
|
|
10797
10918
|
Progressbar_default,
|
|
10798
10919
|
{
|
|
10799
10920
|
step,
|
|
@@ -10804,7 +10925,7 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10804
10925
|
steps
|
|
10805
10926
|
}
|
|
10806
10927
|
),
|
|
10807
|
-
/* @__PURE__ */
|
|
10928
|
+
/* @__PURE__ */ jsx82(
|
|
10808
10929
|
StepBox_default,
|
|
10809
10930
|
{
|
|
10810
10931
|
step,
|
|
@@ -10814,15 +10935,15 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10814
10935
|
steps
|
|
10815
10936
|
}
|
|
10816
10937
|
)
|
|
10817
|
-
] }) : /* @__PURE__ */
|
|
10818
|
-
/* @__PURE__ */
|
|
10819
|
-
/* @__PURE__ */
|
|
10820
|
-
/* @__PURE__ */
|
|
10938
|
+
] }) : /* @__PURE__ */ jsxs49("div", { className: "transaction-content transaction-complete", children: [
|
|
10939
|
+
/* @__PURE__ */ jsx82(TransactionComplete_default, {}),
|
|
10940
|
+
/* @__PURE__ */ jsx82("h2", { children: widgetIsSwap ? "Swap Complete" : "Transaction Complete" }),
|
|
10941
|
+
/* @__PURE__ */ jsx82("div", { className: "kima-stepbox", children: /* @__PURE__ */ jsxs49(
|
|
10821
10942
|
"div",
|
|
10822
10943
|
{
|
|
10823
10944
|
className: `content-wrapper transaction-complete ${theme.colorMode}`,
|
|
10824
10945
|
children: [
|
|
10825
|
-
/* @__PURE__ */
|
|
10946
|
+
/* @__PURE__ */ jsx82("p", { children: widgetIsSwap ? /* @__PURE__ */ jsxs49(Fragment11, { children: [
|
|
10826
10947
|
"You just swapped ",
|
|
10827
10948
|
swapSrcAmtLabel,
|
|
10828
10949
|
" ",
|
|
@@ -10832,50 +10953,50 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10832
10953
|
swapDstAmtLabel,
|
|
10833
10954
|
" ",
|
|
10834
10955
|
swapDstSymLabel
|
|
10835
|
-
] }) : /* @__PURE__ */
|
|
10956
|
+
] }) : /* @__PURE__ */ jsxs49(Fragment11, { children: [
|
|
10836
10957
|
"You just transferred ",
|
|
10837
10958
|
data?.amount,
|
|
10838
10959
|
" ",
|
|
10839
10960
|
displaySymbol(data?.sourceSymbol)
|
|
10840
10961
|
] }) }),
|
|
10841
|
-
/* @__PURE__ */
|
|
10842
|
-
/* @__PURE__ */
|
|
10962
|
+
/* @__PURE__ */ jsxs49("div", { className: "header-network-labels", children: [
|
|
10963
|
+
/* @__PURE__ */ jsxs49(
|
|
10843
10964
|
"div",
|
|
10844
10965
|
{
|
|
10845
10966
|
className: `kima-card-network-label ${theme.colorMode}`,
|
|
10846
10967
|
children: [
|
|
10847
|
-
/* @__PURE__ */
|
|
10968
|
+
/* @__PURE__ */ jsx82(
|
|
10848
10969
|
ChainIcon,
|
|
10849
10970
|
{
|
|
10850
10971
|
symbol: transactionSourceChain?.shortName
|
|
10851
10972
|
}
|
|
10852
10973
|
),
|
|
10853
|
-
windowWidth > 450 && /* @__PURE__ */
|
|
10974
|
+
windowWidth > 450 && /* @__PURE__ */ jsx82("h3", { children: transactionSourceChain?.name })
|
|
10854
10975
|
]
|
|
10855
10976
|
}
|
|
10856
10977
|
),
|
|
10857
|
-
/* @__PURE__ */
|
|
10978
|
+
/* @__PURE__ */ jsx82(
|
|
10858
10979
|
"div",
|
|
10859
10980
|
{
|
|
10860
10981
|
style: {
|
|
10861
10982
|
display: "inline-block",
|
|
10862
10983
|
transform: "rotate(-90deg)"
|
|
10863
10984
|
},
|
|
10864
|
-
children: /* @__PURE__ */
|
|
10985
|
+
children: /* @__PURE__ */ jsx82(Arrow_default, { width: 25, height: 25 })
|
|
10865
10986
|
}
|
|
10866
10987
|
),
|
|
10867
|
-
/* @__PURE__ */
|
|
10988
|
+
/* @__PURE__ */ jsxs49(
|
|
10868
10989
|
"div",
|
|
10869
10990
|
{
|
|
10870
10991
|
className: `kima-card-network-label ${theme.colorMode}`,
|
|
10871
10992
|
children: [
|
|
10872
|
-
/* @__PURE__ */
|
|
10993
|
+
/* @__PURE__ */ jsx82(
|
|
10873
10994
|
ChainIcon,
|
|
10874
10995
|
{
|
|
10875
10996
|
symbol: transactionTargetChain?.shortName
|
|
10876
10997
|
}
|
|
10877
10998
|
),
|
|
10878
|
-
windowWidth > 450 && /* @__PURE__ */
|
|
10999
|
+
windowWidth > 450 && /* @__PURE__ */ jsx82("h3", { children: transactionTargetChain?.name })
|
|
10879
11000
|
]
|
|
10880
11001
|
}
|
|
10881
11002
|
)
|
|
@@ -10883,8 +11004,8 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10883
11004
|
]
|
|
10884
11005
|
}
|
|
10885
11006
|
) }),
|
|
10886
|
-
/* @__PURE__ */
|
|
10887
|
-
/* @__PURE__ */
|
|
11007
|
+
/* @__PURE__ */ jsxs49("div", { className: "transaction-buttons", children: [
|
|
11008
|
+
/* @__PURE__ */ jsx82(
|
|
10888
11009
|
SecondaryButton_default,
|
|
10889
11010
|
{
|
|
10890
11011
|
clickHandler: resetForm,
|
|
@@ -10892,25 +11013,25 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10892
11013
|
children: "New Transaction"
|
|
10893
11014
|
}
|
|
10894
11015
|
),
|
|
10895
|
-
/* @__PURE__ */
|
|
11016
|
+
/* @__PURE__ */ jsx82(
|
|
10896
11017
|
ExternalLink_default,
|
|
10897
11018
|
{
|
|
10898
11019
|
to: `${explorerUrl}/transactions/?tx=${data?.kimaTxHash}`,
|
|
10899
|
-
children: /* @__PURE__ */
|
|
11020
|
+
children: /* @__PURE__ */ jsx82(PrimaryButton_default, { children: "View Details" })
|
|
10900
11021
|
}
|
|
10901
11022
|
)
|
|
10902
11023
|
] })
|
|
10903
11024
|
] }),
|
|
10904
|
-
!error && !isEmptyStatus && !isComplete && /* @__PURE__ */
|
|
11025
|
+
!error && !isEmptyStatus && !isComplete && /* @__PURE__ */ jsx82(
|
|
10905
11026
|
TransactionStatusMessage_default,
|
|
10906
11027
|
{
|
|
10907
11028
|
isCompleted: data?.status,
|
|
10908
11029
|
transactionId: String(safeTxId)
|
|
10909
11030
|
}
|
|
10910
11031
|
)
|
|
10911
|
-
] }) : /* @__PURE__ */
|
|
10912
|
-
/* @__PURE__ */
|
|
10913
|
-
/* @__PURE__ */
|
|
11032
|
+
] }) : /* @__PURE__ */ jsxs49("div", { className: "kima-card-content", children: [
|
|
11033
|
+
/* @__PURE__ */ jsx82("h4", { className: "subtitle", children: "You can follow the status of a previous submitted transaction by entering the provided transaction id" }),
|
|
11034
|
+
/* @__PURE__ */ jsx82("div", { className: "single-form", children: /* @__PURE__ */ jsx82(
|
|
10914
11035
|
TransactionSearch_default,
|
|
10915
11036
|
{
|
|
10916
11037
|
isSwap: statusTxType === "swap",
|
|
@@ -10918,7 +11039,7 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10918
11039
|
}
|
|
10919
11040
|
) })
|
|
10920
11041
|
] }),
|
|
10921
|
-
/* @__PURE__ */
|
|
11042
|
+
/* @__PURE__ */ jsx82(
|
|
10922
11043
|
Toaster,
|
|
10923
11044
|
{
|
|
10924
11045
|
position: "top-right",
|
|
@@ -10943,13 +11064,13 @@ var TransactionWidget = ({ theme }) => {
|
|
|
10943
11064
|
}
|
|
10944
11065
|
}
|
|
10945
11066
|
),
|
|
10946
|
-
/* @__PURE__ */
|
|
11067
|
+
/* @__PURE__ */ jsx82(
|
|
10947
11068
|
"div",
|
|
10948
11069
|
{
|
|
10949
11070
|
className: `floating-footer ${isComplete ? "complete" : "status"}`,
|
|
10950
|
-
children: /* @__PURE__ */
|
|
10951
|
-
/* @__PURE__ */
|
|
10952
|
-
/* @__PURE__ */
|
|
11071
|
+
children: /* @__PURE__ */ jsxs49("div", { className: `items ${theme.colorMode}`, children: [
|
|
11072
|
+
/* @__PURE__ */ jsx82("span", { children: "Powered by" }),
|
|
11073
|
+
/* @__PURE__ */ jsx82(KimaNetwork_default, {})
|
|
10953
11074
|
] })
|
|
10954
11075
|
}
|
|
10955
11076
|
)
|
|
@@ -11663,13 +11784,13 @@ var useValidateTransaction = (inputs) => {
|
|
|
11663
11784
|
var useValidateTransaction_default = useValidateTransaction;
|
|
11664
11785
|
|
|
11665
11786
|
// src/widgets/transfer/components/TransferWidget.tsx
|
|
11666
|
-
import { useEffect as
|
|
11787
|
+
import { useEffect as useEffect29, useState as useState16, useRef as useRef11, useMemo as useMemo48, useCallback as useCallback21 } from "react";
|
|
11667
11788
|
import toast11, { Toaster as Toaster2 } from "react-hot-toast";
|
|
11668
11789
|
import { useDispatch as useDispatch31, useSelector as useSelector58 } from "react-redux";
|
|
11669
11790
|
import { parseUnits as parseUnits7 } from "viem";
|
|
11670
11791
|
|
|
11671
11792
|
// src/components/reusable/WarningModal.tsx
|
|
11672
|
-
import { jsx as
|
|
11793
|
+
import { jsx as jsx83, jsxs as jsxs50 } from "react/jsx-runtime";
|
|
11673
11794
|
var WarningModal = ({
|
|
11674
11795
|
message,
|
|
11675
11796
|
cancelButtonText = "Cancel",
|
|
@@ -11677,11 +11798,11 @@ var WarningModal = ({
|
|
|
11677
11798
|
onAcknowledge,
|
|
11678
11799
|
onCancel
|
|
11679
11800
|
}) => {
|
|
11680
|
-
return /* @__PURE__ */
|
|
11681
|
-
/* @__PURE__ */
|
|
11682
|
-
/* @__PURE__ */
|
|
11683
|
-
/* @__PURE__ */
|
|
11684
|
-
/* @__PURE__ */
|
|
11801
|
+
return /* @__PURE__ */ jsx83("div", { className: "warning-modal-overlay", children: /* @__PURE__ */ jsxs50("div", { className: "warning-modal", children: [
|
|
11802
|
+
/* @__PURE__ */ jsx83("h3", { children: "Warning" }),
|
|
11803
|
+
/* @__PURE__ */ jsx83("p", { children: message }),
|
|
11804
|
+
/* @__PURE__ */ jsxs50("div", { className: "warning-modal-buttons", children: [
|
|
11805
|
+
/* @__PURE__ */ jsx83(
|
|
11685
11806
|
SecondaryButton_default,
|
|
11686
11807
|
{
|
|
11687
11808
|
className: "warning-modal-cancel",
|
|
@@ -11689,7 +11810,7 @@ var WarningModal = ({
|
|
|
11689
11810
|
children: cancelButtonText
|
|
11690
11811
|
}
|
|
11691
11812
|
),
|
|
11692
|
-
/* @__PURE__ */
|
|
11813
|
+
/* @__PURE__ */ jsx83(
|
|
11693
11814
|
PrimaryButton_default,
|
|
11694
11815
|
{
|
|
11695
11816
|
className: "warning-modal-acknowledge",
|
|
@@ -11704,20 +11825,20 @@ var WarningModal_default = WarningModal;
|
|
|
11704
11825
|
|
|
11705
11826
|
// src/components/reusable/SingleForm.tsx
|
|
11706
11827
|
import { parseUnits as parseUnits6 } from "viem";
|
|
11707
|
-
import { useEffect as
|
|
11828
|
+
import { useEffect as useEffect23, useMemo as useMemo37, useState as useState13 } from "react";
|
|
11708
11829
|
import { toast as toast4 } from "react-hot-toast";
|
|
11709
11830
|
import { useDispatch as useDispatch19, useSelector as useSelector46 } from "react-redux";
|
|
11710
11831
|
|
|
11711
11832
|
// src/components/primary/NetworkSelector.tsx
|
|
11712
|
-
import
|
|
11833
|
+
import React13, { useState as useState12, useMemo as useMemo36, useRef as useRef8, useEffect as useEffect22 } from "react";
|
|
11713
11834
|
import { useSelector as useSelector45, useDispatch as useDispatch18 } from "react-redux";
|
|
11714
|
-
import { jsx as
|
|
11835
|
+
import { jsx as jsx84, jsxs as jsxs51 } from "react/jsx-runtime";
|
|
11715
11836
|
var NetworkSelector = ({
|
|
11716
11837
|
type,
|
|
11717
11838
|
initialSelection,
|
|
11718
11839
|
setInitialSelection
|
|
11719
11840
|
}) => {
|
|
11720
|
-
const [collapsed, setCollapsed] =
|
|
11841
|
+
const [collapsed, setCollapsed] = useState12(true);
|
|
11721
11842
|
const ref = useRef8(null);
|
|
11722
11843
|
const dispatch = useDispatch18();
|
|
11723
11844
|
const theme = useSelector45(selectTheme);
|
|
@@ -11734,7 +11855,7 @@ var NetworkSelector = ({
|
|
|
11734
11855
|
const currentTargetAddr = useSelector45(selectTargetAddress);
|
|
11735
11856
|
const { switchChainHandler } = useKimaContext();
|
|
11736
11857
|
const isOriginSelector = type === "origin";
|
|
11737
|
-
|
|
11858
|
+
useEffect22(() => {
|
|
11738
11859
|
logger_default.info("[NetworkSelector] mount", {
|
|
11739
11860
|
type,
|
|
11740
11861
|
mode,
|
|
@@ -11811,7 +11932,7 @@ var NetworkSelector = ({
|
|
|
11811
11932
|
transactionOption?.targetChain
|
|
11812
11933
|
]);
|
|
11813
11934
|
const lastForcedShort = useRef8();
|
|
11814
|
-
|
|
11935
|
+
useEffect22(() => {
|
|
11815
11936
|
if (!shouldLockSourceNetwork || !isOriginSelector || !transactionOption?.targetChain)
|
|
11816
11937
|
return;
|
|
11817
11938
|
const forcedNetwork = networks.find(
|
|
@@ -11926,7 +12047,7 @@ var NetworkSelector = ({
|
|
|
11926
12047
|
}
|
|
11927
12048
|
setCollapsed(true);
|
|
11928
12049
|
};
|
|
11929
|
-
|
|
12050
|
+
useEffect22(() => {
|
|
11930
12051
|
const handleOutsideClick = (e) => {
|
|
11931
12052
|
if (ref.current && !ref.current.contains(e.target)) {
|
|
11932
12053
|
setCollapsed(true);
|
|
@@ -11935,7 +12056,7 @@ var NetworkSelector = ({
|
|
|
11935
12056
|
document.addEventListener("mousedown", handleOutsideClick);
|
|
11936
12057
|
return () => document.removeEventListener("mousedown", handleOutsideClick);
|
|
11937
12058
|
}, []);
|
|
11938
|
-
|
|
12059
|
+
useEffect22(() => {
|
|
11939
12060
|
if (mode !== "light" /* light */) return;
|
|
11940
12061
|
let srcDemo = "";
|
|
11941
12062
|
if (isEVMChain(sourceNetwork.shortName)) srcDemo = lightDemoAccounts.EVM;
|
|
@@ -11967,7 +12088,7 @@ var NetworkSelector = ({
|
|
|
11967
12088
|
currentTargetAddr,
|
|
11968
12089
|
dispatch
|
|
11969
12090
|
]);
|
|
11970
|
-
return /* @__PURE__ */
|
|
12091
|
+
return /* @__PURE__ */ jsxs51(
|
|
11971
12092
|
"div",
|
|
11972
12093
|
{
|
|
11973
12094
|
className: `network-dropdown ${theme?.colorMode ?? ""} ${collapsed ? "collapsed" : "toggled"} ${shouldLockSourceNetwork ? "disabled" : ""}`,
|
|
@@ -11976,15 +12097,15 @@ var NetworkSelector = ({
|
|
|
11976
12097
|
},
|
|
11977
12098
|
ref,
|
|
11978
12099
|
children: [
|
|
11979
|
-
/* @__PURE__ */
|
|
11980
|
-
/* @__PURE__ */
|
|
11981
|
-
/* @__PURE__ */
|
|
12100
|
+
/* @__PURE__ */ jsxs51("div", { className: "network-wrapper", children: [
|
|
12101
|
+
/* @__PURE__ */ jsx84(ChainIcon, { symbol: selectedNetwork.shortName }),
|
|
12102
|
+
/* @__PURE__ */ jsx84("span", { children: selectedNetwork.name })
|
|
11982
12103
|
] }),
|
|
11983
|
-
/* @__PURE__ */
|
|
12104
|
+
/* @__PURE__ */ jsx84(
|
|
11984
12105
|
"div",
|
|
11985
12106
|
{
|
|
11986
12107
|
className: `network-menu custom-scrollbar ${theme?.colorMode ?? ""} ${collapsed ? "collapsed" : "toggled"}`,
|
|
11987
|
-
children: networks.filter((network) => network.shortName !== selectedNetwork.shortName).map((network) => /* @__PURE__ */
|
|
12108
|
+
children: networks.filter((network) => network.shortName !== selectedNetwork.shortName).map((network) => /* @__PURE__ */ jsxs51(
|
|
11988
12109
|
"div",
|
|
11989
12110
|
{
|
|
11990
12111
|
className: `network-menu-item ${theme?.colorMode ?? ""} ${network.disabled ? "disabled has-tooltip" : "enabled"}`,
|
|
@@ -11993,24 +12114,24 @@ var NetworkSelector = ({
|
|
|
11993
12114
|
if (!network.disabled) handleNetworkChange(network);
|
|
11994
12115
|
},
|
|
11995
12116
|
children: [
|
|
11996
|
-
network.disabled ? /* @__PURE__ */
|
|
11997
|
-
/* @__PURE__ */
|
|
11998
|
-
network.disabled && /* @__PURE__ */
|
|
12117
|
+
network.disabled ? /* @__PURE__ */ jsx84(Warning_default, { width: 25, height: 25 }) : /* @__PURE__ */ jsx84(ChainIcon, { symbol: network.shortName }),
|
|
12118
|
+
/* @__PURE__ */ jsx84("p", { children: network.name }),
|
|
12119
|
+
network.disabled && /* @__PURE__ */ jsx84("span", { className: "tooltip", children: "Temporarily unavailable" })
|
|
11999
12120
|
]
|
|
12000
12121
|
},
|
|
12001
12122
|
`${network.shortName}-${network.name}`
|
|
12002
12123
|
))
|
|
12003
12124
|
}
|
|
12004
12125
|
),
|
|
12005
|
-
!shouldLockSourceNetwork && /* @__PURE__ */
|
|
12126
|
+
!shouldLockSourceNetwork && /* @__PURE__ */ jsx84("div", { className: `dropdown-icon ${collapsed ? "toggled" : "collapsed"}`, children: /* @__PURE__ */ jsx84(Arrow_default, { fill: "none" }) })
|
|
12006
12127
|
]
|
|
12007
12128
|
}
|
|
12008
12129
|
);
|
|
12009
12130
|
};
|
|
12010
|
-
var NetworkSelector_default =
|
|
12131
|
+
var NetworkSelector_default = React13.memo(NetworkSelector);
|
|
12011
12132
|
|
|
12012
12133
|
// src/components/reusable/SingleForm.tsx
|
|
12013
|
-
import { jsx as
|
|
12134
|
+
import { jsx as jsx85, jsxs as jsxs52 } from "react/jsx-runtime";
|
|
12014
12135
|
var SingleForm = ({
|
|
12015
12136
|
isLoadingFees,
|
|
12016
12137
|
feeError,
|
|
@@ -12030,7 +12151,7 @@ var SingleForm = ({
|
|
|
12030
12151
|
const targetNetwork = useSelector46(selectTargetChain);
|
|
12031
12152
|
const targetAddress = useSelector46(selectTargetAddress);
|
|
12032
12153
|
const { isReady } = useIsWalletReady_default();
|
|
12033
|
-
const [amountValue, setAmountValue] =
|
|
12154
|
+
const [amountValue, setAmountValue] = useState13("");
|
|
12034
12155
|
const amount = useSelector46(selectAmount);
|
|
12035
12156
|
const sourceCurrency = useSelector46(selectSourceCurrency);
|
|
12036
12157
|
const targetCurrency = useSelector46(selectTargetCurrency);
|
|
@@ -12075,11 +12196,11 @@ var SingleForm = ({
|
|
|
12075
12196
|
sourceAddress,
|
|
12076
12197
|
targetAddress
|
|
12077
12198
|
]);
|
|
12078
|
-
|
|
12199
|
+
useEffect23(() => {
|
|
12079
12200
|
if (!errorMessage) return;
|
|
12080
12201
|
toast4.error(errorMessage);
|
|
12081
12202
|
}, [errorMessage]);
|
|
12082
|
-
|
|
12203
|
+
useEffect23(() => {
|
|
12083
12204
|
if (amountValue && amount !== "") return;
|
|
12084
12205
|
setAmountValue(amount);
|
|
12085
12206
|
}, [amount, amountValue]);
|
|
@@ -12176,7 +12297,7 @@ var SingleForm = ({
|
|
|
12176
12297
|
}
|
|
12177
12298
|
return isReady && !initialSelection.sourceSelection;
|
|
12178
12299
|
}, [isReady, initialSelection, mode, dAppOption]);
|
|
12179
|
-
|
|
12300
|
+
useEffect23(() => {
|
|
12180
12301
|
logger_default.debug("[SingleForm] snapshot", {
|
|
12181
12302
|
mode,
|
|
12182
12303
|
srcShort: sourceNetwork?.shortName,
|
|
@@ -12203,14 +12324,14 @@ var SingleForm = ({
|
|
|
12203
12324
|
demoSourceAddress,
|
|
12204
12325
|
feeDeduct
|
|
12205
12326
|
]);
|
|
12206
|
-
return /* @__PURE__ */
|
|
12207
|
-
/* @__PURE__ */
|
|
12208
|
-
/* @__PURE__ */
|
|
12327
|
+
return /* @__PURE__ */ jsxs52("div", { className: "single-form", children: [
|
|
12328
|
+
/* @__PURE__ */ jsxs52("div", { className: "form-item", children: [
|
|
12329
|
+
/* @__PURE__ */ jsxs52("span", { className: "label", children: [
|
|
12209
12330
|
dAppOption === "none" /* None */ && "Source",
|
|
12210
12331
|
" Network:"
|
|
12211
12332
|
] }),
|
|
12212
|
-
/* @__PURE__ */
|
|
12213
|
-
/* @__PURE__ */
|
|
12333
|
+
/* @__PURE__ */ jsxs52("div", { className: "items", children: [
|
|
12334
|
+
/* @__PURE__ */ jsx85(
|
|
12214
12335
|
NetworkSelector_default,
|
|
12215
12336
|
{
|
|
12216
12337
|
type: "origin",
|
|
@@ -12220,10 +12341,10 @@ var SingleForm = ({
|
|
|
12220
12341
|
}
|
|
12221
12342
|
}
|
|
12222
12343
|
),
|
|
12223
|
-
/* @__PURE__ */
|
|
12344
|
+
/* @__PURE__ */ jsx85(CoinDropdown_default, { isSourceChain: true })
|
|
12224
12345
|
] })
|
|
12225
12346
|
] }),
|
|
12226
|
-
/* @__PURE__ */
|
|
12347
|
+
/* @__PURE__ */ jsxs52(
|
|
12227
12348
|
"div",
|
|
12228
12349
|
{
|
|
12229
12350
|
className: `dynamic-area ${["CC" /* CC */, "BANK" /* BANK */].includes(
|
|
@@ -12232,20 +12353,20 @@ var SingleForm = ({
|
|
|
12232
12353
|
children: [
|
|
12233
12354
|
!["CC" /* CC */, "BANK" /* BANK */].includes(
|
|
12234
12355
|
sourceNetwork.compatibility
|
|
12235
|
-
) && /* @__PURE__ */
|
|
12356
|
+
) && /* @__PURE__ */ jsxs52(
|
|
12236
12357
|
"div",
|
|
12237
12358
|
{
|
|
12238
12359
|
className: `form-item wallet-button-item ${isConnectedSourceWrapper ? "connected" : ""}`,
|
|
12239
12360
|
children: [
|
|
12240
|
-
/* @__PURE__ */
|
|
12241
|
-
/* @__PURE__ */
|
|
12361
|
+
/* @__PURE__ */ jsx85("span", { className: "label", children: "Wallet:" }),
|
|
12362
|
+
/* @__PURE__ */ jsx85(WalletButton_default, { initialSelection: initialSelection.sourceSelection })
|
|
12242
12363
|
]
|
|
12243
12364
|
}
|
|
12244
12365
|
),
|
|
12245
|
-
mode !== "payment" /* payment */ && /* @__PURE__ */
|
|
12246
|
-
/* @__PURE__ */
|
|
12247
|
-
/* @__PURE__ */
|
|
12248
|
-
/* @__PURE__ */
|
|
12366
|
+
mode !== "payment" /* payment */ && /* @__PURE__ */ jsxs52("div", { className: "form-item", children: [
|
|
12367
|
+
/* @__PURE__ */ jsx85("span", { className: "label", children: "Target Network:" }),
|
|
12368
|
+
/* @__PURE__ */ jsxs52("div", { className: "items", children: [
|
|
12369
|
+
/* @__PURE__ */ jsx85(
|
|
12249
12370
|
NetworkSelector_default,
|
|
12250
12371
|
{
|
|
12251
12372
|
type: "target",
|
|
@@ -12255,15 +12376,15 @@ var SingleForm = ({
|
|
|
12255
12376
|
}
|
|
12256
12377
|
}
|
|
12257
12378
|
),
|
|
12258
|
-
/* @__PURE__ */
|
|
12379
|
+
/* @__PURE__ */ jsx85(CoinDropdown_default, { isSourceChain: false })
|
|
12259
12380
|
] })
|
|
12260
12381
|
] })
|
|
12261
12382
|
]
|
|
12262
12383
|
}
|
|
12263
12384
|
),
|
|
12264
|
-
mode === "bridge" /* bridge */ && /* @__PURE__ */
|
|
12265
|
-
/* @__PURE__ */
|
|
12266
|
-
/* @__PURE__ */
|
|
12385
|
+
mode === "bridge" /* bridge */ && /* @__PURE__ */ jsxs52("div", { className: `form-item ${theme.colorMode}`, children: [
|
|
12386
|
+
/* @__PURE__ */ jsx85("span", { className: "label", children: "Target Address:" }),
|
|
12387
|
+
/* @__PURE__ */ jsx85(
|
|
12267
12388
|
AddressInput_default,
|
|
12268
12389
|
{
|
|
12269
12390
|
theme: theme.colorMode,
|
|
@@ -12271,14 +12392,14 @@ var SingleForm = ({
|
|
|
12271
12392
|
}
|
|
12272
12393
|
)
|
|
12273
12394
|
] }),
|
|
12274
|
-
mode === "light" /* light */ && /* @__PURE__ */
|
|
12395
|
+
mode === "light" /* light */ && /* @__PURE__ */ jsxs52(
|
|
12275
12396
|
"div",
|
|
12276
12397
|
{
|
|
12277
12398
|
className: `form-item wallet-button-item ${isConnectedTargetWrapper ? "connected" : ""}`,
|
|
12278
12399
|
style: { display: "flex", alignItems: "center" },
|
|
12279
12400
|
children: [
|
|
12280
|
-
/* @__PURE__ */
|
|
12281
|
-
/* @__PURE__ */
|
|
12401
|
+
/* @__PURE__ */ jsx85("span", { className: "label", children: "Target Wallet:" }),
|
|
12402
|
+
/* @__PURE__ */ jsx85(
|
|
12282
12403
|
WalletButton_default,
|
|
12283
12404
|
{
|
|
12284
12405
|
initialSelection: initialSelection.targetSelection,
|
|
@@ -12288,10 +12409,10 @@ var SingleForm = ({
|
|
|
12288
12409
|
]
|
|
12289
12410
|
}
|
|
12290
12411
|
),
|
|
12291
|
-
/* @__PURE__ */
|
|
12292
|
-
/* @__PURE__ */
|
|
12293
|
-
/* @__PURE__ */
|
|
12294
|
-
/* @__PURE__ */
|
|
12412
|
+
/* @__PURE__ */ jsxs52("div", { className: `form-item ${theme.colorMode}`, children: [
|
|
12413
|
+
/* @__PURE__ */ jsx85("span", { className: "label", children: "Amount:" }),
|
|
12414
|
+
/* @__PURE__ */ jsxs52("div", { className: `amount-label-container items ${theme.colorMode}`, children: [
|
|
12415
|
+
/* @__PURE__ */ jsx85(
|
|
12295
12416
|
"input",
|
|
12296
12417
|
{
|
|
12297
12418
|
className: `${theme.colorMode}`,
|
|
@@ -12302,20 +12423,20 @@ var SingleForm = ({
|
|
|
12302
12423
|
disabled: mode === "payment" /* payment */
|
|
12303
12424
|
}
|
|
12304
12425
|
),
|
|
12305
|
-
/* @__PURE__ */
|
|
12306
|
-
sourceNetwork.shortName !== "CC" && mode !== "payment" /* payment */ && /* @__PURE__ */
|
|
12307
|
-
dAppOption === "none" /* None */ && canQuoteFees && /* @__PURE__ */
|
|
12426
|
+
/* @__PURE__ */ jsxs52("div", { className: "max-disclaimer", children: [
|
|
12427
|
+
sourceNetwork.shortName !== "CC" && mode !== "payment" /* payment */ && /* @__PURE__ */ jsx85("span", { className: "max-button", onClick: onMaxClick, children: "Max" }),
|
|
12428
|
+
dAppOption === "none" /* None */ && canQuoteFees && /* @__PURE__ */ jsxs52("p", { className: "fee-amount", children: [
|
|
12308
12429
|
"Est fees:",
|
|
12309
12430
|
" ",
|
|
12310
|
-
isLoadingFees ? /* @__PURE__ */
|
|
12311
|
-
/* @__PURE__ */
|
|
12312
|
-
/* @__PURE__ */
|
|
12313
|
-
/* @__PURE__ */
|
|
12314
|
-
] }) : feeError ? /* @__PURE__ */
|
|
12431
|
+
isLoadingFees ? /* @__PURE__ */ jsxs52("span", { className: "inline-spinner loading", "aria-live": "polite", children: [
|
|
12432
|
+
/* @__PURE__ */ jsx85("span", { className: "dot" }),
|
|
12433
|
+
/* @__PURE__ */ jsx85("span", { className: "dot" }),
|
|
12434
|
+
/* @__PURE__ */ jsx85("span", { className: "dot" })
|
|
12435
|
+
] }) : feeError ? /* @__PURE__ */ jsx85("span", { className: "fee-value fee-error", children: "Fee unavailable" }) : totalFee.value >= 0n ? /* @__PURE__ */ jsxs52("span", { className: "fee-value", children: [
|
|
12315
12436
|
formatBigInt(totalFee),
|
|
12316
12437
|
" ",
|
|
12317
12438
|
feeTokenSymbol
|
|
12318
|
-
] }) : /* @__PURE__ */
|
|
12439
|
+
] }) : /* @__PURE__ */ jsx85("span", { className: "fee-value", children: "\u2014" })
|
|
12319
12440
|
] })
|
|
12320
12441
|
] })
|
|
12321
12442
|
] })
|
|
@@ -12325,7 +12446,7 @@ var SingleForm = ({
|
|
|
12325
12446
|
var SingleForm_default = SingleForm;
|
|
12326
12447
|
|
|
12327
12448
|
// src/components/reusable/FiatWidget.tsx
|
|
12328
|
-
import { useEffect as
|
|
12449
|
+
import { useEffect as useEffect24, useMemo as useMemo38, useRef as useRef9, useState as useState14 } from "react";
|
|
12329
12450
|
import { useSelector as useSelector47, useDispatch as useDispatch20 } from "react-redux";
|
|
12330
12451
|
import { v4 as uuidv4 } from "uuid";
|
|
12331
12452
|
|
|
@@ -12353,7 +12474,7 @@ var useCCTransactionId = (backendUrl, transactionIdSeed) => {
|
|
|
12353
12474
|
};
|
|
12354
12475
|
|
|
12355
12476
|
// src/components/reusable/FiatWidget.tsx
|
|
12356
|
-
import { jsx as
|
|
12477
|
+
import { jsx as jsx86, jsxs as jsxs53 } from "react/jsx-runtime";
|
|
12357
12478
|
var FiatWidget = ({ submitCallback }) => {
|
|
12358
12479
|
const dispatch = useDispatch20();
|
|
12359
12480
|
const feeDeduct = useSelector47(selectFeeDeduct);
|
|
@@ -12375,7 +12496,7 @@ var FiatWidget = ({ submitCallback }) => {
|
|
|
12375
12496
|
isLoading: isTransactionIdLoading,
|
|
12376
12497
|
error
|
|
12377
12498
|
} = useCCTransactionId(backendUrl, ccTransactionIdSeedRef.current);
|
|
12378
|
-
|
|
12499
|
+
useEffect24(() => {
|
|
12379
12500
|
dispatch(setCCTransactionIdSeed(ccTransactionIdSeedRef.current));
|
|
12380
12501
|
dispatch(setCCTransactionId(data?.transactionId));
|
|
12381
12502
|
}, [dispatch, data, isTransactionIdLoading]);
|
|
@@ -12384,7 +12505,7 @@ var FiatWidget = ({ submitCallback }) => {
|
|
|
12384
12505
|
() => formatBigInt(txValues.allowanceAmount),
|
|
12385
12506
|
[txValues]
|
|
12386
12507
|
);
|
|
12387
|
-
const [isLoading, setIsLoading] =
|
|
12508
|
+
const [isLoading, setIsLoading] = useState14(true);
|
|
12388
12509
|
const baseUrl = useMemo38(
|
|
12389
12510
|
() => networkOption === "testnet" /* testnet */ ? "https://widget2-sandbox.depa.wtf" : "https://widget.depa.finance",
|
|
12390
12511
|
[networkOption]
|
|
@@ -12412,7 +12533,7 @@ var FiatWidget = ({ submitCallback }) => {
|
|
|
12412
12533
|
scenario,
|
|
12413
12534
|
sourceCurrency
|
|
12414
12535
|
]);
|
|
12415
|
-
|
|
12536
|
+
useEffect24(() => {
|
|
12416
12537
|
const handleMessage = (event) => {
|
|
12417
12538
|
if (event.origin !== baseUrl) {
|
|
12418
12539
|
return;
|
|
@@ -12441,12 +12562,12 @@ var FiatWidget = ({ submitCallback }) => {
|
|
|
12441
12562
|
window.addEventListener("message", handleMessage);
|
|
12442
12563
|
return () => window.removeEventListener("message", handleMessage);
|
|
12443
12564
|
}, []);
|
|
12444
|
-
|
|
12565
|
+
useEffect24(() => {
|
|
12445
12566
|
if (error) dispatch(setCCTransactionStatus("error-id"));
|
|
12446
12567
|
}, [dispatch, error]);
|
|
12447
|
-
return /* @__PURE__ */
|
|
12448
|
-
(isLoading || isTransactionIdLoading || isEnvLoading || ccTransactionStatus === "success") && /* @__PURE__ */
|
|
12449
|
-
/* @__PURE__ */
|
|
12568
|
+
return /* @__PURE__ */ jsxs53("div", { className: `cc-widget ${isLoading ? "loading" : ""}`, children: [
|
|
12569
|
+
(isLoading || isTransactionIdLoading || isEnvLoading || ccTransactionStatus === "success") && /* @__PURE__ */ jsx86("div", { className: "cc-widget-loader", children: /* @__PURE__ */ jsx86(ring_default, { width: 50, height: 50, fill: "#86b8ce" }) }),
|
|
12570
|
+
/* @__PURE__ */ jsx86(
|
|
12450
12571
|
"iframe",
|
|
12451
12572
|
{
|
|
12452
12573
|
width: isLoading || isTransactionIdLoading || ccTransactionStatus === "success" || error ? 0 : "100%",
|
|
@@ -12541,12 +12662,12 @@ var useDisconnectWallet7 = () => {
|
|
|
12541
12662
|
var useDisconnectWallet_default = useDisconnectWallet7;
|
|
12542
12663
|
|
|
12543
12664
|
// src/widgets/transfer/components/solana/SolanaConnectModal.tsx
|
|
12544
|
-
import
|
|
12665
|
+
import React19, { useCallback as useCallback17, useMemo as useMemo41 } from "react";
|
|
12545
12666
|
import { useDispatch as useDispatch24, useSelector as useSelector52 } from "react-redux";
|
|
12546
12667
|
import { useWallet as useSolanaWallet3 } from "@solana/wallet-adapter-react";
|
|
12547
12668
|
|
|
12548
12669
|
// src/widgets/transfer/components/solana/SolanaWalletSelect.tsx
|
|
12549
|
-
import { useCallback as useCallback16, useEffect as
|
|
12670
|
+
import { useCallback as useCallback16, useEffect as useEffect26, useMemo as useMemo39 } from "react";
|
|
12550
12671
|
import { useDispatch as useDispatch21, useSelector as useSelector49 } from "react-redux";
|
|
12551
12672
|
import { useWallet as useWallet5 } from "@solana/wallet-adapter-react";
|
|
12552
12673
|
import { WalletReadyState } from "@solana/wallet-adapter-base";
|
|
@@ -12566,9 +12687,9 @@ import { useRef as useRef10 } from "react";
|
|
|
12566
12687
|
import { useSelector as useSelector48 } from "react-redux";
|
|
12567
12688
|
|
|
12568
12689
|
// src/shared/lib/hooks/useHorizontalDragScroll.ts
|
|
12569
|
-
import { useEffect as
|
|
12690
|
+
import { useEffect as useEffect25 } from "react";
|
|
12570
12691
|
var useHorizontalDragScroll = (ref) => {
|
|
12571
|
-
|
|
12692
|
+
useEffect25(() => {
|
|
12572
12693
|
const el = ref.current;
|
|
12573
12694
|
if (!el) return;
|
|
12574
12695
|
let isDown = false;
|
|
@@ -12609,7 +12730,7 @@ var useHorizontalDragScroll = (ref) => {
|
|
|
12609
12730
|
};
|
|
12610
12731
|
|
|
12611
12732
|
// src/widgets/transfer/components/WalletOptionList.tsx
|
|
12612
|
-
import { jsx as
|
|
12733
|
+
import { jsx as jsx87, jsxs as jsxs54 } from "react/jsx-runtime";
|
|
12613
12734
|
var WalletOptionList = ({
|
|
12614
12735
|
options,
|
|
12615
12736
|
onSelect,
|
|
@@ -12621,9 +12742,9 @@ var WalletOptionList = ({
|
|
|
12621
12742
|
useHorizontalDragScroll(sliderRef);
|
|
12622
12743
|
const detected = options.filter((wallet) => wallet.installed);
|
|
12623
12744
|
const undetected = options.filter((wallet) => !wallet.installed);
|
|
12624
|
-
const renderIcon = (icon, alt) => typeof icon === "string" ? /* @__PURE__ */
|
|
12625
|
-
return /* @__PURE__ */
|
|
12626
|
-
detected.map((wallet) => /* @__PURE__ */
|
|
12745
|
+
const renderIcon = (icon, alt) => typeof icon === "string" ? /* @__PURE__ */ jsx87("img", { src: icon, alt }) : icon;
|
|
12746
|
+
return /* @__PURE__ */ jsx87("div", { className: "wallet-select", children: /* @__PURE__ */ jsx87("div", { className: "slide-area hide-scrollbar", ref: sliderRef, children: /* @__PURE__ */ jsxs54("div", { className: "wallet-container", children: [
|
|
12747
|
+
detected.map((wallet) => /* @__PURE__ */ jsx87(
|
|
12627
12748
|
"div",
|
|
12628
12749
|
{
|
|
12629
12750
|
className: `card-item ${theme.colorMode} ${selectedWallet === wallet.id ? "selected" : ""}`,
|
|
@@ -12631,21 +12752,21 @@ var WalletOptionList = ({
|
|
|
12631
12752
|
if (disabled) return;
|
|
12632
12753
|
onSelect(wallet.id);
|
|
12633
12754
|
},
|
|
12634
|
-
children: /* @__PURE__ */
|
|
12755
|
+
children: /* @__PURE__ */ jsxs54("div", { className: "wallet-item", children: [
|
|
12635
12756
|
renderIcon(wallet.icon, wallet.name),
|
|
12636
|
-
/* @__PURE__ */
|
|
12757
|
+
/* @__PURE__ */ jsx87("span", { children: wallet.name })
|
|
12637
12758
|
] })
|
|
12638
12759
|
},
|
|
12639
12760
|
wallet.id
|
|
12640
12761
|
)),
|
|
12641
|
-
undetected.map((wallet) => /* @__PURE__ */
|
|
12762
|
+
undetected.map((wallet) => /* @__PURE__ */ jsx87(
|
|
12642
12763
|
ExternalLink_default,
|
|
12643
12764
|
{
|
|
12644
12765
|
to: wallet.installUrl || "#",
|
|
12645
12766
|
className: `card-item ${theme.colorMode}`,
|
|
12646
|
-
children: /* @__PURE__ */
|
|
12767
|
+
children: /* @__PURE__ */ jsxs54("div", { className: "wallet-item", children: [
|
|
12647
12768
|
renderIcon(wallet.icon, wallet.name),
|
|
12648
|
-
/* @__PURE__ */
|
|
12769
|
+
/* @__PURE__ */ jsxs54("span", { children: [
|
|
12649
12770
|
"Install ",
|
|
12650
12771
|
wallet.name
|
|
12651
12772
|
] })
|
|
@@ -12658,7 +12779,7 @@ var WalletOptionList = ({
|
|
|
12658
12779
|
var WalletOptionList_default = WalletOptionList;
|
|
12659
12780
|
|
|
12660
12781
|
// src/widgets/transfer/components/solana/SolanaWalletSelect.tsx
|
|
12661
|
-
import { jsx as
|
|
12782
|
+
import { jsx as jsx88 } from "react/jsx-runtime";
|
|
12662
12783
|
var SolanaWalletSelect = () => {
|
|
12663
12784
|
const sourceChain = useSelector49(selectSourceChain);
|
|
12664
12785
|
const dispatch = useDispatch21();
|
|
@@ -12678,7 +12799,7 @@ var SolanaWalletSelect = () => {
|
|
|
12678
12799
|
},
|
|
12679
12800
|
[select]
|
|
12680
12801
|
);
|
|
12681
|
-
|
|
12802
|
+
useEffect26(() => {
|
|
12682
12803
|
if (!wallet) return;
|
|
12683
12804
|
if (sourceChain.shortName !== "SOL") {
|
|
12684
12805
|
return;
|
|
@@ -12700,7 +12821,7 @@ var SolanaWalletSelect = () => {
|
|
|
12700
12821
|
});
|
|
12701
12822
|
}
|
|
12702
12823
|
}, [wallet, sourceChain]);
|
|
12703
|
-
return /* @__PURE__ */
|
|
12824
|
+
return /* @__PURE__ */ jsx88(WalletOptionList_default, { options, onSelect: handleWalletClick });
|
|
12704
12825
|
};
|
|
12705
12826
|
var SolanaWalletSelect_default = SolanaWalletSelect;
|
|
12706
12827
|
|
|
@@ -12725,7 +12846,7 @@ var getBtcAccountExplorerUrl = (address, networkOption) => {
|
|
|
12725
12846
|
|
|
12726
12847
|
// src/widgets/transfer/components/WalletModalShell.tsx
|
|
12727
12848
|
import { useSelector as useSelector50 } from "react-redux";
|
|
12728
|
-
import { jsx as
|
|
12849
|
+
import { jsx as jsx89, jsxs as jsxs55 } from "react/jsx-runtime";
|
|
12729
12850
|
var WalletModalShell = ({
|
|
12730
12851
|
isOpen,
|
|
12731
12852
|
title,
|
|
@@ -12736,18 +12857,18 @@ var WalletModalShell = ({
|
|
|
12736
12857
|
}) => {
|
|
12737
12858
|
const theme = useSelector50(selectTheme);
|
|
12738
12859
|
if (!isOpen) return null;
|
|
12739
|
-
return /* @__PURE__ */
|
|
12860
|
+
return /* @__PURE__ */ jsxs55(
|
|
12740
12861
|
"div",
|
|
12741
12862
|
{
|
|
12742
12863
|
className: `kima-modal ${theme.colorMode} ${isOpen ? "open" : ""} ${className}`,
|
|
12743
12864
|
children: [
|
|
12744
|
-
/* @__PURE__ */
|
|
12745
|
-
/* @__PURE__ */
|
|
12746
|
-
/* @__PURE__ */
|
|
12747
|
-
/* @__PURE__ */
|
|
12748
|
-
/* @__PURE__ */
|
|
12865
|
+
/* @__PURE__ */ jsx89("div", { className: "modal-overlay", onClick: onClose }),
|
|
12866
|
+
/* @__PURE__ */ jsxs55("div", { className: `modal-content-container ${theme.colorMode}`, children: [
|
|
12867
|
+
/* @__PURE__ */ jsx89("div", { className: "kima-card-header", children: /* @__PURE__ */ jsxs55("div", { className: "topbar", children: [
|
|
12868
|
+
/* @__PURE__ */ jsx89("div", { className: "title", children: /* @__PURE__ */ jsx89("h3", { children: title }) }),
|
|
12869
|
+
/* @__PURE__ */ jsx89("div", { className: "control-buttons", children: rightHeader })
|
|
12749
12870
|
] }) }),
|
|
12750
|
-
/* @__PURE__ */
|
|
12871
|
+
/* @__PURE__ */ jsx89("div", { className: "modal-content", children })
|
|
12751
12872
|
] })
|
|
12752
12873
|
]
|
|
12753
12874
|
}
|
|
@@ -12756,7 +12877,7 @@ var WalletModalShell = ({
|
|
|
12756
12877
|
var WalletModalShell_default = WalletModalShell;
|
|
12757
12878
|
|
|
12758
12879
|
// src/widgets/transfer/components/AccountDetailsModalBase.tsx
|
|
12759
|
-
import { jsx as
|
|
12880
|
+
import { jsx as jsx90, jsxs as jsxs56 } from "react/jsx-runtime";
|
|
12760
12881
|
var AccountDetailsModalBase = ({
|
|
12761
12882
|
isOpen,
|
|
12762
12883
|
onClose,
|
|
@@ -12773,32 +12894,32 @@ var AccountDetailsModalBase = ({
|
|
|
12773
12894
|
closeButtonClassName = "cross-icon-button"
|
|
12774
12895
|
}) => {
|
|
12775
12896
|
const isLight = themeMode ? themeMode === "light" : true;
|
|
12776
|
-
return /* @__PURE__ */
|
|
12897
|
+
return /* @__PURE__ */ jsxs56(
|
|
12777
12898
|
WalletModalShell_default,
|
|
12778
12899
|
{
|
|
12779
12900
|
isOpen: !!isOpen,
|
|
12780
12901
|
title: "Account Details",
|
|
12781
12902
|
onClose,
|
|
12782
|
-
rightHeader: /* @__PURE__ */
|
|
12903
|
+
rightHeader: /* @__PURE__ */ jsx90("button", { className: closeButtonClassName, onClick: onClose, children: /* @__PURE__ */ jsx90(Cross_default, { fill: isLight ? "black" : "white" }) }),
|
|
12783
12904
|
children: [
|
|
12784
|
-
/* @__PURE__ */
|
|
12785
|
-
iconSymbol ? /* @__PURE__ */
|
|
12786
|
-
/* @__PURE__ */
|
|
12787
|
-
/* @__PURE__ */
|
|
12788
|
-
address && /* @__PURE__ */
|
|
12905
|
+
/* @__PURE__ */ jsxs56("div", { className: "summary", children: [
|
|
12906
|
+
iconSymbol ? /* @__PURE__ */ jsx90("div", { className: "summary-icon", children: /* @__PURE__ */ jsx90(ChainIcon, { width: 100, height: 100, symbol: iconSymbol }) }) : null,
|
|
12907
|
+
/* @__PURE__ */ jsxs56("div", { className: "address", children: [
|
|
12908
|
+
/* @__PURE__ */ jsx90("h2", { children: address ? getShortenedAddress(address) : "\u2014" }),
|
|
12909
|
+
address && /* @__PURE__ */ jsx90(CopyButton_default, { text: address })
|
|
12789
12910
|
] }),
|
|
12790
|
-
isBalanceLoading ? /* @__PURE__ */
|
|
12911
|
+
isBalanceLoading ? /* @__PURE__ */ jsx90("div", { className: "balance-skeleton", "aria-label": "balance-loading" }) : /* @__PURE__ */ jsxs56("h3", { children: [
|
|
12791
12912
|
balance == null ? "0" : decimals == null ? balance.toString() : formatBigInt({ value: balance, decimals }),
|
|
12792
12913
|
" ",
|
|
12793
12914
|
symbol
|
|
12794
12915
|
] })
|
|
12795
12916
|
] }),
|
|
12796
|
-
/* @__PURE__ */
|
|
12797
|
-
/* @__PURE__ */
|
|
12798
|
-
/* @__PURE__ */
|
|
12799
|
-
/* @__PURE__ */
|
|
12917
|
+
/* @__PURE__ */ jsx90(SecondaryButton_default, { className: "block-explorer", children: /* @__PURE__ */ jsxs56(ExternalLink_default, { className: "link", to: explorerUrl, children: [
|
|
12918
|
+
/* @__PURE__ */ jsx90(Explorer_default, { fill: "#778DA3" }),
|
|
12919
|
+
/* @__PURE__ */ jsx90("p", { children: "Block explorer" }),
|
|
12920
|
+
/* @__PURE__ */ jsx90(ExternalUrl_default, { fill: "#778DA3" })
|
|
12800
12921
|
] }) }),
|
|
12801
|
-
/* @__PURE__ */
|
|
12922
|
+
/* @__PURE__ */ jsx90(PrimaryButton_default, { clickHandler: onDisconnect, disabled: disableDisconnect, children: "Disconnect" })
|
|
12802
12923
|
]
|
|
12803
12924
|
}
|
|
12804
12925
|
);
|
|
@@ -12807,7 +12928,7 @@ var AccountDetailsModalBase_default = AccountDetailsModalBase;
|
|
|
12807
12928
|
|
|
12808
12929
|
// src/widgets/transfer/components/solana/AccountDetailsModal.tsx
|
|
12809
12930
|
import toast6 from "react-hot-toast";
|
|
12810
|
-
import { jsx as
|
|
12931
|
+
import { jsx as jsx91 } from "react/jsx-runtime";
|
|
12811
12932
|
var AccountDetailsModal = () => {
|
|
12812
12933
|
const dispatch = useDispatch22();
|
|
12813
12934
|
const theme = useSelector51(selectTheme);
|
|
@@ -12842,13 +12963,13 @@ var AccountDetailsModal = () => {
|
|
|
12842
12963
|
if (isUserRejected2(e)) {
|
|
12843
12964
|
toast6("Wallet disconnect was cancelled.");
|
|
12844
12965
|
} else {
|
|
12845
|
-
toast6.error("Failed to disconnect wallet.", { icon: /* @__PURE__ */
|
|
12966
|
+
toast6.error("Failed to disconnect wallet.", { icon: /* @__PURE__ */ jsx91(Error_default, {}) });
|
|
12846
12967
|
}
|
|
12847
12968
|
} finally {
|
|
12848
12969
|
close();
|
|
12849
12970
|
}
|
|
12850
12971
|
};
|
|
12851
|
-
return /* @__PURE__ */
|
|
12972
|
+
return /* @__PURE__ */ jsx91(
|
|
12852
12973
|
AccountDetailsModalBase_default,
|
|
12853
12974
|
{
|
|
12854
12975
|
isOpen: !!isOpen,
|
|
@@ -12870,7 +12991,7 @@ var AccountDetailsModal_default = AccountDetailsModal;
|
|
|
12870
12991
|
|
|
12871
12992
|
// src/widgets/transfer/components/WalletConnectModalBase.tsx
|
|
12872
12993
|
import { useDispatch as useDispatch23 } from "react-redux";
|
|
12873
|
-
import { jsx as
|
|
12994
|
+
import { jsx as jsx92, jsxs as jsxs57 } from "react/jsx-runtime";
|
|
12874
12995
|
var WalletConnectModalBase = ({
|
|
12875
12996
|
isOpen,
|
|
12876
12997
|
mode,
|
|
@@ -12880,14 +13001,14 @@ var WalletConnectModalBase = ({
|
|
|
12880
13001
|
children
|
|
12881
13002
|
}) => {
|
|
12882
13003
|
const dispatch = useDispatch23();
|
|
12883
|
-
return /* @__PURE__ */
|
|
13004
|
+
return /* @__PURE__ */ jsxs57(
|
|
12884
13005
|
WalletModalShell_default,
|
|
12885
13006
|
{
|
|
12886
13007
|
isOpen,
|
|
12887
13008
|
title: "Connect Wallet",
|
|
12888
13009
|
onClose,
|
|
12889
13010
|
className: "wallet-connect",
|
|
12890
|
-
rightHeader: /* @__PURE__ */
|
|
13011
|
+
rightHeader: /* @__PURE__ */ jsx92("button", { className: "cross-icon-button", onClick: onClose, children: /* @__PURE__ */ jsx92(
|
|
12891
13012
|
Cross_default,
|
|
12892
13013
|
{
|
|
12893
13014
|
width: 30,
|
|
@@ -12896,9 +13017,9 @@ var WalletConnectModalBase = ({
|
|
|
12896
13017
|
}
|
|
12897
13018
|
) }),
|
|
12898
13019
|
children: [
|
|
12899
|
-
demoMessage && /* @__PURE__ */
|
|
12900
|
-
mode !== "light" /* light */ ? children : /* @__PURE__ */
|
|
12901
|
-
/* @__PURE__ */
|
|
13020
|
+
demoMessage && /* @__PURE__ */ jsx92("p", { className: "muted", children: demoMessage }),
|
|
13021
|
+
mode !== "light" /* light */ ? children : /* @__PURE__ */ jsxs57("div", { className: "wallet-modal-actions", children: [
|
|
13022
|
+
/* @__PURE__ */ jsx92(
|
|
12902
13023
|
"button",
|
|
12903
13024
|
{
|
|
12904
13025
|
className: "secondary",
|
|
@@ -12906,7 +13027,7 @@ var WalletConnectModalBase = ({
|
|
|
12906
13027
|
children: "View Account"
|
|
12907
13028
|
}
|
|
12908
13029
|
),
|
|
12909
|
-
/* @__PURE__ */
|
|
13030
|
+
/* @__PURE__ */ jsx92("button", { className: "primary", onClick: onClose, children: "Close" })
|
|
12910
13031
|
] })
|
|
12911
13032
|
]
|
|
12912
13033
|
}
|
|
@@ -12915,7 +13036,7 @@ var WalletConnectModalBase = ({
|
|
|
12915
13036
|
var WalletConnectModalBase_default = WalletConnectModalBase;
|
|
12916
13037
|
|
|
12917
13038
|
// src/widgets/transfer/components/solana/SolanaConnectModal.tsx
|
|
12918
|
-
import { Fragment as
|
|
13039
|
+
import { Fragment as Fragment12, jsx as jsx93, jsxs as jsxs58 } from "react/jsx-runtime";
|
|
12919
13040
|
var SolanaWalletConnectModal = () => {
|
|
12920
13041
|
const dispatch = useDispatch24();
|
|
12921
13042
|
const theme = useSelector52(selectTheme);
|
|
@@ -12925,7 +13046,7 @@ var SolanaWalletConnectModal = () => {
|
|
|
12925
13046
|
const close = useCallback17(() => {
|
|
12926
13047
|
dispatch(setSolanaConnectModal(false));
|
|
12927
13048
|
}, [dispatch]);
|
|
12928
|
-
|
|
13049
|
+
React19.useEffect(() => {
|
|
12929
13050
|
logger_default.debug("[SolanaConnectModal] wallet-adapter state", {
|
|
12930
13051
|
connecting,
|
|
12931
13052
|
connected,
|
|
@@ -12936,9 +13057,9 @@ var SolanaWalletConnectModal = () => {
|
|
|
12936
13057
|
() => mode === "light" /* light */ ? `Light mode uses a demo Solana address (${lightDemoAccounts.SOL}).` : "",
|
|
12937
13058
|
[mode]
|
|
12938
13059
|
);
|
|
12939
|
-
return /* @__PURE__ */
|
|
12940
|
-
/* @__PURE__ */
|
|
12941
|
-
/* @__PURE__ */
|
|
13060
|
+
return /* @__PURE__ */ jsxs58(Fragment12, { children: [
|
|
13061
|
+
/* @__PURE__ */ jsx93(AccountDetailsModal_default, {}),
|
|
13062
|
+
/* @__PURE__ */ jsx93(
|
|
12942
13063
|
WalletConnectModalBase_default,
|
|
12943
13064
|
{
|
|
12944
13065
|
isOpen: !!isOpen,
|
|
@@ -12946,7 +13067,7 @@ var SolanaWalletConnectModal = () => {
|
|
|
12946
13067
|
themeMode: theme.colorMode ?? "light" /* light */,
|
|
12947
13068
|
demoMessage: demoMsg,
|
|
12948
13069
|
onClose: close,
|
|
12949
|
-
children: /* @__PURE__ */
|
|
13070
|
+
children: /* @__PURE__ */ jsx93(SolanaWalletSelect_default, {})
|
|
12950
13071
|
}
|
|
12951
13072
|
)
|
|
12952
13073
|
] });
|
|
@@ -12962,7 +13083,7 @@ import { useMemo as useMemo42 } from "react";
|
|
|
12962
13083
|
import { useDispatch as useDispatch25, useSelector as useSelector53 } from "react-redux";
|
|
12963
13084
|
import { useWallet as useTronWallet4 } from "@tronweb3/tronwallet-adapter-react-hooks";
|
|
12964
13085
|
import toast7 from "react-hot-toast";
|
|
12965
|
-
import { jsx as
|
|
13086
|
+
import { jsx as jsx94 } from "react/jsx-runtime";
|
|
12966
13087
|
var AccountDetailsModal2 = () => {
|
|
12967
13088
|
const dispatch = useDispatch25();
|
|
12968
13089
|
const theme = useSelector53(selectTheme);
|
|
@@ -12997,13 +13118,13 @@ var AccountDetailsModal2 = () => {
|
|
|
12997
13118
|
if (isUserRejected2(e)) {
|
|
12998
13119
|
toast7("Wallet disconnect was cancelled.");
|
|
12999
13120
|
} else {
|
|
13000
|
-
toast7.error("Failed to disconnect wallet.", { icon: /* @__PURE__ */
|
|
13121
|
+
toast7.error("Failed to disconnect wallet.", { icon: /* @__PURE__ */ jsx94(Error_default, {}) });
|
|
13001
13122
|
}
|
|
13002
13123
|
} finally {
|
|
13003
13124
|
close();
|
|
13004
13125
|
}
|
|
13005
13126
|
};
|
|
13006
|
-
return /* @__PURE__ */
|
|
13127
|
+
return /* @__PURE__ */ jsx94(
|
|
13007
13128
|
AccountDetailsModalBase_default,
|
|
13008
13129
|
{
|
|
13009
13130
|
isOpen: !!isOpen,
|
|
@@ -13024,12 +13145,12 @@ var AccountDetailsModal2 = () => {
|
|
|
13024
13145
|
var AccountDetailsModal_default2 = AccountDetailsModal2;
|
|
13025
13146
|
|
|
13026
13147
|
// src/widgets/transfer/components/tron/TronWalletSelect.tsx
|
|
13027
|
-
import { useEffect as
|
|
13148
|
+
import { useEffect as useEffect27, useMemo as useMemo43 } from "react";
|
|
13028
13149
|
import { useDispatch as useDispatch26 } from "react-redux";
|
|
13029
13150
|
import { useWallet as useWallet6 } from "@tronweb3/tronwallet-adapter-react-hooks";
|
|
13030
13151
|
import { AdapterState } from "@tronweb3/tronwallet-abstract-adapter";
|
|
13031
13152
|
import toast8 from "react-hot-toast";
|
|
13032
|
-
import { jsx as
|
|
13153
|
+
import { jsx as jsx95 } from "react/jsx-runtime";
|
|
13033
13154
|
var TronWalletSelect = () => {
|
|
13034
13155
|
const dispatch = useDispatch26();
|
|
13035
13156
|
const {
|
|
@@ -13048,7 +13169,7 @@ var TronWalletSelect = () => {
|
|
|
13048
13169
|
installed: wallet.state === AdapterState.Connected || wallet.state === AdapterState.Disconnect || wallet.state === AdapterState.Loading
|
|
13049
13170
|
}));
|
|
13050
13171
|
}, [wallets]);
|
|
13051
|
-
|
|
13172
|
+
useEffect27(() => {
|
|
13052
13173
|
connected && dispatch(setTronConnectModal(false));
|
|
13053
13174
|
}, [connected]);
|
|
13054
13175
|
const connectWallet = async (walletName) => {
|
|
@@ -13066,12 +13187,12 @@ var TronWalletSelect = () => {
|
|
|
13066
13187
|
}
|
|
13067
13188
|
}
|
|
13068
13189
|
};
|
|
13069
|
-
return /* @__PURE__ */
|
|
13190
|
+
return /* @__PURE__ */ jsx95(WalletOptionList_default, { options, onSelect: connectWallet });
|
|
13070
13191
|
};
|
|
13071
13192
|
var TronWalletSelect_default = TronWalletSelect;
|
|
13072
13193
|
|
|
13073
13194
|
// src/widgets/transfer/components/tron/TronWalletConnectModal.tsx
|
|
13074
|
-
import { Fragment as
|
|
13195
|
+
import { Fragment as Fragment13, jsx as jsx96, jsxs as jsxs59 } from "react/jsx-runtime";
|
|
13075
13196
|
var TronWalletConnectModal = () => {
|
|
13076
13197
|
const dispatch = useDispatch27();
|
|
13077
13198
|
const theme = useSelector54(selectTheme);
|
|
@@ -13084,9 +13205,9 @@ var TronWalletConnectModal = () => {
|
|
|
13084
13205
|
() => mode === "light" /* light */ ? `Light mode uses a demo Tron address (${lightDemoAccounts.TRX}).` : "",
|
|
13085
13206
|
[mode]
|
|
13086
13207
|
);
|
|
13087
|
-
return /* @__PURE__ */
|
|
13088
|
-
/* @__PURE__ */
|
|
13089
|
-
/* @__PURE__ */
|
|
13208
|
+
return /* @__PURE__ */ jsxs59(Fragment13, { children: [
|
|
13209
|
+
/* @__PURE__ */ jsx96(AccountDetailsModal_default2, {}),
|
|
13210
|
+
/* @__PURE__ */ jsx96(
|
|
13090
13211
|
WalletConnectModalBase_default,
|
|
13091
13212
|
{
|
|
13092
13213
|
isOpen: !!isOpen,
|
|
@@ -13094,7 +13215,7 @@ var TronWalletConnectModal = () => {
|
|
|
13094
13215
|
themeMode: theme.colorMode ?? "light" /* light */,
|
|
13095
13216
|
demoMessage: demoMsg,
|
|
13096
13217
|
onClose: close,
|
|
13097
|
-
children: /* @__PURE__ */
|
|
13218
|
+
children: /* @__PURE__ */ jsx96(TronWalletSelect_default, {})
|
|
13098
13219
|
}
|
|
13099
13220
|
)
|
|
13100
13221
|
] });
|
|
@@ -13102,7 +13223,7 @@ var TronWalletConnectModal = () => {
|
|
|
13102
13223
|
var TronWalletConnectModal_default = TronWalletConnectModal;
|
|
13103
13224
|
|
|
13104
13225
|
// src/widgets/transfer/components/btc/BtcConnectModal.tsx
|
|
13105
|
-
import { useCallback as useCallback20, useEffect as
|
|
13226
|
+
import { useCallback as useCallback20, useEffect as useEffect28, useMemo as useMemo47, useState as useState15 } from "react";
|
|
13106
13227
|
import { useDispatch as useDispatch30, useSelector as useSelector57 } from "react-redux";
|
|
13107
13228
|
import toast10 from "react-hot-toast";
|
|
13108
13229
|
|
|
@@ -13111,7 +13232,6 @@ import { useCallback as useCallback19 } from "react";
|
|
|
13111
13232
|
import { useDispatch as useDispatch28, useSelector as useSelector55 } from "react-redux";
|
|
13112
13233
|
var useBtcWallet = () => {
|
|
13113
13234
|
const dispatch = useDispatch28();
|
|
13114
|
-
const { externalProvider } = useKimaContext();
|
|
13115
13235
|
const networkOption = useSelector55(selectNetworkOption);
|
|
13116
13236
|
const ensureNetworkMatch = useCallback19(
|
|
13117
13237
|
(address) => {
|
|
@@ -13129,20 +13249,6 @@ var useBtcWallet = () => {
|
|
|
13129
13249
|
);
|
|
13130
13250
|
const connect = useCallback19(
|
|
13131
13251
|
async (options) => {
|
|
13132
|
-
if (externalProvider?.type === "btc") {
|
|
13133
|
-
const signer = externalProvider.signer;
|
|
13134
|
-
const address2 = typeof signer === "string" ? signer : signer?.address ?? "";
|
|
13135
|
-
const pubkey2 = normalizeBtcPubkeyHex(
|
|
13136
|
-
typeof signer === "object" && signer?.publicKey || externalProvider.provider?.publicKey || ""
|
|
13137
|
-
) || "";
|
|
13138
|
-
ensureNetworkMatch(address2);
|
|
13139
|
-
if (address2) {
|
|
13140
|
-
dispatch(setBitcoinAddress(address2));
|
|
13141
|
-
dispatch(setSourceAddress(address2));
|
|
13142
|
-
}
|
|
13143
|
-
if (pubkey2) dispatch(setBitcoinPubkey(pubkey2));
|
|
13144
|
-
return { address: address2, pubkey: pubkey2 };
|
|
13145
|
-
}
|
|
13146
13252
|
const walletType = options?.wallet;
|
|
13147
13253
|
const unisat = walletType === "unisat" || !walletType ? getUnisat() : null;
|
|
13148
13254
|
if (walletType === "unisat" && !unisat) {
|
|
@@ -13190,7 +13296,7 @@ var useBtcWallet = () => {
|
|
|
13190
13296
|
});
|
|
13191
13297
|
return { address, pubkey };
|
|
13192
13298
|
},
|
|
13193
|
-
[dispatch, ensureNetworkMatch
|
|
13299
|
+
[dispatch, ensureNetworkMatch]
|
|
13194
13300
|
);
|
|
13195
13301
|
const disconnect = useCallback19(async () => {
|
|
13196
13302
|
const unisat = getUnisat();
|
|
@@ -13207,7 +13313,7 @@ var useBtcWallet = () => {
|
|
|
13207
13313
|
|
|
13208
13314
|
// src/widgets/transfer/components/btc/BtcWalletSelect.tsx
|
|
13209
13315
|
import { useMemo as useMemo45 } from "react";
|
|
13210
|
-
import { jsx as
|
|
13316
|
+
import { jsx as jsx97 } from "react/jsx-runtime";
|
|
13211
13317
|
var BtcWalletSelect = ({
|
|
13212
13318
|
selectedWallet,
|
|
13213
13319
|
onSelect,
|
|
@@ -13221,12 +13327,12 @@ var BtcWalletSelect = ({
|
|
|
13221
13327
|
name: "UniSat",
|
|
13222
13328
|
installUrl: "https://unisat.io/download",
|
|
13223
13329
|
installed: unisatInstalled,
|
|
13224
|
-
icon: /* @__PURE__ */
|
|
13330
|
+
icon: /* @__PURE__ */ jsx97(UniSat_default, {})
|
|
13225
13331
|
}
|
|
13226
13332
|
];
|
|
13227
13333
|
return list;
|
|
13228
13334
|
}, []);
|
|
13229
|
-
return /* @__PURE__ */
|
|
13335
|
+
return /* @__PURE__ */ jsx97(
|
|
13230
13336
|
WalletOptionList_default,
|
|
13231
13337
|
{
|
|
13232
13338
|
options: wallets,
|
|
@@ -13242,7 +13348,7 @@ var BtcWalletSelect_default = BtcWalletSelect;
|
|
|
13242
13348
|
import { useMemo as useMemo46 } from "react";
|
|
13243
13349
|
import { useDispatch as useDispatch29, useSelector as useSelector56 } from "react-redux";
|
|
13244
13350
|
import toast9 from "react-hot-toast";
|
|
13245
|
-
import { jsx as
|
|
13351
|
+
import { jsx as jsx98 } from "react/jsx-runtime";
|
|
13246
13352
|
var AccountDetailsModal3 = () => {
|
|
13247
13353
|
const dispatch = useDispatch29();
|
|
13248
13354
|
const theme = useSelector56(selectTheme);
|
|
@@ -13277,13 +13383,13 @@ var AccountDetailsModal3 = () => {
|
|
|
13277
13383
|
if (isUserRejected2(e)) {
|
|
13278
13384
|
toast9("Wallet disconnect was cancelled.");
|
|
13279
13385
|
} else {
|
|
13280
|
-
toast9.error("Failed to disconnect wallet.", { icon: /* @__PURE__ */
|
|
13386
|
+
toast9.error("Failed to disconnect wallet.", { icon: /* @__PURE__ */ jsx98(Error_default, {}) });
|
|
13281
13387
|
}
|
|
13282
13388
|
} finally {
|
|
13283
13389
|
close();
|
|
13284
13390
|
}
|
|
13285
13391
|
};
|
|
13286
|
-
return /* @__PURE__ */
|
|
13392
|
+
return /* @__PURE__ */ jsx98(
|
|
13287
13393
|
AccountDetailsModalBase_default,
|
|
13288
13394
|
{
|
|
13289
13395
|
isOpen: !!isOpen,
|
|
@@ -13304,7 +13410,7 @@ var AccountDetailsModal3 = () => {
|
|
|
13304
13410
|
var AccountDetailsModal_default3 = AccountDetailsModal3;
|
|
13305
13411
|
|
|
13306
13412
|
// src/widgets/transfer/components/btc/BtcConnectModal.tsx
|
|
13307
|
-
import { Fragment as
|
|
13413
|
+
import { Fragment as Fragment14, jsx as jsx99, jsxs as jsxs60 } from "react/jsx-runtime";
|
|
13308
13414
|
var BtcConnectModal = () => {
|
|
13309
13415
|
const dispatch = useDispatch30();
|
|
13310
13416
|
const theme = useSelector57(selectTheme);
|
|
@@ -13312,13 +13418,13 @@ var BtcConnectModal = () => {
|
|
|
13312
13418
|
const mode = useSelector57(selectMode);
|
|
13313
13419
|
const sourceChain = useSelector57(selectSourceChain);
|
|
13314
13420
|
const { connect } = useBtcWallet();
|
|
13315
|
-
const [selectedWallet, setSelectedWallet] =
|
|
13316
|
-
const [connecting, setConnecting] =
|
|
13421
|
+
const [selectedWallet, setSelectedWallet] = useState15(null);
|
|
13422
|
+
const [connecting, setConnecting] = useState15(false);
|
|
13317
13423
|
const isBtc2 = sourceChain.shortName === "BTC" /* BTC */;
|
|
13318
13424
|
const close = useCallback20(() => {
|
|
13319
13425
|
dispatch(setBtcConnectModal(false));
|
|
13320
13426
|
}, [dispatch]);
|
|
13321
|
-
|
|
13427
|
+
useEffect28(() => {
|
|
13322
13428
|
if (!isOpen) return;
|
|
13323
13429
|
if (selectedWallet) return;
|
|
13324
13430
|
if (getUnisat()) {
|
|
@@ -13344,22 +13450,22 @@ var BtcConnectModal = () => {
|
|
|
13344
13450
|
if (isUserRejected2(e)) {
|
|
13345
13451
|
toast10("Wallet connection was cancelled.");
|
|
13346
13452
|
} else if (e?.error?.message) {
|
|
13347
|
-
toast10.error(e.error.message, { icon: /* @__PURE__ */
|
|
13453
|
+
toast10.error(e.error.message, { icon: /* @__PURE__ */ jsx99(Error_default, {}) });
|
|
13348
13454
|
} else if (e?.code === "UNISAT_NOT_FOUND") {
|
|
13349
|
-
toast10.error("UniSat wallet not found.", { icon: /* @__PURE__ */
|
|
13455
|
+
toast10.error("UniSat wallet not found.", { icon: /* @__PURE__ */ jsx99(Error_default, {}) });
|
|
13350
13456
|
} else if (e?.code === "BTC_WALLET_NOT_FOUND") {
|
|
13351
|
-
toast10.error("Bitcoin wallet not found.", { icon: /* @__PURE__ */
|
|
13457
|
+
toast10.error("Bitcoin wallet not found.", { icon: /* @__PURE__ */ jsx99(Error_default, {}) });
|
|
13352
13458
|
} else if (e?.code === "BTC_NO_ACCOUNT") {
|
|
13353
13459
|
toast10.error("No Bitcoin account returned. Please try again.", {
|
|
13354
|
-
icon: /* @__PURE__ */
|
|
13460
|
+
icon: /* @__PURE__ */ jsx99(Error_default, {})
|
|
13355
13461
|
});
|
|
13356
13462
|
} else if (e?.code === "BTC_WRONG_NETWORK") {
|
|
13357
13463
|
const expected = e?.expectedNetwork ? String(e.expectedNetwork) : "";
|
|
13358
13464
|
const detected = e?.detectedNetwork ? String(e.detectedNetwork) : "";
|
|
13359
13465
|
const detail = expected && detected ? `Wallet is on ${detected}. Switch to ${expected}.` : "Wallet network mismatch. Please switch networks.";
|
|
13360
|
-
toast10.error(detail, { icon: /* @__PURE__ */
|
|
13466
|
+
toast10.error(detail, { icon: /* @__PURE__ */ jsx99(Error_default, {}) });
|
|
13361
13467
|
} else {
|
|
13362
|
-
toast10.error("Failed to connect wallet.", { icon: /* @__PURE__ */
|
|
13468
|
+
toast10.error("Failed to connect wallet.", { icon: /* @__PURE__ */ jsx99(Error_default, {}) });
|
|
13363
13469
|
}
|
|
13364
13470
|
logger_default.error("[BtcConnectModal] connect error", e);
|
|
13365
13471
|
} finally {
|
|
@@ -13369,9 +13475,9 @@ var BtcConnectModal = () => {
|
|
|
13369
13475
|
[connect, connecting, dispatch, isBtc2, mode]
|
|
13370
13476
|
);
|
|
13371
13477
|
const demoMsg = useMemo47(() => "", []);
|
|
13372
|
-
return /* @__PURE__ */
|
|
13373
|
-
/* @__PURE__ */
|
|
13374
|
-
/* @__PURE__ */
|
|
13478
|
+
return /* @__PURE__ */ jsxs60(Fragment14, { children: [
|
|
13479
|
+
/* @__PURE__ */ jsx99(AccountDetailsModal_default3, {}),
|
|
13480
|
+
/* @__PURE__ */ jsx99(
|
|
13375
13481
|
WalletConnectModalBase_default,
|
|
13376
13482
|
{
|
|
13377
13483
|
isOpen: !!isOpen,
|
|
@@ -13379,7 +13485,7 @@ var BtcConnectModal = () => {
|
|
|
13379
13485
|
themeMode: theme.colorMode ?? "light" /* light */,
|
|
13380
13486
|
demoMessage: demoMsg,
|
|
13381
13487
|
onClose: close,
|
|
13382
|
-
children: /* @__PURE__ */
|
|
13488
|
+
children: /* @__PURE__ */ jsx99(
|
|
13383
13489
|
BtcWalletSelect_default,
|
|
13384
13490
|
{
|
|
13385
13491
|
selectedWallet,
|
|
@@ -13394,7 +13500,7 @@ var BtcConnectModal = () => {
|
|
|
13394
13500
|
var BtcConnectModal_default = BtcConnectModal;
|
|
13395
13501
|
|
|
13396
13502
|
// src/widgets/transfer/components/TransferWidget.tsx
|
|
13397
|
-
import { jsx as
|
|
13503
|
+
import { jsx as jsx100, jsxs as jsxs61 } from "react/jsx-runtime";
|
|
13398
13504
|
var PERMIT2_INFO_MESSAGE = "This approval uses Permit2, so you can skip a separate approval transaction and save gas.";
|
|
13399
13505
|
var PERMIT2_DOCS_URL = "https://docs.kima.network/kima-network/the-kima-sdk/use-kima-sdk-without-widget/message-signing#permit2-tokens";
|
|
13400
13506
|
var TransferWidget = ({
|
|
@@ -13406,17 +13512,17 @@ var TransferWidget = ({
|
|
|
13406
13512
|
logger_default.debug("[TransferWidget] mount");
|
|
13407
13513
|
const dispatch = useDispatch31();
|
|
13408
13514
|
const mainRef = useRef11(null);
|
|
13409
|
-
const [signature, setSignature2] =
|
|
13410
|
-
const [isSubmitting, setIsSubmitting] =
|
|
13411
|
-
const [formStep, setFormStep] =
|
|
13412
|
-
const [warningModalOpen, setWarningModalOpen] =
|
|
13413
|
-
const [resetModalOpen, setResetModalOpen] =
|
|
13414
|
-
const [isPermit2TooltipOpen, setPermit2TooltipOpen] =
|
|
13515
|
+
const [signature, setSignature2] = useState16("");
|
|
13516
|
+
const [isSubmitting, setIsSubmitting] = useState16(false);
|
|
13517
|
+
const [formStep, setFormStep] = useState16(0);
|
|
13518
|
+
const [warningModalOpen, setWarningModalOpen] = useState16(null);
|
|
13519
|
+
const [resetModalOpen, setResetModalOpen] = useState16(false);
|
|
13520
|
+
const [isPermit2TooltipOpen, setPermit2TooltipOpen] = useState16(false);
|
|
13415
13521
|
const permit2TooltipRef = useRef11(null);
|
|
13416
|
-
const [isCancellingApprove, setCancellingApprove] =
|
|
13417
|
-
const [isApproving, setApproving] =
|
|
13418
|
-
const [isSigning, setSigning] =
|
|
13419
|
-
const [feeOptionDisabled, setFeeOptionDisabled] =
|
|
13522
|
+
const [isCancellingApprove, setCancellingApprove] = useState16(false);
|
|
13523
|
+
const [isApproving, setApproving] = useState16(false);
|
|
13524
|
+
const [isSigning, setSigning] = useState16(false);
|
|
13525
|
+
const [feeOptionDisabled, setFeeOptionDisabled] = useState16(false);
|
|
13420
13526
|
const networkOption = useSelector58(selectNetworkOption);
|
|
13421
13527
|
const dAppOption = useSelector58(selectDappOption);
|
|
13422
13528
|
const mode = useSelector58(selectMode);
|
|
@@ -13449,7 +13555,7 @@ var TransferWidget = ({
|
|
|
13449
13555
|
panelRef: toastPanelRef,
|
|
13450
13556
|
formatTime: formatToastTime
|
|
13451
13557
|
} = useToastHistory();
|
|
13452
|
-
|
|
13558
|
+
useEffect29(() => {
|
|
13453
13559
|
if (!isPermit2TooltipOpen) return;
|
|
13454
13560
|
const handler = (event) => {
|
|
13455
13561
|
const target = event.target;
|
|
@@ -13502,7 +13608,7 @@ var TransferWidget = ({
|
|
|
13502
13608
|
[sourceChain, sourceCurrency, targetChain, targetCurrency]
|
|
13503
13609
|
);
|
|
13504
13610
|
const prevAmountRef = useRef11("");
|
|
13505
|
-
|
|
13611
|
+
useEffect29(() => {
|
|
13506
13612
|
setSignature2("");
|
|
13507
13613
|
setFeeOptionDisabled(false);
|
|
13508
13614
|
setApproving(false);
|
|
@@ -13515,7 +13621,7 @@ var TransferWidget = ({
|
|
|
13515
13621
|
targetChain.shortName,
|
|
13516
13622
|
targetCurrency
|
|
13517
13623
|
]);
|
|
13518
|
-
|
|
13624
|
+
useEffect29(() => {
|
|
13519
13625
|
const prevAmount = prevAmountRef.current;
|
|
13520
13626
|
if (prevAmount !== "" && amount !== prevAmount) {
|
|
13521
13627
|
dispatch(clearPermit2Signature());
|
|
@@ -13525,10 +13631,10 @@ var TransferWidget = ({
|
|
|
13525
13631
|
}
|
|
13526
13632
|
prevAmountRef.current = amount;
|
|
13527
13633
|
}, [amount, dispatch, isBtcOrigin]);
|
|
13528
|
-
|
|
13634
|
+
useEffect29(() => {
|
|
13529
13635
|
dispatch(clearPermit2Signature());
|
|
13530
13636
|
}, [dispatch, feeDeduct]);
|
|
13531
|
-
|
|
13637
|
+
useEffect29(() => {
|
|
13532
13638
|
try {
|
|
13533
13639
|
if (fees) dispatch(setServiceFee(fees));
|
|
13534
13640
|
if (mode === "payment" /* payment */ && transactionOption?.sourceChain) {
|
|
@@ -13544,7 +13650,7 @@ var TransferWidget = ({
|
|
|
13544
13650
|
);
|
|
13545
13651
|
toast11.error(
|
|
13546
13652
|
"An unexpected error occurred while preparing the transfer. Please contact support for assistance.",
|
|
13547
|
-
{ icon: /* @__PURE__ */
|
|
13653
|
+
{ icon: /* @__PURE__ */ jsx100(Error_default, {}) }
|
|
13548
13654
|
);
|
|
13549
13655
|
}
|
|
13550
13656
|
}, [fees, mode, transactionOption, dispatch]);
|
|
@@ -13564,7 +13670,7 @@ var TransferWidget = ({
|
|
|
13564
13670
|
}
|
|
13565
13671
|
return true;
|
|
13566
13672
|
}, [sourceChain, ccTransactionStatus, submitted]);
|
|
13567
|
-
const [initialSelection, setInitialSelection] =
|
|
13673
|
+
const [initialSelection, setInitialSelection] = useState16({
|
|
13568
13674
|
sourceSelection: true,
|
|
13569
13675
|
targetSelection: true
|
|
13570
13676
|
});
|
|
@@ -13605,7 +13711,7 @@ var TransferWidget = ({
|
|
|
13605
13711
|
} catch (err) {
|
|
13606
13712
|
logger_default.error("[TransferWidget] submit failed", err);
|
|
13607
13713
|
const message = err instanceof Error && err.message ? err.message : "Failed to submit your transaction. Please contact support for assistance.";
|
|
13608
|
-
toast11.error(message, { icon: /* @__PURE__ */
|
|
13714
|
+
toast11.error(message, { icon: /* @__PURE__ */ jsx100(Error_default, {}) });
|
|
13609
13715
|
dispatch(setCCTransactionStatus("error-generic"));
|
|
13610
13716
|
}
|
|
13611
13717
|
}, [signature, submitTransaction, dispatch]);
|
|
@@ -13633,7 +13739,7 @@ var TransferWidget = ({
|
|
|
13633
13739
|
logger_default.error("[TransferWidget] signing failed", err);
|
|
13634
13740
|
toast11.error(
|
|
13635
13741
|
"Failed to sign the message. Please contact support for assistance.",
|
|
13636
|
-
{ icon: /* @__PURE__ */
|
|
13742
|
+
{ icon: /* @__PURE__ */ jsx100(Error_default, {}) }
|
|
13637
13743
|
);
|
|
13638
13744
|
}
|
|
13639
13745
|
return void 0;
|
|
@@ -13651,7 +13757,7 @@ var TransferWidget = ({
|
|
|
13651
13757
|
const handleSubmit = async () => {
|
|
13652
13758
|
const { error, message: validationMessage } = validate(true);
|
|
13653
13759
|
if (error === "ValidationError" /* Error */) {
|
|
13654
|
-
toast11.error(validationMessage, { icon: /* @__PURE__ */
|
|
13760
|
+
toast11.error(validationMessage, { icon: /* @__PURE__ */ jsx100(Error_default, {}) });
|
|
13655
13761
|
return;
|
|
13656
13762
|
}
|
|
13657
13763
|
if (["BANK", "CC"].includes(sourceChain.shortName)) {
|
|
@@ -13678,7 +13784,7 @@ var TransferWidget = ({
|
|
|
13678
13784
|
if (msg.includes("ChainMismatch")) {
|
|
13679
13785
|
toast11.error(
|
|
13680
13786
|
`Your wallet is on the wrong network. Please switch to ${sourceChain.name} and try again.`,
|
|
13681
|
-
{ icon: /* @__PURE__ */
|
|
13787
|
+
{ icon: /* @__PURE__ */ jsx100(Error_default, {}) }
|
|
13682
13788
|
);
|
|
13683
13789
|
return;
|
|
13684
13790
|
}
|
|
@@ -13686,14 +13792,14 @@ var TransferWidget = ({
|
|
|
13686
13792
|
if (/internal json-rpc error|internal rpc error/i.test(errMessage)) {
|
|
13687
13793
|
toast11.error(
|
|
13688
13794
|
"Internal RPC error while approving. Please try again. If this keeps happening, contact support for assistance.",
|
|
13689
|
-
{ icon: /* @__PURE__ */
|
|
13795
|
+
{ icon: /* @__PURE__ */ jsx100(Error_default, {}) }
|
|
13690
13796
|
);
|
|
13691
13797
|
return;
|
|
13692
13798
|
}
|
|
13693
13799
|
logger_default.error("[TransferWidget] approval failed", err);
|
|
13694
13800
|
toast11.error(
|
|
13695
13801
|
"Failed to approve the token allowance. Please contact support for assistance.",
|
|
13696
|
-
{ icon: /* @__PURE__ */
|
|
13802
|
+
{ icon: /* @__PURE__ */ jsx100(Error_default, {}) }
|
|
13697
13803
|
);
|
|
13698
13804
|
} finally {
|
|
13699
13805
|
setApproving(false);
|
|
@@ -13720,11 +13826,11 @@ var TransferWidget = ({
|
|
|
13720
13826
|
logger_default.error("[TransferWidget] handleSubmit failed", err);
|
|
13721
13827
|
const msg = err?.message;
|
|
13722
13828
|
if (msg && String(msg).includes("Fees unavailable")) {
|
|
13723
|
-
toast11.error(String(msg), { icon: /* @__PURE__ */
|
|
13829
|
+
toast11.error(String(msg), { icon: /* @__PURE__ */ jsx100(Error_default, {}) });
|
|
13724
13830
|
} else {
|
|
13725
13831
|
toast11.error(
|
|
13726
13832
|
"An unexpected error occurred while submitting. Please contact support for assistance.",
|
|
13727
|
-
{ icon: /* @__PURE__ */
|
|
13833
|
+
{ icon: /* @__PURE__ */ jsx100(Error_default, {}) }
|
|
13728
13834
|
);
|
|
13729
13835
|
}
|
|
13730
13836
|
setIsSubmitting(false);
|
|
@@ -13745,7 +13851,7 @@ var TransferWidget = ({
|
|
|
13745
13851
|
void handleSubmit();
|
|
13746
13852
|
return;
|
|
13747
13853
|
}
|
|
13748
|
-
toast11.error(validationMessage, { icon: /* @__PURE__ */
|
|
13854
|
+
toast11.error(validationMessage, { icon: /* @__PURE__ */ jsx100(Error_default, {}) });
|
|
13749
13855
|
mainRef.current?.click();
|
|
13750
13856
|
};
|
|
13751
13857
|
const onBack = () => {
|
|
@@ -13773,7 +13879,7 @@ var TransferWidget = ({
|
|
|
13773
13879
|
logger_default.error("[TransferWidget] cancel approve failed", err);
|
|
13774
13880
|
toast11.error(
|
|
13775
13881
|
"Unable to cancel the approval. Please contact support for assistance.",
|
|
13776
|
-
{ icon: /* @__PURE__ */
|
|
13882
|
+
{ icon: /* @__PURE__ */ jsx100(Error_default, {}) }
|
|
13777
13883
|
);
|
|
13778
13884
|
}
|
|
13779
13885
|
} finally {
|
|
@@ -13800,8 +13906,8 @@ var TransferWidget = ({
|
|
|
13800
13906
|
const primaryButtonLabel = getButtonLabel();
|
|
13801
13907
|
const isSmallScreen = windowWidth > 0 && windowWidth <= 500;
|
|
13802
13908
|
const showPermit2Info = formStep === 1 && isPermit2Required && mode !== "light" /* light */ && dAppOption === "none" /* None */ && signature && !isApproved && (primaryButtonLabel === "Approve" || primaryButtonLabel === "Approving...");
|
|
13803
|
-
const permit2InfoTooltip = showPermit2Info ? /* @__PURE__ */
|
|
13804
|
-
/* @__PURE__ */
|
|
13909
|
+
const permit2InfoTooltip = showPermit2Info ? /* @__PURE__ */ jsxs61("div", { className: "permit2-button-info", ref: permit2TooltipRef, children: [
|
|
13910
|
+
/* @__PURE__ */ jsx100(
|
|
13805
13911
|
"button",
|
|
13806
13912
|
{
|
|
13807
13913
|
type: "button",
|
|
@@ -13818,23 +13924,23 @@ var TransferWidget = ({
|
|
|
13818
13924
|
children: "i"
|
|
13819
13925
|
}
|
|
13820
13926
|
),
|
|
13821
|
-
/* @__PURE__ */
|
|
13927
|
+
/* @__PURE__ */ jsxs61(
|
|
13822
13928
|
"div",
|
|
13823
13929
|
{
|
|
13824
13930
|
className: `permit2-tooltip ${theme.colorMode} ${isPermit2TooltipOpen ? "open" : ""}`,
|
|
13825
13931
|
children: [
|
|
13826
|
-
/* @__PURE__ */
|
|
13827
|
-
/* @__PURE__ */
|
|
13932
|
+
/* @__PURE__ */ jsx100("p", { children: PERMIT2_INFO_MESSAGE }),
|
|
13933
|
+
/* @__PURE__ */ jsx100(ExternalLink_default, { className: "permit2-tooltip-link", to: PERMIT2_DOCS_URL, children: "Learn more" })
|
|
13828
13934
|
]
|
|
13829
13935
|
}
|
|
13830
13936
|
)
|
|
13831
13937
|
] }) : null;
|
|
13832
|
-
|
|
13938
|
+
useEffect29(() => {
|
|
13833
13939
|
if (!showPermit2Info && isPermit2TooltipOpen) {
|
|
13834
13940
|
setPermit2TooltipOpen(false);
|
|
13835
13941
|
}
|
|
13836
13942
|
}, [showPermit2Info, isPermit2TooltipOpen]);
|
|
13837
|
-
|
|
13943
|
+
useEffect29(() => {
|
|
13838
13944
|
if (!isSmallScreen && isPermit2TooltipOpen) {
|
|
13839
13945
|
setPermit2TooltipOpen(false);
|
|
13840
13946
|
}
|
|
@@ -13865,11 +13971,11 @@ var TransferWidget = ({
|
|
|
13865
13971
|
logger_default.error("[TransferWidget] reset failed", e);
|
|
13866
13972
|
toast11.error(
|
|
13867
13973
|
"Unable to reset the form. Please contact support for assistance.",
|
|
13868
|
-
{ icon: /* @__PURE__ */
|
|
13974
|
+
{ icon: /* @__PURE__ */ jsx100(Error_default, {}) }
|
|
13869
13975
|
);
|
|
13870
13976
|
}
|
|
13871
13977
|
};
|
|
13872
|
-
return /* @__PURE__ */
|
|
13978
|
+
return /* @__PURE__ */ jsxs61(
|
|
13873
13979
|
"div",
|
|
13874
13980
|
{
|
|
13875
13981
|
className: `kima-card ${theme.colorMode}`,
|
|
@@ -13877,7 +13983,7 @@ var TransferWidget = ({
|
|
|
13877
13983
|
background: theme.colorMode === "light" /* light */ ? theme.backgroundColorLight : theme.backgroundColorDark
|
|
13878
13984
|
},
|
|
13879
13985
|
children: [
|
|
13880
|
-
resetModalOpen && /* @__PURE__ */
|
|
13986
|
+
resetModalOpen && /* @__PURE__ */ jsx100(
|
|
13881
13987
|
WarningModal_default,
|
|
13882
13988
|
{
|
|
13883
13989
|
message: "Are you sure you want to reset the widget?",
|
|
@@ -13889,7 +13995,7 @@ var TransferWidget = ({
|
|
|
13889
13995
|
onCancel: () => setResetModalOpen(false)
|
|
13890
13996
|
}
|
|
13891
13997
|
),
|
|
13892
|
-
warningModalOpen && /* @__PURE__ */
|
|
13998
|
+
warningModalOpen && /* @__PURE__ */ jsx100(
|
|
13893
13999
|
WarningModal_default,
|
|
13894
14000
|
{
|
|
13895
14001
|
message: warningModalOpen.message,
|
|
@@ -13903,21 +14009,22 @@ var TransferWidget = ({
|
|
|
13903
14009
|
}
|
|
13904
14010
|
}
|
|
13905
14011
|
),
|
|
13906
|
-
mode === "payment" /* payment */ && !transactionOption && /* @__PURE__ */
|
|
13907
|
-
/* @__PURE__ */
|
|
13908
|
-
|
|
13909
|
-
|
|
13910
|
-
|
|
13911
|
-
/* @__PURE__ */
|
|
13912
|
-
|
|
14012
|
+
mode === "payment" /* payment */ && !transactionOption && /* @__PURE__ */ jsx100("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." }),
|
|
14013
|
+
/* @__PURE__ */ jsx100(VersionInfo_default, { theme }),
|
|
14014
|
+
/* @__PURE__ */ jsxs61("div", { className: "transfer-card", children: [
|
|
14015
|
+
/* @__PURE__ */ jsxs61("div", { className: "kima-card-header", children: [
|
|
14016
|
+
/* @__PURE__ */ jsxs61("div", { className: "topbar", children: [
|
|
14017
|
+
/* @__PURE__ */ jsx100("div", { className: "title", children: /* @__PURE__ */ jsx100("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") }) }),
|
|
14018
|
+
/* @__PURE__ */ jsxs61("div", { className: "control-buttons", children: [
|
|
14019
|
+
/* @__PURE__ */ jsx100(
|
|
13913
14020
|
ExternalLink_default,
|
|
13914
14021
|
{
|
|
13915
14022
|
to: helpURL ? helpURL : networkOption === "testnet" /* testnet */ ? "https://docs.kima.network/kima-network/try-kima-with-the-demo-app" : "https://support.kima.network",
|
|
13916
|
-
children: /* @__PURE__ */
|
|
14023
|
+
children: /* @__PURE__ */ jsx100("div", { className: "menu-button", children: "I need help" })
|
|
13917
14024
|
}
|
|
13918
14025
|
),
|
|
13919
|
-
["BANK", "CC"].includes(sourceChain.shortName) && formStep > 0 && /* @__PURE__ */
|
|
13920
|
-
formStep === 0 && mode !== "payment" /* payment */ && /* @__PURE__ */
|
|
14026
|
+
["BANK", "CC"].includes(sourceChain.shortName) && formStep > 0 && /* @__PURE__ */ jsx100(ExternalLink_default, { to: "https://docs.kima.network/kima-network/supported-fiat#unsupported-countries-credit-cards", children: /* @__PURE__ */ jsx100("div", { className: "menu-button", children: "Unsupported Countries" }) }),
|
|
14027
|
+
formStep === 0 && mode !== "payment" /* payment */ && /* @__PURE__ */ jsx100(
|
|
13921
14028
|
"button",
|
|
13922
14029
|
{
|
|
13923
14030
|
className: "reset-button",
|
|
@@ -13926,32 +14033,32 @@ var TransferWidget = ({
|
|
|
13926
14033
|
children: "Reset"
|
|
13927
14034
|
}
|
|
13928
14035
|
),
|
|
13929
|
-
toastHistory.length > 0 && /* @__PURE__ */
|
|
14036
|
+
toastHistory.length > 0 && /* @__PURE__ */ jsxs61(
|
|
13930
14037
|
"div",
|
|
13931
14038
|
{
|
|
13932
14039
|
ref: toastPanelRef,
|
|
13933
14040
|
className: `toast-history ${theme.colorMode}`,
|
|
13934
14041
|
children: [
|
|
13935
|
-
/* @__PURE__ */
|
|
14042
|
+
/* @__PURE__ */ jsx100(
|
|
13936
14043
|
"button",
|
|
13937
14044
|
{
|
|
13938
14045
|
className: "toast-history-button",
|
|
13939
14046
|
onClick: () => setToastPanelOpen(true),
|
|
13940
14047
|
"aria-label": "Notifications",
|
|
13941
|
-
children: /* @__PURE__ */
|
|
14048
|
+
children: /* @__PURE__ */ jsx100(Notification_default, { width: 30, height: 30 })
|
|
13942
14049
|
}
|
|
13943
14050
|
),
|
|
13944
|
-
toastPanelOpen && /* @__PURE__ */
|
|
13945
|
-
/* @__PURE__ */
|
|
13946
|
-
/* @__PURE__ */
|
|
13947
|
-
/* @__PURE__ */
|
|
13948
|
-
/* @__PURE__ */
|
|
14051
|
+
toastPanelOpen && /* @__PURE__ */ jsxs61("div", { className: `toast-history-panel ${theme.colorMode}`, children: [
|
|
14052
|
+
/* @__PURE__ */ jsx100("div", { className: "toast-history-header", children: /* @__PURE__ */ jsx100("span", { children: "Notifications" }) }),
|
|
14053
|
+
/* @__PURE__ */ jsx100("div", { className: "toast-history-list", children: toastHistory.map((item) => /* @__PURE__ */ jsxs61("div", { className: "toast-history-item", children: [
|
|
14054
|
+
/* @__PURE__ */ jsx100("span", { className: "toast-history-message", children: item.message }),
|
|
14055
|
+
/* @__PURE__ */ jsx100("span", { className: "toast-history-time", children: formatToastTime(item.time) })
|
|
13949
14056
|
] }, item.id)) })
|
|
13950
14057
|
] })
|
|
13951
14058
|
]
|
|
13952
14059
|
}
|
|
13953
14060
|
),
|
|
13954
|
-
closeHandler && /* @__PURE__ */
|
|
14061
|
+
closeHandler && /* @__PURE__ */ jsx100(
|
|
13955
14062
|
"button",
|
|
13956
14063
|
{
|
|
13957
14064
|
className: "cross-icon-button",
|
|
@@ -13959,14 +14066,14 @@ var TransferWidget = ({
|
|
|
13959
14066
|
resetForm();
|
|
13960
14067
|
closeHandler(0);
|
|
13961
14068
|
},
|
|
13962
|
-
children: /* @__PURE__ */
|
|
14069
|
+
children: /* @__PURE__ */ jsx100(Cross_default, {})
|
|
13963
14070
|
}
|
|
13964
14071
|
)
|
|
13965
14072
|
] })
|
|
13966
14073
|
] }),
|
|
13967
|
-
mode === "payment" /* payment */ && paymentTitleOption?.title && /* @__PURE__ */
|
|
14074
|
+
mode === "payment" /* payment */ && paymentTitleOption?.title && /* @__PURE__ */ jsx100("h4", { className: "subtitle", children: paymentTitleOption.title })
|
|
13968
14075
|
] }),
|
|
13969
|
-
/* @__PURE__ */
|
|
14076
|
+
/* @__PURE__ */ jsx100("div", { className: "kima-card-content", ref: mainRef, children: formStep === 0 ? /* @__PURE__ */ jsx100(
|
|
13970
14077
|
SingleForm_default,
|
|
13971
14078
|
{
|
|
13972
14079
|
...{
|
|
@@ -13980,7 +14087,7 @@ var TransferWidget = ({
|
|
|
13980
14087
|
setInitialSelection
|
|
13981
14088
|
}
|
|
13982
14089
|
}
|
|
13983
|
-
) : ccTransactionStatus !== "idle" ? /* @__PURE__ */
|
|
14090
|
+
) : ccTransactionStatus !== "idle" ? /* @__PURE__ */ jsx100(FiatWidget_default, { submitCallback: submit }) : /* @__PURE__ */ jsx100(
|
|
13984
14091
|
ConfirmDetails_default,
|
|
13985
14092
|
{
|
|
13986
14093
|
...{
|
|
@@ -13989,12 +14096,12 @@ var TransferWidget = ({
|
|
|
13989
14096
|
}
|
|
13990
14097
|
}
|
|
13991
14098
|
) }),
|
|
13992
|
-
/* @__PURE__ */
|
|
14099
|
+
/* @__PURE__ */ jsx100(
|
|
13993
14100
|
"div",
|
|
13994
14101
|
{
|
|
13995
14102
|
className: `kima-card-footer ${mode === "bridge" /* bridge */ && formStep !== 0 && "confirm"}`,
|
|
13996
|
-
children: /* @__PURE__ */
|
|
13997
|
-
isBackButtonEnabled && /* @__PURE__ */
|
|
14103
|
+
children: /* @__PURE__ */ jsxs61("div", { className: "button-group", children: [
|
|
14104
|
+
isBackButtonEnabled && /* @__PURE__ */ jsx100(
|
|
13998
14105
|
SecondaryButton_default,
|
|
13999
14106
|
{
|
|
14000
14107
|
clickHandler: onBack,
|
|
@@ -14003,7 +14110,7 @@ var TransferWidget = ({
|
|
|
14003
14110
|
children: formStep > 0 && ccTransactionStatus !== "initialized" ? "Back" : "Cancel"
|
|
14004
14111
|
}
|
|
14005
14112
|
),
|
|
14006
|
-
(!!allowance && allowance > 0n || isPermit2Required && !!permit2Signature) && formStep !== 0 && !["BANK", "CC", "BTC"].includes(sourceChain.shortName) && mode !== "light" /* light */ && /* @__PURE__ */
|
|
14113
|
+
(!!allowance && allowance > 0n || isPermit2Required && !!permit2Signature) && formStep !== 0 && !["BANK", "CC", "BTC"].includes(sourceChain.shortName) && mode !== "light" /* light */ && /* @__PURE__ */ jsx100(
|
|
14007
14114
|
SecondaryButton_default,
|
|
14008
14115
|
{
|
|
14009
14116
|
clickHandler: onCancelApprove,
|
|
@@ -14013,7 +14120,7 @@ var TransferWidget = ({
|
|
|
14013
14120
|
children: isCancellingApprove ? "Cancelling Approval" : "Cancel Approve"
|
|
14014
14121
|
}
|
|
14015
14122
|
),
|
|
14016
|
-
isSubmitButtonEnabled && /* @__PURE__ */
|
|
14123
|
+
isSubmitButtonEnabled && /* @__PURE__ */ jsx100(
|
|
14017
14124
|
PrimaryButton_default,
|
|
14018
14125
|
{
|
|
14019
14126
|
clickHandler: onNext,
|
|
@@ -14026,10 +14133,10 @@ var TransferWidget = ({
|
|
|
14026
14133
|
] })
|
|
14027
14134
|
}
|
|
14028
14135
|
),
|
|
14029
|
-
/* @__PURE__ */
|
|
14030
|
-
/* @__PURE__ */
|
|
14031
|
-
/* @__PURE__ */
|
|
14032
|
-
/* @__PURE__ */
|
|
14136
|
+
/* @__PURE__ */ jsx100(SolanaConnectModal_default, {}),
|
|
14137
|
+
/* @__PURE__ */ jsx100(TronWalletConnectModal_default, {}),
|
|
14138
|
+
/* @__PURE__ */ jsx100(BtcConnectModal_default, {}),
|
|
14139
|
+
/* @__PURE__ */ jsx100(
|
|
14033
14140
|
Toaster2,
|
|
14034
14141
|
{
|
|
14035
14142
|
position: "top-right",
|
|
@@ -14053,9 +14160,9 @@ var TransferWidget = ({
|
|
|
14053
14160
|
}
|
|
14054
14161
|
}
|
|
14055
14162
|
),
|
|
14056
|
-
/* @__PURE__ */
|
|
14057
|
-
/* @__PURE__ */
|
|
14058
|
-
/* @__PURE__ */
|
|
14163
|
+
/* @__PURE__ */ jsx100("div", { className: "floating-footer", children: /* @__PURE__ */ jsxs61("div", { className: `items ${theme.colorMode}`, children: [
|
|
14164
|
+
/* @__PURE__ */ jsx100("span", { children: "Powered by" }),
|
|
14165
|
+
/* @__PURE__ */ jsx100(KimaNetwork_default, {})
|
|
14059
14166
|
] }) })
|
|
14060
14167
|
] })
|
|
14061
14168
|
]
|
|
@@ -14064,7 +14171,7 @@ var TransferWidget = ({
|
|
|
14064
14171
|
};
|
|
14065
14172
|
|
|
14066
14173
|
// src/widgets/common/KimaWidgetWrapper.tsx
|
|
14067
|
-
import { jsx as
|
|
14174
|
+
import { jsx as jsx101 } from "react/jsx-runtime";
|
|
14068
14175
|
var KimaWidgetWrapper = ({
|
|
14069
14176
|
mode,
|
|
14070
14177
|
txId,
|
|
@@ -14093,7 +14200,7 @@ var KimaWidgetWrapper = ({
|
|
|
14093
14200
|
const kimaExplorer = envOptions?.kimaExplorer || "https://explorer.sardis.kima.network";
|
|
14094
14201
|
const { currentPlugin } = useGetCurrentPlugin_default();
|
|
14095
14202
|
const prevColorMode = useRef12(void 0);
|
|
14096
|
-
|
|
14203
|
+
useEffect30(() => {
|
|
14097
14204
|
if (prevColorMode.current !== theme?.colorMode) {
|
|
14098
14205
|
dispatch(setTheme(theme));
|
|
14099
14206
|
setThemeMode(
|
|
@@ -14116,7 +14223,7 @@ var KimaWidgetWrapper = ({
|
|
|
14116
14223
|
excludedSourceNetworksJson: "",
|
|
14117
14224
|
excludedTargetNetworksJson: ""
|
|
14118
14225
|
});
|
|
14119
|
-
|
|
14226
|
+
useEffect30(() => {
|
|
14120
14227
|
const excludedSourceNetworksJson = JSON.stringify(excludedSourceNetworks);
|
|
14121
14228
|
const excludedTargetNetworksJson = JSON.stringify(excludedTargetNetworks);
|
|
14122
14229
|
if (prevConfigRef.current.compliantOption !== compliantOption) {
|
|
@@ -14162,7 +14269,7 @@ var KimaWidgetWrapper = ({
|
|
|
14162
14269
|
excludedTargetNetworks,
|
|
14163
14270
|
dispatch
|
|
14164
14271
|
]);
|
|
14165
|
-
|
|
14272
|
+
useEffect30(() => {
|
|
14166
14273
|
const activeTransactionOption = mode === "payment" /* payment */ ? transactionOption : void 0;
|
|
14167
14274
|
const nextJson = activeTransactionOption ? JSON.stringify(transactionOption) : null;
|
|
14168
14275
|
const storedJson = storedTransactionOption ? JSON.stringify(storedTransactionOption) : null;
|
|
@@ -14193,7 +14300,7 @@ var KimaWidgetWrapper = ({
|
|
|
14193
14300
|
}, [transactionOption, storedTransactionOption, mode, chainData, dispatch]);
|
|
14194
14301
|
const prevModeRef = useRef12(void 0);
|
|
14195
14302
|
const prevTxIdRef = useRef12(void 0);
|
|
14196
|
-
|
|
14303
|
+
useEffect30(() => {
|
|
14197
14304
|
const modeChanged = prevModeRef.current !== mode;
|
|
14198
14305
|
const txChanged = prevTxIdRef.current !== txId;
|
|
14199
14306
|
if (mode === "payment" /* payment */ && !transactionOption) {
|
|
@@ -14224,7 +14331,7 @@ var KimaWidgetWrapper = ({
|
|
|
14224
14331
|
prevTxIdRef.current = txId;
|
|
14225
14332
|
}
|
|
14226
14333
|
}, [mode, txId, transactionOption, dispatch]);
|
|
14227
|
-
|
|
14334
|
+
useEffect30(() => {
|
|
14228
14335
|
logger_default.debug("[KimaWidgetWrapper] render", {
|
|
14229
14336
|
mode,
|
|
14230
14337
|
dAppOption,
|
|
@@ -14240,10 +14347,10 @@ var KimaWidgetWrapper = ({
|
|
|
14240
14347
|
}, [currentPlugin?.id, sourceChain?.shortName]);
|
|
14241
14348
|
const content = useMemo49(() => {
|
|
14242
14349
|
if (mode === "status" /* status */) {
|
|
14243
|
-
return /* @__PURE__ */
|
|
14350
|
+
return /* @__PURE__ */ jsx101(TransactionWidget, { theme });
|
|
14244
14351
|
}
|
|
14245
14352
|
if (!currentPlugin && !sourceChain?.shortName) {
|
|
14246
|
-
return /* @__PURE__ */
|
|
14353
|
+
return /* @__PURE__ */ jsx101(
|
|
14247
14354
|
TransferWidget,
|
|
14248
14355
|
{
|
|
14249
14356
|
theme,
|
|
@@ -14255,15 +14362,15 @@ var KimaWidgetWrapper = ({
|
|
|
14255
14362
|
);
|
|
14256
14363
|
}
|
|
14257
14364
|
if (!currentPlugin) {
|
|
14258
|
-
return /* @__PURE__ */
|
|
14365
|
+
return /* @__PURE__ */ jsx101(SkeletonLoader_default, { theme });
|
|
14259
14366
|
}
|
|
14260
14367
|
if (sourceChain.shortName === "CC") {
|
|
14261
14368
|
if (submitted) {
|
|
14262
14369
|
logger_default.debug("[KimaWidgetWrapper] CC mode -> TransactionWidget");
|
|
14263
|
-
return /* @__PURE__ */
|
|
14370
|
+
return /* @__PURE__ */ jsx101(TransactionWidget, { theme });
|
|
14264
14371
|
}
|
|
14265
14372
|
if (ccTransactionStatus === "error-id") {
|
|
14266
|
-
return /* @__PURE__ */
|
|
14373
|
+
return /* @__PURE__ */ jsx101(
|
|
14267
14374
|
ErrorWidget_default,
|
|
14268
14375
|
{
|
|
14269
14376
|
theme,
|
|
@@ -14278,7 +14385,7 @@ var KimaWidgetWrapper = ({
|
|
|
14278
14385
|
);
|
|
14279
14386
|
}
|
|
14280
14387
|
if (ccTransactionStatus === "error-generic") {
|
|
14281
|
-
return /* @__PURE__ */
|
|
14388
|
+
return /* @__PURE__ */ jsx101(
|
|
14282
14389
|
ErrorWidget_default,
|
|
14283
14390
|
{
|
|
14284
14391
|
theme,
|
|
@@ -14292,7 +14399,7 @@ var KimaWidgetWrapper = ({
|
|
|
14292
14399
|
}
|
|
14293
14400
|
);
|
|
14294
14401
|
}
|
|
14295
|
-
return /* @__PURE__ */
|
|
14402
|
+
return /* @__PURE__ */ jsx101(
|
|
14296
14403
|
TransferWidget,
|
|
14297
14404
|
{
|
|
14298
14405
|
theme,
|
|
@@ -14307,7 +14414,7 @@ var KimaWidgetWrapper = ({
|
|
|
14307
14414
|
"[KimaWidgetWrapper] rendering TransferWidget with plugin",
|
|
14308
14415
|
currentPlugin?.id
|
|
14309
14416
|
);
|
|
14310
|
-
return submitted ? /* @__PURE__ */
|
|
14417
|
+
return submitted ? /* @__PURE__ */ jsx101(TransactionWidget, { theme }) : /* @__PURE__ */ jsx101(
|
|
14311
14418
|
TransferWidget,
|
|
14312
14419
|
{
|
|
14313
14420
|
theme,
|
|
@@ -14336,7 +14443,7 @@ var KimaWidgetWrapper = ({
|
|
|
14336
14443
|
var KimaWidgetWrapper_default = KimaWidgetWrapper;
|
|
14337
14444
|
|
|
14338
14445
|
// src/widgets/common/KimaTransactionWidget.tsx
|
|
14339
|
-
import { jsx as
|
|
14446
|
+
import { jsx as jsx102 } from "react/jsx-runtime";
|
|
14340
14447
|
var KimaTransactionWidget = ({
|
|
14341
14448
|
mode,
|
|
14342
14449
|
txId,
|
|
@@ -14352,7 +14459,7 @@ var KimaTransactionWidget = ({
|
|
|
14352
14459
|
}) => {
|
|
14353
14460
|
const dispatch = useDispatch33();
|
|
14354
14461
|
const { kimaBackendUrl } = useKimaContext();
|
|
14355
|
-
const [hydrated, setHydrated] =
|
|
14462
|
+
const [hydrated, setHydrated] = useState17(false);
|
|
14356
14463
|
const {
|
|
14357
14464
|
data: envOptions,
|
|
14358
14465
|
error: envOptionsError,
|
|
@@ -14363,20 +14470,20 @@ var KimaTransactionWidget = ({
|
|
|
14363
14470
|
error: chainDataError,
|
|
14364
14471
|
isLoading: isLoadingChainData
|
|
14365
14472
|
} = useChainData(kimaBackendUrl);
|
|
14366
|
-
|
|
14473
|
+
useEffect31(() => {
|
|
14367
14474
|
if (typeof window !== "undefined") setHydrated(true);
|
|
14368
14475
|
}, []);
|
|
14369
|
-
|
|
14476
|
+
useEffect31(() => {
|
|
14370
14477
|
if (theme?.colorMode) {
|
|
14371
14478
|
dispatch(setTheme(theme));
|
|
14372
14479
|
}
|
|
14373
14480
|
}, [theme?.colorMode, dispatch, theme]);
|
|
14374
14481
|
if (!hydrated || !theme?.colorMode)
|
|
14375
|
-
return /* @__PURE__ */
|
|
14482
|
+
return /* @__PURE__ */ jsx102(ring_default, { width: 20, height: 20, fill: "#86b8ce" });
|
|
14376
14483
|
if (isLoadingEnvs || isLoadingChainData)
|
|
14377
|
-
return /* @__PURE__ */
|
|
14484
|
+
return /* @__PURE__ */ jsx102(SkeletonLoader_default, { theme });
|
|
14378
14485
|
if (envOptionsError || !envOptions)
|
|
14379
|
-
return /* @__PURE__ */
|
|
14486
|
+
return /* @__PURE__ */ jsx102(
|
|
14380
14487
|
ErrorWidget_default,
|
|
14381
14488
|
{
|
|
14382
14489
|
theme,
|
|
@@ -14385,7 +14492,7 @@ var KimaTransactionWidget = ({
|
|
|
14385
14492
|
}
|
|
14386
14493
|
);
|
|
14387
14494
|
if (chainDataError || !chainData)
|
|
14388
|
-
return /* @__PURE__ */
|
|
14495
|
+
return /* @__PURE__ */ jsx102(
|
|
14389
14496
|
ErrorWidget_default,
|
|
14390
14497
|
{
|
|
14391
14498
|
theme,
|
|
@@ -14393,7 +14500,7 @@ var KimaTransactionWidget = ({
|
|
|
14393
14500
|
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 */
|
|
14394
14501
|
}
|
|
14395
14502
|
);
|
|
14396
|
-
return /* @__PURE__ */
|
|
14503
|
+
return /* @__PURE__ */ jsx102(ToastHistoryProvider, { children: /* @__PURE__ */ jsx102(
|
|
14397
14504
|
KimaWidgetWrapper_default,
|
|
14398
14505
|
{
|
|
14399
14506
|
...{
|
|
@@ -14434,8 +14541,6 @@ export {
|
|
|
14434
14541
|
NetworkOptions,
|
|
14435
14542
|
SOLANA_HOST,
|
|
14436
14543
|
TransactionStatus,
|
|
14437
|
-
isSolProvider,
|
|
14438
|
-
isTronProvider,
|
|
14439
14544
|
lightDemoAccounts,
|
|
14440
14545
|
lightDemoNetworks
|
|
14441
14546
|
};
|