explorer icon indicating copy to clipboard operation
explorer copied to clipboard

The parser for `NFTokenAcceptOffer` will sometimes return an incorrect address as buyer/accepter

Open will2022 opened this issue 2 years ago • 5 comments

I found an example where the parser for NFTokenAcceptOffer returns the wrong buyer: https://livenet.xrpl.org/transactions/E6CE3C3C554BA01891A9D12E89062C34BBEA6282CF8AA4D9AF8BF7D0E7D26B7D/simple

image

Looking at the detailed view it's possible to see who the real buyer is image

The ownership history shown on Bithomp does also specify the actual buyer

I've quickly looked at src/containers/shared/components/Transaction/NFTokenAcceptOffer/parser.ts. It seems like the accepter maybe should be defined as const accepter = acceptedOfferNode.Destination ? acceptedOfferNode.Destination : tx.Account;.

will2022 avatar Dec 05 '22 00:12 will2022

Fixed by https://github.com/ripple/explorer/pull/493

will2022 avatar Dec 05 '22 08:12 will2022

The #493 pull request isn't gonna fix this.

The AffectedNodes array has two DeletedNode objects. Both with the LedgerEntryType set to NFTokenOffer. It's the second one that has the correct NFT owner, but it's the first one that gets chosen.

For privacy-ish reasons, I'm attaching an image so searching for their wallet on Google won't link to this issue image

will2022 avatar Dec 05 '22 13:12 will2022

The #493 pull request isn't gonna fix this.

The AffectedNodes array has two DeletedNode objects. Both with the LedgerEntryType set to NFTokenOffer. It's the second one that has the correct NFT owner, but it's the first one that gets chosen.

For privacy-ish reasons, I'm attaching an image so searching for their wallet on Google won't link to this issue image

Thanks we will take a look

shawnxie999 avatar Dec 05 '22 15:12 shawnxie999

The problem is that the parser only takes the first accepted offer, but in a brokered transfer, two offers are accepted, and the account submitting the transaction is neither the seller nor the buyer. The tx.Account is the broker (which should probably also be specified, but separately).

So a fix would probably be to find all the accepted offer nodes (instead of just the first), make sure the number of nodes matches the number of offers, figure out which is the sell offer and which is the buy offer, and use that to determine the buyer and seller.

mvadari avatar Dec 05 '22 15:12 mvadari

@mvadari @ckniffen @will2022 I have opened a PR that would choose the NFTokenOffer node without the Destination field to fetch the buyer in brokered mode. Im open to discuss the correctness of this approach and whether there is a better way

EDIT 1: PR is still in progress, still need to correctly fetch the seller EDIT 2: PR is fixed

shawnxie999 avatar Dec 05 '22 16:12 shawnxie999