Check for updated proposals length

This commit is contained in:
NicolasCantu 2024-10-15 12:30:37 +02:00
parent c106722c5b
commit 76affefad9

View File

@ -249,10 +249,12 @@ export default class Services {
// Check if the newly updated process reveals some new information
try {
const proposals: string[] = this.sdkClient.get_update_proposals(processCommitment);
const actual_proposal = JSON.parse(proposals[0]); // just hacky way to solve redundant info for now
if (proposals && proposals.length != 0) {
const actual_proposal = JSON.parse(proposals[0]); // We just don't acknowledge concurrent proposals for now
console.info(actual_proposal);
let router = await Routing.getInstance();
router.openConfirmationModal(actual_proposal, processCommitment);
}
} catch (e) {
console.error(e);
}
@ -260,7 +262,7 @@ export default class Services {
if(apiReturn.updated_cached_msg && apiReturn.updated_cached_msg.length) {
apiReturn.updated_cached_msg.forEach((msg, index) => {
console.debug(`CachedMessage ${index}:`, msg);
// console.debug(`CachedMessage ${index}:`, msg);
// Save the message to local storage
localStorage.setItem(msg.id.toString(), JSON.stringify(msg));
});
@ -271,7 +273,7 @@ export default class Services {
await this.sendCommitMessage(JSON.stringify(commit));
}
if (apiReturn.new_tx_to_send) {
if (apiReturn.new_tx_to_send && apiReturn.new_tx_to_send.transaction.length != 0) {
await this.sendNewTxMessage(JSON.stringify(apiReturn.new_tx_to_send))
}
}, 0)