@show-karma/karma-gap-sdk 0.3.39 → 0.3.41

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,117 @@
1
+ [
2
+ {
3
+ "inputs": [
4
+ {
5
+ "internalType": "bytes32",
6
+ "name": "_profileId",
7
+ "type": "bytes32"
8
+ },
9
+ {
10
+ "internalType": "address",
11
+ "name": "_strategy",
12
+ "type": "address"
13
+ },
14
+ {
15
+ "internalType": "bytes",
16
+ "name": "_initStrategyData",
17
+ "type": "bytes"
18
+ },
19
+ {
20
+ "internalType": "address",
21
+ "name": "_token",
22
+ "type": "address"
23
+ },
24
+ {
25
+ "internalType": "uint256",
26
+ "name": "_amount",
27
+ "type": "uint256"
28
+ },
29
+ {
30
+ "components": [
31
+ {
32
+ "internalType": "uint256",
33
+ "name": "protocol",
34
+ "type": "uint256"
35
+ },
36
+ {
37
+ "internalType": "string",
38
+ "name": "pointer",
39
+ "type": "string"
40
+ }
41
+ ],
42
+ "internalType": "struct IAllo.Metadata",
43
+ "name": "_metadata",
44
+ "type": "tuple"
45
+ },
46
+ {
47
+ "internalType": "address[]",
48
+ "name": "_managers",
49
+ "type": "address[]"
50
+ }
51
+ ],
52
+ "name": "createPool",
53
+ "outputs": [
54
+ {
55
+ "internalType": "uint256",
56
+ "name": "poolId",
57
+ "type": "uint256"
58
+ }
59
+ ],
60
+ "stateMutability": "payable",
61
+ "type": "function"
62
+ },
63
+ {
64
+ "inputs": [
65
+ {
66
+ "internalType": "uint256",
67
+ "name": "_poolId",
68
+ "type": "uint256"
69
+ },
70
+ {
71
+ "components": [
72
+ {
73
+ "internalType": "uint256",
74
+ "name": "protocol",
75
+ "type": "uint256"
76
+ },
77
+ {
78
+ "internalType": "string",
79
+ "name": "pointer",
80
+ "type": "string"
81
+ }
82
+ ],
83
+ "internalType": "struct IAllo.Metadata",
84
+ "name": "_metadata",
85
+ "type": "tuple"
86
+ }
87
+ ],
88
+ "name": "updatePoolMetadata",
89
+ "outputs": [],
90
+ "stateMutability": "nonpayable",
91
+ "type": "function"
92
+ },
93
+ {
94
+ "inputs": [
95
+ {
96
+ "internalType": "address",
97
+ "name": "_alloAddress",
98
+ "type": "address"
99
+ }
100
+ ],
101
+ "stateMutability": "nonpayable",
102
+ "type": "constructor"
103
+ },
104
+ {
105
+ "inputs": [],
106
+ "name": "allo",
107
+ "outputs": [
108
+ {
109
+ "internalType": "contract IAllo",
110
+ "name": "",
111
+ "type": "address"
112
+ }
113
+ ],
114
+ "stateMutability": "view",
115
+ "type": "function"
116
+ }
117
+ ]
@@ -4,7 +4,6 @@ exports.Attestation = void 0;
4
4
  const Schema_1 = require("./Schema");
5
5
  const SchemaError_1 = require("./SchemaError");
6
6
  const get_date_1 = require("../utils/get-date");
7
- const GAP_1 = require("./GAP");
8
7
  const consts_1 = require("../consts");
9
8
  const GapContract_1 = require("./contract/GapContract");
10
9
  /**
@@ -196,16 +195,10 @@ class Attestation {
196
195
  async payloadFor(refIdx) {
197
196
  this.assertPayload();
198
197
  if (this.schema.isJsonSchema()) {
199
- const { remoteClient } = GAP_1.GAP;
200
198
  if (this.type) {
201
199
  this._data.type = this.type;
202
200
  this.schema.setValue("json", JSON.stringify(this._data));
203
201
  }
204
- if (remoteClient && JSON.stringify(this._data)?.length > 1500) {
205
- const cid = await remoteClient.save(this._data, this.schema.name);
206
- const encodedData = remoteClient.encode(cid);
207
- this.schema.setValue("json", JSON.stringify(encodedData));
208
- }
209
202
  }
210
203
  const payload = (encode = true) => ({
211
204
  uid: consts_1.nullRef,
@@ -1,8 +1,8 @@
1
- import { AttestArgs, Facade, SchemaInterface, TNetwork, TSchemaName, SignerOrProvider } from '../types';
2
- import { GapSchema } from './GapSchema';
3
- import { ethers } from 'ethers';
4
- import { Fetcher } from './Fetcher';
5
- import { RemoteStorage } from './remote-storage/RemoteStorage';
1
+ import { AttestArgs, Facade, SchemaInterface, TNetwork, TSchemaName, SignerOrProvider } from "../types";
2
+ import { GapSchema } from "./GapSchema";
3
+ import { ethers } from "ethers";
4
+ import { Fetcher } from "./Fetcher";
5
+ import { RemoteStorage } from "./remote-storage/RemoteStorage";
6
6
  interface GAPArgs {
7
7
  network: TNetwork;
8
8
  globalSchemas?: boolean;
@@ -229,7 +229,7 @@ export declare class GAP extends Facade {
229
229
  * In case of true, the transactions will be sent through [Gelato](https://gelato.network)
230
230
  * and an API key is needed.
231
231
  */
232
- static get gelatoOpts(): GAPArgs['gelatoOpts'];
232
+ static get gelatoOpts(): GAPArgs["gelatoOpts"];
233
233
  static set useGasLess(useGasLess: boolean);
234
234
  static get remoteClient(): RemoteStorage<unknown>;
235
235
  }
package/core/class/GAP.js CHANGED
@@ -81,16 +81,15 @@ class GAP extends types_1.Facade {
81
81
  this.generateSlug = async (text) => {
82
82
  let slug = text
83
83
  .toLowerCase()
84
- .replace(/ /g, '-')
85
- .replace(/[^\w-]+/g, '');
84
+ .replace(/ /g, "-")
85
+ .replace(/[^\w-]+/g, "");
86
86
  const slugExists = await this.fetch.slugExists(slug);
87
87
  if (slugExists) {
88
- const parts = slug.split('-');
88
+ const parts = slug.split("-");
89
89
  const counter = parts.pop();
90
- slug = /\d+/g.test(counter) ? parts.join('-') : slug;
90
+ slug = /\d+/g.test(counter) ? parts.join("-") : slug;
91
91
  // eslint-disable-next-line no-param-reassign
92
92
  const nextSlug = `${slug}-${counter && /\d+/g.test(counter) ? +counter + 1 : 1}`;
93
- console.log({ nextSlug, counter, slug });
94
93
  return this.generateSlug(nextSlug);
95
94
  }
96
95
  return slug.toLowerCase();
@@ -114,18 +113,18 @@ class GAP extends types_1.Facade {
114
113
  assertGelatoOpts(args) {
115
114
  if (args.gelatoOpts &&
116
115
  !(args.gelatoOpts.sponsorUrl || args.gelatoOpts.apiKey)) {
117
- throw new Error('You must provide a `sponsorUrl` or an `apiKey`.');
116
+ throw new Error("You must provide a `sponsorUrl` or an `apiKey`.");
118
117
  }
119
118
  if (args.gelatoOpts?.sponsorUrl &&
120
119
  args.gelatoOpts?.contained &&
121
120
  !args.gelatoOpts.env_gelatoApiKey) {
122
- throw new Error('You must provide `env_gelatoApiKey` to be able to use it in a backend handler.');
121
+ throw new Error("You must provide `env_gelatoApiKey` to be able to use it in a backend handler.");
123
122
  }
124
123
  if ((args.gelatoOpts?.env_gelatoApiKey ||
125
124
  args.gelatoOpts?.apiKey ||
126
125
  args.gelatoOpts?.sponsorUrl) &&
127
126
  !args.gelatoOpts?.useGasless) {
128
- console.warn('GAP::You are using gelatoOpts but not setting useGasless to true. This will send transactions through the normal provider.');
127
+ console.warn("GAP::You are using gelatoOpts but not setting useGasless to true. This will send transactions through the normal provider.");
129
128
  }
130
129
  }
131
130
  /**
@@ -219,11 +218,11 @@ class GAP extends types_1.Facade {
219
218
  * and an API key is needed.
220
219
  */
221
220
  static set gelatoOpts(gelatoOpts) {
222
- if (typeof this._gelatoOpts === 'undefined') {
221
+ if (typeof this._gelatoOpts === "undefined") {
223
222
  this._gelatoOpts = gelatoOpts;
224
223
  }
225
224
  else {
226
- throw new Error('Cannot change a readonly value gelatoOpts.');
225
+ throw new Error("Cannot change a readonly value gelatoOpts.");
227
226
  }
228
227
  }
229
228
  /**
@@ -240,7 +239,7 @@ class GAP extends types_1.Facade {
240
239
  !this._gelatoOpts?.apiKey &&
241
240
  !this._gelatoOpts?.sponsorUrl &&
242
241
  !this._gelatoOpts?.env_gelatoApiKey) {
243
- throw new Error('You must provide a `sponsorUrl` or an `apiKey` before using gasless transactions.');
242
+ throw new Error("You must provide a `sponsorUrl` or an `apiKey` before using gasless transactions.");
244
243
  }
245
244
  this._gelatoOpts.useGasless = useGasLess;
246
245
  }
@@ -4,7 +4,6 @@ exports.Schema = void 0;
4
4
  const eas_sdk_1 = require("@ethereum-attestation-service/eas-sdk");
5
5
  const SchemaError_1 = require("./SchemaError");
6
6
  const consts_1 = require("../consts");
7
- const GAP_1 = require("./GAP");
8
7
  const GapContract_1 = require("./contract/GapContract");
9
8
  const ethers_1 = require("ethers");
10
9
  /**
@@ -224,12 +223,6 @@ class Schema {
224
223
  if (this.references && !refUID)
225
224
  throw new SchemaError_1.AttestationError("INVALID_REFERENCE", "Attestation schema references another schema but no reference UID was provided.");
226
225
  if (this.isJsonSchema()) {
227
- const { remoteClient } = GAP_1.GAP;
228
- if (remoteClient) {
229
- const cid = await remoteClient.save(data, this.name);
230
- const encodedData = remoteClient.encode(cid);
231
- data = encodedData;
232
- }
233
226
  this.setValue("json", JSON.stringify(data));
234
227
  }
235
228
  else {
@@ -467,5 +460,7 @@ Schema.schemas = {
467
460
  sepolia: [],
468
461
  arbitrum: [],
469
462
  celo: [],
463
+ "sei": [],
464
+ "sei-testnet": [],
470
465
  "base-sepolia": [],
471
466
  };
@@ -49,7 +49,7 @@ class IpfsStorage extends RemoteStorage_1.RemoteStorage {
49
49
  return res.data.IpfsHash;
50
50
  }
51
51
  catch (error) {
52
- console.log(error);
52
+ throw new SchemaError_1.RemoteStorageError("REMOTE_STORAGE_UPLOAD", `Error adding data to IPFS`);
53
53
  }
54
54
  }
55
55
  }
package/core/consts.d.ts CHANGED
@@ -11,6 +11,8 @@ export declare const chainIdToNetwork: {
11
11
  11155111: string;
12
12
  84532: string;
13
13
  42220: string;
14
+ 1328: string;
15
+ 1329: string;
14
16
  };
15
17
  export declare const nullRef = "0x0000000000000000000000000000000000000000000000000000000000000000";
16
18
  export declare const nullResolver = "0x0000000000000000000000000000000000000000";
package/core/consts.js CHANGED
@@ -19,6 +19,8 @@ exports.chainIdToNetwork = {
19
19
  11155111: "sepolia",
20
20
  84532: "base-sepolia",
21
21
  42220: "celo",
22
+ 1328: "sei-testnet",
23
+ 1329: "sei",
22
24
  };
23
25
  exports.nullRef = "0x0000000000000000000000000000000000000000000000000000000000000000";
24
26
  // TODO: Remove null resolver and change usage to zero address
@@ -174,6 +176,54 @@ exports.Networks = {
174
176
  Project: "0xf3f753b41e04d1052b5a5ec7624d1dfdb6c2da288a985120e477ddbcac071022",
175
177
  },
176
178
  },
179
+ "sei": {
180
+ chainId: 1329,
181
+ url: "https://sei.easscan.org/graphql",
182
+ rpcUrl: "https://evm-rpc.sei-apis.com",
183
+ contracts: {
184
+ eas: "0x391020888b0adBA584A67693458b374e4141f838",
185
+ schema: "0x80A4B50f549a8271e10A6C8e79172cb56f35fD57",
186
+ multicall: "0xB80D85690747C3E2ceCc0f8529594C6602b642D5",
187
+ projectResolver: "0x96f36F25C6bD648d9bdBbd8C3E029CfB2394754d",
188
+ communityResolver: "0x61d519C99279DC91fC2FC56B177f42B90B35050E",
189
+ donations: "0xB80D85690747C3E2ceCc0f8529594C6602b642D5",
190
+ },
191
+ schemas: {
192
+ Community: "0x57dee0b7e1aa8e5c6280c27fecf2edeb225f1b87b47e2750f9dc7eaebe57a2ba",
193
+ Details: "0x1b4365b92aa47de3f67cdfb53127518381c1e66e0d9e0f8a15bbfa7250950967",
194
+ Grant: "0xe9030dc574039832103dd5939f9dd214340602d2af4bbf1c8b2666e720ed0bf6",
195
+ GrantVerified: "0x6edc90af92553109cfed1292a67a75b34e41880bd8a61e9d05db0473b69a2f9e",
196
+ MemberOf: "0xb7278b94cea2b9f1a8fdd1c4bb52ed66906516a0ff9d59d0f80daffcf147ea5d",
197
+ MilestoneApproved: "0x6edc90af92553109cfed1292a67a75b34e41880bd8a61e9d05db0473b69a2f9e",
198
+ MilestoneCompleted: "0x6edc90af92553109cfed1292a67a75b34e41880bd8a61e9d05db0473b69a2f9e",
199
+ GrantUpdateStatus: "0x6edc90af92553109cfed1292a67a75b34e41880bd8a61e9d05db0473b69a2f9e",
200
+ Project: "0xf6b89107f8096220051240b89a48abb66e0a23e529c914953b80f5a2bc5ea44c",
201
+ },
202
+ },
203
+ "sei-testnet": {
204
+ chainId: 1328,
205
+ url: "https://sei-testnet.easscan.org/graphql",
206
+ rpcUrl: "https://evm-rpc-testnet.sei-apis.com",
207
+ contracts: {
208
+ eas: "0x4F166ed0A038ECdEEefa7Dc508f15991762974Fe",
209
+ schema: "0x906a57aCa067178e76e6eBDF4C7b26CBcAEC0Edd",
210
+ multicall: "0x0bB232f1b137fB55CB6af92c218A1cD63445a2E9",
211
+ projectResolver: "0xdA2c62101851365EEdC5A1f7087d92Ffde7345B4",
212
+ communityResolver: "0x50fb4a65CE924D29b9AC8C508c376a5a21Fda1BC",
213
+ donations: "0xB80D85690747C3E2ceCc0f8529594C6602b642D5",
214
+ },
215
+ schemas: {
216
+ Community: "0x968fe3d635bbf22b6253596df6290d1b6da1f192da9e2b5b41ae3595a965dbc2",
217
+ Details: "0x76f38d22f88a0df52a8ff0763e1c0af912b0822e758be2e0c9cded91aef71d22",
218
+ Grant: "0xfd5af4f0abd2875c64d2fed8be07bc1dfa5192a49e1a80587b0f12cae8d5173f",
219
+ GrantVerified: "0xb25551d21dc886be83a07c241c46de318704cb6f485191fdedcf80f4b8b28188",
220
+ MemberOf: "0x222fa508c0cdb5954905dd30611a940f6402da2b3c49ce0c88d33e22f72121e7",
221
+ MilestoneApproved: "0xb25551d21dc886be83a07c241c46de318704cb6f485191fdedcf80f4b8b28188",
222
+ MilestoneCompleted: "0xb25551d21dc886be83a07c241c46de318704cb6f485191fdedcf80f4b8b28188",
223
+ GrantUpdateStatus: "0xb25551d21dc886be83a07c241c46de318704cb6f485191fdedcf80f4b8b28188",
224
+ Project: "0x9de9294fbb62391b39332a33bfc28b4e0e728dd094aee4bda3955df62f8401a5",
225
+ },
226
+ },
177
227
  };
178
228
  const DetailsSchema = [{ type: "string", name: "json", value: null }];
179
229
  /**
package/core/types.d.ts CHANGED
@@ -26,7 +26,7 @@ export interface AttestArgs<T = unknown> {
26
26
  export type TSchemaName = "Community" | "CommunityDetails" | "Grant" | "GrantDetails" | "GrantVerified" | "MemberOf" | "MemberDetails" | "Milestone" | "MilestoneCompleted" | "MilestoneApproved" | "Project" | "ProjectDetails" | "Details" | "ProjectImpact" | "GrantUpdate" | "GrantUpdateStatus" | "ProjectEndorsement";
27
27
  export type TResolvedSchemaNames = "Community" | "Grant" | "GrantVerified" | "MemberOf" | "MilestoneCompleted" | "MilestoneApproved" | "Project" | "Details" | "GrantUpdateStatus";
28
28
  export type TExternalLink = "twitter" | "github" | "website" | "linkedin" | "discord";
29
- export type TNetwork = "optimism" | "celo" | "optimism-sepolia" | "arbitrum" | "sepolia" | "base-sepolia";
29
+ export type TNetwork = "optimism" | "celo" | "optimism-sepolia" | "arbitrum" | "sepolia" | "sei" | "sei-testnet" | "base-sepolia";
30
30
  /**
31
31
  * Generic GAP Facade interface.
32
32
  * This supplies the GAP class with the necessary properties.
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.3.39",
6
+ "version": "0.3.41",
7
7
  "description": "Simple and easy interface between EAS and Karma GAP.",
8
8
  "main": "./index.js",
9
9
  "author": "KarmaHQ",