@reyaxyz/community-sdk 0.57.14 → 0.57.16-perpob.110
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/modules/tge/index.js +0 -12
- package/dist/modules/tge/index.js.map +1 -1
- package/dist/modules/tge/services/sign.js +1 -1
- package/dist/modules/tge/services/sign.js.map +1 -1
- package/dist/modules/tge/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/dist/types/modules/tge/index.d.ts +2 -3
- package/dist/types/modules/tge/index.d.ts.map +1 -1
- package/dist/types/modules/tge/services/sign.d.ts.map +1 -1
- package/dist/types/modules/tge/types.d.ts +2 -8
- package/dist/types/modules/tge/types.d.ts.map +1 -1
- package/dist/types/utils/contractAddresses.d.ts.map +1 -1
- package/dist/utils/contractAddresses.js +17 -4
- package/dist/utils/contractAddresses.js.map +1 -1
- package/package.json +5 -5
- package/src/modules/discord/index.ts +0 -41
- package/src/modules/discord/types.ts +0 -4
- package/src/modules/tge/index.ts +0 -8
- package/src/modules/tge/services/sign.ts +2 -6
- package/src/modules/tge/types.ts +2 -9
- package/src/utils/contractAddresses.ts +11 -3
|
@@ -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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAAwE;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/discord/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAAwE;AAUxE;IAA2C,iCAAU;IAGnD,uBAAY,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,mCAAW,GAAX,UAAY,MAAyB;;;;;4BAEvC,qBAAM,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,EAAA;;wBAD5B,aAAa,GAAG,CACpB,SAAgC,CACjC,CAAC,WAAW,EAAa;;;;wBAIZ,qBAAM,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,EAAA;;wBAA1D,SAAS,GAAG,SAA8C,CAAC;;;;wBAE3D,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC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ACvB,2CAA2C,CAC9C,CAAC;wBACJ,CAAC;wBACD,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;;;;;KAExE;IAGK,uCAAe,GAAf,UACJ,MAA6B;;;;gBAEvB,GAAG,GAAG,iCAA0B,MAAM,CAAC,OAAO,CAAE,CAAC;gBACvD,sBAAO,IAAI,CAAC,GAAG,CAAwB,GAAG,CAAC,EAAC;;;KAC7C;IAvEK;QADL,IAAA,eAAM,EAAC,2BAA2B,CAAC;oDAoCnC;IAGK;QADL,IAAA,eAAM,EAAC,6BAA6B,CAAC;sDA0BrC;IAGK;QADL,IAAA,eAAM,EAAC,+BAA+B,CAAC;wDAMvC;IACH,oBAAC;CAAA,AAjFD,CAA2C,mBAAU,GAiFpD;kBAjFoB,aAAa;AAkFlC,+DAA+D;AAC/D,SAAS,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"]}
|
|
@@ -135,15 +135,6 @@ var TGEModule = /** @class */ (function (_super) {
|
|
|
135
135
|
});
|
|
136
136
|
});
|
|
137
137
|
};
|
|
138
|
-
TGEModule.prototype.unlockTokens = function (params) {
|
|
139
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
140
|
-
var uri;
|
|
141
|
-
return __generator(this, function (_a) {
|
|
142
|
-
uri = "/api/tge/unlock/".concat(params.wallet);
|
|
143
|
-
return [2 /*return*/, this.post(uri, {})];
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
};
|
|
147
138
|
__decorate([
|
|
148
139
|
(0, common_1.Logger)('TGEModule.getReyaChecker')
|
|
149
140
|
], TGEModule.prototype, "getReyaChecker", null);
|
|
@@ -156,9 +147,6 @@ var TGEModule = /** @class */ (function (_super) {
|
|
|
156
147
|
__decorate([
|
|
157
148
|
(0, common_1.Logger)('TGEModule.lockTokens')
|
|
158
149
|
], TGEModule.prototype, "lockTokens", null);
|
|
159
|
-
__decorate([
|
|
160
|
-
(0, common_1.Logger)('TGEModule.unlockTokens')
|
|
161
|
-
], TGEModule.prototype, "unlockTokens", null);
|
|
162
150
|
return TGEModule;
|
|
163
151
|
}(common_1.RestClient));
|
|
164
152
|
exports.default = TGEModule;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/tge/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAA+D;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/tge/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;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EAAE,MAAM,CAAC,MAAM;4BACrB,mBAAmB,EAAE,MAAM,CAAC,mBAAmB;4BAC/C,UAAU,EAAE,MAAM,CAAC,UAAU;4BAC7B,SAAS,EAAE,IAAI;yBAChB,CAAC,EAAA;;wBALI,KAAmC,SAKvC,EALM,SAAS,eAAA,EAAE,iBAAiB,uBAAA;wBAOrB,qBAAM,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,EAAA;;wBAAzC,MAAM,GAAG,SAAgC;wBACzC,GAAG,GAAG,wBAAiB,MAAM,CAAE,CAAC;wBACtC,sBAAO,IAAI,CAAC,IAAI,CACd,GAAG,EACH,EAAE,EACF;gCACE,SAAS,WAAA;gCACT,iBAAiB,mBAAA;6BAClB,CACF,EAAC;;;;KACH;IAnDK;QADL,IAAA,eAAM,EAAC,0BAA0B,CAAC;mDAIlC;IAGK;QADL,IAAA,eAAM,EAAC,2BAA2B,CAAC;oDAInC;IAGK;QADL,IAAA,eAAM,EAAC,uBAAuB,CAAC;gDAmB/B;IAGK;QADL,IAAA,eAAM,EAAC,sBAAsB,CAAC;+CAmB9B;IACH,gBAAC;CAAA,AA7DD,CAAuC,mBAAU,GA6DhD;kBA7DoB,SAAS","sourcesContent":["import { RestClient, Loggable, Logger } from '@reyaxyz/common';\n\nimport {\n GetReyaCheckerResult,\n GetReyaCheckerParams,\n GetTgeClaimingInfoParams,\n GetTgeClaimingInfoResult,\n TgeClaimTokensParams,\n TgeClaimTokensResult,\n TgeLockTokensParams,\n TgeLockTokensResult,\n} from './types';\nimport { signClaimOrLock } from './services/sign';\n\nexport default class TGEModule 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('TGEModule.getReyaChecker')\n async getReyaChecker(params: GetReyaCheckerParams) {\n const uri = `/api/tge/eligibility-check/${params.wallet}`;\n return this.get<GetReyaCheckerResult>(uri);\n }\n\n @Logger('TGEModule.getClaimingInfo')\n async getClaimingInfo(params: GetTgeClaimingInfoParams) {\n const uri = `/api/tge/claiming-info/${params.wallet}`;\n return this.get<GetTgeClaimingInfoResult>(uri);\n }\n\n @Logger('TGEModule.claimTokens')\n async claimTokens(params: TgeClaimTokensParams) {\n const { signature, signatureDeadline } = await signClaimOrLock({\n signer: params.signer,\n distributorContract: params.distributorContract,\n merkleRoot: params.merkleRoot,\n isLocking: false,\n });\n\n const wallet = await params.signer.getAddress();\n const uri = `/api/tge/claim/${wallet}`;\n return this.post<TgeClaimTokensResult>(\n uri,\n {},\n {\n signature,\n signatureDeadline,\n },\n );\n }\n\n @Logger('TGEModule.lockTokens')\n async lockTokens(params: TgeLockTokensParams) {\n const { signature, signatureDeadline } = await signClaimOrLock({\n signer: params.signer,\n distributorContract: params.distributorContract,\n merkleRoot: params.merkleRoot,\n isLocking: true,\n });\n\n const wallet = await params.signer.getAddress();\n const uri = `/api/tge/lock/${wallet}`;\n return this.post<TgeLockTokensResult>(\n uri,\n {},\n {\n signature,\n signatureDeadline,\n },\n );\n }\n}\n"]}
|
|
@@ -56,7 +56,7 @@ var signClaimOrLock = function (params) { return __awaiter(void 0, void 0, void
|
|
|
56
56
|
return [4 /*yield*/, params.signer.getAddress()];
|
|
57
57
|
case 2:
|
|
58
58
|
wallet = _b.sent();
|
|
59
|
-
deadline = Math.floor(Date.now() / 1000) +
|
|
59
|
+
deadline = Math.floor(Date.now() / 1000) + 15;
|
|
60
60
|
return [4 /*yield*/, signClaimOrLockBySig(params.signer, reyaChainId, params.distributorContract, wallet, params.merkleRoot, params.isLocking, deadline)];
|
|
61
61
|
case 3:
|
|
62
62
|
signature = _b.sent();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sign.js","sourceRoot":"/","sources":["modules/tge/services/sign.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,
|
|
1
|
+
{"version":3,"file":"sign.js","sourceRoot":"/","sources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BAAgB,EAAE;4BAChB,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,SAAS,EAAE;4BAC7C,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE;4BACnC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE;4BACjC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE;4BACnC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE;yBACtC;qBACF,CAAC;oBACI,MAAM,GAAG;wBACb,gBAAgB,EAAE,WAAW;wBAC7B,MAAM,EAAE,MAAM;wBACd,IAAI,EAAE,UAAU;wBAChB,SAAS,EAAE,SAAS;wBACpB,QAAQ,EAAE,QAAQ;qBACnB,CAAC;oBAEI,MAAM,GAAG,IAAA,sBAAa,EAAC,mBAAmB,CAAC,CAAC;oBAE1B,qBAAM,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,EAAA;;oBAAnE,eAAe,GAAG,SAAiD;oBAEzE,sBAAO,eAAe,EAAC;;;;CACxB","sourcesContent":["import { Signer } from 'ethers';\nimport { ReyaChainId, getReyaDomain } from '@reyaxyz/common';\nimport { JsonRpcSigner } from 'ethers';\n\nexport type SignClaimOrLockParams = {\n signer: Signer;\n distributorContract: string;\n merkleRoot: string;\n isLocking: boolean;\n};\n\nexport type SignedClaimOrLock = {\n signature: string;\n signatureDeadline: number;\n};\n\nexport const signClaimOrLock = async (\n params: SignClaimOrLockParams,\n): Promise<SignedClaimOrLock> => {\n const network = await params.signer.provider?.getNetwork();\n if (!network) {\n throw new Error('Claim/Lock failed. Network not found.');\n }\n\n const reyaChainId = Number(network.chainId);\n if (!Object.values(ReyaChainId).includes(reyaChainId)) {\n throw new Error('Not on Reya Network.');\n }\n\n const wallet = await params.signer.getAddress();\n const deadline = Math.floor(Date.now() / 1000) + 15;\n\n const signature = await signClaimOrLockBySig(\n params.signer,\n reyaChainId,\n params.distributorContract,\n wallet,\n params.merkleRoot,\n params.isLocking,\n deadline,\n );\n\n return { signature, signatureDeadline: deadline };\n};\n\nasync function signClaimOrLockBySig(\n signer: Signer | JsonRpcSigner,\n reyaChainId: ReyaChainId,\n distributorContract: string,\n wallet: string,\n merkleRoot: string,\n isLocking: boolean,\n deadline: number,\n): Promise<string> {\n const types = {\n ClaimOrLockBySig: [\n { name: 'verifyingChainId', type: 'uint256' },\n { name: 'wallet', type: 'address' },\n { name: 'root', type: 'bytes32' },\n { name: 'isLocking', type: 'bool' },\n { name: 'deadline', type: 'uint256' },\n ],\n };\n const values = {\n verifyingChainId: reyaChainId,\n wallet: wallet,\n root: merkleRoot,\n isLocking: isLocking,\n deadline: deadline,\n };\n\n const domain = getReyaDomain(distributorContract);\n\n const signatureString = await signer.signTypedData(domain, types, values);\n\n return signatureString;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"/","sources":["modules/tge/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { TgeClaimTokensResult } from '@reyaxyz/common';\n\nexport {\n GetReyaCheckerResult,\n TgeAllocatedAmount,\n GetTgeClaimingInfoResult,\n TgeClaimTokensResult,\n} from '@reyaxyz/common';\n\nimport { Signer } from 'ethers';\n\nexport type GetReyaCheckerParams = {\n wallet: string;\n};\n\nexport type GetTgeClaimingInfoParams = {\n wallet: string;\n};\n\nexport type TgeClaimTokensParams = {\n signer: Signer;\n distributorContract: string;\n merkleRoot: string;\n};\n\nexport type TgeLockTokensParams = TgeClaimTokensParams;\n\nexport type
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"/","sources":["modules/tge/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { TgeClaimTokensResult } from '@reyaxyz/common';\n\nexport {\n GetReyaCheckerResult,\n TgeAllocatedAmount,\n GetTgeClaimingInfoResult,\n TrancheInfo,\n TgeClaimTokensResult,\n} from '@reyaxyz/common';\n\nimport { Signer } from 'ethers';\n\nexport type GetReyaCheckerParams = {\n wallet: string;\n};\n\nexport type GetTgeClaimingInfoParams = {\n wallet: string;\n};\n\nexport type TgeClaimTokensParams = {\n signer: Signer;\n distributorContract: string;\n merkleRoot: string;\n};\n\nexport type TgeLockTokensParams = TgeClaimTokensParams;\n\nexport type TgeLockTokensResult = TgeClaimTokensResult;\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"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { RestClient, Loggable } from '@reyaxyz/common';
|
|
2
|
-
import { GetReyaCheckerResult, GetReyaCheckerParams, GetTgeClaimingInfoParams, GetTgeClaimingInfoResult, TgeClaimTokensParams, TgeClaimTokensResult, TgeLockTokensParams
|
|
2
|
+
import { GetReyaCheckerResult, GetReyaCheckerParams, GetTgeClaimingInfoParams, GetTgeClaimingInfoResult, TgeClaimTokensParams, TgeClaimTokensResult, TgeLockTokensParams } from './types';
|
|
3
3
|
export default class TGEModule extends RestClient implements Loggable {
|
|
4
4
|
loggingEnabled: boolean;
|
|
5
5
|
constructor(apiUrl: string, loggingEnabled: boolean);
|
|
6
6
|
getReyaChecker(params: GetReyaCheckerParams): Promise<GetReyaCheckerResult>;
|
|
7
7
|
getClaimingInfo(params: GetTgeClaimingInfoParams): Promise<GetTgeClaimingInfoResult>;
|
|
8
8
|
claimTokens(params: TgeClaimTokensParams): Promise<TgeClaimTokensResult>;
|
|
9
|
-
lockTokens(params: TgeLockTokensParams): Promise<
|
|
10
|
-
unlockTokens(params: TgeUnlockTokensParams): Promise<TgeClaimTokensResult>;
|
|
9
|
+
lockTokens(params: TgeLockTokensParams): Promise<TgeClaimTokensResult>;
|
|
11
10
|
}
|
|
12
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/tge/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAU,MAAM,iBAAiB,CAAC;AAE/D,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,wBAAwB,EACxB,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/tge/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAU,MAAM,iBAAiB,CAAC;AAE/D,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,wBAAwB,EACxB,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EAEpB,MAAM,SAAS,CAAC;AAGjB,MAAM,CAAC,OAAO,OAAO,SAAU,SAAQ,UAAW,YAAW,QAAQ;IACnE,cAAc,EAAE,OAAO,CAAS;gBAEpB,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO;IAM7C,cAAc,CAAC,MAAM,EAAE,oBAAoB;IAM3C,eAAe,CAAC,MAAM,EAAE,wBAAwB;IAMhD,WAAW,CAAC,MAAM,EAAE,oBAAoB;IAqBxC,UAAU,CAAC,MAAM,EAAE,mBAAmB;CAmB7C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sign.d.ts","sourceRoot":"/","sources":["modules/tge/services/sign.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"sign.d.ts","sourceRoot":"/","sources":["modules/tge/services/sign.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,mBAAmB,EAAE,MAAM,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,eAAe,WAClB,qBAAqB,KAC5B,QAAQ,iBAAiB,CAyB3B,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TgeClaimTokensResult } from '@reyaxyz/common';
|
|
2
|
-
export { GetReyaCheckerResult, TgeAllocatedAmount, GetTgeClaimingInfoResult, TgeClaimTokensResult, } from '@reyaxyz/common';
|
|
2
|
+
export { GetReyaCheckerResult, TgeAllocatedAmount, GetTgeClaimingInfoResult, TrancheInfo, TgeClaimTokensResult, } from '@reyaxyz/common';
|
|
3
3
|
import { Signer } from 'ethers';
|
|
4
4
|
export type GetReyaCheckerParams = {
|
|
5
5
|
wallet: string;
|
|
@@ -13,11 +13,5 @@ export type TgeClaimTokensParams = {
|
|
|
13
13
|
merkleRoot: string;
|
|
14
14
|
};
|
|
15
15
|
export type TgeLockTokensParams = TgeClaimTokensParams;
|
|
16
|
-
export type
|
|
17
|
-
wallet: string;
|
|
18
|
-
};
|
|
19
|
-
export type TgeLockTokensResult = TgeClaimTokensResult & {
|
|
20
|
-
timeInMsToUnlock: number;
|
|
21
|
-
};
|
|
22
|
-
export type TgeUnlockTokensResult = TgeClaimTokensResult;
|
|
16
|
+
export type TgeLockTokensResult = TgeClaimTokensResult;
|
|
23
17
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["modules/tge/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAE5D,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,wBAAwB,EACxB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,mBAAmB,EAAE,MAAM,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,oBAAoB,CAAC;AAEvD,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["modules/tge/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAE5D,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,wBAAwB,EACxB,WAAW,EACX,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,mBAAmB,EAAE,MAAM,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,oBAAoB,CAAC;AAEvD,MAAM,MAAM,mBAAmB,GAAG,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contractAddresses.d.ts","sourceRoot":"/","sources":["utils/contractAddresses.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;AAGxC,oBAAY,YAAY;IACtB,kBAAkB,uBAAuB;IACzC,WAAW,gBAAgB;CAC5B;
|
|
1
|
+
{"version":3,"file":"contractAddresses.d.ts","sourceRoot":"/","sources":["utils/contractAddresses.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;AAGxC,oBAAY,YAAY;IACtB,kBAAkB,uBAAuB;IACzC,WAAW,gBAAgB;CAC5B;AAsBD,eAAO,MAAM,UAAU,YACZ,MAAM,gBACD,YAAY,KACzB,MAcF,CAAC"}
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
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
|
+
var _a, _b, _c, _d;
|
|
3
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
15
|
exports.getAddress = exports.ContractType = void 0;
|
|
5
16
|
var common_1 = require("@reyaxyz/common");
|
|
@@ -8,7 +19,7 @@ var ContractType;
|
|
|
8
19
|
ContractType["COMMUNITY_DEPLOYER"] = "community_deployer";
|
|
9
20
|
ContractType["RANKS_PROXY"] = "ranks_proxy";
|
|
10
21
|
})(ContractType || (exports.ContractType = ContractType = {}));
|
|
11
|
-
var
|
|
22
|
+
var remoteAddresses = (_a = {},
|
|
12
23
|
_a[common_1.ReyaChainId.reyaCronos] = (_b = {},
|
|
13
24
|
_b[ContractType.COMMUNITY_DEPLOYER] = '0x0fc85eb14c45acc1534257431f6a079cf3bbdfe9',
|
|
14
25
|
_b[ContractType.RANKS_PROXY] = '0xddc9759e9218fc4b1d56e3d75b2936f877dc6dea',
|
|
@@ -18,16 +29,18 @@ var addresses = (_a = {},
|
|
|
18
29
|
_c[ContractType.RANKS_PROXY] = '0x4ab90747a2e8dec7c378d591b80b9f2f8f78351f',
|
|
19
30
|
_c),
|
|
20
31
|
_a);
|
|
32
|
+
var addresses = __assign(__assign({}, remoteAddresses), (_d = {}, _d[common_1.ReyaChainId.reyaLocal] = {}, _d));
|
|
21
33
|
var getAddress = function (chainId, contractName) {
|
|
22
34
|
var keyChainId = chainId.toString();
|
|
23
35
|
if (!Object.keys(addresses).includes(keyChainId)) {
|
|
24
36
|
return "Unspecified addresses for chain id ".concat(keyChainId);
|
|
25
37
|
}
|
|
26
38
|
var networkAddresses = addresses[chainId];
|
|
27
|
-
|
|
39
|
+
var contractAddress = networkAddresses[contractName];
|
|
40
|
+
if (!contractAddress) {
|
|
28
41
|
return "Unspecified address for ".concat(contractName, " contract");
|
|
29
42
|
}
|
|
30
|
-
return
|
|
43
|
+
return contractAddress;
|
|
31
44
|
};
|
|
32
45
|
exports.getAddress = getAddress;
|
|
33
46
|
//# sourceMappingURL=contractAddresses.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contractAddresses.js","sourceRoot":"/","sources":["utils/contractAddresses.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"contractAddresses.js","sourceRoot":"/","sources":["utils/contractAddresses.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,0CAA8C;AAE9C,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,yDAAyC,CAAA;IACzC,2CAA2B,CAAA;AAC7B,CAAC,EAHW,YAAY,4BAAZ,YAAY,QAGvB;AAID,IAAM,eAAe,GAAG,CAAA;IACtB,GAAC,oBAAW,CAAC,UAAU;QACrB,GAAC,YAAY,CAAC,kBAAkB,IAC9B,4CAA4C;QAC9C,GAAC,YAAY,CAAC,WAAW,IAAG,4CAA4C;WACzE;IACD,GAAC,oBAAW,CAAC,WAAW;QACtB,GAAC,YAAY,CAAC,kBAAkB,IAC9B,4CAA4C;QAC9C,GAAC,YAAY,CAAC,WAAW,IAAG,4CAA4C;WACzE;MACiE,CAAA,CAAC;AAErE,IAAM,SAAS,yBACV,eAAe,gBACjB,oBAAW,CAAC,SAAS,IAAG,EAAE,MAC5B,CAAC;AAEK,IAAM,UAAU,GAAG,UACxB,OAAe,EACf,YAA0B;IAE1B,IAAM,UAAU,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAEtC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC;QACjD,OAAO,6CAAsC,UAAU,CAAE,CAAC;IAC5D,CAAC;IAED,IAAM,gBAAgB,GAAG,SAAS,CAAC,OAAsB,CAAC,CAAC;IAC3D,IAAM,eAAe,GAAG,gBAAgB,CAAC,YAAY,CAAC,CAAC;IACvD,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,OAAO,kCAA2B,YAAY,cAAW,CAAC;IAC5D,CAAC;IAED,OAAO,eAAe,CAAC;AACzB,CAAC,CAAC;AAjBW,QAAA,UAAU,cAiBrB","sourcesContent":["export type Address = Lowercase<string>;\nimport { ReyaChainId } from '@reyaxyz/common';\n\nexport enum ContractType {\n COMMUNITY_DEPLOYER = 'community_deployer',\n RANKS_PROXY = 'ranks_proxy',\n}\n\ntype RemoteReyaChainId = Exclude<ReyaChainId, ReyaChainId.reyaLocal>;\n\nconst remoteAddresses = {\n [ReyaChainId.reyaCronos]: {\n [ContractType.COMMUNITY_DEPLOYER]:\n '0x0fc85eb14c45acc1534257431f6a079cf3bbdfe9',\n [ContractType.RANKS_PROXY]: '0xddc9759e9218fc4b1d56e3d75b2936f877dc6dea',\n },\n [ReyaChainId.reyaNetwork]: {\n [ContractType.COMMUNITY_DEPLOYER]:\n '0xa45506157b7d1c6cb5d4b4846d03a9892010a4f3',\n [ContractType.RANKS_PROXY]: '0x4ab90747a2e8dec7c378d591b80b9f2f8f78351f',\n },\n} satisfies Record<RemoteReyaChainId, Record<ContractType, Address>>;\n\nconst addresses: Record<ReyaChainId, Partial<Record<ContractType, Address>>> = {\n ...remoteAddresses,\n [ReyaChainId.reyaLocal]: {},\n};\n\nexport const getAddress = (\n chainId: number,\n contractName: ContractType,\n): string => {\n const keyChainId = chainId.toString();\n\n if (!Object.keys(addresses).includes(keyChainId)) {\n return `Unspecified addresses for chain id ${keyChainId}`;\n }\n\n const networkAddresses = addresses[chainId as ReyaChainId];\n const contractAddress = networkAddresses[contractName];\n if (!contractAddress) {\n return `Unspecified address for ${contractName} contract`;\n }\n\n return contractAddress;\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reyaxyz/community-sdk",
|
|
3
|
-
"version": "0.57.
|
|
3
|
+
"version": "0.57.16-perpob.110+6b1593537",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -10,9 +10,9 @@
|
|
|
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.146.
|
|
15
|
-
"ethers": "6.
|
|
13
|
+
"@reyaxyz/common": "0.344.1-perpob.110+6b1593537",
|
|
14
|
+
"@reyaxyz/sdk": "0.146.5-perpob.110+6b1593537",
|
|
15
|
+
"ethers": "6.17.0"
|
|
16
16
|
},
|
|
17
17
|
"main": "dist/index.js",
|
|
18
18
|
"types": "dist/types",
|
|
@@ -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": "6b159353795fad33cf7b14e4786141adf34b3e51"
|
|
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 {
|
package/src/modules/tge/index.ts
CHANGED
|
@@ -9,8 +9,6 @@ import {
|
|
|
9
9
|
TgeClaimTokensResult,
|
|
10
10
|
TgeLockTokensParams,
|
|
11
11
|
TgeLockTokensResult,
|
|
12
|
-
TgeUnlockTokensParams,
|
|
13
|
-
TgeUnlockTokensResult,
|
|
14
12
|
} from './types';
|
|
15
13
|
import { signClaimOrLock } from './services/sign';
|
|
16
14
|
|
|
@@ -75,10 +73,4 @@ export default class TGEModule extends RestClient implements Loggable {
|
|
|
75
73
|
},
|
|
76
74
|
);
|
|
77
75
|
}
|
|
78
|
-
|
|
79
|
-
@Logger('TGEModule.unlockTokens')
|
|
80
|
-
async unlockTokens(params: TgeUnlockTokensParams) {
|
|
81
|
-
const uri = `/api/tge/unlock/${params.wallet}`;
|
|
82
|
-
return this.post<TgeUnlockTokensResult>(uri, {});
|
|
83
|
-
}
|
|
84
76
|
}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import { Signer } from 'ethers';
|
|
2
|
-
import {
|
|
3
|
-
ReyaChainId,
|
|
4
|
-
ONE_DAY_IN_SECONDS,
|
|
5
|
-
getReyaDomain,
|
|
6
|
-
} from '@reyaxyz/common';
|
|
2
|
+
import { ReyaChainId, getReyaDomain } from '@reyaxyz/common';
|
|
7
3
|
import { JsonRpcSigner } from 'ethers';
|
|
8
4
|
|
|
9
5
|
export type SignClaimOrLockParams = {
|
|
@@ -32,7 +28,7 @@ export const signClaimOrLock = async (
|
|
|
32
28
|
}
|
|
33
29
|
|
|
34
30
|
const wallet = await params.signer.getAddress();
|
|
35
|
-
const deadline = Math.floor(Date.now() / 1000) +
|
|
31
|
+
const deadline = Math.floor(Date.now() / 1000) + 15;
|
|
36
32
|
|
|
37
33
|
const signature = await signClaimOrLockBySig(
|
|
38
34
|
params.signer,
|
package/src/modules/tge/types.ts
CHANGED
|
@@ -4,6 +4,7 @@ export {
|
|
|
4
4
|
GetReyaCheckerResult,
|
|
5
5
|
TgeAllocatedAmount,
|
|
6
6
|
GetTgeClaimingInfoResult,
|
|
7
|
+
TrancheInfo,
|
|
7
8
|
TgeClaimTokensResult,
|
|
8
9
|
} from '@reyaxyz/common';
|
|
9
10
|
|
|
@@ -25,12 +26,4 @@ export type TgeClaimTokensParams = {
|
|
|
25
26
|
|
|
26
27
|
export type TgeLockTokensParams = TgeClaimTokensParams;
|
|
27
28
|
|
|
28
|
-
export type
|
|
29
|
-
wallet: string;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export type TgeLockTokensResult = TgeClaimTokensResult & {
|
|
33
|
-
timeInMsToUnlock: number;
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
export type TgeUnlockTokensResult = TgeClaimTokensResult;
|
|
29
|
+
export type TgeLockTokensResult = TgeClaimTokensResult;
|
|
@@ -6,7 +6,9 @@ export enum ContractType {
|
|
|
6
6
|
RANKS_PROXY = 'ranks_proxy',
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
type RemoteReyaChainId = Exclude<ReyaChainId, ReyaChainId.reyaLocal>;
|
|
10
|
+
|
|
11
|
+
const remoteAddresses = {
|
|
10
12
|
[ReyaChainId.reyaCronos]: {
|
|
11
13
|
[ContractType.COMMUNITY_DEPLOYER]:
|
|
12
14
|
'0x0fc85eb14c45acc1534257431f6a079cf3bbdfe9',
|
|
@@ -17,6 +19,11 @@ const addresses: Record<ReyaChainId, Record<ContractType, Address>> = {
|
|
|
17
19
|
'0xa45506157b7d1c6cb5d4b4846d03a9892010a4f3',
|
|
18
20
|
[ContractType.RANKS_PROXY]: '0x4ab90747a2e8dec7c378d591b80b9f2f8f78351f',
|
|
19
21
|
},
|
|
22
|
+
} satisfies Record<RemoteReyaChainId, Record<ContractType, Address>>;
|
|
23
|
+
|
|
24
|
+
const addresses: Record<ReyaChainId, Partial<Record<ContractType, Address>>> = {
|
|
25
|
+
...remoteAddresses,
|
|
26
|
+
[ReyaChainId.reyaLocal]: {},
|
|
20
27
|
};
|
|
21
28
|
|
|
22
29
|
export const getAddress = (
|
|
@@ -30,9 +37,10 @@ export const getAddress = (
|
|
|
30
37
|
}
|
|
31
38
|
|
|
32
39
|
const networkAddresses = addresses[chainId as ReyaChainId];
|
|
33
|
-
|
|
40
|
+
const contractAddress = networkAddresses[contractName];
|
|
41
|
+
if (!contractAddress) {
|
|
34
42
|
return `Unspecified address for ${contractName} contract`;
|
|
35
43
|
}
|
|
36
44
|
|
|
37
|
-
return
|
|
45
|
+
return contractAddress;
|
|
38
46
|
};
|