@kimafinance/kima-transaction-widget 1.3.10 → 1.3.12
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/dist/index.cjs +21 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.css +18 -0
- package/dist/index.css.map +1 -1
- package/dist/index.js +21 -13
- 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
|
@@ -2774,12 +2774,14 @@ function useEvmAllowance() {
|
|
|
2774
2774
|
const appkitAccountInfo = useAppKitAccount4();
|
|
2775
2775
|
const sourceChain = useSelector4(selectSourceChain);
|
|
2776
2776
|
const networkOption = useSelector4(selectNetworkOption);
|
|
2777
|
-
const { totalFeeUsd, allowanceAmount, decimals } = useSelector4(selectServiceFee);
|
|
2777
|
+
const { totalFeeUsd, allowanceAmount, submitAmount, decimals } = useSelector4(selectServiceFee);
|
|
2778
2778
|
const selectedCoin = useSelector4(selectSourceCurrency);
|
|
2779
2779
|
const tokenOptions = useSelector4(selectTokenOptions);
|
|
2780
2780
|
const backendUrl = useSelector4(selectBackendUrl);
|
|
2781
2781
|
const feeDeduct = useSelector4(selectFeeDeduct);
|
|
2782
|
-
const allowanceNumber = Number(
|
|
2782
|
+
const allowanceNumber = Number(
|
|
2783
|
+
formatUnits4(feeDeduct ? submitAmount : allowanceAmount ?? "0", decimals)
|
|
2784
|
+
);
|
|
2783
2785
|
const amount = useSelector4(selectAmount);
|
|
2784
2786
|
const { pools } = useGetPools_default(backendUrl, networkOption);
|
|
2785
2787
|
const walletAddress = externalProvider?.signer?.address || appkitAccountInfo?.address;
|
|
@@ -2823,7 +2825,7 @@ function useEvmAllowance() {
|
|
|
2823
2825
|
});
|
|
2824
2826
|
return await walletClient.signMessage({
|
|
2825
2827
|
account: walletAddress,
|
|
2826
|
-
message: `I approve
|
|
2828
|
+
message: `I approve the transfer of ${allowanceNumber} ${data.originSymbol} from ${data.originChain} to ${data.targetAddress} on ${data.targetChain}.`
|
|
2827
2829
|
});
|
|
2828
2830
|
} catch (error) {
|
|
2829
2831
|
console.error("useEvmAllowance: Error on signing message:", error);
|
|
@@ -3095,10 +3097,13 @@ import { PublicKey as PublicKey5, Transaction } from "@solana/web3.js";
|
|
|
3095
3097
|
import { formatUnits as formatUnits5 } from "ethers";
|
|
3096
3098
|
function useSolanaAllowance() {
|
|
3097
3099
|
const sourceChain = useSelector6(selectSourceChain);
|
|
3098
|
-
const { allowanceAmount, decimals } = useSelector6(selectServiceFee);
|
|
3100
|
+
const { allowanceAmount, submitAmount, decimals } = useSelector6(selectServiceFee);
|
|
3101
|
+
const feeDeduct = useSelector6(selectFeeDeduct);
|
|
3099
3102
|
const backendUrl = useSelector6(selectBackendUrl);
|
|
3100
3103
|
const networkOption = useSelector6(selectNetworkOption);
|
|
3101
|
-
const allowanceNumber = Number(
|
|
3104
|
+
const allowanceNumber = Number(
|
|
3105
|
+
formatUnits5(feeDeduct ? submitAmount : allowanceAmount ?? "0", decimals)
|
|
3106
|
+
);
|
|
3102
3107
|
const { externalProvider } = useKimaContext();
|
|
3103
3108
|
const { connection: internalConnection } = useConnection2();
|
|
3104
3109
|
const {
|
|
@@ -3148,7 +3153,7 @@ function useSolanaAllowance() {
|
|
|
3148
3153
|
return;
|
|
3149
3154
|
}
|
|
3150
3155
|
try {
|
|
3151
|
-
const message = `I approve
|
|
3156
|
+
const message = `I approve the transfer of ${allowanceNumber} ${data.originSymbol} from ${data.originChain} to ${data.targetAddress} on ${data.targetChain}.`;
|
|
3152
3157
|
const encodedMessage = new TextEncoder().encode(message);
|
|
3153
3158
|
const signature = await signMessage(encodedMessage);
|
|
3154
3159
|
return `0x${Buffer.from(signature).toString("hex")}`;
|
|
@@ -3688,11 +3693,14 @@ function useTronAllowance() {
|
|
|
3688
3693
|
const sourceChain = useSelector9(selectSourceChain);
|
|
3689
3694
|
const networkOption = useSelector9(selectNetworkOption);
|
|
3690
3695
|
const backendUrl = useSelector9(selectBackendUrl);
|
|
3691
|
-
const { allowanceAmount, decimals } = useSelector9(selectServiceFee);
|
|
3696
|
+
const { allowanceAmount, submitAmount, decimals } = useSelector9(selectServiceFee);
|
|
3692
3697
|
useTronWallet();
|
|
3693
3698
|
const selectedCoin = useSelector9(selectSourceCurrency);
|
|
3694
3699
|
const tokenOptions = useSelector9(selectTokenOptions);
|
|
3695
|
-
const
|
|
3700
|
+
const feeDeduct = useSelector9(selectFeeDeduct);
|
|
3701
|
+
const allowanceNumber = Number(
|
|
3702
|
+
formatUnits7(feeDeduct ? submitAmount : allowanceAmount ?? "0", decimals)
|
|
3703
|
+
);
|
|
3696
3704
|
const { pools } = useGetPools_default(backendUrl, networkOption);
|
|
3697
3705
|
const {
|
|
3698
3706
|
address: internalUserAddress,
|
|
@@ -3736,7 +3744,7 @@ function useTronAllowance() {
|
|
|
3736
3744
|
return;
|
|
3737
3745
|
}
|
|
3738
3746
|
try {
|
|
3739
|
-
const message = `I approve
|
|
3747
|
+
const message = `I approve the transfer of ${allowanceNumber} ${data.originSymbol} from ${data.originChain} to ${data.targetAddress} on ${data.targetChain}.`;
|
|
3740
3748
|
const signedMessage = await signMessage(message);
|
|
3741
3749
|
return signedMessage;
|
|
3742
3750
|
} catch (error2) {
|
|
@@ -6277,9 +6285,9 @@ var TransferWidget = ({
|
|
|
6277
6285
|
if (error === "ApprovalNeeded" /* ApprovalNeeded */) {
|
|
6278
6286
|
const sig2 = await signMessage?.({
|
|
6279
6287
|
targetAddress,
|
|
6280
|
-
targetChain: targetChain.
|
|
6288
|
+
targetChain: targetChain.shortName,
|
|
6281
6289
|
originSymbol: sourceCurrency,
|
|
6282
|
-
originChain: sourceChain.
|
|
6290
|
+
originChain: sourceChain.shortName
|
|
6283
6291
|
});
|
|
6284
6292
|
setSignature2(sig2);
|
|
6285
6293
|
return approve();
|
|
@@ -6292,9 +6300,9 @@ var TransferWidget = ({
|
|
|
6292
6300
|
if (!sig) {
|
|
6293
6301
|
sig = await signMessage?.({
|
|
6294
6302
|
targetAddress,
|
|
6295
|
-
targetChain: targetChain.
|
|
6303
|
+
targetChain: targetChain.shortName,
|
|
6296
6304
|
originSymbol: sourceCurrency,
|
|
6297
|
-
originChain: sourceChain.
|
|
6305
|
+
originChain: sourceChain.shortName
|
|
6298
6306
|
});
|
|
6299
6307
|
}
|
|
6300
6308
|
const { success, message: submitMessage } = await submitTransaction(sig);
|