-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
81 lines (81 loc) · 3.15 KB
/
index.d.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
/*! micro-eth-signer - MIT License (c) Paul Miller (paulmillr.com) */
export declare const CHAIN_TYPES: {
mainnet: number;
ropsten: number;
rinkeby: number;
goerli: number;
kovan: number;
};
export declare const TRANSACTION_TYPES: {
legacy: number;
eip2930: number;
eip1559: number;
};
export declare function add0x(hex: string): string;
export declare function strip0x(hex: string): string;
export declare function hexToBytes(hex: string): Uint8Array;
export declare function numberTo0xHex(num: number | bigint): string;
declare type Chain = keyof typeof CHAIN_TYPES;
declare type Type = keyof typeof TRANSACTION_TYPES;
declare const FIELDS: readonly ["nonce", "gasPrice", "gasLimit", "to", "value", "data", "v", "r", "s"];
declare const FIELDS2930: readonly ["chainId", "nonce", "gasPrice", "gasLimit", "to", "value", "data", "accessList", "yParity", "r", "s"];
declare const FIELDS1559: readonly ["chainId", "nonce", "maxPriorityFeePerGas", "maxFeePerGas", "gasLimit", "to", "value", "data", "accessList", "yParity", "r", "s"];
export declare type Field = typeof FIELDS[number] | typeof FIELDS2930[number] | typeof FIELDS1559[number] | 'address' | 'storageKey';
declare type str = string;
export declare type AccessList = [str, str[]][];
export declare type RawTxLegacy = [str, str, str, str, str, str, str, str, str];
export declare type RawTx2930 = [str, str, str, str, str, str, AccessList, str, str, str];
export declare type RawTx1559 = [str, str, str, str, str, str, str, AccessList, str, str, str];
export declare type RawTx = RawTxLegacy | RawTx2930 | RawTx1559;
export declare type RawTxMap = {
chainId?: string;
nonce: string;
gasPrice?: string;
maxPriorityFeePerGas?: string;
maxFeePerGas?: string;
gasLimit: string;
to: string;
value: string;
data: string;
accessList?: AccessList;
yParity?: string;
v?: string;
r: string;
s: string;
};
export declare const Address: {
fromPrivateKey(key: string | Uint8Array): string;
fromPublicKey(key: string | Uint8Array): string;
checksum(nonChecksummedAddress: string): string;
verifyChecksum(address: string): boolean;
};
export declare class Transaction {
readonly hardfork: string;
static DEFAULT_HARDFORK: string;
static DEFAULT_CHAIN: Chain;
static DEFAULT_TYPE: Type;
readonly hex: string;
readonly raw: RawTxMap;
readonly isSigned: boolean;
readonly type: Type;
constructor(data: string | Uint8Array | RawTx | RawTxMap, chain?: Chain, hardfork?: string, type?: Type);
get bytes(): Uint8Array;
equals(other: Transaction): boolean;
get chain(): Chain | undefined;
get sender(): string;
get gasPrice(): bigint;
get maxFeePerGas(): bigint;
get maxPriorityFeePerGas(): bigint;
get gasLimit(): bigint;
get amount(): bigint;
get fee(): bigint;
get upfrontCost(): bigint;
get to(): string;
get nonce(): number;
private supportsReplayProtection;
getMessageToSign(signed?: boolean): string;
get hash(): string;
sign(privateKey: string | Uint8Array, extraEntropy?: boolean): Promise<Transaction>;
recoverSenderPublicKey(): Uint8Array | undefined;
}
export {};