Send Transaction combines signing and broadcasting in one step. For more control over when a transaction is broadcast, use Sign Transaction instead.
How it works
When your application requests to send a transaction:- Your app calls the send transaction method from the MoonKey SDK
- The Send Transaction screen appears, displaying transaction details
- User reviews the transaction information (recipient, amount, gas, etc.)
- User approves or rejects the transaction
- If approved, MoonKey signs the transaction with the user’s wallet
- MoonKey automatically broadcasts the signed transaction to the blockchain
- The transaction hash is returned to your application
Triggering the Send Transaction screen
Use theuseSendTransaction hook from the MoonKey SDK to trigger the Send Transaction screen:
- Ethereum
- Solana
Customizing the Send Transaction screen
You can customize the Send Transaction screen by passing UI configuration in theuiConfig object:
Configuration options
Basic UI Options
string
URL to your company logo. Displayed at the top of the Send Transaction screen.Example:
string
Custom title text displayed at the top of the Send Transaction screen.Example:
string
Custom description text displayed below the title, providing context for the transaction.Example:
string
Custom text for the confirm/send button.Default:
'Send'Example:string
Custom text for the cancel button.Default:
'Cancel'Example:boolean
Whether to show wallet information (address, balance) in the Send Transaction screen.Default:
trueExample:number
Time in milliseconds to wait before automatically closing the screen after a successful transaction.Default:
1500 (1.5 seconds)Example:Advanced Transaction Options
object
Configuration for the advanced transaction settings screen.
Success Screen Options
object
Configuration for the success screen displayed after the transaction is sent.
Failed Screen Options
object
Configuration for the error screen displayed if the transaction fails.
Common use cases
Simple ETH/SOL transfer
Send native currency to a recipient:Token transfer
Send ERC-20 or SPL tokens:NFT transfer
Transfer an NFT to another wallet:Mint NFT
Mint an NFT with payment:Contract interaction with gas estimation
Send a transaction with custom gas settings:Complete example
Here’s a complete example with transaction tracking:User experience flow
1
Trigger transaction
Your application calls
sendTransaction() with transaction data, wallet, and optional UI options.2
Send Transaction screen appears
The customized Send Transaction screen is displayed with transaction details.
3
Review transaction details
User reviews the transaction information including recipient, amount, gas fees, and any contract interactions.
4
Approve or reject
User clicks the send button to proceed, or cancels (if
isCancellable: true) to reject.5
Transaction signed and broadcast
If approved, MoonKey signs the transaction and automatically broadcasts it to the blockchain network.
6
Success screen
The success screen appears with the configured
successHeader and successDescription.7
Return transaction hash
The transaction hash (or signature for Solana) is returned to your application for tracking.
Send Transaction vs. Sign Transaction
Understanding when to use each:Send Transaction (this screen)
Send Transaction (this screen)
- Signs and broadcasts in one step
- Automatically submits to the blockchain
- Returns transaction hash immediately
- Simpler API for basic operations
- Best for immediate transactions
- User can’t control broadcast timing
- Most common for standard transfers
- Example: Send ETH, transfer tokens, mint NFTs
Sign Transaction
Sign Transaction
- Only signs the transaction
- Does not broadcast automatically
- Returns signed transaction data
- Requires manual broadcasting
- More control over when to broadcast
- Can sign offline
- Good for batch operations or complex flows
- Example: Multi-step flows, conditional broadcasting
Tracking transaction status
After sending a transaction, you typically want to track its confirmation status:- Ethereum
- Solana
Best practices
Show clear transaction details
Show clear transaction details
Always provide clear information about what the transaction does:
Validate inputs before sending
Validate inputs before sending
Check transaction validity before showing the UI:
Handle errors appropriately
Handle errors appropriately
Different errors require different handling:
Provide transaction tracking
Provide transaction tracking
Help users track their transaction:
Enable wallet UI for balance checks
Enable wallet UI for balance checks
Always show wallet UI so users can verify they have sufficient funds:
Set appropriate gas limits
Set appropriate gas limits
For complex transactions, set appropriate gas limits:
Store transaction history
Store transaction history
Keep a record of sent transactions for user reference:
Use descriptive success messages
Use descriptive success messages
Inform users about next steps:
Error handling
Common errors and how to handle them:Security considerations
For developers:- Validate all inputs - Check addresses, amounts, and data before sending
- Show full details - Display recipient, amount, gas fees, and contract interactions
- Estimate gas - Provide accurate gas estimates to prevent failed transactions
- Check balances - Verify sufficient funds before attempting to send
- Rate limit - Prevent abuse by limiting transaction frequency
- Log transactions - Keep records for debugging and support
- Handle errors - Provide clear error messages for different failure scenarios
- Displaying full transaction details before sending
- Showing wallet balance to prevent insufficient funds errors
- Providing clear context via title and description
- Allowing cancellation if
isCancellableis true - Showing success confirmation with transaction hash
Next steps
Sign Transaction
Sign transactions without broadcasting
Sign Message
Sign messages for authentication
UI Components Overview
Explore all UI components
Configure Appearance
Global appearance settings