UNPKG

@opendatalabs/vana-sdk

Version:

A TypeScript library for interacting with Vana Network smart contracts.

67 lines (66 loc) 3.1 kB
/** * Optional first-party Account integration for Personal Server registration. * * The protocol helper lives in `protocol/personal-server-registration`. * This module is only for callers that want to use an Account deployment's * constrained silent-sign endpoint. * * @category Account */ import { type Address } from "viem"; import { type BuildPersonalServerRegistrationTypedDataInput, type PersonalServerRegistrationSignature, type PersonalServerRegistrationSigner, type PersonalServerRegistrationTypedData } from "../protocol/personal-server-registration"; export declare const ACCOUNT_PERSONAL_SERVER_REGISTRATION_INTENT: "personal_server.server_registration.v1"; export type AccountPersonalServerRegistrationIntent = typeof ACCOUNT_PERSONAL_SERVER_REGISTRATION_INTENT; export type AccountPersonalServerRegistrationStatus = "signed" | "confirmation_required" | "fallback_required"; export interface AccountPersonalServerRegistrationRequest extends Omit<BuildPersonalServerRegistrationTypedDataInput, "ownerAddress"> { } export interface AccountPersonalServerRegistrationConfig { /** * Origin for the Account deployment to call, e.g. an app-dev Account origin. * No production origin is assumed by the SDK. */ accountOrigin: string; /** * Path for Account's constrained PS registration silent-sign endpoint. */ endpointPath?: string; /** * Optional fetch implementation for tests and non-default runtimes. */ fetchImpl?: typeof fetch; /** * Optional signer used when Account says user confirmation is required and * returns typed data for the caller to sign interactively. */ fallbackSigner?: PersonalServerRegistrationSigner; } export type AccountPersonalServerRegistrationSignature = PersonalServerRegistrationSignature & { intent: AccountPersonalServerRegistrationIntent; }; export interface AccountSignedPersonalServerRegistration { status: "signed"; result: AccountPersonalServerRegistrationSignature; } export interface AccountConfirmationRequiredPersonalServerRegistration { status: "confirmation_required"; typedData: PersonalServerRegistrationTypedData; signerAddress?: Address; } export interface AccountFallbackSignedPersonalServerRegistration { status: "fallback_signed"; accountStatus: "confirmation_required"; result: AccountPersonalServerRegistrationSignature; } export type AccountPersonalServerRegistrationResult = AccountSignedPersonalServerRegistration | AccountConfirmationRequiredPersonalServerRegistration | AccountFallbackSignedPersonalServerRegistration; export declare class AccountPersonalServerRegistrationError extends Error { status: number; code?: string; details?: unknown; constructor(input: { status: number; message: string; code?: string; details?: unknown; }); } export declare function signPersonalServerRegistrationWithAccount(config: AccountPersonalServerRegistrationConfig, request: AccountPersonalServerRegistrationRequest): Promise<AccountPersonalServerRegistrationResult>;