@grapenpm/gpass-sdk 0.1.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/README.md +251 -0
- package/dist/index.d.mts +1041 -0
- package/dist/index.d.ts +1041 -0
- package/dist/index.js +3609 -0
- package/dist/index.mjs +3592 -0
- package/package.json +50 -0
- package/src/bn-js.d.ts +18 -0
- package/src/client.ts +349 -0
- package/src/idl.ts +531 -0
- package/src/index.ts +44 -0
- package/src/pda.ts +125 -0
- package/src/types/index.ts +294 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,1041 @@
|
|
|
1
|
+
import { Program, AnchorProvider } from '@coral-xyz/anchor';
|
|
2
|
+
import { PublicKey, TransactionInstruction, Transaction } from '@solana/web3.js';
|
|
3
|
+
import BN from 'bn.js';
|
|
4
|
+
|
|
5
|
+
type GrapeGatingProtocol = {
|
|
6
|
+
version: "0.1.0";
|
|
7
|
+
name: "grape_gating_protocol";
|
|
8
|
+
instructions: [
|
|
9
|
+
{
|
|
10
|
+
name: "initializeGate";
|
|
11
|
+
accounts: [
|
|
12
|
+
{
|
|
13
|
+
name: "gate";
|
|
14
|
+
isMut: true;
|
|
15
|
+
isSigner: false;
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: "authority";
|
|
19
|
+
isMut: false;
|
|
20
|
+
isSigner: true;
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: "payer";
|
|
24
|
+
isMut: true;
|
|
25
|
+
isSigner: true;
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: "systemProgram";
|
|
29
|
+
isMut: false;
|
|
30
|
+
isSigner: false;
|
|
31
|
+
}
|
|
32
|
+
];
|
|
33
|
+
args: [
|
|
34
|
+
{
|
|
35
|
+
name: "gateId";
|
|
36
|
+
type: "publicKey";
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: "criteria";
|
|
40
|
+
type: {
|
|
41
|
+
defined: "GateCriteria";
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: "gateType";
|
|
46
|
+
type: {
|
|
47
|
+
defined: "GateType";
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
];
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: "setGateAuthority";
|
|
54
|
+
accounts: [
|
|
55
|
+
{
|
|
56
|
+
name: "gate";
|
|
57
|
+
isMut: true;
|
|
58
|
+
isSigner: false;
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: "authority";
|
|
62
|
+
isMut: false;
|
|
63
|
+
isSigner: true;
|
|
64
|
+
}
|
|
65
|
+
];
|
|
66
|
+
args: [
|
|
67
|
+
{
|
|
68
|
+
name: "gateId";
|
|
69
|
+
type: "publicKey";
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
name: "newAuthority";
|
|
73
|
+
type: "publicKey";
|
|
74
|
+
}
|
|
75
|
+
];
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: "updateGateCriteria";
|
|
79
|
+
accounts: [
|
|
80
|
+
{
|
|
81
|
+
name: "gate";
|
|
82
|
+
isMut: true;
|
|
83
|
+
isSigner: false;
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: "authority";
|
|
87
|
+
isMut: false;
|
|
88
|
+
isSigner: true;
|
|
89
|
+
}
|
|
90
|
+
];
|
|
91
|
+
args: [
|
|
92
|
+
{
|
|
93
|
+
name: "gateId";
|
|
94
|
+
type: "publicKey";
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: "newCriteria";
|
|
98
|
+
type: {
|
|
99
|
+
defined: "GateCriteria";
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
];
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: "setGateActive";
|
|
106
|
+
accounts: [
|
|
107
|
+
{
|
|
108
|
+
name: "gate";
|
|
109
|
+
isMut: true;
|
|
110
|
+
isSigner: false;
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: "authority";
|
|
114
|
+
isMut: false;
|
|
115
|
+
isSigner: true;
|
|
116
|
+
}
|
|
117
|
+
];
|
|
118
|
+
args: [
|
|
119
|
+
{
|
|
120
|
+
name: "gateId";
|
|
121
|
+
type: "publicKey";
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
name: "isActive";
|
|
125
|
+
type: "bool";
|
|
126
|
+
}
|
|
127
|
+
];
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
name: "checkGate";
|
|
131
|
+
accounts: [
|
|
132
|
+
{
|
|
133
|
+
name: "gate";
|
|
134
|
+
isMut: true;
|
|
135
|
+
isSigner: false;
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
name: "user";
|
|
139
|
+
isMut: false;
|
|
140
|
+
isSigner: false;
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
name: "reputationAccount";
|
|
144
|
+
isMut: true;
|
|
145
|
+
isSigner: false;
|
|
146
|
+
isOptional: true;
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
name: "identityAccount";
|
|
150
|
+
isMut: false;
|
|
151
|
+
isSigner: false;
|
|
152
|
+
isOptional: true;
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
name: "linkAccount";
|
|
156
|
+
isMut: false;
|
|
157
|
+
isSigner: false;
|
|
158
|
+
isOptional: true;
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
name: "tokenAccount";
|
|
162
|
+
isMut: false;
|
|
163
|
+
isSigner: false;
|
|
164
|
+
isOptional: true;
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
name: "checkRecord";
|
|
168
|
+
isMut: true;
|
|
169
|
+
isSigner: false;
|
|
170
|
+
isOptional: true;
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
name: "payer";
|
|
174
|
+
isMut: true;
|
|
175
|
+
isSigner: true;
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
name: "systemProgram";
|
|
179
|
+
isMut: false;
|
|
180
|
+
isSigner: false;
|
|
181
|
+
}
|
|
182
|
+
];
|
|
183
|
+
args: [{
|
|
184
|
+
name: "gateId";
|
|
185
|
+
type: "publicKey";
|
|
186
|
+
}];
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
name: "createCheckRecord";
|
|
190
|
+
accounts: [
|
|
191
|
+
{
|
|
192
|
+
name: "gate";
|
|
193
|
+
isMut: false;
|
|
194
|
+
isSigner: false;
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
name: "user";
|
|
198
|
+
isMut: false;
|
|
199
|
+
isSigner: false;
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
name: "checkRecord";
|
|
203
|
+
isMut: true;
|
|
204
|
+
isSigner: false;
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
name: "payer";
|
|
208
|
+
isMut: true;
|
|
209
|
+
isSigner: true;
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
name: "systemProgram";
|
|
213
|
+
isMut: false;
|
|
214
|
+
isSigner: false;
|
|
215
|
+
}
|
|
216
|
+
];
|
|
217
|
+
args: [{
|
|
218
|
+
name: "gateId";
|
|
219
|
+
type: "publicKey";
|
|
220
|
+
}];
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
name: "closeGate";
|
|
224
|
+
accounts: [
|
|
225
|
+
{
|
|
226
|
+
name: "gate";
|
|
227
|
+
isMut: true;
|
|
228
|
+
isSigner: false;
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
name: "authority";
|
|
232
|
+
isMut: false;
|
|
233
|
+
isSigner: true;
|
|
234
|
+
},
|
|
235
|
+
{
|
|
236
|
+
name: "recipient";
|
|
237
|
+
isMut: true;
|
|
238
|
+
isSigner: false;
|
|
239
|
+
}
|
|
240
|
+
];
|
|
241
|
+
args: [{
|
|
242
|
+
name: "gateId";
|
|
243
|
+
type: "publicKey";
|
|
244
|
+
}];
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
name: "closeCheckRecord";
|
|
248
|
+
accounts: [
|
|
249
|
+
{
|
|
250
|
+
name: "gate";
|
|
251
|
+
isMut: false;
|
|
252
|
+
isSigner: false;
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
name: "user";
|
|
256
|
+
isMut: false;
|
|
257
|
+
isSigner: false;
|
|
258
|
+
},
|
|
259
|
+
{
|
|
260
|
+
name: "checkRecord";
|
|
261
|
+
isMut: true;
|
|
262
|
+
isSigner: false;
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
name: "authority";
|
|
266
|
+
isMut: false;
|
|
267
|
+
isSigner: true;
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
name: "recipient";
|
|
271
|
+
isMut: true;
|
|
272
|
+
isSigner: false;
|
|
273
|
+
}
|
|
274
|
+
];
|
|
275
|
+
args: [{
|
|
276
|
+
name: "gateId";
|
|
277
|
+
type: "publicKey";
|
|
278
|
+
}];
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
name: "adminCloseAny";
|
|
282
|
+
accounts: [
|
|
283
|
+
{
|
|
284
|
+
name: "authority";
|
|
285
|
+
isMut: false;
|
|
286
|
+
isSigner: true;
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
name: "target";
|
|
290
|
+
isMut: true;
|
|
291
|
+
isSigner: false;
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
name: "recipient";
|
|
295
|
+
isMut: true;
|
|
296
|
+
isSigner: false;
|
|
297
|
+
}
|
|
298
|
+
];
|
|
299
|
+
args: [];
|
|
300
|
+
}
|
|
301
|
+
];
|
|
302
|
+
accounts: [
|
|
303
|
+
{
|
|
304
|
+
name: "Gate";
|
|
305
|
+
type: {
|
|
306
|
+
kind: "struct";
|
|
307
|
+
fields: [
|
|
308
|
+
{
|
|
309
|
+
name: "version";
|
|
310
|
+
type: "u8";
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
name: "gateId";
|
|
314
|
+
type: "publicKey";
|
|
315
|
+
},
|
|
316
|
+
{
|
|
317
|
+
name: "authority";
|
|
318
|
+
type: "publicKey";
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
name: "criteria";
|
|
322
|
+
type: {
|
|
323
|
+
defined: "GateCriteria";
|
|
324
|
+
};
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
name: "gateType";
|
|
328
|
+
type: {
|
|
329
|
+
defined: "GateType";
|
|
330
|
+
};
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
name: "isActive";
|
|
334
|
+
type: "bool";
|
|
335
|
+
},
|
|
336
|
+
{
|
|
337
|
+
name: "createdAt";
|
|
338
|
+
type: "i64";
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
name: "totalChecks";
|
|
342
|
+
type: "u64";
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
name: "successfulChecks";
|
|
346
|
+
type: "u64";
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
name: "bump";
|
|
350
|
+
type: "u8";
|
|
351
|
+
}
|
|
352
|
+
];
|
|
353
|
+
};
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
name: "GateCheckRecord";
|
|
357
|
+
type: {
|
|
358
|
+
kind: "struct";
|
|
359
|
+
fields: [
|
|
360
|
+
{
|
|
361
|
+
name: "version";
|
|
362
|
+
type: "u8";
|
|
363
|
+
},
|
|
364
|
+
{
|
|
365
|
+
name: "gate";
|
|
366
|
+
type: "publicKey";
|
|
367
|
+
},
|
|
368
|
+
{
|
|
369
|
+
name: "user";
|
|
370
|
+
type: "publicKey";
|
|
371
|
+
},
|
|
372
|
+
{
|
|
373
|
+
name: "passed";
|
|
374
|
+
type: "bool";
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
name: "checkedAt";
|
|
378
|
+
type: "i64";
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
name: "bump";
|
|
382
|
+
type: "u8";
|
|
383
|
+
}
|
|
384
|
+
];
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
];
|
|
388
|
+
types: [
|
|
389
|
+
{
|
|
390
|
+
name: "GateType";
|
|
391
|
+
type: {
|
|
392
|
+
kind: "enum";
|
|
393
|
+
variants: [
|
|
394
|
+
{
|
|
395
|
+
name: "SingleUse";
|
|
396
|
+
},
|
|
397
|
+
{
|
|
398
|
+
name: "Reusable";
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
name: "TimeLimited";
|
|
402
|
+
fields: [{
|
|
403
|
+
name: "durationSeconds";
|
|
404
|
+
type: "i64";
|
|
405
|
+
}];
|
|
406
|
+
},
|
|
407
|
+
{
|
|
408
|
+
name: "Subscription";
|
|
409
|
+
fields: [{
|
|
410
|
+
name: "intervalSeconds";
|
|
411
|
+
type: "i64";
|
|
412
|
+
}];
|
|
413
|
+
}
|
|
414
|
+
];
|
|
415
|
+
};
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
name: "GateCriteria";
|
|
419
|
+
type: {
|
|
420
|
+
kind: "enum";
|
|
421
|
+
variants: [
|
|
422
|
+
{
|
|
423
|
+
name: "MinReputation";
|
|
424
|
+
fields: [
|
|
425
|
+
{
|
|
426
|
+
name: "vineConfig";
|
|
427
|
+
type: "publicKey";
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
name: "minPoints";
|
|
431
|
+
type: "u64";
|
|
432
|
+
},
|
|
433
|
+
{
|
|
434
|
+
name: "season";
|
|
435
|
+
type: "u16";
|
|
436
|
+
}
|
|
437
|
+
];
|
|
438
|
+
},
|
|
439
|
+
{
|
|
440
|
+
name: "VerifiedIdentity";
|
|
441
|
+
fields: [
|
|
442
|
+
{
|
|
443
|
+
name: "grapeSpace";
|
|
444
|
+
type: "publicKey";
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
name: "platforms";
|
|
448
|
+
type: "bytes";
|
|
449
|
+
}
|
|
450
|
+
];
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
name: "VerifiedWithWallet";
|
|
454
|
+
fields: [
|
|
455
|
+
{
|
|
456
|
+
name: "grapeSpace";
|
|
457
|
+
type: "publicKey";
|
|
458
|
+
},
|
|
459
|
+
{
|
|
460
|
+
name: "platforms";
|
|
461
|
+
type: "bytes";
|
|
462
|
+
}
|
|
463
|
+
];
|
|
464
|
+
},
|
|
465
|
+
{
|
|
466
|
+
name: "Combined";
|
|
467
|
+
fields: [
|
|
468
|
+
{
|
|
469
|
+
name: "vineConfig";
|
|
470
|
+
type: "publicKey";
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
name: "minPoints";
|
|
474
|
+
type: "u64";
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
name: "season";
|
|
478
|
+
type: "u16";
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
name: "grapeSpace";
|
|
482
|
+
type: "publicKey";
|
|
483
|
+
},
|
|
484
|
+
{
|
|
485
|
+
name: "platforms";
|
|
486
|
+
type: "bytes";
|
|
487
|
+
},
|
|
488
|
+
{
|
|
489
|
+
name: "requireWalletLink";
|
|
490
|
+
type: "bool";
|
|
491
|
+
}
|
|
492
|
+
];
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
name: "TimeLockedReputation";
|
|
496
|
+
fields: [
|
|
497
|
+
{
|
|
498
|
+
name: "vineConfig";
|
|
499
|
+
type: "publicKey";
|
|
500
|
+
},
|
|
501
|
+
{
|
|
502
|
+
name: "minPoints";
|
|
503
|
+
type: "u64";
|
|
504
|
+
},
|
|
505
|
+
{
|
|
506
|
+
name: "season";
|
|
507
|
+
type: "u16";
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
name: "minHoldDurationSeconds";
|
|
511
|
+
type: "u64";
|
|
512
|
+
}
|
|
513
|
+
];
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
name: "MultiDao";
|
|
517
|
+
fields: [
|
|
518
|
+
{
|
|
519
|
+
name: "requiredGates";
|
|
520
|
+
type: {
|
|
521
|
+
vec: "publicKey";
|
|
522
|
+
};
|
|
523
|
+
},
|
|
524
|
+
{
|
|
525
|
+
name: "requireAll";
|
|
526
|
+
type: "bool";
|
|
527
|
+
}
|
|
528
|
+
];
|
|
529
|
+
},
|
|
530
|
+
{
|
|
531
|
+
name: "TokenHolding";
|
|
532
|
+
fields: [
|
|
533
|
+
{
|
|
534
|
+
name: "mint";
|
|
535
|
+
type: "publicKey";
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
name: "minAmount";
|
|
539
|
+
type: "u64";
|
|
540
|
+
},
|
|
541
|
+
{
|
|
542
|
+
name: "checkAta";
|
|
543
|
+
type: "bool";
|
|
544
|
+
}
|
|
545
|
+
];
|
|
546
|
+
},
|
|
547
|
+
{
|
|
548
|
+
name: "NftCollection";
|
|
549
|
+
fields: [
|
|
550
|
+
{
|
|
551
|
+
name: "collectionMint";
|
|
552
|
+
type: "publicKey";
|
|
553
|
+
},
|
|
554
|
+
{
|
|
555
|
+
name: "minCount";
|
|
556
|
+
type: "u16";
|
|
557
|
+
}
|
|
558
|
+
];
|
|
559
|
+
},
|
|
560
|
+
{
|
|
561
|
+
name: "CustomProgram";
|
|
562
|
+
fields: [
|
|
563
|
+
{
|
|
564
|
+
name: "programId";
|
|
565
|
+
type: "publicKey";
|
|
566
|
+
},
|
|
567
|
+
{
|
|
568
|
+
name: "instructionData";
|
|
569
|
+
type: "bytes";
|
|
570
|
+
}
|
|
571
|
+
];
|
|
572
|
+
}
|
|
573
|
+
];
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
];
|
|
577
|
+
errors: [
|
|
578
|
+
{
|
|
579
|
+
code: 6000;
|
|
580
|
+
name: "Unauthorized";
|
|
581
|
+
msg: "Unauthorized";
|
|
582
|
+
},
|
|
583
|
+
{
|
|
584
|
+
code: 6001;
|
|
585
|
+
name: "GateInactive";
|
|
586
|
+
msg: "Gate is inactive";
|
|
587
|
+
},
|
|
588
|
+
{
|
|
589
|
+
code: 6002;
|
|
590
|
+
name: "GateCheckFailed";
|
|
591
|
+
msg: "Gate check failed";
|
|
592
|
+
},
|
|
593
|
+
{
|
|
594
|
+
code: 6003;
|
|
595
|
+
name: "ReputationAccountRequired";
|
|
596
|
+
msg: "Reputation account required";
|
|
597
|
+
},
|
|
598
|
+
{
|
|
599
|
+
code: 6004;
|
|
600
|
+
name: "IdentityAccountRequired";
|
|
601
|
+
msg: "Identity account required";
|
|
602
|
+
},
|
|
603
|
+
{
|
|
604
|
+
code: 6005;
|
|
605
|
+
name: "LinkAccountRequired";
|
|
606
|
+
msg: "Link account required";
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
code: 6006;
|
|
610
|
+
name: "TokenAccountRequired";
|
|
611
|
+
msg: "Token account required";
|
|
612
|
+
},
|
|
613
|
+
{
|
|
614
|
+
code: 6007;
|
|
615
|
+
name: "InvalidReputationAccount";
|
|
616
|
+
msg: "Invalid reputation account";
|
|
617
|
+
},
|
|
618
|
+
{
|
|
619
|
+
code: 6008;
|
|
620
|
+
name: "InvalidIdentityAccount";
|
|
621
|
+
msg: "Invalid identity account";
|
|
622
|
+
},
|
|
623
|
+
{
|
|
624
|
+
code: 6009;
|
|
625
|
+
name: "InvalidLinkAccount";
|
|
626
|
+
msg: "Invalid link account";
|
|
627
|
+
},
|
|
628
|
+
{
|
|
629
|
+
code: 6010;
|
|
630
|
+
name: "InvalidPda";
|
|
631
|
+
msg: "Invalid PDA derivation";
|
|
632
|
+
},
|
|
633
|
+
{
|
|
634
|
+
code: 6011;
|
|
635
|
+
name: "WrongUser";
|
|
636
|
+
msg: "Wrong user";
|
|
637
|
+
},
|
|
638
|
+
{
|
|
639
|
+
code: 6012;
|
|
640
|
+
name: "SeasonMismatch";
|
|
641
|
+
msg: "Season mismatch";
|
|
642
|
+
},
|
|
643
|
+
{
|
|
644
|
+
code: 6013;
|
|
645
|
+
name: "WrongSpace";
|
|
646
|
+
msg: "Wrong space";
|
|
647
|
+
},
|
|
648
|
+
{
|
|
649
|
+
code: 6014;
|
|
650
|
+
name: "WrongIdentity";
|
|
651
|
+
msg: "Wrong identity";
|
|
652
|
+
},
|
|
653
|
+
{
|
|
654
|
+
code: 6015;
|
|
655
|
+
name: "IdentityNotVerified";
|
|
656
|
+
msg: "Identity not verified";
|
|
657
|
+
},
|
|
658
|
+
{
|
|
659
|
+
code: 6016;
|
|
660
|
+
name: "IdentityExpired";
|
|
661
|
+
msg: "Identity expired";
|
|
662
|
+
},
|
|
663
|
+
{
|
|
664
|
+
code: 6017;
|
|
665
|
+
name: "InsufficientGateChecks";
|
|
666
|
+
msg: "Insufficient gate checks";
|
|
667
|
+
},
|
|
668
|
+
{
|
|
669
|
+
code: 6018;
|
|
670
|
+
name: "InvalidCheckRecord";
|
|
671
|
+
msg: "Invalid check record";
|
|
672
|
+
},
|
|
673
|
+
{
|
|
674
|
+
code: 6019;
|
|
675
|
+
name: "CheckRecordExpired";
|
|
676
|
+
msg: "Check record expired";
|
|
677
|
+
},
|
|
678
|
+
{
|
|
679
|
+
code: 6020;
|
|
680
|
+
name: "WrongMint";
|
|
681
|
+
msg: "Wrong mint";
|
|
682
|
+
},
|
|
683
|
+
{
|
|
684
|
+
code: 6021;
|
|
685
|
+
name: "WrongTokenOwner";
|
|
686
|
+
msg: "Wrong token owner";
|
|
687
|
+
},
|
|
688
|
+
{
|
|
689
|
+
code: 6022;
|
|
690
|
+
name: "InsufficientNfts";
|
|
691
|
+
msg: "Insufficient NFTs";
|
|
692
|
+
},
|
|
693
|
+
{
|
|
694
|
+
code: 6023;
|
|
695
|
+
name: "CustomProgramAccountRequired";
|
|
696
|
+
msg: "Custom program account required";
|
|
697
|
+
},
|
|
698
|
+
{
|
|
699
|
+
code: 6024;
|
|
700
|
+
name: "InvalidCustomProgram";
|
|
701
|
+
msg: "Invalid custom program";
|
|
702
|
+
},
|
|
703
|
+
{
|
|
704
|
+
code: 6025;
|
|
705
|
+
name: "CustomValidationFailed";
|
|
706
|
+
msg: "Custom validation failed";
|
|
707
|
+
},
|
|
708
|
+
{
|
|
709
|
+
code: 6026;
|
|
710
|
+
name: "TargetNotProgramOwned";
|
|
711
|
+
msg: "Target not program owned";
|
|
712
|
+
},
|
|
713
|
+
{
|
|
714
|
+
code: 6027;
|
|
715
|
+
name: "Overflow";
|
|
716
|
+
msg: "Overflow";
|
|
717
|
+
}
|
|
718
|
+
];
|
|
719
|
+
};
|
|
720
|
+
declare const IDL: GrapeGatingProtocol;
|
|
721
|
+
|
|
722
|
+
declare const GPASS_PROGRAM_ID: PublicKey;
|
|
723
|
+
declare const VINE_REPUTATION_PROGRAM_ID: PublicKey;
|
|
724
|
+
declare const GRAPE_VERIFICATION_PROGRAM_ID: PublicKey;
|
|
725
|
+
declare enum VerificationPlatform {
|
|
726
|
+
Discord = 0,
|
|
727
|
+
Telegram = 1,
|
|
728
|
+
Twitter = 2,
|
|
729
|
+
Email = 3
|
|
730
|
+
}
|
|
731
|
+
type GateType = {
|
|
732
|
+
singleUse: Record<string, never>;
|
|
733
|
+
} | {
|
|
734
|
+
reusable: Record<string, never>;
|
|
735
|
+
} | {
|
|
736
|
+
timeLimited: {
|
|
737
|
+
durationSeconds: BN;
|
|
738
|
+
};
|
|
739
|
+
} | {
|
|
740
|
+
subscription: {
|
|
741
|
+
intervalSeconds: BN;
|
|
742
|
+
};
|
|
743
|
+
};
|
|
744
|
+
declare const GateTypeFactory: {
|
|
745
|
+
singleUse: () => GateType;
|
|
746
|
+
reusable: () => GateType;
|
|
747
|
+
timeLimited: (durationSeconds: number) => GateType;
|
|
748
|
+
subscription: (intervalSeconds: number) => GateType;
|
|
749
|
+
};
|
|
750
|
+
type GateCriteria = {
|
|
751
|
+
minReputation: {
|
|
752
|
+
vineConfig: PublicKey;
|
|
753
|
+
minPoints: BN;
|
|
754
|
+
season: number;
|
|
755
|
+
};
|
|
756
|
+
} | {
|
|
757
|
+
verifiedIdentity: {
|
|
758
|
+
grapeSpace: PublicKey;
|
|
759
|
+
platforms: Buffer;
|
|
760
|
+
};
|
|
761
|
+
} | {
|
|
762
|
+
verifiedWithWallet: {
|
|
763
|
+
grapeSpace: PublicKey;
|
|
764
|
+
platforms: Buffer;
|
|
765
|
+
};
|
|
766
|
+
} | {
|
|
767
|
+
combined: {
|
|
768
|
+
vineConfig: PublicKey;
|
|
769
|
+
minPoints: BN;
|
|
770
|
+
season: number;
|
|
771
|
+
grapeSpace: PublicKey;
|
|
772
|
+
platforms: Buffer;
|
|
773
|
+
requireWalletLink: boolean;
|
|
774
|
+
};
|
|
775
|
+
} | {
|
|
776
|
+
timeLockedReputation: {
|
|
777
|
+
vineConfig: PublicKey;
|
|
778
|
+
minPoints: BN;
|
|
779
|
+
season: number;
|
|
780
|
+
minHoldDurationSeconds: BN;
|
|
781
|
+
};
|
|
782
|
+
} | {
|
|
783
|
+
multiDao: {
|
|
784
|
+
requiredGates: PublicKey[];
|
|
785
|
+
requireAll: boolean;
|
|
786
|
+
};
|
|
787
|
+
} | {
|
|
788
|
+
tokenHolding: {
|
|
789
|
+
mint: PublicKey;
|
|
790
|
+
minAmount: BN;
|
|
791
|
+
checkAta: boolean;
|
|
792
|
+
};
|
|
793
|
+
} | {
|
|
794
|
+
nftCollection: {
|
|
795
|
+
collectionMint: PublicKey;
|
|
796
|
+
minCount: number;
|
|
797
|
+
};
|
|
798
|
+
} | {
|
|
799
|
+
customProgram: {
|
|
800
|
+
programId: PublicKey;
|
|
801
|
+
instructionData: Buffer;
|
|
802
|
+
};
|
|
803
|
+
};
|
|
804
|
+
declare const GateCriteriaFactory: {
|
|
805
|
+
minReputation: (params: {
|
|
806
|
+
vineConfig: PublicKey;
|
|
807
|
+
minPoints: number | BN;
|
|
808
|
+
season: number;
|
|
809
|
+
}) => GateCriteria;
|
|
810
|
+
verifiedIdentity: (params: {
|
|
811
|
+
grapeSpace: PublicKey;
|
|
812
|
+
platforms: VerificationPlatform[];
|
|
813
|
+
}) => GateCriteria;
|
|
814
|
+
verifiedWithWallet: (params: {
|
|
815
|
+
grapeSpace: PublicKey;
|
|
816
|
+
platforms: VerificationPlatform[];
|
|
817
|
+
}) => GateCriteria;
|
|
818
|
+
combined: (params: {
|
|
819
|
+
vineConfig: PublicKey;
|
|
820
|
+
minPoints: number | BN;
|
|
821
|
+
season: number;
|
|
822
|
+
grapeSpace: PublicKey;
|
|
823
|
+
platforms: VerificationPlatform[];
|
|
824
|
+
requireWalletLink?: boolean;
|
|
825
|
+
}) => GateCriteria;
|
|
826
|
+
timeLockedReputation: (params: {
|
|
827
|
+
vineConfig: PublicKey;
|
|
828
|
+
minPoints: number | BN;
|
|
829
|
+
season: number;
|
|
830
|
+
minHoldDurationSeconds: number | BN;
|
|
831
|
+
}) => GateCriteria;
|
|
832
|
+
multiDao: (params: {
|
|
833
|
+
requiredGates: PublicKey[];
|
|
834
|
+
requireAll?: boolean;
|
|
835
|
+
}) => GateCriteria;
|
|
836
|
+
tokenHolding: (params: {
|
|
837
|
+
mint: PublicKey;
|
|
838
|
+
minAmount: number | BN;
|
|
839
|
+
checkAta?: boolean;
|
|
840
|
+
}) => GateCriteria;
|
|
841
|
+
nftCollection: (params: {
|
|
842
|
+
collectionMint: PublicKey;
|
|
843
|
+
minCount?: number;
|
|
844
|
+
}) => GateCriteria;
|
|
845
|
+
customProgram: (params: {
|
|
846
|
+
programId: PublicKey;
|
|
847
|
+
instructionData?: Buffer;
|
|
848
|
+
}) => GateCriteria;
|
|
849
|
+
};
|
|
850
|
+
interface Gate {
|
|
851
|
+
version: number;
|
|
852
|
+
gateId: PublicKey;
|
|
853
|
+
authority: PublicKey;
|
|
854
|
+
criteria: GateCriteria;
|
|
855
|
+
gateType: GateType;
|
|
856
|
+
isActive: boolean;
|
|
857
|
+
createdAt: BN;
|
|
858
|
+
totalChecks: BN;
|
|
859
|
+
successfulChecks: BN;
|
|
860
|
+
bump: number;
|
|
861
|
+
}
|
|
862
|
+
interface GateCheckRecord {
|
|
863
|
+
version: number;
|
|
864
|
+
gate: PublicKey;
|
|
865
|
+
user: PublicKey;
|
|
866
|
+
passed: boolean;
|
|
867
|
+
checkedAt: BN;
|
|
868
|
+
bump: number;
|
|
869
|
+
}
|
|
870
|
+
interface InitializeGateParams {
|
|
871
|
+
/** Unique identifier for this gate (use a fresh Keypair.publicKey) */
|
|
872
|
+
gateId: PublicKey;
|
|
873
|
+
criteria: GateCriteria;
|
|
874
|
+
gateType: GateType;
|
|
875
|
+
/** Defaults to the provider wallet */
|
|
876
|
+
authority?: PublicKey;
|
|
877
|
+
}
|
|
878
|
+
interface CheckGateParams {
|
|
879
|
+
gateId: PublicKey;
|
|
880
|
+
user: PublicKey;
|
|
881
|
+
/** Vine reputation PDA — required for reputation-based criteria */
|
|
882
|
+
reputationAccount?: PublicKey;
|
|
883
|
+
/** Grape identity PDA — required for verification-based criteria */
|
|
884
|
+
identityAccount?: PublicKey;
|
|
885
|
+
/** Grape link PDA — required for VerifiedWithWallet / Combined */
|
|
886
|
+
linkAccount?: PublicKey;
|
|
887
|
+
/** SPL token account — required for TokenHolding criteria */
|
|
888
|
+
tokenAccount?: PublicKey;
|
|
889
|
+
/** If true, creates/updates a GateCheckRecord PDA on-chain */
|
|
890
|
+
storeRecord?: boolean;
|
|
891
|
+
}
|
|
892
|
+
interface UpdateGateCriteriaParams {
|
|
893
|
+
gateId: PublicKey;
|
|
894
|
+
newCriteria: GateCriteria;
|
|
895
|
+
}
|
|
896
|
+
interface SetGateActiveParams {
|
|
897
|
+
gateId: PublicKey;
|
|
898
|
+
isActive: boolean;
|
|
899
|
+
}
|
|
900
|
+
interface CloseGateParams {
|
|
901
|
+
gateId: PublicKey;
|
|
902
|
+
/** SOL recipient — defaults to provider wallet */
|
|
903
|
+
recipient?: PublicKey;
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
declare class GpassClient {
|
|
907
|
+
readonly program: Program<GrapeGatingProtocol>;
|
|
908
|
+
readonly provider: AnchorProvider;
|
|
909
|
+
constructor(provider: AnchorProvider, programId?: PublicKey);
|
|
910
|
+
/**
|
|
911
|
+
* Create a new gate with the given criteria.
|
|
912
|
+
*
|
|
913
|
+
* @example
|
|
914
|
+
* const { tx, gate } = await client.initializeGate({
|
|
915
|
+
* gateId: Keypair.generate().publicKey,
|
|
916
|
+
* criteria: GateCriteriaFactory.combined({
|
|
917
|
+
* vineConfig,
|
|
918
|
+
* minPoints: 500,
|
|
919
|
+
* season: 1,
|
|
920
|
+
* grapeSpace,
|
|
921
|
+
* platforms: [VerificationPlatform.Discord],
|
|
922
|
+
* requireWalletLink: true,
|
|
923
|
+
* }),
|
|
924
|
+
* gateType: GateTypeFactory.reusable(),
|
|
925
|
+
* });
|
|
926
|
+
*/
|
|
927
|
+
initializeGate(params: InitializeGateParams): Promise<{
|
|
928
|
+
tx: string;
|
|
929
|
+
gate: PublicKey;
|
|
930
|
+
}>;
|
|
931
|
+
/**
|
|
932
|
+
* Check whether a user passes a gate's criteria.
|
|
933
|
+
* Throws GateCheckFailed (6002) if the user does not pass.
|
|
934
|
+
*
|
|
935
|
+
* @example
|
|
936
|
+
* await client.checkGate({
|
|
937
|
+
* gateId,
|
|
938
|
+
* user: walletPublicKey,
|
|
939
|
+
* reputationAccount: vineRepPda,
|
|
940
|
+
* identityAccount: grapeIdentityPda,
|
|
941
|
+
* storeRecord: true,
|
|
942
|
+
* });
|
|
943
|
+
*/
|
|
944
|
+
checkGate(params: CheckGateParams): Promise<string>;
|
|
945
|
+
/**
|
|
946
|
+
* Simulate a gate check without submitting a transaction.
|
|
947
|
+
* Returns true if the user would pass, false otherwise.
|
|
948
|
+
* Does NOT throw — use this for UI gating.
|
|
949
|
+
*/
|
|
950
|
+
simulateCheckGate(params: CheckGateParams): Promise<boolean>;
|
|
951
|
+
/**
|
|
952
|
+
* Update the criteria for an existing gate.
|
|
953
|
+
*/
|
|
954
|
+
updateGateCriteria(params: UpdateGateCriteriaParams): Promise<string>;
|
|
955
|
+
/**
|
|
956
|
+
* Enable or disable a gate.
|
|
957
|
+
*/
|
|
958
|
+
setGateActive(params: SetGateActiveParams): Promise<string>;
|
|
959
|
+
/**
|
|
960
|
+
* Transfer gate authority to a new public key.
|
|
961
|
+
*/
|
|
962
|
+
setGateAuthority(params: {
|
|
963
|
+
gateId: PublicKey;
|
|
964
|
+
newAuthority: PublicKey;
|
|
965
|
+
}): Promise<string>;
|
|
966
|
+
/**
|
|
967
|
+
* Close a gate and reclaim rent.
|
|
968
|
+
*/
|
|
969
|
+
closeGate(params: CloseGateParams): Promise<string>;
|
|
970
|
+
/**
|
|
971
|
+
* Close a check record and reclaim rent.
|
|
972
|
+
*/
|
|
973
|
+
closeCheckRecord(params: {
|
|
974
|
+
gateId: PublicKey;
|
|
975
|
+
user: PublicKey;
|
|
976
|
+
recipient?: PublicKey;
|
|
977
|
+
}): Promise<string>;
|
|
978
|
+
/**
|
|
979
|
+
* Fetch a Gate account.
|
|
980
|
+
*/
|
|
981
|
+
fetchGate(gateId: PublicKey): Promise<Gate | null>;
|
|
982
|
+
/**
|
|
983
|
+
* Fetch a GateCheckRecord for a user.
|
|
984
|
+
*/
|
|
985
|
+
fetchCheckRecord(gateId: PublicKey, user: PublicKey): Promise<GateCheckRecord | null>;
|
|
986
|
+
/**
|
|
987
|
+
* Fetch all gates owned by a specific authority.
|
|
988
|
+
*/
|
|
989
|
+
fetchGatesByAuthority(authority: PublicKey): Promise<{
|
|
990
|
+
publicKey: PublicKey;
|
|
991
|
+
account: Gate;
|
|
992
|
+
}[]>;
|
|
993
|
+
/**
|
|
994
|
+
* Returns the raw instruction for checkGate — useful for
|
|
995
|
+
* bundling into a larger transaction (e.g., CPI-style on client side).
|
|
996
|
+
*/
|
|
997
|
+
buildCheckGateInstruction(params: CheckGateParams): Promise<TransactionInstruction>;
|
|
998
|
+
/**
|
|
999
|
+
* Build a full transaction that checks a gate and then executes
|
|
1000
|
+
* additional instructions (e.g., mint, vote, transfer).
|
|
1001
|
+
*/
|
|
1002
|
+
buildGatedTransaction(checkParams: CheckGateParams, ...additionalInstructions: TransactionInstruction[]): Promise<Transaction>;
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
/**
|
|
1006
|
+
* Derives the Gate PDA for a given gate_id.
|
|
1007
|
+
* seeds = ["gate", gate_id]
|
|
1008
|
+
*/
|
|
1009
|
+
declare function findGatePda(gateId: PublicKey, programId?: PublicKey): Promise<[PublicKey, number]>;
|
|
1010
|
+
/**
|
|
1011
|
+
* Derives the GateCheckRecord PDA for a gate + user.
|
|
1012
|
+
* seeds = ["check", gate, user]
|
|
1013
|
+
*/
|
|
1014
|
+
declare function findCheckRecordPda(gate: PublicKey, user: PublicKey, programId?: PublicKey): Promise<[PublicKey, number]>;
|
|
1015
|
+
/**
|
|
1016
|
+
* Derives the Vine ReputationConfig PDA.
|
|
1017
|
+
* seeds = ["config", dao_id]
|
|
1018
|
+
*/
|
|
1019
|
+
declare function findVineConfigPda(daoId: PublicKey, programId?: PublicKey): Promise<[PublicKey, number]>;
|
|
1020
|
+
/**
|
|
1021
|
+
* Derives the Vine Reputation PDA for a user in a config+season.
|
|
1022
|
+
* seeds = ["reputation", config, user, season_le_bytes]
|
|
1023
|
+
*/
|
|
1024
|
+
declare function findVineReputationPda(config: PublicKey, user: PublicKey, season: number, programId?: PublicKey): Promise<[PublicKey, number]>;
|
|
1025
|
+
/**
|
|
1026
|
+
* Derives the Grape VerificationSpace PDA.
|
|
1027
|
+
* seeds = ["space", dao_id]
|
|
1028
|
+
*/
|
|
1029
|
+
declare function findGrapeSpacePda(daoId: PublicKey, programId?: PublicKey): Promise<[PublicKey, number]>;
|
|
1030
|
+
/**
|
|
1031
|
+
* Derives the Grape Identity PDA.
|
|
1032
|
+
* seeds = ["identity", space, platform_seed, id_hash]
|
|
1033
|
+
*/
|
|
1034
|
+
declare function findGrapeIdentityPda(space: PublicKey, platformSeed: number, idHash: Uint8Array, programId?: PublicKey): Promise<[PublicKey, number]>;
|
|
1035
|
+
/**
|
|
1036
|
+
* Derives the Grape Link PDA.
|
|
1037
|
+
* seeds = ["link", identity, wallet_hash]
|
|
1038
|
+
*/
|
|
1039
|
+
declare function findGrapeLinkPda(identity: PublicKey, walletHash: Uint8Array, programId?: PublicKey): Promise<[PublicKey, number]>;
|
|
1040
|
+
|
|
1041
|
+
export { type CheckGateParams, type CloseGateParams, GPASS_PROGRAM_ID, GRAPE_VERIFICATION_PROGRAM_ID, type Gate, type GateCheckRecord, type GateCriteria, GateCriteriaFactory, type GateType, GateTypeFactory, GpassClient, type GrapeGatingProtocol, IDL, type InitializeGateParams, type SetGateActiveParams, type UpdateGateCriteriaParams, VINE_REPUTATION_PROGRAM_ID, VerificationPlatform, findCheckRecordPda, findGatePda, findGrapeIdentityPda, findGrapeLinkPda, findGrapeSpacePda, findVineConfigPda, findVineReputationPda };
|