@show-karma/karma-gap-sdk 0.3.32 → 0.3.33

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,12 +1,12 @@
1
1
  import { ethers } from "ethers";
2
- import { NFTStorage } from "nft.storage";
2
+ import pinataSDK from "@pinata/sdk";
3
3
  export declare class AlloBase {
4
4
  private signer;
5
5
  private contract;
6
6
  private static ipfsClient;
7
7
  private allo;
8
- constructor(signer: ethers.Signer, ipfsStorage: NFTStorage, chainId: number);
9
- saveAndGetCID(data: any): Promise<import("nft.storage").CIDString>;
8
+ constructor(signer: ethers.Signer, ipfsStorage: pinataSDK, chainId: number);
9
+ saveAndGetCID(data: any): Promise<string>;
10
10
  encodeStrategyInitData(applicationStart: number, applicationEnd: number, roundStart: number, roundEnd: number, payoutToken: string): Promise<string>;
11
11
  createGrant(args: any): Promise<{
12
12
  poolId: string;
@@ -18,11 +18,8 @@ class AlloBase {
18
18
  }
19
19
  async saveAndGetCID(data) {
20
20
  try {
21
- const blob = new Blob([JSON.stringify(data)], {
22
- type: "application/json",
23
- });
24
- const cid = await AlloBase.ipfsClient.storeBlob(blob);
25
- return cid;
21
+ const res = await AlloBase.ipfsClient.pinJSONToIPFS(data);
22
+ return res.IpfsHash;
26
23
  }
27
24
  catch (error) {
28
25
  throw new Error(`Error adding data to IPFS: ${error}`);
@@ -31,12 +28,12 @@ class AlloBase {
31
28
  async encodeStrategyInitData(applicationStart, applicationEnd, roundStart, roundEnd, payoutToken) {
32
29
  const encoder = new ethers_2.AbiCoder();
33
30
  const initStrategyData = encoder.encode(["bool", "bool", "uint256", "uint256", "uint256", "uint256", "address[]"], [
34
- false, // useRegistryAnchor
35
- true, // metadataRequired
36
- applicationStart, // Eg. Curr + 1 hour later registrationStartTime
37
- applicationEnd, // Eg. Curr + 5 days later registrationEndTime
38
- roundStart, // Eg. Curr + 2 hours later allocationStartTime
39
- roundEnd, // Eg. Curr + 10 days later allocaitonEndTime
31
+ false,
32
+ true,
33
+ applicationStart,
34
+ applicationEnd,
35
+ roundStart,
36
+ roundEnd,
40
37
  [payoutToken],
41
38
  ]);
42
39
  return initStrategyData;
@@ -58,7 +55,7 @@ class AlloBase {
58
55
  const createPoolArgs = {
59
56
  profileId: args.profileId,
60
57
  strategy: args.strategy,
61
- initStrategyData: initStrategyData, // unique to the strategy
58
+ initStrategyData: initStrategyData,
62
59
  token: args.payoutToken,
63
60
  amount: BigInt(args.matchingFundAmt),
64
61
  metadata: metadata,
@@ -1,11 +1,11 @@
1
1
  import { ethers } from "ethers";
2
2
  import { ProfileMetadata } from "../types/allo";
3
- import { NFTStorage } from "nft.storage";
3
+ import pinataSDK from "@pinata/sdk";
4
4
  export declare class AlloRegistry {
5
5
  private contract;
6
6
  private static ipfsClient;
7
- constructor(signer: ethers.Signer, ipfsStorage: NFTStorage);
8
- saveAndGetCID(data: any): Promise<import("nft.storage").CIDString>;
7
+ constructor(signer: ethers.Signer, ipfsStorage: pinataSDK);
8
+ saveAndGetCID(data: any): Promise<string>;
9
9
  createProgram(nonce: number, name: string, profileMetadata: ProfileMetadata, owner: string, members: string[]): Promise<{
10
10
  profileId: any;
11
11
  txHash: any;
@@ -14,11 +14,8 @@ class AlloRegistry {
14
14
  }
15
15
  async saveAndGetCID(data) {
16
16
  try {
17
- const blob = new Blob([JSON.stringify(data)], {
18
- type: "application/json",
19
- });
20
- const cid = await AlloRegistry.ipfsClient.storeBlob(blob);
21
- return cid;
17
+ const res = await AlloRegistry.ipfsClient.pinJSONToIPFS(data);
18
+ return res.IpfsHash;
22
19
  }
23
20
  catch (error) {
24
21
  throw new Error(`Error adding data to IPFS: ${error}`);
@@ -6,6 +6,6 @@ export interface IMemberOf {
6
6
  }
7
7
  export declare class MemberOf extends Attestation<IMemberOf> {
8
8
  details?: MemberDetails;
9
- multiAttestPayload(currentPayload?: MultiAttestPayload, projectIdx?: number): Promise<[Attestation<unknown, import("core").GapSchema>, import("core/types").RawMultiAttestPayload][]>;
9
+ multiAttestPayload(currentPayload?: MultiAttestPayload, projectIdx?: number): Promise<[Attestation<unknown, import("..").GapSchema>, import("core/types").RawMultiAttestPayload][]>;
10
10
  attest(signer: SignerOrProvider, callback?: Function): Promise<void>;
11
11
  }
@@ -108,6 +108,10 @@ export interface IProjectDetails extends IAttestationResponse {
108
108
  tags?: ITag[];
109
109
  slug?: string;
110
110
  type: "project-details";
111
+ businessModel?: string;
112
+ stageIn?: string;
113
+ raisedMoney?: string;
114
+ pathToTake?: string;
111
115
  };
112
116
  }
113
117
  export interface IProjectImpact extends IAttestationResponse {
@@ -1,18 +1,16 @@
1
- /// <reference types="node" />
2
- import { NFTStorage } from 'nft.storage';
3
- import { RemoteStorage } from './RemoteStorage';
4
- import { TRemoteStorageOutput } from 'core/types';
1
+ import pinataSDK from "@pinata/sdk";
2
+ import { RemoteStorage } from "./RemoteStorage";
3
+ import { TRemoteStorageOutput } from "core/types";
5
4
  export interface IpfsStorageOptions {
6
5
  token: string;
7
- endpoint?: URL;
8
6
  }
9
- export declare class IpfsStorage extends RemoteStorage<NFTStorage> {
7
+ export declare class IpfsStorage extends RemoteStorage<pinataSDK> {
10
8
  constructor(opts: IpfsStorageOptions,
11
9
  /**
12
10
  * If set, will send request to another server instead of
13
11
  * using the local instance
14
12
  */
15
- sponsor?: RemoteStorage['sponsor']);
13
+ sponsor?: RemoteStorage["sponsor"]);
16
14
  private assert;
17
15
  save<T = unknown>(data: T): Promise<string>;
18
16
  encode(data: string): TRemoteStorageOutput<string>;
@@ -1,7 +1,10 @@
1
1
  "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  exports.IpfsStorage = void 0;
4
- const nft_storage_1 = require("nft.storage");
7
+ const sdk_1 = __importDefault(require("@pinata/sdk"));
5
8
  const RemoteStorage_1 = require("./RemoteStorage");
6
9
  const SchemaError_1 = require("../SchemaError");
7
10
  const utils_1 = require("../../utils");
@@ -14,19 +17,16 @@ class IpfsStorage extends RemoteStorage_1.RemoteStorage {
14
17
  sponsor) {
15
18
  super(0 /* STORAGE_TYPE.IPFS */, sponsor);
16
19
  this.assert(opts);
17
- this.client = new nft_storage_1.NFTStorage({ ...opts });
20
+ this.client = new sdk_1.default({ pinataJWTKey: opts.token });
18
21
  }
19
22
  assert(opts) { }
20
23
  async save(data) {
21
24
  try {
22
- const blob = new Blob([JSON.stringify(data)], {
23
- type: 'application/json',
24
- });
25
- const cid = await this.client.storeBlob(blob);
26
- return cid;
25
+ const res = await this.client.pinJSONToIPFS(data);
26
+ return res.IpfsHash;
27
27
  }
28
28
  catch (error) {
29
- throw new SchemaError_1.RemoteStorageError('REMOTE_STORAGE_UPLOAD', `Error adding data to IPFS`);
29
+ throw new SchemaError_1.RemoteStorageError("REMOTE_STORAGE_UPLOAD", `Error adding data to IPFS`);
30
30
  }
31
31
  }
32
32
  encode(data) {
@@ -95,6 +95,10 @@ export interface IProjectDetails {
95
95
  externalIds?: string[];
96
96
  slug?: string;
97
97
  type?: string;
98
+ businessModel?: string;
99
+ stageIn?: string;
100
+ raisedMoney?: string;
101
+ pathToTake?: string;
98
102
  }
99
103
  export declare class ProjectDetails extends Attestation<IProjectDetails> implements IProjectDetails {
100
104
  title: string;
@@ -105,6 +109,10 @@ export declare class ProjectDetails extends Attestation<IProjectDetails> impleme
105
109
  slug: string;
106
110
  type: string;
107
111
  externalIds: string[];
112
+ businessModel?: string;
113
+ stageIn?: string;
114
+ raisedMoney?: string;
115
+ pathToTake?: string;
108
116
  }
109
117
  export declare class Grantee {
110
118
  address: string;
package/core/consts.js CHANGED
@@ -36,7 +36,7 @@ exports.Networks = {
36
36
  contracts: {
37
37
  eas: "0x4200000000000000000000000000000000000021",
38
38
  schema: "0x4200000000000000000000000000000000000020",
39
- multicall: "0xd2eD366393FDfd243931Fe48e9fb65A192B0018c", //proxy,
39
+ multicall: "0xd2eD366393FDfd243931Fe48e9fb65A192B0018c",
40
40
  projectResolver: "0x7177AdC0f924b695C0294A40C4C5FEFf5EE1E141",
41
41
  communityResolver: "0x6dC1D6b864e8BEf815806f9e4677123496e12026",
42
42
  donations: "0x021896771412C1D3f31BC7B01fFA3a6A17c5dA30",
@@ -84,7 +84,7 @@ exports.Networks = {
84
84
  contracts: {
85
85
  eas: "0xbD75f629A22Dc1ceD33dDA0b68c546A1c035c458",
86
86
  schema: "0xA310da9c5B885E7fb3fbA9D66E9Ba6Df512b78eB",
87
- multicall: "0x6dC1D6b864e8BEf815806f9e4677123496e12026", //proxy,
87
+ multicall: "0x6dC1D6b864e8BEf815806f9e4677123496e12026",
88
88
  projectResolver: "0x28BE0b0515be8BB8822aF1467A6613795E74717b",
89
89
  communityResolver: "0xD534C4704F82494aBbc901560046fB62Ac63E9C4",
90
90
  donations: "0x475F3E915601d975c792E6116791FBe9ACdBE902",
@@ -114,10 +114,10 @@ exports.Networks = {
114
114
  donations: "0xb2021F7550b8B07cA71696159B592C1F713593e4",
115
115
  },
116
116
  schemas: {
117
- Community: "0xf3d790c7fdab6c1b1f25ffcc9289e5be2792eb596d2851a4d059c8aae1bc8b2e", //test with resolver
117
+ Community: "0xf3d790c7fdab6c1b1f25ffcc9289e5be2792eb596d2851a4d059c8aae1bc8b2e",
118
118
  // "0x1954572e3fe21bf4334afdaf1358ed7098af1ed136e76dc93c2fdc25e83934c1", // original without resolver
119
119
  Details: "0x2c270e35bfcdc4d611f0e9d3d2ab6924ec6c673505abc22a1dd07e19b67211af",
120
- Grant: "0x09697aeeb3ae71de1cc19e388fd74264f11af5fba3016094764553ac341fdc72", // with communityUID/resolver
120
+ Grant: "0x09697aeeb3ae71de1cc19e388fd74264f11af5fba3016094764553ac341fdc72",
121
121
  GrantVerified: "0x0be8952e2dd74ffd63a02f4d55b20b603fe7a60130cb9d70de31feb9c52fdd37",
122
122
  MemberOf: "0xdd87b3500457931252424f4439365534ba72a367503a8805ff3482353fb90301",
123
123
  MilestoneApproved: "0xcdef0e492d2e7ad25d0b0fdb868f6dcd1f5e5c30e42fd5fa0debdc12f7618322",
@@ -86,7 +86,7 @@ data, chainId, target) {
86
86
  chainId,
87
87
  target,
88
88
  },
89
- '{apiKey}', // filled in the api
89
+ '{apiKey}',
90
90
  {
91
91
  retries: 3,
92
92
  },
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.3.32",
6
+ "version": "0.3.33",
7
7
  "description": "Simple and easy interface between EAS and Karma GAP.",
8
8
  "main": "./index.js",
9
9
  "author": "KarmaHQ",
@@ -22,10 +22,10 @@
22
22
  "@allo-team/allo-v2-sdk": "^1.0.63",
23
23
  "@ethereum-attestation-service/eas-sdk": "1.4.2",
24
24
  "@gelatonetwork/relay-sdk": "^5.2.0",
25
+ "@pinata/sdk": "^2.1.0",
25
26
  "@types/sha256": "^0.2.0",
26
27
  "axios": "^1.4.0",
27
28
  "ethers": "6.11.0",
28
- "nft.storage": "^7.1.1",
29
29
  "sha256": "^0.2.0",
30
30
  "simple-ts-job-runner": "^1.0.12"
31
31
  },