diff options
author | Brandon Millman <brandon.millman@gmail.com> | 2018-10-30 01:26:27 +0800 |
---|---|---|
committer | Brandon Millman <brandon.millman@gmail.com> | 2018-10-30 01:37:56 +0800 |
commit | aab9bedd7fe1ab328e416024b6397f242d39d84f (patch) | |
tree | 5ffa6dc9d737d5dddd1b16c4ecb6fb65e6e85ee4 /packages/instant/src/components/buy_order_state_buttons.tsx | |
parent | 8d1689073b702d973075d30b2bb36369487fad1c (diff) | |
parent | 4e4291eccdd6c837bbec70603aa6eb64d3aa8d85 (diff) | |
download | dexon-sol-tools-aab9bedd7fe1ab328e416024b6397f242d39d84f.tar dexon-sol-tools-aab9bedd7fe1ab328e416024b6397f242d39d84f.tar.gz dexon-sol-tools-aab9bedd7fe1ab328e416024b6397f242d39d84f.tar.bz2 dexon-sol-tools-aab9bedd7fe1ab328e416024b6397f242d39d84f.tar.lz dexon-sol-tools-aab9bedd7fe1ab328e416024b6397f242d39d84f.tar.xz dexon-sol-tools-aab9bedd7fe1ab328e416024b6397f242d39d84f.tar.zst dexon-sol-tools-aab9bedd7fe1ab328e416024b6397f242d39d84f.zip |
Merge branch 'development' into feature/instant/fixed-orders-in-render-method
* development:
Has Sufficient Funds/Balance -> Has Sufficient ETH
When transaction too low, treat as validation error. also modify callback: errorMessage could be AssetBuyError as well
onPendingValidation -> onValidationPending
linting
Simpler way of validaitng has enough eth
questionmark syntax instead of '| undefined'
Validate enough ETH when user clicks buy
acccount for no address
move funct into util
move imports
yarn.lock changes
feat(instant): Show message if user doesn't have enough ETH
ethDecimals -> ETH_DECIMALS
Diffstat (limited to 'packages/instant/src/components/buy_order_state_buttons.tsx')
-rw-r--r-- | packages/instant/src/components/buy_order_state_buttons.tsx | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/packages/instant/src/components/buy_order_state_buttons.tsx b/packages/instant/src/components/buy_order_state_buttons.tsx index 758eabcb7..d01e9ff57 100644 --- a/packages/instant/src/components/buy_order_state_buttons.tsx +++ b/packages/instant/src/components/buy_order_state_buttons.tsx @@ -1,4 +1,4 @@ -import { AssetBuyer, BuyQuote } from '@0x/asset-buyer'; +import { AssetBuyer, AssetBuyerError, BuyQuote } from '@0x/asset-buyer'; import * as React from 'react'; import { BuyButton } from '../components/buy_button'; @@ -7,7 +7,7 @@ import { Flex } from '../components/ui/flex'; import { PlacingOrderButton } from '../components/placing_order_button'; import { ColorOption } from '../style/theme'; -import { OrderProcessState } from '../types'; +import { OrderProcessState, ZeroExInstantError } from '../types'; import { Button } from './ui/button'; import { Text } from './ui/text'; @@ -17,7 +17,8 @@ export interface BuyOrderStateButtonProps { buyOrderProcessingState: OrderProcessState; assetBuyer?: AssetBuyer; onViewTransaction: () => void; - onAwaitingSignature: (buyQuote: BuyQuote) => void; + onValidationPending: (buyQuote: BuyQuote) => void; + onValidationFail: (buyQuote: BuyQuote, errorMessage: AssetBuyerError | ZeroExInstantError) => void; onSignatureDenied: (buyQuote: BuyQuote) => void; onBuyProcessing: (buyQuote: BuyQuote, txHash: string) => void; onBuySuccess: (buyQuote: BuyQuote, txHash: string) => void; @@ -45,7 +46,7 @@ export const BuyOrderStateButtons: React.StatelessComponent<BuyOrderStateButtonP props.buyOrderProcessingState === OrderProcessState.PROCESSING ) { return <SecondaryButton onClick={props.onViewTransaction}>View Transaction</SecondaryButton>; - } else if (props.buyOrderProcessingState === OrderProcessState.AWAITING_SIGNATURE) { + } else if (props.buyOrderProcessingState === OrderProcessState.VALIDATING) { return <PlacingOrderButton />; } @@ -53,7 +54,8 @@ export const BuyOrderStateButtons: React.StatelessComponent<BuyOrderStateButtonP <BuyButton buyQuote={props.buyQuote} assetBuyer={props.assetBuyer} - onAwaitingSignature={props.onAwaitingSignature} + onValidationPending={props.onValidationPending} + onValidationFail={props.onValidationFail} onSignatureDenied={props.onSignatureDenied} onBuyProcessing={props.onBuyProcessing} onBuySuccess={props.onBuySuccess} |