Skip to content

Commit

Permalink
Merge pull request #67 from kodadot/revert-66-revert-65-feat/split
Browse files Browse the repository at this point in the history
Revert "Need to release v12 first"
  • Loading branch information
vikiival committed Sep 16, 2024
2 parents 6d369e2 + 1a0edee commit b26ad4a
Show file tree
Hide file tree
Showing 11 changed files with 59 additions and 13 deletions.
2 changes: 1 addition & 1 deletion basick.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
manifestVersion: subsquid.io/v0.1
name: basick
version: 12
version: 13
description: 'SubSquid indexer for Base'
build:
deploy:
Expand Down
15 changes: 15 additions & 0 deletions db/migrations/1726484389986-Data.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module.exports = class Data1726484389986 {
name = 'Data1726484389986'

async up(db) {
await db.query(`ALTER TABLE "metadata_entity" ADD "banner" text`)
await db.query(`ALTER TABLE "metadata_entity" ADD "kind" character varying(6)`)
await db.query(`ALTER TABLE "collection_entity" ADD "kind" character varying(6)`)
}

async down(db) {
await db.query(`ALTER TABLE "metadata_entity" DROP COLUMN "banner"`)
await db.query(`ALTER TABLE "metadata_entity" DROP COLUMN "kind"`)
await db.query(`ALTER TABLE "collection_entity" DROP COLUMN "kind"`)
}
}
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"update": "npx npm-check-updates --filter /subsquid/ --upgrade && npm i -f"
},
"dependencies": {
"@kodadot1/hyperdata": "^0.0.1-rc.4",
"@kodadot1/hyperdata": "^0.0.1-rc.5",
"@kodadot1/metasquid": "^0.3.0-rc.0",
"@kodadot1/minipfs": "^0.4.3-rc.2",
"@subsquid/archive-registry": "^3.3.2",
Expand Down
13 changes: 12 additions & 1 deletion schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ type CollectionEntity @entity {
id: ID!
image: String
issuer: String!
kind: Kind
max: Int
media: String
meta: MetadataEntity
Expand Down Expand Up @@ -75,7 +76,8 @@ type MetadataEntity @entity {
attributes: [Attribute!]
animationUrl: String
type: String
# banner: String
banner: String
kind: Kind
}

type Attribute @jsonField {
Expand Down Expand Up @@ -135,6 +137,15 @@ enum Interaction {
# LOCK
}

enum Kind {
poap
pfp
genart
mixed
# audio
# video
}

# type AssetEntity @entity {
# id: ID!
# name: String
Expand Down
5 changes: 3 additions & 2 deletions src/mappings/shared/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { Content } from '@kodadot1/hyperdata'
import { logger } from '@kodadot1/metasquid/logger'
import { Store } from '@subsquid/typeorm-store'
// import md5 from 'md5'
import { MetadataEntity as Metadata } from '../../model/generated'
import { Kind, MetadataEntity as Metadata } from '../../model/generated'
import { fetchMetadata } from '../utils/metadata'

export async function handleMetadata(id: string, store: Store): Promise<Optional<Metadata>> {
Expand All @@ -31,7 +31,8 @@ export async function handleMetadata(id: string, store: Store): Promise<Optional
attributes: [], // metadata.attributes?.map(attributeFrom) || [],
name: metadata.name || '',
type: metadata.type || '',
// banner: metadata.banner || '',
banner: metadata.banner,
kind: metadata.kind as Kind || Kind.genart,
}

const final = create<Metadata>(Metadata, id, partial)
Expand Down
6 changes: 6 additions & 0 deletions src/model/generated/_kind.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export enum Kind {
poap = "poap",
pfp = "pfp",
genart = "genart",
mixed = "mixed",
}
4 changes: 4 additions & 0 deletions src/model/generated/collectionEntity.model.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, StringColumn as StringColumn_, BigIntColumn as BigIntColumn_, Index as Index_, DateTimeColumn as DateTimeColumn_, IntColumn as IntColumn_, OneToMany as OneToMany_, ManyToOne as ManyToOne_} from "@subsquid/typeorm-store"
import {CollectionEvent} from "./collectionEvent.model"
import {Kind} from "./_kind"
import {MetadataEntity} from "./metadataEntity.model"
import {NFTEntity} from "./nftEntity.model"
import {CollectionType} from "./_collectionType"
Expand Down Expand Up @@ -49,6 +50,9 @@ export class CollectionEntity {
@StringColumn_({nullable: false})
issuer!: string

@Column_("varchar", {length: 6, nullable: true})
kind!: Kind | undefined | null

@IntColumn_({nullable: true})
max!: number | undefined | null

Expand Down
1 change: 1 addition & 0 deletions src/model/generated/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export * from "./collectionEntity.model"
export * from "./_kind"
export * from "./_collectionType"
export * from "./nftEntity.model"
export * from "./tokenEntity.model"
Expand Down
7 changes: 7 additions & 0 deletions src/model/generated/metadataEntity.model.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, StringColumn as StringColumn_} from "@subsquid/typeorm-store"
import * as marshal from "./marshal"
import {Attribute} from "./_attribute"
import {Kind} from "./_kind"

@Entity_()
export class MetadataEntity {
Expand Down Expand Up @@ -28,4 +29,10 @@ export class MetadataEntity {

@StringColumn_({nullable: true})
type!: string | undefined | null

@StringColumn_({nullable: true})
banner!: string | undefined | null

@Column_("varchar", {length: 6, nullable: true})
kind!: Kind | undefined | null
}
3 changes: 2 additions & 1 deletion src/processable.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CollectionEntity, CollectionType } from "./model";
import { CollectionEntity, CollectionType, Kind } from "./model";

// https://sphere.market/immutable/collection/0x4cd9d7819c01c85F0130Aef429ab32D0465672A2
// export enum Contracts {
Expand Down Expand Up @@ -116,5 +116,6 @@ function toMap(
supply: 0,
volume: BigInt(0),
version: 721,
kind: Kind.genart,
};
}

0 comments on commit b26ad4a

Please sign in to comment.