@reyaxyz/community-sdk 0.13.1 → 0.13.3

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":"types.js","sourceRoot":"/","sources":["modules/lge/types.ts"],"names":[],"mappings":"","sourcesContent":["export {\n GetAccountLGEStatusParams,\n GetAccountLGEStatusResult,\n GetLGEBoostRateParams,\n GetLGEBoostRateResult,\n} from '@reyaxyz/common';\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"/","sources":["modules/lge/types.ts"],"names":[],"mappings":"","sourcesContent":["export {\n GetAccountLGEStatusParams,\n GetAccountLGEStatusResult,\n GetLGEBoostRateParams,\n GetLGEBoostRateResult,\n XPEntity,\n} from '@reyaxyz/common';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/vote/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAA6C;AAQ7C,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,CAAuB,GAAG,CAAC,EAAC;;;KAC5C;IAEK,kCAAa,GAAnB,UAAoB,MAA2B;;;;gBACvC,GAAG,GAAG,oBAAa,MAAM,CAAC,EAAE,mBAAS,MAAM,CAAC,OAAO,CAAE,CAAC;gBAC5D,sBAAO,IAAI,CAAC,GAAG,CAAsB,GAAG,CAAC,EAAC;;;KAC3C;IACH,iBAAC;AAAD,CAAC,AAlBD,CAAwC,mBAAU,GAkBjD","sourcesContent":["import { RestClient } from '@reyaxyz/common';\nimport {\n GetVoteDetailsParams,\n GetVoteDetailsResult,\n GetVoteStatusParams,\n GetVoteStatusResult,\n VoteParams,\n} 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<GetVoteDetailsResult>(uri);\n }\n\n async getVoteStatus(params: GetVoteStatusParams) {\n const uri = `/api/vote/${params.id}/user/${params.address}`;\n return this.get<GetVoteStatusResult>(uri);\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/vote/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAA6C;AAQ7C,uCAAkC;AAElC;IAAwC,8BAAU;IAAlD;;IAgBA,CAAC;IAfC,QAAQ;IACF,yBAAI,GAAV,UAAW,MAAkB;;;gBAC3B,sBAAO,IAAA,eAAI,EAAC,MAAM,CAAC,EAAC;;;KACrB;IAED,OAAO;IACD,mCAAc,GAApB,UAAqB,MAA4B;;;;gBACzC,GAAG,GAAG,oBAAa,MAAM,CAAC,EAAE,CAAE,CAAC;gBACrC,sBAAO,IAAI,CAAC,GAAG,CAAuB,GAAG,CAAC,EAAC;;;KAC5C;IAEK,kCAAa,GAAnB,UAAoB,MAA2B;;;;gBACvC,GAAG,GAAG,oBAAa,MAAM,CAAC,EAAE,mBAAS,MAAM,CAAC,OAAO,CAAE,CAAC;gBAC5D,sBAAO,IAAI,CAAC,GAAG,CAAsB,GAAG,CAAC,EAAC;;;KAC3C;IACH,iBAAC;AAAD,CAAC,AAhBD,CAAwC,mBAAU,GAgBjD","sourcesContent":["import { RestClient } from '@reyaxyz/common';\nimport {\n GetVoteDetailsParams,\n GetVoteDetailsResult,\n GetVoteStatusParams,\n GetVoteStatusResult,\n VoteParams,\n} from './types';\nimport { vote } from './services';\n\nexport default class VoteModule extends RestClient {\n // WRITE\n async vote(params: VoteParams) {\n return vote(params);\n }\n\n // READ\n async getVoteDetails(params: GetVoteDetailsParams) {\n const uri = `/api/vote/${params.id}`;\n return this.get<GetVoteDetailsResult>(uri);\n }\n\n async getVoteStatus(params: GetVoteStatusParams) {\n const uri = `/api/vote/${params.id}/user/${params.address}`;\n return this.get<GetVoteStatusResult>(uri);\n }\n}\n"]}
@@ -14,7 +14,5 @@ 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("./get-vote-details"), exports);
18
- __exportStar(require("./get-vote-status"), exports);
19
17
  __exportStar(require("./vote"), exports);
20
18
  //# 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","sourcesContent":["export * from './get-vote-details';\nexport * from './get-vote-status';\nexport * from './vote';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/vote/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB","sourcesContent":["export * from './vote';\n"]}
@@ -1,2 +1,2 @@
1
- export { GetAccountLGEStatusParams, GetAccountLGEStatusResult, GetLGEBoostRateParams, GetLGEBoostRateResult, } from '@reyaxyz/common';
1
+ export { GetAccountLGEStatusParams, GetAccountLGEStatusResult, GetLGEBoostRateParams, GetLGEBoostRateResult, XPEntity, } from '@reyaxyz/common';
2
2
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["modules/lge/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["modules/lge/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,QAAQ,GACT,MAAM,iBAAiB,CAAC"}
@@ -1 +1 @@
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,EACL,oBAAoB,EAEpB,mBAAmB,EAEnB,UAAU,EACX,MAAM,SAAS,CAAC;AAGjB,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"}
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,EACL,oBAAoB,EAEpB,mBAAmB,EAEnB,UAAU,EACX,MAAM,SAAS,CAAC;AAGjB,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,UAAU;IAE1C,IAAI,CAAC,MAAM,EAAE,UAAU;IAKvB,cAAc,CAAC,MAAM,EAAE,oBAAoB;IAK3C,aAAa,CAAC,MAAM,EAAE,mBAAmB;CAIhD"}
@@ -1,4 +1,2 @@
1
- export * from './get-vote-details';
2
- export * from './get-vote-status';
3
1
  export * from './vote';
4
2
  //# 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"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/vote/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reyaxyz/community-sdk",
3
- "version": "0.13.1",
3
+ "version": "0.13.3",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -10,8 +10,8 @@
10
10
  "url": "https://github.com/Reya-Labs/reya-off-chain-monorepo.git"
11
11
  },
12
12
  "dependencies": {
13
- "@reyaxyz/common": "0.42.0",
14
- "@reyaxyz/sdk": "0.32.4",
13
+ "@reyaxyz/common": "0.43.0",
14
+ "@reyaxyz/sdk": "0.32.5",
15
15
  "ethers": "6.9.0"
16
16
  },
17
17
  "main": "dist/index.js",
@@ -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": "d9441d9e3b4e3b2ad907a6733ef3d83dbd6e17e0"
41
+ "gitHead": "18894640bcf98fce992197fe02eefa8ca99d3bee"
42
42
  }
@@ -3,4 +3,5 @@ export {
3
3
  GetAccountLGEStatusResult,
4
4
  GetLGEBoostRateParams,
5
5
  GetLGEBoostRateResult,
6
+ XPEntity,
6
7
  } from '@reyaxyz/common';
@@ -10,13 +10,11 @@ import { vote } from './services';
10
10
 
11
11
  export default class VoteModule extends RestClient {
12
12
  // WRITE
13
-
14
13
  async vote(params: VoteParams) {
15
14
  return vote(params);
16
15
  }
17
16
 
18
17
  // READ
19
-
20
18
  async getVoteDetails(params: GetVoteDetailsParams) {
21
19
  const uri = `/api/vote/${params.id}`;
22
20
  return this.get<GetVoteDetailsResult>(uri);
@@ -1,3 +1 @@
1
- export * from './get-vote-details';
2
- export * from './get-vote-status';
3
1
  export * from './vote';
@@ -1,73 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- 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;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.getVoteDetails = void 0;
40
- function mockVoteEntity(id) {
41
- var daysToAdd = Math.floor(Math.random() * (30 - 14 + 1)) + 14; // Random days between 14 and 30
42
- return {
43
- id: id,
44
- startDate: Date.now(),
45
- endDate: Date.now() + 1000 * 60 * 60 * 24 * daysToAdd, // 14 to 30 days from now
46
- percentageToPass: 4,
47
- yesCount: Math.floor(Math.random() * 100),
48
- noCount: Math.floor(Math.random() * 100),
49
- };
50
- }
51
- // TODO: Write proper implementation
52
- // TODO: Note if vote details cannot be found throw new Error('Vote not found') UI will have logic based on this
53
- var getVoteDetails = function (_a) {
54
- var id = _a.id;
55
- return __awaiter(void 0, void 0, void 0, function () {
56
- return __generator(this, function (_b) {
57
- switch (_b.label) {
58
- case 0: return [4 /*yield*/, new Promise(function (resolve, reject) {
59
- setTimeout(function () {
60
- var error = Math.random() * 100 > 50;
61
- if (error) {
62
- reject(new Error('Vote not found'));
63
- }
64
- resolve(mockVoteEntity(id));
65
- }, Math.random() * 100 + 1000);
66
- })];
67
- case 1: return [2 /*return*/, _b.sent()];
68
- }
69
- });
70
- });
71
- };
72
- exports.getVoteDetails = getVoteDetails;
73
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
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,67 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- 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;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.getVoteStatus = void 0;
40
- function mockVoteStatusEntity() {
41
- return {
42
- votingPower: Math.floor(Math.random() * 1000), // Random voting power between 0 and 999
43
- hasVoted: Math.random() < 0.5, // Randomly true or false
44
- };
45
- }
46
- // TODO: Write proper implementation
47
- var getVoteStatus = function (_a) {
48
- var id = _a.id, address = _a.address;
49
- return __awaiter(void 0, void 0, void 0, function () {
50
- return __generator(this, function (_b) {
51
- switch (_b.label) {
52
- case 0: return [4 /*yield*/, new Promise(function (resolve, reject) {
53
- setTimeout(function () {
54
- var error = Math.random() * 100 > 50;
55
- if (error) {
56
- reject(new Error("Vote ".concat(id, ", ").concat(address, " error")));
57
- }
58
- resolve(mockVoteStatusEntity());
59
- }, Math.random() * 100 + 1000);
60
- })];
61
- case 1: return [2 /*return*/, _b.sent()];
62
- }
63
- });
64
- });
65
- };
66
- exports.getVoteStatus = getVoteStatus;
67
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
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"]}
@@ -1,3 +0,0 @@
1
- import { GetVoteDetailsParams, GetVoteDetailsResult } from '../../types';
2
- export declare const getVoteDetails: ({ id, }: GetVoteDetailsParams) => Promise<GetVoteDetailsResult>;
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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 +0,0 @@
1
- import { GetVoteStatusParams, GetVoteStatusResult } from '../../types';
2
- export declare const getVoteStatus: ({ id, address, }: GetVoteStatusParams) => Promise<GetVoteStatusResult>;
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
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,33 +0,0 @@
1
- import { VoteDetailsEntity } from '@reyaxyz/common';
2
- import { GetVoteDetailsParams, GetVoteDetailsResult } from '../../types';
3
-
4
- function mockVoteEntity(id: number): VoteDetailsEntity {
5
- const daysToAdd = Math.floor(Math.random() * (30 - 14 + 1)) + 14; // Random days between 14 and 30
6
- return {
7
- id,
8
- startDate: Date.now(),
9
- endDate: Date.now() + 1000 * 60 * 60 * 24 * daysToAdd, // 14 to 30 days from now
10
- percentageToPass: 4,
11
- yesCount: Math.floor(Math.random() * 100),
12
- noCount: Math.floor(Math.random() * 100),
13
- };
14
- }
15
-
16
- // TODO: Write proper implementation
17
- // TODO: Note if vote details cannot be found throw new Error('Vote not found') UI will have logic based on this
18
- export const getVoteDetails = async ({
19
- id,
20
- }: GetVoteDetailsParams): Promise<GetVoteDetailsResult> => {
21
- return await new Promise((resolve, reject) => {
22
- setTimeout(
23
- () => {
24
- const error = Math.random() * 100 > 50;
25
- if (error) {
26
- reject(new Error('Vote not found'));
27
- }
28
- resolve(mockVoteEntity(id));
29
- },
30
- Math.random() * 100 + 1000,
31
- );
32
- });
33
- };
@@ -1,28 +0,0 @@
1
- import { VoteStatusEntity } from '@reyaxyz/common';
2
- import { GetVoteStatusParams, GetVoteStatusResult } from '../../types';
3
-
4
- function mockVoteStatusEntity(): VoteStatusEntity {
5
- return {
6
- votingPower: Math.floor(Math.random() * 1000), // Random voting power between 0 and 999
7
- hasVoted: Math.random() < 0.5, // Randomly true or false
8
- };
9
- }
10
-
11
- // TODO: Write proper implementation
12
- export const getVoteStatus = async ({
13
- id,
14
- address,
15
- }: GetVoteStatusParams): Promise<GetVoteStatusResult> => {
16
- return await new Promise((resolve, reject) => {
17
- setTimeout(
18
- () => {
19
- const error = Math.random() * 100 > 50;
20
- if (error) {
21
- reject(new Error(`Vote ${id}, ${address} error`));
22
- }
23
- resolve(mockVoteStatusEntity());
24
- },
25
- Math.random() * 100 + 1000,
26
- );
27
- });
28
- };