@reyaxyz/community-sdk 0.57.42 → 0.58.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/modules/discord/index.js +0 -44
- package/dist/modules/discord/index.js.map +1 -1
- package/dist/modules/discord/types.js.map +1 -1
- package/dist/types/modules/discord/index.d.ts +1 -3
- package/dist/types/modules/discord/index.d.ts.map +1 -1
- package/dist/types/modules/discord/types.d.ts +1 -1
- package/dist/types/modules/discord/types.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/modules/discord/index.ts +0 -41
- package/src/modules/discord/types.ts +0 -4
|
@@ -138,35 +138,6 @@ var DiscordModule = /** @class */ (function (_super) {
|
|
|
138
138
|
});
|
|
139
139
|
});
|
|
140
140
|
};
|
|
141
|
-
DiscordModule.prototype.claimDiscordRank = function (params) {
|
|
142
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
143
|
-
var formData, uri, response, error_4;
|
|
144
|
-
return __generator(this, function (_a) {
|
|
145
|
-
switch (_a.label) {
|
|
146
|
-
case 0:
|
|
147
|
-
formData = new FormData();
|
|
148
|
-
formData.append('address', params.address);
|
|
149
|
-
formData.append('discordAccessToken', params.discordAccessToken);
|
|
150
|
-
uri = "/api/discord/claim-rank";
|
|
151
|
-
_a.label = 1;
|
|
152
|
-
case 1:
|
|
153
|
-
_a.trys.push([1, 3, , 4]);
|
|
154
|
-
return [4 /*yield*/, this.post(uri, undefined, formData, undefined)];
|
|
155
|
-
case 2:
|
|
156
|
-
response = _a.sent();
|
|
157
|
-
return [2 /*return*/, response];
|
|
158
|
-
case 3:
|
|
159
|
-
error_4 = _a.sent();
|
|
160
|
-
if (isApiErrorResponse(error_4)) {
|
|
161
|
-
throw new Error(error_4.response.data.error ||
|
|
162
|
-
'An error occurred while claiming Discord rank');
|
|
163
|
-
}
|
|
164
|
-
throw new Error('An unknown error occurred while claiming Discord rank');
|
|
165
|
-
case 4: return [2 /*return*/];
|
|
166
|
-
}
|
|
167
|
-
});
|
|
168
|
-
});
|
|
169
|
-
};
|
|
170
141
|
DiscordModule.prototype.isDiscordLinked = function (params) {
|
|
171
142
|
return __awaiter(this, void 0, void 0, function () {
|
|
172
143
|
var uri;
|
|
@@ -176,30 +147,15 @@ var DiscordModule = /** @class */ (function (_super) {
|
|
|
176
147
|
});
|
|
177
148
|
});
|
|
178
149
|
};
|
|
179
|
-
DiscordModule.prototype.isDiscordRankClaimed = function (params) {
|
|
180
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
181
|
-
var uri;
|
|
182
|
-
return __generator(this, function (_a) {
|
|
183
|
-
uri = "/api/discord/is-rank-claimed/".concat(params.address);
|
|
184
|
-
return [2 /*return*/, this.get(uri)];
|
|
185
|
-
});
|
|
186
|
-
});
|
|
187
|
-
};
|
|
188
150
|
__decorate([
|
|
189
151
|
(0, common_1.Logger)('DiscordModule.linkDiscord')
|
|
190
152
|
], DiscordModule.prototype, "linkDiscord", null);
|
|
191
153
|
__decorate([
|
|
192
154
|
(0, common_1.Logger)('DiscordModule.unlinkDiscord')
|
|
193
155
|
], DiscordModule.prototype, "unlinkDiscord", null);
|
|
194
|
-
__decorate([
|
|
195
|
-
(0, common_1.Logger)('DiscordModule.claimDiscordRank')
|
|
196
|
-
], DiscordModule.prototype, "claimDiscordRank", null);
|
|
197
156
|
__decorate([
|
|
198
157
|
(0, common_1.Logger)('DiscordModule.isDiscordLinked')
|
|
199
158
|
], DiscordModule.prototype, "isDiscordLinked", null);
|
|
200
|
-
__decorate([
|
|
201
|
-
(0, common_1.Logger)('DiscordModule.isDiscordRankClaimed')
|
|
202
|
-
], DiscordModule.prototype, "isDiscordRankClaimed", null);
|
|
203
159
|
return DiscordModule;
|
|
204
160
|
}(common_1.RestClient));
|
|
205
161
|
exports.default = DiscordModule;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/discord/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;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kBAAkB,CAAC,KAAU;IACpC,OAAO,CACL,KAAK;QACL,KAAK,CAAC,QAAQ;QACd,OAAO,KAAK,CAAC,QAAQ,CAAC,MAAM,KAAK,QAAQ;QACzC,KAAK,CAAC,QAAQ,CAAC,IAAI;QACnB,OAAO,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,KAAK,QAAQ,CAC9C,CAAC;AACJ,CAAC","sourcesContent":["import { Address, Loggable, Logger, RestClient } from '@reyaxyz/common';\nimport {\n IsDiscordLinkedResult,\n IsDiscordLinkedParams,\n LinkDiscordParams,\n LinkDiscordResult,\n UnlinkDiscordParams,\n UnlinkDiscordResult,\n ApiErrorResponse,\n} from './types';\nexport default class DiscordModule 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('DiscordModule.linkDiscord')\n async linkDiscord(params: LinkDiscordParams): Promise<LinkDiscordResult> {\n const signerAddress = (\n await params.signer.getAddress()\n ).toLowerCase() as Address;\n\n let signature;\n try {\n signature = await params.signer.signMessage(signerAddress);\n } catch (error) {\n throw new Error('Error signing message');\n }\n\n const formData = new FormData();\n formData.append('address', signerAddress);\n formData.append('signature', signature);\n formData.append('discordAccessToken', params.discordAccessToken);\n\n const uri = `/api/discord/link`;\n try {\n const response = await this.post<LinkDiscordResult>(\n uri,\n undefined,\n formData,\n undefined,\n );\n return response;\n } catch (error) {\n if (isApiErrorResponse(error)) {\n throw new Error(\n error.response.data.error ||\n 'An error occurred while linking Discord',\n );\n }\n throw new Error('An unknown error occurred while linking Discord');\n }\n }\n\n @Logger('DiscordModule.unlinkDiscord')\n async unlinkDiscord(\n params: UnlinkDiscordParams,\n ): Promise<UnlinkDiscordResult> {\n const formData = new FormData();\n formData.append('address', params.address);\n formData.append('discordAccessToken', params.discordAccessToken);\n\n const uri = `/api/discord/unlink`;\n try {\n const response = await this.delete<UnlinkDiscordResult>(\n uri,\n undefined,\n formData,\n undefined,\n );\n return response;\n } catch (error) {\n if (isApiErrorResponse(error)) {\n throw new Error(\n error.response.data.error ||\n 'An error occurred while unlinking Discord',\n );\n }\n throw new Error('An unknown error occurred while unlinking Discord');\n }\n }\n\n @Logger('DiscordModule.isDiscordLinked')\n async isDiscordLinked(\n params: IsDiscordLinkedParams,\n ): Promise<IsDiscordLinkedResult> {\n const uri = `/api/discord/is-linked/${params.address}`;\n return this.get<IsDiscordLinkedResult>(uri);\n }\n}\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction isApiErrorResponse(error: any): error is ApiErrorResponse {\n return (\n error &&\n error.response &&\n typeof error.response.status === 'number' &&\n error.response.data &&\n typeof error.response.data.error === 'string'\n );\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"/","sources":["modules/discord/types.ts"],"names":[],"mappings":"","sourcesContent":["export {\n IsDiscordLinkedParams,\n IsDiscordLinkedResult,\n LinkDiscordParams,\n LinkDiscordResult,\n UnlinkDiscordParams,\n UnlinkDiscordResult,\n
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"/","sources":["modules/discord/types.ts"],"names":[],"mappings":"","sourcesContent":["export {\n IsDiscordLinkedParams,\n IsDiscordLinkedResult,\n LinkDiscordParams,\n LinkDiscordResult,\n UnlinkDiscordParams,\n UnlinkDiscordResult,\n ApiErrorResponse,\n} from '@reyaxyz/common';\n"]}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { Loggable, RestClient } from '@reyaxyz/common';
|
|
2
|
-
import { IsDiscordLinkedResult, IsDiscordLinkedParams, LinkDiscordParams, LinkDiscordResult, UnlinkDiscordParams, UnlinkDiscordResult
|
|
2
|
+
import { IsDiscordLinkedResult, IsDiscordLinkedParams, LinkDiscordParams, LinkDiscordResult, UnlinkDiscordParams, UnlinkDiscordResult } from './types';
|
|
3
3
|
export default class DiscordModule extends RestClient implements Loggable {
|
|
4
4
|
loggingEnabled: boolean;
|
|
5
5
|
constructor(apiUrl: string, loggingEnabled: boolean);
|
|
6
6
|
linkDiscord(params: LinkDiscordParams): Promise<LinkDiscordResult>;
|
|
7
7
|
unlinkDiscord(params: UnlinkDiscordParams): Promise<UnlinkDiscordResult>;
|
|
8
|
-
claimDiscordRank(params: ClaimDiscordRankParams): Promise<ClaimDiscordRankResult>;
|
|
9
8
|
isDiscordLinked(params: IsDiscordLinkedParams): Promise<IsDiscordLinkedResult>;
|
|
10
|
-
isDiscordRankClaimed(params: IsDiscordRankClaimedParams): Promise<IsDiscordRankClaimedResult>;
|
|
11
9
|
}
|
|
12
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/discord/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,QAAQ,EAAU,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/discord/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAW,QAAQ,EAAU,UAAU,EAAE,MAAM,iBAAiB,CAAC;AACxE,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EAEpB,MAAM,SAAS,CAAC;AACjB,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,UAAW,YAAW,QAAQ;IACvE,cAAc,EAAE,OAAO,CAAS;gBAEpB,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO;IAM7C,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAsClE,aAAa,CACjB,MAAM,EAAE,mBAAmB,GAC1B,OAAO,CAAC,mBAAmB,CAAC;IA0BzB,eAAe,CACnB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;CAIlC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { IsDiscordLinkedParams, IsDiscordLinkedResult, LinkDiscordParams, LinkDiscordResult, UnlinkDiscordParams, UnlinkDiscordResult,
|
|
1
|
+
export { IsDiscordLinkedParams, IsDiscordLinkedResult, LinkDiscordParams, LinkDiscordResult, UnlinkDiscordParams, UnlinkDiscordResult, ApiErrorResponse, } from '@reyaxyz/common';
|
|
2
2
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["modules/discord/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["modules/discord/types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reyaxyz/community-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.58.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.149.
|
|
13
|
+
"@reyaxyz/common": "0.357.0",
|
|
14
|
+
"@reyaxyz/sdk": "0.149.17",
|
|
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.3.1",
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "d32f44a84929e334dbac8a29ec7950a13d520a3e"
|
|
42
42
|
}
|
|
@@ -6,10 +6,6 @@ import {
|
|
|
6
6
|
LinkDiscordResult,
|
|
7
7
|
UnlinkDiscordParams,
|
|
8
8
|
UnlinkDiscordResult,
|
|
9
|
-
ClaimDiscordRankParams,
|
|
10
|
-
ClaimDiscordRankResult,
|
|
11
|
-
IsDiscordRankClaimedParams,
|
|
12
|
-
IsDiscordRankClaimedResult,
|
|
13
9
|
ApiErrorResponse,
|
|
14
10
|
} from './types';
|
|
15
11
|
export default class DiscordModule extends RestClient implements Loggable {
|
|
@@ -86,35 +82,6 @@ export default class DiscordModule extends RestClient implements Loggable {
|
|
|
86
82
|
}
|
|
87
83
|
}
|
|
88
84
|
|
|
89
|
-
@Logger('DiscordModule.claimDiscordRank')
|
|
90
|
-
async claimDiscordRank(
|
|
91
|
-
params: ClaimDiscordRankParams,
|
|
92
|
-
): Promise<ClaimDiscordRankResult> {
|
|
93
|
-
const formData = new FormData();
|
|
94
|
-
formData.append('address', params.address);
|
|
95
|
-
formData.append('discordAccessToken', params.discordAccessToken);
|
|
96
|
-
|
|
97
|
-
const uri = `/api/discord/claim-rank`;
|
|
98
|
-
|
|
99
|
-
try {
|
|
100
|
-
const response = await this.post<ClaimDiscordRankResult>(
|
|
101
|
-
uri,
|
|
102
|
-
undefined,
|
|
103
|
-
formData,
|
|
104
|
-
undefined,
|
|
105
|
-
);
|
|
106
|
-
return response;
|
|
107
|
-
} catch (error) {
|
|
108
|
-
if (isApiErrorResponse(error)) {
|
|
109
|
-
throw new Error(
|
|
110
|
-
error.response.data.error ||
|
|
111
|
-
'An error occurred while claiming Discord rank',
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
throw new Error('An unknown error occurred while claiming Discord rank');
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
85
|
@Logger('DiscordModule.isDiscordLinked')
|
|
119
86
|
async isDiscordLinked(
|
|
120
87
|
params: IsDiscordLinkedParams,
|
|
@@ -122,14 +89,6 @@ export default class DiscordModule extends RestClient implements Loggable {
|
|
|
122
89
|
const uri = `/api/discord/is-linked/${params.address}`;
|
|
123
90
|
return this.get<IsDiscordLinkedResult>(uri);
|
|
124
91
|
}
|
|
125
|
-
|
|
126
|
-
@Logger('DiscordModule.isDiscordRankClaimed')
|
|
127
|
-
async isDiscordRankClaimed(
|
|
128
|
-
params: IsDiscordRankClaimedParams,
|
|
129
|
-
): Promise<IsDiscordRankClaimedResult> {
|
|
130
|
-
const uri = `/api/discord/is-rank-claimed/${params.address}`;
|
|
131
|
-
return this.get<IsDiscordRankClaimedResult>(uri);
|
|
132
|
-
}
|
|
133
92
|
}
|
|
134
93
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
135
94
|
function isApiErrorResponse(error: any): error is ApiErrorResponse {
|