@kimafinance/kima-transaction-widget 1.2.2-beta.1 → 1.2.4-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 +3 -2
- package/dist/hooks/useIsWalletReady.d.ts +1 -1
- package/dist/index.css +15 -3
- package/dist/index.js +112 -74
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +95 -56
- package/dist/index.modern.js.map +1 -1
- package/dist/store/optionSlice.d.ts +103 -1
- package/dist/store/selectors.d.ts +1 -0
- package/dist/utils/constants.d.ts +0 -1
- package/package.json +1 -1
|
@@ -7,7 +7,8 @@ interface Props {
|
|
|
7
7
|
mode: ModeOptions;
|
|
8
8
|
txId?: number;
|
|
9
9
|
useFIAT?: boolean;
|
|
10
|
-
|
|
10
|
+
defaultToken?: string;
|
|
11
|
+
autoSwitchChain?: boolean;
|
|
11
12
|
dAppOption?: DAppOptions;
|
|
12
13
|
provider?: Web3Provider;
|
|
13
14
|
titleOption?: TitleOption;
|
|
@@ -36,5 +37,5 @@ interface Props {
|
|
|
36
37
|
*
|
|
37
38
|
* @beta
|
|
38
39
|
*/
|
|
39
|
-
export declare const KimaTransactionWidget: ({ mode, txId,
|
|
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;
|
|
40
41
|
export {};
|
package/dist/index.css
CHANGED
|
@@ -523,6 +523,7 @@
|
|
|
523
523
|
position: relative;
|
|
524
524
|
border-radius: 1em;
|
|
525
525
|
padding: 0.5em;
|
|
526
|
+
padding-right: 3em;
|
|
526
527
|
height: 2.8em;
|
|
527
528
|
display: flex;
|
|
528
529
|
align-items: center;
|
|
@@ -538,7 +539,6 @@
|
|
|
538
539
|
font-weight: 500;
|
|
539
540
|
padding: 0.2em;
|
|
540
541
|
padding-right: 0.5em;
|
|
541
|
-
background: white;
|
|
542
542
|
color: black;
|
|
543
543
|
}
|
|
544
544
|
.kima-card .kima-card-content .single-form .coin-dropdown .coin-wrapper svg {
|
|
@@ -547,16 +547,28 @@
|
|
|
547
547
|
margin-right: 0.5em;
|
|
548
548
|
}
|
|
549
549
|
.kima-card .kima-card-content .single-form .coin-dropdown.dark .coin-wrapper {
|
|
550
|
-
background: #979797;
|
|
551
550
|
color: white;
|
|
552
551
|
}
|
|
552
|
+
.kima-card .kima-card-content .single-form .coin-dropdown:before {
|
|
553
|
+
position: absolute;
|
|
554
|
+
content: "";
|
|
555
|
+
width: 0.8em;
|
|
556
|
+
height: 0.8em;
|
|
557
|
+
right: 1.1em;
|
|
558
|
+
top: 1.7em;
|
|
559
|
+
border-top: 2px solid;
|
|
560
|
+
border-right: 2px solid;
|
|
561
|
+
border-color: white;
|
|
562
|
+
transform: rotate(-45deg);
|
|
563
|
+
transition: all 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
|
|
564
|
+
}
|
|
553
565
|
.kima-card .kima-card-content .single-form .coin-dropdown .coin-menu {
|
|
554
566
|
box-shadow: 0px 2px 6px 2px rgba(0, 0, 0, 0.15);
|
|
555
567
|
position: absolute;
|
|
556
568
|
z-index: 100;
|
|
557
569
|
max-height: 10em;
|
|
558
570
|
width: 100%;
|
|
559
|
-
top: 100
|
|
571
|
+
top: calc(100% - 0.5em);
|
|
560
572
|
left: 0;
|
|
561
573
|
overflow: hidden;
|
|
562
574
|
transition: all 0.3s cubic-bezier(0.25, 0.1, 0.25, 1);
|
package/dist/index.js
CHANGED
|
@@ -13,7 +13,8 @@ var tronwalletAdapterOkxwallet = require('@tronweb3/tronwallet-adapter-okxwallet
|
|
|
13
13
|
var tronwalletAdapterTokenpocket = require('@tronweb3/tronwallet-adapter-tokenpocket');
|
|
14
14
|
var tronwalletAdapterReactHooks = require('@tronweb3/tronwallet-adapter-react-hooks');
|
|
15
15
|
var tronwalletAbstractAdapter = require('@tronweb3/tronwallet-abstract-adapter');
|
|
16
|
-
var
|
|
16
|
+
var toast = require('react-hot-toast');
|
|
17
|
+
var toast__default = _interopDefault(toast);
|
|
17
18
|
var react = require('@web3modal/ethers5/react');
|
|
18
19
|
var reactTooltip = require('react-tooltip');
|
|
19
20
|
var walletAdapterBase = require('@solana/wallet-adapter-base');
|
|
@@ -827,6 +828,7 @@ var isEVMChain = function isEVMChain(chainId) {
|
|
|
827
828
|
};
|
|
828
829
|
var COIN_LIST = {
|
|
829
830
|
USDK: {
|
|
831
|
+
symbol: 'USDK',
|
|
830
832
|
icon: USDT
|
|
831
833
|
},
|
|
832
834
|
KEUR: {
|
|
@@ -888,7 +890,7 @@ var initialState = {
|
|
|
888
890
|
helpPopup: false,
|
|
889
891
|
hashPopup: false,
|
|
890
892
|
bankPopup: false,
|
|
891
|
-
walletAutoConnect:
|
|
893
|
+
walletAutoConnect: true,
|
|
892
894
|
provider: undefined,
|
|
893
895
|
dAppOption: exports.DAppOptions.None,
|
|
894
896
|
solanaProvider: undefined,
|
|
@@ -916,6 +918,7 @@ var initialState = {
|
|
|
916
918
|
nodeProviderQuery: '',
|
|
917
919
|
txId: -1,
|
|
918
920
|
selectedToken: 'USDK',
|
|
921
|
+
avilableTokenList: ['USDK'],
|
|
919
922
|
compliantOption: true,
|
|
920
923
|
sourceCompliant: 'low',
|
|
921
924
|
targetCompliant: 'low',
|
|
@@ -1044,6 +1047,9 @@ var optionSlice = createSlice({
|
|
|
1044
1047
|
setSelectedToken: function setSelectedToken(state, action) {
|
|
1045
1048
|
state.selectedToken = action.payload;
|
|
1046
1049
|
},
|
|
1050
|
+
setAvailableTokenList: function setAvailableTokenList(state, action) {
|
|
1051
|
+
state.avilableTokenList = action.payload;
|
|
1052
|
+
},
|
|
1047
1053
|
setCompliantOption: function setCompliantOption(state, action) {
|
|
1048
1054
|
state.compliantOption = action.payload;
|
|
1049
1055
|
},
|
|
@@ -1104,6 +1110,7 @@ var _optionSlice$actions = optionSlice.actions,
|
|
|
1104
1110
|
setNodeProviderQuery = _optionSlice$actions.setNodeProviderQuery,
|
|
1105
1111
|
setTxId = _optionSlice$actions.setTxId,
|
|
1106
1112
|
setSelectedToken = _optionSlice$actions.setSelectedToken,
|
|
1113
|
+
setAvailableTokenList = _optionSlice$actions.setAvailableTokenList,
|
|
1107
1114
|
setCompliantOption = _optionSlice$actions.setCompliantOption,
|
|
1108
1115
|
setSourceCompliant = _optionSlice$actions.setSourceCompliant,
|
|
1109
1116
|
setTargetCompliant = _optionSlice$actions.setTargetCompliant,
|
|
@@ -1376,6 +1383,9 @@ var selectTxId = function selectTxId(state) {
|
|
|
1376
1383
|
var selectSelectedToken = function selectSelectedToken(state) {
|
|
1377
1384
|
return state.option.selectedToken;
|
|
1378
1385
|
};
|
|
1386
|
+
var selectAvailableTokenList = function selectAvailableTokenList(state) {
|
|
1387
|
+
return state.option.avilableTokenList;
|
|
1388
|
+
};
|
|
1379
1389
|
var selectCompliantOption = function selectCompliantOption(state) {
|
|
1380
1390
|
return state.option.compliantOption;
|
|
1381
1391
|
};
|
|
@@ -1593,8 +1603,6 @@ function handleResponse(response) {
|
|
|
1593
1603
|
|
|
1594
1604
|
function useNetworkOptions() {
|
|
1595
1605
|
var dispatch = reactRedux.useDispatch();
|
|
1596
|
-
var mode = reactRedux.useSelector(selectMode);
|
|
1597
|
-
var dAppOption = reactRedux.useSelector(selectDappOption);
|
|
1598
1606
|
var useFIAT = reactRedux.useSelector(selectUseFIAT);
|
|
1599
1607
|
var nodeProviderQuery = reactRedux.useSelector(selectNodeProviderQuery);
|
|
1600
1608
|
var _useState = React.useState(networkOptions),
|
|
@@ -1602,39 +1610,37 @@ function useNetworkOptions() {
|
|
|
1602
1610
|
setOptions = _useState[1];
|
|
1603
1611
|
React.useEffect(function () {
|
|
1604
1612
|
if (!nodeProviderQuery) return;
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
return
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
tokenOptions[token.symbol] = {};
|
|
1622
|
-
}
|
|
1623
|
-
tokenOptions[token.symbol][network.symbol] = token.address;
|
|
1613
|
+
(function () {
|
|
1614
|
+
try {
|
|
1615
|
+
var _temp = _catch(function () {
|
|
1616
|
+
return Promise.resolve(fetchWrapper.get(nodeProviderQuery + "/kima-finance/kima-blockchain/chains/chain")).then(function (networks) {
|
|
1617
|
+
setOptions(networkOptions.filter(function (network) {
|
|
1618
|
+
return networks.Chain.findIndex(function (chain) {
|
|
1619
|
+
return chain.symbol === network.id && !chain.disabled;
|
|
1620
|
+
}) >= 0 || network.id === exports.SupportNetworks.FIAT && useFIAT;
|
|
1621
|
+
}));
|
|
1622
|
+
var tokenOptions = {};
|
|
1623
|
+
for (var _iterator = _createForOfIteratorHelperLoose(networks.Chain), _step; !(_step = _iterator()).done;) {
|
|
1624
|
+
var network = _step.value;
|
|
1625
|
+
for (var _iterator2 = _createForOfIteratorHelperLoose(network.tokens), _step2; !(_step2 = _iterator2()).done;) {
|
|
1626
|
+
var token = _step2.value;
|
|
1627
|
+
if (!tokenOptions[token.symbol]) {
|
|
1628
|
+
tokenOptions[token.symbol] = {};
|
|
1624
1629
|
}
|
|
1630
|
+
tokenOptions[token.symbol][network.symbol] = token.address;
|
|
1625
1631
|
}
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
}, function (e) {
|
|
1629
|
-
console.log('rpc disconnected', e);
|
|
1632
|
+
}
|
|
1633
|
+
dispatch(setTokenOptions(tokenOptions));
|
|
1630
1634
|
});
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
}
|
|
1635
|
-
}
|
|
1636
|
-
|
|
1637
|
-
|
|
1635
|
+
}, function (e) {
|
|
1636
|
+
console.log('rpc disconnected', e);
|
|
1637
|
+
});
|
|
1638
|
+
return _temp && _temp.then ? _temp.then(function () {}) : void 0;
|
|
1639
|
+
} catch (e) {
|
|
1640
|
+
Promise.reject(e);
|
|
1641
|
+
}
|
|
1642
|
+
})();
|
|
1643
|
+
}, [nodeProviderQuery]);
|
|
1638
1644
|
return React.useMemo(function () {
|
|
1639
1645
|
return {
|
|
1640
1646
|
options: options
|
|
@@ -1989,11 +1995,9 @@ var createWalletStatus = function createWalletStatus(isReady, statusMessage, for
|
|
|
1989
1995
|
walletAddress: walletAddress
|
|
1990
1996
|
};
|
|
1991
1997
|
};
|
|
1992
|
-
function useIsWalletReady(
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
}
|
|
1996
|
-
var autoSwitch = enableNetworkAutoswitch;
|
|
1998
|
+
function useIsWalletReady() {
|
|
1999
|
+
var dispatch = reactRedux.useDispatch();
|
|
2000
|
+
var autoSwitch = reactRedux.useSelector(selectWalletAutoConnect);
|
|
1997
2001
|
var _useSolanaWallet = SolanaAdapter.useWallet(),
|
|
1998
2002
|
solanaAddress = _useSolanaWallet.publicKey;
|
|
1999
2003
|
var _useTronWallet = tronwalletAdapterReactHooks.useWallet(),
|
|
@@ -2066,9 +2070,15 @@ function useIsWalletReady(enableNetworkAutoswitch) {
|
|
|
2066
2070
|
return createWalletStatus(true, undefined, forceNetworkSwitch, evmAddress);
|
|
2067
2071
|
} else {
|
|
2068
2072
|
if (evmProvider && correctEvmNetwork) {
|
|
2069
|
-
if (autoSwitch)
|
|
2073
|
+
if (autoSwitch) {
|
|
2074
|
+
forceNetworkSwitch();
|
|
2075
|
+
} else {
|
|
2076
|
+
console.log('autoSwitch', autoSwitch, evmChainId);
|
|
2077
|
+
dispatch(setSourceChain(CHAIN_IDS_TO_NAMES[evmChainId || SupportedChainId.ETHEREUM]));
|
|
2078
|
+
toast__default.success("Wallet connected to " + CHAIN_NAMES_TO_STRING[CHAIN_IDS_TO_NAMES[evmChainId || SupportedChainId.ETHEREUM]]);
|
|
2079
|
+
}
|
|
2070
2080
|
}
|
|
2071
|
-
if (evmChainId) return createWalletStatus(false, "Wallet not connected to " + CHAIN_NAMES_TO_STRING[CHAIN_IDS_TO_NAMES[correctEvmNetwork]], forceNetworkSwitch, evmAddress);
|
|
2081
|
+
if (evmChainId && autoSwitch) return createWalletStatus(false, "Wallet not connected to " + CHAIN_NAMES_TO_STRING[CHAIN_IDS_TO_NAMES[correctEvmNetwork]], forceNetworkSwitch, evmAddress);
|
|
2072
2082
|
}
|
|
2073
2083
|
}
|
|
2074
2084
|
return createWalletStatus(false, '', forceNetworkSwitch, undefined);
|
|
@@ -2597,8 +2607,7 @@ var WalletButton = function WalletButton(_ref) {
|
|
|
2597
2607
|
var sourceCompliant = reactRedux.useSelector(selectSourceCompliant);
|
|
2598
2608
|
var compliantOption = reactRedux.useSelector(selectCompliantOption);
|
|
2599
2609
|
var selectedNetwork = reactRedux.useSelector(selectSourceChain);
|
|
2600
|
-
var
|
|
2601
|
-
var _useIsWalletReady = useIsWalletReady(walletAutoConnect),
|
|
2610
|
+
var _useIsWalletReady = useIsWalletReady(),
|
|
2602
2611
|
isReady = _useIsWalletReady.isReady,
|
|
2603
2612
|
statusMessage = _useIsWalletReady.statusMessage,
|
|
2604
2613
|
walletAddress = _useIsWalletReady.walletAddress;
|
|
@@ -2624,7 +2633,7 @@ var WalletButton = function WalletButton(_ref) {
|
|
|
2624
2633
|
}, [isReady, statusMessage, sourceCompliant, compliantOption]);
|
|
2625
2634
|
React.useEffect(function () {
|
|
2626
2635
|
if (!errorMessage) return;
|
|
2627
|
-
|
|
2636
|
+
toast.toast.error(errorMessage);
|
|
2628
2637
|
}, [errorMessage]);
|
|
2629
2638
|
return React__default.createElement("div", {
|
|
2630
2639
|
className: "wallet-button " + theme.colorMode + " " + (errorBelow ? 'error-below' : ''),
|
|
@@ -2637,22 +2646,44 @@ var WalletButton = function WalletButton(_ref) {
|
|
|
2637
2646
|
};
|
|
2638
2647
|
|
|
2639
2648
|
var CoinDropdown = function CoinDropdown() {
|
|
2649
|
+
var ref = React.useRef();
|
|
2640
2650
|
var _useState = React.useState(true),
|
|
2641
2651
|
collapsed = _useState[0],
|
|
2642
2652
|
setCollapsed = _useState[1];
|
|
2643
2653
|
var selectedCoin = reactRedux.useSelector(selectSelectedToken);
|
|
2654
|
+
var tokenList = reactRedux.useSelector(selectAvailableTokenList);
|
|
2644
2655
|
var theme = reactRedux.useSelector(selectTheme);
|
|
2645
2656
|
var Icon = COIN_LIST[selectedCoin || 'USDK'].icon;
|
|
2657
|
+
React.useEffect(function () {
|
|
2658
|
+
var bodyMouseDowntHandler = function bodyMouseDowntHandler(e) {
|
|
2659
|
+
if (ref !== null && ref !== void 0 && ref.current && !ref.current.contains(e.target)) {
|
|
2660
|
+
setCollapsed(true);
|
|
2661
|
+
}
|
|
2662
|
+
};
|
|
2663
|
+
document.addEventListener('mousedown', bodyMouseDowntHandler);
|
|
2664
|
+
return function () {
|
|
2665
|
+
document.removeEventListener('mousedown', bodyMouseDowntHandler);
|
|
2666
|
+
};
|
|
2667
|
+
}, [setCollapsed]);
|
|
2646
2668
|
return React__default.createElement("div", {
|
|
2647
2669
|
className: "coin-dropdown " + theme.colorMode + " " + (collapsed ? 'collapsed' : ''),
|
|
2648
2670
|
onClick: function onClick() {
|
|
2649
2671
|
return setCollapsed(function (prev) {
|
|
2650
2672
|
return !prev;
|
|
2651
2673
|
});
|
|
2652
|
-
}
|
|
2674
|
+
},
|
|
2675
|
+
ref: ref
|
|
2653
2676
|
}, React__default.createElement("div", {
|
|
2654
2677
|
className: 'coin-wrapper'
|
|
2655
|
-
}, React__default.createElement(Icon, null), selectedCoin)
|
|
2678
|
+
}, React__default.createElement(Icon, null), selectedCoin), React__default.createElement("div", {
|
|
2679
|
+
className: "coin-menu " + theme.colorMode + " " + (collapsed ? 'collapsed' : '')
|
|
2680
|
+
}, tokenList.map(function (token) {
|
|
2681
|
+
var CoinIcon = COIN_LIST[token].icon;
|
|
2682
|
+
return React__default.createElement("div", {
|
|
2683
|
+
className: 'coin-item',
|
|
2684
|
+
key: COIN_LIST[token].symbol
|
|
2685
|
+
}, React__default.createElement(CoinIcon, null), React__default.createElement("p", null, COIN_LIST[token].symbol));
|
|
2686
|
+
})));
|
|
2656
2687
|
};
|
|
2657
2688
|
|
|
2658
2689
|
var NetworkDropdown = React__default.memo(function (_ref) {
|
|
@@ -2667,6 +2698,7 @@ var NetworkDropdown = React__default.memo(function (_ref) {
|
|
|
2667
2698
|
var ref = React.useRef();
|
|
2668
2699
|
var sourceChangeRef = React.useRef(false);
|
|
2669
2700
|
var mode = reactRedux.useSelector(selectMode);
|
|
2701
|
+
var autoSwitchChain = reactRedux.useSelector(selectWalletAutoConnect);
|
|
2670
2702
|
var useFIAT = reactRedux.useSelector(selectUseFIAT);
|
|
2671
2703
|
var dAppOption = reactRedux.useSelector(selectDappOption);
|
|
2672
2704
|
var originNetwork = reactRedux.useSelector(selectSourceChain);
|
|
@@ -2770,7 +2802,8 @@ var NetworkDropdown = React__default.memo(function (_ref) {
|
|
|
2770
2802
|
return React__default.createElement("div", {
|
|
2771
2803
|
className: "network-dropdown " + theme.colorMode + " " + (collapsed ? 'collapsed' : ''),
|
|
2772
2804
|
onClick: function onClick() {
|
|
2773
|
-
|
|
2805
|
+
if (!autoSwitchChain && isOriginChain) return;
|
|
2806
|
+
setCollapsed(function (prev) {
|
|
2774
2807
|
return !prev;
|
|
2775
2808
|
});
|
|
2776
2809
|
},
|
|
@@ -3228,7 +3261,7 @@ var BankPopup = function BankPopup(_ref) {
|
|
|
3228
3261
|
} else if (kycResult[0].status === 'approved') {
|
|
3229
3262
|
setVerifying(false);
|
|
3230
3263
|
dispatch(setKYCStatus('approved'));
|
|
3231
|
-
|
|
3264
|
+
toast.toast.success('KYC is verified');
|
|
3232
3265
|
}
|
|
3233
3266
|
});
|
|
3234
3267
|
}, function () {
|
|
@@ -3404,7 +3437,7 @@ var TransactionWidget = function TransactionWidget(_ref) {
|
|
|
3404
3437
|
setErrorStep(1);
|
|
3405
3438
|
setLoadingStep(-1);
|
|
3406
3439
|
console.error(data.failReason);
|
|
3407
|
-
|
|
3440
|
+
toast.toast.error('Unavailable');
|
|
3408
3441
|
setErrorMessage('Unavailable');
|
|
3409
3442
|
} else if (status === TransactionStatus.KEYSIGNED) {
|
|
3410
3443
|
setStep(3);
|
|
@@ -3420,7 +3453,7 @@ var TransactionWidget = function TransactionWidget(_ref) {
|
|
|
3420
3453
|
setErrorStep(3);
|
|
3421
3454
|
setLoadingStep(-1);
|
|
3422
3455
|
console.error(data.failReason);
|
|
3423
|
-
|
|
3456
|
+
toast.toast.error('Failed to release tokens to target!');
|
|
3424
3457
|
setErrorMessage('Failed to release tokens to target!');
|
|
3425
3458
|
} else if (status === TransactionStatus.FAILEDTOPULL) {
|
|
3426
3459
|
setStep(1);
|
|
@@ -3428,7 +3461,7 @@ var TransactionWidget = function TransactionWidget(_ref) {
|
|
|
3428
3461
|
setErrorStep(1);
|
|
3429
3462
|
setLoadingStep(-1);
|
|
3430
3463
|
console.error(data.failReason);
|
|
3431
|
-
|
|
3464
|
+
toast.toast.error('Failed to pull tokens from source!');
|
|
3432
3465
|
setErrorMessage('Failed to pull tokens from source!');
|
|
3433
3466
|
} else if (status === TransactionStatus.COMPLETED) {
|
|
3434
3467
|
setStep(4);
|
|
@@ -3499,7 +3532,7 @@ var TransactionWidget = function TransactionWidget(_ref) {
|
|
|
3499
3532
|
fill: theme.colorMode === 'light' ? 'black' : '#C5C5C5'
|
|
3500
3533
|
}))), React__default.createElement(HelpPopup, null), React__default.createElement(HashPopup, {
|
|
3501
3534
|
data: data
|
|
3502
|
-
}), React__default.createElement(
|
|
3535
|
+
}), React__default.createElement(toast.Toaster, {
|
|
3503
3536
|
position: 'top-right',
|
|
3504
3537
|
reverseOrder: false,
|
|
3505
3538
|
containerStyle: {
|
|
@@ -3548,7 +3581,7 @@ var SingleForm = function SingleForm(_ref) {
|
|
|
3548
3581
|
}, [compliantOption, targetCompliant]);
|
|
3549
3582
|
React.useEffect(function () {
|
|
3550
3583
|
if (!errorMessage) return;
|
|
3551
|
-
|
|
3584
|
+
toast.toast.error(errorMessage);
|
|
3552
3585
|
}, [errorMessage]);
|
|
3553
3586
|
return React__default.createElement("div", {
|
|
3554
3587
|
className: 'single-form'
|
|
@@ -7549,6 +7582,7 @@ var AddressInputWizard = function AddressInputWizard() {
|
|
|
7549
7582
|
};
|
|
7550
7583
|
|
|
7551
7584
|
function useCurrencyOptions() {
|
|
7585
|
+
var dispatch = reactRedux.useDispatch();
|
|
7552
7586
|
var _useState = React.useState('USDK'),
|
|
7553
7587
|
options = _useState[0],
|
|
7554
7588
|
setOptions = _useState[1];
|
|
@@ -7566,6 +7600,7 @@ function useCurrencyOptions() {
|
|
|
7566
7600
|
}
|
|
7567
7601
|
return Promise.resolve(fetchWrapper.get(nodeProviderQuery + "/kima-finance/kima-blockchain/chains/get_currencies/" + originNetwork + "/" + targetNetwork)).then(function (coins) {
|
|
7568
7602
|
var _coins$Currencies;
|
|
7603
|
+
dispatch(setAvailableTokenList(coins.Currencies || ['USDK']));
|
|
7569
7604
|
setOptions((_coins$Currencies = coins.Currencies) !== null && _coins$Currencies !== void 0 && _coins$Currencies.length ? coins.Currencies[0] : 'USDK');
|
|
7570
7605
|
});
|
|
7571
7606
|
}, function (e) {
|
|
@@ -7805,7 +7840,7 @@ var TransferWidget = function TransferWidget(_ref) {
|
|
|
7805
7840
|
var symbol = selectedToken;
|
|
7806
7841
|
var errorString = "Tried to transfer " + amount + " " + symbol + ", but " + CHAIN_NAMES_TO_STRING[targetChain] + " pool has only " + +poolBalance[i].balance[j].amount + " " + symbol;
|
|
7807
7842
|
console.log(errorString);
|
|
7808
|
-
|
|
7843
|
+
toast.toast.error(CHAIN_NAMES_TO_STRING[targetChain] + " pool has insufficient balance!");
|
|
7809
7844
|
errorHandler(errorString);
|
|
7810
7845
|
return false;
|
|
7811
7846
|
}
|
|
@@ -7823,12 +7858,12 @@ var TransferWidget = function TransferWidget(_ref) {
|
|
|
7823
7858
|
try {
|
|
7824
7859
|
var _exit = false;
|
|
7825
7860
|
if (fee < 0) {
|
|
7826
|
-
|
|
7861
|
+
toast.toast.error('Fee is not calculated!');
|
|
7827
7862
|
errorHandler('Fee is not calculated!');
|
|
7828
7863
|
return Promise.resolve();
|
|
7829
7864
|
}
|
|
7830
7865
|
if (dAppOption !== exports.DAppOptions.LPDrain && balance < amount) {
|
|
7831
|
-
|
|
7866
|
+
toast.toast.error('Insufficient balance!');
|
|
7832
7867
|
errorHandler('Insufficient balance!');
|
|
7833
7868
|
return Promise.resolve();
|
|
7834
7869
|
}
|
|
@@ -7877,7 +7912,7 @@ var TransferWidget = function TransferWidget(_ref) {
|
|
|
7877
7912
|
console.log(result);
|
|
7878
7913
|
if ((result === null || result === void 0 ? void 0 : result.code) !== 0) {
|
|
7879
7914
|
errorHandler(result);
|
|
7880
|
-
|
|
7915
|
+
toast.toast.error('Failed to submit transaction!');
|
|
7881
7916
|
setSubmitting(false);
|
|
7882
7917
|
return;
|
|
7883
7918
|
}
|
|
@@ -7904,7 +7939,7 @@ var TransferWidget = function TransferWidget(_ref) {
|
|
|
7904
7939
|
errorHandler(e);
|
|
7905
7940
|
setSubmitting(false);
|
|
7906
7941
|
console.log((e === null || e === void 0 ? void 0 : e.status) !== 500 ? 'rpc disconnected' : '', e);
|
|
7907
|
-
|
|
7942
|
+
toast.toast.error('Failed to submit transaction');
|
|
7908
7943
|
}));
|
|
7909
7944
|
} catch (e) {
|
|
7910
7945
|
return Promise.reject(e);
|
|
@@ -7914,7 +7949,7 @@ var TransferWidget = function TransferWidget(_ref) {
|
|
|
7914
7949
|
var _mainRef$current;
|
|
7915
7950
|
if (isWizard && wizardStep < 5) {
|
|
7916
7951
|
if (wizardStep === 1 && !isReady) {
|
|
7917
|
-
|
|
7952
|
+
toast.toast.error('Wallet is not connected!');
|
|
7918
7953
|
errorHandler('Wallet is not connected!');
|
|
7919
7954
|
return;
|
|
7920
7955
|
}
|
|
@@ -7941,23 +7976,23 @@ var TransferWidget = function TransferWidget(_ref) {
|
|
|
7941
7976
|
if (isReady) {
|
|
7942
7977
|
if (targetChain === exports.SupportNetworks.FIAT) {
|
|
7943
7978
|
if (!bankDetails.iban) {
|
|
7944
|
-
|
|
7979
|
+
toast.toast.error('Invalid IBAN!');
|
|
7945
7980
|
errorHandler('Invalid IBAN!');
|
|
7946
7981
|
return;
|
|
7947
7982
|
}
|
|
7948
7983
|
if (!bankDetails.recipient) {
|
|
7949
|
-
|
|
7984
|
+
toast.toast.error('Invalid Recipient Address!');
|
|
7950
7985
|
errorHandler('Invalid Recipient Address!');
|
|
7951
7986
|
return;
|
|
7952
7987
|
}
|
|
7953
7988
|
}
|
|
7954
7989
|
if (amount <= 0) {
|
|
7955
|
-
|
|
7990
|
+
toast.toast.error('Invalid amount!');
|
|
7956
7991
|
errorHandler('Invalid amount!');
|
|
7957
7992
|
return;
|
|
7958
7993
|
}
|
|
7959
7994
|
if (fee < 0) {
|
|
7960
|
-
|
|
7995
|
+
toast.toast.error('Fee is not calculated!');
|
|
7961
7996
|
errorHandler('Fee is not calculated!');
|
|
7962
7997
|
return;
|
|
7963
7998
|
}
|
|
@@ -7968,7 +8003,7 @@ var TransferWidget = function TransferWidget(_ref) {
|
|
|
7968
8003
|
}
|
|
7969
8004
|
return;
|
|
7970
8005
|
} else {
|
|
7971
|
-
|
|
8006
|
+
toast.toast.error('Wallet is not connected!');
|
|
7972
8007
|
errorHandler('Wallet is not connected!');
|
|
7973
8008
|
}
|
|
7974
8009
|
}
|
|
@@ -8091,14 +8126,14 @@ var TransferWidget = function TransferWidget(_ref) {
|
|
|
8091
8126
|
}, getButtonLabel()))), React__default.createElement(SolanaWalletConnectModal, null), React__default.createElement(TronWalletConnectModal, null), React__default.createElement(HelpPopup, null), sourceChain === exports.SupportNetworks.FIAT || targetChain === exports.SupportNetworks.FIAT ? React__default.createElement(BankPopup, {
|
|
8092
8127
|
setVerifying: setVerifying,
|
|
8093
8128
|
isVerifying: isVerifying
|
|
8094
|
-
}) : null, React__default.createElement(
|
|
8129
|
+
}) : null, React__default.createElement(toast.Toaster, {
|
|
8095
8130
|
position: 'top-right',
|
|
8096
8131
|
reverseOrder: false,
|
|
8097
8132
|
containerStyle: {
|
|
8098
8133
|
position: 'absolute'
|
|
8099
8134
|
},
|
|
8100
8135
|
toastOptions: {
|
|
8101
|
-
duration:
|
|
8136
|
+
duration: 3 * 1000,
|
|
8102
8137
|
style: {
|
|
8103
8138
|
position: 'relative',
|
|
8104
8139
|
top: windowWidth > 768 ? '3rem' : '1.5rem',
|
|
@@ -8118,8 +8153,10 @@ var TransferWidget = function TransferWidget(_ref) {
|
|
|
8118
8153
|
var KimaTransactionWidget = function KimaTransactionWidget(_ref) {
|
|
8119
8154
|
var mode = _ref.mode,
|
|
8120
8155
|
txId = _ref.txId,
|
|
8121
|
-
_ref$
|
|
8122
|
-
|
|
8156
|
+
_ref$autoSwitchChain = _ref.autoSwitchChain,
|
|
8157
|
+
autoSwitchChain = _ref$autoSwitchChain === void 0 ? true : _ref$autoSwitchChain,
|
|
8158
|
+
_ref$defaultToken = _ref.defaultToken,
|
|
8159
|
+
defaultToken = _ref$defaultToken === void 0 ? 'USDK' : _ref$defaultToken,
|
|
8123
8160
|
provider = _ref.provider,
|
|
8124
8161
|
_ref$dAppOption = _ref.dAppOption,
|
|
8125
8162
|
dAppOption = _ref$dAppOption === void 0 ? exports.DAppOptions.None : _ref$dAppOption,
|
|
@@ -8177,7 +8214,8 @@ var KimaTransactionWidget = function KimaTransactionWidget(_ref) {
|
|
|
8177
8214
|
dispatch(setMode(mode));
|
|
8178
8215
|
dispatch(setProvider(provider));
|
|
8179
8216
|
dispatch(setDappOption(dAppOption));
|
|
8180
|
-
dispatch(setWalletAutoConnect(
|
|
8217
|
+
dispatch(setWalletAutoConnect(autoSwitchChain));
|
|
8218
|
+
dispatch(setSelectedToken(defaultToken));
|
|
8181
8219
|
dispatch(setUseFIAT(useFIAT));
|
|
8182
8220
|
if (useFIAT) {
|
|
8183
8221
|
dispatch(setTxId(txId || -1));
|
|
@@ -8278,7 +8316,7 @@ var polygon = {
|
|
|
8278
8316
|
name: 'Mumbai',
|
|
8279
8317
|
currency: 'MATIC',
|
|
8280
8318
|
explorerUrl: 'https://mumbai.polygonscan.com',
|
|
8281
|
-
rpcUrl: 'https://
|
|
8319
|
+
rpcUrl: 'https://polygon-mumbai-bor-rpc.publicnode.com'
|
|
8282
8320
|
};
|
|
8283
8321
|
var arbitrum = {
|
|
8284
8322
|
chainId: 421614,
|
|
@@ -8337,13 +8375,13 @@ var KimaProvider = function KimaProvider(_ref) {
|
|
|
8337
8375
|
}, []);
|
|
8338
8376
|
function onError(e) {
|
|
8339
8377
|
if (e instanceof tronwalletAbstractAdapter.WalletNotFoundError) {
|
|
8340
|
-
|
|
8378
|
+
toast.toast.error(e.message);
|
|
8341
8379
|
} else if (e instanceof tronwalletAbstractAdapter.WalletDisconnectedError) {
|
|
8342
|
-
|
|
8343
|
-
} else
|
|
8380
|
+
toast.toast.error(e.message);
|
|
8381
|
+
} else toast.toast.error(e.message);
|
|
8344
8382
|
}
|
|
8345
8383
|
var onChainChanged = function onChainChanged(chainData) {
|
|
8346
|
-
|
|
8384
|
+
toast.toast.error('Please switch to Tron Nile Testnet!');
|
|
8347
8385
|
if (chainData.chainId !== '0xcd8690dc') {
|
|
8348
8386
|
adapters[0].switchChain('0xcd8690dc');
|
|
8349
8387
|
}
|