@okcontract/sdk
Version:
One-stop-shop permissionless SDK for building any blockchain frontend
37 lines (36 loc) • 1.2 kB
TypeScript
import type { BaseError } from "viem";
import type { ABIExtra } from "@okcontract/coredata";
/**
* StructuredError defines structured errors.
*/
export type StructuredError = {
/** should the error be displayed */
dis: boolean;
/** human-friendly message */
msg: string;
};
export declare const execution_reverted = "execution reverted: ";
export declare const INVALID_ARG = "INVALID_ARGUMENT";
export declare const NETWORK_ERROR = "NETWORK_ERROR";
/**
* human_extra looks up for a known error in ABIExtra.
* @param extra
* @param err
* @returns {dis:boolean, msg:string}
* @todo use ABIError
* @todo handle Viem Error
*/
export declare const human_error: (extra: ABIExtra, err: BaseError) => StructuredError;
export declare const err_no_whitelist: Error;
export declare const err_wallet_connect: Error;
export declare const err_wallet_signin: Error;
export declare const err_no_wallet: Error;
export declare const err_wallet_code: (err: Error & {
code: string;
}) => Error;
export declare const err_lighthouse: Error;
export declare const err_wrong_message: Error;
export declare const formatError: (err: Error) => {
type: "info" | "error";
message: string;
};