Use this file to discover all available pages before exploring further.
The following example uses Particle Connect instead of Particle Auth. It shows how to sign and send a Universal Account transaction using a connected wallet.
When using Particle Connect, you can access the connected wallet through the useWallets() hook. The primaryWallet object exposes a walletClient, which acts as the signer.This lets you sign the Universal Account transaction payload (rootHash) using any wallet connected via Particle Connect.The following code snippet shows how to use the Universal Accounts SDK to sign a transaction with Particle Connect:
import { useWallets, useAccount } from "@particle-network/connectkit";import { CHAIN_ID } from "@particle-network/universal-account-sdk";// Get wallet from Particle Connectconst [primaryWallet] = useWallets();const walletClient = primaryWallet?.getWalletClient();const { address } = useAccount();// Create a cross-chain transfer transaction via Universal Accountsconst transaction = await ua.createTransferTransaction({ token: { chainId: CHAIN_ID.ARBITRUM_MAINNET_ONE, address: "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9", // USDT on Arbitrum }, amount: "0.1", // Amount to send (human-readable string) receiver: receiverAddress, // Target address});// Sign the transaction's root hash using connected walletconst signature = await walletClient?.signMessage({ account: address as `0x${string}`, message: { raw: transaction.rootHash },});// Send the signed transaction via Universal Account SDKconst sendResult = await universalAccount.sendTransaction( transaction, signature);// Log UniversalX explorer linkconsole.log( "Explorer URL:", `https://universalx.app/activity/details?id=${sendResult.transactionId}`);