From 96a45e4045c878fbd6fb89fe599c6f67e2ec77c4 Mon Sep 17 00:00:00 2001 From: Sebastian Gerske <13647606+H34D@users.noreply.github.com> Date: Mon, 5 Aug 2024 13:35:06 +0200 Subject: [PATCH] chore (metadata): Remove all metadata loading methods --- src/modules/credit-score/load.ts | 7 +---- src/modules/green/load.ts | 7 +---- src/modules/identity/load.ts | 11 +------- src/utils/clients/masa-client.ts | 46 -------------------------------- 4 files changed, 3 insertions(+), 68 deletions(-) diff --git a/src/modules/credit-score/load.ts b/src/modules/credit-score/load.ts index 951cf165..f2b002a1 100644 --- a/src/modules/credit-score/load.ts +++ b/src/modules/credit-score/load.ts @@ -1,7 +1,7 @@ import type { BigNumber } from "@ethersproject/bignumber"; import type { MasaInterface } from "../../interface"; -import { CreditScoreDetails, ICreditScore } from "../../interface"; +import { CreditScoreDetails } from "../../interface"; import { isBigNumber, patchMetadataUrl } from "../../utils"; export const loadCreditScoreDetails = async ( @@ -22,14 +22,9 @@ export const loadCreditScoreDetails = async ( console.info(`Credit Score Metadata URL: '${tokenUri}'`); } - const metadata = ( - await masa.client.metadata.get(tokenUri) - ); - return { tokenId, tokenUri, - metadata, }; }), ) diff --git a/src/modules/green/load.ts b/src/modules/green/load.ts index 9b24288e..4a5ee8d4 100644 --- a/src/modules/green/load.ts +++ b/src/modules/green/load.ts @@ -1,6 +1,6 @@ import { BigNumber } from "ethers"; -import type { GreenDetails, IGreen, MasaInterface } from "../../interface"; +import type { GreenDetails, MasaInterface } from "../../interface"; import { isBigNumber, patchMetadataUrl } from "../../utils"; export const loadGreenDetails = async ( @@ -21,14 +21,9 @@ export const loadGreenDetails = async ( console.info(`Green Metadata URL: '${tokenUri}'`); } - const metadata = ( - await masa.client.metadata.get(tokenUri) - ); - return { tokenId, tokenUri, - metadata, }; }), ) diff --git a/src/modules/identity/load.ts b/src/modules/identity/load.ts index 51d474a7..2bf8894e 100644 --- a/src/modules/identity/load.ts +++ b/src/modules/identity/load.ts @@ -1,11 +1,7 @@ import type { BigNumber } from "@ethersproject/bignumber"; import { Messages } from "../../collections"; -import type { - IdentityDetails, - IIdentity, - MasaInterface, -} from "../../interface"; +import type { IdentityDetails, MasaInterface } from "../../interface"; import { isBigNumber, patchMetadataUrl } from "../../utils"; import { resolveReverseIdentity } from "./resolve"; @@ -62,14 +58,9 @@ export const loadIdentityDetails = async ( console.info(`Identity Metadata URL: '${tokenUri}'`); } - const metadata: IIdentity | undefined = ( - await masa.client.metadata.get(tokenUri) - ); - return { tokenId: identityId, tokenUri, - metadata, }; }; diff --git a/src/utils/clients/masa-client.ts b/src/utils/clients/masa-client.ts index a8dd0e77..8002dcdd 100644 --- a/src/utils/clients/masa-client.ts +++ b/src/utils/clients/masa-client.ts @@ -5,9 +5,6 @@ import type { BaseResult, ChallengeResult, ChallengeResultWithCookie, - ICreditScore, - IGreen, - IIdentity, ISession, LogoutResult, MasaInterface, @@ -188,49 +185,6 @@ export class MasaClient extends MasaBase { }, }; - metadata = { - /** - * Retrieve metadata - * @param uri - * @param additionalHeaders - */ - get: async ( - uri: string, - additionalHeaders?: Record, - ): Promise => { - const headers = { - cookie: this.cookie ? [this.cookie] : undefined, - ...additionalHeaders, - }; - - const metadataResponse = await this._middlewareClient - .get(uri, { - headers, - }) - .catch((error: Error | AxiosError) => { - console.error("Failed to load Metadata!", error.message, uri); - }); - - const { data: metadataResponseData, status } = metadataResponse || {}; - - if (this.masa.config.verbose) { - console.dir( - { - metadataResponse: { - status, - metadataResponseData, - }, - }, - { - depth: null, - }, - ); - } - - return metadataResponseData; - }, - }; - soulName = { /** * Store metadata