Mobile work-around
Classic Paymaster implementation (not compatible with all wallets):
// Paymaster Data received from Zyfi's API
const pmData = await submitTxDataToAPI(API_URL, dataTxRequest)
// Extend wallet client to support paymaster transactions
const wClient = walletClient.extend(eip712WalletActions())
// Prepare transaction request
const txReq = await wClient.prepareTransactionRequest({
account: address,
to: toAddress,
value: ETH_AMOUNT,
chain: zkSync,
gas: BigInt(pmData.gasLimit),
gasPerPubdata: BigInt(pmData.txData.customData.gasPerPubdata),
maxFeePerGas: BigInt(pmData.txData.maxFeePerGas),
maxPriorityFeePerGas: 0n,
data: pmData.txData.data,
paymaster: pmData.txData.customData.paymasterParams.paymaster,
paymasterInput: pmData.txData.customData.paymasterParams.paymasterInput,
})
// Signs and sends to an endpoint that might be incompatible with eth_sendRawTransaction
const hash = await wClient.sendTransaction(txReq)Work-around Paymaster Implementation (Works with all wallets)
Last updated