UNPKG

accounts

Version:

Tempo Accounts SDK

73 lines 3.33 kB
import * as Adapter from '../../Adapter.js'; import type * as Keystore from '../../Keystore.js'; /** * Builds an adapter that forwards wallet RPC to a remote wallet through a * single request function. * * Shared core for adapters whose wallet lives behind a request/response * session (e.g. Wata mobile web auth or postMessage). Access keys are * generated locally; every other wallet action round-trips through * `request`. */ export declare function fromRequest(options: fromRequest.Options): Adapter.Adapter; export declare namespace fromRequest { /** Options for {@link fromRequest}. */ type Options = { /** * Adapter-specific action overrides layered over the request-forwarding * defaults. Receives the request channel plus the adapter's client and * store for actions that need local bookkeeping around an exchange. */ actions?: ((context: { getClient: Adapter.SetupFn.Parameters['getClient']; request: Options['request']; store: Adapter.SetupFn.Parameters['store']; }) => Partial<Adapter.Instance['actions']>) | undefined; /** * Called once during setup with the adapter's store, for late wiring * that needs to mutate local state (e.g. reconciling connection state * from a wallet `accountsChanged` notification on the request channel). */ bind?: ((context: { store: Adapter.SetupFn.Parameters['store']; }) => void) | undefined; /** * Tears down adapter-owned resources (sessions, mounted UI) when the * provider discards the adapter instance. @default `close`, when set. */ cleanup?: (() => void) | undefined; /** Data URI of the provider icon, announced via EIP-6963. */ icon?: Adapter.Meta['icon'] | undefined; /** * Default keystores backing locally generated access keys. Omit to use * the SDK default (non-extractable `webCryptoP256`). Pass an explicit * keystore where the transport's environment needs one — e.g. pure-JS * P-256 for React Native, which may lack WebCrypto and persists access * keys through string-based storage. */ keystores?: Keystore.Keystores | undefined; /** * Tears down the adapter's wallet session. Wired to the `disconnect` * action and instance cleanup; never forwarded to the remote wallet. * Omit for single-exchange transports with no session to clean up. */ close?: (() => Promise<void>) | undefined; /** Provider display name. */ name: string; /** Reverse-DNS provider identifier. */ rdns: string; /** Forwards a single wallet JSON-RPC request to the remote wallet. */ request: (request: { /** JSON-RPC method name. */ method: string; /** JSON-RPC params. */ params?: readonly unknown[] | undefined; /** Session selectors (active account + chain) for the wallet to act on. */ context?: { account?: string | undefined; chainId?: number | undefined; } | undefined; }) => Promise<unknown>; }; } //# sourceMappingURL=fromRequest.d.ts.map