Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial Commit for Dynamic NFT and Crop XYZ #134

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions airstack-modules/bin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ https://github.com/Airstack-xyz/Subgraphs/tree/main/airstack-modules/modules/air
`
);
break;
case Vertical.DynamicNft:
console.log(`
Integration for DYNAMIC NFT vertical done. For documentation and examples please check below link:
https://github.com/Airstack-xyz/Subgraphs/tree/main/airstack-modules/modules/airstack/dynamic-nft/Readme.md
`
);
default:
break;
}
Expand Down
86 changes: 86 additions & 0 deletions airstack-modules/graphql/airstack-dynamic-nft-schema.graphql.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
const schema = `#--Airstack Schemas--

enum AirProtocolType {
DYNAMIC_NFT
}

enum AirProtocolActionType {
UPDATE
}

enum AirTokenStandardType {
ERC1155
ERC721
ERC20
}

type AirBlock @entity {
id: ID! #chain-number
hash: String!
number: BigInt!
timestamp: BigInt!
}

type AirMeta @entity {
id: ID! # air_meta
network: String!
schemaVersion: String!
slug: String! # POAP ??
name: String! # POAP
version: String!
}

type AirToken @entity {
id: ID!
address: String!
}


type AirEntityCounter @entity {
id: ID!
count: BigInt!
createdAt: AirBlock!
lastUpdatedAt: AirBlock!
}

interface AirTransaction {
id: ID!
logOrCallIndex: BigInt!
transactionHash: String!
block: AirBlock!
index: BigInt!
protocolType: AirProtocolType! #SOCIAL
protocolActionType: AirProtocolActionType! #REGISTRATION
}

type AirNftTokenURIUpdateTransaction implements AirTransaction @entity {
id: ID!
nft: AirNFT!
tokenId: String!
tokenAddress: AirToken!
logOrCallIndex: BigInt!
transactionHash: String!
block: AirBlock!
index: BigInt! #entity counter
protocolType: AirProtocolType! #SOCIAL
protocolActionType: AirProtocolActionType! #SOCIAL_REGISTRATION
}

type AirNFT @entity {
id: ID!
tokenId: String!
tokenAddress: AirToken!
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

token standard(ERC721, 1155) field can be added

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

tokenStandard: AirTokenStandardType!
createdAt: AirBlock!
lastUpdatedAt: AirBlock!
lastUpdatedIndex: BigInt! # gets updated on each update
}

type AirAccount @entity {
id: ID!
address: String!
createdAt: AirBlock!
}
`

export default schema
1 change: 1 addition & 0 deletions airstack-modules/modules/airstack/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ AIR_CHAIN_ID_MAP.set("osmosis", "osmosis-1");
AIR_CHAIN_ID_MAP.set("matic", "137");
AIR_CHAIN_ID_MAP.set("gnosis", "100");
AIR_CHAIN_ID_MAP.set("mumbai", "80001");
AIR_CHAIN_ID_MAP.set("gold", "4653");

export function getChainId(): string {
const network = dataSource.network();
Expand Down
2 changes: 1 addition & 1 deletion airstack-modules/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@airstack/subgraph-generator",
"version": "1.0.0-alpha.9",
"version": "1.0.0-alpha.10",
"description": "Integrate Airstack schemas in any subgraph.",
"main": "modules/airstack/index",
"scripts": {
Expand Down
2 changes: 2 additions & 0 deletions airstack-modules/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ export enum Vertical {
DomainName = "domain-name",
Social = "social",
Poap = "poap",
DynamicNft = "dynamic-nft",
}
export const SupportedVerticals: Array<string> = [
Vertical.Dex,
Vertical.NftMarketplace,
Vertical.DomainName,
Vertical.Social,
Vertical.Poap,
Vertical.DynamicNft
]
4 changes: 4 additions & 0 deletions airstack-modules/src/integrate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,10 @@ function copyAirstackModules(vertical: Vertical): { targetDir: string, commontTa
sourceDir = path.resolve(__dirname, '../../modules/airstack/poap');
targetDir = path.resolve(__dirname, '../../../../../modules/airstack/poap');
break;
case Vertical.DynamicNft:
sourceDir = path.resolve(__dirname, '../../modules/airstack/dynamic-nft');
targetDir = path.resolve(__dirname, '../../../../../modules/airstack/dynamic-nft');
break;
default:
console.error("Invalid vertical, please check the vertical name.");
process.exit(1); // an error occurred
Expand Down
6 changes: 6 additions & 0 deletions airstack-modules/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ import nftMarketPlaceSchema from "../graphql/airstack-nft-marketplace-schema.gra
import domainNameSchema from "../graphql/airstack-domain-name-schema.graphql";
import socialSchema from "../graphql/airstack-social-schema.graphql";
import poapSchema from "../graphql/airstack-poap-schema.graphql"
import dynamicNftSchema from "../graphql/airstack-dynamic-nft-schema.graphql"

import dexYamlString from "../yamls/dex.yaml";
import nftMarketPlaceYamlString from "../yamls/nft-marketplace.yaml";
import domainNameYamlString from "../yamls/domain-name.yaml";
import socialYamlString from "../yamls/social.yaml";
import poapYamlString from "../yamls/poap.yaml"
import dynamicNftYamlString from "../yamls/dynamic-nft.yaml"

export namespace Utils {
export function isVerticalSupported(verticalName: string): boolean {
Expand Down Expand Up @@ -51,6 +53,8 @@ export namespace Utils {
case Vertical.Poap:
yamlString = poapYamlString;
break;
case Vertical.DynamicNft:
yamlString = dynamicNftYamlString;
default:
break;
}
Expand Down Expand Up @@ -78,6 +82,8 @@ export namespace Utils {
return socialSchema;
case Vertical.Poap:
return poapSchema;
case Vertical.DynamicNft:
return dynamicNftSchema;
default:
break;
}
Expand Down
12 changes: 12 additions & 0 deletions airstack-modules/yamls/dynamic-nft.yaml.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const yamlString = `
entities:
- AirBlock
- AirMeta
- AirToken
- AirEntityCounter
- AirAccount
- AirNftTokenURIUpdateTransaction
- AirNFT
`;

export default yamlString;
1 change: 1 addition & 0 deletions cropxyz/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
Loading