Skip to content

Commit

Permalink
[Release] beta version 0.2.16-beta.7
Browse files Browse the repository at this point in the history
  • Loading branch information
saltict committed Oct 13, 2023
1 parent f0417ff commit 0ae3ceb
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 72 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"sideEffects": false,
"type": "module",
"version": "0.2.16-beta.6",
"version": "0.2.16-beta.7",
"workspaces": [
"packages/*"
],
Expand Down
2 changes: 1 addition & 1 deletion packages/chain-list-assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "0.2.16-beta.6",
"version": "0.2.16-beta.7",
"main": "index.js"
}
2 changes: 1 addition & 1 deletion packages/chain-list/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"./detectPackage.cjs"
],
"type": "module",
"version": "0.2.16-beta.6",
"version": "0.2.16-beta.7",
"main": "index.js",
"dependencies": {
"@polkadot/dev": "0.67.167",
Expand Down
2 changes: 1 addition & 1 deletion packages/chain-list/src/packageInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@

// Do not edit, auto-generated by @polkadot/dev

export const packageInfo = { name: '@subwallet/chain-list', path: 'auto', type: 'auto', version: '0.2.16-beta.6' };
export const packageInfo = { name: '@subwallet/chain-list', path: 'auto', type: 'auto', version: '0.2.16-beta.7' };
76 changes: 8 additions & 68 deletions scripts/strapi/fetch-chains.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,84 +4,24 @@ import {DOWNLOAD_DIR, DOWNLOAD_LINK, downloadFile, graphQLClient, removeDir, wri

const SAVE_PATH = './packages/chain-list/src/data/ChainInfo.json';


const query = gql`
query {
chains (pagination: {pageSize: 1000}, sort: "ordinal:asc") {
data {
attributes {
slug
name
chainStatus
providers {
name
url
}
isTestnet
substrateInfo {
paraId
relaySlug
genesisHash
addressPrefix
crowdloanUrl
chainType
blockExplorer
symbol
existentialDeposit
decimals
supportStaking
hasNativeNft
supportSmartContract
}
evmInfo {
evmChainId
blockExplorer
symbol
decimals
existentialDeposit
supportSmartContract
abiExplorer
}
icon {
data {
attributes {
url
}
}
}
}
}
}
}
`;

const main = async () => {
const results = await graphQLClient.request(query);
const results = await fetch('https://content.subwallet.app/api/list/chain');
const data = await results.json();
const downloadDir = `${DOWNLOAD_DIR}/chains`;
const chains = await Promise.all(results.chains.data.map(async chain => {
const attributes = chain.attributes;
const providers = Object.fromEntries(attributes.providers.map(provider => [provider.name, provider.url]));

let iconURL = attributes.icon?.data?.attributes?.url;
const chains = await Promise.all(data.map(async chain => {
let iconURL = chain.icon;
if (iconURL) {
try {
const newFileName = await downloadFile(iconURL, downloadDir, attributes.slug.toLowerCase());
const newFileName = await downloadFile(iconURL, downloadDir, chain.slug.toLowerCase());
iconURL = `${DOWNLOAD_LINK}/assets/chains/${newFileName}`;
} catch (e) {
console.error(e);
}
}

return {
slug: attributes.slug,
name: attributes.name,
chainStatus: attributes.chainStatus,
providers,
isTestnet: attributes.isTestnet,
substrateInfo: attributes.substrateInfo,
evmInfo: attributes.evmInfo,
icon: iconURL,
}
chain.ordinal&& delete chain.ordinal;

return chain
}));

const chainMap = Object.fromEntries(chains.map(chain => [chain.slug, chain]));
Expand Down

0 comments on commit 0ae3ceb

Please sign in to comment.