aboutsummaryrefslogtreecommitdiffstats
path: root/packages/instant
diff options
context:
space:
mode:
Diffstat (limited to 'packages/instant')
-rw-r--r--packages/instant/src/components/buy_button.tsx20
-rw-r--r--packages/instant/src/containers/selected_asset_buy_button.ts12
-rw-r--r--packages/instant/src/containers/selected_asset_view_transaction_button.tsx2
-rw-r--r--packages/instant/src/types.ts6
-rw-r--r--packages/instant/src/util/etherscan.ts4
5 files changed, 22 insertions, 22 deletions
diff --git a/packages/instant/src/components/buy_button.tsx b/packages/instant/src/components/buy_button.tsx
index 7004b6a18..841a9593b 100644
--- a/packages/instant/src/components/buy_button.tsx
+++ b/packages/instant/src/components/buy_button.tsx
@@ -13,9 +13,9 @@ export interface BuyButtonProps {
assetBuyer?: AssetBuyer;
onAwaitingSignature: (buyQuote: BuyQuote) => void;
onSignatureDenied: (buyQuote: BuyQuote, preventedError: Error) => void;
- onBuyProcessing: (buyQuote: BuyQuote, txnHash: string) => void;
- onBuySuccess: (buyQuote: BuyQuote, txnHash: string) => void;
- onBuyFailure: (buyQuote: BuyQuote, txnHash?: string) => void; // TODO: make this non-optional
+ onBuyProcessing: (buyQuote: BuyQuote, txHash: string) => void;
+ onBuySuccess: (buyQuote: BuyQuote, txHash: string) => void;
+ onBuyFailure: (buyQuote: BuyQuote, txHash?: string) => void; // TODO: make this non-optional
}
export class BuyButton extends React.Component<BuyButtonProps> {
@@ -41,10 +41,10 @@ export class BuyButton extends React.Component<BuyButtonProps> {
return;
}
- let txnHash: string | undefined;
+ let txHash: string | undefined;
this.props.onAwaitingSignature(buyQuote);
try {
- txnHash = await assetBuyer.executeBuyQuoteAsync(buyQuote);
+ txHash = await assetBuyer.executeBuyQuoteAsync(buyQuote);
} catch (e) {
if (e instanceof Error && e.message === AssetBuyerError.SignatureRequestDenied) {
this.props.onSignatureDenied(buyQuote, e);
@@ -54,20 +54,20 @@ export class BuyButton extends React.Component<BuyButtonProps> {
}
// Have to let TS know that txHash is definitely defined now
- if (!txnHash) {
+ if (!txHash) {
throw new Error('No txHash available');
}
- this.props.onBuyProcessing(buyQuote, txnHash);
+ this.props.onBuyProcessing(buyQuote, txHash);
try {
- await web3Wrapper.awaitTransactionSuccessAsync(txnHash);
+ await web3Wrapper.awaitTransactionSuccessAsync(txHash);
} catch (e) {
if (e instanceof Error && e.message.startsWith('Transaction failed')) {
- this.props.onBuyFailure(buyQuote, txnHash);
+ this.props.onBuyFailure(buyQuote, txHash);
return;
}
throw e;
}
- this.props.onBuySuccess(buyQuote, txnHash);
+ this.props.onBuySuccess(buyQuote, txHash);
};
}
diff --git a/packages/instant/src/containers/selected_asset_buy_button.ts b/packages/instant/src/containers/selected_asset_buy_button.ts
index 17cc1a770..8d60715be 100644
--- a/packages/instant/src/containers/selected_asset_buy_button.ts
+++ b/packages/instant/src/containers/selected_asset_buy_button.ts
@@ -20,8 +20,8 @@ interface ConnectedState {
interface ConnectedDispatch {
onAwaitingSignature: (buyQuote: BuyQuote) => void;
onSignatureDenied: (buyQuote: BuyQuote, error: Error) => void;
- onBuyProcessing: (buyQuote: BuyQuote, txnHash: string) => void;
- onBuySuccess: (buyQuote: BuyQuote, txnHash: string) => void;
+ onBuyProcessing: (buyQuote: BuyQuote, txHash: string) => void;
+ onBuySuccess: (buyQuote: BuyQuote, txHash: string) => void;
onBuyFailure: (buyQuote: BuyQuote) => void;
}
@@ -35,12 +35,12 @@ const mapDispatchToProps = (dispatch: Dispatch<Action>, ownProps: SelectedAssetB
const newOrderState: OrderState = { processState: OrderProcessState.AWAITING_SIGNATURE };
dispatch(actions.updateBuyOrderState(newOrderState));
},
- onBuyProcessing: (buyQuote: BuyQuote, txnHash: string) => {
- const newOrderState: OrderState = { processState: OrderProcessState.PROCESSING, txnHash };
+ onBuyProcessing: (buyQuote: BuyQuote, txHash: string) => {
+ const newOrderState: OrderState = { processState: OrderProcessState.PROCESSING, txHash };
dispatch(actions.updateBuyOrderState(newOrderState));
},
- onBuySuccess: (buyQuote: BuyQuote, txnHash: string) =>
- dispatch(actions.updateBuyOrderState({ processState: OrderProcessState.SUCCESS, txnHash })),
+ onBuySuccess: (buyQuote: BuyQuote, txHash: string) =>
+ dispatch(actions.updateBuyOrderState({ processState: OrderProcessState.SUCCESS, txHash })),
onBuyFailure: buyQuote => dispatch(actions.updateBuyOrderState({ processState: OrderProcessState.FAILURE })),
onSignatureDenied: (buyQuote, error) => {
dispatch(actions.resetAmount());
diff --git a/packages/instant/src/containers/selected_asset_view_transaction_button.tsx b/packages/instant/src/containers/selected_asset_view_transaction_button.tsx
index 8239319a4..064b877be 100644
--- a/packages/instant/src/containers/selected_asset_view_transaction_button.tsx
+++ b/packages/instant/src/containers/selected_asset_view_transaction_button.tsx
@@ -22,7 +22,7 @@ const mapStateToProps = (state: State, _ownProps: {}): ConnectedState => ({
state.buyOrderState.processState === OrderProcessState.SUCCESS)
) {
const etherscanUrl = etherscanUtil.getEtherScanTxnAddressIfExists(
- state.buyOrderState.txnHash,
+ state.buyOrderState.txHash,
state.assetBuyer.networkId,
);
if (etherscanUrl) {
diff --git a/packages/instant/src/types.ts b/packages/instant/src/types.ts
index 60f8b8e38..255aee1eb 100644
--- a/packages/instant/src/types.ts
+++ b/packages/instant/src/types.ts
@@ -21,15 +21,15 @@ interface RegularOrderState {
}
interface ProcessingOrderState {
processState: OrderProcessState.PROCESSING;
- txnHash: string;
+ txHash: string;
}
interface SuccessfulOrderState {
processState: OrderProcessState.SUCCESS;
- txnHash: string;
+ txHash: string;
}
interface FailureOrderState {
processState: OrderProcessState.FAILURE;
- txnHash?: string;
+ txHash?: string;
}
export type OrderState = RegularOrderState | ProcessingOrderState | SuccessfulOrderState | FailureOrderState;
diff --git a/packages/instant/src/util/etherscan.ts b/packages/instant/src/util/etherscan.ts
index ffb08a382..cfc2578a3 100644
--- a/packages/instant/src/util/etherscan.ts
+++ b/packages/instant/src/util/etherscan.ts
@@ -14,11 +14,11 @@ const etherscanPrefix = (networkId: number): string | undefined => {
};
export const etherscanUtil = {
- getEtherScanTxnAddressIfExists: (txnHash: string, networkId: number) => {
+ getEtherScanTxnAddressIfExists: (txHash: string, networkId: number) => {
const prefix = etherscanPrefix(networkId);
if (_.isUndefined(prefix)) {
return;
}
- return `https://${prefix}etherscan.io/tx/${txnHash}`;
+ return `https://${prefix}etherscan.io/tx/${txHash}`;
},
};