Skip to content

Commit

Permalink
fix 'op.ledger' is possibly 'null'.
Browse files Browse the repository at this point in the history
  • Loading branch information
yoozo committed Feb 12, 2025
1 parent 32448b1 commit 916a760
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export async function handleOperation(
): Promise<void> {
logger.info(`Indexing operation ${op.id}, type: ${op.type}`);

const fromAccount = await checkAndGetAccount(op.from, op.ledger.sequence);
const toAccount = await checkAndGetAccount(op.to, op.ledger.sequence);
const fromAccount = await checkAndGetAccount(op.from, op.ledger!.sequence);
const toAccount = await checkAndGetAccount(op.to, op.ledger!.sequence);

const payment = Payment.create({
id: op.id,
Expand All @@ -27,8 +27,8 @@ export async function handleOperation(
amount: op.amount,
});

fromAccount.lastSeenLedger = op.ledger.sequence;
toAccount.lastSeenLedger = op.ledger.sequence;
fromAccount.lastSeenLedger = op.ledger!.sequence;
toAccount.lastSeenLedger = op.ledger!.sequence;
await Promise.all([fromAccount.save(), toAccount.save(), payment.save()]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export async function handleOperation(
): Promise<void> {
logger.info(`Indexing operation ${op.id}, type: ${op.type}`);

const fromAccount = await checkAndGetAccount(op.from, op.ledger.sequence);
const toAccount = await checkAndGetAccount(op.to, op.ledger.sequence);
const fromAccount = await checkAndGetAccount(op.from, op.ledger!.sequence);
const toAccount = await checkAndGetAccount(op.to, op.ledger!.sequence);

const payment = Payment.create({
id: op.id,
Expand All @@ -27,8 +27,8 @@ export async function handleOperation(
amount: op.amount,
});

fromAccount.lastSeenLedger = op.ledger.sequence;
toAccount.lastSeenLedger = op.ledger.sequence;
fromAccount.lastSeenLedger = op.ledger!.sequence;
toAccount.lastSeenLedger = op.ledger!.sequence;
await Promise.all([fromAccount.save(), toAccount.save(), payment.save()]);
}

Expand Down

0 comments on commit 916a760

Please sign in to comment.