btc-wallet 0.5.13-beta → 0.5.15-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/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/dist/index.js
CHANGED
@@ -3229,7 +3229,9 @@ function getWhitelist(url) {
|
|
3229
3229
|
|
3230
3230
|
// src/core/btcUtils.ts
|
3231
3231
|
var import_bitcoinjs_lib = __toESM(require("bitcoinjs-lib"), 1);
|
3232
|
+
var ecc = __toESM(require("@bitcoinerlab/secp256k1"), 1);
|
3232
3233
|
var import_coinselect = __toESM(require("coinselect"), 1);
|
3234
|
+
import_bitcoinjs_lib.default.initEccLib(ecc);
|
3233
3235
|
var NEAR_STORAGE_DEPOSIT_AMOUNT = "1250000000000000000000";
|
3234
3236
|
var NBTC_STORAGE_DEPOSIT_AMOUNT = "3000";
|
3235
3237
|
var GAS_LIMIT = "50000000000000";
|
@@ -4407,11 +4409,6 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
|
|
4407
4409
|
tokenId: currentConfig.nearToken,
|
4408
4410
|
env
|
4409
4411
|
});
|
4410
|
-
const { balance: btcBalance } = yield getTokenBalance({
|
4411
|
-
csna: accountId,
|
4412
|
-
tokenId: currentConfig.btcToken,
|
4413
|
-
env
|
4414
|
-
});
|
4415
4412
|
const transferAmount = transactions2.reduce(
|
4416
4413
|
(acc, tx) => {
|
4417
4414
|
tx.actions.forEach((action) => {
|
@@ -4431,12 +4428,7 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
|
|
4431
4428
|
{ near: new import_big2.default(0), btc: new import_big2.default(0) }
|
4432
4429
|
);
|
4433
4430
|
const nearAvailableBalance = new import_big2.default(nearBalance).minus(transferAmount.near).toNumber();
|
4434
|
-
const btcAvailableBalance = new import_big2.default(btcBalance).minus(transferAmount.btc).toNumber();
|
4435
|
-
if (btcAvailableBalance < 8e-6) {
|
4436
|
-
throw new Error("BTC balance is not enough, please deposit more BTC.");
|
4437
|
-
}
|
4438
4431
|
console.log("available near balance:", nearAvailableBalance);
|
4439
|
-
console.log("available btc balance:", btcAvailableBalance);
|
4440
4432
|
console.log("available gas token balance:", gasTokenBalance);
|
4441
4433
|
const convertTx = yield Promise.all(
|
4442
4434
|
transactions2.map((transaction, index) => convertTransactionToTxHex(transaction, index))
|
@@ -4584,7 +4576,7 @@ function setupBTCWallet({
|
|
4584
4576
|
|
4585
4577
|
// src/index.ts
|
4586
4578
|
var getVersion = () => {
|
4587
|
-
return "0.5.
|
4579
|
+
return "0.5.15-beta";
|
4588
4580
|
};
|
4589
4581
|
if (typeof window !== "undefined") {
|
4590
4582
|
window.__BTC_WALLET_VERSION = getVersion();
|