@reyaxyz/community-sdk 0.1.28 → 0.2.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.
- package/dist/client/index.js +16 -0
- package/dist/client/index.js.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/dist/modules/index.js +1 -0
- package/dist/modules/index.js.map +1 -1
- package/dist/modules/lge/index.js +61 -0
- package/dist/modules/lge/index.js.map +1 -0
- package/dist/modules/lge/services/get-account-lge-status/index.js +67 -0
- package/dist/modules/lge/services/get-account-lge-status/index.js.map +1 -0
- package/dist/modules/lge/services/get-account-lge-status/types.js +3 -0
- package/dist/modules/lge/services/get-account-lge-status/types.js.map +1 -0
- package/dist/modules/lge/services/get-lge-boost-rate/index.js +63 -0
- package/dist/modules/lge/services/get-lge-boost-rate/index.js.map +1 -0
- package/dist/modules/lge/services/get-lge-boost-rate/types.js +3 -0
- package/dist/modules/lge/services/get-lge-boost-rate/types.js.map +1 -0
- package/dist/modules/lge/services/index.js +21 -0
- package/dist/modules/lge/services/index.js.map +1 -0
- package/dist/types/client/index.d.ts +10 -0
- package/dist/types/client/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/modules/index.d.ts +1 -0
- package/dist/types/modules/index.d.ts.map +1 -1
- package/dist/types/modules/lge/index.d.ts +9 -0
- package/dist/types/modules/lge/index.d.ts.map +1 -0
- package/dist/types/modules/lge/services/get-account-lge-status/index.d.ts +3 -0
- package/dist/types/modules/lge/services/get-account-lge-status/index.d.ts.map +1 -0
- package/dist/types/modules/lge/services/get-account-lge-status/types.d.ts +9 -0
- package/dist/types/modules/lge/services/get-account-lge-status/types.d.ts.map +1 -0
- package/dist/types/modules/lge/services/get-lge-boost-rate/index.d.ts +3 -0
- package/dist/types/modules/lge/services/get-lge-boost-rate/index.d.ts.map +1 -0
- package/dist/types/modules/lge/services/get-lge-boost-rate/types.d.ts +3 -0
- package/dist/types/modules/lge/services/get-lge-boost-rate/types.d.ts.map +1 -0
- package/dist/types/modules/lge/services/index.d.ts +5 -0
- package/dist/types/modules/lge/services/index.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/client/index.ts +14 -0
- package/src/index.ts +2 -1
- package/src/modules/index.ts +1 -0
- package/src/modules/lge/index.ts +23 -0
- package/src/modules/lge/services/get-account-lge-status/index.ts +28 -0
- package/src/modules/lge/services/get-account-lge-status/types.ts +8 -0
- package/src/modules/lge/services/get-lge-boost-rate/index.ts +24 -0
- package/src/modules/lge/services/get-lge-boost-rate/types.ts +2 -0
- package/src/modules/lge/services/index.ts +4 -0
package/dist/client/index.js
CHANGED
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.CommunityClient = void 0;
|
|
7
7
|
var constants_1 = require("./constants");
|
|
8
8
|
var vote_1 = __importDefault(require("../modules/vote"));
|
|
9
|
+
var lge_1 = __importDefault(require("../modules/lge"));
|
|
9
10
|
/**
|
|
10
11
|
* @description Client for Community SDK
|
|
11
12
|
*/
|
|
@@ -13,6 +14,7 @@ var CommunityClient = /** @class */ (function () {
|
|
|
13
14
|
function CommunityClient(params) {
|
|
14
15
|
CommunityClient.config = constants_1.SERVICE_CONFIG[params.environment];
|
|
15
16
|
this._vote = new vote_1.default(CommunityClient.config.chainId);
|
|
17
|
+
this._LGE = new lge_1.default(CommunityClient.config.chainId);
|
|
16
18
|
}
|
|
17
19
|
CommunityClient.configure = function (params) {
|
|
18
20
|
if (!params.environment ||
|
|
@@ -41,6 +43,20 @@ var CommunityClient = /** @class */ (function () {
|
|
|
41
43
|
enumerable: false,
|
|
42
44
|
configurable: true
|
|
43
45
|
});
|
|
46
|
+
Object.defineProperty(CommunityClient, "LGE", {
|
|
47
|
+
/**
|
|
48
|
+
* Provides access to the LGEModule instance.
|
|
49
|
+
* This getter allows for interacting with LGE-related functionalities.
|
|
50
|
+
*
|
|
51
|
+
* @returns {LGEModule} An instance of LGEModule for LGE operations.
|
|
52
|
+
* @memberof CommunityClient
|
|
53
|
+
*/
|
|
54
|
+
get: function () {
|
|
55
|
+
return CommunityClient.getInstance()._LGE;
|
|
56
|
+
},
|
|
57
|
+
enumerable: false,
|
|
58
|
+
configurable: true
|
|
59
|
+
});
|
|
44
60
|
Object.defineProperty(CommunityClient, "supportedChain", {
|
|
45
61
|
get: function () {
|
|
46
62
|
return CommunityClient.config.chainId;
|
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;AACzC,uDAAuC;AAMvC;;GAEG;AACH;IAME,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;IAC5D,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;IAED,sBAAkB,iCAAc;aAAhC;YACE,OAAO,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC;QACxC,CAAC;;;OAAA;IAvDc,sBAAM,GAAkB,0BAAc,CAAC,MAAM,CAAC,CAAC;IAwDhE,sBAAC;CAAA,AA1DD,IA0DC;AA1DY,0CAAe","sourcesContent":["import { SERVICE_CONFIG, ServiceConfig } from './constants';\nimport VoteModule from '../modules/vote';\nimport LGEModule from '../modules/lge';\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\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 }\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 public static get supportedChain(): number {\n return CommunityClient.config.chainId;\n }\n}\n"]}
|
package/dist/index.js
CHANGED
|
@@ -18,5 +18,6 @@ __exportStar(require("./types"), exports);
|
|
|
18
18
|
__exportStar(require("./client"), exports);
|
|
19
19
|
__exportStar(require("./modules/vote/services/get-vote-details/types"), exports);
|
|
20
20
|
__exportStar(require("./modules/vote/services/get-vote-status/types"), exports);
|
|
21
|
-
__exportStar(require("./modules/
|
|
21
|
+
__exportStar(require("./modules/lge/services/get-account-lge-status/types"), exports);
|
|
22
|
+
__exportStar(require("./modules/lge/services/get-lge-boost-rate/types"), exports);
|
|
22
23
|
//# 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;AACzB,iFAA+D;AAC/D,gFAA8D;AAC9D,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,2CAAyB;AACzB,iFAA+D;AAC/D,gFAA8D;AAC9D,sFAAoE;AACpE,kFAAgE","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/lge/services/get-account-lge-status/types';\nexport * from './modules/lge/services/get-lge-boost-rate/types';\n"]}
|
package/dist/modules/index.js
CHANGED
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./vote"), exports);
|
|
18
|
+
__exportStar(require("./lge"), exports);
|
|
18
19
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB","sourcesContent":["export * from './vote';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,wCAAsB","sourcesContent":["export * from './vote';\nexport * from './lge';\n"]}
|
|
@@ -0,0 +1,61 @@
|
|
|
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
|
+
var services_1 = require("./services");
|
|
40
|
+
var LGEModule = /** @class */ (function () {
|
|
41
|
+
function LGEModule(chainId) {
|
|
42
|
+
this.chainId = chainId;
|
|
43
|
+
}
|
|
44
|
+
LGEModule.prototype.getLGEBoostRate = function (params) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
46
|
+
return __generator(this, function (_a) {
|
|
47
|
+
return [2 /*return*/, (0, services_1.getLGEBoostRate)(params)];
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
LGEModule.prototype.getAccountLGEStatus = function (params) {
|
|
52
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
53
|
+
return __generator(this, function (_a) {
|
|
54
|
+
return [2 /*return*/, (0, services_1.getAccountLGEStatus)(params)];
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
return LGEModule;
|
|
59
|
+
}());
|
|
60
|
+
exports.default = LGEModule;
|
|
61
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/lge/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,uCAKoB;AAEpB;IAGE,mBAAY,OAAoB;QAC9B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAEK,mCAAe,GAArB,UAAsB,MAA6B;;;gBACjD,sBAAO,IAAA,0BAAe,EAAC,MAAM,CAAC,EAAC;;;KAChC;IAEK,uCAAmB,GAAzB,UAA0B,MAAiC;;;gBACzD,sBAAO,IAAA,8BAAmB,EAAC,MAAM,CAAC,EAAC;;;KACpC;IACH,gBAAC;AAAD,CAAC,AAdD,IAcC","sourcesContent":["import { ReyaChainId } from '@reyaxyz/common';\nimport {\n getAccountLGEStatus,\n GetAccountLGEStatusParams,\n getLGEBoostRate,\n GetLGEBoostRateParams,\n} from './services';\n\nexport default class LGEModule {\n private chainId: ReyaChainId;\n\n constructor(chainId: ReyaChainId) {\n this.chainId = chainId;\n }\n\n async getLGEBoostRate(params: GetLGEBoostRateParams) {\n return getLGEBoostRate(params);\n }\n\n async getAccountLGEStatus(params: GetAccountLGEStatusParams) {\n return getAccountLGEStatus(params);\n }\n}\n"]}
|
|
@@ -0,0 +1,67 @@
|
|
|
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.getAccountLGEStatus = void 0;
|
|
40
|
+
function mockAccountLGEStatus() {
|
|
41
|
+
return {
|
|
42
|
+
currentBoost: Math.random() * 100,
|
|
43
|
+
deposited: Math.floor(Math.random() * 10000) + 1000,
|
|
44
|
+
xp: Math.floor(Math.random() * 100) + 1000,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
// TODO: Write proper implementation
|
|
48
|
+
var getAccountLGEStatus = function (
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
50
|
+
_) { return __awaiter(void 0, void 0, void 0, function () {
|
|
51
|
+
return __generator(this, function (_a) {
|
|
52
|
+
switch (_a.label) {
|
|
53
|
+
case 0: return [4 /*yield*/, new Promise(function (resolve, reject) {
|
|
54
|
+
setTimeout(function () {
|
|
55
|
+
var error = Math.random() * 100 > 50;
|
|
56
|
+
if (error) {
|
|
57
|
+
reject(new Error('Vote not found'));
|
|
58
|
+
}
|
|
59
|
+
resolve(mockAccountLGEStatus());
|
|
60
|
+
}, Math.random() * 100 + 1000);
|
|
61
|
+
})];
|
|
62
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}); };
|
|
66
|
+
exports.getAccountLGEStatus = getAccountLGEStatus;
|
|
67
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/lge/services/get-account-lge-status/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,SAAS,oBAAoB;IAC3B,OAAO;QACL,YAAY,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG;QACjC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,GAAG,IAAI;QACnD,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,CAAC,GAAG,IAAI;KAC3C,CAAC;AACJ,CAAC;AAED,oCAAoC;AAC7B,IAAM,mBAAmB,GAAG;AACjC,6DAA6D;AAC7D,CAA4B;;;oBAErB,qBAAM,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;oBACvC,UAAU,CACR;wBACE,IAAM,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE,CAAC;wBACvC,IAAI,KAAK,EAAE,CAAC;4BACV,MAAM,CAAC,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC;wBACtC,CAAC;wBACD,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAAC;oBAClC,CAAC,EACD,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,IAAI,CAC3B,CAAC;gBACJ,CAAC,CAAC,EAAA;oBAXF,sBAAO,SAWL,EAAC;;;KACJ,CAAC;AAhBW,QAAA,mBAAmB,uBAgB9B","sourcesContent":["import { GetAccountLGEStatusParams, GetLAccountLGEStatusResult } from './types';\n\nfunction mockAccountLGEStatus(): GetLAccountLGEStatusResult {\n return {\n currentBoost: Math.random() * 100,\n deposited: Math.floor(Math.random() * 10000) + 1000,\n xp: Math.floor(Math.random() * 100) + 1000,\n };\n}\n\n// TODO: Write proper implementation\nexport const getAccountLGEStatus = async (\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _: GetAccountLGEStatusParams,\n): Promise<GetLAccountLGEStatusResult> => {\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(mockAccountLGEStatus());\n },\n Math.random() * 100 + 1000,\n );\n });\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"/","sources":["modules/lge/services/get-account-lge-status/types.ts"],"names":[],"mappings":"","sourcesContent":["export type GetAccountLGEStatusParams = {\n address: string; // wallet address\n};\nexport type GetLAccountLGEStatusResult = {\n xp: number;\n currentBoost: number;\n deposited: number;\n};\n"]}
|
|
@@ -0,0 +1,63 @@
|
|
|
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.getLGEBoostRate = void 0;
|
|
40
|
+
function mockLGEBoostRate() {
|
|
41
|
+
return Math.floor(Math.random() * 1000);
|
|
42
|
+
}
|
|
43
|
+
// TODO: Write proper implementation
|
|
44
|
+
var getLGEBoostRate = function (
|
|
45
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
46
|
+
_) { return __awaiter(void 0, void 0, void 0, function () {
|
|
47
|
+
return __generator(this, function (_a) {
|
|
48
|
+
switch (_a.label) {
|
|
49
|
+
case 0: return [4 /*yield*/, new Promise(function (resolve, reject) {
|
|
50
|
+
setTimeout(function () {
|
|
51
|
+
var error = Math.random() * 100 > 50;
|
|
52
|
+
if (error) {
|
|
53
|
+
reject(new Error('Vote not found'));
|
|
54
|
+
}
|
|
55
|
+
resolve(mockLGEBoostRate());
|
|
56
|
+
}, Math.random() * 100 + 1000);
|
|
57
|
+
})];
|
|
58
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}); };
|
|
62
|
+
exports.getLGEBoostRate = getLGEBoostRate;
|
|
63
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/lge/services/get-lge-boost-rate/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,SAAS,gBAAgB;IACvB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CAAC,CAAC;AAC1C,CAAC;AAED,oCAAoC;AAC7B,IAAM,eAAe,GAAG;AAC7B,6DAA6D;AAC7D,CAAwB;;;oBAEjB,qBAAM,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;oBACvC,UAAU,CACR;wBACE,IAAM,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE,CAAC;wBACvC,IAAI,KAAK,EAAE,CAAC;4BACV,MAAM,CAAC,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC,CAAC;wBACtC,CAAC;wBACD,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;oBAC9B,CAAC,EACD,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,IAAI,CAC3B,CAAC;gBACJ,CAAC,CAAC,EAAA;oBAXF,sBAAO,SAWL,EAAC;;;KACJ,CAAC;AAhBW,QAAA,eAAe,mBAgB1B","sourcesContent":["import { GetLGEBoostRateParams, GetLGEBoostRateResult } from './types';\n\nfunction mockLGEBoostRate(): GetLGEBoostRateResult {\n return Math.floor(Math.random() * 1000);\n}\n\n// TODO: Write proper implementation\nexport const getLGEBoostRate = async (\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _: GetLGEBoostRateParams,\n): Promise<GetLGEBoostRateResult> => {\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(mockLGEBoostRate());\n },\n Math.random() * 100 + 1000,\n );\n });\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"/","sources":["modules/lge/services/get-lge-boost-rate/types.ts"],"names":[],"mappings":"","sourcesContent":["export type GetLGEBoostRateParams = void;\nexport type GetLGEBoostRateResult = number;\n"]}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./get-lge-boost-rate"), exports);
|
|
18
|
+
__exportStar(require("./get-account-lge-status"), exports);
|
|
19
|
+
__exportStar(require("./get-account-lge-status/types"), exports);
|
|
20
|
+
__exportStar(require("./get-lge-boost-rate/types"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/lge/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,2DAAyC;AACzC,iEAA+C;AAC/C,6DAA2C","sourcesContent":["export * from './get-lge-boost-rate';\nexport * from './get-account-lge-status';\nexport * from './get-account-lge-status/types';\nexport * from './get-lge-boost-rate/types';\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ServiceConfig } from './constants';
|
|
2
2
|
import VoteModule from '../modules/vote';
|
|
3
|
+
import LGEModule from '../modules/lge';
|
|
3
4
|
export type ConfigureParams = {
|
|
4
5
|
environment: ServiceConfig['environment'];
|
|
5
6
|
};
|
|
@@ -10,6 +11,7 @@ export declare class CommunityClient {
|
|
|
10
11
|
private static instance;
|
|
11
12
|
private static config;
|
|
12
13
|
private readonly _vote;
|
|
14
|
+
private readonly _LGE;
|
|
13
15
|
private constructor();
|
|
14
16
|
static configure(params: ConfigureParams): void;
|
|
15
17
|
private static getInstance;
|
|
@@ -21,6 +23,14 @@ export declare class CommunityClient {
|
|
|
21
23
|
* @memberof CommunityClient
|
|
22
24
|
*/
|
|
23
25
|
static get vote(): VoteModule;
|
|
26
|
+
/**
|
|
27
|
+
* Provides access to the LGEModule instance.
|
|
28
|
+
* This getter allows for interacting with LGE-related functionalities.
|
|
29
|
+
*
|
|
30
|
+
* @returns {LGEModule} An instance of LGEModule for LGE operations.
|
|
31
|
+
* @memberof CommunityClient
|
|
32
|
+
*/
|
|
33
|
+
static get LGE(): LGEModule;
|
|
24
34
|
static get supportedChain(): number;
|
|
25
35
|
}
|
|
26
36
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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;
|
|
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;AAEvC,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;IAEjC,OAAO;WAMO,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,WAAkB,cAAc,IAAI,MAAM,CAEzC;CACF"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,5 +2,6 @@ export * from './types';
|
|
|
2
2
|
export * from './client';
|
|
3
3
|
export * from './modules/vote/services/get-vote-details/types';
|
|
4
4
|
export * from './modules/vote/services/get-vote-status/types';
|
|
5
|
-
export * from './modules/
|
|
5
|
+
export * from './modules/lge/services/get-account-lge-status/types';
|
|
6
|
+
export * from './modules/lge/services/get-lge-boost-rate/types';
|
|
6
7
|
//# 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;AACzB,cAAc,gDAAgD,CAAC;AAC/D,cAAc,+CAA+C,CAAC;AAC9D,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,qDAAqD,CAAC;AACpE,cAAc,iDAAiD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReyaChainId } from '@reyaxyz/common';
|
|
2
|
+
import { GetAccountLGEStatusParams, GetLGEBoostRateParams } from './services';
|
|
3
|
+
export default class LGEModule {
|
|
4
|
+
private chainId;
|
|
5
|
+
constructor(chainId: ReyaChainId);
|
|
6
|
+
getLGEBoostRate(params: GetLGEBoostRateParams): Promise<number>;
|
|
7
|
+
getAccountLGEStatus(params: GetAccountLGEStatusParams): Promise<import("./services").GetLAccountLGEStatusResult>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/lge/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAEL,yBAAyB,EAEzB,qBAAqB,EACtB,MAAM,YAAY,CAAC;AAEpB,MAAM,CAAC,OAAO,OAAO,SAAS;IAC5B,OAAO,CAAC,OAAO,CAAc;gBAEjB,OAAO,EAAE,WAAW;IAI1B,eAAe,CAAC,MAAM,EAAE,qBAAqB;IAI7C,mBAAmB,CAAC,MAAM,EAAE,yBAAyB;CAG5D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/lge/services/get-account-lge-status/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,SAAS,CAAC;AAWhF,eAAO,MAAM,mBAAmB,MAE3B,yBAAyB,KAC3B,QAAQ,0BAA0B,CAapC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["modules/lge/services/get-account-lge-status/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,yBAAyB,GAAG;IACtC,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AACF,MAAM,MAAM,0BAA0B,GAAG;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/lge/services/get-lge-boost-rate/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAOvE,eAAO,MAAM,eAAe,MAEvB,qBAAqB,KACvB,QAAQ,qBAAqB,CAa/B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["modules/lge/services/get-lge-boost-rate/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC;AACzC,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/lge/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reyaxyz/community-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
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.21.
|
|
13
|
+
"@reyaxyz/common": "0.21.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": "3777f4edc3ecb95df885f7102cf76059917d85c2"
|
|
41
41
|
}
|
package/src/client/index.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { SERVICE_CONFIG, ServiceConfig } from './constants';
|
|
2
2
|
import VoteModule from '../modules/vote';
|
|
3
|
+
import LGEModule from '../modules/lge';
|
|
3
4
|
|
|
4
5
|
export type ConfigureParams = {
|
|
5
6
|
environment: ServiceConfig['environment'];
|
|
@@ -12,10 +13,12 @@ export class CommunityClient {
|
|
|
12
13
|
private static instance: CommunityClient;
|
|
13
14
|
private static config: ServiceConfig = SERVICE_CONFIG['test'];
|
|
14
15
|
private readonly _vote: VoteModule;
|
|
16
|
+
private readonly _LGE: LGEModule;
|
|
15
17
|
|
|
16
18
|
private constructor(params: ConfigureParams) {
|
|
17
19
|
CommunityClient.config = SERVICE_CONFIG[params.environment];
|
|
18
20
|
this._vote = new VoteModule(CommunityClient.config.chainId);
|
|
21
|
+
this._LGE = new LGEModule(CommunityClient.config.chainId);
|
|
19
22
|
}
|
|
20
23
|
|
|
21
24
|
public static configure(params: ConfigureParams): void {
|
|
@@ -50,6 +53,17 @@ export class CommunityClient {
|
|
|
50
53
|
return CommunityClient.getInstance()._vote;
|
|
51
54
|
}
|
|
52
55
|
|
|
56
|
+
/**
|
|
57
|
+
* Provides access to the LGEModule instance.
|
|
58
|
+
* This getter allows for interacting with LGE-related functionalities.
|
|
59
|
+
*
|
|
60
|
+
* @returns {LGEModule} An instance of LGEModule for LGE operations.
|
|
61
|
+
* @memberof CommunityClient
|
|
62
|
+
*/
|
|
63
|
+
public static get LGE(): LGEModule {
|
|
64
|
+
return CommunityClient.getInstance()._LGE;
|
|
65
|
+
}
|
|
66
|
+
|
|
53
67
|
public static get supportedChain(): number {
|
|
54
68
|
return CommunityClient.config.chainId;
|
|
55
69
|
}
|
package/src/index.ts
CHANGED
|
@@ -2,4 +2,5 @@ export * from './types';
|
|
|
2
2
|
export * from './client';
|
|
3
3
|
export * from './modules/vote/services/get-vote-details/types';
|
|
4
4
|
export * from './modules/vote/services/get-vote-status/types';
|
|
5
|
-
export * from './modules/
|
|
5
|
+
export * from './modules/lge/services/get-account-lge-status/types';
|
|
6
|
+
export * from './modules/lge/services/get-lge-boost-rate/types';
|
package/src/modules/index.ts
CHANGED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ReyaChainId } from '@reyaxyz/common';
|
|
2
|
+
import {
|
|
3
|
+
getAccountLGEStatus,
|
|
4
|
+
GetAccountLGEStatusParams,
|
|
5
|
+
getLGEBoostRate,
|
|
6
|
+
GetLGEBoostRateParams,
|
|
7
|
+
} from './services';
|
|
8
|
+
|
|
9
|
+
export default class LGEModule {
|
|
10
|
+
private chainId: ReyaChainId;
|
|
11
|
+
|
|
12
|
+
constructor(chainId: ReyaChainId) {
|
|
13
|
+
this.chainId = chainId;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
async getLGEBoostRate(params: GetLGEBoostRateParams) {
|
|
17
|
+
return getLGEBoostRate(params);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async getAccountLGEStatus(params: GetAccountLGEStatusParams) {
|
|
21
|
+
return getAccountLGEStatus(params);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { GetAccountLGEStatusParams, GetLAccountLGEStatusResult } from './types';
|
|
2
|
+
|
|
3
|
+
function mockAccountLGEStatus(): GetLAccountLGEStatusResult {
|
|
4
|
+
return {
|
|
5
|
+
currentBoost: Math.random() * 100,
|
|
6
|
+
deposited: Math.floor(Math.random() * 10000) + 1000,
|
|
7
|
+
xp: Math.floor(Math.random() * 100) + 1000,
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// TODO: Write proper implementation
|
|
12
|
+
export const getAccountLGEStatus = async (
|
|
13
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
14
|
+
_: GetAccountLGEStatusParams,
|
|
15
|
+
): Promise<GetLAccountLGEStatusResult> => {
|
|
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 not found'));
|
|
22
|
+
}
|
|
23
|
+
resolve(mockAccountLGEStatus());
|
|
24
|
+
},
|
|
25
|
+
Math.random() * 100 + 1000,
|
|
26
|
+
);
|
|
27
|
+
});
|
|
28
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { GetLGEBoostRateParams, GetLGEBoostRateResult } from './types';
|
|
2
|
+
|
|
3
|
+
function mockLGEBoostRate(): GetLGEBoostRateResult {
|
|
4
|
+
return Math.floor(Math.random() * 1000);
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
// TODO: Write proper implementation
|
|
8
|
+
export const getLGEBoostRate = async (
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
10
|
+
_: GetLGEBoostRateParams,
|
|
11
|
+
): Promise<GetLGEBoostRateResult> => {
|
|
12
|
+
return await new Promise((resolve, reject) => {
|
|
13
|
+
setTimeout(
|
|
14
|
+
() => {
|
|
15
|
+
const error = Math.random() * 100 > 50;
|
|
16
|
+
if (error) {
|
|
17
|
+
reject(new Error('Vote not found'));
|
|
18
|
+
}
|
|
19
|
+
resolve(mockLGEBoostRate());
|
|
20
|
+
},
|
|
21
|
+
Math.random() * 100 + 1000,
|
|
22
|
+
);
|
|
23
|
+
});
|
|
24
|
+
};
|