|
1 | 1 | import { rpc, xdr, StrKey } from '@stellar/stellar-sdk'; |
2 | | -import { prisma } from '../lib/prisma.js'; |
| 2 | +import { prisma, Prisma } from '../lib/prisma.js'; |
3 | 3 | import { INDEXER_STATE_ID } from '../lib/indexer-state.js'; |
4 | 4 | import { sseService } from '../services/sse.service.js'; |
5 | 5 | import logger from '../logger.js'; |
@@ -146,7 +146,7 @@ export class SorobanEventWorker { |
146 | 146 | this.pollTimer = setTimeout(() => this.poll(), this.pollIntervalMs); |
147 | 147 | } |
148 | 148 |
|
149 | | - private async ensureSystemStream(tx: any): Promise<void> { |
| 149 | + private async ensureSystemStream(tx: Prisma.TransactionClient): Promise<void> { |
150 | 150 | const systemUser = 'GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF'; |
151 | 151 | await tx.user.upsert({ |
152 | 152 | where: { publicKey: systemUser }, |
@@ -351,7 +351,7 @@ export class SorobanEventWorker { |
351 | 351 | const newFeeRateBps = decodeU32(body['new_fee_rate_bps']); |
352 | 352 | const timestamp = Math.floor(Date.now() / 1000); |
353 | 353 |
|
354 | | - await prisma.$transaction(async (tx: any) => { |
| 354 | + await prisma.$transaction(async (tx: Prisma.TransactionClient) => { |
355 | 355 | await this.ensureSystemStream(tx); |
356 | 356 |
|
357 | 357 | await tx.streamEvent.upsert({ |
@@ -399,7 +399,7 @@ export class SorobanEventWorker { |
399 | 399 | const newAdmin = decodeAddress(body['new_admin']); |
400 | 400 | const timestamp = Math.floor(Date.now() / 1000); |
401 | 401 |
|
402 | | - await prisma.$transaction(async (tx: any) => { |
| 402 | + await prisma.$transaction(async (tx: Prisma.TransactionClient) => { |
403 | 403 | await this.ensureSystemStream(tx); |
404 | 404 |
|
405 | 405 | await tx.streamEvent.upsert({ |
@@ -462,7 +462,7 @@ export class SorobanEventWorker { |
462 | 462 | ? null |
463 | 463 | : startTime + Number(BigInt(depositedAmount) / ratePerSecondBigInt); |
464 | 464 |
|
465 | | - await prisma.$transaction(async (tx: any) => { |
| 465 | + await prisma.$transaction(async (tx: Prisma.TransactionClient) => { |
466 | 466 | await tx.user.upsert({ |
467 | 467 | where: { publicKey: sender }, |
468 | 468 | create: { publicKey: sender }, |
@@ -551,7 +551,7 @@ export class SorobanEventWorker { |
551 | 551 | const newDepositedAmount = decodeI128(body['new_deposited_amount']); |
552 | 552 | const timestamp = Math.floor(Date.now() / 1000); |
553 | 553 |
|
554 | | - await prisma.$transaction(async (tx: any) => { |
| 554 | + await prisma.$transaction(async (tx: Prisma.TransactionClient) => { |
555 | 555 | const stream = await tx.stream.findUniqueOrThrow({ |
556 | 556 | where: { streamId }, |
557 | 557 | select: { ratePerSecond: true, startTime: true, totalPausedDuration: true } |
@@ -622,7 +622,7 @@ export class SorobanEventWorker { |
622 | 622 | const amount = decodeI128(body['amount']); |
623 | 623 | const timestamp = Number(decodeU64(body['timestamp'])); |
624 | 624 |
|
625 | | - await prisma.$transaction(async (tx: any) => { |
| 625 | + await prisma.$transaction(async (tx: Prisma.TransactionClient) => { |
626 | 626 | const stream = await tx.stream.findUniqueOrThrow({ |
627 | 627 | where: { streamId }, |
628 | 628 | select: { withdrawnAmount: true }, |
@@ -688,7 +688,7 @@ export class SorobanEventWorker { |
688 | 688 | const refundedAmount = decodeI128(body['refunded_amount']); |
689 | 689 | const timestamp = Math.floor(Date.now() / 1000); |
690 | 690 |
|
691 | | - await prisma.$transaction(async (tx: any) => { |
| 691 | + await prisma.$transaction(async (tx: Prisma.TransactionClient) => { |
692 | 692 | await tx.stream.update({ |
693 | 693 | where: { streamId }, |
694 | 694 | data: { |
@@ -746,7 +746,7 @@ export class SorobanEventWorker { |
746 | 746 | const totalWithdrawn = decodeI128(body['total_withdrawn']); |
747 | 747 | const timestamp = Math.floor(Date.now() / 1000); |
748 | 748 |
|
749 | | - await prisma.$transaction(async (tx: any) => { |
| 749 | + await prisma.$transaction(async (tx: Prisma.TransactionClient) => { |
750 | 750 | await tx.stream.update({ |
751 | 751 | where: { streamId }, |
752 | 752 | data: { |
@@ -853,7 +853,7 @@ export class SorobanEventWorker { |
853 | 853 | const pausedAt = Number(decodeU64(body['paused_at'])); |
854 | 854 | const timestamp = Math.floor(Date.now() / 1000); |
855 | 855 |
|
856 | | - await prisma.$transaction(async (tx: any) => { |
| 856 | + await prisma.$transaction(async (tx: Prisma.TransactionClient) => { |
857 | 857 | await tx.stream.update({ |
858 | 858 | where: { streamId }, |
859 | 859 | data: { |
@@ -910,7 +910,7 @@ export class SorobanEventWorker { |
910 | 910 | const newEndTime = Number(decodeU64(body['new_end_time'])); |
911 | 911 | const timestamp = Math.floor(Date.now() / 1000); |
912 | 912 |
|
913 | | - await prisma.$transaction(async (tx: any) => { |
| 913 | + await prisma.$transaction(async (tx: Prisma.TransactionClient) => { |
914 | 914 | // Get current stream to calculate paused duration |
915 | 915 | const currentStream = await tx.stream.findUniqueOrThrow({ |
916 | 916 | where: { streamId }, |
|
0 commit comments