essential-eth 0.11.2 → 1.0.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/chunk-CLIQ4S3P.js +780 -0
- package/dist/chunk-GFWRB7PT.js +96 -0
- package/dist/conversions.d.ts +9 -0
- package/dist/conversions.js +1 -0
- package/dist/index-utils-e8a8adc8.d.ts +63 -0
- package/dist/index.cjs +419 -286
- package/dist/index.d.ts +60 -101
- package/dist/index.js +239 -1046
- package/dist/utils.d.ts +2 -0
- package/dist/utils.js +2 -0
- package/package.json +14 -7
- package/readme.md +750 -449
- package/dist/index.d.cts +0 -330
package/dist/index.d.ts
CHANGED
|
@@ -1,55 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
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;
|
|
1
|
+
import { B as BytesLike } from './index-utils-e8a8adc8.js';
|
|
2
|
+
export { b as Bytes, c as BytesLikeWithNumber, D as DataOptions, H as Hexable, S as Signature, o as SignatureLike, a as arrayify, p as computeAddress, q as computePublicKey, d as concat, r as hashMessage, h as hexConcat, e as hexDataLength, f as hexDataSlice, i as hexStripZeros, j as hexValue, k as hexZeroPad, g as hexlify, t as isAddress, l as isBytes, m as isBytesLike, n as isHexString, u as keccak256, v as pack, w as solidityKeccak256, x as splitSignature, s as stripZeros, y as toChecksumAddress, A as toUtf8Bytes, z as zeroPad } from './index-utils-e8a8adc8.js';
|
|
3
|
+
export { etherToGwei, etherToWei, gweiToEther, weiToEther } from './conversions.js';
|
|
53
4
|
|
|
54
5
|
type Modify$1<T, R> = Omit<T, keyof R> & R;
|
|
55
6
|
interface RPCTransaction extends RPCBlockTransaction {
|
|
@@ -59,24 +10,24 @@ interface RPCTransaction extends RPCBlockTransaction {
|
|
|
59
10
|
type TransactionResponse = Modify$1<RPCTransaction, {
|
|
60
11
|
blockNumber: number;
|
|
61
12
|
chainId: number;
|
|
62
|
-
gas:
|
|
63
|
-
gasLimit:
|
|
64
|
-
gasPrice:
|
|
65
|
-
nonce:
|
|
13
|
+
gas: bigint;
|
|
14
|
+
gasLimit: bigint;
|
|
15
|
+
gasPrice: bigint;
|
|
16
|
+
nonce: bigint;
|
|
66
17
|
transactionIndex: number;
|
|
67
18
|
type: number;
|
|
68
19
|
v: number;
|
|
69
|
-
value:
|
|
20
|
+
value: bigint;
|
|
70
21
|
} & {
|
|
71
|
-
maxFeePerGas:
|
|
72
|
-
maxPriorityFeePerGas:
|
|
22
|
+
maxFeePerGas: bigint;
|
|
23
|
+
maxPriorityFeePerGas: bigint;
|
|
73
24
|
confirmations: number;
|
|
74
25
|
}>;
|
|
75
26
|
type TransactionReceipt = Modify$1<RPCTransactionReceipt, {
|
|
76
27
|
blockNumber: number;
|
|
77
|
-
cumulativeGasUsed:
|
|
78
|
-
effectiveGasPrice:
|
|
79
|
-
gasUsed:
|
|
28
|
+
cumulativeGasUsed: bigint;
|
|
29
|
+
effectiveGasPrice: bigint;
|
|
30
|
+
gasUsed: bigint;
|
|
80
31
|
logs: Array<Log>;
|
|
81
32
|
status: number;
|
|
82
33
|
transactionIndex: number;
|
|
@@ -99,15 +50,15 @@ interface RPCTransactionRequest {
|
|
|
99
50
|
interface TransactionRequest {
|
|
100
51
|
to?: string;
|
|
101
52
|
from?: string;
|
|
102
|
-
nonce?:
|
|
103
|
-
gas?:
|
|
104
|
-
gasPrice?:
|
|
53
|
+
nonce?: bigint | string | number;
|
|
54
|
+
gas?: bigint | number | string;
|
|
55
|
+
gasPrice?: bigint | string | number;
|
|
105
56
|
data?: BytesLike;
|
|
106
|
-
value?:
|
|
57
|
+
value?: bigint | string | number;
|
|
107
58
|
chainId?: number;
|
|
108
59
|
type?: number;
|
|
109
|
-
maxPriorityFeePerGas?:
|
|
110
|
-
maxFeePerGas?:
|
|
60
|
+
maxPriorityFeePerGas?: bigint | string | number;
|
|
61
|
+
maxFeePerGas?: bigint | string | number;
|
|
111
62
|
}
|
|
112
63
|
type Log = Modify$1<RPCLog, {
|
|
113
64
|
blockNumber: number;
|
|
@@ -163,15 +114,15 @@ interface RPCLog {
|
|
|
163
114
|
|
|
164
115
|
type Modify<T, R> = Omit<T, keyof R> & R;
|
|
165
116
|
type BlockResponse = Modify<RPCBlock, {
|
|
166
|
-
baseFeePerGas:
|
|
167
|
-
difficulty:
|
|
168
|
-
gasLimit:
|
|
169
|
-
gasUsed:
|
|
170
|
-
nonce:
|
|
117
|
+
baseFeePerGas: bigint;
|
|
118
|
+
difficulty: bigint;
|
|
119
|
+
gasLimit: bigint;
|
|
120
|
+
gasUsed: bigint;
|
|
121
|
+
nonce: bigint;
|
|
171
122
|
number: number;
|
|
172
|
-
size:
|
|
173
|
-
timestamp:
|
|
174
|
-
totalDifficulty:
|
|
123
|
+
size: bigint;
|
|
124
|
+
timestamp: bigint;
|
|
125
|
+
totalDifficulty: bigint;
|
|
175
126
|
transactions: Array<string | BlockTransactionResponse>;
|
|
176
127
|
}>;
|
|
177
128
|
interface RPCBlock {
|
|
@@ -200,10 +151,10 @@ interface RPCBlock {
|
|
|
200
151
|
type BlockTag = 'latest' | 'earliest' | 'pending' | number | string;
|
|
201
152
|
|
|
202
153
|
interface FeeData {
|
|
203
|
-
gasPrice:
|
|
204
|
-
lastBaseFeePerGas:
|
|
205
|
-
maxFeePerGas:
|
|
206
|
-
maxPriorityFeePerGas:
|
|
154
|
+
gasPrice: bigint;
|
|
155
|
+
lastBaseFeePerGas: bigint | null;
|
|
156
|
+
maxFeePerGas: bigint | null;
|
|
157
|
+
maxPriorityFeePerGas: bigint | null;
|
|
207
158
|
}
|
|
208
159
|
|
|
209
160
|
interface EventFilter {
|
|
@@ -236,13 +187,14 @@ declare abstract class BaseProvider {
|
|
|
236
187
|
getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>;
|
|
237
188
|
getTransactionCount(address: string, blockTag?: BlockTag): Promise<number>;
|
|
238
189
|
getBlock(timeFrame?: BlockTag, returnTransactionObjects?: boolean): Promise<BlockResponse>;
|
|
239
|
-
getGasPrice(): Promise<
|
|
240
|
-
getBalance(address: string, blockTag?: BlockTag): Promise<
|
|
190
|
+
getGasPrice(): Promise<bigint>;
|
|
191
|
+
getBalance(address: string, blockTag?: BlockTag): Promise<bigint>;
|
|
241
192
|
getCode(address: string, blockTag?: BlockTag): Promise<string>;
|
|
242
|
-
estimateGas(transaction: TransactionRequest): Promise<
|
|
193
|
+
estimateGas(transaction: TransactionRequest): Promise<bigint>;
|
|
243
194
|
getFeeData(): Promise<FeeData>;
|
|
244
195
|
getLogs(filter: Filter | FilterByBlockHash): Promise<Array<Log>>;
|
|
245
196
|
call(transaction: TransactionRequest, blockTag?: BlockTag): Promise<string>;
|
|
197
|
+
resolveName(name: string): Promise<string | null>;
|
|
246
198
|
}
|
|
247
199
|
|
|
248
200
|
declare class JsonRpcProvider extends BaseProvider {
|
|
@@ -252,7 +204,7 @@ declare class JsonRpcProvider extends BaseProvider {
|
|
|
252
204
|
}
|
|
253
205
|
declare function jsonRpcProvider(rpcUrl?: string): JsonRpcProvider;
|
|
254
206
|
|
|
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]' | '
|
|
207
|
+
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]' | 'uint8' | 'uint16' | 'uint24' | 'uint32' | 'uint40' | 'uint48' | 'uint56' | 'uint64' | 'uint72' | 'uint80' | 'uint88' | 'uint96' | 'uint104' | 'uint112' | 'uint120' | 'uint128' | 'uint136' | 'uint144' | 'uint152' | 'uint160' | 'uint168' | 'uint176' | 'uint184' | 'uint192' | 'uint200' | 'uint208' | 'uint216' | 'uint224' | 'uint232' | 'uint240' | 'uint248' | 'uint256' | 'uint256[100]' | 'int8' | 'int16' | 'int24' | 'int32' | 'int40' | 'int48' | 'int56' | 'int64' | 'int72' | 'int80' | 'int88' | 'int96' | 'int104' | 'int112' | 'int120' | 'int128' | 'int136' | 'int144' | 'int152' | 'int160' | 'int168' | 'int176' | 'int184' | 'int192' | 'int200' | 'int208' | 'int216' | 'int224' | 'int232' | 'int240' | 'int248' | 'int256' | string;
|
|
256
208
|
type ContractInterface = JSONABI;
|
|
257
209
|
interface JSONABIArgument {
|
|
258
210
|
anonymous?: false;
|
|
@@ -300,31 +252,38 @@ declare class FallthroughProvider extends BaseProvider {
|
|
|
300
252
|
post: (body: Record<string, unknown>) => Promise<any>;
|
|
301
253
|
}
|
|
302
254
|
|
|
303
|
-
|
|
255
|
+
type Hex = `0x${string}`;
|
|
256
|
+
type Address = Hex;
|
|
257
|
+
type Hash = Hex;
|
|
258
|
+
type LogTopic = Hex | Hex[] | null;
|
|
304
259
|
|
|
305
|
-
declare function
|
|
260
|
+
declare function encodeFunctionData(abi: JSONABI, functionName: string, args?: any[]): string;
|
|
261
|
+
declare function decodeFunctionResult(abi: JSONABI, functionName: string, data: string): any;
|
|
306
262
|
|
|
307
|
-
declare function
|
|
263
|
+
declare function encodeBytes32String(text: string): string;
|
|
264
|
+
declare function decodeBytes32String(bytes32: string): string;
|
|
308
265
|
|
|
309
|
-
declare function
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
266
|
+
declare function decodeEventLog(abi: JSONABI, log: {
|
|
267
|
+
topics: string[];
|
|
268
|
+
data: string;
|
|
269
|
+
}): {
|
|
270
|
+
eventName: string;
|
|
271
|
+
args: Record<string, any>;
|
|
272
|
+
};
|
|
314
273
|
|
|
315
|
-
declare function
|
|
274
|
+
declare function getEventTopic(eventSignature: string): string;
|
|
275
|
+
declare function getEventSignature(abi: JSONABI, eventName: string): string;
|
|
316
276
|
|
|
317
|
-
declare function
|
|
277
|
+
declare function formatUnits(value: string | number | bigint, decimals?: number): string;
|
|
318
278
|
|
|
319
|
-
declare function
|
|
320
|
-
declare function solidityKeccak256(types: ReadonlyArray<string>, values: ReadonlyArray<any>): string;
|
|
279
|
+
declare function getAddress(address: string): string;
|
|
321
280
|
|
|
322
|
-
declare function
|
|
281
|
+
declare function id(text: string): string;
|
|
323
282
|
|
|
324
|
-
declare function
|
|
283
|
+
declare function namehash(name: string): string;
|
|
325
284
|
|
|
326
|
-
declare function
|
|
285
|
+
declare function parseUnits(value: string, decimals?: number): bigint;
|
|
327
286
|
|
|
328
|
-
declare function
|
|
287
|
+
declare function toUtf8String(bytes: BytesLike): string;
|
|
329
288
|
|
|
330
|
-
export { AlchemyProvider, BaseContract,
|
|
289
|
+
export { Address, AlchemyProvider, BaseContract, BlockResponse, BlockTag, BlockTransactionResponse, BytesLike, ConstructorOptions, Contract, ContractTypes, FallthroughProvider, Filter, FilterByBlockHash, Hash, Hex, JSONABI, JSONABIArgument, JsonRpcProvider, Log, LogTopic, Network, RPCBlock, RPCLog, RPCTransaction, RPCTransactionReceipt, RPCTransactionRequest, TransactionReceipt, TransactionRequest, TransactionResponse, decodeBytes32String, decodeEventLog, decodeFunctionResult, encodeBytes32String, encodeFunctionData, formatUnits, getAddress, getEventSignature, getEventTopic, id, jsonRpcProvider, namehash, parseUnits, toUtf8String };
|