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/{chunk-C4VOKUKQ.js → chunk-4V2QY6OK.js} +42 -18
- package/dist/chunk-GFWRB7PT.js +96 -0
- package/dist/conversions.d.ts +5 -17
- package/dist/conversions.js +1 -1
- package/dist/{index-utils-D40THakY.d.ts → index-utils-e8a8adc8.d.ts} +2 -2
- package/dist/index.cjs +486 -282
- package/dist/index.d.ts +72 -38
- package/dist/index.js +343 -66
- package/dist/utils.d.ts +1 -2
- package/dist/utils.js +2 -2
- package/package.json +5 -6
- package/readme.md +739 -456
- package/dist/chunk-UXC5R4JE.js +0 -210
package/dist/index.cjs
CHANGED
|
@@ -28,20 +28,28 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
29
|
|
|
30
30
|
// src/index.ts
|
|
31
|
-
var
|
|
32
|
-
__export(
|
|
31
|
+
var src_exports = {};
|
|
32
|
+
__export(src_exports, {
|
|
33
33
|
AlchemyProvider: () => AlchemyProvider,
|
|
34
34
|
BaseContract: () => BaseContract,
|
|
35
35
|
Contract: () => Contract,
|
|
36
36
|
FallthroughProvider: () => FallthroughProvider,
|
|
37
37
|
JsonRpcProvider: () => JsonRpcProvider,
|
|
38
|
-
TinyBig: () => TinyBig,
|
|
39
38
|
arrayify: () => arrayify,
|
|
40
39
|
computeAddress: () => computeAddress,
|
|
41
40
|
computePublicKey: () => computePublicKey,
|
|
42
41
|
concat: () => concat,
|
|
42
|
+
decodeBytes32String: () => decodeBytes32String,
|
|
43
|
+
decodeEventLog: () => decodeEventLog,
|
|
44
|
+
decodeFunctionResult: () => decodeFunctionResult,
|
|
45
|
+
encodeBytes32String: () => encodeBytes32String,
|
|
46
|
+
encodeFunctionData: () => encodeFunctionData,
|
|
43
47
|
etherToGwei: () => etherToGwei,
|
|
44
48
|
etherToWei: () => etherToWei,
|
|
49
|
+
formatUnits: () => formatUnits,
|
|
50
|
+
getAddress: () => getAddress,
|
|
51
|
+
getEventSignature: () => getEventSignature,
|
|
52
|
+
getEventTopic: () => getEventTopic,
|
|
45
53
|
gweiToEther: () => gweiToEther,
|
|
46
54
|
hashMessage: () => hashMessage,
|
|
47
55
|
hexConcat: () => hexConcat,
|
|
@@ -51,191 +59,31 @@ __export(index_exports, {
|
|
|
51
59
|
hexValue: () => hexValue,
|
|
52
60
|
hexZeroPad: () => hexZeroPad,
|
|
53
61
|
hexlify: () => hexlify,
|
|
62
|
+
id: () => id,
|
|
54
63
|
isAddress: () => isAddress,
|
|
55
64
|
isBytes: () => isBytes,
|
|
56
65
|
isBytesLike: () => isBytesLike,
|
|
57
66
|
isHexString: () => isHexString,
|
|
58
67
|
jsonRpcProvider: () => jsonRpcProvider,
|
|
59
68
|
keccak256: () => keccak256,
|
|
69
|
+
namehash: () => namehash,
|
|
60
70
|
pack: () => pack,
|
|
71
|
+
parseUnits: () => parseUnits,
|
|
61
72
|
solidityKeccak256: () => solidityKeccak256,
|
|
62
73
|
splitSignature: () => splitSignature,
|
|
63
74
|
stripZeros: () => stripZeros,
|
|
64
|
-
tinyBig: () => tinyBig,
|
|
65
75
|
toChecksumAddress: () => toChecksumAddress,
|
|
66
76
|
toUtf8Bytes: () => toUtf8Bytes,
|
|
77
|
+
toUtf8String: () => toUtf8String,
|
|
67
78
|
weiToEther: () => weiToEther,
|
|
68
79
|
zeroPad: () => zeroPad
|
|
69
80
|
});
|
|
70
|
-
module.exports = __toCommonJS(
|
|
81
|
+
module.exports = __toCommonJS(src_exports);
|
|
71
82
|
|
|
72
83
|
// src/classes/utils/encode-decode-transaction.ts
|
|
73
84
|
var import_sha32 = require("@noble/hashes/sha3.js");
|
|
74
85
|
var import_utils2 = require("@noble/hashes/utils.js");
|
|
75
86
|
|
|
76
|
-
// src/shared/tiny-big/tiny-big.ts
|
|
77
|
-
var import_big = __toESM(require("big.js"), 1);
|
|
78
|
-
|
|
79
|
-
// src/classes/utils/hex-to-decimal.ts
|
|
80
|
-
function hexToDecimal(hex) {
|
|
81
|
-
return BigInt(hex).toString();
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// src/shared/tiny-big/helpers.ts
|
|
85
|
-
function stripTrailingZeroes(numberString) {
|
|
86
|
-
const isNegative = numberString.startsWith("-");
|
|
87
|
-
numberString = numberString.replace("-", "");
|
|
88
|
-
numberString = numberString.replace(
|
|
89
|
-
/\.0*$/g,
|
|
90
|
-
""
|
|
91
|
-
);
|
|
92
|
-
numberString = numberString.replace(/^0+/, "");
|
|
93
|
-
if (numberString.includes(".")) {
|
|
94
|
-
numberString = numberString.replace(/0+$/, "");
|
|
95
|
-
}
|
|
96
|
-
if (numberString.startsWith(".")) {
|
|
97
|
-
numberString = `0${numberString}`;
|
|
98
|
-
}
|
|
99
|
-
return `${isNegative ? "-" : ""}${numberString}`;
|
|
100
|
-
}
|
|
101
|
-
function scientificStrToDecimalStr(scientificString) {
|
|
102
|
-
if (!scientificString.match(
|
|
103
|
-
/e/i
|
|
104
|
-
/* lowercase and uppercase E */
|
|
105
|
-
)) {
|
|
106
|
-
return stripTrailingZeroes(scientificString);
|
|
107
|
-
}
|
|
108
|
-
let [base, power] = scientificString.split(
|
|
109
|
-
/e/i
|
|
110
|
-
);
|
|
111
|
-
const isNegative = Number(base) < 0;
|
|
112
|
-
base = base.replace("-", "");
|
|
113
|
-
base = stripTrailingZeroes(base);
|
|
114
|
-
const [wholeNumber, fraction = ""] = base.split(".");
|
|
115
|
-
if (Number(power) === 0) {
|
|
116
|
-
return `${isNegative ? "-" : ""}${stripTrailingZeroes(base)}`;
|
|
117
|
-
} else {
|
|
118
|
-
const includesDecimal = base.includes(".");
|
|
119
|
-
if (!includesDecimal) {
|
|
120
|
-
base = `${base}.`;
|
|
121
|
-
}
|
|
122
|
-
base = base.replace(".", "");
|
|
123
|
-
const baseLength = base.length;
|
|
124
|
-
let splitPaddedNumber;
|
|
125
|
-
if (Number(power) < 0) {
|
|
126
|
-
if (wholeNumber.length < Math.abs(Number(power))) {
|
|
127
|
-
base = base.padStart(
|
|
128
|
-
baseLength + Math.abs(Number(power)) - wholeNumber.length,
|
|
129
|
-
"0"
|
|
130
|
-
);
|
|
131
|
-
}
|
|
132
|
-
splitPaddedNumber = base.split("");
|
|
133
|
-
if (wholeNumber.length < Math.abs(Number(power))) {
|
|
134
|
-
splitPaddedNumber = [".", ...splitPaddedNumber];
|
|
135
|
-
} else {
|
|
136
|
-
splitPaddedNumber.splice(
|
|
137
|
-
splitPaddedNumber.length - Math.abs(Number(power)),
|
|
138
|
-
0,
|
|
139
|
-
"."
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
} else {
|
|
143
|
-
if (fraction.length < Math.abs(Number(power))) {
|
|
144
|
-
base = base.padEnd(
|
|
145
|
-
baseLength + Math.abs(Number(power)) - fraction.length,
|
|
146
|
-
"0"
|
|
147
|
-
);
|
|
148
|
-
}
|
|
149
|
-
splitPaddedNumber = base.split("");
|
|
150
|
-
if (fraction.length > Math.abs(Number(power))) {
|
|
151
|
-
splitPaddedNumber.splice(
|
|
152
|
-
splitPaddedNumber.length - Math.abs(Number(power)),
|
|
153
|
-
0,
|
|
154
|
-
"."
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
const toReturn = stripTrailingZeroes(splitPaddedNumber.join(""));
|
|
159
|
-
return `${isNegative ? "-" : ""}${toReturn}`;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// src/shared/tiny-big/tiny-big.ts
|
|
164
|
-
var TinyBig = class extends import_big.default {
|
|
165
|
-
constructor(value) {
|
|
166
|
-
if (typeof value === "string" && value.startsWith("0x")) {
|
|
167
|
-
value = hexToDecimal(value);
|
|
168
|
-
}
|
|
169
|
-
super(value);
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Used anytime you're passing in "value" to ethers or web3
|
|
173
|
-
* For now, TypeScript will complain that `TinyBig` is not a `BigNumberish`. You can // @ts-ignore or call this
|
|
174
|
-
*
|
|
175
|
-
* @returns the TinyBig represented as a hex string
|
|
176
|
-
* @example
|
|
177
|
-
* ```javascript
|
|
178
|
-
* tinyBig(293).toHexString();
|
|
179
|
-
* // '0x125'
|
|
180
|
-
* ```
|
|
181
|
-
* @example
|
|
182
|
-
* ```javascript
|
|
183
|
-
* tinyBig(681365874).toHexString();
|
|
184
|
-
* // '0x289cd172'
|
|
185
|
-
*/
|
|
186
|
-
toHexString() {
|
|
187
|
-
return `0x${BigInt(this.toString()).toString(16)}`;
|
|
188
|
-
}
|
|
189
|
-
toNumber() {
|
|
190
|
-
return Number(scientificStrToDecimalStr(super.toString()));
|
|
191
|
-
}
|
|
192
|
-
toString() {
|
|
193
|
-
if (this.toNumber() === 0) {
|
|
194
|
-
return "0";
|
|
195
|
-
}
|
|
196
|
-
return scientificStrToDecimalStr(super.toString());
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* Eithers pads or shortens a string to a specified length
|
|
200
|
-
*
|
|
201
|
-
* @param str the string to pad or chop
|
|
202
|
-
* @param padChar the character to pad the string with
|
|
203
|
-
* @param length the desired length of the given string
|
|
204
|
-
* @returns a string of the desired length, either padded with the specified padChar or with the beginning of the string chopped off
|
|
205
|
-
* @example
|
|
206
|
-
* ```javascript
|
|
207
|
-
* padAndChop('essential-eth', 'a', 8);
|
|
208
|
-
* // 'tial-eth'
|
|
209
|
-
* ```
|
|
210
|
-
* @example
|
|
211
|
-
* ```javascript
|
|
212
|
-
* padAndChop('essential-eth', 'A', 20);
|
|
213
|
-
* // 'AAAAAAAessential-eth'
|
|
214
|
-
* ```
|
|
215
|
-
*/
|
|
216
|
-
padAndChop = (str, padChar, length) => {
|
|
217
|
-
return (Array(length).fill(padChar).join("") + str).slice(length * -1);
|
|
218
|
-
};
|
|
219
|
-
toTwos(bitCount) {
|
|
220
|
-
let binaryStr;
|
|
221
|
-
if (this.gte(0)) {
|
|
222
|
-
const twosComp = this.toNumber().toString(2);
|
|
223
|
-
binaryStr = this.padAndChop(twosComp, "0", bitCount || twosComp.length);
|
|
224
|
-
} else {
|
|
225
|
-
binaryStr = this.plus(Math.pow(2, bitCount)).toNumber().toString(2);
|
|
226
|
-
if (Number(binaryStr) < 0) {
|
|
227
|
-
throw new Error("Cannot calculate twos complement");
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
const binary = `0b${binaryStr}`;
|
|
231
|
-
const decimal = Number(binary);
|
|
232
|
-
return tinyBig(decimal);
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
function tinyBig(value) {
|
|
236
|
-
return new TinyBig(value);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
87
|
// src/utils/to-checksum-address.ts
|
|
240
88
|
var import_sha3 = require("@noble/hashes/sha3.js");
|
|
241
89
|
var import_utils = require("@noble/hashes/utils.js");
|
|
@@ -272,6 +120,11 @@ function toChecksumAddress(address) {
|
|
|
272
120
|
return checksumAddress;
|
|
273
121
|
}
|
|
274
122
|
|
|
123
|
+
// src/classes/utils/hex-to-decimal.ts
|
|
124
|
+
function hexToDecimal(hex) {
|
|
125
|
+
return BigInt(hex).toString();
|
|
126
|
+
}
|
|
127
|
+
|
|
275
128
|
// src/classes/utils/encode-decode-transaction.ts
|
|
276
129
|
var hexFalse = "0".repeat(64);
|
|
277
130
|
var hexTrue = "0".repeat(63) + "1";
|
|
@@ -284,7 +137,8 @@ function hexToUtf8(hex) {
|
|
|
284
137
|
}
|
|
285
138
|
for (; i < l; i += 2) {
|
|
286
139
|
const code = parseInt(hex.substr(i, 2), 16);
|
|
287
|
-
if (code === 0)
|
|
140
|
+
if (code === 0)
|
|
141
|
+
continue;
|
|
288
142
|
str += String.fromCharCode(code);
|
|
289
143
|
}
|
|
290
144
|
try {
|
|
@@ -398,7 +252,7 @@ function decodeRPCResponse(jsonABIArgument, nodeResponse) {
|
|
|
398
252
|
if (rawOutputs?.length === 1 && rawOutputs[0].type === "uint256[]") {
|
|
399
253
|
const outputs2 = encodedOutputs.slice(2);
|
|
400
254
|
return outputs2.map((output) => {
|
|
401
|
-
return
|
|
255
|
+
return BigInt(hexToDecimal(`0x${output}`));
|
|
402
256
|
});
|
|
403
257
|
}
|
|
404
258
|
const outputs = encodedOutputs.map((output, i) => {
|
|
@@ -408,14 +262,17 @@ function decodeRPCResponse(jsonABIArgument, nodeResponse) {
|
|
|
408
262
|
return output === hexTrue;
|
|
409
263
|
case "address":
|
|
410
264
|
return toChecksumAddress(`0x${output.slice(24)}`);
|
|
411
|
-
case "uint256":
|
|
412
|
-
case "uint120":
|
|
413
|
-
return tinyBig(hexToDecimal(`0x${output}`));
|
|
414
265
|
case "bytes32":
|
|
415
266
|
return `0x${output}`;
|
|
416
267
|
case "uint8":
|
|
417
268
|
return Number(hexToDecimal(`0x${output}`));
|
|
418
269
|
default:
|
|
270
|
+
if (outputType.startsWith("uint")) {
|
|
271
|
+
return BigInt(hexToDecimal(`0x${output}`));
|
|
272
|
+
}
|
|
273
|
+
if (outputType.startsWith("int")) {
|
|
274
|
+
return BigInt(hexToDecimal(`0x${output}`));
|
|
275
|
+
}
|
|
419
276
|
throw new Error(
|
|
420
277
|
`essential-eth does not yet support "${outputType}" outputs. Make a PR today!"`
|
|
421
278
|
);
|
|
@@ -497,7 +354,8 @@ function cleanTransaction(transaction) {
|
|
|
497
354
|
...transaction
|
|
498
355
|
};
|
|
499
356
|
Object.keys(transaction).forEach((key) => {
|
|
500
|
-
if (!transaction[key])
|
|
357
|
+
if (!transaction[key])
|
|
358
|
+
return;
|
|
501
359
|
switch (key) {
|
|
502
360
|
case "blockNumber":
|
|
503
361
|
case "chainId":
|
|
@@ -518,7 +376,7 @@ function cleanTransaction(transaction) {
|
|
|
518
376
|
case "maxFeePerGas":
|
|
519
377
|
case "maxPriorityFeePerGas":
|
|
520
378
|
case "nonce":
|
|
521
|
-
cleanedTransaction[key] =
|
|
379
|
+
cleanedTransaction[key] = BigInt(hexToDecimal(transaction[key]));
|
|
522
380
|
break;
|
|
523
381
|
}
|
|
524
382
|
});
|
|
@@ -529,7 +387,8 @@ function cleanTransaction(transaction) {
|
|
|
529
387
|
function cleanBlock(block, returnTransactionObjects) {
|
|
530
388
|
const cleanedBlock = { ...block };
|
|
531
389
|
Object.keys(block).forEach((key) => {
|
|
532
|
-
if (!block[key])
|
|
390
|
+
if (!block[key])
|
|
391
|
+
return;
|
|
533
392
|
switch (key) {
|
|
534
393
|
case "difficulty":
|
|
535
394
|
case "totalDifficulty":
|
|
@@ -538,7 +397,7 @@ function cleanBlock(block, returnTransactionObjects) {
|
|
|
538
397
|
case "size":
|
|
539
398
|
case "timestamp":
|
|
540
399
|
case "baseFeePerGas":
|
|
541
|
-
cleanedBlock[key] =
|
|
400
|
+
cleanedBlock[key] = BigInt(hexToDecimal(block[key]));
|
|
542
401
|
break;
|
|
543
402
|
case "number":
|
|
544
403
|
cleanedBlock[key] = Number(hexToDecimal(block[key]));
|
|
@@ -591,7 +450,8 @@ function cleanTransactionReceipt(transactionReceipt) {
|
|
|
591
450
|
...cleanedTransaction
|
|
592
451
|
};
|
|
593
452
|
Object.keys(transactionReceipt).forEach((key) => {
|
|
594
|
-
if (!transactionReceipt[key])
|
|
453
|
+
if (!transactionReceipt[key])
|
|
454
|
+
return;
|
|
595
455
|
switch (key) {
|
|
596
456
|
case "status":
|
|
597
457
|
cleanedTransactionReceipt[key] = Number(
|
|
@@ -608,7 +468,7 @@ function cleanTransactionReceipt(transactionReceipt) {
|
|
|
608
468
|
case "cumulativeGasUsed":
|
|
609
469
|
case "effectiveGasPrice":
|
|
610
470
|
case "gasUsed":
|
|
611
|
-
cleanedTransactionReceipt[key] =
|
|
471
|
+
cleanedTransactionReceipt[key] = BigInt(
|
|
612
472
|
hexToDecimal(transactionReceipt[key])
|
|
613
473
|
);
|
|
614
474
|
break;
|
|
@@ -661,11 +521,8 @@ function buildRPCPostBody(method, params) {
|
|
|
661
521
|
};
|
|
662
522
|
}
|
|
663
523
|
|
|
664
|
-
// src/classes/utils/prepare-transaction.ts
|
|
665
|
-
var import_big2 = __toESM(require("big.js"), 1);
|
|
666
|
-
|
|
667
524
|
// src/logger/package-version.ts
|
|
668
|
-
var version = "
|
|
525
|
+
var version = "1.1.0";
|
|
669
526
|
|
|
670
527
|
// src/logger/logger.ts
|
|
671
528
|
var Logger = class {
|
|
@@ -755,6 +612,15 @@ function arrayify(value, options) {
|
|
|
755
612
|
}
|
|
756
613
|
return new Uint8Array(result);
|
|
757
614
|
}
|
|
615
|
+
if (typeof value === "bigint") {
|
|
616
|
+
const hex = value.toString(16).padStart(2, "0");
|
|
617
|
+
const padded = hex.length % 2 ? "0" + hex : hex;
|
|
618
|
+
const result = new Uint8Array(padded.length / 2);
|
|
619
|
+
for (let i = 0; i < result.length; i++) {
|
|
620
|
+
result[i] = parseInt(padded.substring(i * 2, i * 2 + 2), 16);
|
|
621
|
+
}
|
|
622
|
+
return result;
|
|
623
|
+
}
|
|
758
624
|
if (options.allowMissingPrefix && typeof value === "string" && value.substring(0, 2) !== "0x") {
|
|
759
625
|
value = "0x" + value;
|
|
760
626
|
}
|
|
@@ -958,15 +824,13 @@ function prepareTransaction(transaction) {
|
|
|
958
824
|
case "maxPriorityFeePerGas":
|
|
959
825
|
case "value": {
|
|
960
826
|
const value = transaction[key];
|
|
961
|
-
if (value
|
|
962
|
-
preparedTransaction[key] = value.
|
|
963
|
-
} else if (value
|
|
964
|
-
preparedTransaction[key] =
|
|
965
|
-
|
|
966
|
-
)
|
|
967
|
-
}
|
|
968
|
-
preparedTransaction[key] = "0x" + transaction[key].toString(16);
|
|
969
|
-
else preparedTransaction[key] = transaction[key].toString();
|
|
827
|
+
if (typeof value === "bigint") {
|
|
828
|
+
preparedTransaction[key] = "0x" + value.toString(16);
|
|
829
|
+
} else if (typeof value === "number") {
|
|
830
|
+
preparedTransaction[key] = "0x" + value.toString(16);
|
|
831
|
+
} else {
|
|
832
|
+
preparedTransaction[key] = value.toString();
|
|
833
|
+
}
|
|
970
834
|
break;
|
|
971
835
|
}
|
|
972
836
|
case "data":
|
|
@@ -978,6 +842,42 @@ function prepareTransaction(transaction) {
|
|
|
978
842
|
return preparedTransaction;
|
|
979
843
|
}
|
|
980
844
|
|
|
845
|
+
// src/utils/keccak256.ts
|
|
846
|
+
var import_sha33 = require("@noble/hashes/sha3.js");
|
|
847
|
+
var import_utils3 = require("@noble/hashes/utils.js");
|
|
848
|
+
function keccak256(data) {
|
|
849
|
+
let bytes;
|
|
850
|
+
if (typeof data === "string") {
|
|
851
|
+
const hex = data.replace(/^0x/, "");
|
|
852
|
+
bytes = new Uint8Array(hex.length / 2);
|
|
853
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
854
|
+
bytes[i] = parseInt(hex.substr(i * 2, 2), 16);
|
|
855
|
+
}
|
|
856
|
+
} else {
|
|
857
|
+
bytes = new Uint8Array(data);
|
|
858
|
+
}
|
|
859
|
+
return "0x" + (0, import_utils3.bytesToHex)((0, import_sha33.keccak_256)(bytes));
|
|
860
|
+
}
|
|
861
|
+
|
|
862
|
+
// src/utils/to-utf8-bytes.ts
|
|
863
|
+
function toUtf8Bytes(data) {
|
|
864
|
+
return new TextEncoder().encode(data);
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
// src/utils/namehash.ts
|
|
868
|
+
function namehash(name) {
|
|
869
|
+
let node = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
870
|
+
if (name === "") {
|
|
871
|
+
return node;
|
|
872
|
+
}
|
|
873
|
+
const labels = name.split(".");
|
|
874
|
+
for (let i = labels.length - 1; i >= 0; i--) {
|
|
875
|
+
const labelHash = keccak256(toUtf8Bytes(labels[i]));
|
|
876
|
+
node = keccak256("0x" + node.slice(2) + labelHash.slice(2));
|
|
877
|
+
}
|
|
878
|
+
return node;
|
|
879
|
+
}
|
|
880
|
+
|
|
981
881
|
// src/providers/utils/chains-info.ts
|
|
982
882
|
var chains_info_default = {
|
|
983
883
|
"1": [
|
|
@@ -1049,7 +949,7 @@ var chains_info_default = {
|
|
|
1049
949
|
|
|
1050
950
|
// src/providers/BaseProvider.ts
|
|
1051
951
|
function prepBlockTag(blockTag) {
|
|
1052
|
-
return typeof blockTag === "number" ?
|
|
952
|
+
return typeof blockTag === "number" ? "0x" + blockTag.toString(16) : blockTag;
|
|
1053
953
|
}
|
|
1054
954
|
var BaseProvider = class {
|
|
1055
955
|
/**
|
|
@@ -1075,7 +975,6 @@ var BaseProvider = class {
|
|
|
1075
975
|
*
|
|
1076
976
|
* * [Identical](/docs/api#isd) to [`ethers.provider.getNetwork`](https://docs.ethers.io/v5/api/providers/provider/#Provider-getNetwork) in ethers.js
|
|
1077
977
|
* * [Similar](/docs/api#isd) to [`web3.eth.getChainId`](https://web3js.readthedocs.io/en/v1.7.3/web3-eth.html#getchainid) in web3.js, returns more than just the `chainId`
|
|
1078
|
-
*
|
|
1079
978
|
* @returns information about the network this provider is currently connected to
|
|
1080
979
|
* @example
|
|
1081
980
|
* ```javascript
|
|
@@ -1106,7 +1005,6 @@ var BaseProvider = class {
|
|
|
1106
1005
|
*
|
|
1107
1006
|
* * [Identical](/docs/api#isd) to [`ethers.provider.getBlockNumber`](https://docs.ethers.io/v5/api/providers/provider/#Provider-getBlockNumber) in ethers.js
|
|
1108
1007
|
* * [Identical](/docs/api#isd) to [`web3.eth.getBlockNumber`](https://web3js.readthedocs.io/en/v1.7.3/web3-eth.html#getblocknumber) in web3.js
|
|
1109
|
-
*
|
|
1110
1008
|
* @returns the number of the most recently mined block
|
|
1111
1009
|
* @example
|
|
1112
1010
|
* ```javascript
|
|
@@ -1125,7 +1023,6 @@ var BaseProvider = class {
|
|
|
1125
1023
|
*
|
|
1126
1024
|
* * [Similar](/docs/api#isd) to [`ethers.provider.getTransaction`](https://docs.ethers.io/v5/api/providers/provider/#Provider-getTransaction) in ethers.js, does not have `wait` method that waits until the transaction has been mined
|
|
1127
1025
|
* * [Similar](/docs/api#isd) to [`web3.eth.getTransaction`](https://web3js.readthedocs.io/en/v1.7.3/web3-eth.html#gettransaction) in web3.js, some information returned using different types
|
|
1128
|
-
*
|
|
1129
1026
|
* @param transactionHash the hash of the transaction to get information about
|
|
1130
1027
|
* @returns information about the specified transaction
|
|
1131
1028
|
* @example
|
|
@@ -1137,20 +1034,20 @@ var BaseProvider = class {
|
|
|
1137
1034
|
* // blockNumber: 14578286,
|
|
1138
1035
|
* // chainId: 1,
|
|
1139
1036
|
* // from: "0xdfD9dE5f6FA60BD70636c0900752E93a6144AEd4",
|
|
1140
|
-
* // gas:
|
|
1141
|
-
* // gasPrice:
|
|
1037
|
+
* // gas: 112163n,
|
|
1038
|
+
* // gasPrice: 48592426858n,
|
|
1142
1039
|
* // hash: "0x9014ae6ef92464338355a79e5150e542ff9a83e2323318b21f40d6a3e65b4789",
|
|
1143
1040
|
* // input: "0x83259f17000000000000000000000000000000000000000000...",
|
|
1144
|
-
* // maxFeePerGas:
|
|
1145
|
-
* // maxPriorityFeePerGas:
|
|
1146
|
-
* // nonce:
|
|
1041
|
+
* // maxFeePerGas: 67681261618n,
|
|
1042
|
+
* // maxPriorityFeePerGas: 1500000000n,
|
|
1043
|
+
* // nonce: 129n,
|
|
1147
1044
|
* // r: "0x59a7c15b12c18cd68d6c440963d959bff3e73831ffc938e75ecad07f7ee43fbc",
|
|
1148
1045
|
* // s: "0x1ebaf05f0d9273b16c2a7748b150a79d22533a8cd74552611cbe620fee3dcf1c",
|
|
1149
1046
|
* // to: "0x39B72d136ba3e4ceF35F48CD09587ffaB754DD8B",
|
|
1150
1047
|
* // transactionIndex: 29,
|
|
1151
1048
|
* // type: 2,
|
|
1152
1049
|
* // v: 0,
|
|
1153
|
-
* // value:
|
|
1050
|
+
* // value: 0n,
|
|
1154
1051
|
* // confirmations: 298140,
|
|
1155
1052
|
* // }
|
|
1156
1053
|
* ```
|
|
@@ -1171,7 +1068,6 @@ var BaseProvider = class {
|
|
|
1171
1068
|
*
|
|
1172
1069
|
* * [Identical](/docs/api#isd) to [`ethers.provider.getTransactionReceipt`](https://docs.ethers.io/v5/api/providers/provider/#Provider-getTransactionReceipt) in ethers.js
|
|
1173
1070
|
* * [Similar](/docs/api#isd) to [`web3.eth.getTransactionReceipt`](https://web3js.readthedocs.io/en/v1.7.3/web3-eth.html#gettransactionreceipt) in web3.js, some information returned using different types
|
|
1174
|
-
*
|
|
1175
1071
|
* @param transactionHash the hash of the transaction to get information about
|
|
1176
1072
|
* @returns information about the specified transaction that has already been mined
|
|
1177
1073
|
* @example
|
|
@@ -1181,10 +1077,10 @@ var BaseProvider = class {
|
|
|
1181
1077
|
* // blockHash: "0x876810a013dbcd140f6fd6048c1dc33abbb901f1f96b394c2fa63aef3cb40b5d",
|
|
1182
1078
|
* // blockNumber: 14578286,
|
|
1183
1079
|
* // contractAddress: null,
|
|
1184
|
-
* // cumulativeGasUsed:
|
|
1185
|
-
* // effectiveGasPrice:
|
|
1080
|
+
* // cumulativeGasUsed: 3067973n,
|
|
1081
|
+
* // effectiveGasPrice: 48592426858n,
|
|
1186
1082
|
* // from: "0xdfD9dE5f6FA60BD70636c0900752E93a6144AEd4",
|
|
1187
|
-
* // gasUsed:
|
|
1083
|
+
* // gasUsed: 112163n,
|
|
1188
1084
|
* // logs: [
|
|
1189
1085
|
* // {
|
|
1190
1086
|
* // address: "0x0eDF9bc41Bbc1354c70e2107F80C42caE7FBBcA8",
|
|
@@ -1242,7 +1138,6 @@ var BaseProvider = class {
|
|
|
1242
1138
|
*
|
|
1243
1139
|
* * [Identical](/docs/api#isd) to [`ethers.provider.getTransactionCount`](https://docs.ethers.io/v5/api/providers/provider/#Provider-getTransactionCount) in ethers.js
|
|
1244
1140
|
* * [Identical](/docs/api#isd) to [`web3.eth.getTransactionCount`](https://web3js.readthedocs.io/en/v1.7.3/web3-eth.html#gettransactioncount) in web3.js
|
|
1245
|
-
*
|
|
1246
1141
|
* @param address the address to count number of sent transactions
|
|
1247
1142
|
* @param blockTag the block to count transactions up to, inclusive
|
|
1248
1143
|
* @returns the number of transactions sent by the specified address
|
|
@@ -1274,7 +1169,6 @@ var BaseProvider = class {
|
|
|
1274
1169
|
*
|
|
1275
1170
|
* * [Similar](/docs/api#isd) to [`ethers.provider.getBlock`](https://docs.ethers.io/v5/api/providers/provider/#Provider-getLogs) in ethers.js, includes some additional information. Can also return block with full transaction objects, similar to [`ethers.providers.getBlockWithTransactions`]
|
|
1276
1171
|
* * [Identical](/docs/api#isd) to [`web3.eth.getBlock`](https://web3js.readthedocs.io/en/v1.7.3/web3-eth.html#getpastlogs) in web3.js
|
|
1277
|
-
*
|
|
1278
1172
|
* @param timeFrame The number, hash, or text-based description ('latest', 'earliest', or 'pending') of the block to collect information on.
|
|
1279
1173
|
* @param returnTransactionObjects Whether to also return data about the transactions on the block.
|
|
1280
1174
|
* @returns A BlockResponse object with information about the specified block
|
|
@@ -1282,11 +1176,11 @@ var BaseProvider = class {
|
|
|
1282
1176
|
* ```javascript
|
|
1283
1177
|
* await provider.getBlock(14879862);
|
|
1284
1178
|
* // {
|
|
1285
|
-
* // baseFeePerGas:
|
|
1286
|
-
* // difficulty:
|
|
1179
|
+
* // baseFeePerGas: 39095728776n,
|
|
1180
|
+
* // difficulty: 14321294455359973n,
|
|
1287
1181
|
* // extraData: "0x486976656f6e2073672d6865617679",
|
|
1288
|
-
* // gasLimit:
|
|
1289
|
-
* // gasUsed:
|
|
1182
|
+
* // gasLimit: 29970620n,
|
|
1183
|
+
* // gasUsed: 20951384n,
|
|
1290
1184
|
* // hash: "0x563b458ec3c4f87393b53f70bdddc0058497109b784d8cacd9247ddf267049ab",
|
|
1291
1185
|
* // logsBloom:
|
|
1292
1186
|
* // "0x9f38794fe80b521794df6efad8b0d2e9582f9ec3959a3f9384bda0fa371cfa5fac5af9d515c6bdf1ec325f5b5f7ebdd6a3a9fae17b38a86d4dc4b0971afc68d8086640550f4c156e6f923f4a1bb94fb0bed6cdcc474c5c64bfeff7a4a906f72b9a7b94004ee58efc53d63ac66961acd3a431b2d896cc9fd75f6072960bced45f770587caf130f57504decfcb63c6ca8fbc5bdbd749edd5a99a7375d2b81872289adb775fb3c928259f4be39c6d3f4d5b6217822979bb88c1f1fb62429b1b6d41cf4e3f77f9e1db3f5723108f1e5b1255dd734ad8cdb11e7ea22487c788e67c83777b6f395e504ca59c64f52245ee6de3804cf809e5caa4f0ea6a9aa9eb6ed801",
|
|
@@ -1297,10 +1191,10 @@ var BaseProvider = class {
|
|
|
1297
1191
|
* // parentHash: "0x95986ae14a71face8d9a6a379edd875b2e8bc73e4de0d9d460e7752bddb0f579",
|
|
1298
1192
|
* // receiptsRoot: "0x8e6ba2fd9bee602b653dae6e3132f16538c2c5df24f1df8c000392053f73defa",
|
|
1299
1193
|
* // sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
|
|
1300
|
-
* // size:
|
|
1194
|
+
* // size: 134483n,
|
|
1301
1195
|
* // stateRoot: "0xbf2bb67bd1c741f3d00904b8451d7c2cf4e3a2726f5a5884792ede2074747b85",
|
|
1302
|
-
* // timestamp:
|
|
1303
|
-
* // totalDifficulty:
|
|
1196
|
+
* // timestamp: 1654016186n,
|
|
1197
|
+
* // totalDifficulty: 50478104614257705213748n,
|
|
1304
1198
|
* // transactions: [
|
|
1305
1199
|
* // "0xb3326a9149809603a2c28545e50e4f7d16e194bf5ee9764e0544603854c4a8d2",
|
|
1306
1200
|
* // "0x8b42095f8d335404a4896b2817b8e5e3d86a5a87cb434a8eec295d5280a7f48e",
|
|
@@ -1331,8 +1225,7 @@ var BaseProvider = class {
|
|
|
1331
1225
|
* Gives an estimate of the current gas price in wei.
|
|
1332
1226
|
*
|
|
1333
1227
|
* * [Similar](/docs/api#isd) to [`ethers.provider.getGasPrice`](https://docs.ethers.io/v5/api/providers/provider/#Provider-getGasPrice) in ethers.js, does not have a parameter specifying what unit you'd like to return. See also [`weiToEther`](/docs/api/modules#weitoether) and [`etherToGwei`](/docs/api/modules#ethertogwei)
|
|
1334
|
-
* * [Identical](/docs/api#isd) to [`web3.eth.getGasPrice`](https://web3js.readthedocs.io/en/v1.7.3/web3-eth.html#getgasprice) in web3.js, returns a number (
|
|
1335
|
-
*
|
|
1228
|
+
* * [Identical](/docs/api#isd) to [`web3.eth.getGasPrice`](https://web3js.readthedocs.io/en/v1.7.3/web3-eth.html#getgasprice) in web3.js, returns a number (bigint) instead of a string
|
|
1336
1229
|
* @returns an estimate of the current gas price in wei
|
|
1337
1230
|
* @example
|
|
1338
1231
|
* ```javascript
|
|
@@ -1344,14 +1237,13 @@ var BaseProvider = class {
|
|
|
1344
1237
|
const hexGasPrice = await this.post(
|
|
1345
1238
|
buildRPCPostBody("eth_gasPrice", [])
|
|
1346
1239
|
);
|
|
1347
|
-
return
|
|
1240
|
+
return BigInt(hexToDecimal(hexGasPrice));
|
|
1348
1241
|
}
|
|
1349
1242
|
/**
|
|
1350
1243
|
* Returns the balance of the account in wei.
|
|
1351
1244
|
*
|
|
1352
1245
|
* * [Identical](/docs/api#isd) to [`ethers.provider.getBalance`](https://docs.ethers.io/v5/api/providers/provider/#Provider-getBalance) in ethers.js
|
|
1353
|
-
* * [Identical](/docs/api#isd) to [`web3.eth.getBalance`](https://web3js.readthedocs.io/en/v1.7.3/web3-eth.html#getbalance) in web3.js, returns a number (
|
|
1354
|
-
*
|
|
1246
|
+
* * [Identical](/docs/api#isd) to [`web3.eth.getBalance`](https://web3js.readthedocs.io/en/v1.7.3/web3-eth.html#getbalance) in web3.js, returns a number (bigint) instead of a string
|
|
1355
1247
|
* @param address the address to check the balance of
|
|
1356
1248
|
* @param blockTag the block to check the specified address' balance on
|
|
1357
1249
|
* @returns the balance of the network's native token for the specified address on the specified block
|
|
@@ -1366,14 +1258,13 @@ var BaseProvider = class {
|
|
|
1366
1258
|
const hexBalance = await this.post(
|
|
1367
1259
|
buildRPCPostBody("eth_getBalance", [address, blockTag])
|
|
1368
1260
|
);
|
|
1369
|
-
return
|
|
1261
|
+
return BigInt(hexToDecimal(hexBalance));
|
|
1370
1262
|
}
|
|
1371
1263
|
/**
|
|
1372
1264
|
* Gets the code of a contract on a specified block.
|
|
1373
1265
|
*
|
|
1374
1266
|
* * [Identical](/docs/api#isd) to [`ethers.provider.getCode`](https://docs.ethers.io/v5/api/providers/provider/#Provider-getCode) in ethers.js
|
|
1375
1267
|
* * [Identical](/docs/api#isd) to [`web3.eth.getCode`](https://web3js.readthedocs.io/en/v1.7.3/web3-eth.html#getcode) in web3.js
|
|
1376
|
-
*
|
|
1377
1268
|
* @param address the contract address to get the contract code from
|
|
1378
1269
|
* @param blockTag the block height to search for the contract code from. Contract code can change, so this allows for checking a specific block
|
|
1379
1270
|
* @returns the contract creation code for the specified address at the specified block height
|
|
@@ -1396,7 +1287,6 @@ var BaseProvider = class {
|
|
|
1396
1287
|
*
|
|
1397
1288
|
* * [Identical](/docs/api#isd) to [`ethers.provider.estimateGas`](https://docs.ethers.io/v5/api/providers/provider/#Provider-estimateGas) in ethers.js
|
|
1398
1289
|
* * [Identical](/docs/api#isd) to [`web3.eth.estimateGas`](https://web3js.readthedocs.io/en/v1.7.3/web3-eth.html#estimateGas) in web3.js
|
|
1399
|
-
*
|
|
1400
1290
|
* @param transaction the transaction to check the estimated gas cost for
|
|
1401
1291
|
* @returns the estimated amount of gas charged for submitting the specified transaction to the blockchain
|
|
1402
1292
|
* @example
|
|
@@ -1407,7 +1297,7 @@ var BaseProvider = class {
|
|
|
1407
1297
|
* data: "0xd0e30db0",
|
|
1408
1298
|
* value: etherToWei('1.0').toHexString(),
|
|
1409
1299
|
* });
|
|
1410
|
-
* //
|
|
1300
|
+
* // 27938n
|
|
1411
1301
|
* ```
|
|
1412
1302
|
*/
|
|
1413
1303
|
async estimateGas(transaction) {
|
|
@@ -1415,7 +1305,7 @@ var BaseProvider = class {
|
|
|
1415
1305
|
const gasUsed = await this.post(
|
|
1416
1306
|
buildRPCPostBody("eth_estimateGas", [rpcTransaction])
|
|
1417
1307
|
);
|
|
1418
|
-
return
|
|
1308
|
+
return BigInt(hexToDecimal(gasUsed));
|
|
1419
1309
|
}
|
|
1420
1310
|
/**
|
|
1421
1311
|
* Returns the current recommended FeeData to use in a transaction.
|
|
@@ -1423,16 +1313,15 @@ var BaseProvider = class {
|
|
|
1423
1313
|
* For legacy transactions and networks which do not support EIP-1559, the gasPrice should be used.Returns an estimate of the amount of gas that would be required to submit transaction to the network.
|
|
1424
1314
|
*
|
|
1425
1315
|
* * [Identical](/docs/api#isd) to [`ethers.provider.getFeeData`](https://docs.ethers.org/v5/api/providers/provider/#Provider-getFeeData) in ethers.js
|
|
1426
|
-
*
|
|
1427
1316
|
* @returns an object with gas estimates for the network currently
|
|
1428
1317
|
* @example
|
|
1429
1318
|
* ```javascript
|
|
1430
1319
|
* await provider.getFeeData();
|
|
1431
1320
|
* // {
|
|
1432
|
-
* // gasPrice:
|
|
1433
|
-
* // lastBaseFeePerGas:
|
|
1434
|
-
* // maxFeePerGas:
|
|
1435
|
-
* // maxPriorityFeePerGas:
|
|
1321
|
+
* // gasPrice: 14184772639n,
|
|
1322
|
+
* // lastBaseFeePerGas: 14038523098n,
|
|
1323
|
+
* // maxFeePerGas: 29577046196n,
|
|
1324
|
+
* // maxPriorityFeePerGas: 1500000000n
|
|
1436
1325
|
* // }
|
|
1437
1326
|
* ```
|
|
1438
1327
|
*/
|
|
@@ -1444,10 +1333,8 @@ var BaseProvider = class {
|
|
|
1444
1333
|
let lastBaseFeePerGas = null, maxFeePerGas = null, maxPriorityFeePerGas = null;
|
|
1445
1334
|
if (block && block.baseFeePerGas) {
|
|
1446
1335
|
lastBaseFeePerGas = block.baseFeePerGas;
|
|
1447
|
-
maxPriorityFeePerGas =
|
|
1448
|
-
maxFeePerGas =
|
|
1449
|
-
block.baseFeePerGas.mul(2).add(maxPriorityFeePerGas)
|
|
1450
|
-
);
|
|
1336
|
+
maxPriorityFeePerGas = BigInt("1500000000");
|
|
1337
|
+
maxFeePerGas = block.baseFeePerGas * 2n + maxPriorityFeePerGas;
|
|
1451
1338
|
}
|
|
1452
1339
|
return { lastBaseFeePerGas, maxFeePerGas, maxPriorityFeePerGas, gasPrice };
|
|
1453
1340
|
}
|
|
@@ -1457,7 +1344,6 @@ var BaseProvider = class {
|
|
|
1457
1344
|
*
|
|
1458
1345
|
* * [Identical](/docs/api#isd) to [`ethers.provider.getLogs`](https://docs.ethers.io/v5/api/providers/provider/#Provider-getLogs) in ethers.js
|
|
1459
1346
|
* * [Identical](/docs/api#isd) to [`web3.eth.getPastLogs`](https://web3js.readthedocs.io/en/v1.7.3/web3-eth.html#getpastlogs) in web3.js
|
|
1460
|
-
*
|
|
1461
1347
|
* @param filter parameters to filter the logs by
|
|
1462
1348
|
* @returns an array of logs matching the specified filter
|
|
1463
1349
|
* @example
|
|
@@ -1509,7 +1395,6 @@ var BaseProvider = class {
|
|
|
1509
1395
|
*
|
|
1510
1396
|
* * [Identical](/docs/api#isd) to [`ethers.provider.call`](https://docs.ethers.io/v5/api/providers/provider/#Provider-call) in ethers.js
|
|
1511
1397
|
* * [Identical](/docs/api#isd) to [`web3.eth.call`](https://web3js.readthedocs.io/en/v1.7.3/web3-eth.html#call) in web3.js
|
|
1512
|
-
*
|
|
1513
1398
|
* @param transaction the transaction object to, in theory, execute. Doesn't actually get added to the blockchain.
|
|
1514
1399
|
* @param blockTag the block to execute this transaction on
|
|
1515
1400
|
* @returns the result of executing the transaction on the specified block
|
|
@@ -1546,6 +1431,137 @@ var BaseProvider = class {
|
|
|
1546
1431
|
);
|
|
1547
1432
|
return transactionRes;
|
|
1548
1433
|
}
|
|
1434
|
+
/**
|
|
1435
|
+
* Resolves an ENS name to an Ethereum address.
|
|
1436
|
+
*
|
|
1437
|
+
* Performs the full ENS resolution process:
|
|
1438
|
+
* 1. Computes the namehash of the ENS name
|
|
1439
|
+
* 2. Queries the ENS Registry for the resolver contract
|
|
1440
|
+
* 3. Queries the resolver for the address
|
|
1441
|
+
*
|
|
1442
|
+
* * [Identical](/docs/api#isd) to [`ethers.provider.resolveName`](https://docs.ethers.io/v5/api/providers/provider/#Provider-resolveName) in ethers.js
|
|
1443
|
+
* @param name the ENS name to resolve (e.g. 'vitalik.eth')
|
|
1444
|
+
* @returns the Ethereum address the name resolves to, or null if not found
|
|
1445
|
+
* @example
|
|
1446
|
+
* ```javascript
|
|
1447
|
+
* await provider.resolveName('vitalik.eth');
|
|
1448
|
+
* // '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'
|
|
1449
|
+
* ```
|
|
1450
|
+
* @example
|
|
1451
|
+
* ```javascript
|
|
1452
|
+
* await provider.resolveName('thisshouldnotexist12345.eth');
|
|
1453
|
+
* // null
|
|
1454
|
+
* ```
|
|
1455
|
+
*/
|
|
1456
|
+
async resolveName(name) {
|
|
1457
|
+
const ENS_REGISTRY = "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";
|
|
1458
|
+
const RESOLVER_SELECTOR = "0x0178b8bf";
|
|
1459
|
+
const ADDR_SELECTOR = "0x3b3b57de";
|
|
1460
|
+
const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
1461
|
+
const node = namehash(name);
|
|
1462
|
+
const nodeWithoutPrefix = node.slice(2);
|
|
1463
|
+
const resolverData = RESOLVER_SELECTOR + nodeWithoutPrefix;
|
|
1464
|
+
const resolverResult = await this.call({
|
|
1465
|
+
to: ENS_REGISTRY,
|
|
1466
|
+
data: resolverData
|
|
1467
|
+
});
|
|
1468
|
+
if (!resolverResult || resolverResult === ZERO_ADDRESS) {
|
|
1469
|
+
return null;
|
|
1470
|
+
}
|
|
1471
|
+
const resolverAddress = "0x" + resolverResult.slice(26);
|
|
1472
|
+
if (resolverAddress === "0x0000000000000000000000000000000000000000" || resolverAddress === "0x" + "0".repeat(resolverResult.length - 2)) {
|
|
1473
|
+
return null;
|
|
1474
|
+
}
|
|
1475
|
+
const addrData = ADDR_SELECTOR + nodeWithoutPrefix;
|
|
1476
|
+
const addrResult = await this.call({
|
|
1477
|
+
to: resolverAddress,
|
|
1478
|
+
data: addrData
|
|
1479
|
+
});
|
|
1480
|
+
if (!addrResult || addrResult === ZERO_ADDRESS) {
|
|
1481
|
+
return null;
|
|
1482
|
+
}
|
|
1483
|
+
const rawAddress = "0x" + addrResult.slice(26);
|
|
1484
|
+
if (rawAddress === "0x0000000000000000000000000000000000000000") {
|
|
1485
|
+
return null;
|
|
1486
|
+
}
|
|
1487
|
+
return toChecksumAddress(rawAddress);
|
|
1488
|
+
}
|
|
1489
|
+
/**
|
|
1490
|
+
* Performs reverse ENS resolution to get the ENS name associated with an address.
|
|
1491
|
+
*
|
|
1492
|
+
* Performs the full ENS reverse resolution process:
|
|
1493
|
+
* 1. Formats the address as a reverse lookup: `{address}.addr.reverse`
|
|
1494
|
+
* 2. Computes the namehash of the reverse name
|
|
1495
|
+
* 3. Queries the ENS Registry for the resolver contract
|
|
1496
|
+
* 4. Queries the resolver for the name
|
|
1497
|
+
* 5. Verifies the name resolves back to the original address (per ENSIP-3)
|
|
1498
|
+
*
|
|
1499
|
+
* * [Identical](/docs/api#isd) to [`viem.getEnsName`](https://viem.sh/docs/ens/actions/getEnsName) in viem
|
|
1500
|
+
* @param address the Ethereum address to look up (e.g. '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045')
|
|
1501
|
+
* @returns the ENS name the address resolves to, or null if not found or verification fails
|
|
1502
|
+
* @example
|
|
1503
|
+
* ```javascript
|
|
1504
|
+
* await provider.lookupAddress('0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045');
|
|
1505
|
+
* // 'vitalik.eth'
|
|
1506
|
+
* ```
|
|
1507
|
+
* @example
|
|
1508
|
+
* ```javascript
|
|
1509
|
+
* await provider.lookupAddress('0x0000000000000000000000000000000000000000');
|
|
1510
|
+
* // null
|
|
1511
|
+
* ```
|
|
1512
|
+
*/
|
|
1513
|
+
async lookupAddress(address) {
|
|
1514
|
+
const ENS_REGISTRY = "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e";
|
|
1515
|
+
const RESOLVER_SELECTOR = "0x0178b8bf";
|
|
1516
|
+
const NAME_SELECTOR = "0x691f3431";
|
|
1517
|
+
const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000000000000000000000000000";
|
|
1518
|
+
const addressLower = address.toLowerCase();
|
|
1519
|
+
const addressWithoutPrefix = addressLower.startsWith("0x") ? addressLower.slice(2) : addressLower;
|
|
1520
|
+
const reverseName = `${addressWithoutPrefix}.addr.reverse`;
|
|
1521
|
+
const node = namehash(reverseName);
|
|
1522
|
+
const nodeWithoutPrefix = node.slice(2);
|
|
1523
|
+
const resolverData = RESOLVER_SELECTOR + nodeWithoutPrefix;
|
|
1524
|
+
const resolverResult = await this.call({
|
|
1525
|
+
to: ENS_REGISTRY,
|
|
1526
|
+
data: resolverData
|
|
1527
|
+
});
|
|
1528
|
+
if (!resolverResult || resolverResult === ZERO_ADDRESS) {
|
|
1529
|
+
return null;
|
|
1530
|
+
}
|
|
1531
|
+
const resolverAddress = "0x" + resolverResult.slice(26);
|
|
1532
|
+
if (resolverAddress === "0x0000000000000000000000000000000000000000" || resolverAddress === "0x" + "0".repeat(resolverResult.length - 2)) {
|
|
1533
|
+
return null;
|
|
1534
|
+
}
|
|
1535
|
+
const nameData = NAME_SELECTOR + nodeWithoutPrefix;
|
|
1536
|
+
const nameResult = await this.call({
|
|
1537
|
+
to: resolverAddress,
|
|
1538
|
+
data: nameData
|
|
1539
|
+
});
|
|
1540
|
+
if (!nameResult || nameResult === ZERO_ADDRESS) {
|
|
1541
|
+
return null;
|
|
1542
|
+
}
|
|
1543
|
+
const lengthHex = nameResult.slice(2 + 64, 2 + 128);
|
|
1544
|
+
const length = parseInt(lengthHex, 16);
|
|
1545
|
+
if (length === 0) {
|
|
1546
|
+
return null;
|
|
1547
|
+
}
|
|
1548
|
+
const dataHex = nameResult.slice(2 + 128);
|
|
1549
|
+
const name = dataHex.slice(0, length * 2).match(/.{1,2}/g)?.map((byte) => String.fromCharCode(parseInt(byte, 16))).join("");
|
|
1550
|
+
if (!name) {
|
|
1551
|
+
return null;
|
|
1552
|
+
}
|
|
1553
|
+
try {
|
|
1554
|
+
const verifyAddress = await this.resolveName(name);
|
|
1555
|
+
const normalizedAddress = addressLower.startsWith("0x") ? addressLower : "0x" + addressLower;
|
|
1556
|
+
const normalizedVerifyAddress = verifyAddress?.toLowerCase();
|
|
1557
|
+
if (normalizedVerifyAddress !== normalizedAddress) {
|
|
1558
|
+
return null;
|
|
1559
|
+
}
|
|
1560
|
+
} catch {
|
|
1561
|
+
return null;
|
|
1562
|
+
}
|
|
1563
|
+
return name;
|
|
1564
|
+
}
|
|
1549
1565
|
};
|
|
1550
1566
|
|
|
1551
1567
|
// src/providers/JsonRpcProvider.ts
|
|
@@ -1580,7 +1596,7 @@ function jsonRpcProvider(rpcUrl) {
|
|
|
1580
1596
|
// src/providers/AlchemyProvider.ts
|
|
1581
1597
|
var AlchemyProvider = class extends JsonRpcProvider {
|
|
1582
1598
|
constructor(apiKey, network = "mainnet") {
|
|
1583
|
-
const alchemyUrl = `https://eth-${network}.
|
|
1599
|
+
const alchemyUrl = `https://eth-${network}.g.alchemy.com/v2/${apiKey}`;
|
|
1584
1600
|
super(alchemyUrl);
|
|
1585
1601
|
}
|
|
1586
1602
|
};
|
|
@@ -1647,6 +1663,51 @@ var FallthroughProvider = class extends BaseProvider {
|
|
|
1647
1663
|
};
|
|
1648
1664
|
};
|
|
1649
1665
|
|
|
1666
|
+
// src/utils/abi-encode-decode.ts
|
|
1667
|
+
function findFunctionABI(abi, functionName) {
|
|
1668
|
+
const entry = abi.find(
|
|
1669
|
+
(item) => item.type === "function" && item.name === functionName
|
|
1670
|
+
);
|
|
1671
|
+
if (!entry) {
|
|
1672
|
+
throw new Error(`Function "${functionName}" not found in ABI`);
|
|
1673
|
+
}
|
|
1674
|
+
return entry;
|
|
1675
|
+
}
|
|
1676
|
+
function encodeFunctionData(abi, functionName, args = []) {
|
|
1677
|
+
const abiEntry = findFunctionABI(abi, functionName);
|
|
1678
|
+
return encodeData(abiEntry, args);
|
|
1679
|
+
}
|
|
1680
|
+
function decodeFunctionResult(abi, functionName, data) {
|
|
1681
|
+
const abiEntry = findFunctionABI(abi, functionName);
|
|
1682
|
+
return decodeRPCResponse(abiEntry, data);
|
|
1683
|
+
}
|
|
1684
|
+
|
|
1685
|
+
// src/utils/to-utf8-string.ts
|
|
1686
|
+
function toUtf8String(bytes) {
|
|
1687
|
+
return new TextDecoder().decode(arrayify(bytes));
|
|
1688
|
+
}
|
|
1689
|
+
|
|
1690
|
+
// src/utils/bytes32-string.ts
|
|
1691
|
+
function encodeBytes32String(text) {
|
|
1692
|
+
const bytes = toUtf8Bytes(text);
|
|
1693
|
+
if (bytes.length > 31) {
|
|
1694
|
+
throw new Error("bytes32 string must be less than 32 bytes");
|
|
1695
|
+
}
|
|
1696
|
+
const padded = new Uint8Array(32);
|
|
1697
|
+
padded.set(bytes);
|
|
1698
|
+
return hexlify(padded);
|
|
1699
|
+
}
|
|
1700
|
+
function decodeBytes32String(bytes32) {
|
|
1701
|
+
let hex = bytes32;
|
|
1702
|
+
if (hex.startsWith("0x") || hex.startsWith("0X")) {
|
|
1703
|
+
hex = hex.slice(2);
|
|
1704
|
+
}
|
|
1705
|
+
hex = hex.replace(/(00)+$/, "");
|
|
1706
|
+
if (hex.length === 0)
|
|
1707
|
+
return "";
|
|
1708
|
+
return toUtf8String("0x" + hex);
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1650
1711
|
// src/utils/compute-public-key.ts
|
|
1651
1712
|
var import_secp256k1 = require("@noble/secp256k1");
|
|
1652
1713
|
function computePublicKey(privKey) {
|
|
@@ -1654,23 +1715,6 @@ function computePublicKey(privKey) {
|
|
|
1654
1715
|
return "0x" + import_secp256k1.Point.fromPrivateKey(privKey).toHex();
|
|
1655
1716
|
}
|
|
1656
1717
|
|
|
1657
|
-
// src/utils/keccak256.ts
|
|
1658
|
-
var import_sha33 = require("@noble/hashes/sha3.js");
|
|
1659
|
-
var import_utils3 = require("@noble/hashes/utils.js");
|
|
1660
|
-
function keccak256(data) {
|
|
1661
|
-
let bytes;
|
|
1662
|
-
if (typeof data === "string") {
|
|
1663
|
-
const hex = data.replace(/^0x/, "");
|
|
1664
|
-
bytes = new Uint8Array(hex.length / 2);
|
|
1665
|
-
for (let i = 0; i < bytes.length; i++) {
|
|
1666
|
-
bytes[i] = parseInt(hex.substr(i * 2, 2), 16);
|
|
1667
|
-
}
|
|
1668
|
-
} else {
|
|
1669
|
-
bytes = new Uint8Array(data);
|
|
1670
|
-
}
|
|
1671
|
-
return "0x" + (0, import_utils3.bytesToHex)((0, import_sha33.keccak_256)(bytes));
|
|
1672
|
-
}
|
|
1673
|
-
|
|
1674
1718
|
// src/utils/compute-address.ts
|
|
1675
1719
|
function computeAddress(key) {
|
|
1676
1720
|
if (!key.startsWith("0x04") && !key.startsWith("0x03") && !key.startsWith("0x02")) {
|
|
@@ -1679,30 +1723,174 @@ function computeAddress(key) {
|
|
|
1679
1723
|
return toChecksumAddress(hexDataSlice(keccak256(hexDataSlice(key, 1)), 12));
|
|
1680
1724
|
}
|
|
1681
1725
|
|
|
1726
|
+
// src/utils/decode-event-log.ts
|
|
1727
|
+
function computeEventTopic(event) {
|
|
1728
|
+
const types = event.inputs.map((input) => input.type);
|
|
1729
|
+
const signature = `${event.name}(${types.join(",")})`;
|
|
1730
|
+
return keccak256(toUtf8Bytes(signature));
|
|
1731
|
+
}
|
|
1732
|
+
function decodeValue(hexChunk, type) {
|
|
1733
|
+
if (type === "bool") {
|
|
1734
|
+
return hexChunk[hexChunk.length - 1] === "1";
|
|
1735
|
+
}
|
|
1736
|
+
if (type === "address") {
|
|
1737
|
+
return toChecksumAddress(`0x${hexChunk.slice(24)}`);
|
|
1738
|
+
}
|
|
1739
|
+
if (type === "bytes32") {
|
|
1740
|
+
return `0x${hexChunk}`;
|
|
1741
|
+
}
|
|
1742
|
+
if (type === "uint8") {
|
|
1743
|
+
return Number(BigInt(`0x${hexChunk}`));
|
|
1744
|
+
}
|
|
1745
|
+
if (type.startsWith("uint")) {
|
|
1746
|
+
return BigInt(`0x${hexChunk}`);
|
|
1747
|
+
}
|
|
1748
|
+
if (type.startsWith("int")) {
|
|
1749
|
+
return BigInt(`0x${hexChunk}`);
|
|
1750
|
+
}
|
|
1751
|
+
throw new Error(
|
|
1752
|
+
`essential-eth does not yet support decoding "${type}" in event logs. Make a PR today!`
|
|
1753
|
+
);
|
|
1754
|
+
}
|
|
1755
|
+
function decodeEventLog(abi, log) {
|
|
1756
|
+
const topic0 = log.topics[0];
|
|
1757
|
+
const events = abi.filter((entry) => entry.type === "event");
|
|
1758
|
+
let matchedEvent;
|
|
1759
|
+
for (const event of events) {
|
|
1760
|
+
const hash = computeEventTopic(event);
|
|
1761
|
+
if (hash === topic0) {
|
|
1762
|
+
matchedEvent = event;
|
|
1763
|
+
break;
|
|
1764
|
+
}
|
|
1765
|
+
}
|
|
1766
|
+
if (!matchedEvent) {
|
|
1767
|
+
throw new Error(`No matching event found in ABI for topic0: ${topic0}`);
|
|
1768
|
+
}
|
|
1769
|
+
const args = {};
|
|
1770
|
+
let topicIndex = 1;
|
|
1771
|
+
let dataOffset = 0;
|
|
1772
|
+
const rawData = log.data.startsWith("0x") ? log.data.slice(2) : log.data;
|
|
1773
|
+
for (const input of matchedEvent.inputs) {
|
|
1774
|
+
if (input.indexed) {
|
|
1775
|
+
const topicHex = log.topics[topicIndex];
|
|
1776
|
+
const hexChunk = topicHex.startsWith("0x") ? topicHex.slice(2) : topicHex;
|
|
1777
|
+
args[input.name] = decodeValue(hexChunk, input.type);
|
|
1778
|
+
topicIndex++;
|
|
1779
|
+
} else {
|
|
1780
|
+
const hexChunk = rawData.slice(dataOffset, dataOffset + 64);
|
|
1781
|
+
args[input.name] = decodeValue(hexChunk, input.type);
|
|
1782
|
+
dataOffset += 64;
|
|
1783
|
+
}
|
|
1784
|
+
}
|
|
1785
|
+
return {
|
|
1786
|
+
eventName: matchedEvent.name,
|
|
1787
|
+
args
|
|
1788
|
+
};
|
|
1789
|
+
}
|
|
1790
|
+
|
|
1791
|
+
// src/utils/fixed-point.ts
|
|
1792
|
+
function parseFixed(value, decimals) {
|
|
1793
|
+
let negative = false;
|
|
1794
|
+
if (value.startsWith("-")) {
|
|
1795
|
+
negative = true;
|
|
1796
|
+
value = value.substring(1);
|
|
1797
|
+
}
|
|
1798
|
+
if (value === "") {
|
|
1799
|
+
throw new Error("invalid decimal value");
|
|
1800
|
+
}
|
|
1801
|
+
const parts = value.split(".");
|
|
1802
|
+
if (parts.length > 2) {
|
|
1803
|
+
throw new Error("too many decimal points");
|
|
1804
|
+
}
|
|
1805
|
+
const integer = parts[0] || "0";
|
|
1806
|
+
let fraction = parts[1] || "";
|
|
1807
|
+
if (fraction.length > decimals) {
|
|
1808
|
+
const extra = fraction.substring(decimals);
|
|
1809
|
+
if (extra.match(/[^0]/)) {
|
|
1810
|
+
throw new Error("fractional component exceeds decimals");
|
|
1811
|
+
}
|
|
1812
|
+
fraction = fraction.substring(0, decimals);
|
|
1813
|
+
}
|
|
1814
|
+
while (fraction.length < decimals) {
|
|
1815
|
+
fraction += "0";
|
|
1816
|
+
}
|
|
1817
|
+
const result = BigInt(integer + fraction);
|
|
1818
|
+
return negative ? -result : result;
|
|
1819
|
+
}
|
|
1820
|
+
function formatFixed(value, decimals) {
|
|
1821
|
+
let negative = "";
|
|
1822
|
+
if (value < 0n) {
|
|
1823
|
+
negative = "-";
|
|
1824
|
+
value = -value;
|
|
1825
|
+
}
|
|
1826
|
+
let str = value.toString();
|
|
1827
|
+
while (str.length <= decimals) {
|
|
1828
|
+
str = "0" + str;
|
|
1829
|
+
}
|
|
1830
|
+
const integerPart = str.substring(0, str.length - decimals);
|
|
1831
|
+
const fractionPart = str.substring(str.length - decimals);
|
|
1832
|
+
const trimmedFraction = fractionPart.replace(/0+$/, "");
|
|
1833
|
+
if (trimmedFraction) {
|
|
1834
|
+
return `${negative}${integerPart}.${trimmedFraction}`;
|
|
1835
|
+
}
|
|
1836
|
+
return `${negative}${integerPart}`;
|
|
1837
|
+
}
|
|
1838
|
+
function toBigInt(value) {
|
|
1839
|
+
if (typeof value === "bigint")
|
|
1840
|
+
return value;
|
|
1841
|
+
if (typeof value === "string") {
|
|
1842
|
+
if (value.startsWith("0x")) {
|
|
1843
|
+
return BigInt(value);
|
|
1844
|
+
}
|
|
1845
|
+
if (value.includes(".")) {
|
|
1846
|
+
return BigInt(value.split(".")[0] || "0");
|
|
1847
|
+
}
|
|
1848
|
+
return BigInt(value);
|
|
1849
|
+
}
|
|
1850
|
+
return BigInt(value);
|
|
1851
|
+
}
|
|
1852
|
+
|
|
1682
1853
|
// src/utils/ether-to-gwei.ts
|
|
1683
1854
|
function etherToGwei(etherQuantity) {
|
|
1684
|
-
validateType(etherQuantity, ["string", "number", "
|
|
1685
|
-
|
|
1686
|
-
return tinyBig(result);
|
|
1855
|
+
validateType(etherQuantity, ["string", "number", "bigint"]);
|
|
1856
|
+
return parseFixed(String(etherQuantity), 9);
|
|
1687
1857
|
}
|
|
1688
1858
|
|
|
1689
1859
|
// src/utils/ether-to-wei.ts
|
|
1690
1860
|
function etherToWei(etherQuantity) {
|
|
1691
|
-
validateType(etherQuantity, ["string", "number", "
|
|
1692
|
-
|
|
1693
|
-
return tinyBig(result);
|
|
1861
|
+
validateType(etherQuantity, ["string", "number", "bigint"]);
|
|
1862
|
+
return parseFixed(String(etherQuantity), 18);
|
|
1694
1863
|
}
|
|
1695
1864
|
|
|
1696
|
-
// src/utils/
|
|
1697
|
-
function
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1865
|
+
// src/utils/event-topic.ts
|
|
1866
|
+
function getEventTopic(eventSignature) {
|
|
1867
|
+
return keccak256(toUtf8Bytes(eventSignature));
|
|
1868
|
+
}
|
|
1869
|
+
function getEventSignature(abi, eventName) {
|
|
1870
|
+
const event = abi.find(
|
|
1871
|
+
(entry) => entry.type === "event" && entry.name === eventName
|
|
1872
|
+
);
|
|
1873
|
+
if (!event) {
|
|
1874
|
+
throw new Error(`Event "${eventName}" not found in ABI`);
|
|
1875
|
+
}
|
|
1876
|
+
const signature = `${event.name}(${event.inputs.map((input) => input.type).join(",")})`;
|
|
1877
|
+
return getEventTopic(signature);
|
|
1701
1878
|
}
|
|
1702
1879
|
|
|
1703
|
-
// src/utils/
|
|
1704
|
-
function
|
|
1705
|
-
return
|
|
1880
|
+
// src/utils/format-units.ts
|
|
1881
|
+
function formatUnits(value, decimals = 18) {
|
|
1882
|
+
return formatFixed(toBigInt(value), decimals);
|
|
1883
|
+
}
|
|
1884
|
+
|
|
1885
|
+
// src/utils/get-address.ts
|
|
1886
|
+
function getAddress(address) {
|
|
1887
|
+
return toChecksumAddress(address);
|
|
1888
|
+
}
|
|
1889
|
+
|
|
1890
|
+
// src/utils/gwei-to-ether.ts
|
|
1891
|
+
function gweiToEther(gweiQuantity) {
|
|
1892
|
+
validateType(gweiQuantity, ["string", "number", "bigint"]);
|
|
1893
|
+
return formatFixed(toBigInt(gweiQuantity), 9);
|
|
1706
1894
|
}
|
|
1707
1895
|
|
|
1708
1896
|
// src/utils/hash-message.ts
|
|
@@ -1720,6 +1908,11 @@ function hashMessage(message) {
|
|
|
1720
1908
|
);
|
|
1721
1909
|
}
|
|
1722
1910
|
|
|
1911
|
+
// src/utils/id.ts
|
|
1912
|
+
function id(text) {
|
|
1913
|
+
return keccak256(toUtf8Bytes(text));
|
|
1914
|
+
}
|
|
1915
|
+
|
|
1723
1916
|
// src/utils/is-address.ts
|
|
1724
1917
|
function isAddress(address) {
|
|
1725
1918
|
validateType(address, ["string"]);
|
|
@@ -1731,6 +1924,11 @@ function isAddress(address) {
|
|
|
1731
1924
|
}
|
|
1732
1925
|
}
|
|
1733
1926
|
|
|
1927
|
+
// src/utils/parse-units.ts
|
|
1928
|
+
function parseUnits(value, decimals = 18) {
|
|
1929
|
+
return parseFixed(value, decimals);
|
|
1930
|
+
}
|
|
1931
|
+
|
|
1734
1932
|
// src/utils/solidity-keccak256.ts
|
|
1735
1933
|
var regexBytes = new RegExp("^bytes([0-9]+)$");
|
|
1736
1934
|
var regexNumber = new RegExp("^(u?int)([0-9]*)$");
|
|
@@ -1762,7 +1960,11 @@ function _pack(type, value, isArray) {
|
|
|
1762
1960
|
if (isArray) {
|
|
1763
1961
|
size = 256;
|
|
1764
1962
|
}
|
|
1765
|
-
|
|
1963
|
+
let bigVal = BigInt(value);
|
|
1964
|
+
if (bigVal < 0n) {
|
|
1965
|
+
bigVal = bigVal + (1n << BigInt(size));
|
|
1966
|
+
}
|
|
1967
|
+
value = Number(bigVal);
|
|
1766
1968
|
const hexValue2 = hexlify(value);
|
|
1767
1969
|
return zeroPad(hexValue2, size / 8);
|
|
1768
1970
|
}
|
|
@@ -1976,17 +2178,8 @@ function splitSignature(signature) {
|
|
|
1976
2178
|
|
|
1977
2179
|
// src/utils/wei-to-ether.ts
|
|
1978
2180
|
function weiToEther(weiQuantity) {
|
|
1979
|
-
validateType(weiQuantity, ["string", "number", "
|
|
1980
|
-
|
|
1981
|
-
let _weiQuantity = weiQuantity;
|
|
1982
|
-
if (typeof weiQuantity === "string" && weiQuantity.slice(0, 2) === "0x") {
|
|
1983
|
-
_weiQuantity = BigInt(weiQuantity).toString();
|
|
1984
|
-
}
|
|
1985
|
-
const result = tinyBig(_weiQuantity).div("1000000000000000000");
|
|
1986
|
-
return tinyBig(result);
|
|
1987
|
-
} catch (error) {
|
|
1988
|
-
throw error;
|
|
1989
|
-
}
|
|
2181
|
+
validateType(weiQuantity, ["string", "number", "bigint"]);
|
|
2182
|
+
return formatFixed(toBigInt(weiQuantity), 18);
|
|
1990
2183
|
}
|
|
1991
2184
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1992
2185
|
0 && (module.exports = {
|
|
@@ -1995,13 +2188,21 @@ function weiToEther(weiQuantity) {
|
|
|
1995
2188
|
Contract,
|
|
1996
2189
|
FallthroughProvider,
|
|
1997
2190
|
JsonRpcProvider,
|
|
1998
|
-
TinyBig,
|
|
1999
2191
|
arrayify,
|
|
2000
2192
|
computeAddress,
|
|
2001
2193
|
computePublicKey,
|
|
2002
2194
|
concat,
|
|
2195
|
+
decodeBytes32String,
|
|
2196
|
+
decodeEventLog,
|
|
2197
|
+
decodeFunctionResult,
|
|
2198
|
+
encodeBytes32String,
|
|
2199
|
+
encodeFunctionData,
|
|
2003
2200
|
etherToGwei,
|
|
2004
2201
|
etherToWei,
|
|
2202
|
+
formatUnits,
|
|
2203
|
+
getAddress,
|
|
2204
|
+
getEventSignature,
|
|
2205
|
+
getEventTopic,
|
|
2005
2206
|
gweiToEther,
|
|
2006
2207
|
hashMessage,
|
|
2007
2208
|
hexConcat,
|
|
@@ -2011,19 +2212,22 @@ function weiToEther(weiQuantity) {
|
|
|
2011
2212
|
hexValue,
|
|
2012
2213
|
hexZeroPad,
|
|
2013
2214
|
hexlify,
|
|
2215
|
+
id,
|
|
2014
2216
|
isAddress,
|
|
2015
2217
|
isBytes,
|
|
2016
2218
|
isBytesLike,
|
|
2017
2219
|
isHexString,
|
|
2018
2220
|
jsonRpcProvider,
|
|
2019
2221
|
keccak256,
|
|
2222
|
+
namehash,
|
|
2020
2223
|
pack,
|
|
2224
|
+
parseUnits,
|
|
2021
2225
|
solidityKeccak256,
|
|
2022
2226
|
splitSignature,
|
|
2023
2227
|
stripZeros,
|
|
2024
|
-
tinyBig,
|
|
2025
2228
|
toChecksumAddress,
|
|
2026
2229
|
toUtf8Bytes,
|
|
2230
|
+
toUtf8String,
|
|
2027
2231
|
weiToEther,
|
|
2028
2232
|
zeroPad
|
|
2029
2233
|
});
|