Skip to content

Commit

Permalink
Merge pull request #1442 from hypersign-protocol/v5.6.0
Browse files Browse the repository at this point in the history
V5.6.0
  • Loading branch information
Vishwas1 authored Jul 10, 2022
2 parents 5febb6b + 5642630 commit 2603c81
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 60 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ coverage
# nyc test coverage
.nyc_output

*.env

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

Expand Down
18 changes: 0 additions & 18 deletions prod.env.txt

This file was deleted.

54 changes: 31 additions & 23 deletions src/components/participant/ActionInputs/ReefErc20.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,26 +40,34 @@
v-model="value.userWalletAddress"
:disabled="done"
:required="data.isManadatory"
v-if="!done"
></b-form-select>
<b-form-input
type="text"
:placeholder="data.placeHolder"
v-model="value.userWalletAddress.address"
:disabled="true"
:required="data.isManadatory"
v-else></b-form-input>
</div>
</b-col>
</b-row>
<b-row v-else>
<b-col cols="12" sm="12" md="12">
<ErrorMessage errorMessage="Install Reef browser extension" v-if="!done"/>
<b-form-select
<b-form-input
type="text"
:options="options"
v-model="value.userWalletAddress"
:placeholder="data.placeHolder"
v-model="value.userWalletAddress.address"
:disabled="done"
:required="data.isManadatory"
v-else
></b-form-select>
v-else></b-form-input>
</b-col>
</b-row>
<b-row v-if="!done && !showerror">
<b-col cols="12" sm="12" md="12" >
<button class="btn btn-link center" @click="update()">Continue</button>
<b-col class= "btn-group" cols="12" sm="12" md="12" >
<button class="btn btn-link" @click="invokeReef()">Connect Reef Wallet</button>
<button class="btn btn-link" @click="update()">Continue</button>
</b-col>
</b-row>
</b-card-body>
Expand Down Expand Up @@ -111,7 +119,7 @@ export default {
signature: "",
message_sign: "You are Signing this Message to confirm your Paricipation",
options:[{value: '', text: 'Please select your reef wallet'}],
options:[{value: '', text: 'Please select your Reef wallet'}],
value: {
contractAddress: "",
userWalletAddress: '',
Expand All @@ -132,11 +140,7 @@ export default {
Object.assign(this.value, { ...(this.data.value) });
}
eventBus.$on(`disableInput${this.data._id}`, this.disableInput);
// TODO: need to check if this works
await this.checkWeb3Injection();
await this.invokeReef()
await this.fetchAccounts()
},
methods: {
async checkWeb3Injection() {
Expand All @@ -157,32 +161,27 @@ export default {
},
async fetchAccounts() {
this.options = [{value: '', text: 'Please select your Reef wallet.'}];
for (let i in this.wallet) {
this.options.push({value:this.wallet[i],text: 'Address: '+ this.wallet[i].address.slice(0,12)+'...'+this.wallet[i].address.slice(38,48)+' Name: '+this.wallet[i].name})
}
this.value.userWalletAddress = this.options[1]? this.options[1].value : this.options[0].value
},
async invokeReef() {
try {
if (this.web3 && this.web3.reef) {
if (this.web3 && this.web3.reef) {
let sign;
await window.injectedWeb3.reef.enable()
.then(async walletObj=>{
this.wallet = await walletObj.accounts.get();
this.walletSignObj=walletObj
await this.fetchAccounts();
})
// const walletAddr= await wallet.get
}
} catch (error) {
return this.notifyErr(error.message)
Expand Down Expand Up @@ -225,7 +224,16 @@ export default {
return true;
},
async fetchBalance() {
if(!this.value.contractAddress){
throw new Error("Missing contract address")
}
if(!this.value.userWalletAddress.address){
throw new Error("Missing userWallet address")
}
this.signature=await this.walletSignObj.signer.signRaw(this.value.userWalletAddress)
const body = {
actionType: this.data.type,
Expand Down
42 changes: 31 additions & 11 deletions src/components/participant/ActionInputs/ReefErc721.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,26 +40,34 @@
v-model="value.userWalletAddress"
:disabled="done"
:required="data.isManadatory"
v-if="!done"
></b-form-select>
<b-form-input
type="text"
:placeholder="data.placeHolder"
v-model="value.userWalletAddress.address"
:disabled="true"
:required="data.isManadatory"
v-else></b-form-input>
</div>
</b-col>
</b-row>
<b-row v-else>
<b-col cols="12" sm="12" md="12">
<ErrorMessage errorMessage="Install Reef browser extension" v-if="!done" />
<b-form-select
<b-form-input
type="text"
:options="options"
v-model="value.userWalletAddress"
:placeholder="data.placeHolder"
v-model="value.userWalletAddress.address"
:disabled="done"
:required="data.isManadatory"
v-else
></b-form-select>
v-else></b-form-input>
</b-col>
</b-row>
<b-row v-if="!done && !showerror">
<b-col cols="12" sm="12" md="12" >
<button class="btn btn-link center" @click="update()">Continue</button>
<b-col class= "btn-group" cols="12" sm="12" md="12" >
<button class="btn btn-link" @click="invokeReef()">Connect Reef</button>
<button class="btn btn-link" @click="update()">Continue</button>
</b-col>
</b-row>
</b-card-body>
Expand Down Expand Up @@ -111,7 +119,7 @@ export default {
signature: "",
message_sign: "You are Signing this Message to confirm your Paricipation",
options:[{value: '', text: 'Please select your reef wallet'}],
options:[{value: '', text: 'Please select your Reef wallet'}],
value: {
contractAddress: "",
userWalletAddress: '',
Expand All @@ -133,9 +141,7 @@ export default {
Object.assign(this.value, { ...(this.data.value) });
}
eventBus.$on(`disableInput${this.data._id}`, this.disableInput);
this.checkWeb3Injection();
await this.invokeReef()
await this.fetchAccounts()
await this.checkWeb3Injection();
},
methods: {
async checkWeb3Injection() {
Expand All @@ -156,10 +162,13 @@ export default {
},
async fetchAccounts() {
this.options = [{value: '', text: 'Please select your reef wallet'}];
for (let i in this.wallet) {
this.options.push({value:this.wallet[i],text: 'Address: '+ this.wallet[i].address.slice(0,12)+'...'+this.wallet[i].address.slice(38,48)+' Name: '+this.wallet[i].name})
}
this.value.userWalletAddress = this.options[1]? this.options[1].value : this.options[0].value
},
async invokeReef() {
try {
Expand All @@ -171,6 +180,7 @@ export default {
.then(async walletObj=>{
this.wallet = await walletObj.accounts.get();
this.walletSignObj=walletObj
await this.fetchAccounts();
})
Expand Down Expand Up @@ -224,6 +234,16 @@ export default {
return true;
},
async fetchBalance() {
if(!this.value.contractAddress){
throw new Error("Missing contract address")
}
if(!this.value.userWalletAddress.address){
throw new Error("Missing userWallet address")
}
this.signature=await this.walletSignObj.signer.signRaw(this.value.userWalletAddress)
const body = {
Expand Down
19 changes: 11 additions & 8 deletions src/views/admin/Events.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1137,14 +1137,17 @@ export default {
);
localStorage.removeItem("userProjects");
tempProject.projects.splice(index, 1);
localStorage.setItem(
"userProjects",
JSON.stringify({
projects: tempProject.projects,
count: tempProject.projects.length,
})
);
if(tempProject){
tempProject.projects.splice(index, 1);
localStorage.setItem(
"userProjects",
JSON.stringify({
projects: tempProject.projects,
count: tempProject.projects.length,
})
);
}
if (json) {
if (!resp.ok) {
return this.notifyErr(json);
Expand Down

0 comments on commit 2603c81

Please sign in to comment.