Skip to main content

Connect browser wallets

For vanilla TypeScript apps, call the wallet extension APIs directly.

Keplr: suggest chain

Full JSON lives in Testnet endpoints. Minimal flow:

declare global {
interface Window {
keplr?: { experimentalSuggestChain: (c: unknown) => Promise<void>; enable: (id: string) => Promise<void> };
getOfflineSigner?: (chainId: string) => import('@cosmjs/proto-signing').OfflineSigner;
}
}

const safroTestnetChainInfo = {
chainId: 'safro-testnet-1',
chainName: 'Safrochain Testnet',
rpc: 'https://rpc.testnet.safrochain.com',
rest: 'https://rest.testnet.safrochain.com',
stakeCurrency: { coinDenom: 'SAF', coinMinimalDenom: 'usaf', coinDecimals: 6 },
bech32Config: {
bech32PrefixAccAddr: 'addr_safro',
bech32PrefixAccPub: 'addr_safropub',
bech32PrefixValAddr: 'addr_safrovaloper',
bech32PrefixValPub: 'addr_safrovaloperpub',
bech32PrefixConsAddr: 'addr_safrovalcons',
bech32PrefixConsPub: 'addr_safrovalconspub',
},
currencies: [{ coinDenom: 'SAF', coinMinimalDenom: 'usaf', coinDecimals: 6 }],
feeCurrencies: [{
coinDenom: 'SAF',
coinMinimalDenom: 'usaf',
coinDecimals: 6,
gasPriceStep: { low: 0.05, average: 0.0625, high: 0.075 },
}],
coinType: 118,
};

await window.keplr!.experimentalSuggestChain(safroTestnetChainInfo);
await window.keplr!.enable('safro-testnet-1');
const offlineSigner = window.getOfflineSigner!('safro-testnet-1');

Leap uses window.leap with the same chain object.

CORS and gas

  • Public RPC/REST endpoints allow browser wallets (see mainnet endpoints).
  • Set gasPriceStep low/average/high to 0.05 / 0.0625 / 0.075 usaf.

Next steps