@reyaxyz/community-sdk 0.18.2 → 0.20.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 +1 -1
- package/dist/client/index.js.map +1 -1
- package/dist/modules/lge/index.js +46 -0
- package/dist/modules/lge/index.js.map +1 -1
- package/dist/modules/lge/types.js.map +1 -1
- package/dist/modules/twitter/index.js +20 -6
- package/dist/modules/twitter/index.js.map +1 -1
- package/dist/types/client/index.d.ts.map +1 -1
- package/dist/types/modules/lge/index.d.ts +3 -1
- package/dist/types/modules/lge/index.d.ts.map +1 -1
- package/dist/types/modules/lge/types.d.ts +17 -0
- package/dist/types/modules/lge/types.d.ts.map +1 -1
- package/dist/types/modules/twitter/index.d.ts +7 -3
- package/dist/types/modules/twitter/index.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/client/index.ts +3 -1
- package/src/modules/lge/index.ts +46 -4
- package/src/modules/lge/types.ts +11 -0
- package/src/modules/twitter/index.ts +34 -8
package/dist/client/index.js
CHANGED
|
@@ -17,7 +17,7 @@ var CommunityClient = /** @class */ (function () {
|
|
|
17
17
|
function CommunityClient() {
|
|
18
18
|
this._voteModule = new vote_1.default(CommunityClient.config.apiEndpoint, CommunityClient.config.logging);
|
|
19
19
|
this._lgeModule = new lge_1.default(CommunityClient.config.apiEndpoint, CommunityClient.config.logging);
|
|
20
|
-
this._twitterModule = new twitter_1.default(CommunityClient.config.twitter.
|
|
20
|
+
this._twitterModule = new twitter_1.default(CommunityClient.config.twitter.getExtraBoostTwitterApiURI, CommunityClient.config.twitter.getLockGameBoostTwitterApiURI, CommunityClient.config.twitter.getShareReferralTwitterApiURI, CommunityClient.config.twitter.clientId, CommunityClient.config.logging);
|
|
21
21
|
this._leaderboardModule = new leaderboard_1.default(CommunityClient.config.apiEndpoint, CommunityClient.config.logging);
|
|
22
22
|
this._referralModule = new referral_1.default(CommunityClient.config.logging);
|
|
23
23
|
}
|
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,uEAAuD;AACvD,iEAAiD;AAEjD;;GAEG;AACH;IAUE;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,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["client/index.ts"],"names":[],"mappings":";;;;;;AAAA,0CAAoE;AACpE,yDAAyC;AACzC,uDAAuC;AACvC,+DAA+C;AAC/C,uEAAuD;AACvD,iEAAiD;AAEjD;;GAEG;AACH;IAUE;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,0BAA0B,EACzD,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,6BAA6B,EAC5D,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,6BAA6B,EAC5D,eAAe,CAAC,MAAM,CAAC,OAAO,C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CAAC,eAAe,CAAC;QACvD,CAAC;;;OAAA;IAED,sBAAkB,iCAAc;aAAhC;YACE,OAAO,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC;QACtC,CAAC;;;OAAA;IAvGc,sBAAM,GAAkB,2BAAkB,CAAC,MAAM,CAAC,CAAC;IAwGpE,sBAAC;CAAA,AA1GD,IA0GC;AA1GY,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 LeaderboardModule from '../modules/leaderboard';\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 _leaderboardModule: LeaderboardModule;\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.getExtraBoostTwitterApiURI,\n CommunityClient.config.twitter.getLockGameBoostTwitterApiURI,\n CommunityClient.config.twitter.getShareReferralTwitterApiURI,\n CommunityClient.config.twitter.clientId,\n CommunityClient.config.logging,\n );\n this._leaderboardModule = new LeaderboardModule(\n CommunityClient.config.apiEndpoint,\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 /**\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 LeaderboardModule instance.\n * This getter allows for interacting with leaderboard-related functionalities.\n *\n * @returns {LeaderboardModule} An instance of Leaderboard for twitter operations.\n * @memberof CommunityClient\n */\n public static get leaderboard(): LeaderboardModule {\n return CommunityClient.getInstance()._leaderboardModule;\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"]}
|
|
@@ -103,6 +103,46 @@ var LGEModule = /** @class */ (function (_super) {
|
|
|
103
103
|
});
|
|
104
104
|
});
|
|
105
105
|
};
|
|
106
|
+
// TODO: Costin fix implementation
|
|
107
|
+
LGEModule.prototype.getUserGameStatus = function (
|
|
108
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
109
|
+
params) {
|
|
110
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
111
|
+
return __generator(this, function (_a) {
|
|
112
|
+
return [2 /*return*/, new Promise(function (resolve) {
|
|
113
|
+
return setTimeout(function () {
|
|
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
|
+
})];
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
};
|
|
129
|
+
// TODO: Costin fix implementation
|
|
130
|
+
LGEModule.prototype.generateGameBoostRate = function (
|
|
131
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
132
|
+
params) {
|
|
133
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
134
|
+
return __generator(this, function (_a) {
|
|
135
|
+
return [2 /*return*/, new Promise(function (resolve) {
|
|
136
|
+
return setTimeout(function () {
|
|
137
|
+
return resolve({
|
|
138
|
+
boostRate: Math.random() * 15,
|
|
139
|
+
bodyId: Math.floor(Math.random() * 10).toString(),
|
|
140
|
+
});
|
|
141
|
+
}, Math.random() * 2000);
|
|
142
|
+
})];
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
};
|
|
106
146
|
__decorate([
|
|
107
147
|
(0, common_2.Logger)('LGEModule.getLGEBoostRate')
|
|
108
148
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -116,6 +156,12 @@ var LGEModule = /** @class */ (function (_super) {
|
|
|
116
156
|
__decorate([
|
|
117
157
|
(0, common_2.Logger)('LGEModule.getUserLeaderboardData')
|
|
118
158
|
], LGEModule.prototype, "getUserLeaderboardData", null);
|
|
159
|
+
__decorate([
|
|
160
|
+
(0, common_2.Logger)('LGEModule.getUserGameStatus')
|
|
161
|
+
], LGEModule.prototype, "getUserGameStatus", null);
|
|
162
|
+
__decorate([
|
|
163
|
+
(0, common_2.Logger)('LGEModule.generateGameBoostRate')
|
|
164
|
+
], LGEModule.prototype, "generateGameBoostRate", null);
|
|
119
165
|
return LGEModule;
|
|
120
166
|
}(common_1.RestClient));
|
|
121
167
|
exports.default = LGEModule;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/lge/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAMyB;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/lge/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAMyB;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;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;I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E,EACJ,IAAI,CAAC,MAAM,EAAE,GAAG,IAAI,CACrB;oBAPD,CAOC,CACF,EAAC;;;KACH;IAjEK;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;IAIK;QADL,IAAA,eAAM,EAAC,6BAA6B,CAAC;sDAuBrC;IAIK;QADL,IAAA,eAAM,EAAC,iCAAiC,CAAC;0DAezC;IACH,gBAAC;CAAA,AA5ED,CAAuC,mBAAU,GA4EhD;kBA5EoB,SAAS","sourcesContent":["import {\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.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 // TODO: Costin fix implementation\n @Logger('LGEModule.getUserGameStatus')\n async getUserGameStatus(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n params: GetUserGameStatusParams,\n ): Promise<GetUserGameStatusResult> {\n return new Promise((resolve) =>\n setTimeout(\n () =>\n resolve({\n status:\n Math.random() > 50\n ? 'notStarted'\n : Math.random() > 50\n ? 'notLockedIn'\n : 'lockedIn',\n boostRate: Math.random() * 15,\n bodyId: Math.floor(Math.random() * 10).toString(),\n nextBoostStartTimestampMilliseconds:\n Date.now() + Math.random() * 1000 * 60 * 60,\n }),\n Math.random() * 2000,\n ),\n );\n }\n\n // TODO: Costin fix implementation\n @Logger('LGEModule.generateGameBoostRate')\n async generateGameBoostRate(\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n params: GenerateGameBoostRateParams,\n ): Promise<GenerateGameBoostRateResult> {\n return new Promise((resolve) =>\n setTimeout(\n () =>\n resolve({\n boostRate: Math.random() * 15,\n bodyId: Math.floor(Math.random() * 10).toString(),\n }),\n Math.random() * 2000,\n ),\n );\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 XPEntity,\n} from '@reyaxyz/common';\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 XPEntity,\n} from '@reyaxyz/common';\n\n// TODO: Costin fix implementation, review if needed to be moved to common\nexport type GetUserGameStatusParams = { address: string };\nexport type GetUserGameStatusResult = {\n bodyId: string;\n status: 'notStarted' | 'notLockedIn' | 'lockedIn';\n boostRate: number;\n nextBoostStartTimestampMilliseconds: number;\n};\nexport type GenerateGameBoostRateParams = { address: string; bodyId: string };\nexport type GenerateGameBoostRateResult = { boostRate: number; bodyId: string };\n"]}
|
|
@@ -20,18 +20,32 @@ 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(getExtraBoostTwitterApiURI, getLockGameBoostTwitterApiURI, getShareReferralTwitterApiURI, twitterClientId, loggingEnabled) {
|
|
24
24
|
this.loggingEnabled = false;
|
|
25
|
-
this.
|
|
25
|
+
this.getExtraBoostTwitterApiURI = getExtraBoostTwitterApiURI;
|
|
26
|
+
this.getLockGameBoostTwitterApiURI = getLockGameBoostTwitterApiURI;
|
|
27
|
+
this.getShareReferralTwitterApiURI = getShareReferralTwitterApiURI;
|
|
26
28
|
this.twitterClientId = twitterClientId;
|
|
27
29
|
this.loggingEnabled = loggingEnabled;
|
|
28
30
|
}
|
|
29
|
-
TwitterModule.prototype.
|
|
30
|
-
return (0, services_1.getTwitterOauthUrl)(__assign(__assign({}, params), { redirectURI: this.
|
|
31
|
+
TwitterModule.prototype.getExtraBoostTwitterLink = function (params) {
|
|
32
|
+
return (0, services_1.getTwitterOauthUrl)(__assign(__assign({}, params), { redirectURI: this.getExtraBoostTwitterApiURI, twitterClientId: this.twitterClientId }));
|
|
31
33
|
};
|
|
34
|
+
TwitterModule.prototype.getLockGameBoostTwitterLink = function (params) {
|
|
35
|
+
return (0, services_1.getTwitterOauthUrl)(__assign(__assign({}, params), { redirectURI: this.getLockGameBoostTwitterApiURI, twitterClientId: this.twitterClientId }));
|
|
36
|
+
};
|
|
37
|
+
TwitterModule.prototype.getShareReferralTwitterLink = function (params) {
|
|
38
|
+
return (0, services_1.getTwitterOauthUrl)(__assign(__assign({}, params), { redirectURI: this.getShareReferralTwitterApiURI, twitterClientId: this.twitterClientId }));
|
|
39
|
+
};
|
|
40
|
+
__decorate([
|
|
41
|
+
(0, common_1.Logger)('TwitterModule.getExtraBoostTwitterLink')
|
|
42
|
+
], TwitterModule.prototype, "getExtraBoostTwitterLink", null);
|
|
43
|
+
__decorate([
|
|
44
|
+
(0, common_1.Logger)('TwitterModule.getLockGameBoostTwitterLink')
|
|
45
|
+
], TwitterModule.prototype, "getLockGameBoostTwitterLink", null);
|
|
32
46
|
__decorate([
|
|
33
|
-
(0, common_1.Logger)('TwitterModule.
|
|
34
|
-
], TwitterModule.prototype, "
|
|
47
|
+
(0, common_1.Logger)('TwitterModule.getShareReferralTwitterLink')
|
|
48
|
+
], TwitterModule.prototype, "getShareReferralTwitterLink", null);
|
|
35
49
|
return TwitterModule;
|
|
36
50
|
}());
|
|
37
51
|
exports.default = TwitterModule;
|
|
@@ -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;IAQE,uBACE,0BAAkC,EAClC,6BAAqC,EACrC,6BAAqC,EACrC,eAAuB,EACvB,cAAuB;QAPzB,mBAAc,GAAY,KAAK,CAAC;QAS9B,IAAI,CAAC,0BAA0B,GAAG,0BAA0B,CAAC;QAC7D,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;IAGD,gDAAwB,GAAxB,UACE,MAAuD;QAEvD,OAAO,IAAA,6BAAkB,wBACpB,MAAM,KACT,WAAW,EAAE,IAAI,CAAC,0BAA0B,EAC5C,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;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;IA9BD;QADC,IAAA,eAAM,EAAC,wCAAwC,CAAC;iEAShD;IAGD;QADC,IAAA,eAAM,EAAC,2CAA2C,CAAC;oEASnD;IAGD;QADC,IAAA,eAAM,EAAC,2CAA2C,CAAC;oEASnD;IACH,oBAAC;CAAA,AAtDD,IAsDC;kBAtDoB,aAAa","sourcesContent":["import { getTwitterOauthUrl, GetTwitterOauthUrlParams } from './services';\nimport { Loggable, Logger } from '@reyaxyz/common';\n\nexport default class TwitterModule implements Loggable {\n private getExtraBoostTwitterApiURI: string;\n private getLockGameBoostTwitterApiURI: string;\n private getShareReferralTwitterApiURI: string;\n\n private twitterClientId: string;\n loggingEnabled: boolean = false;\n\n constructor(\n getExtraBoostTwitterApiURI: string,\n getLockGameBoostTwitterApiURI: string,\n getShareReferralTwitterApiURI: string,\n twitterClientId: string,\n loggingEnabled: boolean,\n ) {\n this.getExtraBoostTwitterApiURI = getExtraBoostTwitterApiURI;\n this.getLockGameBoostTwitterApiURI = getLockGameBoostTwitterApiURI;\n this.getShareReferralTwitterApiURI = getShareReferralTwitterApiURI;\n this.twitterClientId = twitterClientId;\n this.loggingEnabled = loggingEnabled;\n }\n\n @Logger('TwitterModule.getExtraBoostTwitterLink')\n getExtraBoostTwitterLink(\n params: Pick<GetTwitterOauthUrlParams, 'walletAddress'>,\n ): string {\n return getTwitterOauthUrl({\n ...params,\n redirectURI: this.getExtraBoostTwitterApiURI,\n twitterClientId: this.twitterClientId,\n });\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"]}
|
|
@@ -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,iBAAiB,MAAM,wBAAwB,CAAC;AACvD,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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AQ,IAAI,cAAc,CAE3C;IAED,WAAkB,cAAc,IAAI,MAAM,CAEzC;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GetLeaderboardParams, GetLeaderboardResult, GetUserLeaderboardDataParams, RestClient } from '@reyaxyz/common';
|
|
2
|
-
import { GetAccountLGEStatusParams, GetAccountLGEStatusResult, GetLGEBoostRateParams, GetLGEBoostRateResult } from './types';
|
|
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;
|
|
@@ -8,5 +8,7 @@ export default class LGEModule extends RestClient implements Loggable {
|
|
|
8
8
|
getAccountLGEStatus(params: GetAccountLGEStatusParams): Promise<GetAccountLGEStatusResult>;
|
|
9
9
|
getLeaderboard(params: GetLeaderboardParams): Promise<GetLeaderboardResult>;
|
|
10
10
|
getUserLeaderboardData(params: GetUserLeaderboardDataParams): Promise<import("@reyaxyz/common").UserLeaderboardDataEntity>;
|
|
11
|
+
getUserGameStatus(params: GetUserGameStatusParams): Promise<GetUserGameStatusResult>;
|
|
12
|
+
generateGameBoostRate(params: GenerateGameBoostRateParams): Promise<GenerateGameBoostRateResult>;
|
|
11
13
|
}
|
|
12
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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,yBAAyB,EACzB,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,
|
|
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;IAO7C,eAAe,CAAC,CAAC,EAAE,qBAAqB;IAMxC,mBAAmB,CAAC,MAAM,EAAE,yBAAyB;IAMrD,cAAc,CAAC,MAAM,EAAE,oBAAoB;IAM3C,sBAAsB,CAAC,MAAM,EAAE,4BAA4B;IAO3D,iBAAiB,CAErB,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,uBAAuB,CAAC;IAuB7B,qBAAqB,CAEzB,MAAM,EAAE,2BAA2B,GAClC,OAAO,CAAC,2BAA2B,CAAC;CAYxC"}
|
|
@@ -1,2 +1,19 @@
|
|
|
1
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
|
+
};
|
|
2
19
|
//# 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,QAAQ,GACT,MAAM,iBAAiB,CAAC"}
|
|
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,QAAQ,GACT,MAAM,iBAAiB,CAAC;AAGzB,MAAM,MAAM,uBAAuB,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAC1D,MAAM,MAAM,uBAAuB,GAAG;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,YAAY,GAAG,aAAa,GAAG,UAAU,CAAC;IAClD,SAAS,EAAE,MAAM,CAAC;IAClB,mCAAmC,EAAE,MAAM,CAAC;CAC7C,CAAC;AACF,MAAM,MAAM,2BAA2B,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAC9E,MAAM,MAAM,2BAA2B,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import { GetTwitterOauthUrlParams } from './services';
|
|
2
2
|
import { Loggable } from '@reyaxyz/common';
|
|
3
3
|
export default class TwitterModule implements Loggable {
|
|
4
|
-
private
|
|
4
|
+
private getExtraBoostTwitterApiURI;
|
|
5
|
+
private getLockGameBoostTwitterApiURI;
|
|
6
|
+
private getShareReferralTwitterApiURI;
|
|
5
7
|
private twitterClientId;
|
|
6
8
|
loggingEnabled: boolean;
|
|
7
|
-
constructor(
|
|
8
|
-
|
|
9
|
+
constructor(getExtraBoostTwitterApiURI: string, getLockGameBoostTwitterApiURI: string, getShareReferralTwitterApiURI: string, twitterClientId: string, loggingEnabled: boolean);
|
|
10
|
+
getExtraBoostTwitterLink(params: Pick<GetTwitterOauthUrlParams, 'walletAddress'>): string;
|
|
11
|
+
getLockGameBoostTwitterLink(params: Pick<GetTwitterOauthUrlParams, 'walletAddress'>): string;
|
|
12
|
+
getShareReferralTwitterLink(params: Pick<GetTwitterOauthUrlParams, 'walletAddress'>): string;
|
|
9
13
|
}
|
|
10
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -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,0BAA0B,CAAS;IAC3C,OAAO,CAAC,6BAA6B,CAAS;IAC9C,OAAO,CAAC,6BAA6B,CAAS;IAE9C,OAAO,CAAC,eAAe,CAAS;IAChC,cAAc,EAAE,OAAO,CAAS;gBAG9B,0BAA0B,EAAE,MAAM,EAClC,6BAA6B,EAAE,MAAM,EACrC,6BAA6B,EAAE,MAAM,EACrC,eAAe,EAAE,MAAM,EACvB,cAAc,EAAE,OAAO;IAUzB,wBAAwB,CACtB,MAAM,EAAE,IAAI,CAAC,wBAAwB,EAAE,eAAe,CAAC,GACtD,MAAM;IAST,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.20.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.49.
|
|
13
|
+
"@reyaxyz/common": "0.57.0",
|
|
14
|
+
"@reyaxyz/sdk": "0.49.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": "666f7e4d02a8a02edca91a735298085b33dc5bbe"
|
|
42
42
|
}
|
package/src/client/index.ts
CHANGED
|
@@ -28,7 +28,9 @@ export class CommunityClient {
|
|
|
28
28
|
CommunityClient.config.logging,
|
|
29
29
|
);
|
|
30
30
|
this._twitterModule = new TwitterModule(
|
|
31
|
-
CommunityClient.config.twitter.
|
|
31
|
+
CommunityClient.config.twitter.getExtraBoostTwitterApiURI,
|
|
32
|
+
CommunityClient.config.twitter.getLockGameBoostTwitterApiURI,
|
|
33
|
+
CommunityClient.config.twitter.getShareReferralTwitterApiURI,
|
|
32
34
|
CommunityClient.config.twitter.clientId,
|
|
33
35
|
CommunityClient.config.logging,
|
|
34
36
|
);
|
package/src/modules/lge/index.ts
CHANGED
|
@@ -7,10 +7,14 @@ import {
|
|
|
7
7
|
} from '@reyaxyz/common';
|
|
8
8
|
|
|
9
9
|
import {
|
|
10
|
+
GenerateGameBoostRateParams,
|
|
11
|
+
GenerateGameBoostRateResult,
|
|
10
12
|
GetAccountLGEStatusParams,
|
|
11
13
|
GetAccountLGEStatusResult,
|
|
12
14
|
GetLGEBoostRateParams,
|
|
13
15
|
GetLGEBoostRateResult,
|
|
16
|
+
GetUserGameStatusParams,
|
|
17
|
+
GetUserGameStatusResult,
|
|
14
18
|
} from './types';
|
|
15
19
|
|
|
16
20
|
import { Loggable, Logger } from '@reyaxyz/common';
|
|
@@ -48,9 +52,47 @@ export default class LGEModule extends RestClient implements Loggable {
|
|
|
48
52
|
return this.get<GetUserLeaderboardDataResult>(uri);
|
|
49
53
|
}
|
|
50
54
|
|
|
51
|
-
// TODO:
|
|
52
|
-
|
|
55
|
+
// TODO: Costin fix implementation
|
|
56
|
+
@Logger('LGEModule.getUserGameStatus')
|
|
57
|
+
async getUserGameStatus(
|
|
58
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
59
|
+
params: GetUserGameStatusParams,
|
|
60
|
+
): Promise<GetUserGameStatusResult> {
|
|
61
|
+
return new Promise((resolve) =>
|
|
62
|
+
setTimeout(
|
|
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
|
+
);
|
|
79
|
+
}
|
|
53
80
|
|
|
54
|
-
// TODO:
|
|
55
|
-
|
|
81
|
+
// TODO: Costin fix implementation
|
|
82
|
+
@Logger('LGEModule.generateGameBoostRate')
|
|
83
|
+
async generateGameBoostRate(
|
|
84
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
85
|
+
params: GenerateGameBoostRateParams,
|
|
86
|
+
): Promise<GenerateGameBoostRateResult> {
|
|
87
|
+
return new Promise((resolve) =>
|
|
88
|
+
setTimeout(
|
|
89
|
+
() =>
|
|
90
|
+
resolve({
|
|
91
|
+
boostRate: Math.random() * 15,
|
|
92
|
+
bodyId: Math.floor(Math.random() * 10).toString(),
|
|
93
|
+
}),
|
|
94
|
+
Math.random() * 2000,
|
|
95
|
+
),
|
|
96
|
+
);
|
|
97
|
+
}
|
|
56
98
|
}
|
package/src/modules/lge/types.ts
CHANGED
|
@@ -5,3 +5,14 @@ export {
|
|
|
5
5
|
GetLGEBoostRateResult,
|
|
6
6
|
XPEntity,
|
|
7
7
|
} 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 };
|
|
@@ -2,31 +2,57 @@ 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
|
|
5
|
+
private getExtraBoostTwitterApiURI: string;
|
|
6
|
+
private getLockGameBoostTwitterApiURI: string;
|
|
7
|
+
private getShareReferralTwitterApiURI: string;
|
|
8
|
+
|
|
6
9
|
private twitterClientId: string;
|
|
7
10
|
loggingEnabled: boolean = false;
|
|
8
11
|
|
|
9
12
|
constructor(
|
|
10
|
-
|
|
13
|
+
getExtraBoostTwitterApiURI: string,
|
|
14
|
+
getLockGameBoostTwitterApiURI: string,
|
|
15
|
+
getShareReferralTwitterApiURI: string,
|
|
11
16
|
twitterClientId: string,
|
|
12
17
|
loggingEnabled: boolean,
|
|
13
18
|
) {
|
|
14
|
-
this.
|
|
19
|
+
this.getExtraBoostTwitterApiURI = getExtraBoostTwitterApiURI;
|
|
20
|
+
this.getLockGameBoostTwitterApiURI = getLockGameBoostTwitterApiURI;
|
|
21
|
+
this.getShareReferralTwitterApiURI = getShareReferralTwitterApiURI;
|
|
15
22
|
this.twitterClientId = twitterClientId;
|
|
16
23
|
this.loggingEnabled = loggingEnabled;
|
|
17
24
|
}
|
|
18
25
|
|
|
19
|
-
@Logger('TwitterModule.
|
|
20
|
-
|
|
26
|
+
@Logger('TwitterModule.getExtraBoostTwitterLink')
|
|
27
|
+
getExtraBoostTwitterLink(
|
|
28
|
+
params: Pick<GetTwitterOauthUrlParams, 'walletAddress'>,
|
|
29
|
+
): string {
|
|
30
|
+
return getTwitterOauthUrl({
|
|
31
|
+
...params,
|
|
32
|
+
redirectURI: this.getExtraBoostTwitterApiURI,
|
|
33
|
+
twitterClientId: this.twitterClientId,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
@Logger('TwitterModule.getLockGameBoostTwitterLink')
|
|
38
|
+
getLockGameBoostTwitterLink(
|
|
21
39
|
params: Pick<GetTwitterOauthUrlParams, 'walletAddress'>,
|
|
22
40
|
): string {
|
|
23
41
|
return getTwitterOauthUrl({
|
|
24
42
|
...params,
|
|
25
|
-
redirectURI: this.
|
|
43
|
+
redirectURI: this.getLockGameBoostTwitterApiURI,
|
|
26
44
|
twitterClientId: this.twitterClientId,
|
|
27
45
|
});
|
|
28
46
|
}
|
|
29
47
|
|
|
30
|
-
|
|
31
|
-
|
|
48
|
+
@Logger('TwitterModule.getShareReferralTwitterLink')
|
|
49
|
+
getShareReferralTwitterLink(
|
|
50
|
+
params: Pick<GetTwitterOauthUrlParams, 'walletAddress'>,
|
|
51
|
+
): string {
|
|
52
|
+
return getTwitterOauthUrl({
|
|
53
|
+
...params,
|
|
54
|
+
redirectURI: this.getShareReferralTwitterApiURI,
|
|
55
|
+
twitterClientId: this.twitterClientId,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
32
58
|
}
|