In the offer process we call two API’s to complete the offer process. createOffer mutation is called next to get the message to sign via metamask to make an offer. In this mutation to check the owner of the NFT and create one order record against the NFT and generate the SHA3 signature returned to sign the metamask via front end.
Sample query
mutation createOffer(
$nftTokenId: UUID1!
$orgId: UUID1!
$buyerAddress: String!
$offerPrice: Float!
$expiryDate: Time!
$paymentToken: String!
$currencyId: UUID1!
$cryptoTax: CryptoTax
$taxAddress: TaxAddressInput
$currency: CurrencyCodeFiat
) {
createOffer(
nftTokenId: $nftTokenId
orgId: $orgId
buyerAddress: $buyerAddress
offerPrice: $offerPrice
expiryDate: $expiryDate
paymentToken: $paymentToken
currencyId: $currencyId
cryptoTax: $cryptoTax
taxAddress: $taxAddress
currency: $currency
) {
messageToSign
order {
id
nftTokenId
tokenId
tokenContract
quantity
nftOwnerAddress
fixedPrice
nftToken {
id
name
deployed
tokenMetadata {
name
description
image
}
nftContractID
}
}
}
}
Sample variable
{
"nftTokenId": "fda8ac2d-ab33-45ae-a481-5159dd8d0ae1",
"orgId": "8fb128bd-f55d-4bcc-8b6c-0beb684e4d4e",
"buyerAddress": "0xa77915a574e1f9b88db152525ceBfEAA8c71bAa4",
"offerPrice": 0.04,
"expiryDate": "2023-03-04T12:52:00Z",
"paymentToken": "0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6",
"currencyId": "c41db347-0ee3-4212-563a-ca213b8e0ea8",
"cryptoTax": {
"cryptoTaxPrice": 0.0024,
"cryptoTotalPrice": 0.0424,
"USDUnitprice": 1565.89,
"taxPercentage": 5.663
},
"taxAddress": {
"street1": "184 Hareness Creek road ",
"city": "Annapolis",
"state": "Maryland",
"postalCode": "21403",
"country": "US"
}
}
Sample response
{
"data": {
"createOffer": {
"messageToSign": "0x01dc827f13643991e213fc167b2f13b0ceefd9b69f79e78a6c122db83d1ac936",
"order": {
"id": "c960711f-4478-4048-aadb-61aab3426be0",
"nftTokenId": "fda8ac2d-ab33-45ae-a481-5159dd8d0ae1",
"tokenId": "5",
"tokenContract": "0xcef83635de6935cb85192090564b0a8e08594584",
"quantity": 1,
"nftOwnerAddress": "0xfcd914e807cb395a706d4fe16cc1635c735f829c",
"fixedPrice": 0.04,
"nftToken": null
}
}
}
}
Arguments
Name | Type | Description | Required |
---|---|---|---|
nftTokenId | UUID | NFT token ID | Yes |
orgId | UUID | The organization id. | Yes |
buyerAddress | String | Metamask connected address | Yes |
offerPrice | Float | Offer price (crypto) | Yes |
expiryDate | Time | Offer expiry time. | Yes |
paymentToken | String | Currency payment address | Yes |
orgID | UUID | The organization ID | Yes |
currencyId | UUID | Currency id from supported currency table | Yes |
cryptoTax | Object | Contains information from CryptoTax such as crypto tax price and cryptoTaxPrice. | |
taxAddress | Object | Contains information from TaxAddressInput such as street1, city and etc.. | |
currency | Enum | Fiat currency. |