@kimafinance/kima-transaction-widget 1.2.27-beta.1 → 1.2.29-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/index.js CHANGED
@@ -1204,9 +1204,7 @@ var _optionSlice$actions = optionSlice.actions,
1204
1204
  setSignature = _optionSlice$actions.setSignature,
1205
1205
  setUuid = _optionSlice$actions.setUuid,
1206
1206
  setKYCStatus = _optionSlice$actions.setKYCStatus,
1207
- setExpireTime = _optionSlice$actions.setExpireTime,
1208
- setPendingTxData = _optionSlice$actions.setPendingTxData,
1209
- setPendingTxs = _optionSlice$actions.setPendingTxs;
1207
+ setExpireTime = _optionSlice$actions.setExpireTime;
1210
1208
  var optionReducer = optionSlice.reducer;
1211
1209
 
1212
1210
  var configureStore = toolkitRaw.configureStore;
@@ -1294,93 +1292,6 @@ const _iteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.it
1294
1292
 
1295
1293
  const _asyncIteratorSymbol = /*#__PURE__*/ typeof Symbol !== "undefined" ? (Symbol.asyncIterator || (Symbol.asyncIterator = Symbol("Symbol.asyncIterator"))) : "@@asyncIterator";
1296
1294
 
1297
- // Asynchronously implement a generic for loop
1298
- function _for(test, update, body) {
1299
- var stage;
1300
- for (;;) {
1301
- var shouldContinue = test();
1302
- if (_isSettledPact(shouldContinue)) {
1303
- shouldContinue = shouldContinue.v;
1304
- }
1305
- if (!shouldContinue) {
1306
- return result;
1307
- }
1308
- if (shouldContinue.then) {
1309
- stage = 0;
1310
- break;
1311
- }
1312
- var result = body();
1313
- if (result && result.then) {
1314
- if (_isSettledPact(result)) {
1315
- result = result.s;
1316
- } else {
1317
- stage = 1;
1318
- break;
1319
- }
1320
- }
1321
- if (update) {
1322
- var updateValue = update();
1323
- if (updateValue && updateValue.then && !_isSettledPact(updateValue)) {
1324
- stage = 2;
1325
- break;
1326
- }
1327
- }
1328
- }
1329
- var pact = new _Pact();
1330
- var reject = _settle.bind(null, pact, 2);
1331
- (stage === 0 ? shouldContinue.then(_resumeAfterTest) : stage === 1 ? result.then(_resumeAfterBody) : updateValue.then(_resumeAfterUpdate)).then(void 0, reject);
1332
- return pact;
1333
- function _resumeAfterBody(value) {
1334
- result = value;
1335
- do {
1336
- if (update) {
1337
- updateValue = update();
1338
- if (updateValue && updateValue.then && !_isSettledPact(updateValue)) {
1339
- updateValue.then(_resumeAfterUpdate).then(void 0, reject);
1340
- return;
1341
- }
1342
- }
1343
- shouldContinue = test();
1344
- if (!shouldContinue || (_isSettledPact(shouldContinue) && !shouldContinue.v)) {
1345
- _settle(pact, 1, result);
1346
- return;
1347
- }
1348
- if (shouldContinue.then) {
1349
- shouldContinue.then(_resumeAfterTest).then(void 0, reject);
1350
- return;
1351
- }
1352
- result = body();
1353
- if (_isSettledPact(result)) {
1354
- result = result.v;
1355
- }
1356
- } while (!result || !result.then);
1357
- result.then(_resumeAfterBody).then(void 0, reject);
1358
- }
1359
- function _resumeAfterTest(shouldContinue) {
1360
- if (shouldContinue) {
1361
- result = body();
1362
- if (result && result.then) {
1363
- result.then(_resumeAfterBody).then(void 0, reject);
1364
- } else {
1365
- _resumeAfterBody(result);
1366
- }
1367
- } else {
1368
- _settle(pact, 1, result);
1369
- }
1370
- }
1371
- function _resumeAfterUpdate() {
1372
- if (shouldContinue = test()) {
1373
- if (shouldContinue.then) {
1374
- shouldContinue.then(_resumeAfterTest).then(void 0, reject);
1375
- } else {
1376
- _resumeAfterTest(shouldContinue);
1377
- }
1378
- } else {
1379
- _settle(pact, 1, result);
1380
- }
1381
- }
1382
- }
1383
-
1384
1295
  // Asynchronously implement a do ... while loop
1385
1296
  function _do(body, test) {
1386
1297
  var awaitBody;
@@ -2216,13 +2127,6 @@ function useIsWalletReady() {
2216
2127
  var correctEvmNetwork = CHAIN_NAMES_TO_IDS[correctChain];
2217
2128
  var hasCorrectEvmNetwork = evmChainId === correctEvmNetwork;
2218
2129
  var events = react.useWeb3ModalEvents();
2219
- var _useState = React.useState('loading'),
2220
- capabilityState = _useState[0],
2221
- setCapabilityState = _useState[1];
2222
- var _useState2 = React.useState(),
2223
- capabilities = _useState2[0],
2224
- setCapabilities = _useState2[1];
2225
- var capabilityMessage = capabilityState === 'loading' ? 'Checking capabilities...' : capabilityState === 'cancelled' ? 'Capability check cancelled by wallet. Please refresh the page and try again.' : capabilityState === 'missing' ? 'Could not find an installed Sats Connect capable wallet. Please install a wallet and try again.' : !capabilities ? 'Something went wrong with getting capabilities' : undefined;
2226
2130
  React.useEffect(function () {
2227
2131
  var _events$data, _events$data2;
2228
2132
  if (((_events$data = events.data) === null || _events$data === void 0 ? void 0 : _events$data.event) === 'SELECT_WALLET' || ((_events$data2 = events.data) === null || _events$data2 === void 0 ? void 0 : _events$data2.event) === 'CONNECT_SUCCESS') {
@@ -2230,50 +2134,6 @@ function useIsWalletReady() {
2230
2134
  localStorage.setItem('wallet', (_events$data3 = events.data) === null || _events$data3 === void 0 ? void 0 : (_events$data3$propert = _events$data3.properties) === null || _events$data3$propert === void 0 ? void 0 : _events$data3$propert.name);
2231
2135
  }
2232
2136
  }, [events]);
2233
- React.useEffect(function () {
2234
- var runCapabilityCheck = function runCapabilityCheck() {
2235
- try {
2236
- var runs = 0;
2237
- var MAX_RUNS = 20;
2238
- setCapabilityState('loading');
2239
- var _temp3 = _for(function () {
2240
- return runs < MAX_RUNS;
2241
- }, void 0, function () {
2242
- function _temp2() {
2243
- return Promise.resolve(new Promise(function (resolve) {
2244
- return setTimeout(resolve, 100);
2245
- })).then(function () {});
2246
- }
2247
- var _temp = _catch(function () {
2248
- return Promise.resolve(satsConnect.getCapabilities({
2249
- onFinish: function onFinish(response) {
2250
- setCapabilities(new Set(response));
2251
- setCapabilityState('loaded');
2252
- },
2253
- onCancel: function onCancel() {
2254
- setCapabilityState('cancelled');
2255
- },
2256
- payload: {
2257
- network: {
2258
- type: satsConnect.BitcoinNetworkType.Testnet
2259
- }
2260
- }
2261
- })).then(function () {});
2262
- }, function () {
2263
- runs++;
2264
- if (runs === MAX_RUNS) {
2265
- setCapabilityState('missing');
2266
- }
2267
- });
2268
- return _temp && _temp.then ? _temp.then(_temp2) : _temp2(_temp);
2269
- });
2270
- return Promise.resolve(_temp3 && _temp3.then ? _temp3.then(function () {}) : void 0);
2271
- } catch (e) {
2272
- return Promise.reject(e);
2273
- }
2274
- };
2275
- runCapabilityCheck();
2276
- }, []);
2277
2137
  var connectBitcoinWallet = React.useCallback(function () {
2278
2138
  try {
2279
2139
  return Promise.resolve(satsConnect.getAddress({
@@ -2334,7 +2194,7 @@ function useIsWalletReady() {
2334
2194
  if (bitcoinAddress) {
2335
2195
  return createWalletStatus(true, undefined, connectBitcoinWallet, bitcoinAddress);
2336
2196
  }
2337
- return createWalletStatus(false, capabilityMessage, connectBitcoinWallet, '');
2197
+ return createWalletStatus(false, 'Xverse wallet connection error', connectBitcoinWallet, '');
2338
2198
  } else if (isEVMChain(correctChain) && hasEthInfo && evmAddress) {
2339
2199
  if (hasCorrectEvmNetwork) {
2340
2200
  return createWalletStatus(true, undefined, connectBitcoinWallet, evmAddress);
@@ -8707,55 +8567,6 @@ var TransferWidget = function TransferWidget(_ref) {
8707
8567
  React.useEffect(function () {
8708
8568
  dispatch(setTheme(theme));
8709
8569
  }, [theme]);
8710
- React.useEffect(function () {
8711
- if (!nodeProviderQuery || !walletAddress || sourceChain !== exports.SupportNetworks.BTC) return;
8712
- var updatePendingTxData = function updatePendingTxData() {
8713
- try {
8714
- var _temp9 = _catch(function () {
8715
- return Promise.resolve(fetchWrapper.get(nodeProviderQuery + "/kima-finance/kima-blockchain/transaction/get_htlc_transaction/" + walletAddress)).then(function (result) {
8716
- var data = result === null || result === void 0 ? void 0 : result.htlcLockingTransaction;
8717
- var txData = [];
8718
- if (data.length > 0) {
8719
- for (var _iterator5 = _createForOfIteratorHelperLoose(data), _step5; !(_step5 = _iterator5()).done;) {
8720
- var tx = _step5.value;
8721
- var status = '';
8722
- if (tx.status !== 'Completed') {
8723
- status = 'Confirming';
8724
- } else if (tx.pull_status === 'htlc_pull_available') {
8725
- status = 'Pending';
8726
- } else if (tx.pull_status === 'htlc_pull_in_progress') {
8727
- status = 'In Progress';
8728
- } else if (tx.pull_status === 'htlc_pull_succeed') {
8729
- status = 'Completed';
8730
- } else if (tx.pull_status === 'htlc_pull_failed') {
8731
- status = 'Failed';
8732
- }
8733
- txData.push({
8734
- hash: tx.txHash,
8735
- amount: tx.amount,
8736
- expireTime: tx.htlcTimestamp,
8737
- status: status
8738
- });
8739
- }
8740
- dispatch(setPendingTxData(txData));
8741
- dispatch(setPendingTxs(txData.filter(function (tx) {
8742
- return tx.status === 'Pending' || tx.status === 'Confirming';
8743
- }).length));
8744
- console.log(txData.filter(function (tx) {
8745
- return tx.status === 'Pending' || tx.status === 'Confirming';
8746
- }).length, txData);
8747
- }
8748
- });
8749
- }, function (e) {
8750
- console.log(e);
8751
- });
8752
- return Promise.resolve(_temp9 && _temp9.then ? _temp9.then(function () {}) : void 0);
8753
- } catch (e) {
8754
- return Promise.reject(e);
8755
- }
8756
- };
8757
- updatePendingTxData();
8758
- }, [sourceChain, nodeProviderQuery, walletAddress]);
8759
8570
  return React__default.createElement("div", {
8760
8571
  className: "kima-card " + theme.colorMode + " font-" + theme.fontSize,
8761
8572
  style: {