diff --git a/db/migrations/1734536868219-Data.js b/db/migrations/1734706828708-Data.js similarity index 97% rename from db/migrations/1734536868219-Data.js rename to db/migrations/1734706828708-Data.js index 243bb80..526221d 100644 --- a/db/migrations/1734536868219-Data.js +++ b/db/migrations/1734706828708-Data.js @@ -1,5 +1,5 @@ -module.exports = class Data1734536868219 { - name = 'Data1734536868219' +module.exports = class Data1734706828708 { + name = 'Data1734706828708' async up(db) { await db.query(`CREATE TABLE "account" ("id" character varying NOT NULL, "address_status" text, CONSTRAINT "PK_54115ee388cdb6d86bb4bf5b2ea" PRIMARY KEY ("id"))`) @@ -12,7 +12,7 @@ module.exports = class Data1734536868219 { await db.query(`CREATE INDEX "IDX_863162a8edb416799e89f386f8" ON "route" ("to_domain_id") `) await db.query(`CREATE INDEX "IDX_4536bd7b96f363dedfe95dd26f" ON "route" ("resource_id") `) await db.query(`CREATE UNIQUE INDEX "IDX_7dc7af2a7a9c846759377d1450" ON "route" ("from_domain_id", "to_domain_id", "resource_id") `) - await db.query(`CREATE TABLE "domain" ("id" character varying NOT NULL, "type" text NOT NULL, "name" text NOT NULL, "icon_url" text, "explorer_url" text, CONSTRAINT "PK_27e3ec3ea0ae02c8c5bceab3ba9" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "domain" ("id" character varying NOT NULL, "type" text NOT NULL, "name" text NOT NULL, "icon_url" text NOT NULL, "explorer_url" text NOT NULL, CONSTRAINT "PK_27e3ec3ea0ae02c8c5bceab3ba9" PRIMARY KEY ("id"))`) await db.query(`CREATE TABLE "token" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "decimals" integer NOT NULL, "token_address" text NOT NULL, "token_symbol" text NOT NULL, "resource_id" character varying, "domain_id" character varying, CONSTRAINT "PK_82fae97f905930df5d62a702fc9" PRIMARY KEY ("id"))`) await db.query(`CREATE INDEX "IDX_435ef0917a04e91698042dff2b" ON "token" ("resource_id") `) await db.query(`CREATE INDEX "IDX_3d565341b16e9c03d63e05eac8" ON "token" ("domain_id") `) @@ -78,4 +78,4 @@ module.exports = class Data1734536868219 { await db.query(`ALTER TABLE "transfer" DROP CONSTRAINT "FK_f6b9e9b86a1ce51c26cd08f596a"`) await db.query(`ALTER TABLE "transfer" DROP CONSTRAINT "FK_da16210e30a21445643e6acbcd7"`) } -} \ No newline at end of file +} diff --git a/envs/.env.indexer.example b/envs/.env.indexer.example index afa8ab9..3eae8a5 100644 --- a/envs/.env.indexer.example +++ b/envs/.env.indexer.example @@ -4,8 +4,8 @@ DB_PORT=5432 DB_USERNAME=postgres DB_HOST=db SHARED_CONFIG_URL="https://ipfs.io/ipfs/bafkreiasnla2ya55of6nwm3swjstip4q2ixfa3t6tvixyibclfovxnerte" -1_METADATA='{"id": 1, "rpcUrl": "http://evm1:8545"}' -2_METADATA='{"id": 2, "rpcUrl": "http://evm2:8545"}' -3_METADATA='{"id": 3, "rpcUrl": "ws://substrate-pallet:9944"}' +1_METADATA='{"id": 1, "rpcUrl": "http://evm1:8545", "iconUrl": "https://example.com/icon1.png", "explorerUrl": "https://explorer.com/1"}' +2_METADATA='{"id": 2, "rpcUrl": "http://evm2:8545", "iconUrl": "https://example.com/icon2.png", "explorerUrl": "https://explorer.com/2"}' +3_METADATA='{"id": 3, "rpcUrl": "ws://substrate-pallet:9944", "iconUrl": "https://example.com/icon3.png", "explorerUrl": "https://explorer.com/3"}' ENV_DOMAINS='[1,2,3]' \ No newline at end of file diff --git a/schema.graphql b/schema.graphql index 418f7c4..bf55092 100644 --- a/schema.graphql +++ b/schema.graphql @@ -67,8 +67,8 @@ type Domain @entity { id: ID! type: String! name: String! - iconURL: String - explorerURL: String + iconURL: String! + explorerURL: String! routesFrom: [Route!] @derivedFrom(field: "fromDomain") routesTo: [Route!] @derivedFrom(field: "toDomain") token: [Token!] @derivedFrom(field: "domain") diff --git a/src/indexer/config/envLoader.ts b/src/indexer/config/envLoader.ts index 705806e..65ae8b6 100644 --- a/src/indexer/config/envLoader.ts +++ b/src/indexer/config/envLoader.ts @@ -15,8 +15,8 @@ export type DomainMetadata = { domainId: number; rpcUrl: string; domainGateway?: string; - iconUrl?: string; - explorerUrl?: string; + iconUrl: string; + explorerUrl: string; }; export type EnvVariables = { diff --git a/src/model/generated/domain.model.ts b/src/model/generated/domain.model.ts index 2cd798a..c5281c8 100644 --- a/src/model/generated/domain.model.ts +++ b/src/model/generated/domain.model.ts @@ -21,11 +21,11 @@ export class Domain { @StringColumn_({nullable: false}) name!: string - @StringColumn_({nullable: true}) - iconURL!: string | undefined | null + @StringColumn_({nullable: false}) + iconURL!: string - @StringColumn_({nullable: true}) - explorerURL!: string | undefined | null + @StringColumn_({nullable: false}) + explorerURL!: string @OneToMany_(() => Route, e => e.fromDomain) routesFrom!: Route[]