sync
This commit is contained in:
parent
4f0c48c240
commit
5286b6c110
|
|
@ -38,16 +38,29 @@ function Beneficiary() {
|
||||||
var will_beneficiary = await eth.contractWithSigner.wills(response[i].toNumber());
|
var will_beneficiary = await eth.contractWithSigner.wills(response[i].toNumber());
|
||||||
//console.log(response[i].toNumber());
|
//console.log(response[i].toNumber());
|
||||||
|
|
||||||
var withdrawdateNew = timeConverter(will_beneficiary.withdrawDate.toNumber());
|
try{
|
||||||
|
var withdrawdateNew = timeConverter(will_beneficiary.withdrawDate.toNumber());
|
||||||
var myWill = {
|
var myWill = {
|
||||||
id: response[i].toNumber(),
|
id: response[i].toNumber(),
|
||||||
amount: ethers.utils.formatEther(will_beneficiary.amount),
|
amount: ethers.utils.formatEther(will_beneficiary.amount),
|
||||||
testator: will_beneficiary.testator,
|
testator: will_beneficiary.testator,
|
||||||
beneficiary: will_beneficiary.beneficiary,
|
beneficiary: will_beneficiary.beneficiary,
|
||||||
withdrawDate: withdrawdateNew
|
withdrawDate: withdrawdateNew
|
||||||
|
}
|
||||||
}
|
}
|
||||||
console.log(myWill)
|
catch(e) {
|
||||||
|
console.log("Invalid withdrawDate");
|
||||||
|
var myWill = {
|
||||||
|
id: response[i].toNumber(),
|
||||||
|
amount: ethers.utils.formatEther(will_beneficiary.amount),
|
||||||
|
testator: will_beneficiary.testator,
|
||||||
|
beneficiary: will_beneficiary.beneficiary,
|
||||||
|
withdrawDate: "Invalid withdrawDate: " + will_beneficiary.withdrawDate._hex
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log(myWill)
|
||||||
myBeneficiary.push(myWill);
|
myBeneficiary.push(myWill);
|
||||||
}
|
}
|
||||||
setwill_beneficiary(myBeneficiary);
|
setwill_beneficiary(myBeneficiary);
|
||||||
|
|
|
||||||
|
|
@ -42,10 +42,13 @@ async function withdraw(){
|
||||||
<br/>
|
<br/>
|
||||||
<div className="btnArea">
|
<div className="btnArea">
|
||||||
{ props.amount > 0 ?
|
{ props.amount > 0 ?
|
||||||
|
<div>
|
||||||
<button className="withdrawBtn" onClick={withdraw} >Withdraw</button>
|
<button className="withdrawBtn" onClick={withdraw} >Withdraw</button>
|
||||||
|
</div>
|
||||||
:
|
:
|
||||||
<button className="withdrawBtn" onClick={withdraw} disabled>Withdraw</button>
|
<button className="withdrawBtn" onClick={withdraw} disabled>Withdraw</button>
|
||||||
}
|
}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -34,14 +34,25 @@ function Testator() {
|
||||||
console.log(response[i].toNumber());
|
console.log(response[i].toNumber());
|
||||||
var will_testator = await eth.contractWithSigner.wills(response[i].toNumber());
|
var will_testator = await eth.contractWithSigner.wills(response[i].toNumber());
|
||||||
|
|
||||||
var withdrawdateNew = timeConverter(will_testator.withdrawDate.toNumber());
|
try{
|
||||||
|
var withdrawdateNew = timeConverter(will_testator.withdrawDate.toNumber());
|
||||||
var myWill = {
|
var myWill = {
|
||||||
id: response[i].toNumber(),
|
id: response[i].toNumber(),
|
||||||
amount: ethers.utils.formatEther(will_testator.amount),
|
amount: ethers.utils.formatEther(will_testator.amount),
|
||||||
testator: will_testator.testator,
|
testator: will_testator.testator,
|
||||||
beneficiary: will_testator.beneficiary,
|
beneficiary: will_testator.beneficiary,
|
||||||
withdrawDate: withdrawdateNew
|
withdrawDate: withdrawdateNew
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(e) {
|
||||||
|
console.log("Invalid withdrawDate");
|
||||||
|
var myWill = {
|
||||||
|
id: response[i].toNumber(),
|
||||||
|
amount: ethers.utils.formatEther(will_testator.amount),
|
||||||
|
testator: will_testator.testator,
|
||||||
|
beneficiary: will_testator.beneficiary,
|
||||||
|
withdrawDate: "Invalid withdrawDate: " + will_testator.withdrawDate._hex,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
myWills.push(myWill);
|
myWills.push(myWill);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue