viem 2.0.0-rc.2 → 2.0.0-rc.3

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 (107) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/_cjs/accounts/generateMnemonic.js +2 -2
  3. package/_cjs/accounts/generateMnemonic.js.map +1 -1
  4. package/_cjs/chains/definitions/arbitrumSepolia.js +2 -4
  5. package/_cjs/chains/definitions/arbitrumSepolia.js.map +1 -1
  6. package/_cjs/chains/definitions/bitTorrent.js +19 -0
  7. package/_cjs/chains/definitions/bitTorrent.js.map +1 -0
  8. package/_cjs/chains/definitions/bitTorrentTestnet.js +20 -0
  9. package/_cjs/chains/definitions/bitTorrentTestnet.js.map +1 -0
  10. package/_cjs/chains/definitions/jbc.js +32 -0
  11. package/_cjs/chains/definitions/jbc.js.map +1 -0
  12. package/_cjs/chains/definitions/wemix.js +19 -0
  13. package/_cjs/chains/definitions/wemix.js.map +1 -0
  14. package/_cjs/chains/definitions/wemixTestnet.js +20 -0
  15. package/_cjs/chains/definitions/wemixTestnet.js.map +1 -0
  16. package/_cjs/chains/index.js +14 -4
  17. package/_cjs/chains/index.js.map +1 -1
  18. package/_cjs/chains/opStack/abis.js.map +1 -1
  19. package/_cjs/chains/opStack/contracts.js.map +1 -1
  20. package/_cjs/chains/opStack/decorators/publicL1.js.map +1 -1
  21. package/_cjs/chains/opStack/decorators/publicL2.js.map +1 -1
  22. package/_cjs/chains/opStack/decorators/walletL1.js.map +1 -1
  23. package/_cjs/chains/opStack/decorators/walletL2.js.map +1 -1
  24. package/_cjs/errors/version.js +1 -1
  25. package/_esm/accounts/generateMnemonic.js +3 -2
  26. package/_esm/accounts/generateMnemonic.js.map +1 -1
  27. package/_esm/chains/definitions/arbitrumSepolia.js +2 -4
  28. package/_esm/chains/definitions/arbitrumSepolia.js.map +1 -1
  29. package/_esm/chains/definitions/bitTorrent.js +16 -0
  30. package/_esm/chains/definitions/bitTorrent.js.map +1 -0
  31. package/_esm/chains/definitions/bitTorrentTestnet.js +17 -0
  32. package/_esm/chains/definitions/bitTorrentTestnet.js.map +1 -0
  33. package/_esm/chains/definitions/jbc.js +29 -0
  34. package/_esm/chains/definitions/jbc.js.map +1 -0
  35. package/_esm/chains/definitions/wemix.js +16 -0
  36. package/_esm/chains/definitions/wemix.js.map +1 -0
  37. package/_esm/chains/definitions/wemixTestnet.js +17 -0
  38. package/_esm/chains/definitions/wemixTestnet.js.map +1 -0
  39. package/_esm/chains/index.js +5 -0
  40. package/_esm/chains/index.js.map +1 -1
  41. package/_esm/chains/opStack/abis.js +4 -0
  42. package/_esm/chains/opStack/abis.js.map +1 -1
  43. package/_esm/chains/opStack/contracts.js +4 -0
  44. package/_esm/chains/opStack/contracts.js.map +1 -1
  45. package/_esm/chains/opStack/decorators/publicL1.js +15 -0
  46. package/_esm/chains/opStack/decorators/publicL1.js.map +1 -1
  47. package/_esm/chains/opStack/decorators/publicL2.js +15 -0
  48. package/_esm/chains/opStack/decorators/publicL2.js.map +1 -1
  49. package/_esm/chains/opStack/decorators/walletL1.js +17 -0
  50. package/_esm/chains/opStack/decorators/walletL1.js.map +1 -1
  51. package/_esm/chains/opStack/decorators/walletL2.js +17 -0
  52. package/_esm/chains/opStack/decorators/walletL2.js.map +1 -1
  53. package/_esm/errors/version.js +1 -1
  54. package/_types/accounts/generateMnemonic.d.ts +2 -1
  55. package/_types/accounts/generateMnemonic.d.ts.map +1 -1
  56. package/_types/actions/public/simulateContract.d.ts +2 -2
  57. package/_types/actions/public/simulateContract.d.ts.map +1 -1
  58. package/_types/chains/definitions/arbitrumSepolia.d.ts +6 -2
  59. package/_types/chains/definitions/arbitrumSepolia.d.ts.map +1 -1
  60. package/_types/chains/definitions/bitTorrent.d.ts +42 -0
  61. package/_types/chains/definitions/bitTorrent.d.ts.map +1 -0
  62. package/_types/chains/definitions/bitTorrentTestnet.d.ts +42 -0
  63. package/_types/chains/definitions/bitTorrentTestnet.d.ts.map +1 -0
  64. package/_types/chains/definitions/jbc.d.ts +36 -0
  65. package/_types/chains/definitions/jbc.d.ts.map +1 -0
  66. package/_types/chains/definitions/wemix.d.ts +42 -0
  67. package/_types/chains/definitions/wemix.d.ts.map +1 -0
  68. package/_types/chains/definitions/wemixTestnet.d.ts +42 -0
  69. package/_types/chains/definitions/wemixTestnet.d.ts.map +1 -0
  70. package/_types/chains/index.d.ts +5 -0
  71. package/_types/chains/index.d.ts.map +1 -1
  72. package/_types/chains/opStack/abis.d.ts +4 -0
  73. package/_types/chains/opStack/abis.d.ts.map +1 -1
  74. package/_types/chains/opStack/contracts.d.ts +4 -0
  75. package/_types/chains/opStack/contracts.d.ts.map +1 -1
  76. package/_types/chains/opStack/decorators/publicL1.d.ts +15 -0
  77. package/_types/chains/opStack/decorators/publicL1.d.ts.map +1 -1
  78. package/_types/chains/opStack/decorators/publicL2.d.ts +15 -0
  79. package/_types/chains/opStack/decorators/publicL2.d.ts.map +1 -1
  80. package/_types/chains/opStack/decorators/walletL1.d.ts +17 -0
  81. package/_types/chains/opStack/decorators/walletL1.d.ts.map +1 -1
  82. package/_types/chains/opStack/decorators/walletL2.d.ts +17 -0
  83. package/_types/chains/opStack/decorators/walletL2.d.ts.map +1 -1
  84. package/_types/chains/opStack/types/contract.d.ts +8 -7
  85. package/_types/chains/opStack/types/contract.d.ts.map +1 -1
  86. package/_types/clients/decorators/wallet.d.ts +2 -2
  87. package/_types/clients/decorators/wallet.d.ts.map +1 -1
  88. package/_types/errors/version.d.ts +1 -1
  89. package/accounts/generateMnemonic.ts +6 -2
  90. package/actions/public/simulateContract.ts +2 -2
  91. package/chains/definitions/arbitrumSepolia.ts +2 -4
  92. package/chains/definitions/bitTorrent.ts +16 -0
  93. package/chains/definitions/bitTorrentTestnet.ts +17 -0
  94. package/chains/definitions/jbc.ts +29 -0
  95. package/chains/definitions/wemix.ts +16 -0
  96. package/chains/definitions/wemixTestnet.ts +17 -0
  97. package/chains/index.ts +5 -0
  98. package/chains/opStack/abis.ts +4 -0
  99. package/chains/opStack/contracts.ts +4 -0
  100. package/chains/opStack/decorators/publicL1.ts +15 -0
  101. package/chains/opStack/decorators/publicL2.ts +15 -0
  102. package/chains/opStack/decorators/walletL1.ts +17 -0
  103. package/chains/opStack/decorators/walletL2.ts +17 -0
  104. package/chains/opStack/types/contract.ts +15 -6
  105. package/clients/decorators/wallet.ts +2 -2
  106. package/errors/version.ts +1 -1
  107. package/package.json +1 -1
@@ -69,6 +69,23 @@ export type WalletActionsL2<
69
69
  ) => Promise<InitiateWithdrawalReturnType>
70
70
  }
71
71
 
72
+ /**
73
+ * A suite of Wallet Actions for suited for development with Layer 2 (OP Stack) chains.
74
+ *
75
+ * - Docs: https://viem.sh/op-stack/client.html
76
+ *
77
+ * @example
78
+ * import { createPublicClient, createWalletClient, http } from 'viem'
79
+ * import { mainnet } from 'viem/chains'
80
+ * import { walletActionsL1 } from 'viem/op-stack'
81
+ *
82
+ * const walletClient = createWalletClient({
83
+ * chain: mainnet,
84
+ * transport: http(),
85
+ * }).extend(walletActionsL1())
86
+ *
87
+ * const hash = await walletClient.depositTransaction({...})
88
+ */
72
89
  export function walletActionsL2() {
73
90
  return <
74
91
  TTransport extends Transport,
@@ -1,6 +1,7 @@
1
1
  import type { Address } from 'abitype'
2
2
 
3
3
  import type { Chain } from '../../../types/chain.js'
4
+ import type { Prettify } from '../../../types/utils.js'
4
5
  import type { TargetChain } from './chain.js'
5
6
 
6
7
  export type GetContractAddressParameter<
@@ -8,10 +9,18 @@ export type GetContractAddressParameter<
8
9
  contractName extends string,
9
10
  > =
10
11
  | (chain extends Chain
11
- ? {
12
- [_key in `${contractName}Address`]?: undefined
13
- } & { targetChain: TargetChain<chain, contractName> }
12
+ ? Prettify<
13
+ {
14
+ targetChain: Prettify<TargetChain<chain, contractName>>
15
+ } & {
16
+ [_ in `${contractName}Address`]?: undefined
17
+ }
18
+ >
14
19
  : never)
15
- | ({
16
- [_key in `${contractName}Address`]: Address
17
- } & { targetChain?: undefined })
20
+ | Prettify<
21
+ {
22
+ targetChain?: undefined
23
+ } & {
24
+ [_ in `${contractName}Address`]: Address
25
+ }
26
+ >
@@ -370,7 +370,7 @@ export type WalletActions<
370
370
  * value: 1000000000000000000n,
371
371
  * })
372
372
  */
373
- sendTransaction: <TChainOverride extends Chain | undefined>(
373
+ sendTransaction: <TChainOverride extends Chain | undefined = undefined>(
374
374
  args: SendTransactionParameters<TChain, TAccount, TChainOverride>,
375
375
  ) => Promise<SendTransactionReturnType>
376
376
  /**
@@ -664,7 +664,7 @@ export type WalletActions<
664
664
  const abi extends Abi | readonly unknown[],
665
665
  functionName extends ContractFunctionName<abi, 'payable' | 'nonpayable'>,
666
666
  args extends ContractFunctionArgs<abi, 'pure' | 'view', functionName>,
667
- TChainOverride extends Chain | undefined,
667
+ TChainOverride extends Chain | undefined = undefined,
668
668
  >(
669
669
  args: WriteContractParameters<
670
670
  abi,
package/errors/version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '2.0.0-rc.2'
1
+ export const version = '2.0.0-rc.3'
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "viem",
3
3
  "description": "TypeScript Interface for Ethereum",
4
- "version": "2.0.0-rc.2",
4
+ "version": "2.0.0-rc.3",
5
5
  "main": "./_cjs/index.js",
6
6
  "module": "./_esm/index.js",
7
7
  "types": "./_types/index.d.ts",