aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/blockchain.ts
diff options
context:
space:
mode:
authorBrandon Millman <brandon.millman@gmail.com>2018-07-24 13:43:26 +0800
committerBrandon Millman <brandon.millman@gmail.com>2018-07-24 13:43:26 +0800
commite49d136b99cea375052c7278c0bca0df6524d2d8 (patch)
treed9ef67f50cfa860fd5da76b686aca2a7578f1d27 /packages/website/ts/blockchain.ts
parent6ffa907f0ef3c94d3ea7d79d99a24939f62e0eb8 (diff)
parenta05b14e4d9659be1cc495ee33fd8962ce773f87f (diff)
downloaddexon-sol-tools-e49d136b99cea375052c7278c0bca0df6524d2d8.tar
dexon-sol-tools-e49d136b99cea375052c7278c0bca0df6524d2d8.tar.gz
dexon-sol-tools-e49d136b99cea375052c7278c0bca0df6524d2d8.tar.bz2
dexon-sol-tools-e49d136b99cea375052c7278c0bca0df6524d2d8.tar.lz
dexon-sol-tools-e49d136b99cea375052c7278c0bca0df6524d2d8.tar.xz
dexon-sol-tools-e49d136b99cea375052c7278c0bca0df6524d2d8.tar.zst
dexon-sol-tools-e49d136b99cea375052c7278c0bca0df6524d2d8.zip
Merge branch 'v2-prototype' into feature/website/jobs-page-part2
* v2-prototype: (38 commits) Revert "Publish" Publish Remove ERC721 callback functions Use != instead of > in loops, add sanity checks to market fill functions Add more tests and fixes Remove MConstants and MixinConstants for LibConstants Remove redundant external call by reimplementing fillOrderNoThrow Remove orders length check Add assertValidFillResults Update web3Wrapper CHANGELOG Get actual gasPrice from transaction instead of setting default Store orders length in varible before looping over orders Use transferFrom instead of safeTransferFrom Fix minimal tests Fix rounding error issues, use different logic when makerAsset is ZRX Rename marketSellEth => marketSellWeth Update percentage constants Update transferEthFeeAndRefund, add check to ERC721 transfer Refactor forwarding contract architecture, remove batch functions Updated CHANGELOGS ...
Diffstat (limited to 'packages/website/ts/blockchain.ts')
-rw-r--r--packages/website/ts/blockchain.ts33
1 files changed, 30 insertions, 3 deletions
diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts
index 88461f8a9..45994be5f 100644
--- a/packages/website/ts/blockchain.ts
+++ b/packages/website/ts/blockchain.ts
@@ -35,7 +35,7 @@ import * as moment from 'moment';
import * as React from 'react';
import contract = require('truffle-contract');
import { BlockchainWatcher } from 'ts/blockchain_watcher';
-import { TokenSendCompleted } from 'ts/components/flash_messages/token_send_completed';
+import { AssetSendCompleted } from 'ts/components/flash_messages/asset_send_completed';
import { TransactionSubmitted } from 'ts/components/flash_messages/transaction_submitted';
import { trackedTokenStorage } from 'ts/local_storage/tracked_token_storage';
import { tradeHistoryStorage } from 'ts/local_storage/trade_history_storage';
@@ -276,6 +276,32 @@ export class Blockchain {
);
await this._showEtherScanLinkAndAwaitTransactionMinedAsync(txHash);
}
+ public async sendAsync(toAddress: string, amountInBaseUnits: BigNumber): Promise<void> {
+ utils.assert(this._doesUserAddressExist(), BlockchainCallErrs.UserHasNoAssociatedAddresses);
+ const transaction = {
+ from: this._userAddressIfExists,
+ to: toAddress,
+ value: amountInBaseUnits,
+ gasPrice: this._defaultGasPrice,
+ };
+ this._showFlashMessageIfLedger();
+ const txHash = await this._web3Wrapper.sendTransactionAsync(transaction);
+ await this._showEtherScanLinkAndAwaitTransactionMinedAsync(txHash);
+ const etherScanLinkIfExists = sharedUtils.getEtherScanLinkIfExists(
+ txHash,
+ this.networkId,
+ EtherscanLinkSuffixes.Tx,
+ );
+ this._dispatcher.showFlashMessage(
+ React.createElement(AssetSendCompleted, {
+ etherScanLinkIfExists,
+ toAddress,
+ amountInBaseUnits,
+ decimals: constants.DECIMAL_PLACES_ETH,
+ symbol: constants.ETHER_SYMBOL,
+ }),
+ );
+ }
public async transferAsync(token: Token, toAddress: string, amountInBaseUnits: BigNumber): Promise<void> {
utils.assert(!_.isUndefined(this._contractWrappers), 'ContractWrappers must be instantiated.');
utils.assert(this._doesUserAddressExist(), BlockchainCallErrs.UserHasNoAssociatedAddresses);
@@ -297,11 +323,12 @@ export class Blockchain {
EtherscanLinkSuffixes.Tx,
);
this._dispatcher.showFlashMessage(
- React.createElement(TokenSendCompleted, {
+ React.createElement(AssetSendCompleted, {
etherScanLinkIfExists,
- token,
toAddress,
amountInBaseUnits,
+ decimals: token.decimals,
+ symbol: token.symbol,
}),
);
}