@reyaxyz/community-sdk 0.2.12 → 0.3.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.
Files changed (41) hide show
  1. package/dist/client/constants.js +17 -2
  2. package/dist/client/constants.js.map +1 -1
  3. package/dist/client/index.js +16 -0
  4. package/dist/client/index.js.map +1 -1
  5. package/dist/index.js +1 -0
  6. package/dist/index.js.map +1 -1
  7. package/dist/modules/index.js +1 -0
  8. package/dist/modules/index.js.map +1 -1
  9. package/dist/modules/twitter/index.js +26 -0
  10. package/dist/modules/twitter/index.js.map +1 -0
  11. package/dist/modules/twitter/services/get-auth-url/index.js +20 -0
  12. package/dist/modules/twitter/services/get-auth-url/index.js.map +1 -0
  13. package/dist/modules/twitter/services/get-auth-url/types.js +3 -0
  14. package/dist/modules/twitter/services/get-auth-url/types.js.map +1 -0
  15. package/dist/modules/twitter/services/index.js +19 -0
  16. package/dist/modules/twitter/services/index.js.map +1 -0
  17. package/dist/types/client/constants.d.ts +4 -0
  18. package/dist/types/client/constants.d.ts.map +1 -1
  19. package/dist/types/client/index.d.ts +10 -0
  20. package/dist/types/client/index.d.ts.map +1 -1
  21. package/dist/types/index.d.ts +1 -0
  22. package/dist/types/index.d.ts.map +1 -1
  23. package/dist/types/modules/index.d.ts +1 -0
  24. package/dist/types/modules/index.d.ts.map +1 -1
  25. package/dist/types/modules/twitter/index.d.ts +8 -0
  26. package/dist/types/modules/twitter/index.d.ts.map +1 -0
  27. package/dist/types/modules/twitter/services/get-auth-url/index.d.ts +3 -0
  28. package/dist/types/modules/twitter/services/get-auth-url/index.d.ts.map +1 -0
  29. package/dist/types/modules/twitter/services/get-auth-url/types.d.ts +6 -0
  30. package/dist/types/modules/twitter/services/get-auth-url/types.d.ts.map +1 -0
  31. package/dist/types/modules/twitter/services/index.d.ts +3 -0
  32. package/dist/types/modules/twitter/services/index.d.ts.map +1 -0
  33. package/package.json +2 -2
  34. package/src/client/constants.ts +21 -2
  35. package/src/client/index.ts +17 -0
  36. package/src/index.ts +1 -0
  37. package/src/modules/index.ts +1 -0
  38. package/src/modules/twitter/index.ts +21 -0
  39. package/src/modules/twitter/services/get-auth-url/index.ts +21 -0
  40. package/src/modules/twitter/services/get-auth-url/types.ts +5 -0
  41. package/src/modules/twitter/services/index.ts +2 -0
@@ -3,7 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SERVICE_CONFIG = void 0;
4
4
  var common_1 = require("@reyaxyz/common");
5
5
  exports.SERVICE_CONFIG = {
6
- production: { environment: 'production', chainId: common_1.ReyaChainId.reyaNetwork },
7
- test: { environment: 'test', chainId: common_1.ReyaChainId.reyaCronos },
6
+ production: {
7
+ environment: 'production',
8
+ chainId: common_1.ReyaChainId.reyaNetwork,
9
+ // todo: populate
10
+ twitter: {
11
+ clientId: '',
12
+ redirectURI: '',
13
+ },
14
+ },
15
+ test: {
16
+ environment: 'test',
17
+ chainId: common_1.ReyaChainId.reyaCronos,
18
+ twitter: {
19
+ clientId: '',
20
+ redirectURI: '',
21
+ },
22
+ },
8
23
  };
9
24
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"/","sources":["client/constants.ts"],"names":[],"mappings":";;;AAAA,0CAA8C;AASjC,QAAA,cAAc,GAA8C;IACvE,UAAU,EAAE,EAAE,WAAW,EAAE,YAAY,EAAE,OAAO,EAAE,oBAAW,CAAC,WAAW,EAAE;IAC3E,IAAI,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAW,CAAC,UAAU,EAAE;CAC/D,CAAC","sourcesContent":["import { ReyaChainId } from '@reyaxyz/common';\n\nexport type ServiceEnvironment = 'production' | 'test';\n\nexport type ServiceConfig = {\n chainId: ReyaChainId;\n environment: ServiceEnvironment;\n};\n\nexport const SERVICE_CONFIG: Record<ServiceEnvironment, ServiceConfig> = {\n production: { environment: 'production', chainId: ReyaChainId.reyaNetwork },\n test: { environment: 'test', chainId: ReyaChainId.reyaCronos },\n};\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"/","sources":["client/constants.ts"],"names":[],"mappings":";;;AAAA,0CAA8C;AAajC,QAAA,cAAc,GAA8C;IACvE,UAAU,EAAE;QACV,WAAW,EAAE,YAAY;QACzB,OAAO,EAAE,oBAAW,CAAC,WAAW;QAChC,iBAAiB;QACjB,OAAO,EAAE;YACP,QAAQ,EAAE,EAAE;YACZ,WAAW,EAAE,EAAE;SAChB;KACF;IACD,IAAI,EAAE;QACJ,WAAW,EAAE,MAAM;QACnB,OAAO,EAAE,oBAAW,CAAC,UAAU;QAC/B,OAAO,EAAE;YACP,QAAQ,EAAE,EAAE;YACZ,WAAW,EAAE,EAAE;SAChB;KACF;CACF,CAAC","sourcesContent":["import { ReyaChainId } from '@reyaxyz/common';\n\nexport type ServiceEnvironment = 'production' | 'test';\n\nexport type ServiceConfig = {\n chainId: ReyaChainId;\n twitter: {\n clientId: string;\n redirectURI: string;\n };\n environment: ServiceEnvironment;\n};\n\nexport const SERVICE_CONFIG: Record<ServiceEnvironment, ServiceConfig> = {\n production: {\n environment: 'production',\n chainId: ReyaChainId.reyaNetwork,\n // todo: populate\n twitter: {\n clientId: '',\n redirectURI: '',\n },\n },\n test: {\n environment: 'test',\n chainId: ReyaChainId.reyaCronos,\n twitter: {\n clientId: '',\n redirectURI: '',\n },\n },\n};\n"]}
@@ -7,6 +7,7 @@ exports.CommunityClient = void 0;
7
7
  var constants_1 = require("./constants");
8
8
  var vote_1 = __importDefault(require("../modules/vote"));
9
9
  var lge_1 = __importDefault(require("../modules/lge"));
10
+ var twitter_1 = __importDefault(require("../modules/twitter"));
10
11
  /**
11
12
  * @description Client for Community SDK
12
13
  */
@@ -15,6 +16,7 @@ var CommunityClient = /** @class */ (function () {
15
16
  CommunityClient.config = constants_1.SERVICE_CONFIG[params.environment];
16
17
  this._vote = new vote_1.default(CommunityClient.config.chainId);
17
18
  this._LGE = new lge_1.default(CommunityClient.config.chainId);
19
+ this._twitter = new twitter_1.default(CommunityClient.config.twitter.redirectURI, CommunityClient.config.twitter.clientId);
18
20
  }
19
21
  CommunityClient.configure = function (params) {
20
22
  if (!params.environment ||
@@ -57,6 +59,20 @@ var CommunityClient = /** @class */ (function () {
57
59
  enumerable: false,
58
60
  configurable: true
59
61
  });
62
+ Object.defineProperty(CommunityClient, "twitter", {
63
+ /**
64
+ * Provides access to the TwitterModule instance.
65
+ * This getter allows for interacting with twitter-related functionalities.
66
+ *
67
+ * @returns {TwitterModule} An instance of Twitter for twitter operations.
68
+ * @memberof CommunityClient
69
+ */
70
+ get: function () {
71
+ return CommunityClient.getInstance()._twitter;
72
+ },
73
+ enumerable: false,
74
+ configurable: true
75
+ });
60
76
  Object.defineProperty(CommunityClient, "supportedChain", {
61
77
  get: function () {
62
78
  return CommunityClient.config.chainId;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["client/index.ts"],"names":[],"mappings":";;;;;;AAAA,yCAA4D;AAC5D,yDAAyC;AACzC,uDAAuC;AAMvC;;GAEG;AACH;IAME,yBAAoB,MAAuB;QACzC,eAAe,CAAC,MAAM,GAAG,0BAAc,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QAC5D,IAAI,CAAC,KAAK,GAAG,IAAI,cAAU,CAAC,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC5D,IAAI,CAAC,IAAI,GAAG,IAAI,aAAS,CAAC,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC5D,CAAC;IAEa,yBAAS,GAAvB,UAAwB,MAAuB;QAC7C,IACE,CAAC,MAAM,CAAC,WAAW;YACnB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EACzD,CAAC;YACD,MAAM,IAAI,KAAK,CACb,0FAA0F,CAC3F,CAAC;QACJ,CAAC;QACD,eAAe,CAAC,QAAQ,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC;IACzD,CAAC;IAEc,2BAAW,GAA1B;QACE,IAAI,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CACb,6DAA6D,CAC9D,CAAC;QACJ,CAAC;QACD,OAAO,eAAe,CAAC,QAAQ,CAAC;IAClC,CAAC;IASD,sBAAkB,uBAAI;QAPtB;;;;;;WAMG;aACH;YACE,OAAO,eAAe,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC;QAC7C,CAAC;;;OAAA;IASD,sBAAkB,sBAAG;QAPrB;;;;;;WAMG;aACH;YACE,OAAO,eAAe,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC;QAC5C,CAAC;;;OAAA;IAED,sBAAkB,iCAAc;aAAhC;YACE,OAAO,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC;QACxC,CAAC;;;OAAA;IAvDc,sBAAM,GAAkB,0BAAc,CAAC,MAAM,CAAC,CAAC;IAwDhE,sBAAC;CAAA,AA1DD,IA0DC;AA1DY,0CAAe","sourcesContent":["import { SERVICE_CONFIG, ServiceConfig } from './constants';\nimport VoteModule from '../modules/vote';\nimport LGEModule from '../modules/lge';\n\nexport type ConfigureParams = {\n environment: ServiceConfig['environment'];\n};\n\n/**\n * @description Client for Community SDK\n */\nexport class CommunityClient {\n private static instance: CommunityClient;\n private static config: ServiceConfig = SERVICE_CONFIG['test'];\n private readonly _vote: VoteModule;\n private readonly _LGE: LGEModule;\n\n private constructor(params: ConfigureParams) {\n CommunityClient.config = SERVICE_CONFIG[params.environment];\n this._vote = new VoteModule(CommunityClient.config.chainId);\n this._LGE = new LGEModule(CommunityClient.config.chainId);\n }\n\n public static configure(params: ConfigureParams): void {\n if (\n !params.environment ||\n ['test', 'production'].indexOf(params.environment) === -1\n ) {\n throw new Error(\n 'Client environment is incorrect or not provided. Consult the docs about ConfigureParams.',\n );\n }\n CommunityClient.instance = new CommunityClient(params);\n }\n\n private static getInstance(): CommunityClient {\n if (!CommunityClient.instance) {\n throw new Error(\n 'Client is not configured. Please configure it before using.',\n );\n }\n return CommunityClient.instance;\n }\n\n /**\n * Provides access to the VoteModule instance.\n * This getter allows for interacting with vote-related functionalities.\n *\n * @returns {VoteModule} An instance of VoteModule for vote operations.\n * @memberof CommunityClient\n */\n public static get vote(): VoteModule {\n return CommunityClient.getInstance()._vote;\n }\n\n /**\n * Provides access to the LGEModule instance.\n * This getter allows for interacting with LGE-related functionalities.\n *\n * @returns {LGEModule} An instance of LGEModule for LGE operations.\n * @memberof CommunityClient\n */\n public static get LGE(): LGEModule {\n return CommunityClient.getInstance()._LGE;\n }\n\n public static get supportedChain(): number {\n return CommunityClient.config.chainId;\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["client/index.ts"],"names":[],"mappings":";;;;;;AAAA,yCAA4D;AAC5D,yDAAyC;AACzC,uDAAuC;AACvC,+DAA+C;AAM/C;;GAEG;AACH;IAOE,yBAAoB,MAAuB;QACzC,eAAe,CAAC,MAAM,GAAG,0BAAc,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QAC5D,IAAI,CAAC,KAAK,GAAG,IAAI,cAAU,CAAC,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC5D,IAAI,CAAC,IAAI,GAAG,IAAI,aAAS,CAAC,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;QAC1D,IAAI,CAAC,QAAQ,GAAG,IAAI,iBAAa,CAC/B,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,EAC1C,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CACxC,CAAC;IACJ,CAAC;IAEa,yBAAS,GAAvB,UAAwB,MAAuB;QAC7C,IACE,CAAC,MAAM,CAAC,WAAW;YACnB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,EACzD,CAAC;YACD,MAAM,IAAI,KAAK,CACb,0FAA0F,CAC3F,CAAC;QACJ,CAAC;QACD,eAAe,CAAC,QAAQ,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC;IACzD,CAAC;IAEc,2BAAW,GAA1B;QACE,IAAI,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC;YAC9B,MAAM,IAAI,KAAK,CACb,6DAA6D,CAC9D,CAAC;QACJ,CAAC;QACD,OAAO,eAAe,CAAC,QAAQ,CAAC;IAClC,CAAC;IASD,sBAAkB,uBAAI;QAPtB;;;;;;WAMG;aACH;YACE,OAAO,eAAe,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC;QAC7C,CAAC;;;OAAA;IASD,sBAAkB,sBAAG;QAPrB;;;;;;WAMG;aACH;YACE,OAAO,eAAe,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC;QAC5C,CAAC;;;OAAA;IASD,sBAAkB,0BAAO;QAPzB;;;;;;WAMG;aACH;YACE,OAAO,eAAe,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC;QAChD,CAAC;;;OAAA;IAED,sBAAkB,iCAAc;aAAhC;YACE,OAAO,eAAe,CAAC,MAAM,CAAC,OAAO,CAAC;QACxC,CAAC;;;OAAA;IAvEc,sBAAM,GAAkB,0BAAc,CAAC,MAAM,CAAC,CAAC;IAwEhE,sBAAC;CAAA,AA1ED,IA0EC;AA1EY,0CAAe","sourcesContent":["import { SERVICE_CONFIG, ServiceConfig } from './constants';\nimport VoteModule from '../modules/vote';\nimport LGEModule from '../modules/lge';\nimport TwitterModule from '../modules/twitter';\n\nexport type ConfigureParams = {\n environment: ServiceConfig['environment'];\n};\n\n/**\n * @description Client for Community SDK\n */\nexport class CommunityClient {\n private static instance: CommunityClient;\n private static config: ServiceConfig = SERVICE_CONFIG['test'];\n private readonly _vote: VoteModule;\n private readonly _LGE: LGEModule;\n private readonly _twitter: TwitterModule;\n\n private constructor(params: ConfigureParams) {\n CommunityClient.config = SERVICE_CONFIG[params.environment];\n this._vote = new VoteModule(CommunityClient.config.chainId);\n this._LGE = new LGEModule(CommunityClient.config.chainId);\n this._twitter = new TwitterModule(\n CommunityClient.config.twitter.redirectURI,\n CommunityClient.config.twitter.clientId,\n );\n }\n\n public static configure(params: ConfigureParams): void {\n if (\n !params.environment ||\n ['test', 'production'].indexOf(params.environment) === -1\n ) {\n throw new Error(\n 'Client environment is incorrect or not provided. Consult the docs about ConfigureParams.',\n );\n }\n CommunityClient.instance = new CommunityClient(params);\n }\n\n private static getInstance(): CommunityClient {\n if (!CommunityClient.instance) {\n throw new Error(\n 'Client is not configured. Please configure it before using.',\n );\n }\n return CommunityClient.instance;\n }\n\n /**\n * Provides access to the VoteModule instance.\n * This getter allows for interacting with vote-related functionalities.\n *\n * @returns {VoteModule} An instance of VoteModule for vote operations.\n * @memberof CommunityClient\n */\n public static get vote(): VoteModule {\n return CommunityClient.getInstance()._vote;\n }\n\n /**\n * Provides access to the LGEModule instance.\n * This getter allows for interacting with LGE-related functionalities.\n *\n * @returns {LGEModule} An instance of LGEModule for LGE operations.\n * @memberof CommunityClient\n */\n public static get LGE(): LGEModule {\n return CommunityClient.getInstance()._LGE;\n }\n\n /**\n * Provides access to the TwitterModule instance.\n * This getter allows for interacting with twitter-related functionalities.\n *\n * @returns {TwitterModule} An instance of Twitter for twitter operations.\n * @memberof CommunityClient\n */\n public static get twitter(): TwitterModule {\n return CommunityClient.getInstance()._twitter;\n }\n\n public static get supportedChain(): number {\n return CommunityClient.config.chainId;\n }\n}\n"]}
package/dist/index.js CHANGED
@@ -21,4 +21,5 @@ __exportStar(require("./modules/vote/services/get-vote-status/types"), exports);
21
21
  __exportStar(require("./modules/vote/services/vote/types"), exports);
22
22
  __exportStar(require("./modules/lge/services/get-account-lge-status/types"), exports);
23
23
  __exportStar(require("./modules/lge/services/get-lge-boost-rate/types"), exports);
24
+ __exportStar(require("./modules/twitter/services/get-auth-url/types"), exports);
24
25
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,2CAAyB;AACzB,iFAA+D;AAC/D,gFAA8D;AAC9D,qEAAmD;AACnD,sFAAoE;AACpE,kFAAgE","sourcesContent":["export * from './types';\nexport * from './client';\nexport * from './modules/vote/services/get-vote-details/types';\nexport * from './modules/vote/services/get-vote-status/types';\nexport * from './modules/vote/services/vote/types';\nexport * from './modules/lge/services/get-account-lge-status/types';\nexport * from './modules/lge/services/get-lge-boost-rate/types';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,2CAAyB;AACzB,iFAA+D;AAC/D,gFAA8D;AAC9D,qEAAmD;AACnD,sFAAoE;AACpE,kFAAgE;AAChE,gFAA8D","sourcesContent":["export * from './types';\nexport * from './client';\nexport * from './modules/vote/services/get-vote-details/types';\nexport * from './modules/vote/services/get-vote-status/types';\nexport * from './modules/vote/services/vote/types';\nexport * from './modules/lge/services/get-account-lge-status/types';\nexport * from './modules/lge/services/get-lge-boost-rate/types';\nexport * from './modules/twitter/services/get-auth-url/types';\n"]}
@@ -16,4 +16,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./vote"), exports);
18
18
  __exportStar(require("./lge"), exports);
19
+ __exportStar(require("./twitter"), exports);
19
20
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,wCAAsB","sourcesContent":["export * from './vote';\nexport * from './lge';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,wCAAsB;AACtB,4CAA0B","sourcesContent":["export * from './vote';\nexport * from './lge';\nexport * from './twitter';\n"]}
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ var services_1 = require("./services");
15
+ var TwitterModule = /** @class */ (function () {
16
+ function TwitterModule(redirectURI, twitterClientId) {
17
+ this.redirectURI = redirectURI;
18
+ this.twitterClientId = twitterClientId;
19
+ }
20
+ TwitterModule.prototype.getTwitterOauthUrl = function (params) {
21
+ return (0, services_1.getTwitterOauthUrl)(__assign(__assign({}, params), { redirectURI: this.redirectURI, twitterClientId: this.twitterClientId }));
22
+ };
23
+ return TwitterModule;
24
+ }());
25
+ exports.default = TwitterModule;
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/twitter/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,uCAA0E;AAE1E;IAIE,uBAAY,WAAmB,EAAE,eAAuB;QACtD,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,eAAe,GAAG,eAAe,CAAC;IACzC,CAAC;IAED,0CAAkB,GAAlB,UACE,MAAuD;QAEvD,OAAO,IAAA,6BAAkB,wBACpB,MAAM,KACT,WAAW,EAAE,IAAI,CAAC,WAAW,EAC7B,eAAe,EAAE,IAAI,CAAC,eAAe,IACrC,CAAC;IACL,CAAC;IACH,oBAAC;AAAD,CAAC,AAlBD,IAkBC","sourcesContent":["import { getTwitterOauthUrl, GetTwitterOauthUrlParams } from './services';\n\nexport default class TwitterModule {\n private redirectURI: string;\n private twitterClientId: string;\n\n constructor(redirectURI: string, twitterClientId: string) {\n this.redirectURI = redirectURI;\n this.twitterClientId = twitterClientId;\n }\n\n getTwitterOauthUrl(\n params: Pick<GetTwitterOauthUrlParams, 'walletAddress'>,\n ): string {\n return getTwitterOauthUrl({\n ...params,\n redirectURI: this.redirectURI,\n twitterClientId: this.twitterClientId,\n });\n }\n}\n"]}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTwitterOauthUrl = void 0;
4
+ var rootUrl = 'https://twitter.com/i/oauth2/authorize';
5
+ function getTwitterOauthUrl(_a) {
6
+ var walletAddress = _a.walletAddress, twitterClientId = _a.twitterClientId, redirectURI = _a.redirectURI;
7
+ var options = {
8
+ redirect_uri: redirectURI,
9
+ client_id: twitterClientId,
10
+ state: JSON.stringify({ walletAddress: walletAddress }),
11
+ response_type: 'code',
12
+ code_challenge: 'challenge',
13
+ code_challenge_method: 'plain',
14
+ scope: ['users.read', 'tweet.write'].join(' '),
15
+ };
16
+ var qs = new URLSearchParams(options).toString();
17
+ return "".concat(rootUrl, "?").concat(qs);
18
+ }
19
+ exports.getTwitterOauthUrl = getTwitterOauthUrl;
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/twitter/services/get-auth-url/index.ts"],"names":[],"mappings":";;;AAEA,IAAM,OAAO,GAAW,wCAAwC,CAAC;AAEjE,SAAgB,kBAAkB,CAAC,EAIR;QAHzB,aAAa,mBAAA,EACb,eAAe,qBAAA,EACf,WAAW,iBAAA;IAEX,IAAM,OAAO,GAAG;QACd,YAAY,EAAE,WAAW;QACzB,SAAS,EAAE,eAAe;QAC1B,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,aAAa,eAAA,EAAE,CAAC;QACxC,aAAa,EAAE,MAAM;QACrB,cAAc,EAAE,WAAW;QAC3B,qBAAqB,EAAE,OAAO;QAC9B,KAAK,EAAE,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;KAC/C,CAAC;IACF,IAAM,EAAE,GAAG,IAAI,eAAe,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC;IACnD,OAAO,UAAG,OAAO,cAAI,EAAE,CAAE,CAAC;AAC5B,CAAC;AAhBD,gDAgBC","sourcesContent":["import { GetTwitterOauthUrlParams } from './types';\n\nconst rootUrl: string = 'https://twitter.com/i/oauth2/authorize';\n\nexport function getTwitterOauthUrl({\n walletAddress,\n twitterClientId,\n redirectURI,\n}: GetTwitterOauthUrlParams): string {\n const options = {\n redirect_uri: redirectURI,\n client_id: twitterClientId,\n state: JSON.stringify({ walletAddress }),\n response_type: 'code',\n code_challenge: 'challenge',\n code_challenge_method: 'plain',\n scope: ['users.read', 'tweet.write'].join(' '),\n };\n const qs = new URLSearchParams(options).toString();\n return `${rootUrl}?${qs}`;\n}\n"]}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"/","sources":["modules/twitter/services/get-auth-url/types.ts"],"names":[],"mappings":"","sourcesContent":["export type GetTwitterOauthUrlParams = {\n walletAddress: string;\n twitterClientId: string;\n redirectURI: string;\n};\n"]}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./get-auth-url"), exports);
18
+ __exportStar(require("./get-auth-url/types"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/twitter/services/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,uDAAqC","sourcesContent":["export * from './get-auth-url';\nexport * from './get-auth-url/types';\n"]}
@@ -2,6 +2,10 @@ import { ReyaChainId } from '@reyaxyz/common';
2
2
  export type ServiceEnvironment = 'production' | 'test';
3
3
  export type ServiceConfig = {
4
4
  chainId: ReyaChainId;
5
+ twitter: {
6
+ clientId: string;
7
+ redirectURI: string;
8
+ };
5
9
  environment: ServiceEnvironment;
6
10
  };
7
11
  export declare const SERVICE_CONFIG: Record<ServiceEnvironment, ServiceConfig>;
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"/","sources":["client/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,MAAM,CAAC;AAEvD,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,WAAW,CAAC;IACrB,WAAW,EAAE,kBAAkB,CAAC;CACjC,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,kBAAkB,EAAE,aAAa,CAGpE,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"/","sources":["client/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,MAAM,CAAC;AAEvD,MAAM,MAAM,aAAa,GAAG;IAC1B,OAAO,EAAE,WAAW,CAAC;IACrB,OAAO,EAAE;QACP,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,WAAW,EAAE,kBAAkB,CAAC;CACjC,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,kBAAkB,EAAE,aAAa,CAkBpE,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { ServiceConfig } from './constants';
2
2
  import VoteModule from '../modules/vote';
3
3
  import LGEModule from '../modules/lge';
4
+ import TwitterModule from '../modules/twitter';
4
5
  export type ConfigureParams = {
5
6
  environment: ServiceConfig['environment'];
6
7
  };
@@ -12,6 +13,7 @@ export declare class CommunityClient {
12
13
  private static config;
13
14
  private readonly _vote;
14
15
  private readonly _LGE;
16
+ private readonly _twitter;
15
17
  private constructor();
16
18
  static configure(params: ConfigureParams): void;
17
19
  private static getInstance;
@@ -31,6 +33,14 @@ export declare class CommunityClient {
31
33
  * @memberof CommunityClient
32
34
  */
33
35
  static get LGE(): LGEModule;
36
+ /**
37
+ * Provides access to the TwitterModule instance.
38
+ * This getter allows for interacting with twitter-related functionalities.
39
+ *
40
+ * @returns {TwitterModule} An instance of Twitter for twitter operations.
41
+ * @memberof CommunityClient
42
+ */
43
+ static get twitter(): TwitterModule;
34
44
  static get supportedChain(): number;
35
45
  }
36
46
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,SAAS,MAAM,gBAAgB,CAAC;AAEvC,MAAM,MAAM,eAAe,GAAG;IAC5B,WAAW,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;CAC3C,CAAC;AAEF;;GAEG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAkB;IACzC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAyC;IAC9D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAa;IACnC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAY;IAEjC,OAAO;WAMO,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI;IAYtD,OAAO,CAAC,MAAM,CAAC,WAAW;IAS1B;;;;;;OAMG;IACH,WAAkB,IAAI,IAAI,UAAU,CAEnC;IAED;;;;;;OAMG;IACH,WAAkB,GAAG,IAAI,SAAS,CAEjC;IAED,WAAkB,cAAc,IAAI,MAAM,CAEzC;CACF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAE/C,MAAM,MAAM,eAAe,GAAG;IAC5B,WAAW,EAAE,aAAa,CAAC,aAAa,CAAC,CAAC;CAC3C,CAAC;AAEF;;GAEG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAkB;IACzC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAyC;IAC9D,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAa;IACnC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAY;IACjC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAgB;IAEzC,OAAO;WAUO,SAAS,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI;IAYtD,OAAO,CAAC,MAAM,CAAC,WAAW;IAS1B;;;;;;OAMG;IACH,WAAkB,IAAI,IAAI,UAAU,CAEnC;IAED;;;;;;OAMG;IACH,WAAkB,GAAG,IAAI,SAAS,CAEjC;IAED;;;;;;OAMG;IACH,WAAkB,OAAO,IAAI,aAAa,CAEzC;IAED,WAAkB,cAAc,IAAI,MAAM,CAEzC;CACF"}
@@ -5,4 +5,5 @@ export * from './modules/vote/services/get-vote-status/types';
5
5
  export * from './modules/vote/services/vote/types';
6
6
  export * from './modules/lge/services/get-account-lge-status/types';
7
7
  export * from './modules/lge/services/get-lge-boost-rate/types';
8
+ export * from './modules/twitter/services/get-auth-url/types';
8
9
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,gDAAgD,CAAC;AAC/D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,oCAAoC,CAAC;AACnD,cAAc,qDAAqD,CAAC;AACpE,cAAc,iDAAiD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,gDAAgD,CAAC;AAC/D,cAAc,+CAA+C,CAAC;AAC9D,cAAc,oCAAoC,CAAC;AACnD,cAAc,qDAAqD,CAAC;AACpE,cAAc,iDAAiD,CAAC;AAChE,cAAc,+CAA+C,CAAC"}
@@ -1,3 +1,4 @@
1
1
  export * from './vote';
2
2
  export * from './lge';
3
+ export * from './twitter';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,WAAW,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { GetTwitterOauthUrlParams } from './services';
2
+ export default class TwitterModule {
3
+ private redirectURI;
4
+ private twitterClientId;
5
+ constructor(redirectURI: string, twitterClientId: string);
6
+ getTwitterOauthUrl(params: Pick<GetTwitterOauthUrlParams, 'walletAddress'>): string;
7
+ }
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/twitter/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAE1E,MAAM,CAAC,OAAO,OAAO,aAAa;IAChC,OAAO,CAAC,WAAW,CAAS;IAC5B,OAAO,CAAC,eAAe,CAAS;gBAEpB,WAAW,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM;IAKxD,kBAAkB,CAChB,MAAM,EAAE,IAAI,CAAC,wBAAwB,EAAE,eAAe,CAAC,GACtD,MAAM;CAOV"}
@@ -0,0 +1,3 @@
1
+ import { GetTwitterOauthUrlParams } from './types';
2
+ export declare function getTwitterOauthUrl({ walletAddress, twitterClientId, redirectURI, }: GetTwitterOauthUrlParams): string;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/twitter/services/get-auth-url/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAInD,wBAAgB,kBAAkB,CAAC,EACjC,aAAa,EACb,eAAe,EACf,WAAW,GACZ,EAAE,wBAAwB,GAAG,MAAM,CAYnC"}
@@ -0,0 +1,6 @@
1
+ export type GetTwitterOauthUrlParams = {
2
+ walletAddress: string;
3
+ twitterClientId: string;
4
+ redirectURI: string;
5
+ };
6
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["modules/twitter/services/get-auth-url/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,wBAAwB,GAAG;IACrC,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export * from './get-auth-url';
2
+ export * from './get-auth-url/types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/twitter/services/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reyaxyz/community-sdk",
3
- "version": "0.2.12",
3
+ "version": "0.3.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -37,5 +37,5 @@
37
37
  "generate:coverage-badges": "npx istanbul-badges-readme --silent"
38
38
  },
39
39
  "packageManager": "pnpm@8.10.4",
40
- "gitHead": "71b07abf9166997526471800a502954a6598a389"
40
+ "gitHead": "176ab2c3ac7cc5b7d5e5bb283768a80779772165"
41
41
  }
@@ -4,10 +4,29 @@ export type ServiceEnvironment = 'production' | 'test';
4
4
 
5
5
  export type ServiceConfig = {
6
6
  chainId: ReyaChainId;
7
+ twitter: {
8
+ clientId: string;
9
+ redirectURI: string;
10
+ };
7
11
  environment: ServiceEnvironment;
8
12
  };
9
13
 
10
14
  export const SERVICE_CONFIG: Record<ServiceEnvironment, ServiceConfig> = {
11
- production: { environment: 'production', chainId: ReyaChainId.reyaNetwork },
12
- test: { environment: 'test', chainId: ReyaChainId.reyaCronos },
15
+ production: {
16
+ environment: 'production',
17
+ chainId: ReyaChainId.reyaNetwork,
18
+ // todo: populate
19
+ twitter: {
20
+ clientId: '',
21
+ redirectURI: '',
22
+ },
23
+ },
24
+ test: {
25
+ environment: 'test',
26
+ chainId: ReyaChainId.reyaCronos,
27
+ twitter: {
28
+ clientId: '',
29
+ redirectURI: '',
30
+ },
31
+ },
13
32
  };
@@ -1,6 +1,7 @@
1
1
  import { SERVICE_CONFIG, ServiceConfig } from './constants';
2
2
  import VoteModule from '../modules/vote';
3
3
  import LGEModule from '../modules/lge';
4
+ import TwitterModule from '../modules/twitter';
4
5
 
5
6
  export type ConfigureParams = {
6
7
  environment: ServiceConfig['environment'];
@@ -14,11 +15,16 @@ export class CommunityClient {
14
15
  private static config: ServiceConfig = SERVICE_CONFIG['test'];
15
16
  private readonly _vote: VoteModule;
16
17
  private readonly _LGE: LGEModule;
18
+ private readonly _twitter: TwitterModule;
17
19
 
18
20
  private constructor(params: ConfigureParams) {
19
21
  CommunityClient.config = SERVICE_CONFIG[params.environment];
20
22
  this._vote = new VoteModule(CommunityClient.config.chainId);
21
23
  this._LGE = new LGEModule(CommunityClient.config.chainId);
24
+ this._twitter = new TwitterModule(
25
+ CommunityClient.config.twitter.redirectURI,
26
+ CommunityClient.config.twitter.clientId,
27
+ );
22
28
  }
23
29
 
24
30
  public static configure(params: ConfigureParams): void {
@@ -64,6 +70,17 @@ export class CommunityClient {
64
70
  return CommunityClient.getInstance()._LGE;
65
71
  }
66
72
 
73
+ /**
74
+ * Provides access to the TwitterModule instance.
75
+ * This getter allows for interacting with twitter-related functionalities.
76
+ *
77
+ * @returns {TwitterModule} An instance of Twitter for twitter operations.
78
+ * @memberof CommunityClient
79
+ */
80
+ public static get twitter(): TwitterModule {
81
+ return CommunityClient.getInstance()._twitter;
82
+ }
83
+
67
84
  public static get supportedChain(): number {
68
85
  return CommunityClient.config.chainId;
69
86
  }
package/src/index.ts CHANGED
@@ -5,3 +5,4 @@ export * from './modules/vote/services/get-vote-status/types';
5
5
  export * from './modules/vote/services/vote/types';
6
6
  export * from './modules/lge/services/get-account-lge-status/types';
7
7
  export * from './modules/lge/services/get-lge-boost-rate/types';
8
+ export * from './modules/twitter/services/get-auth-url/types';
@@ -1,2 +1,3 @@
1
1
  export * from './vote';
2
2
  export * from './lge';
3
+ export * from './twitter';
@@ -0,0 +1,21 @@
1
+ import { getTwitterOauthUrl, GetTwitterOauthUrlParams } from './services';
2
+
3
+ export default class TwitterModule {
4
+ private redirectURI: string;
5
+ private twitterClientId: string;
6
+
7
+ constructor(redirectURI: string, twitterClientId: string) {
8
+ this.redirectURI = redirectURI;
9
+ this.twitterClientId = twitterClientId;
10
+ }
11
+
12
+ getTwitterOauthUrl(
13
+ params: Pick<GetTwitterOauthUrlParams, 'walletAddress'>,
14
+ ): string {
15
+ return getTwitterOauthUrl({
16
+ ...params,
17
+ redirectURI: this.redirectURI,
18
+ twitterClientId: this.twitterClientId,
19
+ });
20
+ }
21
+ }
@@ -0,0 +1,21 @@
1
+ import { GetTwitterOauthUrlParams } from './types';
2
+
3
+ const rootUrl: string = 'https://twitter.com/i/oauth2/authorize';
4
+
5
+ export function getTwitterOauthUrl({
6
+ walletAddress,
7
+ twitterClientId,
8
+ redirectURI,
9
+ }: GetTwitterOauthUrlParams): string {
10
+ const options = {
11
+ redirect_uri: redirectURI,
12
+ client_id: twitterClientId,
13
+ state: JSON.stringify({ walletAddress }),
14
+ response_type: 'code',
15
+ code_challenge: 'challenge',
16
+ code_challenge_method: 'plain',
17
+ scope: ['users.read', 'tweet.write'].join(' '),
18
+ };
19
+ const qs = new URLSearchParams(options).toString();
20
+ return `${rootUrl}?${qs}`;
21
+ }
@@ -0,0 +1,5 @@
1
+ export type GetTwitterOauthUrlParams = {
2
+ walletAddress: string;
3
+ twitterClientId: string;
4
+ redirectURI: string;
5
+ };
@@ -0,0 +1,2 @@
1
+ export * from './get-auth-url';
2
+ export * from './get-auth-url/types';