Skip to main content

Function: fromOffer()

function fromOffer(offer): Offer;

Defined in: evm-client/src/utils.ts:257

The core domain's Offer as the contract struct — what EvmWriter submits to createOffer.

The inverse of toOffer, and it has to fill in the one field that shape drops: counterparty is set to the zero address, i.e. an offer anyone may fill. That is not a default chosen here — it is the only value consistent with the id. Core keys the offer by Serialization.id(offer), whose preimage covers counterparty as 32 bytes, and getId on the counterparty-less core Offer commits to 32 zero bytes (NO_COUNTERPARTY in serialization.ts). Submitting any other counterparty would store the offer under an id the SDK cannot re-derive, so cancelOffer and matchOffer would never find it again.

Parameters​

ParameterType
offerOffer

Returns​

Offer