@btc-vision/wallet-sdk 1.0.0
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/LICENSE +15 -0
- package/README.md +24 -0
- package/es/bundle.js +2 -0
- package/es/bundle.js.LICENSE.txt +48 -0
- package/lib/address/index.d.ts +37 -0
- package/lib/address/index.js +235 -0
- package/lib/bitcoin-core.d.ts +5 -0
- package/lib/bitcoin-core.js +37 -0
- package/lib/constants.d.ts +1 -0
- package/lib/constants.js +5 -0
- package/lib/error.d.ts +20 -0
- package/lib/error.js +29 -0
- package/lib/index.d.ts +14 -0
- package/lib/index.js +50 -0
- package/lib/keyring/hd-keyring.d.ts +50 -0
- package/lib/keyring/hd-keyring.js +238 -0
- package/lib/keyring/index.d.ts +4 -0
- package/lib/keyring/index.js +20 -0
- package/lib/keyring/interfaces/SimpleKeyringOptions.d.ts +53 -0
- package/lib/keyring/interfaces/SimpleKeyringOptions.js +85 -0
- package/lib/keyring/keystone-keyring.d.ts +82 -0
- package/lib/keyring/keystone-keyring.js +377 -0
- package/lib/keyring/simple-keyring.d.ts +11 -0
- package/lib/keyring/simple-keyring.js +66 -0
- package/lib/message/bip322-simple.d.ts +19 -0
- package/lib/message/bip322-simple.js +182 -0
- package/lib/message/deterministic-ecdsa.d.ts +2 -0
- package/lib/message/deterministic-ecdsa.js +83 -0
- package/lib/message/ecdsa.d.ts +3 -0
- package/lib/message/ecdsa.js +32 -0
- package/lib/message/index.d.ts +3 -0
- package/lib/message/index.js +19 -0
- package/lib/network/index.d.ts +14 -0
- package/lib/network/index.js +40 -0
- package/lib/runes/index.d.ts +1 -0
- package/lib/runes/index.js +17 -0
- package/lib/runes/rund_id.d.ts +11 -0
- package/lib/runes/rund_id.js +30 -0
- package/lib/runes/varint.d.ts +15 -0
- package/lib/runes/varint.js +45 -0
- package/lib/src/address/index.d.ts +37 -0
- package/lib/src/bitcoin-core.d.ts +5 -0
- package/lib/src/constants.d.ts +1 -0
- package/lib/src/error.d.ts +20 -0
- package/lib/src/index.d.ts +14 -0
- package/lib/src/keyring/hd-keyring.d.ts +50 -0
- package/lib/src/keyring/index.d.ts +4 -0
- package/lib/src/keyring/interfaces/SimpleKeyringOptions.d.ts +53 -0
- package/lib/src/keyring/keystone-keyring.d.ts +82 -0
- package/lib/src/keyring/simple-keyring.d.ts +11 -0
- package/lib/src/message/bip322-simple.d.ts +19 -0
- package/lib/src/message/deterministic-ecdsa.d.ts +2 -0
- package/lib/src/message/ecdsa.d.ts +3 -0
- package/lib/src/message/index.d.ts +3 -0
- package/lib/src/network/index.d.ts +14 -0
- package/lib/src/runes/index.d.ts +1 -0
- package/lib/src/runes/rund_id.d.ts +11 -0
- package/lib/src/runes/varint.d.ts +15 -0
- package/lib/src/transaction/index.d.ts +3 -0
- package/lib/src/transaction/inscription-utxo.d.ts +33 -0
- package/lib/src/transaction/transaction.d.ts +52 -0
- package/lib/src/transaction/utxo.d.ts +35 -0
- package/lib/src/tx-helpers/index.d.ts +8 -0
- package/lib/src/tx-helpers/send-atomicals-ft.d.ts +16 -0
- package/lib/src/tx-helpers/send-atomicals-nft.d.ts +14 -0
- package/lib/src/tx-helpers/send-btc.d.ts +28 -0
- package/lib/src/tx-helpers/send-inscription.d.ts +16 -0
- package/lib/src/tx-helpers/send-inscriptions.d.ts +14 -0
- package/lib/src/tx-helpers/send-runes.d.ts +19 -0
- package/lib/src/tx-helpers/split-inscription-utxo.d.ts +15 -0
- package/lib/src/types.d.ts +59 -0
- package/lib/src/utils.d.ts +23 -0
- package/lib/src/wallet/abstract-wallet.d.ts +6 -0
- package/lib/src/wallet/estimate-wallet.d.ts +23 -0
- package/lib/src/wallet/index.d.ts +3 -0
- package/lib/src/wallet/local-wallet.d.ts +23 -0
- package/lib/test/address/address.test.d.ts +1 -0
- package/lib/test/keyring/hd-keyring.test.d.ts +1 -0
- package/lib/test/keyring/keystone-keyring.test.d.ts +1 -0
- package/lib/test/keyring/simple-keyring.test.d.ts +1 -0
- package/lib/test/message/message.test.d.ts +1 -0
- package/lib/test/runes/varint.test.d.ts +1 -0
- package/lib/test/transaction/transaction.test.d.ts +1 -0
- package/lib/test/transaction/utxo.test.d.ts +1 -0
- package/lib/test/tx-helpers/send-atomicals-ft.test.d.ts +1 -0
- package/lib/test/tx-helpers/send-atomicals-nft.test.d.ts +1 -0
- package/lib/test/tx-helpers/send-btc.test.d.ts +1 -0
- package/lib/test/tx-helpers/send-inscription.test.d.ts +1 -0
- package/lib/test/tx-helpers/send-inscriptions.test.d.ts +1 -0
- package/lib/test/tx-helpers/send-runes.test.d.ts +1 -0
- package/lib/test/tx-helpers/split-inscription-utxo.test.d.ts +1 -0
- package/lib/test/tx-helpers/utils.d.ts +217 -0
- package/lib/test/utils.d.ts +4 -0
- package/lib/test/wallet/local-wallet.test.d.ts +1 -0
- package/lib/transaction/index.d.ts +3 -0
- package/lib/transaction/index.js +19 -0
- package/lib/transaction/inscription-utxo.d.ts +33 -0
- package/lib/transaction/inscription-utxo.js +120 -0
- package/lib/transaction/transaction.d.ts +52 -0
- package/lib/transaction/transaction.js +358 -0
- package/lib/transaction/utxo.d.ts +35 -0
- package/lib/transaction/utxo.js +107 -0
- package/lib/tx-helpers/index.d.ts +8 -0
- package/lib/tx-helpers/index.js +18 -0
- package/lib/tx-helpers/send-atomicals-ft.d.ts +16 -0
- package/lib/tx-helpers/send-atomicals-ft.js +66 -0
- package/lib/tx-helpers/send-atomicals-nft.d.ts +14 -0
- package/lib/tx-helpers/send-atomicals-nft.js +45 -0
- package/lib/tx-helpers/send-btc.d.ts +28 -0
- package/lib/tx-helpers/send-btc.js +78 -0
- package/lib/tx-helpers/send-inscription.d.ts +16 -0
- package/lib/tx-helpers/send-inscription.js +49 -0
- package/lib/tx-helpers/send-inscriptions.d.ts +14 -0
- package/lib/tx-helpers/send-inscriptions.js +45 -0
- package/lib/tx-helpers/send-runes.d.ts +19 -0
- package/lib/tx-helpers/send-runes.js +101 -0
- package/lib/tx-helpers/split-inscription-utxo.d.ts +15 -0
- package/lib/tx-helpers/split-inscription-utxo.js +58 -0
- package/lib/types.d.ts +59 -0
- package/lib/types.js +15 -0
- package/lib/utils.d.ts +23 -0
- package/lib/utils.js +71 -0
- package/lib/wallet/abstract-wallet.d.ts +6 -0
- package/lib/wallet/abstract-wallet.js +2 -0
- package/lib/wallet/estimate-wallet.d.ts +23 -0
- package/lib/wallet/estimate-wallet.js +174 -0
- package/lib/wallet/index.d.ts +3 -0
- package/lib/wallet/index.js +19 -0
- package/lib/wallet/local-wallet.d.ts +23 -0
- package/lib/wallet/local-wallet.js +183 -0
- package/package.json +97 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { NetworkType } from '../network';
|
|
2
|
+
import { ToSignInput, UnspentOutput } from '../types';
|
|
3
|
+
export declare function sendBTC(params: {
|
|
4
|
+
btcUtxos: UnspentOutput[];
|
|
5
|
+
tos: {
|
|
6
|
+
address: string;
|
|
7
|
+
satoshis: number;
|
|
8
|
+
}[];
|
|
9
|
+
networkType: NetworkType;
|
|
10
|
+
changeAddress: string;
|
|
11
|
+
feeRate: number;
|
|
12
|
+
enableRBF?: boolean;
|
|
13
|
+
memo?: string;
|
|
14
|
+
memos?: string[];
|
|
15
|
+
}): Promise<{
|
|
16
|
+
psbt: import("bitcoinjs-lib").Psbt;
|
|
17
|
+
toSignInputs: ToSignInput[];
|
|
18
|
+
}>;
|
|
19
|
+
export declare function sendAllBTC(params: {
|
|
20
|
+
btcUtxos: UnspentOutput[];
|
|
21
|
+
toAddress: string;
|
|
22
|
+
networkType: NetworkType;
|
|
23
|
+
feeRate: number;
|
|
24
|
+
enableRBF?: boolean;
|
|
25
|
+
}): Promise<{
|
|
26
|
+
psbt: import("bitcoinjs-lib").Psbt;
|
|
27
|
+
toSignInputs: ToSignInput[];
|
|
28
|
+
}>;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.sendAllBTC = exports.sendBTC = void 0;
|
|
13
|
+
const constants_1 = require("../constants");
|
|
14
|
+
const error_1 = require("../error");
|
|
15
|
+
const transaction_1 = require("../transaction");
|
|
16
|
+
function sendBTC(params) {
|
|
17
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
const { btcUtxos, tos, networkType, changeAddress, feeRate, enableRBF = true, memo, memos } = params;
|
|
19
|
+
if (transaction_1.utxoHelper.hasAnyAssets(btcUtxos)) {
|
|
20
|
+
throw new error_1.WalletUtilsError(error_1.ErrorCodes.NOT_SAFE_UTXOS);
|
|
21
|
+
}
|
|
22
|
+
const tx = new transaction_1.Transaction();
|
|
23
|
+
tx.setNetworkType(networkType);
|
|
24
|
+
tx.setFeeRate(feeRate);
|
|
25
|
+
tx.setEnableRBF(enableRBF);
|
|
26
|
+
tx.setChangeAddress(changeAddress);
|
|
27
|
+
tos.forEach((v) => {
|
|
28
|
+
tx.addOutput(v.address, v.satoshis);
|
|
29
|
+
});
|
|
30
|
+
if (memo) {
|
|
31
|
+
if (Buffer.from(memo, 'hex').toString('hex') === memo) {
|
|
32
|
+
tx.addOpreturn([Buffer.from(memo, 'hex')]);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
tx.addOpreturn([Buffer.from(memo)]);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
else if (memos) {
|
|
39
|
+
if (Buffer.from(memos[0], 'hex').toString('hex') === memos[0]) {
|
|
40
|
+
tx.addOpreturn(memos.map((memo) => Buffer.from(memo, 'hex')));
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
tx.addOpreturn(memos.map((memo) => Buffer.from(memo)));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const toSignInputs = yield tx.addSufficientUtxosForFee(btcUtxos);
|
|
47
|
+
const psbt = tx.toPsbt();
|
|
48
|
+
return { psbt, toSignInputs };
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
exports.sendBTC = sendBTC;
|
|
52
|
+
function sendAllBTC(params) {
|
|
53
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
const { btcUtxos, toAddress, networkType, feeRate, enableRBF = true } = params;
|
|
55
|
+
if (transaction_1.utxoHelper.hasAnyAssets(btcUtxos)) {
|
|
56
|
+
throw new error_1.WalletUtilsError(error_1.ErrorCodes.NOT_SAFE_UTXOS);
|
|
57
|
+
}
|
|
58
|
+
const tx = new transaction_1.Transaction();
|
|
59
|
+
tx.setNetworkType(networkType);
|
|
60
|
+
tx.setFeeRate(feeRate);
|
|
61
|
+
tx.setEnableRBF(enableRBF);
|
|
62
|
+
tx.addOutput(toAddress, constants_1.UTXO_DUST);
|
|
63
|
+
const toSignInputs = [];
|
|
64
|
+
btcUtxos.forEach((v, index) => {
|
|
65
|
+
tx.addInput(v);
|
|
66
|
+
toSignInputs.push({ index, publicKey: v.pubkey });
|
|
67
|
+
});
|
|
68
|
+
const fee = yield tx.calNetworkFee();
|
|
69
|
+
const unspent = tx.getTotalInput() - fee;
|
|
70
|
+
if (unspent < constants_1.UTXO_DUST) {
|
|
71
|
+
throw new error_1.WalletUtilsError(error_1.ErrorCodes.INSUFFICIENT_BTC_UTXO);
|
|
72
|
+
}
|
|
73
|
+
tx.outputs[0].value = unspent;
|
|
74
|
+
const psbt = tx.toPsbt();
|
|
75
|
+
return { psbt, toSignInputs };
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
exports.sendAllBTC = sendAllBTC;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { NetworkType } from '../network';
|
|
2
|
+
import { UnspentOutput } from '../types';
|
|
3
|
+
export declare function sendInscription({ assetUtxo, btcUtxos, toAddress, networkType, changeAddress, feeRate, outputValue, enableRBF, enableMixed }: {
|
|
4
|
+
assetUtxo: UnspentOutput;
|
|
5
|
+
btcUtxos: UnspentOutput[];
|
|
6
|
+
toAddress: string;
|
|
7
|
+
networkType: NetworkType;
|
|
8
|
+
changeAddress: string;
|
|
9
|
+
feeRate: number;
|
|
10
|
+
outputValue: number;
|
|
11
|
+
enableRBF?: boolean;
|
|
12
|
+
enableMixed?: boolean;
|
|
13
|
+
}): Promise<{
|
|
14
|
+
psbt: import("bitcoinjs-lib").Psbt;
|
|
15
|
+
toSignInputs: import("../types").ToSignInput[];
|
|
16
|
+
}>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.sendInscription = void 0;
|
|
13
|
+
const error_1 = require("../error");
|
|
14
|
+
const transaction_1 = require("../transaction/transaction");
|
|
15
|
+
const utxo_1 = require("../transaction/utxo");
|
|
16
|
+
function sendInscription({ assetUtxo, btcUtxos, toAddress, networkType, changeAddress, feeRate, outputValue, enableRBF = true, enableMixed = false }) {
|
|
17
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
if (utxo_1.utxoHelper.hasAnyAssets(btcUtxos)) {
|
|
19
|
+
throw new error_1.WalletUtilsError(error_1.ErrorCodes.NOT_SAFE_UTXOS);
|
|
20
|
+
}
|
|
21
|
+
if (utxo_1.utxoHelper.hasAtomicals([assetUtxo])) {
|
|
22
|
+
throw new error_1.WalletUtilsError(error_1.ErrorCodes.NOT_SAFE_UTXOS);
|
|
23
|
+
}
|
|
24
|
+
if (!enableMixed && assetUtxo.inscriptions.length !== 1) {
|
|
25
|
+
throw new error_1.WalletUtilsError(error_1.ErrorCodes.NOT_SAFE_UTXOS);
|
|
26
|
+
}
|
|
27
|
+
const maxOffset = assetUtxo.inscriptions.reduce((pre, cur) => {
|
|
28
|
+
return Math.max(pre, cur.offset);
|
|
29
|
+
}, 0);
|
|
30
|
+
if (outputValue - 1 < maxOffset) {
|
|
31
|
+
throw new error_1.WalletUtilsError(error_1.ErrorCodes.ASSET_MAYBE_LOST);
|
|
32
|
+
}
|
|
33
|
+
const tx = new transaction_1.Transaction();
|
|
34
|
+
tx.setNetworkType(networkType);
|
|
35
|
+
tx.setFeeRate(feeRate);
|
|
36
|
+
tx.setEnableRBF(enableRBF);
|
|
37
|
+
tx.setChangeAddress(changeAddress);
|
|
38
|
+
tx.addInput(assetUtxo);
|
|
39
|
+
tx.addOutput(toAddress, outputValue);
|
|
40
|
+
const toSignInputs = yield tx.addSufficientUtxosForFee(btcUtxos);
|
|
41
|
+
toSignInputs.push({
|
|
42
|
+
index: 0,
|
|
43
|
+
publicKey: assetUtxo.pubkey
|
|
44
|
+
});
|
|
45
|
+
const psbt = tx.toPsbt();
|
|
46
|
+
return { psbt, toSignInputs };
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
exports.sendInscription = sendInscription;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { NetworkType } from '../network';
|
|
2
|
+
import { ToSignInput, UnspentOutput } from '../types';
|
|
3
|
+
export declare function sendInscriptions({ assetUtxos, btcUtxos, toAddress, networkType, changeAddress, feeRate, enableRBF }: {
|
|
4
|
+
assetUtxos: UnspentOutput[];
|
|
5
|
+
btcUtxos: UnspentOutput[];
|
|
6
|
+
toAddress: string;
|
|
7
|
+
networkType: NetworkType;
|
|
8
|
+
changeAddress: string;
|
|
9
|
+
feeRate: number;
|
|
10
|
+
enableRBF?: boolean;
|
|
11
|
+
}): Promise<{
|
|
12
|
+
psbt: import("bitcoinjs-lib").Psbt;
|
|
13
|
+
toSignInputs: ToSignInput[];
|
|
14
|
+
}>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.sendInscriptions = void 0;
|
|
13
|
+
const error_1 = require("../error");
|
|
14
|
+
const transaction_1 = require("../transaction/transaction");
|
|
15
|
+
const utxo_1 = require("../transaction/utxo");
|
|
16
|
+
function sendInscriptions({ assetUtxos, btcUtxos, toAddress, networkType, changeAddress, feeRate, enableRBF = true }) {
|
|
17
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
if (utxo_1.utxoHelper.hasAnyAssets(btcUtxos)) {
|
|
19
|
+
throw new error_1.WalletUtilsError(error_1.ErrorCodes.NOT_SAFE_UTXOS);
|
|
20
|
+
}
|
|
21
|
+
if (utxo_1.utxoHelper.hasAtomicals(assetUtxos)) {
|
|
22
|
+
throw new error_1.WalletUtilsError(error_1.ErrorCodes.NOT_SAFE_UTXOS);
|
|
23
|
+
}
|
|
24
|
+
const tx = new transaction_1.Transaction();
|
|
25
|
+
tx.setNetworkType(networkType);
|
|
26
|
+
tx.setFeeRate(feeRate);
|
|
27
|
+
tx.setEnableRBF(enableRBF);
|
|
28
|
+
tx.setChangeAddress(changeAddress);
|
|
29
|
+
const toSignInputs = [];
|
|
30
|
+
for (let i = 0; i < assetUtxos.length; i++) {
|
|
31
|
+
const assetUtxo = assetUtxos[i];
|
|
32
|
+
if (assetUtxo.inscriptions.length > 1) {
|
|
33
|
+
throw new Error('Multiple inscriptions in one UTXO! Please split them first.');
|
|
34
|
+
}
|
|
35
|
+
tx.addInput(assetUtxo);
|
|
36
|
+
tx.addOutput(toAddress, assetUtxo.satoshis);
|
|
37
|
+
toSignInputs.push({ index: i, publicKey: assetUtxo.pubkey });
|
|
38
|
+
}
|
|
39
|
+
const _toSignInputs = yield tx.addSufficientUtxosForFee(btcUtxos);
|
|
40
|
+
toSignInputs.push(..._toSignInputs);
|
|
41
|
+
const psbt = tx.toPsbt();
|
|
42
|
+
return { psbt, toSignInputs };
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
exports.sendInscriptions = sendInscriptions;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { bitcoin } from '../bitcoin-core';
|
|
2
|
+
import { NetworkType } from '../network';
|
|
3
|
+
import { ToSignInput, UnspentOutput } from '../types';
|
|
4
|
+
export declare function sendRunes({ assetUtxos, btcUtxos, assetAddress, btcAddress, toAddress, networkType, runeid, runeAmount, outputValue, feeRate, enableRBF }: {
|
|
5
|
+
assetUtxos: UnspentOutput[];
|
|
6
|
+
btcUtxos: UnspentOutput[];
|
|
7
|
+
assetAddress: string;
|
|
8
|
+
btcAddress: string;
|
|
9
|
+
toAddress: string;
|
|
10
|
+
networkType: NetworkType;
|
|
11
|
+
runeid: string;
|
|
12
|
+
runeAmount: string;
|
|
13
|
+
outputValue: number;
|
|
14
|
+
feeRate: number;
|
|
15
|
+
enableRBF?: boolean;
|
|
16
|
+
}): Promise<{
|
|
17
|
+
psbt: bitcoin.Psbt;
|
|
18
|
+
toSignInputs: ToSignInput[];
|
|
19
|
+
}>;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.sendRunes = void 0;
|
|
16
|
+
const big_integer_1 = __importDefault(require("big-integer"));
|
|
17
|
+
const bitcoin_core_1 = require("../bitcoin-core");
|
|
18
|
+
const error_1 = require("../error");
|
|
19
|
+
const runes_1 = require("../runes");
|
|
20
|
+
const rund_id_1 = require("../runes/rund_id");
|
|
21
|
+
const transaction_1 = require("../transaction/transaction");
|
|
22
|
+
const utxo_1 = require("../transaction/utxo");
|
|
23
|
+
// only one arc20 can be send
|
|
24
|
+
function sendRunes({ assetUtxos, btcUtxos, assetAddress, btcAddress, toAddress, networkType, runeid, runeAmount, outputValue, feeRate, enableRBF = true }) {
|
|
25
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
// safe check
|
|
27
|
+
if (utxo_1.utxoHelper.hasAtomicalsNFT(assetUtxos) || utxo_1.utxoHelper.hasInscription(assetUtxos)) {
|
|
28
|
+
throw new error_1.WalletUtilsError(error_1.ErrorCodes.NOT_SAFE_UTXOS);
|
|
29
|
+
}
|
|
30
|
+
if (utxo_1.utxoHelper.hasAnyAssets(btcUtxos)) {
|
|
31
|
+
throw new error_1.WalletUtilsError(error_1.ErrorCodes.NOT_SAFE_UTXOS);
|
|
32
|
+
}
|
|
33
|
+
const tx = new transaction_1.Transaction();
|
|
34
|
+
tx.setNetworkType(networkType);
|
|
35
|
+
tx.setFeeRate(feeRate);
|
|
36
|
+
tx.setEnableRBF(enableRBF);
|
|
37
|
+
tx.setChangeAddress(btcAddress);
|
|
38
|
+
const toSignInputs = [];
|
|
39
|
+
// add assets
|
|
40
|
+
assetUtxos.forEach((v, index) => {
|
|
41
|
+
tx.addInput(v);
|
|
42
|
+
toSignInputs.push({ index, publicKey: v.pubkey });
|
|
43
|
+
});
|
|
44
|
+
let fromRuneAmount = (0, big_integer_1.default)(0);
|
|
45
|
+
let hasMultipleRunes = false;
|
|
46
|
+
let runesMap = {};
|
|
47
|
+
assetUtxos.forEach((v) => {
|
|
48
|
+
if (v.runes) {
|
|
49
|
+
v.runes.forEach((w) => {
|
|
50
|
+
runesMap[w.runeid] = true;
|
|
51
|
+
if (w.runeid === runeid) {
|
|
52
|
+
fromRuneAmount = fromRuneAmount.plus((0, big_integer_1.default)(w.amount));
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
if (Object.keys(runesMap).length > 1) {
|
|
58
|
+
hasMultipleRunes = true;
|
|
59
|
+
}
|
|
60
|
+
const changedRuneAmount = fromRuneAmount.minus((0, big_integer_1.default)(runeAmount));
|
|
61
|
+
if (changedRuneAmount.lt(0)) {
|
|
62
|
+
throw new error_1.WalletUtilsError(error_1.ErrorCodes.INSUFFICIENT_ASSET_UTXO);
|
|
63
|
+
}
|
|
64
|
+
let needChange = false;
|
|
65
|
+
if (hasMultipleRunes || changedRuneAmount.gt(0)) {
|
|
66
|
+
needChange = true;
|
|
67
|
+
}
|
|
68
|
+
let payload = [];
|
|
69
|
+
let runeId = rund_id_1.RuneId.fromString(runeid);
|
|
70
|
+
runes_1.varint.encodeToVec(0, payload);
|
|
71
|
+
// add send data
|
|
72
|
+
runes_1.varint.encodeToVec(runeId.block, payload);
|
|
73
|
+
runes_1.varint.encodeToVec(runeId.tx, payload);
|
|
74
|
+
runes_1.varint.encodeToVec(runeAmount, payload);
|
|
75
|
+
if (needChange) {
|
|
76
|
+
// 1 is to change
|
|
77
|
+
// 2 is to send
|
|
78
|
+
runes_1.varint.encodeToVec(2, payload);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
// 1 is to send
|
|
82
|
+
runes_1.varint.encodeToVec(1, payload);
|
|
83
|
+
}
|
|
84
|
+
// add op_return
|
|
85
|
+
tx.addScriptOutput(
|
|
86
|
+
// OUTPUT_0
|
|
87
|
+
bitcoin_core_1.bitcoin.script.compile([bitcoin_core_1.bitcoin.opcodes.OP_RETURN, bitcoin_core_1.bitcoin.opcodes.OP_13, Buffer.from(new Uint8Array(payload))]), 0);
|
|
88
|
+
if (needChange) {
|
|
89
|
+
// OUTPUT_1
|
|
90
|
+
// add change
|
|
91
|
+
tx.addOutput(assetAddress, outputValue);
|
|
92
|
+
}
|
|
93
|
+
tx.addOutput(toAddress, outputValue);
|
|
94
|
+
// add btc
|
|
95
|
+
const _toSignInputs = yield tx.addSufficientUtxosForFee(btcUtxos, true);
|
|
96
|
+
toSignInputs.push(..._toSignInputs);
|
|
97
|
+
const psbt = tx.toPsbt();
|
|
98
|
+
return { psbt, toSignInputs };
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
exports.sendRunes = sendRunes;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { NetworkType } from '../network';
|
|
2
|
+
import { ToSignInput, UnspentOutput } from '../types';
|
|
3
|
+
export declare function splitInscriptionUtxo({ btcUtxos, assetUtxo, networkType, changeAddress, feeRate, enableRBF, outputValue }: {
|
|
4
|
+
btcUtxos: UnspentOutput[];
|
|
5
|
+
assetUtxo: UnspentOutput;
|
|
6
|
+
networkType: NetworkType;
|
|
7
|
+
changeAddress: string;
|
|
8
|
+
feeRate?: number;
|
|
9
|
+
enableRBF?: boolean;
|
|
10
|
+
outputValue?: number;
|
|
11
|
+
}): Promise<{
|
|
12
|
+
psbt: import("bitcoinjs-lib").Psbt;
|
|
13
|
+
toSignInputs: ToSignInput[];
|
|
14
|
+
splitedCount: number;
|
|
15
|
+
}>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.splitInscriptionUtxo = void 0;
|
|
13
|
+
const constants_1 = require("../constants");
|
|
14
|
+
const error_1 = require("../error");
|
|
15
|
+
const transaction_1 = require("../transaction");
|
|
16
|
+
function splitInscriptionUtxo({ btcUtxos, assetUtxo, networkType, changeAddress, feeRate, enableRBF = true, outputValue = 546 }) {
|
|
17
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
if (transaction_1.utxoHelper.hasAnyAssets(btcUtxos)) {
|
|
19
|
+
throw new error_1.WalletUtilsError(error_1.ErrorCodes.NOT_SAFE_UTXOS);
|
|
20
|
+
}
|
|
21
|
+
if (transaction_1.utxoHelper.hasAtomicals([assetUtxo])) {
|
|
22
|
+
throw new error_1.WalletUtilsError(error_1.ErrorCodes.NOT_SAFE_UTXOS);
|
|
23
|
+
}
|
|
24
|
+
const tx = new transaction_1.Transaction();
|
|
25
|
+
tx.setNetworkType(networkType);
|
|
26
|
+
tx.setFeeRate(feeRate);
|
|
27
|
+
tx.setEnableRBF(enableRBF);
|
|
28
|
+
tx.setChangeAddress(changeAddress);
|
|
29
|
+
const toSignInputs = [];
|
|
30
|
+
let lastUnit = null;
|
|
31
|
+
let splitedCount = 0;
|
|
32
|
+
const ordUtxo = new transaction_1.InscriptionUnspendOutput(assetUtxo, outputValue);
|
|
33
|
+
tx.addInput(ordUtxo.utxo);
|
|
34
|
+
toSignInputs.push({ index: 0, publicKey: ordUtxo.utxo.pubkey });
|
|
35
|
+
for (let j = 0; j < ordUtxo.inscriptionUnits.length; j++) {
|
|
36
|
+
const unit = ordUtxo.inscriptionUnits[j];
|
|
37
|
+
if (unit.hasInscriptions()) {
|
|
38
|
+
tx.addChangeOutput(unit.satoshis);
|
|
39
|
+
lastUnit = unit;
|
|
40
|
+
splitedCount++;
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
tx.addChangeOutput(unit.satoshis);
|
|
44
|
+
lastUnit = unit;
|
|
45
|
+
}
|
|
46
|
+
if (!lastUnit.hasInscriptions()) {
|
|
47
|
+
tx.removeChangeOutput();
|
|
48
|
+
}
|
|
49
|
+
if (lastUnit.satoshis < constants_1.UTXO_DUST) {
|
|
50
|
+
lastUnit.satoshis = constants_1.UTXO_DUST;
|
|
51
|
+
}
|
|
52
|
+
const _toSignInputs = yield tx.addSufficientUtxosForFee(btcUtxos);
|
|
53
|
+
toSignInputs.push(..._toSignInputs);
|
|
54
|
+
const psbt = tx.toPsbt();
|
|
55
|
+
return { psbt, toSignInputs, splitedCount };
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
exports.splitInscriptionUtxo = splitInscriptionUtxo;
|
package/lib/types.d.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
interface BaseUserToSignInput {
|
|
2
|
+
index: number;
|
|
3
|
+
sighashTypes?: number[] | undefined;
|
|
4
|
+
disableTweakSigner?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface AddressUserToSignInput extends BaseUserToSignInput {
|
|
7
|
+
address: string;
|
|
8
|
+
}
|
|
9
|
+
export interface PublicKeyUserToSignInput extends BaseUserToSignInput {
|
|
10
|
+
publicKey: string;
|
|
11
|
+
}
|
|
12
|
+
export type UserToSignInput = AddressUserToSignInput | PublicKeyUserToSignInput;
|
|
13
|
+
export interface SignPsbtOptions {
|
|
14
|
+
autoFinalized?: boolean;
|
|
15
|
+
toSignInputs?: UserToSignInput[];
|
|
16
|
+
}
|
|
17
|
+
export interface ToSignInput {
|
|
18
|
+
index: number;
|
|
19
|
+
publicKey: string;
|
|
20
|
+
sighashTypes?: number[];
|
|
21
|
+
disableTweakSigner?: boolean;
|
|
22
|
+
}
|
|
23
|
+
export interface UnspentOutput {
|
|
24
|
+
txid: string;
|
|
25
|
+
vout: number;
|
|
26
|
+
satoshis: number;
|
|
27
|
+
scriptPk: string;
|
|
28
|
+
pubkey: string;
|
|
29
|
+
addressType: AddressType;
|
|
30
|
+
inscriptions: {
|
|
31
|
+
inscriptionId: string;
|
|
32
|
+
inscriptionNumber?: number;
|
|
33
|
+
offset: number;
|
|
34
|
+
}[];
|
|
35
|
+
atomicals: {
|
|
36
|
+
atomicalId: string;
|
|
37
|
+
atomicalNumber: number;
|
|
38
|
+
type: 'FT' | 'NFT';
|
|
39
|
+
ticker?: string;
|
|
40
|
+
atomicalValue?: number;
|
|
41
|
+
}[];
|
|
42
|
+
runes?: {
|
|
43
|
+
runeid: string;
|
|
44
|
+
amount: string;
|
|
45
|
+
}[];
|
|
46
|
+
rawtx?: string;
|
|
47
|
+
}
|
|
48
|
+
export declare enum AddressType {
|
|
49
|
+
P2PKH = 0,
|
|
50
|
+
P2WPKH = 1,
|
|
51
|
+
P2TR = 2,
|
|
52
|
+
P2SH_P2WPKH = 3,
|
|
53
|
+
M44_P2WPKH = 4,
|
|
54
|
+
M44_P2TR = 5,
|
|
55
|
+
P2WSH = 6,
|
|
56
|
+
P2SH = 7,
|
|
57
|
+
UNKNOWN = 8
|
|
58
|
+
}
|
|
59
|
+
export {};
|
package/lib/types.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AddressType = void 0;
|
|
4
|
+
var AddressType;
|
|
5
|
+
(function (AddressType) {
|
|
6
|
+
AddressType[AddressType["P2PKH"] = 0] = "P2PKH";
|
|
7
|
+
AddressType[AddressType["P2WPKH"] = 1] = "P2WPKH";
|
|
8
|
+
AddressType[AddressType["P2TR"] = 2] = "P2TR";
|
|
9
|
+
AddressType[AddressType["P2SH_P2WPKH"] = 3] = "P2SH_P2WPKH";
|
|
10
|
+
AddressType[AddressType["M44_P2WPKH"] = 4] = "M44_P2WPKH";
|
|
11
|
+
AddressType[AddressType["M44_P2TR"] = 5] = "M44_P2TR";
|
|
12
|
+
AddressType[AddressType["P2WSH"] = 6] = "P2WSH";
|
|
13
|
+
AddressType[AddressType["P2SH"] = 7] = "P2SH";
|
|
14
|
+
AddressType[AddressType["UNKNOWN"] = 8] = "UNKNOWN";
|
|
15
|
+
})(AddressType = exports.AddressType || (exports.AddressType = {}));
|
package/lib/utils.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { bitcoin } from './bitcoin-core';
|
|
2
|
+
export declare const toXOnly: (pubKey: Buffer) => Buffer;
|
|
3
|
+
/**
|
|
4
|
+
* Transform raw private key to taproot address private key
|
|
5
|
+
*/
|
|
6
|
+
export declare function tweakSigner(signer: bitcoin.Signer, opts?: any): bitcoin.Signer;
|
|
7
|
+
/**
|
|
8
|
+
* ECDSA signature validator
|
|
9
|
+
*/
|
|
10
|
+
export declare const validator: (pubkey: Buffer, msghash: Buffer, signature: Buffer) => boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Schnorr signature validator
|
|
13
|
+
*/
|
|
14
|
+
export declare const schnorrValidator: (pubkey: Buffer, msghash: Buffer, signature: Buffer) => boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Transform satoshis to btc format
|
|
17
|
+
*/
|
|
18
|
+
export declare function satoshisToAmount(val: number): string;
|
|
19
|
+
/**
|
|
20
|
+
* Transform btc format to satoshis
|
|
21
|
+
*/
|
|
22
|
+
export declare function amountToSaothis(val: any): number;
|
|
23
|
+
export declare function shortAddress(address?: string, len?: number): string;
|
package/lib/utils.js
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.shortAddress = exports.amountToSaothis = exports.satoshisToAmount = exports.schnorrValidator = exports.validator = exports.tweakSigner = exports.toXOnly = void 0;
|
|
7
|
+
const bignumber_js_1 = __importDefault(require("bignumber.js"));
|
|
8
|
+
const bitcoin_core_1 = require("./bitcoin-core");
|
|
9
|
+
const toXOnly = (pubKey) => (pubKey.length === 32 ? pubKey : pubKey.slice(1, 33));
|
|
10
|
+
exports.toXOnly = toXOnly;
|
|
11
|
+
function tapTweakHash(pubKey, h) {
|
|
12
|
+
return bitcoin_core_1.bitcoin.crypto.taggedHash('TapTweak', Buffer.concat(h ? [pubKey, h] : [pubKey]));
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Transform raw private key to taproot address private key
|
|
16
|
+
*/
|
|
17
|
+
function tweakSigner(signer, opts = {}) {
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
19
|
+
// @ts-ignore
|
|
20
|
+
let privateKey = signer.privateKey;
|
|
21
|
+
if (!privateKey) {
|
|
22
|
+
throw new Error('Private key is required for tweaking signer!');
|
|
23
|
+
}
|
|
24
|
+
if (signer.publicKey[0] === 3) {
|
|
25
|
+
privateKey = bitcoin_core_1.ecc.privateNegate(privateKey);
|
|
26
|
+
}
|
|
27
|
+
const tweakedPrivateKey = bitcoin_core_1.ecc.privateAdd(privateKey, tapTweakHash((0, exports.toXOnly)(signer.publicKey), opts.tweakHash));
|
|
28
|
+
if (!tweakedPrivateKey) {
|
|
29
|
+
throw new Error('Invalid tweaked private key!');
|
|
30
|
+
}
|
|
31
|
+
return bitcoin_core_1.ECPair.fromPrivateKey(Buffer.from(tweakedPrivateKey), {
|
|
32
|
+
network: opts.network
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
exports.tweakSigner = tweakSigner;
|
|
36
|
+
/**
|
|
37
|
+
* ECDSA signature validator
|
|
38
|
+
*/
|
|
39
|
+
const validator = (pubkey, msghash, signature) => bitcoin_core_1.ECPair.fromPublicKey(pubkey).verify(msghash, signature);
|
|
40
|
+
exports.validator = validator;
|
|
41
|
+
/**
|
|
42
|
+
* Schnorr signature validator
|
|
43
|
+
*/
|
|
44
|
+
const schnorrValidator = (pubkey, msghash, signature) => {
|
|
45
|
+
return bitcoin_core_1.ECPair.fromPublicKey(pubkey).verifySchnorr(msghash, signature);
|
|
46
|
+
};
|
|
47
|
+
exports.schnorrValidator = schnorrValidator;
|
|
48
|
+
/**
|
|
49
|
+
* Transform satoshis to btc format
|
|
50
|
+
*/
|
|
51
|
+
function satoshisToAmount(val) {
|
|
52
|
+
const num = new bignumber_js_1.default(val);
|
|
53
|
+
return num.dividedBy(100000000).toFixed(8);
|
|
54
|
+
}
|
|
55
|
+
exports.satoshisToAmount = satoshisToAmount;
|
|
56
|
+
/**
|
|
57
|
+
* Transform btc format to satoshis
|
|
58
|
+
*/
|
|
59
|
+
function amountToSaothis(val) {
|
|
60
|
+
const num = new bignumber_js_1.default(val);
|
|
61
|
+
return num.multipliedBy(100000000).toNumber();
|
|
62
|
+
}
|
|
63
|
+
exports.amountToSaothis = amountToSaothis;
|
|
64
|
+
function shortAddress(address, len = 5) {
|
|
65
|
+
if (!address)
|
|
66
|
+
return '';
|
|
67
|
+
if (address.length <= len * 2)
|
|
68
|
+
return address;
|
|
69
|
+
return address.slice(0, len) + '...' + address.slice(address.length - len);
|
|
70
|
+
}
|
|
71
|
+
exports.shortAddress = shortAddress;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { bitcoin } from '../bitcoin-core';
|
|
2
|
+
import { SignPsbtOptions } from '../types';
|
|
3
|
+
export interface AbstractWallet {
|
|
4
|
+
signPsbt(psbt: bitcoin.Psbt, opts?: SignPsbtOptions): Promise<bitcoin.Psbt>;
|
|
5
|
+
signMessage(text: string, type: 'bip322-simple' | 'ecdsa'): Promise<string>;
|
|
6
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { bitcoin } from '../bitcoin-core';
|
|
2
|
+
import { SimpleKeyring } from '../keyring';
|
|
3
|
+
import { NetworkType } from '../network';
|
|
4
|
+
import { AddressType, SignPsbtOptions } from '../types';
|
|
5
|
+
import { AbstractWallet } from './abstract-wallet';
|
|
6
|
+
/**
|
|
7
|
+
* EstimateWallet is a wallet that can be used to estimate the size of a transaction.
|
|
8
|
+
*/
|
|
9
|
+
export declare class EstimateWallet implements AbstractWallet {
|
|
10
|
+
keyring: SimpleKeyring;
|
|
11
|
+
address: string;
|
|
12
|
+
pubkey: string;
|
|
13
|
+
network: bitcoin.Network;
|
|
14
|
+
networkType: NetworkType;
|
|
15
|
+
addressType: AddressType;
|
|
16
|
+
constructor(wif: string, networkType?: NetworkType, addressType?: AddressType);
|
|
17
|
+
static fromRandom(addressType?: AddressType, networkType?: NetworkType): EstimateWallet;
|
|
18
|
+
getNetworkType(): NetworkType;
|
|
19
|
+
signPsbt(psbt: bitcoin.Psbt, opts?: SignPsbtOptions): Promise<bitcoin.Psbt>;
|
|
20
|
+
getPublicKey(): Promise<string>;
|
|
21
|
+
signMessage(text: string, type: 'bip322-simple' | 'ecdsa'): Promise<string>;
|
|
22
|
+
private formatOptionsToSignInputs;
|
|
23
|
+
}
|