Fix counter mutations

This commit is contained in:
minibits-cash
2026-01-10 00:39:30 +01:00
parent 9b606741b3
commit 480b0db1a2
2 changed files with 12 additions and 5 deletions
+7
View File
@@ -206,6 +206,13 @@ export const MintProofsCounterModel = types
counter: self.counter,
})
},
setProofsCounter(newCounter: number) {
self.counter = newCounter
log.debug('[setProofsCounter]', 'Set proofsCounter', {
counter: self.counter,
})
},
}))
.views(self => ({
// === In-flight requests ===
+5 -5
View File
@@ -403,7 +403,7 @@ export const WalletStoreModel = types
throw new AppError(Err.VALIDATION_ERROR, 'Missing mint instance', {mintUrl})
}
const cashuWallet = yield self.getWallet(
const cashuWallet: CashuWallet = yield self.getWallet(
mintUrl,
unit,
{
@@ -474,7 +474,7 @@ export const WalletStoreModel = types
// Update our counter to match what the wallet used (v3.x)
if (reservedCounters) {
currentCounter.counter = reservedCounters.next
currentCounter.setProofsCounter(reservedCounters.next)
log.debug('[receive] Updated counter', {
keysetId: reservedCounters.keysetId,
start: reservedCounters.start,
@@ -589,7 +589,7 @@ export const WalletStoreModel = types
// Update our counter to match what the wallet used (v3.x)
if (reservedCounters) {
currentCounter.counter = reservedCounters.next
currentCounter.setProofsCounter(reservedCounters.next)
log.debug('[send] Updated counter', {
keysetId: reservedCounters.keysetId,
start: reservedCounters.start,
@@ -818,7 +818,7 @@ export const WalletStoreModel = types
// Update our counter to match what the wallet used (v3.x)
if (reservedCounters) {
currentCounter.counter = reservedCounters.next
currentCounter.setProofsCounter(reservedCounters.next)
log.debug('[mintProofs] Updated counter', {
keysetId: reservedCounters.keysetId,
start: reservedCounters.start,
@@ -942,7 +942,7 @@ export const WalletStoreModel = types
// Update our counter to match what the wallet used (v3.x)
if (reservedCounters) {
currentCounter.counter = reservedCounters.next
currentCounter.setProofsCounter(reservedCounters.next)
log.debug('[prepareMelt] Updated counter', {
keysetId: reservedCounters.keysetId,
start: reservedCounters.start,