From b546a1cc3f2f2f1f6bf8c45da191b5214c678544 Mon Sep 17 00:00:00 2001 From: Tad Hardesty Date: Wed, 8 May 2024 16:19:18 -0700 Subject: [PATCH] Use wallet ID instead of address to handle delegation --- .../paima-rest/src/controllers/AchievementsController.ts | 2 +- packages/node-sdk/paima-db/migrations/up.sql | 2 +- packages/node-sdk/paima-db/src/paima-tables.ts | 4 ++-- packages/node-sdk/paima-db/src/sql/achievements.queries.ts | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/engine/paima-rest/src/controllers/AchievementsController.ts b/packages/engine/paima-rest/src/controllers/AchievementsController.ts index 89265956..428c58fb 100644 --- a/packages/engine/paima-rest/src/controllers/AchievementsController.ts +++ b/packages/engine/paima-rest/src/controllers/AchievementsController.ts @@ -95,7 +95,7 @@ export class AchievementsController extends Controller { }; const names = name ? name.split(',') : ['*']; - const rows = await getAchievementProgress.run({ wallet, names }, db); + const rows = await getAchievementProgress.run({ wallet: id, names }, db); return { ...(await this.validity()), diff --git a/packages/node-sdk/paima-db/migrations/up.sql b/packages/node-sdk/paima-db/migrations/up.sql index e406877a..20203eec 100644 --- a/packages/node-sdk/paima-db/migrations/up.sql +++ b/packages/node-sdk/paima-db/migrations/up.sql @@ -249,7 +249,7 @@ CREATE TABLE mina_checkpoint ( ); CREATE TABLE achievement_progress( - wallet TEXT NOT NULL, + wallet INTEGER NOT NULL REFERENCES addresses(id), name TEXT NOT NULL, completed_date TIMESTAMP, progress INTEGER, diff --git a/packages/node-sdk/paima-db/src/paima-tables.ts b/packages/node-sdk/paima-db/src/paima-tables.ts index 32a7f5e0..24c1207a 100644 --- a/packages/node-sdk/paima-db/src/paima-tables.ts +++ b/packages/node-sdk/paima-db/src/paima-tables.ts @@ -597,7 +597,7 @@ const TABLE_DATA_MINA_CHECKPOINT: TableData = { const QUERY_CREATE_TABLE_ACHIEVEMENT_PROGRESS = ` CREATE TABLE achievement_progress( - wallet TEXT NOT NULL, + wallet INTEGER NOT NULL REFERENCES addresses(id), name TEXT NOT NULL, completed_date TIMESTAMP, progress INTEGER, @@ -610,7 +610,7 @@ const TABLE_DATA_ACHIEVEMENT_PROGRESS: TableData = { tableName: 'achievement_progress', primaryKeyColumns: ['wallet', 'name'], columnData: packTuples([ - ['wallet', 'text', 'NO', ''], + ['wallet', 'integer', 'NO', ''], ['name', 'text', 'NO', ''], ['completed_date', 'timestamp without time zone', 'YES', ''], ['progress', 'integer', 'YES', ''], diff --git a/packages/node-sdk/paima-db/src/sql/achievements.queries.ts b/packages/node-sdk/paima-db/src/sql/achievements.queries.ts index a174a400..a51a0d4a 100644 --- a/packages/node-sdk/paima-db/src/sql/achievements.queries.ts +++ b/packages/node-sdk/paima-db/src/sql/achievements.queries.ts @@ -6,7 +6,7 @@ export type DateOrString = Date | string; /** 'GetAchievementProgress' parameters type */ export interface IGetAchievementProgressParams { names: readonly (string | null | void)[]; - wallet: string; + wallet: number; } /** 'GetAchievementProgress' return type */ @@ -15,7 +15,7 @@ export interface IGetAchievementProgressResult { name: string; progress: number | null; total: number | null; - wallet: string; + wallet: number; } /** 'GetAchievementProgress' query type */ @@ -43,7 +43,7 @@ export interface ISetAchievementProgressParams { name: string; progress?: number | null | void; total?: number | null | void; - wallet: string; + wallet: number; } /** 'SetAchievementProgress' return type */