@@ -8,29 +8,26 @@ export function createGetInscriptionsByAddressCacheKey(address: string, networkI
88 return [ BitcoinQueryPrefixes . GetInscriptionsByAddress , networkId , address ] ;
99}
1010
11- // In lieu of reliable API, we scrape HTML from the Ordinals.com explorer and
12- // parses the HTML
13- // Example:
14- // https://ordinals.com/output/758bd2703dd9f0a2df31c2898aecf6caba05a906498c9bc076947f9fc4d8f081:0
11+ // In lieu of reliable API, we scrape HTML from the ordinals.com explorer
12+ // Ex: https://ordinals.com/output/758bd2703dd9f0a2df31c2898aecf6caba05a906498c9bc076947f9fc4d8f081:0
1513async function getOrdinalsComTxOutputHtmlPage ( id : string , index : number ) {
16- const resp = await axios . get ( `https://ordinals-explorer.generative.xyz /output/${ id } :${ index } ` ) ;
14+ const resp = await axios . get ( `https://ordinals.com /output/${ id } :${ index } ` ) ;
1715 return new DOMParser ( ) . parseFromString ( resp . data , 'text/html' ) ;
1816}
1917
20- export async function getNumberOfInscriptionOnUtxoUsingOrdinalsCom ( id : string , index : number ) {
18+ export async function getNumberOfInscriptionsOnUtxoUsingOrdinalsCom ( id : string , index : number ) {
2119 const utxoPage = await getOrdinalsComTxOutputHtmlPage ( id , index ) ;
2220
23- // First content on page is inscrption section header and thumbnail of
24- // inscrptions in utxo
21+ // First content on page is inscrption section header and thumbnail of inscrptions in utxo
2522 const firstSectionHeader = utxoPage . querySelector ( 'dl > dt:first-child' ) ;
2623 if ( ! firstSectionHeader )
2724 throw new Error ( 'If no element matching this selector is found, something is wrong' ) ;
2825
2926 const firstHeaderText = firstSectionHeader . textContent ;
3027 const thumbnailCount = utxoPage . querySelectorAll ( 'dl > dt:first-child + dd.thumbnails a' ) . length ;
3128
32- // Were HTML to page to change, thumbnailCount alone would dangerously return
33- // zero 0, hence additional check that inscrption header is also missing
29+ // Were HTML page to change, thumbnailCount alone would dangerously return zero,
30+ // hence additional check that inscription header is also missing
3431 if ( thumbnailCount === 0 && firstHeaderText !== 'inscriptions' ) return 0 ;
3532
3633 return thumbnailCount ;
0 commit comments