Loading...
; - return ; - } - ``` + if (!authenticated) { + return ; + } - ### 4. Send Solana Transactions - - ```tsx - import { useAlchemySolanaTransaction } from "@account-kit/privy-integration/solana"; - - function SolanaButton() { - const { sendTransactionAsync, isPending } = useAlchemySolanaTransaction({ - rpcUrl: "https://solana-mainnet.g.alchemy.com/v2/your-api-key", - policyId: "your-solana-policy-id", // optional - }); - - const handleTransfer = async () => { - const result = await sendTransactionAsync({ - transfer: { - amount: 1_000_000_000, // 1 SOL in lamports - toAddress: "recipient-base58-address", - }, - }); - console.log("Transaction hash:", result.hash); - }; - - return ; - } - ``` - - ### Advanced: Access the Smart Wallet Client - - ```tsx - import { useAlchemyClient } from "@account-kit/privy-integration"; - - function Advanced() { - const { getClient } = useAlchemyClient(); - - const doOp = async () => { - const { client, account } = await getClient(); - await client.sendCalls({ - from: account.address, - calls: [{ to: "0x...", data: "0x" }], - capabilities: { eip7702Auth: true, paymasterService: { policyId: "your-policy-id" } }, - }); - }; - - return ; + return ( +Loading signer...
} +Loading...
; + + if (authState !== AuthState.Authenticated) { + return ; + } + + return ( +Loading signer...
} +- {embeddedWallet.address} -
-- You've successfully upgraded your EOA to a smart account and sent - your first sponsored transaction.{" "} - - Keep building - - . -
-- Transaction Hash:{" "} - {status.txHash} -
-- There was an error sending your sponsored transaction. Please try - again. -
-