viem 0.0.1-alpha.3 → 0.0.1-alpha.31

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 (101) hide show
  1. package/chains/package.json +1 -1
  2. package/contract/package.json +4 -0
  3. package/dist/chain-00b37e4e.d.ts +543 -0
  4. package/dist/chain-38182d92.d.ts +5 -0
  5. package/dist/chains.d.ts +1305 -74
  6. package/dist/chains.js +125 -130
  7. package/dist/chains.js.map +1 -0
  8. package/dist/chains.mjs +129 -0
  9. package/dist/chains.mjs.map +1 -0
  10. package/dist/chunk-5STAX3WF.js +265 -0
  11. package/dist/chunk-5STAX3WF.js.map +1 -0
  12. package/dist/chunk-6ZFIUYGC.mjs +3436 -0
  13. package/dist/chunk-6ZFIUYGC.mjs.map +1 -0
  14. package/dist/chunk-APXHGB76.mjs +197 -0
  15. package/dist/chunk-APXHGB76.mjs.map +1 -0
  16. package/dist/chunk-C54QK7K3.mjs +210 -0
  17. package/dist/chunk-C54QK7K3.mjs.map +1 -0
  18. package/dist/{chunk-YZEQFYZ3.js → chunk-IBWRBL2I.mjs} +725 -556
  19. package/dist/chunk-IBWRBL2I.mjs.map +1 -0
  20. package/dist/chunk-J7QHQ26Y.js +3436 -0
  21. package/dist/chunk-J7QHQ26Y.js.map +1 -0
  22. package/dist/chunk-MYFKW55L.js +210 -0
  23. package/dist/chunk-MYFKW55L.js.map +1 -0
  24. package/dist/chunk-NCPBWOQA.js +1216 -0
  25. package/dist/chunk-NCPBWOQA.js.map +1 -0
  26. package/dist/chunk-QBB3DFIB.mjs +265 -0
  27. package/dist/chunk-QBB3DFIB.mjs.map +1 -0
  28. package/dist/chunk-UUULPQHV.js +197 -0
  29. package/dist/chunk-UUULPQHV.js.map +1 -0
  30. package/dist/contract.d.ts +11 -0
  31. package/dist/contract.js +57 -0
  32. package/dist/contract.js.map +1 -0
  33. package/dist/contract.mjs +57 -0
  34. package/dist/contract.mjs.map +1 -0
  35. package/dist/createClient-5258d590.d.ts +70 -0
  36. package/dist/createPublicClient-99be385b.d.ts +650 -0
  37. package/dist/{eip1193-8b4d90ce.d.ts → eip1193-fcdeee04.d.ts} +13 -10
  38. package/dist/ens.d.ts +22 -0
  39. package/dist/ens.js +22 -0
  40. package/dist/ens.js.map +1 -0
  41. package/dist/ens.mjs +22 -0
  42. package/dist/ens.mjs.map +1 -0
  43. package/dist/formatAbiItem-50cb39d8.d.ts +14 -0
  44. package/dist/getAbiItem-6d4f64d2.d.ts +97 -0
  45. package/dist/index.d.ts +251 -67
  46. package/dist/index.js +769 -344
  47. package/dist/index.js.map +1 -0
  48. package/dist/index.mjs +769 -0
  49. package/dist/index.mjs.map +1 -0
  50. package/dist/namehash-88f4639d.d.ts +22 -0
  51. package/dist/parseGwei-8af7a0a6.d.ts +509 -0
  52. package/dist/public.d.ts +29 -0
  53. package/dist/public.js +60 -0
  54. package/dist/public.js.map +1 -0
  55. package/dist/public.mjs +60 -0
  56. package/dist/public.mjs.map +1 -0
  57. package/dist/test-79ec416c.d.ts +213 -0
  58. package/dist/test.d.ts +20 -0
  59. package/dist/test.js +62 -0
  60. package/dist/test.js.map +1 -0
  61. package/dist/test.mjs +62 -0
  62. package/dist/test.mjs.map +1 -0
  63. package/dist/utils/index.d.ts +52 -7
  64. package/dist/utils/index.js +187 -126
  65. package/dist/utils/index.js.map +1 -0
  66. package/dist/utils/index.mjs +187 -0
  67. package/dist/utils/index.mjs.map +1 -0
  68. package/dist/wallet-cf5c8351.d.ts +115 -0
  69. package/dist/wallet.d.ts +7 -0
  70. package/dist/wallet.js +24 -0
  71. package/dist/wallet.js.map +1 -0
  72. package/dist/wallet.mjs +24 -0
  73. package/dist/wallet.mjs.map +1 -0
  74. package/dist/window.d.ts +5 -2
  75. package/dist/window.js +1 -0
  76. package/dist/window.js.map +1 -0
  77. package/dist/window.mjs +1 -0
  78. package/dist/window.mjs.map +1 -0
  79. package/ens/package.json +4 -0
  80. package/package.json +46 -73
  81. package/public/package.json +4 -0
  82. package/test/package.json +4 -0
  83. package/utils/package.json +1 -1
  84. package/wallet/package.json +4 -0
  85. package/window/package.json +1 -1
  86. package/actions/package.json +0 -4
  87. package/clients/package.json +0 -4
  88. package/dist/actions/index.d.ts +0 -7
  89. package/dist/actions/index.js +0 -124
  90. package/dist/chunk-SRDTRROA.js +0 -1214
  91. package/dist/chunk-TLEMV4T3.js +0 -258
  92. package/dist/chunk-WZITKXV3.js +0 -996
  93. package/dist/clients/index.d.ts +0 -7
  94. package/dist/clients/index.js +0 -23
  95. package/dist/createWalletClient-15ad1601.d.ts +0 -130
  96. package/dist/parseGwei-0f85e8ca.d.ts +0 -248
  97. package/dist/rpc-15b85963.d.ts +0 -292
  98. package/dist/rpc-26932bae.d.ts +0 -61
  99. package/dist/transactionRequest-f538ea86.d.ts +0 -44
  100. package/dist/watchAsset-0c9d01e2.d.ts +0 -522
  101. package/dist/webSocket-b55b0951.d.ts +0 -83
@@ -1,4 +1,4 @@
1
- import { A as Address, H as Hash, Q as Quantity, s as RpcTransactionRequest, m as RpcBlockNumber, b as BlockTag, l as RpcBlockIdentifier, a as Hex, P as RpcEstimateGasParameters, n as RpcFeeHistory, R as RpcBlock, p as RpcLog, q as RpcTransaction, r as RpcTransactionReceipt, u as RpcUncle } from './rpc-15b85963.js';
1
+ import { A as Address, a as Hash, a3 as Quantity, s as RpcTransactionRequest, m as RpcBlockNumber, g as BlockTag, l as RpcBlockIdentifier, H as Hex, n as RpcFeeHistory, R as RpcBlock, p as RpcLog, a6 as LogTopic, q as RpcTransaction, r as RpcTransactionReceipt, t as RpcUncle } from './chain-00b37e4e.js';
2
2
 
3
3
  declare class RpcError extends Error {
4
4
  code: number;
@@ -35,7 +35,7 @@ type Chain = {
35
35
  symbol: string;
36
36
  decimals: number;
37
37
  };
38
- rpcUrls: string[];
38
+ rpcUrls: readonly string[];
39
39
  blockExplorerUrls?: string[];
40
40
  iconUrls?: string[];
41
41
  };
@@ -179,7 +179,7 @@ type PublicRequests = {
179
179
  * // => '0x5208'
180
180
  * */
181
181
  method: 'eth_estimateGas';
182
- params: [parameters: RpcEstimateGasParameters, block: RpcBlockNumber | BlockTag];
182
+ params: [parameters: RpcTransactionRequest, block: RpcBlockNumber | BlockTag];
183
183
  }): Promise<Quantity>;
184
184
  request(args: {
185
185
  /**
@@ -331,22 +331,25 @@ type PublicRequests = {
331
331
  * @description Returns a list of all logs based on a filter object
332
332
  * @link https://eips.ethereum.org/EIPS/eip-1474
333
333
  * @example
334
- * provider.request({ method: 'eth_getLogs', params: [{ ... }] })
334
+ * provider.request({ method: 'eth_getLogs', params: [{ fromBlock: '0x...', toBlock: '0x...', address: '0x...', topics: ['0x...'] }] })
335
335
  * // => [{ ... }, { ... }]
336
336
  * */
337
337
  method: 'eth_getLogs';
338
338
  params: [
339
- filter: {
339
+ parameters: {
340
340
  address?: Address | Address[];
341
- topics?: Hex[];
341
+ topics?: LogTopic[];
342
342
  } & ({
343
343
  fromBlock?: RpcBlockNumber | BlockTag;
344
344
  toBlock?: RpcBlockNumber | BlockTag;
345
+ blockHash?: never;
345
346
  } | {
347
+ fromBlock?: never;
348
+ toBlock?: never;
346
349
  blockHash?: Hash;
347
350
  })
348
351
  ];
349
- }): Promise<RpcLog>;
352
+ }): Promise<RpcLog[]>;
350
353
  request(args: {
351
354
  /**
352
355
  * @description Returns the value from a storage position at an address
@@ -361,7 +364,7 @@ type PublicRequests = {
361
364
  index: Quantity,
362
365
  block: RpcBlockNumber | BlockTag | RpcBlockIdentifier
363
366
  ];
364
- }): Promise<RpcLog>;
367
+ }): Promise<Hex>;
365
368
  request(args: {
366
369
  /**
367
370
  * @description Returns information about a transaction specified by block hash and transaction index
@@ -405,7 +408,7 @@ type PublicRequests = {
405
408
  * */
406
409
  method: 'eth_getTransactionCount';
407
410
  params: [address: Address, block: RpcBlockNumber | BlockTag | RpcBlockIdentifier];
408
- }): Promise<Quantity | null>;
411
+ }): Promise<Quantity>;
409
412
  request(args: {
410
413
  /**
411
414
  * @description Returns the receipt of a transaction specified by hash
@@ -486,7 +489,7 @@ type PublicRequests = {
486
489
  fromBlock?: RpcBlockNumber | BlockTag;
487
490
  toBlock?: RpcBlockNumber | BlockTag;
488
491
  address?: Address | Address[];
489
- topics?: (Hex | Hex[] | null)[];
492
+ topics?: LogTopic[];
490
493
  }
491
494
  ];
492
495
  }): Promise<Quantity>;
package/dist/ens.d.ts ADDED
@@ -0,0 +1,22 @@
1
+ export { z as GetEnsAddressArgs, A as GetEnsNameArgs, D as getEnsAddress, H as getEnsName } from './createPublicClient-99be385b.js';
2
+ export { l as labelhash, n as namehash } from './namehash-88f4639d.js';
3
+ import './eip1193-fcdeee04.js';
4
+ import './chain-00b37e4e.js';
5
+ import '@wagmi/chains';
6
+ import 'abitype';
7
+ import 'ethers@6/types/providers';
8
+ import './createClient-5258d590.js';
9
+ import './wallet-cf5c8351.js';
10
+
11
+ /**
12
+ * @description Normalizes ENS name
13
+ *
14
+ * @example
15
+ * normalize('wagmi-dev.eth')
16
+ * 'wagmi-dev.eth'
17
+ *
18
+ * @see https://docs.ens.domains/contract-api-reference/name-processing#normalising-names
19
+ */
20
+ declare function normalize(name: string): string;
21
+
22
+ export { normalize };
package/dist/ens.js ADDED
@@ -0,0 +1,22 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+ var _chunkMYFKW55Ljs = require('./chunk-MYFKW55L.js');
7
+ require('./chunk-NCPBWOQA.js');
8
+ require('./chunk-J7QHQ26Y.js');
9
+
10
+ // src/utils/ens/normalize.ts
11
+ var _idnauts46hx = require('idna-uts46-hx');
12
+ function normalize(name) {
13
+ return _idnauts46hx.toUnicode.call(void 0, name, { useStd3ASCII: true });
14
+ }
15
+
16
+
17
+
18
+
19
+
20
+
21
+ exports.getEnsAddress = _chunkMYFKW55Ljs.getEnsAddress; exports.getEnsName = _chunkMYFKW55Ljs.getEnsName; exports.labelhash = _chunkMYFKW55Ljs.labelhash; exports.namehash = _chunkMYFKW55Ljs.namehash; exports.normalize = normalize;
22
+ //# sourceMappingURL=ens.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/ens/normalize.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,SAAS,iBAAiB;AAWnB,SAAS,UAAU,MAAc;AACtC,SAAO,UAAU,MAAM,EAAE,cAAc,KAAK,CAAC;AAC/C","sourcesContent":["import { toUnicode } from 'idna-uts46-hx'\n\n/**\n * @description Normalizes ENS name\n *\n * @example\n * normalize('wagmi-dev.eth')\n * 'wagmi-dev.eth'\n *\n * @see https://docs.ens.domains/contract-api-reference/name-processing#normalising-names\n */\nexport function normalize(name: string) {\n return toUnicode(name, { useStd3ASCII: true })\n}\n"]}
package/dist/ens.mjs ADDED
@@ -0,0 +1,22 @@
1
+ import {
2
+ getEnsAddress,
3
+ getEnsName,
4
+ labelhash,
5
+ namehash
6
+ } from "./chunk-C54QK7K3.mjs";
7
+ import "./chunk-IBWRBL2I.mjs";
8
+ import "./chunk-6ZFIUYGC.mjs";
9
+
10
+ // src/utils/ens/normalize.ts
11
+ import { toUnicode } from "idna-uts46-hx";
12
+ function normalize(name) {
13
+ return toUnicode(name, { useStd3ASCII: true });
14
+ }
15
+ export {
16
+ getEnsAddress,
17
+ getEnsName,
18
+ labelhash,
19
+ namehash,
20
+ normalize
21
+ };
22
+ //# sourceMappingURL=ens.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/ens/normalize.ts"],"sourcesContent":["import { toUnicode } from 'idna-uts46-hx'\n\n/**\n * @description Normalizes ENS name\n *\n * @example\n * normalize('wagmi-dev.eth')\n * 'wagmi-dev.eth'\n *\n * @see https://docs.ens.domains/contract-api-reference/name-processing#normalising-names\n */\nexport function normalize(name: string) {\n return toUnicode(name, { useStd3ASCII: true })\n}\n"],"mappings":";;;;;;;;;;AAAA,SAAS,iBAAiB;AAWnB,SAAS,UAAU,MAAc;AACtC,SAAO,UAAU,MAAM,EAAE,cAAc,KAAK,CAAC;AAC/C;","names":[]}
@@ -0,0 +1,14 @@
1
+ import { b as AbiItem } from './chain-00b37e4e.js';
2
+
3
+ declare function formatAbiItemWithArgs({ abiItem, args, includeFunctionName, includeName, }: {
4
+ abiItem: AbiItem;
5
+ args: readonly unknown[];
6
+ includeFunctionName?: boolean;
7
+ includeName?: boolean;
8
+ }): string | undefined;
9
+
10
+ declare function formatAbiItem(abiItem: AbiItem, { includeName }?: {
11
+ includeName?: boolean;
12
+ }): string;
13
+
14
+ export { formatAbiItem as a, formatAbiItemWithArgs as f };
@@ -0,0 +1,97 @@
1
+ import { AbiParameter, Narrow, Abi, AbiParametersToPrimitiveTypes } from 'abitype';
2
+ import { H as Hex, b as AbiItem, a6 as LogTopic, a0 as ExtractEventNameFromAbi, a7 as ExtractEventArgsFromTopics, a8 as ExtractFunctionNameFromAbi, a9 as ExtractArgsFromAbi, Z as ExtractResultFromAbi, a4 as ExtractConstructorArgsFromAbi, aa as ExtractErrorNameFromAbi, ab as ExtractErrorArgsFromAbi, a1 as ExtractEventArgsFromAbi, ac as ExtractNameFromAbi } from './chain-00b37e4e.js';
3
+ import * as abitype_dist_abi_78346466 from 'abitype/dist/abi-78346466';
4
+
5
+ type DecodeAbiArgs<TParams extends readonly AbiParameter[] | readonly unknown[] = readonly AbiParameter[]> = {
6
+ data: Hex;
7
+ params: Narrow<TParams>;
8
+ };
9
+ declare function decodeAbi<TParams extends readonly AbiParameter[] | readonly unknown[]>({ data, params }: DecodeAbiArgs<TParams>): readonly unknown[] | undefined;
10
+
11
+ type DecodeErrorResultArgs = {
12
+ abi?: Abi;
13
+ data: Hex;
14
+ };
15
+ type DecodeErrorResultResponse = {
16
+ abiItem: AbiItem;
17
+ errorName: string;
18
+ args?: readonly unknown[];
19
+ };
20
+ declare function decodeErrorResult({ abi, data, }: DecodeErrorResultArgs): DecodeErrorResultResponse;
21
+
22
+ type DecodeEventLogArgs<TAbi extends Abi | readonly unknown[] = Abi, TEventName extends string = string, TTopics extends LogTopic[] = LogTopic[], TData extends Hex | undefined = undefined> = {
23
+ abi: Narrow<TAbi>;
24
+ data?: TData;
25
+ eventName?: ExtractEventNameFromAbi<TAbi, TEventName>;
26
+ topics: [signature: Hex, ...args: TTopics];
27
+ };
28
+ type DecodeEventLogResponse<TAbi extends Abi | readonly unknown[] = Abi, TEventName extends string = string, TTopics extends LogTopic[] = LogTopic[], TData extends Hex | undefined = undefined> = {
29
+ eventName: TEventName;
30
+ } & ExtractEventArgsFromTopics<TAbi, TEventName, TTopics, TData>;
31
+ declare function decodeEventLog<TAbi extends Abi | readonly unknown[], TEventName extends string, TTopics extends LogTopic[], TData extends Hex | undefined = undefined>({ abi, data, topics, }: DecodeEventLogArgs<TAbi, TEventName, TTopics, TData>): DecodeEventLogResponse<TAbi, TEventName, TTopics, TData>;
32
+
33
+ type DecodeFunctionDataArgs = {
34
+ abi: Abi | readonly unknown[];
35
+ data: Hex;
36
+ };
37
+ declare function decodeFunctionData({ abi, data }: DecodeFunctionDataArgs): {
38
+ functionName: string;
39
+ args: readonly unknown[] | undefined;
40
+ };
41
+
42
+ type DecodeFunctionResultArgs<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string> = {
43
+ abi: Narrow<TAbi>;
44
+ functionName: ExtractFunctionNameFromAbi<TAbi, TFunctionName>;
45
+ data: Hex;
46
+ } & Partial<ExtractArgsFromAbi<TAbi, TFunctionName>>;
47
+ type DecodeFunctionResultResponse<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string> = ExtractResultFromAbi<TAbi, TFunctionName>;
48
+ declare function decodeFunctionResult<TAbi extends Abi | readonly unknown[], TFunctionName extends string>({ abi, args, functionName, data, }: DecodeFunctionResultArgs<TAbi, TFunctionName>): DecodeFunctionResultResponse<TAbi, TFunctionName>;
49
+
50
+ type EncodeAbiArgs<TParams extends readonly AbiParameter[] | readonly unknown[] = readonly AbiParameter[]> = {
51
+ params: Narrow<TParams>;
52
+ values: TParams extends readonly AbiParameter[] ? AbiParametersToPrimitiveTypes<TParams> : never;
53
+ };
54
+ /**
55
+ * @description Encodes a list of primitive values into an ABI-encoded hex value.
56
+ */
57
+ declare function encodeAbi<TParams extends readonly AbiParameter[] | readonly unknown[]>({ params, values }: EncodeAbiArgs<TParams>): `0x${string}`;
58
+
59
+ type EncodeDeployDataArgs<TAbi extends Abi | readonly unknown[] = Abi> = {
60
+ abi: Narrow<TAbi>;
61
+ bytecode: Hex;
62
+ } & ExtractConstructorArgsFromAbi<TAbi>;
63
+ declare function encodeDeployData<TAbi extends Abi | readonly unknown[]>({ abi, args, bytecode, }: EncodeDeployDataArgs<TAbi>): `0x${string}`;
64
+
65
+ type EncodeErrorResultArgs<TAbi extends Abi | readonly unknown[] = Abi, TErrorName extends string = string> = {
66
+ abi: Narrow<TAbi>;
67
+ errorName: ExtractErrorNameFromAbi<TAbi, TErrorName>;
68
+ } & ExtractErrorArgsFromAbi<TAbi, TErrorName>;
69
+ declare function encodeErrorResult<TAbi extends Abi | readonly unknown[], TErrorName extends string>({ abi, errorName, args }: EncodeErrorResultArgs<TAbi, TErrorName>): `0x${string}`;
70
+
71
+ type EncodeEventTopicsArgs<TAbi extends Abi | readonly unknown[] = Abi, TEventName extends string = string> = {
72
+ abi: Narrow<TAbi>;
73
+ args?: ExtractEventArgsFromAbi<TAbi, TEventName>;
74
+ eventName: ExtractEventNameFromAbi<TAbi, TEventName>;
75
+ };
76
+ declare function encodeEventTopics<TAbi extends Abi | readonly unknown[], TEventName extends string>({ abi, eventName, args }: EncodeEventTopicsArgs<TAbi, TEventName>): `0x${string}`[];
77
+
78
+ type EncodeFunctionDataArgs<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string> = {
79
+ abi: Narrow<TAbi>;
80
+ functionName: ExtractFunctionNameFromAbi<TAbi, TFunctionName>;
81
+ } & ExtractArgsFromAbi<TAbi, TFunctionName>;
82
+ declare function encodeFunctionData<TAbi extends Abi | readonly unknown[], TFunctionName extends string>({ abi, args, functionName }: EncodeFunctionDataArgs<TAbi, TFunctionName>): `0x${string}`;
83
+
84
+ type EncodeFunctionResultArgs<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string> = {
85
+ abi: Narrow<TAbi>;
86
+ functionName: ExtractFunctionNameFromAbi<TAbi, TFunctionName>;
87
+ result?: ExtractResultFromAbi<TAbi, TFunctionName>;
88
+ };
89
+ declare function encodeFunctionResult<TAbi extends Abi | readonly unknown[], TFunctionName extends string>({ abi, functionName, result, }: EncodeFunctionResultArgs<TAbi, TFunctionName>): `0x${string}`;
90
+
91
+ type GetAbiItemArgs<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = any> = {
92
+ abi: Narrow<TAbi>;
93
+ name: ExtractNameFromAbi<TAbi, TFunctionName>;
94
+ } & Partial<ExtractArgsFromAbi<TAbi, TFunctionName>>;
95
+ declare function getAbiItem<TAbi extends Abi | readonly unknown[], TFunctionName extends string>({ abi, args, name }: GetAbiItemArgs<TAbi, TFunctionName>): abitype_dist_abi_78346466.q | abitype_dist_abi_78346466.p | abitype_dist_abi_78346466.o | undefined;
96
+
97
+ export { DecodeAbiArgs as D, EncodeAbiArgs as E, GetAbiItemArgs as G, DecodeErrorResultArgs as a, DecodeErrorResultResponse as b, DecodeEventLogArgs as c, DecodeEventLogResponse as d, DecodeFunctionDataArgs as e, DecodeFunctionResultArgs as f, DecodeFunctionResultResponse as g, EncodeDeployDataArgs as h, EncodeErrorResultArgs as i, EncodeEventTopicsArgs as j, EncodeFunctionDataArgs as k, EncodeFunctionResultArgs as l, decodeAbi as m, decodeErrorResult as n, decodeEventLog as o, decodeFunctionData as p, decodeFunctionResult as q, encodeAbi as r, encodeDeployData as s, encodeErrorResult as t, encodeEventTopics as u, encodeFunctionData as v, encodeFunctionResult as w, getAbiItem as x };