@reyaxyz/community-sdk 0.53.0 → 0.53.2

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.
@@ -72,7 +72,7 @@ var VltzModule = /** @class */ (function (_super) {
72
72
  VltzModule.prototype.mint = function (params) {
73
73
  var _a;
74
74
  return __awaiter(this, void 0, void 0, function () {
75
- var network, chainId, walletAddress, scaledAllocation, _b, data, value, result;
75
+ var network, chainId, walletAddress, scaledAllocation, deadlineMs, _b, data, value, result;
76
76
  return __generator(this, function (_c) {
77
77
  switch (_c.label) {
78
78
  case 0: return [4 /*yield*/, ((_a = params.signer.provider) === null || _a === void 0 ? void 0 : _a.getNetwork())];
@@ -87,6 +87,13 @@ var VltzModule = /** @class */ (function (_super) {
87
87
  chainId === common_1.MoneyInOutChainId.ethereumMainnet)) {
88
88
  throw new Error('Network not supported. Switch to Ethereum.');
89
89
  }
90
+ // if current time (UTC) is past the mint deadline, throw error
91
+ if (params.merkleRoot == common_1.VLTZ_MINTING_DETAILS[chainId].rounds[1].root) {
92
+ deadlineMs = common_1.VLTZ_MINTING_DETAILS[chainId].rounds[1].mintDeadline * 1000;
93
+ if (Date.now() > deadlineMs) {
94
+ throw new Error('Claim deadline passed');
95
+ }
96
+ }
90
97
  _b = (0, encode_1.encodeMint)(walletAddress, scaledAllocation, params.merkleProof, params.merkleRoot), data = _b.calldata, value = _b.value;
91
98
  return [4 /*yield*/, (0, common_1.executeTransaction)(params.signer, data, value, chainId, params.contractAddress)];
92
99
  case 3:
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/vltz/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAKyB;AASzB,0CAAmD;AACnD,mCAAsC;AAEtC;IAAwC,8BAAU;IAGhD,oBAAY,MAAc,EAAE,cAAuB;QACjD,YAAA,MAAK,YAAC,MAAM,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0BAAmB,MAAM,CAAC,EAAE,CAAE,CAAC;wBACpC,qBAAM,IAAI,CAAC,GAAG,CAAsB,GAAG,CAAC,EAAA;4BAA/C,sBAAO,SAAwC,EAAC;;;;KACjD;IAGK,sCAAiB,GAAjB,UAAkB,MAA4B;;;;;;wBAC5C,GAAG,GAAG,2BAAoB,MAAM,CAAC,OAAO,cAAI,MAAM,CAAC,OAAO,CAAE,CAAC;wBAC5D,qBAAM,IAAI,CAAC,GAAG,CAAuB,GAAG,CAAC,EAAA;4BAAhD,sBAAO,SAAyC,EAAC;;;;KAClD;IA/CK;QADL,IAAA,eAAM,EAAC,iBAAiB,CAAC;0CAmCzB;IAIK;QADL,IAAA,eAAM,EAAC,6BAA6B,CAAC;sDAIrC;IAGK;QADL,IAAA,eAAM,EAAC,8BAA8B,CAAC;uDAItC;IACH,iBAAC;CAAA,AA1DD,CAAwC,mBAAU,GA0DjD;kBA1DoB,UAAU","sourcesContent":["import {\n executeTransaction,\n MoneyInOutChainId,\n RestClient,\n scale,\n} from '@reyaxyz/common';\nimport {\n VltzMintResult,\n VltzMintParams,\n VltzRoundInfoResult,\n VltzRoundInfoParams,\n VltzWalletInfoParams,\n VltzWalletInfoResult,\n} from './types';\nimport { Logger, Loggable } from '@reyaxyz/common';\nimport { encodeMint } from './encode';\n\nexport default class VltzModule 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('VltzModule.mint')\n async mint(params: VltzMintParams): Promise<VltzMintResult> {\n const network = await params.signer.provider?.getNetwork();\n const chainId: MoneyInOutChainId = Number(network?.chainId);\n const walletAddress = await params.signer.getAddress();\n\n const scaledAllocation = scale(18)(Number(params.allocation)).toString();\n\n if (\n !(\n chainId === MoneyInOutChainId.ethereumSepolia ||\n chainId === MoneyInOutChainId.ethereumMainnet\n )\n ) {\n throw new Error('Network not supported. Switch to Ethereum.');\n }\n\n const { calldata: data, value } = encodeMint(\n walletAddress,\n scaledAllocation,\n params.merkleProof,\n params.merkleRoot,\n );\n\n const result = await executeTransaction(\n params.signer,\n data,\n value,\n chainId,\n params.contractAddress,\n );\n\n return {\n transactionHash: result?.hash || null,\n };\n }\n\n // READ\n @Logger('VltzModule.getVltzRoundInfo')\n async getVltzRoundInfo(params: VltzRoundInfoParams) {\n const uri = `/api/vltz/round/${params.id}`;\n return await this.get<VltzRoundInfoResult>(uri);\n }\n\n @Logger('VltzModule.getVltzWalletInfo')\n async getVltzWalletInfo(params: VltzWalletInfoParams) {\n const uri = `/api/vltz/wallet/${params.address}/${params.roundId}`;\n return await this.get<VltzWalletInfoResult>(uri);\n }\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/vltz/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAMyB;AASzB,0CAAmD;AACnD,mCAAsC;AAEtC;IAAwC,8BAAU;IAGhD,oBAAY,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,yBAAI,GAAJ,UAAK,MAAsB;;;;;;4BACf,qBAAM,CAAA,MAAA,MAAM,CAAC,MAAM,CAAC,QAAQ,0CAAE,UAAU,EAAE,CAAA,EAAA;;wBAApD,OAAO,GAAG,SAA0C;wBACpD,OAAO,GAAsB,MAAM,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,CAAC,CAAC;wBACtC,qBAAM,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,EAAA;;wBAAhD,aAAa,GAAG,SAAgC;wBAEhD,gBAAgB,GAAG,IAAA,cAAK,EAAC,EAAE,CAAC,CAAC,MAAM,CAAC,M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;IAGK,sCAAiB,GAAjB,UAAkB,MAA4B;;;;;;wBAC5C,GAAG,GAAG,2BAAoB,MAAM,CAAC,OAAO,cAAI,MAAM,CAAC,OAAO,CAAE,CAAC;wBAC5D,qBAAM,IAAI,CAAC,GAAG,CAAuB,GAAG,CAAC,EAAA;4BAAhD,sBAAO,SAAyC,EAAC;;;;KAClD;IAxDK;QADL,IAAA,eAAM,EAAC,iBAAiB,CAAC;0CA4CzB;IAIK;QADL,IAAA,eAAM,EAAC,6BAA6B,CAAC;sDAIrC;IAGK;QADL,IAAA,eAAM,EAAC,8BAA8B,CAAC;uDAItC;IACH,iBAAC;CAAA,AAnED,CAAwC,mBAAU,GAmEjD;kBAnEoB,UAAU","sourcesContent":["import {\n executeTransaction,\n MoneyInOutChainId,\n RestClient,\n scale,\n VLTZ_MINTING_DETAILS,\n} from '@reyaxyz/common';\nimport {\n VltzMintResult,\n VltzMintParams,\n VltzRoundInfoResult,\n VltzRoundInfoParams,\n VltzWalletInfoParams,\n VltzWalletInfoResult,\n} from './types';\nimport { Logger, Loggable } from '@reyaxyz/common';\nimport { encodeMint } from './encode';\n\nexport default class VltzModule 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('VltzModule.mint')\n async mint(params: VltzMintParams): Promise<VltzMintResult> {\n const network = await params.signer.provider?.getNetwork();\n const chainId: MoneyInOutChainId = Number(network?.chainId);\n const walletAddress = await params.signer.getAddress();\n\n const scaledAllocation = scale(18)(Number(params.allocation)).toString();\n\n if (\n !(\n chainId === MoneyInOutChainId.ethereumSepolia ||\n chainId === MoneyInOutChainId.ethereumMainnet\n )\n ) {\n throw new Error('Network not supported. Switch to Ethereum.');\n }\n\n // if current time (UTC) is past the mint deadline, throw error\n if (params.merkleRoot == VLTZ_MINTING_DETAILS[chainId].rounds[1].root) {\n const deadlineMs =\n VLTZ_MINTING_DETAILS[chainId].rounds[1].mintDeadline * 1000;\n if (Date.now() > deadlineMs) {\n throw new Error('Claim deadline passed');\n }\n }\n\n const { calldata: data, value } = encodeMint(\n walletAddress,\n scaledAllocation,\n params.merkleProof,\n params.merkleRoot,\n );\n\n const result = await executeTransaction(\n params.signer,\n data,\n value,\n chainId,\n params.contractAddress,\n );\n\n return {\n transactionHash: result?.hash || null,\n };\n }\n\n // READ\n @Logger('VltzModule.getVltzRoundInfo')\n async getVltzRoundInfo(params: VltzRoundInfoParams) {\n const uri = `/api/vltz/round/${params.id}`;\n return await this.get<VltzRoundInfoResult>(uri);\n }\n\n @Logger('VltzModule.getVltzWalletInfo')\n async getVltzWalletInfo(params: VltzWalletInfoParams) {\n const uri = `/api/vltz/wallet/${params.address}/${params.roundId}`;\n return await this.get<VltzWalletInfoResult>(uri);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/vltz/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EAEX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,cAAc,EACd,cAAc,EAEd,mBAAmB,EACnB,oBAAoB,EAErB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAU,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAGnD,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,UAAW,YAAW,QAAQ;IACpE,cAAc,EAAE,OAAO,CAAS;gBAEpB,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO;IAO7C,IAAI,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;IAsCrD,gBAAgB,CAAC,MAAM,EAAE,mBAAmB;IAM5C,iBAAiB,CAAC,MAAM,EAAE,oBAAoB;CAIrD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/vltz/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EAGX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,cAAc,EACd,cAAc,EAEd,mBAAmB,EACnB,oBAAoB,EAErB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAU,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAGnD,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,UAAW,YAAW,QAAQ;IACpE,cAAc,EAAE,OAAO,CAAS;gBAEpB,MAAM,EAAE,MAAM,EAAE,cAAc,EAAE,OAAO;IAO7C,IAAI,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;IA+CrD,gBAAgB,CAAC,MAAM,EAAE,mBAAmB;IAM5C,iBAAiB,CAAC,MAAM,EAAE,oBAAoB;CAIrD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reyaxyz/community-sdk",
3
- "version": "0.53.0",
3
+ "version": "0.53.2",
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.324.0",
14
- "@reyaxyz/sdk": "0.140.2",
13
+ "@reyaxyz/common": "0.324.1",
14
+ "@reyaxyz/sdk": "0.140.3",
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": "22962719b00f42ae9cc5be93e14713526c95972e"
41
+ "gitHead": "60883c43c6ba4b6a9450adf4c132ce7d747659b8"
42
42
  }
@@ -3,6 +3,7 @@ import {
3
3
  MoneyInOutChainId,
4
4
  RestClient,
5
5
  scale,
6
+ VLTZ_MINTING_DETAILS,
6
7
  } from '@reyaxyz/common';
7
8
  import {
8
9
  VltzMintResult,
@@ -41,6 +42,15 @@ export default class VltzModule extends RestClient implements Loggable {
41
42
  throw new Error('Network not supported. Switch to Ethereum.');
42
43
  }
43
44
 
45
+ // if current time (UTC) is past the mint deadline, throw error
46
+ if (params.merkleRoot == VLTZ_MINTING_DETAILS[chainId].rounds[1].root) {
47
+ const deadlineMs =
48
+ VLTZ_MINTING_DETAILS[chainId].rounds[1].mintDeadline * 1000;
49
+ if (Date.now() > deadlineMs) {
50
+ throw new Error('Claim deadline passed');
51
+ }
52
+ }
53
+
44
54
  const { calldata: data, value } = encodeMint(
45
55
  walletAddress,
46
56
  scaledAllocation,