mirror of
https://github.com/tornadocash/tornado-initiation-ui.git
synced 2024-12-01 13:47:16 +01:00
34 lines
910 B
JavaScript
34 lines
910 B
JavaScript
/* eslint-disable no-console */
|
|
import txStatus from './txStatus'
|
|
const { hexToNumber } = require('web3-utils')
|
|
|
|
export const getters = {
|
|
txExplorerUrl: (state, getters, rootState, rootGetters) => (txHash) => {
|
|
const { explorerUrl } = rootGetters['provider/getNetwork']
|
|
return explorerUrl.tx + txHash
|
|
},
|
|
addressExplorerUrl: (state, getters, rootState, rootGetters) => (address) => {
|
|
const { explorerUrl } = rootGetters['provider/getNetwork']
|
|
return explorerUrl.address + address
|
|
},
|
|
}
|
|
|
|
export const actions = {
|
|
async runTxWatcher({ commit, dispatch }, { txHash }) {
|
|
const result = await dispatch(
|
|
'provider/waitForTxReceipt',
|
|
{ txHash },
|
|
{ root: true }
|
|
)
|
|
|
|
if (!result || !result.status) {
|
|
return false
|
|
}
|
|
|
|
const status =
|
|
hexToNumber(result.status) === 1 ? txStatus.success : txStatus.fail
|
|
|
|
return status === txStatus.success
|
|
},
|
|
}
|