viem 0.2.0-main.20230330T201928 → 0.2.0-main.20230403T061632

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 (75) hide show
  1. package/accounts/package.json +4 -0
  2. package/dist/abi.d.ts +3 -3
  3. package/dist/abi.js +2 -2
  4. package/dist/abi.mjs +1 -1
  5. package/dist/accounts/index.d.ts +81 -0
  6. package/dist/accounts/index.js +142 -0
  7. package/dist/accounts/index.js.map +1 -0
  8. package/dist/accounts/index.mjs +142 -0
  9. package/dist/accounts/index.mjs.map +1 -0
  10. package/dist/{chain-1b53ef88.d.ts → chain-5507c6f0.d.ts} +212 -148
  11. package/dist/{chain-ec8c485d.d.ts → chain-fe47467d.d.ts} +1 -1
  12. package/dist/chains.d.ts +867 -99
  13. package/dist/chains.js +115 -63
  14. package/dist/chains.js.map +1 -1
  15. package/dist/chains.mjs +58 -6
  16. package/dist/chains.mjs.map +1 -1
  17. package/dist/chunk-EMXJKA5P.mjs +31 -0
  18. package/dist/chunk-EMXJKA5P.mjs.map +1 -0
  19. package/dist/{chunk-LGWBVIG5.mjs → chunk-KILBOPDD.mjs} +1887 -262
  20. package/dist/chunk-KILBOPDD.mjs.map +1 -0
  21. package/dist/chunk-KQOOAYBY.js +31 -0
  22. package/dist/chunk-KQOOAYBY.js.map +1 -0
  23. package/dist/{chunk-VLSWFKRM.js → chunk-PWUNCH5G.js} +1943 -318
  24. package/dist/chunk-PWUNCH5G.js.map +1 -0
  25. package/dist/contract.d.ts +9 -7
  26. package/dist/contract.js +2 -2
  27. package/dist/contract.mjs +1 -1
  28. package/dist/{createTransport-e3eba9f7.d.ts → createTransport-21a0d2b3.d.ts} +24 -10
  29. package/dist/{eip1193-4f4e240c.d.ts → eip1193-2f3a9cd2.d.ts} +1 -1
  30. package/dist/{encodeFunctionResult-1f324375.d.ts → encodeFunctionResult-c5185b98.d.ts} +15 -15
  31. package/dist/{encodePacked-d5d5264a.d.ts → encodePacked-98f67d09.d.ts} +1 -1
  32. package/dist/ens.d.ts +6 -4
  33. package/dist/ens.js +8 -3
  34. package/dist/ens.js.map +1 -1
  35. package/dist/ens.mjs +7 -2
  36. package/dist/ens.mjs.map +1 -1
  37. package/dist/ethers.d.ts +5 -6
  38. package/dist/ethers.js +7 -5
  39. package/dist/ethers.js.map +1 -1
  40. package/dist/ethers.mjs +7 -5
  41. package/dist/ethers.mjs.map +1 -1
  42. package/dist/{formatAbiItem-15e8817d.d.ts → formatAbiItem-56dff508.d.ts} +1 -1
  43. package/dist/{getAbiItem-3e809ff9.d.ts → getAbiItem-bfba73d1.d.ts} +3 -3
  44. package/dist/getEnsResolver-9e26c596.d.ts +876 -0
  45. package/dist/index.d.ts +132 -15
  46. package/dist/index.js +150 -103
  47. package/dist/index.js.map +1 -1
  48. package/dist/index.mjs +96 -49
  49. package/dist/index.mjs.map +1 -1
  50. package/dist/{parseGwei-361e8a12.d.ts → parseGwei-d2147f8b.d.ts} +95 -15
  51. package/dist/public.d.ts +6 -4
  52. package/dist/public.js +2 -2
  53. package/dist/public.mjs +1 -1
  54. package/dist/publicKeyToAddress-623eb398.d.ts +16 -0
  55. package/dist/test-b67569fe.d.ts +198 -0
  56. package/dist/test.d.ts +11 -11
  57. package/dist/test.js +2 -2
  58. package/dist/test.mjs +1 -1
  59. package/dist/typedData-46b4d81f.d.ts +93 -0
  60. package/dist/utils/index.d.ts +22 -30
  61. package/dist/utils/index.js +28 -2
  62. package/dist/utils/index.mjs +31 -5
  63. package/dist/wallet.d.ts +6 -4
  64. package/dist/wallet.js +2 -2
  65. package/dist/wallet.mjs +1 -1
  66. package/dist/window.d.ts +2 -2
  67. package/package.json +12 -3
  68. package/dist/chunk-3JK5RHC7.mjs +0 -186
  69. package/dist/chunk-3JK5RHC7.mjs.map +0 -1
  70. package/dist/chunk-LGWBVIG5.mjs.map +0 -1
  71. package/dist/chunk-M4VQVSC6.js +0 -186
  72. package/dist/chunk-M4VQVSC6.js.map +0 -1
  73. package/dist/chunk-VLSWFKRM.js.map +0 -1
  74. package/dist/createPublicClient-31d44569.d.ts +0 -841
  75. package/dist/test-67630299.d.ts +0 -205
@@ -1,205 +0,0 @@
1
- import { a as Hash, y as RpcTransaction, a9 as Quantity, I as TransactionRequest, H as Hex, C as Chain } from './chain-1b53ef88.js';
2
- import { a as Transport, b as ClientConfig, C as Client } from './createTransport-e3eba9f7.js';
3
- import { T as TestRequests } from './eip1193-4f4e240c.js';
4
- import { Address } from 'abitype';
5
-
6
- type DropTransactionParameters = {
7
- /** The hash of the transaction to drop. */
8
- hash: Hash;
9
- };
10
- declare function dropTransaction(client: TestClient, { hash }: DropTransactionParameters): Promise<void>;
11
-
12
- type GetAutomineReturnType = boolean;
13
- declare function getAutomine(client: TestClient): Promise<GetAutomineReturnType>;
14
-
15
- type GetTxpoolContentReturnType = {
16
- pending: Record<Address, Record<string, RpcTransaction>>;
17
- queued: Record<Address, Record<string, RpcTransaction>>;
18
- };
19
- declare function getTxpoolContent(client: TestClient): Promise<GetTxpoolContentReturnType>;
20
-
21
- type GetTxpoolStatusReturnType = {
22
- pending: number;
23
- queued: number;
24
- };
25
- declare function getTxpoolStatus(client: TestClient): Promise<GetTxpoolStatusReturnType>;
26
-
27
- type ImpersonateAccountParameters = {
28
- /** The account to impersonate. */
29
- address: Address;
30
- };
31
- declare function impersonateAccount(client: TestClient, { address }: ImpersonateAccountParameters): Promise<void>;
32
-
33
- type IncreaseTimeParameters = {
34
- /** The amount of seconds to jump forward in time. */
35
- seconds: number;
36
- };
37
- declare function increaseTime(client: TestClient, { seconds }: IncreaseTimeParameters): Promise<`0x${string}`>;
38
-
39
- type InspectTxpoolReturnType = {
40
- pending: Record<Address, Record<string, string>>;
41
- queued: Record<Address, Record<string, string>>;
42
- };
43
- declare function inspectTxpool(client: TestClient): Promise<InspectTxpoolReturnType>;
44
-
45
- type MineParameters = {
46
- /** Number of blocks to mine. */
47
- blocks: number;
48
- /** Interval between each block in seconds. */
49
- interval?: number;
50
- };
51
- declare function mine(client: TestClient, { blocks, interval }: MineParameters): Promise<void>;
52
-
53
- type ResetParameters = {
54
- /** The block number to reset from. */
55
- blockNumber?: bigint;
56
- /** The JSON RPC URL. */
57
- jsonRpcUrl?: string;
58
- };
59
- declare function reset(client: TestClient, { blockNumber, jsonRpcUrl }?: ResetParameters): Promise<void>;
60
-
61
- type RevertParameters = {
62
- /** The snapshot ID to revert to. */
63
- id: Quantity;
64
- };
65
- declare function revert(client: TestClient, { id }: RevertParameters): Promise<void>;
66
-
67
- type SendUnsignedTransactionParameters = TransactionRequest;
68
- type SendUnsignedTransactionReturnType = Hash;
69
- declare function sendUnsignedTransaction(client: TestClient, request: SendUnsignedTransactionParameters): Promise<SendUnsignedTransactionReturnType>;
70
-
71
- type SetBalanceParameters = {
72
- /** The account address. */
73
- address: Address;
74
- /** Amount (in wei) to set */
75
- value: bigint;
76
- };
77
- declare function setBalance(client: TestClient, { address, value }: SetBalanceParameters): Promise<void>;
78
-
79
- type SetBlockGasLimitParameters = {
80
- /** Gas limit (in wei). */
81
- gasLimit: bigint;
82
- };
83
- declare function setBlockGasLimit(client: TestClient, { gasLimit }: SetBlockGasLimitParameters): Promise<void>;
84
-
85
- type SetBlockTimestampIntervalParameters = {
86
- /** The interval (in seconds). */
87
- interval: number;
88
- };
89
- declare function setBlockTimestampInterval(client: TestClient, { interval }: SetBlockTimestampIntervalParameters): Promise<void>;
90
-
91
- type SetCodeParameters = {
92
- /** The account address. */
93
- address: Address;
94
- /** The bytecode to set */
95
- bytecode: Hex;
96
- };
97
- declare function setCode(client: TestClient, { address, bytecode }: SetCodeParameters): Promise<void>;
98
-
99
- type SetCoinbaseParameters = {
100
- /** The coinbase address. */
101
- address: Address;
102
- };
103
- declare function setCoinbase(client: TestClient, { address }: SetCoinbaseParameters): Promise<void>;
104
-
105
- type SetIntervalMiningParameters = {
106
- /** The mining interval. */
107
- interval: number;
108
- };
109
- declare function setIntervalMining(client: TestClient, { interval }: SetIntervalMiningParameters): Promise<void>;
110
-
111
- type SetMinGasPriceParameters = {
112
- /** The gas price. */
113
- gasPrice: bigint;
114
- };
115
- declare function setMinGasPrice(client: TestClient, { gasPrice }: SetMinGasPriceParameters): Promise<void>;
116
-
117
- type SetNextBlockBaseFeePerGasParameters = {
118
- /** Base fee per gas (in wei). */
119
- baseFeePerGas: bigint;
120
- };
121
- declare function setNextBlockBaseFeePerGas(client: TestClient, { baseFeePerGas }: SetNextBlockBaseFeePerGasParameters): Promise<void>;
122
-
123
- type SetNextBlockTimestampParameters = {
124
- /** The timestamp (in seconds). */
125
- timestamp: bigint;
126
- };
127
- declare function setNextBlockTimestamp(client: TestClient, { timestamp }: SetNextBlockTimestampParameters): Promise<void>;
128
-
129
- type SetNonceParameters = {
130
- /** The account address. */
131
- address: Address;
132
- /** The nonce to set. */
133
- nonce: number;
134
- };
135
- declare function setNonce(client: TestClient, { address, nonce }: SetNonceParameters): Promise<void>;
136
-
137
- type SetStorageAtParameters = {
138
- /** The account address. */
139
- address: Address;
140
- /** The storage slot (index). Can either be a number or hash value. */
141
- index: number | Hash;
142
- /** The value to store as a 32 byte hex string. */
143
- value: Hex;
144
- };
145
- declare function setStorageAt(client: TestClient, { address, index, value }: SetStorageAtParameters): Promise<void>;
146
-
147
- type StopImpersonatingAccountParameters = {
148
- /** The account to impersonate. */
149
- address: Address;
150
- };
151
- declare function stopImpersonatingAccount(client: TestClient, { address }: StopImpersonatingAccountParameters): Promise<void>;
152
-
153
- type TestClientModes = 'anvil' | 'hardhat';
154
- type TestClientConfig<TTransport extends Transport = Transport, TChain extends Chain = Chain, TMode extends TestClientModes = TestClientModes> = {
155
- chain?: ClientConfig<TTransport, TChain>['chain'];
156
- /** The key of the client. */
157
- key?: ClientConfig['key'];
158
- /** Mode of the test client. Available: "anvil" | "hardhat" */
159
- mode: TMode;
160
- /** The name of the client. */
161
- name?: ClientConfig['name'];
162
- /** Frequency (in ms) for polling enabled actions & events. Defaults to 4_000 milliseconds. */
163
- pollingInterval?: ClientConfig['pollingInterval'];
164
- transport: ClientConfig<TTransport, TChain>['transport'];
165
- };
166
- type TestClient<TTransport extends Transport = Transport, TChain extends Chain = Chain, TMode extends TestClientModes = TestClientModes, TIncludeActions extends boolean = true> = Client<TTransport, TChain, TestRequests<TMode>> & {
167
- mode: TMode;
168
- } & (TIncludeActions extends true ? TestActions<TChain> : {});
169
- /**
170
- * @description Creates a test client with a given transport.
171
- */
172
- declare function createTestClient<TTransport extends Transport, TChain extends Chain, TMode extends TestClientModes>({ chain, key, name, mode, pollingInterval, transport, }: TestClientConfig<TTransport, TChain, TMode>): TestClient<TTransport, TChain, TMode, true>;
173
-
174
- type TestActions<TChain extends Chain = Chain> = {
175
- dropTransaction: (args: DropTransactionParameters) => Promise<void>;
176
- getAutomine: () => Promise<GetAutomineReturnType>;
177
- getTxpoolContent: () => Promise<GetTxpoolContentReturnType>;
178
- getTxpoolStatus: () => Promise<GetTxpoolStatusReturnType>;
179
- impersonateAccount: (args: ImpersonateAccountParameters) => Promise<void>;
180
- increaseTime: (args: IncreaseTimeParameters) => Promise<Quantity>;
181
- inspectTxpool: () => Promise<InspectTxpoolReturnType>;
182
- mine: (args: MineParameters) => Promise<void>;
183
- removeBlockTimestampInterval: () => Promise<void>;
184
- reset: (args?: ResetParameters) => Promise<void>;
185
- revert: (args: RevertParameters) => Promise<void>;
186
- sendUnsignedTransaction: (args: SendUnsignedTransactionParameters) => Promise<SendUnsignedTransactionReturnType>;
187
- setAutomine: (args: boolean) => Promise<void>;
188
- setBalance: (args: SetBalanceParameters) => Promise<void>;
189
- setBlockGasLimit: (args: SetBlockGasLimitParameters) => Promise<void>;
190
- setBlockTimestampInterval: (args: SetBlockTimestampIntervalParameters) => Promise<void>;
191
- setCode: (args: SetCodeParameters) => Promise<void>;
192
- setCoinbase: (args: SetCoinbaseParameters) => Promise<void>;
193
- setIntervalMining: (args: SetIntervalMiningParameters) => Promise<void>;
194
- setLoggingEnabled: (args: boolean) => Promise<void>;
195
- setMinGasPrice: (args: SetMinGasPriceParameters) => Promise<void>;
196
- setNextBlockBaseFeePerGas: (args: SetNextBlockBaseFeePerGasParameters) => Promise<void>;
197
- setNextBlockTimestamp: (args: SetNextBlockTimestampParameters) => Promise<void>;
198
- setNonce: (args: SetNonceParameters) => Promise<void>;
199
- setRpcUrl: (args: string) => Promise<void>;
200
- setStorageAt: (args: SetStorageAtParameters) => Promise<void>;
201
- snapshot: () => Promise<Quantity>;
202
- stopImpersonatingAccount: (args: StopImpersonatingAccountParameters) => Promise<void>;
203
- };
204
-
205
- export { RevertParameters as A, SendUnsignedTransactionReturnType as B, SetBalanceParameters as C, DropTransactionParameters as D, SetBlockGasLimitParameters as E, SetBlockTimestampIntervalParameters as F, SetCodeParameters as G, SetCoinbaseParameters as H, ImpersonateAccountParameters as I, SetIntervalMiningParameters as J, SetMinGasPriceParameters as K, SetNextBlockBaseFeePerGasParameters as L, MineParameters as M, SetNextBlockTimestampParameters as N, SetNonceParameters as O, SetStorageAtParameters as P, StopImpersonatingAccountParameters as Q, ResetParameters as R, SendUnsignedTransactionParameters as S, TestClient as T, TestClientConfig as a, getTxpoolContent as b, createTestClient as c, dropTransaction as d, getTxpoolStatus as e, increaseTime as f, getAutomine as g, inspectTxpool as h, impersonateAccount as i, revert as j, setBalance as k, setBlockGasLimit as l, mine as m, setBlockTimestampInterval as n, setCode as o, setCoinbase as p, setIntervalMining as q, reset as r, sendUnsignedTransaction as s, setMinGasPrice as t, setNextBlockBaseFeePerGas as u, setNextBlockTimestamp as v, setNonce as w, setStorageAt as x, stopImpersonatingAccount as y, IncreaseTimeParameters as z };