createUniversalTransaction().
This method ensures that a specified Primary Asset is made available on a destination chain—by sourcing and converting any supported Primary Asset from the user’s Universal Account, regardless of where they’re held.
Creating a Custom Universal Transaction
To initiate a cross-chain transaction, usecreateUniversalTransaction() with the following parameters:
chainId: the destination chain where the asset should be made availableexpectTokens: a list of expected tokens and amounts you want to receive on the destination chaintransactions(optional): an array of follow-up actions to execute after the conversion (e.g., contract interactions). When empty, the converted tokens are sent back to the Universal Account.
Check out the Quickstart to learn how to set up Universal Accounts in your app.
page.tsx
- Detects available assets across all chains within the Universal Account
- Calculates the optimal conversion path to fulfill the expectTokens requirement
If the user doesn’t have the expected token on the destination chain, the SDK will automatically convert and route value from other chains or tokens they hold—fully abstracted from the user.
Find more details about custom Universal Transactions
See full SDK reference for
createUniversalTransactionSending the Transaction
Once the transaction object is built, the next step is to have the user sign it and submit it for execution. The returned transaction object includes important metadata, including the rootHash, which the user must sign to authorize the transaction. Here’s how you can sign and send the transaction using a browser wallet withethers.js:
To learn how to display transaction previews before user confirmation, see the Previewing Transaction Details guide.For handling the response after sending a transaction, refer to the Send Transaction Response Structure in the SDK reference.
Full Conversion Widget
The following is a completeTSX component that implements the conversion flow.
This is a simple version and allows the user to convert any Primary Asset they hold into USDC on Base or Arbitrum.
SimpleConversionWidget.tsx
What’s Next?
SDK Reference
See full API for
createUniversalTransactionSupported Primary Assets
View all Primary Assets and chains supported for conversion
