From 794164cf3ec5b8f63e02ab366c8a44165bf122fb Mon Sep 17 00:00:00 2001 From: JeremyParish69 <95667791+JeremyParish69@users.noreply.github.com> Date: Sat, 28 Oct 2023 15:40:10 -0600 Subject: [PATCH] update image sync script (#3073) --- .github/workflows/utility/sync_images.mjs | 42 +++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/.github/workflows/utility/sync_images.mjs b/.github/workflows/utility/sync_images.mjs index ce10bde5c5..2f001a0364 100644 --- a/.github/workflows/utility/sync_images.mjs +++ b/.github/workflows/utility/sync_images.mjs @@ -245,11 +245,49 @@ function getLinkedImage(chain_name, base_denom){ } } +function overwriteLogoURIs(chain_name, base_denom){ + +// iterate chains +// iterate assets +// if images +// logo_URIs::png&&svg = images[0].png&&svg + + + + let chains = chain_reg.getChains(); + chains.forEach((chainName) => { + let images = chain_reg.getFileProperty(chainName, "chain", "images"); + let logo_URIs = { + png: images?.[0]?.png, + svg: images?.[0]?.svg + } + if(images) { + if(images[0].png || images[0].svg) { + chain_reg.setFileProperty(chainName, "chain", "logo_URIs", logo_URIs); + } + } + }); + + let assets = chain_reg.getAssetPointers(); + assets.forEach((assetPointer) => { + let images = chain_reg.getAssetProperty(assetPointer.chain_name, assetPointer.base_denom, "images"); + let logo_URIs = { + png: images?.[0]?.png, + svg: images?.[0]?.svg + } + if(images) { + if(images[0].png || images[0].svg) { + chain_reg.setAssetProperty(assetPointer.chain_name, assetPointer.base_denom, "logo_URIs", logo_URIs); + } + } + }); + +} + function main(){ createImagesArray(); - //pull from linked image getLinkedImages(); - //add to logo_URIs + overwriteLogoURIs(); } main() \ No newline at end of file