Skip to Content
On this page

This page documents the public runtime exports from @dogeos/dogeos-sdk.

Components#

WalletConnectProvider#

Wraps your app with wallet connection state, the connection modal, and embedded wallet login. Uses DogeOS production services with your registered client ID.

import { WalletConnectProvider } from "@dogeos/dogeos-sdk" import "@dogeos/dogeos-sdk/style.css" export function Providers({ children }: { children: React.ReactNode }) { return <WalletConnectProvider config={{ clientId: "YOUR_DOGEOS_CLIENT_ID" }}>{children}</WalletConnectProvider> }
PropTypeRequiredDescription
configWalletConnectKitConfigYesSDK configuration
childrenReact.ReactNodeYesReact subtree to wrap

The provider is browser-only. Use a client component in SSR frameworks.

WalletConnectEmbed#

Renders the SDK wallet UI inline instead of as a modal overlay.

import { WalletConnectEmbed } from "@dogeos/dogeos-sdk" export function WalletPanel() { return <WalletConnectEmbed className="wallet-embed" style={{ maxWidth: 448 }} /> }
PropTypeRequiredDescription
classNamestringNoCSS class for the wrapper
styleReact.CSSPropertiesNoInline wrapper styles

WalletConnectEmbed must render inside WalletConnectProvider. When connected, it renders the account view. Otherwise, it renders the current wallet modal view inline.

Hooks#

useWalletConnect#

Controls modal state, connection state, embedded-wallet readiness, connect, and disconnect.

import { useWalletConnect } from "@dogeos/dogeos-sdk" const { isOpenModal, connectionStatus, isConnected, isConnecting, isDisconnected, error, walletStatus, isWalletReady, isWalletLoading, connect, disconnect, openModal, closeModal, } = useWalletConnect()
FieldTypeDescription
isOpenModalbooleanWhether the SDK modal is open
connectionStatusConnectionStatus"disconnected", "connecting", or "connected"
isConnectedbooleanWhether a wallet is connected
isConnectingbooleanWhether a connection attempt is active
isDisconnectedbooleanWhether no wallet is connected
errorstringLast connection/action error message
walletStatusWalletStatusEmbedded wallet lifecycle state
isWalletReadybooleanwalletStatus === "ready"
isWalletLoadingbooleanwalletStatus === "initializing"
connect(variables: ConnectVariables) => Promise<ConnectData>Advanced runtime connector flow
disconnect() => Promise<void>Disconnect active wallet
openModal() => voidOpen the SDK modal
closeModal() => voidClose the SDK modal
import { useWalletConnect } from "@dogeos/dogeos-sdk" export function ConnectButton() { const { isConnected, isConnecting, openModal, disconnect } = useWalletConnect() return ( <button disabled={isConnecting} onClick={isConnected ? disconnect : openModal}> {isConnected ? "Disconnect" : "Connect wallet"} </button> ) }

connect() expects a live WalletConnector. Do not pass WalletConfig objects returned from getConnectors().

useAccount#

Use these fields for active account identity and account actions. Read live balances through currentProvider as shown in Core Workflows.

import { useAccount } from "@dogeos/dogeos-sdk" const { address, chainType, chainId, currentWallet, currentProvider, switchChain, signMessage, signInWithWallet } = useAccount()
FieldTypeDescription
addressstringConnected account address
chainTypeChainType | undefinedActive chain family
chainIdstring | undefinedActive chain ID
currentWalletConnector | nullConnected wallet object
currentProviderUseAccount["currentProvider"]Provider for the active chain type
switchChain(options: SwitchChainOptions) => Promise<boolean>Switch or add a chain
signMessage(params: { message: string; nonce?: string }) => Promise<string | Uint8Array>Sign a message
signInWithWallet(params?: SignInParams) => Promise<string | Uint8Array>Sign a wallet-auth payload
import { useAccount } from "@dogeos/dogeos-sdk" export function AccountAddress() { const { address, chainType, chainId } = useAccount() if (!address) return <span>Not connected</span> return ( <span> {address.slice(0, 6)}...{address.slice(-4)} on {chainType}:{chainId} </span> ) }

signMessage() and signInWithWallet() throw if no wallet is connected.

useConnectors#

Returns connector providers from the current wallet.

import { useConnectors } from "@dogeos/dogeos-sdk" const { connectors, currentProvider } = useConnectors()
FieldTypeDescription
connectorsConnectorProviders | nullCurrent wallet provider map
currentProviderUseAccount["currentProvider"]Active provider from useAccount()
import { useConnectors } from "@dogeos/dogeos-sdk" export function ConnectorFamilies() { const { connectors } = useConnectors() return ( <pre> {JSON.stringify( { evm: Boolean(connectors?.evm), solana: Boolean(connectors?.solana), dogecoin: Boolean(connectors?.dogecoin), }, null, 2 )} </pre> ) }

useEmbeddedWallet#

Deprecated. This hook is still exported for backward compatibility, but embedded wallet state is now treated as internal. Use useWalletConnect() for readiness fields.

const { walletStatus, isWalletReady, isWalletLoading } = useWalletConnect()

Helpers#

getChains#

Loads chain configuration from the DogeOS chain service. The promise rejects if the request fails or returns no chains; handle the error and offer a retry if you load configuration yourself.

import { getChains } from "@dogeos/dogeos-sdk" const chains = await getChains()

Signature:

function getChains(): Promise<Partial<Record<ChainType, EvmChain[] | Chain[]>>>

The returned object can be passed to WalletConnectKitConfig.chains.

getConnectors#

Loads wallet connector configuration through the SDK adapter layer.

import { getConnectors } from "@dogeos/dogeos-sdk" const connectors = await getConnectors()

Signature:

function getConnectors(): Promise<WalletConfig[]>

The returned array can be passed to WalletConnectKitConfig.connectors. If loading fails, the promise rejects. Handle the error and offer a retry when you call this helper yourself. Standard integrations can let WalletConnectProvider load connectors automatically.

Constants and Types#

ChainTypeEnum#

Enum exported from the underlying wallet utilities.

import { ChainTypeEnum } from "@dogeos/dogeos-sdk" connect({ wallet, chainType: ChainTypeEnum.EVM })

Use the enum for typed chainType and defaultConnectChain values.

WalletProvider#

Describes wallet provider objects. For the precise type returned by useAccount(), use UseAccount["currentProvider"]. Methods available at runtime depend on the connected wallet and chain family.

import type { WalletProvider } from "@dogeos/dogeos-sdk"

Export Summary#

import { ChainTypeEnum, WalletConnectEmbed, WalletConnectProvider, getChains, getConnectors, useAccount, useConnectors, useWalletConnect, } from "@dogeos/dogeos-sdk" import type { Chain, ChainType, ConnectData, ConnectVariables, SignInParams, WalletConnectKitConfig, WalletProvider, } from "@dogeos/dogeos-sdk"