Compare commits
No commits in common. "454ab1ae21b5498de78ff728cbd8a0c229901a92" and "7c4c1760bcec2e7dc532c0400c00a7b946d2335f" have entirely different histories.
454ab1ae21
...
7c4c1760bc
@ -1,2 +0,0 @@
|
|||||||
VITE_CHAIN_ID =
|
|
||||||
VITE_SBT_ADDR =
|
|
||||||
1
.gitignore
vendored
1
.gitignore
vendored
@ -26,4 +26,3 @@ coverage
|
|||||||
*.njsproj
|
*.njsproj
|
||||||
*.sln
|
*.sln
|
||||||
*.sw?
|
*.sw?
|
||||||
.env
|
|
||||||
|
|||||||
6081
package-lock.json
generated
6081
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,53 +1,10 @@
|
|||||||
<script>
|
<script>
|
||||||
import Web3 from 'web3';
|
|
||||||
import SBT from '@/assets/SBT.json'
|
|
||||||
import WarningModal from '../components/WarningModal.vue'
|
|
||||||
import SuccessModal from '../components/SuccessModal.vue'
|
|
||||||
import { useClientStore } from '../stores/Client.js'
|
|
||||||
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: { WarningModal, SuccessModal },
|
name: 'PageFooter'
|
||||||
name: 'PageFooter',
|
|
||||||
data () {
|
|
||||||
return {
|
|
||||||
SBTAddress: import.meta.env.VITE_SBT_ADDR,
|
|
||||||
number: '',
|
|
||||||
warningModalStatus: false,
|
|
||||||
successModalStatus: false,
|
|
||||||
msg: '',
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
async check () {
|
|
||||||
console.log(this.SBTAddress)
|
|
||||||
const web3 = new Web3(window.ethereum)
|
|
||||||
const clientAddr = (await web3.eth.getAccounts())[0]
|
|
||||||
var token = new web3.eth.Contract(SBT, this.SBTAddress)
|
|
||||||
var returnNumber = await token.methods.getAccountNumber(clientAddr).call()
|
|
||||||
if (returnNumber != 0 && returnNumber == number) {
|
|
||||||
this.successModalStatus = true
|
|
||||||
this.msg = 'Success: '+returnNumber
|
|
||||||
} else {
|
|
||||||
this.warningModalStatus = true
|
|
||||||
this.msg = 'Fail: '+returnNumber
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<button class='button is-info is-large'>mint</button>
|
SBT
|
||||||
<hr>
|
|
||||||
<form>
|
|
||||||
number: <input type='text' v-model='number'>
|
|
||||||
<input type='submit' class='button is-success'>
|
|
||||||
</form>
|
|
||||||
<button class='button is-info is-large' @click='check'>check</button>
|
|
||||||
|
|
||||||
<WarningModal :active="warningModalStatus" :errorMsg="msg" @closeModal="warningModalStatus=false"></WarningModal>
|
|
||||||
<SuccessModal :active="successModalStatus" :successMsg="msg" @closeModal="successModalStatus=false" link="/signup/linksbt" btnName="繼續"></SuccessModal>
|
|
||||||
|
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@ -20,8 +20,7 @@ export default {
|
|||||||
const provider = await detectEthereumProvider()
|
const provider = await detectEthereumProvider()
|
||||||
if (provider) {
|
if (provider) {
|
||||||
const chainId = await window.ethereum.request({ method: 'eth_chainId' })
|
const chainId = await window.ethereum.request({ method: 'eth_chainId' })
|
||||||
console.log(chainId)
|
if (chainId == 0xaa36a7) {
|
||||||
if (chainId == import.meta.env.VITE_CHAIN_ID) {
|
|
||||||
const account = await window.ethereum.request({ method: 'eth_requestAccounts' })
|
const account = await window.ethereum.request({ method: 'eth_requestAccounts' })
|
||||||
this.client.address = account[0]
|
this.client.address = account[0]
|
||||||
this.client.linked = true
|
this.client.linked = true
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user