Populates missing properties meant for signing using an ECDSA private key:
from
nonce
provider.getTransactionCount(tx.from, "pending")
gasLimit
provider.estimateGas(tx)
tx.from
chainId
provider.getNetwork()
type
utils.EIP712_TX_TYPE
value
bigint
0n
data
0x
customData
{factoryDeps=[], gasPerPubdata=utils.DEFAULT_GAS_PER_PUBDATA_LIMIT}
Requires provider to be set.
provider
import { populateTransactionECDSA, types, Web3ZKsyncL2 } from "web3-plugin-zksync";const PRIVATE_KEY = "<PRIVATE_KEY>";const provider = Web3ZKsyncL2.initWithDefaultProvider(types.Network.Sepolia);const populatedTx = populateTransactionECDSA( { chainId: 270, to: "<RECEIVER>", value: 7_000_000_000, }, PRIVATE_KEY, provider); Copy
import { populateTransactionECDSA, types, Web3ZKsyncL2 } from "web3-plugin-zksync";const PRIVATE_KEY = "<PRIVATE_KEY>";const provider = Web3ZKsyncL2.initWithDefaultProvider(types.Network.Sepolia);const populatedTx = populateTransactionECDSA( { chainId: 270, to: "<RECEIVER>", value: 7_000_000_000, }, PRIVATE_KEY, provider);
Optional
The ECDSA private key used for populating the transaction.
The provider is used to fetch data from the network if it is required for signing.
Populates missing properties meant for signing using an ECDSA private key:
fromusing the address derived from the ECDSA private key.nonceviaprovider.getTransactionCount(tx.from, "pending").gasLimitviaprovider.estimateGas(tx). Iftx.fromis not EOA, the estimation is done with address derived from the ECDSA private key.chainIdviaprovider.getNetwork().typewithutils.EIP712_TX_TYPE.valueby converting tobigintif set, otherwise to0n.datawith0x.customDatawith{factoryDeps=[], gasPerPubdata=utils.DEFAULT_GAS_PER_PUBDATA_LIMIT}.Throws
Requires
providerto be set.Example