@kimafinance/kima-transaction-widget 1.2.8-beta.1 → 1.2.10-beta.1
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/components/KimaTransactionWidget.d.ts +2 -1
- package/dist/components/TransferWidget.d.ts +2 -1
- package/dist/hooks/useServiceFee.d.ts +2 -2
- package/dist/index.css +12 -5
- package/dist/index.js +93 -28
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +82 -22
- package/dist/index.modern.js.map +1 -1
- package/dist/utils/constants.d.ts +1 -1
- package/package.json +1 -1
|
@@ -14,6 +14,7 @@ interface Props {
|
|
|
14
14
|
titleOption?: TitleOption;
|
|
15
15
|
compliantOption?: boolean;
|
|
16
16
|
helpURL?: string;
|
|
17
|
+
feeURL?: string;
|
|
17
18
|
transactionOption?: TransactionOption;
|
|
18
19
|
paymentTitleOption?: PaymentTitleOption;
|
|
19
20
|
kimaBackendUrl: string;
|
|
@@ -37,5 +38,5 @@ interface Props {
|
|
|
37
38
|
*
|
|
38
39
|
* @beta
|
|
39
40
|
*/
|
|
40
|
-
export declare const KimaTransactionWidget: ({ mode, txId, autoSwitchChain, defaultToken, provider, dAppOption, theme, titleOption, paymentTitleOption, useFIAT, helpURL, compliantOption, transactionOption, kimaBackendUrl, kimaNodeProviderQuery, kimaExplorer, errorHandler, closeHandler, successHandler, switchChainHandler, keplrHandler }: Props) => React.JSX.Element;
|
|
41
|
+
export declare const KimaTransactionWidget: ({ mode, txId, autoSwitchChain, defaultToken, provider, dAppOption, theme, titleOption, paymentTitleOption, useFIAT, helpURL, compliantOption, transactionOption, kimaBackendUrl, kimaNodeProviderQuery, kimaExplorer, feeURL, errorHandler, closeHandler, successHandler, switchChainHandler, keplrHandler }: Props) => React.JSX.Element;
|
|
41
42
|
export {};
|
|
@@ -3,9 +3,10 @@ import { PaymentTitleOption, ThemeOptions, TitleOption } from '../interface';
|
|
|
3
3
|
import '../index.css';
|
|
4
4
|
interface Props {
|
|
5
5
|
theme: ThemeOptions;
|
|
6
|
+
feeURL: string;
|
|
6
7
|
helpURL?: string;
|
|
7
8
|
titleOption?: TitleOption;
|
|
8
9
|
paymentTitleOption?: PaymentTitleOption;
|
|
9
10
|
}
|
|
10
|
-
export declare const TransferWidget: ({ theme, helpURL, titleOption, paymentTitleOption }: Props) => React.JSX.Element;
|
|
11
|
+
export declare const TransferWidget: ({ theme, feeURL, helpURL, titleOption, paymentTitleOption }: Props) => React.JSX.Element;
|
|
11
12
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export default function useServiceFee(isConfirming
|
|
2
|
-
serviceFee:
|
|
1
|
+
export default function useServiceFee(isConfirming: boolean | undefined, feeURL: string): {
|
|
2
|
+
serviceFee: any;
|
|
3
3
|
};
|
package/dist/index.css
CHANGED
|
@@ -944,11 +944,19 @@
|
|
|
944
944
|
}
|
|
945
945
|
}
|
|
946
946
|
.kima-card .kima-card-content .kima-custom-checkbox {
|
|
947
|
-
margin-left:
|
|
947
|
+
margin-left: 11.5em;
|
|
948
|
+
margin-top: 1em;
|
|
949
|
+
display: flex;
|
|
950
|
+
align-items: center;
|
|
951
|
+
}
|
|
952
|
+
.kima-card .kima-card-content .kima-custom-checkbox .content {
|
|
948
953
|
display: flex;
|
|
949
954
|
align-items: center;
|
|
955
|
+
-moz-column-gap: 0.5em;
|
|
956
|
+
column-gap: 0.5em;
|
|
957
|
+
cursor: pointer;
|
|
950
958
|
}
|
|
951
|
-
.kima-card .kima-card-content .kima-custom-checkbox .icon-wrapper {
|
|
959
|
+
.kima-card .kima-card-content .kima-custom-checkbox .content .icon-wrapper {
|
|
952
960
|
border: 1px solid #ffffff;
|
|
953
961
|
height: 1em;
|
|
954
962
|
width: 1em;
|
|
@@ -956,12 +964,11 @@
|
|
|
956
964
|
display: flex;
|
|
957
965
|
justify-content: center;
|
|
958
966
|
align-items: center;
|
|
959
|
-
cursor: pointer;
|
|
960
967
|
}
|
|
961
|
-
.kima-card .kima-card-content .kima-custom-checkbox .icon-wrapper.light {
|
|
968
|
+
.kima-card .kima-card-content .kima-custom-checkbox .content .icon-wrapper.light {
|
|
962
969
|
border-color: #4f5156;
|
|
963
970
|
}
|
|
964
|
-
.kima-card .kima-card-content .kima-custom-checkbox .icon-wrapper svg {
|
|
971
|
+
.kima-card .kima-card-content .kima-custom-checkbox .content .icon-wrapper svg {
|
|
965
972
|
margin-top: 0.2em;
|
|
966
973
|
margin-left: 1px;
|
|
967
974
|
}
|
package/dist/index.js
CHANGED
|
@@ -56,12 +56,11 @@ function _setPrototypeOf(o, p) {
|
|
|
56
56
|
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
57
57
|
if (source == null) return {};
|
|
58
58
|
var target = {};
|
|
59
|
-
var
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
target[key] = source[key];
|
|
59
|
+
for (var key in source) {
|
|
60
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
61
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
62
|
+
target[key] = source[key];
|
|
63
|
+
}
|
|
65
64
|
}
|
|
66
65
|
return target;
|
|
67
66
|
}
|
|
@@ -177,7 +176,7 @@ var Check = function Check(_ref) {
|
|
|
177
176
|
_ref$height = _ref.height,
|
|
178
177
|
height = _ref$height === void 0 ? 11 : _ref$height,
|
|
179
178
|
_ref$fill = _ref.fill,
|
|
180
|
-
fill = _ref$fill === void 0 ? '#
|
|
179
|
+
fill = _ref$fill === void 0 ? '#03a932' : _ref$fill,
|
|
181
180
|
rest = _objectWithoutPropertiesLoose(_ref, _excluded$3);
|
|
182
181
|
return React__default.createElement("svg", Object.assign({
|
|
183
182
|
width: width,
|
|
@@ -760,7 +759,7 @@ var _CHAIN_NAMES_TO_IDS, _CHAIN_NAMES_TO_STRIN, _CHAIN_STRING_TO_NAME, _CHAIN_NA
|
|
|
760
759
|
var SupportedChainId;
|
|
761
760
|
(function (SupportedChainId) {
|
|
762
761
|
SupportedChainId[SupportedChainId["ETHEREUM"] = 11155111] = "ETHEREUM";
|
|
763
|
-
SupportedChainId[SupportedChainId["POLYGON"] =
|
|
762
|
+
SupportedChainId[SupportedChainId["POLYGON"] = 80002] = "POLYGON";
|
|
764
763
|
SupportedChainId[SupportedChainId["AVALANCHE"] = 43113] = "AVALANCHE";
|
|
765
764
|
SupportedChainId[SupportedChainId["BSC"] = 97] = "BSC";
|
|
766
765
|
SupportedChainId[SupportedChainId["ARBITRUM"] = 421614] = "ARBITRUM";
|
|
@@ -1106,6 +1105,7 @@ var _optionSlice$actions = optionSlice.actions,
|
|
|
1106
1105
|
setSwitchChainHandler = _optionSlice$actions.setSwitchChainHandler,
|
|
1107
1106
|
setServiceFee = _optionSlice$actions.setServiceFee,
|
|
1108
1107
|
setMode = _optionSlice$actions.setMode,
|
|
1108
|
+
setFeeDeduct = _optionSlice$actions.setFeeDeduct,
|
|
1109
1109
|
setBackendUrl = _optionSlice$actions.setBackendUrl,
|
|
1110
1110
|
setNodeProviderQuery = _optionSlice$actions.setNodeProviderQuery,
|
|
1111
1111
|
setTxId = _optionSlice$actions.setTxId,
|
|
@@ -1634,6 +1634,7 @@ function useNetworkOptions() {
|
|
|
1634
1634
|
});
|
|
1635
1635
|
}, function (e) {
|
|
1636
1636
|
console.log('rpc disconnected', e);
|
|
1637
|
+
toast__default.error('rpc disconnected');
|
|
1637
1638
|
});
|
|
1638
1639
|
return _temp && _temp.then ? _temp.then(function () {}) : void 0;
|
|
1639
1640
|
} catch (e) {
|
|
@@ -1699,6 +1700,7 @@ var Network = function Network(_ref) {
|
|
|
1699
1700
|
});
|
|
1700
1701
|
}, function (e) {
|
|
1701
1702
|
console.log('rpc disconnected', e);
|
|
1703
|
+
toast__default.error('rpc disconnected');
|
|
1702
1704
|
});
|
|
1703
1705
|
return _temp && _temp.then ? _temp.then(function () {}) : void 0;
|
|
1704
1706
|
} catch (e) {
|
|
@@ -2073,7 +2075,6 @@ function useIsWalletReady() {
|
|
|
2073
2075
|
if (autoSwitch) {
|
|
2074
2076
|
forceNetworkSwitch();
|
|
2075
2077
|
} else {
|
|
2076
|
-
console.log('autoSwitch', autoSwitch, evmChainId);
|
|
2077
2078
|
dispatch(setSourceChain(CHAIN_IDS_TO_NAMES[evmChainId || SupportedChainId.ETHEREUM]));
|
|
2078
2079
|
toast__default.success("Wallet connected to " + CHAIN_NAMES_TO_STRING[CHAIN_IDS_TO_NAMES[evmChainId || SupportedChainId.ETHEREUM]]);
|
|
2079
2080
|
}
|
|
@@ -2530,8 +2531,14 @@ function useBalance() {
|
|
|
2530
2531
|
var selectedCoin = reactRedux.useSelector(selectSelectedToken);
|
|
2531
2532
|
var tokenOptions = reactRedux.useSelector(selectTokenOptions);
|
|
2532
2533
|
var tokenAddress = React.useMemo(function () {
|
|
2533
|
-
if (isEmptyObject(tokenOptions)) return '';
|
|
2534
|
-
|
|
2534
|
+
if (isEmptyObject(tokenOptions) || sourceChain === exports.SupportNetworks.FIAT || tokenOptions) return '';
|
|
2535
|
+
if (tokenOptions && typeof tokenOptions === 'object') {
|
|
2536
|
+
var coinOptions = tokenOptions[selectedCoin];
|
|
2537
|
+
if (coinOptions && typeof coinOptions === 'object') {
|
|
2538
|
+
return tokenOptions[selectedCoin][sourceChain];
|
|
2539
|
+
}
|
|
2540
|
+
}
|
|
2541
|
+
return '';
|
|
2535
2542
|
}, [selectedCoin, sourceChain, tokenOptions]);
|
|
2536
2543
|
React.useEffect(function () {
|
|
2537
2544
|
(function () {
|
|
@@ -2757,6 +2764,7 @@ var NetworkDropdown = React__default.memo(function (_ref) {
|
|
|
2757
2764
|
return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
|
|
2758
2765
|
}, function (e) {
|
|
2759
2766
|
console.log('rpc disconnected', e);
|
|
2767
|
+
toast__default.error('rpc disconnected');
|
|
2760
2768
|
});
|
|
2761
2769
|
return _temp3 && _temp3.then ? _temp3.then(function () {}) : void 0;
|
|
2762
2770
|
} catch (e) {
|
|
@@ -2782,6 +2790,7 @@ var NetworkDropdown = React__default.memo(function (_ref) {
|
|
|
2782
2790
|
}
|
|
2783
2791
|
}, function (e) {
|
|
2784
2792
|
console.log('rpc disconnected', e);
|
|
2793
|
+
toast__default.error('rpc disconnected');
|
|
2785
2794
|
});
|
|
2786
2795
|
} catch (e) {
|
|
2787
2796
|
Promise.reject(e);
|
|
@@ -2932,6 +2941,23 @@ var AddressInput = function AddressInput() {
|
|
|
2932
2941
|
});
|
|
2933
2942
|
};
|
|
2934
2943
|
|
|
2944
|
+
var CustomCheckbox = function CustomCheckbox(_ref) {
|
|
2945
|
+
var text = _ref.text,
|
|
2946
|
+
checked = _ref.checked,
|
|
2947
|
+
setCheck = _ref.setCheck;
|
|
2948
|
+
var theme = reactRedux.useSelector(selectTheme);
|
|
2949
|
+
return React__default.createElement("div", {
|
|
2950
|
+
className: 'kima-custom-checkbox'
|
|
2951
|
+
}, React__default.createElement("div", {
|
|
2952
|
+
className: 'content',
|
|
2953
|
+
onClick: function onClick() {
|
|
2954
|
+
return setCheck(!checked);
|
|
2955
|
+
}
|
|
2956
|
+
}, React__default.createElement("div", {
|
|
2957
|
+
className: "icon-wrapper " + theme.colorMode
|
|
2958
|
+
}, checked && React__default.createElement(Check, null)), React__default.createElement("span", null, text)));
|
|
2959
|
+
};
|
|
2960
|
+
|
|
2935
2961
|
var CopyButton = function CopyButton(_ref) {
|
|
2936
2962
|
var text = _ref.text;
|
|
2937
2963
|
var _useState = React.useState(false),
|
|
@@ -3258,6 +3284,7 @@ var BankPopup = function BankPopup(_ref) {
|
|
|
3258
3284
|
console.log(kycResult);
|
|
3259
3285
|
if (!kycResult.length) {
|
|
3260
3286
|
console.log('failed to check kyc status');
|
|
3287
|
+
toast.toast.error('failed to check kyc status');
|
|
3261
3288
|
} else if (kycResult[0].status === 'approved') {
|
|
3262
3289
|
setVerifying(false);
|
|
3263
3290
|
dispatch(setKYCStatus('approved'));
|
|
@@ -3266,6 +3293,7 @@ var BankPopup = function BankPopup(_ref) {
|
|
|
3266
3293
|
});
|
|
3267
3294
|
}, function () {
|
|
3268
3295
|
console.log('failed to check kyc status');
|
|
3296
|
+
toast.toast.error('failed to check kyc status');
|
|
3269
3297
|
});
|
|
3270
3298
|
return Promise.resolve(_temp && _temp.then ? _temp.then(function () {}) : void 0);
|
|
3271
3299
|
} catch (e) {
|
|
@@ -3404,6 +3432,7 @@ var TransactionWidget = function TransactionWidget(_ref) {
|
|
|
3404
3432
|
}();
|
|
3405
3433
|
return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
|
|
3406
3434
|
}, function (e) {
|
|
3435
|
+
toast.toast.error('rpc disconnected');
|
|
3407
3436
|
console.log('rpc disconnected', e);
|
|
3408
3437
|
}));
|
|
3409
3438
|
} catch (e) {
|
|
@@ -3569,6 +3598,8 @@ var SingleForm = function SingleForm(_ref) {
|
|
|
3569
3598
|
var mode = reactRedux.useSelector(selectMode);
|
|
3570
3599
|
var theme = reactRedux.useSelector(selectTheme);
|
|
3571
3600
|
var amount = reactRedux.useSelector(selectAmount);
|
|
3601
|
+
var feeDeduct = reactRedux.useSelector(selectFeeDeduct);
|
|
3602
|
+
var serviceFee = reactRedux.useSelector(selectServiceFee);
|
|
3572
3603
|
var compliantOption = reactRedux.useSelector(selectCompliantOption);
|
|
3573
3604
|
var targetCompliant = reactRedux.useSelector(selectTargetCompliant);
|
|
3574
3605
|
var transactionOption = reactRedux.useSelector(selectTransactionOption);
|
|
@@ -3629,7 +3660,13 @@ var SingleForm = function SingleForm(_ref) {
|
|
|
3629
3660
|
className: "amount-label " + theme.colorMode
|
|
3630
3661
|
}, React__default.createElement("span", null, (transactionOption === null || transactionOption === void 0 ? void 0 : transactionOption.amount) || ''), React__default.createElement("div", {
|
|
3631
3662
|
className: 'coin-wrapper'
|
|
3632
|
-
}, React__default.createElement(Icon, null), selectedCoin)))
|
|
3663
|
+
}, React__default.createElement(Icon, null), selectedCoin))), mode === exports.ModeOptions.bridge && serviceFee > 0 ? React__default.createElement(CustomCheckbox, {
|
|
3664
|
+
text: "Deduct " + formatterFloat.format(serviceFee) + " USDK fee",
|
|
3665
|
+
checked: feeDeduct,
|
|
3666
|
+
setCheck: function setCheck(value) {
|
|
3667
|
+
return dispatch(setFeeDeduct(value));
|
|
3668
|
+
}
|
|
3669
|
+
}) : null);
|
|
3633
3670
|
};
|
|
3634
3671
|
|
|
3635
3672
|
var CoinSelect = function CoinSelect() {
|
|
@@ -3658,7 +3695,7 @@ var CoinSelect = function CoinSelect() {
|
|
|
3658
3695
|
}, React__default.createElement(Icon, null), React__default.createElement("span", null, selectedCoin)))));
|
|
3659
3696
|
};
|
|
3660
3697
|
|
|
3661
|
-
function useServiceFee(isConfirming) {
|
|
3698
|
+
function useServiceFee(isConfirming, feeURL) {
|
|
3662
3699
|
if (isConfirming === void 0) {
|
|
3663
3700
|
isConfirming = false;
|
|
3664
3701
|
}
|
|
@@ -3673,7 +3710,6 @@ function useServiceFee(isConfirming) {
|
|
|
3673
3710
|
var targetNetwork = reactRedux.useSelector(selectTargetChain);
|
|
3674
3711
|
var targetAddress_ = reactRedux.useSelector(selectTargetAddress);
|
|
3675
3712
|
var transactionOption = reactRedux.useSelector(selectTransactionOption);
|
|
3676
|
-
var nodeProviderQuery = reactRedux.useSelector(selectNodeProviderQuery);
|
|
3677
3713
|
var targetChain = React.useMemo(function () {
|
|
3678
3714
|
return mode === exports.ModeOptions.payment ? (transactionOption === null || transactionOption === void 0 ? void 0 : transactionOption.targetChain) || '' : targetNetwork;
|
|
3679
3715
|
}, [transactionOption, mode, targetNetwork]);
|
|
@@ -3685,23 +3721,24 @@ function useServiceFee(isConfirming) {
|
|
|
3685
3721
|
}, [transactionOption, mode, amount_]);
|
|
3686
3722
|
var getServiceFee = function getServiceFee() {
|
|
3687
3723
|
try {
|
|
3688
|
-
if (!sourceChain || !targetChain || !isReady || !walletAddress || !targetAddress || !
|
|
3689
|
-
var gasFee = {};
|
|
3724
|
+
if (!sourceChain || !targetChain || !isReady || !walletAddress || !targetAddress || !amount) return Promise.resolve();
|
|
3690
3725
|
return Promise.resolve(_catch(function () {
|
|
3691
3726
|
if (sourceChain === exports.SupportNetworks.FIAT || targetChain === exports.SupportNetworks.FIAT) {
|
|
3692
3727
|
dispatch(setServiceFee(0));
|
|
3693
3728
|
return;
|
|
3694
3729
|
}
|
|
3695
|
-
return Promise.resolve(fetchWrapper.get(
|
|
3696
|
-
|
|
3697
|
-
|
|
3730
|
+
return Promise.resolve(fetchWrapper.get(feeURL + "/fee/" + sourceChain)).then(function (sourceChainResult) {
|
|
3731
|
+
var sourceFee = sourceChainResult.fee.split('-')[0];
|
|
3732
|
+
return Promise.resolve(fetchWrapper.get(feeURL + "/fee/" + targetChain)).then(function (targetChainResult) {
|
|
3733
|
+
var targetFee = targetChainResult.fee.split('-')[0];
|
|
3734
|
+
var fee = +sourceFee + +targetFee;
|
|
3735
|
+
dispatch(setServiceFee(parseFloat(fee.toFixed(2))));
|
|
3698
3736
|
});
|
|
3699
|
-
var fee = 0;
|
|
3700
|
-
dispatch(setServiceFee(parseFloat(fee.toFixed(2))));
|
|
3701
3737
|
});
|
|
3702
3738
|
}, function (e) {
|
|
3703
3739
|
dispatch(setServiceFee(0));
|
|
3704
3740
|
console.log('rpc disconnected', e);
|
|
3741
|
+
toast__default.error('rpc disconnected');
|
|
3705
3742
|
}));
|
|
3706
3743
|
} catch (e) {
|
|
3707
3744
|
return Promise.reject(e);
|
|
@@ -3716,7 +3753,7 @@ function useServiceFee(isConfirming) {
|
|
|
3716
3753
|
return function () {
|
|
3717
3754
|
clearInterval(timerId);
|
|
3718
3755
|
};
|
|
3719
|
-
}, [sourceChain, targetChain, isReady, walletAddress, isConfirming, targetAddress,
|
|
3756
|
+
}, [sourceChain, targetChain, isReady, walletAddress, isConfirming, targetAddress, amount]);
|
|
3720
3757
|
return React.useMemo(function () {
|
|
3721
3758
|
return {
|
|
3722
3759
|
serviceFee: serviceFee
|
|
@@ -7344,14 +7381,19 @@ function useAllowance(_ref) {
|
|
|
7344
7381
|
var selectedCoin = reactRedux.useSelector(selectSelectedToken);
|
|
7345
7382
|
var tokenOptions = reactRedux.useSelector(selectTokenOptions);
|
|
7346
7383
|
var tokenAddress = React.useMemo(function () {
|
|
7347
|
-
if (isEmptyObject(tokenOptions)) return '';
|
|
7348
|
-
|
|
7384
|
+
if (isEmptyObject(tokenOptions) || sourceChain === exports.SupportNetworks.FIAT || tokenOptions) return '';
|
|
7385
|
+
if (tokenOptions && typeof tokenOptions === 'object') {
|
|
7386
|
+
var coinOptions = tokenOptions[selectedCoin];
|
|
7387
|
+
if (coinOptions && typeof coinOptions === 'object') {
|
|
7388
|
+
return tokenOptions[selectedCoin][sourceChain];
|
|
7389
|
+
}
|
|
7390
|
+
}
|
|
7391
|
+
return '';
|
|
7349
7392
|
}, [selectedCoin, sourceChain, tokenOptions]);
|
|
7350
7393
|
var _useState3 = React.useState(),
|
|
7351
7394
|
targetAddress = _useState3[0],
|
|
7352
7395
|
setTargetAddress = _useState3[1];
|
|
7353
7396
|
var isApproved = React.useMemo(function () {
|
|
7354
|
-
console.log(allowance, amount, serviceFee);
|
|
7355
7397
|
return allowance >= amount + serviceFee;
|
|
7356
7398
|
}, [allowance, amount, serviceFee, dAppOption]);
|
|
7357
7399
|
var updatePoolAddress = function updatePoolAddress() {
|
|
@@ -7364,11 +7406,13 @@ function useAllowance(_ref) {
|
|
|
7364
7406
|
}
|
|
7365
7407
|
if (sourceChain === exports.SupportNetworks.SOLANA && !result.tssPubkey[0].eddsa) {
|
|
7366
7408
|
console.log('solana pool address is missing');
|
|
7409
|
+
toast__default.error('solana pool address is missing');
|
|
7367
7410
|
}
|
|
7368
7411
|
setTargetAddress(sourceChain === exports.SupportNetworks.SOLANA ? result.tssPubkey[0].eddsa : sourceChain === exports.SupportNetworks.TRON ? fromHex(result.tssPubkey[0].ecdsa) : result.tssPubkey[0].ecdsa);
|
|
7369
7412
|
});
|
|
7370
7413
|
}, function (e) {
|
|
7371
7414
|
console.log('rpc disconnected', e);
|
|
7415
|
+
toast__default.error('rpc disconnected');
|
|
7372
7416
|
}));
|
|
7373
7417
|
} catch (e) {
|
|
7374
7418
|
return Promise.reject(e);
|
|
@@ -7476,7 +7520,6 @@ function useAllowance(_ref) {
|
|
|
7476
7520
|
accountInfo = _connection$getParsed;
|
|
7477
7521
|
var parsedAccountInfo = (_accountInfo = accountInfo) === null || _accountInfo === void 0 ? void 0 : (_accountInfo$value2 = _accountInfo.value) === null || _accountInfo$value2 === void 0 ? void 0 : _accountInfo$value2.data;
|
|
7478
7522
|
allowAmount = ((_parsedAccountInfo$pa9 = parsedAccountInfo.parsed) === null || _parsedAccountInfo$pa9 === void 0 ? void 0 : (_parsedAccountInfo$pa10 = _parsedAccountInfo$pa9.info) === null || _parsedAccountInfo$pa10 === void 0 ? void 0 : _parsedAccountInfo$pa10.delegate) === targetAddress ? (_parsedAccountInfo$pa11 = parsedAccountInfo.parsed) === null || _parsedAccountInfo$pa11 === void 0 ? void 0 : (_parsedAccountInfo$pa12 = _parsedAccountInfo$pa11.info) === null || _parsedAccountInfo$pa12 === void 0 ? void 0 : (_parsedAccountInfo$pa13 = _parsedAccountInfo$pa12.delegatedAmount) === null || _parsedAccountInfo$pa13 === void 0 ? void 0 : _parsedAccountInfo$pa13.uiAmount : 0;
|
|
7479
|
-
console.log('sleep');
|
|
7480
7523
|
return Promise.resolve(sleep(1000)).then(function () {});
|
|
7481
7524
|
});
|
|
7482
7525
|
}, function () {
|
|
@@ -7605,6 +7648,7 @@ function useCurrencyOptions() {
|
|
|
7605
7648
|
});
|
|
7606
7649
|
}, function (e) {
|
|
7607
7650
|
console.log('rpc disconnected', e);
|
|
7651
|
+
toast__default.error('rpc disconnected');
|
|
7608
7652
|
});
|
|
7609
7653
|
} catch (e) {
|
|
7610
7654
|
Promise.reject(e);
|
|
@@ -7689,6 +7733,7 @@ function useSign(_ref) {
|
|
|
7689
7733
|
var TransferWidget = function TransferWidget(_ref) {
|
|
7690
7734
|
var _theme$backgroundColo;
|
|
7691
7735
|
var theme = _ref.theme,
|
|
7736
|
+
feeURL = _ref.feeURL,
|
|
7692
7737
|
helpURL = _ref.helpURL,
|
|
7693
7738
|
titleOption = _ref.titleOption,
|
|
7694
7739
|
paymentTitleOption = _ref.paymentTitleOption;
|
|
@@ -7706,6 +7751,7 @@ var TransferWidget = function TransferWidget(_ref) {
|
|
|
7706
7751
|
var mode = reactRedux.useSelector(selectMode);
|
|
7707
7752
|
var dAppOption = reactRedux.useSelector(selectDappOption);
|
|
7708
7753
|
var amount = reactRedux.useSelector(selectAmount);
|
|
7754
|
+
var feeDeduct = reactRedux.useSelector(selectFeeDeduct);
|
|
7709
7755
|
var sourceChain = reactRedux.useSelector(selectSourceChain);
|
|
7710
7756
|
var targetAddress = reactRedux.useSelector(selectTargetAddress);
|
|
7711
7757
|
var targetChain = reactRedux.useSelector(selectTargetChain);
|
|
@@ -7750,7 +7796,7 @@ var TransferWidget = function TransferWidget(_ref) {
|
|
|
7750
7796
|
}),
|
|
7751
7797
|
isSigned = _useSign.isSigned,
|
|
7752
7798
|
sign = _useSign.sign;
|
|
7753
|
-
var _useServiceFee = useServiceFee(isConfirming),
|
|
7799
|
+
var _useServiceFee = useServiceFee(isConfirming, feeURL),
|
|
7754
7800
|
fee = _useServiceFee.serviceFee;
|
|
7755
7801
|
var _useBalance = useBalance(),
|
|
7756
7802
|
balance = _useBalance.balance;
|
|
@@ -7766,6 +7812,7 @@ var TransferWidget = function TransferWidget(_ref) {
|
|
|
7766
7812
|
address: walletAddress
|
|
7767
7813
|
}))).then(function (res) {
|
|
7768
7814
|
dispatch(setSourceCompliant(res));
|
|
7815
|
+
toast.toast.error('xplorisk check failed');
|
|
7769
7816
|
});
|
|
7770
7817
|
}, function (e) {
|
|
7771
7818
|
console.log('xplorisk check failed', e);
|
|
@@ -7785,6 +7832,7 @@ var TransferWidget = function TransferWidget(_ref) {
|
|
|
7785
7832
|
address: targetAddress
|
|
7786
7833
|
}))).then(function (res) {
|
|
7787
7834
|
dispatch(setTargetCompliant(res));
|
|
7835
|
+
toast.toast.error('xplorisk check failed');
|
|
7788
7836
|
});
|
|
7789
7837
|
}, function (e) {
|
|
7790
7838
|
console.log('xplorisk check failed', e);
|
|
@@ -7840,6 +7888,7 @@ var TransferWidget = function TransferWidget(_ref) {
|
|
|
7840
7888
|
var symbol = selectedToken;
|
|
7841
7889
|
var errorString = "Tried to transfer " + amount + " " + symbol + ", but " + CHAIN_NAMES_TO_STRING[targetChain] + " pool has only " + +poolBalance[i].balance[j].amount + " " + symbol;
|
|
7842
7890
|
console.log(errorString);
|
|
7891
|
+
toast.toast.error(errorString);
|
|
7843
7892
|
toast.toast.error(CHAIN_NAMES_TO_STRING[targetChain] + " pool has insufficient balance!");
|
|
7844
7893
|
errorHandler(errorString);
|
|
7845
7894
|
return false;
|
|
@@ -7939,6 +7988,7 @@ var TransferWidget = function TransferWidget(_ref) {
|
|
|
7939
7988
|
errorHandler(e);
|
|
7940
7989
|
setSubmitting(false);
|
|
7941
7990
|
console.log((e === null || e === void 0 ? void 0 : e.status) !== 500 ? 'rpc disconnected' : '', e);
|
|
7991
|
+
toast.toast.error('rpc disconnected');
|
|
7942
7992
|
toast.toast.error('Failed to submit transaction');
|
|
7943
7993
|
}));
|
|
7944
7994
|
} catch (e) {
|
|
@@ -7965,6 +8015,11 @@ var TransferWidget = function TransferWidget(_ref) {
|
|
|
7965
8015
|
}
|
|
7966
8016
|
return;
|
|
7967
8017
|
}
|
|
8018
|
+
if (fee > 0 && fee > amount && feeDeduct) {
|
|
8019
|
+
toast.toast.error('Fee is greater than amount to transfer!');
|
|
8020
|
+
errorHandler('Fee is greater than amount to transfer!');
|
|
8021
|
+
return;
|
|
8022
|
+
}
|
|
7968
8023
|
if (mode === exports.ModeOptions.payment && wizardStep === 1 && fee >= 0 && (!compliantOption || sourceCompliant === 'low' && targetCompliant === 'low')) {
|
|
7969
8024
|
setConfirming(true);
|
|
7970
8025
|
setWizardStep(5);
|
|
@@ -7997,6 +8052,11 @@ var TransferWidget = function TransferWidget(_ref) {
|
|
|
7997
8052
|
return;
|
|
7998
8053
|
}
|
|
7999
8054
|
if (compliantOption && (sourceCompliant !== 'low' || targetCompliant !== 'low')) return;
|
|
8055
|
+
if (fee > 0 && fee > amount && feeDeduct) {
|
|
8056
|
+
toast.toast.error('Fee is greater than amount to transfer!');
|
|
8057
|
+
errorHandler('Fee is greater than amount to transfer!');
|
|
8058
|
+
return;
|
|
8059
|
+
}
|
|
8000
8060
|
if (mode === exports.ModeOptions.payment || targetAddress && amount > 0) {
|
|
8001
8061
|
setConfirming(true);
|
|
8002
8062
|
setFormStep(1);
|
|
@@ -8174,6 +8234,8 @@ var KimaTransactionWidget = function KimaTransactionWidget(_ref) {
|
|
|
8174
8234
|
kimaNodeProviderQuery = _ref.kimaNodeProviderQuery,
|
|
8175
8235
|
_ref$kimaExplorer = _ref.kimaExplorer,
|
|
8176
8236
|
kimaExplorer = _ref$kimaExplorer === void 0 ? 'explorer.kima.finance' : _ref$kimaExplorer,
|
|
8237
|
+
_ref$feeURL = _ref.feeURL,
|
|
8238
|
+
feeURL = _ref$feeURL === void 0 ? 'https://fee.kima.finance' : _ref$feeURL,
|
|
8177
8239
|
_ref$errorHandler = _ref.errorHandler,
|
|
8178
8240
|
errorHandler = _ref$errorHandler === void 0 ? function () {
|
|
8179
8241
|
return void 0;
|
|
@@ -8224,7 +8286,7 @@ var KimaTransactionWidget = function KimaTransactionWidget(_ref) {
|
|
|
8224
8286
|
var _temp = _catch(function () {
|
|
8225
8287
|
return Promise.resolve(fetchWrapper.get(kimaBackendUrl + "/uuid")).then(function (uuid) {
|
|
8226
8288
|
dispatch(setUuid(uuid));
|
|
8227
|
-
console.log('uuid: ', uuid);
|
|
8289
|
+
console.log('depasify uuid: ', uuid);
|
|
8228
8290
|
});
|
|
8229
8291
|
}, function (e) {
|
|
8230
8292
|
console.log('uuid generate failed', e);
|
|
@@ -8250,6 +8312,7 @@ var KimaTransactionWidget = function KimaTransactionWidget(_ref) {
|
|
|
8250
8312
|
address: transactionOption === null || transactionOption === void 0 ? void 0 : transactionOption.targetAddress
|
|
8251
8313
|
}))).then(function (compliantRes) {
|
|
8252
8314
|
dispatch(setTargetCompliant(compliantRes));
|
|
8315
|
+
toast__default.error('xplorisk check failed');
|
|
8253
8316
|
});
|
|
8254
8317
|
}
|
|
8255
8318
|
}();
|
|
@@ -8263,6 +8326,7 @@ var KimaTransactionWidget = function KimaTransactionWidget(_ref) {
|
|
|
8263
8326
|
dispatch(setSourceChain(networks.Chains[0]));
|
|
8264
8327
|
});
|
|
8265
8328
|
}, function (e) {
|
|
8329
|
+
toast__default.error('rpc disconnected!');
|
|
8266
8330
|
console.log('rpc disconnected', e);
|
|
8267
8331
|
});
|
|
8268
8332
|
return _temp3 && _temp3.then ? _temp3.then(_temp4) : _temp4(_temp3);
|
|
@@ -8288,6 +8352,7 @@ var KimaTransactionWidget = function KimaTransactionWidget(_ref) {
|
|
|
8288
8352
|
theme: theme
|
|
8289
8353
|
}) : React__default.createElement(TransferWidget, {
|
|
8290
8354
|
theme: theme,
|
|
8355
|
+
feeURL: feeURL,
|
|
8291
8356
|
helpURL: helpURL,
|
|
8292
8357
|
titleOption: titleOption,
|
|
8293
8358
|
paymentTitleOption: paymentTitleOption
|