-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from cosmology-tech/transition-ibc-type
Transition ibc type
- Loading branch information
Showing
40 changed files
with
11,045 additions
and
6,560 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,21 @@ | ||
import { getIbcAssets } from '@chain-registry/utils'; | ||
import { getAssetLists } from '@chain-registry/utils'; | ||
import { assets, ibc } from 'chain-registry'; | ||
import { writeFileSync } from 'fs'; | ||
|
||
const ibc_assets = assets.reduce((m, { chain_name }) => { | ||
return [...m, ...getIbcAssets(chain_name, ibc, assets)]; | ||
const asset_lists = assets.reduce((m, { chain_name }) => { | ||
return [...m, ...getAssetLists(chain_name, ibc, assets)]; | ||
}, []); | ||
|
||
const write = (file, json) => { | ||
const write = (file, json, TypeName, isArray = false) => { | ||
const strfy = JSON.stringify(json, null, 2); | ||
const exportType = isArray ? TypeName + '[]' : TypeName; | ||
writeFileSync( | ||
`${__dirname}/../src/${file}.ts`, | ||
`export default ` + JSON.stringify(json, null, 2) + ';' | ||
`import { ${TypeName} } from '@chain-registry/types'; | ||
const ${file}: ${exportType} = ${strfy}; | ||
export default ${file}; | ||
` | ||
); | ||
}; | ||
|
||
write(`ibc_assets`, ibc_assets); | ||
write(`asset_lists`, asset_lists, 'AssetList', true); |
Oops, something went wrong.