@reyaxyz/community-sdk 0.13.4 → 0.13.6

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.
@@ -41,7 +41,7 @@ var contractAddresses_1 = require("../../../../utils/contractAddresses");
41
41
  var executeTransaction_1 = require("../executeTransaction");
42
42
  var encode_1 = require("./encode");
43
43
  var vote = function (params) { return __awaiter(void 0, void 0, void 0, function () {
44
- var _a, data, value, network, chainId, result;
44
+ var _a, data, value, network, chainId, result, error_1;
45
45
  var _b;
46
46
  return __generator(this, function (_c) {
47
47
  switch (_c.label) {
@@ -51,12 +51,19 @@ var vote = function (params) { return __awaiter(void 0, void 0, void 0, function
51
51
  case 1:
52
52
  network = _c.sent();
53
53
  chainId = Number(network === null || network === void 0 ? void 0 : network.chainId);
54
- return [4 /*yield*/, (0, executeTransaction_1.executeTransaction)(params.signer, data, value, chainId, contractAddresses_1.ContractType.COMMUNITY_DEPLOYER)];
54
+ _c.label = 2;
55
55
  case 2:
56
+ _c.trys.push([2, 4, , 5]);
57
+ return [4 /*yield*/, (0, executeTransaction_1.executeTransaction)(params.signer, data, value, chainId, contractAddresses_1.ContractType.COMMUNITY_DEPLOYER)];
58
+ case 3:
56
59
  result = _c.sent();
57
60
  return [2 /*return*/, {
58
61
  transactionHash: (result === null || result === void 0 ? void 0 : result.hash) || null,
59
62
  }];
63
+ case 4:
64
+ error_1 = _c.sent();
65
+ throw new Error('Vote failed. Please reach out via Discord.');
66
+ case 5: return [2 /*return*/];
60
67
  }
61
68
  });
62
69
  }); };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/vote/services/vote/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAmE;AACnE,4DAA2D;AAC3D,mCAA0C;AAGnC,IAAM,IAAI,GAAG,UAAO,MAAkB;;;;;;gBACrC,KAA4B,IAAA,uBAAc,EAAC,MAAM,CAAC,KAAK,IAAI,KAAK,CAAC,EAArD,IAAI,cAAA,EAAE,KAAK,WAAA,CAA2C;gBAExD,qBAAM,CAAA,MAAA,MAAM,CAAC,MAAM,CAAC,QAAQ,0CAAE,UAAU,EAAE,CAAA,EAAA;;gBAApD,OAAO,GAAG,SAA0C;gBACpD,OAAO,GAAG,MAAM,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,CAAC,CAAC;gBAE1B,qBAAM,IAAA,uCAAkB,EACrC,MAAM,CAAC,MAAM,EACb,IAAI,EACJ,KAAK,EACL,OAAO,EACP,gCAAY,CAAC,kBAAkB,CAChC,EAAA;;gBANK,MAAM,GAAG,SAMd;gBAED,sBAAO;wBACL,eAAe,EAAE,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,KAAI,IAAI;qBACtC,EAAC;;;KACH,CAAC;AAjBW,QAAA,IAAI,QAiBf","sourcesContent":["import { ContractType } from '../../../../utils/contractAddresses';\nimport { executeTransaction } from '../executeTransaction';\nimport { encodeCastVote } from './encode';\nimport { VoteParams, VoteResult } from '../../types';\n\nexport const vote = async (params: VoteParams): Promise<VoteResult> => {\n const { calldata: data, value } = encodeCastVote(params.voted == 'yes');\n\n const network = await params.signer.provider?.getNetwork();\n const chainId = Number(network?.chainId);\n\n const result = await executeTransaction(\n params.signer,\n data,\n value,\n chainId,\n ContractType.COMMUNITY_DEPLOYER,\n );\n\n return {\n transactionHash: result?.hash || null,\n };\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/vote/services/vote/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAmE;AACnE,4DAA2D;AAC3D,mCAA0C;AAGnC,IAAM,IAAI,GAAG,UAAO,MAAkB;;;;;;gBACrC,KAA4B,IAAA,uBAAc,EAAC,MAAM,CAAC,KAAK,IAAI,KAAK,CAAC,EAArD,IAAI,cAAA,EAAE,KAAK,WAAA,CAA2C;gBAExD,qBAAM,CAAA,MAAA,MAAM,CAAC,MAAM,CAAC,QAAQ,0CAAE,UAAU,EAAE,CAAA,EAAA;;gBAApD,OAAO,GAAG,SAA0C;gBACpD,OAAO,GAAG,MAAM,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,CAAC,CAAC;;;;gBAGxB,qBAAM,IAAA,uCAAkB,EACrC,MAAM,CAAC,MAAM,EACb,IAAI,EACJ,KAAK,EACL,OAAO,EACP,gCAAY,CAAC,kBAAkB,CAChC,EAAA;;gBANK,MAAM,GAAG,SAMd;gBACD,sBAAO;wBACL,eAAe,EAAE,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,KAAI,IAAI;qBACtC,EAAC;;;gBAEF,MAAM,IAAI,KAAK,CAAC,4CAA4C,CAAC,CAAC;;;;KAEjE,CAAC;AApBW,QAAA,IAAI,QAoBf","sourcesContent":["import { ContractType } from '../../../../utils/contractAddresses';\nimport { executeTransaction } from '../executeTransaction';\nimport { encodeCastVote } from './encode';\nimport { VoteParams, VoteResult } from '../../types';\n\nexport const vote = async (params: VoteParams): Promise<VoteResult> => {\n const { calldata: data, value } = encodeCastVote(params.voted == 'yes');\n\n const network = await params.signer.provider?.getNetwork();\n const chainId = Number(network?.chainId);\n\n try {\n const result = await executeTransaction(\n params.signer,\n data,\n value,\n chainId,\n ContractType.COMMUNITY_DEPLOYER,\n );\n return {\n transactionHash: result?.hash || null,\n };\n } catch (error) {\n throw new Error('Vote failed. Please reach out via Discord.');\n }\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/vote/services/vote/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAErD,eAAO,MAAM,IAAI,WAAkB,UAAU,KAAG,QAAQ,UAAU,CAiBjE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/vote/services/vote/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAErD,eAAO,MAAM,IAAI,WAAkB,UAAU,KAAG,QAAQ,UAAU,CAoBjE,CAAC"}
@@ -20,7 +20,7 @@ var addresses = (_a = {},
20
20
  _c[ContractType.RANKS_PROXY] = '0xddc9759e9218fc4b1d56e3d75b2936f877dc6dea',
21
21
  _c),
22
22
  _a[common_1.ReyaChainId.reyaNetwork] = (_d = {},
23
- _d[ContractType.COMMUNITY_DEPLOYER] = '0x59f75a9cbcc8ad666587a967ced9f1896e55dc7d',
23
+ _d[ContractType.COMMUNITY_DEPLOYER] = '0x574232e3fba95fb73f773fc77949de6cb4ae0e00',
24
24
  _d[ContractType.RANKS_PROXY] = '0x6fae3560b52c18d293449f0a9b0d97afb0a719f0',
25
25
  _d),
26
26
  _a);
@@ -1 +1 @@
1
- {"version":3,"file":"contractAddresses.js","sourceRoot":"/","sources":["utils/contractAddresses.ts"],"names":[],"mappings":";;;;AACA,+CAA+C;AAC/C,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,aAAa;QACxB,wDAAwD;QACxD,GAAC,YAAY,CAAC,kBAAkB,IAC9B,4CAA4C;QAC9C,GAAC,YAAY,CAAC,WAAW,IAAG,4CAA4C;WACzE;IACD,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>;\n// @todo update with proper chainId for mainnet\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.polygonMumbai]: {\n // todo replace with mapping from id to contract address\n [ContractType.COMMUNITY_DEPLOYER]:\n '0x69b480a57eb3ab98d68c5d5590ad63bf4d5eb3f7',\n [ContractType.RANKS_PROXY]: '0xf2a1fca4f1e08f84eef135395b6e8df7cb02d59f',\n },\n [ReyaChainId.reyaCronos]: {\n [ContractType.COMMUNITY_DEPLOYER]:\n '0x0fc85eb14c45acc1534257431f6a079cf3bbdfe9',\n [ContractType.RANKS_PROXY]: '0xddc9759e9218fc4b1d56e3d75b2936f877dc6dea',\n },\n [ReyaChainId.reyaNetwork]: {\n [ContractType.COMMUNITY_DEPLOYER]:\n '0x59f75a9cbcc8ad666587a967ced9f1896e55dc7d',\n [ContractType.RANKS_PROXY]: '0x6fae3560b52c18d293449f0a9b0d97afb0a719f0',\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,+CAA+C;AAC/C,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,aAAa;QACxB,wDAAwD;QACxD,GAAC,YAAY,CAAC,kBAAkB,IAC9B,4CAA4C;QAC9C,GAAC,YAAY,CAAC,WAAW,IAAG,4CAA4C;WACzE;IACD,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>;\n// @todo update with proper chainId for mainnet\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.polygonMumbai]: {\n // todo replace with mapping from id to contract address\n [ContractType.COMMUNITY_DEPLOYER]:\n '0x69b480a57eb3ab98d68c5d5590ad63bf4d5eb3f7',\n [ContractType.RANKS_PROXY]: '0xf2a1fca4f1e08f84eef135395b6e8df7cb02d59f',\n },\n [ReyaChainId.reyaCronos]: {\n [ContractType.COMMUNITY_DEPLOYER]:\n '0x0fc85eb14c45acc1534257431f6a079cf3bbdfe9',\n [ContractType.RANKS_PROXY]: '0xddc9759e9218fc4b1d56e3d75b2936f877dc6dea',\n },\n [ReyaChainId.reyaNetwork]: {\n [ContractType.COMMUNITY_DEPLOYER]:\n '0x574232e3fba95fb73f773fc77949de6cb4ae0e00',\n [ContractType.RANKS_PROXY]: '0x6fae3560b52c18d293449f0a9b0d97afb0a719f0',\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"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reyaxyz/community-sdk",
3
- "version": "0.13.4",
3
+ "version": "0.13.6",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -38,5 +38,5 @@
38
38
  "generate:coverage-badges": "npx istanbul-badges-readme --silent"
39
39
  },
40
40
  "packageManager": "pnpm@8.10.4",
41
- "gitHead": "230cbf334fba9c01a0705e6546a881f961b98c27"
41
+ "gitHead": "0eb14de23818f3b0102ab1979a540ff6113e6539"
42
42
  }
@@ -9,15 +9,18 @@ export const vote = async (params: VoteParams): Promise<VoteResult> => {
9
9
  const network = await params.signer.provider?.getNetwork();
10
10
  const chainId = Number(network?.chainId);
11
11
 
12
- const result = await executeTransaction(
13
- params.signer,
14
- data,
15
- value,
16
- chainId,
17
- ContractType.COMMUNITY_DEPLOYER,
18
- );
19
-
20
- return {
21
- transactionHash: result?.hash || null,
22
- };
12
+ try {
13
+ const result = await executeTransaction(
14
+ params.signer,
15
+ data,
16
+ value,
17
+ chainId,
18
+ ContractType.COMMUNITY_DEPLOYER,
19
+ );
20
+ return {
21
+ transactionHash: result?.hash || null,
22
+ };
23
+ } catch (error) {
24
+ throw new Error('Vote failed. Please reach out via Discord.');
25
+ }
23
26
  };
@@ -21,7 +21,7 @@ const addresses: Record<ReyaChainId, Record<ContractType, Address>> = {
21
21
  },
22
22
  [ReyaChainId.reyaNetwork]: {
23
23
  [ContractType.COMMUNITY_DEPLOYER]:
24
- '0x59f75a9cbcc8ad666587a967ced9f1896e55dc7d',
24
+ '0x574232e3fba95fb73f773fc77949de6cb4ae0e00',
25
25
  [ContractType.RANKS_PROXY]: '0x6fae3560b52c18d293449f0a9b0d97afb0a719f0',
26
26
  },
27
27
  };