import type { Messenger } from "@metamask/messenger"; import { ApiPlatformClient } from "./api/index.mjs"; import type { ApiPlatformClientOptions } from "./api/index.mjs"; import type { ApiPlatformClientServiceMethodActions } from "./ApiPlatformClientService-method-action-types.mjs"; /** * The name of the {@link ApiPlatformClientService}, used to namespace the * service's actions and events. */ export declare const apiPlatformClientServiceName = "ApiPlatformClientService"; /** * Actions that {@link ApiPlatformClientService} exposes to other consumers. */ export type ApiPlatformClientServiceActions = ApiPlatformClientServiceMethodActions; /** * Actions from other messengers that {@link ApiPlatformClientServiceMessenger} calls. */ type AllowedActions = never; /** * Events that {@link ApiPlatformClientService} exposes to other consumers. */ export type ApiPlatformClientServiceEvents = never; /** * Events from other messengers that {@link ApiPlatformClientService} subscribes to. */ type AllowedEvents = never; /** * The messenger which is restricted to actions and events accessed by * {@link ApiPlatformClientService}. */ export type ApiPlatformClientServiceMessenger = Messenger; /** * Options for constructing {@link ApiPlatformClientService}. */ export type ApiPlatformClientServiceOptions = { /** The messenger suited for this service. */ messenger: ApiPlatformClientServiceMessenger; } & ApiPlatformClientOptions; /** * Service that provides access to {@link ApiPlatformClient} via the messenger. * * Consumers obtain the client by calling the `ApiPlatformClientService:getApiPlatformClient` * action, then use it for accounts, prices, token, and tokens API calls. * * @example * * ```ts * import { Messenger } from '@metamask/messenger'; * import { * ApiPlatformClientService, * type ApiPlatformClientServiceActions, * type ApiPlatformClientServiceEvents, * } from '@metamask/core-backend'; * * const rootMessenger = new Messenger<'Root', ApiPlatformClientServiceActions, ApiPlatformClientServiceEvents>({ namespace: 'Root' }); * const serviceMessenger = new Messenger< * 'ApiPlatformClientService', * ApiPlatformClientServiceActions, * ApiPlatformClientServiceEvents, * typeof rootMessenger * >({ namespace: 'ApiPlatformClientService', parent: rootMessenger }); * * new ApiPlatformClientService({ * messenger: serviceMessenger, * clientProduct: 'metamask-extension', * getBearerToken: async () => token, * }); * * const client = rootMessenger.call('ApiPlatformClientService:getApiPlatformClient'); * const balances = await client.accounts.fetchV5MultiAccountBalances(accountIds); * ``` */ export declare class ApiPlatformClientService { #private; readonly name: typeof apiPlatformClientServiceName; constructor({ messenger, ...clientOptions }: ApiPlatformClientServiceOptions); /** * Returns the shared ApiPlatformClient instance. * * Use this via the messenger: `messenger.call('ApiPlatformClientService:getApiPlatformClient')`. * * @returns The ApiPlatformClient instance (accounts, prices, token, tokens). */ getApiPlatformClient(): ApiPlatformClient; } export {}; //# sourceMappingURL=ApiPlatformClientService.d.mts.map