btc-wallet 0.5.65-beta → 0.5.67-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/core/btcUtils.d.ts +1 -0
- package/dist/index.js +24 -16
- package/dist/index.js.map +3 -3
- package/esm/index.js +24 -16
- package/esm/index.js.map +3 -3
- package/package.json +1 -1
package/dist/core/btcUtils.d.ts
CHANGED
@@ -22,6 +22,7 @@ export declare function getBtcBalance(account?: string): Promise<{
|
|
22
22
|
availableBalance: number;
|
23
23
|
}>;
|
24
24
|
export declare function sendBitcoin(address: string, amount: number, feeRate: number): Promise<string>;
|
25
|
+
export declare function signMessage(message: string): Promise<string>;
|
25
26
|
/** estimate deposit receive amount, deduct protocol fee and repay amount */
|
26
27
|
export declare function estimateDepositAmount(amount: string, option?: {
|
27
28
|
env?: ENV;
|
package/dist/index.js
CHANGED
@@ -124,6 +124,7 @@ __export(src_exports, {
|
|
124
124
|
sendBitcoin: () => sendBitcoin,
|
125
125
|
setupBTCWallet: () => setupBTCWallet,
|
126
126
|
setupWalletSelectorModal: () => setupWalletSelectorModal,
|
127
|
+
signMessage: () => signMessage,
|
127
128
|
useAccountContract: () => useAccountContract,
|
128
129
|
useAccounts: () => useAccounts,
|
129
130
|
useBTCProvider: () => useBTCProvider,
|
@@ -1077,7 +1078,7 @@ var MagicEdenConnector = class extends BaseConnector {
|
|
1077
1078
|
if (addresses.length === 0) {
|
1078
1079
|
throw new Error(`${this.metadata.name} not connected!`);
|
1079
1080
|
}
|
1080
|
-
const { signMessage } = yield import("sats-connect");
|
1081
|
+
const { signMessage: signMessage2 } = yield import("sats-connect");
|
1081
1082
|
const sig = yield new Promise((resolve, reject) => {
|
1082
1083
|
const signMessageOptions = {
|
1083
1084
|
payload: {
|
@@ -1097,7 +1098,7 @@ var MagicEdenConnector = class extends BaseConnector {
|
|
1097
1098
|
});
|
1098
1099
|
}
|
1099
1100
|
};
|
1100
|
-
|
1101
|
+
signMessage2(signMessageOptions).catch((e) => {
|
1101
1102
|
reject(e);
|
1102
1103
|
});
|
1103
1104
|
});
|
@@ -1229,7 +1230,7 @@ var useBTCProvider = () => {
|
|
1229
1230
|
provider,
|
1230
1231
|
accounts,
|
1231
1232
|
getPublicKey,
|
1232
|
-
signMessage,
|
1233
|
+
signMessage: signMessage2,
|
1233
1234
|
getNetwork: getNetwork2,
|
1234
1235
|
switchNetwork,
|
1235
1236
|
sendBitcoin: sendBitcoin2
|
@@ -1248,7 +1249,7 @@ var useBTCProvider = () => {
|
|
1248
1249
|
provider,
|
1249
1250
|
accounts,
|
1250
1251
|
getPublicKey,
|
1251
|
-
signMessage,
|
1252
|
+
signMessage: signMessage2,
|
1252
1253
|
getNetwork: getNetwork2,
|
1253
1254
|
switchNetwork,
|
1254
1255
|
sendBitcoin: sendBitcoin2,
|
@@ -2484,7 +2485,7 @@ var ConnectProvider = ({
|
|
2484
2485
|
const pubKey = yield connector2.getPublicKey();
|
2485
2486
|
return pubKey;
|
2486
2487
|
}), [getConnector]);
|
2487
|
-
const
|
2488
|
+
const signMessage2 = (0, import_react10.useCallback)(
|
2488
2489
|
(message) => __async(void 0, null, function* () {
|
2489
2490
|
if (!connector) {
|
2490
2491
|
throw new Error("Wallet not connected!");
|
@@ -2538,9 +2539,9 @@ var ConnectProvider = ({
|
|
2538
2539
|
window.__bitcoinSmartAccount = smartAccount2;
|
2539
2540
|
}
|
2540
2541
|
window.__bitcoinSmartAccount.provider.getPublicKey = getPublicKey;
|
2541
|
-
window.__bitcoinSmartAccount.provider.personalSign =
|
2542
|
+
window.__bitcoinSmartAccount.provider.personalSign = signMessage2;
|
2542
2543
|
return window.__bitcoinSmartAccount;
|
2543
|
-
}, [options, evmSupportChainIds, getPublicKey,
|
2544
|
+
}, [options, evmSupportChainIds, getPublicKey, signMessage2, accountContract]);
|
2544
2545
|
const requestAccount = (0, import_react10.useCallback)(
|
2545
2546
|
(connector2) => __async(void 0, null, function* () {
|
2546
2547
|
let accounts2 = yield connector2.getAccounts();
|
@@ -2685,7 +2686,7 @@ var ConnectProvider = ({
|
|
2685
2686
|
disconnect,
|
2686
2687
|
requestDirectAccount,
|
2687
2688
|
getPublicKey,
|
2688
|
-
signMessage,
|
2689
|
+
signMessage: signMessage2,
|
2689
2690
|
evmAccount,
|
2690
2691
|
smartAccount,
|
2691
2692
|
getNetwork: getNetwork2,
|
@@ -2852,7 +2853,7 @@ function useBtcWalletSelector() {
|
|
2852
2853
|
sendBitcoin: sendBitcoin2,
|
2853
2854
|
getPublicKey,
|
2854
2855
|
provider,
|
2855
|
-
signMessage,
|
2856
|
+
signMessage: signMessage2,
|
2856
2857
|
connector,
|
2857
2858
|
getNetwork: getNetwork2,
|
2858
2859
|
switchNetwork
|
@@ -2929,7 +2930,7 @@ function useBtcWalletSelector() {
|
|
2929
2930
|
}),
|
2930
2931
|
signMessage: (msg) => __async(this, null, function* () {
|
2931
2932
|
yield connectWallet(false);
|
2932
|
-
return
|
2933
|
+
return signMessage2(msg);
|
2933
2934
|
}),
|
2934
2935
|
getContext: () => {
|
2935
2936
|
return context;
|
@@ -2952,7 +2953,7 @@ function useBtcWalletSelector() {
|
|
2952
2953
|
requestDirectAccount,
|
2953
2954
|
disconnect,
|
2954
2955
|
getPublicKey,
|
2955
|
-
|
2956
|
+
signMessage2
|
2956
2957
|
]);
|
2957
2958
|
return hook;
|
2958
2959
|
}
|
@@ -3907,6 +3908,13 @@ function sendBitcoin(address, amount, feeRate) {
|
|
3907
3908
|
return txHash;
|
3908
3909
|
});
|
3909
3910
|
}
|
3911
|
+
function signMessage(message) {
|
3912
|
+
return __async(this, null, function* () {
|
3913
|
+
const { signMessage: signMessage2 } = getBtcProvider();
|
3914
|
+
const signature = yield signMessage2(message);
|
3915
|
+
return signature;
|
3916
|
+
});
|
3917
|
+
}
|
3910
3918
|
function estimateDepositAmount(amount, option) {
|
3911
3919
|
return __async(this, null, function* () {
|
3912
3920
|
return amount;
|
@@ -4837,7 +4845,7 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
|
|
4837
4845
|
signOut,
|
4838
4846
|
getAccounts,
|
4839
4847
|
verifyOwner,
|
4840
|
-
signMessage,
|
4848
|
+
signMessage: signMessage2,
|
4841
4849
|
isSignedIn,
|
4842
4850
|
signAndSendTransaction,
|
4843
4851
|
signAndSendTransactions
|
@@ -5022,7 +5030,7 @@ var BTCWallet = (_0) => __async(void 0, [_0], function* ({
|
|
5022
5030
|
throw new Error(`Method not supported by ${metadata.name}`);
|
5023
5031
|
});
|
5024
5032
|
}
|
5025
|
-
function
|
5033
|
+
function signMessage2() {
|
5026
5034
|
return __async(this, null, function* () {
|
5027
5035
|
throw new Error(`Method not supported by ${metadata.name}`);
|
5028
5036
|
});
|
@@ -5222,9 +5230,9 @@ function setupWalletSelectorModal(selector, options) {
|
|
5222
5230
|
return modal;
|
5223
5231
|
}
|
5224
5232
|
var CHAINS = [
|
5225
|
-
{ id: "
|
5233
|
+
{ id: "near", name: "Near", description: "Near Account" },
|
5226
5234
|
{ id: "eth", name: "Ethereum", description: "EVM address as Near Account" },
|
5227
|
-
{ id: "
|
5235
|
+
{ id: "btc", name: "Bitcoin", description: "MPC Mapping" }
|
5228
5236
|
];
|
5229
5237
|
function openChainModal(group) {
|
5230
5238
|
return __async(this, null, function* () {
|
@@ -5278,7 +5286,7 @@ function getGroup(state) {
|
|
5278
5286
|
|
5279
5287
|
// src/index.ts
|
5280
5288
|
var getVersion = () => {
|
5281
|
-
return "0.5.
|
5289
|
+
return "0.5.67-beta";
|
5282
5290
|
};
|
5283
5291
|
if (typeof window !== "undefined") {
|
5284
5292
|
window.__BTC_WALLET_VERSION = getVersion();
|