viem 0.0.1-alpha.34 → 0.0.1-alpha.36

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 (71) hide show
  1. package/README.md +132 -0
  2. package/abi/package.json +4 -0
  3. package/dist/abi.d.ts +5 -0
  4. package/dist/abi.js +11 -0
  5. package/dist/abi.js.map +1 -0
  6. package/dist/abi.mjs +11 -0
  7. package/dist/abi.mjs.map +1 -0
  8. package/dist/{chain-4a0d4164.d.ts → chain-a34aa9a2.d.ts} +65 -63
  9. package/dist/{chain-ce6e149c.d.ts → chain-b1229232.d.ts} +1 -1
  10. package/dist/chains.d.ts +3 -3
  11. package/dist/chains.js +46 -46
  12. package/dist/chains.mjs +1 -1
  13. package/dist/{chunk-EJEZIHXK.js → chunk-4AEFOF5R.js} +21 -23
  14. package/dist/chunk-4AEFOF5R.js.map +1 -0
  15. package/dist/{chunk-VP57P6CD.mjs → chunk-AXATFOBJ.mjs} +1885 -146
  16. package/dist/chunk-AXATFOBJ.mjs.map +1 -0
  17. package/dist/{chunk-KQQLLKZV.mjs → chunk-CUT73KXY.mjs} +3 -5
  18. package/dist/{chunk-KQQLLKZV.mjs.map → chunk-CUT73KXY.mjs.map} +1 -1
  19. package/dist/{chunk-F76TECTY.js → chunk-KXGQFW2R.js} +1907 -168
  20. package/dist/chunk-KXGQFW2R.js.map +1 -0
  21. package/dist/contract.d.ts +7 -8
  22. package/dist/contract.js +2 -6
  23. package/dist/contract.mjs +15 -19
  24. package/dist/{createClient-8a8b4bf4.d.ts → createClient-8024655d.d.ts} +3 -11
  25. package/dist/{createPublicClient-b5afe6b8.d.ts → createPublicClient-f283b09d.d.ts} +155 -39
  26. package/dist/{eip1193-8c021438.d.ts → eip1193-a4f254d2.d.ts} +12 -2
  27. package/dist/{getAbiItem-d7aa40b1.d.ts → encodeFunctionResult-c3d6c7ea.d.ts} +3 -25
  28. package/dist/ens.d.ts +4 -5
  29. package/dist/ens.js +3 -4
  30. package/dist/ens.js.map +1 -1
  31. package/dist/ens.mjs +2 -3
  32. package/dist/ens.mjs.map +1 -1
  33. package/dist/{formatAbiItem-6e00e5e6.d.ts → formatAbiItem-d79cb207.d.ts} +1 -1
  34. package/dist/getAbiItem-48e793da.d.ts +22 -0
  35. package/dist/index.d.ts +27 -17
  36. package/dist/index.js +89 -92
  37. package/dist/index.js.map +1 -1
  38. package/dist/index.mjs +85 -88
  39. package/dist/index.mjs.map +1 -1
  40. package/dist/{parseGwei-ce3a9dfa.d.ts → parseGwei-5dc2744d.d.ts} +11 -23
  41. package/dist/public.d.ts +6 -7
  42. package/dist/public.js +2 -3
  43. package/dist/public.mjs +1 -2
  44. package/dist/{test-5d5828c9.d.ts → test-f8bc2fa7.d.ts} +9 -17
  45. package/dist/test.d.ts +5 -5
  46. package/dist/test.js +2 -3
  47. package/dist/test.mjs +1 -2
  48. package/dist/utils/index.d.ts +27 -18
  49. package/dist/utils/index.js +2 -4
  50. package/dist/utils/index.mjs +11 -13
  51. package/dist/wallet.d.ts +5 -5
  52. package/dist/wallet.js +2 -3
  53. package/dist/wallet.mjs +5 -6
  54. package/dist/window.d.ts +2 -2
  55. package/package.json +8 -2
  56. package/dist/chunk-7ALCXZ5K.js +0 -1216
  57. package/dist/chunk-7ALCXZ5K.js.map +0 -1
  58. package/dist/chunk-EBLS4P77.js +0 -265
  59. package/dist/chunk-EBLS4P77.js.map +0 -1
  60. package/dist/chunk-EJEZIHXK.js.map +0 -1
  61. package/dist/chunk-F76TECTY.js.map +0 -1
  62. package/dist/chunk-IUCGWGPX.js +0 -197
  63. package/dist/chunk-IUCGWGPX.js.map +0 -1
  64. package/dist/chunk-NMET3ZHG.mjs +0 -265
  65. package/dist/chunk-NMET3ZHG.mjs.map +0 -1
  66. package/dist/chunk-TNN5X44H.mjs +0 -197
  67. package/dist/chunk-TNN5X44H.mjs.map +0 -1
  68. package/dist/chunk-VHZHROXW.mjs +0 -1216
  69. package/dist/chunk-VHZHROXW.mjs.map +0 -1
  70. package/dist/chunk-VP57P6CD.mjs.map +0 -1
  71. package/dist/wallet-5ab86528.d.ts +0 -115
@@ -1,11 +1,10 @@
1
- export { D as DecodeAbiArgs, a as DecodeErrorResultArgs, b as DecodeErrorResultResponse, c as DecodeEventLogArgs, d as DecodeEventLogResponse, e as DecodeFunctionDataArgs, f as DecodeFunctionResultArgs, g as DecodeFunctionResultResponse, E as EncodeAbiArgs, h as EncodeDeployDataArgs, i as EncodeErrorResultArgs, j as EncodeEventTopicsArgs, k as EncodeFunctionDataArgs, l as EncodeFunctionResultArgs, G as GetAbiItemArgs, m as decodeAbi, n as decodeErrorResult, o as decodeEventLog, p as decodeFunctionData, q as decodeFunctionResult, r as encodeAbi, s as encodeDeployData, t as encodeErrorResult, u as encodeEventTopics, v as encodeFunctionData, w as encodeFunctionResult, x as getAbiItem } from './getAbiItem-d7aa40b1.js';
2
- export { a as formatAbiItem, f as formatAbiItemWithArgs } from './formatAbiItem-6e00e5e6.js';
3
- export { D as DeployContractArgs, e as DeployContractResponse, b as WriteContractArgs, g as WriteContractResponse, h as deployContract, w as writeContract } from './wallet-5ab86528.js';
4
- export { g as CreateContractEventFilterArgs, h as CreateContractEventFilterResponse, i as EstimateContractGasArgs, j as EstimateContractGasResponse, G as GetBytecodeArgs, k as GetBytecodeResponse, l as GetStorageAtArgs, m as GetStorageAtResponse, M as MulticallArgs, n as MulticallResponse, O as OnLogs, o as OnLogsResponse, R as ReadContractArgs, p as ReadContractResponse, S as SimulateContractArgs, q as SimulateContractResponse, W as WatchContractEventArgs, r as createContractEventFilter, s as estimateContractGas, t as getBytecode, u as getStorageAt, v as multicall, w as readContract, x as simulateContract, y as watchContractEvent } from './createPublicClient-b5afe6b8.js';
1
+ export { D as DecodeAbiParametersResponse, E as EncodeAbiParametersResponse, G as GetAbiItemArgs, d as decodeAbiParameters, e as encodeAbiParameters, g as getAbiItem } from './getAbiItem-48e793da.js';
2
+ export { D as DecodeErrorResultArgs, a as DecodeErrorResultResponse, b as DecodeEventLogArgs, c as DecodeEventLogResponse, d as DecodeFunctionDataArgs, e as DecodeFunctionResultArgs, f as DecodeFunctionResultResponse, E as EncodeDeployDataArgs, g as EncodeErrorResultArgs, h as EncodeEventTopicsArgs, i as EncodeFunctionDataArgs, j as EncodeFunctionResultArgs, k as decodeErrorResult, l as decodeEventLog, m as decodeFunctionData, n as decodeFunctionResult, o as encodeDeployData, p as encodeErrorResult, q as encodeEventTopics, r as encodeFunctionData, s as encodeFunctionResult } from './encodeFunctionResult-c3d6c7ea.js';
3
+ export { a as formatAbiItem, f as formatAbiItemWithArgs } from './formatAbiItem-d79cb207.js';
4
+ export { n as CreateContractEventFilterArgs, o as CreateContractEventFilterResponse, U as DeployContractArgs, V as DeployContractResponse, p as EstimateContractGasArgs, q as EstimateContractGasResponse, G as GetBytecodeArgs, r as GetBytecodeResponse, s as GetStorageAtArgs, t as GetStorageAtResponse, M as MulticallArgs, u as MulticallResponse, O as OnLogs, v as OnLogsResponse, R as ReadContractArgs, w as ReadContractResponse, x as SimulateContractArgs, y as SimulateContractResponse, z as WatchContractEventArgs, X as WriteContractArgs, Y as WriteContractResponse, D as createContractEventFilter, Z as deployContract, H as estimateContractGas, I as getBytecode, J as getStorageAt, K as multicall, L as readContract, N as simulateContract, Q as watchContractEvent, _ as writeContract } from './createPublicClient-f283b09d.js';
5
5
  import 'abitype';
6
- import './chain-4a0d4164.js';
6
+ import './chain-a34aa9a2.js';
7
7
  import '@wagmi/chains';
8
8
  import 'ethers@6/types/providers';
9
- import 'abitype/dist/abi-78346466';
10
- import './eip1193-8c021438.js';
11
- import './createClient-8a8b4bf4.js';
9
+ import './eip1193-a4f254d2.js';
10
+ import './createClient-8024655d.js';
package/dist/contract.js CHANGED
@@ -7,11 +7,9 @@
7
7
 
8
8
 
9
9
 
10
- var _chunk7ALCXZ5Kjs = require('./chunk-7ALCXZ5K.js');
11
10
 
12
11
 
13
12
 
14
- var _chunkIUCGWGPXjs = require('./chunk-IUCGWGPX.js');
15
13
 
16
14
 
17
15
 
@@ -25,9 +23,9 @@ var _chunkIUCGWGPXjs = require('./chunk-IUCGWGPX.js');
25
23
 
26
24
 
27
25
 
26
+ var _chunkKXGQFW2Rjs = require('./chunk-KXGQFW2R.js');
28
27
 
29
28
 
30
- var _chunkF76TECTYjs = require('./chunk-F76TECTY.js');
31
29
 
32
30
 
33
31
 
@@ -51,7 +49,5 @@ var _chunkF76TECTYjs = require('./chunk-F76TECTY.js');
51
49
 
52
50
 
53
51
 
54
-
55
-
56
- exports.createContractEventFilter = _chunk7ALCXZ5Kjs.createContractEventFilter; exports.decodeAbi = _chunkF76TECTYjs.decodeAbi; exports.decodeErrorResult = _chunkF76TECTYjs.decodeErrorResult; exports.decodeEventLog = _chunkF76TECTYjs.decodeEventLog; exports.decodeFunctionData = _chunkF76TECTYjs.decodeFunctionData; exports.decodeFunctionResult = _chunkF76TECTYjs.decodeFunctionResult; exports.deployContract = _chunkIUCGWGPXjs.deployContract; exports.encodeAbi = _chunkF76TECTYjs.encodeAbi; exports.encodeDeployData = _chunkF76TECTYjs.encodeDeployData; exports.encodeErrorResult = _chunkF76TECTYjs.encodeErrorResult; exports.encodeEventTopics = _chunkF76TECTYjs.encodeEventTopics; exports.encodeFunctionData = _chunkF76TECTYjs.encodeFunctionData; exports.encodeFunctionResult = _chunkF76TECTYjs.encodeFunctionResult; exports.estimateContractGas = _chunk7ALCXZ5Kjs.estimateContractGas; exports.formatAbiItem = _chunkF76TECTYjs.formatAbiItem; exports.formatAbiItemWithArgs = _chunkF76TECTYjs.formatAbiItemWithArgs; exports.getAbiItem = _chunkF76TECTYjs.getAbiItem; exports.getBytecode = _chunk7ALCXZ5Kjs.getBytecode; exports.getStorageAt = _chunk7ALCXZ5Kjs.getStorageAt; exports.multicall = _chunk7ALCXZ5Kjs.multicall; exports.readContract = _chunk7ALCXZ5Kjs.readContract; exports.simulateContract = _chunk7ALCXZ5Kjs.simulateContract; exports.watchContractEvent = _chunk7ALCXZ5Kjs.watchContractEvent; exports.writeContract = _chunkIUCGWGPXjs.writeContract;
52
+ exports.createContractEventFilter = _chunkKXGQFW2Rjs.createContractEventFilter; exports.decodeAbiParameters = _chunkKXGQFW2Rjs.decodeAbiParameters; exports.decodeErrorResult = _chunkKXGQFW2Rjs.decodeErrorResult; exports.decodeEventLog = _chunkKXGQFW2Rjs.decodeEventLog; exports.decodeFunctionData = _chunkKXGQFW2Rjs.decodeFunctionData; exports.decodeFunctionResult = _chunkKXGQFW2Rjs.decodeFunctionResult; exports.deployContract = _chunkKXGQFW2Rjs.deployContract; exports.encodeAbiParameters = _chunkKXGQFW2Rjs.encodeAbiParameters; exports.encodeDeployData = _chunkKXGQFW2Rjs.encodeDeployData; exports.encodeErrorResult = _chunkKXGQFW2Rjs.encodeErrorResult; exports.encodeEventTopics = _chunkKXGQFW2Rjs.encodeEventTopics; exports.encodeFunctionData = _chunkKXGQFW2Rjs.encodeFunctionData; exports.encodeFunctionResult = _chunkKXGQFW2Rjs.encodeFunctionResult; exports.estimateContractGas = _chunkKXGQFW2Rjs.estimateContractGas; exports.formatAbiItem = _chunkKXGQFW2Rjs.formatAbiItem; exports.formatAbiItemWithArgs = _chunkKXGQFW2Rjs.formatAbiItemWithArgs; exports.getAbiItem = _chunkKXGQFW2Rjs.getAbiItem; exports.getBytecode = _chunkKXGQFW2Rjs.getBytecode; exports.getStorageAt = _chunkKXGQFW2Rjs.getStorageAt; exports.multicall = _chunkKXGQFW2Rjs.multicall; exports.readContract = _chunkKXGQFW2Rjs.readContract; exports.simulateContract = _chunkKXGQFW2Rjs.simulateContract; exports.watchContractEvent = _chunkKXGQFW2Rjs.watchContractEvent; exports.writeContract = _chunkKXGQFW2Rjs.writeContract;
57
53
  //# sourceMappingURL=contract.js.map
package/dist/contract.mjs CHANGED
@@ -1,42 +1,38 @@
1
1
  import {
2
2
  createContractEventFilter,
3
- estimateContractGas,
4
- getBytecode,
5
- getStorageAt,
6
- multicall,
7
- readContract,
8
- simulateContract,
9
- watchContractEvent
10
- } from "./chunk-VHZHROXW.mjs";
11
- import {
12
- deployContract,
13
- writeContract
14
- } from "./chunk-TNN5X44H.mjs";
15
- import {
16
- decodeAbi,
3
+ decodeAbiParameters,
17
4
  decodeErrorResult,
18
5
  decodeEventLog,
19
6
  decodeFunctionData,
20
7
  decodeFunctionResult,
21
- encodeAbi,
8
+ deployContract,
9
+ encodeAbiParameters,
22
10
  encodeDeployData,
23
11
  encodeErrorResult,
24
12
  encodeEventTopics,
25
13
  encodeFunctionData,
26
14
  encodeFunctionResult,
15
+ estimateContractGas,
27
16
  formatAbiItem,
28
17
  formatAbiItemWithArgs,
29
- getAbiItem
30
- } from "./chunk-VP57P6CD.mjs";
18
+ getAbiItem,
19
+ getBytecode,
20
+ getStorageAt,
21
+ multicall,
22
+ readContract,
23
+ simulateContract,
24
+ watchContractEvent,
25
+ writeContract
26
+ } from "./chunk-AXATFOBJ.mjs";
31
27
  export {
32
28
  createContractEventFilter,
33
- decodeAbi,
29
+ decodeAbiParameters,
34
30
  decodeErrorResult,
35
31
  decodeEventLog,
36
32
  decodeFunctionData,
37
33
  decodeFunctionResult,
38
34
  deployContract,
39
- encodeAbi,
35
+ encodeAbiParameters,
40
36
  encodeDeployData,
41
37
  encodeErrorResult,
42
38
  encodeEventTopics,
@@ -1,5 +1,5 @@
1
- import { R as Requests } from './eip1193-8c021438.js';
2
- import { C as Chain } from './chain-4a0d4164.js';
1
+ import { R as Requests } from './eip1193-a4f254d2.js';
2
+ import { C as Chain } from './chain-a34aa9a2.js';
3
3
 
4
4
  type BaseRpcRequests = {
5
5
  request(...args: any): Promise<any>;
@@ -55,15 +55,7 @@ type ClientConfig<TTransport extends Transport = Transport, TChain extends Chain
55
55
  transport: TTransport;
56
56
  };
57
57
  /**
58
- * @description Creates a base RPC client with the given transport.
59
- *
60
- * - Intended to be used as a base for other RPC clients.
61
- * - Has access to _all_ EIP-1474 RPC methods.
62
- *
63
- * @example
64
- * import { mainnet } from 'viem/chains'
65
- * import { createClient, http } from 'viem/clients'
66
- * const client = createClient(http({ chain: mainnet }))
58
+ * @description Creates a base client with the given transport.
67
59
  */
68
60
  declare function createClient<TTransport extends Transport, TChain extends Chain, TRequests extends BaseRpcRequests>({ chain, key, name, pollingInterval, transport, type, }: ClientConfig<TTransport, TChain, TRequests>): Client<TTransport, TChain, TRequests>;
69
61
 
@@ -1,8 +1,7 @@
1
- import { P as PublicRequests } from './eip1193-8c021438.js';
2
- import { a as Transport, b as ClientConfig, C as Client } from './createClient-8a8b4bf4.js';
3
- import { Abi, AbiEvent, Narrow, ExtractAbiEvent } from 'abitype';
4
- import { C as Chain, J as ExtractFormatter, S as Formatters, V as Formatter, K as Formatted, d as Block, R as RpcBlock, z as Transaction, T as TransactionReceipt, r as RpcTransactionReceipt, W as TransactionType, A as Address, g as BlockTag, H as Hex, X as MergeIntersectionProperties, u as TransactionRequest, h as ContractConfig, Y as GetValue, Z as ExtractResultFromAbi, _ as MaybeAbiEventName, $ as MaybeExtractEventArgsFromAbi, f as BlockNumber, a0 as ExtractEventNameFromAbi, a as Hash, F as FeeHistory, L as Log, M as FormattedTransaction, N as TransactionFormatter, a1 as ExtractEventArgsFromAbi, a2 as Prettify } from './chain-4a0d4164.js';
5
- import { T as TransactionRequestFormatter, b as WriteContractArgs } from './wallet-5ab86528.js';
1
+ import { W as WalletPermission, a as WatchAssetParams, P as PublicRequests } from './eip1193-a4f254d2.js';
2
+ import { a as Transport, b as ClientConfig, C as Client } from './createClient-8024655d.js';
3
+ import { Abi, Narrow, Address, AbiEvent, ExtractAbiEvent } from 'abitype';
4
+ import { C as Chain, J as ExtractFormatter, S as Formatters, V as Formatter, K as Formatted, d as Block, R as RpcBlock, z as Transaction, T as TransactionReceipt, r as RpcTransactionReceipt, W as TransactionType, s as RpcTransactionRequest, u as TransactionRequest, g as BlockTag, H as Hex, X as MergeIntersectionProperties, Y as ExtractConstructorArgsFromAbi, a as Hash, Z as GetValue, h as ContractConfig, _ as ExtractResultFromAbi, $ as MaybeAbiEventName, a0 as MaybeExtractEventArgsFromAbi, c as Address$1, f as BlockNumber, a1 as ExtractEventNameFromAbi, F as FeeHistory, L as Log, M as FormattedTransaction, N as TransactionFormatter, a2 as ExtractEventArgsFromAbi, a3 as Prettify } from './chain-a34aa9a2.js';
6
5
 
7
6
  type BlockFormatter<TChain extends Chain = Chain> = ExtractFormatter<TChain, 'block', NonNullable<Formatters['block']>>;
8
7
  type FormattedBlock<TFormatter extends Formatter | undefined = Formatter> = Formatted<TFormatter, Block>;
@@ -27,9 +26,21 @@ declare const defineTransactionReceipt: <TFormat extends Formatter<Partial<RpcTr
27
26
  [key: string]: unknown;
28
27
  }) => TransactionReceipt<bigint, number, "success" | "reverted", TransactionType> & ReturnType<TFormat> & { [K in TExclude[number]]: never; };
29
28
 
30
- type FormattedCall<TFormatter extends Formatter | undefined = Formatter> = MergeIntersectionProperties<Formatted<TFormatter, TransactionRequest, true>, TransactionRequest>;
29
+ type TransactionRequestFormatter<TChain extends Chain = Chain> = ExtractFormatter<TChain, 'transactionRequest', NonNullable<Formatters['transactionRequest']>>;
30
+ type FormattedTransactionRequest$1<TFormatter extends Formatter | undefined = Formatter> = Formatted<TFormatter, RpcTransactionRequest>;
31
+ declare function formatTransactionRequest(transactionRequest: Partial<TransactionRequest>): RpcTransactionRequest;
32
+ declare const defineTransactionRequest: <TFormat extends Formatter<Partial<TransactionRequest<bigint, number>>, Partial<RpcTransactionRequest> & {
33
+ [key: string]: unknown;
34
+ }>, TExclude extends ("value" | "from" | "gasPrice" | "maxFeePerGas" | "maxPriorityFeePerGas" | "data" | "gas" | "nonce" | "to" | "accessList")[] = []>({ exclude, format: formatOverride, }: {
35
+ exclude?: TExclude | undefined;
36
+ format?: TFormat | undefined;
37
+ }) => (data: Partial<TransactionRequest<bigint, number>> & {
38
+ [key: string]: unknown;
39
+ }) => RpcTransactionRequest & ReturnType<TFormat> & { [K in TExclude[number]]: never; };
40
+
41
+ type FormattedCall<TFormatter extends Formatter | undefined = Formatter> = MergeIntersectionProperties<Omit<Formatted<TFormatter, TransactionRequest, true>, 'from'>, TransactionRequest>;
31
42
  type CallArgs<TChain extends Chain = Chain> = FormattedCall<TransactionRequestFormatter<TChain>> & {
32
- from?: Address;
43
+ account?: Account;
33
44
  } & ({
34
45
  /** The balance of the account at a block number. */
35
46
  blockNumber?: bigint;
@@ -44,6 +55,73 @@ type CallResponse = {
44
55
  };
45
56
  declare function call<TChain extends Chain>(client: PublicClient<any, TChain>, args: CallArgs<TChain>): Promise<CallResponse>;
46
57
 
58
+ type AddChainArgs = {
59
+ chain: Chain;
60
+ };
61
+ declare function addChain(client: WalletClient, { chain }: AddChainArgs): Promise<void>;
62
+
63
+ type DeployContractArgs<TChain extends Chain = Chain, TAbi extends Abi | readonly unknown[] = Abi> = Omit<SendTransactionArgs<TChain>, 'accessList' | 'to' | 'data' | 'value'> & {
64
+ abi: Narrow<TAbi>;
65
+ bytecode: Hex;
66
+ } & ExtractConstructorArgsFromAbi<TAbi>;
67
+ type DeployContractResponse = SendTransactionResponse;
68
+ declare function deployContract<TChain extends Chain, TAbi extends Abi | readonly unknown[]>(walletClient: WalletClient, { abi, args, bytecode, ...request }: DeployContractArgs<TChain, TAbi>): Promise<DeployContractResponse>;
69
+
70
+ type GetAddressesResponse = Address[];
71
+ declare function getAddresses(client: WalletClient): Promise<GetAddressesResponse>;
72
+
73
+ type GetChainIdResponse = number;
74
+ declare function getChainId(client: PublicClient | WalletClient): Promise<GetChainIdResponse>;
75
+
76
+ type GetPermissionsResponse = WalletPermission[];
77
+ declare function getPermissions(client: WalletClient): Promise<WalletPermission[]>;
78
+
79
+ type RequestAddressesResponse = Address[];
80
+ declare function requestAddresses(client: WalletClient): Promise<RequestAddressesResponse>;
81
+
82
+ type RequestPermissionsArgs = {
83
+ eth_accounts: Record<string, any>;
84
+ } & {
85
+ [key: string]: Record<string, any>;
86
+ };
87
+ type RequestPermissionsResponse = WalletPermission[];
88
+ declare function requestPermissions(client: WalletClient, permissions: RequestPermissionsArgs): Promise<WalletPermission[]>;
89
+
90
+ type FormattedTransactionRequest<TFormatter extends Formatter | undefined = Formatter> = MergeIntersectionProperties<Omit<Formatted<TFormatter, TransactionRequest, true>, 'from'>, TransactionRequest>;
91
+ type SendTransactionArgs<TChain extends Chain = Chain> = FormattedTransactionRequest<TransactionRequestFormatter<TChain>> & {
92
+ account: Account;
93
+ } & ({
94
+ assertChain?: false;
95
+ chain?: TChain;
96
+ } | {
97
+ assertChain: true;
98
+ chain: TChain;
99
+ });
100
+ type SendTransactionResponse = Hash;
101
+ declare function sendTransaction<TChain extends Chain>(client: WalletClient, args: SendTransactionArgs<TChain>): Promise<SendTransactionResponse>;
102
+
103
+ type SignMessageArgs = {
104
+ account: Account;
105
+ data: string;
106
+ };
107
+ type SignMessageResponse = Hex;
108
+ declare function signMessage(client: WalletClient, { account, data }: SignMessageArgs): Promise<SignMessageResponse>;
109
+
110
+ type SwitchChainArgs = {
111
+ id: Chain['id'];
112
+ };
113
+ declare function switchChain(client: WalletClient, { id }: SwitchChainArgs): Promise<void>;
114
+
115
+ type WatchAssetArgs = WatchAssetParams;
116
+ type WatchAssetResponse = boolean;
117
+ declare function watchAsset(client: WalletClient, params: WatchAssetParams): Promise<WatchAssetResponse>;
118
+
119
+ type WriteContractArgs<TChain extends Chain = Chain, TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string> = Omit<SendTransactionArgs<TChain>, 'to' | 'data' | 'value'> & {
120
+ value?: GetValue<TAbi, TFunctionName, SendTransactionArgs<TChain>['value']>;
121
+ } & ContractConfig<TAbi, TFunctionName, 'payable' | 'nonpayable'>;
122
+ type WriteContractResponse = SendTransactionResponse;
123
+ declare function writeContract<TChain extends Chain, TAbi extends Abi | readonly unknown[], TFunctionName extends string>(client: WalletClient, { abi, address, args, functionName, ...request }: WriteContractArgs<TChain, TAbi, TFunctionName>): Promise<WriteContractResponse>;
124
+
47
125
  type SimulateContractArgs<TChain extends Chain = Chain, TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = any> = Omit<CallArgs<TChain>, 'to' | 'data' | 'value'> & ContractConfig<TAbi, TFunctionName, 'payable' | 'nonpayable'> & {
48
126
  value?: GetValue<TAbi, TFunctionName, CallArgs<TChain>['value']>;
49
127
  };
@@ -60,7 +138,7 @@ type CreateBlockFilterResponse = Filter<'block'>;
60
138
  declare function createBlockFilter(client: PublicClient): Promise<CreateBlockFilterResponse>;
61
139
 
62
140
  type CreateEventFilterArgs<TAbiEvent extends AbiEvent | undefined = undefined, TAbi extends Abi | readonly unknown[] = [TAbiEvent], TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>, TArgs extends MaybeExtractEventArgsFromAbi<TAbi, TEventName> | undefined = undefined> = {
63
- address?: Address | Address[];
141
+ address?: Address$1 | Address$1[];
64
142
  fromBlock?: BlockNumber | BlockTag;
65
143
  toBlock?: BlockNumber | BlockTag;
66
144
  } & (MaybeExtractEventArgsFromAbi<TAbi, TEventName> extends infer TEventFilterArgs ? {
@@ -80,7 +158,7 @@ type CreateEventFilterResponse<TAbiEvent extends AbiEvent | undefined = undefine
80
158
  declare function createEventFilter<TAbiEvent extends AbiEvent | undefined, TAbi extends Abi | readonly unknown[] = [TAbiEvent], TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>, TArgs extends MaybeExtractEventArgsFromAbi<TAbi, TEventName> | undefined = undefined>(client: PublicClient, { address, args, event, fromBlock, toBlock, }?: CreateEventFilterArgs<TAbiEvent, TAbi, TEventName, TArgs>): Promise<CreateEventFilterResponse<TAbiEvent, TAbi, TEventName, TArgs>>;
81
159
 
82
160
  type CreateContractEventFilterArgs<TAbi extends Abi | readonly unknown[] = Abi, TEventName extends string | undefined = undefined, TArgs extends MaybeExtractEventArgsFromAbi<TAbi, TEventName> | undefined = undefined> = {
83
- address?: Address | Address[];
161
+ address?: Address$1 | Address$1[];
84
162
  abi: Narrow<TAbi>;
85
163
  eventName?: ExtractEventNameFromAbi<TAbi, TEventName>;
86
164
  fromBlock?: BlockNumber | BlockTag;
@@ -95,8 +173,10 @@ type CreateContractEventFilterArgs<TAbi extends Abi | readonly unknown[] = Abi,
95
173
  type CreateContractEventFilterResponse<TAbi extends Abi | readonly unknown[] = Abi, TEventName extends string | undefined = undefined, TArgs extends MaybeExtractEventArgsFromAbi<TAbi, TEventName> | undefined = undefined> = Filter<'event', TAbi, TEventName, TArgs>;
96
174
  declare function createContractEventFilter<TAbi extends Abi | readonly unknown[], TEventName extends string | undefined, TArgs extends MaybeExtractEventArgsFromAbi<TAbi, TEventName> | undefined>(client: PublicClient, { address, abi, args, eventName, fromBlock, toBlock, }: CreateContractEventFilterArgs<TAbi, TEventName, TArgs>): Promise<CreateContractEventFilterResponse<TAbi, TEventName, TArgs>>;
97
175
 
98
- type FormattedEstimateGas<TFormatter extends Formatter | undefined = Formatter> = MergeIntersectionProperties<Formatted<TFormatter, TransactionRequest, true>, TransactionRequest>;
99
- type EstimateGasArgs<TChain extends Chain = Chain> = FormattedEstimateGas<TransactionRequestFormatter<TChain>> & ({
176
+ type FormattedEstimateGas<TFormatter extends Formatter | undefined = Formatter> = MergeIntersectionProperties<Omit<Formatted<TFormatter, TransactionRequest, true>, 'from'>, TransactionRequest>;
177
+ type EstimateGasArgs<TChain extends Chain = Chain> = FormattedEstimateGas<TransactionRequestFormatter<TChain>> & {
178
+ account: Account;
179
+ } & ({
100
180
  /** The balance of the account at a block number. */
101
181
  blockNumber?: bigint;
102
182
  blockTag?: never;
@@ -109,17 +189,17 @@ type EstimateGasResponse = bigint;
109
189
  /**
110
190
  * @description Estimates the gas necessary to complete a transaction without submitting it to the network.
111
191
  */
112
- declare function estimateGas<TChain extends Chain>(client: PublicClient<any, TChain>, args: EstimateGasArgs<TChain>): Promise<EstimateGasResponse>;
192
+ declare function estimateGas<TChain extends Chain>(client: PublicClient<any, TChain> | WalletClient, args: EstimateGasArgs<TChain>): Promise<EstimateGasResponse>;
113
193
 
114
- type EstimateContractGasArgs<TChain extends Chain = Chain, TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = any> = Omit<CallArgs<TChain>, 'to' | 'data' | 'value'> & ContractConfig<TAbi, TFunctionName, 'payable' | 'nonpayable'> & {
115
- value?: GetValue<TAbi, TFunctionName, CallArgs<TChain>['value']>;
194
+ type EstimateContractGasArgs<TChain extends Chain = Chain, TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = any> = Omit<EstimateGasArgs<TChain>, 'data' | 'to' | 'value'> & ContractConfig<TAbi, TFunctionName, 'payable' | 'nonpayable'> & {
195
+ value?: GetValue<TAbi, TFunctionName, EstimateGasArgs<TChain>['value']>;
116
196
  };
117
197
  type EstimateContractGasResponse = bigint;
118
198
  declare function estimateContractGas<TChain extends Chain, TAbi extends Abi | readonly unknown[], TFunctionName extends string>(client: PublicClient<any, TChain>, { abi, address, args, functionName, ...request }: EstimateContractGasArgs<TChain, TAbi, TFunctionName>): Promise<EstimateContractGasResponse>;
119
199
 
120
200
  type GetBalanceArgs = {
121
201
  /** The address of the account. */
122
- address: Address;
202
+ address: Address$1;
123
203
  } & ({
124
204
  /** The balance of the account at a block number. */
125
205
  blockNumber?: bigint;
@@ -155,7 +235,7 @@ type GetBlockArgs = {
155
235
  blockTag?: BlockTag;
156
236
  });
157
237
  type GetBlockResponse<TChain extends Chain = Chain> = FormattedBlock<BlockFormatter<TChain>>;
158
- declare function getBlock<TChain extends Chain>(client: PublicClient<any, TChain>, { blockHash, blockNumber, blockTag, includeTransactions, }?: GetBlockArgs): Promise<GetBlockResponse<TChain>>;
238
+ declare function getBlock<TChain extends Chain>(client: PublicClient<any, TChain> | WalletClient, { blockHash, blockNumber, blockTag, includeTransactions, }?: GetBlockArgs): Promise<GetBlockResponse<TChain>>;
159
239
 
160
240
  type GetBlockNumberArgs = {
161
241
  /** The maximum age (in ms) of the cached value. */
@@ -209,7 +289,7 @@ type GetBlockTransactionCountResponse = number;
209
289
  declare function getBlockTransactionCount<TChain extends Chain>(client: PublicClient<any, TChain>, { blockHash, blockNumber, blockTag, }?: GetBlockTransactionCountArgs): Promise<GetBlockTransactionCountResponse>;
210
290
 
211
291
  type GetBytecodeArgs = {
212
- address: Address;
292
+ address: Address$1;
213
293
  } & ({
214
294
  blockNumber?: never;
215
295
  blockTag?: BlockTag;
@@ -220,9 +300,6 @@ type GetBytecodeArgs = {
220
300
  type GetBytecodeResponse = Hex | undefined;
221
301
  declare function getBytecode(client: PublicClient, { address, blockNumber, blockTag }: GetBytecodeArgs): Promise<GetBytecodeResponse>;
222
302
 
223
- type GetChainIdResponse = number;
224
- declare function getChainId(client: PublicClient): Promise<GetChainIdResponse>;
225
-
226
303
  type GetFeeHistoryArgs = {
227
304
  blockCount: number;
228
305
  rewardPercentiles: number[];
@@ -255,11 +332,11 @@ type GetGasPriceResponse = bigint;
255
332
  /**
256
333
  * @description Returns the current price of gas (in wei).
257
334
  */
258
- declare function getGasPrice(client: PublicClient): Promise<GetGasPriceResponse>;
335
+ declare function getGasPrice(client: PublicClient | WalletClient): Promise<GetGasPriceResponse>;
259
336
 
260
337
  type GetLogsArgs<TAbiEvent extends AbiEvent | undefined = undefined, TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>> = {
261
338
  /** Address or list of addresses from which logs originated */
262
- address?: Address | Address[];
339
+ address?: Address$1 | Address$1[];
263
340
  } & ({
264
341
  event: TAbiEvent;
265
342
  args?: MaybeExtractEventArgsFromAbi<[TAbiEvent], TEventName>;
@@ -285,7 +362,7 @@ type GetLogsResponse<TAbiEvent extends AbiEvent | undefined = undefined, TEventN
285
362
  declare function getLogs<TAbiEvent extends AbiEvent | undefined>(client: PublicClient, { address, blockHash, fromBlock, toBlock, event, args, }?: GetLogsArgs<TAbiEvent>): Promise<GetLogsResponse<TAbiEvent>>;
286
363
 
287
364
  type GetStorageAtArgs = {
288
- address: Address;
365
+ address: Address$1;
289
366
  slot: Hex;
290
367
  } & ({
291
368
  blockNumber?: never;
@@ -350,7 +427,7 @@ type GetTransactionReceiptArgs = {
350
427
  hash: Hash;
351
428
  };
352
429
  type GetTransactionReceiptResponse<TChain extends Chain = Chain> = FormattedTransactionReceipt<TransactionReceiptFormatter<TChain>>;
353
- declare function getTransactionReceipt<TChain extends Chain>(client: PublicClient<any, TChain>, { hash }: GetTransactionReceiptArgs): Promise<Formatted<ExtractFormatter<TChain, "transactionReceipt", Formatter<RpcTransactionReceipt, TransactionReceipt<bigint, number, "success" | "reverted", TransactionType>>>, TransactionReceipt<bigint, number, "success" | "reverted", TransactionType>, false>>;
430
+ declare function getTransactionReceipt<TChain extends Chain>(client: PublicClient<any, TChain>, { hash }: GetTransactionReceiptArgs): Promise<Formatted<ExtractFormatter<TChain, "transactionReceipt", Formatter<RpcTransactionReceipt, TransactionReceipt<bigint, number, "success" | "reverted", TransactionType>>>, TransactionReceipt<bigint, number, "success" | "reverted", TransactionType>, false, false>>;
354
431
 
355
432
  type MAXIMUM_DEPTH = 20;
356
433
  type Contract<TAbi extends Abi | readonly unknown[] = Abi | readonly unknown[], TFunctionName extends string = string> = {
@@ -397,7 +474,7 @@ type MulticallResults<TContracts extends Contract[], TAllowFailure extends boole
397
474
  type MulticallArgs<TContracts extends ContractConfig[] = ContractConfig[], TAllowFailure extends boolean = true> = Pick<CallArgs, 'blockNumber' | 'blockTag'> & {
398
475
  allowFailure?: TAllowFailure;
399
476
  contracts: readonly [...MulticallContracts<TContracts>];
400
- multicallAddress: Address;
477
+ multicallAddress: Address$1;
401
478
  };
402
479
  type MulticallResponse<TContracts extends ContractConfig[] = ContractConfig[], TAllowFailure extends boolean = true> = MulticallResults<TContracts, TAllowFailure>;
403
480
  declare function multicall<TContracts extends ContractConfig[], TAllowFailure extends boolean = true>(client: PublicClient, args: MulticallArgs<TContracts, TAllowFailure>): Promise<MulticallResponse<TContracts, TAllowFailure>>;
@@ -481,7 +558,7 @@ type OnLogsResponse$1<TAbi extends Abi | readonly unknown[] = readonly unknown[]
481
558
  type OnLogs$1<TAbi extends Abi | readonly unknown[] = readonly unknown[], TEventName extends string = string> = (logs: OnLogsResponse$1<TAbi, TEventName>) => void;
482
559
  type WatchContractEventArgs<TAbi extends Abi | readonly unknown[] = readonly unknown[], TEventName extends string = string> = {
483
560
  /** The address of the contract. */
484
- address?: Address | Address[];
561
+ address?: Address$1 | Address$1[];
485
562
  /** Contract ABI. */
486
563
  abi: Narrow<TAbi>;
487
564
  args?: ExtractEventArgsFromAbi<TAbi, TEventName>;
@@ -502,7 +579,7 @@ type OnLogsResponse<TAbiEvent extends AbiEvent | undefined = undefined, TEventNa
502
579
  type OnLogs<TAbiEvent extends AbiEvent | undefined = undefined, TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>> = (logs: OnLogsResponse<TAbiEvent, TEventName>) => void;
503
580
  type WatchEventArgs<TAbiEvent extends AbiEvent | undefined = undefined, TEventName extends string | undefined = MaybeAbiEventName<TAbiEvent>> = {
504
581
  /** The address of the contract. */
505
- address?: Address | Address[];
582
+ address?: Address$1 | Address$1[];
506
583
  /** Whether or not the event logs should be batched on each invocation. */
507
584
  batch?: boolean;
508
585
  /** The callback to call when an error occurred when trying to get for a new block. */
@@ -534,6 +611,21 @@ type WatchPendingTransactionsArgs = {
534
611
  };
535
612
  declare function watchPendingTransactions(client: PublicClient, { batch, onError, onTransactions, pollingInterval, }: WatchPendingTransactionsArgs): () => void;
536
613
 
614
+ type Account = JsonRpcAccount | ExternallyOwnedAccount;
615
+ type JsonRpcAccount = {
616
+ address: Address$1;
617
+ type: 'json-rpc';
618
+ };
619
+ type ExternallyOwnedAccount = {
620
+ address: Address$1;
621
+ signMessage: (message: string) => Promise<Hash>;
622
+ signTransaction: (transaction: Omit<TransactionRequest, 'from'> & {
623
+ chainId: number;
624
+ from: Address$1;
625
+ }) => Promise<Hash>;
626
+ type: 'externally-owned';
627
+ };
628
+
537
629
  type FilterType = 'transaction' | 'block' | 'event';
538
630
  type Filter<TFilterType extends FilterType = 'event', TAbi extends Abi | readonly unknown[] = Abi, TEventName extends string | undefined = undefined, TArgs extends MaybeExtractEventArgsFromAbi<TAbi, TEventName> | undefined = MaybeExtractEventArgsFromAbi<TAbi, TEventName>> = {
539
631
  id: Hex;
@@ -560,9 +652,9 @@ type GetEnsAddressArgs = Prettify<Pick<ReadContractArgs, 'blockNumber' | 'blockT
560
652
  /** ENS name to get address. */
561
653
  name: string;
562
654
  /** Address of ENS Universal Resolver Contract */
563
- universalResolverAddress?: Address;
655
+ universalResolverAddress?: Address$1;
564
656
  }>;
565
- type GetEnsAddressResponse = Address;
657
+ type GetEnsAddressResponse = Address$1;
566
658
  /**
567
659
  * @description Gets address for ENS name.
568
660
  *
@@ -578,9 +670,9 @@ declare function getEnsAddress(client: PublicClient, { blockNumber, blockTag, na
578
670
 
579
671
  type GetEnsNameArgs = Prettify<Pick<ReadContractArgs, 'blockNumber' | 'blockTag'> & {
580
672
  /** Address to get ENS name for. */
581
- address: Address;
673
+ address: Address$1;
582
674
  /** Address of ENS Universal Resolver Contract. */
583
- universalResolverAddress?: Address;
675
+ universalResolverAddress?: Address$1;
584
676
  }>;
585
677
  type GetEnsNameResponse = string | null;
586
678
  /**
@@ -633,18 +725,42 @@ type PublicActions<TChain extends Chain = Chain> = {
633
725
  watchPendingTransactions: (args: WatchPendingTransactionsArgs) => ReturnType<typeof watchPendingTransactions>;
634
726
  };
635
727
 
728
+ type WalletClientConfig<TTransport extends Transport = Transport, TChain extends Chain = Chain> = {
729
+ chain?: ClientConfig<TTransport, TChain>['chain'];
730
+ /** The key of the Wallet Client. */
731
+ key?: ClientConfig['key'];
732
+ /** The name of the Wallet Client. */
733
+ name?: ClientConfig['name'];
734
+ /** Frequency (in ms) for polling enabled actions & events. Defaults to 4_000 milliseconds. */
735
+ pollingInterval?: ClientConfig['pollingInterval'];
736
+ transport: ClientConfig<TTransport, TChain>['transport'];
737
+ };
738
+ type WalletClient<TTransport extends Transport = Transport, TChain extends Chain = Chain, TIncludeActions extends boolean = true> = Client<TTransport, TChain> & (TIncludeActions extends true ? WalletActions<TChain> : {});
739
+ /**
740
+ * @description Creates a wallet client with a given transport.
741
+ */
742
+ declare function createWalletClient<TTransport extends Transport, TChain extends Chain>({ transport, key, name, pollingInterval, }: WalletClientConfig<TTransport, TChain>): WalletClient<TTransport, TChain, true>;
743
+
744
+ type WalletActions<TChain extends Chain = Chain> = {
745
+ addChain: (args: AddChainArgs) => Promise<void>;
746
+ deployContract: <TAbi extends Abi | readonly unknown[]>(args: DeployContractArgs<TChain, TAbi>) => Promise<DeployContractResponse>;
747
+ getAddresses: () => Promise<GetAddressesResponse>;
748
+ getChainId: () => Promise<GetChainIdResponse>;
749
+ getPermissions: () => Promise<GetPermissionsResponse>;
750
+ requestAddresses: () => Promise<RequestAddressesResponse>;
751
+ requestPermissions: (args: RequestPermissionsArgs) => Promise<RequestPermissionsResponse>;
752
+ sendTransaction: <TChainOverride extends Chain>(args: SendTransactionArgs<TChainOverride>) => Promise<SendTransactionResponse>;
753
+ signMessage: (args: SignMessageArgs) => Promise<SignMessageResponse>;
754
+ switchChain: (args: SwitchChainArgs) => Promise<void>;
755
+ watchAsset: (args: WatchAssetArgs) => Promise<WatchAssetResponse>;
756
+ writeContract: <TAbi extends Abi | readonly unknown[], TFunctionName extends string, TChainOverride extends Chain>(args: WriteContractArgs<TChainOverride, TAbi, TFunctionName>) => Promise<WriteContractResponse>;
757
+ };
758
+
636
759
  type PublicClientConfig<TTransport extends Transport = Transport, TChain extends Chain = Chain> = Pick<ClientConfig<TTransport, TChain>, 'chain' | 'key' | 'name' | 'pollingInterval' | 'transport'>;
637
760
  type PublicClient<TTransport extends Transport = Transport, TChain extends Chain = Chain, TIncludeActions extends boolean = true> = Client<TTransport, TChain, PublicRequests> & (TIncludeActions extends true ? PublicActions<TChain> : {});
638
761
  /**
639
762
  * @description Creates a public client with a given transport.
640
- *
641
- * - Only has access to "public" EIP-1474 RPC methods (ie. `eth_blockNumber`, etc).
642
- *
643
- * @example
644
- * import { mainnet } from 'viem/chains'
645
- * import { createPublicClient, http } from 'viem/clients'
646
- * const client = createPublicClient({ transport: http('https://...') })
647
763
  */
648
764
  declare function createPublicClient<TTransport extends Transport, TChain extends Chain>({ chain, key, name, transport, pollingInterval, }: PublicClientConfig<TTransport, TChain>): PublicClient<TTransport, TChain, true>;
649
765
 
650
- export { getFilterChanges as $, GetEnsNameArgs as A, BlockFormatter as B, CallArgs as C, getEnsAddress as D, EstimateGasArgs as E, FormattedBlock as F, GetBytecodeArgs as G, getEnsName as H, call as I, createBlockFilter as J, createEventFilter as K, createPendingTransactionFilter as L, MulticallArgs as M, estimateGas as N, OnLogs as O, PublicClient as P, getBalance as Q, ReadContractArgs as R, SimulateContractArgs as S, TransactionReceiptFormatter as T, getBlock as U, getBlockNumber as V, WatchContractEventArgs as W, getBlockNumberCache as X, getBlockTransactionCount as Y, getChainId as Z, getFeeHistory as _, PublicClientConfig as a, getFilterLogs as a0, getLogs as a1, getGasPrice as a2, getTransaction as a3, getTransactionConfirmations as a4, getTransactionReceipt as a5, uninstallFilter as a6, waitForTransactionReceipt as a7, watchBlockNumber as a8, watchBlocks as a9, GetTransactionReceiptArgs as aA, GetTransactionReceiptResponse as aB, GetTransactionResponse as aC, OnBlock as aD, OnBlockNumber as aE, OnBlockNumberResponse as aF, OnBlockResponse as aG, OnTransactions as aH, OnTransactionsResponse as aI, ReplacementReason as aJ, ReplacementResponse as aK, UninstallFilterArgs as aL, UninstallFilterResponse as aM, WaitForTransactionReceiptArgs as aN, WaitForTransactionReceiptResponse as aO, WatchBlockNumberArgs as aP, WatchBlocksArgs as aQ, WatchPendingTransactionsArgs as aR, watchEvent as aa, watchPendingTransactions as ab, CallResponse as ac, CreateBlockFilterResponse as ad, CreateEventFilterArgs as ae, CreateEventFilterResponse as af, CreatePendingTransactionFilterResponse as ag, EstimateGasResponse as ah, GetBalanceArgs as ai, GetBalanceResponse as aj, GetBlockArgs as ak, GetBlockNumberArgs as al, GetBlockNumberResponse as am, GetBlockResponse as an, GetBlockTransactionCountArgs as ao, GetBlockTransactionCountResponse as ap, GetFeeHistoryArgs as aq, GetFeeHistoryResponse as ar, GetFilterChangesArgs as as, GetFilterChangesResponse as at, GetFilterLogsArgs as au, GetFilterLogsResponse as av, GetGasPriceResponse as aw, GetTransactionArgs as ax, GetTransactionConfirmationsArgs as ay, GetTransactionConfirmationsResponse as az, FormattedTransactionReceipt as b, createPublicClient as c, defineBlock as d, defineTransactionReceipt as e, formatBlock as f, CreateContractEventFilterArgs as g, CreateContractEventFilterResponse as h, EstimateContractGasArgs as i, EstimateContractGasResponse as j, GetBytecodeResponse as k, GetStorageAtArgs as l, GetStorageAtResponse as m, MulticallResponse as n, OnLogsResponse as o, ReadContractResponse as p, SimulateContractResponse as q, createContractEventFilter as r, estimateContractGas as s, getBytecode as t, getStorageAt as u, multicall as v, readContract as w, simulateContract as x, watchContractEvent as y, GetEnsAddressArgs as z };
766
+ export { GetEnsAddressArgs as $, Account as A, BlockFormatter as B, CallArgs as C, createContractEventFilter as D, ExternallyOwnedAccount as E, FormattedBlock as F, GetBytecodeArgs as G, estimateContractGas as H, getBytecode as I, getStorageAt as J, multicall as K, readContract as L, MulticallArgs as M, simulateContract as N, OnLogs as O, PublicClient as P, watchContractEvent as Q, ReadContractArgs as R, SendTransactionArgs as S, TransactionReceiptFormatter as T, DeployContractArgs as U, DeployContractResponse as V, WalletClient as W, WriteContractArgs as X, WriteContractResponse as Y, deployContract as Z, writeContract as _, PublicClientConfig as a, UninstallFilterArgs as a$, GetEnsNameArgs as a0, getEnsAddress as a1, getEnsName as a2, call as a3, createBlockFilter as a4, createEventFilter as a5, createPendingTransactionFilter as a6, estimateGas as a7, getBalance as a8, getBlock as a9, GetBlockArgs as aA, GetBlockNumberArgs as aB, GetBlockNumberResponse as aC, GetBlockResponse as aD, GetBlockTransactionCountArgs as aE, GetBlockTransactionCountResponse as aF, GetFeeHistoryArgs as aG, GetFeeHistoryResponse as aH, GetFilterChangesArgs as aI, GetFilterChangesResponse as aJ, GetFilterLogsArgs as aK, GetFilterLogsResponse as aL, GetGasPriceResponse as aM, GetTransactionArgs as aN, GetTransactionConfirmationsArgs as aO, GetTransactionConfirmationsResponse as aP, GetTransactionReceiptArgs as aQ, GetTransactionReceiptResponse as aR, GetTransactionResponse as aS, OnBlock as aT, OnBlockNumber as aU, OnBlockNumberResponse as aV, OnBlockResponse as aW, OnTransactions as aX, OnTransactionsResponse as aY, ReplacementReason as aZ, ReplacementResponse as a_, getBlockNumber as aa, getBlockNumberCache as ab, getBlockTransactionCount as ac, getChainId as ad, getFeeHistory as ae, getFilterChanges as af, getFilterLogs as ag, getLogs as ah, getGasPrice as ai, getTransaction as aj, getTransactionConfirmations as ak, getTransactionReceipt as al, uninstallFilter as am, waitForTransactionReceipt as an, watchBlockNumber as ao, watchBlocks as ap, watchEvent as aq, watchPendingTransactions as ar, CallResponse as as, CreateBlockFilterResponse as at, CreateEventFilterArgs as au, CreateEventFilterResponse as av, CreatePendingTransactionFilterResponse as aw, EstimateGasResponse as ax, GetBalanceArgs as ay, GetBalanceResponse as az, WalletClientConfig as b, UninstallFilterResponse as b0, WaitForTransactionReceiptArgs as b1, WaitForTransactionReceiptResponse as b2, WatchBlockNumberArgs as b3, WatchBlocksArgs as b4, WatchPendingTransactionsArgs as b5, addChain as b6, getAddresses as b7, getPermissions as b8, requestAddresses as b9, requestPermissions as ba, sendTransaction as bb, signMessage as bc, switchChain as bd, watchAsset as be, AddChainArgs as bf, FormattedTransactionRequest as bg, GetPermissionsResponse as bh, GetAddressesResponse as bi, RequestAddressesResponse as bj, RequestPermissionsResponse as bk, SendTransactionResponse as bl, SignMessageArgs as bm, SignMessageResponse as bn, SwitchChainArgs as bo, WatchAssetArgs as bp, WatchAssetResponse as bq, createPublicClient as c, createWalletClient as d, FormattedTransactionReceipt as e, FormattedTransactionRequest$1 as f, TransactionRequestFormatter as g, defineBlock as h, defineTransactionReceipt as i, defineTransactionRequest as j, formatBlock as k, formatTransactionRequest as l, EstimateGasArgs as m, CreateContractEventFilterArgs as n, CreateContractEventFilterResponse as o, EstimateContractGasArgs as p, EstimateContractGasResponse as q, GetBytecodeResponse as r, GetStorageAtArgs as s, GetStorageAtResponse as t, MulticallResponse as u, OnLogsResponse as v, ReadContractResponse as w, SimulateContractArgs as x, SimulateContractResponse as y, WatchContractEventArgs as z };
@@ -1,4 +1,4 @@
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-4a0d4164.js';
1
+ import { c as Address, a as Hash, a4 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, a8 as LogTopic, q as RpcTransaction, r as RpcTransactionReceipt, t as RpcUncle } from './chain-a34aa9a2.js';
2
2
 
3
3
  declare class RpcError extends Error {
4
4
  code: number;
@@ -914,6 +914,16 @@ type WalletRequests = {
914
914
  method: 'eth_accounts';
915
915
  params?: never;
916
916
  }): Promise<Address[]>;
917
+ request(args: {
918
+ /**
919
+ * @description Returns the current chain ID associated with the wallet.
920
+ * @example
921
+ * provider.request({ method: 'eth_chainId' })
922
+ * // => '1'
923
+ */
924
+ method: 'eth_chainId';
925
+ params?: never;
926
+ }): Promise<Quantity>;
917
927
  request(args: {
918
928
  /**
919
929
  * @description Requests that the user provides an Ethereum address to be identified by. Typically causes a browser extension popup to appear.
@@ -987,4 +997,4 @@ type WalletRequests = {
987
997
  };
988
998
  type Requests = PublicRequests & SignableRequests & WalletRequests;
989
999
 
990
- export { Events as E, PublicRequests as P, Requests as R, SignableRequests as S, TestRequests as T, WalletPermission as W, WatchAssetParams as a, WalletRequests as b };
1000
+ export { Events as E, PublicRequests as P, Requests as R, TestRequests as T, WalletPermission as W, WatchAssetParams as a };
@@ -1,12 +1,5 @@
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-4a0d4164.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;
1
+ import { Abi, Narrow } from 'abitype';
2
+ import { H as Hex, A as AbiItem, a8 as LogTopic, a1 as ExtractEventNameFromAbi, a9 as ExtractEventArgsFromTopics, aa as ExtractFunctionNameFromAbi, a7 as ExtractArgsFromAbi, _ as ExtractResultFromAbi, Y as ExtractConstructorArgsFromAbi, ab as ExtractErrorNameFromAbi, ac as ExtractErrorArgsFromAbi, a2 as ExtractEventArgsFromAbi } from './chain-a34aa9a2.js';
10
3
 
11
4
  type DecodeErrorResultArgs = {
12
5
  abi?: Abi;
@@ -47,15 +40,6 @@ type DecodeFunctionResultArgs<TAbi extends Abi | readonly unknown[] = Abi, TFunc
47
40
  type DecodeFunctionResultResponse<TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string> = ExtractResultFromAbi<TAbi, TFunctionName>;
48
41
  declare function decodeFunctionResult<TAbi extends Abi | readonly unknown[], TFunctionName extends string>({ abi, args, functionName, data, }: DecodeFunctionResultArgs<TAbi, TFunctionName>): DecodeFunctionResultResponse<TAbi, TFunctionName>;
49
42
 
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
43
  type EncodeDeployDataArgs<TAbi extends Abi | readonly unknown[] = Abi> = {
60
44
  abi: Narrow<TAbi>;
61
45
  bytecode: Hex;
@@ -88,10 +72,4 @@ type EncodeFunctionResultArgs<TAbi extends Abi | readonly unknown[] = Abi, TFunc
88
72
  };
89
73
  declare function encodeFunctionResult<TAbi extends Abi | readonly unknown[], TFunctionName extends string>({ abi, functionName, result, }: EncodeFunctionResultArgs<TAbi, TFunctionName>): `0x${string}`;
90
74
 
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 };
75
+ export { DecodeErrorResultArgs as D, EncodeDeployDataArgs as E, DecodeErrorResultResponse as a, DecodeEventLogArgs as b, DecodeEventLogResponse as c, DecodeFunctionDataArgs as d, DecodeFunctionResultArgs as e, DecodeFunctionResultResponse as f, EncodeErrorResultArgs as g, EncodeEventTopicsArgs as h, EncodeFunctionDataArgs as i, EncodeFunctionResultArgs as j, decodeErrorResult as k, decodeEventLog as l, decodeFunctionData as m, decodeFunctionResult as n, encodeDeployData as o, encodeErrorResult as p, encodeEventTopics as q, encodeFunctionData as r, encodeFunctionResult as s };
package/dist/ens.d.ts CHANGED
@@ -1,12 +1,11 @@
1
- export { z as GetEnsAddressArgs, A as GetEnsNameArgs, D as getEnsAddress, H as getEnsName } from './createPublicClient-b5afe6b8.js';
1
+ export { $ as GetEnsAddressArgs, a0 as GetEnsNameArgs, a1 as getEnsAddress, a2 as getEnsName } from './createPublicClient-f283b09d.js';
2
2
  export { l as labelhash, n as namehash } from './namehash-88f4639d.js';
3
- import './eip1193-8c021438.js';
4
- import './chain-4a0d4164.js';
3
+ import './eip1193-a4f254d2.js';
4
+ import './chain-a34aa9a2.js';
5
5
  import '@wagmi/chains';
6
6
  import 'abitype';
7
7
  import 'ethers@6/types/providers';
8
- import './createClient-8a8b4bf4.js';
9
- import './wallet-5ab86528.js';
8
+ import './createClient-8024655d.js';
10
9
 
11
10
  /**
12
11
  * @description Normalizes ENS name
package/dist/ens.js CHANGED
@@ -3,9 +3,8 @@
3
3
 
4
4
 
5
5
 
6
- var _chunkEJEZIHXKjs = require('./chunk-EJEZIHXK.js');
7
- require('./chunk-7ALCXZ5K.js');
8
- require('./chunk-F76TECTY.js');
6
+ var _chunk4AEFOF5Rjs = require('./chunk-4AEFOF5R.js');
7
+ require('./chunk-KXGQFW2R.js');
9
8
 
10
9
  // src/utils/ens/normalize.ts
11
10
  var _idnauts46hx = require('idna-uts46-hx');
@@ -18,5 +17,5 @@ function normalize(name) {
18
17
 
19
18
 
20
19
 
21
- exports.getEnsAddress = _chunkEJEZIHXKjs.getEnsAddress; exports.getEnsName = _chunkEJEZIHXKjs.getEnsName; exports.labelhash = _chunkEJEZIHXKjs.labelhash; exports.namehash = _chunkEJEZIHXKjs.namehash; exports.normalize = normalize;
20
+ exports.getEnsAddress = _chunk4AEFOF5Rjs.getEnsAddress; exports.getEnsName = _chunk4AEFOF5Rjs.getEnsName; exports.labelhash = _chunk4AEFOF5Rjs.labelhash; exports.namehash = _chunk4AEFOF5Rjs.namehash; exports.normalize = normalize;
22
21
  //# sourceMappingURL=ens.js.map
package/dist/ens.js.map CHANGED
@@ -1 +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"]}
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"]}