-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathinterfaces.ts
93 lines (70 loc) · 2.1 KB
/
interfaces.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import * as bitcoin from 'bitcoinjs-lib';
import { Network } from 'bitcoinjs-lib';
import {
BIP32Interface,
TinySecp256k1Interface as TinySecp256k1InterfaceBIP32,
} from 'bip32';
export type NetworkCoin = {
network: Network;
coin: string;
};
export interface PublicKeyOutpoint {
pubKey: Buffer;
outpoint: Buffer;
privKey?: Buffer;
}
export interface TinySecp256k1Interface extends TinySecp256k1InterfaceBIP32 {
privateAdd(d: Uint8Array, tweak: Uint8Array): Uint8Array | null;
pointMultiply(
p: Uint8Array,
tweak: Uint8Array,
compressed?: boolean,
): Uint8Array | null;
pointAdd(
pA: Uint8Array,
pB: Uint8Array,
compressed?: boolean,
): Uint8Array | null;
}
export interface BIP47Interface {
network: NetworkCoin;
RootPaymentCodeNode: BIP32Interface;
getPaymentWallet(
bobsRootPaymentCodeNode: BIP32Interface,
index: number,
): BIP32Interface;
getReceiveWallet(
bobsRootPaymentCodeNode: BIP32Interface,
index: number,
): BIP32Interface;
getPaymentCodeNode(): BIP32Interface;
getPaymentAddress(
bobsRootPaymentCodeNode: BIP32Interface,
index: number,
): string;
getSerializedPaymentCode(): string;
getBinaryPaymentCode(): Buffer;
getNotificationNode(): BIP32Interface;
getNotificationNodeFromPaymentCode(paymentCode: string): BIP32Interface;
getNotificationAddressFromPaymentCode(paymentCode: string): string;
getNotificationAddress(): string;
getAddressFromNode(node: BIP32Interface, network: NetworkCoin): string;
getBlindedPaymentCode(
bobBIP47: BIP47Interface,
privateKey: string | Buffer,
outpoint: string | Buffer,
): string;
getFirstExposedPubKeyAndOutpoint(tx: bitcoin.Transaction): PublicKeyOutpoint;
getPaymentCodeFromRawNotificationTransaction(
rawHexNotificationData: string,
): string;
}
export interface BIP47API {
fromSeedHex(seedHex: string | Buffer, network?: NetworkCoin): BIP47Interface;
fromBip39Seed(
bip39Seed: string,
network?: NetworkCoin,
password?: string,
): BIP47Interface;
fromPaymentCode(paymentCode: string, network?: NetworkCoin): BIP47Interface;
}