@reyaxyz/community-sdk 0.1.6 → 0.1.8
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/client/index.js
CHANGED
|
@@ -21,17 +21,17 @@ var vote_1 = __importDefault(require("../modules/vote"));
|
|
|
21
21
|
* @description Client for Community SDK
|
|
22
22
|
*/
|
|
23
23
|
var CommunityClient = /** @class */ (function () {
|
|
24
|
-
function CommunityClient(
|
|
25
|
-
CommunityClient.config =
|
|
24
|
+
function CommunityClient(params) {
|
|
25
|
+
CommunityClient.config = constants_1.SERVICE_CONFIG[params.environment];
|
|
26
|
+
CommunityClient.config = __assign(__assign({}, CommunityClient.config), params);
|
|
26
27
|
this._vote = new vote_1.default(CommunityClient.config.chainId);
|
|
27
28
|
}
|
|
28
|
-
CommunityClient.configure = function (
|
|
29
|
-
CommunityClient.
|
|
30
|
-
CommunityClient.instance = new CommunityClient(config);
|
|
29
|
+
CommunityClient.configure = function (params) {
|
|
30
|
+
CommunityClient.instance = new CommunityClient(params);
|
|
31
31
|
};
|
|
32
32
|
CommunityClient.getInstance = function () {
|
|
33
33
|
if (!CommunityClient.instance) {
|
|
34
|
-
throw new Error('
|
|
34
|
+
throw new Error('Client is not configured. Please configure it before using.');
|
|
35
35
|
}
|
|
36
36
|
return CommunityClient.instance;
|
|
37
37
|
};
|
package/dist/client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["client/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yCAA4D;AAC5D,yDAAyC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["client/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,yCAA4D;AAC5D,yDAAyC;AAOzC;;GAEG;AACH;IAKE,yBAAoB,MAAuB;QACzC,eAAe,CAAC,MAAM,GAAG,0BAAc,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QAC5D,eAAe,CAAC,MAAM,yBAAQ,eAAe,CAAC,MAAM,GAAK,MAAM,CAAE,CAAC;QAClE,IAAI,CAAC,KAAK,GAAG,IAAI,cAAU,CAAC,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC9D,CAAC;IAEa,yBAAS,GAAvB,UAAwB,MAAuB;QAC7C,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;IAED,sBAAkB,kCAAe;aAAjC;YACE,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC1C,CAAC;;;OAAA;IAnCc,sBAAM,GAAkB,0BAAc,CAAC,MAAM,CAAC,CAAC;IAoChE,sBAAC;CAAA,AAtCD,IAsCC;AAtCY,0CAAe","sourcesContent":["import { SERVICE_CONFIG, ServiceConfig } from './constants';\nimport VoteModule from '../modules/vote';\nimport { ReyaChainId } from '@reyaxyz/common';\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\n private constructor(params: ConfigureParams) {\n CommunityClient.config = SERVICE_CONFIG[params.environment];\n CommunityClient.config = { ...CommunityClient.config, ...params };\n this._vote = new VoteModule(CommunityClient.config.chainId);\n }\n\n public static configure(params: ConfigureParams): void {\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 public static get supportedChains(): ReyaChainId[] {\n return [CommunityClient.config.chainId];\n }\n}\n"]}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { ServiceConfig } from './constants';
|
|
2
2
|
import VoteModule from '../modules/vote';
|
|
3
3
|
import { ReyaChainId } from '@reyaxyz/common';
|
|
4
|
+
export type ConfigureParams = {
|
|
5
|
+
environment: ServiceConfig['environment'];
|
|
6
|
+
};
|
|
4
7
|
/**
|
|
5
8
|
* @description Client for Community SDK
|
|
6
9
|
*/
|
|
@@ -9,7 +12,7 @@ export declare class CommunityClient {
|
|
|
9
12
|
private static config;
|
|
10
13
|
private readonly _vote;
|
|
11
14
|
private constructor();
|
|
12
|
-
static configure(
|
|
15
|
+
static configure(params: ConfigureParams): void;
|
|
13
16
|
private static getInstance;
|
|
14
17
|
/**
|
|
15
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,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C;;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;IAEnC,OAAO;
|
|
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,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,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;IAEnC,OAAO;WAMO,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI;IAItD,OAAO,CAAC,MAAM,CAAC,WAAW;IAS1B;;;;;;OAMG;IACH,WAAkB,IAAI,IAAI,UAAU,CAEnC;IAED,WAAkB,eAAe,IAAI,WAAW,EAAE,CAEjD;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reyaxyz/community-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"url": "https://github.com/Reya-Labs/reya-off-chain-monorepo.git"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@reyaxyz/common": "0.6.
|
|
13
|
+
"@reyaxyz/common": "0.6.1",
|
|
14
14
|
"ethers": "6.9.0"
|
|
15
15
|
},
|
|
16
16
|
"main": "dist/index.js",
|
|
@@ -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": "c21f595afd7fbe3a31cebc5d1ff632c75ff8c7e7"
|
|
41
41
|
}
|
package/src/client/index.ts
CHANGED
|
@@ -2,6 +2,10 @@ import { SERVICE_CONFIG, ServiceConfig } from './constants';
|
|
|
2
2
|
import VoteModule from '../modules/vote';
|
|
3
3
|
import { ReyaChainId } from '@reyaxyz/common';
|
|
4
4
|
|
|
5
|
+
export type ConfigureParams = {
|
|
6
|
+
environment: ServiceConfig['environment'];
|
|
7
|
+
};
|
|
8
|
+
|
|
5
9
|
/**
|
|
6
10
|
* @description Client for Community SDK
|
|
7
11
|
*/
|
|
@@ -10,20 +14,20 @@ export class CommunityClient {
|
|
|
10
14
|
private static config: ServiceConfig = SERVICE_CONFIG['test'];
|
|
11
15
|
private readonly _vote: VoteModule;
|
|
12
16
|
|
|
13
|
-
private constructor(
|
|
14
|
-
CommunityClient.config =
|
|
17
|
+
private constructor(params: ConfigureParams) {
|
|
18
|
+
CommunityClient.config = SERVICE_CONFIG[params.environment];
|
|
19
|
+
CommunityClient.config = { ...CommunityClient.config, ...params };
|
|
15
20
|
this._vote = new VoteModule(CommunityClient.config.chainId);
|
|
16
21
|
}
|
|
17
22
|
|
|
18
|
-
public static configure(
|
|
19
|
-
CommunityClient.
|
|
20
|
-
CommunityClient.instance = new CommunityClient(config);
|
|
23
|
+
public static configure(params: ConfigureParams): void {
|
|
24
|
+
CommunityClient.instance = new CommunityClient(params);
|
|
21
25
|
}
|
|
22
26
|
|
|
23
27
|
private static getInstance(): CommunityClient {
|
|
24
28
|
if (!CommunityClient.instance) {
|
|
25
29
|
throw new Error(
|
|
26
|
-
'
|
|
30
|
+
'Client is not configured. Please configure it before using.',
|
|
27
31
|
);
|
|
28
32
|
}
|
|
29
33
|
return CommunityClient.instance;
|