Skip to content

Instantly share code, notes, and snippets.

@wangzuo
Last active June 13, 2018 06:35
Show Gist options
  • Save wangzuo/45d2a04dd9ab2e0a32daf8492b89b3e4 to your computer and use it in GitHub Desktop.
Save wangzuo/45d2a04dd9ab2e0a32daf8492b89b3e4 to your computer and use it in GitHub Desktop.
export interface IRPCProvider {
getNetVersion(): Promise<string>;
ping(): Promise<boolean>;
getBalance(address: string): Promise<Wei>;
estimateGas(tx: Partial<IHexStrTransaction>): Promise<Wei>;
getTransactionCount(address: string): Promise<string>;
getTransactionByHash(txhash: string): Promise<TransactionData>;
getTransactionReceipt(txhash: string): Promise<TransactionReceipt>;
sendRawTx(tx: string): Promise<string>;
sendCallRequest(txObj: TxObj): Promise<string>;
sendCallRequests(txObj: TxObj[]): Promise<string[]>;
getCurrentBlock(): Promise<string>;
}
export interface IProvider extends IRPCProvider {
/*Web3 methods*/
sendTransaction(web3Tx: IHexStrWeb3Transaction): Promise<string>;
signMessage(msgHex: string, fromAddr: string): Promise<string>;
}
export type AllProviderMethods = keyof IProvider;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment