• Resolve a service from the global context.

    This is the simplest way to access services without dependency on any specific framework. Works in Node.js, Deno, Bun, and browsers.

    Type Parameters

    • T

      The service type.

    Parameters

    Returns T

    The resolved service instance.

    If no context is set.

    If the token is not registered.

    1.2.0

    import { useService, Tokens } from '@oobe-protocol-labs/synapse-client-sdk/context';

    const rpc = useService(Tokens.RPC);
    const balance = await rpc.getBalance(pubkey);