CryptoDonate: convert utils to ts

merge-requests/1149/head
Alex Gleason 2022-03-25 16:39:26 -05:00
rodzic c62d402a4e
commit 5d4eb96cca
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
4 zmienionych plików z 10 dodań i 7 usunięć

Wyświetl plik

@ -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);
};

Wyświetl plik

@ -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);
};

Wyświetl plik

@ -8,6 +8,7 @@
"jsx": "react",
"allowJs": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"experimentalDecorators": true,
"allowSyntheticDefaultImports": true,
"typeRoots": [ "./types", "./node_modules/@types"]