@btc-vision/wallet-sdk 1.0.0 → 1.0.2
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/es/bundle.js +1 -1
- package/lib/address/index.d.ts +1 -2
- package/lib/address/index.js +25 -16
- package/lib/bitcoin-core.js +17 -7
- package/lib/error.js +1 -1
- package/lib/index.js +17 -7
- package/lib/keyring/hd-keyring.js +17 -7
- package/lib/keyring/interfaces/SimpleKeyringOptions.d.ts +0 -1
- package/lib/keyring/keystone-keyring.js +19 -9
- package/lib/keyring/simple-keyring.js +2 -2
- package/lib/message/bip322-simple.d.ts +1 -1
- package/lib/message/bip322-simple.js +25 -15
- package/lib/message/deterministic-ecdsa.js +31 -16
- package/lib/message/ecdsa.js +2 -3
- package/lib/network/index.js +4 -4
- package/lib/runes/rund_id.d.ts +1 -1
- package/lib/runes/rund_id.js +3 -3
- package/lib/runes/varint.d.ts +1 -2
- package/lib/src/address/index.d.ts +36 -37
- package/lib/src/bitcoin-core.d.ts +5 -5
- package/lib/src/constants.d.ts +1 -1
- package/lib/src/error.d.ts +20 -20
- package/lib/src/index.d.ts +14 -14
- package/lib/src/keyring/hd-keyring.d.ts +50 -50
- package/lib/src/keyring/index.d.ts +4 -4
- package/lib/src/keyring/interfaces/SimpleKeyringOptions.d.ts +52 -53
- package/lib/src/keyring/keystone-keyring.d.ts +82 -82
- package/lib/src/keyring/simple-keyring.d.ts +11 -11
- package/lib/src/message/bip322-simple.d.ts +19 -19
- package/lib/src/message/deterministic-ecdsa.d.ts +2 -2
- package/lib/src/message/ecdsa.d.ts +3 -3
- package/lib/src/message/index.d.ts +3 -3
- package/lib/src/network/index.d.ts +14 -14
- package/lib/src/runes/index.d.ts +1 -1
- package/lib/src/runes/rund_id.d.ts +11 -11
- package/lib/src/runes/varint.d.ts +14 -15
- package/lib/src/transaction/index.d.ts +3 -3
- package/lib/src/transaction/inscription-utxo.d.ts +33 -33
- package/lib/src/transaction/transaction.d.ts +51 -52
- package/lib/src/transaction/utxo.d.ts +35 -35
- package/lib/src/tx-helpers/index.d.ts +8 -8
- package/lib/src/tx-helpers/send-atomicals-ft.d.ts +16 -16
- package/lib/src/tx-helpers/send-atomicals-nft.d.ts +14 -14
- package/lib/src/tx-helpers/send-btc.d.ts +28 -28
- package/lib/src/tx-helpers/send-inscription.d.ts +16 -16
- package/lib/src/tx-helpers/send-inscriptions.d.ts +14 -14
- package/lib/src/tx-helpers/send-runes.d.ts +19 -19
- package/lib/src/tx-helpers/split-inscription-utxo.d.ts +15 -15
- package/lib/src/types.d.ts +59 -59
- package/lib/src/utils.d.ts +23 -23
- package/lib/src/wallet/abstract-wallet.d.ts +6 -6
- package/lib/src/wallet/estimate-wallet.d.ts +23 -23
- package/lib/src/wallet/index.d.ts +3 -3
- package/lib/src/wallet/local-wallet.d.ts +23 -23
- package/lib/test/address/address.test.d.ts +1 -1
- package/lib/test/keyring/hd-keyring.test.d.ts +1 -1
- package/lib/test/keyring/keystone-keyring.test.d.ts +1 -1
- package/lib/test/keyring/simple-keyring.test.d.ts +1 -1
- package/lib/test/message/message.test.d.ts +1 -1
- package/lib/test/runes/varint.test.d.ts +1 -1
- package/lib/test/transaction/transaction.test.d.ts +1 -1
- package/lib/test/transaction/utxo.test.d.ts +1 -1
- package/lib/test/tx-helpers/send-atomicals-ft.test.d.ts +1 -1
- package/lib/test/tx-helpers/send-atomicals-nft.test.d.ts +1 -1
- package/lib/test/tx-helpers/send-btc.test.d.ts +1 -1
- package/lib/test/tx-helpers/send-inscription.test.d.ts +1 -1
- package/lib/test/tx-helpers/send-inscriptions.test.d.ts +1 -1
- package/lib/test/tx-helpers/send-runes.test.d.ts +1 -1
- package/lib/test/tx-helpers/split-inscription-utxo.test.d.ts +1 -1
- package/lib/test/tx-helpers/utils.d.ts +217 -217
- package/lib/test/utils.d.ts +4 -4
- package/lib/test/wallet/local-wallet.test.d.ts +1 -1
- package/lib/transaction/inscription-utxo.d.ts +1 -1
- package/lib/transaction/inscription-utxo.js +36 -28
- package/lib/transaction/transaction.d.ts +3 -4
- package/lib/transaction/transaction.js +44 -44
- package/lib/transaction/utxo.js +3 -3
- package/lib/tx-helpers/send-atomicals-ft.js +1 -2
- package/lib/tx-helpers/send-atomicals-nft.js +1 -2
- package/lib/tx-helpers/send-btc.js +2 -3
- package/lib/tx-helpers/send-inscription.js +3 -4
- package/lib/tx-helpers/send-inscriptions.js +3 -4
- package/lib/tx-helpers/send-runes.js +8 -5
- package/lib/tx-helpers/split-inscription-utxo.js +3 -4
- package/lib/types.d.ts +2 -2
- package/lib/types.js +1 -1
- package/lib/utils.d.ts +1 -1
- package/lib/utils.js +5 -5
- package/lib/wallet/local-wallet.js +2 -2
- package/package.json +94 -95
package/lib/src/error.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
export declare enum ErrorCodes {
|
|
2
|
-
UNKNOWN = -1,
|
|
3
|
-
INSUFFICIENT_BTC_UTXO = -2,
|
|
4
|
-
INSUFFICIENT_ASSET_UTXO = -3,
|
|
5
|
-
NOT_SAFE_UTXOS = -4,
|
|
6
|
-
ASSET_MAYBE_LOST = -5,
|
|
7
|
-
ONLY_ONE_ARC20_CAN_BE_SENT = -6
|
|
8
|
-
}
|
|
9
|
-
export declare const ErrorMessages: {
|
|
10
|
-
[-1]: string;
|
|
11
|
-
[-2]: string;
|
|
12
|
-
[-3]: string;
|
|
13
|
-
[-4]: string;
|
|
14
|
-
[-5]: string;
|
|
15
|
-
[-6]: string;
|
|
16
|
-
};
|
|
17
|
-
export declare class WalletUtilsError extends Error {
|
|
18
|
-
code: ErrorCodes;
|
|
19
|
-
constructor(code: ErrorCodes, message?: string);
|
|
20
|
-
}
|
|
1
|
+
export declare enum ErrorCodes {
|
|
2
|
+
UNKNOWN = -1,
|
|
3
|
+
INSUFFICIENT_BTC_UTXO = -2,
|
|
4
|
+
INSUFFICIENT_ASSET_UTXO = -3,
|
|
5
|
+
NOT_SAFE_UTXOS = -4,
|
|
6
|
+
ASSET_MAYBE_LOST = -5,
|
|
7
|
+
ONLY_ONE_ARC20_CAN_BE_SENT = -6
|
|
8
|
+
}
|
|
9
|
+
export declare const ErrorMessages: {
|
|
10
|
+
[-1]: string;
|
|
11
|
+
[-2]: string;
|
|
12
|
+
[-3]: string;
|
|
13
|
+
[-4]: string;
|
|
14
|
+
[-5]: string;
|
|
15
|
+
[-6]: string;
|
|
16
|
+
};
|
|
17
|
+
export declare class WalletUtilsError extends Error {
|
|
18
|
+
code: ErrorCodes;
|
|
19
|
+
constructor(code: ErrorCodes, message?: string);
|
|
20
|
+
}
|
package/lib/src/index.d.ts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export * as address from './address';
|
|
2
|
-
export * as core from './bitcoin-core';
|
|
3
|
-
export * from './constants';
|
|
4
|
-
export * as keyring from './keyring';
|
|
5
|
-
export * as message from './message';
|
|
6
|
-
export * as transaction from './transaction';
|
|
7
|
-
export * as txHelpers from './tx-helpers';
|
|
8
|
-
export * from './types';
|
|
9
|
-
export * as utils from './utils';
|
|
10
|
-
export * as wallet from './wallet';
|
|
11
|
-
export * from './keyring/interfaces/SimpleKeyringOptions';
|
|
12
|
-
export * from './keyring/hd-keyring';
|
|
13
|
-
export * from './keyring/keystone-keyring';
|
|
14
|
-
export * from './keyring/simple-keyring';
|
|
1
|
+
export * as address from './address';
|
|
2
|
+
export * as core from './bitcoin-core';
|
|
3
|
+
export * from './constants';
|
|
4
|
+
export * as keyring from './keyring';
|
|
5
|
+
export * as message from './message';
|
|
6
|
+
export * as transaction from './transaction';
|
|
7
|
+
export * as txHelpers from './tx-helpers';
|
|
8
|
+
export * from './types';
|
|
9
|
+
export * as utils from './utils';
|
|
10
|
+
export * as wallet from './wallet';
|
|
11
|
+
export * from './keyring/interfaces/SimpleKeyringOptions';
|
|
12
|
+
export * from './keyring/hd-keyring';
|
|
13
|
+
export * from './keyring/keystone-keyring';
|
|
14
|
+
export * from './keyring/simple-keyring';
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import bitcore from 'bitcore-lib';
|
|
2
|
-
import { ECPairInterface } from '../bitcoin-core';
|
|
3
|
-
import { DeserializeOption, IKeyringBase } from './interfaces/SimpleKeyringOptions';
|
|
4
|
-
export declare class HdKeyring extends IKeyringBase<DeserializeOption> {
|
|
5
|
-
static type: string;
|
|
6
|
-
type: string;
|
|
7
|
-
mnemonic: string;
|
|
8
|
-
xpriv: string;
|
|
9
|
-
passphrase: string;
|
|
10
|
-
hdPath: string;
|
|
11
|
-
root: bitcore.HDPrivateKey;
|
|
12
|
-
hdWallet?: any;
|
|
13
|
-
wallets: ECPairInterface[];
|
|
14
|
-
activeIndexes: number[];
|
|
15
|
-
page: number;
|
|
16
|
-
perPage: number;
|
|
17
|
-
private _index2wallet;
|
|
18
|
-
constructor(opts?: DeserializeOption);
|
|
19
|
-
serialize(): DeserializeOption;
|
|
20
|
-
deserialize(_opts?: DeserializeOption): void;
|
|
21
|
-
initFromXpriv(xpriv: string): void;
|
|
22
|
-
initFromMnemonic(mnemonic: string): void;
|
|
23
|
-
changeHdPath(hdPath: string): void;
|
|
24
|
-
getAccountByHdPath(hdPath: string, index: number): string;
|
|
25
|
-
addAccounts(numberOfAccounts?: number): string[];
|
|
26
|
-
activeAccounts(indexes: number[]): string[];
|
|
27
|
-
getFirstPage(): Promise<{
|
|
28
|
-
address: string;
|
|
29
|
-
index: number;
|
|
30
|
-
}[]>;
|
|
31
|
-
getNextPage(): Promise<{
|
|
32
|
-
address: string;
|
|
33
|
-
index: number;
|
|
34
|
-
}[]>;
|
|
35
|
-
getPreviousPage(): Promise<{
|
|
36
|
-
address: string;
|
|
37
|
-
index: number;
|
|
38
|
-
}[]>;
|
|
39
|
-
getAddresses(start: number, end: number): {
|
|
40
|
-
address: string;
|
|
41
|
-
index: number;
|
|
42
|
-
}[];
|
|
43
|
-
__getPage(increment: number): Promise<{
|
|
44
|
-
address: string;
|
|
45
|
-
index: number;
|
|
46
|
-
}[]>;
|
|
47
|
-
getAccounts(): string[];
|
|
48
|
-
getIndexByAddress(address: string): number;
|
|
49
|
-
private _addressFromIndex;
|
|
50
|
-
}
|
|
1
|
+
import bitcore from 'bitcore-lib';
|
|
2
|
+
import { ECPairInterface } from '../bitcoin-core';
|
|
3
|
+
import { DeserializeOption, IKeyringBase } from './interfaces/SimpleKeyringOptions';
|
|
4
|
+
export declare class HdKeyring extends IKeyringBase<DeserializeOption> {
|
|
5
|
+
static type: string;
|
|
6
|
+
type: string;
|
|
7
|
+
mnemonic: string;
|
|
8
|
+
xpriv: string;
|
|
9
|
+
passphrase: string;
|
|
10
|
+
hdPath: string;
|
|
11
|
+
root: bitcore.HDPrivateKey;
|
|
12
|
+
hdWallet?: any;
|
|
13
|
+
wallets: ECPairInterface[];
|
|
14
|
+
activeIndexes: number[];
|
|
15
|
+
page: number;
|
|
16
|
+
perPage: number;
|
|
17
|
+
private _index2wallet;
|
|
18
|
+
constructor(opts?: DeserializeOption);
|
|
19
|
+
serialize(): DeserializeOption;
|
|
20
|
+
deserialize(_opts?: DeserializeOption): void;
|
|
21
|
+
initFromXpriv(xpriv: string): void;
|
|
22
|
+
initFromMnemonic(mnemonic: string): void;
|
|
23
|
+
changeHdPath(hdPath: string): void;
|
|
24
|
+
getAccountByHdPath(hdPath: string, index: number): string;
|
|
25
|
+
addAccounts(numberOfAccounts?: number): string[];
|
|
26
|
+
activeAccounts(indexes: number[]): string[];
|
|
27
|
+
getFirstPage(): Promise<{
|
|
28
|
+
address: string;
|
|
29
|
+
index: number;
|
|
30
|
+
}[]>;
|
|
31
|
+
getNextPage(): Promise<{
|
|
32
|
+
address: string;
|
|
33
|
+
index: number;
|
|
34
|
+
}[]>;
|
|
35
|
+
getPreviousPage(): Promise<{
|
|
36
|
+
address: string;
|
|
37
|
+
index: number;
|
|
38
|
+
}[]>;
|
|
39
|
+
getAddresses(start: number, end: number): {
|
|
40
|
+
address: string;
|
|
41
|
+
index: number;
|
|
42
|
+
}[];
|
|
43
|
+
__getPage(increment: number): Promise<{
|
|
44
|
+
address: string;
|
|
45
|
+
index: number;
|
|
46
|
+
}[]>;
|
|
47
|
+
getAccounts(): string[];
|
|
48
|
+
getIndexByAddress(address: string): number;
|
|
49
|
+
private _addressFromIndex;
|
|
50
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './hd-keyring';
|
|
2
|
-
export * from './keystone-keyring';
|
|
3
|
-
export * from './simple-keyring';
|
|
4
|
-
export * from './interfaces/SimpleKeyringOptions';
|
|
1
|
+
export * from './hd-keyring';
|
|
2
|
+
export * from './keystone-keyring';
|
|
3
|
+
export * from './simple-keyring';
|
|
4
|
+
export * from './interfaces/SimpleKeyringOptions';
|
|
@@ -1,53 +1,52 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
readonly
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
readonly
|
|
17
|
-
readonly
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
readonly
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
readonly
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
export
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
protected
|
|
34
|
-
|
|
35
|
-
abstract
|
|
36
|
-
abstract
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
private
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
export {};
|
|
1
|
+
import { Network, Psbt } from 'bitcoinjs-lib';
|
|
2
|
+
import { EventEmitter } from 'events';
|
|
3
|
+
import { ECPairInterface } from 'ecpair';
|
|
4
|
+
interface BaseKeyringOptions {
|
|
5
|
+
readonly network?: Network;
|
|
6
|
+
}
|
|
7
|
+
export interface SimpleKeyringOptions extends BaseKeyringOptions {
|
|
8
|
+
readonly privateKeys?: string[];
|
|
9
|
+
}
|
|
10
|
+
export interface DeserializeOptionBase extends BaseKeyringOptions {
|
|
11
|
+
readonly hdPath?: string;
|
|
12
|
+
readonly activeIndexes?: number[];
|
|
13
|
+
}
|
|
14
|
+
export interface DeserializeOption extends DeserializeOptionBase {
|
|
15
|
+
readonly mnemonic?: string;
|
|
16
|
+
readonly xpriv?: string;
|
|
17
|
+
readonly passphrase?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface KeystoneKey {
|
|
20
|
+
readonly path: string;
|
|
21
|
+
readonly extendedPublicKey: string;
|
|
22
|
+
}
|
|
23
|
+
export interface DeserializeOptionKeystone extends DeserializeOptionBase {
|
|
24
|
+
readonly mfp: string;
|
|
25
|
+
readonly keys: KeystoneKey[];
|
|
26
|
+
}
|
|
27
|
+
export type KeyringOptions = SimpleKeyringOptions | DeserializeOption | DeserializeOptionKeystone;
|
|
28
|
+
export declare abstract class IKeyringBase<T extends BaseKeyringOptions> extends EventEmitter {
|
|
29
|
+
readonly network: Network;
|
|
30
|
+
static type: string;
|
|
31
|
+
type: string;
|
|
32
|
+
protected wallets: ECPairInterface[];
|
|
33
|
+
protected constructor(network?: Network);
|
|
34
|
+
abstract serialize(): T;
|
|
35
|
+
abstract addAccounts(numberOfAccounts: number): string[];
|
|
36
|
+
abstract deserialize(opts?: T): unknown;
|
|
37
|
+
removeAccount(publicKey: string): void;
|
|
38
|
+
verifyMessage(publicKey: string, text: string, sig: string): Promise<boolean>;
|
|
39
|
+
signData(publicKey: string, data: string, type?: 'ecdsa' | 'schnorr'): string;
|
|
40
|
+
abstract getAccounts(): string[];
|
|
41
|
+
signMessage(publicKey: string, text: string): string;
|
|
42
|
+
exportAccount(publicKey: string): string;
|
|
43
|
+
signTransaction(psbt: Psbt, inputs: {
|
|
44
|
+
index: number;
|
|
45
|
+
publicKey: string;
|
|
46
|
+
sighashTypes?: number[];
|
|
47
|
+
disableTweakSigner?: boolean;
|
|
48
|
+
}[], opts?: any): Psbt;
|
|
49
|
+
private _getWalletForAccount;
|
|
50
|
+
private _getPrivateKeyFor;
|
|
51
|
+
}
|
|
52
|
+
export {};
|
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
import bitcore from 'bitcore-lib';
|
|
2
|
-
import { DeserializeOptionKeystone, IKeyringBase, KeystoneKey } from './interfaces/SimpleKeyringOptions';
|
|
3
|
-
interface Wallet {
|
|
4
|
-
index: number;
|
|
5
|
-
publicKey: string;
|
|
6
|
-
path: string;
|
|
7
|
-
}
|
|
8
|
-
export declare class KeystoneKeyring extends IKeyringBase<DeserializeOptionKeystone> {
|
|
9
|
-
static type: string;
|
|
10
|
-
type: string;
|
|
11
|
-
mfp: string;
|
|
12
|
-
keys: KeystoneKey[];
|
|
13
|
-
hdPath?: string;
|
|
14
|
-
activeIndexes?: number[];
|
|
15
|
-
root: bitcore.HDPublicKey;
|
|
16
|
-
page: number;
|
|
17
|
-
perPage: number;
|
|
18
|
-
origin: string;
|
|
19
|
-
constructor(opts?: DeserializeOptionKeystone);
|
|
20
|
-
initFromUR(type: string, cbor: string): Promise<void>;
|
|
21
|
-
getHardenedPath(hdPath: string): string;
|
|
22
|
-
getHDPublicKey(hdPath: string): bitcore.HDPublicKey;
|
|
23
|
-
getDefaultHdPath(): string;
|
|
24
|
-
initRoot(): void;
|
|
25
|
-
deserialize(opts: DeserializeOptionKeystone): void;
|
|
26
|
-
serialize(): DeserializeOptionKeystone;
|
|
27
|
-
addAccounts(numberOfAccounts?: number): string[];
|
|
28
|
-
addChangeAddressAccounts(numberOfAccounts?: number): Promise<any[]>;
|
|
29
|
-
getAccounts(): string[];
|
|
30
|
-
getAccounts2(): Promise<{
|
|
31
|
-
index: number;
|
|
32
|
-
path: string;
|
|
33
|
-
publicKey: string;
|
|
34
|
-
}[]>;
|
|
35
|
-
getAccountsWithBrand(): Promise<{
|
|
36
|
-
address: string;
|
|
37
|
-
index: number;
|
|
38
|
-
}[]>;
|
|
39
|
-
getWalletByIndex(index: number): Wallet;
|
|
40
|
-
getChangeAddressWalletByIndex(index: number): Wallet;
|
|
41
|
-
removeAccount(publicKey: string): void;
|
|
42
|
-
exportAccount(_publicKey: string): string;
|
|
43
|
-
getFirstPage(): Promise<{
|
|
44
|
-
address: string;
|
|
45
|
-
index: number;
|
|
46
|
-
}[]>;
|
|
47
|
-
getNextPage(): Promise<{
|
|
48
|
-
address: string;
|
|
49
|
-
index: number;
|
|
50
|
-
}[]>;
|
|
51
|
-
getPreviousPage(): Promise<{
|
|
52
|
-
address: string;
|
|
53
|
-
index: number;
|
|
54
|
-
}[]>;
|
|
55
|
-
getAddresses(start: number, end: number): {
|
|
56
|
-
address: string;
|
|
57
|
-
index: number;
|
|
58
|
-
}[];
|
|
59
|
-
getPage(increment: number): Promise<{
|
|
60
|
-
address: string;
|
|
61
|
-
index: number;
|
|
62
|
-
}[]>;
|
|
63
|
-
activeAccounts(indexes: number[]): string[];
|
|
64
|
-
changeHdPath(hdPath: string): void;
|
|
65
|
-
changeChangeAddressHdPath(hdPath: string): any[];
|
|
66
|
-
getAccountByHdPath(hdPath: string, index: number): string;
|
|
67
|
-
getChangeAddressAccountByHdPath(hdPath: string, index: number): string;
|
|
68
|
-
genSignPsbtUr(psbtHex: string): Promise<{
|
|
69
|
-
type: string;
|
|
70
|
-
cbor: string;
|
|
71
|
-
}>;
|
|
72
|
-
parseSignPsbtUr(type: string, cbor: string): Promise<string>;
|
|
73
|
-
genSignMsgUr(publicKey: string, text: string): Promise<{
|
|
74
|
-
requestId: any;
|
|
75
|
-
type: string;
|
|
76
|
-
cbor: string;
|
|
77
|
-
}>;
|
|
78
|
-
parseSignMsgUr(type: string, cbor: string): Promise<import("@keystonehq/keystone-sdk").BtcSignature>;
|
|
79
|
-
signMessage(publicKey: string, text: string): string;
|
|
80
|
-
verifyMessage(publicKey: string, text: string, sig: string): Promise<boolean>;
|
|
81
|
-
}
|
|
82
|
-
export {};
|
|
1
|
+
import bitcore from 'bitcore-lib';
|
|
2
|
+
import { DeserializeOptionKeystone, IKeyringBase, KeystoneKey } from './interfaces/SimpleKeyringOptions';
|
|
3
|
+
interface Wallet {
|
|
4
|
+
index: number;
|
|
5
|
+
publicKey: string;
|
|
6
|
+
path: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class KeystoneKeyring extends IKeyringBase<DeserializeOptionKeystone> {
|
|
9
|
+
static type: string;
|
|
10
|
+
type: string;
|
|
11
|
+
mfp: string;
|
|
12
|
+
keys: KeystoneKey[];
|
|
13
|
+
hdPath?: string;
|
|
14
|
+
activeIndexes?: number[];
|
|
15
|
+
root: bitcore.HDPublicKey;
|
|
16
|
+
page: number;
|
|
17
|
+
perPage: number;
|
|
18
|
+
origin: string;
|
|
19
|
+
constructor(opts?: DeserializeOptionKeystone);
|
|
20
|
+
initFromUR(type: string, cbor: string): Promise<void>;
|
|
21
|
+
getHardenedPath(hdPath: string): string;
|
|
22
|
+
getHDPublicKey(hdPath: string): bitcore.HDPublicKey;
|
|
23
|
+
getDefaultHdPath(): string;
|
|
24
|
+
initRoot(): void;
|
|
25
|
+
deserialize(opts: DeserializeOptionKeystone): void;
|
|
26
|
+
serialize(): DeserializeOptionKeystone;
|
|
27
|
+
addAccounts(numberOfAccounts?: number): string[];
|
|
28
|
+
addChangeAddressAccounts(numberOfAccounts?: number): Promise<any[]>;
|
|
29
|
+
getAccounts(): string[];
|
|
30
|
+
getAccounts2(): Promise<{
|
|
31
|
+
index: number;
|
|
32
|
+
path: string;
|
|
33
|
+
publicKey: string;
|
|
34
|
+
}[]>;
|
|
35
|
+
getAccountsWithBrand(): Promise<{
|
|
36
|
+
address: string;
|
|
37
|
+
index: number;
|
|
38
|
+
}[]>;
|
|
39
|
+
getWalletByIndex(index: number): Wallet;
|
|
40
|
+
getChangeAddressWalletByIndex(index: number): Wallet;
|
|
41
|
+
removeAccount(publicKey: string): void;
|
|
42
|
+
exportAccount(_publicKey: string): string;
|
|
43
|
+
getFirstPage(): Promise<{
|
|
44
|
+
address: string;
|
|
45
|
+
index: number;
|
|
46
|
+
}[]>;
|
|
47
|
+
getNextPage(): Promise<{
|
|
48
|
+
address: string;
|
|
49
|
+
index: number;
|
|
50
|
+
}[]>;
|
|
51
|
+
getPreviousPage(): Promise<{
|
|
52
|
+
address: string;
|
|
53
|
+
index: number;
|
|
54
|
+
}[]>;
|
|
55
|
+
getAddresses(start: number, end: number): {
|
|
56
|
+
address: string;
|
|
57
|
+
index: number;
|
|
58
|
+
}[];
|
|
59
|
+
getPage(increment: number): Promise<{
|
|
60
|
+
address: string;
|
|
61
|
+
index: number;
|
|
62
|
+
}[]>;
|
|
63
|
+
activeAccounts(indexes: number[]): string[];
|
|
64
|
+
changeHdPath(hdPath: string): void;
|
|
65
|
+
changeChangeAddressHdPath(hdPath: string): any[];
|
|
66
|
+
getAccountByHdPath(hdPath: string, index: number): string;
|
|
67
|
+
getChangeAddressAccountByHdPath(hdPath: string, index: number): string;
|
|
68
|
+
genSignPsbtUr(psbtHex: string): Promise<{
|
|
69
|
+
type: string;
|
|
70
|
+
cbor: string;
|
|
71
|
+
}>;
|
|
72
|
+
parseSignPsbtUr(type: string, cbor: string): Promise<string>;
|
|
73
|
+
genSignMsgUr(publicKey: string, text: string): Promise<{
|
|
74
|
+
requestId: any;
|
|
75
|
+
type: string;
|
|
76
|
+
cbor: string;
|
|
77
|
+
}>;
|
|
78
|
+
parseSignMsgUr(type: string, cbor: string): Promise<import("@keystonehq/keystone-sdk").BtcSignature>;
|
|
79
|
+
signMessage(publicKey: string, text: string): string;
|
|
80
|
+
verifyMessage(publicKey: string, text: string, sig: string): Promise<boolean>;
|
|
81
|
+
}
|
|
82
|
+
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { IKeyringBase, SimpleKeyringOptions } from './interfaces/SimpleKeyringOptions';
|
|
2
|
-
export declare class SimpleKeyring extends IKeyringBase<SimpleKeyringOptions> {
|
|
3
|
-
static type: string;
|
|
4
|
-
type: string;
|
|
5
|
-
constructor(opts?: SimpleKeyringOptions);
|
|
6
|
-
serialize(): SimpleKeyringOptions;
|
|
7
|
-
deserialize(opts: SimpleKeyringOptions): void;
|
|
8
|
-
addAccounts(n?: number): string[];
|
|
9
|
-
getAccounts(): string[];
|
|
10
|
-
}
|
|
11
|
-
export declare function verifySignData(publicKey: string, hash: string, type: 'ecdsa' | 'schnorr', signature: string): boolean;
|
|
1
|
+
import { IKeyringBase, SimpleKeyringOptions } from './interfaces/SimpleKeyringOptions';
|
|
2
|
+
export declare class SimpleKeyring extends IKeyringBase<SimpleKeyringOptions> {
|
|
3
|
+
static type: string;
|
|
4
|
+
type: string;
|
|
5
|
+
constructor(opts?: SimpleKeyringOptions);
|
|
6
|
+
serialize(): SimpleKeyringOptions;
|
|
7
|
+
deserialize(opts: SimpleKeyringOptions): void;
|
|
8
|
+
addAccounts(n?: number): string[];
|
|
9
|
+
getAccounts(): string[];
|
|
10
|
+
}
|
|
11
|
+
export declare function verifySignData(publicKey: string, hash: string, type: 'ecdsa' | 'schnorr', signature: string): boolean;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
export declare function genPsbtOfBIP322Simple({ message, address, networkType }: {
|
|
5
|
-
message: string;
|
|
6
|
-
address: string;
|
|
7
|
-
networkType: NetworkType;
|
|
8
|
-
}): bitcoin.Psbt;
|
|
9
|
-
export declare function getSignatureFromPsbtOfBIP322Simple(psbt: bitcoin.Psbt): string;
|
|
10
|
-
/**
|
|
11
|
-
* reference: https://github.com/bitcoin/bips/blob/master/bip-0322.mediawiki
|
|
12
|
-
*/
|
|
13
|
-
export declare function signMessageOfBIP322Simple({ message, address, networkType, wallet }: {
|
|
14
|
-
message: string;
|
|
15
|
-
address: string;
|
|
16
|
-
networkType: NetworkType;
|
|
17
|
-
wallet: AbstractWallet;
|
|
18
|
-
}): Promise<string>;
|
|
19
|
-
export declare function verifyMessageOfBIP322Simple(address: string, msg: string, signature: string, networkType?: NetworkType): boolean;
|
|
1
|
+
import * as bitcoin from 'bitcoinjs-lib';
|
|
2
|
+
import { NetworkType } from '../network';
|
|
3
|
+
import { AbstractWallet } from '../wallet';
|
|
4
|
+
export declare function genPsbtOfBIP322Simple({ message, address, networkType }: {
|
|
5
|
+
message: string;
|
|
6
|
+
address: string;
|
|
7
|
+
networkType: NetworkType;
|
|
8
|
+
}): bitcoin.Psbt;
|
|
9
|
+
export declare function getSignatureFromPsbtOfBIP322Simple(psbt: bitcoin.Psbt): string;
|
|
10
|
+
/**
|
|
11
|
+
* reference: https://github.com/bitcoin/bips/blob/master/bip-0322.mediawiki
|
|
12
|
+
*/
|
|
13
|
+
export declare function signMessageOfBIP322Simple({ message, address, networkType, wallet }: {
|
|
14
|
+
message: string;
|
|
15
|
+
address: string;
|
|
16
|
+
networkType: NetworkType;
|
|
17
|
+
wallet: AbstractWallet;
|
|
18
|
+
}): Promise<string>;
|
|
19
|
+
export declare function verifyMessageOfBIP322Simple(address: string, msg: string, signature: string, networkType?: NetworkType): boolean;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ECPairInterface } from '../bitcoin-core';
|
|
2
|
-
export declare function signMessageOfDeterministicECDSA(ecpair: ECPairInterface, message: string): string;
|
|
1
|
+
import { ECPairInterface } from '../bitcoin-core';
|
|
2
|
+
export declare function signMessageOfDeterministicECDSA(ecpair: ECPairInterface, message: string): string;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ECPairInterface } from 'ecpair';
|
|
2
|
-
export declare function signMessageOfECDSA(privateKey: ECPairInterface, text: string): string;
|
|
3
|
-
export declare function verifyMessageOfECDSA(publicKey: string, text: string, sig: string): boolean;
|
|
1
|
+
import { ECPairInterface } from 'ecpair';
|
|
2
|
+
export declare function signMessageOfECDSA(privateKey: ECPairInterface, text: string): string;
|
|
3
|
+
export declare function verifyMessageOfECDSA(publicKey: string, text: string, sig: string): boolean;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './bip322-simple';
|
|
2
|
-
export * from './deterministic-ecdsa';
|
|
3
|
-
export * from './ecdsa';
|
|
1
|
+
export * from './bip322-simple';
|
|
2
|
+
export * from './deterministic-ecdsa';
|
|
3
|
+
export * from './ecdsa';
|
|
@@ -1,14 +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;
|
|
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;
|
package/lib/src/runes/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './varint';
|
|
1
|
+
export * from './varint';
|
|
@@ -1,11 +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
|
-
|
|
10
|
-
|
|
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
|
+
static fromString(s: string): RuneId;
|
|
10
|
+
toString(): string;
|
|
11
|
+
}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
declare function
|
|
3
|
-
declare function
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
declare
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
};
|
|
15
|
-
export {};
|
|
1
|
+
declare function try_decode(buf: any): (string | number)[];
|
|
2
|
+
declare function encodeToVec(n: any, v: any): void;
|
|
3
|
+
declare function decode(buffer: any): {
|
|
4
|
+
num: string | number;
|
|
5
|
+
index: string | number;
|
|
6
|
+
};
|
|
7
|
+
declare function encode(n: any): Buffer<Uint8Array<ArrayBuffer>>;
|
|
8
|
+
export declare const varint: {
|
|
9
|
+
encode: typeof encode;
|
|
10
|
+
decode: typeof decode;
|
|
11
|
+
try_decode: typeof try_decode;
|
|
12
|
+
encodeToVec: typeof encodeToVec;
|
|
13
|
+
};
|
|
14
|
+
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './inscription-utxo';
|
|
2
|
-
export * from './transaction';
|
|
3
|
-
export * from './utxo';
|
|
1
|
+
export * from './inscription-utxo';
|
|
2
|
+
export * from './transaction';
|
|
3
|
+
export * from './utxo';
|