Skip to content

Commit

Permalink
Use wallet ID instead of address to handle delegation
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaceManiac committed May 8, 2024
1 parent 21afec7 commit b546a1c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
Expand Down
2 changes: 1 addition & 1 deletion packages/node-sdk/paima-db/migrations/up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions packages/node-sdk/paima-db/src/paima-tables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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', ''],
Expand Down
6 changes: 3 additions & 3 deletions packages/node-sdk/paima-db/src/sql/achievements.queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand All @@ -15,7 +15,7 @@ export interface IGetAchievementProgressResult {
name: string;
progress: number | null;
total: number | null;
wallet: string;
wallet: number;
}

/** 'GetAchievementProgress' query type */
Expand Down Expand Up @@ -43,7 +43,7 @@ export interface ISetAchievementProgressParams {
name: string;
progress?: number | null | void;
total?: number | null | void;
wallet: string;
wallet: number;
}

/** 'SetAchievementProgress' return type */
Expand Down

0 comments on commit b546a1c

Please sign in to comment.