Skip to content

Commit bc85a7d

Browse files
committed
Add support for multiple networks.
1 parent eaa645f commit bc85a7d

13 files changed

+22718
-9454
lines changed

components/Arrow.vue

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
</script>
2121

2222
<style scoped lang="scss">
23+
@import '~assets/scss/_config';
2324
.separator {
2425
border-top: 1px solid $gray-light;
2526
}

components/BasicValidator.vue

+9-2
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,12 @@ import vueScroll from 'vue-scrollto'
7676
import Test from '~/components/Test'
7777
7878
export default {
79+
props: {
80+
chainId: {
81+
type: Number,
82+
default: 1
83+
}
84+
},
7985
data () {
8086
return {
8187
contract: '',
@@ -182,7 +188,7 @@ import Test from '~/components/Test'
182188
}
183189
this.$store.dispatch('reset')
184190
this.status = "loading"
185-
let isContract = await this.$axios.get(`/basic?test=1&contract=${this.contract}`)
191+
let isContract = await this.$axios.get(`/basic?test=1&contract=${this.contract}&chainId=${this.chainId}`)
186192
isContract.data.data ? this.validate() : this.state = "invalid"
187193
this.status = ""
188194
}
@@ -198,7 +204,7 @@ import Test from '~/components/Test'
198204
this.$store.commit('setContract', this.contract)
199205
this.state = "results"
200206
const promises = []
201-
this.test.forEach(t => promises.push(this.$axios.get(`/basic?test=${t.id}&contract=${this.contract}`)))
207+
this.test.forEach(t => promises.push(this.$axios.get(`/basic?test=${t.id}&contract=${this.contract}&chainId=${this.chainId}`)))
202208
const results = await Promise.all(promises)
203209
results.forEach((r, i) => this.test[i].result = r.data.data)
204210
this.status = ""
@@ -218,6 +224,7 @@ import Test from '~/components/Test'
218224
</script>
219225

220226
<style scoped lang="scss">
227+
@import '~assets/scss/_config';
221228
.row {
222229
width: 33%;
223230
}

components/Footer.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<footer>
33
<div class="container">
44
<div class="row">
5-
<div class="copyright">Powered by <a href="https://0xcert.org">0xcert</a> &copy; 2018</div>
5+
<div class="copyright">Powered by <a href="https://0xcert.org">0xcert</a> &copy; 2021</div>
66
<div><a href="https://0xcert.org/?goto=subscribe" target="_blank" rel="noopener">Subscribe for updates</a></div>
77
<div>Accepting donations: <a target="_blank" href="https://etherscan.io/address/0xf9196f9f176fd2ef9243e8960817d5fbe63d79aa">0xF9196F9f176fd2eF9243E8960817d5FbE63D79aa</a></div>
88
<div><a href="https://github.com/0xcert/erc721-validator" target="_blank" rel="noopener">ERC721 validator on GitHub</a></div>
@@ -12,6 +12,7 @@
1212
</template>
1313

1414
<style scoped lang="scss">
15+
@import '~assets/scss/_config';
1516
1617
footer {
1718
margin-top: 4rem;

components/StatusIcon.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
}
3131
</script>
3232

33-
<style scoped>
33+
<style scoped lang="scss">
3434
.icon {
3535
display: inline-block;
3636
margin-right: 1rem;

components/Test.vue

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import Icon from '~/components/StatusIcon'
3232
</script>
3333

3434
<style scoped lang="scss">
35+
@import '~assets/scss/_config';
3536
.test {
3637
display: flex;
3738
&__icon {}

components/TokenValidator.vue

+8-1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ import vueScroll from 'vue-scrollto'
6565
import Test from '~/components/Test'
6666
6767
export default {
68+
props: {
69+
chainId: {
70+
type: Number,
71+
default: 1
72+
}
73+
},
6874
data () {
6975
return {
7076
tokenId: '',
@@ -105,7 +111,7 @@ import Test from '~/components/Test'
105111
this.test.forEach(t => t.result = null)
106112
this.state = "results"
107113
const promises = []
108-
this.test.forEach(t => promises.push(this.$axios.get(`/token?test=${t.id}&contract=${this.$store.state.contract}&token=${this.tokenId}`)))
114+
this.test.forEach(t => promises.push(this.$axios.get(`/token?test=${t.id}&contract=${this.$store.state.contract}&token=${this.tokenId}&chainId=${this.chainId}`)))
109115
const results = await Promise.all(promises)
110116
results.forEach((r, i) => this.test[i].result = r.data.data)
111117
this.status = ""
@@ -126,6 +132,7 @@ import Test from '~/components/Test'
126132
</script>
127133

128134
<style scoped lang="scss">
135+
@import '~assets/scss/_config';
129136
.row {
130137
width: 50%;
131138
}

components/TransferValidator.vue

+20-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<div class="container">
33
<h2>Transfer Validation</h2>
4-
<p class="intro">Approve the Giver contract: <a href="https://etherscan.io/address/0xa0139F5Ab522c86D7F377336c50EEFCD6cAf696E" target="_blank" rel="noopener">0xa0139F5Ab522c86D7F377336c50EEFCD6cAf696E</a> for a token ID and input it bellow. The approved token <strong>WILL NOT</strong> get transfered during the test.</p>
4+
<p class="intro">Approve the Giver contract: <a :href="this.explorerLinks[this.chainId] + this.giverContracts[this.chainId]" target="_blank" rel="noopener">{{ this.giverContracts[this.chainId] }}</a> for a token ID and input it bellow. The approved token <strong>WILL NOT</strong> get transfered during the test.</p>
55
<p class="smaller">There can be a business decision that transfers for a token are not enabled and by such all test will fail.</p>
66
<form @submit.prevent="sanityCheck" novalidate>
77
<div class="input-group input-group-lg">
@@ -71,11 +71,27 @@ import Test from '~/components/Test'
7171
import vueScroll from 'vue-scrollto'
7272
7373
export default {
74+
props: {
75+
chainId: {
76+
type: Number,
77+
default: 1
78+
}
79+
},
7480
data () {
7581
return {
7682
approval: '',
7783
state: "inital",
7884
status: "",
85+
giverContracts: {
86+
1: '0xa0139F5Ab522c86D7F377336c50EEFCD6cAf696E',
87+
3: '0x0867cd9331287d18cb7cd40eb00628ea842d1bca',
88+
4: '0x40Bf8f5F5Deb968744CA5fD29321Cb9D456C2877'
89+
},
90+
explorerLinks: {
91+
1: 'https://etherscan.io/address/',
92+
3: 'https://ropsten.etherscan.io/address/',
93+
4: 'https://rinkeby.etherscan.io/address/'
94+
},
7995
sanity: {
8096
id: 14,
8197
name: "Transfer unsuccesfull",
@@ -197,7 +213,7 @@ import vueScroll from 'vue-scrollto'
197213
try {
198214
if (await this.$validator.validate()) {
199215
this.status = "loading"
200-
let isTransfer = await this.$axios.get(`/transfer?test=14&contract=${this.$store.state.contract}&token=${this.approval}&giver=${this.$store.state.giver}`)
216+
let isTransfer = await this.$axios.get(`/transfer?test=14&contract=${this.$store.state.contract}&token=${this.approval}&giver=${this.giverContracts[this.chainId]}&chainId=${this.chainId}`)
201217
isTransfer.data.data ? this.validate() : this.state = "invalid"
202218
this.status = ""
203219
}
@@ -213,7 +229,7 @@ import vueScroll from 'vue-scrollto'
213229
this.test.forEach(t => t.result = null)
214230
this.state = "results"
215231
const promises = []
216-
this.test.forEach(t => promises.push(this.$axios.get(`/transfer?test=${t.id}&contract=${this.$store.state.contract}&token=${this.approval}&giver=${this.$store.state.giver}`)))
232+
this.test.forEach(t => promises.push(this.$axios.get(`/transfer?test=${t.id}&contract=${this.$store.state.contract}&token=${this.approval}&giver=${this.giverContracts[this.chainId]}&chainId=${this.chainId}`)))
217233
const results = await Promise.all(promises)
218234
vueScroll.scrollTo('#transferResults')
219235
results.forEach((r, i) => this.test[i].result = r.data.data)
@@ -233,6 +249,7 @@ import vueScroll from 'vue-scrollto'
233249
</script>
234250

235251
<style scoped lang="scss">
252+
@import '~assets/scss/_config';
236253
.intro {
237254
max-width: 700px;
238255
}

jsconfig.json

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"compilerOptions": {
3+
"baseUrl": ".",
4+
"paths": {
5+
"~/*": ["./*"],
6+
"@/*": ["./*"],
7+
"~~/*": ["./*"],
8+
"@@/*": ["./*"]
9+
}
10+
},
11+
"exclude": ["node_modules", ".nuxt", "dist"]
12+
}

nuxt.config.js

+12-5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ let meta = {
44
}
55

66
module.exports = {
7+
/*
8+
** Nuxt rendering mode
9+
** See https://nuxtjs.org/api/configuration-mode
10+
*/
11+
mode: 'universal',
12+
/*
13+
** Nuxt target
14+
** See https://nuxtjs.org/api/configuration-target
15+
*/
16+
target: 'static',
717
head: {
818
title: meta.title,
919
meta: [
@@ -18,11 +28,9 @@ module.exports = {
1828
link: [{ rel: "icon", type: "image/png", href: "/favicon.png" }]
1929
},
2030
css: [
21-
{ src: "~/assets/scss/styles.scss" }
22-
],
23-
sassResources: [
24-
'@/assets/scss/_config.scss'
31+
'@/assets/scss/styles.scss'
2532
],
33+
// css: [{ src: '~/assets/scss/styles.scss', lang: 'scss' }],
2634
loading: {
2735
color: "#0971FF"
2836
},
@@ -32,7 +40,6 @@ module.exports = {
3240
],
3341
modules: [
3442
'@nuxtjs/axios',
35-
'nuxt-sass-resources-loader',
3643
['@nuxtjs/google-analytics', {
3744
id: 'UA-122962534-1'
3845
}]

0 commit comments

Comments
 (0)