Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 13 additions & 18 deletions src/modules/smart-contract/smart-contract.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,11 @@ export class SmartContractService {
.send({
from: this.wiiQareAccount.address,
gasPrice: gasPrice,
gas: 500000
gas: 500000,
});

logInfo(`response -> ${response}`);



return response;
} catch (err) {
logError(`Error in mintVoucher: ${err}`);
Expand Down Expand Up @@ -154,7 +152,7 @@ export class SmartContractService {
.call({
from: this.wiiQareAccount.address,
gasPrice: gasPrice,
gas: 500000
gas: 500000,
});

return result;
Expand All @@ -163,7 +161,6 @@ export class SmartContractService {
}
}


/**
* This function is used to make a voucher split
* ** splitVoucher
Expand All @@ -174,12 +171,14 @@ export class SmartContractService {
*/
async splitVoucher(voucherID: string, firstVoucher: any, secondVoucher: any) {
try {
const accounts = await this.web3.eth.getAccounts();

const gasPrice = await this.web3.eth.getGasPrice();
const result = await this.wiiqareContract.methods
.splitVoucher(voucherID, firstVoucher, secondVoucher)
.call({ from: accounts[0] });

.send({
from: this.wiiQareAccount.address,
gasPrice: gasPrice,
gas: 500000,
});
return result;
} catch (err) {
logError(`Error in getVoucher: ${err}`);
Expand All @@ -192,15 +191,11 @@ export class SmartContractService {
);
const gasPrice = await this.web3.eth.getGasPrice();

const response = await this.wiiqareContract.methods
.burn(
voucherID
)
.send({
from: this.wiiQareAccount.address,
gasPrice: gasPrice,
gas: 500000
});
const response = await this.wiiqareContract.methods.burn(voucherID).send({
from: this.wiiQareAccount.address,
gasPrice: gasPrice,
gas: 500000,
});

logInfo(`response -> ${response}`);

Expand Down