@show-karma/karma-gap-sdk 0.4.18 → 0.4.20

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.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const attestationGrantDetails = {
4
+ title: "Grant",
5
+ proposalURL: "https://example.com",
6
+ type: "grant-details",
7
+ receivedDate: 1704844800
8
+ };
9
+ const indexerGrantDetails = {
10
+ id: "attestation-id",
11
+ uid: "0x1111111111111111111111111111111111111111111111111111111111111111",
12
+ schemaUID: "0x2222222222222222222222222222222222222222222222222222222222222222",
13
+ refUID: "0x0000000000000000000000000000000000000000000000000000000000000000",
14
+ attester: "0x3333333333333333333333333333333333333333333333333333333333333333",
15
+ recipient: "0x4444444444444444444444444444444444444444444444444444444444444444",
16
+ revoked: false,
17
+ createdAt: new Date().toISOString(),
18
+ updatedAt: new Date().toISOString(),
19
+ chainID: 10,
20
+ type: "GrantDetails",
21
+ decodedDataJson: "{}",
22
+ isOffchain: false,
23
+ revocable: true,
24
+ schemaId: "0x5555555555555555555555555555555555555555555555555555555555555555",
25
+ data: {
26
+ title: "Grant",
27
+ amount: "1000",
28
+ description: "Description",
29
+ proposalURL: "https://example.com",
30
+ payoutAddress: "0x6666666666666666666666666666666666666666666666666666666666666666",
31
+ questions: [],
32
+ type: "grant-details",
33
+ receivedDate: 1704844800
34
+ }
35
+ };
36
+ const attestationReceivedDate = attestationGrantDetails.receivedDate;
37
+ const indexerReceivedDate = indexerGrantDetails.data.receivedDate;
38
+ void attestationReceivedDate;
39
+ void indexerReceivedDate;
@@ -39,12 +39,12 @@ class AlloBase {
39
39
  async encodeStrategyInitData(applicationStart, applicationEnd, roundStart, roundEnd, payoutToken) {
40
40
  const encoder = new ethers_2.AbiCoder();
41
41
  const initStrategyData = encoder.encode(["bool", "bool", "uint256", "uint256", "uint256", "uint256", "address[]"], [
42
- false,
43
- true,
44
- applicationStart,
45
- applicationEnd,
46
- roundStart,
47
- roundEnd,
42
+ false, // useRegistryAnchor
43
+ true, // metadataRequired
44
+ applicationStart, // Eg. Curr + 1 hour later registrationStartTime
45
+ applicationEnd, // Eg. Curr + 5 days later registrationEndTime
46
+ roundStart, // Eg. Curr + 2 hours later allocationStartTime
47
+ roundEnd, // Eg. Curr + 10 days later allocaitonEndTime
48
48
  [payoutToken],
49
49
  ]);
50
50
  return initStrategyData;
@@ -66,7 +66,7 @@ class AlloBase {
66
66
  const createPoolArgs = {
67
67
  profileId: args.profileId,
68
68
  strategy: args.strategy,
69
- initStrategyData: initStrategyData,
69
+ initStrategyData: initStrategyData, // unique to the strategy
70
70
  token: args.payoutToken,
71
71
  amount: BigInt(args.matchingFundAmt),
72
72
  metadata: metadata,
@@ -28,7 +28,7 @@ const Endpoints = {
28
28
  },
29
29
  project: {
30
30
  all: () => "/projects",
31
- checkSlug: (slug) => `/projects/check-slug/${slug}`,
31
+ checkSlugAvailability: (slug) => `/v2/projects/slug/check/${slug}`,
32
32
  byUidOrSlug: (uidOrSlug) => `/projects/${uidOrSlug}`,
33
33
  grants: (uidOrSlug) => `/projects/${uidOrSlug}/grants`,
34
34
  milestones: (uidOrSlug) => `/projects/${uidOrSlug}/milestones`,
@@ -193,13 +193,8 @@ class GapIndexerApi extends AxiosGQL_1.AxiosGQL {
193
193
  return response;
194
194
  }
195
195
  async slugExists(slug) {
196
- try {
197
- await this.client.get(Endpoints.project.checkSlug(slug));
198
- return true;
199
- }
200
- catch (err) {
201
- return false;
202
- }
196
+ const { data } = await this.client.get(Endpoints.project.checkSlugAvailability(slug));
197
+ return !data.available;
203
198
  }
204
199
  /**
205
200
  * Tracks
@@ -146,7 +146,8 @@ export interface IGrantDetails extends IAttestationResponse {
146
146
  query: string;
147
147
  explanation: string;
148
148
  }[];
149
- startDate: number;
149
+ startDate?: number;
150
+ receivedDate?: number;
150
151
  programId?: string;
151
152
  type: "grant-details";
152
153
  fundUsage?: string;
@@ -48,6 +48,7 @@ export interface IGrantDetails {
48
48
  questions?: IGrantDetailsQuestion[];
49
49
  type?: string;
50
50
  startDate?: number;
51
+ receivedDate?: number;
51
52
  programId?: string;
52
53
  fundUsage?: string;
53
54
  selectedTrackIds?: string[];
@@ -65,6 +66,7 @@ export declare class GrantDetails extends Attestation<IGrantDetails> implements
65
66
  questions?: IGrantDetailsQuestion[];
66
67
  type: string;
67
68
  startDate?: number;
69
+ receivedDate?: number;
68
70
  fundUsage?: string;
69
71
  selectedTrackIds?: string[];
70
72
  }
package/core/consts.js CHANGED
@@ -47,7 +47,7 @@ exports.Networks = {
47
47
  contracts: {
48
48
  eas: "0x4200000000000000000000000000000000000021",
49
49
  schema: "0x4200000000000000000000000000000000000020",
50
- multicall: "0xd2eD366393FDfd243931Fe48e9fb65A192B0018c",
50
+ multicall: "0xd2eD366393FDfd243931Fe48e9fb65A192B0018c", //proxy,
51
51
  projectResolver: "0x7177AdC0f924b695C0294A40C4C5FEFf5EE1E141",
52
52
  communityResolver: "0x6dC1D6b864e8BEf815806f9e4677123496e12026",
53
53
  donations: "0x021896771412C1D3f31BC7B01fFA3a6A17c5dA30",
@@ -157,7 +157,7 @@ exports.Networks = {
157
157
  contracts: {
158
158
  eas: "0xbD75f629A22Dc1ceD33dDA0b68c546A1c035c458",
159
159
  schema: "0xA310da9c5B885E7fb3fbA9D66E9Ba6Df512b78eB",
160
- multicall: "0x6dC1D6b864e8BEf815806f9e4677123496e12026",
160
+ multicall: "0x6dC1D6b864e8BEf815806f9e4677123496e12026", //proxy,
161
161
  projectResolver: "0x28BE0b0515be8BB8822aF1467A6613795E74717b",
162
162
  communityResolver: "0xD534C4704F82494aBbc901560046fB62Ac63E9C4",
163
163
  donations: "0x475F3E915601d975c792E6116791FBe9ACdBE902",
@@ -219,10 +219,10 @@ exports.Networks = {
219
219
  airdropNFT: "0x11f48e68Ff894D417956839263337a2989822703",
220
220
  },
221
221
  schemas: {
222
- Community: "0xf3d790c7fdab6c1b1f25ffcc9289e5be2792eb596d2851a4d059c8aae1bc8b2e",
222
+ Community: "0xf3d790c7fdab6c1b1f25ffcc9289e5be2792eb596d2851a4d059c8aae1bc8b2e", //test with resolver
223
223
  // "0x1954572e3fe21bf4334afdaf1358ed7098af1ed136e76dc93c2fdc25e83934c1", // original without resolver
224
224
  Details: "0x2c270e35bfcdc4d611f0e9d3d2ab6924ec6c673505abc22a1dd07e19b67211af",
225
- Grant: "0x09697aeeb3ae71de1cc19e388fd74264f11af5fba3016094764553ac341fdc72",
225
+ Grant: "0x09697aeeb3ae71de1cc19e388fd74264f11af5fba3016094764553ac341fdc72", // with communityUID/resolver
226
226
  GrantVerified: "0x0be8952e2dd74ffd63a02f4d55b20b603fe7a60130cb9d70de31feb9c52fdd37",
227
227
  MemberOf: "0xdd87b3500457931252424f4439365534ba72a367503a8805ff3482353fb90301",
228
228
  MilestoneApproved: "0xcdef0e492d2e7ad25d0b0fdb868f6dcd1f5e5c30e42fd5fa0debdc12f7618322",
@@ -407,7 +407,7 @@ exports.Networks = {
407
407
  contracts: {
408
408
  eas: "0x4200000000000000000000000000000000000021",
409
409
  schema: "0x4200000000000000000000000000000000000020",
410
- multicall: "0x28BE0b0515be8BB8822aF1467A6613795E74717b",
410
+ multicall: "0x28BE0b0515be8BB8822aF1467A6613795E74717b", //proxy,
411
411
  projectResolver: "0x6dC1D6b864e8BEf815806f9e4677123496e12026",
412
412
  communityResolver: "0xfddb660F2F1C27d219372210745BB9f73431856E",
413
413
  donations: "0x28BE0b0515be8BB8822aF1467A6613795E74717b",
@@ -435,7 +435,7 @@ exports.Networks = {
435
435
  contracts: {
436
436
  eas: "0xC47300428b6AD2c7D03BB76D05A176058b47E6B0",
437
437
  schema: "0xD2CDF46556543316e7D34e8eDc4624e2bB95e3B6",
438
- multicall: "0x8791Ac8c099314bB1D1514D76de13a1E80275950",
438
+ multicall: "0x8791Ac8c099314bB1D1514D76de13a1E80275950", //proxy,
439
439
  projectResolver: "0xAFaE7aA6118D75Fe7FDB3eF8c1623cAaF8C8a653",
440
440
  communityResolver: "0xfddb660F2F1C27d219372210745BB9f73431856E",
441
441
  donations: "0x8791Ac8c099314bB1D1514D76de13a1E80275950",
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Gelato = exports.sendGelatoTxn = void 0;
6
+ exports.Gelato = void 0;
7
+ exports.sendGelatoTxn = sendGelatoTxn;
7
8
  const axios_1 = __importDefault(require("axios"));
8
9
  const relay_sdk_1 = require("@gelatonetwork/relay-sdk");
9
10
  const watch_gelato_txn_1 = require("./watch-gelato-txn");
@@ -56,7 +57,6 @@ async function sendGelatoTxn(...params) {
56
57
  const { wait } = await sendByApiKey(...params);
57
58
  return wait();
58
59
  }
59
- exports.sendGelatoTxn = sendGelatoTxn;
60
60
  /**
61
61
  * Builds the arguments for a sponsored call using GelatoRelay
62
62
  * @param data Populated contract call.
@@ -86,7 +86,7 @@ data, chainId, target) {
86
86
  chainId,
87
87
  target,
88
88
  },
89
- '{apiKey}',
89
+ '{apiKey}', // filled in the api
90
90
  {
91
91
  retries: 3,
92
92
  },
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.handler = void 0;
3
+ exports.handler = handler;
4
4
  const send_gelato_txn_1 = require("./send-gelato-txn");
5
5
  const assertionObj = [
6
6
  {
@@ -57,4 +57,3 @@ async function handler(req, res, env_gelatoApiKey) {
57
57
  res.send(error.message);
58
58
  }
59
59
  }
60
- exports.handler = handler;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.watchGelatoTxn = void 0;
3
+ exports.watchGelatoTxn = watchGelatoTxn;
4
4
  const relay_sdk_1 = require("@gelatonetwork/relay-sdk");
5
5
  var TaskState;
6
6
  (function (TaskState) {
@@ -60,4 +60,3 @@ async function watchGelatoTxn(taskId, ttl = 500) {
60
60
  loop();
61
61
  });
62
62
  }
63
- exports.watchGelatoTxn = watchGelatoTxn;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDate = void 0;
3
+ exports.getDate = getDate;
4
4
  function getDate(date) {
5
5
  return typeof date === "number" ? new Date(date * 1000) : date;
6
6
  }
7
- exports.getDate = getDate;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getIPFSData = void 0;
6
+ exports.getIPFSData = getIPFSData;
7
7
  const axios_1 = __importDefault(require("axios"));
8
8
  async function getIPFSData(cid) {
9
9
  try {
@@ -17,4 +17,3 @@ async function getIPFSData(cid) {
17
17
  throw new Error(`Error to retrive data for CID: ${cid}`);
18
18
  }
19
19
  }
20
- exports.getIPFSData = getIPFSData;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mapFilter = void 0;
3
+ exports.mapFilter = mapFilter;
4
4
  /**
5
5
  * Filters an array by its condition then maps it to the desired format.
6
6
  * @param arr
@@ -17,4 +17,3 @@ function mapFilter(arr, condition, mapTo) {
17
17
  }
18
18
  return newArray;
19
19
  }
20
- exports.mapFilter = mapFilter;
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.serializeWithBigint = void 0;
3
+ exports.serializeWithBigint = serializeWithBigint;
4
4
  function serializeWithBigint(value) {
5
5
  return JSON.stringify(value, (this,
6
6
  (key, value) => (typeof value === "bigint" ? value.toString() : value)));
7
7
  }
8
- exports.serializeWithBigint = serializeWithBigint;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toUnix = void 0;
3
+ exports.toUnix = toUnix;
4
4
  function toUnix(value) {
5
5
  switch (typeof value) {
6
6
  case "number":
@@ -22,4 +22,3 @@ function toUnix(value) {
22
22
  return null;
23
23
  }
24
24
  }
25
- exports.toUnix = toUnix;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.4.18",
6
+ "version": "0.4.20",
7
7
  "description": "Simple and easy interface between EAS and Karma GAP.",
8
8
  "main": "./index.js",
9
9
  "author": "KarmaHQ",
@@ -14,6 +14,8 @@
14
14
  "type": "git"
15
15
  },
16
16
  "scripts": {
17
+ "build": "tsc -p tsconfig.json",
18
+ "test": "npx tsc -p tsconfig.json --noEmit",
17
19
  "deploy": "npx ts-node ./core/scripts/deploy.ts",
18
20
  "csv-upload": "npx ts-node ./csv-upload/scripts/run.ts",
19
21
  "test-file": "npx ts-node ./test-file-indexer-api.ts",