Skip to main content

@mindwallet/core

Protocol-agnostic selection pipeline, wallet interface, state management, and HTTP adapter.

Key Exports

ExportDescription
WalletAdapterInterface for signing operations
OwsWalletAdapterOWS vault-backed wallet
PrivateKeyWalletAdapterRaw private key wallet (viem)
createRouterCreates a MindRouter from methods + state + policy
createMemoryStoreIn-memory RouterStateStore
wrapFetchWraps fetch() with automatic 402 handling
createPolicyEngineEvaluates policy rules against candidates

WalletAdapter Interface

interface WalletAdapter {
sign(request: SignRequest): Promise<string>;
signMessage(request: MessageRequest): Promise<string>;
getAccount(walletId: string, chainId: string): Promise<WalletAccount>;
canSign(chainId: string): Promise<boolean>;
}

wrapFetch

const paidFetch = wrapFetch({
fetch: globalThis.fetch,
router,
state,
wallet,
});

// Automatically handles 402 responses
const response = await paidFetch('https://paid-api.example.com/data');