viem 0.1.12 → 0.1.13
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/abi.js +2 -2
- package/dist/abi.mjs +1 -1
- package/dist/chains.js +63 -63
- package/dist/chains.mjs +1 -1
- package/dist/{chunk-Q6OIGGTK.js → chunk-3FWCHYKE.js} +5 -3
- package/dist/{chunk-Q6OIGGTK.js.map → chunk-3FWCHYKE.js.map} +1 -1
- package/dist/{chunk-2TGSUQZ6.js → chunk-65E5HTFA.js} +19 -19
- package/dist/{chunk-6C7XIWBD.mjs → chunk-BJPR4EAT.mjs} +2 -2
- package/dist/{chunk-XULBGJK5.mjs → chunk-S4MOKUQW.mjs} +4 -2
- package/dist/{chunk-XULBGJK5.mjs.map → chunk-S4MOKUQW.mjs.map} +1 -1
- package/dist/contract.js +2 -2
- package/dist/contract.mjs +1 -1
- package/dist/ens.js +3 -3
- package/dist/ens.mjs +2 -2
- package/dist/ethers.js +3 -3
- package/dist/ethers.mjs +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +96 -90
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -2
- package/dist/index.mjs.map +1 -1
- package/dist/{parseGwei-faf061db.d.ts → parseGwei-a35c7c87.d.ts} +6 -1
- package/dist/public.js +2 -2
- package/dist/public.mjs +1 -1
- package/dist/test.js +2 -2
- package/dist/test.mjs +1 -1
- package/dist/utils/index.d.ts +2 -2
- package/dist/utils/index.js +8 -2
- package/dist/utils/index.mjs +7 -1
- package/dist/wallet.js +2 -2
- package/dist/wallet.mjs +1 -1
- package/package.json +1 -1
- /package/dist/{chunk-2TGSUQZ6.js.map → chunk-65E5HTFA.js.map} +0 -0
- /package/dist/{chunk-6C7XIWBD.mjs.map → chunk-BJPR4EAT.mjs.map} +0 -0
@@ -11,27 +11,27 @@
|
|
11
11
|
|
12
12
|
|
13
13
|
|
14
|
-
var
|
14
|
+
var _chunk3FWCHYKEjs = require('./chunk-3FWCHYKE.js');
|
15
15
|
|
16
16
|
// src/utils/ens/labelhash.ts
|
17
17
|
function labelhash(label) {
|
18
18
|
let result = new Uint8Array(32).fill(0);
|
19
19
|
if (!label)
|
20
|
-
return
|
21
|
-
return
|
20
|
+
return _chunk3FWCHYKEjs.bytesToHex.call(void 0, result);
|
21
|
+
return _chunk3FWCHYKEjs.keccak256.call(void 0, _chunk3FWCHYKEjs.stringToBytes.call(void 0, label));
|
22
22
|
}
|
23
23
|
|
24
24
|
// src/utils/ens/namehash.ts
|
25
25
|
function namehash(name) {
|
26
26
|
let result = new Uint8Array(32).fill(0);
|
27
27
|
if (!name)
|
28
|
-
return
|
28
|
+
return _chunk3FWCHYKEjs.bytesToHex.call(void 0, result);
|
29
29
|
const labels = name.split(".");
|
30
30
|
for (let i = labels.length - 1; i >= 0; i -= 1) {
|
31
|
-
const hashed =
|
32
|
-
result =
|
31
|
+
const hashed = _chunk3FWCHYKEjs.keccak256.call(void 0, _chunk3FWCHYKEjs.stringToBytes.call(void 0, labels[i]), "bytes");
|
32
|
+
result = _chunk3FWCHYKEjs.keccak256.call(void 0, _chunk3FWCHYKEjs.concat.call(void 0, [result, hashed]), "bytes");
|
33
33
|
}
|
34
|
-
return
|
34
|
+
return _chunk3FWCHYKEjs.bytesToHex.call(void 0, result);
|
35
35
|
}
|
36
36
|
|
37
37
|
// src/utils/ens/packetToBytes.ts
|
@@ -39,7 +39,7 @@ function packetToBytes(packet) {
|
|
39
39
|
function length(value2) {
|
40
40
|
if (value2 === "." || value2 === "..")
|
41
41
|
return 1;
|
42
|
-
return
|
42
|
+
return _chunk3FWCHYKEjs.toBytes.call(void 0, value2.replace(/^\.|\.$/gm, "")).length + 2;
|
43
43
|
}
|
44
44
|
const bytes = new Uint8Array(length(packet));
|
45
45
|
const value = packet.replace(/^\.|\.$/gm, "");
|
@@ -48,7 +48,7 @@ function packetToBytes(packet) {
|
|
48
48
|
let offset = 0;
|
49
49
|
const list = value.split(".");
|
50
50
|
for (let i = 0; i < list.length; i++) {
|
51
|
-
const encoded =
|
51
|
+
const encoded = _chunk3FWCHYKEjs.toBytes.call(void 0, list[i]);
|
52
52
|
bytes[offset] = encoded.length;
|
53
53
|
bytes.set(encoded, offset + 1);
|
54
54
|
offset += encoded.length + 1;
|
@@ -69,13 +69,13 @@ async function getEnsAddress(client, {
|
|
69
69
|
throw new Error(
|
70
70
|
"client chain not configured. universalResolverAddress is required."
|
71
71
|
);
|
72
|
-
universalResolverAddress =
|
72
|
+
universalResolverAddress = _chunk3FWCHYKEjs.getChainContractAddress.call(void 0, {
|
73
73
|
blockNumber,
|
74
74
|
chain: client.chain,
|
75
75
|
contract: "ensUniversalResolver"
|
76
76
|
});
|
77
77
|
}
|
78
|
-
const res = await
|
78
|
+
const res = await _chunk3FWCHYKEjs.readContract.call(void 0, client, {
|
79
79
|
address: universalResolverAddress,
|
80
80
|
abi: [
|
81
81
|
{
|
@@ -94,8 +94,8 @@ async function getEnsAddress(client, {
|
|
94
94
|
],
|
95
95
|
functionName: "resolve",
|
96
96
|
args: [
|
97
|
-
|
98
|
-
|
97
|
+
_chunk3FWCHYKEjs.toHex.call(void 0, packetToBytes(name)),
|
98
|
+
_chunk3FWCHYKEjs.encodeFunctionData.call(void 0, {
|
99
99
|
abi: [
|
100
100
|
{
|
101
101
|
name: "addr",
|
@@ -112,7 +112,7 @@ async function getEnsAddress(client, {
|
|
112
112
|
blockNumber,
|
113
113
|
blockTag
|
114
114
|
});
|
115
|
-
return
|
115
|
+
return _chunk3FWCHYKEjs.decodeFunctionResult.call(void 0, {
|
116
116
|
abi: [
|
117
117
|
{
|
118
118
|
name: "addr",
|
@@ -140,7 +140,7 @@ async function getEnsName(client, {
|
|
140
140
|
throw new Error(
|
141
141
|
"client chain not configured. universalResolverAddress is required."
|
142
142
|
);
|
143
|
-
universalResolverAddress =
|
143
|
+
universalResolverAddress = _chunk3FWCHYKEjs.getChainContractAddress.call(void 0, {
|
144
144
|
blockNumber,
|
145
145
|
chain: client.chain,
|
146
146
|
contract: "ensUniversalResolver"
|
@@ -148,7 +148,7 @@ async function getEnsName(client, {
|
|
148
148
|
}
|
149
149
|
const reverseNode = `${address.toLowerCase().substring(2)}.addr.reverse`;
|
150
150
|
try {
|
151
|
-
const res = await
|
151
|
+
const res = await _chunk3FWCHYKEjs.readContract.call(void 0, client, {
|
152
152
|
address: universalResolverAddress,
|
153
153
|
abi: [
|
154
154
|
{
|
@@ -165,13 +165,13 @@ async function getEnsName(client, {
|
|
165
165
|
}
|
166
166
|
],
|
167
167
|
functionName: "reverse",
|
168
|
-
args: [
|
168
|
+
args: [_chunk3FWCHYKEjs.toHex.call(void 0, packetToBytes(reverseNode))],
|
169
169
|
blockNumber,
|
170
170
|
blockTag
|
171
171
|
});
|
172
172
|
return res[0];
|
173
173
|
} catch (error) {
|
174
|
-
if (error instanceof
|
174
|
+
if (error instanceof _chunk3FWCHYKEjs.ContractFunctionExecutionError && error.cause.reason === _chunk3FWCHYKEjs.panicReasons[50])
|
175
175
|
return null;
|
176
176
|
throw error;
|
177
177
|
}
|
@@ -183,4 +183,4 @@ async function getEnsName(client, {
|
|
183
183
|
|
184
184
|
|
185
185
|
exports.labelhash = labelhash; exports.namehash = namehash; exports.getEnsAddress = getEnsAddress; exports.getEnsName = getEnsName;
|
186
|
-
//# sourceMappingURL=chunk-
|
186
|
+
//# sourceMappingURL=chunk-65E5HTFA.js.map
|
@@ -11,7 +11,7 @@ import {
|
|
11
11
|
stringToBytes,
|
12
12
|
toBytes,
|
13
13
|
toHex
|
14
|
-
} from "./chunk-
|
14
|
+
} from "./chunk-S4MOKUQW.mjs";
|
15
15
|
|
16
16
|
// src/utils/ens/labelhash.ts
|
17
17
|
function labelhash(label) {
|
@@ -183,4 +183,4 @@ export {
|
|
183
183
|
getEnsAddress,
|
184
184
|
getEnsName
|
185
185
|
};
|
186
|
-
//# sourceMappingURL=chunk-
|
186
|
+
//# sourceMappingURL=chunk-BJPR4EAT.mjs.map
|
@@ -17,7 +17,7 @@ import {
|
|
17
17
|
var package_default = {
|
18
18
|
name: "viem",
|
19
19
|
description: "TypeScript Interface for Ethereum",
|
20
|
-
version: "0.1.
|
20
|
+
version: "0.1.13",
|
21
21
|
scripts: {
|
22
22
|
anvil: "source .env && anvil --fork-url $VITE_ANVIL_FORK_URL --fork-block-number $VITE_ANVIL_BLOCK_NUMBER --block-time $VITE_ANVIL_BLOCK_TIME",
|
23
23
|
bench: "vitest bench --no-threads",
|
@@ -5317,6 +5317,8 @@ export {
|
|
5317
5317
|
TimeoutError,
|
5318
5318
|
UrlRequiredError,
|
5319
5319
|
concat,
|
5320
|
+
concatBytes,
|
5321
|
+
concatHex,
|
5320
5322
|
isBytes,
|
5321
5323
|
isHex,
|
5322
5324
|
pad,
|
@@ -5492,4 +5494,4 @@ export {
|
|
5492
5494
|
formatGwei,
|
5493
5495
|
parseEther
|
5494
5496
|
};
|
5495
|
-
//# sourceMappingURL=chunk-
|
5497
|
+
//# sourceMappingURL=chunk-S4MOKUQW.mjs.map
|