export default class Bridge { static V2_MIN_VERSION: string; /** * Designated protocol scheme, default `meetone://` * @type {string} */ scheme: string; /** * The Version of Bridge Library * @type {string} */ version: string; /** * Try the `window.postMessage` failed times * * Over 60 times will throw error ('post url timeout') * * @type {number} */ tryTimes: number; /** * Creates an instance of Bridge. * * @param {string} [protocol='meetone://'] * @param {string} The version of Bridge Library */ constructor(scheme?: string, version?: string); /** * Parse Javascript Object to params String * * Detailed conversion process: * * JSON.stringify() -> encodeURIComponent() -> btoa() * * @static * @param {object} obj - target Javascript Object * @returns {string} - params String */ static coverObjectToParams(obj: object): string; /** * Generate random series callback ID * * For realize the callback function * * @private * @returns {string} - `meet_callback_[id]` */ private _getCallbackId; /** * PostMessage to Client for invoke schema * * @private * @param {string} url */ private _sendRequest; /** * Generate Promise with callbackId * Callback is once! * * If `bridge.version < 2.0.0` will return String * * @param {Object} obj * - { * routeName: String, * params: Object * } * @returns {Promise | String} */ customGenerate(obj: Object): any; /** * * @author JohnTrump * @param {Object} obj - target Javascript Object * @param {string} callbackId - make sure callbackId unique * @param {(result: object) => void} callback - callback function * @returns {*} * @memberof Bridge */ timesGenerate(obj: Object, callbackId: string, callback: () => void): any; /** * Parse params String to Javascript Object * * Detailed conversion process: atob() -> decodeURIComponent() -> JSON.parse() * @static * @param {string} url - params String * @returns {object} - Javascript Object */ static revertParamsToObject(url: string): object; /** * Generate the protocol URI * * The web side can communicate with the client through the following two calling methods. * * 1. window.location.href = uri (outside web calling - out of application client) * * 2. window.postMessage(uri) (inside Webview calling - in application client) * * @param routeName - the path for protocol uri, eg: 'eos/authorize' * @param params - the query of params * @param callbackId - callback id * @returns {string} - The protocol of uri */ generateURI({ routeName, params, callbackId }: { routeName?: string; params?: {}; callbackId?: string; }): string; /** * Get EOS wallet current network * include chain_id and domians[] */ invokeGetNetwork(): any; /** * 触发客户端分享 * * @param shareType - 分享类型: `1 文本;2 图片;3 web link;4 文件; 5 口令` * @param imgUrl - 分享的图片[可选] * @param title - 分享标题 * @param description - 分享内容 * @param options - 附带的参数(`shareType = 5`时需要) */ invokeShare({ shareType, title, description, imgUrl, options }: { shareType?: number; title?: string; description?: string; imgUrl?: string; options?: {}; }): any; /** * 生成分享口令 * * 生成的口令会自动被复制,打卡App后会弹出分享的内容 * * @param description - 口令分享弹窗描述 * @param name - Dapps的名称 * @param target - 口令分享跳转的url * @param banner - 弹窗的banner图片 * @param icon - 弹窗Dapp图标 */ invokeShareCode({ description, name, target, banner, icon }: { description?: string; name?: string; target?: string; banner?: string; icon?: string; }): any; /** * Request authorization - return authorization information directly */ invokeAuthorizeInWeb(): any; /** * * Send a transfer request * * @param to 转账给谁 * @param amount 转账金额 * @param tokenName 代币符号 * @param tokenContract 代币合约地址 * @param tokenPrecision 代币精度 * @param memo 转账备注 * @param orderInfo 订单信息 */ invokeTransfer({ to, amount, tokenName, tokenContract, tokenPrecision, memo, orderInfo }: { to?: string; amount?: number; tokenName?: string; tokenContract?: string; tokenPrecision?: number; memo?: string; orderInfo?: string; }): any; /** * * Send a transaction request * * ref: https://github.com/EOSIO/eosjs#transaction * * @param actions - transaction Actions * @param options - transaction Options * @param description - the description about transaction */ invokeTransaction({ actions, options, description }: { actions?: never[]; options?: { broadcast: boolean; }; description?: string; }): any; /** * Get account information */ invokeAccountInfo({ chainId, dappName }?: { chainId?: string; dappName?: string; }): any; /** * * invoke application to Navigate * * @param target - Navigate to route name, eg 'EOSAuthorationPage' * @param options - Parameters that need to passed to the route component */ invokeNavigate({ target, options }: { target?: string; options?: {}; }): any; /** * * invoke application to open a webview * * @param title - webview title * @param uri - target url which will be opened in webview */ invokeWebview({ url, title }: { url?: string; title?: string; }): any; /** * * custom menu of webview * @author JohnTrump */ webviewRightMenu({ title, callback }: { title?: string; callback?: () => void; }): any; /** * invoke clint to return signProvider for eos.js * * ref: https://github.com/EOSIO/eosjs/blob/master/src/index.test.js#L327 * */ invokeSignProvider({ buf, transaction }: { buf?: string[]; transaction?: null; }): any; /** * invoke application to sign a signature which use current account and data * * @param {string} data - The data which used to create a signature * @param {string} whatfor - The description for the Sign request * @param {boolean} isHash - Is used `ecc.Signature.signHash` to sign * @param {boolean} isArbitrary - Is invoked by `scatter.getArbitrarySignature`, Default is `false` */ invokeSignature({ data, // 打算加密的内容 whatfor, // 加密请求说明 isHash, isArbitrary }: { data?: string; whatfor?: string; isHash?: boolean; isArbitrary?: boolean; }): any; /** * invoke application to get token Balance * * @param {string} accountName - the account name of want to query balance - options * @param {string} contract - the token publisher smart contract name - default is 'eosio.token' * @param {string} symbol - the token symbol - default is 'EOS' */ invokeBalance({ accountName, contract, symbol }: { accountName?: string; contract?: string; symbol?: string; }): any; }