Skip to content

Commit

Permalink
fix: valid start update
Browse files Browse the repository at this point in the history
Signed-off-by: Svetoslav Borislavov <[email protected]>
  • Loading branch information
SvetBorislavov committed Jan 22, 2025
1 parent a6ba313 commit ed227e0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,14 @@ async function handleSignSubmit() {
}
try {
updateValidStarts.value = false;
transactionGroup.updateTransactionValidStarts(transactionGroup.groupValidStart);
const ownerKeys = new Array<PublicKey>();
for (const key of user.keyPairs) {
ownerKeys.push(PublicKey.fromString(key.public_key));
}
const requiredKey = new KeyList(ownerKeys);
updateValidStarts.value = false;
await transactionGroupProcessor.value?.process(requiredKey);
} catch (error) {
updateValidStarts.value = true;
Expand Down
19 changes: 11 additions & 8 deletions front-end/src/renderer/stores/storeTransactionGroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,24 +239,27 @@ const useTransactionGroupStore = defineStore('transactionGroup', () => {
}

function updateTransactionValidStarts(newGroupValidStart: Date) {
groupItems.value = groupItems.value.map((item, index) => {
groupItems.value.forEach((groupItem, index) => {
const now = new Date();
if (item.validStart < now) {
if (groupItem.validStart < now) {
const updatedValidStart = findUniqueValidStart(
item.payerAccountId,
groupItem.payerAccountId,
newGroupValidStart.getTime() + index,
);
const transaction = Transaction.fromBytes(item.transactionBytes);
transaction.setTransactionId(createTransactionId(item.payerAccountId, updatedValidStart));
const transaction = Transaction.fromBytes(groupItem.transactionBytes);
transaction.setTransactionId(
createTransactionId(groupItem.payerAccountId, updatedValidStart),
);

return {
...item,
groupItems.value[index] = {
...groupItem,
transactionBytes: transaction.toBytes(),
validStart: updatedValidStart,
};
}
return item;
});
groupItems.value = [...groupItems.value];

setModified();
}

Expand Down

0 comments on commit ed227e0

Please sign in to comment.