eosplayer
Version:
eosplayer is the glue layer of eosjs, which is packaged based on eosjs and provides better usability for the application layer. It can be used on browsers already installed scatter or in Dapp wallets.
80 lines (79 loc) • 2.39 kB
TypeScript
import DB from './db';
import { Player } from '../../player';
import { IEosNodeConfig, IEosNodeConfigTable } from '../../configs';
import { ISignPlugin } from '../../plugins/interface';
import { IEosClient, IIdentity } from '../../types/eos';
import { IScatter } from '../../types/scatter';
/**
* Player on browser (need scatter)
* @author kinghand@foxmail.com
*/
export declare class ScatterPlayer extends Player {
_networks: IEosNodeConfigTable;
protected identityReceiver: ((_identity: IIdentity | Error) => any)[];
readonly storage: DB;
protected _eosClient?: IEosClient;
constructor(_networks: IEosNodeConfigTable);
/**
* switch to an network with name
* @param key
*/
switchNetwork(key: string): void;
/**
* add net config to table at runtime
* @param netName
* @param conf
*/
setNetConf(netName: string, conf: any): void;
/**
* get network name in use
*/
readonly netName: string;
/**
* get network config of cur netName
*/
readonly netConf: IEosNodeConfig;
/**
* try get scatter
* @see https://get-scatter.com/docs/examples-interaction-flow
* @return {Scatter}
*/
readonly scatter: IScatter;
/**
* try get scatter async - if not find
* @see https://get-scatter.com/docs/examples-interaction-flow
* @return {Scatter}
*/
getScatterAsync(maxTry?: number): Promise<IScatter>;
getPCScatter(): Promise<IScatter>;
/**
* login - require account identity from scatter
* @return {Promise<{Identity}>}
*/
login(): Promise<any>;
/**
* logout
* @return {Promise<void>}
*/
logout(): Promise<any>;
/**
* get or create scatter
* @return {eosAPI}
*/
readonly eosClient: IEosClient;
/**
* getIdentity of cur scatter user
* @attention When there are multiple concurrent getIdentity requests, scatter will only return the first one.
* @return {Promise<{Identity}>}
*/
getIdentity(): Promise<any>;
/**
* sign a message with current identity
* @param {string} message - message to sign
* @param {... ISignPlugin[]} signPlugins - signer map's list
* @return {Promise<void>} - signed data
* @constructor
*/
sign(message: string, ...signPlugins: ISignPlugin[]): Promise<string>;
help(): string;
}