essential-eth 0.13.0 → 1.1.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.d.ts CHANGED
@@ -1,8 +1,6 @@
1
- import { TinyBig } from './conversions.js';
2
- export { etherToGwei, etherToWei, gweiToEther, tinyBig, weiToEther } from './conversions.js';
3
- import Big from 'big.js';
4
- import { B as BytesLike } from './index-utils-D40THakY.js';
5
- export { a as Bytes, b as BytesLikeWithNumber, D as DataOptions, H as Hexable, S as Signature, c as SignatureLike, d as arrayify, e as computeAddress, f as computePublicKey, g as concat, h as hashMessage, i as hexConcat, j as hexDataLength, k as hexDataSlice, l as hexStripZeros, m as hexValue, n as hexZeroPad, o as hexlify, p as isAddress, q as isBytes, r as isBytesLike, s as isHexString, t as keccak256, u as pack, v as solidityKeccak256, w as splitSignature, x as stripZeros, y as toChecksumAddress, z as toUtf8Bytes, A as zeroPad } from './index-utils-D40THakY.js';
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';
6
4
 
7
5
  type Modify$1<T, R> = Omit<T, keyof R> & R;
8
6
  interface RPCTransaction extends RPCBlockTransaction {
@@ -12,24 +10,24 @@ interface RPCTransaction extends RPCBlockTransaction {
12
10
  type TransactionResponse = Modify$1<RPCTransaction, {
13
11
  blockNumber: number;
14
12
  chainId: number;
15
- gas: TinyBig;
16
- gasLimit: TinyBig;
17
- gasPrice: TinyBig;
18
- nonce: TinyBig;
13
+ gas: bigint;
14
+ gasLimit: bigint;
15
+ gasPrice: bigint;
16
+ nonce: bigint;
19
17
  transactionIndex: number;
20
18
  type: number;
21
19
  v: number;
22
- value: TinyBig;
20
+ value: bigint;
23
21
  } & {
24
- maxFeePerGas: TinyBig;
25
- maxPriorityFeePerGas: TinyBig;
22
+ maxFeePerGas: bigint;
23
+ maxPriorityFeePerGas: bigint;
26
24
  confirmations: number;
27
25
  }>;
28
26
  type TransactionReceipt = Modify$1<RPCTransactionReceipt, {
29
27
  blockNumber: number;
30
- cumulativeGasUsed: TinyBig;
31
- effectiveGasPrice: TinyBig;
32
- gasUsed: TinyBig;
28
+ cumulativeGasUsed: bigint;
29
+ effectiveGasPrice: bigint;
30
+ gasUsed: bigint;
33
31
  logs: Array<Log>;
34
32
  status: number;
35
33
  transactionIndex: number;
@@ -52,15 +50,15 @@ interface RPCTransactionRequest {
52
50
  interface TransactionRequest {
53
51
  to?: string;
54
52
  from?: string;
55
- nonce?: TinyBig | string | Big | number;
56
- gas?: TinyBig | number | Big | string;
57
- gasPrice?: TinyBig | Big | string | number;
53
+ nonce?: bigint | string | number;
54
+ gas?: bigint | number | string;
55
+ gasPrice?: bigint | string | number;
58
56
  data?: BytesLike;
59
- value?: TinyBig | string | Big | number;
57
+ value?: bigint | string | number;
60
58
  chainId?: number;
61
59
  type?: number;
62
- maxPriorityFeePerGas?: TinyBig | string | Big | number;
63
- maxFeePerGas?: TinyBig | string | Big | number;
60
+ maxPriorityFeePerGas?: bigint | string | number;
61
+ maxFeePerGas?: bigint | string | number;
64
62
  }
65
63
  type Log = Modify$1<RPCLog, {
66
64
  blockNumber: number;
@@ -116,15 +114,15 @@ interface RPCLog {
116
114
 
117
115
  type Modify<T, R> = Omit<T, keyof R> & R;
118
116
  type BlockResponse = Modify<RPCBlock, {
119
- baseFeePerGas: TinyBig;
120
- difficulty: TinyBig;
121
- gasLimit: TinyBig;
122
- gasUsed: TinyBig;
123
- nonce: TinyBig;
117
+ baseFeePerGas: bigint;
118
+ difficulty: bigint;
119
+ gasLimit: bigint;
120
+ gasUsed: bigint;
121
+ nonce: bigint;
124
122
  number: number;
125
- size: TinyBig;
126
- timestamp: TinyBig;
127
- totalDifficulty: TinyBig;
123
+ size: bigint;
124
+ timestamp: bigint;
125
+ totalDifficulty: bigint;
128
126
  transactions: Array<string | BlockTransactionResponse>;
129
127
  }>;
130
128
  interface RPCBlock {
@@ -153,10 +151,10 @@ interface RPCBlock {
153
151
  type BlockTag = 'latest' | 'earliest' | 'pending' | number | string;
154
152
 
155
153
  interface FeeData {
156
- gasPrice: TinyBig;
157
- lastBaseFeePerGas: TinyBig | null;
158
- maxFeePerGas: TinyBig | null;
159
- maxPriorityFeePerGas: TinyBig | null;
154
+ gasPrice: bigint;
155
+ lastBaseFeePerGas: bigint | null;
156
+ maxFeePerGas: bigint | null;
157
+ maxPriorityFeePerGas: bigint | null;
160
158
  }
161
159
 
162
160
  interface EventFilter {
@@ -189,13 +187,15 @@ declare abstract class BaseProvider {
189
187
  getTransactionReceipt(transactionHash: string): Promise<TransactionReceipt>;
190
188
  getTransactionCount(address: string, blockTag?: BlockTag): Promise<number>;
191
189
  getBlock(timeFrame?: BlockTag, returnTransactionObjects?: boolean): Promise<BlockResponse>;
192
- getGasPrice(): Promise<TinyBig>;
193
- getBalance(address: string, blockTag?: BlockTag): Promise<TinyBig>;
190
+ getGasPrice(): Promise<bigint>;
191
+ getBalance(address: string, blockTag?: BlockTag): Promise<bigint>;
194
192
  getCode(address: string, blockTag?: BlockTag): Promise<string>;
195
- estimateGas(transaction: TransactionRequest): Promise<TinyBig>;
193
+ estimateGas(transaction: TransactionRequest): Promise<bigint>;
196
194
  getFeeData(): Promise<FeeData>;
197
195
  getLogs(filter: Filter | FilterByBlockHash): Promise<Array<Log>>;
198
196
  call(transaction: TransactionRequest, blockTag?: BlockTag): Promise<string>;
197
+ resolveName(name: string): Promise<string | null>;
198
+ lookupAddress(address: string): Promise<string | null>;
199
199
  }
200
200
 
201
201
  declare class JsonRpcProvider extends BaseProvider {
@@ -205,7 +205,7 @@ declare class JsonRpcProvider extends BaseProvider {
205
205
  }
206
206
  declare function jsonRpcProvider(rpcUrl?: string): JsonRpcProvider;
207
207
 
208
- 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;
208
+ 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;
209
209
  type ContractInterface = JSONABI;
210
210
  interface JSONABIArgument {
211
211
  anonymous?: false;
@@ -253,4 +253,38 @@ declare class FallthroughProvider extends BaseProvider {
253
253
  post: (body: Record<string, unknown>) => Promise<any>;
254
254
  }
255
255
 
256
- export { AlchemyProvider, BaseContract, type BlockResponse, type BlockTag, type BlockTransactionResponse, BytesLike, type ConstructorOptions, Contract, type ContractTypes, FallthroughProvider, type Filter, type FilterByBlockHash, type JSONABI, type JSONABIArgument, JsonRpcProvider, type Log, type Network, type RPCBlock, type RPCLog, type RPCTransaction, type RPCTransactionReceipt, type RPCTransactionRequest, TinyBig, type TransactionReceipt, type TransactionRequest, type TransactionResponse, jsonRpcProvider };
256
+ type Hex = `0x${string}`;
257
+ type Address = Hex;
258
+ type Hash = Hex;
259
+ type LogTopic = Hex | Hex[] | null;
260
+
261
+ declare function encodeFunctionData(abi: JSONABI, functionName: string, args?: any[]): string;
262
+ declare function decodeFunctionResult(abi: JSONABI, functionName: string, data: string): any;
263
+
264
+ declare function encodeBytes32String(text: string): string;
265
+ declare function decodeBytes32String(bytes32: string): string;
266
+
267
+ declare function decodeEventLog(abi: JSONABI, log: {
268
+ topics: string[];
269
+ data: string;
270
+ }): {
271
+ eventName: string;
272
+ args: Record<string, any>;
273
+ };
274
+
275
+ declare function getEventTopic(eventSignature: string): string;
276
+ declare function getEventSignature(abi: JSONABI, eventName: string): string;
277
+
278
+ declare function formatUnits(value: string | number | bigint, decimals?: number): string;
279
+
280
+ declare function getAddress(address: string): string;
281
+
282
+ declare function id(text: string): string;
283
+
284
+ declare function namehash(name: string): string;
285
+
286
+ declare function parseUnits(value: string, decimals?: number): bigint;
287
+
288
+ declare function toUtf8String(bytes: BytesLike): string;
289
+
290
+ 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 };