btc-wallet 0.3.27 → 0.3.28
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +26 -0
- package/dist/index.js +21 -15
- package/dist/index.js.map +2 -2
- package/esm/index.js +21 -15
- package/esm/index.js.map +2 -2
- package/package.json +1 -1
package/esm/index.js
CHANGED
@@ -3184,6 +3184,9 @@ Dialog.style = `
|
|
3184
3184
|
// src/core/btcUtils.ts
|
3185
3185
|
var MINIMUM_DEPOSIT_AMOUNT = 5e3;
|
3186
3186
|
var MINIMUM_DEPOSIT_AMOUNT_BASE = 1e3;
|
3187
|
+
var NEAR_STORAGE_DEPOSIT_AMOUNT = "1250000000000000000000";
|
3188
|
+
var NBTC_STORAGE_DEPOSIT_AMOUNT = 3e3;
|
3189
|
+
var GAS_LIMIT = "50000000000000";
|
3187
3190
|
function getBtcProvider() {
|
3188
3191
|
if (typeof window === "undefined" || !window.btcContext) {
|
3189
3192
|
throw new Error("BTC Provider is not initialized.");
|
@@ -3393,47 +3396,50 @@ function executeBTCDepositAndAction(_0) {
|
|
3393
3396
|
});
|
3394
3397
|
const accountInfo = yield getAccountInfo(csna, config.accountContractId);
|
3395
3398
|
const newActions = [];
|
3396
|
-
const gasLimit = new Big(50).mul(__pow(10, 12)).toFixed(0);
|
3397
3399
|
const repayAction = yield checkGasTokenArrears(accountInfo == null ? void 0 : accountInfo.debt_info, env, false);
|
3398
3400
|
if (repayAction) {
|
3399
3401
|
newActions.push(__spreadProps(__spreadValues({}, repayAction), {
|
3400
|
-
gas:
|
3402
|
+
gas: GAS_LIMIT
|
3401
3403
|
}));
|
3402
3404
|
}
|
3403
3405
|
if (action || !action && new Big((accountInfo == null ? void 0 : accountInfo.gas_token[config.token]) || 0).lt(MINIMUM_DEPOSIT_AMOUNT_BASE)) {
|
3404
3406
|
newActions.push(
|
3405
3407
|
action ? __spreadProps(__spreadValues({}, action), {
|
3406
3408
|
amount: (repayAction == null ? void 0 : repayAction.amount) && !fixedAmount ? new Big(receiveAmount).minus(repayAction.amount).toString() : receiveAmount.toString(),
|
3407
|
-
gas:
|
3409
|
+
gas: GAS_LIMIT
|
3408
3410
|
}) : {
|
3409
3411
|
receiver_id: config.accountContractId,
|
3410
3412
|
amount: MINIMUM_DEPOSIT_AMOUNT_BASE.toString(),
|
3411
3413
|
msg: JSON.stringify("Deposit"),
|
3412
|
-
gas:
|
3414
|
+
gas: GAS_LIMIT
|
3413
3415
|
}
|
3414
3416
|
);
|
3415
3417
|
}
|
3416
|
-
const depositMsg = {
|
3417
|
-
recipient_id: csna,
|
3418
|
-
post_actions: newActions.length > 0 ? newActions : void 0
|
3419
|
-
};
|
3420
3418
|
const storageDepositMsg = {};
|
3421
|
-
if (!(accountInfo == null ? void 0 : accountInfo.nonce)) {
|
3422
|
-
storageDepositMsg.btc_public_key = btcPublicKey;
|
3423
|
-
}
|
3424
3419
|
const registerRes = yield nearCall((action == null ? void 0 : action.receiver_id) || config.token, "storage_balance_of", {
|
3425
3420
|
account_id: csna
|
3426
3421
|
});
|
3427
3422
|
if (!(registerRes == null ? void 0 : registerRes.available)) {
|
3428
3423
|
storageDepositMsg.storage_deposit_msg = {
|
3429
3424
|
contract_id: (action == null ? void 0 : action.receiver_id) || config.token,
|
3430
|
-
deposit:
|
3425
|
+
deposit: NEAR_STORAGE_DEPOSIT_AMOUNT,
|
3431
3426
|
registration_only: true
|
3432
3427
|
};
|
3433
3428
|
}
|
3434
|
-
if (
|
3435
|
-
|
3429
|
+
if (!(accountInfo == null ? void 0 : accountInfo.nonce)) {
|
3430
|
+
storageDepositMsg.btc_public_key = btcPublicKey;
|
3431
|
+
newActions.push({
|
3432
|
+
receiver_id: config.accountContractId,
|
3433
|
+
amount: NBTC_STORAGE_DEPOSIT_AMOUNT.toString(),
|
3434
|
+
msg: JSON.stringify("RelayerFee"),
|
3435
|
+
gas: GAS_LIMIT
|
3436
|
+
});
|
3436
3437
|
}
|
3438
|
+
const depositMsg = {
|
3439
|
+
recipient_id: csna,
|
3440
|
+
post_actions: newActions.length > 0 ? newActions : void 0,
|
3441
|
+
extra_msg: Object.keys(storageDepositMsg).length > 0 ? JSON.stringify(storageDepositMsg) : void 0
|
3442
|
+
};
|
3437
3443
|
console.log("get_user_deposit_address params:", { deposit_msg: depositMsg });
|
3438
3444
|
const userDepositAddress = yield nearCall(
|
3439
3445
|
config.bridgeContractId,
|
@@ -3948,7 +3954,7 @@ function setupBTCWallet({
|
|
3948
3954
|
|
3949
3955
|
// src/index.ts
|
3950
3956
|
var getVersion = () => {
|
3951
|
-
return "0.3.
|
3957
|
+
return "0.3.28";
|
3952
3958
|
};
|
3953
3959
|
if (typeof window !== "undefined") {
|
3954
3960
|
window.__BTC_WALLET_VERSION = getVersion();
|