@kimafinance/kima-transaction-widget 1.2.57-beta.1 → 1.2.59-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/hooks/useCurrencyOptions.d.ts +1 -1
- package/dist/index.js +55 -72
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +42 -53
- package/dist/index.modern.js.map +1 -1
- package/dist/store/optionSlice.d.ts +1 -125
- package/dist/store/selectors.d.ts +0 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1042,7 +1042,6 @@ var initialState = {
|
|
|
1042
1042
|
nodeProviderQuery: '',
|
|
1043
1043
|
txId: -1,
|
|
1044
1044
|
selectedToken: 'USDK',
|
|
1045
|
-
avilableTokenList: ['USDK'],
|
|
1046
1045
|
compliantOption: true,
|
|
1047
1046
|
sourceCompliant: 'low',
|
|
1048
1047
|
targetCompliant: 'low',
|
|
@@ -1193,9 +1192,6 @@ var optionSlice = createSlice({
|
|
|
1193
1192
|
setSelectedToken: function setSelectedToken(state, action) {
|
|
1194
1193
|
state.selectedToken = action.payload;
|
|
1195
1194
|
},
|
|
1196
|
-
setAvailableTokenList: function setAvailableTokenList(state, action) {
|
|
1197
|
-
state.avilableTokenList = action.payload;
|
|
1198
|
-
},
|
|
1199
1195
|
setCompliantOption: function setCompliantOption(state, action) {
|
|
1200
1196
|
state.compliantOption = action.payload;
|
|
1201
1197
|
},
|
|
@@ -1263,7 +1259,6 @@ var _optionSlice$actions = optionSlice.actions,
|
|
|
1263
1259
|
setNodeProviderQuery = _optionSlice$actions.setNodeProviderQuery,
|
|
1264
1260
|
setTxId = _optionSlice$actions.setTxId,
|
|
1265
1261
|
setSelectedToken = _optionSlice$actions.setSelectedToken,
|
|
1266
|
-
setAvailableTokenList = _optionSlice$actions.setAvailableTokenList,
|
|
1267
1262
|
setCompliantOption = _optionSlice$actions.setCompliantOption,
|
|
1268
1263
|
setSourceCompliant = _optionSlice$actions.setSourceCompliant,
|
|
1269
1264
|
setTargetCompliant = _optionSlice$actions.setTargetCompliant,
|
|
@@ -1548,9 +1543,6 @@ var selectTxId = function selectTxId(state) {
|
|
|
1548
1543
|
var selectSelectedToken = function selectSelectedToken(state) {
|
|
1549
1544
|
return state.option.selectedToken;
|
|
1550
1545
|
};
|
|
1551
|
-
var selectAvailableTokenList = function selectAvailableTokenList(state) {
|
|
1552
|
-
return state.option.avilableTokenList;
|
|
1553
|
-
};
|
|
1554
1546
|
var selectCompliantOption = function selectCompliantOption(state) {
|
|
1555
1547
|
return state.option.compliantOption;
|
|
1556
1548
|
};
|
|
@@ -2900,6 +2892,57 @@ var WalletButton = function WalletButton(_ref) {
|
|
|
2900
2892
|
}, balance.toFixed(selectedCoin === 'WBTC' ? 8 : 2), ' ', selectedNetwork === exports.SupportNetworks.BTC ? 'BTC' : selectedCoin, " available") : null);
|
|
2901
2893
|
};
|
|
2902
2894
|
|
|
2895
|
+
function useCurrencyOptions() {
|
|
2896
|
+
var dispatch = reactRedux.useDispatch();
|
|
2897
|
+
var _useState = React.useState(['USDK']),
|
|
2898
|
+
tokenList = _useState[0],
|
|
2899
|
+
setTokenList = _useState[1];
|
|
2900
|
+
var mode = reactRedux.useSelector(selectMode);
|
|
2901
|
+
var transactionOption = reactRedux.useSelector(selectTransactionOption);
|
|
2902
|
+
var nodeProviderQuery = reactRedux.useSelector(selectNodeProviderQuery);
|
|
2903
|
+
var originNetwork = reactRedux.useSelector(selectSourceChain);
|
|
2904
|
+
var targetNetwork = reactRedux.useSelector(selectTargetChain);
|
|
2905
|
+
React.useEffect(function () {
|
|
2906
|
+
if (!nodeProviderQuery || !originNetwork || !targetNetwork || !transactionOption && mode === exports.ModeOptions.payment) return;
|
|
2907
|
+
(function () {
|
|
2908
|
+
try {
|
|
2909
|
+
return _catch(function () {
|
|
2910
|
+
if (originNetwork === exports.SupportNetworks.FIAT || targetNetwork === exports.SupportNetworks.FIAT) {
|
|
2911
|
+
dispatch(setSelectedToken('KEUR'));
|
|
2912
|
+
return;
|
|
2913
|
+
}
|
|
2914
|
+
return Promise.resolve(fetchWrapper.get(nodeProviderQuery + "/kima-finance/kima-blockchain/chains/get_currencies/" + originNetwork + "/" + targetNetwork)).then(function (coins) {
|
|
2915
|
+
var _tokenList = coins.Currencies.map(function (coin) {
|
|
2916
|
+
return coin.toUpperCase();
|
|
2917
|
+
}) || ['USDK'];
|
|
2918
|
+
if (originNetwork === exports.SupportNetworks.BTC || targetNetwork === exports.SupportNetworks.BTC) {
|
|
2919
|
+
_tokenList = ['WBTC'];
|
|
2920
|
+
}
|
|
2921
|
+
if (transactionOption !== null && transactionOption !== void 0 && transactionOption.currency && _tokenList.findIndex(function (item) {
|
|
2922
|
+
return item === transactionOption.currency;
|
|
2923
|
+
}) >= 0) {
|
|
2924
|
+
dispatch(setSelectedToken(transactionOption.currency));
|
|
2925
|
+
} else {
|
|
2926
|
+
dispatch(setSelectedToken(_tokenList[0]));
|
|
2927
|
+
}
|
|
2928
|
+
setTokenList(_tokenList);
|
|
2929
|
+
});
|
|
2930
|
+
}, function (e) {
|
|
2931
|
+
console.log('rpc disconnected', e);
|
|
2932
|
+
toast__default.error('rpc disconnected');
|
|
2933
|
+
});
|
|
2934
|
+
} catch (e) {
|
|
2935
|
+
Promise.reject(e);
|
|
2936
|
+
}
|
|
2937
|
+
})();
|
|
2938
|
+
}, [nodeProviderQuery, originNetwork, targetNetwork, transactionOption, mode]);
|
|
2939
|
+
return React.useMemo(function () {
|
|
2940
|
+
return {
|
|
2941
|
+
tokenList: tokenList
|
|
2942
|
+
};
|
|
2943
|
+
}, [tokenList]);
|
|
2944
|
+
}
|
|
2945
|
+
|
|
2903
2946
|
var CoinDropdown = function CoinDropdown() {
|
|
2904
2947
|
var _COIN_LIST;
|
|
2905
2948
|
var ref = React.useRef();
|
|
@@ -2908,7 +2951,8 @@ var CoinDropdown = function CoinDropdown() {
|
|
|
2908
2951
|
collapsed = _useState[0],
|
|
2909
2952
|
setCollapsed = _useState[1];
|
|
2910
2953
|
var selectedCoin = reactRedux.useSelector(selectSelectedToken);
|
|
2911
|
-
var
|
|
2954
|
+
var _useCurrencyOptions = useCurrencyOptions(),
|
|
2955
|
+
tokenList = _useCurrencyOptions.tokenList;
|
|
2912
2956
|
var theme = reactRedux.useSelector(selectTheme);
|
|
2913
2957
|
var Icon = ((_COIN_LIST = COIN_LIST[selectedCoin || 'USDK']) === null || _COIN_LIST === void 0 ? void 0 : _COIN_LIST.icon) || COIN_LIST['USDK'].icon;
|
|
2914
2958
|
React.useEffect(function () {
|
|
@@ -7918,58 +7962,6 @@ var BankPopup = function BankPopup(_ref) {
|
|
|
7918
7962
|
}))));
|
|
7919
7963
|
};
|
|
7920
7964
|
|
|
7921
|
-
function useCurrencyOptions() {
|
|
7922
|
-
var dispatch = reactRedux.useDispatch();
|
|
7923
|
-
var _useState = React.useState('USDK'),
|
|
7924
|
-
options = _useState[0],
|
|
7925
|
-
setOptions = _useState[1];
|
|
7926
|
-
var transactionOption = reactRedux.useSelector(selectTransactionOption);
|
|
7927
|
-
var nodeProviderQuery = reactRedux.useSelector(selectNodeProviderQuery);
|
|
7928
|
-
var originNetwork = reactRedux.useSelector(selectSourceChain);
|
|
7929
|
-
var targetNetwork = reactRedux.useSelector(selectTargetChain);
|
|
7930
|
-
React.useEffect(function () {
|
|
7931
|
-
if (!nodeProviderQuery || !originNetwork || !targetNetwork || !transactionOption) return;
|
|
7932
|
-
(function () {
|
|
7933
|
-
try {
|
|
7934
|
-
return _catch(function () {
|
|
7935
|
-
if (originNetwork === exports.SupportNetworks.FIAT || targetNetwork === exports.SupportNetworks.FIAT) {
|
|
7936
|
-
setOptions('KEUR');
|
|
7937
|
-
return;
|
|
7938
|
-
}
|
|
7939
|
-
return Promise.resolve(fetchWrapper.get(nodeProviderQuery + "/kima-finance/kima-blockchain/chains/get_currencies/" + originNetwork + "/" + targetNetwork)).then(function (coins) {
|
|
7940
|
-
var tokenList = coins.Currencies.map(function (coin) {
|
|
7941
|
-
return coin.toUpperCase();
|
|
7942
|
-
}) || ['USDK'];
|
|
7943
|
-
if (originNetwork === exports.SupportNetworks.BTC || targetNetwork === exports.SupportNetworks.BTC) {
|
|
7944
|
-
tokenList = ['WBTC'];
|
|
7945
|
-
}
|
|
7946
|
-
if (transactionOption.currency && tokenList.findIndex(function (item) {
|
|
7947
|
-
return item === transactionOption.currency;
|
|
7948
|
-
}) >= 0) {
|
|
7949
|
-
dispatch(setSelectedToken(transactionOption.currency));
|
|
7950
|
-
setOptions(transactionOption.currency);
|
|
7951
|
-
} else {
|
|
7952
|
-
dispatch(setSelectedToken(tokenList[0]));
|
|
7953
|
-
setOptions(tokenList[0]);
|
|
7954
|
-
}
|
|
7955
|
-
dispatch(setAvailableTokenList(tokenList));
|
|
7956
|
-
});
|
|
7957
|
-
}, function (e) {
|
|
7958
|
-
console.log('rpc disconnected', e);
|
|
7959
|
-
toast__default.error('rpc disconnected');
|
|
7960
|
-
});
|
|
7961
|
-
} catch (e) {
|
|
7962
|
-
Promise.reject(e);
|
|
7963
|
-
}
|
|
7964
|
-
})();
|
|
7965
|
-
}, [nodeProviderQuery, originNetwork, targetNetwork, transactionOption]);
|
|
7966
|
-
return React.useMemo(function () {
|
|
7967
|
-
return {
|
|
7968
|
-
options: options
|
|
7969
|
-
};
|
|
7970
|
-
}, [options]);
|
|
7971
|
-
}
|
|
7972
|
-
|
|
7973
7965
|
var useWidth = function useWidth() {
|
|
7974
7966
|
var _useState = React.useState(window.innerWidth),
|
|
7975
7967
|
width = _useState[0],
|
|
@@ -12024,8 +12016,7 @@ var TransferWidget = function TransferWidget(_ref) {
|
|
|
12024
12016
|
var errorHandler = reactRedux.useSelector(selectErrorHandler);
|
|
12025
12017
|
var keplrHandler = reactRedux.useSelector(selectKeplrHandler);
|
|
12026
12018
|
var closeHandler = reactRedux.useSelector(selectCloseHandler);
|
|
12027
|
-
var
|
|
12028
|
-
selectedToken = _useCurrencyOptions.options;
|
|
12019
|
+
var selectedToken = reactRedux.useSelector(selectSelectedToken);
|
|
12029
12020
|
var backendUrl = reactRedux.useSelector(selectBackendUrl);
|
|
12030
12021
|
var nodeProviderQuery = reactRedux.useSelector(selectNodeProviderQuery);
|
|
12031
12022
|
var bankDetails = reactRedux.useSelector(selectBankDetails);
|
|
@@ -12154,9 +12145,6 @@ var TransferWidget = function TransferWidget(_ref) {
|
|
|
12154
12145
|
Promise.reject(e);
|
|
12155
12146
|
}
|
|
12156
12147
|
}, [nodeProviderQuery]);
|
|
12157
|
-
React.useEffect(function () {
|
|
12158
|
-
dispatch(setSelectedToken(selectedToken));
|
|
12159
|
-
}, [selectedToken]);
|
|
12160
12148
|
React.useEffect(function () {
|
|
12161
12149
|
if (!isReady) {
|
|
12162
12150
|
if (formStep > 0) setFormStep(0);
|
|
@@ -12327,10 +12315,7 @@ var TransferWidget = function TransferWidget(_ref) {
|
|
|
12327
12315
|
var handleSubmit = function handleSubmit() {
|
|
12328
12316
|
try {
|
|
12329
12317
|
var _temp8 = function _temp8(_result2) {
|
|
12330
|
-
|
|
12331
|
-
if (_exit) return _result2;
|
|
12332
|
-
return _catch(function () {
|
|
12333
|
-
var _exit3 = false;
|
|
12318
|
+
return _exit ? _result2 : _catch(function () {
|
|
12334
12319
|
if (sourceChain === exports.SupportNetworks.FIAT || targetChain === exports.SupportNetworks.FIAT) return;
|
|
12335
12320
|
setSubmitting(true);
|
|
12336
12321
|
if (dAppOption === exports.DAppOptions.LPDrain || dAppOption === exports.DAppOptions.LPAdd) {
|
|
@@ -12340,8 +12325,6 @@ var TransferWidget = function TransferWidget(_ref) {
|
|
|
12340
12325
|
return Promise.resolve(checkPoolBalance()).then(function (_checkPoolBalance) {
|
|
12341
12326
|
if (!_checkPoolBalance) {
|
|
12342
12327
|
setSubmitting(false);
|
|
12343
|
-
_exit2 = true;
|
|
12344
|
-
return;
|
|
12345
12328
|
}
|
|
12346
12329
|
var params;
|
|
12347
12330
|
var feeParam;
|