From 467c49bbb7326646e13a61432d1ccb1e09605cd4 Mon Sep 17 00:00:00 2001 From: Darwin <77340894+charmful0x@users.noreply.github.com> Date: Mon, 3 Oct 2022 12:24:23 +0200 Subject: [PATCH] feat: server - Linagee domains --- src/utils/server-utils.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/utils/server-utils.js b/src/utils/server-utils.js index d7d46c0..0ea2c7a 100644 --- a/src/utils/server-utils.js +++ b/src/utils/server-utils.js @@ -53,6 +53,7 @@ export async function getArkProfile(network, address) { userProfile.ANS = await getAnsProfile(userProfile.arweave_address); userProfile.ENS = await getEnsProfile(userProfile.evm_address); userProfile.AVVY = await getAvvyProfile(userProfile.evm_address); + userProfile.LINAGEE = await getLinageeDomains(userProfile.evm_address); userProfile.IS_VOUCHED = await isVouched(userProfile.arweave_address); userProfile.LENS_HANDLES = await getLensHandles(userProfile.evm_address); userProfile.GITPOAPS = await getGitPoaps(userProfile.evm_address); @@ -340,6 +341,37 @@ async function getLensHandles(evm_address) { } } +async function getLinageeDomains(address) { + try { + const options = { + method: "GET", + url: `https://deep-index.moralis.io/api/v2/${address}/nft`, + params: { + chain: "eth", + format: "decimal", + token_addresses: "0x2cc8342d7c8bff5a213eb2cde39de9a59b3461a7", + }, + headers: { accept: "application/json", "X-API-Key": "test" }, + }; + + const res = await axios.request(options); + + for (const domain of res?.data?.result) { + domain.open_sea_url = `https://opensea.io/assets/ethereum/0x2cc8342d7c8bff5a213eb2cde39de9a59b3461a7/${domain.token_id}`; + // delete unnecessay metadata + delete domain.token_uri; + delete domain.metadata; + delete domain.last_token_uri_sync; + delete domain.last_metadata_sync; + } + return res?.data?.result; + } catch (error) { + console.log(error); + return []; + } +} + + async function getGalaxyCreds(address) { try { const q = {