Using Privy Auth in Demo App
This section details the core technologies, smart contracts, and SDKs used in the demo so you can create your own custom interface.
Key Libraries and SDKs
startale-aa-sdk
: Instantiate and manage Startale smart accountsviem
: EVM interaction from TypeScript@privy-io/react-auth
: Privy social login features
Contract Addresses and URLs
# Entrypoint
ENTRY_POINT_ADDRESS=0x0000000071727De22E5E9d8BAf0edAc6f37da032
# Infra
MINATO_RPC=https://rpc.minato.soneium.org
BUNDLER_URL=https://soneium-minato.bundler.scs.startale.com?apikey=[API_KEY]
PAYMASTER_SERVICE_URL=https://paymaster.scs.startale.com/v1?apikey=[API_KEY]
---
## Custom Implementation Steps
### 1. Wrap Your App in `PrivyProvider`
```tsx
<PrivyProvider
appId="[YOUR_APP_ID]"
config={{
loginMethods: ["email", "google", "wallet"],
appearance: {
theme: "light",
accentColor: "#676FFF",
},
embeddedWallets: {
createOnLogin: "all-users",
showWalletUIs: false,
},
supportedChains: [soneiumMinato],
defaultChain: soneiumMinato,
}}
>
2. Initialise Clients
import { createBundlerClient, createPaymasterClient } from "viem/account-abstraction";
import { soneiumMinato } from "viem/chains";
import {
createPublicClient,
encodeFunctionData,
http,
} from "viem";
const chain = soneiumMinato;
const publicClient = createPublicClient({
transport: http(MINATO_RPC),
chain,
});
const bundlerClient = createBundlerClient({
client: publicClient,
transport: http(BUNDLER_URL),
});
const paymasterClient = createPaymasterClient({
transport: http(PAYMASTER_SERVICE_URL),
});
3. Create a Smart Account instance using signer from Privy
import {
createSmartAccountClient,
toStartaleSmartAccount,
} from "startale-aa-sdk";
// Convert Privy wallet instance into a Viem wallet client
const provider = await wallets[0].getEthereumProvider();
const walletClient = createWalletClient({
account: wallets[0].address as `0x${string}`,
chain: soneiumMinato,
transport: custom(provider),
});
const startaleAccountInstance = await toStartaleSmartAccount({
signer: walletClient,
chain,
transport: http(),
index: BigInt(0),
});
const scsContext = { calculateGasLimits: false, policyId: "sudo" };
// Note: You can use paymaster here by providing paymaster client and paymaster context as args below.
const startaleAccountClientInstance = createSmartAccountClient({
account: startaleAccountInstance,
transport: http(BUNDLER_URL),
client: publicClient
});
4. Use the Smart Account APIs
const smartAccountAddress = startaleAccount.address
// startaleAccountClient.sendUserOperation.. and so on
Resources
Useful links for integrating Dynamic into your Account Abstraction dApps: