Send transactions with Passport
Learn how to send blockchain transactions using Immutable Passport in your Unreal game.
Overview
Passport provides two methods for sending transactions on zkEVM:
- ZkEvmSendTransactionWithConfirmation (Recommended) - Waits for transaction confirmation
- ZkEvmSendTransaction - Returns immediately with transaction hash
Prerequisites
- The zkEVM send transaction requires pre-approval.
- Must have first called
ConnectEvm
to set up the zkEVM provider andZkEvmRequestAccounts
to login the user.
Implementation
To send a transaction on zkEVM, use UImmutablePassport::ZkEvmSendTransaction
or UImmutablePassport::ZkEvmSendTransactionWithConfirmation
methods. You need to provide three parameters:
to
: The destination addressvalue
: The value to transfer for the transaction in weidata
: Byte string containing the associated data of the message
gas
, gasPrice
, maxPriorityFeePerGas
, or maxFeePerGas
properties as the relayer abstracts these away from the user. Additionally, the from
property is not supported as the user's Passport wallet address is used instead.- (Recommended) With Confirmation
- Without Confirmation
Sends a transaction to the network, signs it using the logged-in Passport account, and waits for the transaction to be included in a block.
Sends a transaction to the network and signs it using the logged-in Passport account.
ZkEvmGetTransactionReceipt
along with the transaction hash received.In cases where the transaction is still being processed, ZkEvmGetTransactionReceipt
returns no receipt data. Once the transaction is processed, ZkEvmGetTransactionReceipt
returns receipt data with a status of 0x1 (success) or 0x0 (failure).
See here for more details.
Related Methods
- ZkEvmGetBalance - Gets the balance of the given address in wei
- ZkEvmGetTransactionReceipt - Retrieves transaction information for a given transaction hash
Next Steps
After sending transactions, you might want to:
- Sign typed data for message verification
- Check the API Reference for additional blockchain methods