update user outputs

This commit is contained in:
Sosthene00 2024-04-17 09:15:30 +02:00
parent 3330baefc1
commit a6f4a5122c

View File

@ -323,6 +323,29 @@ class Services {
return [];
}
}
public async updateOwnedOutputsForUser(preId: string): Promise<void> {
const services = await Services.getInstance();
let latest_outputs: outputs_list;
try {
latest_outputs = services.sdkClient.get_outpoints_for_user(preId);
} catch (error) {
console.error(error);
return;
}
try {
const indexedDB = await IndexedDB.getInstance();
const db = await indexedDB.getDb();
const storeName = indexedDB.getStoreList().AnkUser;
let user = await indexedDB.getObject<User>(db, storeName, preId);
user.outputs = latest_outputs;
await indexedDB.setObject(db, storeName, user, null);
} catch (error) {
console.error(error);
}
}
public async checkTransaction(tx: string, tweak_data: string, blkheight: number): Promise<string | null> {
const services = await Services.getInstance();