diff --git a/components/AttestationButton.tsx b/components/AttestationButton.tsx index f8acd4b30..cf41d57ac 100644 --- a/components/AttestationButton.tsx +++ b/components/AttestationButton.tsx @@ -19,19 +19,23 @@ export default function AttestationButton(props: any) { return ( { + onPress={async () => { if (attestationStatus === 'neutral') { setLoading(true); - stores.lightningAddressStore - .lookupAttestations(hash, amount_msat) - .then(({ attestations, status }) => { - setAttestations(attestations); - setAttestationStatus(status || ''); - setLoading(false); - }) - .catch(() => { - setLoading(false); - }); + try { + const { attestations, status } = + await stores.lightningAddressStore.lookupAttestations( + hash, + amount_msat + ); + setAttestations(attestations); + setAttestationStatus(status || '' || 'error'); + } catch (error) { + console.error('Error fetching attestations:', error); + setAttestationStatus('error' || ''); + } finally { + setLoading(false); + } } else { if (attestationStatus === 'success') { navigation.navigate('Attestation', {