@dfinity/oisy-wallet-signer
Version:
A library designed to facilitate communication between a dApp and the OISY Wallet on the Internet Computer.
163 lines (162 loc) • 6.52 kB
TypeScript
import * as z from 'zod';
declare const ConnectionOptionsSchema: z.ZodObject<{
/**
* Specifies the interval in milliseconds at which the signer is checked (polled) to determine if it is ready.
* Must be a positive number.
*
* @default 500 - The default polling interval is set to 500 milliseconds.
*/
pollingIntervalInMilliseconds: z.ZodOptional<z.ZodNumber>;
/**
* Specifies the maximum duration in milliseconds for attempting to establish a connection to the signer.
* If the connection is not established within this duration, the process will time out.
* Must be a positive number.
*
* @default 120_000 - The default timeout is set to 120,000 milliseconds (2 minutes).
*/
timeoutInMilliseconds: z.ZodOptional<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
pollingIntervalInMilliseconds?: number | undefined;
timeoutInMilliseconds?: number | undefined;
}, {
pollingIntervalInMilliseconds?: number | undefined;
timeoutInMilliseconds?: number | undefined;
}>;
export type ConnectionOptions = z.infer<typeof ConnectionOptionsSchema>;
declare const WindowOptionsSchema: z.ZodObject<{
/**
* Specifies the position of the signer window.
*/
position: z.ZodEnum<["top-right", "center"]>;
/**
* Specifies a width greater than zero of the signer window.
*/
width: z.ZodNumber;
/**
* Specifies a height greater than zero of the signer window.
*/
height: z.ZodNumber;
/**
* Optional features for the signer Window object.
*/
features: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
height: number;
width: number;
position: "center" | "top-right";
features?: string | undefined;
}, {
height: number;
width: number;
position: "center" | "top-right";
features?: string | undefined;
}>;
export type WindowOptions = z.infer<typeof WindowOptionsSchema>;
declare const OnDisconnectSchema: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodVoid>>;
export type OnDisconnect = z.infer<typeof OnDisconnectSchema>;
declare const RelyingPartyHostSchema: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
export type RelyingPartyHost = z.infer<typeof RelyingPartyHostSchema>;
export declare const RelyingPartyOptionsSchema: z.ZodObject<{
/**
* The URL of the signer.
*/
url: z.ZodEffects<z.ZodString, string, string>;
/**
* Optional window options to display the signer, which can be an object of type WindowOptions or a string.
* If a string is passed, those are applied as-is to the window that is opened (see https://developer.mozilla.org/en-US/docs/Web/API/Window/open#windowfeatures for more information).
*/
windowOptions: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
/**
* Specifies the position of the signer window.
*/
position: z.ZodEnum<["top-right", "center"]>;
/**
* Specifies a width greater than zero of the signer window.
*/
width: z.ZodNumber;
/**
* Specifies a height greater than zero of the signer window.
*/
height: z.ZodNumber;
/**
* Optional features for the signer Window object.
*/
features: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
height: number;
width: number;
position: "center" | "top-right";
features?: string | undefined;
}, {
height: number;
width: number;
position: "center" | "top-right";
features?: string | undefined;
}>, z.ZodString]>>;
/**
* The connection options for establishing the connection with the signer.
*/
connectionOptions: z.ZodOptional<z.ZodObject<{
/**
* Specifies the interval in milliseconds at which the signer is checked (polled) to determine if it is ready.
* Must be a positive number.
*
* @default 500 - The default polling interval is set to 500 milliseconds.
*/
pollingIntervalInMilliseconds: z.ZodOptional<z.ZodNumber>;
/**
* Specifies the maximum duration in milliseconds for attempting to establish a connection to the signer.
* If the connection is not established within this duration, the process will time out.
* Must be a positive number.
*
* @default 120_000 - The default timeout is set to 120,000 milliseconds (2 minutes).
*/
timeoutInMilliseconds: z.ZodOptional<z.ZodNumber>;
}, "strip", z.ZodTypeAny, {
pollingIntervalInMilliseconds?: number | undefined;
timeoutInMilliseconds?: number | undefined;
}, {
pollingIntervalInMilliseconds?: number | undefined;
timeoutInMilliseconds?: number | undefined;
}>>;
/**
* Optional callback function that is triggered when the relying party disconnects from the wallet.
*/
onDisconnect: z.ZodOptional<z.ZodFunction<z.ZodTuple<[], z.ZodUnknown>, z.ZodVoid>>;
/**
* The host of the replica to which the relying party wallet might be connected.
* This is useful for local development if your local replica runs on a port other than the default, as an agent must be created to decode the response.
* If "localhost" or "127.0.0.1" is provided, it will automatically connect to a local replica and fetch the root key for the agent.
*/
host: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
}, "strip", z.ZodTypeAny, {
url: string;
host?: string | undefined;
windowOptions?: string | {
height: number;
width: number;
position: "center" | "top-right";
features?: string | undefined;
} | undefined;
connectionOptions?: {
pollingIntervalInMilliseconds?: number | undefined;
timeoutInMilliseconds?: number | undefined;
} | undefined;
onDisconnect?: ((...args: unknown[]) => void) | undefined;
}, {
url: string;
host?: string | undefined;
windowOptions?: string | {
height: number;
width: number;
position: "center" | "top-right";
features?: string | undefined;
} | undefined;
connectionOptions?: {
pollingIntervalInMilliseconds?: number | undefined;
timeoutInMilliseconds?: number | undefined;
} | undefined;
onDisconnect?: ((...args: unknown[]) => void) | undefined;
}>;
export type RelyingPartyOptions = z.infer<typeof RelyingPartyOptionsSchema>;
export {};