viem 0.0.1-alpha.1 → 0.0.1-alpha.2

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.
@@ -58,8 +58,8 @@ import {
58
58
  watchBlockNumber,
59
59
  watchBlocks,
60
60
  watchPendingTransactions
61
- } from "../chunk-LLYFXUSV.js";
62
- import "../chunk-Z6LRV6XI.js";
61
+ } from "../chunk-4HNVS7AM.js";
62
+ import "../chunk-3EOU525X.js";
63
63
  export {
64
64
  addChain,
65
65
  call,
package/dist/chains.d.ts CHANGED
@@ -24,7 +24,7 @@ declare const defineBlock: <TFormat extends Formatter<Partial<RpcBlock>, Partial
24
24
  }) => Block<bigint, Transaction<bigint, number>> & ReturnType<TFormat> & { [K in TExclude[number]]: never; };
25
25
  declare const defineTransaction: <TFormat extends Formatter<Partial<RpcTransaction>, Partial<Transaction<bigint, number>> & {
26
26
  [key: string]: unknown;
27
- }>, TExclude extends ("type" | "value" | "blockHash" | "blockNumber" | "from" | "gas" | "hash" | "input" | "nonce" | "r" | "s" | "to" | "transactionIndex" | "v" | "gasPrice" | "maxFeePerGas" | "maxPriorityFeePerGas" | "accessList")[] = []>({ exclude, format: formatOverride, }: {
27
+ }>, TExclude extends ("gas" | "type" | "value" | "blockHash" | "blockNumber" | "from" | "hash" | "input" | "nonce" | "r" | "s" | "to" | "transactionIndex" | "v" | "gasPrice" | "maxFeePerGas" | "maxPriorityFeePerGas" | "accessList")[] = []>({ exclude, format: formatOverride, }: {
28
28
  exclude?: TExclude | undefined;
29
29
  format?: TFormat | undefined;
30
30
  }) => (data: Partial<RpcTransaction> & {
@@ -32,7 +32,7 @@ declare const defineTransaction: <TFormat extends Formatter<Partial<RpcTransacti
32
32
  }) => Transaction<bigint, number> & ReturnType<TFormat> & { [K in TExclude[number]]: never; };
33
33
  declare const defineTransactionRequest: <TFormat extends Formatter<Partial<TransactionRequest<bigint, number>>, Partial<RpcTransactionRequest> & {
34
34
  [key: string]: unknown;
35
- }>, TExclude extends ("data" | "value" | "from" | "gas" | "nonce" | "to" | "gasPrice" | "maxFeePerGas" | "maxPriorityFeePerGas" | "accessList")[] = []>({ exclude, format: formatOverride, }: {
35
+ }>, TExclude extends ("gas" | "data" | "value" | "from" | "nonce" | "to" | "gasPrice" | "maxFeePerGas" | "maxPriorityFeePerGas" | "accessList")[] = []>({ exclude, format: formatOverride, }: {
36
36
  exclude?: TExclude | undefined;
37
37
  format?: TFormat | undefined;
38
38
  }) => (data: Partial<TransactionRequest<bigint, number>> & {
package/dist/chains.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  formatTransaction,
4
4
  formatTransactionReceipt,
5
5
  formatTransactionRequest
6
- } from "./chunk-Z6LRV6XI.js";
6
+ } from "./chunk-3EOU525X.js";
7
7
 
8
8
  // src/chains.ts
9
9
  import {
@@ -9,7 +9,7 @@ var __publicField = (obj, key, value) => {
9
9
  var package_default = {
10
10
  name: "viem",
11
11
  description: "TypeScript (& JavaScript) Interface for Ethereum",
12
- version: "0.0.1-alpha.1",
12
+ version: "0.0.1-alpha.2",
13
13
  scripts: {
14
14
  anvil: "source .env && anvil --fork-url $ANVIL_FORK_URL --fork-block-number $VITE_ANVIL_BLOCK_NUMBER --block-time $VITE_ANVIL_BLOCK_TIME",
15
15
  bench: "vitest bench --no-threads",
@@ -665,7 +665,7 @@ function hashFunction(def) {
665
665
  var getEventSignature = (event) => hashFunction(event);
666
666
 
667
667
  // src/utils/hash/getFunctionSignature.ts
668
- var getFunctionSignature = (fn) => hashFunction(fn).slice(0, 10);
668
+ var getFunctionSignature = (fn) => slice(hashFunction(fn), 0, 4);
669
669
 
670
670
  // src/utils/address/getAddress.ts
671
671
  var addressRegex = /^(0x)?[a-fA-F0-9]{40}$/;
@@ -754,7 +754,10 @@ function encodeAbi({
754
754
  givenLength: values.length
755
755
  });
756
756
  const preparedParams = prepareParams({ params, values });
757
- return encodeParams(preparedParams);
757
+ const data = encodeParams(preparedParams);
758
+ if (data.length === 0)
759
+ return void 0;
760
+ return data;
758
761
  }
759
762
  function prepareParams({
760
763
  params,
@@ -1182,6 +1185,70 @@ var InvalidAbiDecodingTypeError = class extends BaseError {
1182
1185
  }
1183
1186
  };
1184
1187
 
1188
+ // src/utils/abi/getDefinition.ts
1189
+ function getDefinition(description) {
1190
+ if (description.type !== "function" && description.type !== "event" && description.type !== "error")
1191
+ throw new InvalidDefinitionTypeError(description.type);
1192
+ return `${description.name}(${getParams(description.inputs)})`;
1193
+ }
1194
+ function getParams(params) {
1195
+ if (!params)
1196
+ return "";
1197
+ return params.map(getParam).join(",");
1198
+ }
1199
+ function getParam(param) {
1200
+ if (param.type.startsWith("tuple")) {
1201
+ return `(${getParams(
1202
+ param.components
1203
+ )})${param.type.slice("tuple".length)}`;
1204
+ }
1205
+ return param.type;
1206
+ }
1207
+ var InvalidDefinitionTypeError = class extends BaseError {
1208
+ constructor(type) {
1209
+ super(
1210
+ [
1211
+ `"${type}" is not a valid definition type.`,
1212
+ 'Valid types: "function", "event", "error"'
1213
+ ].join("\n"),
1214
+ {
1215
+ docsPath: "/docs/contract/getDefinition"
1216
+ }
1217
+ );
1218
+ }
1219
+ };
1220
+
1221
+ // src/utils/abi/encodeFunctionParams.ts
1222
+ function encodeFunctionParams({
1223
+ abi,
1224
+ args,
1225
+ functionName
1226
+ }) {
1227
+ const description = abi.find((x) => "name" in x && x.name === functionName);
1228
+ if (!description)
1229
+ throw new AbiFunctionNotFoundError(functionName);
1230
+ const definition = getDefinition(description);
1231
+ const signature = getFunctionSignature(definition);
1232
+ const data = "inputs" in description && description.inputs ? encodeAbi({
1233
+ params: description.inputs,
1234
+ values: args ?? []
1235
+ }) : void 0;
1236
+ return concatHex([signature, data ?? "0x"]);
1237
+ }
1238
+ var AbiFunctionNotFoundError = class extends BaseError {
1239
+ constructor(functionName) {
1240
+ super(
1241
+ [
1242
+ `Function "${functionName}" not found on ABI.`,
1243
+ "Make sure you are using the correct ABI and that the function exists on it."
1244
+ ].join("\n"),
1245
+ {
1246
+ docsPath: "/docs/contract/encodeFunctionParams"
1247
+ }
1248
+ );
1249
+ }
1250
+ };
1251
+
1185
1252
  // src/utils/buildRequest.ts
1186
1253
  function buildRequest(request) {
1187
1254
  return async (args) => {
@@ -1936,6 +2003,7 @@ export {
1936
2003
  isAddressEqual,
1937
2004
  encodeAbi,
1938
2005
  decodeAbi,
2006
+ encodeFunctionParams,
1939
2007
  buildRequest,
1940
2008
  RpcRequestError,
1941
2009
  ParseRpcError,
@@ -16,7 +16,7 @@ import {
16
16
  numberToHex,
17
17
  wait,
18
18
  withCache
19
- } from "./chunk-Z6LRV6XI.js";
19
+ } from "./chunk-3EOU525X.js";
20
20
 
21
21
  // src/actions/wallet/addChain.ts
22
22
  async function addChain(client, chain) {
@@ -3,7 +3,7 @@ import {
3
3
  buildRequest,
4
4
  getSocket,
5
5
  rpc
6
- } from "./chunk-Z6LRV6XI.js";
6
+ } from "./chunk-3EOU525X.js";
7
7
 
8
8
  // src/clients/transports/createTransport.ts
9
9
  function createTransport(config, value) {
@@ -37,36 +37,34 @@ function custom(provider, { key = "custom", name = "Custom Provider" } = {}) {
37
37
 
38
38
  // src/clients/transports/fallback.ts
39
39
  function fallback(transports, { key = "fallback", name = "Fallback" } = {}) {
40
- return ({ chain }) => {
41
- return createTransport(
42
- {
43
- key,
44
- name,
45
- async request({ method, params }) {
46
- const fetch = async (i = 0) => {
47
- const transport = transports[i]({ chain });
48
- try {
49
- return await transport.config.request({
50
- method,
51
- params
52
- });
53
- } catch (err) {
54
- if (i < transports.length - 1)
55
- return fetch(i + 1);
56
- throw err;
57
- }
58
- };
59
- return fetch();
60
- },
61
- type: "fallback"
40
+ return ({ chain }) => createTransport(
41
+ {
42
+ key,
43
+ name,
44
+ async request({ method, params }) {
45
+ const fetch = async (i = 0) => {
46
+ const transport = transports[i]({ chain });
47
+ try {
48
+ return await transport.config.request({
49
+ method,
50
+ params
51
+ });
52
+ } catch (err) {
53
+ if (i < transports.length - 1)
54
+ return fetch(i + 1);
55
+ throw err;
56
+ }
57
+ };
58
+ return fetch();
62
59
  },
63
- {
64
- transports: transports.map(
65
- (fn) => fn({ chain })
66
- )
67
- }
68
- );
69
- };
60
+ type: "fallback"
61
+ },
62
+ {
63
+ transports: transports.map(
64
+ (fn) => fn({ chain })
65
+ )
66
+ }
67
+ );
70
68
  }
71
69
 
72
70
  // src/clients/transports/http.ts
@@ -211,16 +209,14 @@ function createPublicClient({
211
209
  pollingInterval
212
210
  }) {
213
211
  chain;
214
- return {
215
- ...createClient({
216
- chain,
217
- key,
218
- name,
219
- pollingInterval,
220
- transport,
221
- type: "publicClient"
222
- })
223
- };
212
+ return createClient({
213
+ chain,
214
+ key,
215
+ name,
216
+ pollingInterval,
217
+ transport,
218
+ type: "publicClient"
219
+ });
224
220
  }
225
221
 
226
222
  // src/clients/createTestClient.ts
@@ -252,15 +248,13 @@ function createWalletClient({
252
248
  name = "Wallet Client",
253
249
  pollingInterval
254
250
  }) {
255
- return {
256
- ...createClient({
257
- key,
258
- name,
259
- pollingInterval,
260
- transport,
261
- type: "walletClient"
262
- })
263
- };
251
+ return createClient({
252
+ key,
253
+ name,
254
+ pollingInterval,
255
+ transport,
256
+ type: "walletClient"
257
+ });
264
258
  }
265
259
 
266
260
  export {
@@ -9,8 +9,8 @@ import {
9
9
  fallback,
10
10
  http,
11
11
  webSocket
12
- } from "../chunk-OQTFTQTO.js";
13
- import "../chunk-Z6LRV6XI.js";
12
+ } from "../chunk-YQRTXQ2G.js";
13
+ import "../chunk-3EOU525X.js";
14
14
  export {
15
15
  UrlRequiredError,
16
16
  createClient,
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ export { C as CallArgs, a as CallResponse, b as CreateBlockFilterResponse, c as
2
2
  export { C as Client, a as ClientConfig, P as PublicClient, b as PublicClientConfig, T as TestClient, c as TestClientConfig, d as Transport, e as TransportConfig, W as WalletClient, f as WalletClientConfig, g as createClient, h as createPublicClient, i as createTestClient, j as createTransport, k as createWalletClient } from './createWalletClient-915223f3.js';
3
3
  export { C as CustomTransport, a as CustomTransportConfig, F as FallbackTransport, b as FallbackTransportConfig, H as HttpTransport, c as HttpTransportConfig, U as UrlRequiredError, W as WebSocketTransport, d as WebSocketTransportConfig, e as custom, f as fallback, h as http, w as webSocket } from './webSocket-c6e0d26f.js';
4
4
  export { a as AccessList, A as Address, B as Block, b as BlockIdentifier, c as BlockNumber, d as BlockTag, f as ByteArray, F as FeeHistory, h as FeeValues, i as FeeValuesEIP1559, j as FeeValuesLegacy, k as Hash, H as Hex, L as Log, R as RpcBlock, l as RpcBlockIdentifier, m as RpcBlockNumber, n as RpcFeeHistory, o as RpcFeeValues, p as RpcLog, q as RpcTransaction, r as RpcTransactionReceipt, s as RpcTransactionRequest, u as RpcUncle, D as Transaction, E as TransactionBase, G as TransactionEIP1559, I as TransactionEIP2930, J as TransactionLegacy, T as TransactionReceipt, v as TransactionRequest, x as TransactionRequestBase, y as TransactionRequestEIP1559, z as TransactionRequestEIP2930, C as TransactionRequestLegacy, U as Uncle, e as etherUnits, g as gweiUnits, t as transactionType, w as weiUnits } from './rpc-655c0ba4.js';
5
- export { A as AbiDecodingDataSizeInvalidError, a as AbiEncodingArrayLengthMismatchError, b as AbiEncodingLengthMismatchError, E as EncodeRlpResponse, G as GetContractAddressOptions, d as GetCreate2AddressOptions, c as GetCreateAddressOptions, g as InternalRpcError, I as InvalidAbiDecodingTypeError, e as InvalidAbiEncodingTypeError, f as InvalidArrayError, h as InvalidInputRpcError, i as InvalidParamsRpcError, j as InvalidRequestRpcError, J as JsonRpcVersionUnsupportedError, L as LimitExceededRpcError, M as MethodNotFoundRpcError, k as MethodNotSupportedRpcError, P as ParseRpcError, R as ResourceNotFoundRpcError, l as ResourceUnavailableRpcError, m as RpcRequestError, T as TransactionRejectedRpcError, p as boolToBytes, q as boolToHex, r as bytesToBigint, s as bytesToBool, n as bytesToHex, t as bytesToNumber, o as bytesToString, u as decodeAbi, v as decodeBytes, w as decodeHex, x as decodeRlp, y as encodeAbi, z as encodeBytes, B as encodeHex, C as encodeRlp, Q as formatEther, a7 as formatGwei, a8 as formatUnit, D as getAddress, F as getContractAddress, K as getCreate2Address, H as getCreateAddress, N as getEventSignature, O as getFunctionSignature, X as hexToBigInt, Y as hexToBool, Z as hexToBytes, a9 as hexToNumber, _ as hexToString, S as isAddress, U as isAddressEqual, V as isBytes, W as isHex, $ as keccak256, a0 as numberToBytes, aa as numberToHex, a1 as pad, a2 as padBytes, a3 as padHex, a4 as parseEther, a5 as parseGwei, a6 as parseUnit, ab as size, ac as slice, ad as sliceBytes, ae as sliceHex, af as stringToBytes, ag as stringToHex, ah as trim } from './parseGwei-bbc055e4.js';
5
+ export { A as AbiDecodingDataSizeInvalidError, a as AbiEncodingArrayLengthMismatchError, b as AbiEncodingLengthMismatchError, E as EncodeRlpResponse, G as GetContractAddressOptions, d as GetCreate2AddressOptions, c as GetCreateAddressOptions, g as InternalRpcError, I as InvalidAbiDecodingTypeError, e as InvalidAbiEncodingTypeError, f as InvalidArrayError, h as InvalidInputRpcError, i as InvalidParamsRpcError, j as InvalidRequestRpcError, J as JsonRpcVersionUnsupportedError, L as LimitExceededRpcError, M as MethodNotFoundRpcError, k as MethodNotSupportedRpcError, P as ParseRpcError, R as ResourceNotFoundRpcError, l as ResourceUnavailableRpcError, m as RpcRequestError, T as TransactionRejectedRpcError, p as boolToBytes, q as boolToHex, r as bytesToBigint, s as bytesToBool, n as bytesToHex, t as bytesToNumber, o as bytesToString, u as decodeAbi, v as decodeBytes, w as decodeHex, x as decodeRlp, y as encodeAbi, z as encodeBytes, B as encodeFunctionParams, C as encodeHex, D as encodeRlp, S as formatEther, a8 as formatGwei, a9 as formatUnit, F as getAddress, H as getContractAddress, N as getCreate2Address, K as getCreateAddress, O as getEventSignature, Q as getFunctionSignature, Y as hexToBigInt, Z as hexToBool, _ as hexToBytes, aa as hexToNumber, $ as hexToString, U as isAddress, V as isAddressEqual, W as isBytes, X as isHex, a0 as keccak256, a1 as numberToBytes, ab as numberToHex, a2 as pad, a3 as padBytes, a4 as padHex, a5 as parseEther, a6 as parseGwei, a7 as parseUnit, ac as size, ad as slice, ae as sliceBytes, af as sliceHex, ag as stringToBytes, ah as stringToHex, ai as trim } from './parseGwei-fd7a0f7d.js';
6
6
  export { B as BaseError } from './BaseError-7688f84e.js';
7
7
  export { F as FormattedBlock, a as FormattedTransaction, b as FormattedTransactionRequest, f as formatBlock, c as formatTransaction, d as formatTransactionRequest } from './transactionRequest-ade896ac.js';
8
8
  export { H as HttpRequestError, R as RpcError, T as TimeoutError } from './rpc-3c0e3985.js';
package/dist/index.js CHANGED
@@ -57,7 +57,7 @@ import {
57
57
  watchBlockNumber,
58
58
  watchBlocks,
59
59
  watchPendingTransactions
60
- } from "./chunk-LLYFXUSV.js";
60
+ } from "./chunk-4HNVS7AM.js";
61
61
  import {
62
62
  UrlRequiredError,
63
63
  createClient,
@@ -69,7 +69,7 @@ import {
69
69
  fallback,
70
70
  http,
71
71
  webSocket
72
- } from "./chunk-OQTFTQTO.js";
72
+ } from "./chunk-YQRTXQ2G.js";
73
73
  import {
74
74
  BaseError,
75
75
  HttpRequestError,
@@ -101,6 +101,7 @@ import {
101
101
  decodeRlp,
102
102
  encodeAbi,
103
103
  encodeBytes,
104
+ encodeFunctionParams,
104
105
  encodeHex,
105
106
  encodeRlp,
106
107
  etherUnits,
@@ -144,7 +145,7 @@ import {
144
145
  transactionType,
145
146
  trim,
146
147
  weiUnits
147
- } from "./chunk-Z6LRV6XI.js";
148
+ } from "./chunk-3EOU525X.js";
148
149
  export {
149
150
  BaseError,
150
151
  HttpRequestError,
@@ -188,6 +189,7 @@ export {
188
189
  dropTransaction,
189
190
  encodeAbi,
190
191
  encodeBytes,
192
+ encodeFunctionParams,
191
193
  encodeHex,
192
194
  encodeRlp,
193
195
  estimateGas,
@@ -1,8 +1,25 @@
1
- import { AbiParameter, AbiParametersToPrimitiveTypes } from 'abitype';
1
+ import { Abi, AbiFunction, ExtractAbiFunction, AbiParametersToPrimitiveTypes, AbiParameter, ExtractAbiFunctionNames } from 'abitype';
2
2
  import { H as Hex, A as Address, f as ByteArray } from './rpc-655c0ba4.js';
3
3
  import { B as BaseError } from './BaseError-7688f84e.js';
4
4
  import { R as RpcError } from './rpc-3c0e3985.js';
5
5
 
6
+ type ExtractArgsFromAbi<TAbi extends Abi | readonly unknown[], TFunctionName extends string, TAbiFunction extends AbiFunction & {
7
+ type: 'function';
8
+ } = TAbi extends Abi ? ExtractAbiFunction<TAbi, TFunctionName> : AbiFunction & {
9
+ type: 'function';
10
+ }, TArgs = AbiParametersToPrimitiveTypes<TAbiFunction['inputs']>, FailedToParseArgs = ([TArgs] extends [never] ? true : false) | (readonly unknown[] extends TArgs ? true : false)> = true extends FailedToParseArgs ? {
11
+ /**
12
+ * Arguments to pass contract method
13
+ *
14
+ * Use a [const assertion](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html#const-assertions) on {@link abi} for type inference.
15
+ */
16
+ args?: readonly unknown[];
17
+ } : TArgs extends readonly [] ? {
18
+ args?: never;
19
+ } : {
20
+ /** Arguments to pass contract method */ args: TArgs;
21
+ };
22
+
6
23
  declare function decodeAbi<TParams extends readonly AbiParameter[]>({ data, params, }: {
7
24
  data: Hex;
8
25
  params: TParams;
@@ -22,7 +39,7 @@ declare class InvalidAbiDecodingTypeError extends BaseError {
22
39
  declare function encodeAbi<TParams extends readonly AbiParameter[]>({ params, values, }: {
23
40
  params: TParams;
24
41
  values: AbiParametersToPrimitiveTypes<TParams>;
25
- }): `0x${string}`;
42
+ }): `0x${string}` | undefined;
26
43
  declare class AbiEncodingArrayLengthMismatchError extends BaseError {
27
44
  name: string;
28
45
  constructor({ expectedLength, givenLength, type, }: {
@@ -47,6 +64,11 @@ declare class InvalidArrayError extends BaseError {
47
64
  constructor(value: unknown);
48
65
  }
49
66
 
67
+ declare function encodeFunctionParams<TAbi extends Abi = Abi, TFunctionName extends ExtractAbiFunctionNames<TAbi> = any>({ abi, args, functionName, }: {
68
+ abi: TAbi;
69
+ functionName: TFunctionName;
70
+ } & ExtractArgsFromAbi<TAbi, TFunctionName>): `0x${string}`;
71
+
50
72
  declare function getAddress(address: Address): `0x${string}`;
51
73
 
52
74
  type GetCreateAddressOptions = {
@@ -305,7 +327,7 @@ declare function decodeRlp<TTo extends 'bytes' | 'hex'>(value: ByteArray | Hex,
305
327
 
306
328
  declare const getEventSignature: (event: `${string}(${string})`) => `0x${string}`;
307
329
 
308
- declare const getFunctionSignature: (fn: string) => string;
330
+ declare const getFunctionSignature: (fn: string) => `0x${string}`;
309
331
 
310
332
  type To = 'hex' | 'bytes';
311
333
  type Keccak256Hash<TTo extends To> = TTo extends 'bytes' ? ByteArray : TTo extends 'hex' ? Hex : never;
@@ -323,4 +345,4 @@ declare function parseEther(ether: `${number}`, unit?: 'wei' | 'gwei'): bigint;
323
345
 
324
346
  declare function parseGwei(ether: `${number}`, unit?: 'wei'): bigint;
325
347
 
326
- export { keccak256 as $, AbiDecodingDataSizeInvalidError as A, encodeHex as B, encodeRlp as C, getAddress as D, EncodeRlpResponse as E, getContractAddress as F, GetContractAddressOptions as G, getCreateAddress as H, InvalidAbiDecodingTypeError as I, JsonRpcVersionUnsupportedError as J, getCreate2Address as K, LimitExceededRpcError as L, MethodNotFoundRpcError as M, getEventSignature as N, getFunctionSignature as O, ParseRpcError as P, formatEther as Q, ResourceNotFoundRpcError as R, isAddress as S, TransactionRejectedRpcError as T, isAddressEqual as U, isBytes as V, isHex as W, hexToBigInt as X, hexToBool as Y, hexToBytes as Z, hexToString as _, AbiEncodingArrayLengthMismatchError as a, numberToBytes as a0, pad as a1, padBytes as a2, padHex as a3, parseEther as a4, parseGwei as a5, parseUnit as a6, formatGwei as a7, formatUnit as a8, hexToNumber as a9, numberToHex as aa, size as ab, slice as ac, sliceBytes as ad, sliceHex as ae, stringToBytes as af, stringToHex as ag, trim as ah, buildRequest as ai, AbiEncodingLengthMismatchError as b, GetCreateAddressOptions as c, GetCreate2AddressOptions as d, InvalidAbiEncodingTypeError as e, InvalidArrayError as f, InternalRpcError as g, InvalidInputRpcError as h, InvalidParamsRpcError as i, InvalidRequestRpcError as j, MethodNotSupportedRpcError as k, ResourceUnavailableRpcError as l, RpcRequestError as m, bytesToHex as n, bytesToString as o, boolToBytes as p, boolToHex as q, bytesToBigint as r, bytesToBool as s, bytesToNumber as t, decodeAbi as u, decodeBytes as v, decodeHex as w, decodeRlp as x, encodeAbi as y, encodeBytes as z };
348
+ export { hexToString as $, AbiDecodingDataSizeInvalidError as A, encodeFunctionParams as B, encodeHex as C, encodeRlp as D, EncodeRlpResponse as E, getAddress as F, GetContractAddressOptions as G, getContractAddress as H, InvalidAbiDecodingTypeError as I, JsonRpcVersionUnsupportedError as J, getCreateAddress as K, LimitExceededRpcError as L, MethodNotFoundRpcError as M, getCreate2Address as N, getEventSignature as O, ParseRpcError as P, getFunctionSignature as Q, ResourceNotFoundRpcError as R, formatEther as S, TransactionRejectedRpcError as T, isAddress as U, isAddressEqual as V, isBytes as W, isHex as X, hexToBigInt as Y, hexToBool as Z, hexToBytes as _, AbiEncodingArrayLengthMismatchError as a, keccak256 as a0, numberToBytes as a1, pad as a2, padBytes as a3, padHex as a4, parseEther as a5, parseGwei as a6, parseUnit as a7, formatGwei as a8, formatUnit as a9, hexToNumber as aa, numberToHex as ab, size as ac, slice as ad, sliceBytes as ae, sliceHex as af, stringToBytes as ag, stringToHex as ah, trim as ai, buildRequest as aj, AbiEncodingLengthMismatchError as b, GetCreateAddressOptions as c, GetCreate2AddressOptions as d, InvalidAbiEncodingTypeError as e, InvalidArrayError as f, InternalRpcError as g, InvalidInputRpcError as h, InvalidParamsRpcError as i, InvalidRequestRpcError as j, MethodNotSupportedRpcError as k, ResourceUnavailableRpcError as l, RpcRequestError as m, bytesToHex as n, bytesToString as o, boolToBytes as p, boolToHex as q, bytesToBigint as r, bytesToBool as s, bytesToNumber as t, decodeAbi as u, decodeBytes as v, decodeHex as w, decodeRlp as x, encodeAbi as y, encodeBytes as z };
@@ -1,4 +1,4 @@
1
- export { A as AbiDecodingDataSizeInvalidError, a as AbiEncodingArrayLengthMismatchError, b as AbiEncodingLengthMismatchError, E as EncodeRlpResponse, G as GetContractAddressOptions, d as GetCreate2AddressOptions, c as GetCreateAddressOptions, g as InternalRpcError, I as InvalidAbiDecodingTypeError, e as InvalidAbiEncodingTypeError, f as InvalidArrayError, h as InvalidInputRpcError, i as InvalidParamsRpcError, j as InvalidRequestRpcError, J as JsonRpcVersionUnsupportedError, L as LimitExceededRpcError, M as MethodNotFoundRpcError, k as MethodNotSupportedRpcError, P as ParseRpcError, R as ResourceNotFoundRpcError, l as ResourceUnavailableRpcError, m as RpcRequestError, T as TransactionRejectedRpcError, p as boolToBytes, q as boolToHex, ai as buildRequest, r as bytesToBigint, s as bytesToBool, n as bytesToHex, t as bytesToNumber, o as bytesToString, u as decodeAbi, v as decodeBytes, w as decodeHex, x as decodeRlp, y as encodeAbi, z as encodeBytes, B as encodeHex, C as encodeRlp, Q as formatEther, a7 as formatGwei, a8 as formatUnit, D as getAddress, F as getContractAddress, K as getCreate2Address, H as getCreateAddress, N as getEventSignature, O as getFunctionSignature, X as hexToBigInt, Y as hexToBool, Z as hexToBytes, a9 as hexToNumber, _ as hexToString, S as isAddress, U as isAddressEqual, V as isBytes, W as isHex, $ as keccak256, a0 as numberToBytes, aa as numberToHex, a1 as pad, a2 as padBytes, a3 as padHex, a4 as parseEther, a5 as parseGwei, a6 as parseUnit, ab as size, ac as slice, ad as sliceBytes, ae as sliceHex, af as stringToBytes, ag as stringToHex, ah as trim } from '../parseGwei-bbc055e4.js';
1
+ export { A as AbiDecodingDataSizeInvalidError, a as AbiEncodingArrayLengthMismatchError, b as AbiEncodingLengthMismatchError, E as EncodeRlpResponse, G as GetContractAddressOptions, d as GetCreate2AddressOptions, c as GetCreateAddressOptions, g as InternalRpcError, I as InvalidAbiDecodingTypeError, e as InvalidAbiEncodingTypeError, f as InvalidArrayError, h as InvalidInputRpcError, i as InvalidParamsRpcError, j as InvalidRequestRpcError, J as JsonRpcVersionUnsupportedError, L as LimitExceededRpcError, M as MethodNotFoundRpcError, k as MethodNotSupportedRpcError, P as ParseRpcError, R as ResourceNotFoundRpcError, l as ResourceUnavailableRpcError, m as RpcRequestError, T as TransactionRejectedRpcError, p as boolToBytes, q as boolToHex, aj as buildRequest, r as bytesToBigint, s as bytesToBool, n as bytesToHex, t as bytesToNumber, o as bytesToString, u as decodeAbi, v as decodeBytes, w as decodeHex, x as decodeRlp, y as encodeAbi, z as encodeBytes, B as encodeFunctionParams, C as encodeHex, D as encodeRlp, S as formatEther, a8 as formatGwei, a9 as formatUnit, F as getAddress, H as getContractAddress, N as getCreate2Address, K as getCreateAddress, O as getEventSignature, Q as getFunctionSignature, Y as hexToBigInt, Z as hexToBool, _ as hexToBytes, aa as hexToNumber, $ as hexToString, U as isAddress, V as isAddressEqual, W as isBytes, X as isHex, a0 as keccak256, a1 as numberToBytes, ab as numberToHex, a2 as pad, a3 as padBytes, a4 as padHex, a5 as parseEther, a6 as parseGwei, a7 as parseUnit, ac as size, ad as slice, ae as sliceBytes, af as sliceHex, ag as stringToBytes, ah as stringToHex, ai as trim } from '../parseGwei-fd7a0f7d.js';
2
2
  export { B as BaseError } from '../BaseError-7688f84e.js';
3
3
  export { B as BlockFormatter, E as ExtractFormatter, e as Formatted, F as FormattedBlock, a as FormattedTransaction, h as FormattedTransactionReceipt, b as FormattedTransactionRequest, g as TransactionFormatter, i as TransactionReceiptFormatter, T as TransactionRequestFormatter, j as format, f as formatBlock, c as formatTransaction, d as formatTransactionRequest } from '../transactionRequest-ade896ac.js';
4
4
  export { H as HttpRequestError, R as RpcError, T as TimeoutError, r as rpc } from '../rpc-3c0e3985.js';
@@ -30,6 +30,7 @@ import {
30
30
  decodeRlp,
31
31
  encodeAbi,
32
32
  encodeBytes,
33
+ encodeFunctionParams,
33
34
  encodeHex,
34
35
  encodeRlp,
35
36
  extractFunctionName,
@@ -74,7 +75,7 @@ import {
74
75
  stringToBytes,
75
76
  stringToHex,
76
77
  trim
77
- } from "../chunk-Z6LRV6XI.js";
78
+ } from "../chunk-3EOU525X.js";
78
79
  export {
79
80
  BaseError,
80
81
  HttpRequestError,
@@ -107,6 +108,7 @@ export {
107
108
  decodeRlp,
108
109
  encodeAbi,
109
110
  encodeBytes,
111
+ encodeFunctionParams,
110
112
  encodeHex,
111
113
  encodeRlp,
112
114
  extractFunctionName,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "viem",
3
3
  "description": "TypeScript (& JavaScript) Interface for Ethereum",
4
- "version": "0.0.1-alpha.1",
4
+ "version": "0.0.1-alpha.2",
5
5
  "files": [
6
6
  "/actions",
7
7
  "/chains",