sforkowany z mirror/soapbox
CryptoDonate: convert utils to ts
rodzic
c62d402a4e
commit
5d4eb96cca
|
@ -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"]
|
||||
|
|
Ładowanie…
Reference in New Issue