@show-karma/karma-gap-sdk 0.3.14 → 0.3.15

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.
@@ -118,14 +118,14 @@ export declare abstract class Schema<T extends string = string> implements Schem
118
118
  * @param signer
119
119
  * @returns
120
120
  */
121
- revokeOffchain(uid: Hex, signer: SignerOrProvider): Promise<import("@ethereum-attestation-service/eas-sdk").Transaction<bigint>>;
121
+ revokeOffchain(uid: Hex, signer: SignerOrProvider): Promise<import("@ethereum-attestation-service/eas-sdk/dist/transaction").Transaction<bigint>>;
122
122
  /**
123
123
  * Revokes multiple off chain attestations by their UIDs.
124
124
  * @param uids
125
125
  * @param signer
126
126
  * @returns
127
127
  */
128
- multiRevokeOffchain(uids: Hex[], signer: SignerOrProvider): Promise<import("@ethereum-attestation-service/eas-sdk").Transaction<bigint[]>>;
128
+ multiRevokeOffchain(uids: Hex[], signer: SignerOrProvider): Promise<import("@ethereum-attestation-service/eas-sdk/dist/transaction").Transaction<bigint[]>>;
129
129
  /**
130
130
  * Validates and attests a given schema.
131
131
  *
@@ -1,5 +1,5 @@
1
1
  import { Attestation } from '../Attestation';
2
- import { Grantee, MemberDetails, ProjectDetails } from '../types/attestations';
2
+ import { Grantee, MemberDetails, ProjectDetails, ProjectImpact } from '../types/attestations';
3
3
  import { Hex, MultiAttestPayload, SignerOrProvider, TNetwork } from 'core/types';
4
4
  import { Grant } from './Grant';
5
5
  import { MemberOf } from './MemberOf';
@@ -13,6 +13,7 @@ export declare class Project extends Attestation<IProject> {
13
13
  members: MemberOf[];
14
14
  grants: Grant[];
15
15
  grantee: Grantee;
16
+ impacts: ProjectImpact[];
16
17
  /**
17
18
  * Creates the payload for a multi-attestation.
18
19
  *
@@ -71,5 +72,6 @@ export declare class Project extends Attestation<IProject> {
71
72
  */
72
73
  removeAllMembers(signer: SignerOrProvider): Promise<void>;
73
74
  static from(attestations: _Project[], network: TNetwork): Project[];
75
+ attestImpact(signer: SignerOrProvider, data: ProjectImpact): Promise<void>;
74
76
  }
75
77
  export {};
@@ -15,6 +15,7 @@ class Project extends Attestation_1.Attestation {
15
15
  super(...arguments);
16
16
  this.members = [];
17
17
  this.grants = [];
18
+ this.impacts = [];
18
19
  }
19
20
  /**
20
21
  * Creates the payload for a multi-attestation.
@@ -242,8 +243,34 @@ class Project extends Attestation_1.Attestation {
242
243
  if (attestation.grants) {
243
244
  project.grants = Grant_1.Grant.from(attestation.grants, network);
244
245
  }
246
+ if (attestation.impacts) {
247
+ project.impacts = attestation.impacts.map((pi) => {
248
+ const impact = new attestations_1.ProjectImpact({
249
+ ...pi,
250
+ data: {
251
+ ...pi.data,
252
+ },
253
+ schema: new AllGapSchemas_1.AllGapSchemas().findSchema('ProjectDetails', consts_1.chainIdToNetwork[attestation.chainID]),
254
+ chainID: attestation.chainID,
255
+ });
256
+ return impact;
257
+ });
258
+ }
245
259
  return project;
246
260
  });
247
261
  }
262
+ async attestImpact(signer, data) {
263
+ const projectImpact = new attestations_1.ProjectImpact({
264
+ data: {
265
+ ...data,
266
+ type: 'project-impact',
267
+ },
268
+ recipient: this.recipient,
269
+ refUID: this.uid,
270
+ schema: this.schema.gap.findSchema('ProjectDetails'),
271
+ });
272
+ await projectImpact.attest(signer);
273
+ this.impacts.push(projectImpact);
274
+ }
248
275
  }
249
276
  exports.Project = Project;
@@ -1,6 +1,7 @@
1
- import { Attestation } from '../Attestation';
1
+ import { Attestation, AttestationArgs } from '../Attestation';
2
2
  import { Hex } from 'core/types';
3
3
  import { Project } from '../entities/Project';
4
+ import { GapSchema } from '../GapSchema';
4
5
  /** Attestation interfaces */
5
6
  export type ExternalLink = {
6
7
  type: string;
@@ -121,3 +122,16 @@ export interface IGrantDetailsQuestion {
121
122
  explanation: string;
122
123
  type: string;
123
124
  }
125
+ export interface IProjectImpact {
126
+ work: string;
127
+ impact: string;
128
+ proof: string;
129
+ type?: string;
130
+ }
131
+ export declare class ProjectImpact extends Attestation<IProjectImpact> implements IProjectImpact {
132
+ work: string;
133
+ impact: string;
134
+ proof: string;
135
+ type?: string;
136
+ constructor(data: AttestationArgs<IProjectImpact, GapSchema>);
137
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GrantCompleted = exports.GrantUpdate = exports.Grantee = exports.ProjectDetails = exports.Tag = exports.MilestoneCompleted = exports.MemberDetails = exports.GrantVerified = exports.GrantRound = exports.GrantDetails = exports.CommunityDetails = void 0;
3
+ exports.ProjectImpact = exports.GrantCompleted = exports.GrantUpdate = exports.Grantee = exports.ProjectDetails = exports.Tag = exports.MilestoneCompleted = exports.MemberDetails = exports.GrantVerified = exports.GrantRound = exports.GrantDetails = exports.CommunityDetails = void 0;
4
4
  const Attestation_1 = require("../Attestation");
5
5
  class CommunityDetails extends Attestation_1.Attestation {
6
6
  constructor() {
@@ -55,3 +55,10 @@ exports.GrantUpdate = GrantUpdate;
55
55
  class GrantCompleted extends GrantUpdate {
56
56
  }
57
57
  exports.GrantCompleted = GrantCompleted;
58
+ class ProjectImpact extends Attestation_1.Attestation {
59
+ constructor(data) {
60
+ data.data.type = 'project-impact';
61
+ super(data);
62
+ }
63
+ }
64
+ exports.ProjectImpact = ProjectImpact;
package/core/consts.js CHANGED
@@ -208,5 +208,11 @@ const MountEntities = (network) => ({
208
208
  name: " schema",
209
209
  uid: network.schemas.Details,
210
210
  },
211
+ ProjectImpact: {
212
+ name: "ProjectImpact",
213
+ schema: DetailsSchema,
214
+ uid: network.schemas.Details,
215
+ references: "Project",
216
+ },
211
217
  });
212
218
  exports.MountEntities = MountEntities;
package/core/types.d.ts CHANGED
@@ -21,7 +21,7 @@ export interface AttestArgs<T = unknown> {
21
21
  refUID?: Hex;
22
22
  signer: SignerOrProvider;
23
23
  }
24
- export type TSchemaName = 'Community' | 'CommunityDetails' | 'Grant' | 'GrantDetails' | 'GrantVerified' | 'MemberOf' | 'MemberDetails' | 'Milestone' | 'MilestoneCompleted' | 'MilestoneApproved' | 'Project' | 'ProjectDetails' | 'Details';
24
+ export type TSchemaName = 'Community' | 'CommunityDetails' | 'Grant' | 'GrantDetails' | 'GrantVerified' | 'MemberOf' | 'MemberDetails' | 'Milestone' | 'MilestoneCompleted' | 'MilestoneApproved' | 'Project' | 'ProjectDetails' | 'Details' | 'ProjectImpact';
25
25
  export type TResolvedSchemaNames = 'Community' | 'Grant' | 'GrantVerified' | 'MemberOf' | 'MilestoneCompleted' | 'MilestoneApproved' | 'Project' | 'Details';
26
26
  export type TExternalLink = 'twitter' | 'github' | 'website' | 'linkedin' | 'discord';
27
27
  export type TNetwork = 'optimism' | 'optimism-sepolia' | "arbitrum" | 'sepolia';
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.3.14",
6
+ "version": "0.3.15",
7
7
  "description": "Simple and easy interface between EAS and Karma GAP.",
8
8
  "main": "./index.js",
9
9
  "author": "KarmaHQ",
@@ -19,7 +19,7 @@
19
19
  "publish-npm": "npm version patch && tsc && cd .dist && npm publish --scope=@show-karma/karma-gap-sdk --access public"
20
20
  },
21
21
  "dependencies": {
22
- "@ethereum-attestation-service/eas-sdk": "^1.4.2",
22
+ "@ethereum-attestation-service/eas-sdk": "1.4.2",
23
23
  "@gelatonetwork/relay-sdk": "^5.2.0",
24
24
  "@types/sha256": "^0.2.0",
25
25
  "axios": "^1.4.0",