aboutsummaryrefslogtreecommitdiffstats
path: root/packages/website/ts/blockchain.ts
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-07-19 19:11:44 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-07-19 19:11:44 +0800
commitdead04dce8b26a09cb0b451711517bcb4dea182c (patch)
tree2f3ce593251dee6b5be2ae454fe4bcad27f2987b /packages/website/ts/blockchain.ts
parent3a18c249f5c780240f3dac7eb318118740056367 (diff)
downloaddexon-sol-tools-dead04dce8b26a09cb0b451711517bcb4dea182c.tar
dexon-sol-tools-dead04dce8b26a09cb0b451711517bcb4dea182c.tar.gz
dexon-sol-tools-dead04dce8b26a09cb0b451711517bcb4dea182c.tar.bz2
dexon-sol-tools-dead04dce8b26a09cb0b451711517bcb4dea182c.tar.lz
dexon-sol-tools-dead04dce8b26a09cb0b451711517bcb4dea182c.tar.xz
dexon-sol-tools-dead04dce8b26a09cb0b451711517bcb4dea182c.tar.zst
dexon-sol-tools-dead04dce8b26a09cb0b451711517bcb4dea182c.zip
WIP for sending ether from portal (works)
Diffstat (limited to 'packages/website/ts/blockchain.ts')
-rw-r--r--packages/website/ts/blockchain.ts26
1 files changed, 26 insertions, 0 deletions
diff --git a/packages/website/ts/blockchain.ts b/packages/website/ts/blockchain.ts
index 88461f8a9..5d497dfb1 100644
--- a/packages/website/ts/blockchain.ts
+++ b/packages/website/ts/blockchain.ts
@@ -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,
+ );
+ // TODO
+ // this._dispatcher.showFlashMessage(
+ // React.createElement(TokenSendCompleted, {
+ // etherScanLinkIfExists,
+ // token,
+ // toAddress,
+ // amountInBaseUnits,
+ // }),
+ // );
+ }
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);