beignet 0.2.0 → 0.3.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/README.md +284 -1
- package/dist/cli/beignet-node.js +1019 -47
- package/dist/cli/beignet-node.js.map +1 -1
- package/dist/cli/cli.js +1201 -16
- package/dist/cli/cli.js.map +1 -1
- package/dist/cli/config.js +21 -1
- package/dist/cli/config.js.map +1 -1
- package/dist/cli/daemon.js +342 -16
- package/dist/cli/daemon.js.map +1 -1
- package/dist/cli/errors.js +2 -0
- package/dist/cli/errors.js.map +1 -1
- package/dist/cli/openapi.js +1207 -14
- package/dist/cli/openapi.js.map +1 -1
- package/dist/cli/restore.js +89 -0
- package/dist/cli/restore.js.map +1 -0
- package/dist/cli/wallet-storage.js +34 -0
- package/dist/cli/wallet-storage.js.map +1 -0
- package/dist/electrum/index.js +105 -10
- package/dist/electrum/index.js.map +1 -1
- package/dist/lightning/advisor/fee-tuner.js +42 -0
- package/dist/lightning/advisor/fee-tuner.js.map +1 -0
- package/dist/lightning/advisor/index.js +9 -1
- package/dist/lightning/advisor/index.js.map +1 -1
- package/dist/lightning/advisor/rebalance-planner.js +55 -0
- package/dist/lightning/advisor/rebalance-planner.js.map +1 -0
- package/dist/lightning/backup/index.js +18 -0
- package/dist/lightning/backup/index.js.map +1 -0
- package/dist/lightning/backup/scb.js +42 -0
- package/dist/lightning/backup/scb.js.map +1 -0
- package/dist/lightning/chain/chain-monitor.js +27 -0
- package/dist/lightning/chain/chain-monitor.js.map +1 -1
- package/dist/lightning/chain/output-resolver.js +55 -6
- package/dist/lightning/chain/output-resolver.js.map +1 -1
- package/dist/lightning/chain/types.js +1 -0
- package/dist/lightning/chain/types.js.map +1 -1
- package/dist/lightning/channel/channel-manager.js +64 -0
- package/dist/lightning/channel/channel-manager.js.map +1 -1
- package/dist/lightning/channel/channel-state.js.map +1 -1
- package/dist/lightning/channel/channel.js +124 -4
- package/dist/lightning/channel/channel.js.map +1 -1
- package/dist/lightning/channel/dual-funding.js +6 -5
- package/dist/lightning/channel/dual-funding.js.map +1 -1
- package/dist/lightning/channel/types.js +3 -1
- package/dist/lightning/channel/types.js.map +1 -1
- package/dist/lightning/channel/validation.js +3 -3
- package/dist/lightning/channel/validation.js.map +1 -1
- package/dist/lightning/crypto/index.js +1 -0
- package/dist/lightning/crypto/index.js.map +1 -1
- package/dist/lightning/crypto/message-signing.js +116 -0
- package/dist/lightning/crypto/message-signing.js.map +1 -0
- package/dist/lightning/crypto/xchacha20poly1305.js +77 -0
- package/dist/lightning/crypto/xchacha20poly1305.js.map +1 -0
- package/dist/lightning/features/flags.js +1 -0
- package/dist/lightning/features/flags.js.map +1 -1
- package/dist/lightning/gossip/messages.js +37 -1
- package/dist/lightning/gossip/messages.js.map +1 -1
- package/dist/lightning/index.js +2 -1
- package/dist/lightning/index.js.map +1 -1
- package/dist/lightning/keys/wallet-keys.js +1 -0
- package/dist/lightning/keys/wallet-keys.js.map +1 -1
- package/dist/lightning/message/index.js +1 -0
- package/dist/lightning/message/index.js.map +1 -1
- package/dist/lightning/message/peer-storage.js +43 -0
- package/dist/lightning/message/peer-storage.js.map +1 -0
- package/dist/lightning/message/types.js +2 -0
- package/dist/lightning/message/types.js.map +1 -1
- package/dist/lightning/node/lightning-node.js +1583 -235
- package/dist/lightning/node/lightning-node.js.map +1 -1
- package/dist/lightning/node/types.js +18 -1
- package/dist/lightning/node/types.js.map +1 -1
- package/dist/lightning/offer/offer-manager.js +2 -5
- package/dist/lightning/offer/offer-manager.js.map +1 -1
- package/dist/lightning/offer/tlv.js +3 -1
- package/dist/lightning/offer/tlv.js.map +1 -1
- package/dist/lightning/storage/encryption.js +67 -0
- package/dist/lightning/storage/encryption.js.map +1 -0
- package/dist/lightning/storage/index.js +1 -0
- package/dist/lightning/storage/index.js.map +1 -1
- package/dist/lightning/storage/serialization.js +6 -2
- package/dist/lightning/storage/serialization.js.map +1 -1
- package/dist/lightning/storage/sqlite-storage.js +387 -33
- package/dist/lightning/storage/sqlite-storage.js.map +1 -1
- package/dist/lightning/watchtower/blob.js +135 -0
- package/dist/lightning/watchtower/blob.js.map +1 -0
- package/dist/lightning/watchtower/index.js +55 -0
- package/dist/lightning/watchtower/index.js.map +1 -0
- package/dist/lightning/watchtower/justice.js +182 -0
- package/dist/lightning/watchtower/justice.js.map +1 -0
- package/dist/lightning/watchtower/tower-connection.js +208 -0
- package/dist/lightning/watchtower/tower-connection.js.map +1 -0
- package/dist/lightning/watchtower/types.js +3 -0
- package/dist/lightning/watchtower/types.js.map +1 -0
- package/dist/lightning/watchtower/watchtower-client.js +402 -0
- package/dist/lightning/watchtower/watchtower-client.js.map +1 -0
- package/dist/lightning/watchtower/wtwire.js +201 -0
- package/dist/lightning/watchtower/wtwire.js.map +1 -0
- package/dist/shapes/electrum.js +32 -1
- package/dist/shapes/electrum.js.map +1 -1
- package/dist/shapes/wallet.js +11 -1
- package/dist/shapes/wallet.js.map +1 -1
- package/dist/transaction/index.js +163 -15
- package/dist/transaction/index.js.map +1 -1
- package/dist/types/cli/beignet-node.d.ts +144 -3
- package/dist/types/cli/daemon.d.ts +2 -0
- package/dist/types/cli/errors.d.ts +2 -0
- package/dist/types/cli/restore.d.ts +10 -0
- package/dist/types/cli/types.d.ts +228 -1
- package/dist/types/cli/wallet-storage.d.ts +3 -0
- package/dist/types/electrum/index.d.ts +12 -0
- package/dist/types/electrum.js +1 -0
- package/dist/types/electrum.js.map +1 -1
- package/dist/types/lightning/advisor/fee-tuner.d.ts +20 -0
- package/dist/types/lightning/advisor/index.d.ts +4 -0
- package/dist/types/lightning/advisor/rebalance-planner.d.ts +12 -0
- package/dist/types/lightning/backup/index.d.ts +1 -0
- package/dist/types/lightning/backup/scb.d.ts +24 -0
- package/dist/types/lightning/chain/chain-monitor.d.ts +1 -0
- package/dist/types/lightning/chain/types.d.ts +1 -0
- package/dist/types/lightning/channel/channel-manager.d.ts +7 -0
- package/dist/types/lightning/channel/channel-state.d.ts +2 -0
- package/dist/types/lightning/channel/channel.d.ts +6 -0
- package/dist/types/lightning/channel/dual-funding.d.ts +2 -1
- package/dist/types/lightning/channel/types.d.ts +2 -0
- package/dist/types/lightning/channel/validation.d.ts +1 -1
- package/dist/types/lightning/crypto/index.d.ts +1 -0
- package/dist/types/lightning/crypto/message-signing.d.ts +9 -0
- package/dist/types/lightning/crypto/xchacha20poly1305.d.ts +3 -0
- package/dist/types/lightning/features/flags.d.ts +1 -0
- package/dist/types/lightning/gossip/messages.d.ts +4 -0
- package/dist/types/lightning/index.d.ts +1 -0
- package/dist/types/lightning/keys/wallet-keys.d.ts +2 -1
- package/dist/types/lightning/message/index.d.ts +1 -0
- package/dist/types/lightning/message/peer-storage.d.ts +9 -0
- package/dist/types/lightning/message/types.d.ts +2 -0
- package/dist/types/lightning/node/lightning-node.d.ts +116 -4
- package/dist/types/lightning/node/types.d.ts +62 -1
- package/dist/types/lightning/storage/encryption.d.ts +11 -0
- package/dist/types/lightning/storage/index.d.ts +1 -0
- package/dist/types/lightning/storage/serialization.d.ts +2 -0
- package/dist/types/lightning/storage/sqlite-storage.d.ts +43 -3
- package/dist/types/lightning/storage/types.d.ts +62 -0
- package/dist/types/lightning/watchtower/blob.d.ts +32 -0
- package/dist/types/lightning/watchtower/index.d.ts +9 -0
- package/dist/types/lightning/watchtower/justice.d.ts +29 -0
- package/dist/types/lightning/watchtower/tower-connection.d.ts +34 -0
- package/dist/types/lightning/watchtower/types.d.ts +44 -0
- package/dist/types/lightning/watchtower/watchtower-client.d.ts +67 -0
- package/dist/types/lightning/watchtower/wtwire.d.ts +90 -0
- package/dist/types/shapes/electrum.d.ts +3 -1
- package/dist/types/transaction/index.d.ts +6 -0
- package/dist/types/transaction.js.map +1 -1
- package/dist/types/types/electrum.d.ts +3 -2
- package/dist/types/types/transaction.d.ts +1 -1
- package/dist/types/types/wallet.d.ts +78 -4
- package/dist/types/utils/descriptors.d.ts +2 -0
- package/dist/types/utils/fees.d.ts +3 -0
- package/dist/types/utils/helpers.d.ts +3 -1
- package/dist/types/utils/index.d.ts +5 -0
- package/dist/types/utils/multisig.d.ts +29 -0
- package/dist/types/utils/transaction.d.ts +7 -0
- package/dist/types/utils/wallet-storage-encryption.d.ts +3 -0
- package/dist/types/utils/wallet.d.ts +1 -1
- package/dist/types/utils/watch-only.d.ts +12 -0
- package/dist/types/wallet/constants.d.ts +1 -0
- package/dist/types/wallet/index.d.ts +61 -4
- package/dist/types/wallet.js +3 -0
- package/dist/types/wallet.js.map +1 -1
- package/dist/utils/derivation-path.js +8 -7
- package/dist/utils/derivation-path.js.map +1 -1
- package/dist/utils/descriptors.js +56 -0
- package/dist/utils/descriptors.js.map +1 -0
- package/dist/utils/electrum.js +10 -2
- package/dist/utils/electrum.js.map +1 -1
- package/dist/utils/fees.js +19 -0
- package/dist/utils/fees.js.map +1 -0
- package/dist/utils/helpers.js +22 -5
- package/dist/utils/helpers.js.map +1 -1
- package/dist/utils/index.js +5 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/multisig.js +90 -0
- package/dist/utils/multisig.js.map +1 -0
- package/dist/utils/transaction.js +30 -3
- package/dist/utils/transaction.js.map +1 -1
- package/dist/utils/wallet-storage-encryption.js +45 -0
- package/dist/utils/wallet-storage-encryption.js.map +1 -0
- package/dist/utils/wallet.js +3 -1
- package/dist/utils/wallet.js.map +1 -1
- package/dist/utils/watch-only.js +102 -0
- package/dist/utils/watch-only.js.map +1 -0
- package/dist/wallet/constants.js +2 -1
- package/dist/wallet/constants.js.map +1 -1
- package/dist/wallet/index.js +787 -30
- package/dist/wallet/index.js.map +1 -1
- package/docs/ROADMAP.md +292 -0
- package/package.json +1 -1
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { EventEmitter } from 'events';
|
|
4
|
+
export interface ITowerAddress {
|
|
5
|
+
pubkey: string;
|
|
6
|
+
host: string;
|
|
7
|
+
port: number;
|
|
8
|
+
uri: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ITowerTransport extends EventEmitter {
|
|
11
|
+
connect(): Promise<void>;
|
|
12
|
+
send(type: number, payload: Buffer): void;
|
|
13
|
+
close(): void;
|
|
14
|
+
isConnected(): boolean;
|
|
15
|
+
}
|
|
16
|
+
export type TowerTransportFactory = (addr: ITowerAddress) => ITowerTransport;
|
|
17
|
+
export interface IWatchtowerSession {
|
|
18
|
+
towerUri: string;
|
|
19
|
+
towerPubkey: string;
|
|
20
|
+
sessionId: string;
|
|
21
|
+
blobType: number;
|
|
22
|
+
maxUpdates: number;
|
|
23
|
+
sweepFeeRate: string;
|
|
24
|
+
seqNum: number;
|
|
25
|
+
lastApplied: number;
|
|
26
|
+
createdAt: number;
|
|
27
|
+
}
|
|
28
|
+
export interface IWatchtowerUpdate {
|
|
29
|
+
towerUri: string;
|
|
30
|
+
channelId: string;
|
|
31
|
+
hint: string;
|
|
32
|
+
encryptedBlob: string;
|
|
33
|
+
seqNum: number;
|
|
34
|
+
acked: boolean;
|
|
35
|
+
createdAt: number;
|
|
36
|
+
}
|
|
37
|
+
export interface ITowerHealth {
|
|
38
|
+
uri: string;
|
|
39
|
+
pubkey: string;
|
|
40
|
+
connected: boolean;
|
|
41
|
+
sessions: number;
|
|
42
|
+
pendingBacklog: number;
|
|
43
|
+
lastAck: number | null;
|
|
44
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/// <reference types="node" />
|
|
3
|
+
import { EventEmitter } from 'events';
|
|
4
|
+
import * as bitcoin from 'bitcoinjs-lib';
|
|
5
|
+
import { IJusticeContext } from './justice';
|
|
6
|
+
import { TowerTransportFactory, IWatchtowerSession, IWatchtowerUpdate, ITowerHealth } from './types';
|
|
7
|
+
export interface IWatchtowerStore {
|
|
8
|
+
saveWatchtowerSession(session: IWatchtowerSession, sessionKey: Buffer): void;
|
|
9
|
+
loadWatchtowerSessions(): Array<IWatchtowerSession & {
|
|
10
|
+
sessionKey: Buffer;
|
|
11
|
+
}>;
|
|
12
|
+
setWatchtowerSessionProgress(sessionId: string, seqNum: number, lastApplied: number): void;
|
|
13
|
+
deleteWatchtowerTower(towerUri: string): void;
|
|
14
|
+
addWatchtowerUpdate(update: IWatchtowerUpdate): number;
|
|
15
|
+
loadPendingWatchtowerUpdates(): Array<IWatchtowerUpdate & {
|
|
16
|
+
id: number;
|
|
17
|
+
}>;
|
|
18
|
+
markWatchtowerUpdateAcked(id: number, seqNum: number): void;
|
|
19
|
+
}
|
|
20
|
+
export interface IWatchtowerClientOptions {
|
|
21
|
+
localPrivateKey: Buffer;
|
|
22
|
+
chainHash: Buffer;
|
|
23
|
+
network: bitcoin.Network;
|
|
24
|
+
towers?: string[];
|
|
25
|
+
store?: IWatchtowerStore;
|
|
26
|
+
transportFactory?: TowerTransportFactory;
|
|
27
|
+
socks5Proxy?: {
|
|
28
|
+
host: string;
|
|
29
|
+
port: number;
|
|
30
|
+
};
|
|
31
|
+
maxUpdates?: number;
|
|
32
|
+
sweepFeeRateSatPerKw?: bigint;
|
|
33
|
+
connectTimeoutMs?: number;
|
|
34
|
+
}
|
|
35
|
+
export declare class WatchtowerClient extends EventEmitter {
|
|
36
|
+
private readonly localPrivateKey;
|
|
37
|
+
private readonly chainHash;
|
|
38
|
+
private readonly store?;
|
|
39
|
+
private readonly transportFactory;
|
|
40
|
+
private readonly socks5Proxy?;
|
|
41
|
+
private readonly maxUpdates;
|
|
42
|
+
private readonly sweepFeeRate;
|
|
43
|
+
private readonly connectTimeoutMs;
|
|
44
|
+
private readonly towers;
|
|
45
|
+
private started;
|
|
46
|
+
constructor(opts: IWatchtowerClientOptions);
|
|
47
|
+
get enabled(): boolean;
|
|
48
|
+
start(): Promise<void>;
|
|
49
|
+
stop(): void;
|
|
50
|
+
listTowers(): string[];
|
|
51
|
+
addTower(uri: string): void;
|
|
52
|
+
removeTower(uri: string): void;
|
|
53
|
+
getHealth(): ITowerHealth[];
|
|
54
|
+
backupRevokedState(ctx: IJusticeContext): void;
|
|
55
|
+
private registerTower;
|
|
56
|
+
private connectTower;
|
|
57
|
+
private onConnected;
|
|
58
|
+
private onMessage;
|
|
59
|
+
private onClose;
|
|
60
|
+
private ensureSessionAndDrain;
|
|
61
|
+
private negotiateSession;
|
|
62
|
+
private drainBacklog;
|
|
63
|
+
private shipUpdate;
|
|
64
|
+
private awaitReply;
|
|
65
|
+
private lastAckFor;
|
|
66
|
+
private emitLog;
|
|
67
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
export declare enum WtMessageType {
|
|
3
|
+
INIT = 600,
|
|
4
|
+
ERROR = 601,
|
|
5
|
+
CREATE_SESSION = 602,
|
|
6
|
+
CREATE_SESSION_REPLY = 603,
|
|
7
|
+
STATE_UPDATE = 604,
|
|
8
|
+
STATE_UPDATE_REPLY = 605,
|
|
9
|
+
DELETE_SESSION = 606,
|
|
10
|
+
DELETE_SESSION_REPLY = 607
|
|
11
|
+
}
|
|
12
|
+
export declare enum WtFeatureBit {
|
|
13
|
+
ALTRUIST_SESSIONS_REQUIRED = 0,
|
|
14
|
+
ALTRUIST_SESSIONS_OPTIONAL = 1,
|
|
15
|
+
ANCHOR_COMMIT_REQUIRED = 2,
|
|
16
|
+
ANCHOR_COMMIT_OPTIONAL = 3,
|
|
17
|
+
TAPROOT_COMMIT_REQUIRED = 4,
|
|
18
|
+
TAPROOT_COMMIT_OPTIONAL = 5
|
|
19
|
+
}
|
|
20
|
+
export declare enum WtErrorCode {
|
|
21
|
+
OK = 0,
|
|
22
|
+
TEMPORARY_FAILURE = 40,
|
|
23
|
+
PERMANENT_FAILURE = 50
|
|
24
|
+
}
|
|
25
|
+
export declare enum CreateSessionCode {
|
|
26
|
+
OK = 0,
|
|
27
|
+
REJECT_ALREADY_EXISTS = 60,
|
|
28
|
+
REJECT_MAX_UPDATES = 61,
|
|
29
|
+
REJECT_REWARD_RATE = 62,
|
|
30
|
+
REJECT_SWEEP_FEE_RATE = 63,
|
|
31
|
+
REJECT_BLOB_TYPE = 64
|
|
32
|
+
}
|
|
33
|
+
export declare enum StateUpdateCode {
|
|
34
|
+
OK = 0,
|
|
35
|
+
CLIENT_BEHIND = 40,
|
|
36
|
+
MAX_UPDATES_EXCEEDED = 41,
|
|
37
|
+
SEQ_NUM_OUT_OF_ORDER = 42
|
|
38
|
+
}
|
|
39
|
+
export interface IWtInit {
|
|
40
|
+
connFeatures: Buffer;
|
|
41
|
+
chainHash: Buffer;
|
|
42
|
+
}
|
|
43
|
+
export interface IWtError {
|
|
44
|
+
code: number;
|
|
45
|
+
data: Buffer;
|
|
46
|
+
}
|
|
47
|
+
export interface IWtCreateSession {
|
|
48
|
+
blobType: number;
|
|
49
|
+
maxUpdates: number;
|
|
50
|
+
rewardBase: number;
|
|
51
|
+
rewardRate: number;
|
|
52
|
+
sweepFeeRate: bigint;
|
|
53
|
+
}
|
|
54
|
+
export interface IWtCreateSessionReply {
|
|
55
|
+
code: number;
|
|
56
|
+
lastApplied: number;
|
|
57
|
+
data: Buffer;
|
|
58
|
+
}
|
|
59
|
+
export interface IWtStateUpdate {
|
|
60
|
+
seqNum: number;
|
|
61
|
+
lastApplied: number;
|
|
62
|
+
isComplete: number;
|
|
63
|
+
hint: Buffer;
|
|
64
|
+
encryptedBlob: Buffer;
|
|
65
|
+
}
|
|
66
|
+
export interface IWtStateUpdateReply {
|
|
67
|
+
code: number;
|
|
68
|
+
lastApplied: number;
|
|
69
|
+
}
|
|
70
|
+
export interface IWtDeleteSession {
|
|
71
|
+
_?: never;
|
|
72
|
+
}
|
|
73
|
+
export interface IWtDeleteSessionReply {
|
|
74
|
+
code: number;
|
|
75
|
+
}
|
|
76
|
+
export declare function encodeInit(msg: IWtInit): Buffer;
|
|
77
|
+
export declare function decodeInit(payload: Buffer): IWtInit;
|
|
78
|
+
export declare function encodeError(msg: IWtError): Buffer;
|
|
79
|
+
export declare function decodeError(payload: Buffer): IWtError;
|
|
80
|
+
export declare function encodeCreateSession(msg: IWtCreateSession): Buffer;
|
|
81
|
+
export declare function decodeCreateSession(payload: Buffer): IWtCreateSession;
|
|
82
|
+
export declare function encodeCreateSessionReply(msg: IWtCreateSessionReply): Buffer;
|
|
83
|
+
export declare function decodeCreateSessionReply(payload: Buffer): IWtCreateSessionReply;
|
|
84
|
+
export declare function encodeStateUpdate(msg: IWtStateUpdate): Buffer;
|
|
85
|
+
export declare function decodeStateUpdate(payload: Buffer): IWtStateUpdate;
|
|
86
|
+
export declare function encodeStateUpdateReply(msg: IWtStateUpdateReply): Buffer;
|
|
87
|
+
export declare function decodeStateUpdateReply(payload: Buffer): IWtStateUpdateReply;
|
|
88
|
+
export declare function encodeDeleteSession(): Buffer;
|
|
89
|
+
export declare function encodeDeleteSessionReply(msg: IWtDeleteSessionReply): Buffer;
|
|
90
|
+
export declare function decodeDeleteSessionReply(payload: Buffer): IWtDeleteSessionReply;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { TMessageKeys } from '../types';
|
|
1
|
+
import { EElectrumNetworks, TMessageKeys, TServer } from '../types';
|
|
2
2
|
export declare const onMessageKeys: {
|
|
3
3
|
[K in TMessageKeys]: K;
|
|
4
4
|
};
|
|
5
5
|
export declare const POLLING_INTERVAL: number;
|
|
6
|
+
export declare const ELECTRUM_SERVER_COOLDOWN_MS: number;
|
|
7
|
+
export declare const defaultElectrumPeers: Partial<Record<EElectrumNetworks, TServer[]>>;
|
|
@@ -18,6 +18,7 @@ export declare class Transaction {
|
|
|
18
18
|
}): Promise<Result<ISendTransaction>>;
|
|
19
19
|
resetSendTransaction(): Promise<Result<string>>;
|
|
20
20
|
removeBlackListedUtxos(utxos?: IUtxo[]): IUtxo[];
|
|
21
|
+
private applyMultisigInputWeights;
|
|
21
22
|
getTotalFee: ({ satsPerByte, message, transaction, fundingLightning, coinSelectPreference }: {
|
|
22
23
|
satsPerByte: number;
|
|
23
24
|
message?: string | undefined;
|
|
@@ -52,6 +53,11 @@ export declare class Transaction {
|
|
|
52
53
|
bip32Interface?: BIP32Interface | undefined;
|
|
53
54
|
shuffleTargets?: boolean | undefined;
|
|
54
55
|
}) => Promise<Result<Psbt>>;
|
|
56
|
+
createUnsignedPsbt: ({ transactionData, shuffleOutputs }?: {
|
|
57
|
+
transactionData?: ISendTransaction | undefined;
|
|
58
|
+
shuffleOutputs?: boolean | undefined;
|
|
59
|
+
}) => Promise<Result<Psbt>>;
|
|
60
|
+
private addSignerMetadata;
|
|
55
61
|
addInput: ({ psbt, keyPair, input }: IAddInput) => Promise<Result<string>>;
|
|
56
62
|
addExternalInputs({ inputs, keyPair }: {
|
|
57
63
|
inputs: IUtxo[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../src/types/transaction.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../src/types/transaction.ts"],"names":[],"mappings":";;;AA0CA,IAAY,MAMX;AAND,WAAY,MAAM;IACjB,uBAAa,CAAA;IACb,2BAAiB,CAAA;IACjB,uBAAa,CAAA;IACb,2BAAiB,CAAA;IACjB,uBAAa,CAAA;AACd,CAAC,EANW,MAAM,GAAN,cAAM,KAAN,cAAM,QAMjB;AA8BD,IAAY,qBAMX;AAND,WAAY,qBAAqB;IAChC,wCAAe,CAAA;IACf,wCAAe,CAAA;IACf,oDAA2B,CAAA;IAC3B,4DAAmC,CAAA;IACnC,0DAAiC,CAAA;AAClC,CAAC,EANW,qBAAqB,GAArB,6BAAqB,KAArB,6BAAqB,QAMhC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { EAvailableNetworks, IAddress, IGetAddressBalanceRes, ITransaction, IUtxo } from './wallet';
|
|
2
2
|
export type Net = typeof import('net');
|
|
3
3
|
export type Tls = typeof import('tls');
|
|
4
|
-
export type TElectrumNetworks = 'bitcoin' | 'bitcoinTestnet' | 'bitcoinRegtest';
|
|
4
|
+
export type TElectrumNetworks = 'bitcoin' | 'bitcoinTestnet' | 'bitcoinRegtest' | 'bitcoinSignet';
|
|
5
5
|
export declare enum EElectrumNetworks {
|
|
6
6
|
bitcoin = "bitcoin",
|
|
7
7
|
bitcoinTestnet = "bitcoinTestnet",
|
|
8
|
-
bitcoinRegtest = "bitcoinRegtest"
|
|
8
|
+
bitcoinRegtest = "bitcoinRegtest",
|
|
9
|
+
bitcoinSignet = "bitcoinSignet"
|
|
9
10
|
}
|
|
10
11
|
export type TConnectToElectrumRes = string;
|
|
11
12
|
export interface IElectrumGetAddressBalanceRes extends IGetAddressBalanceRes {
|
|
@@ -3,7 +3,7 @@ import { EElectrumNetworks, IHeader, INewBlock, Net, TServer, TTxResult, Tls } f
|
|
|
3
3
|
import { ECoinSelectPreference, EFeeId, TGapLimitOptions } from './transaction';
|
|
4
4
|
import { ECPairInterface } from 'ecpair';
|
|
5
5
|
import { BIP32Interface } from 'bip32';
|
|
6
|
-
export type TAvailableNetworks = 'bitcoin' | 'testnet' | 'regtest';
|
|
6
|
+
export type TAvailableNetworks = 'bitcoin' | 'testnet' | 'regtest' | 'signet';
|
|
7
7
|
export type TAddressType = 'p2wpkh' | 'p2sh' | 'p2pkh';
|
|
8
8
|
export type TAddressLabel = 'bech32' | 'segwit' | 'legacy';
|
|
9
9
|
export type TKeyDerivationPurpose = '84' | '49' | '44' | string;
|
|
@@ -21,13 +21,17 @@ export declare enum EAvailableNetworks {
|
|
|
21
21
|
testnet = "testnet",
|
|
22
22
|
bitcoinTestnet = "testnet",
|
|
23
23
|
regtest = "regtest",
|
|
24
|
-
bitcoinRegtest = "regtest"
|
|
24
|
+
bitcoinRegtest = "regtest",
|
|
25
|
+
signet = "signet",
|
|
26
|
+
bitcoinSignet = "signet"
|
|
25
27
|
}
|
|
28
|
+
export type TFeeEstimationSource = 'electrum' | 'http' | 'auto';
|
|
26
29
|
export declare enum EAddressType {
|
|
27
30
|
p2wpkh = "p2wpkh",
|
|
28
31
|
p2sh = "p2sh",
|
|
29
32
|
p2pkh = "p2pkh",
|
|
30
|
-
p2tr = "p2tr"
|
|
33
|
+
p2tr = "p2tr",
|
|
34
|
+
p2wsh = "p2wsh"
|
|
31
35
|
}
|
|
32
36
|
export declare enum EPaymentType {
|
|
33
37
|
sent = "sent",
|
|
@@ -147,17 +151,25 @@ export interface IWalletData {
|
|
|
147
151
|
balance: number;
|
|
148
152
|
selectedFeeId: EFeeId;
|
|
149
153
|
feeEstimates: IOnchainFees;
|
|
154
|
+
addressLabels: TAddressLabels;
|
|
155
|
+
birthdayHeight: number;
|
|
150
156
|
}
|
|
157
|
+
export type TAddressLabels = {
|
|
158
|
+
[address: string]: string;
|
|
159
|
+
};
|
|
151
160
|
export type TWalletDataKeys = keyof IWalletData;
|
|
152
161
|
export type TGetData = <K extends keyof IWalletData>(key: string) => Promise<Result<IWalletData[K]>>;
|
|
153
162
|
export type TSetData = <K extends keyof IWalletData>(key: string, value: IWalletData[K]) => Promise<Result<boolean>>;
|
|
154
163
|
export interface IWallet {
|
|
155
|
-
mnemonic
|
|
164
|
+
mnemonic?: string;
|
|
165
|
+
xpub?: string;
|
|
156
166
|
id?: string;
|
|
157
167
|
name?: string;
|
|
158
168
|
passphrase?: string;
|
|
159
169
|
network?: EAvailableNetworks;
|
|
160
170
|
addressType?: EAddressType;
|
|
171
|
+
account?: number;
|
|
172
|
+
birthdayHeight?: number;
|
|
161
173
|
coinSelectPreference?: ECoinSelectPreference;
|
|
162
174
|
data?: IWalletData;
|
|
163
175
|
storage?: TStorage;
|
|
@@ -174,12 +186,14 @@ export interface IWallet {
|
|
|
174
186
|
customGetScriptHash?: (data: ICustomGetScriptHash) => Promise<string>;
|
|
175
187
|
rbf?: boolean;
|
|
176
188
|
selectedFeeId?: EFeeId;
|
|
189
|
+
feeEstimationSource?: TFeeEstimationSource;
|
|
177
190
|
disableMessages?: boolean;
|
|
178
191
|
disableMessagesOnCreate?: boolean;
|
|
179
192
|
addressTypesToMonitor?: EAddressType[];
|
|
180
193
|
gapLimitOptions?: TGapLimitOptions;
|
|
181
194
|
addressLookBehind?: number;
|
|
182
195
|
addressLookAhead?: number;
|
|
196
|
+
multisig?: IMultisigOptions;
|
|
183
197
|
}
|
|
184
198
|
export interface IAddressData {
|
|
185
199
|
path: string;
|
|
@@ -376,6 +390,48 @@ export interface ISend {
|
|
|
376
390
|
txs: ISendTx | ISendTx[];
|
|
377
391
|
satsPerByte?: number;
|
|
378
392
|
}
|
|
393
|
+
export type IWatchOnlyWallet = Omit<IWallet, 'mnemonic' | 'passphrase' | 'xpub'> & {
|
|
394
|
+
xpub: string;
|
|
395
|
+
};
|
|
396
|
+
export interface IMultisigOptions {
|
|
397
|
+
threshold: number;
|
|
398
|
+
cosigners: string[];
|
|
399
|
+
ourXpub?: string;
|
|
400
|
+
}
|
|
401
|
+
export type IMultisigWallet = Omit<IWallet, 'xpub' | 'addressType'> & IMultisigOptions;
|
|
402
|
+
export interface IBuildPsbtArgs {
|
|
403
|
+
txs?: ISendTx[];
|
|
404
|
+
address?: string;
|
|
405
|
+
amount?: number;
|
|
406
|
+
message?: string;
|
|
407
|
+
satsPerByte?: number;
|
|
408
|
+
rbf?: boolean;
|
|
409
|
+
shuffleOutputs?: boolean;
|
|
410
|
+
}
|
|
411
|
+
export interface IBuildPsbtInputSummary {
|
|
412
|
+
tx_hash: string;
|
|
413
|
+
tx_pos: number;
|
|
414
|
+
address: string;
|
|
415
|
+
value: number;
|
|
416
|
+
path: string;
|
|
417
|
+
}
|
|
418
|
+
export interface IBuildPsbtOutputSummary {
|
|
419
|
+
address?: string;
|
|
420
|
+
value: number;
|
|
421
|
+
index: number;
|
|
422
|
+
}
|
|
423
|
+
export interface IBuildPsbtResponse {
|
|
424
|
+
psbtBase64: string;
|
|
425
|
+
fee: number;
|
|
426
|
+
vsizeEstimate: number;
|
|
427
|
+
satsPerByte: number;
|
|
428
|
+
inputs: IBuildPsbtInputSummary[];
|
|
429
|
+
outputs: IBuildPsbtOutputSummary[];
|
|
430
|
+
}
|
|
431
|
+
export interface IImportSignedPsbtResponse {
|
|
432
|
+
txHex: string;
|
|
433
|
+
txid: string;
|
|
434
|
+
}
|
|
379
435
|
export type TAddressIndexInfo = {
|
|
380
436
|
addressIndex: IAddress;
|
|
381
437
|
changeAddressIndex: IAddress;
|
|
@@ -459,4 +515,22 @@ export interface ICanBoostResponse {
|
|
|
459
515
|
rbf: boolean;
|
|
460
516
|
cpfp: boolean;
|
|
461
517
|
}
|
|
518
|
+
export interface IBalanceBreakdown {
|
|
519
|
+
total: number;
|
|
520
|
+
spendable: number;
|
|
521
|
+
frozen: number;
|
|
522
|
+
}
|
|
523
|
+
export interface IExportedDescriptor {
|
|
524
|
+
addressType: EAddressType;
|
|
525
|
+
external: string;
|
|
526
|
+
internal: string;
|
|
527
|
+
}
|
|
528
|
+
export interface IExportDescriptorsResponse {
|
|
529
|
+
fingerprint: string;
|
|
530
|
+
network: EAvailableNetworks;
|
|
531
|
+
account: number;
|
|
532
|
+
birthdayHeight?: number;
|
|
533
|
+
watchOnly: boolean;
|
|
534
|
+
descriptors: IExportedDescriptor[];
|
|
535
|
+
}
|
|
462
536
|
export {};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { EAddressType, EAvailableNetworks, IGetAddressesFromKeyPair, IGetAddressesFromPrivateKey, IKeyDerivationPath } from '../types';
|
|
2
|
+
import { EAddressType, EAvailableNetworks, IGetAddressesFromKeyPair, IGetAddressesFromPrivateKey, IKeyDerivationPath, TAvailableNetworks } from '../types';
|
|
3
3
|
import { Network } from 'bitcoinjs-lib';
|
|
4
4
|
import { Result } from './result';
|
|
5
5
|
import { ECPairInterface } from 'ecpair';
|
|
6
6
|
import { BIP32Interface } from 'bip32';
|
|
7
|
+
export declare const validatePsbtSignature: (pubkey: Buffer, msghash: Buffer, signature: Buffer) => boolean;
|
|
8
|
+
export declare const getBitcoinJsNetwork: (network: EAvailableNetworks | TAvailableNetworks) => Network;
|
|
7
9
|
export declare const getAddressFromScriptPubKey: (scriptPubKey: string, selectedNetwork: EAvailableNetworks) => string;
|
|
8
10
|
export declare const getSha256: (str: string) => string;
|
|
9
11
|
export declare const validateAddress: ({ address, network }: {
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
export * from './wallet';
|
|
2
|
+
export * from './wallet-storage-encryption';
|
|
3
|
+
export * from './watch-only';
|
|
4
|
+
export * from './multisig';
|
|
2
5
|
export * from './helpers';
|
|
3
6
|
export * from './electrum';
|
|
7
|
+
export * from './fees';
|
|
4
8
|
export * from './derivation-path';
|
|
9
|
+
export * from './descriptors';
|
|
5
10
|
export * from './transaction';
|
|
6
11
|
export * from './result';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import { BIP32Interface } from 'bip32';
|
|
3
|
+
import { Network } from 'bitcoinjs-lib';
|
|
4
|
+
import { Result } from './result';
|
|
5
|
+
export declare class MultisigSpendError extends Error {
|
|
6
|
+
readonly code = "MULTISIG_REQUIRES_PSBT";
|
|
7
|
+
constructor(message?: string);
|
|
8
|
+
}
|
|
9
|
+
export declare const BIP48_SCRIPT_TYPE = "2";
|
|
10
|
+
export interface IParsedBip48Path {
|
|
11
|
+
coinType: string;
|
|
12
|
+
account: string;
|
|
13
|
+
change: number;
|
|
14
|
+
index: number;
|
|
15
|
+
}
|
|
16
|
+
export declare const parseBip48Path: (path: string) => Result<IParsedBip48Path>;
|
|
17
|
+
export interface ISortedMultisigPayment {
|
|
18
|
+
address: string;
|
|
19
|
+
output: Buffer;
|
|
20
|
+
witnessScript: Buffer;
|
|
21
|
+
sortedPublicKeys: Buffer[];
|
|
22
|
+
}
|
|
23
|
+
export declare const buildSortedMultisigPayment: ({ threshold, cosignerNodes, change, index, network }: {
|
|
24
|
+
threshold: number;
|
|
25
|
+
cosignerNodes: BIP32Interface[];
|
|
26
|
+
change: number;
|
|
27
|
+
index: number;
|
|
28
|
+
network: Network;
|
|
29
|
+
}) => Result<ISortedMultisigPayment>;
|
|
@@ -5,6 +5,13 @@ export declare const setReplaceByFee: ({ psbt, setRbf }: {
|
|
|
5
5
|
psbt: Psbt;
|
|
6
6
|
setRbf: boolean;
|
|
7
7
|
}) => void;
|
|
8
|
+
export interface IEncodeBip21 {
|
|
9
|
+
address: string;
|
|
10
|
+
amountSats?: number;
|
|
11
|
+
label?: string;
|
|
12
|
+
message?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare const encodeBip21: ({ address, amountSats, label, message }: IEncodeBip21) => Result<string>;
|
|
8
15
|
export declare const parseOnChainPaymentRequest: (data: string, network?: EAvailableNetworks) => Result<{
|
|
9
16
|
address: string;
|
|
10
17
|
network: EAvailableNetworks;
|
|
@@ -35,7 +35,7 @@ export declare const decodeOpReturnMessage: (opReturn?: string) => string[];
|
|
|
35
35
|
export declare const getSeed: (mnemonic: any, bip39Passphrase: any) => Buffer;
|
|
36
36
|
export declare const getSeedHash: (seed: Buffer) => string;
|
|
37
37
|
export declare const generateWalletId: (seed: Buffer) => string;
|
|
38
|
-
export declare const getWalletDataStorageKey: (name: string, network: EAvailableNetworks, key: keyof IWalletData) => string;
|
|
38
|
+
export declare const getWalletDataStorageKey: (name: string, network: EAvailableNetworks, key: keyof IWalletData, account?: number) => string;
|
|
39
39
|
export declare const getStorageKeyValues: (storageKey: string) => {
|
|
40
40
|
walletName: string;
|
|
41
41
|
network: EAvailableNetworks;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BIP32Interface } from 'bip32';
|
|
2
|
+
import { EAddressType, EAvailableNetworks } from '../types';
|
|
3
|
+
import { Result } from './result';
|
|
4
|
+
export declare class WatchOnlySigningError extends Error {
|
|
5
|
+
readonly code = "WATCH_ONLY_CANNOT_SIGN";
|
|
6
|
+
constructor(message?: string);
|
|
7
|
+
}
|
|
8
|
+
export interface IParsedExtendedPublicKey {
|
|
9
|
+
node: BIP32Interface;
|
|
10
|
+
addressType?: EAddressType;
|
|
11
|
+
}
|
|
12
|
+
export declare const parseExtendedPublicKey: (extendedKey: string, network: EAvailableNetworks) => Result<IParsedExtendedPublicKey>;
|
|
@@ -1,14 +1,17 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import { BIP32Interface } from 'bip32';
|
|
2
|
-
import { EAddressType, EAvailableNetworks, EBoostType, ECoinSelectPreference, EFeeId, EScanningStrategy, IAddress, IBoostedTransaction, IBoostedTransactions, ICanBoostResponse, IFormattedTransaction, IFormattedTransactions, IGenerateAddresses, IGenerateAddressesResponse, IGetAddress, IGetAddressBalanceRes, IGetAddressByPath, IGetAddressesFromPrivateKey, IGetAddressResponse, IGetNextAvailableAddressResponse, IGetUtxosResponse, IHeader, IKeyDerivationPath, InputData, IOnchainFees, IPrivateKeyInfo, IRbfData, ISendTransaction, ISendTx, ISetupTransaction, ISweepPrivateKey, ISweepPrivateKeyRes, ITransaction, ITxHash, IUtxo, IWallet, IWalletData, Net, TAddressIndexInfo, TGapLimitOptions, TGetTotalFeeObj, Tls, TOnMessage, TServer, TSetupTransactionResponse, TTxDetails, TTxResult, TWalletDataKeys } from '../types';
|
|
3
|
+
import { EAddressType, EAvailableNetworks, EBoostType, ECoinSelectPreference, EFeeId, EScanningStrategy, IAddress, IBalanceBreakdown, IBoostedTransaction, IBoostedTransactions, IBuildPsbtArgs, IBuildPsbtResponse, IImportSignedPsbtResponse, ICanBoostResponse, IExportDescriptorsResponse, IFormattedTransaction, IFormattedTransactions, IGenerateAddresses, IGenerateAddressesResponse, IGetAddress, IGetAddressBalanceRes, IGetAddressByPath, IGetAddressesFromPrivateKey, IGetAddressResponse, IGetNextAvailableAddressResponse, IGetUtxosResponse, IHeader, IKeyDerivationPath, IMultisigWallet, InputData, IOnchainFees, IPrivateKeyInfo, IRbfData, ISendTransaction, ISendTx, ISetupTransaction, ISweepPrivateKey, ISweepPrivateKeyRes, ITransaction, ITxHash, IUtxo, IWallet, IWalletData, IWatchOnlyWallet, Net, TAddressIndexInfo, TAddressLabels, TFeeEstimationSource, TGapLimitOptions, TGetTotalFeeObj, Tls, TOnMessage, TServer, TSetupTransactionResponse, TTxDetails, TTxResult, TWalletDataKeys } from '../types';
|
|
3
4
|
import { Result } from '../utils';
|
|
4
5
|
import { Electrum } from '../electrum';
|
|
5
6
|
import { Transaction } from '../transaction';
|
|
6
7
|
export declare class Wallet {
|
|
7
8
|
private _network;
|
|
8
|
-
private readonly _mnemonic
|
|
9
|
+
private readonly _mnemonic?;
|
|
9
10
|
private readonly _passphrase;
|
|
10
|
-
private readonly _seed
|
|
11
|
-
private readonly _root
|
|
11
|
+
private readonly _seed?;
|
|
12
|
+
private readonly _root?;
|
|
13
|
+
private readonly _accountNode?;
|
|
14
|
+
private readonly _multisig?;
|
|
12
15
|
private _data;
|
|
13
16
|
private _getData;
|
|
14
17
|
private _setData?;
|
|
@@ -16,8 +19,11 @@ export declare class Wallet {
|
|
|
16
19
|
private _customGetScriptHash?;
|
|
17
20
|
private _pendingRefreshPromises;
|
|
18
21
|
private _disableMessagesOnCreate;
|
|
22
|
+
private readonly _account;
|
|
23
|
+
private readonly _birthdayHeightOption?;
|
|
19
24
|
addressTypesToMonitor: EAddressType[];
|
|
20
25
|
coinSelectPreference: ECoinSelectPreference;
|
|
26
|
+
readonly isWatchOnly: boolean;
|
|
21
27
|
isRefreshing: boolean;
|
|
22
28
|
isSwitchingNetworks: boolean;
|
|
23
29
|
readonly id: string;
|
|
@@ -36,6 +42,7 @@ export declare class Wallet {
|
|
|
36
42
|
feeEstimates: IOnchainFees;
|
|
37
43
|
rbf: boolean;
|
|
38
44
|
selectedFeeId: EFeeId;
|
|
45
|
+
feeEstimationSource: TFeeEstimationSource;
|
|
39
46
|
disableMessages: boolean;
|
|
40
47
|
gapLimitOptions: TGapLimitOptions;
|
|
41
48
|
private constructor();
|
|
@@ -45,7 +52,28 @@ export declare class Wallet {
|
|
|
45
52
|
get utxos(): IUtxo[];
|
|
46
53
|
get balance(): number;
|
|
47
54
|
get network(): EAvailableNetworks;
|
|
55
|
+
get account(): number;
|
|
56
|
+
get birthdayHeight(): number;
|
|
57
|
+
get isMultisig(): boolean;
|
|
58
|
+
get multisigInfo(): {
|
|
59
|
+
threshold: number;
|
|
60
|
+
totalCosigners: number;
|
|
61
|
+
} | undefined;
|
|
48
62
|
static create(params: IWallet): Promise<Result<Wallet>>;
|
|
63
|
+
static createWatchOnly(params: IWatchOnlyWallet): Promise<Result<Wallet>>;
|
|
64
|
+
static createMultisig(params: IMultisigWallet): Promise<Result<Wallet>>;
|
|
65
|
+
private _initMultisig;
|
|
66
|
+
getMultisigPayment(path: string): Result<{
|
|
67
|
+
address: string;
|
|
68
|
+
output: Buffer;
|
|
69
|
+
witnessScript: Buffer;
|
|
70
|
+
publicKey: string;
|
|
71
|
+
derivations: {
|
|
72
|
+
masterFingerprint: Buffer;
|
|
73
|
+
path: string;
|
|
74
|
+
pubkey: Buffer;
|
|
75
|
+
}[];
|
|
76
|
+
}>;
|
|
49
77
|
stop(): Promise<Result<string>>;
|
|
50
78
|
updateCoinSelectPreference(coinSelectPreference: ECoinSelectPreference): void;
|
|
51
79
|
switchNetwork(network: EAvailableNetworks, servers?: TServer | TServer[]): Promise<Result<Wallet>>;
|
|
@@ -60,9 +88,14 @@ export declare class Wallet {
|
|
|
60
88
|
private setWalletData;
|
|
61
89
|
private storageIdCheck;
|
|
62
90
|
getWalletDataKey(key: keyof IWalletData): string;
|
|
91
|
+
private _applyBirthdayHeightOption;
|
|
63
92
|
getWalletData(): Promise<Result<IWalletData>>;
|
|
64
93
|
private getBitcoinNetwork;
|
|
65
94
|
isValid(mnemonic: any): boolean;
|
|
95
|
+
private _derivePathKeyPair;
|
|
96
|
+
private _deriveWatchOnlyNode;
|
|
97
|
+
derivePublicNode(path: string): Result<BIP32Interface>;
|
|
98
|
+
getMasterFingerprint(): Buffer;
|
|
66
99
|
private _getAddress;
|
|
67
100
|
getAddress({ index, changeAddress, addressType }?: IGetAddress): Promise<string>;
|
|
68
101
|
getAddressByPath({ path, addressType }: IGetAddressByPath): Promise<Result<IGetAddressResponse>>;
|
|
@@ -108,6 +141,22 @@ export declare class Wallet {
|
|
|
108
141
|
additionalAddresses?: string[];
|
|
109
142
|
}): Promise<Result<IGetUtxosResponse>>;
|
|
110
143
|
listUtxos(): IUtxo[];
|
|
144
|
+
isUtxoFrozen(txid: string, index: number): boolean;
|
|
145
|
+
freezeUtxo({ txid, index }: {
|
|
146
|
+
txid: string;
|
|
147
|
+
index: number;
|
|
148
|
+
}): Promise<Result<string>>;
|
|
149
|
+
unfreezeUtxo({ txid, index }: {
|
|
150
|
+
txid: string;
|
|
151
|
+
index: number;
|
|
152
|
+
}): Promise<Result<string>>;
|
|
153
|
+
listFrozenUtxos(): IUtxo[];
|
|
154
|
+
getBalanceBreakdown(): IBalanceBreakdown;
|
|
155
|
+
setAddressLabel(address: string, label: string): Promise<Result<string>>;
|
|
156
|
+
getAddressLabel(address: string): string | undefined;
|
|
157
|
+
listAddressLabels(): TAddressLabels;
|
|
158
|
+
exportDescriptors(): Result<IExportDescriptorsResponse>;
|
|
159
|
+
private _toStandardBase58;
|
|
111
160
|
private savingOperations;
|
|
112
161
|
saveWalletData<K extends keyof IWalletData>(key: TWalletDataKeys, data: IWalletData[K]): Promise<string>;
|
|
113
162
|
private updateAndSaveWalletData;
|
|
@@ -151,6 +200,8 @@ export declare class Wallet {
|
|
|
151
200
|
validateAddress(address: string): boolean;
|
|
152
201
|
getChangeAddress(addressType?: EAddressType): Promise<Result<IAddress>>;
|
|
153
202
|
getFeeEstimates(network?: EAvailableNetworks): Promise<IOnchainFees>;
|
|
203
|
+
getFeeEstimatesFromElectrum(): Promise<Result<IOnchainFees>>;
|
|
204
|
+
getFeeEstimatesFromHttp(network?: EAvailableNetworks): Promise<IOnchainFees>;
|
|
154
205
|
getFallbackFeeEstimates(network?: EAvailableNetworks): Promise<IOnchainFees>;
|
|
155
206
|
setupTransaction(params?: ISetupTransaction): Promise<TSetupTransactionResponse>;
|
|
156
207
|
getFeeInfo({ satsPerByte, message, transaction, fundingLightning, coinSelectPreference }?: {
|
|
@@ -182,6 +233,12 @@ export declare class Wallet {
|
|
|
182
233
|
broadcast?: boolean;
|
|
183
234
|
shuffleOutputs?: boolean;
|
|
184
235
|
}): Promise<Result<string>>;
|
|
236
|
+
buildPsbt({ txs, address, amount, message, satsPerByte, rbf, shuffleOutputs }: IBuildPsbtArgs): Promise<Result<IBuildPsbtResponse>>;
|
|
237
|
+
importSignedPsbt(psbtBase64: string): Result<IImportSignedPsbtResponse>;
|
|
238
|
+
private _enforceMultisigThreshold;
|
|
239
|
+
signPsbtWithOurKey(psbtBase64: string): Result<string>;
|
|
240
|
+
combinePsbts(psbts: string[]): Result<string>;
|
|
241
|
+
broadcastTransaction(txHex: string): Promise<Result<string>>;
|
|
185
242
|
getAddressFromScriptHash(scriptHash: string): IAddress | undefined;
|
|
186
243
|
private setZeroIndexAddresses;
|
|
187
244
|
private updateAddressIndex;
|
package/dist/types/wallet.js
CHANGED
|
@@ -10,6 +10,8 @@ var EAvailableNetworks;
|
|
|
10
10
|
EAvailableNetworks["bitcoinTestnet"] = "testnet";
|
|
11
11
|
EAvailableNetworks["regtest"] = "regtest";
|
|
12
12
|
EAvailableNetworks["bitcoinRegtest"] = "regtest";
|
|
13
|
+
EAvailableNetworks["signet"] = "signet";
|
|
14
|
+
EAvailableNetworks["bitcoinSignet"] = "signet";
|
|
13
15
|
})(EAvailableNetworks = exports.EAvailableNetworks || (exports.EAvailableNetworks = {}));
|
|
14
16
|
var EAddressType;
|
|
15
17
|
(function (EAddressType) {
|
|
@@ -17,6 +19,7 @@ var EAddressType;
|
|
|
17
19
|
EAddressType["p2sh"] = "p2sh";
|
|
18
20
|
EAddressType["p2pkh"] = "p2pkh";
|
|
19
21
|
EAddressType["p2tr"] = "p2tr";
|
|
22
|
+
EAddressType["p2wsh"] = "p2wsh";
|
|
20
23
|
})(EAddressType = exports.EAddressType || (exports.EAddressType = {}));
|
|
21
24
|
var EPaymentType;
|
|
22
25
|
(function (EPaymentType) {
|