Comparing version 2.21.58 to 2.21.59
@@ -67,3 +67,3 @@ "use strict"; | ||
const call = call_; | ||
if ('abi' in call) | ||
if (call.abi) | ||
return { | ||
@@ -70,0 +70,0 @@ data: (0, encodeFunctionData_js_1.encodeFunctionData)(call), |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.version = void 0; | ||
exports.version = '2.21.58'; | ||
exports.version = '2.21.59'; | ||
//# sourceMappingURL=version.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.serializeErc6492Signature = exports.isErc6492Signature = exports.parseErc6492Signature = exports.erc7739Actions = exports.erc7715Actions = exports.walletActionsErc7715 = exports.grantPermissions = exports.verifyAuthorization = exports.serializeAuthorizationList = exports.recoverAuthorizationAddress = exports.hashAuthorization = exports.signAuthorization = exports.prepareAuthorization = exports.eip7702Actions = exports.eip5792Actions = exports.walletActionsEip5792 = exports.writeContracts = exports.showCallsStatus = exports.getCallsStatus = exports.sendCalls = exports.getCapabilities = void 0; | ||
exports.serializeErc6492Signature = exports.isErc6492Signature = exports.parseErc6492Signature = exports.erc7821Actions = exports.erc7739Actions = exports.erc7715Actions = exports.walletActionsErc7715 = exports.grantPermissions = exports.verifyAuthorization = exports.serializeAuthorizationList = exports.recoverAuthorizationAddress = exports.hashAuthorization = exports.signAuthorization = exports.prepareAuthorization = exports.eip7702Actions = exports.eip5792Actions = exports.walletActionsEip5792 = exports.writeContracts = exports.showCallsStatus = exports.getCallsStatus = exports.sendCalls = exports.getCapabilities = void 0; | ||
var getCapabilities_js_1 = require("./eip5792/actions/getCapabilities.js"); | ||
@@ -38,2 +38,4 @@ Object.defineProperty(exports, "getCapabilities", { enumerable: true, get: function () { return getCapabilities_js_1.getCapabilities; } }); | ||
Object.defineProperty(exports, "erc7739Actions", { enumerable: true, get: function () { return erc7739_js_1.erc7739Actions; } }); | ||
var erc7821_js_1 = require("./erc7821/decorators/erc7821.js"); | ||
Object.defineProperty(exports, "erc7821Actions", { enumerable: true, get: function () { return erc7821_js_1.erc7821Actions; } }); | ||
var parseErc6492Signature_js_1 = require("../utils/signature/parseErc6492Signature.js"); | ||
@@ -40,0 +42,0 @@ Object.defineProperty(exports, "parseErc6492Signature", { enumerable: true, get: function () { return parseErc6492Signature_js_1.parseErc6492Signature; } }); |
@@ -22,5 +22,7 @@ "use strict"; | ||
data, | ||
to: address_js_1.contractDeployerAddress, | ||
to: deploymentType === 'create2' || deploymentType === 'create2Account' | ||
? address_js_1.contract2FactoryAddress | ||
: address_js_1.contractDeployerAddress, | ||
}); | ||
} | ||
//# sourceMappingURL=deployContract.js.map |
@@ -15,8 +15,8 @@ "use strict"; | ||
async function sendEip712Transaction(client, parameters) { | ||
const { chain = client.chain } = parameters; | ||
if (!parameters.account) | ||
const { account: account_ = client.account, chain = client.chain } = parameters; | ||
const account = account_ ? (0, parseAccount_js_1.parseAccount)(account_) : client.account; | ||
if (!account) | ||
throw new account_js_1.AccountNotFoundError({ | ||
docsPath: '/docs/actions/wallet/sendTransaction', | ||
}); | ||
const account = (0, parseAccount_js_1.parseAccount)(parameters.account); | ||
try { | ||
@@ -23,0 +23,0 @@ (0, assertEip712Request_js_1.assertEip712Request)(parameters); |
@@ -14,7 +14,7 @@ "use strict"; | ||
const { account: account_ = client.account, chain = client.chain, ...transaction } = args; | ||
if (!account_) | ||
const account = account_ ? (0, parseAccount_js_1.parseAccount)(account_) : client.account; | ||
if (!account) | ||
throw new account_js_1.AccountNotFoundError({ | ||
docsPath: '/docs/actions/wallet/signTransaction', | ||
}); | ||
const account = (0, parseAccount_js_1.parseAccount)(account_); | ||
(0, assertEip712Request_js_1.assertEip712Request)({ | ||
@@ -21,0 +21,0 @@ account, |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.paymasterAbi = exports.contractDeployerAbi = void 0; | ||
exports.l2SharedBridgeAbi = exports.paymasterAbi = exports.contractDeployerAbi = void 0; | ||
exports.contractDeployerAbi = [ | ||
@@ -465,2 +465,186 @@ { | ||
]; | ||
exports.l2SharedBridgeAbi = [ | ||
{ | ||
anonymous: false, | ||
inputs: [ | ||
{ | ||
indexed: true, | ||
internalType: 'address', | ||
name: 'l1Sender', | ||
type: 'address', | ||
}, | ||
{ | ||
indexed: true, | ||
internalType: 'address', | ||
name: 'l2Receiver', | ||
type: 'address', | ||
}, | ||
{ | ||
indexed: true, | ||
internalType: 'address', | ||
name: 'l2Token', | ||
type: 'address', | ||
}, | ||
{ | ||
indexed: false, | ||
internalType: 'uint256', | ||
name: 'amount', | ||
type: 'uint256', | ||
}, | ||
], | ||
name: 'FinalizeDeposit', | ||
type: 'event', | ||
}, | ||
{ | ||
anonymous: false, | ||
inputs: [ | ||
{ | ||
indexed: true, | ||
internalType: 'address', | ||
name: 'l2Sender', | ||
type: 'address', | ||
}, | ||
{ | ||
indexed: true, | ||
internalType: 'address', | ||
name: 'l1Receiver', | ||
type: 'address', | ||
}, | ||
{ | ||
indexed: true, | ||
internalType: 'address', | ||
name: 'l2Token', | ||
type: 'address', | ||
}, | ||
{ | ||
indexed: false, | ||
internalType: 'uint256', | ||
name: 'amount', | ||
type: 'uint256', | ||
}, | ||
], | ||
name: 'WithdrawalInitiated', | ||
type: 'event', | ||
}, | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: 'address', | ||
name: '_l1Sender', | ||
type: 'address', | ||
}, | ||
{ | ||
internalType: 'address', | ||
name: '_l2Receiver', | ||
type: 'address', | ||
}, | ||
{ | ||
internalType: 'address', | ||
name: '_l1Token', | ||
type: 'address', | ||
}, | ||
{ | ||
internalType: 'uint256', | ||
name: '_amount', | ||
type: 'uint256', | ||
}, | ||
{ | ||
internalType: 'bytes', | ||
name: '_data', | ||
type: 'bytes', | ||
}, | ||
], | ||
name: 'finalizeDeposit', | ||
outputs: [], | ||
stateMutability: 'nonpayable', | ||
type: 'function', | ||
}, | ||
{ | ||
inputs: [], | ||
name: 'l1Bridge', | ||
outputs: [ | ||
{ | ||
internalType: 'address', | ||
name: '', | ||
type: 'address', | ||
}, | ||
], | ||
stateMutability: 'view', | ||
type: 'function', | ||
}, | ||
{ | ||
inputs: [], | ||
name: 'l1SharedBridge', | ||
outputs: [ | ||
{ | ||
internalType: 'address', | ||
name: '', | ||
type: 'address', | ||
}, | ||
], | ||
stateMutability: 'view', | ||
type: 'function', | ||
}, | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: 'address', | ||
name: '_l2Token', | ||
type: 'address', | ||
}, | ||
], | ||
name: 'l1TokenAddress', | ||
outputs: [ | ||
{ | ||
internalType: 'address', | ||
name: '', | ||
type: 'address', | ||
}, | ||
], | ||
stateMutability: 'view', | ||
type: 'function', | ||
}, | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: 'address', | ||
name: '_l1Token', | ||
type: 'address', | ||
}, | ||
], | ||
name: 'l2TokenAddress', | ||
outputs: [ | ||
{ | ||
internalType: 'address', | ||
name: '', | ||
type: 'address', | ||
}, | ||
], | ||
stateMutability: 'view', | ||
type: 'function', | ||
}, | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: 'address', | ||
name: '_l1Receiver', | ||
type: 'address', | ||
}, | ||
{ | ||
internalType: 'address', | ||
name: '_l2Token', | ||
type: 'address', | ||
}, | ||
{ | ||
internalType: 'uint256', | ||
name: '_amount', | ||
type: 'uint256', | ||
}, | ||
], | ||
name: 'withdraw', | ||
outputs: [], | ||
stateMutability: 'nonpayable', | ||
type: 'function', | ||
}, | ||
]; | ||
//# sourceMappingURL=abis.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.l2BaseTokenAddress = exports.ethAddressInContracts = exports.legacyEthAddress = exports.contractDeployerAddress = void 0; | ||
exports.l2BaseTokenAddress = exports.ethAddressInContracts = exports.legacyEthAddress = exports.contract2FactoryAddress = exports.contractDeployerAddress = void 0; | ||
exports.contractDeployerAddress = '0x0000000000000000000000000000000000008006'; | ||
exports.contract2FactoryAddress = '0x0000000000000000000000000000000000010000'; | ||
exports.legacyEthAddress = '0x0000000000000000000000000000000000000000'; | ||
@@ -6,0 +7,0 @@ exports.ethAddressInContracts = '0x0000000000000000000000000000000000000001'; |
@@ -15,2 +15,4 @@ "use strict"; | ||
const getL1ChainId_js_1 = require("../actions/getL1ChainId.js"); | ||
const getL1TokenAddress_js_1 = require("../actions/getL1TokenAddress.js"); | ||
const getL2TokenAddress_js_1 = require("../actions/getL2TokenAddress.js"); | ||
const getLogProof_js_1 = require("../actions/getLogProof.js"); | ||
@@ -40,2 +42,4 @@ const getMainContractAddress_js_1 = require("../actions/getMainContractAddress.js"); | ||
getBaseTokenL1Address: () => (0, getBaseTokenL1Address_js_1.getBaseTokenL1Address)(client), | ||
getL2TokenAddress: (args) => (0, getL2TokenAddress_js_1.getL2TokenAddress)(client, args), | ||
getL1TokenAddress: (args) => (0, getL1TokenAddress_js_1.getL1TokenAddress)(client, args), | ||
}; | ||
@@ -42,0 +46,0 @@ }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.parseEip712Transaction = exports.getGeneralPaymasterInput = exports.getApprovalBasedPaymasterInput = exports.serializeTransaction = exports.publicActionsL2 = exports.publicActionsL1 = exports.eip712WalletActions = exports.chainConfig = exports.zksyncSepoliaTestnet = exports.zkSyncSepoliaTestnet = exports.zksyncLocalNode = exports.zkSyncLocalNode = exports.zksyncInMemoryNode = exports.zksyncLocalHyperchainL1 = exports.zksyncLocalHyperchain = exports.zksyncLocalCustomHyperchain = exports.zkSyncInMemoryNode = exports.zksync = exports.zkSync = exports.signTransaction = exports.signEip712Transaction = exports.sendEip712Transaction = exports.sendTransaction = exports.getTransactionDetails = exports.getTestnetPaymasterAddress = exports.getRawBlockTransactions = exports.getMainContractAddress = exports.getLogProof = exports.getL1TokenBalance = exports.getL1ChainId = exports.getL1BatchNumber = exports.getL1BatchDetails = exports.getL1BatchBlockRange = exports.getL1Balance = exports.getL1Allowance = exports.getBridgehubContractAddress = exports.getDefaultBridgeAddresses = exports.getBlockDetails = exports.getAllBalances = exports.estimateFee = exports.hashBytecode = exports.encodeDeployData = exports.deployContract = exports.toSinglesigSmartAccount = exports.toMultisigSmartAccount = exports.toSmartAccount = void 0; | ||
exports.parseEip712Transaction = exports.getGeneralPaymasterInput = exports.getApprovalBasedPaymasterInput = exports.serializeTransaction = exports.publicActionsL2 = exports.publicActionsL1 = exports.eip712WalletActions = exports.chainConfig = exports.zksyncSepoliaTestnet = exports.zkSyncSepoliaTestnet = exports.zksyncLocalNode = exports.zkSyncLocalNode = exports.zksyncInMemoryNode = exports.zksyncLocalHyperchainL1 = exports.zksyncLocalHyperchain = exports.zksyncLocalCustomHyperchain = exports.zkSyncInMemoryNode = exports.zksync = exports.zkSync = exports.getL1TokenAddress = exports.getL2TokenAddress = exports.signTransaction = exports.signEip712Transaction = exports.sendEip712Transaction = exports.sendTransaction = exports.getTransactionDetails = exports.getTestnetPaymasterAddress = exports.getRawBlockTransactions = exports.getMainContractAddress = exports.getLogProof = exports.getL1TokenBalance = exports.getL1ChainId = exports.getL1BatchNumber = exports.getL1BatchDetails = exports.getL1BatchBlockRange = exports.getL1Balance = exports.getL1Allowance = exports.getBridgehubContractAddress = exports.getDefaultBridgeAddresses = exports.getBlockDetails = exports.getAllBalances = exports.estimateFee = exports.hashBytecode = exports.encodeDeployData = exports.deployContract = exports.toSinglesigSmartAccount = exports.toMultisigSmartAccount = exports.toSmartAccount = void 0; | ||
var toSmartAccount_js_1 = require("./accounts/toSmartAccount.js"); | ||
@@ -58,2 +58,6 @@ Object.defineProperty(exports, "toSmartAccount", { enumerable: true, get: function () { return toSmartAccount_js_1.toSmartAccount; } }); | ||
Object.defineProperty(exports, "signTransaction", { enumerable: true, get: function () { return signTransaction_js_1.signTransaction; } }); | ||
var getL2TokenAddress_js_1 = require("./actions/getL2TokenAddress.js"); | ||
Object.defineProperty(exports, "getL2TokenAddress", { enumerable: true, get: function () { return getL2TokenAddress_js_1.getL2TokenAddress; } }); | ||
var getL1TokenAddress_js_1 = require("./actions/getL1TokenAddress.js"); | ||
Object.defineProperty(exports, "getL1TokenAddress", { enumerable: true, get: function () { return getL1TokenAddress_js_1.getL1TokenAddress; } }); | ||
var chains_js_1 = require("./chains.js"); | ||
@@ -60,0 +64,0 @@ Object.defineProperty(exports, "zkSync", { enumerable: true, get: function () { return chains_js_1.zksync; } }); |
@@ -108,3 +108,3 @@ import { parseAccount, } from '../../../accounts/utils/parseAccount.js'; | ||
const call = call_; | ||
if ('abi' in call) | ||
if (call.abi) | ||
return { | ||
@@ -111,0 +111,0 @@ data: encodeFunctionData(call), |
@@ -1,2 +0,2 @@ | ||
export const version = '2.21.58'; | ||
export const version = '2.21.59'; | ||
//# sourceMappingURL=version.js.map |
@@ -24,2 +24,3 @@ // biome-ignore lint/performance/noBarrelFile: entrypoint module | ||
export { erc7739Actions, } from './erc7739/decorators/erc7739.js'; | ||
export { erc7821Actions, } from './erc7821/decorators/erc7821.js'; | ||
export { | ||
@@ -26,0 +27,0 @@ /** @deprecated This is no longer experimental – use `import { parseErc6492Signature } from 'viem'` instead. */ |
@@ -1,2 +0,2 @@ | ||
import { contractDeployerAddress } from '../constants/address.js'; | ||
import { contract2FactoryAddress, contractDeployerAddress, } from '../constants/address.js'; | ||
import { encodeDeployData, } from '../utils/abi/encodeDeployData.js'; | ||
@@ -9,3 +9,3 @@ import { sendEip712Transaction, } from './sendEip712Transaction.js'; | ||
* | ||
* @param client - Client to use | ||
* @param walletClient - Client to use | ||
* @param parameters - {@link DeployContractParameters} | ||
@@ -50,5 +50,7 @@ * @returns The [Transaction](https://viem.sh/docs/glossary/terms#transaction) hash. {@link DeployContractReturnType} | ||
data, | ||
to: contractDeployerAddress, | ||
to: deploymentType === 'create2' || deploymentType === 'create2Account' | ||
? contract2FactoryAddress | ||
: contractDeployerAddress, | ||
}); | ||
} | ||
//# sourceMappingURL=deployContract.js.map |
@@ -52,8 +52,8 @@ import { parseAccount } from '../../accounts/utils/parseAccount.js'; | ||
export async function sendEip712Transaction(client, parameters) { | ||
const { chain = client.chain } = parameters; | ||
if (!parameters.account) | ||
const { account: account_ = client.account, chain = client.chain } = parameters; | ||
const account = account_ ? parseAccount(account_) : client.account; | ||
if (!account) | ||
throw new AccountNotFoundError({ | ||
docsPath: '/docs/actions/wallet/sendTransaction', | ||
}); | ||
const account = parseAccount(parameters.account); | ||
try { | ||
@@ -60,0 +60,0 @@ assertEip712Request(parameters); |
@@ -12,2 +12,4 @@ import { parseAccount } from '../../accounts/utils/parseAccount.js'; | ||
* | ||
* | ||
* @param client - Client to use | ||
* @param args - {@link SignTransactionParameters} | ||
@@ -50,7 +52,7 @@ * @returns The signed serialized transaction. {@link SignTransactionReturnType} | ||
const { account: account_ = client.account, chain = client.chain, ...transaction } = args; | ||
if (!account_) | ||
const account = account_ ? parseAccount(account_) : client.account; | ||
if (!account) | ||
throw new AccountNotFoundError({ | ||
docsPath: '/docs/actions/wallet/signTransaction', | ||
}); | ||
const account = parseAccount(account_); | ||
assertEip712Request({ | ||
@@ -57,0 +59,0 @@ account, |
@@ -463,2 +463,186 @@ /* [ContractDeployer](https://github.com/matter-labs/era-system-contracts/blob/main/contracts/ContractDeployer.sol) */ | ||
]; | ||
export const l2SharedBridgeAbi = [ | ||
{ | ||
anonymous: false, | ||
inputs: [ | ||
{ | ||
indexed: true, | ||
internalType: 'address', | ||
name: 'l1Sender', | ||
type: 'address', | ||
}, | ||
{ | ||
indexed: true, | ||
internalType: 'address', | ||
name: 'l2Receiver', | ||
type: 'address', | ||
}, | ||
{ | ||
indexed: true, | ||
internalType: 'address', | ||
name: 'l2Token', | ||
type: 'address', | ||
}, | ||
{ | ||
indexed: false, | ||
internalType: 'uint256', | ||
name: 'amount', | ||
type: 'uint256', | ||
}, | ||
], | ||
name: 'FinalizeDeposit', | ||
type: 'event', | ||
}, | ||
{ | ||
anonymous: false, | ||
inputs: [ | ||
{ | ||
indexed: true, | ||
internalType: 'address', | ||
name: 'l2Sender', | ||
type: 'address', | ||
}, | ||
{ | ||
indexed: true, | ||
internalType: 'address', | ||
name: 'l1Receiver', | ||
type: 'address', | ||
}, | ||
{ | ||
indexed: true, | ||
internalType: 'address', | ||
name: 'l2Token', | ||
type: 'address', | ||
}, | ||
{ | ||
indexed: false, | ||
internalType: 'uint256', | ||
name: 'amount', | ||
type: 'uint256', | ||
}, | ||
], | ||
name: 'WithdrawalInitiated', | ||
type: 'event', | ||
}, | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: 'address', | ||
name: '_l1Sender', | ||
type: 'address', | ||
}, | ||
{ | ||
internalType: 'address', | ||
name: '_l2Receiver', | ||
type: 'address', | ||
}, | ||
{ | ||
internalType: 'address', | ||
name: '_l1Token', | ||
type: 'address', | ||
}, | ||
{ | ||
internalType: 'uint256', | ||
name: '_amount', | ||
type: 'uint256', | ||
}, | ||
{ | ||
internalType: 'bytes', | ||
name: '_data', | ||
type: 'bytes', | ||
}, | ||
], | ||
name: 'finalizeDeposit', | ||
outputs: [], | ||
stateMutability: 'nonpayable', | ||
type: 'function', | ||
}, | ||
{ | ||
inputs: [], | ||
name: 'l1Bridge', | ||
outputs: [ | ||
{ | ||
internalType: 'address', | ||
name: '', | ||
type: 'address', | ||
}, | ||
], | ||
stateMutability: 'view', | ||
type: 'function', | ||
}, | ||
{ | ||
inputs: [], | ||
name: 'l1SharedBridge', | ||
outputs: [ | ||
{ | ||
internalType: 'address', | ||
name: '', | ||
type: 'address', | ||
}, | ||
], | ||
stateMutability: 'view', | ||
type: 'function', | ||
}, | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: 'address', | ||
name: '_l2Token', | ||
type: 'address', | ||
}, | ||
], | ||
name: 'l1TokenAddress', | ||
outputs: [ | ||
{ | ||
internalType: 'address', | ||
name: '', | ||
type: 'address', | ||
}, | ||
], | ||
stateMutability: 'view', | ||
type: 'function', | ||
}, | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: 'address', | ||
name: '_l1Token', | ||
type: 'address', | ||
}, | ||
], | ||
name: 'l2TokenAddress', | ||
outputs: [ | ||
{ | ||
internalType: 'address', | ||
name: '', | ||
type: 'address', | ||
}, | ||
], | ||
stateMutability: 'view', | ||
type: 'function', | ||
}, | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: 'address', | ||
name: '_l1Receiver', | ||
type: 'address', | ||
}, | ||
{ | ||
internalType: 'address', | ||
name: '_l2Token', | ||
type: 'address', | ||
}, | ||
{ | ||
internalType: 'uint256', | ||
name: '_amount', | ||
type: 'uint256', | ||
}, | ||
], | ||
name: 'withdraw', | ||
outputs: [], | ||
stateMutability: 'nonpayable', | ||
type: 'function', | ||
}, | ||
]; | ||
//# sourceMappingURL=abis.js.map |
export const contractDeployerAddress = '0x0000000000000000000000000000000000008006'; | ||
export const contract2FactoryAddress = '0x0000000000000000000000000000000000010000'; | ||
export const legacyEthAddress = '0x0000000000000000000000000000000000000000'; | ||
@@ -3,0 +4,0 @@ export const ethAddressInContracts = '0x0000000000000000000000000000000000000001'; |
@@ -12,2 +12,4 @@ import { estimateFee } from '../actions/estimateFee.js'; | ||
import { getL1ChainId, } from '../actions/getL1ChainId.js'; | ||
import { getL1TokenAddress, } from '../actions/getL1TokenAddress.js'; | ||
import { getL2TokenAddress, } from '../actions/getL2TokenAddress.js'; | ||
import { getLogProof, } from '../actions/getLogProof.js'; | ||
@@ -37,2 +39,4 @@ import { getMainContractAddress, } from '../actions/getMainContractAddress.js'; | ||
getBaseTokenL1Address: () => getBaseTokenL1Address(client), | ||
getL2TokenAddress: (args) => getL2TokenAddress(client, args), | ||
getL1TokenAddress: (args) => getL1TokenAddress(client, args), | ||
}; | ||
@@ -39,0 +43,0 @@ }; |
@@ -29,2 +29,4 @@ // biome-ignore lint/performance/noBarrelFile: entrypoint module | ||
export { signTransaction, } from './actions/signTransaction.js'; | ||
export { getL2TokenAddress, } from './actions/getL2TokenAddress.js'; | ||
export { getL1TokenAddress, } from './actions/getL1TokenAddress.js'; | ||
export { | ||
@@ -31,0 +33,0 @@ /** @deprecated Use `zksync` instead */ |
@@ -6,2 +6,3 @@ import type { Address, Narrow } from 'abitype'; | ||
import type { ErrorType } from '../../../errors/utils.js'; | ||
import type { Calls } from '../../../types/calls.js'; | ||
import type { Chain } from '../../../types/chain.js'; | ||
@@ -16,3 +17,3 @@ import type { Hex } from '../../../types/misc.js'; | ||
import type { DeriveEntryPointVersion, EntryPointVersion } from '../../types/entryPointVersion.js'; | ||
import type { EstimateUserOperationGasReturnType as EstimateUserOperationGasReturnType_, UserOperation, UserOperationCalls, UserOperationRequest } from '../../types/userOperation.js'; | ||
import type { EstimateUserOperationGasReturnType as EstimateUserOperationGasReturnType_, UserOperation, UserOperationRequest } from '../../types/userOperation.js'; | ||
import { type FormatUserOperationGasErrorType } from '../../utils/formatters/userOperationGas.js'; | ||
@@ -22,3 +23,3 @@ import { type FormatUserOperationRequestErrorType } from '../../utils/formatters/userOperationRequest.js'; | ||
export type EstimateUserOperationGasParameters<account extends SmartAccount | undefined = SmartAccount | undefined, accountOverride extends SmartAccount | undefined = SmartAccount | undefined, calls extends readonly unknown[] = readonly unknown[], _derivedAccount extends SmartAccount | undefined = DeriveSmartAccount<account, accountOverride>, _derivedVersion extends EntryPointVersion = DeriveEntryPointVersion<_derivedAccount>> = GetSmartAccountParameter<account, accountOverride, false> & (UserOperation | Assign<UserOperationRequest<_derivedVersion>, OneOf<{ | ||
calls: UserOperationCalls<Narrow<calls>>; | ||
calls: Calls<Narrow<calls>>; | ||
} | { | ||
@@ -25,0 +26,0 @@ callData: Hex; |
@@ -7,2 +7,3 @@ import type { Address, Narrow } from 'abitype'; | ||
import type { ErrorType } from '../../../errors/utils.js'; | ||
import type { Calls } from '../../../types/calls.js'; | ||
import type { Chain } from '../../../types/chain.js'; | ||
@@ -18,3 +19,3 @@ import type { Hex } from '../../../types/misc.js'; | ||
import type { DeriveEntryPointVersion, EntryPointVersion } from '../../types/entryPointVersion.js'; | ||
import type { UserOperation, UserOperationCalls, UserOperationRequest } from '../../types/userOperation.js'; | ||
import type { UserOperation, UserOperationRequest } from '../../types/userOperation.js'; | ||
import { type GetPaymasterDataErrorType } from '../paymaster/getPaymasterData.js'; | ||
@@ -60,3 +61,3 @@ import { type GetPaymasterStubDataErrorType } from '../paymaster/getPaymasterStubData.js'; | ||
export type PrepareUserOperationRequest<account extends SmartAccount | undefined = SmartAccount | undefined, accountOverride extends SmartAccount | undefined = SmartAccount | undefined, calls extends readonly unknown[] = readonly unknown[], _derivedAccount extends SmartAccount | undefined = DeriveSmartAccount<account, accountOverride>, _derivedVersion extends EntryPointVersion = DeriveEntryPointVersion<_derivedAccount>> = Assign<UserOperationRequest<_derivedVersion>, OneOf<{ | ||
calls: UserOperationCalls<Narrow<calls>>; | ||
calls: Calls<Narrow<calls>>; | ||
} | { | ||
@@ -63,0 +64,0 @@ callData: Hex; |
@@ -5,2 +5,3 @@ import type { Address, Narrow } from 'abitype'; | ||
import type { ErrorType } from '../../../errors/utils.js'; | ||
import type { Calls } from '../../../types/calls.js'; | ||
import type { Chain } from '../../../types/chain.js'; | ||
@@ -14,7 +15,7 @@ import type { Hex } from '../../../types/misc.js'; | ||
import type { DeriveEntryPointVersion, EntryPointVersion } from '../../types/entryPointVersion.js'; | ||
import type { UserOperation, UserOperationCalls, UserOperationRequest } from '../../types/userOperation.js'; | ||
import type { UserOperation, UserOperationRequest } from '../../types/userOperation.js'; | ||
import { type FormatUserOperationRequestErrorType } from '../../utils/formatters/userOperationRequest.js'; | ||
import { type PrepareUserOperationErrorType } from './prepareUserOperation.js'; | ||
export type SendUserOperationParameters<account extends SmartAccount | undefined = SmartAccount | undefined, accountOverride extends SmartAccount | undefined = SmartAccount | undefined, calls extends readonly unknown[] = readonly unknown[], _derivedAccount extends SmartAccount | undefined = DeriveSmartAccount<account, accountOverride>, _derivedVersion extends EntryPointVersion = DeriveEntryPointVersion<_derivedAccount>> = GetSmartAccountParameter<account, accountOverride, false> & (UserOperation | Assign<UserOperationRequest<_derivedVersion>, OneOf<{ | ||
calls: UserOperationCalls<Narrow<calls>>; | ||
calls: Calls<Narrow<calls>>; | ||
} | { | ||
@@ -21,0 +22,0 @@ callData: Hex; |
@@ -27,3 +27,3 @@ export { type CreateWebAuthnCredentialParameters, type CreateWebAuthnCredentialReturnType, type P256Credential, createWebAuthnCredential, } from './accounts/createWebAuthnCredential.js'; | ||
export type { RpcEstimateUserOperationGasReturnType, RpcGetUserOperationByHashReturnType, RpcUserOperation, RpcUserOperationReceipt, RpcUserOperationRequest, } from './types/rpc.js'; | ||
export type { UserOperation, UserOperationReceipt, UserOperationRequest, PackedUserOperation, UserOperationCall, UserOperationCalls, } from './types/userOperation.js'; | ||
export type { UserOperation, UserOperationReceipt, UserOperationRequest, PackedUserOperation, } from './types/userOperation.js'; | ||
export { type GetBundlerErrorParameters, type GetBundlerErrorReturnType, getBundlerError, } from './utils/errors/getBundlerError.js'; | ||
@@ -30,0 +30,0 @@ export { type GetUserOperationErrorParameters, type GetUserOperationErrorReturnType, type GetUserOperationErrorErrorType, getUserOperationError, } from './utils/errors/getUserOperationError.js'; |
@@ -1,8 +0,6 @@ | ||
import type { AbiStateMutability, Address } from 'abitype'; | ||
import type { ContractFunctionParameters } from '../../types/contract.js'; | ||
import type { Address } from 'abitype'; | ||
import type { Log } from '../../types/log.js'; | ||
import type { Hash, Hex } from '../../types/misc.js'; | ||
import type { GetMulticallContractParameters } from '../../types/multicall.js'; | ||
import type { TransactionReceipt } from '../../types/transaction.js'; | ||
import type { OneOf, Prettify, UnionPartialBy } from '../../types/utils.js'; | ||
import type { OneOf, UnionPartialBy } from '../../types/utils.js'; | ||
import type { EntryPointVersion } from './entryPointVersion.js'; | ||
@@ -131,28 +129,2 @@ /** @link https://eips.ethereum.org/EIPS/eip-4337#-eth_estimateuseroperationgas */ | ||
}; | ||
export type UserOperationCall = { | ||
to: Hex; | ||
data?: Hex | undefined; | ||
value?: bigint | undefined; | ||
}; | ||
export type UserOperationCalls<calls extends readonly unknown[], result extends readonly any[] = []> = calls extends readonly [] ? readonly [] : calls extends readonly [infer call] ? readonly [ | ||
...result, | ||
Prettify<OneOf<(Omit<GetMulticallContractParameters<call, AbiStateMutability>, 'address'> & { | ||
to: Address; | ||
value?: bigint | undefined; | ||
}) | UserOperationCall>> | ||
] : calls extends readonly [infer call, ...infer rest] ? UserOperationCalls<[ | ||
...rest | ||
], [ | ||
...result, | ||
Prettify<OneOf<(Omit<GetMulticallContractParameters<call, AbiStateMutability>, 'address'> & { | ||
to: Address; | ||
value?: bigint | undefined; | ||
}) | UserOperationCall>> | ||
]> : readonly unknown[] extends calls ? calls : calls extends readonly (infer call extends OneOf<(Omit<ContractFunctionParameters, 'address'> & { | ||
to: Address; | ||
value?: bigint | undefined; | ||
}) | UserOperationCall>)[] ? readonly Prettify<call>[] : readonly OneOf<(Omit<ContractFunctionParameters, 'address'> & { | ||
to: Address; | ||
value?: bigint | undefined; | ||
}) | UserOperationCall>[]; | ||
//# sourceMappingURL=userOperation.d.ts.map |
@@ -1,2 +0,2 @@ | ||
export declare const version = "2.21.58"; | ||
export declare const version = "2.21.59"; | ||
//# sourceMappingURL=version.d.ts.map |
@@ -27,2 +27,3 @@ export { type GetCapabilitiesParameters, type GetCapabilitiesErrorType, type GetCapabilitiesReturnType, getCapabilities, } from './eip5792/actions/getCapabilities.js'; | ||
export { type Erc7739Actions, type Erc7739ActionsParameters, erc7739Actions, } from './erc7739/decorators/erc7739.js'; | ||
export { type Erc7821Actions, erc7821Actions, } from './erc7821/decorators/erc7821.js'; | ||
export { | ||
@@ -29,0 +30,0 @@ /** @deprecated This is no longer experimental – use `import type { ParseErc6492SignatureErrorType } from 'viem'` instead. */ |
@@ -25,3 +25,3 @@ import type { Abi } from 'abitype'; | ||
* | ||
* @param client - Client to use | ||
* @param walletClient - Client to use | ||
* @param parameters - {@link DeployContractParameters} | ||
@@ -28,0 +28,0 @@ * @returns The [Transaction](https://viem.sh/docs/glossary/terms#transaction) hash. {@link DeployContractReturnType} |
@@ -17,2 +17,4 @@ import type { Account } from '../../accounts/types.js'; | ||
* | ||
* | ||
* @param client - Client to use | ||
* @param args - {@link SignTransactionParameters} | ||
@@ -19,0 +21,0 @@ * @returns The signed serialized transaction. {@link SignTransactionReturnType} |
@@ -81,2 +81,145 @@ export declare const contractDeployerAbi: ({ | ||
}[]; | ||
export declare const l2SharedBridgeAbi: readonly [{ | ||
readonly anonymous: false; | ||
readonly inputs: readonly [{ | ||
readonly indexed: true; | ||
readonly internalType: "address"; | ||
readonly name: "l1Sender"; | ||
readonly type: "address"; | ||
}, { | ||
readonly indexed: true; | ||
readonly internalType: "address"; | ||
readonly name: "l2Receiver"; | ||
readonly type: "address"; | ||
}, { | ||
readonly indexed: true; | ||
readonly internalType: "address"; | ||
readonly name: "l2Token"; | ||
readonly type: "address"; | ||
}, { | ||
readonly indexed: false; | ||
readonly internalType: "uint256"; | ||
readonly name: "amount"; | ||
readonly type: "uint256"; | ||
}]; | ||
readonly name: "FinalizeDeposit"; | ||
readonly type: "event"; | ||
}, { | ||
readonly anonymous: false; | ||
readonly inputs: readonly [{ | ||
readonly indexed: true; | ||
readonly internalType: "address"; | ||
readonly name: "l2Sender"; | ||
readonly type: "address"; | ||
}, { | ||
readonly indexed: true; | ||
readonly internalType: "address"; | ||
readonly name: "l1Receiver"; | ||
readonly type: "address"; | ||
}, { | ||
readonly indexed: true; | ||
readonly internalType: "address"; | ||
readonly name: "l2Token"; | ||
readonly type: "address"; | ||
}, { | ||
readonly indexed: false; | ||
readonly internalType: "uint256"; | ||
readonly name: "amount"; | ||
readonly type: "uint256"; | ||
}]; | ||
readonly name: "WithdrawalInitiated"; | ||
readonly type: "event"; | ||
}, { | ||
readonly inputs: readonly [{ | ||
readonly internalType: "address"; | ||
readonly name: "_l1Sender"; | ||
readonly type: "address"; | ||
}, { | ||
readonly internalType: "address"; | ||
readonly name: "_l2Receiver"; | ||
readonly type: "address"; | ||
}, { | ||
readonly internalType: "address"; | ||
readonly name: "_l1Token"; | ||
readonly type: "address"; | ||
}, { | ||
readonly internalType: "uint256"; | ||
readonly name: "_amount"; | ||
readonly type: "uint256"; | ||
}, { | ||
readonly internalType: "bytes"; | ||
readonly name: "_data"; | ||
readonly type: "bytes"; | ||
}]; | ||
readonly name: "finalizeDeposit"; | ||
readonly outputs: readonly []; | ||
readonly stateMutability: "nonpayable"; | ||
readonly type: "function"; | ||
}, { | ||
readonly inputs: readonly []; | ||
readonly name: "l1Bridge"; | ||
readonly outputs: readonly [{ | ||
readonly internalType: "address"; | ||
readonly name: ""; | ||
readonly type: "address"; | ||
}]; | ||
readonly stateMutability: "view"; | ||
readonly type: "function"; | ||
}, { | ||
readonly inputs: readonly []; | ||
readonly name: "l1SharedBridge"; | ||
readonly outputs: readonly [{ | ||
readonly internalType: "address"; | ||
readonly name: ""; | ||
readonly type: "address"; | ||
}]; | ||
readonly stateMutability: "view"; | ||
readonly type: "function"; | ||
}, { | ||
readonly inputs: readonly [{ | ||
readonly internalType: "address"; | ||
readonly name: "_l2Token"; | ||
readonly type: "address"; | ||
}]; | ||
readonly name: "l1TokenAddress"; | ||
readonly outputs: readonly [{ | ||
readonly internalType: "address"; | ||
readonly name: ""; | ||
readonly type: "address"; | ||
}]; | ||
readonly stateMutability: "view"; | ||
readonly type: "function"; | ||
}, { | ||
readonly inputs: readonly [{ | ||
readonly internalType: "address"; | ||
readonly name: "_l1Token"; | ||
readonly type: "address"; | ||
}]; | ||
readonly name: "l2TokenAddress"; | ||
readonly outputs: readonly [{ | ||
readonly internalType: "address"; | ||
readonly name: ""; | ||
readonly type: "address"; | ||
}]; | ||
readonly stateMutability: "view"; | ||
readonly type: "function"; | ||
}, { | ||
readonly inputs: readonly [{ | ||
readonly internalType: "address"; | ||
readonly name: "_l1Receiver"; | ||
readonly type: "address"; | ||
}, { | ||
readonly internalType: "address"; | ||
readonly name: "_l2Token"; | ||
readonly type: "address"; | ||
}, { | ||
readonly internalType: "uint256"; | ||
readonly name: "_amount"; | ||
readonly type: "uint256"; | ||
}]; | ||
readonly name: "withdraw"; | ||
readonly outputs: readonly []; | ||
readonly stateMutability: "nonpayable"; | ||
readonly type: "function"; | ||
}]; | ||
//# sourceMappingURL=abis.d.ts.map |
export declare const contractDeployerAddress: "0x0000000000000000000000000000000000008006"; | ||
export declare const contract2FactoryAddress: "0x0000000000000000000000000000000000010000"; | ||
export declare const legacyEthAddress: "0x0000000000000000000000000000000000000000"; | ||
@@ -3,0 +4,0 @@ export declare const ethAddressInContracts: "0x0000000000000000000000000000000000000001"; |
@@ -15,2 +15,4 @@ import type { Client } from '../../clients/createClient.js'; | ||
import { type GetL1ChainIdReturnType } from '../actions/getL1ChainId.js'; | ||
import { type GetL1TokenAddressParameters, type GetL1TokenAddressReturnType } from '../actions/getL1TokenAddress.js'; | ||
import { type GetL2TokenAddressParameters, type GetL2TokenAddressReturnType } from '../actions/getL2TokenAddress.js'; | ||
import { type GetLogProofParameters, type GetLogProofReturnType } from '../actions/getLogProof.js'; | ||
@@ -321,4 +323,48 @@ import { type GetMainContractAddressReturnType } from '../actions/getMainContractAddress.js'; | ||
getBaseTokenL1Address: () => Promise<GetBaseTokenL1AddressReturnType>; | ||
/** | ||
* Returns the L2 token address equivalent for a L1 token address as they are not equal. | ||
* ETH address is set to zero address. | ||
* | ||
* @remarks Only works for tokens bridged on default ZKsync Era bridges. | ||
* | ||
* @param args - {@link GetL2TokenAddressParameters} | ||
* @returns The L2 token address equivalent for a L1 token address. | ||
* | ||
* @example | ||
* import { createPublicClient, http } from 'viem' | ||
* import { zksync } from 'viem/chains' | ||
* import { publicActionsL2 } from 'viem/zksync' | ||
* | ||
* const client = createPublicClient({ | ||
* chain: zksync, | ||
* transport: http(), | ||
* }).extend(publicActionsL2()) | ||
* | ||
* const address = await client.getL2TokenAddress({token: '0x...'}); | ||
*/ | ||
getL2TokenAddress: (args: GetL2TokenAddressParameters) => Promise<GetL2TokenAddressReturnType>; | ||
/** | ||
* Returns the L1 token address equivalent for a L2 token address as they are not equal. | ||
* ETH address is set to zero address. | ||
* | ||
* @remarks Only works for tokens bridged on default ZKsync Era bridges. | ||
* | ||
* @param args - {@link GetL1TokenAddressParameters} | ||
* @returns The L1 token address equivalent for a L2 token address. | ||
* | ||
* @example | ||
* import { createPublicClient, http } from 'viem' | ||
* import { zksync } from 'viem/chains' | ||
* import { publicActionsL2 } from 'viem/zksync' | ||
* | ||
* const client = createPublicClient({ | ||
* chain: zksync, | ||
* transport: http(), | ||
* }).extend(publicActionsL2()) | ||
* | ||
* const address = await client.getL1TokenAddress({token: '0x...'}); | ||
*/ | ||
getL1TokenAddress: (args: GetL1TokenAddressParameters) => Promise<GetL1TokenAddressReturnType>; | ||
}; | ||
export declare function publicActionsL2(): <transport extends Transport = Transport, chain extends ChainEIP712 | undefined = ChainEIP712 | undefined, account extends Account | undefined = Account | undefined>(client: Client<transport, chain, account>) => PublicActionsL2<chain, account>; | ||
//# sourceMappingURL=publicL2.d.ts.map |
@@ -28,2 +28,4 @@ export { type ToSmartAccountErrorType, type ToSmartAccountParameters, toSmartAccount, } from './accounts/toSmartAccount.js'; | ||
export { type SignTransactionErrorType, type SignTransactionParameters, type SignTransactionReturnType, signTransaction, } from './actions/signTransaction.js'; | ||
export { type GetL2TokenAddressReturnType, type GetL2TokenAddressParameters, getL2TokenAddress, } from './actions/getL2TokenAddress.js'; | ||
export { type GetL1TokenAddressReturnType, type GetL1TokenAddressParameters, getL1TokenAddress, } from './actions/getL1TokenAddress.js'; | ||
export { | ||
@@ -30,0 +32,0 @@ /** @deprecated Use `zksync` instead */ |
@@ -11,2 +11,3 @@ import type { Address, Narrow } from 'abitype' | ||
import type { ErrorType } from '../../../errors/utils.js' | ||
import type { Calls } from '../../../types/calls.js' | ||
import type { Chain } from '../../../types/chain.js' | ||
@@ -37,3 +38,2 @@ import type { Hex } from '../../../types/misc.js' | ||
UserOperation, | ||
UserOperationCalls, | ||
UserOperationRequest, | ||
@@ -73,5 +73,3 @@ } from '../../types/userOperation.js' | ||
UserOperationRequest<_derivedVersion>, | ||
OneOf< | ||
{ calls: UserOperationCalls<Narrow<calls>> } | { callData: Hex } | ||
> & { | ||
OneOf<{ calls: Calls<Narrow<calls>> } | { callData: Hex }> & { | ||
paymaster?: | ||
@@ -78,0 +76,0 @@ | Address |
@@ -15,4 +15,4 @@ import type { Address, Narrow } from 'abitype' | ||
import type { ErrorType } from '../../../errors/utils.js' | ||
import type { Call, Calls } from '../../../types/calls.js' | ||
import type { Chain } from '../../../types/chain.js' | ||
import type { ContractFunctionParameters } from '../../../types/contract.js' | ||
import type { Hex } from '../../../types/misc.js' | ||
@@ -46,4 +46,2 @@ import type { StateOverride } from '../../../types/stateOverride.js' | ||
UserOperation, | ||
UserOperationCall, | ||
UserOperationCalls, | ||
UserOperationRequest, | ||
@@ -159,3 +157,3 @@ } from '../../types/userOperation.js' | ||
UserOperationRequest<_derivedVersion>, | ||
OneOf<{ calls: UserOperationCalls<Narrow<calls>> } | { callData: Hex }> & { | ||
OneOf<{ calls: Calls<Narrow<calls>> } | { callData: Hex }> & { | ||
parameters?: readonly PrepareUserOperationParameterType[] | undefined | ||
@@ -373,6 +371,4 @@ paymaster?: | ||
parameters.calls.map((call_) => { | ||
const call = call_ as | ||
| UserOperationCall | ||
| (ContractFunctionParameters & { to: Address; value: bigint }) | ||
if ('abi' in call) | ||
const call = call_ as Call | ||
if (call.abi) | ||
return { | ||
@@ -382,4 +378,4 @@ data: encodeFunctionData(call), | ||
value: call.value, | ||
} as UserOperationCall | ||
return call as UserOperationCall | ||
} as Call | ||
return call as Call | ||
}), | ||
@@ -386,0 +382,0 @@ ) |
@@ -8,2 +8,3 @@ import type { Address, Narrow } from 'abitype' | ||
import type { ErrorType } from '../../../errors/utils.js' | ||
import type { Calls } from '../../../types/calls.js' | ||
import type { Chain } from '../../../types/chain.js' | ||
@@ -26,3 +27,2 @@ import type { Hex } from '../../../types/misc.js' | ||
UserOperation, | ||
UserOperationCalls, | ||
UserOperationRequest, | ||
@@ -58,5 +58,3 @@ } from '../../types/userOperation.js' | ||
UserOperationRequest<_derivedVersion>, | ||
OneOf< | ||
{ calls: UserOperationCalls<Narrow<calls>> } | { callData: Hex } | ||
> & { | ||
OneOf<{ calls: Calls<Narrow<calls>> } | { callData: Hex }> & { | ||
paymaster?: | ||
@@ -63,0 +61,0 @@ | Address |
@@ -205,4 +205,2 @@ // biome-ignore lint/performance/noBarrelFile: entrypoint | ||
PackedUserOperation, | ||
UserOperationCall, | ||
UserOperationCalls, | ||
} from './types/userOperation.js' | ||
@@ -209,0 +207,0 @@ |
@@ -1,8 +0,6 @@ | ||
import type { AbiStateMutability, Address } from 'abitype' | ||
import type { ContractFunctionParameters } from '../../types/contract.js' | ||
import type { Address } from 'abitype' | ||
import type { Log } from '../../types/log.js' | ||
import type { Hash, Hex } from '../../types/misc.js' | ||
import type { GetMulticallContractParameters } from '../../types/multicall.js' | ||
import type { TransactionReceipt } from '../../types/transaction.js' | ||
import type { OneOf, Prettify, UnionPartialBy } from '../../types/utils.js' | ||
import type { OneOf, UnionPartialBy } from '../../types/utils.js' | ||
import type { EntryPointVersion } from './entryPointVersion.js' | ||
@@ -195,69 +193,1 @@ | ||
} | ||
export type UserOperationCall = { | ||
to: Hex | ||
data?: Hex | undefined | ||
value?: bigint | undefined | ||
} | ||
export type UserOperationCalls< | ||
calls extends readonly unknown[], | ||
/// | ||
result extends readonly any[] = [], | ||
> = calls extends readonly [] // no calls, return empty | ||
? readonly [] | ||
: calls extends readonly [infer call] // one call left before returning `result` | ||
? readonly [ | ||
...result, | ||
Prettify< | ||
OneOf< | ||
| (Omit< | ||
GetMulticallContractParameters<call, AbiStateMutability>, | ||
'address' | ||
> & { | ||
to: Address | ||
value?: bigint | undefined | ||
}) | ||
| UserOperationCall | ||
> | ||
>, | ||
] | ||
: calls extends readonly [infer call, ...infer rest] // grab first call and recurse through `rest` | ||
? UserOperationCalls< | ||
[...rest], | ||
[ | ||
...result, | ||
Prettify< | ||
OneOf< | ||
| (Omit< | ||
GetMulticallContractParameters<call, AbiStateMutability>, | ||
'address' | ||
> & { | ||
to: Address | ||
value?: bigint | undefined | ||
}) | ||
| UserOperationCall | ||
> | ||
>, | ||
] | ||
> | ||
: readonly unknown[] extends calls | ||
? calls | ||
: // If `calls` is *some* array but we couldn't assign `unknown[]` to it, then it must hold some known/homogenous type! | ||
// use this to infer the param types in the case of Array.map() argument | ||
calls extends readonly (infer call extends OneOf< | ||
| (Omit<ContractFunctionParameters, 'address'> & { | ||
to: Address | ||
value?: bigint | undefined | ||
}) | ||
| UserOperationCall | ||
>)[] | ||
? readonly Prettify<call>[] | ||
: // Fallback | ||
readonly OneOf< | ||
| (Omit<ContractFunctionParameters, 'address'> & { | ||
to: Address | ||
value?: bigint | undefined | ||
}) | ||
| UserOperationCall | ||
>[] |
@@ -1,2 +0,2 @@ | ||
import type { Address } from 'abitype' | ||
import type { Abi, Address } from 'abitype' | ||
import { BaseError } from '../../../errors/base.js' | ||
@@ -9,5 +9,4 @@ import { | ||
import type { ErrorType } from '../../../errors/utils.js' | ||
import type { ContractFunctionParameters } from '../../../types/contract.js' | ||
import type { Call } from '../../../types/calls.js' | ||
import type { Hex } from '../../../types/misc.js' | ||
import type { OneOf } from '../../../types/utils.js' | ||
import { decodeErrorResult } from '../../../utils/abi/decodeErrorResult.js' | ||
@@ -20,6 +19,3 @@ import type { GetContractErrorReturnType } from '../../../utils/errors/getContractError.js' | ||
} from '../../errors/userOperation.js' | ||
import type { | ||
UserOperation, | ||
UserOperationCall, | ||
} from '../../types/userOperation.js' | ||
import type { UserOperation } from '../../types/userOperation.js' | ||
import { | ||
@@ -30,9 +26,2 @@ type GetBundlerErrorParameters, | ||
type Call = OneOf< | ||
| UserOperationCall | ||
| (ContractFunctionParameters & { | ||
to: Address | ||
}) | ||
> | ||
type GetNodeErrorReturnType = ErrorType | ||
@@ -112,3 +101,3 @@ | ||
Boolean(call.abi), | ||
) as readonly (ContractFunctionParameters & { to: Address })[] | ||
) as readonly Call[] | ||
@@ -140,3 +129,8 @@ if (contractCalls.length === 1) return contractCalls[0] | ||
} | ||
})() | ||
})() as { | ||
abi: Abi | ||
functionName: string | ||
args: unknown[] | ||
to: Address | ||
} | ||
@@ -143,0 +137,0 @@ const cause = (() => { |
@@ -1,1 +0,1 @@ | ||
export const version = '2.21.58' | ||
export const version = '2.21.59' |
@@ -115,2 +115,7 @@ // biome-ignore lint/performance/noBarrelFile: entrypoint module | ||
export { | ||
type Erc7821Actions, | ||
erc7821Actions, | ||
} from './erc7821/decorators/erc7821.js' | ||
export { | ||
/** @deprecated This is no longer experimental – use `import type { ParseErc6492SignatureErrorType } from 'viem'` instead. */ | ||
@@ -117,0 +122,0 @@ type ParseErc6492SignatureErrorType, |
{ | ||
"name": "viem", | ||
"description": "TypeScript Interface for Ethereum", | ||
"version": "2.21.58", | ||
"version": "2.21.59", | ||
"main": "./_cjs/index.js", | ||
@@ -72,2 +72,7 @@ "module": "./_esm/index.js", | ||
}, | ||
"./experimental/erc7821": { | ||
"types": "./_types/experimental/erc7821/index.d.ts", | ||
"import": "./_esm/experimental/erc7821/index.js", | ||
"default": "./_cjs/experimental/erc7821/index.js" | ||
}, | ||
"./linea": { | ||
@@ -74,0 +79,0 @@ "types": "./_types/linea/index.d.ts", |
@@ -10,3 +10,6 @@ import type { Abi } from 'abitype' | ||
import type { Hash, Hex } from '../../types/misc.js' | ||
import { contractDeployerAddress } from '../constants/address.js' | ||
import { | ||
contract2FactoryAddress, | ||
contractDeployerAddress, | ||
} from '../constants/address.js' | ||
import type { ChainEIP712 } from '../types/chain.js' | ||
@@ -49,3 +52,3 @@ import type { ContractDeploymentType } from '../types/contract.js' | ||
* | ||
* @param client - Client to use | ||
* @param walletClient - Client to use | ||
* @param parameters - {@link DeployContractParameters} | ||
@@ -102,3 +105,6 @@ * @returns The [Transaction](https://viem.sh/docs/glossary/terms#transaction) hash. {@link DeployContractReturnType} | ||
data, | ||
to: contractDeployerAddress, | ||
to: | ||
deploymentType === 'create2' || deploymentType === 'create2Account' | ||
? contract2FactoryAddress | ||
: contractDeployerAddress, | ||
} as unknown as SendEip712TransactionParameters< | ||
@@ -105,0 +111,0 @@ chain, |
@@ -95,9 +95,11 @@ import type { Account } from '../../accounts/types.js' | ||
): Promise<SendEip712TransactionReturnType> { | ||
const { chain = client.chain } = parameters | ||
const { account: account_ = client.account, chain = client.chain } = | ||
parameters | ||
if (!parameters.account) | ||
const account = account_ ? parseAccount(account_) : client.account | ||
if (!account) | ||
throw new AccountNotFoundError({ | ||
docsPath: '/docs/actions/wallet/sendTransaction', | ||
}) | ||
const account = parseAccount(parameters.account) | ||
@@ -104,0 +106,0 @@ try { |
@@ -56,2 +56,4 @@ import type { Account } from '../../accounts/types.js' | ||
* | ||
* | ||
* @param client - Client to use | ||
* @param args - {@link SignTransactionParameters} | ||
@@ -106,7 +108,8 @@ * @returns The signed serialized transaction. {@link SignTransactionReturnType} | ||
if (!account_) | ||
const account = account_ ? parseAccount(account_) : client.account | ||
if (!account) | ||
throw new AccountNotFoundError({ | ||
docsPath: '/docs/actions/wallet/signTransaction', | ||
}) | ||
const account = parseAccount(account_) | ||
@@ -113,0 +116,0 @@ assertEip712Request({ |
@@ -464,1 +464,186 @@ /* [ContractDeployer](https://github.com/matter-labs/era-system-contracts/blob/main/contracts/ContractDeployer.sol) */ | ||
] | ||
export const l2SharedBridgeAbi = [ | ||
{ | ||
anonymous: false, | ||
inputs: [ | ||
{ | ||
indexed: true, | ||
internalType: 'address', | ||
name: 'l1Sender', | ||
type: 'address', | ||
}, | ||
{ | ||
indexed: true, | ||
internalType: 'address', | ||
name: 'l2Receiver', | ||
type: 'address', | ||
}, | ||
{ | ||
indexed: true, | ||
internalType: 'address', | ||
name: 'l2Token', | ||
type: 'address', | ||
}, | ||
{ | ||
indexed: false, | ||
internalType: 'uint256', | ||
name: 'amount', | ||
type: 'uint256', | ||
}, | ||
], | ||
name: 'FinalizeDeposit', | ||
type: 'event', | ||
}, | ||
{ | ||
anonymous: false, | ||
inputs: [ | ||
{ | ||
indexed: true, | ||
internalType: 'address', | ||
name: 'l2Sender', | ||
type: 'address', | ||
}, | ||
{ | ||
indexed: true, | ||
internalType: 'address', | ||
name: 'l1Receiver', | ||
type: 'address', | ||
}, | ||
{ | ||
indexed: true, | ||
internalType: 'address', | ||
name: 'l2Token', | ||
type: 'address', | ||
}, | ||
{ | ||
indexed: false, | ||
internalType: 'uint256', | ||
name: 'amount', | ||
type: 'uint256', | ||
}, | ||
], | ||
name: 'WithdrawalInitiated', | ||
type: 'event', | ||
}, | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: 'address', | ||
name: '_l1Sender', | ||
type: 'address', | ||
}, | ||
{ | ||
internalType: 'address', | ||
name: '_l2Receiver', | ||
type: 'address', | ||
}, | ||
{ | ||
internalType: 'address', | ||
name: '_l1Token', | ||
type: 'address', | ||
}, | ||
{ | ||
internalType: 'uint256', | ||
name: '_amount', | ||
type: 'uint256', | ||
}, | ||
{ | ||
internalType: 'bytes', | ||
name: '_data', | ||
type: 'bytes', | ||
}, | ||
], | ||
name: 'finalizeDeposit', | ||
outputs: [], | ||
stateMutability: 'nonpayable', | ||
type: 'function', | ||
}, | ||
{ | ||
inputs: [], | ||
name: 'l1Bridge', | ||
outputs: [ | ||
{ | ||
internalType: 'address', | ||
name: '', | ||
type: 'address', | ||
}, | ||
], | ||
stateMutability: 'view', | ||
type: 'function', | ||
}, | ||
{ | ||
inputs: [], | ||
name: 'l1SharedBridge', | ||
outputs: [ | ||
{ | ||
internalType: 'address', | ||
name: '', | ||
type: 'address', | ||
}, | ||
], | ||
stateMutability: 'view', | ||
type: 'function', | ||
}, | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: 'address', | ||
name: '_l2Token', | ||
type: 'address', | ||
}, | ||
], | ||
name: 'l1TokenAddress', | ||
outputs: [ | ||
{ | ||
internalType: 'address', | ||
name: '', | ||
type: 'address', | ||
}, | ||
], | ||
stateMutability: 'view', | ||
type: 'function', | ||
}, | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: 'address', | ||
name: '_l1Token', | ||
type: 'address', | ||
}, | ||
], | ||
name: 'l2TokenAddress', | ||
outputs: [ | ||
{ | ||
internalType: 'address', | ||
name: '', | ||
type: 'address', | ||
}, | ||
], | ||
stateMutability: 'view', | ||
type: 'function', | ||
}, | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: 'address', | ||
name: '_l1Receiver', | ||
type: 'address', | ||
}, | ||
{ | ||
internalType: 'address', | ||
name: '_l2Token', | ||
type: 'address', | ||
}, | ||
{ | ||
internalType: 'uint256', | ||
name: '_amount', | ||
type: 'uint256', | ||
}, | ||
], | ||
name: 'withdraw', | ||
outputs: [], | ||
stateMutability: 'nonpayable', | ||
type: 'function', | ||
}, | ||
] as const |
export const contractDeployerAddress = | ||
'0x0000000000000000000000000000000000008006' as const | ||
export const contract2FactoryAddress = | ||
'0x0000000000000000000000000000000000010000' as const | ||
export const legacyEthAddress = | ||
@@ -5,0 +8,0 @@ '0x0000000000000000000000000000000000000000' as const |
@@ -56,2 +56,12 @@ import type { Address } from 'abitype' | ||
import { | ||
type GetL1TokenAddressParameters, | ||
type GetL1TokenAddressReturnType, | ||
getL1TokenAddress, | ||
} from '../actions/getL1TokenAddress.js' | ||
import { | ||
type GetL2TokenAddressParameters, | ||
type GetL2TokenAddressReturnType, | ||
getL2TokenAddress, | ||
} from '../actions/getL2TokenAddress.js' | ||
import { | ||
type GetLogProofParameters, | ||
@@ -415,2 +425,52 @@ type GetLogProofReturnType, | ||
getBaseTokenL1Address: () => Promise<GetBaseTokenL1AddressReturnType> | ||
/** | ||
* Returns the L2 token address equivalent for a L1 token address as they are not equal. | ||
* ETH address is set to zero address. | ||
* | ||
* @remarks Only works for tokens bridged on default ZKsync Era bridges. | ||
* | ||
* @param args - {@link GetL2TokenAddressParameters} | ||
* @returns The L2 token address equivalent for a L1 token address. | ||
* | ||
* @example | ||
* import { createPublicClient, http } from 'viem' | ||
* import { zksync } from 'viem/chains' | ||
* import { publicActionsL2 } from 'viem/zksync' | ||
* | ||
* const client = createPublicClient({ | ||
* chain: zksync, | ||
* transport: http(), | ||
* }).extend(publicActionsL2()) | ||
* | ||
* const address = await client.getL2TokenAddress({token: '0x...'}); | ||
*/ | ||
getL2TokenAddress: ( | ||
args: GetL2TokenAddressParameters, | ||
) => Promise<GetL2TokenAddressReturnType> | ||
/** | ||
* Returns the L1 token address equivalent for a L2 token address as they are not equal. | ||
* ETH address is set to zero address. | ||
* | ||
* @remarks Only works for tokens bridged on default ZKsync Era bridges. | ||
* | ||
* @param args - {@link GetL1TokenAddressParameters} | ||
* @returns The L1 token address equivalent for a L2 token address. | ||
* | ||
* @example | ||
* import { createPublicClient, http } from 'viem' | ||
* import { zksync } from 'viem/chains' | ||
* import { publicActionsL2 } from 'viem/zksync' | ||
* | ||
* const client = createPublicClient({ | ||
* chain: zksync, | ||
* transport: http(), | ||
* }).extend(publicActionsL2()) | ||
* | ||
* const address = await client.getL1TokenAddress({token: '0x...'}); | ||
*/ | ||
getL1TokenAddress: ( | ||
args: GetL1TokenAddressParameters, | ||
) => Promise<GetL1TokenAddressReturnType> | ||
} | ||
@@ -443,4 +503,6 @@ | ||
getBaseTokenL1Address: () => getBaseTokenL1Address(client), | ||
getL2TokenAddress: (args) => getL2TokenAddress(client, args), | ||
getL1TokenAddress: (args) => getL1TokenAddress(client, args), | ||
} | ||
} | ||
} |
@@ -122,2 +122,12 @@ // biome-ignore lint/performance/noBarrelFile: entrypoint module | ||
} from './actions/signTransaction.js' | ||
export { | ||
type GetL2TokenAddressReturnType, | ||
type GetL2TokenAddressParameters, | ||
getL2TokenAddress, | ||
} from './actions/getL2TokenAddress.js' | ||
export { | ||
type GetL1TokenAddressReturnType, | ||
type GetL1TokenAddressParameters, | ||
getL1TokenAddress, | ||
} from './actions/getL1TokenAddress.js' | ||
@@ -124,0 +134,0 @@ export { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
14095455
409717
7324
250936
22
61
7