@reyaxyz/community-sdk 0.1.5 → 0.1.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.
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/modules/vote/services/get-vote-details/index.js.map +1 -1
- package/dist/modules/vote/services/get-vote-details/types.js +3 -0
- package/dist/modules/vote/services/get-vote-details/types.js.map +1 -0
- package/dist/modules/vote/services/get-vote-status/index.js.map +1 -1
- package/dist/modules/vote/services/get-vote-status/types.js +3 -0
- package/dist/modules/vote/services/get-vote-status/types.js.map +1 -0
- package/dist/modules/vote/services/index.js +3 -0
- package/dist/modules/vote/services/index.js.map +1 -1
- package/dist/modules/vote/services/vote/index.js.map +1 -1
- package/dist/modules/vote/services/vote/types.js +3 -0
- package/dist/modules/vote/services/vote/types.js.map +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/modules/vote/services/get-vote-details/index.d.ts +1 -5
- package/dist/types/modules/vote/services/get-vote-details/index.d.ts.map +1 -1
- package/dist/types/modules/vote/services/get-vote-details/types.d.ts +6 -0
- package/dist/types/modules/vote/services/get-vote-details/types.d.ts.map +1 -0
- package/dist/types/modules/vote/services/get-vote-status/index.d.ts +1 -6
- package/dist/types/modules/vote/services/get-vote-status/index.d.ts.map +1 -1
- package/dist/types/modules/vote/services/get-vote-status/types.d.ts +7 -0
- package/dist/types/modules/vote/services/get-vote-status/types.d.ts.map +1 -0
- package/dist/types/modules/vote/services/index.d.ts +3 -0
- package/dist/types/modules/vote/services/index.d.ts.map +1 -1
- package/dist/types/modules/vote/services/vote/index.d.ts +1 -10
- package/dist/types/modules/vote/services/vote/index.d.ts.map +1 -1
- package/dist/types/modules/vote/services/vote/types.d.ts +11 -0
- package/dist/types/modules/vote/services/vote/types.d.ts.map +1 -0
- package/package.json +2 -2
- package/src/index.ts +3 -0
- package/src/modules/vote/services/get-vote-details/index.ts +1 -4
- package/src/modules/vote/services/get-vote-details/types.ts +6 -0
- package/src/modules/vote/services/get-vote-status/index.ts +2 -7
- package/src/modules/vote/services/get-vote-status/types.ts +7 -0
- package/src/modules/vote/services/index.ts +3 -0
- package/src/modules/vote/services/vote/index.ts +1 -11
- package/src/modules/vote/services/vote/types.ts +11 -0
package/dist/index.js
CHANGED
|
@@ -16,4 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./types"), exports);
|
|
18
18
|
__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);
|
|
19
22
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,2CAAyB","sourcesContent":["export * from './types';\nexport * from './client';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,2CAAyB;AACzB,iFAA+D;AAC/D,gFAA8D;AAC9D,qEAAmD","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';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/vote/services/get-vote-details/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"/","sources":["modules/vote/services/get-vote-details/types.ts"],"names":[],"mappings":"","sourcesContent":["import { VoteDetailsEntity } from '../../../../types';\n\nexport type GetVoteDetailsParams = {\n id: VoteDetailsEntity['id'];\n};\nexport type GetVoteDetailsResult = VoteDetailsEntity;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/vote/services/get-vote-status/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"/","sources":["modules/vote/services/get-vote-status/types.ts"],"names":[],"mappings":"","sourcesContent":["import { VoteDetailsEntity, VoteStatusEntity } from '../../../../types';\n\nexport type GetVoteStatusParams = {\n address: string;\n id: VoteDetailsEntity['id'];\n};\nexport type GetVoteStatusResult = VoteStatusEntity;\n"]}
|
|
@@ -17,4 +17,7 @@ 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);
|
|
20
23
|
//# 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,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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/vote/services/vote/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"/","sources":["modules/vote/services/vote/types.ts"],"names":[],"mappings":"","sourcesContent":["import { VoteDetailsEntity } from '../../../../types';\nimport { JsonRpcSigner, Signer } from 'ethers';\n\nexport type VoteParams = {\n id: VoteDetailsEntity['id'];\n voted: 'yes' | 'no';\n signer: Signer | JsonRpcSigner;\n};\nexport type VoteResult = {\n transactionHash: string;\n};\n"]}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
export * from './types';
|
|
2
2
|
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';
|
|
3
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC"}
|
|
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"}
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export type GetVoteDetailsParams = {
|
|
3
|
-
id: VoteDetailsEntity['id'];
|
|
4
|
-
};
|
|
5
|
-
export type GetVoteDetailsResult = VoteDetailsEntity;
|
|
1
|
+
import { GetVoteDetailsParams, GetVoteDetailsResult } from './types';
|
|
6
2
|
export declare const getVoteDetails: ({ id, }: GetVoteDetailsParams) => Promise<GetVoteDetailsResult>;
|
|
7
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":"
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["modules/vote/services/get-vote-details/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,MAAM,oBAAoB,GAAG;IACjC,EAAE,EAAE,iBAAiB,CAAC,IAAI,CAAC,CAAC;CAC7B,CAAC;AACF,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,CAAC"}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export type GetVoteStatusParams = {
|
|
3
|
-
address: string;
|
|
4
|
-
id: VoteDetailsEntity['id'];
|
|
5
|
-
};
|
|
6
|
-
export type GetVoteStatusResult = VoteStatusEntity;
|
|
1
|
+
import { GetVoteStatusParams, GetVoteStatusResult } from './types';
|
|
7
2
|
export declare const getVoteStatus: ({ id, address, }: GetVoteStatusParams) => Promise<GetVoteStatusResult>;
|
|
8
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":"
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["modules/vote/services/get-vote-status/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAExE,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"}
|
|
@@ -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,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,cAAc,CAAC"}
|
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Signer, JsonRpcSigner } from 'ethers';
|
|
3
|
-
export type VoteParams = {
|
|
4
|
-
id: VoteDetailsEntity['id'];
|
|
5
|
-
voted: 'yes' | 'no';
|
|
6
|
-
signer: Signer | JsonRpcSigner;
|
|
7
|
-
};
|
|
8
|
-
export type VoteResult = {
|
|
9
|
-
transactionHash: string;
|
|
10
|
-
};
|
|
1
|
+
import { VoteParams, VoteResult } from './types';
|
|
11
2
|
export declare const vote: ({ id }: VoteParams) => Promise<VoteResult>;
|
|
12
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,
|
|
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"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { VoteDetailsEntity } from '../../../../types';
|
|
2
|
+
import { JsonRpcSigner, Signer } from 'ethers';
|
|
3
|
+
export type VoteParams = {
|
|
4
|
+
id: VoteDetailsEntity['id'];
|
|
5
|
+
voted: 'yes' | 'no';
|
|
6
|
+
signer: Signer | JsonRpcSigner;
|
|
7
|
+
};
|
|
8
|
+
export type VoteResult = {
|
|
9
|
+
transactionHash: string;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["modules/vote/services/vote/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE/C,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;AACF,MAAM,MAAM,UAAU,GAAG;IACvB,eAAe,EAAE,MAAM,CAAC;CACzB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reyaxyz/community-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -37,5 +37,5 @@
|
|
|
37
37
|
"generate:coverage-badges": "npx istanbul-badges-readme --silent"
|
|
38
38
|
},
|
|
39
39
|
"packageManager": "pnpm@8.10.4",
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "6ff551be69fb20b5e6c2386a48d4e21ad1ee79ab"
|
|
41
41
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { VoteDetailsEntity } from '../../../../types';
|
|
2
|
+
import { GetVoteDetailsParams, GetVoteDetailsResult } from './types';
|
|
2
3
|
|
|
3
4
|
function mockVoteEntity(id: number): VoteDetailsEntity {
|
|
4
5
|
const daysToAdd = Math.floor(Math.random() * (30 - 14 + 1)) + 14; // Random days between 14 and 30
|
|
@@ -12,10 +13,6 @@ function mockVoteEntity(id: number): VoteDetailsEntity {
|
|
|
12
13
|
};
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
export type GetVoteDetailsParams = {
|
|
16
|
-
id: VoteDetailsEntity['id'];
|
|
17
|
-
};
|
|
18
|
-
export type GetVoteDetailsResult = VoteDetailsEntity;
|
|
19
16
|
// TODO: Write proper implementation
|
|
20
17
|
// TODO: Note if vote details cannot be found throw new Error('Vote not found') UI will have logic based on this
|
|
21
18
|
export const getVoteDetails = async ({
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { VoteStatusEntity } from '../../../../types';
|
|
2
|
+
import { GetVoteStatusParams, GetVoteStatusResult } from './types';
|
|
2
3
|
|
|
3
4
|
function mockVoteStatusEntity(): VoteStatusEntity {
|
|
4
5
|
return {
|
|
@@ -7,12 +8,6 @@ function mockVoteStatusEntity(): VoteStatusEntity {
|
|
|
7
8
|
};
|
|
8
9
|
}
|
|
9
10
|
|
|
10
|
-
export type GetVoteStatusParams = {
|
|
11
|
-
address: string;
|
|
12
|
-
id: VoteDetailsEntity['id'];
|
|
13
|
-
};
|
|
14
|
-
export type GetVoteStatusResult = VoteStatusEntity;
|
|
15
|
-
|
|
16
11
|
// TODO: Write proper implementation
|
|
17
12
|
export const getVoteStatus = async ({
|
|
18
13
|
id,
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Signer, JsonRpcSigner } from 'ethers';
|
|
3
|
-
|
|
4
|
-
export type VoteParams = {
|
|
5
|
-
id: VoteDetailsEntity['id'];
|
|
6
|
-
voted: 'yes' | 'no';
|
|
7
|
-
signer: Signer | JsonRpcSigner;
|
|
8
|
-
};
|
|
9
|
-
export type VoteResult = {
|
|
10
|
-
transactionHash: string;
|
|
11
|
-
};
|
|
1
|
+
import { VoteParams, VoteResult } from './types';
|
|
12
2
|
|
|
13
3
|
// TODO: Write proper implementation
|
|
14
4
|
export const vote = async ({ id }: VoteParams): Promise<VoteResult> => {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { VoteDetailsEntity } from '../../../../types';
|
|
2
|
+
import { JsonRpcSigner, Signer } from 'ethers';
|
|
3
|
+
|
|
4
|
+
export type VoteParams = {
|
|
5
|
+
id: VoteDetailsEntity['id'];
|
|
6
|
+
voted: 'yes' | 'no';
|
|
7
|
+
signer: Signer | JsonRpcSigner;
|
|
8
|
+
};
|
|
9
|
+
export type VoteResult = {
|
|
10
|
+
transactionHash: string;
|
|
11
|
+
};
|