-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtypes.ts
57 lines (48 loc) · 2.03 KB
/
types.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
import { DogeNetworkId } from "../networks/types";
import { Transaction } from "../transaction";
interface ISignatureResult {
publicKey: string;
signature: string;
}
interface IDogeSignatureRequest {
transaction: Transaction;
sigHashType: number;
inputIndex: number;
}
interface IDogeTransactionSigner {
getCompressedPublicKey(): Promise<string>;
canSignHash(): boolean;
signHash(hashHex: string, signSha256?: boolean): Promise<ISignatureResult>;
signTransaction(signatureRequest: IDogeSignatureRequest): Promise<ISignatureResult>;
getPrivateKeyWIF?(): Promise<string>;
}
type TWalletAbility = "add-wallet-random" | "add-wallet-bip39" | "add-wallet-bip44" | "add-wallet-bip178" | "sign-transaction" | "sign-hash-sha256" | "sign-hash-raw" | "export-private-key-wif";
interface IDogeWalletProvider {
getSigners(): Promise<IDogeTransactionSigner[]>;
addWalletRandom?(networkId: DogeNetworkId): Promise<IDogeTransactionSigner>;
addWalletBIP39?(networkId: DogeNetworkId, seedPhrase: string, password?: string): Promise<IDogeTransactionSigner>;
addWalletBIP44?(networkId: DogeNetworkId, fullDerivationPath: string): Promise<IDogeTransactionSigner>;
addWalletBIP178?(networkId: DogeNetworkId, wif: string): Promise<IDogeTransactionSigner>;
getAbilities(): TWalletAbility[];
}
interface IFullDogeWalletProvider<T extends IDogeWalletProvider> extends IDogeWalletProvider {
getCompressedPublicKeys(useCache?: boolean): Promise<string[]>;
getSignerForPublicKey(compressedPublicKeyHex: string, useCache?: boolean): Promise<IDogeTransactionSigner>;
getP2PKHAddresses(networkId: string, useCache?: boolean): Promise<{ address: string; publicKey: string }[]>;
getSignerForAddress(address: string, useCache?: boolean): Promise<IDogeTransactionSigner>;
getBaseProvider(): T;
}
interface IDogeWalletSerialized {
wif: string;
networkId: string;
name: string;
}
export type {
ISignatureResult,
IDogeTransactionSigner,
IDogeWalletProvider,
IDogeWalletSerialized,
IFullDogeWalletProvider,
IDogeSignatureRequest,
TWalletAbility,
}