Skip to content

Examples

These examples are short paths you can copy into an application. Start with the provider setup, register or unlock a wallet, then choose the operation your product needs.

Prerequisites

Install the SDK and configure the wallet origin, relayer, and registration environment variables used by your app.

sh
pnpm add @seams/sdk
tsx
import { SeamsWebProvider, useSeams, type SeamsConfigsInput } from '@seams/sdk/react';

const seamsConfig = {
  iframeWallet: {
    walletOrigin: import.meta.env.VITE_WALLET_ORIGIN,
    walletServicePath: '/wallet-service',
    sdkBasePath: '/sdk',
  },
  relayerAccount: 'w3a-relayer.testnet',
  relayer: {
    url: import.meta.env.VITE_RELAYER_URL,
  },
  registration: {
    mode: 'managed',
    projectEnvironmentId: import.meta.env.VITE_SEAMS_PROJECT_ENVIRONMENT_ID,
    publishableKey: import.meta.env.VITE_SEAMS_PUBLISHABLE_KEY,
  },
  chains: [
    {
      network: 'near-testnet',
      rpcUrl: 'https://rpc.testnet.near.org',
      explorerUrl: 'https://testnet.nearblocks.io',
    },
  ],
} satisfies SeamsConfigsInput;

function WalletApp() {
  const { loginState } = useSeams();
  return <p>{loginState.isLoggedIn ? 'Wallet unlocked' : 'Wallet locked'}</p>;
}

export function App() {
  return (
    <SeamsWebProvider config={seamsConfig}>
      <WalletApp />
    </SeamsWebProvider>
  );
}

The setup example keeps the provider at the application boundary. Render your wallet UI inside SeamsWebProvider, then pass the seams instance and the wallet identity into the operation examples.

Choose an example

How to use the snippets

The <<< blocks import the canonical TypeScript examples from this directory. Copy the function or component you need, then connect it to your own UI and error reporting. Values such as walletId, nearAccountId, and Google ID tokens come from your authenticated application state.

Every flow returns a typed success or failure result, or reports progress with an event callback. Keep the branch handling in the examples when adapting them so cancellation, policy denial, and expired sessions remain recoverable.

Continue building