UNPKG

@vechain/connex

Version:

Standard interface to connect DApp with VeChain and user

52 lines (51 loc) 1.86 kB
/// <reference types="@vechain/connex-types" /> /// <reference types="@vechain/connex-framework/dist/driver-interface" /> import { Connex1 } from './signer'; declare global { interface Window { connex?: Connex1; } } export declare type BuiltinSigner = 'sync' | 'sync2'; /** options for creating Connex object */ export declare type Options = { /** the base url of the thor node's thorREST API */ node: string; /** * the expected network of the node url. defaults to 'main' if omitted. * if it does not match with the actual network of the node url points to, * all subsequent request will fail. */ network?: 'main' | 'test' | Connex.Thor.Block; /** * designated wallet to connect, Sync, Sync2 or VeWorldExtension supported, Sync2 if omitted. */ signer?: BuiltinSigner; }; /** Thor class which can work stand alone to provide reading-services only */ declare class ThorClass implements Connex.Thor { genesis: Connex.Thor['genesis']; status: Connex.Thor['status']; ticker: Connex.Thor['ticker']; account: Connex.Thor['account']; block: Connex.Thor['block']; transaction: Connex.Thor['transaction']; filter: Connex.Thor['filter']; explain: Connex.Thor['explain']; constructor(opts: Omit<Options, 'signer'>); } /** Vendor class which can work standalone to provides signing-services only */ declare class VendorClass implements Connex.Vendor { sign: Connex.Vendor['sign']; constructor(genesisId: 'main' | 'test' | string, signer?: BuiltinSigner); } /** Connex class */ declare class ConnexClass implements Connex { static readonly Thor: typeof ThorClass; static readonly Vendor: typeof VendorClass; thor: Connex.Thor; vendor: Connex.Vendor; constructor(opts: Options); } export default ConnexClass; export { ConnexClass as Connex };