@kimafinance/kima-transaction-widget 1.2.77-beta.1 → 1.2.79-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
@@ -7360,12 +7360,11 @@ function useAllowance(_ref) {
7360
7360
  var _temp2 = function () {
7361
7361
  if (solanaAddress && tokenAddress && connection) {
7362
7362
  return Promise.resolve(fetchWrapper.get(kimaBackendUrl + "/sol/allowance/" + tokenAddress + "/" + solanaAddress.toBase58())).then(function (allowanceInfo) {
7363
- var tokenAllowance = allowanceInfo.allowance;
7364
- return Promise.resolve(fetchWrapper.get(kimaBackendUrl + "/sol/balances/" + tokenAddress + "/" + solanaAddress.toBase58())).then(function (balanceInfo) {
7365
- var decimals = balanceInfo.decimals;
7366
- setDecimals(decimals || 0);
7367
- setAllowance(+units.formatUnits(tokenAllowance, decimals));
7368
- });
7363
+ var tokenAllowance = allowanceInfo.allowance,
7364
+ decimals = allowanceInfo.decimals,
7365
+ spender = allowanceInfo.spender;
7366
+ setDecimals(decimals || 0);
7367
+ setAllowance(spender === targetAddress ? tokenAllowance : 0);
7369
7368
  });
7370
7369
  } else {
7371
7370
  var _temp6 = function () {
@@ -7381,7 +7380,6 @@ function useAllowance(_ref) {
7381
7380
  parsedDecimals = decimals;
7382
7381
  }
7383
7382
  return Promise.resolve(trc20Contract.allowance(tronAddress, targetAddress).call()).then(function (userAllowance) {
7384
- console.log(parsedDecimals, typeof parsedDecimals);
7385
7383
  setDecimals(parsedDecimals);
7386
7384
  setAllowance(+units.formatUnits(userAllowance, decimals));
7387
7385
  });
@@ -7428,7 +7426,6 @@ function useAllowance(_ref) {
7428
7426
  transaction.feePayer = solanaAddress;
7429
7427
  transaction.recentBlockhash = blockHash;
7430
7428
  return Promise.resolve(signSolanaTransaction(transaction)).then(function (signed) {
7431
- console.log(signed.serialize());
7432
7429
  return Promise.resolve(fetchWrapper.post(kimaBackendUrl + "/sol/send", JSON.stringify({
7433
7430
  transaction: signed.serialize()
7434
7431
  }))).then(function () {
@@ -7440,7 +7437,7 @@ function useAllowance(_ref) {
7440
7437
  var _temp13 = function () {
7441
7438
  if (!isCancel) {
7442
7439
  var _temp12 = function _temp12() {
7443
- setAllowance(+amountToShow);
7440
+ setAllowance(allowAmount);
7444
7441
  };
7445
7442
  var _temp11 = _do(function () {
7446
7443
  return Promise.resolve(fetchWrapper.get(kimaBackendUrl + "/sol/allowance/" + tokenAddress + "/" + solanaAddress.toBase58())).then(function (allowanceInfo) {
@@ -7448,7 +7445,7 @@ function useAllowance(_ref) {
7448
7445
  return Promise.resolve(sleep(2000)).then(function () {});
7449
7446
  });
7450
7447
  }, function () {
7451
- return allowAmount < +amountToShow || retryCount++ < 10;
7448
+ return allowAmount < +amountToShow && retryCount++ < 20;
7452
7449
  });
7453
7450
  return _temp11 && _temp11.then ? _temp11.then(_temp12) : _temp12(_temp11);
7454
7451
  } else {