essential-eth 0.10.3 → 0.10.4-beta.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/dist/index.cjs +2024 -0
- package/dist/index.d.cts +330 -0
- package/dist/index.d.ts +330 -0
- package/dist/index.js +1952 -0
- package/package.json +13 -14
- package/dist/cjs/classes/Contract.d.ts +0 -81
- package/dist/cjs/classes/Contract.js +0 -139
- package/dist/cjs/classes/test/Contract/crv-abi.d.ts +0 -2
- package/dist/cjs/classes/test/Contract/crv-abi.js +0 -413
- package/dist/cjs/classes/test/Contract/ens-abi.d.ts +0 -2
- package/dist/cjs/classes/test/Contract/ens-abi.js +0 -453
- package/dist/cjs/classes/test/Contract/fei-abi.d.ts +0 -2
- package/dist/cjs/classes/test/Contract/fei-abi.js +0 -526
- package/dist/cjs/classes/test/Contract/foo-abi.d.ts +0 -2
- package/dist/cjs/classes/test/Contract/foo-abi.js +0 -42
- package/dist/cjs/classes/test/Contract/jokerrace-abi.d.ts +0 -2
- package/dist/cjs/classes/test/Contract/jokerrace-abi.js +0 -22
- package/dist/cjs/classes/test/Contract/uniswap-abi.d.ts +0 -2
- package/dist/cjs/classes/test/Contract/uniswap-abi.js +0 -121
- package/dist/cjs/classes/utils/clean-block.d.ts +0 -120
- package/dist/cjs/classes/utils/clean-block.js +0 -160
- package/dist/cjs/classes/utils/clean-log.d.ts +0 -9
- package/dist/cjs/classes/utils/clean-log.js +0 -39
- package/dist/cjs/classes/utils/clean-transaction-receipt.d.ts +0 -14
- package/dist/cjs/classes/utils/clean-transaction-receipt.js +0 -53
- package/dist/cjs/classes/utils/clean-transaction.d.ts +0 -14
- package/dist/cjs/classes/utils/clean-transaction.js +0 -54
- package/dist/cjs/classes/utils/encode-decode-transaction.d.ts +0 -16
- package/dist/cjs/classes/utils/encode-decode-transaction.js +0 -185
- package/dist/cjs/classes/utils/fetchers.d.ts +0 -53
- package/dist/cjs/classes/utils/fetchers.js +0 -85
- package/dist/cjs/classes/utils/hex-to-decimal.d.ts +0 -18
- package/dist/cjs/classes/utils/hex-to-decimal.js +0 -24
- package/dist/cjs/classes/utils/prepare-transaction.d.ts +0 -6
- package/dist/cjs/classes/utils/prepare-transaction.js +0 -47
- package/dist/cjs/index.d.ts +0 -24
- package/dist/cjs/index.js +0 -58
- package/dist/cjs/index.umd.js +0 -2
- package/dist/cjs/index.umd.js.map +0 -1
- package/dist/cjs/logger/logger.d.ts +0 -11
- package/dist/cjs/logger/logger.js +0 -37
- package/dist/cjs/logger/package-version.d.ts +0 -1
- package/dist/cjs/logger/package-version.js +0 -5
- package/dist/cjs/package.json +0 -1
- package/dist/cjs/providers/AlchemyProvider.d.ts +0 -4
- package/dist/cjs/providers/AlchemyProvider.js +0 -11
- package/dist/cjs/providers/BaseProvider.d.ts +0 -374
- package/dist/cjs/providers/BaseProvider.js +0 -514
- package/dist/cjs/providers/FallthroughProvider.d.ts +0 -24
- package/dist/cjs/providers/FallthroughProvider.js +0 -74
- package/dist/cjs/providers/JsonRpcProvider.d.ts +0 -33
- package/dist/cjs/providers/JsonRpcProvider.js +0 -46
- package/dist/cjs/providers/test/json-rpc-provider/get-logs/mocks.d.ts +0 -14
- package/dist/cjs/providers/test/json-rpc-provider/get-logs/mocks.js +0 -152
- package/dist/cjs/providers/test/mock-of.d.ts +0 -8
- package/dist/cjs/providers/test/mock-of.js +0 -12
- package/dist/cjs/providers/test/rpc-urls.d.ts +0 -12
- package/dist/cjs/providers/test/rpc-urls.js +0 -27
- package/dist/cjs/providers/utils/chains-info.d.ts +0 -24
- package/dist/cjs/providers/utils/chains-info.js +0 -71
- package/dist/cjs/shared/tiny-big/helpers.d.ts +0 -17
- package/dist/cjs/shared/tiny-big/helpers.js +0 -97
- package/dist/cjs/shared/tiny-big/tiny-big.d.ts +0 -58
- package/dist/cjs/shared/tiny-big/tiny-big.js +0 -101
- package/dist/cjs/shared/validate-type.d.ts +0 -3
- package/dist/cjs/shared/validate-type.js +0 -9
- package/dist/cjs/types/Block.types.d.ts +0 -41
- package/dist/cjs/types/Block.types.js +0 -2
- package/dist/cjs/types/Contract.types.d.ts +0 -24
- package/dist/cjs/types/Contract.types.js +0 -2
- package/dist/cjs/types/FeeData.types.d.ts +0 -7
- package/dist/cjs/types/FeeData.types.js +0 -2
- package/dist/cjs/types/Filter.types.d.ts +0 -16
- package/dist/cjs/types/Filter.types.js +0 -2
- package/dist/cjs/types/Network.types.d.ts +0 -8
- package/dist/cjs/types/Network.types.js +0 -2
- package/dist/cjs/types/Transaction.types.d.ts +0 -123
- package/dist/cjs/types/Transaction.types.js +0 -2
- package/dist/cjs/utils/bytes.d.ts +0 -289
- package/dist/cjs/utils/bytes.js +0 -711
- package/dist/cjs/utils/compute-address.d.ts +0 -17
- package/dist/cjs/utils/compute-address.js +0 -34
- package/dist/cjs/utils/compute-public-key.d.ts +0 -18
- package/dist/cjs/utils/compute-public-key.js +0 -26
- package/dist/cjs/utils/ether-to-gwei.d.ts +0 -27
- package/dist/cjs/utils/ether-to-gwei.js +0 -35
- package/dist/cjs/utils/ether-to-wei.d.ts +0 -27
- package/dist/cjs/utils/ether-to-wei.js +0 -35
- package/dist/cjs/utils/gwei-to-ether.d.ts +0 -27
- package/dist/cjs/utils/gwei-to-ether.js +0 -35
- package/dist/cjs/utils/hash-message.d.ts +0 -14
- package/dist/cjs/utils/hash-message.js +0 -30
- package/dist/cjs/utils/is-address.d.ts +0 -24
- package/dist/cjs/utils/is-address.js +0 -39
- package/dist/cjs/utils/keccak256.d.ts +0 -16
- package/dist/cjs/utils/keccak256.js +0 -31
- package/dist/cjs/utils/solidity-keccak256.d.ts +0 -39
- package/dist/cjs/utils/solidity-keccak256.js +0 -138
- package/dist/cjs/utils/split-signature.d.ts +0 -24
- package/dist/cjs/utils/split-signature.js +0 -163
- package/dist/cjs/utils/to-checksum-address.d.ts +0 -17
- package/dist/cjs/utils/to-checksum-address.js +0 -46
- package/dist/cjs/utils/to-utf8-bytes.d.ts +0 -15
- package/dist/cjs/utils/to-utf8-bytes.js +0 -21
- package/dist/cjs/utils/wei-to-ether.d.ts +0 -27
- package/dist/cjs/utils/wei-to-ether.js +0 -45
- package/dist/esm/classes/Contract.d.ts +0 -11
- package/dist/esm/classes/Contract.js +0 -58
- package/dist/esm/classes/test/Contract/crv-abi.d.ts +0 -2
- package/dist/esm/classes/test/Contract/crv-abi.js +0 -395
- package/dist/esm/classes/test/Contract/ens-abi.d.ts +0 -2
- package/dist/esm/classes/test/Contract/ens-abi.js +0 -435
- package/dist/esm/classes/test/Contract/fei-abi.d.ts +0 -2
- package/dist/esm/classes/test/Contract/fei-abi.js +0 -521
- package/dist/esm/classes/test/Contract/foo-abi.d.ts +0 -2
- package/dist/esm/classes/test/Contract/foo-abi.js +0 -33
- package/dist/esm/classes/test/Contract/jokerrace-abi.d.ts +0 -2
- package/dist/esm/classes/test/Contract/jokerrace-abi.js +0 -18
- package/dist/esm/classes/test/Contract/uniswap-abi.d.ts +0 -2
- package/dist/esm/classes/test/Contract/uniswap-abi.js +0 -116
- package/dist/esm/classes/utils/clean-block.d.ts +0 -2
- package/dist/esm/classes/utils/clean-block.js +0 -35
- package/dist/esm/classes/utils/clean-log.d.ts +0 -2
- package/dist/esm/classes/utils/clean-log.js +0 -28
- package/dist/esm/classes/utils/clean-transaction-receipt.d.ts +0 -2
- package/dist/esm/classes/utils/clean-transaction-receipt.js +0 -37
- package/dist/esm/classes/utils/clean-transaction.d.ts +0 -2
- package/dist/esm/classes/utils/clean-transaction.js +0 -36
- package/dist/esm/classes/utils/encode-decode-transaction.d.ts +0 -4
- package/dist/esm/classes/utils/encode-decode-transaction.js +0 -143
- package/dist/esm/classes/utils/fetchers.d.ts +0 -15
- package/dist/esm/classes/utils/fetchers.js +0 -37
- package/dist/esm/classes/utils/hex-to-decimal.d.ts +0 -1
- package/dist/esm/classes/utils/hex-to-decimal.js +0 -3
- package/dist/esm/classes/utils/prepare-transaction.d.ts +0 -2
- package/dist/esm/classes/utils/prepare-transaction.js +0 -36
- package/dist/esm/index.d.ts +0 -24
- package/dist/esm/index.js +0 -19
- package/dist/esm/logger/logger.d.ts +0 -11
- package/dist/esm/logger/logger.js +0 -34
- package/dist/esm/logger/package-version.d.ts +0 -1
- package/dist/esm/logger/package-version.js +0 -1
- package/dist/esm/providers/AlchemyProvider.d.ts +0 -4
- package/dist/esm/providers/AlchemyProvider.js +0 -7
- package/dist/esm/providers/BaseProvider.d.ts +0 -26
- package/dist/esm/providers/BaseProvider.js +0 -137
- package/dist/esm/providers/FallthroughProvider.d.ts +0 -11
- package/dist/esm/providers/FallthroughProvider.js +0 -50
- package/dist/esm/providers/JsonRpcProvider.d.ts +0 -7
- package/dist/esm/providers/JsonRpcProvider.js +0 -15
- package/dist/esm/providers/test/json-rpc-provider/get-logs/mocks.d.ts +0 -14
- package/dist/esm/providers/test/json-rpc-provider/get-logs/mocks.js +0 -142
- package/dist/esm/providers/test/mock-of.d.ts +0 -1
- package/dist/esm/providers/test/mock-of.js +0 -1
- package/dist/esm/providers/test/rpc-urls.d.ts +0 -12
- package/dist/esm/providers/test/rpc-urls.js +0 -21
- package/dist/esm/providers/utils/chains-info.d.ts +0 -24
- package/dist/esm/providers/utils/chains-info.js +0 -67
- package/dist/esm/shared/tiny-big/helpers.d.ts +0 -1
- package/dist/esm/shared/tiny-big/helpers.js +0 -58
- package/dist/esm/shared/tiny-big/tiny-big.d.ts +0 -10
- package/dist/esm/shared/tiny-big/tiny-big.js +0 -45
- package/dist/esm/shared/validate-type.d.ts +0 -3
- package/dist/esm/shared/validate-type.js +0 -5
- package/dist/esm/types/Block.types.d.ts +0 -40
- package/dist/esm/types/Block.types.js +0 -1
- package/dist/esm/types/Contract.types.d.ts +0 -24
- package/dist/esm/types/Contract.types.js +0 -1
- package/dist/esm/types/FeeData.types.d.ts +0 -7
- package/dist/esm/types/FeeData.types.js +0 -1
- package/dist/esm/types/Filter.types.d.ts +0 -12
- package/dist/esm/types/Filter.types.js +0 -1
- package/dist/esm/types/Network.types.d.ts +0 -5
- package/dist/esm/types/Network.types.js +0 -1
- package/dist/esm/types/Transaction.types.d.ts +0 -113
- package/dist/esm/types/Transaction.types.js +0 -1
- package/dist/esm/utils/bytes.d.ts +0 -40
- package/dist/esm/utils/bytes.js +0 -245
- package/dist/esm/utils/compute-address.d.ts +0 -1
- package/dist/esm/utils/compute-address.js +0 -12
- package/dist/esm/utils/compute-public-key.d.ts +0 -2
- package/dist/esm/utils/compute-public-key.js +0 -6
- package/dist/esm/utils/ether-to-gwei.d.ts +0 -3
- package/dist/esm/utils/ether-to-gwei.js +0 -7
- package/dist/esm/utils/ether-to-wei.d.ts +0 -3
- package/dist/esm/utils/ether-to-wei.js +0 -7
- package/dist/esm/utils/gwei-to-ether.d.ts +0 -3
- package/dist/esm/utils/gwei-to-ether.js +0 -7
- package/dist/esm/utils/hash-message.d.ts +0 -2
- package/dist/esm/utils/hash-message.js +0 -14
- package/dist/esm/utils/is-address.d.ts +0 -1
- package/dist/esm/utils/is-address.js +0 -12
- package/dist/esm/utils/keccak256.d.ts +0 -2
- package/dist/esm/utils/keccak256.js +0 -13
- package/dist/esm/utils/solidity-keccak256.d.ts +0 -2
- package/dist/esm/utils/solidity-keccak256.js +0 -85
- package/dist/esm/utils/split-signature.d.ts +0 -2
- package/dist/esm/utils/split-signature.js +0 -126
- package/dist/esm/utils/to-checksum-address.d.ts +0 -1
- package/dist/esm/utils/to-checksum-address.js +0 -25
- package/dist/esm/utils/to-utf8-bytes.d.ts +0 -1
- package/dist/esm/utils/to-utf8-bytes.js +0 -3
- package/dist/esm/utils/wei-to-ether.d.ts +0 -3
- package/dist/esm/utils/wei-to-ether.js +0 -16
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import Big from 'big.js';
|
|
2
|
+
|
|
3
|
+
declare class TinyBig extends Big {
|
|
4
|
+
constructor(value: string | number | TinyBig | Big);
|
|
5
|
+
toHexString(): string;
|
|
6
|
+
toNumber(): number;
|
|
7
|
+
toString(): string;
|
|
8
|
+
private padAndChop;
|
|
9
|
+
toTwos(bitCount: number): Big;
|
|
10
|
+
}
|
|
11
|
+
declare function tinyBig(value: string | number | TinyBig | Big): TinyBig;
|
|
12
|
+
|
|
13
|
+
type Bytes = ArrayLike<number>;
|
|
14
|
+
type BytesLike = Bytes | string;
|
|
15
|
+
type BytesLikeWithNumber = BytesLike | number;
|
|
16
|
+
interface DataOptions {
|
|
17
|
+
allowMissingPrefix?: boolean;
|
|
18
|
+
hexPad?: 'left' | 'right' | null;
|
|
19
|
+
}
|
|
20
|
+
interface Hexable {
|
|
21
|
+
toHexString(): string;
|
|
22
|
+
}
|
|
23
|
+
type SignatureLike = {
|
|
24
|
+
r: string;
|
|
25
|
+
s?: string;
|
|
26
|
+
_vs?: string;
|
|
27
|
+
recoveryParam?: number;
|
|
28
|
+
v?: number;
|
|
29
|
+
} | BytesLike;
|
|
30
|
+
interface Signature {
|
|
31
|
+
r: string;
|
|
32
|
+
s: string;
|
|
33
|
+
_vs: string;
|
|
34
|
+
recoveryParam: number;
|
|
35
|
+
v: number;
|
|
36
|
+
yParityAndS: string;
|
|
37
|
+
compact: string;
|
|
38
|
+
}
|
|
39
|
+
declare function isBytesLike(value: any): value is BytesLike;
|
|
40
|
+
declare function isBytes(value: any): value is Bytes;
|
|
41
|
+
declare function arrayify(value: BytesLike | Hexable | number, options?: DataOptions): Uint8Array;
|
|
42
|
+
declare function concat(arrayOfBytesLike: ReadonlyArray<BytesLikeWithNumber>): Uint8Array;
|
|
43
|
+
declare function stripZeros(value: BytesLike): Uint8Array;
|
|
44
|
+
declare function zeroPad(value: BytesLike, length: number): Uint8Array;
|
|
45
|
+
declare function isHexString(value: any, length?: number): boolean;
|
|
46
|
+
declare function hexlify(value: BytesLike | Hexable | number | bigint, options?: DataOptions): string;
|
|
47
|
+
declare function hexDataLength(data: BytesLike): number | null;
|
|
48
|
+
declare function hexDataSlice(data: BytesLikeWithNumber, offset: number, endOffset?: number): string;
|
|
49
|
+
declare function hexConcat(items: ReadonlyArray<BytesLike>): string;
|
|
50
|
+
declare function hexValue(value: BytesLike | Hexable | number | bigint): string;
|
|
51
|
+
declare function hexStripZeros(value: BytesLike): string;
|
|
52
|
+
declare function hexZeroPad(value: BytesLikeWithNumber, length: number): string;
|
|
53
|
+
|
|
54
|
+
type Modify$1<T, R> = Omit<T, keyof R> & R;
|
|
55
|
+
interface RPCTransaction extends RPCBlockTransaction {
|
|
56
|
+
maxFeePerGas: string;
|
|
57
|
+
maxPriorityFeePerGas: string;
|
|
58
|
+
}
|
|
59
|
+
type TransactionResponse = Modify$1<RPCTransaction, {
|
|
60
|
+
blockNumber: number;
|
|
61
|
+
chainId: number;
|
|
62
|
+
gas: TinyBig;
|
|
63
|
+
gasLimit: TinyBig;
|
|
64
|
+
gasPrice: TinyBig;
|
|
65
|
+
nonce: TinyBig;
|
|
66
|
+
transactionIndex: number;
|
|
67
|
+
type: number;
|
|
68
|
+
v: number;
|
|
69
|
+
value: TinyBig;
|
|
70
|
+
} & {
|
|
71
|
+
maxFeePerGas: TinyBig;
|
|
72
|
+
maxPriorityFeePerGas: TinyBig;
|
|
73
|
+
confirmations: number;
|
|
74
|
+
}>;
|
|
75
|
+
type TransactionReceipt = Modify$1<RPCTransactionReceipt, {
|
|
76
|
+
blockNumber: number;
|
|
77
|
+
cumulativeGasUsed: TinyBig;
|
|
78
|
+
effectiveGasPrice: TinyBig;
|
|
79
|
+
gasUsed: TinyBig;
|
|
80
|
+
logs: Array<Log>;
|
|
81
|
+
status: number;
|
|
82
|
+
transactionIndex: number;
|
|
83
|
+
type: number;
|
|
84
|
+
} & {
|
|
85
|
+
byzantium: boolean;
|
|
86
|
+
confirmations: number;
|
|
87
|
+
}>;
|
|
88
|
+
interface RPCTransactionRequest {
|
|
89
|
+
from?: string;
|
|
90
|
+
to: string;
|
|
91
|
+
gas?: string;
|
|
92
|
+
gasPrice?: string;
|
|
93
|
+
value?: string;
|
|
94
|
+
data?: BytesLike;
|
|
95
|
+
nonce?: string;
|
|
96
|
+
maxPriorityFeePerGas?: string;
|
|
97
|
+
maxFeePerGas?: string;
|
|
98
|
+
}
|
|
99
|
+
interface TransactionRequest {
|
|
100
|
+
to?: string;
|
|
101
|
+
from?: string;
|
|
102
|
+
nonce?: TinyBig | string | Big | number;
|
|
103
|
+
gas?: TinyBig | number | Big | string;
|
|
104
|
+
gasPrice?: TinyBig | Big | string | number;
|
|
105
|
+
data?: BytesLike;
|
|
106
|
+
value?: TinyBig | string | Big | number;
|
|
107
|
+
chainId?: number;
|
|
108
|
+
type?: number;
|
|
109
|
+
maxPriorityFeePerGas?: TinyBig | string | Big | number;
|
|
110
|
+
maxFeePerGas?: TinyBig | string | Big | number;
|
|
111
|
+
}
|
|
112
|
+
type Log = Modify$1<RPCLog, {
|
|
113
|
+
blockNumber: number;
|
|
114
|
+
logIndex: number;
|
|
115
|
+
transactionIndex: number;
|
|
116
|
+
}>;
|
|
117
|
+
type BlockTransactionResponse = Omit<TransactionResponse, 'maxFeePerGas' | 'maxPriorityFeePerGas'>;
|
|
118
|
+
interface RPCBlockTransaction {
|
|
119
|
+
blockHash: string;
|
|
120
|
+
blockNumber: string;
|
|
121
|
+
chainId: string;
|
|
122
|
+
from: string;
|
|
123
|
+
gas: string;
|
|
124
|
+
gasPrice: string;
|
|
125
|
+
hash: string;
|
|
126
|
+
input: string;
|
|
127
|
+
nonce: string;
|
|
128
|
+
r: string;
|
|
129
|
+
s: string;
|
|
130
|
+
to: string;
|
|
131
|
+
transactionIndex: string;
|
|
132
|
+
type: string;
|
|
133
|
+
v: string;
|
|
134
|
+
value: string;
|
|
135
|
+
}
|
|
136
|
+
interface RPCTransactionReceipt {
|
|
137
|
+
blockHash: string;
|
|
138
|
+
blockNumber: string;
|
|
139
|
+
contractAddress: string;
|
|
140
|
+
cumulativeGasUsed: string;
|
|
141
|
+
effectiveGasPrice: string;
|
|
142
|
+
from: string;
|
|
143
|
+
gasUsed: string;
|
|
144
|
+
logs: Array<RPCLog>;
|
|
145
|
+
logsBloom: string;
|
|
146
|
+
status: string;
|
|
147
|
+
to: string;
|
|
148
|
+
transactionHash: string;
|
|
149
|
+
transactionIndex: string;
|
|
150
|
+
type: string;
|
|
151
|
+
}
|
|
152
|
+
interface RPCLog {
|
|
153
|
+
address: string;
|
|
154
|
+
blockHash: string;
|
|
155
|
+
blockNumber: string;
|
|
156
|
+
data: string;
|
|
157
|
+
logIndex: string;
|
|
158
|
+
removed?: boolean;
|
|
159
|
+
topics: Array<string>;
|
|
160
|
+
transactionHash: string;
|
|
161
|
+
transactionIndex: string;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
type Modify<T, R> = Omit<T, keyof R> & R;
|
|
165
|
+
type BlockResponse = Modify<RPCBlock, {
|
|
166
|
+
baseFeePerGas: TinyBig;
|
|
167
|
+
difficulty: TinyBig;
|
|
168
|
+
gasLimit: TinyBig;
|
|
169
|
+
gasUsed: TinyBig;
|
|
170
|
+
nonce: TinyBig;
|
|
171
|
+
number: number;
|
|
172
|
+
size: TinyBig;
|
|
173
|
+
timestamp: TinyBig;
|
|
174
|
+
totalDifficulty: TinyBig;
|
|
175
|
+
transactions: Array<string | BlockTransactionResponse>;
|
|
176
|
+
}>;
|
|
177
|
+
interface RPCBlock {
|
|
178
|
+
baseFeePerGas: string;
|
|
179
|
+
difficulty: string;
|
|
180
|
+
extraData: string;
|
|
181
|
+
gasLimit: string;
|
|
182
|
+
gasUsed: string;
|
|
183
|
+
hash: string;
|
|
184
|
+
logsBloom: string;
|
|
185
|
+
miner: string;
|
|
186
|
+
mixHash: string;
|
|
187
|
+
nonce: string;
|
|
188
|
+
number: string;
|
|
189
|
+
parentHash: string;
|
|
190
|
+
receiptsRoot: string;
|
|
191
|
+
sha3Uncles: string;
|
|
192
|
+
size: string;
|
|
193
|
+
stateRoot: string;
|
|
194
|
+
timestamp: string;
|
|
195
|
+
totalDifficulty: string;
|
|
196
|
+
transactions: Array<string | RPCTransaction>;
|
|
197
|
+
transactionsRoot: string;
|
|
198
|
+
uncles: Array<string>;
|
|
199
|
+
}
|
|
200
|
+
type BlockTag = 'latest' | 'earliest' | 'pending' | number | string;
|
|
201
|
+
|
|
202
|
+
interface FeeData {
|
|
203
|
+
gasPrice: TinyBig;
|
|
204
|
+
lastBaseFeePerGas: TinyBig | null;
|
|
205
|
+
maxFeePerGas: TinyBig | null;
|
|
206
|
+
maxPriorityFeePerGas: TinyBig | null;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
interface EventFilter {
|
|
210
|
+
address?: string;
|
|
211
|
+
topics?: Array<string | Array<string> | null>;
|
|
212
|
+
}
|
|
213
|
+
interface Filter extends EventFilter {
|
|
214
|
+
fromBlock?: BlockTag;
|
|
215
|
+
toBlock?: BlockTag;
|
|
216
|
+
}
|
|
217
|
+
interface FilterByBlockHash extends EventFilter {
|
|
218
|
+
blockHash?: string;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
interface Network {
|
|
222
|
+
chainId: number;
|
|
223
|
+
ensAddress: string | null;
|
|
224
|
+
name: string;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
declare abstract class BaseProvider {
|
|
228
|
+
abstract selectRpcUrl(): string;
|
|
229
|
+
abstract post(body: Record<string, unknown>): Promise<any>;
|
|
230
|
+
readonly _rpcUrls: string[];
|
|
231
|
+
protected _post: (body: Record<string, unknown>) => Promise<any>;
|
|
232
|
+
constructor(rpcUrls: string[]);
|
|
233
|
+
getNetwork(): Promise<Network>;
|
|
234
|
+
getBlockNumber(): Promise<number>;
|
|
235
|
+
getTransaction(transactionHash: string): Promise<TransactionResponse>;
|
|
236
|
+
getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>;
|
|
237
|
+
getTransactionCount(address: string, blockTag?: BlockTag): Promise<number>;
|
|
238
|
+
getBlock(timeFrame?: BlockTag, returnTransactionObjects?: boolean): Promise<BlockResponse>;
|
|
239
|
+
getGasPrice(): Promise<TinyBig>;
|
|
240
|
+
getBalance(address: string, blockTag?: BlockTag): Promise<TinyBig>;
|
|
241
|
+
getCode(address: string, blockTag?: BlockTag): Promise<string>;
|
|
242
|
+
estimateGas(transaction: TransactionRequest): Promise<TinyBig>;
|
|
243
|
+
getFeeData(): Promise<FeeData>;
|
|
244
|
+
getLogs(filter: Filter | FilterByBlockHash): Promise<Array<Log>>;
|
|
245
|
+
call(transaction: TransactionRequest, blockTag?: BlockTag): Promise<string>;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
declare class JsonRpcProvider extends BaseProvider {
|
|
249
|
+
selectRpcUrl(): string;
|
|
250
|
+
post(body: Record<string, unknown>): Promise<any>;
|
|
251
|
+
constructor(rpcUrl?: string);
|
|
252
|
+
}
|
|
253
|
+
declare function jsonRpcProvider(rpcUrl?: string): JsonRpcProvider;
|
|
254
|
+
|
|
255
|
+
type ContractTypes = 'bool' | 'bytes1' | 'bytes2' | 'bytes3' | 'bytes4' | 'bytes5' | 'bytes6' | 'bytes7' | 'bytes8' | 'bytes9' | 'bytes10' | 'bytes11' | 'bytes12' | 'bytes13' | 'bytes14' | 'bytes15' | 'bytes16' | 'bytes17' | 'bytes18' | 'bytes19' | 'bytes20' | 'bytes21' | 'bytes22' | 'bytes23' | 'bytes24' | 'bytes25' | 'bytes26' | 'bytes27' | 'bytes28' | 'bytes29' | 'bytes30' | 'bytes31' | 'bytes32' | 'bytes32[]' | 'address' | 'address payable' | 'address[4]' | 'address[100]' | 'uint256' | 'uint256[100]' | 'uint8' | 'uint32' | string;
|
|
256
|
+
type ContractInterface = JSONABI;
|
|
257
|
+
interface JSONABIArgument {
|
|
258
|
+
anonymous?: false;
|
|
259
|
+
inputs: {
|
|
260
|
+
internalType?: ContractTypes | string;
|
|
261
|
+
name: string;
|
|
262
|
+
type: ContractTypes;
|
|
263
|
+
indexed?: boolean;
|
|
264
|
+
}[];
|
|
265
|
+
name?: string;
|
|
266
|
+
outputs?: {
|
|
267
|
+
internalType?: ContractTypes | string;
|
|
268
|
+
name: string;
|
|
269
|
+
type: ContractTypes;
|
|
270
|
+
}[];
|
|
271
|
+
stateMutability?: 'view' | 'nonpayable' | string;
|
|
272
|
+
type: 'function' | 'event' | 'constructor' | 'error' | 'fallback';
|
|
273
|
+
gas?: number;
|
|
274
|
+
constant?: boolean;
|
|
275
|
+
payable?: boolean;
|
|
276
|
+
}
|
|
277
|
+
type JSONABI = JSONABIArgument[];
|
|
278
|
+
|
|
279
|
+
declare class BaseContract {
|
|
280
|
+
private readonly _address;
|
|
281
|
+
private readonly _provider;
|
|
282
|
+
constructor(addressOrName: string, contractInterface: ContractInterface, signerOrProvider: JsonRpcProvider);
|
|
283
|
+
}
|
|
284
|
+
declare class Contract extends BaseContract {
|
|
285
|
+
readonly [key: string]: any;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
declare class AlchemyProvider extends JsonRpcProvider {
|
|
289
|
+
constructor(apiKey: string, network?: string);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
interface ConstructorOptions {
|
|
293
|
+
timeoutDuration?: number;
|
|
294
|
+
}
|
|
295
|
+
declare class FallthroughProvider extends BaseProvider {
|
|
296
|
+
private rpcUrlCounter;
|
|
297
|
+
private readonly timeoutDuration;
|
|
298
|
+
selectRpcUrl(): string;
|
|
299
|
+
constructor(rpcUrls: string[], options?: ConstructorOptions);
|
|
300
|
+
post: (body: Record<string, unknown>) => Promise<any>;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
declare function computeAddress(key: string): string;
|
|
304
|
+
|
|
305
|
+
declare function computePublicKey(privKey: BytesLike): string;
|
|
306
|
+
|
|
307
|
+
declare function etherToGwei(etherQuantity: string | number | TinyBig | Big): TinyBig;
|
|
308
|
+
|
|
309
|
+
declare function etherToWei(etherQuantity: string | number | TinyBig | Big): TinyBig;
|
|
310
|
+
|
|
311
|
+
declare function gweiToEther(gweiQuantity: string | number | TinyBig | Big): TinyBig;
|
|
312
|
+
|
|
313
|
+
declare function hashMessage(message: Bytes | string): string;
|
|
314
|
+
|
|
315
|
+
declare function isAddress(address: string): boolean;
|
|
316
|
+
|
|
317
|
+
declare function keccak256(data: BytesLike): string;
|
|
318
|
+
|
|
319
|
+
declare function pack(types: ReadonlyArray<string>, values: ReadonlyArray<any>): string;
|
|
320
|
+
declare function solidityKeccak256(types: ReadonlyArray<string>, values: ReadonlyArray<any>): string;
|
|
321
|
+
|
|
322
|
+
declare function splitSignature(signature: SignatureLike): Signature;
|
|
323
|
+
|
|
324
|
+
declare function toChecksumAddress(address: string): string;
|
|
325
|
+
|
|
326
|
+
declare function toUtf8Bytes(data: string): Uint8Array;
|
|
327
|
+
|
|
328
|
+
declare function weiToEther(weiQuantity: string | number | TinyBig | Big): TinyBig;
|
|
329
|
+
|
|
330
|
+
export { AlchemyProvider, BaseContract, type BlockResponse, type BlockTag, type BlockTransactionResponse, type Bytes, type BytesLike, type BytesLikeWithNumber, type ConstructorOptions, Contract, type ContractTypes, type DataOptions, FallthroughProvider, type Filter, type FilterByBlockHash, type Hexable, type JSONABI, type JSONABIArgument, JsonRpcProvider, type Log, type Network, type RPCBlock, type RPCLog, type RPCTransaction, type RPCTransactionReceipt, type RPCTransactionRequest, type Signature, type SignatureLike, TinyBig, type TransactionReceipt, type TransactionRequest, type TransactionResponse, arrayify, computeAddress, computePublicKey, concat, etherToGwei, etherToWei, gweiToEther, hashMessage, hexConcat, hexDataLength, hexDataSlice, hexStripZeros, hexValue, hexZeroPad, hexlify, isAddress, isBytes, isBytesLike, isHexString, jsonRpcProvider, keccak256, pack, solidityKeccak256, splitSignature, stripZeros, tinyBig, toChecksumAddress, toUtf8Bytes, weiToEther, zeroPad };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import Big from 'big.js';
|
|
2
|
+
|
|
3
|
+
declare class TinyBig extends Big {
|
|
4
|
+
constructor(value: string | number | TinyBig | Big);
|
|
5
|
+
toHexString(): string;
|
|
6
|
+
toNumber(): number;
|
|
7
|
+
toString(): string;
|
|
8
|
+
private padAndChop;
|
|
9
|
+
toTwos(bitCount: number): Big;
|
|
10
|
+
}
|
|
11
|
+
declare function tinyBig(value: string | number | TinyBig | Big): TinyBig;
|
|
12
|
+
|
|
13
|
+
type Bytes = ArrayLike<number>;
|
|
14
|
+
type BytesLike = Bytes | string;
|
|
15
|
+
type BytesLikeWithNumber = BytesLike | number;
|
|
16
|
+
interface DataOptions {
|
|
17
|
+
allowMissingPrefix?: boolean;
|
|
18
|
+
hexPad?: 'left' | 'right' | null;
|
|
19
|
+
}
|
|
20
|
+
interface Hexable {
|
|
21
|
+
toHexString(): string;
|
|
22
|
+
}
|
|
23
|
+
type SignatureLike = {
|
|
24
|
+
r: string;
|
|
25
|
+
s?: string;
|
|
26
|
+
_vs?: string;
|
|
27
|
+
recoveryParam?: number;
|
|
28
|
+
v?: number;
|
|
29
|
+
} | BytesLike;
|
|
30
|
+
interface Signature {
|
|
31
|
+
r: string;
|
|
32
|
+
s: string;
|
|
33
|
+
_vs: string;
|
|
34
|
+
recoveryParam: number;
|
|
35
|
+
v: number;
|
|
36
|
+
yParityAndS: string;
|
|
37
|
+
compact: string;
|
|
38
|
+
}
|
|
39
|
+
declare function isBytesLike(value: any): value is BytesLike;
|
|
40
|
+
declare function isBytes(value: any): value is Bytes;
|
|
41
|
+
declare function arrayify(value: BytesLike | Hexable | number, options?: DataOptions): Uint8Array;
|
|
42
|
+
declare function concat(arrayOfBytesLike: ReadonlyArray<BytesLikeWithNumber>): Uint8Array;
|
|
43
|
+
declare function stripZeros(value: BytesLike): Uint8Array;
|
|
44
|
+
declare function zeroPad(value: BytesLike, length: number): Uint8Array;
|
|
45
|
+
declare function isHexString(value: any, length?: number): boolean;
|
|
46
|
+
declare function hexlify(value: BytesLike | Hexable | number | bigint, options?: DataOptions): string;
|
|
47
|
+
declare function hexDataLength(data: BytesLike): number | null;
|
|
48
|
+
declare function hexDataSlice(data: BytesLikeWithNumber, offset: number, endOffset?: number): string;
|
|
49
|
+
declare function hexConcat(items: ReadonlyArray<BytesLike>): string;
|
|
50
|
+
declare function hexValue(value: BytesLike | Hexable | number | bigint): string;
|
|
51
|
+
declare function hexStripZeros(value: BytesLike): string;
|
|
52
|
+
declare function hexZeroPad(value: BytesLikeWithNumber, length: number): string;
|
|
53
|
+
|
|
54
|
+
type Modify$1<T, R> = Omit<T, keyof R> & R;
|
|
55
|
+
interface RPCTransaction extends RPCBlockTransaction {
|
|
56
|
+
maxFeePerGas: string;
|
|
57
|
+
maxPriorityFeePerGas: string;
|
|
58
|
+
}
|
|
59
|
+
type TransactionResponse = Modify$1<RPCTransaction, {
|
|
60
|
+
blockNumber: number;
|
|
61
|
+
chainId: number;
|
|
62
|
+
gas: TinyBig;
|
|
63
|
+
gasLimit: TinyBig;
|
|
64
|
+
gasPrice: TinyBig;
|
|
65
|
+
nonce: TinyBig;
|
|
66
|
+
transactionIndex: number;
|
|
67
|
+
type: number;
|
|
68
|
+
v: number;
|
|
69
|
+
value: TinyBig;
|
|
70
|
+
} & {
|
|
71
|
+
maxFeePerGas: TinyBig;
|
|
72
|
+
maxPriorityFeePerGas: TinyBig;
|
|
73
|
+
confirmations: number;
|
|
74
|
+
}>;
|
|
75
|
+
type TransactionReceipt = Modify$1<RPCTransactionReceipt, {
|
|
76
|
+
blockNumber: number;
|
|
77
|
+
cumulativeGasUsed: TinyBig;
|
|
78
|
+
effectiveGasPrice: TinyBig;
|
|
79
|
+
gasUsed: TinyBig;
|
|
80
|
+
logs: Array<Log>;
|
|
81
|
+
status: number;
|
|
82
|
+
transactionIndex: number;
|
|
83
|
+
type: number;
|
|
84
|
+
} & {
|
|
85
|
+
byzantium: boolean;
|
|
86
|
+
confirmations: number;
|
|
87
|
+
}>;
|
|
88
|
+
interface RPCTransactionRequest {
|
|
89
|
+
from?: string;
|
|
90
|
+
to: string;
|
|
91
|
+
gas?: string;
|
|
92
|
+
gasPrice?: string;
|
|
93
|
+
value?: string;
|
|
94
|
+
data?: BytesLike;
|
|
95
|
+
nonce?: string;
|
|
96
|
+
maxPriorityFeePerGas?: string;
|
|
97
|
+
maxFeePerGas?: string;
|
|
98
|
+
}
|
|
99
|
+
interface TransactionRequest {
|
|
100
|
+
to?: string;
|
|
101
|
+
from?: string;
|
|
102
|
+
nonce?: TinyBig | string | Big | number;
|
|
103
|
+
gas?: TinyBig | number | Big | string;
|
|
104
|
+
gasPrice?: TinyBig | Big | string | number;
|
|
105
|
+
data?: BytesLike;
|
|
106
|
+
value?: TinyBig | string | Big | number;
|
|
107
|
+
chainId?: number;
|
|
108
|
+
type?: number;
|
|
109
|
+
maxPriorityFeePerGas?: TinyBig | string | Big | number;
|
|
110
|
+
maxFeePerGas?: TinyBig | string | Big | number;
|
|
111
|
+
}
|
|
112
|
+
type Log = Modify$1<RPCLog, {
|
|
113
|
+
blockNumber: number;
|
|
114
|
+
logIndex: number;
|
|
115
|
+
transactionIndex: number;
|
|
116
|
+
}>;
|
|
117
|
+
type BlockTransactionResponse = Omit<TransactionResponse, 'maxFeePerGas' | 'maxPriorityFeePerGas'>;
|
|
118
|
+
interface RPCBlockTransaction {
|
|
119
|
+
blockHash: string;
|
|
120
|
+
blockNumber: string;
|
|
121
|
+
chainId: string;
|
|
122
|
+
from: string;
|
|
123
|
+
gas: string;
|
|
124
|
+
gasPrice: string;
|
|
125
|
+
hash: string;
|
|
126
|
+
input: string;
|
|
127
|
+
nonce: string;
|
|
128
|
+
r: string;
|
|
129
|
+
s: string;
|
|
130
|
+
to: string;
|
|
131
|
+
transactionIndex: string;
|
|
132
|
+
type: string;
|
|
133
|
+
v: string;
|
|
134
|
+
value: string;
|
|
135
|
+
}
|
|
136
|
+
interface RPCTransactionReceipt {
|
|
137
|
+
blockHash: string;
|
|
138
|
+
blockNumber: string;
|
|
139
|
+
contractAddress: string;
|
|
140
|
+
cumulativeGasUsed: string;
|
|
141
|
+
effectiveGasPrice: string;
|
|
142
|
+
from: string;
|
|
143
|
+
gasUsed: string;
|
|
144
|
+
logs: Array<RPCLog>;
|
|
145
|
+
logsBloom: string;
|
|
146
|
+
status: string;
|
|
147
|
+
to: string;
|
|
148
|
+
transactionHash: string;
|
|
149
|
+
transactionIndex: string;
|
|
150
|
+
type: string;
|
|
151
|
+
}
|
|
152
|
+
interface RPCLog {
|
|
153
|
+
address: string;
|
|
154
|
+
blockHash: string;
|
|
155
|
+
blockNumber: string;
|
|
156
|
+
data: string;
|
|
157
|
+
logIndex: string;
|
|
158
|
+
removed?: boolean;
|
|
159
|
+
topics: Array<string>;
|
|
160
|
+
transactionHash: string;
|
|
161
|
+
transactionIndex: string;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
type Modify<T, R> = Omit<T, keyof R> & R;
|
|
165
|
+
type BlockResponse = Modify<RPCBlock, {
|
|
166
|
+
baseFeePerGas: TinyBig;
|
|
167
|
+
difficulty: TinyBig;
|
|
168
|
+
gasLimit: TinyBig;
|
|
169
|
+
gasUsed: TinyBig;
|
|
170
|
+
nonce: TinyBig;
|
|
171
|
+
number: number;
|
|
172
|
+
size: TinyBig;
|
|
173
|
+
timestamp: TinyBig;
|
|
174
|
+
totalDifficulty: TinyBig;
|
|
175
|
+
transactions: Array<string | BlockTransactionResponse>;
|
|
176
|
+
}>;
|
|
177
|
+
interface RPCBlock {
|
|
178
|
+
baseFeePerGas: string;
|
|
179
|
+
difficulty: string;
|
|
180
|
+
extraData: string;
|
|
181
|
+
gasLimit: string;
|
|
182
|
+
gasUsed: string;
|
|
183
|
+
hash: string;
|
|
184
|
+
logsBloom: string;
|
|
185
|
+
miner: string;
|
|
186
|
+
mixHash: string;
|
|
187
|
+
nonce: string;
|
|
188
|
+
number: string;
|
|
189
|
+
parentHash: string;
|
|
190
|
+
receiptsRoot: string;
|
|
191
|
+
sha3Uncles: string;
|
|
192
|
+
size: string;
|
|
193
|
+
stateRoot: string;
|
|
194
|
+
timestamp: string;
|
|
195
|
+
totalDifficulty: string;
|
|
196
|
+
transactions: Array<string | RPCTransaction>;
|
|
197
|
+
transactionsRoot: string;
|
|
198
|
+
uncles: Array<string>;
|
|
199
|
+
}
|
|
200
|
+
type BlockTag = 'latest' | 'earliest' | 'pending' | number | string;
|
|
201
|
+
|
|
202
|
+
interface FeeData {
|
|
203
|
+
gasPrice: TinyBig;
|
|
204
|
+
lastBaseFeePerGas: TinyBig | null;
|
|
205
|
+
maxFeePerGas: TinyBig | null;
|
|
206
|
+
maxPriorityFeePerGas: TinyBig | null;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
interface EventFilter {
|
|
210
|
+
address?: string;
|
|
211
|
+
topics?: Array<string | Array<string> | null>;
|
|
212
|
+
}
|
|
213
|
+
interface Filter extends EventFilter {
|
|
214
|
+
fromBlock?: BlockTag;
|
|
215
|
+
toBlock?: BlockTag;
|
|
216
|
+
}
|
|
217
|
+
interface FilterByBlockHash extends EventFilter {
|
|
218
|
+
blockHash?: string;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
interface Network {
|
|
222
|
+
chainId: number;
|
|
223
|
+
ensAddress: string | null;
|
|
224
|
+
name: string;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
declare abstract class BaseProvider {
|
|
228
|
+
abstract selectRpcUrl(): string;
|
|
229
|
+
abstract post(body: Record<string, unknown>): Promise<any>;
|
|
230
|
+
readonly _rpcUrls: string[];
|
|
231
|
+
protected _post: (body: Record<string, unknown>) => Promise<any>;
|
|
232
|
+
constructor(rpcUrls: string[]);
|
|
233
|
+
getNetwork(): Promise<Network>;
|
|
234
|
+
getBlockNumber(): Promise<number>;
|
|
235
|
+
getTransaction(transactionHash: string): Promise<TransactionResponse>;
|
|
236
|
+
getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>;
|
|
237
|
+
getTransactionCount(address: string, blockTag?: BlockTag): Promise<number>;
|
|
238
|
+
getBlock(timeFrame?: BlockTag, returnTransactionObjects?: boolean): Promise<BlockResponse>;
|
|
239
|
+
getGasPrice(): Promise<TinyBig>;
|
|
240
|
+
getBalance(address: string, blockTag?: BlockTag): Promise<TinyBig>;
|
|
241
|
+
getCode(address: string, blockTag?: BlockTag): Promise<string>;
|
|
242
|
+
estimateGas(transaction: TransactionRequest): Promise<TinyBig>;
|
|
243
|
+
getFeeData(): Promise<FeeData>;
|
|
244
|
+
getLogs(filter: Filter | FilterByBlockHash): Promise<Array<Log>>;
|
|
245
|
+
call(transaction: TransactionRequest, blockTag?: BlockTag): Promise<string>;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
declare class JsonRpcProvider extends BaseProvider {
|
|
249
|
+
selectRpcUrl(): string;
|
|
250
|
+
post(body: Record<string, unknown>): Promise<any>;
|
|
251
|
+
constructor(rpcUrl?: string);
|
|
252
|
+
}
|
|
253
|
+
declare function jsonRpcProvider(rpcUrl?: string): JsonRpcProvider;
|
|
254
|
+
|
|
255
|
+
type ContractTypes = 'bool' | 'bytes1' | 'bytes2' | 'bytes3' | 'bytes4' | 'bytes5' | 'bytes6' | 'bytes7' | 'bytes8' | 'bytes9' | 'bytes10' | 'bytes11' | 'bytes12' | 'bytes13' | 'bytes14' | 'bytes15' | 'bytes16' | 'bytes17' | 'bytes18' | 'bytes19' | 'bytes20' | 'bytes21' | 'bytes22' | 'bytes23' | 'bytes24' | 'bytes25' | 'bytes26' | 'bytes27' | 'bytes28' | 'bytes29' | 'bytes30' | 'bytes31' | 'bytes32' | 'bytes32[]' | 'address' | 'address payable' | 'address[4]' | 'address[100]' | 'uint256' | 'uint256[100]' | 'uint8' | 'uint32' | string;
|
|
256
|
+
type ContractInterface = JSONABI;
|
|
257
|
+
interface JSONABIArgument {
|
|
258
|
+
anonymous?: false;
|
|
259
|
+
inputs: {
|
|
260
|
+
internalType?: ContractTypes | string;
|
|
261
|
+
name: string;
|
|
262
|
+
type: ContractTypes;
|
|
263
|
+
indexed?: boolean;
|
|
264
|
+
}[];
|
|
265
|
+
name?: string;
|
|
266
|
+
outputs?: {
|
|
267
|
+
internalType?: ContractTypes | string;
|
|
268
|
+
name: string;
|
|
269
|
+
type: ContractTypes;
|
|
270
|
+
}[];
|
|
271
|
+
stateMutability?: 'view' | 'nonpayable' | string;
|
|
272
|
+
type: 'function' | 'event' | 'constructor' | 'error' | 'fallback';
|
|
273
|
+
gas?: number;
|
|
274
|
+
constant?: boolean;
|
|
275
|
+
payable?: boolean;
|
|
276
|
+
}
|
|
277
|
+
type JSONABI = JSONABIArgument[];
|
|
278
|
+
|
|
279
|
+
declare class BaseContract {
|
|
280
|
+
private readonly _address;
|
|
281
|
+
private readonly _provider;
|
|
282
|
+
constructor(addressOrName: string, contractInterface: ContractInterface, signerOrProvider: JsonRpcProvider);
|
|
283
|
+
}
|
|
284
|
+
declare class Contract extends BaseContract {
|
|
285
|
+
readonly [key: string]: any;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
declare class AlchemyProvider extends JsonRpcProvider {
|
|
289
|
+
constructor(apiKey: string, network?: string);
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
interface ConstructorOptions {
|
|
293
|
+
timeoutDuration?: number;
|
|
294
|
+
}
|
|
295
|
+
declare class FallthroughProvider extends BaseProvider {
|
|
296
|
+
private rpcUrlCounter;
|
|
297
|
+
private readonly timeoutDuration;
|
|
298
|
+
selectRpcUrl(): string;
|
|
299
|
+
constructor(rpcUrls: string[], options?: ConstructorOptions);
|
|
300
|
+
post: (body: Record<string, unknown>) => Promise<any>;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
declare function computeAddress(key: string): string;
|
|
304
|
+
|
|
305
|
+
declare function computePublicKey(privKey: BytesLike): string;
|
|
306
|
+
|
|
307
|
+
declare function etherToGwei(etherQuantity: string | number | TinyBig | Big): TinyBig;
|
|
308
|
+
|
|
309
|
+
declare function etherToWei(etherQuantity: string | number | TinyBig | Big): TinyBig;
|
|
310
|
+
|
|
311
|
+
declare function gweiToEther(gweiQuantity: string | number | TinyBig | Big): TinyBig;
|
|
312
|
+
|
|
313
|
+
declare function hashMessage(message: Bytes | string): string;
|
|
314
|
+
|
|
315
|
+
declare function isAddress(address: string): boolean;
|
|
316
|
+
|
|
317
|
+
declare function keccak256(data: BytesLike): string;
|
|
318
|
+
|
|
319
|
+
declare function pack(types: ReadonlyArray<string>, values: ReadonlyArray<any>): string;
|
|
320
|
+
declare function solidityKeccak256(types: ReadonlyArray<string>, values: ReadonlyArray<any>): string;
|
|
321
|
+
|
|
322
|
+
declare function splitSignature(signature: SignatureLike): Signature;
|
|
323
|
+
|
|
324
|
+
declare function toChecksumAddress(address: string): string;
|
|
325
|
+
|
|
326
|
+
declare function toUtf8Bytes(data: string): Uint8Array;
|
|
327
|
+
|
|
328
|
+
declare function weiToEther(weiQuantity: string | number | TinyBig | Big): TinyBig;
|
|
329
|
+
|
|
330
|
+
export { AlchemyProvider, BaseContract, type BlockResponse, type BlockTag, type BlockTransactionResponse, type Bytes, type BytesLike, type BytesLikeWithNumber, type ConstructorOptions, Contract, type ContractTypes, type DataOptions, FallthroughProvider, type Filter, type FilterByBlockHash, type Hexable, type JSONABI, type JSONABIArgument, JsonRpcProvider, type Log, type Network, type RPCBlock, type RPCLog, type RPCTransaction, type RPCTransactionReceipt, type RPCTransactionRequest, type Signature, type SignatureLike, TinyBig, type TransactionReceipt, type TransactionRequest, type TransactionResponse, arrayify, computeAddress, computePublicKey, concat, etherToGwei, etherToWei, gweiToEther, hashMessage, hexConcat, hexDataLength, hexDataSlice, hexStripZeros, hexValue, hexZeroPad, hexlify, isAddress, isBytes, isBytesLike, isHexString, jsonRpcProvider, keccak256, pack, solidityKeccak256, splitSignature, stripZeros, tinyBig, toChecksumAddress, toUtf8Bytes, weiToEther, zeroPad };
|