base / base/account-sdk

getPaymentStatus() fetches the transaction receipt but never returns transactionHash

Open Beginner friendly
#405 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
172
Forks
207
Avg merge
49m
Merged PRs (30d)
1

Description

### Describe the bug

`getPaymentStatus()` (`src/interface/payment/getPaymentStatus.ts`)
destructures `receipt: txReceipt` from the bundler's
`eth_getUserOperationReceipt` response and uses it to parse USDC
transfer logs (`txReceipt.logs`) for the `amount`/`recipient` fields on
a `completed` result. `txReceipt.transactionHash` is present on that
same object but is never read out or included anywhere in the returned
`PaymentStatus`.

`PaymentStatus` (`src/interface/payment/types.ts`) only exposes:
`status`, `id`, `message`, `sender`, `amount`, `recipient`, `reason`.
There's no field carrying the actual settlement transaction hash — only
`id`, which is the userOp hash, not an L2 transaction hash. Those are
different values and only one of them (`transactionHash`) resolves on
Basescan/a block explorer.

### Why this matters

We hit this as a real production bug: our "Try It" demo used
`payment.id` (the userOp hash) as if it were a transaction hash for
Basescan links and for our own X-PAYMENT proof header, for about a
month, silently making every smart-wallet payment's on-chain proof
unverifiable. The fix required calling the Coinbase bundler ourselves,
outside the SDK, purely to recover a value `getPaymentStatus()` had
already fetched internally and then discarded.

I'd expect this to affect most integrators who want to show or verify a
real on-chain transaction after a `pay()` call — `id` alone isn't enough
for that, and nothing in the return type signals that a separate lookup
is needed.

### Proposed fix

Add `transactionHash?: Hex` to `PaymentStatus` (present on `completed`,
and on `failed` when a receipt landed on-chain, absent on
`pending`/`not_found`), populated from `txReceipt.transactionHash` in
the `completed`/`failed` branches of `getPaymentStatus()`.

### Versions

- `@base-org/account`: 2.5.9

Contributor guide

Open the contributing guide

Research direction

Read src/interface/payment/getPaymentStatus.ts and src/interface/payment/types.ts, focusing on the receipt handling and completed/failed result branches. Confirm that the returned PaymentStatus exposes transactionHash from txReceipt.transactionHash for on-chain receipts, while pending and not_found results omit it.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
api, payments
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
88/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.