@@ -50,28 +50,16 @@ export class DepositDetector {
5050 const txDetail = await this . cfg . rpc . getTransaction ( sig , {
5151 maxSupportedTransactionVersion : 0 ,
5252 } ) . send ( ) as any ;
53- if ( ! txDetail ?. meta ) {
54- log . warn ( { sig } , 'verifyDeposit: no meta' ) ;
55- return false ;
56- }
53+ if ( ! txDetail ?. meta ) return false ;
5754 const { preBalances, postBalances } = txDetail . meta ;
58- // @solana /kit returns accountKeys (not staticAccountKeys)
55+ // @solana /kit returns accountKeys (not staticAccountKeys), and balances as BigInt
5956 const msg = txDetail . transaction . message ;
6057 const accountKeys : string [ ] = ( msg . accountKeys ?? msg . staticAccountKeys ?? [ ] ) . map ( String ) ;
61- if ( accountKeys . length === 0 ) {
62- log . warn ( { sig, messageKeys : Object . keys ( msg ) } , 'verifyDeposit: no account keys found' ) ;
63- return false ;
64- }
6558 const treasuryIdx = accountKeys . findIndex ( k => k === String ( this . cfg . treasuryAddress ) ) ;
66- if ( treasuryIdx === - 1 ) {
67- log . warn ( { sig, accountKeys, treasury : this . cfg . treasuryAddress } , 'verifyDeposit: treasury not in accountKeys' ) ;
68- return false ;
69- }
70- // @solana /kit returns balances as BigInt, convert to Number for arithmetic
59+ if ( treasuryIdx === - 1 ) return false ;
7160 const received = ( Number ( postBalances [ treasuryIdx ] ) - Number ( preBalances [ treasuryIdx ] ) ) / 1_000_000_000 ;
7261 return received >= expectedSol * 0.999 ;
73- } catch ( err ) {
74- log . warn ( { sig, err } , 'verifyDeposit: exception' ) ;
62+ } catch {
7563 return false ;
7664 }
7765 }
0 commit comments