@reyaxyz/community-sdk 0.3.3 → 0.5.0

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.
Files changed (82) hide show
  1. package/dist/client/index.js +10 -13
  2. package/dist/client/index.js.map +1 -1
  3. package/dist/index.js +0 -4
  4. package/dist/index.js.map +1 -1
  5. package/dist/modules/vote/index.js +33 -10
  6. package/dist/modules/vote/index.js.map +1 -1
  7. package/dist/modules/vote/services/executeTransaction.js +99 -0
  8. package/dist/modules/vote/services/executeTransaction.js.map +1 -0
  9. package/dist/modules/vote/services/get-vote-details/index.js.map +1 -1
  10. package/dist/modules/vote/services/get-vote-status/index.js.map +1 -1
  11. package/dist/modules/vote/services/index.js +0 -3
  12. package/dist/modules/vote/services/index.js.map +1 -1
  13. package/dist/modules/vote/services/vote/encode.js +14 -0
  14. package/dist/modules/vote/services/vote/encode.js.map +1 -0
  15. package/dist/modules/vote/services/vote/index.js +22 -21
  16. package/dist/modules/vote/services/vote/index.js.map +1 -1
  17. package/dist/modules/vote/types.js.map +1 -0
  18. package/dist/types/client/index.d.ts +2 -5
  19. package/dist/types/client/index.d.ts.map +1 -1
  20. package/dist/types/index.d.ts +0 -4
  21. package/dist/types/index.d.ts.map +1 -1
  22. package/dist/types/modules/vote/index.d.ts +6 -8
  23. package/dist/types/modules/vote/index.d.ts.map +1 -1
  24. package/dist/types/modules/vote/services/executeTransaction.d.ts +13 -0
  25. package/dist/types/modules/vote/services/executeTransaction.d.ts.map +1 -0
  26. package/dist/types/modules/vote/services/get-vote-details/index.d.ts +1 -1
  27. package/dist/types/modules/vote/services/get-vote-details/index.d.ts.map +1 -1
  28. package/dist/types/modules/vote/services/get-vote-status/index.d.ts +1 -1
  29. package/dist/types/modules/vote/services/get-vote-status/index.d.ts.map +1 -1
  30. package/dist/types/modules/vote/services/index.d.ts +0 -3
  31. package/dist/types/modules/vote/services/index.d.ts.map +1 -1
  32. package/dist/types/modules/vote/services/vote/encode.d.ts +3 -0
  33. package/dist/types/modules/vote/services/vote/encode.d.ts.map +1 -0
  34. package/dist/types/modules/vote/services/vote/index.d.ts +2 -2
  35. package/dist/types/modules/vote/services/vote/index.d.ts.map +1 -1
  36. package/dist/types/modules/vote/types.d.ts +20 -0
  37. package/dist/types/modules/vote/types.d.ts.map +1 -0
  38. package/dist/types/utils/action.d.ts +11 -0
  39. package/dist/types/utils/action.d.ts.map +1 -0
  40. package/dist/types/utils/contractAddresses.d.ts +7 -0
  41. package/dist/types/utils/contractAddresses.d.ts.map +1 -0
  42. package/dist/{modules/vote/services/get-vote-status/types.js → utils/action.js} +1 -1
  43. package/dist/utils/action.js.map +1 -0
  44. package/dist/utils/contractAddresses.js +39 -0
  45. package/dist/utils/contractAddresses.js.map +1 -0
  46. package/package.json +4 -3
  47. package/src/client/index.ts +11 -21
  48. package/src/index.ts +0 -4
  49. package/src/modules/vote/index.ts +13 -19
  50. package/src/modules/vote/services/executeTransaction.ts +58 -0
  51. package/src/modules/vote/services/get-vote-details/index.ts +2 -2
  52. package/src/modules/vote/services/get-vote-status/index.ts +2 -2
  53. package/src/modules/vote/services/index.ts +0 -3
  54. package/src/modules/vote/services/vote/encode.ts +12 -0
  55. package/src/modules/vote/services/vote/index.ts +21 -17
  56. package/src/modules/vote/types.ts +23 -0
  57. package/src/utils/action.ts +10 -0
  58. package/src/utils/contractAddresses.ts +43 -0
  59. package/dist/client/constants.js +0 -24
  60. package/dist/client/constants.js.map +0 -1
  61. package/dist/modules/vote/services/get-vote-details/types.js.map +0 -1
  62. package/dist/modules/vote/services/get-vote-status/types.js.map +0 -1
  63. package/dist/modules/vote/services/vote/types.js +0 -3
  64. package/dist/modules/vote/services/vote/types.js.map +0 -1
  65. package/dist/types/client/constants.d.ts +0 -12
  66. package/dist/types/client/constants.d.ts.map +0 -1
  67. package/dist/types/modules/vote/services/get-vote-details/types.d.ts +0 -6
  68. package/dist/types/modules/vote/services/get-vote-details/types.d.ts.map +0 -1
  69. package/dist/types/modules/vote/services/get-vote-status/types.d.ts +0 -7
  70. package/dist/types/modules/vote/services/get-vote-status/types.d.ts.map +0 -1
  71. package/dist/types/modules/vote/services/vote/types.d.ts +0 -11
  72. package/dist/types/modules/vote/services/vote/types.d.ts.map +0 -1
  73. package/dist/types/types.d.ts +0 -13
  74. package/dist/types/types.d.ts.map +0 -1
  75. package/dist/types.js +0 -3
  76. package/dist/types.js.map +0 -1
  77. package/src/client/constants.ts +0 -32
  78. package/src/modules/vote/services/get-vote-details/types.ts +0 -6
  79. package/src/modules/vote/services/get-vote-status/types.ts +0 -7
  80. package/src/modules/vote/services/vote/types.ts +0 -11
  81. package/src/types.ts +0 -13
  82. /package/dist/modules/vote/{services/get-vote-details/types.js → types.js} +0 -0
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.CommunityClient = void 0;
7
- var constants_1 = require("./constants");
7
+ var common_1 = require("@reyaxyz/common");
8
8
  var vote_1 = __importDefault(require("../modules/vote"));
9
9
  var lge_1 = __importDefault(require("../modules/lge"));
10
10
  var twitter_1 = __importDefault(require("../modules/twitter"));
@@ -12,18 +12,15 @@ var twitter_1 = __importDefault(require("../modules/twitter"));
12
12
  * @description Client for Community SDK
13
13
  */
14
14
  var CommunityClient = /** @class */ (function () {
15
- function CommunityClient(params) {
16
- CommunityClient.config = constants_1.SERVICE_CONFIG[params.environment];
17
- this._vote = new vote_1.default(CommunityClient.config.chainId);
18
- this._LGE = new lge_1.default(CommunityClient.config.chainId);
15
+ function CommunityClient() {
16
+ this._vote = new vote_1.default(CommunityClient.config.apiEndpoint);
17
+ this._LGE = new lge_1.default(CommunityClient.config.chain);
19
18
  this._twitter = new twitter_1.default(CommunityClient.config.twitter.redirectURI, CommunityClient.config.twitter.clientId);
20
19
  }
21
- CommunityClient.configure = function (params) {
22
- if (!params.environment ||
23
- ['test', 'production'].indexOf(params.environment) === -1) {
24
- throw new Error('Client environment is incorrect or not provided. Consult the docs about ConfigureParams.');
25
- }
26
- CommunityClient.instance = new CommunityClient(params);
20
+ CommunityClient.configure = function (environment) {
21
+ CommunityClient.config =
22
+ common_1.API_CLIENT_CONFIGS[environment] || common_1.API_CLIENT_CONFIGS['test'];
23
+ CommunityClient.instance = new CommunityClient();
27
24
  };
28
25
  CommunityClient.getInstance = function () {
29
26
  if (!CommunityClient.instance) {
@@ -75,12 +72,12 @@ var CommunityClient = /** @class */ (function () {
75
72
  });
76
73
  Object.defineProperty(CommunityClient, "supportedChain", {
77
74
  get: function () {
78
- return CommunityClient.config.chainId;
75
+ return CommunityClient.config.chain;
79
76
  },
80
77
  enumerable: false,
81
78
  configurable: true
82
79
  });
83
- CommunityClient.config = constants_1.SERVICE_CONFIG['test'];
80
+ CommunityClient.config = common_1.API_CLIENT_CONFIGS['test'];
84
81
  return CommunityClient;
85
82
  }());
86
83
  exports.CommunityClient = CommunityClient;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["client/index.ts"],"names":[],"mappings":";;;;;;AAAA,yCAA4D;AAC5D,yDAAyC;AACzC,uDAAuC;AACvC,+DAA+C;AAM/C;;GAEG;AACH;IAOE,yBAAoB,MAAuB;QACzC,eAAe,CAAC,MAAM,GAAG,0BAAc,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QAC5D,IAAI,CAAC,KAAK,GAAG,IAAI,cAAU,CAAC,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC5D,IAAI,CAAC,IAAI,GAAG,IAAI,aAAS,CAAC,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC1D,IAAI,CAAC,QAAQ,GAAG,IAAI,iBAAa,CAC/B,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,EAC1C,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CACxC,CAAC;IACJ,CAAC;IAEa,yBAAS,GAAvB,UAAwB,MAAuB;QAC7C,IACE,CAAC,MAAM,CAAC,WAAW;YACnB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EACzD,CAAC;YACD,MAAM,IAAI,KAAK,CACb,0FAA0F,CAC3F,CAAC;QACJ,CAAC;QACD,eAAe,CAAC,QAAQ,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC;IACzD,CAAC;IAEc,2BAAW,GAA1B;QACE,IAAI,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CACb,6DAA6D,CAC9D,CAAC;QACJ,CAAC;QACD,OAAO,eAAe,CAAC,QAAQ,CAAC;IAClC,CAAC;IASD,sBAAkB,uBAAI;QAPtB;;;;;;WAMG;aACH;YACE,OAAO,eAAe,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC;QAC7C,CAAC;;;OAAA;IASD,sBAAkB,sBAAG;QAPrB;;;;;;WAMG;aACH;YACE,OAAO,eAAe,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC;QAC5C,CAAC;;;OAAA;IASD,sBAAkB,0BAAO;QAPzB;;;;;;WAMG;aACH;YACE,OAAO,eAAe,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC;QAChD,CAAC;;;OAAA;IAED,sBAAkB,iCAAc;aAAhC;YACE,OAAO,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC;QACxC,CAAC;;;OAAA;IAvEc,sBAAM,GAAkB,0BAAc,CAAC,MAAM,CAAC,CAAC;IAwEhE,sBAAC;CAAA,AA1ED,IA0EC;AA1EY,0CAAe","sourcesContent":["import { SERVICE_CONFIG, ServiceConfig } from './constants';\nimport VoteModule from '../modules/vote';\nimport LGEModule from '../modules/lge';\nimport TwitterModule from '../modules/twitter';\n\nexport type ConfigureParams = {\n environment: ServiceConfig['environment'];\n};\n\n/**\n * @description Client for Community SDK\n */\nexport class CommunityClient {\n private static instance: CommunityClient;\n private static config: ServiceConfig = SERVICE_CONFIG['test'];\n private readonly _vote: VoteModule;\n private readonly _LGE: LGEModule;\n private readonly _twitter: TwitterModule;\n\n private constructor(params: ConfigureParams) {\n CommunityClient.config = SERVICE_CONFIG[params.environment];\n this._vote = new VoteModule(CommunityClient.config.chainId);\n this._LGE = new LGEModule(CommunityClient.config.chainId);\n this._twitter = new TwitterModule(\n CommunityClient.config.twitter.redirectURI,\n CommunityClient.config.twitter.clientId,\n );\n }\n\n public static configure(params: ConfigureParams): void {\n if (\n !params.environment ||\n ['test', 'production'].indexOf(params.environment) === -1\n ) {\n throw new Error(\n 'Client environment is incorrect or not provided. Consult the docs about ConfigureParams.',\n );\n }\n CommunityClient.instance = new CommunityClient(params);\n }\n\n private static getInstance(): CommunityClient {\n if (!CommunityClient.instance) {\n throw new Error(\n 'Client is not configured. Please configure it before using.',\n );\n }\n return CommunityClient.instance;\n }\n\n /**\n * Provides access to the VoteModule instance.\n * This getter allows for interacting with vote-related functionalities.\n *\n * @returns {VoteModule} An instance of VoteModule for vote operations.\n * @memberof CommunityClient\n */\n public static get vote(): VoteModule {\n return CommunityClient.getInstance()._vote;\n }\n\n /**\n * Provides access to the LGEModule instance.\n * This getter allows for interacting with LGE-related functionalities.\n *\n * @returns {LGEModule} An instance of LGEModule for LGE operations.\n * @memberof CommunityClient\n */\n public static get LGE(): LGEModule {\n return CommunityClient.getInstance()._LGE;\n }\n\n /**\n * Provides access to the TwitterModule instance.\n * This getter allows for interacting with twitter-related functionalities.\n *\n * @returns {TwitterModule} An instance of Twitter for twitter operations.\n * @memberof CommunityClient\n */\n public static get twitter(): TwitterModule {\n return CommunityClient.getInstance()._twitter;\n }\n\n public static get supportedChain(): number {\n return CommunityClient.config.chainId;\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["client/index.ts"],"names":[],"mappings":";;;;;;AAAA,0CAAoE;AACpE,yDAAyC;AACzC,uDAAuC;AACvC,+DAA+C;AAE/C;;GAEG;AACH;IAQE;QACE,IAAI,CAAC,KAAK,GAAG,IAAI,cAAU,CAAC,eAAe,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QAChE,IAAI,CAAC,IAAI,GAAG,IAAI,aAAS,CAAC,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACxD,IAAI,CAAC,QAAQ,GAAG,IAAI,iBAAa,CAC/B,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,EAC1C,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CACxC,CAAC;IACJ,CAAC;IAEa,yBAAS,GAAvB,UAAwB,WAAyC;QAC/D,eAAe,CAAC,MAAM;YACpB,2BAAkB,CAAC,WAAW,CAAC,IAAI,2BAAkB,CAAC,MAAM,CAAC,CAAC;QAChE,eAAe,CAAC,QAAQ,GAAG,IAAI,eAAe,EAAE,CAAC;IACnD,CAAC;IAEc,2BAAW,GAA1B;QACE,IAAI,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CACb,6DAA6D,CAC9D,CAAC;QACJ,CAAC;QACD,OAAO,eAAe,CAAC,QAAQ,CAAC;IAClC,CAAC;IASD,sBAAkB,uBAAI;QAPtB;;;;;;WAMG;aACH;YACE,OAAO,eAAe,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC;QAC7C,CAAC;;;OAAA;IASD,sBAAkB,sBAAG;QAPrB;;;;;;WAMG;aACH;YACE,OAAO,eAAe,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC;QAC5C,CAAC;;;OAAA;IASD,sBAAkB,0BAAO;QAPzB;;;;;;WAMG;aACH;YACE,OAAO,eAAe,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC;QAChD,CAAC;;;OAAA;IAED,sBAAkB,iCAAc;aAAhC;YACE,OAAO,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC;QACtC,CAAC;;;OAAA;IAjEc,sBAAM,GAAkB,2BAAkB,CAAC,MAAM,CAAC,CAAC;IAkEpE,sBAAC;CAAA,AApED,IAoEC;AApEY,0CAAe","sourcesContent":["import { API_CLIENT_CONFIGS, ServiceConfig } from '@reyaxyz/common';\nimport VoteModule from '../modules/vote';\nimport LGEModule from '../modules/lge';\nimport TwitterModule from '../modules/twitter';\n\n/**\n * @description Client for Community SDK\n */\nexport class CommunityClient {\n private static instance: CommunityClient;\n private static config: ServiceConfig = API_CLIENT_CONFIGS['test'];\n\n private readonly _vote: VoteModule;\n private readonly _LGE: LGEModule;\n private readonly _twitter: TwitterModule;\n\n private constructor() {\n this._vote = new VoteModule(CommunityClient.config.apiEndpoint);\n this._LGE = new LGEModule(CommunityClient.config.chain);\n this._twitter = new TwitterModule(\n CommunityClient.config.twitter.redirectURI,\n CommunityClient.config.twitter.clientId,\n );\n }\n\n public static configure(environment: ServiceConfig['environment']): void {\n CommunityClient.config =\n API_CLIENT_CONFIGS[environment] || API_CLIENT_CONFIGS['test'];\n CommunityClient.instance = new CommunityClient();\n }\n\n private static getInstance(): CommunityClient {\n if (!CommunityClient.instance) {\n throw new Error(\n 'Client is not configured. Please configure it before using.',\n );\n }\n return CommunityClient.instance;\n }\n\n /**\n * Provides access to the VoteModule instance.\n * This getter allows for interacting with vote-related functionalities.\n *\n * @returns {VoteModule} An instance of VoteModule for vote operations.\n * @memberof CommunityClient\n */\n public static get vote(): VoteModule {\n return CommunityClient.getInstance()._vote;\n }\n\n /**\n * Provides access to the LGEModule instance.\n * This getter allows for interacting with LGE-related functionalities.\n *\n * @returns {LGEModule} An instance of LGEModule for LGE operations.\n * @memberof CommunityClient\n */\n public static get LGE(): LGEModule {\n return CommunityClient.getInstance()._LGE;\n }\n\n /**\n * Provides access to the TwitterModule instance.\n * This getter allows for interacting with twitter-related functionalities.\n *\n * @returns {TwitterModule} An instance of Twitter for twitter operations.\n * @memberof CommunityClient\n */\n public static get twitter(): TwitterModule {\n return CommunityClient.getInstance()._twitter;\n }\n\n public static get supportedChain(): number {\n return CommunityClient.config.chain;\n }\n}\n"]}
package/dist/index.js CHANGED
@@ -14,11 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./types"), exports);
18
17
  __exportStar(require("./client"), exports);
19
- __exportStar(require("./modules/vote/services/get-vote-details/types"), exports);
20
- __exportStar(require("./modules/vote/services/get-vote-status/types"), exports);
21
- __exportStar(require("./modules/vote/services/vote/types"), exports);
22
18
  __exportStar(require("./modules/lge/services/get-account-lge-status/types"), exports);
23
19
  __exportStar(require("./modules/lge/services/get-lge-boost-rate/types"), exports);
24
20
  __exportStar(require("./modules/twitter/services/get-auth-url/types"), exports);
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,2CAAyB;AACzB,iFAA+D;AAC/D,gFAA8D;AAC9D,qEAAmD;AACnD,sFAAoE;AACpE,kFAAgE;AAChE,gFAA8D","sourcesContent":["export * from './types';\nexport * from './client';\nexport * from './modules/vote/services/get-vote-details/types';\nexport * from './modules/vote/services/get-vote-status/types';\nexport * from './modules/vote/services/vote/types';\nexport * from './modules/lge/services/get-account-lge-status/types';\nexport * from './modules/lge/services/get-lge-boost-rate/types';\nexport * from './modules/twitter/services/get-auth-url/types';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,sFAAoE;AACpE,kFAAgE;AAChE,gFAA8D","sourcesContent":["export * from './client';\nexport * from './modules/lge/services/get-account-lge-status/types';\nexport * from './modules/lge/services/get-lge-boost-rate/types';\nexport * from './modules/twitter/services/get-auth-url/types';\n"]}
@@ -1,4 +1,19 @@
1
1
  "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
2
17
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
18
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
19
  return new (P || (P = Promise))(function (resolve, reject) {
@@ -36,33 +51,41 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
51
  }
37
52
  };
38
53
  Object.defineProperty(exports, "__esModule", { value: true });
54
+ var common_1 = require("@reyaxyz/common");
39
55
  var services_1 = require("./services");
40
- var VoteModule = /** @class */ (function () {
41
- function VoteModule(chainId) {
42
- this.chainId = chainId;
56
+ var VoteModule = /** @class */ (function (_super) {
57
+ __extends(VoteModule, _super);
58
+ function VoteModule() {
59
+ return _super !== null && _super.apply(this, arguments) || this;
43
60
  }
44
- VoteModule.prototype.getVoteDetails = function (params) {
61
+ // WRITE
62
+ VoteModule.prototype.vote = function (params) {
45
63
  return __awaiter(this, void 0, void 0, function () {
46
64
  return __generator(this, function (_a) {
47
- return [2 /*return*/, (0, services_1.getVoteDetails)(params)];
65
+ return [2 /*return*/, (0, services_1.vote)(params)];
48
66
  });
49
67
  });
50
68
  };
51
- VoteModule.prototype.getVoteStatus = function (params) {
69
+ // READ
70
+ VoteModule.prototype.getVoteDetails = function (params) {
52
71
  return __awaiter(this, void 0, void 0, function () {
72
+ var uri;
53
73
  return __generator(this, function (_a) {
54
- return [2 /*return*/, (0, services_1.getVoteStatus)(params)];
74
+ uri = "/api/vote/".concat(params.id);
75
+ return [2 /*return*/, this.get(uri)];
55
76
  });
56
77
  });
57
78
  };
58
- VoteModule.prototype.vote = function (params) {
79
+ VoteModule.prototype.getVoteStatus = function (params) {
59
80
  return __awaiter(this, void 0, void 0, function () {
81
+ var uri;
60
82
  return __generator(this, function (_a) {
61
- return [2 /*return*/, (0, services_1.vote)(params)];
83
+ uri = "/api/vote/".concat(params.id, "/user/").concat(params.address);
84
+ return [2 /*return*/, this.get(uri)];
62
85
  });
63
86
  });
64
87
  };
65
88
  return VoteModule;
66
- }());
89
+ }(common_1.RestClient));
67
90
  exports.default = VoteModule;
68
91
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/vote/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,uCAOoB;AAEpB;IAGE,oBAAY,OAAoB;QAC9B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAEK,mCAAc,GAApB,UAAqB,MAA4B;;;gBAC/C,sBAAO,IAAA,yBAAc,EAAC,MAAM,CAAC,EAAC;;;KAC/B;IAEK,kCAAa,GAAnB,UAAoB,MAA2B;;;gBAC7C,sBAAO,IAAA,wBAAa,EAAC,MAAM,CAAC,EAAC;;;KAC9B;IAEK,yBAAI,GAAV,UAAW,MAAkB;;;gBAC3B,sBAAO,IAAA,eAAI,EAAC,MAAM,CAAC,EAAC;;;KACrB;IACH,iBAAC;AAAD,CAAC,AAlBD,IAkBC","sourcesContent":["import { ReyaChainId } from '@reyaxyz/common';\nimport {\n getVoteDetails,\n GetVoteDetailsParams,\n getVoteStatus,\n GetVoteStatusParams,\n vote,\n VoteParams,\n} from './services';\n\nexport default class VoteModule {\n private chainId: ReyaChainId;\n\n constructor(chainId: ReyaChainId) {\n this.chainId = chainId;\n }\n\n async getVoteDetails(params: GetVoteDetailsParams) {\n return getVoteDetails(params);\n }\n\n async getVoteStatus(params: GetVoteStatusParams) {\n return getVoteStatus(params);\n }\n\n async vote(params: VoteParams) {\n return vote(params);\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/vote/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAA6C;AAE7C,uCAAkC;AAElC;IAAwC,8BAAU;IAAlD;;IAkBA,CAAC;IAjBC,QAAQ;IAEF,yBAAI,GAAV,UAAW,MAAkB;;;gBAC3B,sBAAO,IAAA,eAAI,EAAC,MAAM,CAAC,EAAC;;;KACrB;IAED,OAAO;IAED,mCAAc,GAApB,UAAqB,MAA4B;;;;gBACzC,GAAG,GAAG,oBAAa,MAAM,CAAC,EAAE,CAAE,CAAC;gBACrC,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAC;;;KACtB;IAEK,kCAAa,GAAnB,UAAoB,MAA2B;;;;gBACvC,GAAG,GAAG,oBAAa,MAAM,CAAC,EAAE,mBAAS,MAAM,CAAC,OAAO,CAAE,CAAC;gBAC5D,sBAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAC;;;KACtB;IACH,iBAAC;AAAD,CAAC,AAlBD,CAAwC,mBAAU,GAkBjD","sourcesContent":["import { RestClient } from '@reyaxyz/common';\nimport { GetVoteDetailsParams, GetVoteStatusParams, VoteParams } from './types';\nimport { vote } from './services';\n\nexport default class VoteModule extends RestClient {\n // WRITE\n\n async vote(params: VoteParams) {\n return vote(params);\n }\n\n // READ\n\n async getVoteDetails(params: GetVoteDetailsParams) {\n const uri = `/api/vote/${params.id}`;\n return this.get(uri);\n }\n\n async getVoteStatus(params: GetVoteStatusParams) {\n const uri = `/api/vote/${params.id}/user/${params.address}`;\n return this.get(uri);\n }\n}\n"]}
@@ -0,0 +1,99 @@
1
+ "use strict";
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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ var __generator = (this && this.__generator) || function (thisArg, body) {
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
+ function verb(n) { return function (v) { return step([n, v]); }; }
26
+ function step(op) {
27
+ if (f) throw new TypeError("Generator is already executing.");
28
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
+ if (y = 0, t) op = [op[0] & 2, t.value];
31
+ switch (op[0]) {
32
+ case 0: case 1: t = op; break;
33
+ case 4: _.label++; return { value: op[1], done: false };
34
+ case 5: _.label++; y = op[1]; op = [0]; continue;
35
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
+ default:
37
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
+ if (t[2]) _.ops.pop();
42
+ _.trys.pop(); continue;
43
+ }
44
+ op = body.call(thisArg, _);
45
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
+ }
48
+ };
49
+ Object.defineProperty(exports, "__esModule", { value: true });
50
+ exports.executeTransaction = exports.estimateGas = void 0;
51
+ var contractAddresses_1 = require("../../../utils/contractAddresses");
52
+ function estimateGas(signer, data, value, chainId, targetContract) {
53
+ return __awaiter(this, void 0, void 0, function () {
54
+ var accountAddress, contractAddress, tx, gasLimit;
55
+ return __generator(this, function (_a) {
56
+ switch (_a.label) {
57
+ case 0: return [4 /*yield*/, signer.getAddress()];
58
+ case 1:
59
+ accountAddress = _a.sent();
60
+ contractAddress = Object.values(contractAddresses_1.ContractType).includes(targetContract)
61
+ ? (0, contractAddresses_1.getAddress)(chainId, targetContract)
62
+ : targetContract;
63
+ tx = __assign({ from: accountAddress, to: contractAddress, data: data }, (value && value !== '0' ? { value: value } : {}));
64
+ gasLimit = BigInt('5000000');
65
+ return [2 /*return*/, __assign(__assign({}, tx), { gasLimit: gasLimit })];
66
+ }
67
+ });
68
+ });
69
+ }
70
+ exports.estimateGas = estimateGas;
71
+ function executeTransaction(signer, data, value, chainId, targetContract) {
72
+ return __awaiter(this, void 0, void 0, function () {
73
+ var txData, txResponse, txReceipt, error_1;
74
+ return __generator(this, function (_a) {
75
+ switch (_a.label) {
76
+ case 0: return [4 /*yield*/, estimateGas(signer, data, value, chainId, targetContract)];
77
+ case 1:
78
+ txData = _a.sent();
79
+ _a.label = 2;
80
+ case 2:
81
+ _a.trys.push([2, 5, , 6]);
82
+ return [4 /*yield*/, signer.sendTransaction(txData)];
83
+ case 3:
84
+ txResponse = _a.sent();
85
+ return [4 /*yield*/, txResponse.wait()];
86
+ case 4:
87
+ txReceipt = _a.sent();
88
+ return [2 /*return*/, txReceipt];
89
+ case 5:
90
+ error_1 = _a.sent();
91
+ console.warn(error_1);
92
+ throw new Error('Transaction Execution Error');
93
+ case 6: return [2 /*return*/];
94
+ }
95
+ });
96
+ });
97
+ }
98
+ exports.executeTransaction = executeTransaction;
99
+ //# sourceMappingURL=executeTransaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executeTransaction.js","sourceRoot":"/","sources":["modules/vote/services/executeTransaction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,sEAA4E;AAS5E,SAAsB,WAAW,CAC/B,MAA8B,EAC9B,IAAY,EACZ,KAAa,EACb,OAAe,EACf,cAAqC;;;;;wBAEd,qBAAM,MAAM,CAAC,UAAU,EAAE,EAAA;;oBAA1C,cAAc,GAAG,SAAyB;oBAC1C,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,gCAAY,CAAC,CAAC,QAAQ,CAC1D,cAA8B,CAC/B;wBACC,CAAC,CAAC,IAAA,8BAAU,EAAC,OAAO,EAAE,cAA8B,CAAC;wBACrD,CAAC,CAAC,cAAc,CAAC;oBACb,EAAE,cACN,IAAI,EAAE,cAAc,EACpB,EAAE,EAAE,eAAe,EACnB,IAAI,MAAA,IACD,CAAC,KAAK,IAAI,KAAK,KAAK,GAAG,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CACpD,CAAC;oBAEI,QAAQ,GAAW,MAAM,CAAC,SAAS,CAAC,CAAC;oBAC3C,4CAAY,EAAE,KAAE,QAAQ,UAAA,KAAG;;;;CAC5B;AAtBD,kCAsBC;AAED,SAAsB,kBAAkB,CACtC,MAA8B,EAC9B,IAAY,EACZ,KAAa,EACb,OAAe,EACf,cAAqC;;;;;wBAEtB,qBAAM,WAAW,CAC9B,MAAM,EACN,IAAI,EACJ,KAAK,EACL,OAAO,EACP,cAAc,CACf,EAAA;;oBANK,MAAM,GAAG,SAMd;;;;oBAGoB,qBAAM,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,EAAA;;oBAAjD,UAAU,GAAG,SAAoC;oBACrC,qBAAM,UAAU,CAAC,IAAI,EAAE,EAAA;;oBAAnC,SAAS,GAAG,SAAuB;oBACzC,sBAAO,SAAS,EAAC;;;oBAEjB,OAAO,CAAC,IAAI,CAAC,OAAK,CAAC,CAAC;oBACpB,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;;;;;CAElD;AAvBD,gDAuBC","sourcesContent":["import { JsonRpcSigner, Signer } from 'ethers';\nimport { ContractType, getAddress } from '../../../utils/contractAddresses';\n\nexport type Transaction = {\n from: string;\n to: string;\n data: string;\n value?: string;\n};\n\nexport async function estimateGas(\n signer: Signer | JsonRpcSigner,\n data: string,\n value: string,\n chainId: number,\n targetContract: ContractType | string,\n): Promise<Transaction & { gasLimit: bigint }> {\n const accountAddress = await signer.getAddress();\n const contractAddress = Object.values(ContractType).includes(\n targetContract as ContractType,\n )\n ? getAddress(chainId, targetContract as ContractType)\n : targetContract;\n const tx = {\n from: accountAddress,\n to: contractAddress,\n data,\n ...(value && value !== '0' ? { value: value } : {}),\n };\n\n const gasLimit: bigint = BigInt('5000000'); // hardcode to 5m gas limit\n return { ...tx, gasLimit };\n}\n\nexport async function executeTransaction(\n signer: Signer | JsonRpcSigner,\n data: string,\n value: string,\n chainId: number,\n targetContract: ContractType | string,\n) {\n const txData = await estimateGas(\n signer,\n data,\n value,\n chainId,\n targetContract,\n );\n\n try {\n const txResponse = await signer.sendTransaction(txData);\n const txReceipt = await txResponse.wait();\n return txReceipt;\n } catch (error) {\n console.warn(error);\n throw new Error('Transaction Execution Error');\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/vote/services/get-vote-details/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,SAAS,cAAc,CAAC,EAAU;IAChC,IAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,gCAAgC;IAClG,OAAO;QACL,EAAE,IAAA;QACF,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;QACrB,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,SAAS,EAAE,yBAAyB;QAChF,gBAAgB,EAAE,CAAC;QACnB,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC;QACzC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC;KACzC,CAAC;AACJ,CAAC;AAED,oCAAoC;AACpC,gHAAgH;AACzG,IAAM,cAAc,GAAG,UAAO,EAEd;QADrB,EAAE,QAAA;;;;wBAEK,qBAAM,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;wBACvC,UAAU,CACR;4BACE,IAAM,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE,CAAC;4BACvC,IAAI,KAAK,EAAE,CAAC;gCACV,MAAM,CAAC,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC;4BACtC,CAAC;4BACD,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC;wBAC9B,CAAC,EACD,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,IAAI,CAC3B,CAAC;oBACJ,CAAC,CAAC,EAAA;wBAXF,sBAAO,SAWL,EAAC;;;;CACJ,CAAC;AAfW,QAAA,cAAc,kBAezB","sourcesContent":["import { VoteDetailsEntity } from '../../../../types';\nimport { GetVoteDetailsParams, GetVoteDetailsResult } from './types';\n\nfunction mockVoteEntity(id: number): VoteDetailsEntity {\n const daysToAdd = Math.floor(Math.random() * (30 - 14 + 1)) + 14; // Random days between 14 and 30\n return {\n id,\n startDate: Date.now(),\n endDate: Date.now() + 1000 * 60 * 60 * 24 * daysToAdd, // 14 to 30 days from now\n percentageToPass: 4,\n yesCount: Math.floor(Math.random() * 100),\n noCount: Math.floor(Math.random() * 100),\n };\n}\n\n// TODO: Write proper implementation\n// TODO: Note if vote details cannot be found throw new Error('Vote not found') UI will have logic based on this\nexport const getVoteDetails = async ({\n id,\n}: GetVoteDetailsParams): Promise<GetVoteDetailsResult> => {\n return await new Promise((resolve, reject) => {\n setTimeout(\n () => {\n const error = Math.random() * 100 > 50;\n if (error) {\n reject(new Error('Vote not found'));\n }\n resolve(mockVoteEntity(id));\n },\n Math.random() * 100 + 1000,\n );\n });\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/vote/services/get-vote-details/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,SAAS,cAAc,CAAC,EAAU;IAChC,IAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC,gCAAgC;IAClG,OAAO;QACL,EAAE,IAAA;QACF,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;QACrB,OAAO,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,SAAS,EAAE,yBAAyB;QAChF,gBAAgB,EAAE,CAAC;QACnB,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC;QACzC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC;KACzC,CAAC;AACJ,CAAC;AAED,oCAAoC;AACpC,gHAAgH;AACzG,IAAM,cAAc,GAAG,UAAO,EAEd;QADrB,EAAE,QAAA;;;;wBAEK,qBAAM,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;wBACvC,UAAU,CACR;4BACE,IAAM,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE,CAAC;4BACvC,IAAI,KAAK,EAAE,CAAC;gCACV,MAAM,CAAC,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC;4BACtC,CAAC;4BACD,OAAO,CAAC,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC;wBAC9B,CAAC,EACD,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,IAAI,CAC3B,CAAC;oBACJ,CAAC,CAAC,EAAA;wBAXF,sBAAO,SAWL,EAAC;;;;CACJ,CAAC;AAfW,QAAA,cAAc,kBAezB","sourcesContent":["import { VoteDetailsEntity } from '@reyaxyz/common';\nimport { GetVoteDetailsParams, GetVoteDetailsResult } from '../../types';\n\nfunction mockVoteEntity(id: number): VoteDetailsEntity {\n const daysToAdd = Math.floor(Math.random() * (30 - 14 + 1)) + 14; // Random days between 14 and 30\n return {\n id,\n startDate: Date.now(),\n endDate: Date.now() + 1000 * 60 * 60 * 24 * daysToAdd, // 14 to 30 days from now\n percentageToPass: 4,\n yesCount: Math.floor(Math.random() * 100),\n noCount: Math.floor(Math.random() * 100),\n };\n}\n\n// TODO: Write proper implementation\n// TODO: Note if vote details cannot be found throw new Error('Vote not found') UI will have logic based on this\nexport const getVoteDetails = async ({\n id,\n}: GetVoteDetailsParams): Promise<GetVoteDetailsResult> => {\n return await new Promise((resolve, reject) => {\n setTimeout(\n () => {\n const error = Math.random() * 100 > 50;\n if (error) {\n reject(new Error('Vote not found'));\n }\n resolve(mockVoteEntity(id));\n },\n Math.random() * 100 + 1000,\n );\n });\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/vote/services/get-vote-status/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,SAAS,oBAAoB;IAC3B,OAAO;QACL,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,wCAAwC;QACvF,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,EAAE,yBAAyB;KACzD,CAAC;AACJ,CAAC;AAED,oCAAoC;AAC7B,IAAM,aAAa,GAAG,UAAO,EAGd;QAFpB,EAAE,QAAA,EACF,OAAO,aAAA;;;;wBAEA,qBAAM,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;wBACvC,UAAU,CACR;4BACE,IAAM,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE,CAAC;4BACvC,IAAI,KAAK,EAAE,CAAC;gCACV,MAAM,CAAC,IAAI,KAAK,CAAC,eAAQ,EAAE,eAAK,OAAO,WAAQ,CAAC,CAAC,CAAC;4BACpD,CAAC;4BACD,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAAC;wBAClC,CAAC,EACD,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,IAAI,CAC3B,CAAC;oBACJ,CAAC,CAAC,EAAA;wBAXF,sBAAO,SAWL,EAAC;;;;CACJ,CAAC;AAhBW,QAAA,aAAa,iBAgBxB","sourcesContent":["import { VoteStatusEntity } from '../../../../types';\nimport { GetVoteStatusParams, GetVoteStatusResult } from './types';\n\nfunction mockVoteStatusEntity(): VoteStatusEntity {\n return {\n votingPower: Math.floor(Math.random() * 1000), // Random voting power between 0 and 999\n hasVoted: Math.random() < 0.5, // Randomly true or false\n };\n}\n\n// TODO: Write proper implementation\nexport const getVoteStatus = async ({\n id,\n address,\n}: GetVoteStatusParams): Promise<GetVoteStatusResult> => {\n return await new Promise((resolve, reject) => {\n setTimeout(\n () => {\n const error = Math.random() * 100 > 50;\n if (error) {\n reject(new Error(`Vote ${id}, ${address} error`));\n }\n resolve(mockVoteStatusEntity());\n },\n Math.random() * 100 + 1000,\n );\n });\n};\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/vote/services/get-vote-status/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,SAAS,oBAAoB;IAC3B,OAAO;QACL,WAAW,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,EAAE,wCAAwC;QACvF,QAAQ,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,EAAE,yBAAyB;KACzD,CAAC;AACJ,CAAC;AAED,oCAAoC;AAC7B,IAAM,aAAa,GAAG,UAAO,EAGd;QAFpB,EAAE,QAAA,EACF,OAAO,aAAA;;;;wBAEA,qBAAM,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;wBACvC,UAAU,CACR;4BACE,IAAM,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE,CAAC;4BACvC,IAAI,KAAK,EAAE,CAAC;gCACV,MAAM,CAAC,IAAI,KAAK,CAAC,eAAQ,EAAE,eAAK,OAAO,WAAQ,CAAC,CAAC,CAAC;4BACpD,CAAC;4BACD,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAAC;wBAClC,CAAC,EACD,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,IAAI,CAC3B,CAAC;oBACJ,CAAC,CAAC,EAAA;wBAXF,sBAAO,SAWL,EAAC;;;;CACJ,CAAC;AAhBW,QAAA,aAAa,iBAgBxB","sourcesContent":["import { VoteStatusEntity } from '@reyaxyz/common';\nimport { GetVoteStatusParams, GetVoteStatusResult } from '../../types';\n\nfunction mockVoteStatusEntity(): VoteStatusEntity {\n return {\n votingPower: Math.floor(Math.random() * 1000), // Random voting power between 0 and 999\n hasVoted: Math.random() < 0.5, // Randomly true or false\n };\n}\n\n// TODO: Write proper implementation\nexport const getVoteStatus = async ({\n id,\n address,\n}: GetVoteStatusParams): Promise<GetVoteStatusResult> => {\n return await new Promise((resolve, reject) => {\n setTimeout(\n () => {\n const error = Math.random() * 100 > 50;\n if (error) {\n reject(new Error(`Vote ${id}, ${address} error`));\n }\n resolve(mockVoteStatusEntity());\n },\n Math.random() * 100 + 1000,\n );\n });\n};\n"]}
@@ -17,7 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./get-vote-details"), exports);
18
18
  __exportStar(require("./get-vote-status"), exports);
19
19
  __exportStar(require("./vote"), exports);
20
- __exportStar(require("./get-vote-details/types"), exports);
21
- __exportStar(require("./get-vote-status/types"), exports);
22
- __exportStar(require("./vote/types"), exports);
23
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/vote/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,oDAAkC;AAClC,yCAAuB;AACvB,2DAAyC;AACzC,0DAAwC;AACxC,+CAA6B","sourcesContent":["export * from './get-vote-details';\nexport * from './get-vote-status';\nexport * from './vote';\nexport * from './get-vote-details/types';\nexport * from './get-vote-status/types';\nexport * from './vote/types';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/vote/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,qDAAmC;AACnC,oDAAkC;AAClC,yCAAuB","sourcesContent":["export * from './get-vote-details';\nexport * from './get-vote-status';\nexport * from './vote';\n"]}
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.encodeCastVote = void 0;
4
+ var ethers_1 = require("ethers");
5
+ var castVoteabi = ['function castVote(bool yesVote)'];
6
+ var encodeCastVote = function (yesVote) {
7
+ var functionSignature = 'castVote';
8
+ var parameters = [yesVote];
9
+ var INTERFACE = new ethers_1.Interface(castVoteabi);
10
+ var calldata = INTERFACE.encodeFunctionData(functionSignature, parameters);
11
+ return { calldata: calldata, value: BigInt(0).toString(10) };
12
+ };
13
+ exports.encodeCastVote = encodeCastVote;
14
+ //# sourceMappingURL=encode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encode.js","sourceRoot":"/","sources":["modules/vote/services/vote/encode.ts"],"names":[],"mappings":";;;AAAA,iCAAmC;AAGnC,IAAM,WAAW,GAAG,CAAC,iCAAiC,CAAC,CAAC;AAEjD,IAAM,cAAc,GAAG,UAAC,OAAgB;IAC7C,IAAM,iBAAiB,GAAG,UAAU,CAAC;IACrC,IAAM,UAAU,GAAG,CAAC,OAAO,CAAC,CAAC;IAC7B,IAAM,SAAS,GAAG,IAAI,kBAAS,CAAC,WAAW,CAAC,CAAC;IAC7C,IAAM,QAAQ,GAAG,SAAS,CAAC,kBAAkB,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC;IAC7E,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;AAC/D,CAAC,CAAC;AANW,QAAA,cAAc,kBAMzB","sourcesContent":["import { Interface } from 'ethers';\nimport { MethodParameters } from '../../../../utils/action';\n\nconst castVoteabi = ['function castVote(bool yesVote)'];\n\nexport const encodeCastVote = (yesVote: boolean): MethodParameters => {\n const functionSignature = 'castVote';\n const parameters = [yesVote];\n const INTERFACE = new Interface(castVoteabi);\n const calldata = INTERFACE.encodeFunctionData(functionSignature, parameters);\n return { calldata: calldata, value: BigInt(0).toString(10) };\n};\n"]}
@@ -37,27 +37,28 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.vote = void 0;
40
- // TODO: Write proper implementation
41
- var vote = function (_a) {
42
- var id = _a.id;
43
- return __awaiter(void 0, void 0, void 0, function () {
44
- return __generator(this, function (_b) {
45
- switch (_b.label) {
46
- case 0: return [4 /*yield*/, new Promise(function (resolve, reject) {
47
- setTimeout(function () {
48
- var error = Math.random() * 100 > 50;
49
- if (error) {
50
- reject(new Error("Vote ".concat(id, " error")));
51
- }
52
- resolve({
53
- transactionHash: '0x123fake',
54
- });
55
- }, Math.random() * 100 + 1000);
56
- })];
57
- case 1: return [2 /*return*/, _b.sent()];
58
- }
59
- });
40
+ var contractAddresses_1 = require("../../../../utils/contractAddresses");
41
+ var executeTransaction_1 = require("../executeTransaction");
42
+ var encode_1 = require("./encode");
43
+ var vote = function (params) { return __awaiter(void 0, void 0, void 0, function () {
44
+ var _a, data, value, network, chainId, result;
45
+ var _b;
46
+ return __generator(this, function (_c) {
47
+ switch (_c.label) {
48
+ case 0:
49
+ _a = (0, encode_1.encodeCastVote)(params.voted == 'yes'), data = _a.calldata, value = _a.value;
50
+ return [4 /*yield*/, ((_b = params.signer.provider) === null || _b === void 0 ? void 0 : _b.getNetwork())];
51
+ case 1:
52
+ network = _c.sent();
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)];
55
+ case 2:
56
+ result = _c.sent();
57
+ return [2 /*return*/, {
58
+ transactionHash: (result === null || result === void 0 ? void 0 : result.hash) || null,
59
+ }];
60
+ }
60
61
  });
61
- };
62
+ }); };
62
63
  exports.vote = vote;
63
64
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/vote/services/vote/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,oCAAoC;AAC7B,IAAM,IAAI,GAAG,UAAO,EAAkB;QAAhB,EAAE,QAAA;;;;wBACtB,qBAAM,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;wBACvC,UAAU,CACR;4BACE,IAAM,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE,CAAC;4BACvC,IAAI,KAAK,EAAE,CAAC;gCACV,MAAM,CAAC,IAAI,KAAK,CAAC,eAAQ,EAAE,WAAQ,CAAC,CAAC,CAAC;4BACxC,CAAC;4BACD,OAAO,CAAC;gCACN,eAAe,EAAE,WAAW;6BAC7B,CAAC,CAAC;wBACL,CAAC,EACD,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,IAAI,CAC3B,CAAC;oBACJ,CAAC,CAAC,EAAA;wBAbF,sBAAO,SAaL,EAAC;;;;CACJ,CAAC;AAfW,QAAA,IAAI,QAef","sourcesContent":["import { VoteParams, VoteResult } from './types';\n\n// TODO: Write proper implementation\nexport const vote = async ({ id }: VoteParams): Promise<VoteResult> => {\n return await new Promise((resolve, reject) => {\n setTimeout(\n () => {\n const error = Math.random() * 100 > 50;\n if (error) {\n reject(new Error(`Vote ${id} error`));\n }\n resolve({\n transactionHash: '0x123fake',\n });\n },\n Math.random() * 100 + 1000,\n );\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;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"]}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"/","sources":["modules/vote/types.ts"],"names":[],"mappings":"","sourcesContent":["import { JsonRpcSigner, Signer } from 'ethers';\nimport { VoteDetailsEntity, VoteStatusEntity } from '@reyaxyz/common';\n\nexport type VoteResult = {\n transactionHash: string | null;\n};\n\nexport type GetVoteDetailsParams = {\n id: VoteDetailsEntity['id'];\n};\nexport type GetVoteDetailsResult = VoteDetailsEntity;\n\nexport type VoteParams = {\n id: VoteDetailsEntity['id'];\n voted: 'yes' | 'no';\n signer: Signer | JsonRpcSigner;\n};\n\nexport type GetVoteStatusParams = {\n address: string;\n id: VoteDetailsEntity['id'];\n};\nexport type GetVoteStatusResult = VoteStatusEntity;\n"]}
@@ -1,10 +1,7 @@
1
- import { ServiceConfig } from './constants';
1
+ import { ServiceConfig } from '@reyaxyz/common';
2
2
  import VoteModule from '../modules/vote';
3
3
  import LGEModule from '../modules/lge';
4
4
  import TwitterModule from '../modules/twitter';
5
- export type ConfigureParams = {
6
- environment: ServiceConfig['environment'];
7
- };
8
5
  /**
9
6
  * @description Client for Community SDK
10
7
  */
@@ -15,7 +12,7 @@ export declare class CommunityClient {
15
12
  private readonly _LGE;
16
13
  private readonly _twitter;
17
14
  private constructor();
18
- static configure(params: ConfigureParams): void;
15
+ static configure(environment: ServiceConfig['environment']): void;
19
16
  private static getInstance;
20
17
  /**
21
18
  * Provides access to the VoteModule instance.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAE/C,MAAM,MAAM,eAAe,GAAG;IAC5B,WAAW,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;CAC3C,CAAC;AAEF;;GAEG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAkB;IACzC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAyC;IAC9D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAa;IACnC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAY;IACjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgB;IAEzC,OAAO;WAUO,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI;IAYtD,OAAO,CAAC,MAAM,CAAC,WAAW;IAS1B;;;;;;OAMG;IACH,WAAkB,IAAI,IAAI,UAAU,CAEnC;IAED;;;;;;OAMG;IACH,WAAkB,GAAG,IAAI,SAAS,CAEjC;IAED;;;;;;OAMG;IACH,WAAkB,OAAO,IAAI,aAAa,CAEzC;IAED,WAAkB,cAAc,IAAI,MAAM,CAEzC;CACF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAE/C;;GAEG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAkB;IACzC,OAAO,CAAC,MAAM,CAAC,MAAM,CAA6C;IAElE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAa;IACnC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAY;IACjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgB;IAEzC,OAAO;WASO,SAAS,CAAC,WAAW,EAAE,aAAa,CAAC,aAAa,CAAC,GAAG,IAAI;IAMxE,OAAO,CAAC,MAAM,CAAC,WAAW;IAS1B;;;;;;OAMG;IACH,WAAkB,IAAI,IAAI,UAAU,CAEnC;IAED;;;;;;OAMG;IACH,WAAkB,GAAG,IAAI,SAAS,CAEjC;IAED;;;;;;OAMG;IACH,WAAkB,OAAO,IAAI,aAAa,CAEzC;IAED,WAAkB,cAAc,IAAI,MAAM,CAEzC;CACF"}
@@ -1,8 +1,4 @@
1
- export * from './types';
2
1
  export * from './client';
3
- export * from './modules/vote/services/get-vote-details/types';
4
- export * from './modules/vote/services/get-vote-status/types';
5
- export * from './modules/vote/services/vote/types';
6
2
  export * from './modules/lge/services/get-account-lge-status/types';
7
3
  export * from './modules/lge/services/get-lge-boost-rate/types';
8
4
  export * from './modules/twitter/services/get-auth-url/types';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,gDAAgD,CAAC;AAC/D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,oCAAoC,CAAC;AACnD,cAAc,qDAAqD,CAAC;AACpE,cAAc,iDAAiD,CAAC;AAChE,cAAc,+CAA+C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,qDAAqD,CAAC;AACpE,cAAc,iDAAiD,CAAC;AAChE,cAAc,+CAA+C,CAAC"}
@@ -1,10 +1,8 @@
1
- import { ReyaChainId } from '@reyaxyz/common';
2
- import { GetVoteDetailsParams, GetVoteStatusParams, VoteParams } from './services';
3
- export default class VoteModule {
4
- private chainId;
5
- constructor(chainId: ReyaChainId);
6
- getVoteDetails(params: GetVoteDetailsParams): Promise<import("../..").VoteDetailsEntity>;
7
- getVoteStatus(params: GetVoteStatusParams): Promise<import("../..").VoteStatusEntity>;
8
- vote(params: VoteParams): Promise<import("./services").VoteResult>;
1
+ import { RestClient } from '@reyaxyz/common';
2
+ import { GetVoteDetailsParams, GetVoteStatusParams, VoteParams } from './types';
3
+ export default class VoteModule extends RestClient {
4
+ vote(params: VoteParams): Promise<import("./types").VoteResult>;
5
+ getVoteDetails(params: GetVoteDetailsParams): Promise<unknown>;
6
+ getVoteStatus(params: GetVoteStatusParams): Promise<unknown>;
9
7
  }
10
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/vote/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAEL,oBAAoB,EAEpB,mBAAmB,EAEnB,UAAU,EACX,MAAM,YAAY,CAAC;AAEpB,MAAM,CAAC,OAAO,OAAO,UAAU;IAC7B,OAAO,CAAC,OAAO,CAAc;gBAEjB,OAAO,EAAE,WAAW;IAI1B,cAAc,CAAC,MAAM,EAAE,oBAAoB;IAI3C,aAAa,CAAC,MAAM,EAAE,mBAAmB;IAIzC,IAAI,CAAC,MAAM,EAAE,UAAU;CAG9B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/vote/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGhF,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,UAAU;IAG1C,IAAI,CAAC,MAAM,EAAE,UAAU;IAMvB,cAAc,CAAC,MAAM,EAAE,oBAAoB;IAK3C,aAAa,CAAC,MAAM,EAAE,mBAAmB;CAIhD"}
@@ -0,0 +1,13 @@
1
+ import { JsonRpcSigner, Signer } from 'ethers';
2
+ import { ContractType } from '../../../utils/contractAddresses';
3
+ export type Transaction = {
4
+ from: string;
5
+ to: string;
6
+ data: string;
7
+ value?: string;
8
+ };
9
+ export declare function estimateGas(signer: Signer | JsonRpcSigner, data: string, value: string, chainId: number, targetContract: ContractType | string): Promise<Transaction & {
10
+ gasLimit: bigint;
11
+ }>;
12
+ export declare function executeTransaction(signer: Signer | JsonRpcSigner, data: string, value: string, chainId: number, targetContract: ContractType | string): Promise<import("ethers").TransactionReceipt | null>;
13
+ //# sourceMappingURL=executeTransaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"executeTransaction.d.ts","sourceRoot":"/","sources":["modules/vote/services/executeTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAc,MAAM,kCAAkC,CAAC;AAE5E,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wBAAsB,WAAW,CAC/B,MAAM,EAAE,MAAM,GAAG,aAAa,EAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,YAAY,GAAG,MAAM,GACpC,OAAO,CAAC,WAAW,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAgB7C;AAED,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,MAAM,GAAG,aAAa,EAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,YAAY,GAAG,MAAM,uDAkBtC"}
@@ -1,3 +1,3 @@
1
- import { GetVoteDetailsParams, GetVoteDetailsResult } from './types';
1
+ import { GetVoteDetailsParams, GetVoteDetailsResult } from '../../types';
2
2
  export declare const getVoteDetails: ({ id, }: GetVoteDetailsParams) => Promise<GetVoteDetailsResult>;
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/vote/services/get-vote-details/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAgBrE,eAAO,MAAM,cAAc,YAExB,oBAAoB,KAAG,QAAQ,oBAAoB,CAarD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/vote/services/get-vote-details/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAgBzE,eAAO,MAAM,cAAc,YAExB,oBAAoB,KAAG,QAAQ,oBAAoB,CAarD,CAAC"}
@@ -1,3 +1,3 @@
1
- import { GetVoteStatusParams, GetVoteStatusResult } from './types';
1
+ import { GetVoteStatusParams, GetVoteStatusResult } from '../../types';
2
2
  export declare const getVoteStatus: ({ id, address, }: GetVoteStatusParams) => Promise<GetVoteStatusResult>;
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/vote/services/get-vote-status/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAUnE,eAAO,MAAM,aAAa,qBAGvB,mBAAmB,KAAG,QAAQ,mBAAmB,CAanD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/vote/services/get-vote-status/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAUvE,eAAO,MAAM,aAAa,qBAGvB,mBAAmB,KAAG,QAAQ,mBAAmB,CAanD,CAAC"}
@@ -1,7 +1,4 @@
1
1
  export * from './get-vote-details';
2
2
  export * from './get-vote-status';
3
3
  export * from './vote';
4
- export * from './get-vote-details/types';
5
- export * from './get-vote-status/types';
6
- export * from './vote/types';
7
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/vote/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,cAAc,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/vote/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { MethodParameters } from '../../../../utils/action';
2
+ export declare const encodeCastVote: (yesVote: boolean) => MethodParameters;
3
+ //# sourceMappingURL=encode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encode.d.ts","sourceRoot":"/","sources":["modules/vote/services/vote/encode.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAI5D,eAAO,MAAM,cAAc,YAAa,OAAO,KAAG,gBAMjD,CAAC"}
@@ -1,3 +1,3 @@
1
- import { VoteParams, VoteResult } from './types';
2
- export declare const vote: ({ id }: VoteParams) => Promise<VoteResult>;
1
+ import { VoteParams, VoteResult } from '../../types';
2
+ export declare const vote: (params: VoteParams) => Promise<VoteResult>;
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/vote/services/vote/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAGjD,eAAO,MAAM,IAAI,WAAkB,UAAU,KAAG,QAAQ,UAAU,CAejE,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,CAiBjE,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { JsonRpcSigner, Signer } from 'ethers';
2
+ import { VoteDetailsEntity, VoteStatusEntity } from '@reyaxyz/common';
3
+ export type VoteResult = {
4
+ transactionHash: string | null;
5
+ };
6
+ export type GetVoteDetailsParams = {
7
+ id: VoteDetailsEntity['id'];
8
+ };
9
+ export type GetVoteDetailsResult = VoteDetailsEntity;
10
+ export type VoteParams = {
11
+ id: VoteDetailsEntity['id'];
12
+ voted: 'yes' | 'no';
13
+ signer: Signer | JsonRpcSigner;
14
+ };
15
+ export type GetVoteStatusParams = {
16
+ address: string;
17
+ id: VoteDetailsEntity['id'];
18
+ };
19
+ export type GetVoteStatusResult = VoteStatusEntity;
20
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["modules/vote/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEtE,MAAM,MAAM,UAAU,GAAG;IACvB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,EAAE,EAAE,iBAAiB,CAAC,IAAI,CAAC,CAAC;CAC7B,CAAC;AACF,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,CAAC;AAErD,MAAM,MAAM,UAAU,GAAG;IACvB,EAAE,EAAE,iBAAiB,CAAC,IAAI,CAAC,CAAC;IAC5B,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,iBAAiB,CAAC,IAAI,CAAC,CAAC;CAC7B,CAAC;AACF,MAAM,MAAM,mBAAmB,GAAG,gBAAgB,CAAC"}