aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant/src/components/buy_button.tsx
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-11-03 04:48:31 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-11-03 05:39:12 +0800
commit5fc2483be776cab90e7ff868b27536a85d6764c9 (patch)
tree1dedb81a97b4c57c763d4f56cb4952d5df4b586f /packages/instant/src/components/buy_button.tsx
parentec83a1d9e735573fe51df7a5854424c0ad4101fb (diff)
downloaddexon-sol-tools-5fc2483be776cab90e7ff868b27536a85d6764c9.tar.gz
dexon-sol-tools-5fc2483be776cab90e7ff868b27536a85d6764c9.tar.zst
dexon-sol-tools-5fc2483be776cab90e7ff868b27536a85d6764c9.zip
feat(instant): pass in provider through props, fallback to injected provider
Diffstat (limited to 'packages/instant/src/components/buy_button.tsx')
-rw-r--r--packages/instant/src/components/buy_button.tsx5
1 files changed, 3 insertions, 2 deletions
diff --git a/packages/instant/src/components/buy_button.tsx b/packages/instant/src/components/buy_button.tsx
index 12ac62601..9d9a8540c 100644
--- a/packages/instant/src/components/buy_button.tsx
+++ b/packages/instant/src/components/buy_button.tsx
@@ -1,4 +1,5 @@
import { AssetBuyer, AssetBuyerError, BuyQuote } from '@0x/asset-buyer';
+import { Web3Wrapper } from '@0x/web3-wrapper';
import * as _ from 'lodash';
import * as React from 'react';
import { oc } from 'ts-optchain';
@@ -10,7 +11,6 @@ import { getBestAddress } from '../util/address';
import { balanceUtil } from '../util/balance';
import { gasPriceEstimator } from '../util/gas_price_estimator';
import { util } from '../util/util';
-import { web3Wrapper } from '../util/web3_wrapper';
import { Button, Text } from './ui';
@@ -50,7 +50,8 @@ export class BuyButton extends React.Component<BuyButtonProps> {
}
this.props.onValidationPending(buyQuote);
- const takerAddress = await getBestAddress();
+ const web3Wrapper = new Web3Wrapper(assetBuyer.provider);
+ const takerAddress = await getBestAddress(web3Wrapper);
const hasSufficientEth = await balanceUtil.hasSufficientEth(takerAddress, buyQuote, web3Wrapper);
if (!hasSufficientEth) {