btc-wallet 0.5.4-beta → 0.5.6-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 +22 -24
- package/dist/index.js.map +2 -2
- package/esm/index.js +22 -24
- package/esm/index.js.map +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
@@ -713,26 +713,19 @@ var XverseConnector = class extends BaseConnector {
|
|
713
713
|
downloadUrl: "https://www.xverse.app"
|
714
714
|
};
|
715
715
|
this.loadAccounts = (network) => __async(this, null, function* () {
|
716
|
-
const {
|
717
|
-
const
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
onFinish: (response) => {
|
727
|
-
resolve(response.addresses);
|
728
|
-
},
|
729
|
-
onCancel: () => reject({
|
730
|
-
code: 4001,
|
731
|
-
message: "User rejected the request."
|
732
|
-
})
|
733
|
-
};
|
734
|
-
getAddress(getAddressOptions).catch((error) => reject(error));
|
716
|
+
const { AddressPurpose } = yield import("sats-connect");
|
717
|
+
const provider = this.getProvider();
|
718
|
+
if (!provider) {
|
719
|
+
throw new Error(`${this.metadata.name} is not install!`);
|
720
|
+
}
|
721
|
+
yield provider.request("wallet_requestPermissions", void 0);
|
722
|
+
const { result: walletType } = yield provider.request("wallet_getWalletType", void 0);
|
723
|
+
const { result } = yield provider.request("getAddresses", {
|
724
|
+
purposes: [AddressPurpose.Payment, AddressPurpose.Ordinals],
|
725
|
+
message: "Address for receiving Ordinals and payments"
|
735
726
|
});
|
727
|
+
const addresses = result.addresses.map((item) => __spreadProps(__spreadValues({}, item), { walletType }));
|
728
|
+
console.log("\u{1F680} ~ XverseConnector ~ loadAccounts ~ res:", addresses);
|
736
729
|
localStorage.setItem("btc-connect-xverse-addresses-" + network, JSON.stringify(addresses));
|
737
730
|
return addresses;
|
738
731
|
});
|
@@ -3405,6 +3398,9 @@ function getCsnaAccountId(env) {
|
|
3405
3398
|
const config = yield getConfig(env);
|
3406
3399
|
const { getPublicKey } = getBtcProvider();
|
3407
3400
|
const btcPublicKey = yield getPublicKey();
|
3401
|
+
if (!btcPublicKey) {
|
3402
|
+
throw new Error("BTC Public Key is not available.");
|
3403
|
+
}
|
3408
3404
|
const csna = yield nearCall(
|
3409
3405
|
config.accountContractId,
|
3410
3406
|
"get_chain_signature_near_account_id",
|
@@ -3523,7 +3519,7 @@ function executeBTCDepositAndAction(_0) {
|
|
3523
3519
|
}
|
3524
3520
|
function checkSatoshiWhitelist(btcAccountId, env = "mainnet") {
|
3525
3521
|
return __async(this, null, function* () {
|
3526
|
-
if (env !== "
|
3522
|
+
if (env !== "mainnet")
|
3527
3523
|
return;
|
3528
3524
|
const hasShownNotice = localStorage.getItem("btc-wallet-private-mainnet-notice");
|
3529
3525
|
if (!hasShownNotice) {
|
@@ -3869,7 +3865,9 @@ function setupButtonClickHandler(button, iframe, wallet, originalWallet) {
|
|
3869
3865
|
iframe.src = iframeSrc.toString();
|
3870
3866
|
const actions = {
|
3871
3867
|
signAndSendTransaction: wallet.signAndSendTransaction,
|
3872
|
-
|
3868
|
+
signAndSendTransactions: wallet.signAndSendTransactions,
|
3869
|
+
executeBTCDepositAndAction,
|
3870
|
+
getWithdrawTransaction
|
3873
3871
|
};
|
3874
3872
|
window.addEventListener("message", (event) => __async(this, null, function* () {
|
3875
3873
|
var _a2, _b;
|
@@ -4046,6 +4044,7 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
|
|
4046
4044
|
yield checkBtcNetwork(walletNetwork);
|
4047
4045
|
if (!state.isValid()) {
|
4048
4046
|
state.clear();
|
4047
|
+
console.log("setupBtcContextListeners clear");
|
4049
4048
|
}
|
4050
4049
|
validateWalletState();
|
4051
4050
|
const btcContext = window.btcContext;
|
@@ -4068,6 +4067,7 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
|
|
4068
4067
|
context.on("updatePublicKey", (btcPublicKey) => __async(this, null, function* () {
|
4069
4068
|
console.log("updatePublicKey");
|
4070
4069
|
state.clear();
|
4070
|
+
console.log("updatePublicKey clear");
|
4071
4071
|
try {
|
4072
4072
|
const { nearAddress, nearPublicKey } = yield getNearAccountByBtcPublicKey(btcPublicKey);
|
4073
4073
|
if (!nearAddress || !nearPublicKey) {
|
@@ -4079,8 +4079,6 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
|
|
4079
4079
|
yield handleConnectionUpdate();
|
4080
4080
|
} catch (error) {
|
4081
4081
|
console.error("Error updating public key:", error);
|
4082
|
-
state.clear();
|
4083
|
-
emitter.emit("accountsChanged", { accounts: [] });
|
4084
4082
|
}
|
4085
4083
|
}));
|
4086
4084
|
context.on("btcLoginError", () => __async(this, null, function* () {
|
@@ -4481,7 +4479,7 @@ function setupBTCWallet({
|
|
4481
4479
|
|
4482
4480
|
// src/index.ts
|
4483
4481
|
var getVersion = () => {
|
4484
|
-
return "0.5.
|
4482
|
+
return "0.5.6-beta";
|
4485
4483
|
};
|
4486
4484
|
if (typeof window !== "undefined") {
|
4487
4485
|
window.__BTC_WALLET_VERSION = getVersion();
|