viem 0.0.0-w-20230630153145 → 0.0.0-w-20230711200108

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 (143) hide show
  1. package/dist/cjs/accounts/utils/signTransaction.js.map +1 -1
  2. package/dist/cjs/actions/public/simulateContract.js +1 -0
  3. package/dist/cjs/actions/public/simulateContract.js.map +1 -1
  4. package/dist/cjs/actions/public/waitForTransactionReceipt.js +3 -4
  5. package/dist/cjs/actions/public/waitForTransactionReceipt.js.map +1 -1
  6. package/dist/cjs/chains/formatters/celo.js +2 -2
  7. package/dist/cjs/chains/formatters/celo.js.map +1 -1
  8. package/dist/cjs/chains/formatters/optimism.js +2 -2
  9. package/dist/cjs/chains/formatters/optimism.js.map +1 -1
  10. package/dist/cjs/chains/index.js +9 -5
  11. package/dist/cjs/chains/index.js.map +1 -1
  12. package/dist/cjs/chains/serializers/celo.js +84 -0
  13. package/dist/cjs/chains/serializers/celo.js.map +1 -0
  14. package/dist/cjs/clients/createClient.js +19 -12
  15. package/dist/cjs/clients/createClient.js.map +1 -1
  16. package/dist/cjs/clients/createPublicClient.js +6 -7
  17. package/dist/cjs/clients/createPublicClient.js.map +1 -1
  18. package/dist/cjs/clients/createTestClient.js +9 -9
  19. package/dist/cjs/clients/createTestClient.js.map +1 -1
  20. package/dist/cjs/clients/createWalletClient.js +6 -6
  21. package/dist/cjs/clients/createWalletClient.js.map +1 -1
  22. package/dist/cjs/clients/decorators/public.js +44 -42
  23. package/dist/cjs/clients/decorators/public.js.map +1 -1
  24. package/dist/cjs/clients/decorators/wallet.js +17 -15
  25. package/dist/cjs/clients/decorators/wallet.js.map +1 -1
  26. package/dist/cjs/errors/base.js +2 -2
  27. package/dist/cjs/errors/base.js.map +1 -1
  28. package/dist/cjs/errors/version.js +1 -1
  29. package/dist/cjs/errors/version.js.map +1 -1
  30. package/dist/cjs/utils/abi/encodePacked.js.map +1 -1
  31. package/dist/cjs/utils/ens/avatar/utils.js +2 -1
  32. package/dist/cjs/utils/ens/avatar/utils.js.map +1 -1
  33. package/dist/cjs/utils/errors/getContractError.js +1 -1
  34. package/dist/cjs/utils/errors/getContractError.js.map +1 -1
  35. package/dist/cjs/utils/formatters/extract.js +0 -1
  36. package/dist/cjs/utils/formatters/extract.js.map +1 -1
  37. package/dist/cjs/utils/transaction/prepareRequest.js +1 -1
  38. package/dist/cjs/utils/transaction/prepareRequest.js.map +1 -1
  39. package/dist/esm/accounts/utils/signTransaction.js.map +1 -1
  40. package/dist/esm/actions/public/simulateContract.js +1 -0
  41. package/dist/esm/actions/public/simulateContract.js.map +1 -1
  42. package/dist/esm/actions/public/waitForTransactionReceipt.js +3 -4
  43. package/dist/esm/actions/public/waitForTransactionReceipt.js.map +1 -1
  44. package/dist/esm/chains/formatters/celo.js +1 -1
  45. package/dist/esm/chains/formatters/celo.js.map +1 -1
  46. package/dist/esm/chains/formatters/optimism.js +1 -1
  47. package/dist/esm/chains/formatters/optimism.js.map +1 -1
  48. package/dist/esm/chains/index.js +11 -7
  49. package/dist/esm/chains/index.js.map +1 -1
  50. package/dist/esm/chains/serializers/celo.js +92 -0
  51. package/dist/esm/chains/serializers/celo.js.map +1 -0
  52. package/dist/esm/clients/createClient.js +19 -15
  53. package/dist/esm/clients/createClient.js.map +1 -1
  54. package/dist/esm/clients/createPublicClient.js +6 -26
  55. package/dist/esm/clients/createPublicClient.js.map +1 -1
  56. package/dist/esm/clients/createTestClient.js +9 -32
  57. package/dist/esm/clients/createTestClient.js.map +1 -1
  58. package/dist/esm/clients/createWalletClient.js +6 -42
  59. package/dist/esm/clients/createWalletClient.js.map +1 -1
  60. package/dist/esm/clients/decorators/public.js +44 -42
  61. package/dist/esm/clients/decorators/public.js.map +1 -1
  62. package/dist/esm/clients/decorators/wallet.js +17 -15
  63. package/dist/esm/clients/decorators/wallet.js.map +1 -1
  64. package/dist/esm/errors/base.js +2 -2
  65. package/dist/esm/errors/base.js.map +1 -1
  66. package/dist/esm/errors/version.js +1 -1
  67. package/dist/esm/errors/version.js.map +1 -1
  68. package/dist/esm/utils/abi/encodePacked.js.map +1 -1
  69. package/dist/esm/utils/ens/avatar/utils.js +3 -1
  70. package/dist/esm/utils/ens/avatar/utils.js.map +1 -1
  71. package/dist/esm/utils/errors/getContractError.js +1 -1
  72. package/dist/esm/utils/errors/getContractError.js.map +1 -1
  73. package/dist/esm/utils/formatters/extract.js +1 -1
  74. package/dist/esm/utils/formatters/extract.js.map +1 -1
  75. package/dist/esm/utils/transaction/prepareRequest.js +1 -1
  76. package/dist/esm/utils/transaction/prepareRequest.js.map +1 -1
  77. package/dist/types/accounts/utils/signTransaction.d.ts +1 -1
  78. package/dist/types/accounts/utils/signTransaction.d.ts.map +1 -1
  79. package/dist/types/actions/public/simulateContract.d.ts.map +1 -1
  80. package/dist/types/actions/public/waitForTransactionReceipt.d.ts.map +1 -1
  81. package/dist/types/actions/wallet/deployContract.d.ts +1 -1
  82. package/dist/types/actions/wallet/deployContract.d.ts.map +1 -1
  83. package/dist/types/chains/formatters/celo.d.ts +2 -2
  84. package/dist/types/chains/formatters/celo.d.ts.map +1 -1
  85. package/dist/types/chains/formatters/optimism.d.ts +9 -9
  86. package/dist/types/chains/formatters/optimism.d.ts.map +1 -1
  87. package/dist/types/chains/index.d.ts.map +1 -1
  88. package/dist/types/chains/serializers/celo.d.ts +20 -0
  89. package/dist/types/chains/serializers/celo.d.ts.map +1 -0
  90. package/dist/types/clients/createClient.d.ts +32 -34
  91. package/dist/types/clients/createClient.d.ts.map +1 -1
  92. package/dist/types/clients/createPublicClient.d.ts +3 -3
  93. package/dist/types/clients/createPublicClient.d.ts.map +1 -1
  94. package/dist/types/clients/createTestClient.d.ts +9 -7
  95. package/dist/types/clients/createTestClient.d.ts.map +1 -1
  96. package/dist/types/clients/createWalletClient.d.ts +3 -3
  97. package/dist/types/clients/createWalletClient.d.ts.map +1 -1
  98. package/dist/types/clients/decorators/public.d.ts +1 -519
  99. package/dist/types/clients/decorators/public.d.ts.map +1 -1
  100. package/dist/types/clients/decorators/wallet.d.ts +1 -519
  101. package/dist/types/clients/decorators/wallet.d.ts.map +1 -1
  102. package/dist/types/errors/base.d.ts +2 -1
  103. package/dist/types/errors/base.d.ts.map +1 -1
  104. package/dist/types/errors/version.d.ts +1 -1
  105. package/dist/types/errors/version.d.ts.map +1 -1
  106. package/dist/types/types/chain.d.ts +3 -4
  107. package/dist/types/types/chain.d.ts.map +1 -1
  108. package/dist/types/types/eip1193.d.ts +9 -10
  109. package/dist/types/types/eip1193.d.ts.map +1 -1
  110. package/dist/types/types/transaction.d.ts +1 -1
  111. package/dist/types/types/transaction.d.ts.map +1 -1
  112. package/dist/types/types/typedData.d.ts +6 -6
  113. package/dist/types/types/typedData.d.ts.map +1 -1
  114. package/dist/types/utils/ens/avatar/utils.d.ts +1 -1
  115. package/dist/types/utils/ens/avatar/utils.d.ts.map +1 -1
  116. package/dist/types/utils/formatters/extract.d.ts +1 -1
  117. package/dist/types/utils/formatters/extract.d.ts.map +1 -1
  118. package/package.json +6 -1
  119. package/src/accounts/utils/signTransaction.ts +7 -2
  120. package/src/actions/public/simulateContract.ts +1 -0
  121. package/src/actions/public/waitForTransactionReceipt.ts +3 -4
  122. package/src/actions/wallet/deployContract.ts +1 -1
  123. package/src/chains/formatters/celo.ts +8 -7
  124. package/src/chains/formatters/optimism.ts +14 -14
  125. package/src/chains/index.ts +11 -7
  126. package/src/chains/serializers/celo.ts +190 -0
  127. package/src/clients/createClient.ts +116 -88
  128. package/src/clients/createPublicClient.ts +26 -26
  129. package/src/clients/createTestClient.ts +41 -47
  130. package/src/clients/createWalletClient.ts +30 -33
  131. package/src/clients/decorators/public.ts +49 -44
  132. package/src/clients/decorators/wallet.ts +18 -16
  133. package/src/errors/base.ts +6 -3
  134. package/src/errors/version.ts +1 -1
  135. package/src/types/chain.ts +6 -7
  136. package/src/types/eip1193.ts +14 -27
  137. package/src/types/transaction.ts +1 -1
  138. package/src/types/typedData.ts +6 -6
  139. package/src/utils/abi/encodePacked.ts +1 -1
  140. package/src/utils/ens/avatar/utils.ts +3 -1
  141. package/src/utils/errors/getContractError.ts +1 -1
  142. package/src/utils/formatters/extract.ts +3 -2
  143. package/src/utils/transaction/prepareRequest.ts +1 -1
@@ -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
- TTransport extends Transport = Transport,
14
- TChain extends Chain | undefined = Chain | undefined,
15
- TAccountOrAddress extends Account | Address | undefined =
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
- > = Pick<
20
- ClientConfig<TTransport, TChain, TAccountOrAddress>,
21
- 'account' | 'chain' | 'key' | 'name' | 'pollingInterval' | 'transport'
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
- TTransport extends Transport = Transport,
26
- TChain extends Chain | undefined = Chain | undefined,
27
- TAccount extends Account | undefined = Account | undefined,
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
- TTransport,
31
- TChain,
32
- TAccount,
32
+ transport,
33
+ chain,
34
+ account,
33
35
  WalletRpcSchema,
34
- WalletActions<TChain, TAccount>
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
- TTransport extends Transport,
76
- TChain extends Chain | undefined = undefined,
77
- TAccountOrAddress extends Account | Address | undefined = undefined,
78
- >({
79
- account,
80
- chain,
81
- transport,
82
- key = 'wallet',
83
- name = 'Wallet Client',
84
- pollingInterval,
85
- }: WalletClientConfig<TTransport, TChain, TAccountOrAddress>): WalletClient<
86
- TTransport,
87
- TChain,
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
- }).extend(walletActions)
94
+ })
95
+ return client.extend(walletActions)
99
96
  }
@@ -1374,52 +1374,57 @@ export type PublicActions<
1374
1374
  ) => WatchPendingTransactionsReturnType
1375
1375
  }
1376
1376
 
1377
- export const publicActions = <
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
- call: (args) => call(client, args),
1385
- createBlockFilter: () => createBlockFilter(client),
1386
- createContractEventFilter: (args) => createContractEventFilter(client, args),
1387
- createEventFilter: (args) => createEventFilter(client, args),
1388
- createPendingTransactionFilter: () => createPendingTransactionFilter(client),
1389
- estimateContractGas: (args) => estimateContractGas(client, args as any),
1390
- estimateGas: (args) => estimateGas(client, args),
1391
- getBalance: (args) => getBalance(client, args),
1392
- getBlock: (args) => getBlock(client, args),
1393
- getBlockNumber: (args) => getBlockNumber(client, args),
1394
- getBlockTransactionCount: (args) => getBlockTransactionCount(client, args),
1395
- getBytecode: (args) => getBytecode(client, args),
1396
- getChainId: () => getChainId(client),
1397
- getEnsAddress: (args) => getEnsAddress(client, args),
1398
- getEnsAvatar: (args) => getEnsAvatar(client, args),
1399
- getEnsName: (args) => getEnsName(client, args),
1400
- getEnsResolver: (args) => getEnsResolver(client, args),
1401
- getEnsText: (args) => getEnsText(client, args),
1402
- getFeeHistory: (args) => getFeeHistory(client, args),
1403
- getFilterChanges: (args) => getFilterChanges(client, args),
1404
- getFilterLogs: (args) => getFilterLogs(client, args),
1405
- getGasPrice: () => getGasPrice(client),
1406
- getLogs: (args) => getLogs(client, args),
1407
- getStorageAt: (args) => getStorageAt(client, args),
1408
- getTransaction: (args) => getTransaction(client, args),
1409
- getTransactionConfirmations: (args) =>
1410
- getTransactionConfirmations(client, args),
1411
- getTransactionCount: (args) => getTransactionCount(client, args),
1412
- getTransactionReceipt: (args) => getTransactionReceipt(client, args),
1413
- multicall: (args) => multicall(client, args),
1414
- readContract: (args) => readContract(client, args),
1415
- simulateContract: (args) => simulateContract(client, args),
1416
- verifyMessage: (args) => verifyMessage(client, args),
1417
- verifyTypedData: (args) => verifyTypedData(client, args),
1418
- uninstallFilter: (args) => uninstallFilter(client, args),
1419
- waitForTransactionReceipt: (args) => waitForTransactionReceipt(client, args),
1420
- watchBlocks: (args) => watchBlocks(client, args),
1421
- watchBlockNumber: (args) => watchBlockNumber(client, args),
1422
- watchContractEvent: (args) => watchContractEvent(client, args),
1423
- watchEvent: (args) => watchEvent(client, args),
1424
- watchPendingTransactions: (args) => watchPendingTransactions(client, args),
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 const walletActions = <
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
- addChain: (args) => addChain(client, args),
534
- deployContract: (args) => deployContract(client, args),
535
- getAddresses: () => getAddresses(client),
536
- getChainId: () => getChainId(client),
537
- getPermissions: () => getPermissions(client),
538
- requestAddresses: () => requestAddresses(client),
539
- requestPermissions: (args) => requestPermissions(client, args),
540
- sendTransaction: (args) => sendTransaction(client, args),
541
- signMessage: (args) => signMessage(client, args),
542
- signTypedData: (args) => signTypedData(client, args),
543
- switchChain: (args) => switchChain(client, args),
544
- watchAsset: (args) => watchAsset(client, args),
545
- writeContract: (args) => writeContract(client, args),
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
+ }
@@ -60,13 +60,16 @@ export class BaseError extends Error {
60
60
  this.shortMessage = shortMessage
61
61
  }
62
62
 
63
- walk(fn?: (err: unknown) => boolean) {
63
+ walk(): Error
64
+ walk(fn: (err: unknown) => boolean): Error | null
65
+ walk(fn?: any): any {
64
66
  return walk(this, fn)
65
67
  }
66
68
  }
67
69
 
68
70
  function walk(err: unknown, fn?: (err: unknown) => boolean): unknown {
69
71
  if (fn?.(err)) return err
70
- if ((err as Error).cause) return walk((err as Error).cause, fn)
71
- return err
72
+ if (err && typeof err === 'object' && 'cause' in err)
73
+ return walk(err.cause, fn)
74
+ return fn ? null : err
72
75
  }
@@ -1 +1 @@
1
- export const version = '1.2.6'
1
+ export const version = '1.2.12'
@@ -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
- TFormatters extends Formatters | undefined = Formatters | undefined,
10
- TSerializers extends Serializers<TFormatters> | undefined =
11
- | Serializers<TFormatters>
8
+ formatters extends Formatters | undefined = Formatters | undefined,
9
+ serializers extends Serializers<formatters> | undefined =
10
+ | Serializers<formatters>
12
11
  | undefined,
13
- > = Chain_ & {
14
- formatters?: TFormatters
15
- serializers?: TSerializers
12
+ > = import('@wagmi/chains').Chain & {
13
+ formatters?: formatters | undefined
14
+ serializers?: serializers | undefined
16
15
  }
17
16
 
18
17
  export type ChainContract = {
@@ -51,35 +51,22 @@ export type ProviderMessage = {
51
51
  data: unknown
52
52
  }
53
53
 
54
- export type EIP1193Events = {
55
- on(
56
- event: 'connect',
57
- listener: (connectInfo: ProviderConnectInfo) => void,
58
- ): void
59
- on(event: 'disconnect', listener: (error: ProviderRpcError) => void): void
60
- on(event: 'chainChanged', listener: (chainId: string) => void): void
61
- on(event: 'accountsChanged', listener: (accounts: string[]) => void): void
62
- on(event: 'message', listener: (message: ProviderMessage) => void): void
54
+ type EIP1193EventMap = {
55
+ accountsChanged(accounts: Address[]): void
56
+ chainChanged(chainId: string): void
57
+ connect(connectInfo: ProviderConnectInfo): void
58
+ disconnect(error: ProviderRpcError): void
59
+ message(message: ProviderMessage): void
60
+ }
63
61
 
64
- removeListener(
65
- event: 'connect',
66
- listener: (connectInfo: ProviderConnectInfo) => void,
67
- ): void
68
- removeListener(
69
- event: 'disconnect',
70
- listener: (error: ProviderRpcError) => void,
71
- ): void
72
- removeListener(
73
- event: 'chainChanged',
74
- listener: (chainId: string) => void,
75
- ): void
76
- removeListener(
77
- event: 'accountsChanged',
78
- listener: (accounts: Address[]) => void,
62
+ export type EIP1193Events = {
63
+ on<TEvent extends keyof EIP1193EventMap>(
64
+ event: TEvent,
65
+ listener: EIP1193EventMap[TEvent],
79
66
  ): void
80
- removeListener(
81
- event: 'message',
82
- listener: (message: ProviderMessage) => void,
67
+ removeListener<TEvent extends keyof EIP1193EventMap>(
68
+ event: TEvent,
69
+ listener: EIP1193EventMap[TEvent],
83
70
  ): void
84
71
  }
85
72
 
@@ -35,7 +35,7 @@ export type TransactionReceipt<
35
35
  logs: Log<TQuantity, TIndex>[]
36
36
  /** Logs bloom filter */
37
37
  logsBloom: Hex
38
- /** `1` if this transaction was successful or `0` if it failed */
38
+ /** `success` if this transaction was successful or `reverted` if it failed */
39
39
  status: TStatus
40
40
  /** Transaction recipient or `null` if deploying a contract */
41
41
  to: Address | null
@@ -15,11 +15,11 @@ export type TypedDataDefinition<
15
15
  GetTypedDataDomain<TTypedData, TPrimaryType>
16
16
 
17
17
  export type GetTypedDataDomain<
18
- TTypedData extends TypedData | { [key: string]: unknown } = TypedData,
18
+ TTypedData extends TypedData | { [key_1: string]: unknown } = TypedData,
19
19
  TPrimaryType extends string = string,
20
20
  TSchema = TTypedData extends TypedData
21
21
  ? TypedDataToPrimitiveTypes<TTypedData>
22
- : { [key: string]: any },
22
+ : { [key_2: string]: any },
23
23
  TDomain = TSchema extends { EIP712Domain: infer Domain }
24
24
  ? Domain
25
25
  : TypedDataDomain,
@@ -32,24 +32,24 @@ export type GetTypedDataDomain<
32
32
  }
33
33
 
34
34
  export type GetTypedDataMessage<
35
- TTypedData extends TypedData | { [key: string]: unknown } = TypedData,
35
+ TTypedData extends TypedData | { [key_1: string]: unknown } = TypedData,
36
36
  TPrimaryType extends string = string,
37
37
  TSchema = TTypedData extends TypedData
38
38
  ? TypedDataToPrimitiveTypes<TTypedData>
39
- : { [key: string]: any },
39
+ : { [key_2: string]: any },
40
40
  TMessage = TSchema[TPrimaryType extends keyof TSchema
41
41
  ? TPrimaryType
42
42
  : keyof TSchema],
43
43
  > = TPrimaryType extends 'EIP712Domain'
44
44
  ? {}
45
- : { [key: string]: any } extends TMessage // Check if we were able to infer the shape of typed data
45
+ : { [key_3: string]: any } extends TMessage // Check if we were able to infer the shape of typed data
46
46
  ? {
47
47
  /**
48
48
  * Data to sign
49
49
  *
50
50
  * Use a [const assertion](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html#const-assertions) on {@link types} for type inference.
51
51
  */
52
- message: { [key: string]: unknown }
52
+ message: { [key_4: string]: unknown }
53
53
  }
54
54
  : {
55
55
  /** Data to sign */
@@ -62,7 +62,7 @@ export function encodePacked<
62
62
  function encode<TPackedAbiType extends PackedAbiType | unknown>(
63
63
  type: TPackedAbiType,
64
64
  value: EncodePackedValues<[TPackedAbiType]>[0],
65
- isArray: boolean = false,
65
+ isArray = false,
66
66
  ): Hex {
67
67
  if (type === 'address') {
68
68
  const address = value as Address
@@ -40,6 +40,7 @@ export async function isImageUri(uri: string) {
40
40
  return false
41
41
  }
42
42
  // fail in NodeJS, since the error is not cors but any other network issue
43
+ // rome-ignore lint/suspicious/noPrototypeBuiltins:
43
44
  if (!globalThis.hasOwnProperty('Image')) return false
44
45
  // in case of cors, use image api to validate if given url is an actual image
45
46
  return new Promise((resolve) => {
@@ -179,7 +180,8 @@ type ParsedNft = {
179
180
  tokenID: string
180
181
  }
181
182
 
182
- export function parseNftUri(uri: string): ParsedNft {
183
+ export function parseNftUri(uri_: string): ParsedNft {
184
+ let uri = uri_
183
185
  // parse valid nft spec (CAIP-22/CAIP-29)
184
186
  // @see: https://github.com/ChainAgnostic/CAIPs/tree/master/CAIPs
185
187
  if (uri.startsWith('did:nft:')) {
@@ -33,7 +33,7 @@ export function getContractError(
33
33
  err instanceof RawContractError
34
34
  ? err
35
35
  : err instanceof BaseError
36
- ? err.walk((err) => 'data' in (err as Error))
36
+ ? err.walk((err) => 'data' in (err as Error)) || err.walk()
37
37
  : {}
38
38
  ) as RawContractError
39
39
 
@@ -9,9 +9,10 @@ export function extract(
9
9
  ) {
10
10
  if (!format) return {}
11
11
  const keys = Object.keys(format({}))
12
- return keys.reduce((data, key) => {
12
+ return keys.reduce((data: Record<string, unknown>, key) => {
13
+ // rome-ignore lint/suspicious/noPrototypeBuiltins:
13
14
  if (value?.hasOwnProperty(key)) {
14
- ;(data as any)[key] = value[key]
15
+ data[key] = value[key]
15
16
  }
16
17
  return data
17
18
  }, {})
@@ -72,7 +72,7 @@ export async function prepareRequest<
72
72
  blockTag: 'pending',
73
73
  })
74
74
 
75
- if (block.baseFeePerGas) {
75
+ if (typeof block.baseFeePerGas === 'bigint') {
76
76
  if (typeof gasPrice !== 'undefined')
77
77
  throw new BaseError('Chain does not support legacy `gasPrice`.')
78
78