viem 0.1.11 → 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.
Files changed (40) hide show
  1. package/dist/abi.js +2 -2
  2. package/dist/abi.mjs +1 -1
  3. package/dist/chains.js +63 -63
  4. package/dist/chains.mjs +1 -1
  5. package/dist/{chunk-YZCQ7AL7.js → chunk-3FWCHYKE.js} +12 -3
  6. package/dist/chunk-3FWCHYKE.js.map +1 -0
  7. package/dist/{chunk-ADJTWF45.js → chunk-65E5HTFA.js} +19 -19
  8. package/dist/{chunk-IAY6WXS3.mjs → chunk-BJPR4EAT.mjs} +2 -2
  9. package/dist/{chunk-H6AQHA74.mjs → chunk-S4MOKUQW.mjs} +11 -2
  10. package/dist/chunk-S4MOKUQW.mjs.map +1 -0
  11. package/dist/contract.js +2 -2
  12. package/dist/contract.mjs +1 -1
  13. package/dist/ens.js +3 -3
  14. package/dist/ens.mjs +2 -2
  15. package/dist/ethers.d.ts +29 -0
  16. package/dist/ethers.js +30 -0
  17. package/dist/ethers.js.map +1 -0
  18. package/dist/ethers.mjs +30 -0
  19. package/dist/ethers.mjs.map +1 -0
  20. package/dist/index.d.ts +2 -2
  21. package/dist/index.js +96 -90
  22. package/dist/index.js.map +1 -1
  23. package/dist/index.mjs +8 -2
  24. package/dist/index.mjs.map +1 -1
  25. package/dist/{parseGwei-faf061db.d.ts → parseGwei-a35c7c87.d.ts} +6 -1
  26. package/dist/public.js +2 -2
  27. package/dist/public.mjs +1 -1
  28. package/dist/test.js +2 -2
  29. package/dist/test.mjs +1 -1
  30. package/dist/utils/index.d.ts +2 -2
  31. package/dist/utils/index.js +8 -2
  32. package/dist/utils/index.mjs +7 -1
  33. package/dist/wallet.js +2 -2
  34. package/dist/wallet.mjs +1 -1
  35. package/ethers/package.json +4 -0
  36. package/package.json +7 -1
  37. package/dist/chunk-H6AQHA74.mjs.map +0 -1
  38. package/dist/chunk-YZCQ7AL7.js.map +0 -1
  39. /package/dist/{chunk-ADJTWF45.js.map → chunk-65E5HTFA.js.map} +0 -0
  40. /package/dist/{chunk-IAY6WXS3.mjs.map → chunk-BJPR4EAT.mjs.map} +0 -0
@@ -11,27 +11,27 @@
11
11
 
12
12
 
13
13
 
14
- var _chunkYZCQ7AL7js = require('./chunk-YZCQ7AL7.js');
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 _chunkYZCQ7AL7js.bytesToHex.call(void 0, result);
21
- return _chunkYZCQ7AL7js.keccak256.call(void 0, _chunkYZCQ7AL7js.stringToBytes.call(void 0, label));
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 _chunkYZCQ7AL7js.bytesToHex.call(void 0, result);
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 = _chunkYZCQ7AL7js.keccak256.call(void 0, _chunkYZCQ7AL7js.stringToBytes.call(void 0, labels[i]), "bytes");
32
- result = _chunkYZCQ7AL7js.keccak256.call(void 0, _chunkYZCQ7AL7js.concat.call(void 0, [result, hashed]), "bytes");
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 _chunkYZCQ7AL7js.bytesToHex.call(void 0, result);
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 _chunkYZCQ7AL7js.toBytes.call(void 0, value2.replace(/^\.|\.$/gm, "")).length + 2;
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 = _chunkYZCQ7AL7js.toBytes.call(void 0, list[i]);
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 = _chunkYZCQ7AL7js.getChainContractAddress.call(void 0, {
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 _chunkYZCQ7AL7js.readContract.call(void 0, client, {
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
- _chunkYZCQ7AL7js.toHex.call(void 0, packetToBytes(name)),
98
- _chunkYZCQ7AL7js.encodeFunctionData.call(void 0, {
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 _chunkYZCQ7AL7js.decodeFunctionResult.call(void 0, {
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 = _chunkYZCQ7AL7js.getChainContractAddress.call(void 0, {
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 _chunkYZCQ7AL7js.readContract.call(void 0, client, {
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: [_chunkYZCQ7AL7js.toHex.call(void 0, packetToBytes(reverseNode))],
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 _chunkYZCQ7AL7js.ContractFunctionExecutionError && error.cause.reason === _chunkYZCQ7AL7js.panicReasons[50])
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-ADJTWF45.js.map
186
+ //# sourceMappingURL=chunk-65E5HTFA.js.map
@@ -11,7 +11,7 @@ import {
11
11
  stringToBytes,
12
12
  toBytes,
13
13
  toHex
14
- } from "./chunk-H6AQHA74.mjs";
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-IAY6WXS3.mjs.map
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.11",
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",
@@ -52,6 +52,7 @@ var package_default = {
52
52
  "src/chains.ts",
53
53
  "src/contract.ts",
54
54
  "src/ens.ts",
55
+ "src/ethers.ts",
55
56
  "src/public.ts",
56
57
  "src/test.ts",
57
58
  "src/utils/index.ts",
@@ -65,6 +66,7 @@ var package_default = {
65
66
  "/chains",
66
67
  "/contract",
67
68
  "/ens",
69
+ "/ethers",
68
70
  "/public",
69
71
  "/test",
70
72
  "/utils",
@@ -97,6 +99,11 @@ var package_default = {
97
99
  module: "./dist/ens.mts",
98
100
  default: "./dist/ens.js"
99
101
  },
102
+ "./ethers": {
103
+ types: "./dist/ethers.d.ts",
104
+ module: "./dist/ethers.mts",
105
+ default: "./dist/ethers.js"
106
+ },
100
107
  "./public": {
101
108
  types: "./dist/public.d.ts",
102
109
  module: "./dist/public.mts",
@@ -5310,6 +5317,8 @@ export {
5310
5317
  TimeoutError,
5311
5318
  UrlRequiredError,
5312
5319
  concat,
5320
+ concatBytes,
5321
+ concatHex,
5313
5322
  isBytes,
5314
5323
  isHex,
5315
5324
  pad,
@@ -5485,4 +5494,4 @@ export {
5485
5494
  formatGwei,
5486
5495
  parseEther
5487
5496
  };
5488
- //# sourceMappingURL=chunk-H6AQHA74.mjs.map
5497
+ //# sourceMappingURL=chunk-S4MOKUQW.mjs.map