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>
}| Prop | Type | Required | Description |
|---|---|---|---|
config | WalletConnectKitConfig | Yes | SDK configuration |
children | React.ReactNode | Yes | React 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 }} />
}| Prop | Type | Required | Description |
|---|---|---|---|
className | string | No | CSS class for the wrapper |
style | React.CSSProperties | No | Inline 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()| Field | Type | Description |
|---|---|---|
isOpenModal | boolean | Whether the SDK modal is open |
connectionStatus | ConnectionStatus | "disconnected", "connecting", or "connected" |
isConnected | boolean | Whether a wallet is connected |
isConnecting | boolean | Whether a connection attempt is active |
isDisconnected | boolean | Whether no wallet is connected |
error | string | Last connection/action error message |
walletStatus | WalletStatus | Embedded wallet lifecycle state |
isWalletReady | boolean | walletStatus === "ready" |
isWalletLoading | boolean | walletStatus === "initializing" |
connect | (variables: ConnectVariables) => Promise<ConnectData> | Advanced runtime connector flow |
disconnect | () => Promise<void> | Disconnect active wallet |
openModal | () => void | Open the SDK modal |
closeModal | () => void | Close 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()| Field | Type | Description |
|---|---|---|
address | string | Connected account address |
chainType | ChainType | undefined | Active chain family |
chainId | string | undefined | Active chain ID |
currentWallet | Connector | null | Connected wallet object |
currentProvider | UseAccount["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()| Field | Type | Description |
|---|---|---|
connectors | ConnectorProviders | null | Current wallet provider map |
currentProvider | UseAccount["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"