@reyaxyz/community-sdk 0.58.11 → 0.59.1

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 +1 @@
1
- {"version":3,"file":"contractAddresses.d.ts","sourceRoot":"/","sources":["utils/contractAddresses.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;AAGxC,oBAAY,YAAY;IACtB,kBAAkB,uBAAuB;IACzC,WAAW,gBAAgB;CAC5B;AAeD,eAAO,MAAM,UAAU,YACZ,MAAM,gBACD,YAAY,KACzB,MAaF,CAAC"}
1
+ {"version":3,"file":"contractAddresses.d.ts","sourceRoot":"/","sources":["utils/contractAddresses.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;AAGxC,oBAAY,YAAY;IACtB,kBAAkB,uBAAuB;IACzC,WAAW,gBAAgB;CAC5B;AAsBD,eAAO,MAAM,UAAU,YACZ,MAAM,gBACD,YAAY,KACzB,MAcF,CAAC"}
@@ -1,5 +1,16 @@
1
1
  "use strict";
2
- var _a, _b, _c;
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var _a, _b, _c, _d;
3
14
  Object.defineProperty(exports, "__esModule", { value: true });
4
15
  exports.getAddress = exports.ContractType = void 0;
5
16
  var common_1 = require("@reyaxyz/common");
@@ -8,7 +19,7 @@ var ContractType;
8
19
  ContractType["COMMUNITY_DEPLOYER"] = "community_deployer";
9
20
  ContractType["RANKS_PROXY"] = "ranks_proxy";
10
21
  })(ContractType || (exports.ContractType = ContractType = {}));
11
- var addresses = (_a = {},
22
+ var remoteAddresses = (_a = {},
12
23
  _a[common_1.ReyaChainId.reyaCronos] = (_b = {},
13
24
  _b[ContractType.COMMUNITY_DEPLOYER] = '0x0fc85eb14c45acc1534257431f6a079cf3bbdfe9',
14
25
  _b[ContractType.RANKS_PROXY] = '0xddc9759e9218fc4b1d56e3d75b2936f877dc6dea',
@@ -18,16 +29,18 @@ var addresses = (_a = {},
18
29
  _c[ContractType.RANKS_PROXY] = '0x4ab90747a2e8dec7c378d591b80b9f2f8f78351f',
19
30
  _c),
20
31
  _a);
32
+ var addresses = __assign(__assign({}, remoteAddresses), (_d = {}, _d[common_1.ReyaChainId.reyaLocal] = {}, _d));
21
33
  var getAddress = function (chainId, contractName) {
22
34
  var keyChainId = chainId.toString();
23
35
  if (!Object.keys(addresses).includes(keyChainId)) {
24
36
  return "Unspecified addresses for chain id ".concat(keyChainId);
25
37
  }
26
38
  var networkAddresses = addresses[chainId];
27
- if (!Object.keys(networkAddresses).includes(contractName)) {
39
+ var contractAddress = networkAddresses[contractName];
40
+ if (!contractAddress) {
28
41
  return "Unspecified address for ".concat(contractName, " contract");
29
42
  }
30
- return networkAddresses[contractName];
43
+ return contractAddress;
31
44
  };
32
45
  exports.getAddress = getAddress;
33
46
  //# sourceMappingURL=contractAddresses.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"contractAddresses.js","sourceRoot":"/","sources":["utils/contractAddresses.ts"],"names":[],"mappings":";;;;AACA,0CAA8C;AAE9C,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,yDAAyC,CAAA;IACzC,2CAA2B,CAAA;AAC7B,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB;AAED,IAAM,SAAS;IACb,GAAC,oBAAW,CAAC,UAAU;QACrB,GAAC,YAAY,CAAC,kBAAkB,IAC9B,4CAA4C;QAC9C,GAAC,YAAY,CAAC,WAAW,IAAG,4CAA4C;WACzE;IACD,GAAC,oBAAW,CAAC,WAAW;QACtB,GAAC,YAAY,CAAC,kBAAkB,IAC9B,4CAA4C;QAC9C,GAAC,YAAY,CAAC,WAAW,IAAG,4CAA4C;WACzE;OACF,CAAC;AAEK,IAAM,UAAU,GAAG,UACxB,OAAe,EACf,YAA0B;IAE1B,IAAM,UAAU,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAEtC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QACjD,OAAO,6CAAsC,UAAU,CAAE,CAAC;IAC5D,CAAC;IAED,IAAM,gBAAgB,GAAG,SAAS,CAAC,OAAsB,CAAC,CAAC;IAC3D,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;QAC1D,OAAO,kCAA2B,YAAY,cAAW,CAAC;IAC5D,CAAC;IAED,OAAO,gBAAgB,CAAC,YAAY,CAAC,CAAC;AACxC,CAAC,CAAC;AAhBW,QAAA,UAAU,cAgBrB","sourcesContent":["export type Address = Lowercase<string>;\nimport { ReyaChainId } from '@reyaxyz/common';\n\nexport enum ContractType {\n COMMUNITY_DEPLOYER = 'community_deployer',\n RANKS_PROXY = 'ranks_proxy',\n}\n\nconst addresses: Record<ReyaChainId, Record<ContractType, Address>> = {\n [ReyaChainId.reyaCronos]: {\n [ContractType.COMMUNITY_DEPLOYER]:\n '0x0fc85eb14c45acc1534257431f6a079cf3bbdfe9',\n [ContractType.RANKS_PROXY]: '0xddc9759e9218fc4b1d56e3d75b2936f877dc6dea',\n },\n [ReyaChainId.reyaNetwork]: {\n [ContractType.COMMUNITY_DEPLOYER]:\n '0xa45506157b7d1c6cb5d4b4846d03a9892010a4f3',\n [ContractType.RANKS_PROXY]: '0x4ab90747a2e8dec7c378d591b80b9f2f8f78351f',\n },\n};\n\nexport const getAddress = (\n chainId: number,\n contractName: ContractType,\n): string => {\n const keyChainId = chainId.toString();\n\n if (!Object.keys(addresses).includes(keyChainId)) {\n return `Unspecified addresses for chain id ${keyChainId}`;\n }\n\n const networkAddresses = addresses[chainId as ReyaChainId];\n if (!Object.keys(networkAddresses).includes(contractName)) {\n return `Unspecified address for ${contractName} contract`;\n }\n\n return networkAddresses[contractName];\n};\n"]}
1
+ {"version":3,"file":"contractAddresses.js","sourceRoot":"/","sources":["utils/contractAddresses.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,0CAA8C;AAE9C,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,yDAAyC,CAAA;IACzC,2CAA2B,CAAA;AAC7B,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB;AAID,IAAM,eAAe,GAAG,CAAA;IACtB,GAAC,oBAAW,CAAC,UAAU;QACrB,GAAC,YAAY,CAAC,kBAAkB,IAC9B,4CAA4C;QAC9C,GAAC,YAAY,CAAC,WAAW,IAAG,4CAA4C;WACzE;IACD,GAAC,oBAAW,CAAC,WAAW;QACtB,GAAC,YAAY,CAAC,kBAAkB,IAC9B,4CAA4C;QAC9C,GAAC,YAAY,CAAC,WAAW,IAAG,4CAA4C;WACzE;MACiE,CAAA,CAAC;AAErE,IAAM,SAAS,yBACV,eAAe,gBACjB,oBAAW,CAAC,SAAS,IAAG,EAAE,MAC5B,CAAC;AAEK,IAAM,UAAU,GAAG,UACxB,OAAe,EACf,YAA0B;IAE1B,IAAM,UAAU,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAEtC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QACjD,OAAO,6CAAsC,UAAU,CAAE,CAAC;IAC5D,CAAC;IAED,IAAM,gBAAgB,GAAG,SAAS,CAAC,OAAsB,CAAC,CAAC;IAC3D,IAAM,eAAe,GAAG,gBAAgB,CAAC,YAAY,CAAC,CAAC;IACvD,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,OAAO,kCAA2B,YAAY,cAAW,CAAC;IAC5D,CAAC;IAED,OAAO,eAAe,CAAC;AACzB,CAAC,CAAC;AAjBW,QAAA,UAAU,cAiBrB","sourcesContent":["export type Address = Lowercase<string>;\nimport { ReyaChainId } from '@reyaxyz/common';\n\nexport enum ContractType {\n COMMUNITY_DEPLOYER = 'community_deployer',\n RANKS_PROXY = 'ranks_proxy',\n}\n\ntype RemoteReyaChainId = Exclude<ReyaChainId, ReyaChainId.reyaLocal>;\n\nconst remoteAddresses = {\n [ReyaChainId.reyaCronos]: {\n [ContractType.COMMUNITY_DEPLOYER]:\n '0x0fc85eb14c45acc1534257431f6a079cf3bbdfe9',\n [ContractType.RANKS_PROXY]: '0xddc9759e9218fc4b1d56e3d75b2936f877dc6dea',\n },\n [ReyaChainId.reyaNetwork]: {\n [ContractType.COMMUNITY_DEPLOYER]:\n '0xa45506157b7d1c6cb5d4b4846d03a9892010a4f3',\n [ContractType.RANKS_PROXY]: '0x4ab90747a2e8dec7c378d591b80b9f2f8f78351f',\n },\n} satisfies Record<RemoteReyaChainId, Record<ContractType, Address>>;\n\nconst addresses: Record<ReyaChainId, Partial<Record<ContractType, Address>>> = {\n ...remoteAddresses,\n [ReyaChainId.reyaLocal]: {},\n};\n\nexport const getAddress = (\n chainId: number,\n contractName: ContractType,\n): string => {\n const keyChainId = chainId.toString();\n\n if (!Object.keys(addresses).includes(keyChainId)) {\n return `Unspecified addresses for chain id ${keyChainId}`;\n }\n\n const networkAddresses = addresses[chainId as ReyaChainId];\n const contractAddress = networkAddresses[contractName];\n if (!contractAddress) {\n return `Unspecified address for ${contractName} contract`;\n }\n\n return contractAddress;\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reyaxyz/community-sdk",
3
- "version": "0.58.11",
3
+ "version": "0.59.1",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -10,9 +10,9 @@
10
10
  "url": "https://github.com/Reya-Labs/reya-off-chain-monorepo.git"
11
11
  },
12
12
  "dependencies": {
13
- "@reyaxyz/common": "0.362.1",
14
- "@reyaxyz/sdk": "0.151.4",
15
- "ethers": "6.9.0"
13
+ "@reyaxyz/common": "0.364.0",
14
+ "@reyaxyz/sdk": "0.152.1",
15
+ "ethers": "6.17.0"
16
16
  },
17
17
  "main": "dist/index.js",
18
18
  "types": "dist/types",
@@ -38,5 +38,5 @@
38
38
  "generate:coverage-badges": "npx istanbul-badges-readme --silent"
39
39
  },
40
40
  "packageManager": "pnpm@8.3.1",
41
- "gitHead": "8dbf4da176ddaf08a9962f8a73824dfa9ded7e44"
41
+ "gitHead": "d550bc1ace1a4a7dd87331ba7abf76833c7f99df"
42
42
  }
@@ -6,7 +6,9 @@ export enum ContractType {
6
6
  RANKS_PROXY = 'ranks_proxy',
7
7
  }
8
8
 
9
- const addresses: Record<ReyaChainId, Record<ContractType, Address>> = {
9
+ type RemoteReyaChainId = Exclude<ReyaChainId, ReyaChainId.reyaLocal>;
10
+
11
+ const remoteAddresses = {
10
12
  [ReyaChainId.reyaCronos]: {
11
13
  [ContractType.COMMUNITY_DEPLOYER]:
12
14
  '0x0fc85eb14c45acc1534257431f6a079cf3bbdfe9',
@@ -17,6 +19,11 @@ const addresses: Record<ReyaChainId, Record<ContractType, Address>> = {
17
19
  '0xa45506157b7d1c6cb5d4b4846d03a9892010a4f3',
18
20
  [ContractType.RANKS_PROXY]: '0x4ab90747a2e8dec7c378d591b80b9f2f8f78351f',
19
21
  },
22
+ } satisfies Record<RemoteReyaChainId, Record<ContractType, Address>>;
23
+
24
+ const addresses: Record<ReyaChainId, Partial<Record<ContractType, Address>>> = {
25
+ ...remoteAddresses,
26
+ [ReyaChainId.reyaLocal]: {},
20
27
  };
21
28
 
22
29
  export const getAddress = (
@@ -30,9 +37,10 @@ export const getAddress = (
30
37
  }
31
38
 
32
39
  const networkAddresses = addresses[chainId as ReyaChainId];
33
- if (!Object.keys(networkAddresses).includes(contractName)) {
40
+ const contractAddress = networkAddresses[contractName];
41
+ if (!contractAddress) {
34
42
  return `Unspecified address for ${contractName} contract`;
35
43
  }
36
44
 
37
- return networkAddresses[contractName];
45
+ return contractAddress;
38
46
  };