Skip to content

Commit 11db606

Browse files
committed
Merge dev: fix BigInt balance conversion
2 parents 7617c77 + ef20865 commit 11db606

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/services/deposit.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ export class DepositDetector {
6767
log.warn({ sig, accountKeys, treasury: this.cfg.treasuryAddress }, 'verifyDeposit: treasury not in accountKeys');
6868
return false;
6969
}
70-
const received = (postBalances[treasuryIdx] - preBalances[treasuryIdx]) / 1_000_000_000;
70+
// @solana/kit returns balances as BigInt, convert to Number for arithmetic
71+
const received = (Number(postBalances[treasuryIdx]) - Number(preBalances[treasuryIdx])) / 1_000_000_000;
7172
return received >= expectedSol * 0.999;
7273
} catch (err) {
7374
log.warn({ sig, err }, 'verifyDeposit: exception');
@@ -124,7 +125,7 @@ export class DepositDetector {
124125
const treasuryIdx = accountKeys.findIndex(k => k === String(this.cfg.treasuryAddress));
125126
if (treasuryIdx === -1) return;
126127

127-
const received = (txDetail.meta.postBalances[treasuryIdx] - txDetail.meta.preBalances[treasuryIdx]) / 1_000_000_000;
128+
const received = (Number(txDetail.meta.postBalances[treasuryIdx]) - Number(txDetail.meta.preBalances[treasuryIdx])) / 1_000_000_000;
128129
// Sender is the first account (fee payer)
129130
const sender = accountKeys[0];
130131

0 commit comments

Comments
 (0)