@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.
Files changed (131) hide show
  1. package/LICENSE +15 -0
  2. package/README.md +24 -0
  3. package/es/bundle.js +2 -0
  4. package/es/bundle.js.LICENSE.txt +48 -0
  5. package/lib/address/index.d.ts +37 -0
  6. package/lib/address/index.js +235 -0
  7. package/lib/bitcoin-core.d.ts +5 -0
  8. package/lib/bitcoin-core.js +37 -0
  9. package/lib/constants.d.ts +1 -0
  10. package/lib/constants.js +5 -0
  11. package/lib/error.d.ts +20 -0
  12. package/lib/error.js +29 -0
  13. package/lib/index.d.ts +14 -0
  14. package/lib/index.js +50 -0
  15. package/lib/keyring/hd-keyring.d.ts +50 -0
  16. package/lib/keyring/hd-keyring.js +238 -0
  17. package/lib/keyring/index.d.ts +4 -0
  18. package/lib/keyring/index.js +20 -0
  19. package/lib/keyring/interfaces/SimpleKeyringOptions.d.ts +53 -0
  20. package/lib/keyring/interfaces/SimpleKeyringOptions.js +85 -0
  21. package/lib/keyring/keystone-keyring.d.ts +82 -0
  22. package/lib/keyring/keystone-keyring.js +377 -0
  23. package/lib/keyring/simple-keyring.d.ts +11 -0
  24. package/lib/keyring/simple-keyring.js +66 -0
  25. package/lib/message/bip322-simple.d.ts +19 -0
  26. package/lib/message/bip322-simple.js +182 -0
  27. package/lib/message/deterministic-ecdsa.d.ts +2 -0
  28. package/lib/message/deterministic-ecdsa.js +83 -0
  29. package/lib/message/ecdsa.d.ts +3 -0
  30. package/lib/message/ecdsa.js +32 -0
  31. package/lib/message/index.d.ts +3 -0
  32. package/lib/message/index.js +19 -0
  33. package/lib/network/index.d.ts +14 -0
  34. package/lib/network/index.js +40 -0
  35. package/lib/runes/index.d.ts +1 -0
  36. package/lib/runes/index.js +17 -0
  37. package/lib/runes/rund_id.d.ts +11 -0
  38. package/lib/runes/rund_id.js +30 -0
  39. package/lib/runes/varint.d.ts +15 -0
  40. package/lib/runes/varint.js +45 -0
  41. package/lib/src/address/index.d.ts +37 -0
  42. package/lib/src/bitcoin-core.d.ts +5 -0
  43. package/lib/src/constants.d.ts +1 -0
  44. package/lib/src/error.d.ts +20 -0
  45. package/lib/src/index.d.ts +14 -0
  46. package/lib/src/keyring/hd-keyring.d.ts +50 -0
  47. package/lib/src/keyring/index.d.ts +4 -0
  48. package/lib/src/keyring/interfaces/SimpleKeyringOptions.d.ts +53 -0
  49. package/lib/src/keyring/keystone-keyring.d.ts +82 -0
  50. package/lib/src/keyring/simple-keyring.d.ts +11 -0
  51. package/lib/src/message/bip322-simple.d.ts +19 -0
  52. package/lib/src/message/deterministic-ecdsa.d.ts +2 -0
  53. package/lib/src/message/ecdsa.d.ts +3 -0
  54. package/lib/src/message/index.d.ts +3 -0
  55. package/lib/src/network/index.d.ts +14 -0
  56. package/lib/src/runes/index.d.ts +1 -0
  57. package/lib/src/runes/rund_id.d.ts +11 -0
  58. package/lib/src/runes/varint.d.ts +15 -0
  59. package/lib/src/transaction/index.d.ts +3 -0
  60. package/lib/src/transaction/inscription-utxo.d.ts +33 -0
  61. package/lib/src/transaction/transaction.d.ts +52 -0
  62. package/lib/src/transaction/utxo.d.ts +35 -0
  63. package/lib/src/tx-helpers/index.d.ts +8 -0
  64. package/lib/src/tx-helpers/send-atomicals-ft.d.ts +16 -0
  65. package/lib/src/tx-helpers/send-atomicals-nft.d.ts +14 -0
  66. package/lib/src/tx-helpers/send-btc.d.ts +28 -0
  67. package/lib/src/tx-helpers/send-inscription.d.ts +16 -0
  68. package/lib/src/tx-helpers/send-inscriptions.d.ts +14 -0
  69. package/lib/src/tx-helpers/send-runes.d.ts +19 -0
  70. package/lib/src/tx-helpers/split-inscription-utxo.d.ts +15 -0
  71. package/lib/src/types.d.ts +59 -0
  72. package/lib/src/utils.d.ts +23 -0
  73. package/lib/src/wallet/abstract-wallet.d.ts +6 -0
  74. package/lib/src/wallet/estimate-wallet.d.ts +23 -0
  75. package/lib/src/wallet/index.d.ts +3 -0
  76. package/lib/src/wallet/local-wallet.d.ts +23 -0
  77. package/lib/test/address/address.test.d.ts +1 -0
  78. package/lib/test/keyring/hd-keyring.test.d.ts +1 -0
  79. package/lib/test/keyring/keystone-keyring.test.d.ts +1 -0
  80. package/lib/test/keyring/simple-keyring.test.d.ts +1 -0
  81. package/lib/test/message/message.test.d.ts +1 -0
  82. package/lib/test/runes/varint.test.d.ts +1 -0
  83. package/lib/test/transaction/transaction.test.d.ts +1 -0
  84. package/lib/test/transaction/utxo.test.d.ts +1 -0
  85. package/lib/test/tx-helpers/send-atomicals-ft.test.d.ts +1 -0
  86. package/lib/test/tx-helpers/send-atomicals-nft.test.d.ts +1 -0
  87. package/lib/test/tx-helpers/send-btc.test.d.ts +1 -0
  88. package/lib/test/tx-helpers/send-inscription.test.d.ts +1 -0
  89. package/lib/test/tx-helpers/send-inscriptions.test.d.ts +1 -0
  90. package/lib/test/tx-helpers/send-runes.test.d.ts +1 -0
  91. package/lib/test/tx-helpers/split-inscription-utxo.test.d.ts +1 -0
  92. package/lib/test/tx-helpers/utils.d.ts +217 -0
  93. package/lib/test/utils.d.ts +4 -0
  94. package/lib/test/wallet/local-wallet.test.d.ts +1 -0
  95. package/lib/transaction/index.d.ts +3 -0
  96. package/lib/transaction/index.js +19 -0
  97. package/lib/transaction/inscription-utxo.d.ts +33 -0
  98. package/lib/transaction/inscription-utxo.js +120 -0
  99. package/lib/transaction/transaction.d.ts +52 -0
  100. package/lib/transaction/transaction.js +358 -0
  101. package/lib/transaction/utxo.d.ts +35 -0
  102. package/lib/transaction/utxo.js +107 -0
  103. package/lib/tx-helpers/index.d.ts +8 -0
  104. package/lib/tx-helpers/index.js +18 -0
  105. package/lib/tx-helpers/send-atomicals-ft.d.ts +16 -0
  106. package/lib/tx-helpers/send-atomicals-ft.js +66 -0
  107. package/lib/tx-helpers/send-atomicals-nft.d.ts +14 -0
  108. package/lib/tx-helpers/send-atomicals-nft.js +45 -0
  109. package/lib/tx-helpers/send-btc.d.ts +28 -0
  110. package/lib/tx-helpers/send-btc.js +78 -0
  111. package/lib/tx-helpers/send-inscription.d.ts +16 -0
  112. package/lib/tx-helpers/send-inscription.js +49 -0
  113. package/lib/tx-helpers/send-inscriptions.d.ts +14 -0
  114. package/lib/tx-helpers/send-inscriptions.js +45 -0
  115. package/lib/tx-helpers/send-runes.d.ts +19 -0
  116. package/lib/tx-helpers/send-runes.js +101 -0
  117. package/lib/tx-helpers/split-inscription-utxo.d.ts +15 -0
  118. package/lib/tx-helpers/split-inscription-utxo.js +58 -0
  119. package/lib/types.d.ts +59 -0
  120. package/lib/types.js +15 -0
  121. package/lib/utils.d.ts +23 -0
  122. package/lib/utils.js +71 -0
  123. package/lib/wallet/abstract-wallet.d.ts +6 -0
  124. package/lib/wallet/abstract-wallet.js +2 -0
  125. package/lib/wallet/estimate-wallet.d.ts +23 -0
  126. package/lib/wallet/estimate-wallet.js +174 -0
  127. package/lib/wallet/index.d.ts +3 -0
  128. package/lib/wallet/index.js +19 -0
  129. package/lib/wallet/local-wallet.d.ts +23 -0
  130. package/lib/wallet/local-wallet.js +183 -0
  131. package/package.json +97 -0
@@ -0,0 +1,14 @@
1
+ import { bitcoin } from '../bitcoin-core';
2
+ export declare enum NetworkType {
3
+ MAINNET = 0,
4
+ TESTNET = 1,
5
+ REGTEST = 2
6
+ }
7
+ /**
8
+ * Convert network type to bitcoinjs-lib network.
9
+ */
10
+ export declare function toPsbtNetwork(networkType: NetworkType): bitcoin.networks.Network;
11
+ /**
12
+ * Convert bitcoinjs-lib network to network type.
13
+ */
14
+ export declare function toNetworkType(network: bitcoin.Network): NetworkType;
@@ -0,0 +1 @@
1
+ export * from './varint';
@@ -0,0 +1,11 @@
1
+ export declare class RuneId {
2
+ block: number;
3
+ tx: number;
4
+ constructor({ block, tx }: {
5
+ block: number;
6
+ tx: number;
7
+ });
8
+ static fromBigInt(n: any): RuneId;
9
+ toString(): string;
10
+ static fromString(s: string): RuneId;
11
+ }
@@ -0,0 +1,15 @@
1
+ /// <reference types="node" />
2
+ declare function try_decode(buf: any): (string | number)[];
3
+ declare function encodeToVec(n: any, v: any): void;
4
+ declare function decode(buffer: any): {
5
+ num: string | number;
6
+ index: string | number;
7
+ };
8
+ declare function encode(n: any): Buffer;
9
+ export declare const varint: {
10
+ encode: typeof encode;
11
+ decode: typeof decode;
12
+ try_decode: typeof try_decode;
13
+ encodeToVec: typeof encodeToVec;
14
+ };
15
+ export {};
@@ -0,0 +1,3 @@
1
+ export * from './inscription-utxo';
2
+ export * from './transaction';
3
+ export * from './utxo';
@@ -0,0 +1,33 @@
1
+ import { UnspentOutput } from '../types';
2
+ export declare class InscriptionUnit {
3
+ satoshis: number;
4
+ inscriptions: {
5
+ id: string;
6
+ outputOffset: number;
7
+ unitOffset: number;
8
+ }[];
9
+ constructor(satoshis: number, inscriptions: {
10
+ id: string;
11
+ outputOffset: number;
12
+ unitOffset: number;
13
+ }[]);
14
+ hasInscriptions(): boolean;
15
+ }
16
+ export declare class InscriptionUnspendOutput {
17
+ inscriptionUnits: InscriptionUnit[];
18
+ utxo: UnspentOutput;
19
+ constructor(utxo: UnspentOutput, outputValue?: number);
20
+ private split;
21
+ /**
22
+ * Get non-Ord satoshis for spending
23
+ */
24
+ getNonInscriptionSatoshis(): number;
25
+ /**
26
+ * Get last non-ord satoshis for spending.
27
+ * Only the last one is available
28
+ * @returns
29
+ */
30
+ getLastUnitSatoshis(): number;
31
+ hasInscriptions(): boolean;
32
+ dump(): void;
33
+ }
@@ -0,0 +1,52 @@
1
+ /// <reference types="node" />
2
+ import { bitcoin } from '../bitcoin-core';
3
+ import { NetworkType } from '../network';
4
+ import { ToSignInput, UnspentOutput } from '../types';
5
+ interface TxOutput {
6
+ address?: string;
7
+ script?: Buffer;
8
+ value: number;
9
+ }
10
+ /**
11
+ * Transaction
12
+ */
13
+ export declare class Transaction {
14
+ private utxos;
15
+ private inputs;
16
+ outputs: TxOutput[];
17
+ private changeOutputIndex;
18
+ changedAddress: string;
19
+ private networkType;
20
+ private feeRate;
21
+ private enableRBF;
22
+ private _cacheNetworkFee;
23
+ private _cacheBtcUtxos;
24
+ private _cacheToSignInputs;
25
+ constructor();
26
+ setNetworkType(network: NetworkType): void;
27
+ setEnableRBF(enable: boolean): void;
28
+ setFeeRate(feeRate: number): void;
29
+ setChangeAddress(address: string): void;
30
+ addInput(utxo: UnspentOutput): void;
31
+ removeLastInput(): void;
32
+ getTotalInput(): number;
33
+ getTotalOutput(): number;
34
+ getUnspent(): number;
35
+ calNetworkFee(): Promise<number>;
36
+ addOutput(address: string, value: number): void;
37
+ addOpreturn(data: Buffer[]): void;
38
+ addScriptOutput(script: Buffer, value: number): void;
39
+ getOutput(index: number): TxOutput;
40
+ addChangeOutput(value: number): void;
41
+ getChangeOutput(): TxOutput;
42
+ getChangeAmount(): number;
43
+ removeChangeOutput(): void;
44
+ removeRecentOutputs(count: number): void;
45
+ toPsbt(): bitcoin.Psbt;
46
+ clone(): Transaction;
47
+ createEstimatePsbt(): Promise<bitcoin.Psbt>;
48
+ private selectBtcUtxos;
49
+ addSufficientUtxosForFee(btcUtxos: UnspentOutput[], forceAsFee?: boolean): Promise<ToSignInput[]>;
50
+ dumpTx(psbt: any): Promise<void>;
51
+ }
52
+ export {};
@@ -0,0 +1,35 @@
1
+ import { NetworkType } from '../network';
2
+ import { AddressType, UnspentOutput } from '../types';
3
+ declare function hasInscription(utxos: UnspentOutput[]): boolean;
4
+ declare function hasAtomicalsFT(utxos: UnspentOutput[]): boolean;
5
+ declare function hasAtomicalsNFT(utxos: UnspentOutput[]): boolean;
6
+ declare function hasAtomicals(utxos: UnspentOutput[]): boolean;
7
+ declare function hasAnyAssets(utxos: UnspentOutput[]): boolean;
8
+ /**
9
+ * select utxos so that the total amount of utxos is greater than or equal to targetAmount
10
+ * return the selected utxos and the unselected utxos
11
+ * @param utxos
12
+ * @param targetAmount
13
+ */
14
+ declare function selectBtcUtxos(utxos: UnspentOutput[], targetAmount: number): {
15
+ selectedUtxos: UnspentOutput[];
16
+ remainingUtxos: UnspentOutput[];
17
+ };
18
+ /**
19
+ * return the added virtual size of the utxo
20
+ */
21
+ declare function getAddedVirtualSize(addressType: AddressType): number;
22
+ export declare function getUtxoDust(addressType: AddressType): 546 | 294 | 330;
23
+ export declare function getAddressUtxoDust(address: string, networkType?: NetworkType): number;
24
+ export declare const utxoHelper: {
25
+ hasAtomicalsFT: typeof hasAtomicalsFT;
26
+ hasAtomicalsNFT: typeof hasAtomicalsNFT;
27
+ hasAtomicals: typeof hasAtomicals;
28
+ hasInscription: typeof hasInscription;
29
+ hasAnyAssets: typeof hasAnyAssets;
30
+ selectBtcUtxos: typeof selectBtcUtxos;
31
+ getAddedVirtualSize: typeof getAddedVirtualSize;
32
+ getUtxoDust: typeof getUtxoDust;
33
+ getAddressUtxoDust: typeof getAddressUtxoDust;
34
+ };
35
+ export {};
@@ -0,0 +1,8 @@
1
+ import { sendAtomicalsFT } from './send-atomicals-ft';
2
+ import { sendAtomicalsNFT } from './send-atomicals-nft';
3
+ import { sendAllBTC, sendBTC } from './send-btc';
4
+ import { sendInscription } from './send-inscription';
5
+ import { sendInscriptions } from './send-inscriptions';
6
+ import { sendRunes } from './send-runes';
7
+ import { splitInscriptionUtxo } from './split-inscription-utxo';
8
+ export { sendAllBTC, sendAtomicalsFT, sendAtomicalsNFT, sendBTC, sendInscription, sendInscriptions, sendRunes, splitInscriptionUtxo };
@@ -0,0 +1,16 @@
1
+ import { NetworkType } from '../network';
2
+ import { ToSignInput, UnspentOutput } from '../types';
3
+ export declare function sendAtomicalsFT(params: {
4
+ assetUtxos: UnspentOutput[];
5
+ btcUtxos: UnspentOutput[];
6
+ toAddress: string;
7
+ networkType: NetworkType;
8
+ changeAssetAddress: string;
9
+ sendAmount: number;
10
+ changeAddress: string;
11
+ feeRate: number;
12
+ enableRBF?: boolean;
13
+ }): Promise<{
14
+ psbt: import("bitcoinjs-lib").Psbt;
15
+ toSignInputs: ToSignInput[];
16
+ }>;
@@ -0,0 +1,14 @@
1
+ import { NetworkType } from '../network';
2
+ import { ToSignInput, UnspentOutput } from '../types';
3
+ export declare function sendAtomicalsNFT(params: {
4
+ assetUtxo: 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,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,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,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,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,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,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 {};
@@ -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;
@@ -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
+ }
@@ -0,0 +1,3 @@
1
+ export * from './abstract-wallet';
2
+ export * from './estimate-wallet';
3
+ export * from './local-wallet';
@@ -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
+ export declare class LocalWallet implements AbstractWallet {
7
+ keyring: SimpleKeyring;
8
+ address: string;
9
+ pubkey: string;
10
+ network: bitcoin.Network;
11
+ addressType: AddressType;
12
+ networkType: NetworkType;
13
+ scriptPk: string;
14
+ constructor(wif: string, addressType?: AddressType, networkType?: NetworkType);
15
+ static fromMnemonic(addressType: AddressType, networkType: NetworkType, mnemonic: string, passPhrase?: string, hdPath?: string): LocalWallet;
16
+ static fromRandom(addressType?: AddressType, networkType?: NetworkType): LocalWallet;
17
+ getNetworkType(): NetworkType;
18
+ signPsbt(psbt: bitcoin.Psbt, opts?: SignPsbtOptions): Promise<bitcoin.Psbt>;
19
+ getPublicKey(): string;
20
+ signMessage(text: string, type: 'bip322-simple' | 'ecdsa'): Promise<string>;
21
+ signData(data: string, type?: 'ecdsa' | 'schnorr'): Promise<string>;
22
+ private formatOptionsToSignInputs;
23
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};