diff --git a/app/soapbox/features/crypto_donate/utils/block_explorer.js b/app/soapbox/features/crypto_donate/utils/block_explorer.js deleted file mode 100644 index 0929250bf..000000000 --- a/app/soapbox/features/crypto_donate/utils/block_explorer.js +++ /dev/null @@ -1,7 +0,0 @@ -import blockExplorers from './block_explorers.json'; - -export const getExplorerUrl = (ticker, address) => { - const template = blockExplorers[ticker]; - if (!template) return false; - return template.replace('{address}', address); -}; diff --git a/app/soapbox/features/crypto_donate/utils/block_explorer.ts b/app/soapbox/features/crypto_donate/utils/block_explorer.ts new file mode 100644 index 000000000..c02ea4abc --- /dev/null +++ b/app/soapbox/features/crypto_donate/utils/block_explorer.ts @@ -0,0 +1,9 @@ +import blockExplorers from './block_explorers.json'; + +type BlockExplorers = Record; + +export const getExplorerUrl = (ticker: string, address: string): string | null => { + const template = (blockExplorers as BlockExplorers)[ticker]; + if (!template) return null; + return template.replace('{address}', address); +}; diff --git a/app/soapbox/features/crypto_donate/utils/coin_db.js b/app/soapbox/features/crypto_donate/utils/coin_db.ts similarity index 100% rename from app/soapbox/features/crypto_donate/utils/coin_db.js rename to app/soapbox/features/crypto_donate/utils/coin_db.ts diff --git a/tsconfig.json b/tsconfig.json index 6af5fd813..beff5f647 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -8,6 +8,7 @@ "jsx": "react", "allowJs": true, "moduleResolution": "node", + "resolveJsonModule": true, "experimentalDecorators": true, "allowSyntheticDefaultImports": true, "typeRoots": [ "./types", "./node_modules/@types"]