initiateBuyNFT

initiateBuyNFT mutation is called next to get the message to sign via metamask to buy NFT. Metamask popup is opened and message is signed via frontend.

Sample mutation

mutation initiateBuyNFT(
  $nftTokenId: UUID1!
  $buyerAddress: String!
  $orgId: UUID1!
  $country: String
  $postalCode: String
  $currencyId: UUID1
) {
  initiateBuyNFT(
    nftTokenId: $nftTokenId
    buyerAddress: $buyerAddress
    orgId: $orgId
    country: $country
    postalCode: $postalCode
    currencyId: $currencyId
  ) {
    proofOfApproval
    Network {
      id
      name
      chainID
      wethAddress
      __typename
    }
    order {
      id
      nftTokenId
      tokenId
      tokenContract
      quantity
      nftOwnerAddress
      fixedPrice
      price {
        unit
        value
        type
        __typename
      }
      nftToken {
        id
        name
        deployed
        tokenMetadata {
          name
          description
          image
          __typename
        }
        nftContractID
        __typename
      }
      __typename
    }
    __typename
  }
}

Sample variable

{
  "nftTokenId": "ba7be6d2-0294-4eca-b124-a9c46dbb11bc",
  "orgId": "f2f5c627-5421-4c40-9913-edfd09dd98b3",
  "buyerAddress": "0x823e14E47EaB5118FDd9d55BB4bd55C415255AF7",
  "country": "IN",
  "postalCode": "600021",
  "currencyId": "8b2343d6-8a8b-11ed-9e0a-42010a940031"
}

Sample response

{
  "data": {
    "initiateBuyNFT": {
      "proofOfApproval": "0xd166927574d75cd14c33da142cf56b01db5eb48ec393ed9b5a792b83fe23e8003d69a29d83fc8f3013912fd60969236f84677e48c0d0ff9bb28849e1d7a480021b",
      "Network": {
        "id": "c41db347-0ee3-4212-943a-ca213b8e0ea8",
        "name": "Goerli Testnet",
        "chainID": 5,
        "wethAddress": "0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6",
        "__typename": "Network"
      },
      "order": {
        "id": "304d276e-2600-460e-8f19-aeaf708f607b",
        "nftTokenId": "ba7be6d2-0294-4eca-b124-a9c46dbb11bc",
        "tokenId": "57",
        "tokenContract": "0xdadd30ab03b90ba4b2042a75c7b3bd12f24629e9",
        "quantity": 1,
        "nftOwnerAddress": "0x07530a99108332cE677e9ab2EE858De3c7a1e8a7",
        "fixedPrice": 0.04,
        "price": [],
        "nftToken": {
          "id": "ba7be6d2-0294-4eca-b124-a9c46dbb11bc",
          "name": "Whiskey Exchange 973",
          "deployed": true,
          "tokenMetadata": {
            "name": "Whiskey Exchange 973",
            "description": "A curiously rare whisky matured for half a century. Aging under the custodianship of a long lineage of whisky makers past and present, this whisky celebrates The Glenlivet’s commitment to continuous progression.",
            "image": "https://gateway.arweave.net/L60zx8c9Tzjpie_uo_9NHp8Yy_DT0LcnBlzmJN0-TMo",
            "__typename": "ERC721Metadata"
          },
          "nftContractID": "f45a10ca-be14-49cd-b5e3-88715cb506c0",
          "__typename": "NFTToken"
        },
        "__typename": "Order"
      },
      "__typename": "NFTSaleDetails"
    }
  }
}

Arguments

NameTypeDescriptionRequired
nftTokenIdUUIDNft token idYes
buyerAddressStringBuyer address of the userYes
orgIdUUIDThe organization idYes
countryStringBuyer country codeNo
postalCodeStringPostal code of the userNo
currencyIdUUIDCurrency idNo

Fields

NameTyepDescription
NFTSaleDetailsObjectContains all the information from Order , Network , proof of approval for metamask transaction, and isSigningRequired.

Examples