btc-wallet 0.3.14 → 0.3.15
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/config.d.ts +1 -0
- package/dist/core/btcUtils.d.ts +1 -0
- package/dist/index.js +30 -10
- package/dist/index.js.map +3 -3
- package/esm/index.js +30 -10
- package/esm/index.js.map +2 -2
- package/package.json +1 -1
package/esm/index.js
CHANGED
@@ -2686,21 +2686,24 @@ var walletConfig = {
|
|
2686
2686
|
token: "nbtc-dev.testnet",
|
2687
2687
|
accountContractId: "acc-dev.testnet",
|
2688
2688
|
bridgeContractId: "brg-dev.testnet",
|
2689
|
-
walletUrl: "https://wallet-dev.satoshibridge.top"
|
2689
|
+
walletUrl: "https://wallet-dev.satoshibridge.top",
|
2690
|
+
bridgeUrl: "https://dev.satoshibridge.top/"
|
2690
2691
|
},
|
2691
2692
|
testnet: {
|
2692
2693
|
base_url: "https://api.testnet.satoshibridge.top",
|
2693
2694
|
token: "nbtc2-nsp.testnet",
|
2694
|
-
accountContractId: "
|
2695
|
+
accountContractId: "acc2-nsp.testnet",
|
2695
2696
|
bridgeContractId: "brg2-nsp.testnet",
|
2696
|
-
walletUrl: "https://wallet-test.satoshibridge.top"
|
2697
|
+
walletUrl: "https://wallet-test.satoshibridge.top",
|
2698
|
+
bridgeUrl: "https://testnet.satoshibridge.top/"
|
2697
2699
|
},
|
2698
2700
|
mainnet: {
|
2699
2701
|
base_url: "https://api.mainnet.satoshibridge.top",
|
2700
|
-
token: "",
|
2701
|
-
accountContractId: "",
|
2702
|
-
bridgeContractId: "",
|
2703
|
-
walletUrl: "https://wallet.satoshibridge.top"
|
2702
|
+
token: "nbtc.toalice.near",
|
2703
|
+
accountContractId: "acc.toalice.near",
|
2704
|
+
bridgeContractId: "brg.toalice.near",
|
2705
|
+
walletUrl: "https://wallet.satoshibridge.top",
|
2706
|
+
bridgeUrl: "https://www.satoshibridge.top/"
|
2704
2707
|
}
|
2705
2708
|
};
|
2706
2709
|
var nearRpcUrls = {
|
@@ -3135,6 +3138,8 @@ Dialog.style = `
|
|
3135
3138
|
`;
|
3136
3139
|
|
3137
3140
|
// src/core/btcUtils.ts
|
3141
|
+
var MINIMUM_DEPOSIT_AMOUNT = 5e3;
|
3142
|
+
var MINIMUM_DEPOSIT_AMOUNT_BASE = 1e3;
|
3138
3143
|
function getBtcProvider() {
|
3139
3144
|
if (typeof window === "undefined" || !window.btcContext) {
|
3140
3145
|
throw new Error("BTC Provider is not initialized.");
|
@@ -3172,6 +3177,21 @@ function getAccountInfo(csna, accountContractId) {
|
|
3172
3177
|
return accountInfo;
|
3173
3178
|
});
|
3174
3179
|
}
|
3180
|
+
function checkGasTokenBalance(csna, gasToken, isDev) {
|
3181
|
+
return __async(this, null, function* () {
|
3182
|
+
const amount = yield nearCall(gasToken, "ft_balance_of", { account_id: csna });
|
3183
|
+
console.log("gas token balance:", amount);
|
3184
|
+
if (new Big(amount).lte(MINIMUM_DEPOSIT_AMOUNT_BASE)) {
|
3185
|
+
yield Dialog.confirm({
|
3186
|
+
title: "Gas token balance is insufficient",
|
3187
|
+
message: "Please deposit gas token to continue, will open bridge website."
|
3188
|
+
});
|
3189
|
+
const config = yield getConfig(isDev);
|
3190
|
+
window.open(config.bridgeUrl, "_blank");
|
3191
|
+
throw new Error("Gas token balance is insufficient");
|
3192
|
+
}
|
3193
|
+
});
|
3194
|
+
}
|
3175
3195
|
function checkGasTokenArrears(debtInfo, isDev, autoDeposit) {
|
3176
3196
|
return __async(this, null, function* () {
|
3177
3197
|
if (!debtInfo)
|
@@ -3248,8 +3268,6 @@ function sendBitcoin(address, amount, feeRate) {
|
|
3248
3268
|
return txHash;
|
3249
3269
|
});
|
3250
3270
|
}
|
3251
|
-
var MINIMUM_DEPOSIT_AMOUNT = 5e3;
|
3252
|
-
var MINIMUM_DEPOSIT_AMOUNT_BASE = 1e3;
|
3253
3271
|
function estimateDepositAmount(amount, option) {
|
3254
3272
|
return __async(this, null, function* () {
|
3255
3273
|
const { receiveAmount } = yield getDepositAmount(amount, __spreadProps(__spreadValues({}, option), { isEstimate: true }));
|
@@ -3581,6 +3599,7 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
|
|
3581
3599
|
const btcContext = window.btcContext;
|
3582
3600
|
const accountId = state.getAccount();
|
3583
3601
|
const accountInfo = yield getAccountInfo(accountId, currentConfig.accountContractId);
|
3602
|
+
yield checkGasTokenBalance(accountId, currentConfig.token, isDev);
|
3584
3603
|
yield checkGasTokenArrears(accountInfo.debt_info, isDev, true);
|
3585
3604
|
const trans = [...params.transactions];
|
3586
3605
|
console.log("raw trans:", trans);
|
@@ -3840,7 +3859,7 @@ function setupBTCWallet({
|
|
3840
3859
|
|
3841
3860
|
// src/index.ts
|
3842
3861
|
var getVersion = () => {
|
3843
|
-
return "0.3.
|
3862
|
+
return "0.3.15";
|
3844
3863
|
};
|
3845
3864
|
if (typeof window !== "undefined") {
|
3846
3865
|
window.__PARTICLE_BTC_CONNECT_VERSION = getVersion();
|
@@ -3859,6 +3878,7 @@ export {
|
|
3859
3878
|
WizzConnector,
|
3860
3879
|
XverseConnector,
|
3861
3880
|
checkGasTokenArrears,
|
3881
|
+
checkGasTokenBalance,
|
3862
3882
|
estimateDepositAmount,
|
3863
3883
|
executeBTCDepositAndAction,
|
3864
3884
|
getAccountInfo,
|