File tree Expand file tree Collapse file tree 3 files changed +18
-11
lines changed
govtool/frontend/src/utils Expand file tree Collapse file tree 3 files changed +18
-11
lines changed Original file line number Diff line number Diff line change @@ -15,12 +15,6 @@ export const dRepSearchPhraseProcessor = async (phrase: string) => {
1515 let drepIDPhrase = phrase ;
1616
1717 try {
18- const adaHandleCIP105DRepId =
19- await adaHandleService . getAdaHandleCIP105DRepId ( phrase ) ;
20- if ( adaHandleCIP105DRepId ) {
21- return adaHandleCIP105DRepId ;
22- }
23-
2418 if (
2519 drepIDPhrase . startsWith ( "drep_script" ) ||
2620 drepIDPhrase . startsWith ( "drep" )
@@ -33,6 +27,12 @@ export const dRepSearchPhraseProcessor = async (phrase: string) => {
3327 return drepIDPhrase . slice ( 2 ) ;
3428 }
3529
30+ const adaHandleCIP105DRepId =
31+ await adaHandleService . getAdaHandleCIP105DRepId ( phrase ) ;
32+ if ( adaHandleCIP105DRepId ) {
33+ return adaHandleCIP105DRepId ;
34+ }
35+
3636 return drepIDPhrase ;
3737 } catch ( e ) {
3838 return phrase ;
Original file line number Diff line number Diff line change 66 */
77export const getImageSha = async ( imageUrl : string ) => {
88 try {
9- const response = await fetch ( imageUrl ) ;
9+ const response = await fetch ( imageUrl , {
10+ // Required to not being blocked by APIs that require a User-Agent
11+ headers : {
12+ "User-Agent" : "GovTool/image-sha" ,
13+ } ,
14+ } ) ;
1015 if ( ! response . ok )
1116 throw new Error ( `Failed to fetch image: ${ response . statusText } ` ) ;
1217
Original file line number Diff line number Diff line change @@ -48,16 +48,18 @@ export async function isReceivingAddress(address?: string) {
4848 if ( ! address ) {
4949 return true ;
5050 }
51+
52+ const receivingAddress = Address . from_bech32 ( address ) ;
53+ if ( receivingAddress ) {
54+ return true ;
55+ }
5156 const isValidAdaHandle = await adaHandleService . isValidAdaHandle ( address ) ;
5257
5358 if ( isValidAdaHandle ) {
5459 return true ;
5560 }
5661
57- const receivingAddress = Address . from_bech32 ( address ) ;
58- return receivingAddress
59- ? true
60- : i18n . t ( "forms.errors.mustBeReceivingAddress" ) ;
62+ return i18n . t ( "forms.errors.mustBeReceivingAddress" ) ;
6163 } catch ( e ) {
6264 return i18n . t ( "forms.errors.mustBeReceivingAddress" ) ;
6365 }
You can’t perform that action at this time.
0 commit comments