Skip to content

Commit

Permalink
temporarly remove jsonrpcproviderusage (#121)
Browse files Browse the repository at this point in the history
  • Loading branch information
liviuvlad-innovatorspark authored Jan 30, 2024
1 parent 066aa0a commit 5a1e8b9
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 13 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
"country-code-lookup": "^0.1.0",
"date-fns": "^2.30.0",
"dotenv": "^16.0.3",
"ethers": "^6.9.2",
"google-libphonenumber": "^3.2.32",
"handlebars": "^4.7.7",
"helmet": "^6.0.1",
Expand Down
12 changes: 0 additions & 12 deletions src/modules/smart-contract/smart-contract.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { AbiItem } from 'web3-utils';
import { VoucherStatus } from '../../common/constants/enums';
import abi from './abi/abi.json';
import { MintVoucherDto } from './dto/mint-voucher.dto';
import { ethers } from 'ethers';

@Injectable()
export class SmartContractService {
Expand Down Expand Up @@ -37,15 +36,13 @@ export class SmartContractService {
*/
async mintVoucher(mintVoucherDto: MintVoucherDto) {
try {
// const gasParams = await this.getGasFees();
//NOTICE: starting we will be using the wiiQare account to mint the vouchers!

const { ownerId, amount, currency, patientId } = mintVoucherDto;

const rr = this.web3.eth.accounts.wallet.add(
this.appConfigService.smartContractPrivateKey,
);
const gasPrice = await this.getGasFees()

const response = await this.wiiqareContract.methods
.mintVoucher([
Expand Down Expand Up @@ -189,8 +186,6 @@ export class SmartContractService {
this.appConfigService.smartContractPrivateKey,
);

const gasPrice = await this.getGasFees();

const response = await this.wiiqareContract.methods
.burn(
voucherID
Expand All @@ -204,11 +199,4 @@ export class SmartContractService {

return response;
}

private async getGasFees(): Promise<string> {
const rpcURL = "https://polygon.llamarpc.com";
const provider = new ethers.JsonRpcProvider(rpcURL);
const hexGasEstimate = (await provider.getFeeData()).gasPrice;
return BigInt(hexGasEstimate).toString();
}
}

0 comments on commit 5a1e8b9

Please sign in to comment.