@@ -8,29 +8,26 @@ export function createGetInscriptionsByAddressCacheKey(address: string, networkI
8
8
return [ BitcoinQueryPrefixes . GetInscriptionsByAddress , networkId , address ] ;
9
9
}
10
10
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
15
13
async 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 } ` ) ;
17
15
return new DOMParser ( ) . parseFromString ( resp . data , 'text/html' ) ;
18
16
}
19
17
20
- export async function getNumberOfInscriptionOnUtxoUsingOrdinalsCom ( id : string , index : number ) {
18
+ export async function getNumberOfInscriptionsOnUtxoUsingOrdinalsCom ( id : string , index : number ) {
21
19
const utxoPage = await getOrdinalsComTxOutputHtmlPage ( id , index ) ;
22
20
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
25
22
const firstSectionHeader = utxoPage . querySelector ( 'dl > dt:first-child' ) ;
26
23
if ( ! firstSectionHeader )
27
24
throw new Error ( 'If no element matching this selector is found, something is wrong' ) ;
28
25
29
26
const firstHeaderText = firstSectionHeader . textContent ;
30
27
const thumbnailCount = utxoPage . querySelectorAll ( 'dl > dt:first-child + dd.thumbnails a' ) . length ;
31
28
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
34
31
if ( thumbnailCount === 0 && firstHeaderText !== 'inscriptions' ) return 0 ;
35
32
36
33
return thumbnailCount ;
0 commit comments