btc-wallet 0.4.1-beta → 0.4.3-beta
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/core/btcUtils.d.ts +1 -1
 - package/dist/index.js +10 -3
 - package/dist/index.js.map +2 -2
 - package/esm/index.js +10 -3
 - package/esm/index.js.map +2 -2
 - package/package.json +1 -1
 
    
        package/esm/index.js
    CHANGED
    
    | 
         @@ -3259,6 +3259,8 @@ function getAccountInfo(csna, accountContractId) { 
     | 
|
| 
       3259 
3259 
     | 
    
         
             
              return __async(this, null, function* () {
         
     | 
| 
       3260 
3260 
     | 
    
         
             
                const accountInfo = yield nearCall(accountContractId, "get_account", {
         
     | 
| 
       3261 
3261 
     | 
    
         
             
                  account_id: csna
         
     | 
| 
      
 3262 
     | 
    
         
            +
                }).catch((error) => {
         
     | 
| 
      
 3263 
     | 
    
         
            +
                  return void 0;
         
     | 
| 
       3262 
3264 
     | 
    
         
             
                });
         
     | 
| 
       3263 
3265 
     | 
    
         
             
                console.log("get_account accountInfo:", accountInfo);
         
     | 
| 
       3264 
3266 
     | 
    
         
             
                return accountInfo;
         
     | 
| 
         @@ -3371,8 +3373,11 @@ function sendBitcoin(address, amount, feeRate) { 
     | 
|
| 
       3371 
3373 
     | 
    
         
             
            }
         
     | 
| 
       3372 
3374 
     | 
    
         
             
            function estimateDepositAmount(amount, option) {
         
     | 
| 
       3373 
3375 
     | 
    
         
             
              return __async(this, null, function* () {
         
     | 
| 
      
 3376 
     | 
    
         
            +
                const config = yield getConfig((option == null ? void 0 : option.env) || "mainnet");
         
     | 
| 
      
 3377 
     | 
    
         
            +
                const csna = yield getCsnaAccountId((option == null ? void 0 : option.env) || "mainnet");
         
     | 
| 
      
 3378 
     | 
    
         
            +
                const accountInfo = yield getAccountInfo(csna, config.accountContractId);
         
     | 
| 
       3374 
3379 
     | 
    
         
             
                const { receiveAmount } = yield getDepositAmount(amount, __spreadProps(__spreadValues({}, option), { isEstimate: true }));
         
     | 
| 
       3375 
     | 
    
         
            -
                return receiveAmount;
         
     | 
| 
      
 3380 
     | 
    
         
            +
                return (accountInfo == null ? void 0 : accountInfo.nonce) ? receiveAmount : new Big(receiveAmount).minus(NBTC_STORAGE_DEPOSIT_AMOUNT).round(0, Big.roundDown).toNumber();
         
     | 
| 
       3376 
3381 
     | 
    
         
             
              });
         
     | 
| 
       3377 
3382 
     | 
    
         
             
            }
         
     | 
| 
       3378 
3383 
     | 
    
         
             
            function getDepositAmount(amount, option) {
         
     | 
| 
         @@ -3874,8 +3879,10 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({ 
     | 
|
| 
       3874 
3879 
     | 
    
         
             
                    near_transactions: transactions2
         
     | 
| 
       3875 
3880 
     | 
    
         
             
                  });
         
     | 
| 
       3876 
3881 
     | 
    
         
             
                  const predictedGasAmount = new Big2(predictedGas).mul(1.2).toFixed(0);
         
     | 
| 
      
 3882 
     | 
    
         
            +
                  const miniGasAmount = 200 * transactions2.length;
         
     | 
| 
      
 3883 
     | 
    
         
            +
                  const gasAmount = Math.max(Number(predictedGasAmount), miniGasAmount);
         
     | 
| 
       3877 
3884 
     | 
    
         
             
                  console.log("predictedGas:", predictedGasAmount);
         
     | 
| 
       3878 
     | 
    
         
            -
                  return  
     | 
| 
      
 3885 
     | 
    
         
            +
                  return gasAmount.toString();
         
     | 
| 
       3879 
3886 
     | 
    
         
             
                });
         
     | 
| 
       3880 
3887 
     | 
    
         
             
              }
         
     | 
| 
       3881 
3888 
     | 
    
         
             
              function calculateGasStrategy(gasTokenBalance, transactions2) {
         
     | 
| 
         @@ -4007,7 +4014,7 @@ function setupBTCWallet({ 
     | 
|
| 
       4007 
4014 
     | 
    
         | 
| 
       4008 
4015 
     | 
    
         
             
            // src/index.ts
         
     | 
| 
       4009 
4016 
     | 
    
         
             
            var getVersion = () => {
         
     | 
| 
       4010 
     | 
    
         
            -
              return "0.4. 
     | 
| 
      
 4017 
     | 
    
         
            +
              return "0.4.3-beta";
         
     | 
| 
       4011 
4018 
     | 
    
         
             
            };
         
     | 
| 
       4012 
4019 
     | 
    
         
             
            if (typeof window !== "undefined") {
         
     | 
| 
       4013 
4020 
     | 
    
         
             
              window.__BTC_WALLET_VERSION = getVersion();
         
     |