@reyaxyz/community-sdk 0.20.3 → 0.21.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 +9 -17
- package/dist/client/index.js.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/modules/lge/index.js +33 -30
- package/dist/modules/lge/index.js.map +1 -1
- package/dist/modules/lge/types.js.map +1 -1
- package/dist/modules/referral/services/get-wallet-referral-details/index.js +1 -1
- package/dist/modules/referral/services/get-wallet-referral-details/index.js.map +1 -1
- package/dist/modules/twitter/index.js +6 -4
- package/dist/modules/twitter/index.js.map +1 -1
- package/dist/types/client/index.d.ts +1 -10
- package/dist/types/client/index.d.ts.map +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/modules/lge/index.d.ts +2 -1
- package/dist/types/modules/lge/index.d.ts.map +1 -1
- package/dist/types/modules/lge/types.d.ts +1 -18
- package/dist/types/modules/lge/types.d.ts.map +1 -1
- package/dist/types/modules/twitter/index.d.ts +2 -3
- package/dist/types/modules/twitter/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/client/index.ts +5 -18
- package/src/index.ts +0 -1
- package/src/modules/lge/index.ts +27 -32
- package/src/modules/lge/types.ts +12 -11
- package/src/modules/referral/services/get-wallet-referral-details/index.ts +1 -1
- package/src/modules/twitter/index.ts +4 -9
- package/dist/modules/leaderboard/index.js +0 -121
- package/dist/modules/leaderboard/index.js.map +0 -1
- package/dist/modules/leaderboard/types.js +0 -3
- package/dist/modules/leaderboard/types.js.map +0 -1
- package/dist/types/modules/leaderboard/index.d.ts +0 -10
- package/dist/types/modules/leaderboard/index.d.ts.map +0 -1
- package/dist/types/modules/leaderboard/types.d.ts +0 -2
- package/dist/types/modules/leaderboard/types.d.ts.map +0 -1
- package/src/modules/leaderboard/index.ts +0 -52
- package/src/modules/leaderboard/types.ts +0 -10
package/dist/client/index.js
CHANGED
|
@@ -8,7 +8,6 @@ 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 leaderboard_1 = __importDefault(require("../modules/leaderboard"));
|
|
12
11
|
var referral_1 = __importDefault(require("../modules/referral"));
|
|
13
12
|
/**
|
|
14
13
|
* @description Client for Community SDK
|
|
@@ -17,8 +16,7 @@ var CommunityClient = /** @class */ (function () {
|
|
|
17
16
|
function CommunityClient() {
|
|
18
17
|
this._voteModule = new vote_1.default(CommunityClient.config.apiEndpoint, CommunityClient.config.logging);
|
|
19
18
|
this._lgeModule = new lge_1.default(CommunityClient.config.apiEndpoint, CommunityClient.config.logging);
|
|
20
|
-
this._twitterModule = new twitter_1.default(CommunityClient.config.twitter.
|
|
21
|
-
this._leaderboardModule = new leaderboard_1.default(CommunityClient.config.apiEndpoint, CommunityClient.config.logging);
|
|
19
|
+
this._twitterModule = new twitter_1.default(CommunityClient.config.twitter.getLockGameBoostTwitterApiURI, CommunityClient.config.twitter.getShareReferralTwitterApiURI, CommunityClient.config.twitter.clientId, CommunityClient.config.logging);
|
|
22
20
|
this._referralModule = new referral_1.default(CommunityClient.config.logging);
|
|
23
21
|
}
|
|
24
22
|
CommunityClient.configure = function (environment) {
|
|
@@ -60,30 +58,24 @@ var CommunityClient = /** @class */ (function () {
|
|
|
60
58
|
enumerable: false,
|
|
61
59
|
configurable: true
|
|
62
60
|
});
|
|
63
|
-
Object.defineProperty(CommunityClient, "
|
|
64
|
-
|
|
65
|
-
* Provides access to the TwitterModule instance.
|
|
66
|
-
* This getter allows for interacting with twitter-related functionalities.
|
|
67
|
-
*
|
|
68
|
-
* @returns {TwitterModule} An instance of Twitter for twitter operations.
|
|
69
|
-
* @memberof CommunityClient
|
|
70
|
-
*/
|
|
61
|
+
Object.defineProperty(CommunityClient, "leaderboard", {
|
|
62
|
+
// TODO: Costin deprecate
|
|
71
63
|
get: function () {
|
|
72
|
-
return CommunityClient.getInstance().
|
|
64
|
+
return CommunityClient.getInstance()._lgeModule;
|
|
73
65
|
},
|
|
74
66
|
enumerable: false,
|
|
75
67
|
configurable: true
|
|
76
68
|
});
|
|
77
|
-
Object.defineProperty(CommunityClient, "
|
|
69
|
+
Object.defineProperty(CommunityClient, "twitter", {
|
|
78
70
|
/**
|
|
79
|
-
* Provides access to the
|
|
80
|
-
* This getter allows for interacting with
|
|
71
|
+
* Provides access to the TwitterModule instance.
|
|
72
|
+
* This getter allows for interacting with twitter-related functionalities.
|
|
81
73
|
*
|
|
82
|
-
* @returns {
|
|
74
|
+
* @returns {TwitterModule} An instance of Twitter for twitter operations.
|
|
83
75
|
* @memberof CommunityClient
|
|
84
76
|
*/
|
|
85
77
|
get: function () {
|
|
86
|
-
return CommunityClient.getInstance().
|
|
78
|
+
return CommunityClient.getInstance()._twitterModule;
|
|
87
79
|
},
|
|
88
80
|
enumerable: false,
|
|
89
81
|
configurable: true
|
package/dist/client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["client/index.ts"],"names":[],"mappings":";;;;;;AAAA,0CAAoE;AACpE,yDAAyC;AACzC,uDAAuC;AACvC,+DAA+C;AAC/C,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["client/index.ts"],"names":[],"mappings":";;;;;;AAAA,0CAAoE;AACpE,yDAAyC;AACzC,uDAAuC;AACvC,+DAA+C;AAC/C,iEAAiD;AAEjD;;GAEG;AACH;IASE;QACE,IAAI,CAAC,WAAW,GAAG,IAAI,cAAU,CAC/B,eAAe,CAAC,MAAM,CAAC,WAAW,EAClC,eAAe,CAAC,MAAM,CAAC,OAAO,CAC/B,CAAC;QACF,IAAI,CAAC,UAAU,GAAG,IAAI,aAAS,CAC7B,eAAe,CAAC,MAAM,CAAC,WAAW,EAClC,eAAe,CAAC,MAAM,CAAC,OAAO,CAC/B,CAAC;QACF,IAAI,CAAC,cAAc,GAAG,IAAI,iBAAa,CACrC,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,6BAA6B,EAC5D,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,6BAA6B,EAC5D,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,EACvC,eAAe,CAAC,MAAM,CAAC,OAAO,CAC/B,CAAC;QACF,IAAI,CAAC,eAAe,GAAG,IAAI,kBAAc,CAAC,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC5E,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,WAAW,CAAC;QACnD,CAAC;;;OAAA;IASD,sBAAkB,sBAAG;QAPrB;;;;;;WAMG;aACH;YACE,OAAO,eAAe,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC;QAClD,CAAC;;;OAAA;IAGD,sBAAkB,8BAAW;QAD7B,yBAAyB;aACzB;YACE,OAAO,eAAe,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC;QAClD,CAAC;;;OAAA;IASD,sBAAkB,0BAAO;QAPzB;;;;;;WAMG;aACH;YACE,OAAO,eAAe,CAAC,WAAW,EAAE,CAAC,cAAc,CAAC;QACtD,CAAC;;;OAAA;IASD,sBAAkB,2BAAQ;QAP1B;;;;;;WAMG;aACH;YACE,OAAO,eAAe,CAAC,WAAW,EAAE,CAAC,eAAe,CAAC;QACvD,CAAC;;;OAAA;IAED,sBAAkB,iCAAc;aAAhC;YACE,OAAO,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC;QACtC,CAAC;;;OAAA;IA3Fc,sBAAM,GAAkB,2BAAkB,CAAC,MAAM,CAAC,CAAC;IA4FpE,sBAAC;CAAA,AA9FD,IA8FC;AA9FY,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 ReferralModule from '../modules/referral';\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 _voteModule: VoteModule;\n private readonly _lgeModule: LGEModule;\n private readonly _twitterModule: TwitterModule;\n private readonly _referralModule: ReferralModule;\n\n private constructor() {\n this._voteModule = new VoteModule(\n CommunityClient.config.apiEndpoint,\n CommunityClient.config.logging,\n );\n this._lgeModule = new LGEModule(\n CommunityClient.config.apiEndpoint,\n CommunityClient.config.logging,\n );\n this._twitterModule = new TwitterModule(\n CommunityClient.config.twitter.getLockGameBoostTwitterApiURI,\n CommunityClient.config.twitter.getShareReferralTwitterApiURI,\n CommunityClient.config.twitter.clientId,\n CommunityClient.config.logging,\n );\n this._referralModule = new ReferralModule(CommunityClient.config.logging);\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()._voteModule;\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()._lgeModule;\n }\n\n // TODO: Costin deprecate\n public static get leaderboard(): LGEModule {\n return CommunityClient.getInstance()._lgeModule;\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()._twitterModule;\n }\n\n /**\n * Provides access to the ReferralModule instance.\n * This getter allows for interacting with referral related functionalities.\n *\n * @returns {ReferralModule} An instance of ReferralModule .\n * @memberof CommunityClient\n */\n public static get referral(): ReferralModule {\n return CommunityClient.getInstance()._referralModule;\n }\n\n public static get supportedChain(): number {\n return CommunityClient.config.chain;\n }\n}\n"]}
|
package/dist/index.js
CHANGED
|
@@ -18,6 +18,5 @@ __exportStar(require("./client"), exports);
|
|
|
18
18
|
__exportStar(require("./modules/twitter/services/get-auth-url/types"), exports);
|
|
19
19
|
__exportStar(require("./modules/vote/types"), exports);
|
|
20
20
|
__exportStar(require("./modules/lge/types"), exports);
|
|
21
|
-
__exportStar(require("./modules/leaderboard/types"), exports);
|
|
22
21
|
__exportStar(require("./modules/referral/services/get-wallet-referral-details/types"), exports);
|
|
23
22
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,gFAA8D;AAC9D,uDAAqC;AACrC,sDAAoC;AACpC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,gFAA8D;AAC9D,uDAAqC;AACrC,sDAAoC;AACpC,gGAA8E","sourcesContent":["export * from './client';\nexport * from './modules/twitter/services/get-auth-url/types';\nexport * from './modules/vote/types';\nexport * from './modules/lge/types';\nexport * from './modules/referral/services/get-wallet-referral-details/types';\n"]}
|
|
@@ -67,6 +67,28 @@ var LGEModule = /** @class */ (function (_super) {
|
|
|
67
67
|
_this.loggingEnabled = loggingEnabled;
|
|
68
68
|
return _this;
|
|
69
69
|
}
|
|
70
|
+
LGEModule.prototype.claimRank = function (params) {
|
|
71
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
72
|
+
return __generator(this, function (_a) {
|
|
73
|
+
switch (_a.label) {
|
|
74
|
+
case 0: return [4 /*yield*/, new Promise(function (resolve, reject) {
|
|
75
|
+
setTimeout(function () {
|
|
76
|
+
var error = Math.random() * 100 > 50;
|
|
77
|
+
if (error) {
|
|
78
|
+
reject(new Error("Claim Rank for ".concat(params.address, " error")));
|
|
79
|
+
}
|
|
80
|
+
resolve({
|
|
81
|
+
success: true,
|
|
82
|
+
});
|
|
83
|
+
}, Math.random() * 100 + 1000);
|
|
84
|
+
})];
|
|
85
|
+
case 1:
|
|
86
|
+
// TODO: Costin, Write proper implementation
|
|
87
|
+
return [2 /*return*/, _a.sent()];
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
};
|
|
70
92
|
LGEModule.prototype.getLGEBoostRate = function (_) {
|
|
71
93
|
return __awaiter(this, void 0, void 0, function () {
|
|
72
94
|
var uri;
|
|
@@ -103,46 +125,27 @@ var LGEModule = /** @class */ (function (_super) {
|
|
|
103
125
|
});
|
|
104
126
|
});
|
|
105
127
|
};
|
|
106
|
-
|
|
107
|
-
LGEModule.prototype.getUserGameStatus = function (
|
|
108
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
109
|
-
params) {
|
|
128
|
+
LGEModule.prototype.getUserGameStatus = function (params) {
|
|
110
129
|
return __awaiter(this, void 0, void 0, function () {
|
|
130
|
+
var uri;
|
|
111
131
|
return __generator(this, function (_a) {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
return resolve({
|
|
115
|
-
status: Math.random() > 50
|
|
116
|
-
? 'notStarted'
|
|
117
|
-
: Math.random() > 50
|
|
118
|
-
? 'notLockedIn'
|
|
119
|
-
: 'lockedIn',
|
|
120
|
-
boostRate: Math.random() * 15,
|
|
121
|
-
bodyId: Math.floor(Math.random() * 10).toString(),
|
|
122
|
-
nextBoostStartTimestampMilliseconds: Date.now() + Math.random() * 1000 * 60 * 60,
|
|
123
|
-
});
|
|
124
|
-
}, Math.random() * 2000);
|
|
125
|
-
})];
|
|
132
|
+
uri = "/api/xp/user-game-status/".concat(params.address);
|
|
133
|
+
return [2 /*return*/, this.get(uri)];
|
|
126
134
|
});
|
|
127
135
|
});
|
|
128
136
|
};
|
|
129
|
-
|
|
130
|
-
LGEModule.prototype.generateGameBoostRate = function (
|
|
131
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
132
|
-
params) {
|
|
137
|
+
LGEModule.prototype.generateGameBoostRate = function (params) {
|
|
133
138
|
return __awaiter(this, void 0, void 0, function () {
|
|
139
|
+
var uri;
|
|
134
140
|
return __generator(this, function (_a) {
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
return resolve({
|
|
138
|
-
boostRate: Math.random() * 15,
|
|
139
|
-
bodyId: Math.floor(Math.random() * 10).toString(),
|
|
140
|
-
});
|
|
141
|
-
}, Math.random() * 2000);
|
|
142
|
-
})];
|
|
141
|
+
uri = "/api/xp/generate-game-boost-rate/".concat(params.address, "/").concat(params.bodyId);
|
|
142
|
+
return [2 /*return*/, this.get(uri)];
|
|
143
143
|
});
|
|
144
144
|
});
|
|
145
145
|
};
|
|
146
|
+
__decorate([
|
|
147
|
+
(0, common_2.Logger)('LGEModule.claimRank')
|
|
148
|
+
], LGEModule.prototype, "claimRank", null);
|
|
146
149
|
__decorate([
|
|
147
150
|
(0, common_2.Logger)('LGEModule.getLGEBoostRate')
|
|
148
151
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/lge/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/lge/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAQyB;AAazB,0CAAmD;AAEnD;IAAuC,6BAAU;IAG/C,mBAAY,MAAc,EAAE,cAAuB;QACjD,YAAA,MAAK,YAAC,MAAM,CAAC,SAAC;QAHhB,oBAAc,GAAY,KAAK,CAAC;QAI9B,KAAI,CAAC,cAAc,GAAG,cAAc,CAAC;;IACvC,CAAC;IAGK,6BAAS,GAAT,UAAU,MAAuB;;;;4BAE9B,qBAAM,IAAI,OAAO,CACtB,UAAC,OAAqC,EAAE,MAAM;4BAC5C,UAAU,CACR;gCACE,IAAM,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE,CAAC;gCACvC,IAAI,KAAK,EAAE,CAAC;oCACV,MAAM,CAAC,IAAI,KAAK,CAAC,yBAAkB,MAAM,CAAC,OAAO,WAAQ,CAAC,CAAC,CAAC;gCAC9D,CAAC;gCACD,OAAO,CAAC;oCACN,OAAO,EAAE,IAAI;iCACd,CAAC,CAAC;4BACL,CAAC,EACD,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,IAAI,CAC3B,CAAC;wBACJ,CAAC,CACF,EAAA;;oBAhBD,4CAA4C;oBAC5C,sBAAO,SAeN,EAAC;;;;KACH;IAIK,mCAAe,GAAf,UAAgB,CAAwB;;;;gBACtC,GAAG,GAAG,kBAAkB,CAAC;gBAC/B,sBAAO,IAAI,CAAC,GAAG,CAAwB,GAAG,CAAC,EAAC;;;KAC7C;IAGK,uCAAmB,GAAnB,UAAoB,MAAiC;;;;gBACnD,GAAG,GAAG,6BAAsB,MAAM,CAAC,OAAO,CAAE,CAAC;gBACnD,sBAAO,IAAI,CAAC,GAAG,CAA4B,GAAG,CAAC,EAAC;;;KACjD;IAGK,kCAAc,GAAd,UAAe,MAA4B;;;;gBACzC,GAAG,GAAG,8BAAuB,MAAM,CAAC,OAAO,cAAI,MAAM,CAAC,IAAI,CAAE,CAAC;gBACnE,sBAAO,IAAI,CAAC,GAAG,CAAuB,GAAG,CAAC,EAAC;;;KAC5C;IAGK,0CAAsB,GAAtB,UAAuB,MAAoC;;;;gBACzD,GAAG,GAAG,wCAAiC,MAAM,CAAC,OAAO,CAAE,CAAC;gBAC9D,sBAAO,IAAI,CAAC,GAAG,CAA+B,GAAG,CAAC,EAAC;;;KACpD;IAGK,qCAAiB,GAAjB,UACJ,MAA+B;;;;gBAEzB,GAAG,GAAG,mCAA4B,MAAM,CAAC,OAAO,CAAE,CAAC;gBACzD,sBAAO,IAAI,CAAC,GAAG,CAA0B,GAAG,CAAC,EAAC;;;KAC/C;IAGK,yCAAqB,GAArB,UACJ,MAAmC;;;;gBAE7B,GAAG,GAAG,2CAAoC,MAAM,CAAC,OAAO,cAAI,MAAM,CAAC,MAAM,CAAE,CAAC;gBAClF,sBAAO,IAAI,CAAC,GAAG,CAA8B,GAAG,CAAC,EAAC;;;KACnD;IA3DK;QADL,IAAA,eAAM,EAAC,qBAAqB,CAAC;8CAmB7B;IAIK;QAFL,IAAA,eAAM,EAAC,2BAA2B,CAAC;QACpC,6DAA6D;oDAI5D;IAGK;QADL,IAAA,eAAM,EAAC,+BAA+B,CAAC;wDAIvC;IAGK;QADL,IAAA,eAAM,EAAC,0BAA0B,CAAC;mDAIlC;IAGK;QADL,IAAA,eAAM,EAAC,kCAAkC,CAAC;2DAI1C;IAGK;QADL,IAAA,eAAM,EAAC,6BAA6B,CAAC;sDAMrC;IAGK;QADL,IAAA,eAAM,EAAC,iCAAiC,CAAC;0DAMzC;IACH,gBAAC;CAAA,AArED,CAAuC,mBAAU,GAqEhD;kBArEoB,SAAS","sourcesContent":["import {\n ClaimRankParams,\n ClaimRankResult,\n GetLeaderboardParams,\n GetLeaderboardResult,\n GetUserLeaderboardDataParams,\n GetUserLeaderboardDataResult,\n RestClient,\n} from '@reyaxyz/common';\n\nimport {\n GenerateGameBoostRateParams,\n GenerateGameBoostRateResult,\n GetAccountLGEStatusParams,\n GetAccountLGEStatusResult,\n GetLGEBoostRateParams,\n GetLGEBoostRateResult,\n GetUserGameStatusParams,\n GetUserGameStatusResult,\n} from './types';\n\nimport { Loggable, Logger } from '@reyaxyz/common';\n\nexport default class LGEModule extends RestClient implements Loggable {\n loggingEnabled: boolean = false;\n\n constructor(apiUrl: string, loggingEnabled: boolean) {\n super(apiUrl);\n this.loggingEnabled = loggingEnabled;\n }\n\n @Logger('LGEModule.claimRank')\n async claimRank(params: ClaimRankParams) {\n // TODO: Costin, Write proper implementation\n return await new Promise(\n (resolve: (_: ClaimRankResult) => void, reject) => {\n setTimeout(\n () => {\n const error = Math.random() * 100 > 50;\n if (error) {\n reject(new Error(`Claim Rank for ${params.address} error`));\n }\n resolve({\n success: true,\n });\n },\n Math.random() * 100 + 1000,\n );\n },\n );\n }\n\n @Logger('LGEModule.getLGEBoostRate')\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n async getLGEBoostRate(_: GetLGEBoostRateParams) {\n const uri = `/api/xp/lp-boost`;\n return this.get<GetLGEBoostRateResult>(uri);\n }\n\n @Logger('LGEModule.getAccountLGEStatus')\n async getAccountLGEStatus(params: GetAccountLGEStatusParams) {\n const uri = `/api/xp/lp-profile/${params.address}`;\n return this.get<GetAccountLGEStatusResult>(uri);\n }\n\n @Logger('LGEModule.getLeaderboard')\n async getLeaderboard(params: GetLeaderboardParams) {\n const uri = `/api/xp/leaderboard/${params.perPage}/${params.page}`;\n return this.get<GetLeaderboardResult>(uri);\n }\n\n @Logger('LGEModule.getUserLeaderboardData')\n async getUserLeaderboardData(params: GetUserLeaderboardDataParams) {\n const uri = `/api/xp/leaderboard-user-data/${params.address}`;\n return this.get<GetUserLeaderboardDataResult>(uri);\n }\n\n @Logger('LGEModule.getUserGameStatus')\n async getUserGameStatus(\n params: GetUserGameStatusParams,\n ): Promise<GetUserGameStatusResult> {\n const uri = `/api/xp/user-game-status/${params.address}`;\n return this.get<GetUserGameStatusResult>(uri);\n }\n\n @Logger('LGEModule.generateGameBoostRate')\n async generateGameBoostRate(\n params: GenerateGameBoostRateParams,\n ): Promise<GenerateGameBoostRateResult> {\n const uri = `/api/xp/generate-game-boost-rate/${params.address}/${params.bodyId}`;\n return this.get<GenerateGameBoostRateResult>(uri);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"/","sources":["modules/lge/types.ts"],"names":[],"mappings":"","sourcesContent":["export {\n GetAccountLGEStatusParams,\n GetAccountLGEStatusResult,\n GetLGEBoostRateParams,\n GetLGEBoostRateResult,\n
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"/","sources":["modules/lge/types.ts"],"names":[],"mappings":"","sourcesContent":["export {\n GetAccountLGEStatusParams,\n GetAccountLGEStatusResult,\n GetLGEBoostRateParams,\n GetLGEBoostRateResult,\n GetUserGameStatusParams,\n GetUserGameStatusResult,\n GenerateGameBoostRateParams,\n GenerateGameBoostRateResult,\n GetLeaderboardParams,\n GetLeaderboardResult,\n GetUserLeaderboardDataParams,\n GetUserLeaderboardDataResult,\n LeaderboardEntity,\n UserLeaderboardDataEntity,\n ClaimRankParams,\n ClaimRankResult,\n XPEntity,\n} from '@reyaxyz/common';\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getWalletReferralDetails = void 0;
|
|
4
|
-
// TODO: Costin fix implementation
|
|
4
|
+
// TODO: Costin fix implementation (PUBLIC)
|
|
5
5
|
function getWalletReferralDetails(_a) {
|
|
6
6
|
var address = _a.address;
|
|
7
7
|
return new Promise(function (resolve) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/referral/services/get-wallet-referral-details/index.ts"],"names":[],"mappings":";;;AAKA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/referral/services/get-wallet-referral-details/index.ts"],"names":[],"mappings":";;;AAKA,2CAA2C;AAC3C,SAAgB,wBAAwB,CAAC,EAER;QAD/B,OAAO,aAAA;IAEP,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO;QACzB,OAAA,UAAU,CACR;YACE,OAAA,OAAO,CAAC;gBACN,YAAY,EAAE,+BAAwB,OAAO,CAAE;gBAC/C,eAAe,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,MAAM;gBACvC,mBAAmB,EAAE,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI;aAC1C,CAAC;QAJF,CAIE,EACJ,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CACrB;IARD,CAQC,CACF,CAAC;AACJ,CAAC;AAdD,4DAcC","sourcesContent":["import {\n GetWalletReferralDetailsParams,\n GetWalletReferralDetailsResult,\n} from './types';\n\n// TODO: Costin fix implementation (PUBLIC)\nexport function getWalletReferralDetails({\n address,\n}: GetWalletReferralDetailsParams): Promise<GetWalletReferralDetailsResult> {\n return new Promise((resolve) =>\n setTimeout(\n () =>\n resolve({\n referralLink: `https://reya.network/${address}`,\n totalReferralXP: Math.random() * 100000,\n totalReferralsCount: Math.random() * 1000,\n }),\n Math.random() * 2000,\n ),\n );\n}\n"]}
|
|
@@ -20,16 +20,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
20
20
|
var services_1 = require("./services");
|
|
21
21
|
var common_1 = require("@reyaxyz/common");
|
|
22
22
|
var TwitterModule = /** @class */ (function () {
|
|
23
|
-
function TwitterModule(
|
|
23
|
+
function TwitterModule(getLockGameBoostTwitterApiURI, getShareReferralTwitterApiURI, twitterClientId, loggingEnabled) {
|
|
24
24
|
this.loggingEnabled = false;
|
|
25
|
-
this.getExtraBoostTwitterApiURI = getExtraBoostTwitterApiURI;
|
|
26
25
|
this.getLockGameBoostTwitterApiURI = getLockGameBoostTwitterApiURI;
|
|
27
26
|
this.getShareReferralTwitterApiURI = getShareReferralTwitterApiURI;
|
|
28
27
|
this.twitterClientId = twitterClientId;
|
|
29
28
|
this.loggingEnabled = loggingEnabled;
|
|
30
29
|
}
|
|
31
|
-
|
|
32
|
-
|
|
30
|
+
// TODO: Costin: deprecate
|
|
31
|
+
TwitterModule.prototype.getExtraBoostTwitterLink = function (
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
33
|
+
_) {
|
|
34
|
+
return 'NONE';
|
|
33
35
|
};
|
|
34
36
|
TwitterModule.prototype.getLockGameBoostTwitterLink = function (params) {
|
|
35
37
|
return (0, services_1.getTwitterOauthUrl)(__assign(__assign({}, params), { redirectURI: this.getLockGameBoostTwitterApiURI, twitterClientId: this.twitterClientId }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/twitter/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,uCAA0E;AAC1E,0CAAmD;AAEnD;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/twitter/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,uCAA0E;AAC1E,0CAAmD;AAEnD;IAOE,uBACE,6BAAqC,EACrC,6BAAqC,EACrC,eAAuB,EACvB,cAAuB;QANzB,mBAAc,GAAY,KAAK,CAAC;QAQ9B,IAAI,CAAC,6BAA6B,GAAG,6BAA6B,CAAC;QACnE,IAAI,CAAC,6BAA6B,GAAG,6BAA6B,CAAC;QACnE,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;QACvC,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;IAED,0BAA0B;IAE1B,gDAAwB,GAAxB;IACE,6DAA6D;IAC7D,CAAkD;QAElD,OAAO,MAAM,CAAC;IAChB,CAAC;IAGD,mDAA2B,GAA3B,UACE,MAAuD;QAEvD,OAAO,IAAA,6BAAkB,wBACpB,MAAM,KACT,WAAW,EAAE,IAAI,CAAC,6BAA6B,EAC/C,eAAe,EAAE,IAAI,CAAC,eAAe,IACrC,CAAC;IACL,CAAC;IAGD,mDAA2B,GAA3B,UACE,MAAuD;QAEvD,OAAO,IAAA,6BAAkB,wBACpB,MAAM,KACT,WAAW,EAAE,IAAI,CAAC,6BAA6B,EAC/C,eAAe,EAAE,IAAI,CAAC,eAAe,IACrC,CAAC;IACL,CAAC;IA3BD;QADC,IAAA,eAAM,EAAC,wCAAwC,CAAC;iEAMhD;IAGD;QADC,IAAA,eAAM,EAAC,2CAA2C,CAAC;oEASnD;IAGD;QADC,IAAA,eAAM,EAAC,2CAA2C,CAAC;oEASnD;IACH,oBAAC;CAAA,AAjDD,IAiDC;kBAjDoB,aAAa","sourcesContent":["import { getTwitterOauthUrl, GetTwitterOauthUrlParams } from './services';\nimport { Loggable, Logger } from '@reyaxyz/common';\n\nexport default class TwitterModule implements Loggable {\n private getLockGameBoostTwitterApiURI: string;\n private getShareReferralTwitterApiURI: string;\n\n private twitterClientId: string;\n loggingEnabled: boolean = false;\n\n constructor(\n getLockGameBoostTwitterApiURI: string,\n getShareReferralTwitterApiURI: string,\n twitterClientId: string,\n loggingEnabled: boolean,\n ) {\n this.getLockGameBoostTwitterApiURI = getLockGameBoostTwitterApiURI;\n this.getShareReferralTwitterApiURI = getShareReferralTwitterApiURI;\n this.twitterClientId = twitterClientId;\n this.loggingEnabled = loggingEnabled;\n }\n\n // TODO: Costin: deprecate\n @Logger('TwitterModule.getExtraBoostTwitterLink')\n getExtraBoostTwitterLink(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n _: Pick<GetTwitterOauthUrlParams, 'walletAddress'>,\n ): string {\n return 'NONE';\n }\n\n @Logger('TwitterModule.getLockGameBoostTwitterLink')\n getLockGameBoostTwitterLink(\n params: Pick<GetTwitterOauthUrlParams, 'walletAddress'>,\n ): string {\n return getTwitterOauthUrl({\n ...params,\n redirectURI: this.getLockGameBoostTwitterApiURI,\n twitterClientId: this.twitterClientId,\n });\n }\n\n @Logger('TwitterModule.getShareReferralTwitterLink')\n getShareReferralTwitterLink(\n params: Pick<GetTwitterOauthUrlParams, 'walletAddress'>,\n ): string {\n return getTwitterOauthUrl({\n ...params,\n redirectURI: this.getShareReferralTwitterApiURI,\n twitterClientId: this.twitterClientId,\n });\n }\n}\n"]}
|
|
@@ -2,7 +2,6 @@ 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 LeaderboardModule from '../modules/leaderboard';
|
|
6
5
|
import ReferralModule from '../modules/referral';
|
|
7
6
|
/**
|
|
8
7
|
* @description Client for Community SDK
|
|
@@ -13,7 +12,6 @@ export declare class CommunityClient {
|
|
|
13
12
|
private readonly _voteModule;
|
|
14
13
|
private readonly _lgeModule;
|
|
15
14
|
private readonly _twitterModule;
|
|
16
|
-
private readonly _leaderboardModule;
|
|
17
15
|
private readonly _referralModule;
|
|
18
16
|
private constructor();
|
|
19
17
|
static configure(environment: ServiceConfig['environment']): void;
|
|
@@ -34,6 +32,7 @@ export declare class CommunityClient {
|
|
|
34
32
|
* @memberof CommunityClient
|
|
35
33
|
*/
|
|
36
34
|
static get lge(): LGEModule;
|
|
35
|
+
static get leaderboard(): LGEModule;
|
|
37
36
|
/**
|
|
38
37
|
* Provides access to the TwitterModule instance.
|
|
39
38
|
* This getter allows for interacting with twitter-related functionalities.
|
|
@@ -42,14 +41,6 @@ export declare class CommunityClient {
|
|
|
42
41
|
* @memberof CommunityClient
|
|
43
42
|
*/
|
|
44
43
|
static get twitter(): TwitterModule;
|
|
45
|
-
/**
|
|
46
|
-
* Provides access to the LeaderboardModule instance.
|
|
47
|
-
* This getter allows for interacting with leaderboard-related functionalities.
|
|
48
|
-
*
|
|
49
|
-
* @returns {LeaderboardModule} An instance of Leaderboard for twitter operations.
|
|
50
|
-
* @memberof CommunityClient
|
|
51
|
-
*/
|
|
52
|
-
static get leaderboard(): LeaderboardModule;
|
|
53
44
|
/**
|
|
54
45
|
* Provides access to the ReferralModule instance.
|
|
55
46
|
* This getter allows for interacting with referral related functionalities.
|
|
@@ -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;AAC/C,OAAO,
|
|
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,cAAc,MAAM,qBAAqB,CAAC;AAEjD;;GAEG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAkB;IACzC,OAAO,CAAC,MAAM,CAAC,MAAM,CAA6C;IAElE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAa;IACzC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAY;IACvC,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAgB;IAC/C,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAiB;IAEjD,OAAO;WAkBO,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;IAGD,WAAkB,WAAW,IAAI,SAAS,CAEzC;IAED;;;;;;OAMG;IACH,WAAkB,OAAO,IAAI,aAAa,CAEzC;IAED;;;;;;OAMG;IACH,WAAkB,QAAQ,IAAI,cAAc,CAE3C;IAED,WAAkB,cAAc,IAAI,MAAM,CAEzC;CACF"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,6 +2,5 @@ export * from './client';
|
|
|
2
2
|
export * from './modules/twitter/services/get-auth-url/types';
|
|
3
3
|
export * from './modules/vote/types';
|
|
4
4
|
export * from './modules/lge/types';
|
|
5
|
-
export * from './modules/leaderboard/types';
|
|
6
5
|
export * from './modules/referral/services/get-wallet-referral-details/types';
|
|
7
6
|
//# 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,+CAA+C,CAAC;AAC9D,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,+CAA+C,CAAC;AAC9D,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,+DAA+D,CAAC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { GetLeaderboardParams, GetLeaderboardResult, GetUserLeaderboardDataParams, RestClient } from '@reyaxyz/common';
|
|
1
|
+
import { ClaimRankParams, ClaimRankResult, GetLeaderboardParams, GetLeaderboardResult, GetUserLeaderboardDataParams, RestClient } from '@reyaxyz/common';
|
|
2
2
|
import { GenerateGameBoostRateParams, GenerateGameBoostRateResult, GetAccountLGEStatusParams, GetAccountLGEStatusResult, GetLGEBoostRateParams, GetLGEBoostRateResult, GetUserGameStatusParams, GetUserGameStatusResult } from './types';
|
|
3
3
|
import { Loggable } from '@reyaxyz/common';
|
|
4
4
|
export default class LGEModule extends RestClient implements Loggable {
|
|
5
5
|
loggingEnabled: boolean;
|
|
6
6
|
constructor(apiUrl: string, loggingEnabled: boolean);
|
|
7
|
+
claimRank(params: ClaimRankParams): Promise<ClaimRankResult>;
|
|
7
8
|
getLGEBoostRate(_: GetLGEBoostRateParams): Promise<GetLGEBoostRateResult>;
|
|
8
9
|
getAccountLGEStatus(params: GetAccountLGEStatusParams): Promise<GetAccountLGEStatusResult>;
|
|
9
10
|
getLeaderboard(params: GetLeaderboardParams): Promise<GetLeaderboardResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/lge/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,4BAA4B,EAE5B,UAAU,EACX,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,yBAAyB,EACzB,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,QAAQ,EAAU,MAAM,iBAAiB,CAAC;AAEnD,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,UAAW,YAAW,QAAQ;IACnE,cAAc,EAAE,OAAO,CAAS;gBAEpB,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/lge/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,4BAA4B,EAE5B,UAAU,EACX,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,yBAAyB,EACzB,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,QAAQ,EAAU,MAAM,iBAAiB,CAAC;AAEnD,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,UAAW,YAAW,QAAQ;IACnE,cAAc,EAAE,OAAO,CAAS;gBAEpB,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO;IAM7C,SAAS,CAAC,MAAM,EAAE,eAAe;IAsBjC,eAAe,CAAC,CAAC,EAAE,qBAAqB;IAMxC,mBAAmB,CAAC,MAAM,EAAE,yBAAyB;IAMrD,cAAc,CAAC,MAAM,EAAE,oBAAoB;IAM3C,sBAAsB,CAAC,MAAM,EAAE,4BAA4B;IAM3D,iBAAiB,CACrB,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,uBAAuB,CAAC;IAM7B,qBAAqB,CACzB,MAAM,EAAE,2BAA2B,GAClC,OAAO,CAAC,2BAA2B,CAAC;CAIxC"}
|
|
@@ -1,19 +1,2 @@
|
|
|
1
|
-
export { GetAccountLGEStatusParams, GetAccountLGEStatusResult, GetLGEBoostRateParams, GetLGEBoostRateResult, XPEntity, } from '@reyaxyz/common';
|
|
2
|
-
export type GetUserGameStatusParams = {
|
|
3
|
-
address: string;
|
|
4
|
-
};
|
|
5
|
-
export type GetUserGameStatusResult = {
|
|
6
|
-
bodyId: string;
|
|
7
|
-
status: 'notStarted' | 'notLockedIn' | 'lockedIn';
|
|
8
|
-
boostRate: number;
|
|
9
|
-
nextBoostStartTimestampMilliseconds: number;
|
|
10
|
-
};
|
|
11
|
-
export type GenerateGameBoostRateParams = {
|
|
12
|
-
address: string;
|
|
13
|
-
bodyId: string;
|
|
14
|
-
};
|
|
15
|
-
export type GenerateGameBoostRateResult = {
|
|
16
|
-
boostRate: number;
|
|
17
|
-
bodyId: string;
|
|
18
|
-
};
|
|
1
|
+
export { GetAccountLGEStatusParams, GetAccountLGEStatusResult, GetLGEBoostRateParams, GetLGEBoostRateResult, GetUserGameStatusParams, GetUserGameStatusResult, GenerateGameBoostRateParams, GenerateGameBoostRateResult, GetLeaderboardParams, GetLeaderboardResult, GetUserLeaderboardDataParams, GetUserLeaderboardDataResult, LeaderboardEntity, UserLeaderboardDataEntity, ClaimRankParams, ClaimRankResult, XPEntity, } from '@reyaxyz/common';
|
|
19
2
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["modules/lge/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["modules/lge/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EACzB,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,uBAAuB,EACvB,2BAA2B,EAC3B,2BAA2B,EAC3B,oBAAoB,EACpB,oBAAoB,EACpB,4BAA4B,EAC5B,4BAA4B,EAC5B,iBAAiB,EACjB,yBAAyB,EACzB,eAAe,EACf,eAAe,EACf,QAAQ,GACT,MAAM,iBAAiB,CAAC"}
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { GetTwitterOauthUrlParams } from './services';
|
|
2
2
|
import { Loggable } from '@reyaxyz/common';
|
|
3
3
|
export default class TwitterModule implements Loggable {
|
|
4
|
-
private getExtraBoostTwitterApiURI;
|
|
5
4
|
private getLockGameBoostTwitterApiURI;
|
|
6
5
|
private getShareReferralTwitterApiURI;
|
|
7
6
|
private twitterClientId;
|
|
8
7
|
loggingEnabled: boolean;
|
|
9
|
-
constructor(
|
|
10
|
-
getExtraBoostTwitterLink(
|
|
8
|
+
constructor(getLockGameBoostTwitterApiURI: string, getShareReferralTwitterApiURI: string, twitterClientId: string, loggingEnabled: boolean);
|
|
9
|
+
getExtraBoostTwitterLink(_: Pick<GetTwitterOauthUrlParams, 'walletAddress'>): string;
|
|
11
10
|
getLockGameBoostTwitterLink(params: Pick<GetTwitterOauthUrlParams, 'walletAddress'>): string;
|
|
12
11
|
getShareReferralTwitterLink(params: Pick<GetTwitterOauthUrlParams, 'walletAddress'>): string;
|
|
13
12
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/twitter/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAU,MAAM,iBAAiB,CAAC;AAEnD,MAAM,CAAC,OAAO,OAAO,aAAc,YAAW,QAAQ;IACpD,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/twitter/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAU,MAAM,iBAAiB,CAAC;AAEnD,MAAM,CAAC,OAAO,OAAO,aAAc,YAAW,QAAQ;IACpD,OAAO,CAAC,6BAA6B,CAAS;IAC9C,OAAO,CAAC,6BAA6B,CAAS;IAE9C,OAAO,CAAC,eAAe,CAAS;IAChC,cAAc,EAAE,OAAO,CAAS;gBAG9B,6BAA6B,EAAE,MAAM,EACrC,6BAA6B,EAAE,MAAM,EACrC,eAAe,EAAE,MAAM,EACvB,cAAc,EAAE,OAAO;IAUzB,wBAAwB,CAEtB,CAAC,EAAE,IAAI,CAAC,wBAAwB,EAAE,eAAe,CAAC,GACjD,MAAM;IAKT,2BAA2B,CACzB,MAAM,EAAE,IAAI,CAAC,wBAAwB,EAAE,eAAe,CAAC,GACtD,MAAM;IAST,2BAA2B,CACzB,MAAM,EAAE,IAAI,CAAC,wBAAwB,EAAE,eAAe,CAAC,GACtD,MAAM;CAOV"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reyaxyz/community-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"url": "https://github.com/Reya-Labs/reya-off-chain-monorepo.git"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@reyaxyz/common": "0.
|
|
14
|
-
"@reyaxyz/sdk": "0.
|
|
13
|
+
"@reyaxyz/common": "0.60.0",
|
|
14
|
+
"@reyaxyz/sdk": "0.52.1",
|
|
15
15
|
"ethers": "6.9.0"
|
|
16
16
|
},
|
|
17
17
|
"main": "dist/index.js",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"generate:coverage-badges": "npx istanbul-badges-readme --silent"
|
|
39
39
|
},
|
|
40
40
|
"packageManager": "pnpm@8.10.4",
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "6843d1af16e37ec4ab4ee4ad46c85affa03ca3e9"
|
|
42
42
|
}
|
package/src/client/index.ts
CHANGED
|
@@ -2,7 +2,6 @@ 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 LeaderboardModule from '../modules/leaderboard';
|
|
6
5
|
import ReferralModule from '../modules/referral';
|
|
7
6
|
|
|
8
7
|
/**
|
|
@@ -15,7 +14,6 @@ export class CommunityClient {
|
|
|
15
14
|
private readonly _voteModule: VoteModule;
|
|
16
15
|
private readonly _lgeModule: LGEModule;
|
|
17
16
|
private readonly _twitterModule: TwitterModule;
|
|
18
|
-
private readonly _leaderboardModule: LeaderboardModule;
|
|
19
17
|
private readonly _referralModule: ReferralModule;
|
|
20
18
|
|
|
21
19
|
private constructor() {
|
|
@@ -28,16 +26,11 @@ export class CommunityClient {
|
|
|
28
26
|
CommunityClient.config.logging,
|
|
29
27
|
);
|
|
30
28
|
this._twitterModule = new TwitterModule(
|
|
31
|
-
CommunityClient.config.twitter.getExtraBoostTwitterApiURI,
|
|
32
29
|
CommunityClient.config.twitter.getLockGameBoostTwitterApiURI,
|
|
33
30
|
CommunityClient.config.twitter.getShareReferralTwitterApiURI,
|
|
34
31
|
CommunityClient.config.twitter.clientId,
|
|
35
32
|
CommunityClient.config.logging,
|
|
36
33
|
);
|
|
37
|
-
this._leaderboardModule = new LeaderboardModule(
|
|
38
|
-
CommunityClient.config.apiEndpoint,
|
|
39
|
-
CommunityClient.config.logging,
|
|
40
|
-
);
|
|
41
34
|
this._referralModule = new ReferralModule(CommunityClient.config.logging);
|
|
42
35
|
}
|
|
43
36
|
|
|
@@ -78,6 +71,11 @@ export class CommunityClient {
|
|
|
78
71
|
return CommunityClient.getInstance()._lgeModule;
|
|
79
72
|
}
|
|
80
73
|
|
|
74
|
+
// TODO: Costin deprecate
|
|
75
|
+
public static get leaderboard(): LGEModule {
|
|
76
|
+
return CommunityClient.getInstance()._lgeModule;
|
|
77
|
+
}
|
|
78
|
+
|
|
81
79
|
/**
|
|
82
80
|
* Provides access to the TwitterModule instance.
|
|
83
81
|
* This getter allows for interacting with twitter-related functionalities.
|
|
@@ -89,17 +87,6 @@ export class CommunityClient {
|
|
|
89
87
|
return CommunityClient.getInstance()._twitterModule;
|
|
90
88
|
}
|
|
91
89
|
|
|
92
|
-
/**
|
|
93
|
-
* Provides access to the LeaderboardModule instance.
|
|
94
|
-
* This getter allows for interacting with leaderboard-related functionalities.
|
|
95
|
-
*
|
|
96
|
-
* @returns {LeaderboardModule} An instance of Leaderboard for twitter operations.
|
|
97
|
-
* @memberof CommunityClient
|
|
98
|
-
*/
|
|
99
|
-
public static get leaderboard(): LeaderboardModule {
|
|
100
|
-
return CommunityClient.getInstance()._leaderboardModule;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
90
|
/**
|
|
104
91
|
* Provides access to the ReferralModule instance.
|
|
105
92
|
* This getter allows for interacting with referral related functionalities.
|
package/src/index.ts
CHANGED
|
@@ -2,5 +2,4 @@ export * from './client';
|
|
|
2
2
|
export * from './modules/twitter/services/get-auth-url/types';
|
|
3
3
|
export * from './modules/vote/types';
|
|
4
4
|
export * from './modules/lge/types';
|
|
5
|
-
export * from './modules/leaderboard/types';
|
|
6
5
|
export * from './modules/referral/services/get-wallet-referral-details/types';
|
package/src/modules/lge/index.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
+
ClaimRankParams,
|
|
3
|
+
ClaimRankResult,
|
|
2
4
|
GetLeaderboardParams,
|
|
3
5
|
GetLeaderboardResult,
|
|
4
6
|
GetUserLeaderboardDataParams,
|
|
@@ -27,6 +29,27 @@ export default class LGEModule extends RestClient implements Loggable {
|
|
|
27
29
|
this.loggingEnabled = loggingEnabled;
|
|
28
30
|
}
|
|
29
31
|
|
|
32
|
+
@Logger('LGEModule.claimRank')
|
|
33
|
+
async claimRank(params: ClaimRankParams) {
|
|
34
|
+
// TODO: Costin, Write proper implementation
|
|
35
|
+
return await new Promise(
|
|
36
|
+
(resolve: (_: ClaimRankResult) => void, reject) => {
|
|
37
|
+
setTimeout(
|
|
38
|
+
() => {
|
|
39
|
+
const error = Math.random() * 100 > 50;
|
|
40
|
+
if (error) {
|
|
41
|
+
reject(new Error(`Claim Rank for ${params.address} error`));
|
|
42
|
+
}
|
|
43
|
+
resolve({
|
|
44
|
+
success: true,
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
Math.random() * 100 + 1000,
|
|
48
|
+
);
|
|
49
|
+
},
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
|
|
30
53
|
@Logger('LGEModule.getLGEBoostRate')
|
|
31
54
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
32
55
|
async getLGEBoostRate(_: GetLGEBoostRateParams) {
|
|
@@ -52,47 +75,19 @@ export default class LGEModule extends RestClient implements Loggable {
|
|
|
52
75
|
return this.get<GetUserLeaderboardDataResult>(uri);
|
|
53
76
|
}
|
|
54
77
|
|
|
55
|
-
// TODO: Costin fix implementation
|
|
56
78
|
@Logger('LGEModule.getUserGameStatus')
|
|
57
79
|
async getUserGameStatus(
|
|
58
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
59
80
|
params: GetUserGameStatusParams,
|
|
60
81
|
): Promise<GetUserGameStatusResult> {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
() =>
|
|
64
|
-
resolve({
|
|
65
|
-
status:
|
|
66
|
-
Math.random() > 50
|
|
67
|
-
? 'notStarted'
|
|
68
|
-
: Math.random() > 50
|
|
69
|
-
? 'notLockedIn'
|
|
70
|
-
: 'lockedIn',
|
|
71
|
-
boostRate: Math.random() * 15,
|
|
72
|
-
bodyId: Math.floor(Math.random() * 10).toString(),
|
|
73
|
-
nextBoostStartTimestampMilliseconds:
|
|
74
|
-
Date.now() + Math.random() * 1000 * 60 * 60,
|
|
75
|
-
}),
|
|
76
|
-
Math.random() * 2000,
|
|
77
|
-
),
|
|
78
|
-
);
|
|
82
|
+
const uri = `/api/xp/user-game-status/${params.address}`;
|
|
83
|
+
return this.get<GetUserGameStatusResult>(uri);
|
|
79
84
|
}
|
|
80
85
|
|
|
81
|
-
// TODO: Costin fix implementation
|
|
82
86
|
@Logger('LGEModule.generateGameBoostRate')
|
|
83
87
|
async generateGameBoostRate(
|
|
84
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
85
88
|
params: GenerateGameBoostRateParams,
|
|
86
89
|
): Promise<GenerateGameBoostRateResult> {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
() =>
|
|
90
|
-
resolve({
|
|
91
|
-
boostRate: Math.random() * 15,
|
|
92
|
-
bodyId: Math.floor(Math.random() * 10).toString(),
|
|
93
|
-
}),
|
|
94
|
-
Math.random() * 2000,
|
|
95
|
-
),
|
|
96
|
-
);
|
|
90
|
+
const uri = `/api/xp/generate-game-boost-rate/${params.address}/${params.bodyId}`;
|
|
91
|
+
return this.get<GenerateGameBoostRateResult>(uri);
|
|
97
92
|
}
|
|
98
93
|
}
|
package/src/modules/lge/types.ts
CHANGED
|
@@ -3,16 +3,17 @@ export {
|
|
|
3
3
|
GetAccountLGEStatusResult,
|
|
4
4
|
GetLGEBoostRateParams,
|
|
5
5
|
GetLGEBoostRateResult,
|
|
6
|
+
GetUserGameStatusParams,
|
|
7
|
+
GetUserGameStatusResult,
|
|
8
|
+
GenerateGameBoostRateParams,
|
|
9
|
+
GenerateGameBoostRateResult,
|
|
10
|
+
GetLeaderboardParams,
|
|
11
|
+
GetLeaderboardResult,
|
|
12
|
+
GetUserLeaderboardDataParams,
|
|
13
|
+
GetUserLeaderboardDataResult,
|
|
14
|
+
LeaderboardEntity,
|
|
15
|
+
UserLeaderboardDataEntity,
|
|
16
|
+
ClaimRankParams,
|
|
17
|
+
ClaimRankResult,
|
|
6
18
|
XPEntity,
|
|
7
19
|
} from '@reyaxyz/common';
|
|
8
|
-
|
|
9
|
-
// TODO: Costin fix implementation, review if needed to be moved to common
|
|
10
|
-
export type GetUserGameStatusParams = { address: string };
|
|
11
|
-
export type GetUserGameStatusResult = {
|
|
12
|
-
bodyId: string;
|
|
13
|
-
status: 'notStarted' | 'notLockedIn' | 'lockedIn';
|
|
14
|
-
boostRate: number;
|
|
15
|
-
nextBoostStartTimestampMilliseconds: number;
|
|
16
|
-
};
|
|
17
|
-
export type GenerateGameBoostRateParams = { address: string; bodyId: string };
|
|
18
|
-
export type GenerateGameBoostRateResult = { boostRate: number; bodyId: string };
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
GetWalletReferralDetailsResult,
|
|
4
4
|
} from './types';
|
|
5
5
|
|
|
6
|
-
// TODO: Costin fix implementation
|
|
6
|
+
// TODO: Costin fix implementation (PUBLIC)
|
|
7
7
|
export function getWalletReferralDetails({
|
|
8
8
|
address,
|
|
9
9
|
}: GetWalletReferralDetailsParams): Promise<GetWalletReferralDetailsResult> {
|
|
@@ -2,7 +2,6 @@ import { getTwitterOauthUrl, GetTwitterOauthUrlParams } from './services';
|
|
|
2
2
|
import { Loggable, Logger } from '@reyaxyz/common';
|
|
3
3
|
|
|
4
4
|
export default class TwitterModule implements Loggable {
|
|
5
|
-
private getExtraBoostTwitterApiURI: string;
|
|
6
5
|
private getLockGameBoostTwitterApiURI: string;
|
|
7
6
|
private getShareReferralTwitterApiURI: string;
|
|
8
7
|
|
|
@@ -10,28 +9,24 @@ export default class TwitterModule implements Loggable {
|
|
|
10
9
|
loggingEnabled: boolean = false;
|
|
11
10
|
|
|
12
11
|
constructor(
|
|
13
|
-
getExtraBoostTwitterApiURI: string,
|
|
14
12
|
getLockGameBoostTwitterApiURI: string,
|
|
15
13
|
getShareReferralTwitterApiURI: string,
|
|
16
14
|
twitterClientId: string,
|
|
17
15
|
loggingEnabled: boolean,
|
|
18
16
|
) {
|
|
19
|
-
this.getExtraBoostTwitterApiURI = getExtraBoostTwitterApiURI;
|
|
20
17
|
this.getLockGameBoostTwitterApiURI = getLockGameBoostTwitterApiURI;
|
|
21
18
|
this.getShareReferralTwitterApiURI = getShareReferralTwitterApiURI;
|
|
22
19
|
this.twitterClientId = twitterClientId;
|
|
23
20
|
this.loggingEnabled = loggingEnabled;
|
|
24
21
|
}
|
|
25
22
|
|
|
23
|
+
// TODO: Costin: deprecate
|
|
26
24
|
@Logger('TwitterModule.getExtraBoostTwitterLink')
|
|
27
25
|
getExtraBoostTwitterLink(
|
|
28
|
-
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
27
|
+
_: Pick<GetTwitterOauthUrlParams, 'walletAddress'>,
|
|
29
28
|
): string {
|
|
30
|
-
return
|
|
31
|
-
...params,
|
|
32
|
-
redirectURI: this.getExtraBoostTwitterApiURI,
|
|
33
|
-
twitterClientId: this.twitterClientId,
|
|
34
|
-
});
|
|
29
|
+
return 'NONE';
|
|
35
30
|
}
|
|
36
31
|
|
|
37
32
|
@Logger('TwitterModule.getLockGameBoostTwitterLink')
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
-
};
|
|
23
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
24
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
25
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
26
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
27
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
28
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
29
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
30
|
-
});
|
|
31
|
-
};
|
|
32
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
33
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
34
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
35
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
36
|
-
function step(op) {
|
|
37
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
38
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
39
|
-
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;
|
|
40
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
41
|
-
switch (op[0]) {
|
|
42
|
-
case 0: case 1: t = op; break;
|
|
43
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
44
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
45
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
46
|
-
default:
|
|
47
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
48
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
49
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
50
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
51
|
-
if (t[2]) _.ops.pop();
|
|
52
|
-
_.trys.pop(); continue;
|
|
53
|
-
}
|
|
54
|
-
op = body.call(thisArg, _);
|
|
55
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
56
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
60
|
-
var common_1 = require("@reyaxyz/common");
|
|
61
|
-
var LeaderboardModule = /** @class */ (function (_super) {
|
|
62
|
-
__extends(LeaderboardModule, _super);
|
|
63
|
-
function LeaderboardModule(apiUrl, loggingEnabled) {
|
|
64
|
-
var _this = _super.call(this, apiUrl) || this;
|
|
65
|
-
_this.loggingEnabled = false;
|
|
66
|
-
_this.loggingEnabled = loggingEnabled;
|
|
67
|
-
return _this;
|
|
68
|
-
}
|
|
69
|
-
LeaderboardModule.prototype.claimRank = function (params) {
|
|
70
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
71
|
-
return __generator(this, function (_a) {
|
|
72
|
-
switch (_a.label) {
|
|
73
|
-
case 0: return [4 /*yield*/, new Promise(function (resolve, reject) {
|
|
74
|
-
setTimeout(function () {
|
|
75
|
-
var error = Math.random() * 100 > 50;
|
|
76
|
-
if (error) {
|
|
77
|
-
reject(new Error("Claim Rank for ".concat(params.address, " error")));
|
|
78
|
-
}
|
|
79
|
-
resolve({
|
|
80
|
-
success: true,
|
|
81
|
-
});
|
|
82
|
-
}, Math.random() * 100 + 1000);
|
|
83
|
-
})];
|
|
84
|
-
case 1:
|
|
85
|
-
// TODO: Costin, Write proper implementation
|
|
86
|
-
return [2 /*return*/, _a.sent()];
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
});
|
|
90
|
-
};
|
|
91
|
-
LeaderboardModule.prototype.getLeaderboard = function (params) {
|
|
92
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
93
|
-
var uri;
|
|
94
|
-
return __generator(this, function (_a) {
|
|
95
|
-
uri = "/api/xp/leaderboard/".concat(params.perPage, "/").concat(params.page);
|
|
96
|
-
return [2 /*return*/, this.get(uri)];
|
|
97
|
-
});
|
|
98
|
-
});
|
|
99
|
-
};
|
|
100
|
-
LeaderboardModule.prototype.getUserLeaderboardData = function (params) {
|
|
101
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
102
|
-
var uri;
|
|
103
|
-
return __generator(this, function (_a) {
|
|
104
|
-
uri = "/api/xp/leaderboard-user-data/".concat(params.address);
|
|
105
|
-
return [2 /*return*/, this.get(uri)];
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
};
|
|
109
|
-
__decorate([
|
|
110
|
-
(0, common_1.Logger)('LeaderboardModule.claimRank')
|
|
111
|
-
], LeaderboardModule.prototype, "claimRank", null);
|
|
112
|
-
__decorate([
|
|
113
|
-
(0, common_1.Logger)('LeaderboardModule.getLeaderboard')
|
|
114
|
-
], LeaderboardModule.prototype, "getLeaderboard", null);
|
|
115
|
-
__decorate([
|
|
116
|
-
(0, common_1.Logger)('LeaderboardModule.getUserLeaderboardData')
|
|
117
|
-
], LeaderboardModule.prototype, "getUserLeaderboardData", null);
|
|
118
|
-
return LeaderboardModule;
|
|
119
|
-
}(common_1.RestClient));
|
|
120
|
-
exports.default = LeaderboardModule;
|
|
121
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/leaderboard/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAA+D;AAW/D;IAA+C,qCAAU;IAGvD,2BAAY,MAAc,EAAE,cAAuB;QACjD,YAAA,MAAK,YAAC,MAAM,CAAC,SAAC;QAHhB,oBAAc,GAAY,KAAK,CAAC;QAI9B,KAAI,CAAC,cAAc,GAAG,cAAc,CAAC;;IACvC,CAAC;IAGK,qCAAS,GAAT,UAAU,MAAuB;;;;4BAE9B,qBAAM,IAAI,OAAO,CACtB,UAAC,OAAqC,EAAE,MAAM;4BAC5C,UAAU,CACR;gCACE,IAAM,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,EAAE,CAAC;gCACvC,IAAI,KAAK,EAAE,CAAC;oCACV,MAAM,CAAC,IAAI,KAAK,CAAC,yBAAkB,MAAM,CAAC,OAAO,WAAQ,CAAC,CAAC,CAAC;gCAC9D,CAAC;gCACD,OAAO,CAAC;oCACN,OAAO,EAAE,IAAI;iCACd,CAAC,CAAC;4BACL,CAAC,EACD,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,IAAI,CAC3B,CAAC;wBACJ,CAAC,CACF,EAAA;;oBAhBD,4CAA4C;oBAC5C,sBAAO,SAeN,EAAC;;;;KACH;IAGK,0CAAc,GAAd,UAAe,MAA4B;;;;gBACzC,GAAG,GAAG,8BAAuB,MAAM,CAAC,OAAO,cAAI,MAAM,CAAC,IAAI,CAAE,CAAC;gBACnE,sBAAO,IAAI,CAAC,GAAG,CAAuB,GAAG,CAAC,EAAC;;;KAC5C;IAGK,kDAAsB,GAAtB,UAAuB,MAAoC;;;;gBACzD,GAAG,GAAG,wCAAiC,MAAM,CAAC,OAAO,CAAE,CAAC;gBAC9D,sBAAO,IAAI,CAAC,GAAG,CAA+B,GAAG,CAAC,EAAC;;;KACpD;IA9BK;QADL,IAAA,eAAM,EAAC,6BAA6B,CAAC;sDAmBrC;IAGK;QADL,IAAA,eAAM,EAAC,kCAAkC,CAAC;2DAI1C;IAGK;QADL,IAAA,eAAM,EAAC,0CAA0C,CAAC;mEAIlD;IACH,wBAAC;CAAA,AAxCD,CAA+C,mBAAU,GAwCxD;kBAxCoB,iBAAiB","sourcesContent":["import { Loggable, Logger, RestClient } from '@reyaxyz/common';\n\nimport {\n ClaimRankParams,\n ClaimRankResult,\n GetLeaderboardParams,\n GetLeaderboardResult,\n GetUserLeaderboardDataParams,\n GetUserLeaderboardDataResult,\n} from './types';\n\nexport default class LeaderboardModule extends RestClient implements Loggable {\n loggingEnabled: boolean = false;\n\n constructor(apiUrl: string, loggingEnabled: boolean) {\n super(apiUrl);\n this.loggingEnabled = loggingEnabled;\n }\n\n @Logger('LeaderboardModule.claimRank')\n async claimRank(params: ClaimRankParams) {\n // TODO: Costin, Write proper implementation\n return await new Promise(\n (resolve: (_: ClaimRankResult) => void, reject) => {\n setTimeout(\n () => {\n const error = Math.random() * 100 > 50;\n if (error) {\n reject(new Error(`Claim Rank for ${params.address} error`));\n }\n resolve({\n success: true,\n });\n },\n Math.random() * 100 + 1000,\n );\n },\n );\n }\n\n @Logger('LeaderboardModule.getLeaderboard')\n async getLeaderboard(params: GetLeaderboardParams) {\n const uri = `/api/xp/leaderboard/${params.perPage}/${params.page}`;\n return this.get<GetLeaderboardResult>(uri);\n }\n\n @Logger('LeaderboardModule.getUserLeaderboardData')\n async getUserLeaderboardData(params: GetUserLeaderboardDataParams) {\n const uri = `/api/xp/leaderboard-user-data/${params.address}`;\n return this.get<GetUserLeaderboardDataResult>(uri);\n }\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"/","sources":["modules/leaderboard/types.ts"],"names":[],"mappings":"","sourcesContent":["export {\n ClaimRankParams,\n ClaimRankResult,\n LeaderboardEntity,\n GetLeaderboardParams,\n GetLeaderboardResult,\n UserLeaderboardDataEntity,\n GetUserLeaderboardDataParams,\n GetUserLeaderboardDataResult,\n} from '@reyaxyz/common';\n"]}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Loggable, RestClient } from '@reyaxyz/common';
|
|
2
|
-
import { ClaimRankParams, ClaimRankResult, GetLeaderboardParams, GetLeaderboardResult, GetUserLeaderboardDataParams } from './types';
|
|
3
|
-
export default class LeaderboardModule extends RestClient implements Loggable {
|
|
4
|
-
loggingEnabled: boolean;
|
|
5
|
-
constructor(apiUrl: string, loggingEnabled: boolean);
|
|
6
|
-
claimRank(params: ClaimRankParams): Promise<ClaimRankResult>;
|
|
7
|
-
getLeaderboard(params: GetLeaderboardParams): Promise<GetLeaderboardResult>;
|
|
8
|
-
getUserLeaderboardData(params: GetUserLeaderboardDataParams): Promise<import("@reyaxyz/common").UserLeaderboardDataEntity>;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/leaderboard/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAU,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE/D,OAAO,EACL,eAAe,EACf,eAAe,EACf,oBAAoB,EACpB,oBAAoB,EACpB,4BAA4B,EAE7B,MAAM,SAAS,CAAC;AAEjB,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,UAAW,YAAW,QAAQ;IAC3E,cAAc,EAAE,OAAO,CAAS;gBAEpB,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO;IAM7C,SAAS,CAAC,MAAM,EAAE,eAAe;IAqBjC,cAAc,CAAC,MAAM,EAAE,oBAAoB;IAM3C,sBAAsB,CAAC,MAAM,EAAE,4BAA4B;CAIlE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["modules/leaderboard/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,oBAAoB,EACpB,oBAAoB,EACpB,yBAAyB,EACzB,4BAA4B,EAC5B,4BAA4B,GAC7B,MAAM,iBAAiB,CAAC"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { Loggable, Logger, RestClient } from '@reyaxyz/common';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
ClaimRankParams,
|
|
5
|
-
ClaimRankResult,
|
|
6
|
-
GetLeaderboardParams,
|
|
7
|
-
GetLeaderboardResult,
|
|
8
|
-
GetUserLeaderboardDataParams,
|
|
9
|
-
GetUserLeaderboardDataResult,
|
|
10
|
-
} from './types';
|
|
11
|
-
|
|
12
|
-
export default class LeaderboardModule extends RestClient implements Loggable {
|
|
13
|
-
loggingEnabled: boolean = false;
|
|
14
|
-
|
|
15
|
-
constructor(apiUrl: string, loggingEnabled: boolean) {
|
|
16
|
-
super(apiUrl);
|
|
17
|
-
this.loggingEnabled = loggingEnabled;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
@Logger('LeaderboardModule.claimRank')
|
|
21
|
-
async claimRank(params: ClaimRankParams) {
|
|
22
|
-
// TODO: Costin, Write proper implementation
|
|
23
|
-
return await new Promise(
|
|
24
|
-
(resolve: (_: ClaimRankResult) => void, reject) => {
|
|
25
|
-
setTimeout(
|
|
26
|
-
() => {
|
|
27
|
-
const error = Math.random() * 100 > 50;
|
|
28
|
-
if (error) {
|
|
29
|
-
reject(new Error(`Claim Rank for ${params.address} error`));
|
|
30
|
-
}
|
|
31
|
-
resolve({
|
|
32
|
-
success: true,
|
|
33
|
-
});
|
|
34
|
-
},
|
|
35
|
-
Math.random() * 100 + 1000,
|
|
36
|
-
);
|
|
37
|
-
},
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
@Logger('LeaderboardModule.getLeaderboard')
|
|
42
|
-
async getLeaderboard(params: GetLeaderboardParams) {
|
|
43
|
-
const uri = `/api/xp/leaderboard/${params.perPage}/${params.page}`;
|
|
44
|
-
return this.get<GetLeaderboardResult>(uri);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
@Logger('LeaderboardModule.getUserLeaderboardData')
|
|
48
|
-
async getUserLeaderboardData(params: GetUserLeaderboardDataParams) {
|
|
49
|
-
const uri = `/api/xp/leaderboard-user-data/${params.address}`;
|
|
50
|
-
return this.get<GetUserLeaderboardDataResult>(uri);
|
|
51
|
-
}
|
|
52
|
-
}
|