code cleaning

pull/2/merge
Szymon Lesisz 6 years ago
parent 62a15b97ee
commit 69f479280b

@ -322,14 +322,6 @@ export const getTransactionReceipt = (tx: PendingTx): AsyncAction => {
}
}
// export function updateLastBlock(hash: string): Action {
// return {
// type: 'web3__update_last_block',
// hash
// }
// }
export const getTransaction = (web3: Web3, txid: string): Promise<any> => {
return new Promise((resolve, reject) => {
web3.eth.getTransaction(txid, (error, result) => {
@ -342,8 +334,6 @@ export const getTransaction = (web3: Web3, txid: string): Promise<any> => {
});
}
export const getBalanceAsync = (web3: Web3, address: string): Promise<BigNumber> => {
return new Promise((resolve, reject) => {
web3.eth.getBalance(address, (error: Error, result: BigNumber) => {
@ -356,8 +346,6 @@ export const getBalanceAsync = (web3: Web3, address: string): Promise<BigNumber>
});
}
export const getTokenBalanceAsync = (erc20: ContractFactory, token: Token): Promise<string> => {
return new Promise((resolve, reject) => {
@ -451,4 +439,4 @@ export const pushTx = (web3: Web3, tx: any): Promise<string> => {
}
});
})
}
}

@ -29,7 +29,7 @@ const ConfirmAddress = (props: Props) => {
}
export default ConfirmAddress;
export const ConfirmUnverifiedAddress = (props: Props): any => {
export const ConfirmUnverifiedAddress = (props: Props) => {
if (!props.modal.opened) return null;
const {

@ -210,7 +210,7 @@ export default class PinModal extends Component<Props, State> {
raf(() => onPassphraseSubmit(empty ? '' : passphrase));
}
render(): any {
render() {
if (!this.props.modal.opened) return null;

@ -103,7 +103,7 @@ export default class Pin extends Component<Props, State> {
window.removeEventListener('keydown', this.keyboardHandler, false);
}
render(): any {
render() {
if (!this.props.modal.opened) return null;

@ -20,7 +20,7 @@ class Indicator extends Component<Props, State> {
reposition: () => void;
state: State;
constructor(props: any) {
constructor(props: Props) {
super(props);
this.state = {
@ -46,7 +46,7 @@ class Indicator extends Component<Props, State> {
window.removeEventListener('resize', this.reposition, false);
}
componentDidUpdate(newProps: any) {
componentDidUpdate(newProps: Props) {
this.reposition();
}
@ -76,7 +76,7 @@ class Indicator extends Component<Props, State> {
}
}
const AccountTabs = (props: any): any => {
const AccountTabs = (props: any) => {
const urlParams = props.match.params;
//const urlParams = props.match ? props.match.params : { address: '0' };

@ -95,22 +95,18 @@ const _render = (props: Props, state: AccountState): React$Element<string> => {
} else if (coinSymbol === selectedCurrency && total !== '0') {
buttonLabel += ` ${total} ${ selectedCoin.symbol }`;
}
//if (device) {
if (!device.connected){
buttonLabel = 'Device is not connected';
buttonDisabled = true;
} else if (!device.available) {
buttonLabel = 'Device is unavailable';
buttonDisabled = true;
} else if (!discovery.completed) {
buttonLabel = 'Loading accounts';
buttonDisabled = true;
}
//}
if (!device.connected){
buttonLabel = 'Device is not connected';
buttonDisabled = true;
} else if (!device.available) {
buttonLabel = 'Device is unavailable';
buttonDisabled = true;
} else if (!discovery.completed) {
buttonLabel = 'Loading accounts';
buttonDisabled = true;
}
let notification = null;
return (

@ -218,7 +218,6 @@ declare module 'trezor-connect' {
declare module.exports: {
init: (options: Object) => Promise<Object>;
// on: (type: string, handler: (event: any) => void) => void;
on: DeviceEventListener & DeviceEventListenerByType & UiEventListener & TransportEventListener;
off: (type: string, handler: (event: any) => void) => void;
getVersion: () => any;
@ -228,13 +227,9 @@ declare module 'trezor-connect' {
getFeatures: (options: Object) => Promise<ResponseGetFeatures>;
getPublicKey: (options: Object) => Promise<ResponseGetPublicKey>;
ethereumGetAddress: (options: Object) => Promise<ResponseEthereumGetAddress>;
uiResponse: (options: Object) => Promise<Object>;
uiResponse: (options: Object) => void;
ethereumSignTransaction: (options: Object) => Promise<ResponseEthereumSignTransaction>;
// export const RESPONSE_EVENT: string = 'RESPONSE_EVENT';
// export const ERROR_EVENT: string = 'ERROR_EVENT';
DEVICE_EVENT: T_DEVICE_EVENT;
DEVICE: T_DEVICE;

@ -70,10 +70,6 @@ const removeAccounts = (state: State, device: TrezorDevice): State => {
return state.filter(account => account.deviceState !== device.state);
}
// const forgetAccounts = (state: State, action: any): State => {
// return state.filter(account => action.accounts.indexOf(account) === -1);
// }
const setBalance = (state: State, action: AccountSetBalanceAction): State => {
const index: number = state.findIndex(account => account.address === action.address && account.network === action.network && account.deviceState === action.deviceState);
const newState: State = [ ...state ];

Loading…
Cancel
Save