btc-wallet 0.5.97-beta → 0.5.99-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 -2
- package/dist/index.js +13 -11
- package/dist/index.js.map +3 -3
- package/esm/index.js +13 -11
- package/esm/index.js.map +3 -3
- package/package.json +1 -1
package/dist/core/btcUtils.d.ts
CHANGED
|
@@ -27,11 +27,10 @@ export declare function getBtcBalance(account?: string): Promise<{
|
|
|
27
27
|
availableBalance: number;
|
|
28
28
|
}>;
|
|
29
29
|
export declare function sendBitcoin(address: string, amount: number, feeRate: number): Promise<string>;
|
|
30
|
+
export declare function getPublicKeyBase58(): Promise<any>;
|
|
30
31
|
export declare function signMessage(message: string): Promise<{
|
|
31
32
|
signature: string;
|
|
32
33
|
publicKey: string;
|
|
33
|
-
signatureBase58: any;
|
|
34
|
-
publicKeyBase58: any;
|
|
35
34
|
}>;
|
|
36
35
|
/** estimate deposit receive amount, deduct protocol fee and repay amount */
|
|
37
36
|
export declare function estimateDepositAmount(amount: string, option?: {
|
package/dist/index.js
CHANGED
|
@@ -120,6 +120,7 @@ __export(src_exports, {
|
|
|
120
120
|
getBtcUtxos: () => getBtcUtxos,
|
|
121
121
|
getCsnaAccountId: () => getCsnaAccountId,
|
|
122
122
|
getDepositAmount: () => getDepositAmount,
|
|
123
|
+
getPublicKeyBase58: () => getPublicKeyBase58,
|
|
123
124
|
getVersion: () => getVersion,
|
|
124
125
|
getWalletConfig: () => getWalletConfig,
|
|
125
126
|
getWithdrawTransaction: () => getWithdrawTransaction,
|
|
@@ -3975,12 +3976,10 @@ function sendBitcoin(address, amount, feeRate) {
|
|
|
3975
3976
|
return txHash;
|
|
3976
3977
|
});
|
|
3977
3978
|
}
|
|
3978
|
-
function
|
|
3979
|
+
function getPublicKeyBase58() {
|
|
3979
3980
|
return __async(this, null, function* () {
|
|
3980
|
-
const {
|
|
3981
|
+
const { getPublicKey } = getBtcProvider();
|
|
3981
3982
|
const publicKey = yield getPublicKey();
|
|
3982
|
-
const signature = yield signMessage2(message);
|
|
3983
|
-
const signatureBase58 = import_bs582.default.encode(Buffer.from(signature, "base64"));
|
|
3984
3983
|
const publicKeyBuffer = Buffer.from(publicKey, "hex");
|
|
3985
3984
|
let uncompressedPublicKey;
|
|
3986
3985
|
if (publicKeyBuffer.length === 33) {
|
|
@@ -3996,12 +3995,15 @@ function signMessage(message) {
|
|
|
3996
3995
|
}
|
|
3997
3996
|
const publicKeyWithoutPrefix = uncompressedPublicKey.subarray(1);
|
|
3998
3997
|
const publicKeyBase58 = import_bs582.default.encode(publicKeyWithoutPrefix);
|
|
3999
|
-
return
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
|
|
4003
|
-
|
|
4004
|
-
};
|
|
3998
|
+
return publicKeyBase58;
|
|
3999
|
+
});
|
|
4000
|
+
}
|
|
4001
|
+
function signMessage(message) {
|
|
4002
|
+
return __async(this, null, function* () {
|
|
4003
|
+
const { signMessage: signMessage2, getPublicKey } = getBtcProvider();
|
|
4004
|
+
const publicKey = yield getPublicKey();
|
|
4005
|
+
const signature = yield signMessage2(message);
|
|
4006
|
+
return { signature, publicKey };
|
|
4005
4007
|
});
|
|
4006
4008
|
}
|
|
4007
4009
|
function estimateDepositAmount(amount, option) {
|
|
@@ -5448,7 +5450,7 @@ function getGroup(state) {
|
|
|
5448
5450
|
|
|
5449
5451
|
// src/index.ts
|
|
5450
5452
|
var getVersion = () => {
|
|
5451
|
-
return "0.5.
|
|
5453
|
+
return "0.5.99-beta";
|
|
5452
5454
|
};
|
|
5453
5455
|
if (typeof window !== "undefined") {
|
|
5454
5456
|
window.__BTC_WALLET_VERSION = getVersion();
|