Skip to content

Commit

Permalink
update image sync script (cosmos#3073)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyParish69 authored Oct 28, 2023
1 parent 5234449 commit 794164c
Showing 1 changed file with 40 additions and 2 deletions.
42 changes: 40 additions & 2 deletions .github/workflows/utility/sync_images.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit 794164c

Please sign in to comment.