@reyaxyz/common 0.262.1 → 0.263.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/README.md
CHANGED
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
|
|
7
7
|
| Statements | Branches | Functions | Lines |
|
|
8
8
|
| --------------------------- | ----------------------- | ------------------------- | ----------------- |
|
|
9
|
-
|  |  |  |  |
|
|
10
10
|
|
|
@@ -3,7 +3,15 @@ import { BigNumberish } from 'ethers';
|
|
|
3
3
|
import { ReyaChainId } from '../types';
|
|
4
4
|
export declare const SBT_ROOT: Record<ReyaChainId, string>;
|
|
5
5
|
export declare const SBT_ROOT_EXTRA_OGS: Record<ReyaChainId, string>;
|
|
6
|
-
export declare
|
|
6
|
+
export declare enum SBT_ROOT_TYPE {
|
|
7
|
+
SPECIAL_ROOT = "special_root",
|
|
8
|
+
OG_ROOT = "all_ogs_root",
|
|
9
|
+
EXTRA_ROOT = "extra_root"
|
|
10
|
+
}
|
|
11
|
+
export declare const getSbtRoot: (reyaChainId: ReyaChainId, ownerAddress: string, isAddressEligibleForSpecialSbt: boolean, isAddressEligibleForOgSbt: boolean, sbtEligibleExtraWallets: {
|
|
12
|
+
account: string;
|
|
13
|
+
root: string;
|
|
14
|
+
}[]) => string;
|
|
7
15
|
export declare const SBT_MINT_DEADLINE = 1743508800;
|
|
8
16
|
export type SbtLeafInfo = {
|
|
9
17
|
account: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sbt-helpers.d.ts","sourceRoot":"/","sources":["utils/sbt-helpers.ts"],"names":[],"mappings":";AAAA,OAAO,EAAU,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAKhD,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAK1D,CAAC;AAEF,eAAO,MAAM,UAAU,gBACR,WAAW,
|
|
1
|
+
{"version":3,"file":"sbt-helpers.d.ts","sourceRoot":"/","sources":["utils/sbt-helpers.ts"],"names":[],"mappings":";AAAA,OAAO,EAAU,YAAY,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,eAAO,MAAM,QAAQ,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAKhD,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAK1D,CAAC;AAEF,oBAAY,aAAa;IACvB,YAAY,iBAAiB;IAC7B,OAAO,iBAAiB;IACxB,UAAU,eAAe;CAC1B;AAED,eAAO,MAAM,UAAU,gBACR,WAAW,gBACV,MAAM,kCACY,OAAO,6BACZ,OAAO,2BACT;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,KAC3D,MAcF,CAAC;AAEF,eAAO,MAAM,iBAAiB,aAAa,CAAC;AAE5C,MAAM,MAAM,WAAW,GAAG;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,eAAO,MAAM,OAAO,YAAa,MAAM,oBAAoB,MAAM,KAAG,MAQnE,CAAC;AAEF,eAAO,MAAM,aAAa,YACf,MAAM,cACH,MAAM,oBACA,MAAM,KACvB,YASF,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a, _b;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.getSbtTokenId = exports.getLeaf = exports.SBT_MINT_DEADLINE = exports.getSbtRoot = exports.SBT_ROOT_EXTRA_OGS = exports.SBT_ROOT = void 0;
|
|
4
|
+
exports.getSbtTokenId = exports.getLeaf = exports.SBT_MINT_DEADLINE = exports.getSbtRoot = exports.SBT_ROOT_TYPE = exports.SBT_ROOT_EXTRA_OGS = exports.SBT_ROOT = void 0;
|
|
5
5
|
var ethers_1 = require("ethers");
|
|
6
6
|
var types_1 = require("../types");
|
|
7
7
|
exports.SBT_ROOT = (_a = {},
|
|
@@ -12,10 +12,28 @@ exports.SBT_ROOT_EXTRA_OGS = (_b = {},
|
|
|
12
12
|
_b[types_1.ReyaChainId.reyaNetwork] = '0xbc6264e25255e1b3d456ec287615879c2525828345a3d4d4c09eb11baa2d201f',
|
|
13
13
|
_b[types_1.ReyaChainId.reyaCronos] = '0xdb3908dd08c4ccc9a39a3699999ff7043780ce76b245fffc4d551dc903594b61',
|
|
14
14
|
_b);
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
var SBT_ROOT_TYPE;
|
|
16
|
+
(function (SBT_ROOT_TYPE) {
|
|
17
|
+
SBT_ROOT_TYPE["SPECIAL_ROOT"] = "special_root";
|
|
18
|
+
SBT_ROOT_TYPE["OG_ROOT"] = "all_ogs_root";
|
|
19
|
+
SBT_ROOT_TYPE["EXTRA_ROOT"] = "extra_root";
|
|
20
|
+
})(SBT_ROOT_TYPE || (exports.SBT_ROOT_TYPE = SBT_ROOT_TYPE = {}));
|
|
21
|
+
var getSbtRoot = function (reyaChainId, ownerAddress, isAddressEligibleForSpecialSbt, isAddressEligibleForOgSbt, sbtEligibleExtraWallets) {
|
|
22
|
+
var merkleRoot = '';
|
|
23
|
+
if (isAddressEligibleForSpecialSbt) {
|
|
24
|
+
return exports.SBT_ROOT[reyaChainId];
|
|
25
|
+
}
|
|
26
|
+
else if (isAddressEligibleForOgSbt) {
|
|
27
|
+
return exports.SBT_ROOT_EXTRA_OGS[reyaChainId];
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
sbtEligibleExtraWallets.forEach(function (e) {
|
|
31
|
+
if (e.account.toLowerCase() == ownerAddress.toLowerCase()) {
|
|
32
|
+
merkleRoot = e.root;
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return merkleRoot;
|
|
19
37
|
};
|
|
20
38
|
exports.getSbtRoot = getSbtRoot;
|
|
21
39
|
exports.SBT_MINT_DEADLINE = 1743508800; // Tue Apr 01 2025 12:00:00 GMT+0000
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sbt-helpers.js","sourceRoot":"/","sources":["utils/sbt-helpers.ts"],"names":[],"mappings":";;;;AAAA,iCAA8C;AAC9C,kCAAuC;AAE1B,QAAA,QAAQ;IACnB,GAAC,mBAAW,CAAC,WAAW,IACtB,oEAAoE;IACtE,GAAC,mBAAW,CAAC,UAAU,IACrB,oEAAoE;QACtE;AAEW,QAAA,kBAAkB;IAC7B,GAAC,mBAAW,CAAC,WAAW,IACtB,oEAAoE;IACtE,GAAC,mBAAW,CAAC,UAAU,IACrB,oEAAoE;QACtE;
|
|
1
|
+
{"version":3,"file":"sbt-helpers.js","sourceRoot":"/","sources":["utils/sbt-helpers.ts"],"names":[],"mappings":";;;;AAAA,iCAA8C;AAC9C,kCAAuC;AAE1B,QAAA,QAAQ;IACnB,GAAC,mBAAW,CAAC,WAAW,IACtB,oEAAoE;IACtE,GAAC,mBAAW,CAAC,UAAU,IACrB,oEAAoE;QACtE;AAEW,QAAA,kBAAkB;IAC7B,GAAC,mBAAW,CAAC,WAAW,IACtB,oEAAoE;IACtE,GAAC,mBAAW,CAAC,UAAU,IACrB,oEAAoE;QACtE;AAEF,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,8CAA6B,CAAA;IAC7B,yCAAwB,CAAA;IACxB,0CAAyB,CAAA;AAC3B,CAAC,EAJW,aAAa,6BAAb,aAAa,QAIxB;AAEM,IAAM,UAAU,GAAG,UACxB,WAAwB,EACxB,YAAoB,EACpB,8BAAuC,EACvC,yBAAkC,EAClC,uBAA4D;IAE5D,IAAI,UAAU,GAAG,EAAE,CAAC;IACpB,IAAI,8BAA8B,EA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 'ethers';\nimport { ReyaChainId } from '../types';\n\nexport const SBT_ROOT: Record<ReyaChainId, string> = {\n [ReyaChainId.reyaNetwork]:\n '0x7d8254a884c4e1e8040d592fdbe3ce8986fb6c5c4f7dee3ce7b7f823fa127c52',\n [ReyaChainId.reyaCronos]:\n '0x01f4d29a3aca5cb40663851d2d40d605636dd6448f251d77765dd0e40c422136',\n};\n\nexport const SBT_ROOT_EXTRA_OGS: Record<ReyaChainId, string> = {\n [ReyaChainId.reyaNetwork]:\n '0xbc6264e25255e1b3d456ec287615879c2525828345a3d4d4c09eb11baa2d201f',\n [ReyaChainId.reyaCronos]:\n '0xdb3908dd08c4ccc9a39a3699999ff7043780ce76b245fffc4d551dc903594b61',\n};\n\nexport enum SBT_ROOT_TYPE {\n SPECIAL_ROOT = 'special_root',\n OG_ROOT = 'all_ogs_root',\n EXTRA_ROOT = 'extra_root',\n}\n\nexport const getSbtRoot = (\n reyaChainId: ReyaChainId,\n ownerAddress: string,\n isAddressEligibleForSpecialSbt: boolean,\n isAddressEligibleForOgSbt: boolean,\n sbtEligibleExtraWallets: { account: string; root: string }[],\n): string => {\n let merkleRoot = '';\n if (isAddressEligibleForSpecialSbt) {\n return SBT_ROOT[reyaChainId];\n } else if (isAddressEligibleForOgSbt) {\n return SBT_ROOT_EXTRA_OGS[reyaChainId];\n } else {\n sbtEligibleExtraWallets.forEach((e) => {\n if (e.account.toLowerCase() == ownerAddress.toLowerCase()) {\n merkleRoot = e.root;\n }\n });\n }\n return merkleRoot;\n};\n\nexport const SBT_MINT_DEADLINE = 1743508800; // Tue Apr 01 2025 12:00:00 GMT+0000\n\nexport type SbtLeafInfo = {\n account: string;\n tokenRootCounter: number;\n};\n\nexport const getLeaf = (address: string, tokenRootCounter: number): Buffer => {\n const messageHash = ethers.keccak256(\n ethers.solidityPacked(\n ['address', 'uint256'],\n [address, tokenRootCounter.toString()],\n ),\n );\n return Buffer.from(messageHash.slice(2), 'hex');\n};\n\nexport const getSbtTokenId = (\n account: string,\n merkleRoot: string,\n tokenRootCounter: number,\n): BigNumberish => {\n return ethers.toBigInt(\n ethers.keccak256(\n ethers.solidityPacked(\n ['address', 'bytes32', 'uint256'],\n [account, merkleRoot, tokenRootCounter.toString()],\n ),\n ),\n );\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reyaxyz/common",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.263.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"generate:coverage-badges": "npx istanbul-badges-readme --silent"
|
|
45
45
|
},
|
|
46
46
|
"packageManager": "pnpm@8.3.1",
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "ee6bfb985404ff7881b9e06801a1e1ff40b61295"
|
|
48
48
|
}
|
package/src/utils/sbt-helpers.ts
CHANGED
|
@@ -15,13 +15,32 @@ export const SBT_ROOT_EXTRA_OGS: Record<ReyaChainId, string> = {
|
|
|
15
15
|
'0xdb3908dd08c4ccc9a39a3699999ff7043780ce76b245fffc4d551dc903594b61',
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
+
export enum SBT_ROOT_TYPE {
|
|
19
|
+
SPECIAL_ROOT = 'special_root',
|
|
20
|
+
OG_ROOT = 'all_ogs_root',
|
|
21
|
+
EXTRA_ROOT = 'extra_root',
|
|
22
|
+
}
|
|
23
|
+
|
|
18
24
|
export const getSbtRoot = (
|
|
19
25
|
reyaChainId: ReyaChainId,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
ownerAddress: string,
|
|
27
|
+
isAddressEligibleForSpecialSbt: boolean,
|
|
28
|
+
isAddressEligibleForOgSbt: boolean,
|
|
29
|
+
sbtEligibleExtraWallets: { account: string; root: string }[],
|
|
30
|
+
): string => {
|
|
31
|
+
let merkleRoot = '';
|
|
32
|
+
if (isAddressEligibleForSpecialSbt) {
|
|
33
|
+
return SBT_ROOT[reyaChainId];
|
|
34
|
+
} else if (isAddressEligibleForOgSbt) {
|
|
35
|
+
return SBT_ROOT_EXTRA_OGS[reyaChainId];
|
|
36
|
+
} else {
|
|
37
|
+
sbtEligibleExtraWallets.forEach((e) => {
|
|
38
|
+
if (e.account.toLowerCase() == ownerAddress.toLowerCase()) {
|
|
39
|
+
merkleRoot = e.root;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return merkleRoot;
|
|
25
44
|
};
|
|
26
45
|
|
|
27
46
|
export const SBT_MINT_DEADLINE = 1743508800; // Tue Apr 01 2025 12:00:00 GMT+0000
|