Daniel Ternyak ab5fa1a799
Support Non-Ethereum Networks (#849)
* Make UnlockHeader a PureComponent

* MVP

* actually disable wallet format if not determined to be valid format for wallet

* default to correct derivation in mnemonic modal

* cleanup

* fix tslint

* use enums for HD wallet getPath

* Add stricter typing

* Fix labels not updating on selector

* Ban hardware wallet support for custom network unsupported chainIds

* Fix type error

* Fix custom node dPath not being saved

* Fix mnemonic modal

* default path bugfixes

* add react-select

* misc fixes; rabbit holing hard.

* fix tslint

* revert identicon changes

* reload on network change :/

* actually reload on network change

* really really reload on network change

* tslint fixes

* Update styles

* set table width

* fix package versioning

* push broken sagas

* Fix saga test

* fix tslint

* address round of review

* move non-selectors out to utilty; adjust reload timer

* cleanup network util comments

* manage wallet disable at WalletDecrypt instead of in both WalletDecrypt and WalletButton

* Separate WalletDecrypt props into ownProps / StateProps

* disable payment requests on non-eth networks

* specialize connect; separate props

* remove unused state prop

* remove bad import

* create tests for networks

* Clarify Lite-Send error on non-ethereum networkS

* remove string option for network config name

* Create concept of always-on 'EXTRA_PATHS'; include SINGULAR_DTV legacy dPath in 'EXTRA_PATHS'

* fix multiple imports

* address PR comments
2018-01-20 14:06:28 -06:00

75 lines
1.6 KiB
TypeScript

import { Token } from 'config';
import ERC20 from 'libs/erc20';
import RPCRequests from '../rpc/requests';
import {
CallRequest,
EstimateGasRequest,
GetBalanceRequest,
GetTokenBalanceRequest,
GetTransactionCountRequest,
SendRawTxRequest,
GetCurrentBlockRequest
} from './types';
export default class EtherscanRequests extends RPCRequests {
public sendRawTx(signedTx: string): SendRawTxRequest {
return {
module: 'proxy',
action: 'eth_sendRawTransaction',
hex: signedTx
};
}
public estimateGas(transaction): EstimateGasRequest {
return {
module: 'proxy',
action: 'eth_estimateGas',
to: transaction.to,
value: transaction.value,
data: transaction.data,
from: transaction.from
};
}
public getBalance(address: string): GetBalanceRequest {
return {
module: 'account',
action: 'balance',
tag: 'latest',
address
};
}
public ethCall(transaction): CallRequest {
return {
module: 'proxy',
action: 'eth_call',
to: transaction.to,
data: transaction.data
};
}
public getTransactionCount(address: string): GetTransactionCountRequest {
return {
module: 'proxy',
action: 'eth_getTransactionCount',
tag: 'latest',
address
};
}
public getTokenBalance(address: string, token: Token): GetTokenBalanceRequest {
return this.ethCall({
to: token.address,
data: ERC20.balanceOf.encodeInput({ _owner: address })
});
}
public getCurrentBlock(): GetCurrentBlockRequest {
return {
module: 'proxy',
action: 'eth_blockNumber'
};
}
}