refresh inscriptions if needed and add utility func

This commit is contained in:
sneurlax 2023-07-23 18:19:38 -05:00
parent f32359ac1e
commit abd4bf9d7a
2 changed files with 15 additions and 5 deletions

View file

@ -1891,7 +1891,6 @@ class LitecoinWallet extends CoinServiceAPI
// TODO check the specific output, not just the address in general
// TODO optimize by querying the litescribe API for all addresses at once, instead of one API call per output
if (utxoOwnerAddress != null) {
// TODO add inscription to database
if (await inscriptionInAddress(utxoOwnerAddress!)) {
shouldBlock = true;
blockReason = "Ordinal";
@ -1927,15 +1926,16 @@ class LitecoinWallet extends CoinServiceAPI
}
}
if (inscriptionsRefreshNeeded) {
await refreshInscriptions();
}
Logging.instance.log(
'Outputs fetched: $outputArray',
level: LogLevel.Info,
);
// TODO replace with refreshInscriptions if outputs are changed
if (inscriptionsRefreshNeeded) {
await refreshInscriptions();
}
await db.updateUTXOs(walletId, outputArray);
// finally update balance

View file

@ -91,4 +91,14 @@ mixin OrdinalsInterface {
return false;
}
}
// check if an inscription is in a given <UTXO> output
Future<bool> inscriptionInAddresses(List<String> addresses) async {
var inscriptions = await _getInscriptionDataFromAddresses(addresses);
if (inscriptions.isNotEmpty) {
return true;
} else {
return false;
}
}
}