viem 1.2.10 → 1.2.11
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.
- package/dist/cjs/chains/formatters/celo.js +2 -2
- package/dist/cjs/chains/formatters/celo.js.map +1 -1
- package/dist/cjs/chains/formatters/optimism.js +2 -2
- package/dist/cjs/chains/formatters/optimism.js.map +1 -1
- package/dist/cjs/chains/index.js +8 -8
- package/dist/cjs/chains/serializers/celo.js +12 -13
- package/dist/cjs/chains/serializers/celo.js.map +1 -1
- package/dist/cjs/clients/createClient.js +19 -12
- package/dist/cjs/clients/createClient.js.map +1 -1
- package/dist/cjs/clients/createPublicClient.js +6 -7
- package/dist/cjs/clients/createPublicClient.js.map +1 -1
- package/dist/cjs/clients/createTestClient.js +9 -9
- package/dist/cjs/clients/createTestClient.js.map +1 -1
- package/dist/cjs/clients/createWalletClient.js +6 -6
- package/dist/cjs/clients/createWalletClient.js.map +1 -1
- package/dist/cjs/clients/decorators/public.js +44 -42
- package/dist/cjs/clients/decorators/public.js.map +1 -1
- package/dist/cjs/clients/decorators/wallet.js +17 -15
- package/dist/cjs/clients/decorators/wallet.js.map +1 -1
- package/dist/esm/chains/formatters/celo.js +1 -1
- package/dist/esm/chains/formatters/celo.js.map +1 -1
- package/dist/esm/chains/formatters/optimism.js +1 -1
- package/dist/esm/chains/formatters/optimism.js.map +1 -1
- package/dist/esm/chains/index.js +11 -11
- package/dist/esm/chains/serializers/celo.js +13 -14
- package/dist/esm/chains/serializers/celo.js.map +1 -1
- package/dist/esm/clients/createClient.js +19 -15
- package/dist/esm/clients/createClient.js.map +1 -1
- package/dist/esm/clients/createPublicClient.js +6 -26
- package/dist/esm/clients/createPublicClient.js.map +1 -1
- package/dist/esm/clients/createTestClient.js +9 -32
- package/dist/esm/clients/createTestClient.js.map +1 -1
- package/dist/esm/clients/createWalletClient.js +6 -42
- package/dist/esm/clients/createWalletClient.js.map +1 -1
- package/dist/esm/clients/decorators/public.js +44 -42
- package/dist/esm/clients/decorators/public.js.map +1 -1
- package/dist/esm/clients/decorators/wallet.js +17 -15
- package/dist/esm/clients/decorators/wallet.js.map +1 -1
- package/dist/types/chains/formatters/celo.d.ts +2 -2
- package/dist/types/chains/formatters/celo.d.ts.map +1 -1
- package/dist/types/chains/formatters/optimism.d.ts +9 -9
- package/dist/types/chains/formatters/optimism.d.ts.map +1 -1
- package/dist/types/chains/serializers/celo.d.ts +3 -4
- package/dist/types/chains/serializers/celo.d.ts.map +1 -1
- package/dist/types/clients/createClient.d.ts +29 -32
- package/dist/types/clients/createClient.d.ts.map +1 -1
- package/dist/types/clients/createPublicClient.d.ts +3 -3
- package/dist/types/clients/createPublicClient.d.ts.map +1 -1
- package/dist/types/clients/createTestClient.d.ts +9 -7
- package/dist/types/clients/createTestClient.d.ts.map +1 -1
- package/dist/types/clients/createWalletClient.d.ts +3 -3
- package/dist/types/clients/createWalletClient.d.ts.map +1 -1
- package/dist/types/clients/decorators/public.d.ts +1 -519
- package/dist/types/clients/decorators/public.d.ts.map +1 -1
- package/dist/types/clients/decorators/wallet.d.ts +1 -519
- package/dist/types/clients/decorators/wallet.d.ts.map +1 -1
- package/dist/types/types/chain.d.ts +3 -4
- package/dist/types/types/chain.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/chains/formatters/celo.ts +8 -7
- package/src/chains/formatters/optimism.ts +14 -14
- package/src/chains/index.ts +11 -11
- package/src/chains/serializers/celo.ts +15 -19
- package/src/clients/createClient.ts +113 -89
- package/src/clients/createPublicClient.ts +26 -26
- package/src/clients/createTestClient.ts +41 -47
- package/src/clients/createWalletClient.ts +30 -33
- package/src/clients/decorators/public.ts +49 -44
- package/src/clients/decorators/wallet.ts +18 -16
- package/src/types/chain.ts +6 -7
@@ -10,28 +10,30 @@ import { type WalletActions, walletActions } from './decorators/wallet.js'
|
|
10
10
|
import type { Transport } from './transports/createTransport.js'
|
11
11
|
|
12
12
|
export type WalletClientConfig<
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
transport extends Transport = Transport,
|
14
|
+
chain extends Chain | undefined = Chain | undefined,
|
15
|
+
accountOrAddress extends Account | Address | undefined =
|
16
16
|
| Account
|
17
17
|
| Address
|
18
18
|
| undefined,
|
19
|
-
> =
|
20
|
-
|
21
|
-
|
19
|
+
> = Prettify<
|
20
|
+
Pick<
|
21
|
+
ClientConfig<transport, chain, accountOrAddress>,
|
22
|
+
'account' | 'chain' | 'key' | 'name' | 'pollingInterval' | 'transport'
|
23
|
+
>
|
22
24
|
>
|
23
25
|
|
24
26
|
export type WalletClient<
|
25
|
-
|
26
|
-
|
27
|
-
|
27
|
+
transport extends Transport = Transport,
|
28
|
+
chain extends Chain | undefined = Chain | undefined,
|
29
|
+
account extends Account | undefined = Account | undefined,
|
28
30
|
> = Prettify<
|
29
31
|
Client<
|
30
|
-
|
31
|
-
|
32
|
-
|
32
|
+
transport,
|
33
|
+
chain,
|
34
|
+
account,
|
33
35
|
WalletRpcSchema,
|
34
|
-
WalletActions<
|
36
|
+
WalletActions<chain, account>
|
35
37
|
>
|
36
38
|
>
|
37
39
|
|
@@ -72,28 +74,23 @@ export type WalletClient<
|
|
72
74
|
* })
|
73
75
|
*/
|
74
76
|
export function createWalletClient<
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
>(
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
ParseAccount<TAccountOrAddress>
|
89
|
-
> {
|
90
|
-
return createClient({
|
91
|
-
account,
|
92
|
-
chain,
|
77
|
+
transport extends Transport,
|
78
|
+
chain extends Chain | undefined = undefined,
|
79
|
+
accountOrAddress extends Account | Address | undefined = undefined,
|
80
|
+
>(
|
81
|
+
parameters: WalletClientConfig<transport, chain, accountOrAddress>,
|
82
|
+
): WalletClient<transport, chain, ParseAccount<accountOrAddress>>
|
83
|
+
|
84
|
+
export function createWalletClient(
|
85
|
+
parameters: WalletClientConfig,
|
86
|
+
): WalletClient {
|
87
|
+
const { key = 'wallet', name = 'Wallet Client', transport } = parameters
|
88
|
+
const client = createClient({
|
89
|
+
...parameters,
|
93
90
|
key,
|
94
91
|
name,
|
95
|
-
pollingInterval,
|
96
92
|
transport: (opts) => transport({ ...opts, retryCount: 0 }),
|
97
93
|
type: 'walletClient',
|
98
|
-
})
|
94
|
+
})
|
95
|
+
return client.extend(walletActions)
|
99
96
|
}
|
@@ -1374,52 +1374,57 @@ export type PublicActions<
|
|
1374
1374
|
) => WatchPendingTransactionsReturnType
|
1375
1375
|
}
|
1376
1376
|
|
1377
|
-
export
|
1377
|
+
export function publicActions<
|
1378
1378
|
TTransport extends Transport = Transport,
|
1379
1379
|
TChain extends Chain | undefined = Chain | undefined,
|
1380
1380
|
TAccount extends Account | undefined = Account | undefined,
|
1381
1381
|
>(
|
1382
1382
|
client: Client<TTransport, TChain, TAccount>,
|
1383
|
-
): PublicActions<TTransport, TChain, TAccount>
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
1390
|
-
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1405
|
-
|
1406
|
-
|
1407
|
-
|
1408
|
-
|
1409
|
-
|
1410
|
-
|
1411
|
-
|
1412
|
-
|
1413
|
-
|
1414
|
-
|
1415
|
-
|
1416
|
-
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1420
|
-
|
1421
|
-
|
1422
|
-
|
1423
|
-
|
1424
|
-
|
1425
|
-
|
1383
|
+
): PublicActions<TTransport, TChain, TAccount> {
|
1384
|
+
return {
|
1385
|
+
call: (args) => call(client, args),
|
1386
|
+
createBlockFilter: () => createBlockFilter(client),
|
1387
|
+
createContractEventFilter: (args) =>
|
1388
|
+
createContractEventFilter(client, args),
|
1389
|
+
createEventFilter: (args) => createEventFilter(client, args),
|
1390
|
+
createPendingTransactionFilter: () =>
|
1391
|
+
createPendingTransactionFilter(client),
|
1392
|
+
estimateContractGas: (args) => estimateContractGas(client, args as any),
|
1393
|
+
estimateGas: (args) => estimateGas(client, args),
|
1394
|
+
getBalance: (args) => getBalance(client, args),
|
1395
|
+
getBlock: (args) => getBlock(client, args),
|
1396
|
+
getBlockNumber: (args) => getBlockNumber(client, args),
|
1397
|
+
getBlockTransactionCount: (args) => getBlockTransactionCount(client, args),
|
1398
|
+
getBytecode: (args) => getBytecode(client, args),
|
1399
|
+
getChainId: () => getChainId(client),
|
1400
|
+
getEnsAddress: (args) => getEnsAddress(client, args),
|
1401
|
+
getEnsAvatar: (args) => getEnsAvatar(client, args),
|
1402
|
+
getEnsName: (args) => getEnsName(client, args),
|
1403
|
+
getEnsResolver: (args) => getEnsResolver(client, args),
|
1404
|
+
getEnsText: (args) => getEnsText(client, args),
|
1405
|
+
getFeeHistory: (args) => getFeeHistory(client, args),
|
1406
|
+
getFilterChanges: (args) => getFilterChanges(client, args),
|
1407
|
+
getFilterLogs: (args) => getFilterLogs(client, args),
|
1408
|
+
getGasPrice: () => getGasPrice(client),
|
1409
|
+
getLogs: (args) => getLogs(client, args),
|
1410
|
+
getStorageAt: (args) => getStorageAt(client, args),
|
1411
|
+
getTransaction: (args) => getTransaction(client, args),
|
1412
|
+
getTransactionConfirmations: (args) =>
|
1413
|
+
getTransactionConfirmations(client, args),
|
1414
|
+
getTransactionCount: (args) => getTransactionCount(client, args),
|
1415
|
+
getTransactionReceipt: (args) => getTransactionReceipt(client, args),
|
1416
|
+
multicall: (args) => multicall(client, args),
|
1417
|
+
readContract: (args) => readContract(client, args),
|
1418
|
+
simulateContract: (args) => simulateContract(client, args),
|
1419
|
+
verifyMessage: (args) => verifyMessage(client, args),
|
1420
|
+
verifyTypedData: (args) => verifyTypedData(client, args),
|
1421
|
+
uninstallFilter: (args) => uninstallFilter(client, args),
|
1422
|
+
waitForTransactionReceipt: (args) =>
|
1423
|
+
waitForTransactionReceipt(client, args),
|
1424
|
+
watchBlocks: (args) => watchBlocks(client, args),
|
1425
|
+
watchBlockNumber: (args) => watchBlockNumber(client, args),
|
1426
|
+
watchContractEvent: (args) => watchContractEvent(client, args),
|
1427
|
+
watchEvent: (args) => watchEvent(client, args),
|
1428
|
+
watchPendingTransactions: (args) => watchPendingTransactions(client, args),
|
1429
|
+
}
|
1430
|
+
}
|
@@ -523,24 +523,26 @@ export type WalletActions<
|
|
523
523
|
) => Promise<WriteContractReturnType>
|
524
524
|
}
|
525
525
|
|
526
|
-
export
|
526
|
+
export function walletActions<
|
527
527
|
TTransport extends Transport,
|
528
528
|
TChain extends Chain | undefined = Chain | undefined,
|
529
529
|
TAccount extends Account | undefined = Account | undefined,
|
530
530
|
>(
|
531
531
|
client: Client<TTransport, TChain, TAccount>,
|
532
|
-
): WalletActions<TChain, TAccount>
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
532
|
+
): WalletActions<TChain, TAccount> {
|
533
|
+
return {
|
534
|
+
addChain: (args) => addChain(client, args),
|
535
|
+
deployContract: (args) => deployContract(client, args),
|
536
|
+
getAddresses: () => getAddresses(client),
|
537
|
+
getChainId: () => getChainId(client),
|
538
|
+
getPermissions: () => getPermissions(client),
|
539
|
+
requestAddresses: () => requestAddresses(client),
|
540
|
+
requestPermissions: (args) => requestPermissions(client, args),
|
541
|
+
sendTransaction: (args) => sendTransaction(client, args),
|
542
|
+
signMessage: (args) => signMessage(client, args),
|
543
|
+
signTypedData: (args) => signTypedData(client, args),
|
544
|
+
switchChain: (args) => switchChain(client, args),
|
545
|
+
watchAsset: (args) => watchAsset(client, args),
|
546
|
+
writeContract: (args) => writeContract(client, args),
|
547
|
+
}
|
548
|
+
}
|
package/src/types/chain.ts
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
import type { Chain as Chain_ } from '@wagmi/chains'
|
2
1
|
import type { Address } from 'abitype'
|
3
2
|
|
4
3
|
import type { Formatters } from './formatter.js'
|
@@ -6,13 +5,13 @@ import type { Serializers } from './serializer.js'
|
|
6
5
|
import type { IsUndefined } from './utils.js'
|
7
6
|
|
8
7
|
export type Chain<
|
9
|
-
|
10
|
-
|
11
|
-
| Serializers<
|
8
|
+
formatters extends Formatters | undefined = Formatters | undefined,
|
9
|
+
serializers extends Serializers<formatters> | undefined =
|
10
|
+
| Serializers<formatters>
|
12
11
|
| undefined,
|
13
|
-
> =
|
14
|
-
formatters?:
|
15
|
-
serializers?:
|
12
|
+
> = import('@wagmi/chains').Chain & {
|
13
|
+
formatters?: formatters | undefined
|
14
|
+
serializers?: serializers | undefined
|
16
15
|
}
|
17
16
|
|
18
17
|
export type ChainContract = {
|