CryptoDonate: convert utils to ts
This commit is contained in:
@ -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);
|
||||
};
|
||||
@ -0,0 +1,9 @@
|
||||
import blockExplorers from './block_explorers.json';
|
||||
|
||||
type BlockExplorers = Record<string, string | null>;
|
||||
|
||||
export const getExplorerUrl = (ticker: string, address: string): string | null => {
|
||||
const template = (blockExplorers as BlockExplorers)[ticker];
|
||||
if (!template) return null;
|
||||
return template.replace('{address}', address);
|
||||
};
|
||||
@ -8,6 +8,7 @@
|
||||
"jsx": "react",
|
||||
"allowJs": true,
|
||||
"moduleResolution": "node",
|
||||
"resolveJsonModule": true,
|
||||
"experimentalDecorators": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"typeRoots": [ "./types", "./node_modules/@types"]
|
||||
|
||||
Reference in New Issue
Block a user