Skip to main content
The Universal Accounts SDK supports powerful cross-chain execution through 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.
In this example, we use it to convert any Primary Asset into a specific Primary Asset on any supported chain—with no bridges or manual steps, essentially creating a conversion transaction. This is ideal for use cases like topping up gas on a new chain, funding transactions in a required token, or consolidating assets into a preferred currency.

Creating a Custom Universal Transaction

To initiate a cross-chain transaction, use createUniversalTransaction() with the following parameters:
  • chainId: the destination chain where the asset should be made available
  • expectTokens: a list of expected tokens and amounts you want to receive on the destination chain
  • transactions (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.
The following snippet shows how to create a conversion transaction:
page.tsx
This method constructs a cross-chain execution plan that:
  • 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 createUniversalTransaction

Sending 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 with ethers.js:
Once signed and submitted, the transaction will execute on the destination chain, completing any asset conversions. The resulting tokens will be available in the user’s Universal Account balance.
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 complete TSX 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 createUniversalTransaction

Supported Primary Assets

View all Primary Assets and chains supported for conversion