-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add rewards route * Display rewards tabs * Update layout * Split pages * Add points block UI * Display limited events UI * Display tasks list * Display history UI * Update history page * Add leaderboard UI * Display active task ID page * Fix points block * Add points API * Update api hooks * Update balance block * Display API data * Add withdraw modal * Add loading states * Add missing loading states * Fire confetti * Add small UI fixes * Add rewards store * Refactor leaderboard * Refactor history * Update rewards balance block * Add rewards about page * Extract back link * Add multi-page loading * Rename withdraw modal * Update claim modal * Update leaderboard styles * Add rewards auth * Add enter program & program details * Update history * Update earn history * Update components * Chore code * Update events loading * Chore types and imports * Refactor rewards components * Update enums * Fix event actions * Add credentials * Fix review issues * Update packages
- Loading branch information
Showing
75 changed files
with
2,526 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
export enum EventsRequestFilters { | ||
Did = 'did', | ||
Status = 'status', | ||
MetaStaticName = 'meta.static.name', | ||
} | ||
|
||
export enum EventRequestPageProperties { | ||
Limit = 'limit', | ||
Cursor = 'cursor', | ||
Order = 'order', | ||
} | ||
|
||
export enum EventRequestPageOrder { | ||
Asc = 'asc', | ||
Desc = 'desc', | ||
} | ||
|
||
export enum EventStatuses { | ||
Open = 'open', | ||
Fulfilled = 'fulfilled', | ||
Claimed = 'claimed', | ||
} | ||
|
||
export enum EventMetadataFrequencies { | ||
OneTime = 'one-time', | ||
Daily = 'daily', | ||
Weekly = 'weekly', | ||
Unlimited = 'unlimited', | ||
Custom = 'custom', | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './events' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
import { api } from '@/api/clients' | ||
import { ApiServicePaths } from '@/enums' | ||
|
||
import { type Balance, type Withdrawal } from '../types' | ||
|
||
export const BALANCE_MOCK: Balance = { | ||
id: 'did:iden3:readonly:tTep1wgHSGULyrAgWD1SKDxtg1jAPGzZuXuHNPknH', | ||
type: 'balance', | ||
amount: 175, | ||
created_at: 1628793600, | ||
updated_at: 1628793600, | ||
rank: 291, | ||
} | ||
|
||
export const LEADERBOARD_MOCK: Balance[] = [ | ||
{ | ||
id: 'did:iden3:readonly:mhQHvqmvimneVHCL5EufeZvfzigRt', | ||
amount: 25345, | ||
type: 'balance', | ||
created_at: 1628793600, | ||
updated_at: 1628793600, | ||
rank: 1, | ||
}, | ||
{ | ||
id: 'did:iden3:readonly:mi1QKgywFcFD7d35QRaHwd6b6Cxy', | ||
amount: 25123, | ||
type: 'balance', | ||
created_at: 1628793600, | ||
updated_at: 1628793600, | ||
rank: 2, | ||
}, | ||
{ | ||
id: 'did:iden3:readonly:mmaJ5kAjbGLRVcfqwsMPi7kHK1f', | ||
amount: 23402, | ||
type: 'balance', | ||
created_at: 1628793600, | ||
updated_at: 1628793600, | ||
rank: 3, | ||
}, | ||
{ | ||
id: 'did:iden3:readonly:mhQHvqmvimneVHCL5EufeZvfzigRv', | ||
amount: 21502, | ||
type: 'balance', | ||
created_at: 1628793600, | ||
updated_at: 1628793600, | ||
rank: 4, | ||
}, | ||
{ | ||
id: 'did:iden3:readonly:mi1QKgywFcFD7d35QRaHwd6b6Cxb', | ||
amount: 20420, | ||
type: 'balance', | ||
created_at: 1628793600, | ||
updated_at: 1628793600, | ||
rank: 5, | ||
}, | ||
{ | ||
id: 'did:iden3:readonly:mmaJ5kAjbGLRVcfqwsMPi7kHK1a', | ||
amount: 19499, | ||
type: 'balance', | ||
created_at: 1628793600, | ||
updated_at: 1628793600, | ||
rank: 6, | ||
}, | ||
{ | ||
id: 'did:iden3:readonly:mi1QKgywFcFD7d35QRaHwd6b6Cxe', | ||
amount: 8992, | ||
type: 'balance', | ||
created_at: 1628793600, | ||
updated_at: 1628793600, | ||
rank: 7, | ||
}, | ||
{ | ||
id: 'did:iden3:readonly:ahQHvqmvimneVHCL5EufeZvfzigRt', | ||
amount: 8150, | ||
type: 'balance', | ||
created_at: 1628793600, | ||
updated_at: 1628793600, | ||
rank: 8, | ||
}, | ||
{ | ||
id: 'did:iden3:readonly:whQHvqmvimneVHCL5EufeZvfzigRt', | ||
amount: 4520, | ||
type: 'balance', | ||
created_at: 1628793600, | ||
updated_at: 1628793600, | ||
rank: 9, | ||
}, | ||
{ | ||
id: 'did:iden3:readonly:mhQHvqmvimneVHCL5EufeZvfzigRa', | ||
amount: 1402, | ||
type: 'balance', | ||
created_at: 1628793600, | ||
updated_at: 1628793600, | ||
rank: 10, | ||
}, | ||
] | ||
|
||
// Balances | ||
export const createPointsBalance = async (did: string, referredBy: string) => { | ||
return api.post<Balance>(`${ApiServicePaths.Points}/v1/public/balances`, { | ||
body: { | ||
data: { | ||
id: did, | ||
type: 'create_balance', | ||
attributes: { | ||
referred_by: referredBy, | ||
}, | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
export const getLeaderboard = async () => { | ||
return api.get<Balance[]>(`${ApiServicePaths.Points}/v1/public/balances`) | ||
} | ||
|
||
export const getPointsBalance = async (did: string) => { | ||
return api.get<Balance>(`${ApiServicePaths.Points}/v1/public/balances/${did}?rank=true`) | ||
} | ||
|
||
// Withdrawals | ||
export const getWithdrawalHistory = async (did: string) => { | ||
return api.get<Withdrawal[]>(`${ApiServicePaths.Points}/v1/public/balances/${did}/withdrawals`) | ||
} | ||
|
||
export const withdrawPoints = async (did: string, amount: number, address: string) => { | ||
return api.post<Withdrawal>(`${ApiServicePaths.Points}/v1/public/balances/${did}/withdrawals`, { | ||
body: { | ||
data: { | ||
type: 'withdraw', | ||
attributes: { | ||
amount, | ||
address, | ||
}, | ||
}, | ||
}, | ||
}) | ||
} |
Oops, something went wrong.