@vechain/connex
Version:
Standard interface to connect DApp with VeChain and user
51 lines (50 loc) • 1.76 kB
TypeScript
import { Connex1 } from './signer';
declare global {
interface Window {
connex?: Connex1;
}
}
export type BuiltinSigner = 'sync' | 'sync2';
/** options for creating Connex object */
export 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'];
fees: Connex.Thor['fees'];
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 };