NFTs.graphql 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. "NFT transactional state"
  2. union TransactionalStatus =
  3. TransactionalStatusIdle
  4. | TransactionalStatusInitiatedOfferToMember
  5. | TransactionalStatusBuyNow
  6. | TransactionalStatusAuction
  7. "Represents TransactionalStatus Idle"
  8. type TransactionalStatusIdle {
  9. phantom: Int
  10. }
  11. "Represents TransactionalStatus InitiatedOfferToMember"
  12. type TransactionalStatusInitiatedOfferToMember {
  13. "Member that recieved the offer"
  14. member: Membership!
  15. "The price that the member should pay to accept offer (optional)"
  16. price: BigInt
  17. }
  18. "Represents TransactionalStatus BuyNow"
  19. type TransactionalStatusBuyNow {
  20. price: BigInt!
  21. }
  22. "Represents TransactionalStatus Auction"
  23. type TransactionalStatusAuction {
  24. auction: Auction!
  25. }
  26. "Represents NFT details"
  27. type OwnedNft @entity {
  28. "Timestamp of the block the NFT was created at"
  29. createdAt: DateTime!
  30. "NFT's video"
  31. video: Video! @unique
  32. "Auctions done for this NFT"
  33. auctions: [Auction!]! @derivedFrom(field: "nft")
  34. "Current owner of the NFT."
  35. owner: NftOwner!
  36. "NFT's transactional status"
  37. transactionalStatus: TransactionalStatus
  38. "Creator royalty (if any)"
  39. creatorRoyalty: Float
  40. "NFT's last sale price (if any)"
  41. lastSalePrice: BigInt
  42. "NFT's last sale date (if any)"
  43. lastSaleDate: DateTime
  44. "All NFT auction bids"
  45. bids: [Bid!]! @derivedFrom(field: "nft")
  46. "Flag to indicate whether the NFT is featured or not"
  47. isFeatured: Boolean!
  48. }
  49. "Represents various action types"
  50. union AuctionType = AuctionTypeEnglish | AuctionTypeOpen
  51. "Represents English auction details"
  52. type AuctionTypeEnglish {
  53. "English auction duration in blocks"
  54. duration: Int!
  55. "Auction extension period in blocks"
  56. extensionPeriod: Int!
  57. "Block when auction is supposed to end"
  58. plannedEndAtBlock: Int!
  59. "Minimal step between auction bids"
  60. minimalBidStep: BigInt!
  61. }
  62. "Represents Open auction details"
  63. type AuctionTypeOpen @variant {
  64. "Auction bid lock duration"
  65. bidLockDuration: Int!
  66. }
  67. "Represents NFT auction"
  68. type Auction @entity {
  69. "Unique identifier"
  70. id: ID!
  71. "Auctioned NFT"
  72. nft: OwnedNft!
  73. "Member that won this auction"
  74. winningMember: Membership
  75. "Auction starting price"
  76. startingPrice: BigInt!
  77. "Price at which the auction gets completed instantly (if any)"
  78. buyNowPrice: BigInt
  79. "The type of auction"
  80. auctionType: AuctionType!
  81. "Auction last bid (if exists)"
  82. # TODO: Is it really needed? (bids(orderBy: amount_DESC, limit: 1).?[0])
  83. topBid: Bid
  84. "All bids made during this auction"
  85. bids: [Bid!]! @derivedFrom(field: "auction")
  86. "Block when auction starts"
  87. startsAtBlock: Int!
  88. "Block when auction ended"
  89. endedAtBlock: Int
  90. "Is auction canceled"
  91. isCanceled: Boolean!
  92. "Is auction completed"
  93. isCompleted: Boolean!
  94. "Auction participants whitelist"
  95. whitelistedMembers: [AuctionWhitelistedMember!] @derivedFrom(field: "auction")
  96. }
  97. type AuctionWhitelistedMember @entity @index(fields: ["auction", "member"], unique: true) {
  98. "{auctionId}-{memberId}"
  99. id: ID!
  100. auction: Auction!
  101. member: Membership!
  102. }
  103. "Represents bid in NFT auction"
  104. type Bid @entity {
  105. "Unique identifier"
  106. id: ID!
  107. "Timestamp of the block the bid was created at"
  108. createdAt: DateTime!
  109. "NFT's auction"
  110. auction: Auction!
  111. "Bid's NFT"
  112. nft: OwnedNft!
  113. "Bidder membership"
  114. bidder: Membership!
  115. "Amount bidded"
  116. amount: BigInt!
  117. "Sign for canceled bid"
  118. isCanceled: Boolean!
  119. "Block in which the bid was placed"
  120. createdInBlock: Int!
  121. "Index in block of the related AuctionBidMade event"
  122. indexInBlock: Int!
  123. "Bid that was displaced by this bid in the English auction (if any)"
  124. previousTopBid: Bid
  125. }