btc-wallet 0.3.13 → 0.3.14

Sign up to get free protection for your applications and to get access to all the features.
package/esm/index.js CHANGED
@@ -3174,13 +3174,13 @@ function getAccountInfo(csna, accountContractId) {
3174
3174
  }
3175
3175
  function checkGasTokenArrears(debtInfo, isDev, autoDeposit) {
3176
3176
  return __async(this, null, function* () {
3177
+ if (!debtInfo)
3178
+ return;
3177
3179
  const config = yield getConfig(isDev);
3178
- const transferAmount = debtInfo.transfer_amount || "0";
3180
+ const transferAmount = debtInfo.transfer_amount;
3179
3181
  console.log("get_account debtInfo:", debtInfo);
3180
- if (transferAmount === "0")
3181
- return;
3182
3182
  const action = {
3183
- receiver_id: config.token,
3183
+ receiver_id: config.accountContractId,
3184
3184
  amount: transferAmount,
3185
3185
  msg: JSON.stringify("Deposit")
3186
3186
  };
@@ -3306,13 +3306,13 @@ function executeBTCDepositAndAction(_0) {
3306
3306
  if (new Big(rawDepositAmount).lt(0)) {
3307
3307
  throw new Error("amount must be greater than 0");
3308
3308
  }
3309
- const { depositAmount } = yield getDepositAmount(rawDepositAmount, {
3309
+ const { depositAmount, receiveAmount } = yield getDepositAmount(rawDepositAmount, {
3310
3310
  isDev
3311
3311
  });
3312
3312
  const accountInfo = yield getAccountInfo(csna, config.accountContractId);
3313
3313
  const newActions = [];
3314
3314
  const gasLimit = new Big(50).mul(__pow(10, 12)).toFixed(0);
3315
- const repayAction = yield checkGasTokenArrears(accountInfo.debt_info, isDev);
3315
+ const repayAction = yield checkGasTokenArrears(accountInfo.debt_info, isDev, false);
3316
3316
  if (repayAction) {
3317
3317
  newActions.push(__spreadProps(__spreadValues({}, repayAction), {
3318
3318
  gas: gasLimit
@@ -3320,7 +3320,7 @@ function executeBTCDepositAndAction(_0) {
3320
3320
  }
3321
3321
  if (action) {
3322
3322
  newActions.push(__spreadProps(__spreadValues({}, action), {
3323
- amount: (repayAction == null ? void 0 : repayAction.amount) && !fixedAmount ? new Big(depositAmount).minus(repayAction.amount).toString() : depositAmount.toString(),
3323
+ amount: (repayAction == null ? void 0 : repayAction.amount) && !fixedAmount ? new Big(receiveAmount).minus(repayAction.amount).toString() : receiveAmount.toString(),
3324
3324
  gas: gasLimit
3325
3325
  }));
3326
3326
  }
@@ -3840,7 +3840,7 @@ function setupBTCWallet({
3840
3840
 
3841
3841
  // src/index.ts
3842
3842
  var getVersion = () => {
3843
- return "0.3.13";
3843
+ return "0.3.14";
3844
3844
  };
3845
3845
  if (typeof window !== "undefined") {
3846
3846
  window.__PARTICLE_BTC_CONNECT_VERSION = getVersion();