SDK PLAYGROUND
INTERACTIVE DEV ENVIRONMENT
PROTOCOL 25
X-RAY
PLAYGROUND.TS
1import { createWallet } from '@stellar-zklogin/sdk';23// Create wallet instance4const wallet = createWallet({5 appName: 'My dApp',6 network: 'testnet',7 oauthClients: {8 google: 'YOUR_GOOGLE_CLIENT_ID'9 }10});1112// Step 1: Initialize session13const { nonce } = await wallet.initializeSession();14console.log('Session nonce:', nonce);1516// Step 2: Redirect to Google OAuth17const authUrl = wallet.getAuthorizationUrl('google', redirectUri);18window.location.href = authUrl;1920// Step 3: After OAuth callback21await wallet.completeOAuth('google', code, redirectUri);2223// Step 4: Compute wallet address24await wallet.computeAddress();25console.log('Wallet:', wallet.getAddress());26console.log('Balance:', await wallet.getBalance());
CONSOLE.LOG
// StellaRay SDK Playground
// Select a snippet and click RUN to execute
// Or press Ctrl+Enter