// 返回 interface IReturnClass { new(): IReturn } // 返回 class interface IReturn { hasSuccess: () => boolean setResult: (rs: any) => void setFee: (fee: string) => void setHash: (hash: string) => void setSymbol: (symbol: string) => void setNonce: (nonce: number) => void setContracts: (params?: { address?: string, decimals?: number }) => void setAddress: (address: string) => void setPrivateKey: (privateKey: string) => void setPublicKey: (publicKey: string) => void setMnemonic: (mnemonic: string) => void end: () => IReturnResult } // 返回数据 export interface IReturnResult { // code号 code: number // 返回数据 rs: T // 手续费 fee?: string // 交易txid hash?: string // 错误信息 error?: string // 缩写 symbol?: string // nonce nonce?: number contracts?: { address?: string, decimals?: number } address?: string privateKey?: string publicKey?: string mnemonic?: string } // 错误信息 export interface IError { /** * 助记词错误 */ mnemonic: IReturnResult /** * 私钥错误 */ privateKey: IReturnResult /** * 公钥错误 */ publicKey: IReturnResult /** * 地址错误 */ address: IReturnResult /** * 地址不能是自己 */ addressNotSelf: IReturnResult /** * 地址未激活 */ addressNotActivated: IReturnResult /** * 不能给 0 地址转账 */ addressNotZero: IReturnResult /** * 金额错误 */ amount: IReturnResult /** * 金额不够 */ amountNotEnough: IReturnResult /** * 金额不得为0 */ amountNotZero: IReturnResult /** * 金额过大 */ amountTooLarge: IReturnResult /** * 金额过小 */ amountTooSmall: IReturnResult /** * 手续费错误 */ fee: IReturnResult /** * 手续费不够 */ feeNotEnough: IReturnResult /** * nonce 错误 */ nonce: IReturnResult /** * nonce 重复 */ nonceRepeat: IReturnResult /** * 合约地址错误 */ contract: IReturnResult /** * 合约 ABI 未认证 */ contractEthAbiError: IReturnResult /** * 合约 CoinId 未找到 */ contractMeerCoinId: IReturnResult /** * hash 错误 */ hash: IReturnResult /** * 网络错误 */ networks: IReturnResult /** * 网络停止 */ networksStop: IReturnResult /** * 网络超时 */ networksTimeout: IReturnResult /** * 等待 */ wait: IReturnResult /** * 没有方法 */ functionErr: IReturnResult /** * 未知错误 */ error: IReturnResult } // 交易类型 export type ITxListType = { // 初始化 init: 'init' // 全部 all: 'all' // 转入 in: 'in' // 转出 out: 'out' // 错误 err: 'err' } // 交易状态 export type ITxListStat = { // 初始化 init: 0 // 成功 success: 1 // 未确认 unconfirmed: 2 // 确认中 confirming: 3 // 错误 fail: 4 } // 交易tron状态 export type ITxListTronStat = { // 初始化 init: 0 // 合约交易 contract: 1 // 资产冻结 freeze: 2 // 授权 approval: 3, } // 助记词生成位数 export type IMnemonicStrength = { // 12 位助记词 "12": 128 // 15 位助记词 "15": 160 // 18 位助记词 "18": 192 // 21 位助记词 "21": 224 // 24 位助记词 "24": 256 } // 链类型 export type IChainType = { bitcoin: 1 ethereum: 2 tron: 3 qitmeer: 4 } // 网络状态 export type INetworkType = { mainnet: 'mainnet' testnet: 'testnet' }