viem 0.2.0-canary.20230314T222417 → 0.2.0-canary.20230315T010233
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-4APUUDQK.js → chunk-BY6O7352.js} +8 -12
- package/dist/chunk-BY6O7352.js.map +1 -0
- package/dist/{chunk-NVOOOH72.mjs → chunk-CRUV4VWS.mjs} +2 -2
- package/dist/{chunk-FGHDFVEC.js → chunk-RTDQEACR.js} +19 -19
- package/dist/{chunk-MGOCDAKD.mjs → chunk-TC3TBWEH.mjs} +8 -12
- package/dist/chunk-TC3TBWEH.mjs.map +1 -0
- 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 +4 -4
- package/dist/ethers.js.map +1 -1
- package/dist/ethers.mjs +2 -2
- package/dist/ethers.mjs.map +1 -1
- package/dist/index.js +90 -90
- package/dist/index.mjs +2 -2
- 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.js +2 -2
- package/dist/utils/index.mjs +1 -1
- package/dist/wallet.js +2 -2
- package/dist/wallet.mjs +1 -1
- package/package.json +2 -2
- package/dist/chunk-4APUUDQK.js.map +0 -1
- package/dist/chunk-MGOCDAKD.mjs.map +0 -1
- /package/dist/{chunk-NVOOOH72.mjs.map → chunk-CRUV4VWS.mjs.map} +0 -0
- /package/dist/{chunk-FGHDFVEC.js.map → chunk-RTDQEACR.js.map} +0 -0
@@ -11,7 +11,7 @@ import {
|
|
11
11
|
stringToBytes,
|
12
12
|
toBytes,
|
13
13
|
toHex
|
14
|
-
} from "./chunk-
|
14
|
+
} from "./chunk-TC3TBWEH.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-CRUV4VWS.mjs.map
|
@@ -11,27 +11,27 @@
|
|
11
11
|
|
12
12
|
|
13
13
|
|
14
|
-
var
|
14
|
+
var _chunkBY6O7352js = require('./chunk-BY6O7352.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 _chunkBY6O7352js.bytesToHex.call(void 0, result);
|
21
|
+
return _chunkBY6O7352js.keccak256.call(void 0, _chunkBY6O7352js.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 _chunkBY6O7352js.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 = _chunkBY6O7352js.keccak256.call(void 0, _chunkBY6O7352js.stringToBytes.call(void 0, labels[i]), "bytes");
|
32
|
+
result = _chunkBY6O7352js.keccak256.call(void 0, _chunkBY6O7352js.concat.call(void 0, [result, hashed]), "bytes");
|
33
33
|
}
|
34
|
-
return
|
34
|
+
return _chunkBY6O7352js.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 _chunkBY6O7352js.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 = _chunkBY6O7352js.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 = _chunkBY6O7352js.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 _chunkBY6O7352js.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
|
+
_chunkBY6O7352js.toHex.call(void 0, packetToBytes(name)),
|
98
|
+
_chunkBY6O7352js.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 _chunkBY6O7352js.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 = _chunkBY6O7352js.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 _chunkBY6O7352js.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: [_chunkBY6O7352js.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 _chunkBY6O7352js.ContractFunctionExecutionError && error.cause.reason === _chunkBY6O7352js.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-RTDQEACR.js.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.18",
|
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",
|
@@ -138,7 +138,7 @@ var package_default = {
|
|
138
138
|
sideEffects: false,
|
139
139
|
dependencies: {
|
140
140
|
"@noble/hashes": "^1.1.2",
|
141
|
-
"@noble/
|
141
|
+
"@noble/curves": "^0.8.2",
|
142
142
|
"@wagmi/chains": "~0.2.11",
|
143
143
|
abitype: "~0.7.1",
|
144
144
|
"idna-uts46-hx": "^4.1.2",
|
@@ -3505,7 +3505,7 @@ ${messageBytes.length}`
|
|
3505
3505
|
}
|
3506
3506
|
|
3507
3507
|
// src/utils/signature/recoverAddress.ts
|
3508
|
-
import {
|
3508
|
+
import { secp256k1 } from "@noble/curves/secp256k1";
|
3509
3509
|
function recoverAddress({
|
3510
3510
|
hash: hash2,
|
3511
3511
|
signature
|
@@ -3513,14 +3513,10 @@ function recoverAddress({
|
|
3513
3513
|
const signatureHex = isHex(signature) ? signature : toHex(signature);
|
3514
3514
|
const hashHex = isHex(hash2) ? hash2 : toHex(hash2);
|
3515
3515
|
const v = hexToNumber(`0x${signatureHex.slice(130)}`);
|
3516
|
-
const publicKey =
|
3517
|
-
|
3518
|
-
|
3519
|
-
|
3520
|
-
v - 27
|
3521
|
-
)
|
3522
|
-
);
|
3523
|
-
const address = keccak256(`0x${publicKey.substring(4)}`).substring(26);
|
3516
|
+
const publicKey = secp256k1.Signature.fromCompact(
|
3517
|
+
signatureHex.substring(2, 130)
|
3518
|
+
).addRecoveryBit(v - 27).recoverPublicKey(hashHex.substring(2)).toHex(false);
|
3519
|
+
const address = keccak256(`0x${publicKey.substring(2)}`).substring(26);
|
3524
3520
|
return checksumAddress(`0x${address}`);
|
3525
3521
|
}
|
3526
3522
|
|
@@ -5590,4 +5586,4 @@ export {
|
|
5590
5586
|
formatGwei,
|
5591
5587
|
parseEther
|
5592
5588
|
};
|
5593
|
-
//# sourceMappingURL=chunk-
|
5589
|
+
//# sourceMappingURL=chunk-TC3TBWEH.mjs.map
|