The Universal Accounts SDK supports buy/swap transactions directly through theDocumentation Index
Fetch the complete documentation index at: https://developers.particle.network/llms.txt
Use this file to discover all available pages before exploring further.
createBuyTransaction() method. This allows you to programmatically route an amount in USD into a target token (e.g., USDT on Arbitrum), without requiring the user to hold funds on the destination chain.
Once the transaction is created, it returns a rootHash value representing the payload to be signed. You then use your signer (in this case, Particle Auth) to sign the message, and pass the result into sendTransaction() to broadcast it:
You can specify the specific tokens you want to use as source for the swap by setting the
usePrimaryTokens property in the tradeConfig object when initializing the Universal Account.sendTransaction method will then return a TransactionResult object, which includes the transaction ID and other metadata.
Sample Swap Transaction
See how to initiate a swap transaction in a demo Next.js app using both Particle Auth and Universal Accounts.
Next steps
Sell Transaction
createSellTransaction() — sell a token into a primary asset.Conversion Transaction
createConvertTransaction() — convert between primary assets.