@reyaxyz/community-sdk 0.7.2 → 0.8.1

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.
Files changed (40) hide show
  1. package/dist/client/index.js +16 -0
  2. package/dist/client/index.js.map +1 -1
  3. package/dist/index.js +1 -0
  4. package/dist/index.js.map +1 -1
  5. package/dist/modules/trading-league/index.js +53 -0
  6. package/dist/modules/trading-league/index.js.map +1 -0
  7. package/dist/modules/trading-league/services/get-leaderboard/index.js +64 -0
  8. package/dist/modules/trading-league/services/get-leaderboard/index.js.map +1 -0
  9. package/dist/modules/trading-league/services/get-leaderboard/mock.js +28 -0
  10. package/dist/modules/trading-league/services/get-leaderboard/mock.js.map +1 -0
  11. package/dist/modules/trading-league/services/get-leaderboard/types.js +3 -0
  12. package/dist/modules/trading-league/services/get-leaderboard/types.js.map +1 -0
  13. package/dist/modules/trading-league/services/index.js +19 -0
  14. package/dist/modules/trading-league/services/index.js.map +1 -0
  15. package/dist/types/client/index.d.ts +10 -0
  16. package/dist/types/client/index.d.ts.map +1 -1
  17. package/dist/types/index.d.ts +1 -0
  18. package/dist/types/index.d.ts.map +1 -1
  19. package/dist/types/modules/trading-league/index.d.ts +5 -0
  20. package/dist/types/modules/trading-league/index.d.ts.map +1 -0
  21. package/dist/types/modules/trading-league/services/get-leaderboard/index.d.ts +3 -0
  22. package/dist/types/modules/trading-league/services/get-leaderboard/index.d.ts.map +1 -0
  23. package/dist/types/modules/trading-league/services/get-leaderboard/mock.d.ts +3 -0
  24. package/dist/types/modules/trading-league/services/get-leaderboard/mock.d.ts.map +1 -0
  25. package/dist/types/modules/trading-league/services/get-leaderboard/types.d.ts +15 -0
  26. package/dist/types/modules/trading-league/services/get-leaderboard/types.d.ts.map +1 -0
  27. package/dist/types/modules/trading-league/services/index.d.ts +3 -0
  28. package/dist/types/modules/trading-league/services/index.d.ts.map +1 -0
  29. package/dist/types/utils/contractAddresses.d.ts.map +1 -1
  30. package/dist/utils/contractAddresses.js +2 -2
  31. package/dist/utils/contractAddresses.js.map +1 -1
  32. package/package.json +2 -2
  33. package/src/client/index.ts +14 -0
  34. package/src/index.ts +1 -0
  35. package/src/modules/trading-league/index.ts +7 -0
  36. package/src/modules/trading-league/services/get-leaderboard/index.ts +31 -0
  37. package/src/modules/trading-league/services/get-leaderboard/mock.ts +30 -0
  38. package/src/modules/trading-league/services/get-leaderboard/types.ts +15 -0
  39. package/src/modules/trading-league/services/index.ts +2 -0
  40. package/src/utils/contractAddresses.ts +3 -2
@@ -8,6 +8,7 @@ var common_1 = require("@reyaxyz/common");
8
8
  var vote_1 = __importDefault(require("../modules/vote"));
9
9
  var lge_1 = __importDefault(require("../modules/lge"));
10
10
  var twitter_1 = __importDefault(require("../modules/twitter"));
11
+ var trading_league_1 = __importDefault(require("../modules/trading-league"));
11
12
  /**
12
13
  * @description Client for Community SDK
13
14
  */
@@ -16,6 +17,7 @@ var CommunityClient = /** @class */ (function () {
16
17
  this._vote = new vote_1.default(CommunityClient.config.apiEndpoint);
17
18
  this._LGE = new lge_1.default(CommunityClient.config.chain);
18
19
  this._twitter = new twitter_1.default(CommunityClient.config.twitter.redirectURI, CommunityClient.config.twitter.clientId);
20
+ this._tradingLeague = new trading_league_1.default();
19
21
  }
20
22
  CommunityClient.configure = function (environment) {
21
23
  CommunityClient.config =
@@ -70,6 +72,20 @@ var CommunityClient = /** @class */ (function () {
70
72
  enumerable: false,
71
73
  configurable: true
72
74
  });
75
+ Object.defineProperty(CommunityClient, "tradingLeague", {
76
+ /**
77
+ * Provides access to the TradingLeagueModule instance.
78
+ * This getter allows for interacting with trading-league-related functionalities.
79
+ *
80
+ * @returns {TradingLeagueModule} An instance of Trading League for twitter operations.
81
+ * @memberof CommunityClient
82
+ */
83
+ get: function () {
84
+ return CommunityClient.getInstance()._tradingLeague;
85
+ },
86
+ enumerable: false,
87
+ configurable: true
88
+ });
73
89
  Object.defineProperty(CommunityClient, "supportedChain", {
74
90
  get: function () {
75
91
  return CommunityClient.config.chain;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["client/index.ts"],"names":[],"mappings":";;;;;;AAAA,0CAAoE;AACpE,yDAAyC;AACzC,uDAAuC;AACvC,+DAA+C;AAE/C;;GAEG;AACH;IAQE;QACE,IAAI,CAAC,KAAK,GAAG,IAAI,cAAU,CAAC,eAAe,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QAChE,IAAI,CAAC,IAAI,GAAG,IAAI,aAAS,CAAC,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACxD,IAAI,CAAC,QAAQ,GAAG,IAAI,iBAAa,CAC/B,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,EAC1C,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CACxC,CAAC;IACJ,CAAC;IAEa,yBAAS,GAAvB,UAAwB,WAAyC;QAC/D,eAAe,CAAC,MAAM;YACpB,2BAAkB,CAAC,WAAW,CAAC,IAAI,2BAAkB,CAAC,MAAM,CAAC,CAAC;QAChE,eAAe,CAAC,QAAQ,GAAG,IAAI,eAAe,EAAE,CAAC;IACnD,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;IASD,sBAAkB,0BAAO;QAPzB;;;;;;WAMG;aACH;YACE,OAAO,eAAe,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC;QAChD,CAAC;;;OAAA;IAED,sBAAkB,iCAAc;aAAhC;YACE,OAAO,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC;QACtC,CAAC;;;OAAA;IAjEc,sBAAM,GAAkB,2BAAkB,CAAC,MAAM,CAAC,CAAC;IAkEpE,sBAAC;CAAA,AApED,IAoEC;AApEY,0CAAe","sourcesContent":["import { API_CLIENT_CONFIGS, ServiceConfig } from '@reyaxyz/common';\nimport VoteModule from '../modules/vote';\nimport LGEModule from '../modules/lge';\nimport TwitterModule from '../modules/twitter';\n\n/**\n * @description Client for Community SDK\n */\nexport class CommunityClient {\n private static instance: CommunityClient;\n private static config: ServiceConfig = API_CLIENT_CONFIGS['test'];\n\n private readonly _vote: VoteModule;\n private readonly _LGE: LGEModule;\n private readonly _twitter: TwitterModule;\n\n private constructor() {\n this._vote = new VoteModule(CommunityClient.config.apiEndpoint);\n this._LGE = new LGEModule(CommunityClient.config.chain);\n this._twitter = new TwitterModule(\n CommunityClient.config.twitter.redirectURI,\n CommunityClient.config.twitter.clientId,\n );\n }\n\n public static configure(environment: ServiceConfig['environment']): void {\n CommunityClient.config =\n API_CLIENT_CONFIGS[environment] || API_CLIENT_CONFIGS['test'];\n CommunityClient.instance = new CommunityClient();\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 /**\n * Provides access to the TwitterModule instance.\n * This getter allows for interacting with twitter-related functionalities.\n *\n * @returns {TwitterModule} An instance of Twitter for twitter operations.\n * @memberof CommunityClient\n */\n public static get twitter(): TwitterModule {\n return CommunityClient.getInstance()._twitter;\n }\n\n public static get supportedChain(): number {\n return CommunityClient.config.chain;\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["client/index.ts"],"names":[],"mappings":";;;;;;AAAA,0CAAoE;AACpE,yDAAyC;AACzC,uDAAuC;AACvC,+DAA+C;AAC/C,6EAA4D;AAE5D;;GAEG;AACH;IASE;QACE,IAAI,CAAC,KAAK,GAAG,IAAI,cAAU,CAAC,eAAe,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QAChE,IAAI,CAAC,IAAI,GAAG,IAAI,aAAS,CAAC,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;QACxD,IAAI,CAAC,QAAQ,GAAG,IAAI,iBAAa,CAC/B,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,EAC1C,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CACxC,CAAC;QACF,IAAI,CAAC,cAAc,GAAG,IAAI,wBAAmB,EAAE,CAAC;IAClD,CAAC;IAEa,yBAAS,GAAvB,UAAwB,WAAyC;QAC/D,eAAe,CAAC,MAAM;YACpB,2BAAkB,CAAC,WAAW,CAAC,IAAI,2BAAkB,CAAC,MAAM,CAAC,CAAC;QAChE,eAAe,CAAC,QAAQ,GAAG,IAAI,eAAe,EAAE,CAAC;IACnD,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;IASD,sBAAkB,0BAAO;QAPzB;;;;;;WAMG;aACH;YACE,OAAO,eAAe,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC;QAChD,CAAC;;;OAAA;IASD,sBAAkB,gCAAa;QAP/B;;;;;;WAMG;aACH;YACE,OAAO,eAAe,CAAC,WAAW,EAAE,CAAC,cAAc,CAAC;QACtD,CAAC;;;OAAA;IAED,sBAAkB,iCAAc;aAAhC;YACE,OAAO,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC;QACtC,CAAC;;;OAAA;IA9Ec,sBAAM,GAAkB,2BAAkB,CAAC,MAAM,CAAC,CAAC;IA+EpE,sBAAC;CAAA,AAjFD,IAiFC;AAjFY,0CAAe","sourcesContent":["import { API_CLIENT_CONFIGS, ServiceConfig } from '@reyaxyz/common';\nimport VoteModule from '../modules/vote';\nimport LGEModule from '../modules/lge';\nimport TwitterModule from '../modules/twitter';\nimport TradingLeagueModule from '../modules/trading-league';\n\n/**\n * @description Client for Community SDK\n */\nexport class CommunityClient {\n private static instance: CommunityClient;\n private static config: ServiceConfig = API_CLIENT_CONFIGS['test'];\n\n private readonly _vote: VoteModule;\n private readonly _LGE: LGEModule;\n private readonly _twitter: TwitterModule;\n private readonly _tradingLeague: TradingLeagueModule;\n\n private constructor() {\n this._vote = new VoteModule(CommunityClient.config.apiEndpoint);\n this._LGE = new LGEModule(CommunityClient.config.chain);\n this._twitter = new TwitterModule(\n CommunityClient.config.twitter.redirectURI,\n CommunityClient.config.twitter.clientId,\n );\n this._tradingLeague = new TradingLeagueModule();\n }\n\n public static configure(environment: ServiceConfig['environment']): void {\n CommunityClient.config =\n API_CLIENT_CONFIGS[environment] || API_CLIENT_CONFIGS['test'];\n CommunityClient.instance = new CommunityClient();\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 /**\n * Provides access to the TwitterModule instance.\n * This getter allows for interacting with twitter-related functionalities.\n *\n * @returns {TwitterModule} An instance of Twitter for twitter operations.\n * @memberof CommunityClient\n */\n public static get twitter(): TwitterModule {\n return CommunityClient.getInstance()._twitter;\n }\n\n /**\n * Provides access to the TradingLeagueModule instance.\n * This getter allows for interacting with trading-league-related functionalities.\n *\n * @returns {TradingLeagueModule} An instance of Trading League for twitter operations.\n * @memberof CommunityClient\n */\n public static get tradingLeague(): TradingLeagueModule {\n return CommunityClient.getInstance()._tradingLeague;\n }\n\n public static get supportedChain(): number {\n return CommunityClient.config.chain;\n }\n}\n"]}
package/dist/index.js CHANGED
@@ -19,4 +19,5 @@ __exportStar(require("./modules/lge/services/get-account-lge-status/types"), exp
19
19
  __exportStar(require("./modules/lge/services/get-lge-boost-rate/types"), exports);
20
20
  __exportStar(require("./modules/twitter/services/get-auth-url/types"), exports);
21
21
  __exportStar(require("./modules/vote/types"), exports);
22
+ __exportStar(require("./modules/trading-league/services/get-leaderboard/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,2CAAyB;AACzB,sFAAoE;AACpE,kFAAgE;AAChE,gFAA8D;AAC9D,uDAAqC","sourcesContent":["export * from './client';\nexport * from './modules/lge/services/get-account-lge-status/types';\nexport * from './modules/lge/services/get-lge-boost-rate/types';\nexport * from './modules/twitter/services/get-auth-url/types';\nexport * from './modules/vote/types';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,sFAAoE;AACpE,kFAAgE;AAChE,gFAA8D;AAC9D,uDAAqC;AACrC,0FAAwE","sourcesContent":["export * from './client';\nexport * from './modules/lge/services/get-account-lge-status/types';\nexport * from './modules/lge/services/get-lge-boost-rate/types';\nexport * from './modules/twitter/services/get-auth-url/types';\nexport * from './modules/vote/types';\nexport * from './modules/trading-league/services/get-leaderboard/types';\n"]}
@@ -0,0 +1,53 @@
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 TradingLeagueModule = /** @class */ (function () {
41
+ function TradingLeagueModule() {
42
+ }
43
+ TradingLeagueModule.prototype.getLeaderboard = function (params) {
44
+ return __awaiter(this, void 0, void 0, function () {
45
+ return __generator(this, function (_a) {
46
+ return [2 /*return*/, (0, services_1.getLeaderboard)(params)];
47
+ });
48
+ });
49
+ };
50
+ return TradingLeagueModule;
51
+ }());
52
+ exports.default = TradingLeagueModule;
53
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/trading-league/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAkE;AAElE;IAAA;IAIA,CAAC;IAHO,4CAAc,GAApB,UAAqB,MAA4B;;;gBAC/C,sBAAO,IAAA,yBAAc,EAAC,MAAM,CAAC,EAAC;;;KAC/B;IACH,0BAAC;AAAD,CAAC,AAJD,IAIC","sourcesContent":["import { getLeaderboard, GetLeaderboardParams } from './services';\n\nexport default class TradingLeagueModule {\n async getLeaderboard(params: GetLeaderboardParams) {\n return getLeaderboard(params);\n }\n}\n"]}
@@ -0,0 +1,64 @@
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.getLeaderboard = void 0;
40
+ var mock_1 = require("./mock");
41
+ var mockedData = [];
42
+ // TODO: Write proper implementation
43
+ var getLeaderboard = function (_) { return __awaiter(void 0, void 0, void 0, function () {
44
+ var page, perPage, toReturn;
45
+ return __generator(this, function (_a) {
46
+ switch (_a.label) {
47
+ case 0:
48
+ if (mockedData.length === 0) {
49
+ mockedData = (0, mock_1.generateMockData)(Math.floor(Math.random() * (123 - 5 + 1)) + 5);
50
+ }
51
+ page = _.page;
52
+ perPage = _.perPage;
53
+ toReturn = mockedData.slice(page * perPage, page * perPage + perPage);
54
+ return [4 /*yield*/, new Promise(function (resolve) {
55
+ setTimeout(function () {
56
+ resolve(toReturn);
57
+ }, Math.random() * 100 + 1000);
58
+ })];
59
+ case 1: return [2 /*return*/, _a.sent()];
60
+ }
61
+ });
62
+ }); };
63
+ exports.getLeaderboard = getLeaderboard;
64
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/trading-league/services/get-leaderboard/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,+BAA0C;AAE1C,IAAI,UAAU,GAAwB,EAAE,CAAC;AAEzC,oCAAoC;AAC7B,IAAM,cAAc,GAAG,UAC5B,CAAuB;;;;;gBAEvB,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;oBAC5B,UAAU,GAAG,IAAA,uBAAgB,EAC3B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAC9C,CAAC;gBACJ,CAAC;gBACK,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC;gBACd,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC;gBACpB,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,IAAI,GAAG,OAAO,EAAE,IAAI,GAAG,OAAO,GAAG,OAAO,CAAC,CAAC;gBAErE,qBAAM,IAAI,OAAO,CAAC,UAAC,OAAO;wBAC/B,UAAU,CACR;4BACE,OAAO,CAAC,QAAQ,CAAC,CAAC;wBACpB,CAAC,EACD,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,IAAI,CAC3B,CAAC;oBACJ,CAAC,CAAC,EAAA;oBAPF,sBAAO,SAOL,EAAC;;;KACJ,CAAC;AApBW,QAAA,cAAc,kBAoBzB","sourcesContent":["import {\n GetLeaderboardParams,\n GetLeaderboardResult,\n LeaderboardEntity,\n} from './types';\nimport { generateMockData } from './mock';\n\nlet mockedData: LeaderboardEntity[] = [];\n\n// TODO: Write proper implementation\nexport const getLeaderboard = async (\n _: GetLeaderboardParams,\n): Promise<GetLeaderboardResult> => {\n if (mockedData.length === 0) {\n mockedData = generateMockData(\n Math.floor(Math.random() * (123 - 5 + 1)) + 5,\n );\n }\n const page = _.page;\n const perPage = _.perPage;\n const toReturn = mockedData.slice(page * perPage, page * perPage + perPage);\n\n return await new Promise((resolve) => {\n setTimeout(\n () => {\n resolve(toReturn);\n },\n Math.random() * 100 + 1000,\n );\n });\n};\n"]}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.generateMockData = void 0;
4
+ function generateMockData(recordsCount) {
5
+ var characters = '0123456789ABCDEF';
6
+ var mockData = [];
7
+ var generateAddress = function () {
8
+ var address = '0x';
9
+ for (var i = 0; i < 40; i++) {
10
+ address += characters.charAt(Math.floor(Math.random() * characters.length));
11
+ }
12
+ return address;
13
+ };
14
+ for (var i = 0; i < recordsCount; i++) {
15
+ mockData.push({
16
+ address: generateAddress(),
17
+ currentBoost: parseFloat((Math.random() * 5 + 0.1).toFixed(1)),
18
+ liquidityXp: Math.random() * 100000,
19
+ rank: Math.floor(Math.random() * recordsCount) + 1,
20
+ ranking: i + 1,
21
+ totalXp: Math.random() * 100000,
22
+ tradingXp: Math.random() * 10000,
23
+ });
24
+ }
25
+ return mockData;
26
+ }
27
+ exports.generateMockData = generateMockData;
28
+ //# sourceMappingURL=mock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mock.js","sourceRoot":"/","sources":["modules/trading-league/services/get-leaderboard/mock.ts"],"names":[],"mappings":";;;AAEA,SAAgB,gBAAgB,CAAC,YAAoB;IACnD,IAAM,UAAU,GAAG,kBAAkB,CAAC;IACtC,IAAM,QAAQ,GAAwB,EAAE,CAAC;IAEzC,IAAM,eAAe,GAAG;QACtB,IAAI,OAAO,GAAG,IAAI,CAAC;QACnB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;YAC5B,OAAO,IAAI,UAAU,CAAC,MAAM,CAC1B,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,UAAU,CAAC,MAAM,CAAC,CAC9C,CAAC;QACJ,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC;IAEF,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,QAAQ,CAAC,IAAI,CAAC;YACZ,OAAO,EAAE,eAAe,EAAE;YAC1B,YAAY,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YAC9D,WAAW,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,MAAM;YACnC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,YAAY,CAAC,GAAG,CAAC;YAClD,OAAO,EAAE,CAAC,GAAG,CAAC;YACd,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,MAAM;YAC/B,SAAS,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK;SACjC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AA3BD,4CA2BC","sourcesContent":["import { LeaderboardEntity } from './types';\n\nexport function generateMockData(recordsCount: number): LeaderboardEntity[] {\n const characters = '0123456789ABCDEF';\n const mockData: LeaderboardEntity[] = [];\n\n const generateAddress = () => {\n let address = '0x';\n for (let i = 0; i < 40; i++) {\n address += characters.charAt(\n Math.floor(Math.random() * characters.length),\n );\n }\n return address;\n };\n\n for (let i = 0; i < recordsCount; i++) {\n mockData.push({\n address: generateAddress(),\n currentBoost: parseFloat((Math.random() * 5 + 0.1).toFixed(1)),\n liquidityXp: Math.random() * 100000,\n rank: Math.floor(Math.random() * recordsCount) + 1,\n ranking: i + 1,\n totalXp: Math.random() * 100000,\n tradingXp: Math.random() * 10000,\n });\n }\n\n return mockData;\n}\n"]}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"/","sources":["modules/trading-league/services/get-leaderboard/types.ts"],"names":[],"mappings":"","sourcesContent":["export type LeaderboardEntity = {\n address: string;\n currentBoost: number;\n liquidityXp: number;\n rank: number;\n totalXp: number;\n ranking: number;\n tradingXp: number;\n};\n\nexport type GetLeaderboardParams = {\n page: number;\n perPage: number;\n};\nexport type GetLeaderboardResult = LeaderboardEntity[];\n"]}
@@ -0,0 +1,19 @@
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-leaderboard"), exports);
18
+ __exportStar(require("./get-leaderboard/types"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/trading-league/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAkC;AAClC,0DAAwC","sourcesContent":["export * from './get-leaderboard';\nexport * from './get-leaderboard/types';\n"]}
@@ -2,6 +2,7 @@ import { ServiceConfig } from '@reyaxyz/common';
2
2
  import VoteModule from '../modules/vote';
3
3
  import LGEModule from '../modules/lge';
4
4
  import TwitterModule from '../modules/twitter';
5
+ import TradingLeagueModule from '../modules/trading-league';
5
6
  /**
6
7
  * @description Client for Community SDK
7
8
  */
@@ -11,6 +12,7 @@ export declare class CommunityClient {
11
12
  private readonly _vote;
12
13
  private readonly _LGE;
13
14
  private readonly _twitter;
15
+ private readonly _tradingLeague;
14
16
  private constructor();
15
17
  static configure(environment: ServiceConfig['environment']): void;
16
18
  private static getInstance;
@@ -38,6 +40,14 @@ export declare class CommunityClient {
38
40
  * @memberof CommunityClient
39
41
  */
40
42
  static get twitter(): TwitterModule;
43
+ /**
44
+ * Provides access to the TradingLeagueModule instance.
45
+ * This getter allows for interacting with trading-league-related functionalities.
46
+ *
47
+ * @returns {TradingLeagueModule} An instance of Trading League for twitter operations.
48
+ * @memberof CommunityClient
49
+ */
50
+ static get tradingLeague(): TradingLeagueModule;
41
51
  static get supportedChain(): number;
42
52
  }
43
53
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAE/C;;GAEG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAkB;IACzC,OAAO,CAAC,MAAM,CAAC,MAAM,CAA6C;IAElE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAa;IACnC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAY;IACjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgB;IAEzC,OAAO;WASO,SAAS,CAAC,WAAW,EAAE,aAAa,CAAC,aAAa,CAAC,GAAG,IAAI;IAMxE,OAAO,CAAC,MAAM,CAAC,WAAW;IAS1B;;;;;;OAMG;IACH,WAAkB,IAAI,IAAI,UAAU,CAEnC;IAED;;;;;;OAMG;IACH,WAAkB,GAAG,IAAI,SAAS,CAEjC;IAED;;;;;;OAMG;IACH,WAAkB,OAAO,IAAI,aAAa,CAEzC;IAED,WAAkB,cAAc,IAAI,MAAM,CAEzC;CACF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAC/C,OAAO,mBAAmB,MAAM,2BAA2B,CAAC;AAE5D;;GAEG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAkB;IACzC,OAAO,CAAC,MAAM,CAAC,MAAM,CAA6C;IAElE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAa;IACnC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAY;IACjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgB;IACzC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAsB;IAErD,OAAO;WAUO,SAAS,CAAC,WAAW,EAAE,aAAa,CAAC,aAAa,CAAC,GAAG,IAAI;IAMxE,OAAO,CAAC,MAAM,CAAC,WAAW;IAS1B;;;;;;OAMG;IACH,WAAkB,IAAI,IAAI,UAAU,CAEnC;IAED;;;;;;OAMG;IACH,WAAkB,GAAG,IAAI,SAAS,CAEjC;IAED;;;;;;OAMG;IACH,WAAkB,OAAO,IAAI,aAAa,CAEzC;IAED;;;;;;OAMG;IACH,WAAkB,aAAa,IAAI,mBAAmB,CAErD;IAED,WAAkB,cAAc,IAAI,MAAM,CAEzC;CACF"}
@@ -3,4 +3,5 @@ export * from './modules/lge/services/get-account-lge-status/types';
3
3
  export * from './modules/lge/services/get-lge-boost-rate/types';
4
4
  export * from './modules/twitter/services/get-auth-url/types';
5
5
  export * from './modules/vote/types';
6
+ export * from './modules/trading-league/services/get-leaderboard/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,UAAU,CAAC;AACzB,cAAc,qDAAqD,CAAC;AACpE,cAAc,iDAAiD,CAAC;AAChE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,qDAAqD,CAAC;AACpE,cAAc,iDAAiD,CAAC;AAChE,cAAc,+CAA+C,CAAC;AAC9D,cAAc,sBAAsB,CAAC;AACrC,cAAc,yDAAyD,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { GetLeaderboardParams } from './services';
2
+ export default class TradingLeagueModule {
3
+ getLeaderboard(params: GetLeaderboardParams): Promise<import("./services").GetLeaderboardResult>;
4
+ }
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/trading-league/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAElE,MAAM,CAAC,OAAO,OAAO,mBAAmB;IAChC,cAAc,CAAC,MAAM,EAAE,oBAAoB;CAGlD"}
@@ -0,0 +1,3 @@
1
+ import { GetLeaderboardParams, GetLeaderboardResult } from './types';
2
+ export declare const getLeaderboard: (_: GetLeaderboardParams) => Promise<GetLeaderboardResult>;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/trading-league/services/get-leaderboard/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EAErB,MAAM,SAAS,CAAC;AAMjB,eAAO,MAAM,cAAc,MACtB,oBAAoB,KACtB,QAAQ,oBAAoB,CAkB9B,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { LeaderboardEntity } from './types';
2
+ export declare function generateMockData(recordsCount: number): LeaderboardEntity[];
3
+ //# sourceMappingURL=mock.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mock.d.ts","sourceRoot":"/","sources":["modules/trading-league/services/get-leaderboard/mock.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAE5C,wBAAgB,gBAAgB,CAAC,YAAY,EAAE,MAAM,GAAG,iBAAiB,EAAE,CA2B1E"}
@@ -0,0 +1,15 @@
1
+ export type LeaderboardEntity = {
2
+ address: string;
3
+ currentBoost: number;
4
+ liquidityXp: number;
5
+ rank: number;
6
+ totalXp: number;
7
+ ranking: number;
8
+ tradingXp: number;
9
+ };
10
+ export type GetLeaderboardParams = {
11
+ page: number;
12
+ perPage: number;
13
+ };
14
+ export type GetLeaderboardResult = LeaderboardEntity[];
15
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["modules/trading-league/services/get-leaderboard/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AACF,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,EAAE,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './get-leaderboard';
2
+ export * from './get-leaderboard/types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/trading-league/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"contractAddresses.d.ts","sourceRoot":"/","sources":["utils/contractAddresses.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;AAIxC,oBAAY,YAAY;IACtB,kBAAkB,uBAAuB;IACzC,WAAW,gBAAgB;CAC5B;AAmBD,eAAO,MAAM,UAAU,YACZ,MAAM,gBACD,YAAY,KACzB,MAaF,CAAC"}
1
+ {"version":3,"file":"contractAddresses.d.ts","sourceRoot":"/","sources":["utils/contractAddresses.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;AAIxC,oBAAY,YAAY;IACtB,kBAAkB,uBAAuB;IACzC,WAAW,gBAAgB;CAC5B;AAoBD,eAAO,MAAM,UAAU,YACZ,MAAM,gBACD,YAAY,KACzB,MAaF,CAAC"}
@@ -16,8 +16,8 @@ var addresses = (_a = {},
16
16
  _b[ContractType.RANKS_PROXY] = '0xf2a1fca4f1e08f84eef135395b6e8df7cb02d59f',
17
17
  _b),
18
18
  _a[common_1.ReyaChainId.reyaCronos] = (_c = {},
19
- _c[ContractType.COMMUNITY_DEPLOYER] = 'todo',
20
- _c[ContractType.RANKS_PROXY] = 'todo',
19
+ _c[ContractType.COMMUNITY_DEPLOYER] = '0x0fc85eb14c45acc1534257431f6a079cf3bbdfe9',
20
+ _c[ContractType.RANKS_PROXY] = '0xddc9759e9218fc4b1d56e3d75b2936f877dc6dea',
21
21
  _c),
22
22
  _a[common_1.ReyaChainId.reyaNetwork] = (_d = {},
23
23
  _d[ContractType.COMMUNITY_DEPLOYER] = 'todo',
@@ -1 +1 @@
1
- {"version":3,"file":"contractAddresses.js","sourceRoot":"/","sources":["utils/contractAddresses.ts"],"names":[],"mappings":";;;;AACA,+CAA+C;AAC/C,0CAA8C;AAE9C,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,yDAAyC,CAAA;IACzC,2CAA2B,CAAA;AAC7B,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB;AAED,IAAM,SAAS;IACb,GAAC,oBAAW,CAAC,aAAa;QACxB,wDAAwD;QACxD,GAAC,YAAY,CAAC,kBAAkB,IAC9B,4CAA4C;QAC9C,GAAC,YAAY,CAAC,WAAW,IAAG,4CAA4C;WACzE;IACD,GAAC,oBAAW,CAAC,UAAU;QACrB,GAAC,YAAY,CAAC,kBAAkB,IAAG,MAAM;QACzC,GAAC,YAAY,CAAC,WAAW,IAAG,MAAM;WACnC;IACD,GAAC,oBAAW,CAAC,WAAW;QACtB,GAAC,YAAY,CAAC,kBAAkB,IAAG,MAAM;QACzC,GAAC,YAAY,CAAC,WAAW,IAAG,MAAM;WACnC;OACF,CAAC;AAEK,IAAM,UAAU,GAAG,UACxB,OAAe,EACf,YAA0B;IAE1B,IAAM,UAAU,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAEtC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QACjD,OAAO,6CAAsC,UAAU,CAAE,CAAC;IAC5D,CAAC;IAED,IAAM,gBAAgB,GAAG,SAAS,CAAC,OAAsB,CAAC,CAAC;IAC3D,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;QAC1D,OAAO,kCAA2B,YAAY,cAAW,CAAC;IAC5D,CAAC;IAED,OAAO,gBAAgB,CAAC,YAAY,CAAC,CAAC;AACxC,CAAC,CAAC;AAhBW,QAAA,UAAU,cAgBrB","sourcesContent":["export type Address = Lowercase<string>;\n// @todo update with proper chainId for mainnet\nimport { ReyaChainId } from '@reyaxyz/common';\n\nexport enum ContractType {\n COMMUNITY_DEPLOYER = 'community_deployer',\n RANKS_PROXY = 'ranks_proxy',\n}\n\nconst addresses: Record<ReyaChainId, Record<ContractType, Address>> = {\n [ReyaChainId.polygonMumbai]: {\n // todo replace with mapping from id to contract address\n [ContractType.COMMUNITY_DEPLOYER]:\n '0x69b480a57eb3ab98d68c5d5590ad63bf4d5eb3f7',\n [ContractType.RANKS_PROXY]: '0xf2a1fca4f1e08f84eef135395b6e8df7cb02d59f',\n },\n [ReyaChainId.reyaCronos]: {\n [ContractType.COMMUNITY_DEPLOYER]: 'todo',\n [ContractType.RANKS_PROXY]: 'todo',\n },\n [ReyaChainId.reyaNetwork]: {\n [ContractType.COMMUNITY_DEPLOYER]: 'todo',\n [ContractType.RANKS_PROXY]: 'todo',\n },\n};\n\nexport const getAddress = (\n chainId: number,\n contractName: ContractType,\n): string => {\n const keyChainId = chainId.toString();\n\n if (!Object.keys(addresses).includes(keyChainId)) {\n return `Unspecified addresses for chain id ${keyChainId}`;\n }\n\n const networkAddresses = addresses[chainId as ReyaChainId];\n if (!Object.keys(networkAddresses).includes(contractName)) {\n return `Unspecified address for ${contractName} contract`;\n }\n\n return networkAddresses[contractName];\n};\n"]}
1
+ {"version":3,"file":"contractAddresses.js","sourceRoot":"/","sources":["utils/contractAddresses.ts"],"names":[],"mappings":";;;;AACA,+CAA+C;AAC/C,0CAA8C;AAE9C,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,yDAAyC,CAAA;IACzC,2CAA2B,CAAA;AAC7B,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB;AAED,IAAM,SAAS;IACb,GAAC,oBAAW,CAAC,aAAa;QACxB,wDAAwD;QACxD,GAAC,YAAY,CAAC,kBAAkB,IAC9B,4CAA4C;QAC9C,GAAC,YAAY,CAAC,WAAW,IAAG,4CAA4C;WACzE;IACD,GAAC,oBAAW,CAAC,UAAU;QACrB,GAAC,YAAY,CAAC,kBAAkB,IAC9B,4CAA4C;QAC9C,GAAC,YAAY,CAAC,WAAW,IAAG,4CAA4C;WACzE;IACD,GAAC,oBAAW,CAAC,WAAW;QACtB,GAAC,YAAY,CAAC,kBAAkB,IAAG,MAAM;QACzC,GAAC,YAAY,CAAC,WAAW,IAAG,MAAM;WACnC;OACF,CAAC;AAEK,IAAM,UAAU,GAAG,UACxB,OAAe,EACf,YAA0B;IAE1B,IAAM,UAAU,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAEtC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QACjD,OAAO,6CAAsC,UAAU,CAAE,CAAC;IAC5D,CAAC;IAED,IAAM,gBAAgB,GAAG,SAAS,CAAC,OAAsB,CAAC,CAAC;IAC3D,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;QAC1D,OAAO,kCAA2B,YAAY,cAAW,CAAC;IAC5D,CAAC;IAED,OAAO,gBAAgB,CAAC,YAAY,CAAC,CAAC;AACxC,CAAC,CAAC;AAhBW,QAAA,UAAU,cAgBrB","sourcesContent":["export type Address = Lowercase<string>;\n// @todo update with proper chainId for mainnet\nimport { ReyaChainId } from '@reyaxyz/common';\n\nexport enum ContractType {\n COMMUNITY_DEPLOYER = 'community_deployer',\n RANKS_PROXY = 'ranks_proxy',\n}\n\nconst addresses: Record<ReyaChainId, Record<ContractType, Address>> = {\n [ReyaChainId.polygonMumbai]: {\n // todo replace with mapping from id to contract address\n [ContractType.COMMUNITY_DEPLOYER]:\n '0x69b480a57eb3ab98d68c5d5590ad63bf4d5eb3f7',\n [ContractType.RANKS_PROXY]: '0xf2a1fca4f1e08f84eef135395b6e8df7cb02d59f',\n },\n [ReyaChainId.reyaCronos]: {\n [ContractType.COMMUNITY_DEPLOYER]:\n '0x0fc85eb14c45acc1534257431f6a079cf3bbdfe9',\n [ContractType.RANKS_PROXY]: '0xddc9759e9218fc4b1d56e3d75b2936f877dc6dea',\n },\n [ReyaChainId.reyaNetwork]: {\n [ContractType.COMMUNITY_DEPLOYER]: 'todo',\n [ContractType.RANKS_PROXY]: 'todo',\n },\n};\n\nexport const getAddress = (\n chainId: number,\n contractName: ContractType,\n): string => {\n const keyChainId = chainId.toString();\n\n if (!Object.keys(addresses).includes(keyChainId)) {\n return `Unspecified addresses for chain id ${keyChainId}`;\n }\n\n const networkAddresses = addresses[chainId as ReyaChainId];\n if (!Object.keys(networkAddresses).includes(contractName)) {\n return `Unspecified address for ${contractName} contract`;\n }\n\n return networkAddresses[contractName];\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reyaxyz/community-sdk",
3
- "version": "0.7.2",
3
+ "version": "0.8.1",
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": "a105ae34a6eed05f404cce4070164163d92f2c0d"
41
+ "gitHead": "b54466d9ba2679a09f24a35a1ba1ea26e9afc8c9"
42
42
  }
@@ -2,6 +2,7 @@ import { API_CLIENT_CONFIGS, ServiceConfig } from '@reyaxyz/common';
2
2
  import VoteModule from '../modules/vote';
3
3
  import LGEModule from '../modules/lge';
4
4
  import TwitterModule from '../modules/twitter';
5
+ import TradingLeagueModule from '../modules/trading-league';
5
6
 
6
7
  /**
7
8
  * @description Client for Community SDK
@@ -13,6 +14,7 @@ export class CommunityClient {
13
14
  private readonly _vote: VoteModule;
14
15
  private readonly _LGE: LGEModule;
15
16
  private readonly _twitter: TwitterModule;
17
+ private readonly _tradingLeague: TradingLeagueModule;
16
18
 
17
19
  private constructor() {
18
20
  this._vote = new VoteModule(CommunityClient.config.apiEndpoint);
@@ -21,6 +23,7 @@ export class CommunityClient {
21
23
  CommunityClient.config.twitter.redirectURI,
22
24
  CommunityClient.config.twitter.clientId,
23
25
  );
26
+ this._tradingLeague = new TradingLeagueModule();
24
27
  }
25
28
 
26
29
  public static configure(environment: ServiceConfig['environment']): void {
@@ -71,6 +74,17 @@ export class CommunityClient {
71
74
  return CommunityClient.getInstance()._twitter;
72
75
  }
73
76
 
77
+ /**
78
+ * Provides access to the TradingLeagueModule instance.
79
+ * This getter allows for interacting with trading-league-related functionalities.
80
+ *
81
+ * @returns {TradingLeagueModule} An instance of Trading League for twitter operations.
82
+ * @memberof CommunityClient
83
+ */
84
+ public static get tradingLeague(): TradingLeagueModule {
85
+ return CommunityClient.getInstance()._tradingLeague;
86
+ }
87
+
74
88
  public static get supportedChain(): number {
75
89
  return CommunityClient.config.chain;
76
90
  }
package/src/index.ts CHANGED
@@ -3,3 +3,4 @@ export * from './modules/lge/services/get-account-lge-status/types';
3
3
  export * from './modules/lge/services/get-lge-boost-rate/types';
4
4
  export * from './modules/twitter/services/get-auth-url/types';
5
5
  export * from './modules/vote/types';
6
+ export * from './modules/trading-league/services/get-leaderboard/types';
@@ -0,0 +1,7 @@
1
+ import { getLeaderboard, GetLeaderboardParams } from './services';
2
+
3
+ export default class TradingLeagueModule {
4
+ async getLeaderboard(params: GetLeaderboardParams) {
5
+ return getLeaderboard(params);
6
+ }
7
+ }
@@ -0,0 +1,31 @@
1
+ import {
2
+ GetLeaderboardParams,
3
+ GetLeaderboardResult,
4
+ LeaderboardEntity,
5
+ } from './types';
6
+ import { generateMockData } from './mock';
7
+
8
+ let mockedData: LeaderboardEntity[] = [];
9
+
10
+ // TODO: Write proper implementation
11
+ export const getLeaderboard = async (
12
+ _: GetLeaderboardParams,
13
+ ): Promise<GetLeaderboardResult> => {
14
+ if (mockedData.length === 0) {
15
+ mockedData = generateMockData(
16
+ Math.floor(Math.random() * (123 - 5 + 1)) + 5,
17
+ );
18
+ }
19
+ const page = _.page;
20
+ const perPage = _.perPage;
21
+ const toReturn = mockedData.slice(page * perPage, page * perPage + perPage);
22
+
23
+ return await new Promise((resolve) => {
24
+ setTimeout(
25
+ () => {
26
+ resolve(toReturn);
27
+ },
28
+ Math.random() * 100 + 1000,
29
+ );
30
+ });
31
+ };
@@ -0,0 +1,30 @@
1
+ import { LeaderboardEntity } from './types';
2
+
3
+ export function generateMockData(recordsCount: number): LeaderboardEntity[] {
4
+ const characters = '0123456789ABCDEF';
5
+ const mockData: LeaderboardEntity[] = [];
6
+
7
+ const generateAddress = () => {
8
+ let address = '0x';
9
+ for (let i = 0; i < 40; i++) {
10
+ address += characters.charAt(
11
+ Math.floor(Math.random() * characters.length),
12
+ );
13
+ }
14
+ return address;
15
+ };
16
+
17
+ for (let i = 0; i < recordsCount; i++) {
18
+ mockData.push({
19
+ address: generateAddress(),
20
+ currentBoost: parseFloat((Math.random() * 5 + 0.1).toFixed(1)),
21
+ liquidityXp: Math.random() * 100000,
22
+ rank: Math.floor(Math.random() * recordsCount) + 1,
23
+ ranking: i + 1,
24
+ totalXp: Math.random() * 100000,
25
+ tradingXp: Math.random() * 10000,
26
+ });
27
+ }
28
+
29
+ return mockData;
30
+ }
@@ -0,0 +1,15 @@
1
+ export type LeaderboardEntity = {
2
+ address: string;
3
+ currentBoost: number;
4
+ liquidityXp: number;
5
+ rank: number;
6
+ totalXp: number;
7
+ ranking: number;
8
+ tradingXp: number;
9
+ };
10
+
11
+ export type GetLeaderboardParams = {
12
+ page: number;
13
+ perPage: number;
14
+ };
15
+ export type GetLeaderboardResult = LeaderboardEntity[];
@@ -0,0 +1,2 @@
1
+ export * from './get-leaderboard';
2
+ export * from './get-leaderboard/types';
@@ -15,8 +15,9 @@ const addresses: Record<ReyaChainId, Record<ContractType, Address>> = {
15
15
  [ContractType.RANKS_PROXY]: '0xf2a1fca4f1e08f84eef135395b6e8df7cb02d59f',
16
16
  },
17
17
  [ReyaChainId.reyaCronos]: {
18
- [ContractType.COMMUNITY_DEPLOYER]: 'todo',
19
- [ContractType.RANKS_PROXY]: 'todo',
18
+ [ContractType.COMMUNITY_DEPLOYER]:
19
+ '0x0fc85eb14c45acc1534257431f6a079cf3bbdfe9',
20
+ [ContractType.RANKS_PROXY]: '0xddc9759e9218fc4b1d56e3d75b2936f877dc6dea',
20
21
  },
21
22
  [ReyaChainId.reyaNetwork]: {
22
23
  [ContractType.COMMUNITY_DEPLOYER]: 'todo',