viem 0.0.1-alpha.36 → 0.0.1-alpha.37

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.
@@ -11,7 +11,7 @@ import {
11
11
  stringToBytes,
12
12
  toBytes,
13
13
  toHex
14
- } from "./chunk-AXATFOBJ.mjs";
14
+ } from "./chunk-WVZFIDQ5.mjs";
15
15
 
16
16
  // src/utils/ens/labelhash.ts
17
17
  function labelhash(label) {
@@ -205,4 +205,4 @@ export {
205
205
  getEnsAddress,
206
206
  getEnsName
207
207
  };
208
- //# sourceMappingURL=chunk-CUT73KXY.mjs.map
208
+ //# sourceMappingURL=chunk-AS2YWIFN.mjs.map
@@ -11,27 +11,27 @@
11
11
 
12
12
 
13
13
 
14
- var _chunkKXGQFW2Rjs = require('./chunk-KXGQFW2R.js');
14
+ var _chunk534U2FZGjs = require('./chunk-534U2FZG.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 _chunkKXGQFW2Rjs.bytesToHex.call(void 0, result);
21
- return _chunkKXGQFW2Rjs.keccak256.call(void 0, _chunkKXGQFW2Rjs.stringToBytes.call(void 0, label));
20
+ return _chunk534U2FZGjs.bytesToHex.call(void 0, result);
21
+ return _chunk534U2FZGjs.keccak256.call(void 0, _chunk534U2FZGjs.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 _chunkKXGQFW2Rjs.bytesToHex.call(void 0, result);
28
+ return _chunk534U2FZGjs.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 = _chunkKXGQFW2Rjs.keccak256.call(void 0, _chunkKXGQFW2Rjs.stringToBytes.call(void 0, labels[i]), "bytes");
32
- result = _chunkKXGQFW2Rjs.keccak256.call(void 0, _chunkKXGQFW2Rjs.concat.call(void 0, [result, hashed]), "bytes");
31
+ const hashed = _chunk534U2FZGjs.keccak256.call(void 0, _chunk534U2FZGjs.stringToBytes.call(void 0, labels[i]), "bytes");
32
+ result = _chunk534U2FZGjs.keccak256.call(void 0, _chunk534U2FZGjs.concat.call(void 0, [result, hashed]), "bytes");
33
33
  }
34
- return _chunkKXGQFW2Rjs.bytesToHex.call(void 0, result);
34
+ return _chunk534U2FZGjs.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 _chunkKXGQFW2Rjs.toBytes.call(void 0, value2.replace(/^\.|\.$/gm, "")).length + 2;
42
+ return _chunk534U2FZGjs.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 = _chunkKXGQFW2Rjs.toBytes.call(void 0, list[i]);
51
+ const encoded = _chunk534U2FZGjs.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;
@@ -71,12 +71,12 @@ async function getEnsAddress(client, {
71
71
  );
72
72
  const contract = _optionalChain([client, 'access', _ => _.chain, 'optionalAccess', _2 => _2.contracts, 'optionalAccess', _3 => _3.ensUniversalResolver]);
73
73
  if (!contract)
74
- throw new (0, _chunkKXGQFW2Rjs.ChainDoesNotSupportContract)({
74
+ throw new (0, _chunk534U2FZGjs.ChainDoesNotSupportContract)({
75
75
  chain: client.chain,
76
76
  contract: { name: "ensUniversalResolver" }
77
77
  });
78
78
  if (blockNumber && contract.blockCreated && contract.blockCreated > blockNumber)
79
- throw new (0, _chunkKXGQFW2Rjs.ChainDoesNotSupportContract)({
79
+ throw new (0, _chunk534U2FZGjs.ChainDoesNotSupportContract)({
80
80
  blockNumber,
81
81
  chain: client.chain,
82
82
  contract: {
@@ -86,7 +86,7 @@ async function getEnsAddress(client, {
86
86
  });
87
87
  universalResolverAddress = contract.address;
88
88
  }
89
- const res = await _chunkKXGQFW2Rjs.readContract.call(void 0, client, {
89
+ const res = await _chunk534U2FZGjs.readContract.call(void 0, client, {
90
90
  address: universalResolverAddress,
91
91
  abi: [
92
92
  {
@@ -105,8 +105,8 @@ async function getEnsAddress(client, {
105
105
  ],
106
106
  functionName: "resolve",
107
107
  args: [
108
- _chunkKXGQFW2Rjs.toHex.call(void 0, packetToBytes(name)),
109
- _chunkKXGQFW2Rjs.encodeFunctionData.call(void 0, {
108
+ _chunk534U2FZGjs.toHex.call(void 0, packetToBytes(name)),
109
+ _chunk534U2FZGjs.encodeFunctionData.call(void 0, {
110
110
  abi: [
111
111
  {
112
112
  name: "addr",
@@ -123,7 +123,7 @@ async function getEnsAddress(client, {
123
123
  blockNumber,
124
124
  blockTag
125
125
  });
126
- return _chunkKXGQFW2Rjs.decodeFunctionResult.call(void 0, {
126
+ return _chunk534U2FZGjs.decodeFunctionResult.call(void 0, {
127
127
  abi: [
128
128
  {
129
129
  name: "addr",
@@ -153,12 +153,12 @@ async function getEnsName(client, {
153
153
  );
154
154
  const contract = _optionalChain([client, 'access', _4 => _4.chain, 'optionalAccess', _5 => _5.contracts, 'optionalAccess', _6 => _6.ensUniversalResolver]);
155
155
  if (!contract)
156
- throw new (0, _chunkKXGQFW2Rjs.ChainDoesNotSupportContract)({
156
+ throw new (0, _chunk534U2FZGjs.ChainDoesNotSupportContract)({
157
157
  chain: client.chain,
158
158
  contract: { name: "ensUniversalResolver" }
159
159
  });
160
160
  if (blockNumber && contract.blockCreated && contract.blockCreated > blockNumber)
161
- throw new (0, _chunkKXGQFW2Rjs.ChainDoesNotSupportContract)({
161
+ throw new (0, _chunk534U2FZGjs.ChainDoesNotSupportContract)({
162
162
  blockNumber,
163
163
  chain: client.chain,
164
164
  contract: {
@@ -170,7 +170,7 @@ async function getEnsName(client, {
170
170
  }
171
171
  const reverseNode = `${address.toLowerCase().substring(2)}.addr.reverse`;
172
172
  try {
173
- const res = await _chunkKXGQFW2Rjs.readContract.call(void 0, client, {
173
+ const res = await _chunk534U2FZGjs.readContract.call(void 0, client, {
174
174
  address: universalResolverAddress,
175
175
  abi: [
176
176
  {
@@ -187,13 +187,13 @@ async function getEnsName(client, {
187
187
  }
188
188
  ],
189
189
  functionName: "reverse",
190
- args: [_chunkKXGQFW2Rjs.toHex.call(void 0, packetToBytes(reverseNode))],
190
+ args: [_chunk534U2FZGjs.toHex.call(void 0, packetToBytes(reverseNode))],
191
191
  blockNumber,
192
192
  blockTag
193
193
  });
194
194
  return res[0];
195
195
  } catch (error) {
196
- if (error instanceof _chunkKXGQFW2Rjs.ContractFunctionExecutionError && error.cause.reason === _chunkKXGQFW2Rjs.panicReasons[50])
196
+ if (error instanceof _chunk534U2FZGjs.ContractFunctionExecutionError && error.cause.reason === _chunk534U2FZGjs.panicReasons[50])
197
197
  return null;
198
198
  throw error;
199
199
  }
@@ -205,4 +205,4 @@ async function getEnsName(client, {
205
205
 
206
206
 
207
207
  exports.labelhash = labelhash; exports.namehash = namehash; exports.getEnsAddress = getEnsAddress; exports.getEnsName = getEnsName;
208
- //# sourceMappingURL=chunk-4AEFOF5R.js.map
208
+ //# sourceMappingURL=chunk-JXFHSHM6.js.map
@@ -9,7 +9,7 @@ var __publicField = (obj, key, value) => {
9
9
  var package_default = {
10
10
  name: "viem",
11
11
  description: "TypeScript Interface for Ethereum",
12
- version: "0.0.1-alpha.36",
12
+ version: "0.0.1-alpha.37",
13
13
  scripts: {
14
14
  anvil: "source .env && anvil --fork-url $VITE_ANVIL_FORK_URL --fork-block-number $VITE_ANVIL_BLOCK_NUMBER --block-time $VITE_ANVIL_BLOCK_TIME",
15
15
  bench: "vitest bench --no-threads",
@@ -4860,8 +4860,8 @@ async function writeContract(client, {
4860
4860
  return hash2;
4861
4861
  }
4862
4862
 
4863
- // src/utils/unit/parseUnit.ts
4864
- function parseUnit(value, decimals) {
4863
+ // src/utils/unit/parseUnits.ts
4864
+ function parseUnits(value, decimals) {
4865
4865
  let [integer, fraction = "0"] = value.split(".");
4866
4866
  const negative = integer.startsWith("-");
4867
4867
  if (negative)
@@ -4884,7 +4884,7 @@ function parseUnit(value, decimals) {
4884
4884
 
4885
4885
  // src/utils/unit/parseGwei.ts
4886
4886
  function parseGwei(ether, unit = "wei") {
4887
- return parseUnit(ether, gweiUnits[unit]);
4887
+ return parseUnits(ether, gweiUnits[unit]);
4888
4888
  }
4889
4889
 
4890
4890
  // src/utils/transaction/prepareRequest.ts
@@ -4927,8 +4927,8 @@ async function prepareRequest(client, args) {
4927
4927
  return request;
4928
4928
  }
4929
4929
 
4930
- // src/utils/unit/formatUnit.ts
4931
- function formatUnit(value, decimals) {
4930
+ // src/utils/unit/formatUnits.ts
4931
+ function formatUnits(value, decimals) {
4932
4932
  let display = value.toString();
4933
4933
  const negative = display.startsWith("-");
4934
4934
  if (negative)
@@ -4944,17 +4944,17 @@ function formatUnit(value, decimals) {
4944
4944
 
4945
4945
  // src/utils/unit/formatEther.ts
4946
4946
  function formatEther(wei, unit = "wei") {
4947
- return formatUnit(wei, etherUnits[unit]);
4947
+ return formatUnits(wei, etherUnits[unit]);
4948
4948
  }
4949
4949
 
4950
4950
  // src/utils/unit/formatGwei.ts
4951
4951
  function formatGwei(wei, unit = "wei") {
4952
- return formatUnit(wei, gweiUnits[unit]);
4952
+ return formatUnits(wei, gweiUnits[unit]);
4953
4953
  }
4954
4954
 
4955
4955
  // src/utils/unit/parseEther.ts
4956
4956
  function parseEther(ether, unit = "wei") {
4957
- return parseUnit(ether, etherUnits[unit]);
4957
+ return parseUnits(ether, etherUnits[unit]);
4958
4958
  }
4959
4959
 
4960
4960
  export {
@@ -5195,12 +5195,12 @@ export {
5195
5195
  switchChain,
5196
5196
  watchAsset,
5197
5197
  writeContract,
5198
- parseUnit,
5198
+ parseUnits,
5199
5199
  parseGwei,
5200
5200
  prepareRequest,
5201
- formatUnit,
5201
+ formatUnits,
5202
5202
  formatEther,
5203
5203
  formatGwei,
5204
5204
  parseEther
5205
5205
  };
5206
- //# sourceMappingURL=chunk-AXATFOBJ.mjs.map
5206
+ //# sourceMappingURL=chunk-WVZFIDQ5.mjs.map