mirror of
https://github.com/trezor/trezor-wallet
synced 2025-02-03 11:51:32 +00:00
code cleaning
This commit is contained in:
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> => {
|
export const getTransaction = (web3: Web3, txid: string): Promise<any> => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
web3.eth.getTransaction(txid, (error, result) => {
|
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> => {
|
export const getBalanceAsync = (web3: Web3, address: string): Promise<BigNumber> => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
web3.eth.getBalance(address, (error: Error, result: BigNumber) => {
|
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> => {
|
export const getTokenBalanceAsync = (erc20: ContractFactory, token: Token): Promise<string> => {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ const ConfirmAddress = (props: Props) => {
|
|||||||
}
|
}
|
||||||
export default ConfirmAddress;
|
export default ConfirmAddress;
|
||||||
|
|
||||||
export const ConfirmUnverifiedAddress = (props: Props): any => {
|
export const ConfirmUnverifiedAddress = (props: Props) => {
|
||||||
|
|
||||||
if (!props.modal.opened) return null;
|
if (!props.modal.opened) return null;
|
||||||
const {
|
const {
|
||||||
|
@ -210,7 +210,7 @@ export default class PinModal extends Component<Props, State> {
|
|||||||
raf(() => onPassphraseSubmit(empty ? '' : passphrase));
|
raf(() => onPassphraseSubmit(empty ? '' : passphrase));
|
||||||
}
|
}
|
||||||
|
|
||||||
render(): any {
|
render() {
|
||||||
|
|
||||||
if (!this.props.modal.opened) return null;
|
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);
|
window.removeEventListener('keydown', this.keyboardHandler, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
render(): any {
|
render() {
|
||||||
|
|
||||||
if (!this.props.modal.opened) return null;
|
if (!this.props.modal.opened) return null;
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ class Indicator extends Component<Props, State> {
|
|||||||
reposition: () => void;
|
reposition: () => void;
|
||||||
state: State;
|
state: State;
|
||||||
|
|
||||||
constructor(props: any) {
|
constructor(props: Props) {
|
||||||
super(props);
|
super(props);
|
||||||
|
|
||||||
this.state = {
|
this.state = {
|
||||||
@ -46,7 +46,7 @@ class Indicator extends Component<Props, State> {
|
|||||||
window.removeEventListener('resize', this.reposition, false);
|
window.removeEventListener('resize', this.reposition, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate(newProps: any) {
|
componentDidUpdate(newProps: Props) {
|
||||||
this.reposition();
|
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.params;
|
||||||
//const urlParams = props.match ? props.match.params : { address: '0' };
|
//const urlParams = props.match ? props.match.params : { address: '0' };
|
||||||
|
@ -96,20 +96,16 @@ const _render = (props: Props, state: AccountState): React$Element<string> => {
|
|||||||
buttonLabel += ` ${total} ${ selectedCoin.symbol }`;
|
buttonLabel += ` ${total} ${ selectedCoin.symbol }`;
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (device) {
|
if (!device.connected){
|
||||||
|
buttonLabel = 'Device is not connected';
|
||||||
if (!device.connected){
|
buttonDisabled = true;
|
||||||
buttonLabel = 'Device is not connected';
|
} else if (!device.available) {
|
||||||
buttonDisabled = true;
|
buttonLabel = 'Device is unavailable';
|
||||||
} else if (!device.available) {
|
buttonDisabled = true;
|
||||||
buttonLabel = 'Device is unavailable';
|
} else if (!discovery.completed) {
|
||||||
buttonDisabled = true;
|
buttonLabel = 'Loading accounts';
|
||||||
} else if (!discovery.completed) {
|
buttonDisabled = true;
|
||||||
buttonLabel = 'Loading accounts';
|
}
|
||||||
buttonDisabled = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
//}
|
|
||||||
|
|
||||||
let notification = null;
|
let notification = null;
|
||||||
|
|
||||||
|
@ -218,7 +218,6 @@ declare module 'trezor-connect' {
|
|||||||
|
|
||||||
declare module.exports: {
|
declare module.exports: {
|
||||||
init: (options: Object) => Promise<Object>;
|
init: (options: Object) => Promise<Object>;
|
||||||
// on: (type: string, handler: (event: any) => void) => void;
|
|
||||||
on: DeviceEventListener & DeviceEventListenerByType & UiEventListener & TransportEventListener;
|
on: DeviceEventListener & DeviceEventListenerByType & UiEventListener & TransportEventListener;
|
||||||
off: (type: string, handler: (event: any) => void) => void;
|
off: (type: string, handler: (event: any) => void) => void;
|
||||||
getVersion: () => any;
|
getVersion: () => any;
|
||||||
@ -228,14 +227,10 @@ declare module 'trezor-connect' {
|
|||||||
getFeatures: (options: Object) => Promise<ResponseGetFeatures>;
|
getFeatures: (options: Object) => Promise<ResponseGetFeatures>;
|
||||||
getPublicKey: (options: Object) => Promise<ResponseGetPublicKey>;
|
getPublicKey: (options: Object) => Promise<ResponseGetPublicKey>;
|
||||||
ethereumGetAddress: (options: Object) => Promise<ResponseEthereumGetAddress>;
|
ethereumGetAddress: (options: Object) => Promise<ResponseEthereumGetAddress>;
|
||||||
uiResponse: (options: Object) => Promise<Object>;
|
uiResponse: (options: Object) => void;
|
||||||
|
|
||||||
ethereumSignTransaction: (options: Object) => Promise<ResponseEthereumSignTransaction>;
|
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_EVENT: T_DEVICE_EVENT;
|
||||||
DEVICE: T_DEVICE;
|
DEVICE: T_DEVICE;
|
||||||
|
|
||||||
|
@ -70,10 +70,6 @@ const removeAccounts = (state: State, device: TrezorDevice): State => {
|
|||||||
return state.filter(account => account.deviceState !== device.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 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 index: number = state.findIndex(account => account.address === action.address && account.network === action.network && account.deviceState === action.deviceState);
|
||||||
const newState: State = [ ...state ];
|
const newState: State = [ ...state ];
|
||||||
|
Loading…
Reference in New Issue
Block a user