Hope
Hope Wallet SDK

Docs

Connect

connect() and VerifyWalletPanel — get a hope1 address without collecting a mnemonic.

import { connect, createHttpTransport } from '@hopenetwork/wallet';
import { VerifyWalletPanel } from '@hopenetwork/wallet/react';

const origin = { name: 'My App', url: window.location.origin };
const transport = createHttpTransport({
  baseUrl: `${origin.url}/api/hope-wallet`,
});

const { address, pubkeyBase64 } = await connect({
  origin,
  chainId: 'hope-testnet-2',
  transport,
  relayUrl: true,
});

React: <VerifyWalletPanel origin={…} chainId="hope-testnet-2" transport={transport} relayUrl={true} onVerified={…} />

Use connect when you only need the wallet identity:

  • account address
  • pubkey
  • proof that Hope Wallet approved the session

relayUrl: true → Hope Wallet POSTs proof to {origin}/api/hope-wallet/sessions/{id}/confirm. That origin must be HTTPS (http only on localhost) and the same origin as the page.

Apps already on Explorer Supabase can use createSupabaseTransport and omit relayUrl (hope_wallet_link_* RPCs).

Confirm body — validate with parseWalletProof:

{ "session_id": "cs_…", "address": "hope1…", "pubkey_base64": "…" }

Server checklist:

  • create a session row on POST /api/hope-wallet/sessions
  • return the current row on GET /api/hope-wallet/sessions/:id
  • mark it cancelled on DELETE /api/hope-wallet/sessions/:id
  • accept the wallet proof on POST /api/hope-wallet/sessions/:id/confirm
  • persist sessions in Redis / KV / DB, not process memory, if you run multiple instances

In-app (Hope Wallet WebView) uses a native overlay instead of the camera. On a phone browser, scan the QR or tap Open Hope Wallet. The SDK does not auto-open hopewallet:// (that remounts Discord/Safari and replaces the cs_… session). Concurrent connect() calls reuse one pending session until it settles.

Choose one transport:

  • createHttpTransport(...): your app owns the session endpoints
  • createSupabaseTransport(...): use Explorer-style pairing RPCs instead of your own HTTP session store

See sessions and try Wallet lab.