@reyaxyz/community-sdk 0.13.4 → 0.13.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -41,7 +41,7 @@ var contractAddresses_1 = require("../../../../utils/contractAddresses");
|
|
|
41
41
|
var executeTransaction_1 = require("../executeTransaction");
|
|
42
42
|
var encode_1 = require("./encode");
|
|
43
43
|
var vote = function (params) { return __awaiter(void 0, void 0, void 0, function () {
|
|
44
|
-
var _a, data, value, network, chainId, result;
|
|
44
|
+
var _a, data, value, network, chainId, result, error_1;
|
|
45
45
|
var _b;
|
|
46
46
|
return __generator(this, function (_c) {
|
|
47
47
|
switch (_c.label) {
|
|
@@ -51,12 +51,19 @@ var vote = function (params) { return __awaiter(void 0, void 0, void 0, function
|
|
|
51
51
|
case 1:
|
|
52
52
|
network = _c.sent();
|
|
53
53
|
chainId = Number(network === null || network === void 0 ? void 0 : network.chainId);
|
|
54
|
-
|
|
54
|
+
_c.label = 2;
|
|
55
55
|
case 2:
|
|
56
|
+
_c.trys.push([2, 4, , 5]);
|
|
57
|
+
return [4 /*yield*/, (0, executeTransaction_1.executeTransaction)(params.signer, data, value, chainId, contractAddresses_1.ContractType.COMMUNITY_DEPLOYER)];
|
|
58
|
+
case 3:
|
|
56
59
|
result = _c.sent();
|
|
57
60
|
return [2 /*return*/, {
|
|
58
61
|
transactionHash: (result === null || result === void 0 ? void 0 : result.hash) || null,
|
|
59
62
|
}];
|
|
63
|
+
case 4:
|
|
64
|
+
error_1 = _c.sent();
|
|
65
|
+
throw new Error('Vote failed. Please reach out via Discord.');
|
|
66
|
+
case 5: return [2 /*return*/];
|
|
60
67
|
}
|
|
61
68
|
});
|
|
62
69
|
}); };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/vote/services/vote/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAm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,CAAC;;;;KAEjE,CAAC;AApBW,QAAA,IAAI,QAoBf","sourcesContent":["import { ContractType } from '../../../../utils/contractAddresses';\nimport { executeTransaction } from '../executeTransaction';\nimport { encodeCastVote } from './encode';\nimport { VoteParams, VoteResult } from '../../types';\n\nexport const vote = async (params: VoteParams): Promise<VoteResult> => {\n const { calldata: data, value } = encodeCastVote(params.voted == 'yes');\n\n const network = await params.signer.provider?.getNetwork();\n const chainId = Number(network?.chainId);\n\n try {\n const result = await executeTransaction(\n params.signer,\n data,\n value,\n chainId,\n ContractType.COMMUNITY_DEPLOYER,\n );\n return {\n transactionHash: result?.hash || null,\n };\n } catch (error) {\n throw new Error('Vote failed. Please reach out via Discord.');\n }\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/vote/services/vote/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAErD,eAAO,MAAM,IAAI,WAAkB,UAAU,KAAG,QAAQ,UAAU,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/vote/services/vote/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAErD,eAAO,MAAM,IAAI,WAAkB,UAAU,KAAG,QAAQ,UAAU,CAoBjE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reyaxyz/community-sdk",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.5",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"generate:coverage-badges": "npx istanbul-badges-readme --silent"
|
|
39
39
|
},
|
|
40
40
|
"packageManager": "pnpm@8.10.4",
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "2554b150821c8e77dbfd49fb637c45558dfeb5ea"
|
|
42
42
|
}
|
|
@@ -9,15 +9,18 @@ export const vote = async (params: VoteParams): Promise<VoteResult> => {
|
|
|
9
9
|
const network = await params.signer.provider?.getNetwork();
|
|
10
10
|
const chainId = Number(network?.chainId);
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
12
|
+
try {
|
|
13
|
+
const result = await executeTransaction(
|
|
14
|
+
params.signer,
|
|
15
|
+
data,
|
|
16
|
+
value,
|
|
17
|
+
chainId,
|
|
18
|
+
ContractType.COMMUNITY_DEPLOYER,
|
|
19
|
+
);
|
|
20
|
+
return {
|
|
21
|
+
transactionHash: result?.hash || null,
|
|
22
|
+
};
|
|
23
|
+
} catch (error) {
|
|
24
|
+
throw new Error('Vote failed. Please reach out via Discord.');
|
|
25
|
+
}
|
|
23
26
|
};
|