@proofchain/sdk 1.2.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +254 -114
- package/dist/index.d.mts +2501 -276
- package/dist/index.d.ts +2501 -276
- package/dist/index.js +2031 -275
- package/dist/index.mjs +2004 -271
- package/package.json +43 -19
- package/src/client.ts +0 -312
- package/src/contract.ts +0 -212
- package/src/index.ts +0 -65
- package/src/types.ts +0 -228
- package/tsconfig.json +0 -18
package/src/types.ts
DELETED
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
// ============ Request Types ============
|
|
2
|
-
|
|
3
|
-
export interface ChallengeRequest {
|
|
4
|
-
wallet_address: string;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export interface VerifyRequest {
|
|
8
|
-
wallet_address: string;
|
|
9
|
-
signature: string;
|
|
10
|
-
message: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export interface EventCreate {
|
|
14
|
-
user_id: string;
|
|
15
|
-
event_type: string;
|
|
16
|
-
data: Record<string, unknown>;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface EventQuery {
|
|
20
|
-
event_types?: string[];
|
|
21
|
-
start_time?: string;
|
|
22
|
-
end_time?: string;
|
|
23
|
-
include_invalidated?: boolean;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface VerifyProofRequest {
|
|
27
|
-
leaf: string;
|
|
28
|
-
proof: string[];
|
|
29
|
-
root: string;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface LinkWalletRequest {
|
|
33
|
-
user_id: string;
|
|
34
|
-
wallet_address: string;
|
|
35
|
-
is_primary?: boolean;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// ============ Response Types ============
|
|
39
|
-
|
|
40
|
-
export interface HealthResponse {
|
|
41
|
-
status: string;
|
|
42
|
-
timestamp: string;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export interface ChallengeResponse {
|
|
46
|
-
message: string;
|
|
47
|
-
nonce: string;
|
|
48
|
-
expires_at: string;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
export interface AuthResponse {
|
|
52
|
-
access_token: string;
|
|
53
|
-
token_type: string;
|
|
54
|
-
expires_in: number;
|
|
55
|
-
wallet_address: string;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export interface Event {
|
|
59
|
-
id: string;
|
|
60
|
-
user_id: string;
|
|
61
|
-
event_type: string;
|
|
62
|
-
ipfs_hash: string;
|
|
63
|
-
timestamp: string;
|
|
64
|
-
invalidated: boolean;
|
|
65
|
-
gateway_url?: string;
|
|
66
|
-
data?: Record<string, unknown>;
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export interface EventsListResponse {
|
|
70
|
-
events: Event[];
|
|
71
|
-
total: number;
|
|
72
|
-
limit: number;
|
|
73
|
-
offset: number;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
export interface MerkleTree {
|
|
77
|
-
user_id: string;
|
|
78
|
-
root: string | null;
|
|
79
|
-
event_count: number;
|
|
80
|
-
rebuilt_at?: string;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export interface MerkleProof {
|
|
84
|
-
user_id: string;
|
|
85
|
-
ipfs_hash: string;
|
|
86
|
-
leaf: string;
|
|
87
|
-
proof: string[];
|
|
88
|
-
root: string;
|
|
89
|
-
index: number;
|
|
90
|
-
event_type?: string;
|
|
91
|
-
timestamp?: number;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export interface VerifyProofResponse {
|
|
95
|
-
valid: boolean;
|
|
96
|
-
leaf: string;
|
|
97
|
-
root: string;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export interface Wallet {
|
|
101
|
-
wallet_address: string;
|
|
102
|
-
user_id: string;
|
|
103
|
-
is_primary: boolean;
|
|
104
|
-
linked_at: string;
|
|
105
|
-
merkle_root?: string;
|
|
106
|
-
onchain_root?: string;
|
|
107
|
-
onchain_synced?: boolean;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
export interface WalletStatus {
|
|
111
|
-
user_id: string;
|
|
112
|
-
wallets: Wallet[];
|
|
113
|
-
merkle_root: string | null;
|
|
114
|
-
onchain_synced: boolean;
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// ============ SDK Config ============
|
|
118
|
-
|
|
119
|
-
export interface AttestationClientConfig {
|
|
120
|
-
baseUrl: string;
|
|
121
|
-
accessToken?: string;
|
|
122
|
-
timeout?: number;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export interface RequestOptions {
|
|
126
|
-
headers?: Record<string, string>;
|
|
127
|
-
signal?: AbortSignal;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// ============ Quest Types ============
|
|
131
|
-
|
|
132
|
-
export interface QuestStep {
|
|
133
|
-
id: string;
|
|
134
|
-
name: string;
|
|
135
|
-
description?: string;
|
|
136
|
-
order: number;
|
|
137
|
-
step_type: 'event_count' | 'event_match' | 'unique_values' | 'cumulative' | 'streak' | 'manual';
|
|
138
|
-
event_type?: string;
|
|
139
|
-
event_types?: string[];
|
|
140
|
-
criteria?: Record<string, unknown>;
|
|
141
|
-
required_data_fields?: Record<string, unknown>;
|
|
142
|
-
step_points?: number;
|
|
143
|
-
icon_url?: string;
|
|
144
|
-
is_optional: boolean;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
export interface Quest {
|
|
148
|
-
id: string;
|
|
149
|
-
name: string;
|
|
150
|
-
slug: string;
|
|
151
|
-
description?: string;
|
|
152
|
-
short_description?: string;
|
|
153
|
-
icon_url?: string;
|
|
154
|
-
banner_url?: string;
|
|
155
|
-
category?: string;
|
|
156
|
-
difficulty?: 'easy' | 'medium' | 'hard' | 'legendary';
|
|
157
|
-
estimated_time?: string;
|
|
158
|
-
status: 'draft' | 'active' | 'paused' | 'ended' | 'archived';
|
|
159
|
-
is_ordered: boolean;
|
|
160
|
-
is_repeatable: boolean;
|
|
161
|
-
is_available: boolean;
|
|
162
|
-
total_steps: number;
|
|
163
|
-
starts_at?: string;
|
|
164
|
-
ends_at?: string;
|
|
165
|
-
time_limit_hours?: number;
|
|
166
|
-
max_participants?: number;
|
|
167
|
-
current_participants: number;
|
|
168
|
-
max_completions?: number;
|
|
169
|
-
current_completions: number;
|
|
170
|
-
reward_points?: number;
|
|
171
|
-
is_public: boolean;
|
|
172
|
-
is_featured: boolean;
|
|
173
|
-
tags: string[];
|
|
174
|
-
steps: QuestStep[];
|
|
175
|
-
created_at: string;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
export interface RewardInfo {
|
|
179
|
-
id: string;
|
|
180
|
-
name: string;
|
|
181
|
-
description?: string;
|
|
182
|
-
type: 'points' | 'nft' | 'badge' | 'coupon' | 'custom';
|
|
183
|
-
image_url?: string;
|
|
184
|
-
issued_at?: string;
|
|
185
|
-
claimed: boolean;
|
|
186
|
-
claim_url?: string;
|
|
187
|
-
metadata: Record<string, unknown>;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
export interface UserQuestProgress {
|
|
191
|
-
id: string;
|
|
192
|
-
quest_id: string;
|
|
193
|
-
user_id: string;
|
|
194
|
-
status: 'not_started' | 'in_progress' | 'completed' | 'reward_pending' | 'reward_issued' | 'expired' | 'abandoned';
|
|
195
|
-
current_step: number;
|
|
196
|
-
steps_completed: number;
|
|
197
|
-
total_steps: number;
|
|
198
|
-
completion_percentage: number;
|
|
199
|
-
points_earned: number;
|
|
200
|
-
step_progress: Record<string, {
|
|
201
|
-
count: number;
|
|
202
|
-
unique_values?: string[];
|
|
203
|
-
completed?: boolean;
|
|
204
|
-
completed_at?: string;
|
|
205
|
-
}>;
|
|
206
|
-
started_at?: string;
|
|
207
|
-
completed_at?: string;
|
|
208
|
-
expires_at?: string;
|
|
209
|
-
completion_count: number;
|
|
210
|
-
// Reward info
|
|
211
|
-
reward_earned_id?: string;
|
|
212
|
-
reward_issued_at?: string;
|
|
213
|
-
reward?: RewardInfo;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
export interface QuestWithProgress {
|
|
217
|
-
quest: Quest;
|
|
218
|
-
progress?: UserQuestProgress;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
export interface QuestStepCompletionResult {
|
|
222
|
-
step_index: number;
|
|
223
|
-
step_completed: boolean;
|
|
224
|
-
quest_completed: boolean;
|
|
225
|
-
current_count: number;
|
|
226
|
-
target_count: number;
|
|
227
|
-
points_earned: number;
|
|
228
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2020",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"moduleResolution": "bundler",
|
|
6
|
-
"lib": ["ES2020", "DOM"],
|
|
7
|
-
"strict": true,
|
|
8
|
-
"esModuleInterop": true,
|
|
9
|
-
"skipLibCheck": true,
|
|
10
|
-
"forceConsistentCasingInFileNames": true,
|
|
11
|
-
"declaration": true,
|
|
12
|
-
"declarationMap": true,
|
|
13
|
-
"outDir": "./dist",
|
|
14
|
-
"rootDir": "./src"
|
|
15
|
-
},
|
|
16
|
-
"include": ["src/**/*"],
|
|
17
|
-
"exclude": ["node_modules", "dist"]
|
|
18
|
-
}
|