Add a Monero donation address and use it as the placeholder for the ReceivingAddress Input

This commit is contained in:
Connor Bryan 2018-07-05 19:45:08 -05:00
parent 1e0627596e
commit e69a15bbc6
2 changed files with 12 additions and 6 deletions

View File

@ -44,7 +44,9 @@ export const etherChainExplorerInst = makeExplorer({
export const donationAddressMap = { export const donationAddressMap = {
BTC: '32oirLEzZRhi33RCXDF9WHJjEb8RsrSss3', BTC: '32oirLEzZRhi33RCXDF9WHJjEb8RsrSss3',
ETH: '0x4bbeEB066eD09B7AEd07bF39EEe0460DFa261520', ETH: '0x4bbeEB066eD09B7AEd07bF39EEe0460DFa261520',
REP: '0x4bbeEB066eD09B7AEd07bF39EEe0460DFa261520' REP: '0x4bbeEB066eD09B7AEd07bF39EEe0460DFa261520',
XMR:
'4GdoN7NCTi8a5gZug7PrwZNKjvHFmKeV11L6pNJPgj5QNEHsN6eeX3DaAQFwZ1ufD4LYCZKArktt113W7QjWvQ7CW7F7tDFvS511SNfZV7'
}; };
export const gasEstimateCacheTime = 60000; export const gasEstimateCacheTime = 60000;

View File

@ -62,6 +62,7 @@ export default class ReceivingAddress extends PureComponent<StateProps & ActionP
public render() { public render() {
const { destinationId, destinationAddress, isPostingOrder } = this.props; const { destinationId, destinationAddress, isPostingOrder } = this.props;
const addressValidators: { [coinOrToken: string]: (address: string) => boolean } = { const addressValidators: { [coinOrToken: string]: (address: string) => boolean } = {
BTC: isValidBTCAddress, BTC: isValidBTCAddress,
XMR: isValidXMRAddress, XMR: isValidXMRAddress,
@ -71,6 +72,13 @@ export default class ReceivingAddress extends PureComponent<StateProps & ActionP
const addressValidator = addressValidators[destinationId] || addressValidators.ETH; const addressValidator = addressValidators[destinationId] || addressValidators.ETH;
const validAddress = addressValidator(destinationAddress); const validAddress = addressValidator(destinationAddress);
const placeholders: { [coinOrToken: string]: string } = {
BTC: donationAddressMap.BTC,
XMR: donationAddressMap.XMR,
ETH: donationAddressMap.ETH
};
const placeholder = placeholders[destinationId] || donationAddressMap.ETH;
return ( return (
<section className="SwapAddress block"> <section className="SwapAddress block">
<section className="row"> <section className="row">
@ -86,11 +94,7 @@ export default class ReceivingAddress extends PureComponent<StateProps & ActionP
type="text" type="text"
value={destinationAddress} value={destinationAddress}
onChange={this.onChangeDestinationAddress} onChange={this.onChangeDestinationAddress}
placeholder={ placeholder={placeholder}
destinationId === 'BTC'
? donationAddressMap[destinationId]
: donationAddressMap.ETH
}
/> />
</label> </label>
</div> </div>