mirror of
https://github.com/tornadocash/tornado-initiation-ui.git
synced 2025-02-14 13:10:29 +01:00
fixes
This commit is contained in:
parent
129223239f
commit
dc07f3928c
@ -54,7 +54,9 @@
|
|||||||
type="is-primary"
|
type="is-primary"
|
||||||
outlined
|
outlined
|
||||||
icon-left="tool"
|
icon-left="tool"
|
||||||
:disabled="isNotLoggedIn || !canDeploy(data.domain)"
|
:disabled="
|
||||||
|
isNotLoggedIn || !canDeploy(data.domain) || data.isPending
|
||||||
|
"
|
||||||
@mousedown="(e) => e.preventDefault()"
|
@mousedown="(e) => e.preventDefault()"
|
||||||
@click="onDeploy"
|
@click="onDeploy"
|
||||||
>
|
>
|
||||||
@ -101,10 +103,8 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions('deploy', ['deployContract']),
|
...mapActions('deploy', ['deployContract']),
|
||||||
// todo pass ens domain here
|
onDeploy() {
|
||||||
onDeploy(/* domain */) {
|
this.deployContract({ action: this.data, index: this.$vnode.key })
|
||||||
// console.log('this.props', this.data)
|
|
||||||
this.deployContract({ action: this.data })
|
|
||||||
},
|
},
|
||||||
domainUrl(address) {
|
domainUrl(address) {
|
||||||
return `https://etherscan.io/address/${address}`
|
return `https://etherscan.io/address/${address}`
|
||||||
|
@ -36,11 +36,12 @@ export default {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
this.fetchDeploymentStatus()
|
this.fetchDeploymentStatus()
|
||||||
|
this.statusPooling()
|
||||||
this.fetchGasPrice()
|
this.fetchGasPrice()
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
...mapActions('provider', ['initProvider']),
|
...mapActions('provider', ['initProvider']),
|
||||||
...mapActions('steps', ['fetchDeploymentStatus']),
|
...mapActions('steps', ['statusPooling', 'fetchDeploymentStatus']),
|
||||||
...mapActions('gasPrice', ['fetchGasPrice']),
|
...mapActions('gasPrice', ['fetchGasPrice']),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
'@nuxtjs/provider',
|
'nuxt-web3-provider',
|
||||||
],
|
],
|
||||||
|
|
||||||
provider: {
|
provider: {
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
"deploy-prod": "npm run generate && push-dir --dir=dist --branch=gh-pages --cleanup --remote=temp"
|
"deploy-prod": "npm run generate && push-dir --dir=dist --branch=gh-pages --cleanup --remote=temp"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nuxtjs/provider": "https://github.com/tornadocash/provider",
|
"nuxt-web3-provider": "^0.1.1",
|
||||||
"core-js": "^3.6.5",
|
"core-js": "^3.6.5",
|
||||||
"gas-price-oracle": "^0.2.2",
|
"gas-price-oracle": "^0.2.2",
|
||||||
"node-sass": "^4.14.1",
|
"node-sass": "^4.14.1",
|
||||||
|
File diff suppressed because one or more lines are too long
@ -24,7 +24,7 @@ const mutations = {}
|
|||||||
const actions = {
|
const actions = {
|
||||||
async deployContract(
|
async deployContract(
|
||||||
{ state, dispatch, getters, rootGetters, commit, rootState },
|
{ state, dispatch, getters, rootGetters, commit, rootState },
|
||||||
{ action }
|
{ action, index }
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
dispatch('loading/enable', {}, { root: true })
|
dispatch('loading/enable', {}, { root: true })
|
||||||
@ -103,6 +103,11 @@ const actions = {
|
|||||||
})
|
})
|
||||||
console.log('txHash', txHash)
|
console.log('txHash', txHash)
|
||||||
dispatch('loading/disable', {}, { root: true })
|
dispatch('loading/disable', {}, { root: true })
|
||||||
|
dispatch(
|
||||||
|
'steps/setPendingState',
|
||||||
|
{ status: true, stepIndex: index },
|
||||||
|
{ root: true }
|
||||||
|
)
|
||||||
|
|
||||||
const noticeId = await dispatch(
|
const noticeId = await dispatch(
|
||||||
'notice/addNotice',
|
'notice/addNotice',
|
||||||
@ -131,6 +136,7 @@ const actions = {
|
|||||||
title: 'contractDeployed',
|
title: 'contractDeployed',
|
||||||
type: 'success',
|
type: 'success',
|
||||||
},
|
},
|
||||||
|
interval: 20000,
|
||||||
},
|
},
|
||||||
{ root: true }
|
{ root: true }
|
||||||
)
|
)
|
||||||
@ -144,6 +150,7 @@ const actions = {
|
|||||||
title: 'transactionFailed',
|
title: 'transactionFailed',
|
||||||
type: 'danger',
|
type: 'danger',
|
||||||
},
|
},
|
||||||
|
interval: 20000,
|
||||||
},
|
},
|
||||||
{ root: true }
|
{ root: true }
|
||||||
)
|
)
|
||||||
@ -162,6 +169,11 @@ const actions = {
|
|||||||
)
|
)
|
||||||
} finally {
|
} finally {
|
||||||
dispatch('loading/disable', {}, { root: true })
|
dispatch('loading/disable', {}, { root: true })
|
||||||
|
dispatch(
|
||||||
|
'steps/setPendingState',
|
||||||
|
{ status: false, stepIndex: index },
|
||||||
|
{ root: true }
|
||||||
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -46,12 +46,12 @@ export const actions = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
addNoticeWithInterval({ dispatch }, { notice, interval }) {
|
addNoticeWithInterval({ dispatch }, { notice, interval }) {
|
||||||
return new Promise((resolve) => {
|
// eslint-disable-next-line no-async-promise-executor
|
||||||
dispatch('addNotice', { notice }).then((id) => {
|
return new Promise(async (resolve) => {
|
||||||
|
const id = await dispatch('addNotice', { notice })
|
||||||
dispatch('addNoticeTimer', { id, interval })
|
dispatch('addNoticeTimer', { id, interval })
|
||||||
resolve(id)
|
resolve(id)
|
||||||
})
|
})
|
||||||
})
|
|
||||||
},
|
},
|
||||||
deleteNotice({ state, commit, dispatch }, { id }) {
|
deleteNotice({ state, commit, dispatch }, { id }) {
|
||||||
const index = state.notices.findIndex((i) => {
|
const index = state.notices.findIndex((i) => {
|
||||||
|
@ -18,7 +18,9 @@ export default {
|
|||||||
localStorage.setItem('provider', { name, network })
|
localStorage.setItem('provider', { name, network })
|
||||||
|
|
||||||
const account = await this.$provider.initProvider(getters.getProvider)
|
const account = await this.$provider.initProvider(getters.getProvider)
|
||||||
await dispatch('checkNetworkVersion')
|
const netId = await dispatch('checkNetworkVersion')
|
||||||
|
|
||||||
|
this.$provider.initWeb3(networkConfig[`netId${netId}`].rpcUrls.Infura.url)
|
||||||
|
|
||||||
commit(SET_ACCOUNT, account)
|
commit(SET_ACCOUNT, account)
|
||||||
|
|
||||||
@ -31,6 +33,7 @@ export default {
|
|||||||
try {
|
try {
|
||||||
const id = await this.$provider.checkNetworkVersion()
|
const id = await this.$provider.checkNetworkVersion()
|
||||||
commit(SET_NETWORK, { ...networkConfig[`netId${id}`], id: Number(id) })
|
commit(SET_NETWORK, { ...networkConfig[`netId${id}`], id: Number(id) })
|
||||||
|
return id
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw new Error(err.message)
|
throw new Error(err.message)
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ const getters = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const SET_DEPLOYER = 'SET_DEPLOYER'
|
const SET_DEPLOYER = 'SET_DEPLOYER'
|
||||||
|
const SET_PENDING_STATE = 'SET_PENDING_STATE'
|
||||||
const mutations = {
|
const mutations = {
|
||||||
[SET_DEPLOYER](state, { stepIndex, deployerAddress, deployTransaction }) {
|
[SET_DEPLOYER](state, { stepIndex, deployerAddress, deployTransaction }) {
|
||||||
this._vm.$set(state.steps[stepIndex], 'deployerAddress', deployerAddress)
|
this._vm.$set(state.steps[stepIndex], 'deployerAddress', deployerAddress)
|
||||||
@ -31,6 +32,9 @@ const mutations = {
|
|||||||
deployTransaction
|
deployTransaction
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
|
[SET_PENDING_STATE](state, { status, stepIndex }) {
|
||||||
|
this._vm.$set(state.steps[stepIndex], 'isPending', status)
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
const actions = {
|
const actions = {
|
||||||
@ -48,7 +52,6 @@ const actions = {
|
|||||||
if (!step) {
|
if (!step) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
console.log('event', event)
|
|
||||||
commit(SET_DEPLOYER, {
|
commit(SET_DEPLOYER, {
|
||||||
stepIndex: state.steps.indexOf(step),
|
stepIndex: state.steps.indexOf(step),
|
||||||
deployerAddress: event.returnValues.sender,
|
deployerAddress: event.returnValues.sender,
|
||||||
@ -56,6 +59,19 @@ const actions = {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
statusPooling({ dispatch }) {
|
||||||
|
setTimeout(async () => {
|
||||||
|
try {
|
||||||
|
console.log('Fetching deployment status...')
|
||||||
|
await dispatch('fetchDeploymentStatus')
|
||||||
|
} finally {
|
||||||
|
dispatch('statusPooling')
|
||||||
|
}
|
||||||
|
}, 15000)
|
||||||
|
},
|
||||||
|
setPendingState({ commit }, { status, stepIndex }) {
|
||||||
|
commit(SET_PENDING_STATE, { status, stepIndex })
|
||||||
|
},
|
||||||
}
|
}
|
||||||
export default {
|
export default {
|
||||||
namespaced: true,
|
namespaced: true,
|
||||||
|
15
yarn.lock
15
yarn.lock
@ -1410,13 +1410,6 @@
|
|||||||
consola "^2.11.3"
|
consola "^2.11.3"
|
||||||
eslint-loader "^4.0.2"
|
eslint-loader "^4.0.2"
|
||||||
|
|
||||||
"@nuxtjs/provider@https://github.com/tornadocash/provider":
|
|
||||||
version "0.0.5"
|
|
||||||
resolved "https://github.com/tornadocash/provider#cf186e3f2b852b95e51959855a61171309c8f478"
|
|
||||||
dependencies:
|
|
||||||
web3 "^1.3.0"
|
|
||||||
web3-utils "^1.3.0"
|
|
||||||
|
|
||||||
"@nuxtjs/youch@^4.2.3":
|
"@nuxtjs/youch@^4.2.3":
|
||||||
version "4.2.3"
|
version "4.2.3"
|
||||||
resolved "https://registry.yarnpkg.com/@nuxtjs/youch/-/youch-4.2.3.tgz#36f8b22df5a0efaa81373109851e1d857aca6bed"
|
resolved "https://registry.yarnpkg.com/@nuxtjs/youch/-/youch-4.2.3.tgz#36f8b22df5a0efaa81373109851e1d857aca6bed"
|
||||||
@ -7178,6 +7171,14 @@ nuxt-buefy@^0.4.4:
|
|||||||
dependencies:
|
dependencies:
|
||||||
buefy "^0.9.4"
|
buefy "^0.9.4"
|
||||||
|
|
||||||
|
nuxt-web3-provider@^0.1.1:
|
||||||
|
version "0.1.1"
|
||||||
|
resolved "https://registry.yarnpkg.com/nuxt-web3-provider/-/nuxt-web3-provider-0.1.1.tgz#8311b21444cf07e9f460c5ea4468c126c067e402"
|
||||||
|
integrity sha512-okYZwF0EsG5ukfYYCyFImnGQOCYvZLKKj2lUJfNaRbfcTR8KTbhxKBpuNtYA7V0ZJMdSQ3qbJ8ZQW64IoM9soA==
|
||||||
|
dependencies:
|
||||||
|
web3 "^1.3.0"
|
||||||
|
web3-utils "^1.3.0"
|
||||||
|
|
||||||
nuxt@^2.14.6:
|
nuxt@^2.14.6:
|
||||||
version "2.14.6"
|
version "2.14.6"
|
||||||
resolved "https://registry.yarnpkg.com/nuxt/-/nuxt-2.14.6.tgz#56ba99cbd055ebdb33250a4d1ed09f084ad7fa14"
|
resolved "https://registry.yarnpkg.com/nuxt/-/nuxt-2.14.6.tgz#56ba99cbd055ebdb33250a4d1ed09f084ad7fa14"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user