Skip to content
Merged
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
7 changes: 3 additions & 4 deletions backend/src/routes/metadata-routes.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
import { GetSecretValueCommand, SecretsManagerClient } from "@aws-sdk/client-secrets-manager";
import { FastifyPluginAsync } from "fastify";
import { Contract, Wallet, providers } from "ethers";
import { Contract, Wallet, providers, utils } from "ethers";
import SupportedNetworks from "../../config.json" assert { type: "json" };
import { getNetworkConfig, printRequest } from "../utils/common.js";
import ReturnCode from "../constants/ReturnCode.js";
Expand All @@ -13,7 +13,6 @@ import * as EtherspotAbi from "../abi/EtherspotAbi.js";
import {abi as verifyingPaymasterAbi} from "../abi/VerifyingPaymasterAbi.js";
import {abi as verifyingPaymasterV2Abi} from "../abi/VerifyingPaymasterAbiV2.js";
import {abi as verifyingPaymastersV3Abi} from "../abi/VerifyingPaymasterAbiV3.js";
import { getAddress } from "ethers/lib/utils";

const metadataRoutes: FastifyPluginAsync = async (server) => {

Expand Down Expand Up @@ -98,7 +97,7 @@ const metadataRoutes: FastifyPluginAsync = async (server) => {
if (networkConfig.contracts.etherspotPaymasterAddress) {
try {
//get native balance of the sponsor in the EtherSpotPaymaster-contract
const paymasterContract = new Contract(getAddress(networkConfig.contracts.etherspotPaymasterAddress), EtherspotAbi.default, provider);
const paymasterContract = new Contract(utils.getAddress(networkConfig.contracts.etherspotPaymasterAddress), EtherspotAbi.default, provider);
sponsorBalance = await paymasterContract.getDeposit();
} catch (err) {
request.log.error(err);
Expand Down Expand Up @@ -209,7 +208,7 @@ const metadataRoutes: FastifyPluginAsync = async (server) => {
if (networkConfig.contracts.etherspotPaymasterAddress) {
try {
//get native balance of the sponsor in the EtherSpotPaymaster-contract
const paymasterContract = new Contract(getAddress(networkConfig.contracts.etherspotPaymasterAddress), EtherspotAbi.default, provider);
const paymasterContract = new Contract(utils.getAddress(networkConfig.contracts.etherspotPaymasterAddress), EtherspotAbi.default, provider);
sponsorBalance = await paymasterContract.getDeposit();
} catch (err) {
request.log.error(err);
Expand Down