The Cancel Offer feature allows the user to cancel an offer they raised before the sale is completed or the offer expires. This process involves two APIs:
- initiateCancelOffer: This API fetches the offer details, token asset information, and contract details required to initiate the offer cancellation transaction. The front end can trigger the cancellation transaction using the Phantom or Backpack wallet.
- cancelOffer: After the transaction is successfully signed, the user needs to confirm the cancellation by calling the
cancelOffer
API. This finalizes and confirms the offer cancellation.
Sample mutation
mutation initiateCancelOfferMutation($orderId: UUID1!, $orgId: UUID1!) {
initiateCancelOffer(orderId: $orderId, orgId: $orgId) {
seller
sellerTokenAccount
buyer
offer
offerEscrow
systemProgram
descriminator
mintAccount
__typename
}
}
mutation cancelOffer($orderId: UUID1!, $orgId: UUID1!, $currency: CurrencyCodeFiat, $signature: String) {
cancelOffer(
orderId: $orderId
orgId: $orgId
currency: $currency
signature: $signature
)
}
Sample variable
{
"orderId": "daf8733d-7c27-43c5-9dc5-a6b9a4705017",
"orgId": "0db10bbf-85fe-4c87-911b-d18f8568fc07"
}
{
"orderId": "daf8733d-7c27-43c5-9dc5-a6b9a4705017",
"orgId": "0db10bbf-85fe-4c87-911b-d18f8568fc07",
"signature": "4mqSCBdFuboXyk4oHJuKoMqvdLiNtDtvsoRp2GsQkN1rZBZV2a16x7Fbwh7HJeGy7L7st6xbQoXuXNUnSduWAzyX",
"currency": "USD"
}
Sample response
{
"data": {
"initiateCancelOffer": {
"seller": "7GckBHDKCMEdFdnxJV3qY12YCEVop6MKtgjVAnd7vHGD",
"sellerTokenAccount": "D5RsufniFeb1zEygWM1SZ4kg2oxnFS8A67dvhjtWvToD",
"buyer": "AhE1ubLPzT6vY1rWFoPko5DSC3rpQUhLMjdEiWV1mJGh",
"offer": "Z4CpmimZHM31wLxC9sZHPfsUUbj8ihQYtSdntAQAUbt",
"offerEscrow": "4aRpxWDMLu9ZfYYFYPng2PnyUancWcZipkFhVHRxLREY",
"systemProgram": "11111111111111111111111111111111",
"descriminator": [
92,
203,
223,
40,
92,
89,
53,
119
],
"mintAccount": "FytWTAobotGfihugTU8TEQzEgjfrttUVNWcRHv1GG2G3",
"__typename": "CancelOfferResponse"
}
}
}
{
"data": {
"cancelOffer": "Offer cancelled."
}
}
Fields
The table below provides an explanation of each variable in the respective column.
initiateCancelOffer:
Name | Type | Description |
---|---|---|
orderId | UUID1 | The offer order unique ID. |
orgId | UUID1 | The organization ID. |
cancelOffer:
Name | Type | Description |
---|---|---|
orderId | UUID1 | The offer order unique ID. |
orgId | UUID1 | The organization ID. |
signature | String | The offer canceled transaction hash. |
currency | Enum | This currency shows the currency conversion rate of the fiat currency amount. |