@show-karma/karma-gap-sdk 0.3.13 → 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.
@@ -17,7 +17,7 @@ export declare class GapContract {
17
17
  * @returns
18
18
  */
19
19
  private static getRSV;
20
- static getSignerAddress(signer: SignerOrProvider): Promise<string>;
20
+ static getSignerAddress(signer: SignerOrProvider): Promise<any>;
21
21
  /**
22
22
  * Get nonce for the transaction
23
23
  * @param address
@@ -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
@@ -1,14 +1,9 @@
1
1
  import { BytesLike } from 'ethers';
2
2
  import { AttestationRequestData, EAS, MultiAttestationRequest, SchemaItem } from '@ethereum-attestation-service/eas-sdk';
3
- import { SignerOrProvider as EASSigner } from '@ethereum-attestation-service/eas-sdk/dist/transaction';
4
3
  import { Attestation } from './class';
5
4
  import { Fetcher } from './class/Fetcher';
6
5
  export type Hex = `0x${string}`;
7
- export type SignerOrProvider = EASSigner & {
8
- address?: Hex;
9
- _address?: Hex;
10
- getAddress?: () => Promise<Hex>;
11
- };
6
+ export type SignerOrProvider = any;
12
7
  export interface SchemaInterface<T extends string = string> {
13
8
  name: string;
14
9
  schema: SchemaItem[];
@@ -26,7 +21,7 @@ export interface AttestArgs<T = unknown> {
26
21
  refUID?: Hex;
27
22
  signer: SignerOrProvider;
28
23
  }
29
- 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';
30
25
  export type TResolvedSchemaNames = 'Community' | 'Grant' | 'GrantVerified' | 'MemberOf' | 'MilestoneCompleted' | 'MilestoneApproved' | 'Project' | 'Details';
31
26
  export type TExternalLink = 'twitter' | 'github' | 'website' | 'linkedin' | 'discord';
32
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.13",
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",