Skip to content

Commit c300c2b

Browse files
Userclaude
authored andcommitted
fix(api): use ContractEventPayload.log.transactionHash in base watcher
The ethers v6 contract.on() listener receives ContractEventPayload as its last argument, not EventLog. Accessing event.transactionHash returned undefined, which then propagated into db.getPaymentByTxHash and triggered sql.js's "tried to bind a value of an unknown type (undefined)" error — so live VpnPayment events were silently dropped and payments never provisioned. Switch the listener to read event.log.transactionHash. The catch-up scanner was already correct (queryFilter returns EventLog), so on restart it will retroactively pick up any events the live listener missed within the 1000-block lookback window. Also gitignore .test-wallet.json (local throwaway key file). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 98bad9f commit c300c2b

2 files changed

Lines changed: 3 additions & 2 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,4 @@ wallets.env
2929

3030
# Memory (local session state)
3131
memory/
32+
.test-wallet.json

api/src/base-watcher.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,10 @@ export function startBaseWatcher(
110110
numDays: bigint,
111111
amount: bigint,
112112
_timestamp: bigint,
113-
event: ethers.EventLog,
113+
event: ethers.ContractEventPayload,
114114
) => {
115115
try {
116-
await processPaymentEvent(agentId, Number(numDays), amount, event.transactionHash, db, config, operator);
116+
await processPaymentEvent(agentId, Number(numDays), amount, event.log.transactionHash, db, config, operator);
117117
} catch (err) {
118118
console.error('[x402] Error processing payment event:', err);
119119
}

0 commit comments

Comments
 (0)