diff options
author | Steve Klebanoff <steve@0xproject.com> | 2018-10-25 03:53:18 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-10-25 03:53:18 +0800 |
commit | 059868e9942fed4616750d212e706f09d17f397b (patch) | |
tree | 7c70fcd71641479479ff831e9e665f7b8e69fa30 /packages/instant/src/util | |
parent | 06ba26a6d30565e7c6c4032528089d30ecc39fdd (diff) | |
parent | 09f0bf7f0062bba51380ae904bff96baddf5f0f2 (diff) | |
download | dexon-sol-tools-059868e9942fed4616750d212e706f09d17f397b.tar.gz dexon-sol-tools-059868e9942fed4616750d212e706f09d17f397b.tar.zst dexon-sol-tools-059868e9942fed4616750d212e706f09d17f397b.zip |
Merge pull request #1179 from 0xProject/feature/instant/processing-state
[instant] Success and Processing state
Diffstat (limited to 'packages/instant/src/util')
-rw-r--r-- | packages/instant/src/util/etherscan.ts | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/packages/instant/src/util/etherscan.ts b/packages/instant/src/util/etherscan.ts new file mode 100644 index 000000000..ffb08a382 --- /dev/null +++ b/packages/instant/src/util/etherscan.ts @@ -0,0 +1,24 @@ +import * as _ from 'lodash'; + +import { Network } from '../types'; + +const etherscanPrefix = (networkId: number): string | undefined => { + switch (networkId) { + case Network.Kovan: + return 'kovan.'; + case Network.Mainnet: + return ''; + default: + return undefined; + } +}; + +export const etherscanUtil = { + getEtherScanTxnAddressIfExists: (txnHash: string, networkId: number) => { + const prefix = etherscanPrefix(networkId); + if (_.isUndefined(prefix)) { + return; + } + return `https://${prefix}etherscan.io/tx/${txnHash}`; + }, +}; |