UNPKG

@metamask/keyring-api

Version:
41 lines 1.37 kB
import { exactOptional, object } from "@metamask/keyring-utils"; import { literal, string, union } from "@metamask/superstruct"; import { JsonStruct } from "@metamask/utils"; export const KeyringResponseStruct = union([ object({ /** * Pending flag. * * Setting the pending flag to true indicates that the request will be * handled asynchronously. The keyring must be called with `approveRequest` * or `rejectRequest` to resolve the request. */ pending: literal(true), /** * Redirect URL. * * If present in the response, MetaMask will display a confirmation dialog * with a link to the redirect URL. The user can choose to follow the link * or cancel the request. */ redirect: exactOptional(object({ message: exactOptional(string()), url: exactOptional(string()), })), }), object({ /** * Pending flag. * * Setting the pending flag to false indicates that the request will be * handled synchronously. The keyring must return the result of the * request execution. */ pending: literal(false), /** * Request result. */ result: JsonStruct, }), ]); //# sourceMappingURL=response.mjs.map