Google OAuth-based account abstraction SDK for Sphere wallets
npm install sphere-connect@sphere/connect is a developer-first SDK that enables users to create and restore secure, non-custodial wallets using their existing Google accounts. By leveraging deterministic key derivation and session-bound ephemeral keys, it provides an enterprise-grade onboarding experience without the complexity of seed phrases.
SphereModal.
bash
npm install sphere-connect
`
$3
Set up your SDK configuration with your Google Client ID and optional redirect URI.
`typescript
// src/config/sphere.ts
export const SPHERE_CONFIG = {
network: 'testnet', // or 'mainnet'
googleClientId: 'YOUR_GOOGLE_CLIENT_ID.apps.googleusercontent.com',
redirectUri: window.location.origin + '/callback', // Optional for redirect flow
};
`
$3
Wrap your application with the SphereProvider.
`tsx
import { SphereProvider } from '@sphere/connect';
import { SPHERE_CONFIG } from './config/sphere';
export default function App() {
return (
);
}
`
$3
Use the SphereModal or the useSphere hook to initiate a connection.
`tsx
import { useSphere, SphereModal } from '@sphere/connect';
function LoginButton() {
const [isOpen, setIsOpen] = useState(false);
const { isAuthenticated, wallet } = useSphere();
if (isAuthenticated) {
return Connected: {wallet.getAddress()};
}
return (
<>
setIsOpen(false)} />
>
);
}
``