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

Moon squid #26

Merged
merged 29 commits into from
Aug 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
72fcde7
➕ FireSquid dependencies
vikiival Aug 7, 2022
69abe24
:robot: same command, firesuquid compatible
vikiival Aug 7, 2022
7b3c18b
🦑 typegen now matches the firesquid config
vikiival Aug 7, 2022
7b88394
:label: new archive URL
vikiival Aug 7, 2022
1ed0f94
🐳 upgraded
vikiival Aug 7, 2022
f5f951f
:label: types for 🔥🦑
vikiival Aug 7, 2022
4755871
:coffin: dead code from sq repo
vikiival Aug 7, 2022
026ea39
🔥🦑 best of firesquid
vikiival Aug 7, 2022
8631ab2
⚡ firesquid has new typeorm api
vikiival Aug 7, 2022
390553c
EVM by :fire:🦑
vikiival Aug 7, 2022
9d96b68
⚡ new implementation of extract utils
vikiival Aug 7, 2022
0aa1cca
:zap: typeorm logic
vikiival Aug 7, 2022
18b83b0
🏷️ just codegen
vikiival Aug 7, 2022
500e045
:whale: updated docker configs
vikiival Aug 8, 2022
0befe9a
:shell: utitility to run docker
vikiival Aug 8, 2022
3feeb7f
:fire::squid: needs it
vikiival Aug 8, 2022
a9fe196
:card_file_box: brand new database migration
vikiival Aug 8, 2022
735e74f
:construction: debugging
vikiival Aug 8, 2022
46b938e
:construction_worker: WIP getAddess
vikiival Aug 23, 2022
b3ef7fa
:robot: dont detach on make
vikiival Aug 23, 2022
8bcefb2
:robot: evm-typegen
vikiival Aug 30, 2022
2d66b7d
:top: updated packages
vikiival Aug 30, 2022
f75102c
:label: updated types ERC ABI
vikiival Aug 30, 2022
af259be
:label: :bug: correct types for transfer
vikiival Aug 30, 2022
1d79b27
:bug: disable caller
vikiival Aug 30, 2022
7e72a32
:bug: testbed for faulty multitoken transfers
vikiival Aug 30, 2022
5d97d02
:bug: multitoken transfer returns values
vikiival Aug 30, 2022
eec154a
:package: @kodadot1/click@0.0.1
vikiival Aug 30, 2022
7138db6
:zap: ich muss jezt los
vikiival Aug 30, 2022
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
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
DB_NAME=squid
DB_PORT=23798
GQL_PORT=4350
ARCHIVE_URL=https://moonriver.archive.subsquid.io/graphql
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ COPY --from=deps /squid/package-lock.json .
COPY --from=deps /squid/node_modules node_modules
COPY --from=builder /squid/lib lib
ADD db db
ADD assets assets
ADD schema.graphql .
# TODO: use shorter PROMETHEUS_PORT
ENV PROCESSOR_PROMETHEUS_PORT 3000
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ explore:


up:
@docker-compose up -d
@docker-compose up


down:
Expand Down
3 changes: 3 additions & 0 deletions assets/README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Assets

`assets` is the designated folder for any additional files to be used by the squid, for example a static data file. The folder is added by default to `Dockerfile` and is kept when the squid is deployed to the Aquairum.
13 changes: 0 additions & 13 deletions db/migrations/1657544332951-Data.js

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module.exports = class Init1656847609124 {
name = 'Init1656847609124'
module.exports = class Data1659952291826 {
name = 'Data1659952291826'

async up(db) {
await db.query(`CREATE TABLE "metadata_entity" ("id" character varying NOT NULL, "name" text, "description" text, "image" text, "attributes" jsonb, "animation_url" text, "type" text, CONSTRAINT "PK_2cb9d5d4ae99d9a27497bf8d2e8" PRIMARY KEY ("id"))`)
await db.query(`CREATE TABLE "event" ("id" character varying NOT NULL, "block_number" numeric, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "caller" text NOT NULL, "current_owner" text NOT NULL, "interaction" character varying(7) NOT NULL, "meta" text NOT NULL, "nft_id" character varying NOT NULL, CONSTRAINT "PK_30c2f3bbaf6d34a55f8ae6e4614" PRIMARY KEY ("id"))`)
await db.query(`CREATE TABLE "event" ("id" character varying NOT NULL, "block_number" numeric, "timestamp" TIMESTAMP WITH TIME ZONE NOT NULL, "caller" text NOT NULL, "current_owner" text NOT NULL, "interaction" character varying(7) NOT NULL, "meta" text NOT NULL, "nft_id" character varying, CONSTRAINT "PK_30c2f3bbaf6d34a55f8ae6e4614" PRIMARY KEY ("id"))`)
await db.query(`CREATE INDEX "IDX_9380d479563e5a664759359470" ON "event" ("nft_id") `)
await db.query(`CREATE TABLE "nft_entity" ("id" character varying NOT NULL, "block_number" numeric, "burned" boolean NOT NULL, "created_at" TIMESTAMP WITH TIME ZONE NOT NULL, "current_owner" text NOT NULL, "hash" text NOT NULL, "issuer" text NOT NULL, "metadata" text, "name" text, "price" numeric, "royalty" integer, "sn" text NOT NULL, "count" integer NOT NULL, "updated_at" TIMESTAMP WITH TIME ZONE NOT NULL, "collection_id" character varying NOT NULL, "meta_id" character varying, CONSTRAINT "PK_ed09c6a38c0f0a867d5a7b63f0d" PRIMARY KEY ("id"))`)
await db.query(`CREATE TABLE "nft_entity" ("id" character varying NOT NULL, "block_number" numeric, "burned" boolean NOT NULL, "created_at" TIMESTAMP WITH TIME ZONE NOT NULL, "current_owner" text NOT NULL, "hash" text NOT NULL, "issuer" text NOT NULL, "metadata" text, "name" text, "price" numeric, "royalty" integer, "sn" text NOT NULL, "count" numeric NOT NULL, "updated_at" TIMESTAMP WITH TIME ZONE NOT NULL, "collection_id" character varying, "meta_id" character varying, CONSTRAINT "PK_ed09c6a38c0f0a867d5a7b63f0d" PRIMARY KEY ("id"))`)
await db.query(`CREATE INDEX "IDX_4b98bf4d630de0037475b9bbb7" ON "nft_entity" ("collection_id") `)
await db.query(`CREATE INDEX "IDX_16e57ac8478b6ea1f383e3eb03" ON "nft_entity" ("hash") `)
await db.query(`CREATE INDEX "IDX_2bfc45b91959a14ab8b2d734cd" ON "nft_entity" ("meta_id") `)
Expand Down
6 changes: 4 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@ version: "3"

services:
db:
image: postgres:12
image: postgres:14
environment:
POSTGRES_DB: postgres
POSTGRES_DB: squid
POSTGRES_PASSWORD: postgres
ports:
- "${DB_PORT}:5432"
# command: ["postgres", "-c", "log_statement=all"]
# volumes:
# - ./data/db:/var/lib/postgresql/data
24 changes: 14 additions & 10 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ process: build
node -r dotenv/config lib/processor.js

serve:
npx squid-graphql-server
@npx squid-graphql-server

up:
docker compose up
Expand All @@ -23,7 +23,7 @@ build:
npm run build

codegen:
npx sqd codegen
npx squid-typeorm-codegen

typegen: ksmVersion
npx squid-substrate-typegen typegen.json
Expand All @@ -32,24 +32,22 @@ ksmVersion: explore

explore:
npx squid-substrate-metadata-explorer \
--chain wss://basilisk-kodadot.hydration.cloud \
--archive $ARCHIVE_URL \
--out kusamaVersions.json
--out kusamaVersions.jsonl

bug: down up

reset:
npx sqd db drop
npx sqd db create
npx sqd db:migrate
reset: migrate

quickstart: migrate process

new-schema: codegen build update-db

migrate:
npx sqd db:migrate
npx squid-typeorm-migration apply

update-db:
npx sqd db:create-migration Data
npx squid-typeorm-migration create-migration Data

test:
npm run test:unit
Expand Down Expand Up @@ -77,3 +75,9 @@ tail TAG:

dump:
docker exec -i click-db-1 /bin/bash -c "pg_dump --username postgres squid" > dump.sql

evm-typegen FILE OUT:
npx squid-evm-typegen --abi=src/abi/{{FILE}}.json --output=src/abi/{{OUT}}.ts

erc TAG:
npx squid-evm-typegen --abi=src/abi/ERC{{TAG}}.json --output=src/abi/erc{{TAG}}.ts
Loading