Skip to content

Commit b26ad4a

Browse files
authored
Merge pull request #67 from kodadot/revert-66-revert-65-feat/split
Revert "Need to release v12 first"
2 parents 6d369e2 + 1a0edee commit b26ad4a

11 files changed

+59
-13
lines changed

basick.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
manifestVersion: subsquid.io/v0.1
22
name: basick
3-
version: 12
3+
version: 13
44
description: 'SubSquid indexer for Base'
55
build:
66
deploy:

db/migrations/1726484389986-Data.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
module.exports = class Data1726484389986 {
2+
name = 'Data1726484389986'
3+
4+
async up(db) {
5+
await db.query(`ALTER TABLE "metadata_entity" ADD "banner" text`)
6+
await db.query(`ALTER TABLE "metadata_entity" ADD "kind" character varying(6)`)
7+
await db.query(`ALTER TABLE "collection_entity" ADD "kind" character varying(6)`)
8+
}
9+
10+
async down(db) {
11+
await db.query(`ALTER TABLE "metadata_entity" DROP COLUMN "banner"`)
12+
await db.query(`ALTER TABLE "metadata_entity" DROP COLUMN "kind"`)
13+
await db.query(`ALTER TABLE "collection_entity" DROP COLUMN "kind"`)
14+
}
15+
}

package-lock.json

+7-7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"update": "npx npm-check-updates --filter /subsquid/ --upgrade && npm i -f"
77
},
88
"dependencies": {
9-
"@kodadot1/hyperdata": "^0.0.1-rc.4",
9+
"@kodadot1/hyperdata": "^0.0.1-rc.5",
1010
"@kodadot1/metasquid": "^0.3.0-rc.0",
1111
"@kodadot1/minipfs": "^0.4.3-rc.2",
1212
"@subsquid/archive-registry": "^3.3.2",

schema.graphql

+12-1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ type CollectionEntity @entity {
1212
id: ID!
1313
image: String
1414
issuer: String!
15+
kind: Kind
1516
max: Int
1617
media: String
1718
meta: MetadataEntity
@@ -75,7 +76,8 @@ type MetadataEntity @entity {
7576
attributes: [Attribute!]
7677
animationUrl: String
7778
type: String
78-
# banner: String
79+
banner: String
80+
kind: Kind
7981
}
8082

8183
type Attribute @jsonField {
@@ -135,6 +137,15 @@ enum Interaction {
135137
# LOCK
136138
}
137139

140+
enum Kind {
141+
poap
142+
pfp
143+
genart
144+
mixed
145+
# audio
146+
# video
147+
}
148+
138149
# type AssetEntity @entity {
139150
# id: ID!
140151
# name: String

src/mappings/shared/metadata.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type { Content } from '@kodadot1/hyperdata'
55
import { logger } from '@kodadot1/metasquid/logger'
66
import { Store } from '@subsquid/typeorm-store'
77
// import md5 from 'md5'
8-
import { MetadataEntity as Metadata } from '../../model/generated'
8+
import { Kind, MetadataEntity as Metadata } from '../../model/generated'
99
import { fetchMetadata } from '../utils/metadata'
1010

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

3738
const final = create<Metadata>(Metadata, id, partial)

src/model/generated/_kind.ts

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export enum Kind {
2+
poap = "poap",
3+
pfp = "pfp",
4+
genart = "genart",
5+
mixed = "mixed",
6+
}

src/model/generated/collectionEntity.model.ts

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
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"
22
import {CollectionEvent} from "./collectionEvent.model"
3+
import {Kind} from "./_kind"
34
import {MetadataEntity} from "./metadataEntity.model"
45
import {NFTEntity} from "./nftEntity.model"
56
import {CollectionType} from "./_collectionType"
@@ -49,6 +50,9 @@ export class CollectionEntity {
4950
@StringColumn_({nullable: false})
5051
issuer!: string
5152

53+
@Column_("varchar", {length: 6, nullable: true})
54+
kind!: Kind | undefined | null
55+
5256
@IntColumn_({nullable: true})
5357
max!: number | undefined | null
5458

src/model/generated/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
export * from "./collectionEntity.model"
2+
export * from "./_kind"
23
export * from "./_collectionType"
34
export * from "./nftEntity.model"
45
export * from "./tokenEntity.model"

src/model/generated/metadataEntity.model.ts

+7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {Entity as Entity_, Column as Column_, PrimaryColumn as PrimaryColumn_, StringColumn as StringColumn_} from "@subsquid/typeorm-store"
22
import * as marshal from "./marshal"
33
import {Attribute} from "./_attribute"
4+
import {Kind} from "./_kind"
45

56
@Entity_()
67
export class MetadataEntity {
@@ -28,4 +29,10 @@ export class MetadataEntity {
2829

2930
@StringColumn_({nullable: true})
3031
type!: string | undefined | null
32+
33+
@StringColumn_({nullable: true})
34+
banner!: string | undefined | null
35+
36+
@Column_("varchar", {length: 6, nullable: true})
37+
kind!: Kind | undefined | null
3138
}

src/processable.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { CollectionEntity, CollectionType } from "./model";
1+
import { CollectionEntity, CollectionType, Kind } from "./model";
22

33
// https://sphere.market/immutable/collection/0x4cd9d7819c01c85F0130Aef429ab32D0465672A2
44
// export enum Contracts {
@@ -116,5 +116,6 @@ function toMap(
116116
supply: 0,
117117
volume: BigInt(0),
118118
version: 721,
119+
kind: Kind.genart,
119120
};
120121
}

0 commit comments

Comments
 (0)