@show-karma/karma-gap-sdk 0.4.0 → 0.4.5

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.
@@ -1,4 +1,9 @@
1
1
  [
2
+ {
3
+ "inputs": [],
4
+ "stateMutability": "nonpayable",
5
+ "type": "constructor"
6
+ },
2
7
  {
3
8
  "anonymous": false,
4
9
  "inputs": [],
@@ -56,6 +61,76 @@
56
61
  "name": "OwnershipTransferred",
57
62
  "type": "event"
58
63
  },
64
+ {
65
+ "inputs": [],
66
+ "name": "ATTEST_TYPEHASH",
67
+ "outputs": [
68
+ {
69
+ "internalType": "bytes32",
70
+ "name": "",
71
+ "type": "bytes32"
72
+ }
73
+ ],
74
+ "stateMutability": "view",
75
+ "type": "function"
76
+ },
77
+ {
78
+ "inputs": [],
79
+ "name": "_grantSchemaUid",
80
+ "outputs": [
81
+ {
82
+ "internalType": "bytes32",
83
+ "name": "",
84
+ "type": "bytes32"
85
+ }
86
+ ],
87
+ "stateMutability": "view",
88
+ "type": "function"
89
+ },
90
+ {
91
+ "inputs": [],
92
+ "name": "_projectResolver",
93
+ "outputs": [
94
+ {
95
+ "internalType": "contract IProjectResolver",
96
+ "name": "",
97
+ "type": "address"
98
+ }
99
+ ],
100
+ "stateMutability": "view",
101
+ "type": "function"
102
+ },
103
+ {
104
+ "inputs": [],
105
+ "name": "_projectSchemaUid",
106
+ "outputs": [
107
+ {
108
+ "internalType": "bytes32",
109
+ "name": "",
110
+ "type": "bytes32"
111
+ }
112
+ ],
113
+ "stateMutability": "view",
114
+ "type": "function"
115
+ },
116
+ {
117
+ "inputs": [
118
+ {
119
+ "internalType": "bytes32",
120
+ "name": "projectUid",
121
+ "type": "bytes32"
122
+ },
123
+ {
124
+ "internalType": "address",
125
+ "name": "addr",
126
+ "type": "address"
127
+ }
128
+ ],
129
+ "name": "addProjectAdmin",
130
+ "outputs": [],
131
+ "stateMutability": "nonpayable",
132
+ "type": "function"
133
+ },
59
134
  {
60
135
  "inputs": [
61
136
  {
@@ -218,15 +293,66 @@
218
293
  "type": "function"
219
294
  },
220
295
  {
221
- "inputs": [
296
+ "inputs": [],
297
+ "name": "eas",
298
+ "outputs": [
299
+ {
300
+ "internalType": "contract IEAS",
301
+ "name": "",
302
+ "type": "address"
303
+ }
304
+ ],
305
+ "stateMutability": "view",
306
+ "type": "function"
307
+ },
308
+ {
309
+ "inputs": [],
310
+ "name": "eip712Domain",
311
+ "outputs": [
312
+ {
313
+ "internalType": "bytes1",
314
+ "name": "fields",
315
+ "type": "bytes1"
316
+ },
317
+ {
318
+ "internalType": "string",
319
+ "name": "name",
320
+ "type": "string"
321
+ },
322
+ {
323
+ "internalType": "string",
324
+ "name": "version",
325
+ "type": "string"
326
+ },
327
+ {
328
+ "internalType": "uint256",
329
+ "name": "chainId",
330
+ "type": "uint256"
331
+ },
222
332
  {
223
333
  "internalType": "address",
224
- "name": "easAddr",
334
+ "name": "verifyingContract",
225
335
  "type": "address"
226
336
  },
337
+ {
338
+ "internalType": "bytes32",
339
+ "name": "salt",
340
+ "type": "bytes32"
341
+ },
342
+ {
343
+ "internalType": "uint256[]",
344
+ "name": "extensions",
345
+ "type": "uint256[]"
346
+ }
347
+ ],
348
+ "stateMutability": "view",
349
+ "type": "function"
350
+ },
351
+ {
352
+ "inputs": [
227
353
  {
228
354
  "internalType": "address",
229
- "name": "projectResolverAddr",
355
+ "name": "easAddr",
230
356
  "type": "address"
231
357
  }
232
358
  ],
@@ -527,204 +653,169 @@
527
653
  "stateMutability": "nonpayable",
528
654
  "type": "function"
529
655
  },
530
- {
531
- "inputs": [],
532
- "name": "renounceOwnership",
533
- "outputs": [],
534
- "stateMutability": "nonpayable",
535
- "type": "function"
536
- },
537
656
  {
538
657
  "inputs": [
539
658
  {
540
- "internalType": "contract IProjectResolver",
541
- "name": "projectResolver",
659
+ "internalType": "address",
660
+ "name": "",
542
661
  "type": "address"
543
662
  }
544
663
  ],
545
- "name": "setProjectResolver",
546
- "outputs": [],
547
- "stateMutability": "nonpayable",
664
+ "name": "nonces",
665
+ "outputs": [
666
+ {
667
+ "internalType": "uint256",
668
+ "name": "",
669
+ "type": "uint256"
670
+ }
671
+ ],
672
+ "stateMutability": "view",
548
673
  "type": "function"
549
674
  },
550
675
  {
551
- "inputs": [
676
+ "inputs": [],
677
+ "name": "owner",
678
+ "outputs": [
552
679
  {
553
680
  "internalType": "address",
554
- "name": "newOwner",
681
+ "name": "",
555
682
  "type": "address"
556
683
  }
557
684
  ],
558
- "name": "transferOwnership",
559
- "outputs": [],
560
- "stateMutability": "nonpayable",
685
+ "stateMutability": "view",
561
686
  "type": "function"
562
687
  },
563
688
  {
564
689
  "inputs": [
565
690
  {
566
691
  "internalType": "bytes32",
567
- "name": "projectUid",
692
+ "name": "refSchemaUid",
568
693
  "type": "bytes32"
569
- },
570
- {
571
- "internalType": "address",
572
- "name": "newOwner",
573
- "type": "address"
574
694
  }
575
695
  ],
576
- "name": "transferProjectOwnership",
577
- "outputs": [],
578
- "stateMutability": "nonpayable",
579
- "type": "function"
580
- },
581
- {
582
- "inputs": [],
583
- "stateMutability": "nonpayable",
584
- "type": "constructor"
585
- },
586
- {
587
- "inputs": [],
588
- "name": "ATTEST_TYPEHASH",
696
+ "name": "refIsGrant",
589
697
  "outputs": [
590
698
  {
591
- "internalType": "bytes32",
699
+ "internalType": "bool",
592
700
  "name": "",
593
- "type": "bytes32"
701
+ "type": "bool"
594
702
  }
595
703
  ],
596
704
  "stateMutability": "view",
597
705
  "type": "function"
598
706
  },
599
707
  {
600
- "inputs": [],
601
- "name": "eas",
708
+ "inputs": [
709
+ {
710
+ "internalType": "bytes32",
711
+ "name": "refSchemaUid",
712
+ "type": "bytes32"
713
+ }
714
+ ],
715
+ "name": "refIsProject",
602
716
  "outputs": [
603
717
  {
604
- "internalType": "contract IEAS",
718
+ "internalType": "bool",
605
719
  "name": "",
606
- "type": "address"
720
+ "type": "bool"
607
721
  }
608
722
  ],
609
723
  "stateMutability": "view",
610
724
  "type": "function"
611
725
  },
612
726
  {
613
- "inputs": [],
614
- "name": "eip712Domain",
615
- "outputs": [
616
- {
617
- "internalType": "bytes1",
618
- "name": "fields",
619
- "type": "bytes1"
620
- },
621
- {
622
- "internalType": "string",
623
- "name": "name",
624
- "type": "string"
625
- },
626
- {
627
- "internalType": "string",
628
- "name": "version",
629
- "type": "string"
630
- },
631
- {
632
- "internalType": "uint256",
633
- "name": "chainId",
634
- "type": "uint256"
635
- },
636
- {
637
- "internalType": "address",
638
- "name": "verifyingContract",
639
- "type": "address"
640
- },
727
+ "inputs": [
641
728
  {
642
729
  "internalType": "bytes32",
643
- "name": "salt",
730
+ "name": "projectUid",
644
731
  "type": "bytes32"
645
732
  },
646
733
  {
647
- "internalType": "uint256[]",
648
- "name": "extensions",
649
- "type": "uint256[]"
734
+ "internalType": "address",
735
+ "name": "addr",
736
+ "type": "address"
650
737
  }
651
738
  ],
652
- "stateMutability": "view",
739
+ "name": "removeProjectAdmin",
740
+ "outputs": [],
741
+ "stateMutability": "nonpayable",
742
+ "type": "function"
743
+ },
744
+ {
745
+ "inputs": [],
746
+ "name": "renounceOwnership",
747
+ "outputs": [],
748
+ "stateMutability": "nonpayable",
653
749
  "type": "function"
654
750
  },
655
751
  {
656
752
  "inputs": [
657
- {
658
- "internalType": "address",
659
- "name": "addr",
660
- "type": "address"
661
- },
662
753
  {
663
754
  "internalType": "bytes32",
664
- "name": "projectUid",
755
+ "name": "grantSchemaUid",
665
756
  "type": "bytes32"
666
757
  }
667
758
  ],
668
- "name": "isProjectAdmin",
669
- "outputs": [
670
- {
671
- "internalType": "bool",
672
- "name": "",
673
- "type": "bool"
674
- }
675
- ],
676
- "stateMutability": "view",
759
+ "name": "setGrantSchema",
760
+ "outputs": [],
761
+ "stateMutability": "nonpayable",
677
762
  "type": "function"
678
763
  },
679
764
  {
680
765
  "inputs": [
681
766
  {
682
- "internalType": "address",
683
- "name": "",
767
+ "internalType": "contract IProjectResolver",
768
+ "name": "projectResolver",
684
769
  "type": "address"
685
770
  }
686
771
  ],
687
- "name": "nonces",
688
- "outputs": [
772
+ "name": "setProjectResolver",
773
+ "outputs": [],
774
+ "stateMutability": "nonpayable",
775
+ "type": "function"
776
+ },
777
+ {
778
+ "inputs": [
689
779
  {
690
- "internalType": "uint256",
691
- "name": "",
692
- "type": "uint256"
780
+ "internalType": "bytes32",
781
+ "name": "projectSchemaUid",
782
+ "type": "bytes32"
693
783
  }
694
784
  ],
695
- "stateMutability": "view",
785
+ "name": "setProjectSchema",
786
+ "outputs": [],
787
+ "stateMutability": "nonpayable",
696
788
  "type": "function"
697
789
  },
698
790
  {
699
- "inputs": [],
700
- "name": "owner",
701
- "outputs": [
791
+ "inputs": [
702
792
  {
703
793
  "internalType": "address",
704
- "name": "",
794
+ "name": "newOwner",
705
795
  "type": "address"
706
796
  }
707
797
  ],
708
- "stateMutability": "view",
798
+ "name": "transferOwnership",
799
+ "outputs": [],
800
+ "stateMutability": "nonpayable",
709
801
  "type": "function"
710
802
  },
711
803
  {
712
804
  "inputs": [
713
805
  {
714
806
  "internalType": "bytes32",
715
- "name": "refSchemaUid",
807
+ "name": "projectUid",
716
808
  "type": "bytes32"
717
- }
718
- ],
719
- "name": "refIsProject",
720
- "outputs": [
809
+ },
721
810
  {
722
- "internalType": "bool",
723
- "name": "",
724
- "type": "bool"
811
+ "internalType": "address",
812
+ "name": "newOwner",
813
+ "type": "address"
725
814
  }
726
815
  ],
727
- "stateMutability": "view",
816
+ "name": "transferProjectOwnership",
817
+ "outputs": [],
818
+ "stateMutability": "nonpayable",
728
819
  "type": "function"
729
820
  }
730
821
  ]
@@ -25,11 +25,35 @@
25
25
  "name": "InvalidEAS",
26
26
  "type": "error"
27
27
  },
28
+ {
29
+ "inputs": [],
30
+ "name": "InvalidLength",
31
+ "type": "error"
32
+ },
28
33
  {
29
34
  "inputs": [],
30
35
  "name": "NotPayable",
31
36
  "type": "error"
32
37
  },
38
+ {
39
+ "anonymous": false,
40
+ "inputs": [
41
+ {
42
+ "indexed": true,
43
+ "internalType": "bytes32",
44
+ "name": "uid",
45
+ "type": "bytes32"
46
+ },
47
+ {
48
+ "indexed": true,
49
+ "internalType": "address",
50
+ "name": "addr",
51
+ "type": "address"
52
+ }
53
+ ],
54
+ "name": "AddAdmin",
55
+ "type": "event"
56
+ },
33
57
  {
34
58
  "anonymous": false,
35
59
  "inputs": [
@@ -62,6 +86,62 @@
62
86
  "name": "OwnershipTransferred",
63
87
  "type": "event"
64
88
  },
89
+ {
90
+ "anonymous": false,
91
+ "inputs": [
92
+ {
93
+ "indexed": true,
94
+ "internalType": "bytes32",
95
+ "name": "uid",
96
+ "type": "bytes32"
97
+ },
98
+ {
99
+ "indexed": true,
100
+ "internalType": "address",
101
+ "name": "addr",
102
+ "type": "address"
103
+ }
104
+ ],
105
+ "name": "RemoveAdmin",
106
+ "type": "event"
107
+ },
108
+ {
109
+ "anonymous": false,
110
+ "inputs": [
111
+ {
112
+ "indexed": false,
113
+ "internalType": "bytes32",
114
+ "name": "uid",
115
+ "type": "bytes32"
116
+ },
117
+ {
118
+ "indexed": false,
119
+ "internalType": "address",
120
+ "name": "newOwner",
121
+ "type": "address"
122
+ }
123
+ ],
124
+ "name": "TransferOwnership",
125
+ "type": "event"
126
+ },
127
+ {
128
+ "inputs": [
129
+ {
130
+ "internalType": "bytes32",
131
+ "name": "uid",
132
+ "type": "bytes32"
133
+ },
134
+ {
135
+ "internalType": "address",
136
+ "name": "addr",
137
+ "type": "address"
138
+ }
139
+ ],
140
+ "name": "addAdmin",
141
+ "outputs": [],
142
+ "stateMutability": "nonpayable",
143
+ "type": "function"
144
+ },
65
145
  {
66
146
  "inputs": [
67
147
  {
@@ -164,6 +244,30 @@
164
244
  "stateMutability": "view",
165
245
  "type": "function"
166
246
  },
247
+ {
248
+ "inputs": [
249
+ {
250
+ "internalType": "bytes32",
251
+ "name": "projectId",
252
+ "type": "bytes32"
253
+ },
254
+ {
255
+ "internalType": "address",
256
+ "name": "addr",
257
+ "type": "address"
258
+ }
259
+ ],
260
+ "name": "isOwner",
261
+ "outputs": [
262
+ {
263
+ "internalType": "bool",
264
+ "name": "",
265
+ "type": "bool"
266
+ }
267
+ ],
268
+ "stateMutability": "view",
269
+ "type": "function"
270
+ },
167
271
  {
168
272
  "inputs": [],
169
273
  "name": "isPayable",
@@ -342,6 +446,86 @@
342
446
  "stateMutability": "view",
343
447
  "type": "function"
344
448
  },
449
+ {
450
+ "inputs": [
451
+ {
452
+ "internalType": "bytes32",
453
+ "name": "",
454
+ "type": "bytes32"
455
+ }
456
+ ],
457
+ "name": "projectAdmin",
458
+ "outputs": [
459
+ {
460
+ "internalType": "address",
461
+ "name": "",
462
+ "type": "address"
463
+ }
464
+ ],
465
+ "stateMutability": "view",
466
+ "type": "function"
467
+ },
468
+ {
469
+ "inputs": [
470
+ {
471
+ "internalType": "bytes32",
472
+ "name": "",
473
+ "type": "bytes32"
474
+ },
475
+ {
476
+ "internalType": "address",
477
+ "name": "",
478
+ "type": "address"
479
+ }
480
+ ],
481
+ "name": "projectAdmins",
482
+ "outputs": [
483
+ {
484
+ "internalType": "bool",
485
+ "name": "",
486
+ "type": "bool"
487
+ }
488
+ ],
489
+ "stateMutability": "view",
490
+ "type": "function"
491
+ },
492
+ {
493
+ "inputs": [
494
+ {
495
+ "internalType": "bytes32",
496
+ "name": "",
497
+ "type": "bytes32"
498
+ }
499
+ ],
500
+ "name": "projectOwner",
501
+ "outputs": [
502
+ {
503
+ "internalType": "address",
504
+ "name": "",
505
+ "type": "address"
506
+ }
507
+ ],
508
+ "stateMutability": "view",
509
+ "type": "function"
510
+ },
511
+ {
512
+ "inputs": [
513
+ {
514
+ "internalType": "bytes32",
515
+ "name": "uid",
516
+ "type": "bytes32"
517
+ },
518
+ {
519
+ "internalType": "address",
520
+ "name": "addr",
521
+ "type": "address"
522
+ }
523
+ ],
524
+ "name": "removeAdmin",
525
+ "outputs": [],
526
+ "stateMutability": "nonpayable",
527
+ "type": "function"
528
+ },
345
529
  {
346
530
  "inputs": [],
347
531
  "name": "renounceOwnership",
@@ -780,6 +780,13 @@ export declare const abis: {
780
780
  };
781
781
  };
782
782
  MultiAttester: ({
783
+ inputs: any[];
784
+ stateMutability: string;
785
+ type: string;
786
+ anonymous?: undefined;
787
+ name?: undefined;
788
+ outputs?: undefined;
789
+ } | {
783
790
  anonymous: boolean;
784
791
  inputs: {
785
792
  indexed: boolean;
@@ -789,8 +796,8 @@ export declare const abis: {
789
796
  }[];
790
797
  name: string;
791
798
  type: string;
792
- outputs?: undefined;
793
799
  stateMutability?: undefined;
800
+ outputs?: undefined;
794
801
  } | {
795
802
  inputs: ({
796
803
  components: ({
@@ -867,13 +874,6 @@ export declare const abis: {
867
874
  stateMutability: string;
868
875
  type: string;
869
876
  anonymous?: undefined;
870
- } | {
871
- inputs: any[];
872
- stateMutability: string;
873
- type: string;
874
- anonymous?: undefined;
875
- name?: undefined;
876
- outputs?: undefined;
877
877
  })[];
878
878
  ProjectResolver: ({
879
879
  inputs: {
@@ -1,7 +1,7 @@
1
- import { CallbackStatus, Hex, RawAttestationPayload, RawMultiAttestPayload, SignerOrProvider } from "core/types";
2
1
  import { MultiRevocationRequest } from "@ethereum-attestation-service/eas-sdk";
3
- import { AttestationWithTx } from "../types/attestations";
2
+ import { CallbackStatus, Hex, RawAttestationPayload, RawMultiAttestPayload, SignerOrProvider } from "core/types";
4
3
  import { Transaction } from "ethers";
4
+ import { AttestationWithTx } from "../types/attestations";
5
5
  export declare class GapContract {
6
6
  static nonces: {
7
7
  [key: string]: number;
@@ -68,8 +68,35 @@ export declare class GapContract {
68
68
  * Check if the signer is the owner of the project
69
69
  * @param signer
70
70
  * @param projectUID
71
+ * @param projectChainId
72
+ * @param publicAddress
73
+ * @returns
74
+ */
75
+ static isProjectOwner(signer: SignerOrProvider, projectUID: Hex, projectChainId: number, publicAddress?: string): Promise<boolean>;
76
+ /**
77
+ * Check if the signer is admin of the project
78
+ * @param signer
79
+ * @param projectUID
80
+ * @param projectChainId
81
+ * @param publicAddress
71
82
  * @returns
72
83
  */
73
- static isProjectOwner(signer: SignerOrProvider, projectUID: Hex, projectChainId: number): Promise<boolean>;
84
+ static isProjectAdmin(signer: SignerOrProvider, projectUID: Hex, projectChainId: number, publicAddress?: string): Promise<boolean>;
74
85
  private static getTransactionLogs;
86
+ /**
87
+ * Add Project Admin
88
+ * @param signer
89
+ * @param projectUID
90
+ * @param newAdmin
91
+ * @returns
92
+ */
93
+ static addProjectAdmin(signer: SignerOrProvider, projectUID: Hex, newAdmin: Hex): Promise<any>;
94
+ /**
95
+ * RemoveProject Admin
96
+ * @param signer
97
+ * @param projectUID
98
+ * @param newAdmin
99
+ * @returns
100
+ */
101
+ static removeProjectAdmin(signer: SignerOrProvider, projectUID: Hex, oldAdmin: Hex): Promise<any>;
75
102
  }
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GapContract = void 0;
4
- const GAP_1 = require("../GAP");
5
- const serialize_bigint_1 = require("../../utils/serialize-bigint");
6
- const send_gelato_txn_1 = require("../../utils/gelato/send-gelato-txn");
7
4
  const eas_sdk_1 = require("@ethereum-attestation-service/eas-sdk");
5
+ const send_gelato_txn_1 = require("../../utils/gelato/send-gelato-txn");
6
+ const serialize_bigint_1 = require("../../utils/serialize-bigint");
7
+ const GAP_1 = require("../GAP");
8
8
  const AttestationDataTypes = {
9
9
  Attest: [
10
10
  { name: "payloadHash", type: "string" },
@@ -224,13 +224,29 @@ class GapContract {
224
224
  * Check if the signer is the owner of the project
225
225
  * @param signer
226
226
  * @param projectUID
227
+ * @param projectChainId
228
+ * @param publicAddress
227
229
  * @returns
228
230
  */
229
- static async isProjectOwner(signer, projectUID, projectChainId) {
231
+ static async isProjectOwner(signer, projectUID, projectChainId, publicAddress) {
230
232
  const contract = await GAP_1.GAP.getProjectResolver(signer, projectChainId);
231
- const address = await this.getSignerAddress(signer);
232
- const isOwner = await contract.isAdmin(projectUID, address);
233
- return !!isOwner?.[0];
233
+ const address = publicAddress || (await this.getSignerAddress(signer));
234
+ const isOwner = await contract.isOwner(projectUID, address);
235
+ return isOwner;
236
+ }
237
+ /**
238
+ * Check if the signer is admin of the project
239
+ * @param signer
240
+ * @param projectUID
241
+ * @param projectChainId
242
+ * @param publicAddress
243
+ * @returns
244
+ */
245
+ static async isProjectAdmin(signer, projectUID, projectChainId, publicAddress) {
246
+ const contract = await GAP_1.GAP.getProjectResolver(signer, projectChainId);
247
+ const address = publicAddress || (await this.getSignerAddress(signer));
248
+ const isAdmin = await contract.isAdmin(projectUID, address);
249
+ return isAdmin;
234
250
  }
235
251
  static async getTransactionLogs(signer, txnHash) {
236
252
  const txn = await signer.provider.getTransactionReceipt(txnHash);
@@ -240,6 +256,30 @@ class GapContract {
240
256
  // the ones from the GelatoRelay contract.
241
257
  return (0, eas_sdk_1.getUIDsFromAttestReceipt)(txn);
242
258
  }
259
+ /**
260
+ * Add Project Admin
261
+ * @param signer
262
+ * @param projectUID
263
+ * @param newAdmin
264
+ * @returns
265
+ */
266
+ static async addProjectAdmin(signer, projectUID, newAdmin) {
267
+ const contract = await GAP_1.GAP.getProjectResolver(signer);
268
+ const tx = await contract.addAdmin(projectUID, newAdmin);
269
+ return tx.wait?.();
270
+ }
271
+ /**
272
+ * RemoveProject Admin
273
+ * @param signer
274
+ * @param projectUID
275
+ * @param newAdmin
276
+ * @returns
277
+ */
278
+ static async removeProjectAdmin(signer, projectUID, oldAdmin) {
279
+ const contract = await GAP_1.GAP.getProjectResolver(signer);
280
+ const tx = await contract.removeAdmin(projectUID, oldAdmin);
281
+ return tx.wait?.();
282
+ }
243
283
  }
244
284
  exports.GapContract = GapContract;
245
285
  GapContract.nonces = {};
@@ -7,14 +7,14 @@ export interface IContributorProfile {
7
7
  aboutMe?: string;
8
8
  github?: string;
9
9
  twitter?: string;
10
- linkdin?: number;
10
+ linkedin?: string;
11
11
  }
12
12
  export declare class ContributorProfile extends Attestation<IContributorProfile> implements IContributorProfile {
13
13
  name: string;
14
14
  aboutMe?: string;
15
15
  github?: string;
16
16
  twitter?: string;
17
- linkdin?: number;
17
+ linkedin?: string;
18
18
  constructor(data: AttestationArgs<IContributorProfile, GapSchema>);
19
19
  /**
20
20
  * Creates the payload for a multi-attestation.
@@ -1,13 +1,13 @@
1
+ import { Hex, MultiAttestPayload, SignerOrProvider, TNetwork } from "core/types";
1
2
  import { Attestation } from "../Attestation";
3
+ import { IProjectResponse } from "../karma-indexer/api/types";
2
4
  import { AttestationWithTx, Grantee, MemberDetails, ProjectDetails, ProjectEndorsement } from "../types/attestations";
3
- import { Hex, MultiAttestPayload, SignerOrProvider, TNetwork } from "core/types";
4
5
  import { Grant } from "./Grant";
5
6
  import { MemberOf } from "./MemberOf";
6
- import { IProjectResponse } from "../karma-indexer/api/types";
7
7
  import { IProjectImpact, ProjectImpact } from "./ProjectImpact";
8
- import { ProjectUpdate } from "./ProjectUpdate";
9
- import { ProjectPointer } from "./ProjectPointer";
10
8
  import { ProjectMilestone } from "./ProjectMilestone";
9
+ import { ProjectPointer } from "./ProjectPointer";
10
+ import { ProjectUpdate } from "./ProjectUpdate";
11
11
  export interface IProject {
12
12
  project: true;
13
13
  }
@@ -34,7 +34,8 @@ export declare class Project extends Attestation<IProject> {
34
34
  multiAttestPayload(currentPayload?: MultiAttestPayload, communityIdx?: number): Promise<MultiAttestPayload>;
35
35
  attest(signer: SignerOrProvider, callback?: Function): Promise<AttestationWithTx>;
36
36
  transferOwnership(signer: SignerOrProvider, newOwner: Hex, callback?: Function): Promise<AttestationWithTx>;
37
- isOwner(signer: SignerOrProvider): Promise<boolean>;
37
+ isOwner(signer: SignerOrProvider, publicAddress?: string): Promise<boolean>;
38
+ isAdmin(signer: SignerOrProvider, publicAddress?: string): Promise<boolean>;
38
39
  /**
39
40
  * Add new members to the project.
40
41
  * If any member in the array already exists in the project
@@ -86,4 +87,6 @@ export declare class Project extends Attestation<IProject> {
86
87
  private attestGhostProjectImpact;
87
88
  attestEndorsement(signer: SignerOrProvider, data?: ProjectEndorsement): Promise<void>;
88
89
  attestGhostProject(signer: SignerOrProvider, targetChainId: number): Promise<AttestationWithTx>;
90
+ addAdmin(signer: SignerOrProvider, newAdmin: Hex, callback?: Function): Promise<AttestationWithTx>;
91
+ removeAdmin(signer: SignerOrProvider, oldAdmin: Hex, callback?: Function): Promise<AttestationWithTx>;
89
92
  }
@@ -1,19 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Project = void 0;
4
+ const consts_1 = require("../../consts");
5
+ const utils_1 = require("../../utils");
6
+ const AllGapSchemas_1 = require("../AllGapSchemas");
4
7
  const Attestation_1 = require("../Attestation");
5
- const attestations_1 = require("../types/attestations");
8
+ const GapContract_1 = require("../contract/GapContract");
6
9
  const SchemaError_1 = require("../SchemaError");
7
- const utils_1 = require("../../utils");
10
+ const attestations_1 = require("../types/attestations");
8
11
  const Grant_1 = require("./Grant");
9
- const consts_1 = require("../../consts");
10
12
  const MemberOf_1 = require("./MemberOf");
11
- const GapContract_1 = require("../contract/GapContract");
12
- const AllGapSchemas_1 = require("../AllGapSchemas");
13
13
  const ProjectImpact_1 = require("./ProjectImpact");
14
- const ProjectUpdate_1 = require("./ProjectUpdate");
15
- const ProjectPointer_1 = require("./ProjectPointer");
16
14
  const ProjectMilestone_1 = require("./ProjectMilestone");
15
+ const ProjectPointer_1 = require("./ProjectPointer");
16
+ const ProjectUpdate_1 = require("./ProjectUpdate");
17
17
  class Project extends Attestation_1.Attestation {
18
18
  constructor() {
19
19
  super(...arguments);
@@ -66,8 +66,11 @@ class Project extends Attestation_1.Attestation {
66
66
  const txArray = [tx].flat();
67
67
  return { tx: txArray, uids: [this.uid] };
68
68
  }
69
- isOwner(signer) {
70
- return GapContract_1.GapContract.isProjectOwner(signer, this.uid, this.chainID);
69
+ isOwner(signer, publicAddress) {
70
+ return GapContract_1.GapContract.isProjectOwner(signer, this.uid, this.chainID, publicAddress);
71
+ }
72
+ isAdmin(signer, publicAddress) {
73
+ return GapContract_1.GapContract.isProjectAdmin(signer, this.uid, this.chainID, publicAddress);
71
74
  }
72
75
  /**
73
76
  * Add new members to the project.
@@ -396,5 +399,19 @@ class Project extends Attestation_1.Attestation {
396
399
  const attestation = await project.attest(signer);
397
400
  return attestation;
398
401
  }
402
+ async addAdmin(signer, newAdmin, callback) {
403
+ callback?.("preparing");
404
+ const tx = await GapContract_1.GapContract.addProjectAdmin(signer, this.uid, newAdmin);
405
+ callback?.("confirmed");
406
+ const txArray = [tx].flat();
407
+ return { tx: txArray, uids: [this.uid] };
408
+ }
409
+ async removeAdmin(signer, oldAdmin, callback) {
410
+ callback?.("preparing");
411
+ const tx = await GapContract_1.GapContract.removeProjectAdmin(signer, this.uid, oldAdmin);
412
+ callback?.("confirmed");
413
+ const txArray = [tx].flat();
414
+ return { tx: txArray, uids: [this.uid] };
415
+ }
399
416
  }
400
417
  exports.Project = Project;
@@ -6,3 +6,4 @@ export * from "./MemberOf";
6
6
  export * from "./GrantUpdate";
7
7
  export * from "./ProjectUpdate";
8
8
  export * from "./ProjectPointer";
9
+ export * from "./ContributorProfile";
@@ -22,3 +22,4 @@ __exportStar(require("./MemberOf"), exports);
22
22
  __exportStar(require("./GrantUpdate"), exports);
23
23
  __exportStar(require("./ProjectUpdate"), exports);
24
24
  __exportStar(require("./ProjectPointer"), exports);
25
+ __exportStar(require("./ContributorProfile"), exports);
@@ -143,6 +143,9 @@ export interface IGrantResponse extends IAttestationResponse {
143
143
  community: ICommunityResponse;
144
144
  members: Hex[];
145
145
  categories?: string[];
146
+ externalAddresses?: {
147
+ [key: string]: string;
148
+ };
146
149
  }
147
150
  export interface IMemberDetails extends IAttestationResponse {
148
151
  name: string;
package/core/consts.js CHANGED
@@ -61,6 +61,7 @@ exports.Networks = {
61
61
  Project: "0x5b873b6e7a16207b526dde366e8164e95bcda2f009272306519667c5e94d2191",
62
62
  ProjectUpdateStatus: "0xdc3f4d0938b1d029d825c01b3c53ad955e0ef3eabc1f57c1ebde90de2bf527ae",
63
63
  ProjectMilestoneStatus: "0xdc3f4d0938b1d029d825c01b3c53ad955e0ef3eabc1f57c1ebde90de2bf527ae",
64
+ ContributorProfile: "0x3b4d5890c1613be229b9f0f20e8244e1b46dab4d01fc18373d2570483c552ce4"
64
65
  },
65
66
  oldSchemas: [
66
67
  {
@@ -115,6 +116,7 @@ exports.Networks = {
115
116
  Project: "0xf9bbd118dd100459a7d093403af21c6e7f847fd7f331b7a4e6bfb94a1366bd76",
116
117
  ProjectUpdateStatus: "0x6f8e6a1394bdc398f8d93a99b0ecca326d04470a4f0ee5c379bb85a458a322e4",
117
118
  ProjectMilestoneStatus: "0x6f8e6a1394bdc398f8d93a99b0ecca326d04470a4f0ee5c379bb85a458a322e4",
119
+ ContributorProfile: "0x18f95014ea1249287fa962a42bc5a1d023b42133ee28ec90730939ec082f8daf"
118
120
  },
119
121
  oldSchemas: [
120
122
  {
@@ -169,6 +171,7 @@ exports.Networks = {
169
171
  Project: "0xac2a06e955a7e25e6729efe1a6532237e3435b21ccd3dc827ae3c94e624d25b3",
170
172
  ProjectUpdateStatus: "0x93391c496898c63995f23797835c8e0468be338f0dbc2df62edfd70856cde1d4",
171
173
  ProjectMilestoneStatus: "0x93391c496898c63995f23797835c8e0468be338f0dbc2df62edfd70856cde1d4",
174
+ ContributorProfile: "0xb2c86dba2ae6850162914ba13ccfb7ac51dd0cbdf96cac38ec41386bad3a3720"
172
175
  },
173
176
  oldSchemas: [
174
177
  {
@@ -224,6 +227,7 @@ exports.Networks = {
224
227
  Project: "0xec77990a252b54b17673955c774b9712766de5eecb22ca5aa2c440e0e93257fb",
225
228
  ProjectUpdateStatus: "0xcdef0e492d2e7ad25d0b0fdb868f6dcd1f5e5c30e42fd5fa0debdc12f7618322",
226
229
  ProjectMilestoneStatus: "0xcdef0e492d2e7ad25d0b0fdb868f6dcd1f5e5c30e42fd5fa0debdc12f7618322",
230
+ ContributorProfile: "0x"
227
231
  },
228
232
  },
229
233
  "base-sepolia": {
@@ -251,6 +255,7 @@ exports.Networks = {
251
255
  Project: "0x5ddd6b7a11406771308431ca9bd146cc717848b74b52993a532dc1aad0ccc83f",
252
256
  ProjectUpdateStatus: "0xe9cce07bd9295aafc78faa7afdd88a6fad6fd61834a048fb8c3dbc86cb471f81",
253
257
  ProjectMilestoneStatus: "0xe9cce07bd9295aafc78faa7afdd88a6fad6fd61834a048fb8c3dbc86cb471f81",
258
+ ContributorProfile: "0x18a987f800645fb6ae7fa0398da5cf5a67c866b0628774f16f485b320111416a"
254
259
  },
255
260
  },
256
261
  celo: {
@@ -278,6 +283,7 @@ exports.Networks = {
278
283
  Project: "0xf3f753b41e04d1052b5a5ec7624d1dfdb6c2da288a985120e477ddbcac071022",
279
284
  ProjectUpdateStatus: "0x80f0701853e862d920f87e8ae5b359a1625ad417a9523af2ed12bc3504b04088",
280
285
  ProjectMilestoneStatus: "0x80f0701853e862d920f87e8ae5b359a1625ad417a9523af2ed12bc3504b04088",
286
+ ContributorProfile: "0x349e661a7546b08be1f1f6a738fbde4af2be7549e7817d26f06e0c53c3544108"
281
287
  },
282
288
  oldSchemas: [
283
289
  {
@@ -332,6 +338,7 @@ exports.Networks = {
332
338
  Project: "0xf6b89107f8096220051240b89a48abb66e0a23e529c914953b80f5a2bc5ea44c",
333
339
  ProjectUpdateStatus: "0xc3b9bee0be3a6ea92f76fa459922a088824e29798becdc82d81f6b2309442563",
334
340
  ProjectMilestoneStatus: "0xc3b9bee0be3a6ea92f76fa459922a088824e29798becdc82d81f6b2309442563",
341
+ ContributorProfile: "0x3d26bc89de1e6b5c6d4430758ed2b595d9265a392e735c6f3cd795e8c200d744"
335
342
  },
336
343
  oldSchemas: [
337
344
  {
@@ -386,6 +393,7 @@ exports.Networks = {
386
393
  Project: "0x9de9294fbb62391b393332a33bfc28b4e0e728dd094aee4bda3955df62f8401a5",
387
394
  ProjectUpdateStatus: "0xb25551d21dc886be83a07c241c46de318704cb6f485191fdedcf80f4b8b28188",
388
395
  ProjectMilestoneStatus: "0xb25551d21dc886be83a07c241c46de318704cb6f485191fdedcf80f4b8b28188",
396
+ ContributorProfile: "0x"
389
397
  },
390
398
  },
391
399
  };
@@ -548,6 +556,12 @@ const MountEntities = (network) => ({
548
556
  references: "ProjectMilestone",
549
557
  oldSchemas: network.oldSchemas?.filter(s => s.name === "ProjectMilestoneStatus")?.map(s => ({ uid: s.uid, raw: s.raw }))
550
558
  },
559
+ ContributorProfile: {
560
+ name: "ContributorProfile",
561
+ schema: DetailsSchema,
562
+ uid: network.schemas.ContributorProfile,
563
+ oldSchemas: network.oldSchemas?.filter(s => s.name === "ContributorProfile")?.map(s => ({ uid: s.uid, raw: s.raw }))
564
+ },
551
565
  });
552
566
  exports.MountEntities = MountEntities;
553
567
  exports.alloSupportedNetworks = {
package/core/types.d.ts CHANGED
@@ -27,8 +27,8 @@ export interface AttestArgs<T = unknown> {
27
27
  signer: SignerOrProvider;
28
28
  callback?: (status: CallbackStatus) => void;
29
29
  }
30
- export type TSchemaName = "Community" | "CommunityDetails" | "Grant" | "GrantDetails" | "GrantVerified" | "MemberOf" | "MemberDetails" | "Milestone" | "MilestoneCompleted" | "MilestoneApproved" | "Project" | "ProjectDetails" | "Details" | "ProjectImpact" | "ProjectUpdate" | "ProjectUpdateStatus" | "ProjectPointer" | "GrantUpdate" | "GrantUpdateStatus" | "ProjectEndorsement" | "ProjectMilestone" | "ProjectMilestoneStatus";
31
- export type TResolvedSchemaNames = "Community" | "Grant" | "GrantVerified" | "MemberOf" | "MilestoneCompleted" | "MilestoneApproved" | "Project" | "Details" | "ProjectUpdateStatus" | "GrantUpdateStatus" | "ProjectUpdateStatus" | "ProjectMilestoneStatus";
30
+ export type TSchemaName = "Community" | "CommunityDetails" | "Grant" | "GrantDetails" | "GrantVerified" | "MemberOf" | "MemberDetails" | "Milestone" | "MilestoneCompleted" | "MilestoneApproved" | "Project" | "ProjectDetails" | "Details" | "ProjectImpact" | "ProjectUpdate" | "ProjectUpdateStatus" | "ProjectPointer" | "GrantUpdate" | "GrantUpdateStatus" | "ProjectEndorsement" | "ProjectMilestone" | "ProjectMilestoneStatus" | "ContributorProfile";
31
+ export type TResolvedSchemaNames = "Community" | "Grant" | "GrantVerified" | "MemberOf" | "MilestoneCompleted" | "MilestoneApproved" | "Project" | "Details" | "ProjectUpdateStatus" | "GrantUpdateStatus" | "ProjectUpdateStatus" | "ProjectMilestoneStatus" | "ContributorProfile";
32
32
  export type TExternalLink = "twitter" | "github" | "website" | "linkedin" | "discord";
33
33
  export type TNetwork = "optimism" | "celo" | "optimism-sepolia" | "arbitrum" | "sepolia" | "sei" | "sei-testnet" | "base-sepolia";
34
34
  /**
package/package.json CHANGED
@@ -3,14 +3,14 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.4.0",
6
+ "version": "0.4.5",
7
7
  "description": "Simple and easy interface between EAS and Karma GAP.",
8
8
  "main": "./index.js",
9
9
  "author": "KarmaHQ",
10
10
  "license": "MIT",
11
11
  "private": false,
12
12
  "repository": {
13
- "url": "https://github.com/show-karma/karma-gap-sdk",
13
+ "url": "git+https://github.com/show-karma/karma-gap-sdk.git",
14
14
  "type": "git"
15
15
  },
16
16
  "scripts": {
@@ -1,37 +0,0 @@
1
- import { Attestation, AttestationArgs } from "../Attestation";
2
- import { AttestationWithTx } from "../types/attestations";
3
- import { GapSchema } from "../GapSchema";
4
- import { MultiAttestPayload, SignerOrProvider, TNetwork } from "core/types";
5
- export interface IUserSummary {
6
- aboutMe: string;
7
- github?: string;
8
- twitter?: string;
9
- linkdin?: number;
10
- }
11
- export declare class UserSummary extends Attestation<IUserSummary> implements IUserSummary {
12
- aboutMe: string;
13
- github?: string;
14
- twitter?: string;
15
- linkdin?: number;
16
- constructor(data: AttestationArgs<IUserSummary, GapSchema>);
17
- /**
18
- * Creates the payload for a multi-attestation.
19
- *
20
- * > if Current payload is set, it'll be used as the base payload
21
- * and the project should refer to an index of the current payload,
22
- * usually the community position.
23
- *
24
- * @param payload
25
- * @param refIdx
26
- */
27
- multiAttestPayload(): Promise<MultiAttestPayload>;
28
- /**
29
- * Attest a community with its details.
30
- *
31
- * If the community exists, it will not be revoked but its details will be updated.
32
- * @param signer
33
- * @param details
34
- */
35
- attest(signer: SignerOrProvider, callback?: Function): Promise<AttestationWithTx>;
36
- static from(attestation: UserSummary, network: TNetwork): UserSummary;
37
- }
@@ -1,69 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UserSummary = void 0;
4
- const Attestation_1 = require("../Attestation");
5
- const consts_1 = require("../../consts");
6
- const SchemaError_1 = require("../SchemaError");
7
- const AllGapSchemas_1 = require("../AllGapSchemas");
8
- class UserSummary extends Attestation_1.Attestation {
9
- constructor(data) {
10
- data.data.type = "user-summary";
11
- super(data);
12
- }
13
- /**
14
- * Creates the payload for a multi-attestation.
15
- *
16
- * > if Current payload is set, it'll be used as the base payload
17
- * and the project should refer to an index of the current payload,
18
- * usually the community position.
19
- *
20
- * @param payload
21
- * @param refIdx
22
- */
23
- async multiAttestPayload() {
24
- const payload = [[this, await this.payloadFor(0)]];
25
- return payload;
26
- }
27
- /**
28
- * Attest a community with its details.
29
- *
30
- * If the community exists, it will not be revoked but its details will be updated.
31
- * @param signer
32
- * @param details
33
- */
34
- async attest(signer, callback) {
35
- console.log("Attesting UserSummary");
36
- try {
37
- if (callback)
38
- callback("preparing");
39
- const { tx: UserSummaryTx, uids: UserSummaryUID } = await this.schema.attest({
40
- signer,
41
- to: this.recipient,
42
- refUID: consts_1.nullRef,
43
- data: this.data,
44
- });
45
- this._uid = UserSummaryUID[0];
46
- console.log(this.uid);
47
- if (callback)
48
- callback("pending");
49
- if (callback)
50
- callback("confirmed");
51
- return { tx: UserSummaryTx, uids: UserSummaryUID };
52
- }
53
- catch (error) {
54
- console.error(error);
55
- throw new SchemaError_1.AttestationError("ATTEST_ERROR", "Error during attestation.", error);
56
- }
57
- }
58
- static from(attestation, network) {
59
- return new UserSummary({
60
- ...attestation,
61
- data: {
62
- ...attestation.data,
63
- },
64
- schema: new AllGapSchemas_1.AllGapSchemas().findSchema("UserSummary", consts_1.chainIdToNetwork[attestation.chainID]),
65
- chainID: attestation.chainID,
66
- });
67
- }
68
- }
69
- exports.UserSummary = UserSummary;