btc-wallet 0.4.8-beta → 0.5.1-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/README.md +3 -1
- package/dist/core/btcUtils.d.ts +4 -1
- package/dist/index.js +21 -18
- package/dist/index.js.map +2 -2
- package/esm/index.js +21 -18
- package/esm/index.js.map +2 -2
- package/package.json +2 -1
package/esm/index.js
CHANGED
@@ -2806,6 +2806,7 @@ function useBtcWalletSelector() {
|
|
2806
2806
|
}),
|
2807
2807
|
autoConnect: () => __async(this, null, function* () {
|
2808
2808
|
requestDirectAccount(connectorRef.current).catch((e) => {
|
2809
|
+
console.error("btcLoginError", e);
|
2809
2810
|
context.emit("btcLoginError");
|
2810
2811
|
});
|
2811
2812
|
}),
|
@@ -2875,16 +2876,16 @@ var walletConfig = {
|
|
2875
2876
|
token: "nbtc.toalice.near",
|
2876
2877
|
accountContractId: "acc.toalice.near",
|
2877
2878
|
bridgeContractId: "brg.toalice.near",
|
2878
|
-
walletUrl: "
|
2879
|
-
bridgeUrl: "https://ramp.satos.network
|
2879
|
+
walletUrl: "http://localhost:3100",
|
2880
|
+
bridgeUrl: "https://old.ramp.satos.network"
|
2880
2881
|
},
|
2881
2882
|
mainnet: {
|
2882
|
-
base_url: "https://api.
|
2883
|
-
token: "nbtc.
|
2884
|
-
accountContractId: "acc.
|
2885
|
-
bridgeContractId: "
|
2883
|
+
base_url: "https://api.satos.network",
|
2884
|
+
token: "nbtc.bridge.near",
|
2885
|
+
accountContractId: "acc.ref-labs.near",
|
2886
|
+
bridgeContractId: "btc-connector.bridge.near",
|
2886
2887
|
walletUrl: "https://wallet.satoshibridge.top",
|
2887
|
-
bridgeUrl: "https://
|
2888
|
+
bridgeUrl: "https://ramp.satos.network"
|
2888
2889
|
}
|
2889
2890
|
};
|
2890
2891
|
var nearRpcUrls = {
|
@@ -2957,6 +2958,7 @@ function createFloatingButtonWithIframe({
|
|
2957
2958
|
userSelect: "none"
|
2958
2959
|
});
|
2959
2960
|
document.body.appendChild(button);
|
2961
|
+
updateIframePosition(iframe, right, bottom, windowWidth, windowHeight);
|
2960
2962
|
let isDragging = false;
|
2961
2963
|
let startX = 0;
|
2962
2964
|
let startY = 0;
|
@@ -3396,10 +3398,11 @@ var NBTC_STORAGE_DEPOSIT_AMOUNT = "3000";
|
|
3396
3398
|
var GAS_LIMIT = "50000000000000";
|
3397
3399
|
var NEW_ACCOUNT_MIN_DEPOSIT_AMOUNT = "1000";
|
3398
3400
|
function getBtcProvider() {
|
3399
|
-
|
3401
|
+
var _a, _b;
|
3402
|
+
if (typeof window === "undefined" || !window.btcContext && !((_a = window.top) == null ? void 0 : _a.btcContext)) {
|
3400
3403
|
throw new Error("BTC Provider is not initialized.");
|
3401
3404
|
}
|
3402
|
-
return window.btcContext;
|
3405
|
+
return window.btcContext || ((_b = window.top) == null ? void 0 : _b.btcContext);
|
3403
3406
|
}
|
3404
3407
|
function getNetwork() {
|
3405
3408
|
return __async(this, null, function* () {
|
@@ -3553,7 +3556,9 @@ function estimateDepositAmount(amount, option) {
|
|
3553
3556
|
}
|
3554
3557
|
function getDepositAmount(amount, option) {
|
3555
3558
|
return __async(this, null, function* () {
|
3559
|
+
var _a;
|
3556
3560
|
const env = (option == null ? void 0 : option.env) || "mainnet";
|
3561
|
+
const _newAccountMinDepositAmount = (_a = option == null ? void 0 : option.newAccountMinDepositAmount) != null ? _a : true;
|
3557
3562
|
const config = yield getConfig(env);
|
3558
3563
|
const csna = yield getCsnaAccountId(env);
|
3559
3564
|
const accountInfo = yield getAccountInfo(csna, config.accountContractId);
|
@@ -3565,7 +3570,7 @@ function getDepositAmount(amount, option) {
|
|
3565
3570
|
} = yield nearCall(config.bridgeContractId, "get_config", {});
|
3566
3571
|
const depositAmount = Math.max(Number(min_deposit_amount), Number(amount));
|
3567
3572
|
const protocolFee = Math.max(Number(fee_min), Number(depositAmount) * fee_rate);
|
3568
|
-
const newAccountMinDepositAmount = !(accountInfo == null ? void 0 : accountInfo.nonce) ? NEW_ACCOUNT_MIN_DEPOSIT_AMOUNT : 0;
|
3573
|
+
const newAccountMinDepositAmount = !(accountInfo == null ? void 0 : accountInfo.nonce) && _newAccountMinDepositAmount ? NEW_ACCOUNT_MIN_DEPOSIT_AMOUNT : 0;
|
3569
3574
|
const totalDepositAmount = new Big(depositAmount).plus(protocolFee).plus(repayAmount).plus(newAccountMinDepositAmount).round(0, Big.roundDown).toNumber();
|
3570
3575
|
return {
|
3571
3576
|
depositAmount,
|
@@ -3598,7 +3603,8 @@ function executeBTCDepositAndAction(_0) {
|
|
3598
3603
|
feeRate,
|
3599
3604
|
pollResult = true,
|
3600
3605
|
registerDeposit,
|
3601
|
-
env = "mainnet"
|
3606
|
+
env = "mainnet",
|
3607
|
+
newAccountMinDepositAmount
|
3602
3608
|
}) {
|
3603
3609
|
var _a;
|
3604
3610
|
try {
|
@@ -3617,7 +3623,8 @@ function executeBTCDepositAndAction(_0) {
|
|
3617
3623
|
throw new Error("amount must be greater than 0");
|
3618
3624
|
}
|
3619
3625
|
const { totalDepositAmount, protocolFee, repayAmount } = yield getDepositAmount(depositAmount, {
|
3620
|
-
env
|
3626
|
+
env,
|
3627
|
+
newAccountMinDepositAmount
|
3621
3628
|
});
|
3622
3629
|
const accountInfo = yield getAccountInfo(csna, config.accountContractId);
|
3623
3630
|
const newActions = [];
|
@@ -3994,7 +4001,7 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
|
|
3994
4001
|
if (btcContext.account) {
|
3995
4002
|
const btcPublicKey = yield btcContext.getPublicKey();
|
3996
4003
|
if (btcPublicKey) {
|
3997
|
-
|
4004
|
+
yield getNearAccountByBtcPublicKey(btcPublicKey);
|
3998
4005
|
yield checkSatoshiWhitelist(btcContext.account, env);
|
3999
4006
|
removeWalletButton();
|
4000
4007
|
setupWalletButton(env, wallet, btcContext);
|
@@ -4026,10 +4033,6 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
|
|
4026
4033
|
}
|
4027
4034
|
}));
|
4028
4035
|
context.on("btcLoginError", () => __async(this, null, function* () {
|
4029
|
-
console.log("btcLoginError");
|
4030
|
-
state.clear();
|
4031
|
-
emitter.emit("accountsChanged", { accounts: [] });
|
4032
|
-
yield handleConnectionUpdate();
|
4033
4036
|
}));
|
4034
4037
|
context.on("btcLogOut", () => __async(this, null, function* () {
|
4035
4038
|
console.log("btcLogOut");
|
@@ -4386,7 +4389,7 @@ function setupBTCWallet({
|
|
4386
4389
|
|
4387
4390
|
// src/index.ts
|
4388
4391
|
var getVersion = () => {
|
4389
|
-
return "0.
|
4392
|
+
return "0.5.1-beta";
|
4390
4393
|
};
|
4391
4394
|
if (typeof window !== "undefined") {
|
4392
4395
|
window.__BTC_WALLET_VERSION = getVersion();
|