Skip to content

[Bug] walletConnect takeOffer Fails to Preview Supported Data Layer Offers and Leaves First Approval Without Semantic Details #2872

Description

@setiawans

What happened?

WalletConnect chia_takeOffer reuses the normal Show Offer Details preview flow from the GUI. That preview path assumes the backend get_offer_summary response is always a normal OfferSummaryRecord with fields like requested, offered, infos, and fees. For supported Data Layer offers, the backend intentionally returns a different summary shape through the same JSON summary field: a DataLayerSummary whose offered value is an array of singleton/root-transition entries and which does not contain requested, infos, or fees. The WalletConnect preview path does not handle that alternate shape. As a result, when a dApp sends a supported Data Layer offer through chia_takeOffer and the user clicks Show Offer Details, the modal fails with Cannot convert undefined or null to object. The user is then left with only the opaque bech32 offer string, even though the backend still accepts the same Data Layer offer type and can execute the associated singleton/store-root transition on approval.

Root Cause

On the BE:

  1. /chia-blockchain/chia/wallet/wallet_request_types.py:713 defines GetOfferSummaryResponse with either summary: OfferSummary or data_layer_summary: DataLayerSummary
  2. /chia-blockchain/chia/wallet/wallet_request_types.py:728-731 serialize data_layer_summary back into the JSON key summary
  3. /chia-blockchain/chia/wallet/trade_manager.py:968-979 detect Data Layer offers and return DataLayerWallet.get_offer_summary(offer)
  4. /chia-blockchain/chia/data_layer/data_layer_wallet.py:95-99 define DataLayerSummary as offered: list[SingletonSummary]

On the FE:

  1. /chia-blockchain-gui/packages/api/src/services/WalletService.ts:271 types getOfferSummary() as returning { id: string; summary: OfferSummaryRecord }
  2. /chia-blockchain-gui/packages/api/src/@types/OfferSummaryRecord.ts assumes requested, offered, infos, fees, and validTimes
  3. /chia-blockchain-gui/packages/gui/src/components/walletConnect/WalletConnectOfferPreview.tsx:20 opens OfferBuilderViewerDialog
  4. /chia-blockchain-gui/packages/gui/src/components/offers2/OfferBuilderViewerDialog.tsx:28 fetches getOfferSummary({ offerData: offer })
  5. /chia-blockchain-gui/packages/gui/src/components/offers2/OfferBuilderViewer.tsx:149 passes the parsed object into offerToOfferBuilderData()
  6. /chia-blockchain-gui/packages/gui/src/util/offerToOfferBuilderData.ts:14 destructures fees, offered, requested, infos
    7/ /chia-blockchain-gui/packages/gui/src/util/offerToOfferBuilderData.ts:28 immediately does Object.keys(requested)

Version

2.5.4-rc1

What platform are you using?

Linux

What ui mode are you using?

GUI

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions