viem 2.22.6 → 2.22.8
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 +14 -0
- package/_cjs/chains/definitions/citreaTestnet.js +23 -0
- package/_cjs/chains/definitions/citreaTestnet.js.map +1 -0
- package/_cjs/chains/index.js +11 -9
- package/_cjs/chains/index.js.map +1 -1
- package/_cjs/errors/version.js +1 -1
- package/_cjs/utils/typedData.js +2 -1
- package/_cjs/utils/typedData.js.map +1 -1
- package/_cjs/zksync/actions/requestExecute.js +112 -0
- package/_cjs/zksync/actions/requestExecute.js.map +1 -0
- package/_cjs/zksync/constants/abis.js +3039 -1
- package/_cjs/zksync/constants/abis.js.map +1 -1
- package/_cjs/zksync/constants/number.js +2 -1
- package/_cjs/zksync/constants/number.js.map +1 -1
- package/_cjs/zksync/decorators/walletL1.js +10 -0
- package/_cjs/zksync/decorators/walletL1.js.map +1 -0
- package/_cjs/zksync/errors/bridge.js +24 -0
- package/_cjs/zksync/errors/bridge.js.map +1 -0
- package/_cjs/zksync/index.js +8 -1
- package/_cjs/zksync/index.js.map +1 -1
- package/_cjs/zksync/utils/bridge/getL2HashFromPriorityOp.js +28 -0
- package/_cjs/zksync/utils/bridge/getL2HashFromPriorityOp.js.map +1 -0
- package/_esm/actions/public/getContractEvents.js +1 -1
- package/_esm/chains/definitions/citreaTestnet.js +20 -0
- package/_esm/chains/definitions/citreaTestnet.js.map +1 -0
- package/_esm/chains/index.js +3 -1
- package/_esm/chains/index.js.map +1 -1
- package/_esm/errors/version.js +1 -1
- package/_esm/utils/typedData.js +2 -1
- package/_esm/utils/typedData.js.map +1 -1
- package/_esm/zksync/actions/requestExecute.js +167 -0
- package/_esm/zksync/actions/requestExecute.js.map +1 -0
- package/_esm/zksync/constants/abis.js +3038 -0
- package/_esm/zksync/constants/abis.js.map +1 -1
- package/_esm/zksync/constants/number.js +1 -0
- package/_esm/zksync/constants/number.js.map +1 -1
- package/_esm/zksync/decorators/walletL1.js +7 -0
- package/_esm/zksync/decorators/walletL1.js.map +1 -0
- package/_esm/zksync/errors/bridge.js +19 -0
- package/_esm/zksync/errors/bridge.js.map +1 -0
- package/_esm/zksync/index.js +3 -0
- package/_esm/zksync/index.js.map +1 -1
- package/_esm/zksync/utils/bridge/getL2HashFromPriorityOp.js +53 -0
- package/_esm/zksync/utils/bridge/getL2HashFromPriorityOp.js.map +1 -0
- package/_types/actions/public/getContractEvents.d.ts +1 -1
- package/_types/chains/definitions/citreaTestnet.d.ts +38 -0
- package/_types/chains/definitions/citreaTestnet.d.ts.map +1 -0
- package/_types/chains/index.d.ts +3 -1
- package/_types/chains/index.d.ts.map +1 -1
- package/_types/errors/version.d.ts +1 -1
- package/_types/utils/typedData.d.ts.map +1 -1
- package/_types/zksync/actions/requestExecute.d.ts +95 -0
- package/_types/zksync/actions/requestExecute.d.ts.map +1 -0
- package/_types/zksync/constants/abis.d.ts +2356 -0
- package/_types/zksync/constants/abis.d.ts.map +1 -1
- package/_types/zksync/constants/number.d.ts +1 -0
- package/_types/zksync/constants/number.d.ts.map +1 -1
- package/_types/zksync/decorators/walletL1.d.ts +41 -0
- package/_types/zksync/decorators/walletL1.d.ts.map +1 -0
- package/_types/zksync/errors/bridge.d.ts +14 -0
- package/_types/zksync/errors/bridge.d.ts.map +1 -0
- package/_types/zksync/index.d.ts +3 -0
- package/_types/zksync/index.d.ts.map +1 -1
- package/_types/zksync/utils/bridge/getL2HashFromPriorityOp.d.ts +34 -0
- package/_types/zksync/utils/bridge/getL2HashFromPriorityOp.d.ts.map +1 -0
- package/actions/public/getContractEvents.ts +1 -1
- package/chains/definitions/citreaTestnet.ts +20 -0
- package/chains/index.ts +3 -1
- package/errors/version.ts +1 -1
- package/package.json +1 -1
- package/utils/typedData.ts +2 -1
- package/zksync/actions/requestExecute.ts +282 -0
- package/zksync/constants/abis.ts +3040 -0
- package/zksync/constants/number.ts +1 -0
- package/zksync/decorators/walletL1.ts +71 -0
- package/zksync/errors/bridge.ts +29 -0
- package/zksync/index.ts +15 -0
- package/zksync/utils/bridge/getL2HashFromPriorityOp.ts +63 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"abis.d.ts","sourceRoot":"","sources":["../../../zksync/constants/abis.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAsa/B,CAAA;AAED,eAAO,MAAM,YAAY;;;;;;;;;;GAqCxB,CAAA;AAED,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuLpB,CAAA"}
|
1
|
+
{"version":3,"file":"abis.d.ts","sourceRoot":"","sources":["../../../zksync/constants/abis.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAsa/B,CAAA;AAED,eAAO,MAAM,YAAY;;;;;;;;;;GAqCxB,CAAA;AAED,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuLpB,CAAA;AAEV,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAs2EZ,CAAA"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../../zksync/constants/number.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB,SAAS,CAAA;AAC1C,eAAO,MAAM,eAAe,QAAkB,CAAA"}
|
1
|
+
{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../../zksync/constants/number.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,oBAAoB,SAAS,CAAA;AAC1C,eAAO,MAAM,eAAe,QAAkB,CAAA;AAC9C,eAAO,MAAM,gCAAgC,OAAO,CAAA"}
|
@@ -0,0 +1,41 @@
|
|
1
|
+
import type { Client } from '../../clients/createClient.js';
|
2
|
+
import type { Transport } from '../../clients/transports/createTransport.js';
|
3
|
+
import type { Account } from '../../types/account.js';
|
4
|
+
import type { Chain } from '../../types/chain.js';
|
5
|
+
import { type RequestExecuteParameters, type RequestExecuteReturnType } from '../actions/requestExecute.js';
|
6
|
+
import type { ChainEIP712 } from '../types/chain.js';
|
7
|
+
export type WalletActionsL1<chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined> = {
|
8
|
+
/**
|
9
|
+
* Requests execution of a L2 transaction from L1.
|
10
|
+
*
|
11
|
+
* @param parameters - {@link RequestExecuteParameters}
|
12
|
+
* @returns hash - The [Transaction](https://viem.sh/docs/glossary/terms#transaction) hash. {@link RequestExecuteReturnType}
|
13
|
+
*
|
14
|
+
* @example
|
15
|
+
* import { createPublicClient, createWalletClient, http } from 'viem'
|
16
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
17
|
+
* import { zksync, mainnet } from 'viem/chains'
|
18
|
+
* import { walletActionsL1, publicActionsL2 } from 'viem/zksync'
|
19
|
+
*
|
20
|
+
* const walletClient = createWalletClient({
|
21
|
+
* chain: mainnet,
|
22
|
+
* transport: http(),
|
23
|
+
* account: privateKeyToAccount('0x…'),
|
24
|
+
* }).extend(walletActionsL1())
|
25
|
+
*
|
26
|
+
* const clientL2 = createPublicClient({
|
27
|
+
* chain: zksync,
|
28
|
+
* transport: http(),
|
29
|
+
* }).extend(publicActionsL2())
|
30
|
+
*
|
31
|
+
* const hash = await walletClient.requestExecute({
|
32
|
+
* client: clientL2,
|
33
|
+
* contractAddress: '0x43020e6e11cef7dce8e37baa09d9a996ac722057'
|
34
|
+
* calldata: '0x',
|
35
|
+
* l2Value: 1_000_000_000_000_000_000n,
|
36
|
+
* })
|
37
|
+
*/
|
38
|
+
requestExecute: <chainOverride extends Chain | undefined = undefined, chainL2 extends ChainEIP712 | undefined = ChainEIP712 | undefined, accountL2 extends Account | undefined = Account | undefined>(parameters: RequestExecuteParameters<chain, account, chainOverride, chainL2, accountL2>) => Promise<RequestExecuteReturnType>;
|
39
|
+
};
|
40
|
+
export declare function walletActionsL1(): <transport extends Transport, chain extends Chain | undefined = Chain | undefined, account extends Account | undefined = Account | undefined>(client: Client<transport, chain, account>) => WalletActionsL1<chain, account>;
|
41
|
+
//# sourceMappingURL=walletL1.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"walletL1.d.ts","sourceRoot":"","sources":["../../../zksync/decorators/walletL1.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6CAA6C,CAAA;AAC5E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAA;AACjD,OAAO,EACL,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAE9B,MAAM,8BAA8B,CAAA;AACrC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAEpD,MAAM,MAAM,eAAe,CACzB,KAAK,SAAS,KAAK,GAAG,SAAS,GAAG,KAAK,GAAG,SAAS,EACnD,OAAO,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,IACvD;IACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6BG;IACH,cAAc,EAAE,CACd,aAAa,SAAS,KAAK,GAAG,SAAS,GAAG,SAAS,EACnD,OAAO,SAAS,WAAW,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,EACjE,SAAS,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,EAE3D,UAAU,EAAE,wBAAwB,CAClC,KAAK,EACL,OAAO,EACP,aAAa,EACb,OAAO,EACP,SAAS,CACV,KACE,OAAO,CAAC,wBAAwB,CAAC,CAAA;CACvC,CAAA;AAED,wBAAgB,eAAe,KAE3B,SAAS,SAAS,SAAS,EAC3B,KAAK,SAAS,KAAK,GAAG,SAAS,sBAC/B,OAAO,SAAS,OAAO,GAAG,SAAS,gCAE3B,MAAM,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,KACxC,eAAe,CAAC,KAAK,EAAE,OAAO,CAAC,CAGnC"}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
import { BaseError } from '../../errors/base.js';
|
2
|
+
export type BaseFeeHigherThanValueErrorType = BaseFeeHigherThanValueError & {
|
3
|
+
name: 'BaseFeeHigherThanValueError';
|
4
|
+
};
|
5
|
+
export declare class BaseFeeHigherThanValueError extends BaseError {
|
6
|
+
constructor(baseCost: bigint, value: bigint);
|
7
|
+
}
|
8
|
+
export type TxHashNotFoundInLogsErrorType = BaseFeeHigherThanValueError & {
|
9
|
+
name: 'TxHashNotFoundInLogsError';
|
10
|
+
};
|
11
|
+
export declare class TxHashNotFoundInLogsError extends BaseError {
|
12
|
+
constructor();
|
13
|
+
}
|
14
|
+
//# sourceMappingURL=bridge.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../../../zksync/errors/bridge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAEhD,MAAM,MAAM,+BAA+B,GAAG,2BAA2B,GAAG;IAC1E,IAAI,EAAE,6BAA6B,CAAA;CACpC,CAAA;AACD,qBAAa,2BAA4B,SAAQ,SAAS;gBAC5C,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;CAW5C;AAED,MAAM,MAAM,6BAA6B,GAAG,2BAA2B,GAAG;IACxE,IAAI,EAAE,2BAA2B,CAAA;CAClC,CAAA;AACD,qBAAa,yBAA0B,SAAQ,SAAS;;CAMvD"}
|
package/_types/zksync/index.d.ts
CHANGED
@@ -21,6 +21,7 @@ export { getMainContractAddress } from './actions/getMainContractAddress.js';
|
|
21
21
|
export { type GetRawBlockTransactionsParameters, type GetRawBlockTransactionsReturnType, getRawBlockTransactions, } from './actions/getRawBlockTransactions.js';
|
22
22
|
export { getTestnetPaymasterAddress } from './actions/getTestnetPaymasterAddress.js';
|
23
23
|
export { type GetTransactionDetailsParameters, type GetTransactionDetailsReturnType, getTransactionDetails, } from './actions/getTransactionDetails.js';
|
24
|
+
export { type RequestExecuteErrorType, type RequestExecuteReturnType, type RequestExecuteParameters, requestExecute, } from './actions/requestExecute.js';
|
24
25
|
export { type SendTransactionErrorType, type SendTransactionParameters, type SendTransactionReturnType, sendTransaction, } from './actions/sendTransaction.js';
|
25
26
|
export { type SendEip712TransactionErrorType, type SendEip712TransactionParameters, type SendEip712TransactionReturnType, sendEip712Transaction, } from './actions/sendEip712Transaction.js';
|
26
27
|
export { type SignEip712TransactionErrorType, type SignEip712TransactionParameters, type SignEip712TransactionReturnType, signEip712Transaction, } from './actions/signEip712Transaction.js';
|
@@ -40,6 +41,7 @@ export { chainConfig } from './chainConfig.js';
|
|
40
41
|
export { eip712WalletActions, type Eip712WalletActions, } from './decorators/eip712.js';
|
41
42
|
export { publicActionsL1, type PublicActionsL1, } from './decorators/publicL1.js';
|
42
43
|
export { publicActionsL2, type PublicActionsL2, } from './decorators/publicL2.js';
|
44
|
+
export { walletActionsL1, type WalletActionsL1, } from './decorators/walletL1.js';
|
43
45
|
export { serializeTransaction } from './serializers.js';
|
44
46
|
export type { ZksyncSmartAccount } from './types/account.js';
|
45
47
|
export type {
|
@@ -111,6 +113,7 @@ ZksyncRawBlockTransactions as ZkSyncRawBlockTransactions, ZksyncRawBlockTransact
|
|
111
113
|
ZksyncRpcTransactionReceipt as ZkSyncRpcTransactionReceipt, ZksyncRpcTransactionReceipt,
|
112
114
|
/** @deprecated Use `ZksyncTransactionDetails` instead */
|
113
115
|
ZksyncTransactionDetails as ZkSyncTransactionDetails, ZksyncTransactionDetails, } from './types/transaction.js';
|
116
|
+
export { type GetL2HashFromPriorityOpErrorType, getL2HashFromPriorityOp, } from './utils/bridge/getL2HashFromPriorityOp.js';
|
114
117
|
export { type GetApprovalBasedPaymasterInputParameters, type GetApprovalBasedPaymasterInputReturnType, getApprovalBasedPaymasterInput, } from './utils/paymaster/getApprovalBasedPaymasterInput.js';
|
115
118
|
export { type GetGeneralPaymasterInputParameters, type GetGeneralPaymasterInputReturnType, getGeneralPaymasterInput, } from './utils/paymaster/getGeneralPaymasterInput.js';
|
116
119
|
export { parseEip712Transaction } from './utils/parseEip712Transaction.js';
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../zksync/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,uBAAuB,EAC5B,KAAK,wBAAwB,EAC7B,cAAc,GACf,MAAM,8BAA8B,CAAA;AACrC,OAAO,EACL,KAAK,gCAAgC,EACrC,sBAAsB,GACvB,MAAM,sCAAsC,CAAA;AAC7C,OAAO,EACL,KAAK,iCAAiC,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AyD;AACzD,wBAAwB,IAAI,wBAAwB,EACpD,wBAAwB,GACzB,MAAM,wBAAwB,CAAA;AAE/B,OAAO,EACL,KAAK,gCAAgC,EACrC,uBAAuB,GACxB,MAAM,2CAA2C,CAAA;AAClD,OAAO,EACL,KAAK,wCAAwC,EAC7C,KAAK,wCAAwC,EAC7C,8BAA8B,GAC/B,MAAM,qDAAqD,CAAA;AAC5D,OAAO,EACL,KAAK,kCAAkC,EACvC,KAAK,kCAAkC,EACvC,wBAAwB,GACzB,MAAM,+CAA+C,CAAA;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAA"}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import type { Address } from 'abitype';
|
2
|
+
import type { TransactionReceipt } from '../../../types/transaction.js';
|
3
|
+
import { type TxHashNotFoundInLogsErrorType } from '../../errors/bridge.js';
|
4
|
+
export type GetL2HashFromPriorityOpErrorType = TxHashNotFoundInLogsErrorType;
|
5
|
+
/**
|
6
|
+
* Returns the hash of the L2 priority operation from a given L1 transaction receipt.
|
7
|
+
*
|
8
|
+
* @param receipt - The L1 transaction receipt.
|
9
|
+
* @param zksync - The address of the ZKsync Era main contract.
|
10
|
+
* @returns hash - The hash of the L2 priority operation.
|
11
|
+
*
|
12
|
+
* @example
|
13
|
+
* import { createPublicClient, http } from 'viem'
|
14
|
+
* import { zksync, mainnet } from 'viem/chains'
|
15
|
+
* import { publicActionsL2, getL2HashFromPriorityOp } from 'viem/zksync'
|
16
|
+
*
|
17
|
+
* const client = createPublicClient({
|
18
|
+
* chain: mainnet,
|
19
|
+
* transport: http(),
|
20
|
+
* })
|
21
|
+
*
|
22
|
+
* const zksyncClient = const client = createPublicClient({
|
23
|
+
* chain: zksync,
|
24
|
+
* transport: http(),
|
25
|
+
* })
|
26
|
+
*
|
27
|
+
* const receipt = await client.waitForTransactionReceipt({hash: '0x...'})
|
28
|
+
* const l2Hash = getL2HashFromPriorityOp(
|
29
|
+
* receipt,
|
30
|
+
* await zksyncClient.getMainContractAddress()
|
31
|
+
* )
|
32
|
+
*/
|
33
|
+
export declare function getL2HashFromPriorityOp(receipt: TransactionReceipt, zksync: Address): Address;
|
34
|
+
//# sourceMappingURL=getL2HashFromPriorityOp.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"getL2HashFromPriorityOp.d.ts","sourceRoot":"","sources":["../../../../zksync/utils/bridge/getL2HashFromPriorityOp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AAEtC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAA;AAGvE,OAAO,EAEL,KAAK,6BAA6B,EACnC,MAAM,wBAAwB,CAAA;AAE/B,MAAM,MAAM,gCAAgC,GAAG,6BAA6B,CAAA;AAE5E;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,kBAAkB,EAC3B,MAAM,EAAE,OAAO,GACd,OAAO,CAmBT"}
|
@@ -89,7 +89,7 @@ export type GetContractEventsErrorType =
|
|
89
89
|
/**
|
90
90
|
* Returns a list of event logs emitted by a contract.
|
91
91
|
*
|
92
|
-
* - Docs: https://viem.sh/docs/
|
92
|
+
* - Docs: https://viem.sh/docs/contract/getContractEvents#getcontractevents
|
93
93
|
* - JSON-RPC Methods: [`eth_getLogs`](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getlogs)
|
94
94
|
*
|
95
95
|
* @param client - Client to use
|
@@ -0,0 +1,20 @@
|
|
1
|
+
import { defineChain } from '../../utils/chain/defineChain.js'
|
2
|
+
|
3
|
+
export const citreaTestnet = /*#__PURE__*/ defineChain({
|
4
|
+
id: 5115,
|
5
|
+
name: 'Citrea Testnet',
|
6
|
+
nativeCurrency: { name: 'cBTC', symbol: 'cBTC', decimals: 18 },
|
7
|
+
rpcUrls: {
|
8
|
+
default: {
|
9
|
+
http: ['https://rpc.testnet.citrea.xyz'],
|
10
|
+
},
|
11
|
+
},
|
12
|
+
blockExplorers: {
|
13
|
+
default: {
|
14
|
+
name: 'Citrea Explorer',
|
15
|
+
url: 'https://explorer.testnet.citrea.xyz',
|
16
|
+
apiUrl: 'https://explorer.testnet.citrea.xyz/api',
|
17
|
+
},
|
18
|
+
},
|
19
|
+
testnet: true,
|
20
|
+
})
|
package/chains/index.ts
CHANGED
@@ -84,6 +84,7 @@ export { celoAlfajores } from './definitions/celoAlfajores.js'
|
|
84
84
|
export { chang } from './definitions/chang.js'
|
85
85
|
export { chiliz } from './definitions/chiliz.js'
|
86
86
|
export { chips } from './definitions/chips.js'
|
87
|
+
export { citreaTestnet } from './definitions/citreaTestnet.js'
|
87
88
|
export { classic } from './definitions/classic.js'
|
88
89
|
export { coinbit } from './definitions/coinbit.js'
|
89
90
|
export { coinex } from './definitions/coinex.js'
|
@@ -245,9 +246,10 @@ export { lavita } from './definitions/lavita.js'
|
|
245
246
|
export { lightlinkPegasus } from './definitions/lightlinkPegasus.js'
|
246
247
|
export { lightlinkPhoenix } from './definitions/lightlinkPhoenix.js'
|
247
248
|
export { linea } from './definitions/linea.js'
|
249
|
+
/** @deprecated Use `lineaSepolia` instead. */
|
248
250
|
export { lineaGoerli } from './definitions/lineaGoerli.js'
|
249
251
|
export { lineaSepolia } from './definitions/lineaSepolia.js'
|
250
|
-
/** @deprecated Use `
|
252
|
+
/** @deprecated Use `lineaSepolia` instead. */
|
251
253
|
export { lineaTestnet } from './definitions/lineaTestnet.js'
|
252
254
|
export { lisk } from './definitions/lisk.js'
|
253
255
|
export { liskSepolia } from './definitions/liskSepolia.js'
|
package/errors/version.ts
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const version = '2.22.
|
1
|
+
export const version = '2.22.8'
|
package/package.json
CHANGED
package/utils/typedData.ts
CHANGED
@@ -142,7 +142,8 @@ export function getTypesForEIP712Domain({
|
|
142
142
|
return [
|
143
143
|
typeof domain?.name === 'string' && { name: 'name', type: 'string' },
|
144
144
|
domain?.version && { name: 'version', type: 'string' },
|
145
|
-
typeof domain?.chainId === 'number'
|
145
|
+
(typeof domain?.chainId === 'number' ||
|
146
|
+
typeof domain?.chainId === 'bigint') && {
|
146
147
|
name: 'chainId',
|
147
148
|
type: 'uint256',
|
148
149
|
},
|
@@ -0,0 +1,282 @@
|
|
1
|
+
import type { Address } from 'abitype'
|
2
|
+
import { generatePrivateKey } from '../../accounts/generatePrivateKey.js'
|
3
|
+
import type { Account } from '../../accounts/types.js'
|
4
|
+
import { privateKeyToAddress } from '../../accounts/utils/privateKeyToAddress.js'
|
5
|
+
import { readContract } from '../../actions/public/readContract.js'
|
6
|
+
import {
|
7
|
+
type SendTransactionErrorType,
|
8
|
+
type SendTransactionParameters,
|
9
|
+
type SendTransactionReturnType,
|
10
|
+
sendTransaction,
|
11
|
+
} from '../../actions/wallet/sendTransaction.js'
|
12
|
+
import type { Client } from '../../clients/createClient.js'
|
13
|
+
import { publicActions } from '../../clients/decorators/public.js'
|
14
|
+
import type { Transport } from '../../clients/transports/createTransport.js'
|
15
|
+
import { AccountNotFoundError } from '../../errors/account.js'
|
16
|
+
import { ClientChainNotConfiguredError } from '../../errors/chain.js'
|
17
|
+
import type { GetAccountParameter } from '../../types/account.js'
|
18
|
+
import type {
|
19
|
+
Chain,
|
20
|
+
DeriveChain,
|
21
|
+
GetChainParameter,
|
22
|
+
} from '../../types/chain.js'
|
23
|
+
import type { Hex } from '../../types/misc.js'
|
24
|
+
import type { UnionEvaluate, UnionOmit } from '../../types/utils.js'
|
25
|
+
import {
|
26
|
+
type FormattedTransactionRequest,
|
27
|
+
encodeFunctionData,
|
28
|
+
isAddressEqual,
|
29
|
+
parseAccount,
|
30
|
+
} from '../../utils/index.js'
|
31
|
+
import { bridgehubAbi } from '../constants/abis.js'
|
32
|
+
import { ethAddressInContracts } from '../constants/address.js'
|
33
|
+
import { requiredL1ToL2GasPerPubdataLimit } from '../constants/number.js'
|
34
|
+
import {
|
35
|
+
BaseFeeHigherThanValueError,
|
36
|
+
type BaseFeeHigherThanValueErrorType,
|
37
|
+
} from '../errors/bridge.js'
|
38
|
+
import type { ChainEIP712 } from '../types/chain.js'
|
39
|
+
import { estimateGasL1ToL2 } from './estimateGasL1ToL2.js'
|
40
|
+
import { getBridgehubContractAddress } from './getBridgehubContractAddress.js'
|
41
|
+
|
42
|
+
export type RequestExecuteParameters<
|
43
|
+
chain extends Chain | undefined = Chain | undefined,
|
44
|
+
account extends Account | undefined = Account | undefined,
|
45
|
+
chainOverride extends Chain | undefined = Chain | undefined,
|
46
|
+
chainL2 extends ChainEIP712 | undefined = ChainEIP712 | undefined,
|
47
|
+
accountL2 extends Account | undefined = Account | undefined,
|
48
|
+
_derivedChain extends Chain | undefined = DeriveChain<chain, chainOverride>,
|
49
|
+
> = UnionEvaluate<
|
50
|
+
UnionOmit<FormattedTransactionRequest<_derivedChain>, 'data' | 'to' | 'from'>
|
51
|
+
> &
|
52
|
+
Partial<GetChainParameter<chain, chainOverride>> &
|
53
|
+
Partial<GetAccountParameter<account>> & {
|
54
|
+
/** L2 client. */
|
55
|
+
client: Client<Transport, chainL2, accountL2>
|
56
|
+
/** The L2 contract to be called. */
|
57
|
+
contractAddress: Address
|
58
|
+
/** The input of the L2 transaction. */
|
59
|
+
calldata: Hex
|
60
|
+
/** Maximum amount of L2 gas that transaction can consume during execution on L2. */
|
61
|
+
l2GasLimit?: bigint
|
62
|
+
/** The amount of base token that needs to be minted on non-ETH-based L2. */
|
63
|
+
mintValue?: bigint
|
64
|
+
/** The `msg.value` of L2 transaction. */
|
65
|
+
l2Value?: bigint
|
66
|
+
/** An array of L2 bytecodes that will be marked as known on L2. */
|
67
|
+
factoryDeps?: Hex[]
|
68
|
+
/** (currently not used) The tip the operator will receive on top of
|
69
|
+
the base cost of the transaction. */
|
70
|
+
operatorTip?: bigint
|
71
|
+
/** The L2 gas price for each published L1 calldata byte. */
|
72
|
+
gasPerPubdataByte?: bigint
|
73
|
+
/** The address on L2 that will receive the refund for the transaction.
|
74
|
+
If the transaction fails, it will also be the address to receive `l2Value`. */
|
75
|
+
refundRecipient?: Address
|
76
|
+
}
|
77
|
+
|
78
|
+
export type RequestExecuteReturnType = SendTransactionReturnType
|
79
|
+
|
80
|
+
export type RequestExecuteErrorType =
|
81
|
+
| SendTransactionErrorType
|
82
|
+
| BaseFeeHigherThanValueErrorType
|
83
|
+
|
84
|
+
/**
|
85
|
+
* Requests execution of a L2 transaction from L1.
|
86
|
+
*
|
87
|
+
* @param client - Client to use
|
88
|
+
* @param parameters - {@link RequestExecuteParameters}
|
89
|
+
* @returns hash - The [Transaction](https://viem.sh/docs/glossary/terms#transaction) hash. {@link RequestExecuteReturnType}
|
90
|
+
*
|
91
|
+
* @example
|
92
|
+
* import { createPublicClient, http } from 'viem'
|
93
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
94
|
+
* import { zksync, mainnet } from 'viem/chains'
|
95
|
+
* import { requestExecute, publicActionsL2 } from 'viem/zksync'
|
96
|
+
*
|
97
|
+
* const client = createPublicClient({
|
98
|
+
* chain: mainnet,
|
99
|
+
* transport: http(),
|
100
|
+
* })
|
101
|
+
*
|
102
|
+
* const clientL2 = createPublicClient({
|
103
|
+
* chain: zksync,
|
104
|
+
* transport: http(),
|
105
|
+
* }).extend(publicActionsL2())
|
106
|
+
*
|
107
|
+
* const hash = await requestExecute(client, {
|
108
|
+
* client: clientL2,
|
109
|
+
* account: privateKeyToAccount('0x…'),
|
110
|
+
* contractAddress: '0x43020e6e11cef7dce8e37baa09d9a996ac722057'
|
111
|
+
* calldata: '0x',
|
112
|
+
* l2Value: 1_000_000_000_000_000_000n,
|
113
|
+
* })
|
114
|
+
*
|
115
|
+
* @example Account Hoisting
|
116
|
+
* import { createPublicClient, createWalletClient, http } from 'viem'
|
117
|
+
* import { privateKeyToAccount } from 'viem/accounts'
|
118
|
+
* import { zksync, mainnet } from 'viem/chains'
|
119
|
+
* import { requestExecute, publicActionsL2 } from 'viem/zksync'
|
120
|
+
*
|
121
|
+
* const client = createWalletClient({
|
122
|
+
* account: privateKeyToAccount('0x…'),
|
123
|
+
* chain: mainnet,
|
124
|
+
* transport: http(),
|
125
|
+
* })
|
126
|
+
*
|
127
|
+
* const clientL2 = createPublicClient({
|
128
|
+
* chain: zksync,
|
129
|
+
* transport: http(),
|
130
|
+
* }).extend(publicActionsL2())
|
131
|
+
*
|
132
|
+
* const hash = await requestExecute(client, {
|
133
|
+
* client: clientL2,
|
134
|
+
* contractAddress: '0x43020e6e11cef7dce8e37baa09d9a996ac722057'
|
135
|
+
* calldata: '0x',
|
136
|
+
* l2Value: 1_000_000_000_000_000_000n,
|
137
|
+
* })
|
138
|
+
*/
|
139
|
+
export async function requestExecute<
|
140
|
+
chain extends Chain | undefined,
|
141
|
+
account extends Account | undefined,
|
142
|
+
chainOverride extends Chain | undefined = Chain | undefined,
|
143
|
+
chainL2 extends ChainEIP712 | undefined = ChainEIP712 | undefined,
|
144
|
+
accountL2 extends Account | undefined = Account | undefined,
|
145
|
+
>(
|
146
|
+
client: Client<Transport, chain, account>,
|
147
|
+
parameters: RequestExecuteParameters<
|
148
|
+
chain,
|
149
|
+
account,
|
150
|
+
chainOverride,
|
151
|
+
chainL2,
|
152
|
+
accountL2
|
153
|
+
>,
|
154
|
+
): Promise<RequestExecuteReturnType> {
|
155
|
+
let {
|
156
|
+
account: account_ = client.account,
|
157
|
+
chain: chain_ = client.chain,
|
158
|
+
client: l2Client,
|
159
|
+
contractAddress,
|
160
|
+
calldata,
|
161
|
+
l2Value = 0n,
|
162
|
+
mintValue = 0n,
|
163
|
+
operatorTip = 0n,
|
164
|
+
factoryDeps = [],
|
165
|
+
gasPerPubdataByte = requiredL1ToL2GasPerPubdataLimit,
|
166
|
+
refundRecipient,
|
167
|
+
l2GasLimit,
|
168
|
+
value,
|
169
|
+
gasPrice,
|
170
|
+
maxFeePerGas,
|
171
|
+
maxPriorityFeePerGas,
|
172
|
+
...rest
|
173
|
+
} = parameters
|
174
|
+
|
175
|
+
const account = account_ ? parseAccount(account_) : client.account
|
176
|
+
if (!account)
|
177
|
+
throw new AccountNotFoundError({
|
178
|
+
docsPath: '/docs/actions/wallet/sendTransaction',
|
179
|
+
})
|
180
|
+
if (!l2Client.chain) throw new ClientChainNotConfiguredError()
|
181
|
+
|
182
|
+
const bridgehub = await getBridgehubContractAddress(l2Client)
|
183
|
+
const baseToken = await readContract(client, {
|
184
|
+
address: bridgehub,
|
185
|
+
abi: bridgehubAbi,
|
186
|
+
functionName: 'baseToken',
|
187
|
+
args: [BigInt(l2Client.chain.id)],
|
188
|
+
})
|
189
|
+
const isETHBasedChain = isAddressEqual(baseToken, ethAddressInContracts)
|
190
|
+
|
191
|
+
refundRecipient ??= account.address
|
192
|
+
l2GasLimit ??= await estimateGasL1ToL2(l2Client, {
|
193
|
+
chain: l2Client.chain,
|
194
|
+
// If the `from` address is not provided, we use a random address, because
|
195
|
+
// due to storage slot aggregation, the gas estimation will depend on the address
|
196
|
+
// and so estimation for the zero address may be smaller than for the sender.
|
197
|
+
account:
|
198
|
+
l2Client.account ??
|
199
|
+
parseAccount(privateKeyToAddress(generatePrivateKey())),
|
200
|
+
data: calldata,
|
201
|
+
to: contractAddress,
|
202
|
+
value: l2Value,
|
203
|
+
gasPerPubdata: gasPerPubdataByte,
|
204
|
+
factoryDeps,
|
205
|
+
})
|
206
|
+
|
207
|
+
let gasPriceForEstimation = maxFeePerGas || gasPrice
|
208
|
+
if (!gasPriceForEstimation) {
|
209
|
+
const estimatedFee = await getFeePrice(client)
|
210
|
+
gasPriceForEstimation = estimatedFee.maxFeePerGas
|
211
|
+
maxFeePerGas = estimatedFee.maxFeePerGas
|
212
|
+
maxPriorityFeePerGas ??= estimatedFee.maxPriorityFeePerGas
|
213
|
+
}
|
214
|
+
|
215
|
+
const baseCost = await readContract(client, {
|
216
|
+
address: bridgehub,
|
217
|
+
abi: bridgehubAbi,
|
218
|
+
functionName: 'l2TransactionBaseCost',
|
219
|
+
args: [
|
220
|
+
BigInt(l2Client.chain.id),
|
221
|
+
gasPriceForEstimation,
|
222
|
+
l2GasLimit,
|
223
|
+
gasPerPubdataByte,
|
224
|
+
],
|
225
|
+
})
|
226
|
+
|
227
|
+
const l2Costs = baseCost + operatorTip + l2Value
|
228
|
+
let providedValue = isETHBasedChain ? value : mintValue
|
229
|
+
if (!providedValue || providedValue === 0n) {
|
230
|
+
providedValue = l2Costs
|
231
|
+
}
|
232
|
+
|
233
|
+
if (baseCost > providedValue)
|
234
|
+
throw new BaseFeeHigherThanValueError(baseCost, providedValue)
|
235
|
+
|
236
|
+
const data = encodeFunctionData({
|
237
|
+
abi: bridgehubAbi,
|
238
|
+
functionName: 'requestL2TransactionDirect',
|
239
|
+
args: [
|
240
|
+
{
|
241
|
+
chainId: BigInt(l2Client.chain.id),
|
242
|
+
mintValue: providedValue,
|
243
|
+
l2Contract: contractAddress,
|
244
|
+
l2Value: l2Value,
|
245
|
+
l2Calldata: calldata,
|
246
|
+
l2GasLimit: l2GasLimit,
|
247
|
+
l2GasPerPubdataByteLimit: gasPerPubdataByte,
|
248
|
+
factoryDeps: factoryDeps,
|
249
|
+
refundRecipient: refundRecipient,
|
250
|
+
},
|
251
|
+
],
|
252
|
+
})
|
253
|
+
|
254
|
+
return await sendTransaction(client, {
|
255
|
+
chain: chain_,
|
256
|
+
account: account,
|
257
|
+
to: bridgehub,
|
258
|
+
value: isETHBasedChain ? providedValue : value,
|
259
|
+
data,
|
260
|
+
gasPrice,
|
261
|
+
maxFeePerGas,
|
262
|
+
maxPriorityFeePerGas,
|
263
|
+
...rest,
|
264
|
+
} as SendTransactionParameters)
|
265
|
+
}
|
266
|
+
|
267
|
+
async function getFeePrice<chain extends Chain | undefined>(
|
268
|
+
client: Client<Transport, chain>,
|
269
|
+
) {
|
270
|
+
const client_ = client.extend(publicActions)
|
271
|
+
const block = await client_.getBlock()
|
272
|
+
const baseFee =
|
273
|
+
typeof block.baseFeePerGas !== 'bigint'
|
274
|
+
? await client_.getGasPrice()
|
275
|
+
: block.baseFeePerGas
|
276
|
+
const maxPriorityFeePerGas = await client_.estimateMaxPriorityFeePerGas()
|
277
|
+
|
278
|
+
return {
|
279
|
+
maxFeePerGas: (baseFee * 3n) / 2n + maxPriorityFeePerGas,
|
280
|
+
maxPriorityFeePerGas: maxPriorityFeePerGas,
|
281
|
+
}
|
282
|
+
}
|