HenryNguyen5 2f8e0fe272 Contract Refactor (#175)
* Refactor BaseNode to be an interface INode

* Initial contract commit

* Remove redundant fallback ABI function

* First working iteration of Contract generator to be used in ENS branch

* Hide abi to clean up logging output

* Strip 0x prefix from output decode

* Handle unnamed output params

* Implement ability to supply output mappings to ABI functions

* Fix null case in outputMapping

* Add flow typing

* Add .call method to functions

* Partial commit for type refactor

* Temp contract type fix -- waiting for NPM modularization

* Remove empty files

* Cleanup contract

* Add call request to node interface

* Fix output mapping types

* Revert destructuring overboard

* Add sendCallRequest to rpcNode class and add typing

* Use enum for selecting ABI methods

* Add transaction capability to contracts

* Cleanup privaite/public members

* Remove broadcasting step from a contract transaction

* Cleanup uneeded types

* Fix spacing + remove unused imports /  types

* Actually address PR comments
2017-10-16 16:48:03 -07:00

19 lines
655 B
TypeScript

import { BigNumber } from 'bignumber.js';
import { Token } from 'config/data';
import { TransactionWithoutGas } from 'libs/messages';
import { Wei } from 'libs/units';
export interface TxObj {
to: string;
data: string;
}
export interface INode {
getBalance(address: string): Promise<Wei>;
getTokenBalance(address: string, token: Token): Promise<BigNumber>;
getTokenBalances(address: string, tokens: Token[]): Promise<BigNumber[]>;
estimateGas(tx: TransactionWithoutGas): Promise<BigNumber>;
getTransactionCount(address: string): Promise<string>;
sendRawTx(tx: string): Promise<string>;
sendCallRequest(txObj: TxObj): Promise<string>;
}