Privy Integration (Aptos)
Privy handles auth + Ed25519 wallet creation. SmoothSend handles fee-payer sponsorship. Your users get gasless Aptos transactions without downloading any wallet.
Aptos natively supports sponsored transactions (fee-payer model). No bundlers, no UserOps, no paymaster contracts.
- Your hook builds the transaction with
withFeePayer: true - Privy signs the sender portion (Ed25519)
- SmoothSend relayer adds fee-payer signature and submits to Aptos
This is simpler than the AVAX flow — Aptos has native gas sponsorship built into the protocol.
npm install @smoothsend/sdk @privy-io/react-auth @aptos-labs/ts-sdk
1import { PrivyProvider } from '@privy-io/react-auth';2import { SmoothSendAptosProvider } from '@smoothsend/sdk/aptos';3 4export function Providers({ children }: { children: React.ReactNode }) {5 return (6 <PrivyProvider7 appId={process.env.NEXT_PUBLIC_PRIVY_APP_ID!}8 config={{9 embeddedWallets: {10 ethereum: { createOnLogin: 'users-without-wallets' },11 },12 }}13 >14 <SmoothSendAptosProvider15 apiKey={process.env.NEXT_PUBLIC_SMOOTHSEND_API_KEY!}16 // network defaults to "testnet"; set "mainnet" for production17 >18 {children}19 </SmoothSendAptosProvider>20 </PrivyProvider>21 );22}useSmoothSendPrivyWrite from @smoothsend/sdk/aptos. Every submitTransaction call goes through SmoothSend — gas is free.1import { useSmoothSendPrivyWrite } from '@smoothsend/sdk/aptos';2import { usePrivy } from '@privy-io/react-auth';3import { toHex } from 'viem';4 5function GaslessButton() {6 const { user, signMessage } = usePrivy();7 8 // Privy creates an Aptos wallet with Ed25519 keys9 const aptosWallet = user?.linkedAccounts?.find(10 (a) => a.type === 'wallet' && a.chainType === 'aptos'11 );12 13 const { submitTransaction, isPending } = useSmoothSendPrivyWrite({14 publicKey: aptosWallet?.publicKey ?? '',15 address: aptosWallet?.address ?? '',16 signTransaction: async ({ message }) => {17 // Privy signs the raw transaction bytes18 const sig = await signMessage(toHex(message));19 return sig;20 },21 });22 23 return (24 <button25 disabled={isPending || !aptosWallet}26 onClick={() =>27 submitTransaction({28 function: '0x1::coin::transfer',29 typeArguments: ['0x1::aptos_coin::AptosCoin'],30 functionArguments: ['0xRecipientAddress', 100],31 })32 }33 >34 {isPending ? 'Sponsoring...' : 'Send Gasless'}35 </button>36 );37}apiKey is required on SmoothSendAptosProvider. network is optional and defaults to "testnet".
Privy Aptos wallets use Ed25519 keys. publicKey must be the 32-byte hex key from wallet.public_key.
No relayer or gateway changes needed — the hook uses the same /api/v1/relayer/gasless-transaction endpoint as the standard Wallet Adapter integration.
All transactions are developer-sponsored (gasless). The Aptos fee-payer model does not have a user-pays-ERC20 equivalent — the developer always pays APT gas via SmoothSend credits.