Skip to content

Commit

Permalink
graphql mockup
Browse files Browse the repository at this point in the history
  • Loading branch information
NorVirae committed Nov 9, 2022
1 parent 9589655 commit be2b3be
Show file tree
Hide file tree
Showing 10 changed files with 4,035 additions and 93 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules
generated
build
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
1. clone this project
2. run "yarn global add @graphprotocol/graph-cli" or "npm i -g @graphprotocol/graph-cli"
3. run "graph codegen && graph build"
4. to deploy run "graph deploy --product hosted-service norvirae/podship"

you can query this subgraph from your graphql dapp at "https://api.thegraph.com/subgraphs/name/norvirae/podship"
236 changes: 236 additions & 0 deletions abis/PodShipSupporterNFT.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,236 @@
[
{ "inputs": [], "stateMutability": "nonpayable", "type": "constructor" },
{ "inputs": [], "name": "PodShip__ZeroAddress", "type": "error" },
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "account",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"indexed": false,
"internalType": "bool",
"name": "approved",
"type": "bool"
}
],
"name": "PodShipSupporterNFTApprovalForAll",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256[]",
"name": "ids",
"type": "uint256[]"
},
{
"indexed": false,
"internalType": "uint256[]",
"name": "values",
"type": "uint256[]"
}
],
"name": "TransferBatch",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "operator",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "from",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "to",
"type": "address"
},
{
"indexed": false,
"internalType": "uint256",
"name": "id",
"type": "uint256"
},
{
"indexed": false,
"internalType": "uint256",
"name": "value",
"type": "uint256"
}
],
"name": "TransferSingle",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": false,
"internalType": "string",
"name": "value",
"type": "string"
},
{
"indexed": true,
"internalType": "uint256",
"name": "id",
"type": "uint256"
}
],
"name": "URI",
"type": "event"
},
{
"inputs": [],
"name": "PodShipSupporterNft",
"outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "account", "type": "address" },
{ "internalType": "uint256", "name": "id", "type": "uint256" }
],
"name": "balanceOf",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "address[]", "name": "accounts", "type": "address[]" },
{ "internalType": "uint256[]", "name": "ids", "type": "uint256[]" }
],
"name": "balanceOfBatch",
"outputs": [
{ "internalType": "uint256[]", "name": "", "type": "uint256[]" }
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "uint256", "name": "id", "type": "uint256" }],
"name": "exists",
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "account", "type": "address" },
{ "internalType": "address", "name": "operator", "type": "address" }
],
"name": "isApprovedForAll",
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "_winner", "type": "address" }
],
"name": "mintPodShipSupporterNFT",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "from", "type": "address" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256[]", "name": "ids", "type": "uint256[]" },
{ "internalType": "uint256[]", "name": "amounts", "type": "uint256[]" },
{ "internalType": "bytes", "name": "data", "type": "bytes" }
],
"name": "safeBatchTransferFrom",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "from", "type": "address" },
{ "internalType": "address", "name": "to", "type": "address" },
{ "internalType": "uint256", "name": "id", "type": "uint256" },
{ "internalType": "uint256", "name": "amount", "type": "uint256" },
{ "internalType": "bytes", "name": "data", "type": "bytes" }
],
"name": "safeTransferFrom",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "address", "name": "operator", "type": "address" },
{ "internalType": "bool", "name": "approved", "type": "bool" }
],
"name": "setApprovalForAll",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{ "internalType": "bytes4", "name": "interfaceId", "type": "bytes4" }
],
"name": "supportsInterface",
"outputs": [{ "internalType": "bool", "name": "", "type": "bool" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "uint256", "name": "id", "type": "uint256" }],
"name": "totalSupply",
"outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [{ "internalType": "uint256", "name": "_id", "type": "uint256" }],
"name": "uri",
"outputs": [{ "internalType": "string", "name": "", "type": "string" }],
"stateMutability": "view",
"type": "function"
}
]
3 changes: 3 additions & 0 deletions networks.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
"mumbai": {
"PodShipAuction": {
"address": "0xFdc217E2867717ca21A5Edc13Fb8feA73192292D"
},
"PodShipSupporterNFT": {
"address": "0x0E2a4F18CEBE45f863ff8Dc7381B812295a02397"
}
}
}
33 changes: 29 additions & 4 deletions schema.graphql
Original file line number Diff line number Diff line change
@@ -1,6 +1,31 @@
type ExampleEntity @entity {
type PodSale @entity {
id: ID!
count: BigInt!
owner: Bytes! # address
approved: Bytes! # address
podcast: Podcast!
# isOnSale: Boolean #set isOnsale = true when OfferCreated, AuctionCreated is emitted, and isOnSale = false when OfferCancelled, OfferPurchased, AuctionCancelled, AuctionPurchased, AuctionResulted is called
amount: BigInt #can be reserved_price for auction or price for fixed
isOnSale: Boolean
startTime: BigInt
endTime: BigInt
podcastId: ID!
duration: BigInt
buyer: User
seller: User
}

type Podcast @entity {
id: ID!
podcastId: ID!
metadataURI: String!
baseURI: String!
isOnSale: Boolean
created: BigInt!
ownerAddress: User!
creator: User!
}

type User @entity{
id: ID!
podcasts: [Podcast!]! @derivedFrom(field: "ownerAddress")
created: [Podcast!]! @derivedFrom(field: "creator")
}

Loading

0 comments on commit be2b3be

Please sign in to comment.