btc-wallet 0.5.13-beta → 0.5.15-beta
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.js +3 -11
- package/dist/index.js.map +3 -3
- package/esm/index.js +3 -11
- package/esm/index.js.map +2 -2
- package/package.json +2 -1
package/esm/index.js
CHANGED
@@ -3179,7 +3179,9 @@ function getWhitelist(url) {
|
|
3179
3179
|
|
3180
3180
|
// src/core/btcUtils.ts
|
3181
3181
|
import bitcoin from "bitcoinjs-lib";
|
3182
|
+
import * as ecc from "@bitcoinerlab/secp256k1";
|
3182
3183
|
import coinselect from "coinselect";
|
3184
|
+
bitcoin.initEccLib(ecc);
|
3183
3185
|
var NEAR_STORAGE_DEPOSIT_AMOUNT = "1250000000000000000000";
|
3184
3186
|
var NBTC_STORAGE_DEPOSIT_AMOUNT = "3000";
|
3185
3187
|
var GAS_LIMIT = "50000000000000";
|
@@ -4357,11 +4359,6 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
|
|
4357
4359
|
tokenId: currentConfig.nearToken,
|
4358
4360
|
env
|
4359
4361
|
});
|
4360
|
-
const { balance: btcBalance } = yield getTokenBalance({
|
4361
|
-
csna: accountId,
|
4362
|
-
tokenId: currentConfig.btcToken,
|
4363
|
-
env
|
4364
|
-
});
|
4365
4362
|
const transferAmount = transactions2.reduce(
|
4366
4363
|
(acc, tx) => {
|
4367
4364
|
tx.actions.forEach((action) => {
|
@@ -4381,12 +4378,7 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
|
|
4381
4378
|
{ near: new Big2(0), btc: new Big2(0) }
|
4382
4379
|
);
|
4383
4380
|
const nearAvailableBalance = new Big2(nearBalance).minus(transferAmount.near).toNumber();
|
4384
|
-
const btcAvailableBalance = new Big2(btcBalance).minus(transferAmount.btc).toNumber();
|
4385
|
-
if (btcAvailableBalance < 8e-6) {
|
4386
|
-
throw new Error("BTC balance is not enough, please deposit more BTC.");
|
4387
|
-
}
|
4388
4381
|
console.log("available near balance:", nearAvailableBalance);
|
4389
|
-
console.log("available btc balance:", btcAvailableBalance);
|
4390
4382
|
console.log("available gas token balance:", gasTokenBalance);
|
4391
4383
|
const convertTx = yield Promise.all(
|
4392
4384
|
transactions2.map((transaction, index) => convertTransactionToTxHex(transaction, index))
|
@@ -4534,7 +4526,7 @@ function setupBTCWallet({
|
|
4534
4526
|
|
4535
4527
|
// src/index.ts
|
4536
4528
|
var getVersion = () => {
|
4537
|
-
return "0.5.
|
4529
|
+
return "0.5.15-beta";
|
4538
4530
|
};
|
4539
4531
|
if (typeof window !== "undefined") {
|
4540
4532
|
window.__BTC_WALLET_VERSION = getVersion();
|