viem 0.1.1 → 0.1.3

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/README.md CHANGED
@@ -1,9 +1,11 @@
1
- <p align="center">
2
- <picture>
3
- <source media="(prefers-color-scheme: dark)" srcset="https://github.com/wagmi-dev/viem/blob/main/.github/gh-logo-dark.svg">
4
- <img alt="viem logo" src="https://github.com/wagmi-dev/viem/blob/main/.github/gh-logo-light.svg" width="auto" height="60">
5
- </picture>
6
- </p>
1
+ <a href="https://viem.sh">
2
+ <p align="center">
3
+ <picture>
4
+ <source media="(prefers-color-scheme: dark)" srcset="https://github.com/wagmi-dev/viem/blob/main/.github/gh-logo-dark.svg">
5
+ <img alt="viem logo" src="https://github.com/wagmi-dev/viem/blob/main/.github/gh-logo-light.svg" width="auto" height="60">
6
+ </picture>
7
+ </p>
8
+ </a>
7
9
 
8
10
  <p align="center">
9
11
  TypeScript Interface for Ethereum
package/dist/abi.js CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
 
9
9
 
10
- var _chunkPZIHILNKjs = require('./chunk-PZIHILNK.js');
10
+ var _chunkZ62X7UMWjs = require('./chunk-Z62X7UMW.js');
11
11
 
12
12
 
13
13
 
@@ -17,5 +17,5 @@ var _chunkPZIHILNKjs = require('./chunk-PZIHILNK.js');
17
17
 
18
18
 
19
19
 
20
- exports.decodeAbiParameters = _chunkPZIHILNKjs.decodeAbiParameters; exports.encodeAbiParameters = _chunkPZIHILNKjs.encodeAbiParameters; exports.encodePacked = _chunkPZIHILNKjs.encodePacked; exports.getAbiItem = _chunkPZIHILNKjs.getAbiItem; exports.parseAbi = _chunkPZIHILNKjs.parseAbi; exports.parseAbiItem = _chunkPZIHILNKjs.parseAbiItem; exports.parseAbiParameter = _chunkPZIHILNKjs.parseAbiParameter; exports.parseAbiParameters = _chunkPZIHILNKjs.parseAbiParameters;
20
+ exports.decodeAbiParameters = _chunkZ62X7UMWjs.decodeAbiParameters; exports.encodeAbiParameters = _chunkZ62X7UMWjs.encodeAbiParameters; exports.encodePacked = _chunkZ62X7UMWjs.encodePacked; exports.getAbiItem = _chunkZ62X7UMWjs.getAbiItem; exports.parseAbi = _chunkZ62X7UMWjs.parseAbi; exports.parseAbiItem = _chunkZ62X7UMWjs.parseAbiItem; exports.parseAbiParameter = _chunkZ62X7UMWjs.parseAbiParameter; exports.parseAbiParameters = _chunkZ62X7UMWjs.parseAbiParameters;
21
21
  //# sourceMappingURL=abi.js.map
package/dist/abi.mjs CHANGED
@@ -7,7 +7,7 @@ import {
7
7
  parseAbiItem,
8
8
  parseAbiParameter,
9
9
  parseAbiParameters
10
- } from "./chunk-HDZRBHNX.mjs";
10
+ } from "./chunk-UJYIRVKR.mjs";
11
11
  export {
12
12
  decodeAbiParameters,
13
13
  encodeAbiParameters,
package/dist/chains.js CHANGED
@@ -4,32 +4,32 @@
4
4
 
5
5
 
6
6
 
7
- var _chunkPZIHILNKjs = require('./chunk-PZIHILNK.js');
7
+ var _chunkZ62X7UMWjs = require('./chunk-Z62X7UMW.js');
8
8
 
9
9
  // src/chains.ts
10
10
  var _chains = require('@wagmi/chains'); var chains = _interopRequireWildcard(_chains);
11
11
  var celoFormatters = {
12
- block: _chunkPZIHILNKjs.defineBlock.call(void 0, {
12
+ block: _chunkZ62X7UMWjs.defineBlock.call(void 0, {
13
13
  exclude: ["difficulty", "gasLimit", "mixHash", "nonce", "uncles"],
14
14
  format: (block) => ({
15
15
  randomness: block.randomness
16
16
  })
17
17
  }),
18
- transaction: _chunkPZIHILNKjs.defineTransaction.call(void 0, {
18
+ transaction: _chunkZ62X7UMWjs.defineTransaction.call(void 0, {
19
19
  format: (transaction) => ({
20
20
  feeCurrency: transaction.feeCurrency,
21
21
  gatewayFee: transaction.gatewayFee ? BigInt(transaction.gatewayFee) : null,
22
22
  gatewayFeeRecipient: transaction.gatewayFeeRecipient
23
23
  })
24
24
  }),
25
- transactionReceipt: _chunkPZIHILNKjs.defineTransactionReceipt.call(void 0, {
25
+ transactionReceipt: _chunkZ62X7UMWjs.defineTransactionReceipt.call(void 0, {
26
26
  format: (transaction) => ({
27
27
  feeCurrency: transaction.feeCurrency,
28
28
  gatewayFee: transaction.gatewayFee ? BigInt(transaction.gatewayFee) : null,
29
29
  gatewayFeeRecipient: transaction.gatewayFeeRecipient
30
30
  })
31
31
  }),
32
- transactionRequest: _chunkPZIHILNKjs.defineTransactionRequest.call(void 0, {
32
+ transactionRequest: _chunkZ62X7UMWjs.defineTransactionRequest.call(void 0, {
33
33
  format: (transactionRequest) => ({
34
34
  feeCurrency: transactionRequest.feeCurrency,
35
35
  gatewayFee: transactionRequest.gatewayFee,
@@ -37,52 +37,52 @@ var celoFormatters = {
37
37
  })
38
38
  })
39
39
  };
40
- var arbitrum2 = _chunkPZIHILNKjs.defineChain.call(void 0, chains.arbitrum);
41
- var arbitrumGoerli2 = _chunkPZIHILNKjs.defineChain.call(void 0, chains.arbitrumGoerli);
42
- var aurora2 = _chunkPZIHILNKjs.defineChain.call(void 0, chains.aurora);
43
- var auroraGoerli = _chunkPZIHILNKjs.defineChain.call(void 0, chains.auroraTestnet);
44
- var avalanche2 = _chunkPZIHILNKjs.defineChain.call(void 0, chains.avalanche);
45
- var avalancheFuji2 = _chunkPZIHILNKjs.defineChain.call(void 0, chains.avalancheFuji);
46
- var bronos2 = _chunkPZIHILNKjs.defineChain.call(void 0, chains.bronos);
47
- var bronosTestnet2 = _chunkPZIHILNKjs.defineChain.call(void 0, chains.bronosTestnet);
48
- var bsc2 = _chunkPZIHILNKjs.defineChain.call(void 0, chains.bsc);
49
- var bscTestnet2 = _chunkPZIHILNKjs.defineChain.call(void 0, chains.bscTestnet);
50
- var canto2 = _chunkPZIHILNKjs.defineChain.call(void 0, chains.canto);
51
- var celo2 = _chunkPZIHILNKjs.defineChain.call(void 0, {
40
+ var arbitrum2 = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.arbitrum);
41
+ var arbitrumGoerli2 = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.arbitrumGoerli);
42
+ var aurora2 = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.aurora);
43
+ var auroraGoerli = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.auroraTestnet);
44
+ var avalanche2 = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.avalanche);
45
+ var avalancheFuji2 = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.avalancheFuji);
46
+ var bronos2 = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.bronos);
47
+ var bronosTestnet2 = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.bronosTestnet);
48
+ var bsc2 = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.bsc);
49
+ var bscTestnet2 = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.bscTestnet);
50
+ var canto2 = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.canto);
51
+ var celo2 = _chunkZ62X7UMWjs.defineChain.call(void 0, {
52
52
  ...chains.celo,
53
53
  formatters: celoFormatters
54
54
  });
55
- var celoAlfajores2 = _chunkPZIHILNKjs.defineChain.call(void 0, {
55
+ var celoAlfajores2 = _chunkZ62X7UMWjs.defineChain.call(void 0, {
56
56
  ...chains.celoAlfajores,
57
57
  formatters: celoFormatters
58
58
  });
59
- var crossbell2 = _chunkPZIHILNKjs.defineChain.call(void 0, chains.crossbell);
60
- var evmos2 = _chunkPZIHILNKjs.defineChain.call(void 0, chains.evmos);
61
- var evmosTestnet2 = _chunkPZIHILNKjs.defineChain.call(void 0, chains.evmosTestnet);
62
- var fantom2 = _chunkPZIHILNKjs.defineChain.call(void 0, chains.fantom);
63
- var fantomTestnet2 = _chunkPZIHILNKjs.defineChain.call(void 0, chains.fantomTestnet);
64
- var filecoin2 = _chunkPZIHILNKjs.defineChain.call(void 0, chains.filecoin);
65
- var filecoinTestnet = _chunkPZIHILNKjs.defineChain.call(void 0, chains.filecoinHyperspace);
66
- var foundry2 = _chunkPZIHILNKjs.defineChain.call(void 0, chains.foundry);
67
- var goerli2 = _chunkPZIHILNKjs.defineChain.call(void 0, chains.goerli);
68
- var gnosis2 = _chunkPZIHILNKjs.defineChain.call(void 0, chains.gnosis);
69
- var gnosisChiado2 = _chunkPZIHILNKjs.defineChain.call(void 0, chains.gnosisChiado);
70
- var hardhat2 = _chunkPZIHILNKjs.defineChain.call(void 0, chains.hardhat);
71
- var iotex2 = _chunkPZIHILNKjs.defineChain.call(void 0, chains.iotex);
72
- var iotexTestnet2 = _chunkPZIHILNKjs.defineChain.call(void 0, chains.iotexTestnet);
73
- var localhost2 = _chunkPZIHILNKjs.defineChain.call(void 0, chains.localhost);
74
- var mainnet2 = _chunkPZIHILNKjs.defineChain.call(void 0, chains.mainnet);
75
- var metis2 = _chunkPZIHILNKjs.defineChain.call(void 0, chains.metis);
76
- var metisGoerli2 = _chunkPZIHILNKjs.defineChain.call(void 0, chains.metisGoerli);
77
- var optimism2 = _chunkPZIHILNKjs.defineChain.call(void 0, chains.optimism);
78
- var optimismGoerli2 = _chunkPZIHILNKjs.defineChain.call(void 0, chains.optimismGoerli);
79
- var polygon2 = _chunkPZIHILNKjs.defineChain.call(void 0, chains.polygon);
80
- var polygonMumbai2 = _chunkPZIHILNKjs.defineChain.call(void 0, chains.polygonMumbai);
81
- var sepolia2 = _chunkPZIHILNKjs.defineChain.call(void 0, chains.sepolia);
82
- var taraxa2 = _chunkPZIHILNKjs.defineChain.call(void 0, chains.taraxa);
83
- var taraxaTestnet2 = _chunkPZIHILNKjs.defineChain.call(void 0, chains.taraxaTestnet);
84
- var zkSync2 = _chunkPZIHILNKjs.defineChain.call(void 0, chains.zkSync);
85
- var zkSyncTestnet2 = _chunkPZIHILNKjs.defineChain.call(void 0, chains.zkSyncTestnet);
59
+ var crossbell2 = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.crossbell);
60
+ var evmos2 = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.evmos);
61
+ var evmosTestnet2 = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.evmosTestnet);
62
+ var fantom2 = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.fantom);
63
+ var fantomTestnet2 = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.fantomTestnet);
64
+ var filecoin2 = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.filecoin);
65
+ var filecoinTestnet = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.filecoinHyperspace);
66
+ var foundry2 = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.foundry);
67
+ var goerli2 = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.goerli);
68
+ var gnosis2 = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.gnosis);
69
+ var gnosisChiado2 = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.gnosisChiado);
70
+ var hardhat2 = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.hardhat);
71
+ var iotex2 = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.iotex);
72
+ var iotexTestnet2 = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.iotexTestnet);
73
+ var localhost2 = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.localhost);
74
+ var mainnet2 = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.mainnet);
75
+ var metis2 = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.metis);
76
+ var metisGoerli2 = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.metisGoerli);
77
+ var optimism2 = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.optimism);
78
+ var optimismGoerli2 = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.optimismGoerli);
79
+ var polygon2 = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.polygon);
80
+ var polygonMumbai2 = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.polygonMumbai);
81
+ var sepolia2 = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.sepolia);
82
+ var taraxa2 = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.taraxa);
83
+ var taraxaTestnet2 = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.taraxaTestnet);
84
+ var zkSync2 = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.zkSync);
85
+ var zkSyncTestnet2 = _chunkZ62X7UMWjs.defineChain.call(void 0, chains.zkSyncTestnet);
86
86
 
87
87
 
88
88
 
@@ -125,5 +125,5 @@ var zkSyncTestnet2 = _chunkPZIHILNKjs.defineChain.call(void 0, chains.zkSyncTest
125
125
 
126
126
 
127
127
 
128
- exports.arbitrum = arbitrum2; exports.arbitrumGoerli = arbitrumGoerli2; exports.aurora = aurora2; exports.auroraGoerli = auroraGoerli; exports.avalanche = avalanche2; exports.avalancheFuji = avalancheFuji2; exports.bronos = bronos2; exports.bronosTestnet = bronosTestnet2; exports.bsc = bsc2; exports.bscTestnet = bscTestnet2; exports.canto = canto2; exports.celo = celo2; exports.celoAlfajores = celoAlfajores2; exports.crossbell = crossbell2; exports.defineChain = _chunkPZIHILNKjs.defineChain; exports.evmos = evmos2; exports.evmosTestnet = evmosTestnet2; exports.fantom = fantom2; exports.fantomTestnet = fantomTestnet2; exports.filecoin = filecoin2; exports.filecoinTestnet = filecoinTestnet; exports.foundry = foundry2; exports.gnosis = gnosis2; exports.gnosisChiado = gnosisChiado2; exports.goerli = goerli2; exports.hardhat = hardhat2; exports.iotex = iotex2; exports.iotexTestnet = iotexTestnet2; exports.localhost = localhost2; exports.mainnet = mainnet2; exports.metis = metis2; exports.metisGoerli = metisGoerli2; exports.optimism = optimism2; exports.optimismGoerli = optimismGoerli2; exports.polygon = polygon2; exports.polygonMumbai = polygonMumbai2; exports.sepolia = sepolia2; exports.taraxa = taraxa2; exports.taraxaTestnet = taraxaTestnet2; exports.zkSync = zkSync2; exports.zkSyncTestnet = zkSyncTestnet2;
128
+ exports.arbitrum = arbitrum2; exports.arbitrumGoerli = arbitrumGoerli2; exports.aurora = aurora2; exports.auroraGoerli = auroraGoerli; exports.avalanche = avalanche2; exports.avalancheFuji = avalancheFuji2; exports.bronos = bronos2; exports.bronosTestnet = bronosTestnet2; exports.bsc = bsc2; exports.bscTestnet = bscTestnet2; exports.canto = canto2; exports.celo = celo2; exports.celoAlfajores = celoAlfajores2; exports.crossbell = crossbell2; exports.defineChain = _chunkZ62X7UMWjs.defineChain; exports.evmos = evmos2; exports.evmosTestnet = evmosTestnet2; exports.fantom = fantom2; exports.fantomTestnet = fantomTestnet2; exports.filecoin = filecoin2; exports.filecoinTestnet = filecoinTestnet; exports.foundry = foundry2; exports.gnosis = gnosis2; exports.gnosisChiado = gnosisChiado2; exports.goerli = goerli2; exports.hardhat = hardhat2; exports.iotex = iotex2; exports.iotexTestnet = iotexTestnet2; exports.localhost = localhost2; exports.mainnet = mainnet2; exports.metis = metis2; exports.metisGoerli = metisGoerli2; exports.optimism = optimism2; exports.optimismGoerli = optimismGoerli2; exports.polygon = polygon2; exports.polygonMumbai = polygonMumbai2; exports.sepolia = sepolia2; exports.taraxa = taraxa2; exports.taraxaTestnet = taraxaTestnet2; exports.zkSync = zkSync2; exports.zkSyncTestnet = zkSyncTestnet2;
129
129
  //# sourceMappingURL=chains.js.map
package/dist/chains.mjs CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  defineTransaction,
5
5
  defineTransactionReceipt,
6
6
  defineTransactionRequest
7
- } from "./chunk-HDZRBHNX.mjs";
7
+ } from "./chunk-UJYIRVKR.mjs";
8
8
 
9
9
  // src/chains.ts
10
10
  import * as chains from "@wagmi/chains";
@@ -11,27 +11,27 @@
11
11
 
12
12
 
13
13
 
14
- var _chunkPZIHILNKjs = require('./chunk-PZIHILNK.js');
14
+ var _chunkZ62X7UMWjs = require('./chunk-Z62X7UMW.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 _chunkPZIHILNKjs.bytesToHex.call(void 0, result);
21
- return _chunkPZIHILNKjs.keccak256.call(void 0, _chunkPZIHILNKjs.stringToBytes.call(void 0, label));
20
+ return _chunkZ62X7UMWjs.bytesToHex.call(void 0, result);
21
+ return _chunkZ62X7UMWjs.keccak256.call(void 0, _chunkZ62X7UMWjs.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 _chunkPZIHILNKjs.bytesToHex.call(void 0, result);
28
+ return _chunkZ62X7UMWjs.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 = _chunkPZIHILNKjs.keccak256.call(void 0, _chunkPZIHILNKjs.stringToBytes.call(void 0, labels[i]), "bytes");
32
- result = _chunkPZIHILNKjs.keccak256.call(void 0, _chunkPZIHILNKjs.concat.call(void 0, [result, hashed]), "bytes");
31
+ const hashed = _chunkZ62X7UMWjs.keccak256.call(void 0, _chunkZ62X7UMWjs.stringToBytes.call(void 0, labels[i]), "bytes");
32
+ result = _chunkZ62X7UMWjs.keccak256.call(void 0, _chunkZ62X7UMWjs.concat.call(void 0, [result, hashed]), "bytes");
33
33
  }
34
- return _chunkPZIHILNKjs.bytesToHex.call(void 0, result);
34
+ return _chunkZ62X7UMWjs.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 _chunkPZIHILNKjs.toBytes.call(void 0, value2.replace(/^\.|\.$/gm, "")).length + 2;
42
+ return _chunkZ62X7UMWjs.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 = _chunkPZIHILNKjs.toBytes.call(void 0, list[i]);
51
+ const encoded = _chunkZ62X7UMWjs.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, _chunkPZIHILNKjs.ChainDoesNotSupportContract)({
74
+ throw new (0, _chunkZ62X7UMWjs.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, _chunkPZIHILNKjs.ChainDoesNotSupportContract)({
79
+ throw new (0, _chunkZ62X7UMWjs.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 _chunkPZIHILNKjs.readContract.call(void 0, client, {
89
+ const res = await _chunkZ62X7UMWjs.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
- _chunkPZIHILNKjs.toHex.call(void 0, packetToBytes(name)),
109
- _chunkPZIHILNKjs.encodeFunctionData.call(void 0, {
108
+ _chunkZ62X7UMWjs.toHex.call(void 0, packetToBytes(name)),
109
+ _chunkZ62X7UMWjs.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 _chunkPZIHILNKjs.decodeFunctionResult.call(void 0, {
126
+ return _chunkZ62X7UMWjs.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, _chunkPZIHILNKjs.ChainDoesNotSupportContract)({
156
+ throw new (0, _chunkZ62X7UMWjs.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, _chunkPZIHILNKjs.ChainDoesNotSupportContract)({
161
+ throw new (0, _chunkZ62X7UMWjs.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 _chunkPZIHILNKjs.readContract.call(void 0, client, {
173
+ const res = await _chunkZ62X7UMWjs.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: [_chunkPZIHILNKjs.toHex.call(void 0, packetToBytes(reverseNode))],
190
+ args: [_chunkZ62X7UMWjs.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 _chunkPZIHILNKjs.ContractFunctionExecutionError && error.cause.reason === _chunkPZIHILNKjs.panicReasons[50])
196
+ if (error instanceof _chunkZ62X7UMWjs.ContractFunctionExecutionError && error.cause.reason === _chunkZ62X7UMWjs.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-NM6QXEYF.js.map
208
+ //# sourceMappingURL=chunk-MC6HQXR7.js.map
@@ -11,7 +11,7 @@ import {
11
11
  stringToBytes,
12
12
  toBytes,
13
13
  toHex
14
- } from "./chunk-HDZRBHNX.mjs";
14
+ } from "./chunk-UJYIRVKR.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-N5WJ5FTW.mjs.map
208
+ //# sourceMappingURL=chunk-PLPHFY5A.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.1",
20
+ version: "0.1.3",
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",
@@ -131,7 +131,7 @@ var package_default = {
131
131
  dependencies: {
132
132
  "@noble/hashes": "^1.1.2",
133
133
  "@wagmi/chains": "~0.2.8",
134
- abitype: "~0.6.2",
134
+ abitype: "~0.6.7",
135
135
  "idna-uts46-hx": "^4.1.2",
136
136
  "isomorphic-ws": "^5.0.0",
137
137
  ws: "^8.12.0"
@@ -1593,16 +1593,14 @@ function numberToHex(value_, opts = {}) {
1593
1593
  return pad(hex, { size: size2 });
1594
1594
  return hex;
1595
1595
  }
1596
- function stringToHex(value) {
1597
- let hex = "";
1598
- for (let i = 0; i < value.length; i++) {
1599
- hex += value.charCodeAt(i).toString(16);
1600
- }
1601
- return `0x${hex}`;
1596
+ var encoder = new TextEncoder();
1597
+ function stringToHex(value_) {
1598
+ const value = encoder.encode(value_);
1599
+ return toHex(value);
1602
1600
  }
1603
1601
 
1604
1602
  // src/utils/encoding/toBytes.ts
1605
- var encoder = new TextEncoder();
1603
+ var encoder2 = new TextEncoder();
1606
1604
  function toBytes(value) {
1607
1605
  if (typeof value === "number" || typeof value === "bigint")
1608
1606
  return numberToBytes(value);
@@ -1637,7 +1635,7 @@ function numberToBytes(value, opts) {
1637
1635
  return hexToBytes(hex);
1638
1636
  }
1639
1637
  function stringToBytes(value) {
1640
- return encoder.encode(value);
1638
+ return encoder2.encode(value);
1641
1639
  }
1642
1640
 
1643
1641
  // src/utils/encoding/toRlp.ts
@@ -2063,9 +2061,9 @@ function encodeArray(value, {
2063
2061
  function encodeBytes(value, { param }) {
2064
2062
  const [_, size_] = param.type.split("bytes");
2065
2063
  if (!size_) {
2066
- const partsLength = Math.floor(size(value) / 32);
2064
+ const partsLength = Math.ceil(size(value) / 32);
2067
2065
  const parts = [];
2068
- for (let i = 0; i < partsLength + 1; i++) {
2066
+ for (let i = 0; i < partsLength; i++) {
2069
2067
  parts.push(
2070
2068
  padHex(slice(value, i * 32, (i + 1) * 32), {
2071
2069
  dir: "right"
@@ -2100,11 +2098,21 @@ function encodeNumber(value, { signed }) {
2100
2098
  };
2101
2099
  }
2102
2100
  function encodeString(value) {
2101
+ const hexValue = stringToHex(value);
2102
+ const partsLength = Math.ceil(size(hexValue) / 32);
2103
+ const parts = [];
2104
+ for (let i = 0; i < partsLength; i++) {
2105
+ parts.push(
2106
+ padHex(slice(hexValue, i * 32, (i + 1) * 32), {
2107
+ dir: "right"
2108
+ })
2109
+ );
2110
+ }
2103
2111
  return {
2104
2112
  dynamic: true,
2105
2113
  encoded: concat([
2106
- padHex(numberToHex(value.length, { size: 32 })),
2107
- padHex(stringToHex(value), { dir: "right" })
2114
+ padHex(numberToHex(size(hexValue), { size: 32 })),
2115
+ ...parts
2108
2116
  ])
2109
2117
  };
2110
2118
  }
@@ -5323,4 +5331,4 @@ export {
5323
5331
  formatGwei,
5324
5332
  parseEther
5325
5333
  };
5326
- //# sourceMappingURL=chunk-HDZRBHNX.mjs.map
5334
+ //# sourceMappingURL=chunk-UJYIRVKR.mjs.map