viem 2.0.0-rc.2 → 2.0.0-rc.4
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/CHANGELOG.md +44 -0
- package/_cjs/_test/generated.js +313 -0
- package/_cjs/_test/generated.js.map +1 -0
- package/_cjs/accounts/generateMnemonic.js +2 -2
- package/_cjs/accounts/generateMnemonic.js.map +1 -1
- package/_cjs/chains/definitions/acala.js +32 -0
- package/_cjs/chains/definitions/acala.js.map +1 -0
- package/_cjs/chains/definitions/arbitrumSepolia.js +2 -4
- package/_cjs/chains/definitions/arbitrumSepolia.js.map +1 -1
- package/_cjs/chains/definitions/bahamut.js +43 -0
- package/_cjs/chains/definitions/bahamut.js.map +1 -0
- package/_cjs/chains/definitions/bitTorrent.js +19 -0
- package/_cjs/chains/definitions/bitTorrent.js.map +1 -0
- package/_cjs/chains/definitions/bitTorrentTestnet.js +20 -0
- package/_cjs/chains/definitions/bitTorrentTestnet.js.map +1 -0
- package/_cjs/chains/definitions/jbc.js +32 -0
- package/_cjs/chains/definitions/jbc.js.map +1 -0
- package/_cjs/chains/definitions/karura.js +32 -0
- package/_cjs/chains/definitions/karura.js.map +1 -0
- package/_cjs/chains/definitions/klaytn.js +1 -1
- package/_cjs/chains/definitions/klaytn.js.map +1 -1
- package/_cjs/chains/definitions/mandala.js +32 -0
- package/_cjs/chains/definitions/mandala.js.map +1 -0
- package/_cjs/chains/definitions/oasisTestnet.js +22 -0
- package/_cjs/chains/definitions/oasisTestnet.js.map +1 -0
- package/_cjs/chains/definitions/opBNBTestnet.js +1 -1
- package/_cjs/chains/definitions/opBNBTestnet.js.map +1 -1
- package/_cjs/chains/definitions/wemix.js +19 -0
- package/_cjs/chains/definitions/wemix.js.map +1 -0
- package/_cjs/chains/definitions/wemixTestnet.js +20 -0
- package/_cjs/chains/definitions/wemixTestnet.js.map +1 -0
- package/_cjs/chains/definitions/zkFair.js +30 -0
- package/_cjs/chains/definitions/zkFair.js.map +1 -0
- package/_cjs/chains/definitions/zkFairTestnet.js +30 -0
- package/_cjs/chains/definitions/zkFairTestnet.js.map +1 -0
- package/_cjs/chains/index.js +28 -4
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/chains/opStack/abis.js.map +1 -1
- package/_cjs/chains/opStack/contracts.js.map +1 -1
- package/_cjs/chains/opStack/decorators/publicL1.js.map +1 -1
- package/_cjs/chains/opStack/decorators/publicL2.js.map +1 -1
- package/_cjs/chains/opStack/decorators/walletL1.js.map +1 -1
- package/_cjs/chains/opStack/decorators/walletL2.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_esm/_test/generated.js +335 -0
- package/_esm/_test/generated.js.map +1 -0
- package/_esm/accounts/generateMnemonic.js +3 -2
- package/_esm/accounts/generateMnemonic.js.map +1 -1
- package/_esm/chains/definitions/acala.js +29 -0
- package/_esm/chains/definitions/acala.js.map +1 -0
- package/_esm/chains/definitions/arbitrumSepolia.js +2 -4
- package/_esm/chains/definitions/arbitrumSepolia.js.map +1 -1
- package/_esm/chains/definitions/bahamut.js +40 -0
- package/_esm/chains/definitions/bahamut.js.map +1 -0
- package/_esm/chains/definitions/bitTorrent.js +16 -0
- package/_esm/chains/definitions/bitTorrent.js.map +1 -0
- package/_esm/chains/definitions/bitTorrentTestnet.js +17 -0
- package/_esm/chains/definitions/bitTorrentTestnet.js.map +1 -0
- package/_esm/chains/definitions/jbc.js +29 -0
- package/_esm/chains/definitions/jbc.js.map +1 -0
- package/_esm/chains/definitions/karura.js +29 -0
- package/_esm/chains/definitions/karura.js.map +1 -0
- package/_esm/chains/definitions/klaytn.js +1 -1
- package/_esm/chains/definitions/klaytn.js.map +1 -1
- package/_esm/chains/definitions/mandala.js +29 -0
- package/_esm/chains/definitions/mandala.js.map +1 -0
- package/_esm/chains/definitions/oasisTestnet.js +19 -0
- package/_esm/chains/definitions/oasisTestnet.js.map +1 -0
- package/_esm/chains/definitions/opBNBTestnet.js +1 -1
- package/_esm/chains/definitions/opBNBTestnet.js.map +1 -1
- package/_esm/chains/definitions/wemix.js +16 -0
- package/_esm/chains/definitions/wemix.js.map +1 -0
- package/_esm/chains/definitions/wemixTestnet.js +17 -0
- package/_esm/chains/definitions/wemixTestnet.js.map +1 -0
- package/_esm/chains/definitions/zkFair.js +27 -0
- package/_esm/chains/definitions/zkFair.js.map +1 -0
- package/_esm/chains/definitions/zkFairTestnet.js +27 -0
- package/_esm/chains/definitions/zkFairTestnet.js.map +1 -0
- package/_esm/chains/index.js +12 -0
- package/_esm/chains/index.js.map +1 -1
- package/_esm/chains/opStack/abis.js +4 -0
- package/_esm/chains/opStack/abis.js.map +1 -1
- package/_esm/chains/opStack/contracts.js +4 -0
- package/_esm/chains/opStack/contracts.js.map +1 -1
- package/_esm/chains/opStack/decorators/publicL1.js +15 -0
- package/_esm/chains/opStack/decorators/publicL1.js.map +1 -1
- package/_esm/chains/opStack/decorators/publicL2.js +15 -0
- package/_esm/chains/opStack/decorators/publicL2.js.map +1 -1
- package/_esm/chains/opStack/decorators/walletL1.js +17 -0
- package/_esm/chains/opStack/decorators/walletL1.js.map +1 -1
- package/_esm/chains/opStack/decorators/walletL2.js +17 -0
- package/_esm/chains/opStack/decorators/walletL2.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_test/generated.ts +350 -0
- package/_types/_test/generated.d.ts +428 -0
- package/_types/_test/generated.d.ts.map +1 -0
- package/_types/accounts/generateMnemonic.d.ts +2 -1
- package/_types/accounts/generateMnemonic.d.ts.map +1 -1
- package/_types/actions/public/simulateContract.d.ts +2 -2
- package/_types/actions/public/simulateContract.d.ts.map +1 -1
- package/_types/chains/definitions/acala.d.ts +40 -0
- package/_types/chains/definitions/acala.d.ts.map +1 -0
- package/_types/chains/definitions/arbitrumSepolia.d.ts +6 -2
- package/_types/chains/definitions/arbitrumSepolia.d.ts.map +1 -1
- package/_types/chains/definitions/bahamut.d.ts +40 -0
- package/_types/chains/definitions/bahamut.d.ts.map +1 -0
- package/_types/chains/definitions/bitTorrent.d.ts +42 -0
- package/_types/chains/definitions/bitTorrent.d.ts.map +1 -0
- package/_types/chains/definitions/bitTorrentTestnet.d.ts +42 -0
- package/_types/chains/definitions/bitTorrentTestnet.d.ts.map +1 -0
- package/_types/chains/definitions/jbc.d.ts +36 -0
- package/_types/chains/definitions/jbc.d.ts.map +1 -0
- package/_types/chains/definitions/karura.d.ts +40 -0
- package/_types/chains/definitions/karura.d.ts.map +1 -0
- package/_types/chains/definitions/klaytn.d.ts +1 -1
- package/_types/chains/definitions/mandala.d.ts +40 -0
- package/_types/chains/definitions/mandala.d.ts.map +1 -0
- package/_types/chains/definitions/oasisTestnet.d.ts +38 -0
- package/_types/chains/definitions/oasisTestnet.d.ts.map +1 -0
- package/_types/chains/definitions/opBNBTestnet.d.ts +1 -1
- package/_types/chains/definitions/wemix.d.ts +42 -0
- package/_types/chains/definitions/wemix.d.ts.map +1 -0
- package/_types/chains/definitions/wemixTestnet.d.ts +42 -0
- package/_types/chains/definitions/wemixTestnet.d.ts.map +1 -0
- package/_types/chains/definitions/zkFair.d.ts +38 -0
- package/_types/chains/definitions/zkFair.d.ts.map +1 -0
- package/_types/chains/definitions/zkFairTestnet.d.ts +38 -0
- package/_types/chains/definitions/zkFairTestnet.d.ts.map +1 -0
- package/_types/chains/index.d.ts +12 -0
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/chains/opStack/abis.d.ts +4 -0
- package/_types/chains/opStack/abis.d.ts.map +1 -1
- package/_types/chains/opStack/contracts.d.ts +4 -0
- package/_types/chains/opStack/contracts.d.ts.map +1 -1
- package/_types/chains/opStack/decorators/publicL1.d.ts +15 -0
- package/_types/chains/opStack/decorators/publicL1.d.ts.map +1 -1
- package/_types/chains/opStack/decorators/publicL2.d.ts +15 -0
- package/_types/chains/opStack/decorators/publicL2.d.ts.map +1 -1
- package/_types/chains/opStack/decorators/walletL1.d.ts +17 -0
- package/_types/chains/opStack/decorators/walletL1.d.ts.map +1 -1
- package/_types/chains/opStack/decorators/walletL2.d.ts +17 -0
- package/_types/chains/opStack/decorators/walletL2.d.ts.map +1 -1
- package/_types/chains/opStack/types/contract.d.ts +8 -7
- package/_types/chains/opStack/types/contract.d.ts.map +1 -1
- package/_types/clients/decorators/wallet.d.ts +2 -2
- package/_types/clients/decorators/wallet.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/accounts/generateMnemonic.ts +6 -2
- package/actions/public/simulateContract.ts +2 -2
- package/chains/definitions/acala.ts +29 -0
- package/chains/definitions/arbitrumSepolia.ts +2 -4
- package/chains/definitions/bahamut.ts +40 -0
- package/chains/definitions/bitTorrent.ts +16 -0
- package/chains/definitions/bitTorrentTestnet.ts +17 -0
- package/chains/definitions/jbc.ts +29 -0
- package/chains/definitions/karura.ts +29 -0
- package/chains/definitions/klaytn.ts +1 -1
- package/chains/definitions/mandala.ts +29 -0
- package/chains/definitions/oasisTestnet.ts +19 -0
- package/chains/definitions/opBNBTestnet.ts +1 -1
- package/chains/definitions/wemix.ts +16 -0
- package/chains/definitions/wemixTestnet.ts +17 -0
- package/chains/definitions/zkFair.ts +27 -0
- package/chains/definitions/zkFairTestnet.ts +27 -0
- package/chains/index.ts +12 -0
- package/chains/opStack/abis.ts +4 -0
- package/chains/opStack/contracts.ts +4 -0
- package/chains/opStack/decorators/publicL1.ts +15 -0
- package/chains/opStack/decorators/publicL2.ts +15 -0
- package/chains/opStack/decorators/walletL1.ts +17 -0
- package/chains/opStack/decorators/walletL2.ts +17 -0
- package/chains/opStack/types/contract.ts +15 -6
- package/clients/decorators/wallet.ts +2 -2
- package/errors/version.ts +1 -1
- package/package.json +12 -34
@@ -485,6 +485,21 @@ export type PublicActionsL1<
|
|
485
485
|
) => Promise<WaitToProveReturnType>
|
486
486
|
}
|
487
487
|
|
488
|
+
/**
|
489
|
+
* A suite of Public Actions for suited for development with Layer 2 (OP Stack) chains.
|
490
|
+
*
|
491
|
+
* - Docs: https://viem.sh/op-stack/client.html
|
492
|
+
*
|
493
|
+
* @example
|
494
|
+
* import { publicActionsL1 } from 'viem/op-stack'
|
495
|
+
* import { mainnet } from 'viem/chains'
|
496
|
+
* import { buildDepositTransaction } from 'viem/wallet'
|
497
|
+
*
|
498
|
+
* export const opStackPublicClientL1 = createWalletClient({
|
499
|
+
* chain: mainnet,
|
500
|
+
* transport: http(),
|
501
|
+
* }).extend(publicActionsL1())
|
502
|
+
*/
|
488
503
|
export function publicActionsL1() {
|
489
504
|
return <
|
490
505
|
TTransport extends Transport,
|
@@ -444,6 +444,21 @@ export type PublicActionsL2<
|
|
444
444
|
) => Promise<EstimateTotalGasReturnType>
|
445
445
|
}
|
446
446
|
|
447
|
+
/**
|
448
|
+
* A suite of Public Actions for suited for development with Layer 2 (OP Stack) chains.
|
449
|
+
*
|
450
|
+
* - Docs: https://viem.sh/op-stack/client.html
|
451
|
+
*
|
452
|
+
* @example
|
453
|
+
* import { publicActionsL2 } from 'viem/op-stack'
|
454
|
+
* import { optimism } from 'viem/chains'
|
455
|
+
* import { buildDepositTransaction } from 'viem/wallet'
|
456
|
+
*
|
457
|
+
* export const opStackPublicClientL1 = createWalletClient({
|
458
|
+
* chain: optimism,
|
459
|
+
* transport: http(),
|
460
|
+
* }).extend(publicActionsL1())
|
461
|
+
*/
|
447
462
|
export function publicActionsL2() {
|
448
463
|
return <
|
449
464
|
TTransport extends Transport,
|
@@ -138,6 +138,23 @@ export type WalletActionsL1<
|
|
138
138
|
) => Promise<ProveWithdrawalReturnType>
|
139
139
|
}
|
140
140
|
|
141
|
+
/**
|
142
|
+
* A suite of Wallet Actions for suited for development with Layer 2 (OP Stack) chains.
|
143
|
+
*
|
144
|
+
* - Docs: https://viem.sh/op-stack/client.html
|
145
|
+
*
|
146
|
+
* @example
|
147
|
+
* import { createPublicClient, createWalletClient, http } from 'viem'
|
148
|
+
* import { mainnet } from 'viem/chains'
|
149
|
+
* import { walletActionsL1 } from 'viem/op-stack'
|
150
|
+
*
|
151
|
+
* const walletClient = createWalletClient({
|
152
|
+
* chain: mainnet,
|
153
|
+
* transport: http(),
|
154
|
+
* }).extend(walletActionsL1())
|
155
|
+
*
|
156
|
+
* const hash = await walletClient.depositTransaction({...})
|
157
|
+
*/
|
141
158
|
export function walletActionsL1() {
|
142
159
|
return <
|
143
160
|
TTransport extends Transport,
|
@@ -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
|
-
|
13
|
-
|
12
|
+
? Prettify<
|
13
|
+
{
|
14
|
+
targetChain: Prettify<TargetChain<chain, contractName>>
|
15
|
+
} & {
|
16
|
+
[_ in `${contractName}Address`]?: undefined
|
17
|
+
}
|
18
|
+
>
|
14
19
|
: never)
|
15
|
-
|
|
16
|
-
|
17
|
-
|
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.
|
1
|
+
export const version = '2.0.0-rc.4'
|
package/package.json
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
{
|
2
2
|
"name": "viem",
|
3
3
|
"description": "TypeScript Interface for Ethereum",
|
4
|
-
"version": "2.0.0-rc.
|
4
|
+
"version": "2.0.0-rc.4",
|
5
|
+
"type": "module",
|
5
6
|
"main": "./_cjs/index.js",
|
6
7
|
"module": "./_esm/index.js",
|
7
8
|
"types": "./_types/index.d.ts",
|
@@ -76,27 +77,13 @@
|
|
76
77
|
},
|
77
78
|
"typesVersions": {
|
78
79
|
"*": {
|
79
|
-
"accounts": [
|
80
|
-
|
81
|
-
],
|
82
|
-
"
|
83
|
-
|
84
|
-
],
|
85
|
-
"
|
86
|
-
"./_types/chains/index.d.ts"
|
87
|
-
],
|
88
|
-
"chains/utils": [
|
89
|
-
"./_types/chains/utils.d.ts"
|
90
|
-
],
|
91
|
-
"ens": [
|
92
|
-
"./_types/ens/index.d.ts"
|
93
|
-
],
|
94
|
-
"utils": [
|
95
|
-
"./_types/utils/index.d.ts"
|
96
|
-
],
|
97
|
-
"window": [
|
98
|
-
"./_types/window/index.d.ts"
|
99
|
-
]
|
80
|
+
"accounts": ["./_types/accounts/index.d.ts"],
|
81
|
+
"actions": ["./_types/actions/index.d.ts"],
|
82
|
+
"chains": ["./_types/chains/index.d.ts"],
|
83
|
+
"chains/utils": ["./_types/chains/utils.d.ts"],
|
84
|
+
"ens": ["./_types/ens/index.d.ts"],
|
85
|
+
"utils": ["./_types/utils/index.d.ts"],
|
86
|
+
"window": ["./_types/window/index.d.ts"]
|
100
87
|
}
|
101
88
|
},
|
102
89
|
"peerDependencies": {
|
@@ -120,21 +107,12 @@
|
|
120
107
|
"license": "MIT",
|
121
108
|
"homepage": "https://viem.sh",
|
122
109
|
"repository": "wevm/viem",
|
123
|
-
"authors": [
|
124
|
-
"awkweb.eth",
|
125
|
-
"jxom.eth"
|
126
|
-
],
|
110
|
+
"authors": ["awkweb.eth", "jxom.eth"],
|
127
111
|
"funding": [
|
128
112
|
{
|
129
113
|
"type": "github",
|
130
114
|
"url": "https://github.com/sponsors/wevm"
|
131
115
|
}
|
132
116
|
],
|
133
|
-
"keywords": [
|
134
|
-
|
135
|
-
"ethereum",
|
136
|
-
"dapps",
|
137
|
-
"wallet",
|
138
|
-
"web3"
|
139
|
-
]
|
140
|
-
}
|
117
|
+
"keywords": ["eth", "ethereum", "dapps", "wallet", "web3"]
|
118
|
+
}
|