@reyaxyz/community-sdk 0.46.3 → 0.46.5
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/sbt/index.js +3 -3
- package/dist/modules/sbt/index.js.map +1 -1
- package/dist/modules/sbt/services/signMintTx.js +4 -3
- package/dist/modules/sbt/services/signMintTx.js.map +1 -1
- package/dist/modules/sbt/types.js.map +1 -1
- package/dist/types/modules/sbt/index.d.ts.map +1 -1
- package/dist/types/modules/sbt/services/signMintTx.d.ts.map +1 -1
- package/dist/types/modules/sbt/types.d.ts +2 -1
- package/dist/types/modules/sbt/types.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/modules/sbt/index.ts +7 -4
- package/src/modules/sbt/services/signMintTx.ts +4 -3
- package/src/modules/sbt/types.ts +2 -1
|
@@ -71,13 +71,13 @@ var SbtModule = /** @class */ (function (_super) {
|
|
|
71
71
|
// WRITE
|
|
72
72
|
SbtModule.prototype.mint = function (params) {
|
|
73
73
|
return __awaiter(this, void 0, void 0, function () {
|
|
74
|
-
var _a, signature, signatureDeadline, mintUri, result, _b, _c, response;
|
|
74
|
+
var _a, signature, signatureDeadline, sbtRoot, mintUri, result, _b, _c, response;
|
|
75
75
|
var _d;
|
|
76
76
|
return __generator(this, function (_e) {
|
|
77
77
|
switch (_e.label) {
|
|
78
78
|
case 0: return [4 /*yield*/, (0, signMintTx_1.signMint)(params)];
|
|
79
79
|
case 1:
|
|
80
|
-
_a = _e.sent(), signature = _a.signature, signatureDeadline = _a.deadline;
|
|
80
|
+
_a = _e.sent(), signature = _a.signature, signatureDeadline = _a.deadline, sbtRoot = _a.sbtRoot;
|
|
81
81
|
mintUri = "/api/sbt/mint";
|
|
82
82
|
_b = this.put;
|
|
83
83
|
_c = [mintUri,
|
|
@@ -85,7 +85,7 @@ var SbtModule = /** @class */ (function (_super) {
|
|
|
85
85
|
_d = {};
|
|
86
86
|
return [4 /*yield*/, params.signer.getAddress()];
|
|
87
87
|
case 2: return [4 /*yield*/, _b.apply(this, _c.concat([(_d.owner = _e.sent(),
|
|
88
|
-
_d.merkleRoot =
|
|
88
|
+
_d.merkleRoot = sbtRoot,
|
|
89
89
|
_d.tokenRootCounter = 0,
|
|
90
90
|
_d.signature = signature,
|
|
91
91
|
_d.signatureDeadline = signatureDeadline,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/sbt/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/sbt/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAA6C;AAQ7C,oDAAiD;AACjD,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;IAED,QAAQ;IAEF,wBAAI,GAAJ,UAAK,MAAqB;;;;;;4BAK1B,qBAAM,IAAA,qBAAQ,EAAC,MAAM,CAAC,EAAA;;wBAJpB,KAIF,SAAsB,EAHb,SAAS,eAAA,EACV,iBAAiB,cAAA,EAClB,OAAO,aAAA;wBAGZ,OAAO,GAAG,eAAe,CAAC;wBACX,KAAA,IAAI,CAAC,GAAG,CAAA;8BAC3B,OAAO;4BACP,EAAE;;wBAEO,qBAAM,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,EAAA;4BAJ5B,qBAAM,SAAA,IAAI,cAIrB,QAAK,GAAE,SAAgC;gCACvC,aAAU,GAAE,OAAO;gCACnB,mBAAgB,GAAE,CAAC;gCACnB,YAAS,GAAE,SAAS;gCACpB,oBAAiB,GAAE,iBAAiB;sCAEvC,EAAA;;wBAVK,MAAM,GAAG,SAUd;wBAEK,QAAQ,GAAkB,EAAE,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;wBACnE,sBAAO,QAAQ,EAAC;;;;KACjB;IAED,OAAO;IAED,sCAAkB,GAAlB,UAAmB,MAA0B;;;;gBAC3C,GAAG,GAAG,qCAA8B,MAAM,CAAC,YAAY,kBAAe,CAAC;gBAC7E,sBAAO,IAAI,CAAC,GAAG,CAAqB,GAAG,CAAC,EAAC;;;KAC1C;IAGK,+BAAW,GAAX;;;;gBACE,GAAG,GAAG,eAAe,CAAC;gBAC5B,sBAAO,IAAI,CAAC,GAAG,CAAoB,GAAG,CAAC,EAAC;;;KACzC;IAnCK;QADL,IAAA,eAAM,EAAC,gBAAgB,CAAC;yCAuBxB;IAIK;QADL,IAAA,eAAM,EAAC,8BAA8B,CAAC;uDAItC;IAGK;QADL,IAAA,eAAM,EAAC,uBAAuB,CAAC;gDAI/B;IACH,gBAAC;CAAA,AA9CD,CAAuC,mBAAU,GA8ChD;kBA9CoB,SAAS","sourcesContent":["import { RestClient } from '@reyaxyz/common';\nimport {\n SbtMintResult,\n SbtMintParams,\n GetSbtMintedParams,\n GetSbtMintedResult,\n GetSbtsInfoResult,\n} from './types';\nimport { signMint } from './services/signMintTx';\nimport { Logger, Loggable } from '@reyaxyz/common';\n\nexport default class SbtModule 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 // WRITE\n @Logger('SbtModule.mint')\n async mint(params: SbtMintParams) {\n const {\n signature: signature,\n deadline: signatureDeadline,\n sbtRoot: sbtRoot,\n } = await signMint(params);\n\n const mintUri = `/api/sbt/mint`;\n const result = await this.put<{ txHash: string }>(\n mintUri,\n {},\n {\n owner: await params.signer.getAddress(),\n merkleRoot: sbtRoot,\n tokenRootCounter: 0, // hardcoded value for this batch\n signature: signature,\n signatureDeadline: signatureDeadline,\n },\n );\n\n const response: SbtMintResult = { transactionHash: result.txHash };\n return response;\n }\n\n // READ\n @Logger('SbtModule.getSbtMintedStatus')\n async getSbtMintedStatus(params: GetSbtMintedParams) {\n const uri = `/api/sbt/mint-status/owner/${params.ownerAddress}/tokenCount/0`;\n return this.get<GetSbtMintedResult>(uri);\n }\n\n @Logger('SbtModule.getSbtsInfo')\n async getSbtsInfo() {\n const uri = `/api/sbt/info`;\n return this.get<GetSbtsInfoResult>(uri);\n }\n}\n"]}
|
|
@@ -39,7 +39,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.signMint = void 0;
|
|
40
40
|
var common_1 = require("@reyaxyz/common");
|
|
41
41
|
var signMint = function (params) { return __awaiter(void 0, void 0, void 0, function () {
|
|
42
|
-
var network, reyaChainId, user, deadline, contractAddress, tokenRootCounter, signature;
|
|
42
|
+
var network, reyaChainId, user, deadline, contractAddress, tokenRootCounter, sbtRoot, signature;
|
|
43
43
|
var _a;
|
|
44
44
|
return __generator(this, function (_b) {
|
|
45
45
|
switch (_b.label) {
|
|
@@ -59,10 +59,11 @@ var signMint = function (params) { return __awaiter(void 0, void 0, void 0, func
|
|
|
59
59
|
deadline = Math.floor(Date.now() / 1000) + common_1.ONE_DAY_IN_SECONDS * 7;
|
|
60
60
|
contractAddress = (0, common_1.getAddress)(reyaChainId, common_1.ContractType.REYA_SBTS);
|
|
61
61
|
tokenRootCounter = 0;
|
|
62
|
-
|
|
62
|
+
sbtRoot = (0, common_1.getSbtRoot)(reyaChainId);
|
|
63
|
+
return [4 /*yield*/, (0, common_1.signSbtMint)(params.signer, reyaChainId, contractAddress, user, tokenRootCounter, sbtRoot, deadline)];
|
|
63
64
|
case 3:
|
|
64
65
|
signature = _b.sent();
|
|
65
|
-
return [2 /*return*/, { signature: signature, deadline: deadline }];
|
|
66
|
+
return [2 /*return*/, { signature: signature, deadline: deadline, sbtRoot: sbtRoot }];
|
|
66
67
|
}
|
|
67
68
|
});
|
|
68
69
|
}); };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signMintTx.js","sourceRoot":"/","sources":["modules/sbt/services/signMintTx.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,0CAOyB;AAElB,IAAM,QAAQ,GAAG,UACtB,MAAqB;;;;;oBAEL,qBAAM,CAAA,MAAA,MAAM,CAAC,MAAM,CAAC,QAAQ,0CAAE,UAAU,EAAE,CAAA,EAAA;;gBAApD,OAAO,GAAG,SAA0C;gBAC1D,IAAI,CAAC,OAAO,EAAE,CAAC;oBACb,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;gBACrD,CAAC;gBACK,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;gBAC5C,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,oBAAW,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;oBACtD,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;gBAC1C,CAAC;gBAEY,qBAAM,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,EAAA;;gBAAvC,IAAI,GAAG,SAAgC;gBACvC,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,2BAAkB,GAAG,CAAC,CAAC;gBAElE,eAAe,GAAG,IAAA,mBAAU,EAAC,WAAW,EAAE,qBAAY,CAAC,SAAS,CAAC,CAAC;gBAElE,gBAAgB,GAAG,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"signMintTx.js","sourceRoot":"/","sources":["modules/sbt/services/signMintTx.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,0CAOyB;AAElB,IAAM,QAAQ,GAAG,UACtB,MAAqB;;;;;oBAEL,qBAAM,CAAA,MAAA,MAAM,CAAC,MAAM,CAAC,QAAQ,0CAAE,UAAU,EAAE,CAAA,EAAA;;gBAApD,OAAO,GAAG,SAA0C;gBAC1D,IAAI,CAAC,OAAO,EAAE,CAAC;oBACb,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;gBACrD,CAAC;gBACK,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;gBAC5C,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,oBAAW,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;oBACtD,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;gBAC1C,CAAC;gBAEY,qBAAM,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,EAAA;;gBAAvC,IAAI,GAAG,SAAgC;gBACvC,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,GAAG,2BAAkB,GAAG,CAAC,CAAC;gBAElE,eAAe,GAAG,IAAA,mBAAU,EAAC,WAAW,EAAE,qBAAY,CAAC,SAAS,CAAC,CAAC;gBAElE,gBAAgB,GAAG,CAAC,CAAC;gBACrB,OAAO,GAAG,IAAA,mBAAU,EAAC,WAAW,CAAC,CAAC;gBACtB,qBAAM,IAAA,oBAAW,EACjC,MAAM,CAAC,MAAM,EACb,WAAW,EACX,eAAe,EACf,IAAI,EACJ,gBAAgB,EAChB,OAAO,EACP,QAAQ,CACT,EAAA;;gBARK,SAAS,GAAG,SAQjB;gBAED,sBAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,EAAC;;;KACvE,CAAC;AA9BW,QAAA,QAAQ,YA8BnB","sourcesContent":["import { SbtMintParams, SignedSbtMintTx } from '../types';\nimport {\n ReyaChainId,\n signSbtMint,\n ONE_DAY_IN_SECONDS,\n getAddress,\n ContractType,\n getSbtRoot,\n} from '@reyaxyz/common';\n\nexport const signMint = async (\n params: SbtMintParams,\n): Promise<SignedSbtMintTx> => {\n const network = await params.signer.provider?.getNetwork();\n if (!network) {\n throw new Error('Mint failed. Network not found.');\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 user = await params.signer.getAddress();\n const deadline = Math.floor(Date.now() / 1000) + ONE_DAY_IN_SECONDS * 7;\n\n const contractAddress = getAddress(reyaChainId, ContractType.REYA_SBTS);\n\n const tokenRootCounter = 0; // hardcoaded for this batch\n const sbtRoot = getSbtRoot(reyaChainId);\n const signature = await signSbtMint(\n params.signer,\n reyaChainId,\n contractAddress,\n user,\n tokenRootCounter,\n sbtRoot,\n deadline,\n );\n\n return { signature: signature, deadline: deadline, sbtRoot: sbtRoot };\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"/","sources":["modules/sbt/types.ts"],"names":[],"mappings":"","sourcesContent":["import { SbtMintedStatusEntity } from '@reyaxyz/common';\nimport { Signer } from 'ethers';\n\nexport type SbtMintResult = {\n transactionHash: string | null;\n};\nexport type SbtMintParams = {\n signer: Signer;\n};\n\nexport type SignedSbtMintTx = {\n signature: string;\n deadline: number;\n};\n\nexport type GetSbtMintedParams = {\n ownerAddress: string;\n};\nexport type GetSbtMintedResult = SbtMintedStatusEntity;\n\nexport type GetSbtsInfoResult = {\n totalSbts:
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"/","sources":["modules/sbt/types.ts"],"names":[],"mappings":"","sourcesContent":["import { SbtMintedStatusEntity } from '@reyaxyz/common';\nimport { Signer } from 'ethers';\n\nexport type SbtMintResult = {\n transactionHash: string | null;\n};\nexport type SbtMintParams = {\n signer: Signer;\n};\n\nexport type SignedSbtMintTx = {\n signature: string;\n deadline: number;\n sbtRoot: string;\n};\n\nexport type GetSbtMintedParams = {\n ownerAddress: string;\n};\nexport type GetSbtMintedResult = SbtMintedStatusEntity;\n\nexport type GetSbtsInfoResult = {\n totalSbts: number;\n deadlineMs: number;\n newFee: 0.01;\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/sbt/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/sbt/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EACL,aAAa,EACb,aAAa,EACb,kBAAkB,EAElB,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAU,QAAQ,EAAE,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,IAAI,CAAC,MAAM,EAAE,aAAa;IA0B1B,kBAAkB,CAAC,MAAM,EAAE,kBAAkB;IAM7C,WAAW;CAIlB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signMintTx.d.ts","sourceRoot":"/","sources":["modules/sbt/services/signMintTx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAU1D,eAAO,MAAM,QAAQ,WACX,aAAa,KACpB,QAAQ,eAAe,
|
|
1
|
+
{"version":3,"file":"signMintTx.d.ts","sourceRoot":"/","sources":["modules/sbt/services/signMintTx.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAU1D,eAAO,MAAM,QAAQ,WACX,aAAa,KACpB,QAAQ,eAAe,CA4BzB,CAAC"}
|
|
@@ -9,13 +9,14 @@ export type SbtMintParams = {
|
|
|
9
9
|
export type SignedSbtMintTx = {
|
|
10
10
|
signature: string;
|
|
11
11
|
deadline: number;
|
|
12
|
+
sbtRoot: string;
|
|
12
13
|
};
|
|
13
14
|
export type GetSbtMintedParams = {
|
|
14
15
|
ownerAddress: string;
|
|
15
16
|
};
|
|
16
17
|
export type GetSbtMintedResult = SbtMintedStatusEntity;
|
|
17
18
|
export type GetSbtsInfoResult = {
|
|
18
|
-
totalSbts:
|
|
19
|
+
totalSbts: number;
|
|
19
20
|
deadlineMs: number;
|
|
20
21
|
newFee: 0.01;
|
|
21
22
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["modules/sbt/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,MAAM,MAAM,aAAa,GAAG;IAC1B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC,CAAC;AACF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["modules/sbt/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,MAAM,MAAM,aAAa,GAAG;IAC1B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC,CAAC;AACF,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AACF,MAAM,MAAM,kBAAkB,GAAG,qBAAqB,CAAC;AAEvD,MAAM,MAAM,iBAAiB,GAAG;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,IAAI,CAAC;CACd,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reyaxyz/community-sdk",
|
|
3
|
-
"version": "0.46.
|
|
3
|
+
"version": "0.46.5",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@gelatonetwork/relay-sdk": "^5.5.0",
|
|
14
|
-
"@reyaxyz/common": "0.258.
|
|
15
|
-
"@reyaxyz/sdk": "0.127.
|
|
14
|
+
"@reyaxyz/common": "0.258.2",
|
|
15
|
+
"@reyaxyz/sdk": "0.127.31",
|
|
16
16
|
"ethers": "6.9.0"
|
|
17
17
|
},
|
|
18
18
|
"main": "dist/index.js",
|
|
@@ -39,5 +39,5 @@
|
|
|
39
39
|
"generate:coverage-badges": "npx istanbul-badges-readme --silent"
|
|
40
40
|
},
|
|
41
41
|
"packageManager": "pnpm@8.3.1",
|
|
42
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "832af0d03db57f82f3aec02e7a01a5c6a58b0ab8"
|
|
43
43
|
}
|
package/src/modules/sbt/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RestClient
|
|
1
|
+
import { RestClient } from '@reyaxyz/common';
|
|
2
2
|
import {
|
|
3
3
|
SbtMintResult,
|
|
4
4
|
SbtMintParams,
|
|
@@ -20,8 +20,11 @@ export default class SbtModule extends RestClient implements Loggable {
|
|
|
20
20
|
// WRITE
|
|
21
21
|
@Logger('SbtModule.mint')
|
|
22
22
|
async mint(params: SbtMintParams) {
|
|
23
|
-
const {
|
|
24
|
-
|
|
23
|
+
const {
|
|
24
|
+
signature: signature,
|
|
25
|
+
deadline: signatureDeadline,
|
|
26
|
+
sbtRoot: sbtRoot,
|
|
27
|
+
} = await signMint(params);
|
|
25
28
|
|
|
26
29
|
const mintUri = `/api/sbt/mint`;
|
|
27
30
|
const result = await this.put<{ txHash: string }>(
|
|
@@ -29,7 +32,7 @@ export default class SbtModule extends RestClient implements Loggable {
|
|
|
29
32
|
{},
|
|
30
33
|
{
|
|
31
34
|
owner: await params.signer.getAddress(),
|
|
32
|
-
merkleRoot:
|
|
35
|
+
merkleRoot: sbtRoot,
|
|
33
36
|
tokenRootCounter: 0, // hardcoded value for this batch
|
|
34
37
|
signature: signature,
|
|
35
38
|
signatureDeadline: signatureDeadline,
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
ONE_DAY_IN_SECONDS,
|
|
6
6
|
getAddress,
|
|
7
7
|
ContractType,
|
|
8
|
-
|
|
8
|
+
getSbtRoot,
|
|
9
9
|
} from '@reyaxyz/common';
|
|
10
10
|
|
|
11
11
|
export const signMint = async (
|
|
@@ -26,15 +26,16 @@ export const signMint = async (
|
|
|
26
26
|
const contractAddress = getAddress(reyaChainId, ContractType.REYA_SBTS);
|
|
27
27
|
|
|
28
28
|
const tokenRootCounter = 0; // hardcoaded for this batch
|
|
29
|
+
const sbtRoot = getSbtRoot(reyaChainId);
|
|
29
30
|
const signature = await signSbtMint(
|
|
30
31
|
params.signer,
|
|
31
32
|
reyaChainId,
|
|
32
33
|
contractAddress,
|
|
33
34
|
user,
|
|
34
35
|
tokenRootCounter,
|
|
35
|
-
|
|
36
|
+
sbtRoot,
|
|
36
37
|
deadline,
|
|
37
38
|
);
|
|
38
39
|
|
|
39
|
-
return { signature: signature, deadline: deadline };
|
|
40
|
+
return { signature: signature, deadline: deadline, sbtRoot: sbtRoot };
|
|
40
41
|
};
|
package/src/modules/sbt/types.ts
CHANGED
|
@@ -11,6 +11,7 @@ export type SbtMintParams = {
|
|
|
11
11
|
export type SignedSbtMintTx = {
|
|
12
12
|
signature: string;
|
|
13
13
|
deadline: number;
|
|
14
|
+
sbtRoot: string;
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
export type GetSbtMintedParams = {
|
|
@@ -19,7 +20,7 @@ export type GetSbtMintedParams = {
|
|
|
19
20
|
export type GetSbtMintedResult = SbtMintedStatusEntity;
|
|
20
21
|
|
|
21
22
|
export type GetSbtsInfoResult = {
|
|
22
|
-
totalSbts:
|
|
23
|
+
totalSbts: number;
|
|
23
24
|
deadlineMs: number;
|
|
24
25
|
newFee: 0.01;
|
|
25
26
|
};
|