viem 0.0.1-alpha.20 → 0.0.1-alpha.21

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 (39) hide show
  1. package/dist/chains.js +46 -46
  2. package/dist/chains.mjs +1 -1
  3. package/dist/{chunk-ZVGTYLKU.mjs → chunk-46BO7YAQ.mjs} +2 -2
  4. package/dist/{chunk-ZVGTYLKU.mjs.map → chunk-46BO7YAQ.mjs.map} +0 -0
  5. package/dist/{chunk-YODUQCHJ.mjs → chunk-57ZOFERP.mjs} +2 -2
  6. package/dist/{chunk-YODUQCHJ.mjs.map → chunk-57ZOFERP.mjs.map} +0 -0
  7. package/dist/{chunk-5Q6FSUU2.mjs → chunk-62VTYU2V.mjs} +10 -4
  8. package/dist/chunk-62VTYU2V.mjs.map +1 -0
  9. package/dist/{chunk-MYQNZSWD.mjs → chunk-DGO77E2H.mjs} +3 -3
  10. package/dist/{chunk-MYQNZSWD.mjs.map → chunk-DGO77E2H.mjs.map} +0 -0
  11. package/dist/{chunk-T7CBAKLI.mjs → chunk-DSPMAIDO.mjs} +2 -2
  12. package/dist/{chunk-T7CBAKLI.mjs.map → chunk-DSPMAIDO.mjs.map} +0 -0
  13. package/dist/{chunk-IAQPMSGJ.js → chunk-EC3NUIJE.js} +13 -13
  14. package/dist/{chunk-IAQPMSGJ.js.map → chunk-EC3NUIJE.js.map} +0 -0
  15. package/dist/{chunk-FHXXG7I6.js → chunk-KEHGSYDO.js} +12 -12
  16. package/dist/{chunk-FHXXG7I6.js.map → chunk-KEHGSYDO.js.map} +0 -0
  17. package/dist/{chunk-NHAKUPTF.js → chunk-KZMJR27B.js} +63 -63
  18. package/dist/{chunk-NHAKUPTF.js.map → chunk-KZMJR27B.js.map} +0 -0
  19. package/dist/{chunk-SF4I2NKC.js → chunk-O2GYLJVD.js} +10 -4
  20. package/dist/chunk-O2GYLJVD.js.map +1 -0
  21. package/dist/{chunk-YFKR74XG.js → chunk-W7BWWAC4.js} +14 -14
  22. package/dist/{chunk-YFKR74XG.js.map → chunk-W7BWWAC4.js.map} +0 -0
  23. package/dist/clients/index.js +3 -3
  24. package/dist/clients/index.mjs +2 -2
  25. package/dist/index.js +6 -6
  26. package/dist/index.mjs +5 -5
  27. package/dist/public.js +4 -4
  28. package/dist/public.mjs +3 -3
  29. package/dist/test.js +3 -3
  30. package/dist/test.mjs +2 -2
  31. package/dist/utils/index.js +2 -2
  32. package/dist/utils/index.mjs +1 -1
  33. package/dist/wallet.js +3 -3
  34. package/dist/wallet.mjs +2 -2
  35. package/package.json +1 -1
  36. package/src/utils/abi/encodeAbi.test.ts +37 -3
  37. package/src/utils/abi/encodeAbi.ts +9 -3
  38. package/dist/chunk-5Q6FSUU2.mjs.map +0 -1
  39. package/dist/chunk-SF4I2NKC.js.map +0 -1
@@ -3,7 +3,7 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkSF4I2NKCjs = require('./chunk-SF4I2NKC.js');
6
+ var _chunkO2GYLJVDjs = require('./chunk-O2GYLJVD.js');
7
7
 
8
8
  // src/clients/transports/createTransport.ts
9
9
  function createTransport(config, value) {
@@ -60,13 +60,13 @@ function http(url, { key = "http", name = "HTTP JSON-RPC" } = {}) {
60
60
  return ({ chain }) => {
61
61
  const url_ = url || _optionalChain([chain, 'optionalAccess', _ => _.rpcUrls, 'access', _2 => _2.default, 'access', _3 => _3.http, 'access', _4 => _4[0]]);
62
62
  if (!url_)
63
- throw new (0, _chunkSF4I2NKCjs.UrlRequiredError)();
63
+ throw new (0, _chunkO2GYLJVDjs.UrlRequiredError)();
64
64
  return createTransport(
65
65
  {
66
66
  key,
67
67
  name,
68
68
  async request({ method, params }) {
69
- const { result } = await _chunkSF4I2NKCjs.rpc.http(url_, {
69
+ const { result } = await _chunkO2GYLJVDjs.rpc.http(url_, {
70
70
  body: {
71
71
  method,
72
72
  params
@@ -91,14 +91,14 @@ function webSocket(url, {
91
91
  return ({ chain }) => {
92
92
  const url_ = url || _optionalChain([chain, 'optionalAccess', _5 => _5.rpcUrls, 'access', _6 => _6.default, 'access', _7 => _7.webSocket, 'optionalAccess', _8 => _8[0]]);
93
93
  if (!url_)
94
- throw new (0, _chunkSF4I2NKCjs.UrlRequiredError)();
94
+ throw new (0, _chunkO2GYLJVDjs.UrlRequiredError)();
95
95
  return createTransport(
96
96
  {
97
97
  key,
98
98
  name,
99
99
  async request({ method, params }) {
100
- const socket = await _chunkSF4I2NKCjs.getSocket.call(void 0, url_);
101
- const { result } = await _chunkSF4I2NKCjs.rpc.webSocketAsync(socket, {
100
+ const socket = await _chunkO2GYLJVDjs.getSocket.call(void 0, url_);
101
+ const { result } = await _chunkO2GYLJVDjs.rpc.webSocketAsync(socket, {
102
102
  body: { method, params }
103
103
  });
104
104
  return result;
@@ -107,12 +107,12 @@ function webSocket(url, {
107
107
  },
108
108
  {
109
109
  getSocket() {
110
- return _chunkSF4I2NKCjs.getSocket.call(void 0, url_);
110
+ return _chunkO2GYLJVDjs.getSocket.call(void 0, url_);
111
111
  },
112
112
  async subscribe({ params, onData, onError }) {
113
- const socket = await _chunkSF4I2NKCjs.getSocket.call(void 0, url_);
113
+ const socket = await _chunkO2GYLJVDjs.getSocket.call(void 0, url_);
114
114
  const { result: subscriptionId } = await new Promise(
115
- (resolve, reject) => _chunkSF4I2NKCjs.rpc.webSocket(socket, {
115
+ (resolve, reject) => _chunkO2GYLJVDjs.rpc.webSocket(socket, {
116
116
  body: {
117
117
  method: "eth_subscribe",
118
118
  params
@@ -134,7 +134,7 @@ function webSocket(url, {
134
134
  subscriptionId,
135
135
  async unsubscribe() {
136
136
  return new Promise(
137
- (resolve, reject) => _chunkSF4I2NKCjs.rpc.webSocket(socket, {
137
+ (resolve, reject) => _chunkO2GYLJVDjs.rpc.webSocket(socket, {
138
138
  body: {
139
139
  method: "eth_unsubscribe",
140
140
  params: [subscriptionId]
@@ -181,7 +181,7 @@ function createClient({
181
181
  key,
182
182
  name,
183
183
  pollingInterval,
184
- request: _chunkSF4I2NKCjs.buildRequest.call(void 0, config.request),
184
+ request: _chunkO2GYLJVDjs.buildRequest.call(void 0, config.request),
185
185
  transport: { ...config, ...value },
186
186
  type,
187
187
  uid: uid()
@@ -256,4 +256,4 @@ function createWalletClient({
256
256
 
257
257
 
258
258
  exports.createTransport = createTransport; exports.custom = custom; exports.fallback = fallback; exports.http = http; exports.webSocket = webSocket; exports.createClient = createClient; exports.createPublicClient = createPublicClient; exports.createTestClient = createTestClient; exports.createWalletClient = createWalletClient;
259
- //# sourceMappingURL=chunk-FHXXG7I6.js.map
259
+ //# sourceMappingURL=chunk-KEHGSYDO.js.map
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkIAQPMSGJjs = require('./chunk-IAQPMSGJ.js');
3
+ var _chunkEC3NUIJEjs = require('./chunk-EC3NUIJE.js');
4
4
 
5
5
 
6
6
 
@@ -26,7 +26,7 @@ var _chunkIAQPMSGJjs = require('./chunk-IAQPMSGJ.js');
26
26
 
27
27
 
28
28
 
29
- var _chunkSF4I2NKCjs = require('./chunk-SF4I2NKC.js');
29
+ var _chunkO2GYLJVDjs = require('./chunk-O2GYLJVD.js');
30
30
 
31
31
  // src/actions/public/call.ts
32
32
  async function call(client, {
@@ -46,10 +46,10 @@ async function call(client, {
46
46
  ...rest
47
47
  }) {
48
48
  if (maxFeePerGas !== void 0 && maxPriorityFeePerGas !== void 0 && maxFeePerGas < maxPriorityFeePerGas)
49
- throw new (0, _chunkSF4I2NKCjs.InvalidGasArgumentsError)();
50
- const blockNumberHex = blockNumber ? _chunkSF4I2NKCjs.numberToHex.call(void 0, blockNumber) : void 0;
49
+ throw new (0, _chunkO2GYLJVDjs.InvalidGasArgumentsError)();
50
+ const blockNumberHex = blockNumber ? _chunkO2GYLJVDjs.numberToHex.call(void 0, blockNumber) : void 0;
51
51
  const formatter = _optionalChain([chain, 'optionalAccess', _ => _.formatters, 'optionalAccess', _2 => _2.transactionRequest]);
52
- const request_ = _chunkSF4I2NKCjs.format.call(void 0,
52
+ const request_ = _chunkO2GYLJVDjs.format.call(void 0,
53
53
  {
54
54
  from,
55
55
  accessList,
@@ -61,10 +61,10 @@ async function call(client, {
61
61
  nonce,
62
62
  to,
63
63
  value,
64
- ..._chunkSF4I2NKCjs.extract.call(void 0, rest, { formatter })
64
+ ..._chunkO2GYLJVDjs.extract.call(void 0, rest, { formatter })
65
65
  },
66
66
  {
67
- formatter: formatter || _chunkSF4I2NKCjs.formatTransactionRequest
67
+ formatter: formatter || _chunkO2GYLJVDjs.formatTransactionRequest
68
68
  }
69
69
  );
70
70
  const response = await client.request({
@@ -84,7 +84,7 @@ async function simulateContract(client, {
84
84
  functionName,
85
85
  ...callRequest
86
86
  }) {
87
- const calldata = _chunkSF4I2NKCjs.encodeFunctionData.call(void 0, {
87
+ const calldata = _chunkO2GYLJVDjs.encodeFunctionData.call(void 0, {
88
88
  abi,
89
89
  args,
90
90
  functionName
@@ -95,7 +95,7 @@ async function simulateContract(client, {
95
95
  to: address,
96
96
  ...callRequest
97
97
  });
98
- const result = _chunkSF4I2NKCjs.decodeFunctionResult.call(void 0, {
98
+ const result = _chunkO2GYLJVDjs.decodeFunctionResult.call(void 0, {
99
99
  abi,
100
100
  functionName,
101
101
  data: data || "0x"
@@ -111,7 +111,7 @@ async function simulateContract(client, {
111
111
  }
112
112
  };
113
113
  } catch (err) {
114
- throw _chunkSF4I2NKCjs.getContractError.call(void 0, err, {
114
+ throw _chunkO2GYLJVDjs.getContractError.call(void 0, err, {
115
115
  abi,
116
116
  address,
117
117
  args,
@@ -154,8 +154,8 @@ async function createEventFilter(client, {
154
154
  params: [
155
155
  {
156
156
  address,
157
- fromBlock: typeof fromBlock === "bigint" ? _chunkSF4I2NKCjs.numberToHex.call(void 0, fromBlock) : fromBlock,
158
- toBlock: typeof toBlock === "bigint" ? _chunkSF4I2NKCjs.numberToHex.call(void 0, toBlock) : toBlock,
157
+ fromBlock: typeof fromBlock === "bigint" ? _chunkO2GYLJVDjs.numberToHex.call(void 0, fromBlock) : fromBlock,
158
+ toBlock: typeof toBlock === "bigint" ? _chunkO2GYLJVDjs.numberToHex.call(void 0, toBlock) : toBlock,
159
159
  ...topics.length ? { topics } : {}
160
160
  }
161
161
  ]
@@ -166,7 +166,7 @@ function buildFilterTopics({
166
166
  event,
167
167
  args: _args
168
168
  }) {
169
- const signature = _chunkSF4I2NKCjs.getEventSignature.call(void 0, event);
169
+ const signature = _chunkO2GYLJVDjs.getEventSignature.call(void 0, event);
170
170
  return [signature];
171
171
  }
172
172
 
@@ -179,7 +179,7 @@ async function createContractEventFilter(client, {
179
179
  fromBlock,
180
180
  toBlock
181
181
  }) {
182
- const topics = eventName ? _chunkSF4I2NKCjs.encodeEventTopics.call(void 0, {
182
+ const topics = eventName ? _chunkO2GYLJVDjs.encodeEventTopics.call(void 0, {
183
183
  abi,
184
184
  args,
185
185
  eventName
@@ -189,8 +189,8 @@ async function createContractEventFilter(client, {
189
189
  params: [
190
190
  {
191
191
  address,
192
- fromBlock: typeof fromBlock === "bigint" ? _chunkSF4I2NKCjs.numberToHex.call(void 0, fromBlock) : fromBlock,
193
- toBlock: typeof toBlock === "bigint" ? _chunkSF4I2NKCjs.numberToHex.call(void 0, toBlock) : toBlock,
192
+ fromBlock: typeof fromBlock === "bigint" ? _chunkO2GYLJVDjs.numberToHex.call(void 0, fromBlock) : fromBlock,
193
+ toBlock: typeof toBlock === "bigint" ? _chunkO2GYLJVDjs.numberToHex.call(void 0, toBlock) : toBlock,
194
194
  topics
195
195
  }
196
196
  ]
@@ -200,12 +200,12 @@ async function createContractEventFilter(client, {
200
200
 
201
201
  // src/actions/public/deployContract.ts
202
202
  function deployContract(walletClient, { abi, args, bytecode, ...request }) {
203
- const calldata = _chunkSF4I2NKCjs.encodeDeployData.call(void 0, {
203
+ const calldata = _chunkO2GYLJVDjs.encodeDeployData.call(void 0, {
204
204
  abi,
205
205
  args,
206
206
  bytecode
207
207
  });
208
- return _chunkIAQPMSGJjs.sendTransaction.call(void 0, walletClient, {
208
+ return _chunkEC3NUIJEjs.sendTransaction.call(void 0, walletClient, {
209
209
  ...request,
210
210
  data: calldata
211
211
  });
@@ -224,16 +224,16 @@ async function estimateGas(client, {
224
224
  to,
225
225
  value
226
226
  }) {
227
- const blockNumberHex = blockNumber ? _chunkSF4I2NKCjs.numberToHex.call(void 0, blockNumber) : void 0;
227
+ const blockNumberHex = blockNumber ? _chunkO2GYLJVDjs.numberToHex.call(void 0, blockNumber) : void 0;
228
228
  const parameters = {
229
229
  data,
230
230
  from,
231
- gas: gas ? _chunkSF4I2NKCjs.numberToHex.call(void 0, gas) : void 0,
232
- gasPrice: gasPrice ? _chunkSF4I2NKCjs.numberToHex.call(void 0, gasPrice) : void 0,
233
- maxFeePerGas: maxFeePerGas ? _chunkSF4I2NKCjs.numberToHex.call(void 0, maxFeePerGas) : void 0,
234
- maxPriorityFeePerGas: maxPriorityFeePerGas ? _chunkSF4I2NKCjs.numberToHex.call(void 0, maxPriorityFeePerGas) : void 0,
231
+ gas: gas ? _chunkO2GYLJVDjs.numberToHex.call(void 0, gas) : void 0,
232
+ gasPrice: gasPrice ? _chunkO2GYLJVDjs.numberToHex.call(void 0, gasPrice) : void 0,
233
+ maxFeePerGas: maxFeePerGas ? _chunkO2GYLJVDjs.numberToHex.call(void 0, maxFeePerGas) : void 0,
234
+ maxPriorityFeePerGas: maxPriorityFeePerGas ? _chunkO2GYLJVDjs.numberToHex.call(void 0, maxPriorityFeePerGas) : void 0,
235
235
  to,
236
- value: value ? _chunkSF4I2NKCjs.numberToHex.call(void 0, value) : void 0
236
+ value: value ? _chunkO2GYLJVDjs.numberToHex.call(void 0, value) : void 0
237
237
  };
238
238
  const balance = await client.request({
239
239
  method: "eth_estimateGas",
@@ -244,7 +244,7 @@ async function estimateGas(client, {
244
244
 
245
245
  // src/actions/public/getBalance.ts
246
246
  async function getBalance(client, { address, blockNumber, blockTag = "latest" }) {
247
- const blockNumberHex = blockNumber ? _chunkSF4I2NKCjs.numberToHex.call(void 0, blockNumber) : void 0;
247
+ const blockNumberHex = blockNumber ? _chunkO2GYLJVDjs.numberToHex.call(void 0, blockNumber) : void 0;
248
248
  const balance = await client.request({
249
249
  method: "eth_getBalance",
250
250
  params: [address, blockNumberHex || blockTag]
@@ -259,7 +259,7 @@ async function getBlock(client, {
259
259
  blockTag = "latest",
260
260
  includeTransactions = false
261
261
  } = {}) {
262
- const blockNumberHex = blockNumber !== void 0 ? _chunkSF4I2NKCjs.numberToHex.call(void 0, blockNumber) : void 0;
262
+ const blockNumberHex = blockNumber !== void 0 ? _chunkO2GYLJVDjs.numberToHex.call(void 0, blockNumber) : void 0;
263
263
  let block = null;
264
264
  if (blockHash) {
265
265
  block = await client.request({
@@ -273,19 +273,19 @@ async function getBlock(client, {
273
273
  });
274
274
  }
275
275
  if (!block)
276
- throw new (0, _chunkSF4I2NKCjs.BlockNotFoundError)({ blockHash, blockNumber });
277
- return _chunkSF4I2NKCjs.format.call(void 0, block, {
278
- formatter: _optionalChain([client, 'access', _3 => _3.chain, 'optionalAccess', _4 => _4.formatters, 'optionalAccess', _5 => _5.block]) || _chunkSF4I2NKCjs.formatBlock
276
+ throw new (0, _chunkO2GYLJVDjs.BlockNotFoundError)({ blockHash, blockNumber });
277
+ return _chunkO2GYLJVDjs.format.call(void 0, block, {
278
+ formatter: _optionalChain([client, 'access', _3 => _3.chain, 'optionalAccess', _4 => _4.formatters, 'optionalAccess', _5 => _5.block]) || _chunkO2GYLJVDjs.formatBlock
279
279
  });
280
280
  }
281
281
 
282
282
  // src/actions/public/getBlockNumber.ts
283
283
  var cacheKey = (id) => `blockNumber.${id}`;
284
284
  function getBlockNumberCache(id) {
285
- return _chunkSF4I2NKCjs.getCache.call(void 0, cacheKey(id));
285
+ return _chunkO2GYLJVDjs.getCache.call(void 0, cacheKey(id));
286
286
  }
287
287
  async function getBlockNumber(client, { maxAge = client.pollingInterval } = {}) {
288
- const blockNumberHex = await _chunkSF4I2NKCjs.withCache.call(void 0,
288
+ const blockNumberHex = await _chunkO2GYLJVDjs.withCache.call(void 0,
289
289
  () => client.request({
290
290
  method: "eth_blockNumber"
291
291
  }),
@@ -300,7 +300,7 @@ async function getBlockTransactionCount(client, {
300
300
  blockNumber,
301
301
  blockTag = "latest"
302
302
  } = {}) {
303
- const blockNumberHex = blockNumber !== void 0 ? _chunkSF4I2NKCjs.numberToHex.call(void 0, blockNumber) : void 0;
303
+ const blockNumberHex = blockNumber !== void 0 ? _chunkO2GYLJVDjs.numberToHex.call(void 0, blockNumber) : void 0;
304
304
  let count = null;
305
305
  if (blockHash) {
306
306
  count = await client.request({
@@ -313,12 +313,12 @@ async function getBlockTransactionCount(client, {
313
313
  params: [blockNumberHex || blockTag]
314
314
  });
315
315
  }
316
- return _chunkSF4I2NKCjs.hexToNumber.call(void 0, count);
316
+ return _chunkO2GYLJVDjs.hexToNumber.call(void 0, count);
317
317
  }
318
318
 
319
319
  // src/actions/public/getBytecode.ts
320
320
  async function getBytecode(client, { address, blockNumber, blockTag = "latest" }) {
321
- const blockNumberHex = blockNumber !== void 0 ? _chunkSF4I2NKCjs.numberToHex.call(void 0, blockNumber) : void 0;
321
+ const blockNumberHex = blockNumber !== void 0 ? _chunkO2GYLJVDjs.numberToHex.call(void 0, blockNumber) : void 0;
322
322
  const hex = await client.request({
323
323
  method: "eth_getCode",
324
324
  params: [address, blockNumberHex || blockTag]
@@ -331,7 +331,7 @@ async function getBytecode(client, { address, blockNumber, blockTag = "latest" }
331
331
  // src/actions/public/getChainId.ts
332
332
  async function getChainId(client) {
333
333
  const chainIdHex = await client.request({ method: "eth_chainId" });
334
- return _chunkSF4I2NKCjs.hexToNumber.call(void 0, chainIdHex);
334
+ return _chunkO2GYLJVDjs.hexToNumber.call(void 0, chainIdHex);
335
335
  }
336
336
 
337
337
  // src/actions/public/getFeeHistory.ts
@@ -341,16 +341,16 @@ async function getFeeHistory(client, {
341
341
  blockTag = "latest",
342
342
  rewardPercentiles
343
343
  }) {
344
- const blockNumberHex = blockNumber ? _chunkSF4I2NKCjs.numberToHex.call(void 0, blockNumber) : void 0;
344
+ const blockNumberHex = blockNumber ? _chunkO2GYLJVDjs.numberToHex.call(void 0, blockNumber) : void 0;
345
345
  const feeHistory = await client.request({
346
346
  method: "eth_feeHistory",
347
347
  params: [
348
- _chunkSF4I2NKCjs.numberToHex.call(void 0, blockCount),
348
+ _chunkO2GYLJVDjs.numberToHex.call(void 0, blockCount),
349
349
  blockNumberHex || blockTag,
350
350
  rewardPercentiles
351
351
  ]
352
352
  });
353
- return _chunkSF4I2NKCjs.formatFeeHistory.call(void 0, feeHistory);
353
+ return _chunkO2GYLJVDjs.formatFeeHistory.call(void 0, feeHistory);
354
354
  }
355
355
 
356
356
  // src/actions/public/getFilterChanges.ts
@@ -360,7 +360,7 @@ async function getFilterChanges(client, { filter }) {
360
360
  params: [filter.id]
361
361
  });
362
362
  return logs.map(
363
- (log) => typeof log === "string" ? log : _chunkSF4I2NKCjs.formatLog.call(void 0, log)
363
+ (log) => typeof log === "string" ? log : _chunkO2GYLJVDjs.formatLog.call(void 0, log)
364
364
  );
365
365
  }
366
366
 
@@ -370,7 +370,7 @@ async function getFilterLogs(client, { filter }) {
370
370
  method: "eth_getFilterLogs",
371
371
  params: [filter.id]
372
372
  });
373
- return logs.map(_chunkSF4I2NKCjs.formatLog);
373
+ return logs.map(_chunkO2GYLJVDjs.formatLog);
374
374
  }
375
375
 
376
376
  // src/actions/public/getGasPrice.ts
@@ -407,18 +407,18 @@ async function getLogs(client, {
407
407
  {
408
408
  address,
409
409
  topics,
410
- fromBlock: typeof fromBlock === "bigint" ? _chunkSF4I2NKCjs.numberToHex.call(void 0, fromBlock) : fromBlock,
411
- toBlock: typeof toBlock === "bigint" ? _chunkSF4I2NKCjs.numberToHex.call(void 0, toBlock) : toBlock
410
+ fromBlock: typeof fromBlock === "bigint" ? _chunkO2GYLJVDjs.numberToHex.call(void 0, fromBlock) : fromBlock,
411
+ toBlock: typeof toBlock === "bigint" ? _chunkO2GYLJVDjs.numberToHex.call(void 0, toBlock) : toBlock
412
412
  }
413
413
  ]
414
414
  });
415
415
  }
416
- return logs.map(_chunkSF4I2NKCjs.formatLog);
416
+ return logs.map(_chunkO2GYLJVDjs.formatLog);
417
417
  }
418
418
 
419
419
  // src/actions/public/getStorageAt.ts
420
420
  async function getStorageAt(client, { address, blockNumber, blockTag = "latest", slot }) {
421
- const blockNumberHex = blockNumber !== void 0 ? _chunkSF4I2NKCjs.numberToHex.call(void 0, blockNumber) : void 0;
421
+ const blockNumberHex = blockNumber !== void 0 ? _chunkO2GYLJVDjs.numberToHex.call(void 0, blockNumber) : void 0;
422
422
  const data = await client.request({
423
423
  method: "eth_getStorageAt",
424
424
  params: [address, slot, blockNumberHex || blockTag]
@@ -434,7 +434,7 @@ async function getTransaction(client, {
434
434
  hash,
435
435
  index
436
436
  }) {
437
- const blockNumberHex = blockNumber !== void 0 ? _chunkSF4I2NKCjs.numberToHex.call(void 0, blockNumber) : void 0;
437
+ const blockNumberHex = blockNumber !== void 0 ? _chunkO2GYLJVDjs.numberToHex.call(void 0, blockNumber) : void 0;
438
438
  let transaction = null;
439
439
  if (hash) {
440
440
  transaction = await client.request({
@@ -444,24 +444,24 @@ async function getTransaction(client, {
444
444
  } else if (blockHash) {
445
445
  transaction = await client.request({
446
446
  method: "eth_getTransactionByBlockHashAndIndex",
447
- params: [blockHash, _chunkSF4I2NKCjs.numberToHex.call(void 0, index)]
447
+ params: [blockHash, _chunkO2GYLJVDjs.numberToHex.call(void 0, index)]
448
448
  });
449
449
  } else if (blockNumberHex || blockTag) {
450
450
  transaction = await client.request({
451
451
  method: "eth_getTransactionByBlockNumberAndIndex",
452
- params: [blockNumberHex || blockTag, _chunkSF4I2NKCjs.numberToHex.call(void 0, index)]
452
+ params: [blockNumberHex || blockTag, _chunkO2GYLJVDjs.numberToHex.call(void 0, index)]
453
453
  });
454
454
  }
455
455
  if (!transaction)
456
- throw new (0, _chunkSF4I2NKCjs.TransactionNotFoundError)({
456
+ throw new (0, _chunkO2GYLJVDjs.TransactionNotFoundError)({
457
457
  blockHash,
458
458
  blockNumber,
459
459
  blockTag,
460
460
  hash,
461
461
  index
462
462
  });
463
- return _chunkSF4I2NKCjs.format.call(void 0, transaction, {
464
- formatter: _optionalChain([client, 'access', _6 => _6.chain, 'optionalAccess', _7 => _7.formatters, 'optionalAccess', _8 => _8.transaction]) || _chunkSF4I2NKCjs.formatTransaction
463
+ return _chunkO2GYLJVDjs.format.call(void 0, transaction, {
464
+ formatter: _optionalChain([client, 'access', _6 => _6.chain, 'optionalAccess', _7 => _7.formatters, 'optionalAccess', _8 => _8.transaction]) || _chunkO2GYLJVDjs.formatTransaction
465
465
  });
466
466
  }
467
467
 
@@ -481,9 +481,9 @@ async function getTransactionConfirmations(client, { hash, transactionReceipt })
481
481
  async function getTransactionCount(client, { address, blockTag = "latest", blockNumber }) {
482
482
  const count = await client.request({
483
483
  method: "eth_getTransactionCount",
484
- params: [address, blockNumber ? _chunkSF4I2NKCjs.numberToHex.call(void 0, blockNumber) : blockTag]
484
+ params: [address, blockNumber ? _chunkO2GYLJVDjs.numberToHex.call(void 0, blockNumber) : blockTag]
485
485
  });
486
- return _chunkSF4I2NKCjs.hexToNumber.call(void 0, count);
486
+ return _chunkO2GYLJVDjs.hexToNumber.call(void 0, count);
487
487
  }
488
488
 
489
489
  // src/actions/public/getTransactionReceipt.ts
@@ -493,9 +493,9 @@ async function getTransactionReceipt(client, { hash }) {
493
493
  params: [hash]
494
494
  });
495
495
  if (!receipt)
496
- throw new (0, _chunkSF4I2NKCjs.TransactionReceiptNotFoundError)({ hash });
497
- return _chunkSF4I2NKCjs.format.call(void 0, receipt, {
498
- formatter: _optionalChain([client, 'access', _11 => _11.chain, 'optionalAccess', _12 => _12.formatters, 'optionalAccess', _13 => _13.transactionReceipt]) || _chunkSF4I2NKCjs.formatTransactionReceipt
496
+ throw new (0, _chunkO2GYLJVDjs.TransactionReceiptNotFoundError)({ hash });
497
+ return _chunkO2GYLJVDjs.format.call(void 0, receipt, {
498
+ formatter: _optionalChain([client, 'access', _11 => _11.chain, 'optionalAccess', _12 => _12.formatters, 'optionalAccess', _13 => _13.transactionReceipt]) || _chunkO2GYLJVDjs.formatTransactionReceipt
499
499
  });
500
500
  }
501
501
 
@@ -507,7 +507,7 @@ async function readContract(client, {
507
507
  functionName,
508
508
  ...callRequest
509
509
  }) {
510
- const calldata = _chunkSF4I2NKCjs.encodeFunctionData.call(void 0, {
510
+ const calldata = _chunkO2GYLJVDjs.encodeFunctionData.call(void 0, {
511
511
  abi,
512
512
  args,
513
513
  functionName
@@ -518,13 +518,13 @@ async function readContract(client, {
518
518
  to: address,
519
519
  ...callRequest
520
520
  });
521
- return _chunkSF4I2NKCjs.decodeFunctionResult.call(void 0, {
521
+ return _chunkO2GYLJVDjs.decodeFunctionResult.call(void 0, {
522
522
  abi,
523
523
  functionName,
524
524
  data: data || "0x"
525
525
  });
526
526
  } catch (err) {
527
- throw _chunkSF4I2NKCjs.getContractError.call(void 0, err, {
527
+ throw _chunkO2GYLJVDjs.getContractError.call(void 0, err, {
528
528
  abi,
529
529
  address,
530
530
  args,
@@ -592,12 +592,12 @@ function poll(fn, { emitOnBegin, initialWaitTime, interval }) {
592
592
  if (emitOnBegin)
593
593
  data = await fn({ unpoll: unwatch });
594
594
  const initialWait = await _asyncNullishCoalesce(await _optionalChain([initialWaitTime, 'optionalCall', _17 => _17(data)]), async () => ( interval));
595
- await _chunkSF4I2NKCjs.wait.call(void 0, initialWait);
595
+ await _chunkO2GYLJVDjs.wait.call(void 0, initialWait);
596
596
  const poll2 = async () => {
597
597
  if (!active)
598
598
  return;
599
599
  await fn({ unpoll: unwatch });
600
- await _chunkSF4I2NKCjs.wait.call(void 0, interval);
600
+ await _chunkO2GYLJVDjs.wait.call(void 0, interval);
601
601
  poll2();
602
602
  };
603
603
  poll2();
@@ -780,7 +780,7 @@ async function waitForTransactionReceipt(client, {
780
780
  return new Promise((resolve, reject) => {
781
781
  if (timeout)
782
782
  setTimeout(
783
- () => reject(new (0, _chunkSF4I2NKCjs.WaitForTransactionReceiptTimeoutError)({ hash })),
783
+ () => reject(new (0, _chunkO2GYLJVDjs.WaitForTransactionReceiptTimeoutError)({ hash })),
784
784
  timeout
785
785
  );
786
786
  const unobserve = observe(
@@ -810,7 +810,7 @@ async function waitForTransactionReceipt(client, {
810
810
  return;
811
811
  done(() => emit.resolve(receipt));
812
812
  } catch (err) {
813
- if (transaction && (err instanceof _chunkSF4I2NKCjs.TransactionNotFoundError || err instanceof _chunkSF4I2NKCjs.TransactionReceiptNotFoundError)) {
813
+ if (transaction && (err instanceof _chunkO2GYLJVDjs.TransactionNotFoundError || err instanceof _chunkO2GYLJVDjs.TransactionReceiptNotFoundError)) {
814
814
  replacedTransaction = transaction;
815
815
  const block = await getBlock(client, {
816
816
  blockNumber,
@@ -886,4 +886,4 @@ async function waitForTransactionReceipt(client, {
886
886
 
887
887
 
888
888
  exports.call = call; exports.simulateContract = simulateContract; exports.createPendingTransactionFilter = createPendingTransactionFilter; exports.createBlockFilter = createBlockFilter; exports.createEventFilter = createEventFilter; exports.createContractEventFilter = createContractEventFilter; exports.deployContract = deployContract; exports.estimateGas = estimateGas; exports.getBalance = getBalance; exports.getBlock = getBlock; exports.getBlockNumberCache = getBlockNumberCache; exports.getBlockNumber = getBlockNumber; exports.getBlockTransactionCount = getBlockTransactionCount; exports.getBytecode = getBytecode; exports.getChainId = getChainId; exports.getFeeHistory = getFeeHistory; exports.getFilterChanges = getFilterChanges; exports.getFilterLogs = getFilterLogs; exports.getGasPrice = getGasPrice; exports.getLogs = getLogs; exports.getStorageAt = getStorageAt; exports.getTransaction = getTransaction; exports.getTransactionConfirmations = getTransactionConfirmations; exports.getTransactionCount = getTransactionCount; exports.getTransactionReceipt = getTransactionReceipt; exports.readContract = readContract; exports.uninstallFilter = uninstallFilter; exports.waitForTransactionReceipt = waitForTransactionReceipt; exports.watchBlockNumber = watchBlockNumber; exports.watchBlocks = watchBlocks; exports.watchPendingTransactions = watchPendingTransactions;
889
- //# sourceMappingURL=chunk-NHAKUPTF.js.map
889
+ //# sourceMappingURL=chunk-KZMJR27B.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.20",
12
+ version: "0.0.1-alpha.21",
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",
@@ -1542,14 +1542,20 @@ function encodeArray(value, {
1542
1542
  }
1543
1543
  function encodeBytes2(value, { param }) {
1544
1544
  const [_, size_] = param.type.split("bytes");
1545
- if (!size_)
1545
+ if (!size_) {
1546
+ const partsLength = Math.floor(size(value) / 32);
1547
+ const parts = [];
1548
+ for (let i = 0; i < partsLength + 1; i++) {
1549
+ parts.push(padHex(slice(value, i * 32, (i + 1) * 32), { dir: "right" }));
1550
+ }
1546
1551
  return {
1547
1552
  dynamic: true,
1548
1553
  encoded: concat([
1549
1554
  padHex(numberToHex(size(value), { size: 32 })),
1550
- padHex(value, { dir: "right" })
1555
+ ...parts
1551
1556
  ])
1552
1557
  };
1558
+ }
1553
1559
  return { dynamic: false, encoded: padHex(value, { dir: "right" }) };
1554
1560
  }
1555
1561
  function encodeBool(value) {
@@ -2680,4 +2686,4 @@ function parseGwei(ether, unit = "wei") {
2680
2686
 
2681
2687
 
2682
2688
  exports.stringify = stringify; exports.BaseError = BaseError; exports.AbiConstructorNotFoundError = AbiConstructorNotFoundError; exports.AbiConstructorParamsNotFoundError = AbiConstructorParamsNotFoundError; exports.AbiDecodingDataSizeInvalidError = AbiDecodingDataSizeInvalidError; exports.AbiEncodingArrayLengthMismatchError = AbiEncodingArrayLengthMismatchError; exports.AbiEncodingLengthMismatchError = AbiEncodingLengthMismatchError; exports.AbiErrorInputsNotFoundError = AbiErrorInputsNotFoundError; exports.AbiErrorNotFoundError = AbiErrorNotFoundError; exports.AbiErrorSignatureNotFoundError = AbiErrorSignatureNotFoundError; exports.AbiEventNotFoundError = AbiEventNotFoundError; exports.AbiFunctionNotFoundError = AbiFunctionNotFoundError; exports.AbiFunctionOutputsNotFoundError = AbiFunctionOutputsNotFoundError; exports.AbiFunctionSignatureNotFoundError = AbiFunctionSignatureNotFoundError; exports.InvalidAbiEncodingTypeError = InvalidAbiEncodingTypeError; exports.InvalidAbiDecodingTypeError = InvalidAbiDecodingTypeError; exports.InvalidArrayError = InvalidArrayError; exports.InvalidDefinitionTypeError = InvalidDefinitionTypeError; exports.InvalidAddressError = InvalidAddressError; exports.BlockNotFoundError = BlockNotFoundError; exports.SizeExceedsPaddingSizeError = SizeExceedsPaddingSizeError; exports.DataLengthTooLongError = DataLengthTooLongError; exports.DataLengthTooShortError = DataLengthTooShortError; exports.InvalidBytesBooleanError = InvalidBytesBooleanError; exports.InvalidHexBooleanError = InvalidHexBooleanError; exports.InvalidHexValueError = InvalidHexValueError; exports.OffsetOutOfBoundsError = OffsetOutOfBoundsError; exports.FilterTypeNotSupportedError = FilterTypeNotSupportedError; exports.RequestError = RequestError; exports.RpcRequestError = RpcRequestError; exports.ParseRpcError = ParseRpcError; exports.InvalidRequestRpcError = InvalidRequestRpcError; exports.MethodNotFoundRpcError = MethodNotFoundRpcError; exports.InvalidParamsRpcError = InvalidParamsRpcError; exports.InternalRpcError = InternalRpcError; exports.InvalidInputRpcError = InvalidInputRpcError; exports.ResourceNotFoundRpcError = ResourceNotFoundRpcError; exports.ResourceUnavailableRpcError = ResourceUnavailableRpcError; exports.TransactionRejectedRpcError = TransactionRejectedRpcError; exports.MethodNotSupportedRpcError = MethodNotSupportedRpcError; exports.LimitExceededRpcError = LimitExceededRpcError; exports.JsonRpcVersionUnsupportedError = JsonRpcVersionUnsupportedError; exports.UnknownRpcError = UnknownRpcError; exports.isBytes = isBytes; exports.isHex = isHex; exports.pad = pad; exports.padHex = padHex; exports.padBytes = padBytes; exports.trim = trim; exports.size = size; exports.slice = slice; exports.sliceBytes = sliceBytes; exports.sliceHex = sliceHex; exports.boolToHex = boolToHex; exports.bytesToHex = bytesToHex; exports.encodeHex = encodeHex; exports.numberToHex = numberToHex; exports.stringToHex = stringToHex; exports.boolToBytes = boolToBytes; exports.encodeBytes = encodeBytes; exports.hexToBytes = hexToBytes; exports.numberToBytes = numberToBytes; exports.stringToBytes = stringToBytes; exports.encodeRlp = encodeRlp; exports.decodeHex = decodeHex; exports.hexToBigInt = hexToBigInt; exports.hexToBool = hexToBool; exports.hexToNumber = hexToNumber; exports.hexToString = hexToString; exports.decodeBytes = decodeBytes; exports.bytesToBigint = bytesToBigint; exports.bytesToBool = bytesToBool; exports.bytesToNumber = bytesToNumber; exports.bytesToString = bytesToString; exports.decodeRlp = decodeRlp; exports.extractFunctionParts = extractFunctionParts; exports.extractFunctionName = extractFunctionName; exports.extractFunctionParams = extractFunctionParams; exports.extractFunctionType = extractFunctionType; exports.getContractError = getContractError; exports.keccak256 = keccak256; exports.getEventSignature = getEventSignature; exports.getFunctionSignature = getFunctionSignature; exports.checksumAddress = checksumAddress; exports.getAddress = getAddress; exports.getContractAddress = getContractAddress; exports.getCreateAddress = getCreateAddress; exports.getCreate2Address = getCreate2Address; exports.isAddress = isAddress; exports.isAddressEqual = isAddressEqual; exports.encodeAbi = encodeAbi; exports.decodeAbi = decodeAbi; exports.formatAbiItem = formatAbiItem; exports.decodeErrorResult = decodeErrorResult; exports.decodeFunctionData = decodeFunctionData; exports.decodeFunctionResult = decodeFunctionResult; exports.encodeDeployData = encodeDeployData; exports.getAbiItem = getAbiItem; exports.encodeErrorResult = encodeErrorResult; exports.encodeEventTopics = encodeEventTopics; exports.encodeFunctionData = encodeFunctionData; exports.encodeFunctionResult = encodeFunctionResult; exports.formatAbiItemWithArgs = formatAbiItemWithArgs; exports.buildRequest = buildRequest; exports.defineChain = defineChain; exports.format = format3; exports.defineFormatter = defineFormatter; exports.transactionType = transactionType; exports.formatTransaction = formatTransaction; exports.defineTransaction = defineTransaction; exports.formatBlock = formatBlock; exports.defineBlock = defineBlock; exports.extract = extract; exports.formatFeeHistory = formatFeeHistory; exports.formatLog = formatLog; exports.formatTransactionReceipt = formatTransactionReceipt; exports.defineTransactionReceipt = defineTransactionReceipt; exports.formatTransactionRequest = formatTransactionRequest; exports.defineTransactionRequest = defineTransactionRequest; exports.getCache = getCache; exports.withCache = withCache; exports.wait = wait; exports.getSocket = getSocket; exports.rpc = rpc; exports.etherUnits = etherUnits; exports.gweiUnits = gweiUnits; exports.weiUnits = weiUnits; exports.formatUnit = formatUnit; exports.formatEther = formatEther; exports.formatGwei = formatGwei; exports.parseUnit = parseUnit; exports.parseEther = parseEther; exports.parseGwei = parseGwei; exports.HttpRequestError = HttpRequestError; exports.WebSocketRequestError = WebSocketRequestError; exports.RpcError = RpcError; exports.TimeoutError = TimeoutError; exports.InvalidGasArgumentsError = InvalidGasArgumentsError; exports.TransactionNotFoundError = TransactionNotFoundError; exports.TransactionReceiptNotFoundError = TransactionReceiptNotFoundError; exports.WaitForTransactionReceiptTimeoutError = WaitForTransactionReceiptTimeoutError; exports.UrlRequiredError = UrlRequiredError;
2683
- //# sourceMappingURL=chunk-SF4I2NKC.js.map
2689
+ //# sourceMappingURL=chunk-O2GYLJVD.js.map