@reyaxyz/community-sdk 0.52.20 → 0.52.21

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, _b, data, value, result;
75
+ var network, chainId, walletAddress, scaledAllocation, _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())];
@@ -82,11 +82,12 @@ var VltzModule = /** @class */ (function (_super) {
82
82
  return [4 /*yield*/, params.signer.getAddress()];
83
83
  case 2:
84
84
  walletAddress = _c.sent();
85
+ scaledAllocation = (0, common_1.scale)(18)(Number(params.allocation)).toString();
85
86
  if (!(chainId === common_1.MoneyInOutChainId.ethereumSepolia ||
86
87
  chainId === common_1.MoneyInOutChainId.ethereumMainnet)) {
87
88
  throw new Error('Network not supported. Switch to Ethereum.');
88
89
  }
89
- _b = (0, encode_1.encodeMint)(walletAddress, params.allocation, params.merkleProof, params.merkleRoot), data = _b.calldata, value = _b.value;
90
+ _b = (0, encode_1.encodeMint)(walletAddress, scaledAllocation, params.merkleProof, params.merkleRoot), data = _b.calldata, value = _b.value;
90
91
  return [4 /*yield*/, (0, common_1.executeTransaction)(params.signer, data, value, chainId, common_1.VLTZ_MINTING_DETAILS[chainId].contractAddress)];
91
92
  case 3:
92
93
  result = _c.sent();
@@ -104,7 +105,7 @@ var VltzModule = /** @class */ (function (_super) {
104
105
  return __generator(this, function (_a) {
105
106
  switch (_a.label) {
106
107
  case 0:
107
- uri = "/api/vltz/".concat(params.id);
108
+ uri = "/api/vltz/round/".concat(params.id);
108
109
  return [4 /*yield*/, this.get(uri)];
109
110
  case 1: return [2 /*return*/, _a.sent()];
110
111
  }
@@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sBAAO;gCACL,eAAe,EAAE,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,IAAI,KAAI,IAAI;6BACtC,EAAC;;;;KACH;IAED,OAAO;IAED,qCAAgB,GAAhB,UAAiB,MAA2B;;;;;;wBAC1C,GAAG,GAAG,oBAAa,MAAM,CAAC,EAAE,CAAE,CAAC;wBAC9B,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;IA7CK;QADL,IAAA,eAAM,EAAC,iBAAiB,CAAC;0CAiCzB;IAIK;QADL,IAAA,eAAM,EAAC,6BAA6B,CAAC;sDAIrC;IAGK;QADL,IAAA,eAAM,EAAC,8BAA8B,CAAC;uDAItC;IACH,iBAAC;CAAA,AAxDD,CAAwC,mBAAU,GAwDjD;kBAxDoB,UAAU","sourcesContent":["import {\n executeTransaction,\n MoneyInOutChainId,\n RestClient,\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 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 params.allocation,\n params.merkleProof,\n params.merkleRoot,\n );\n\n const result = await executeTransaction(\n params.signer,\n data,\n value,\n chainId,\n VLTZ_MINTING_DETAILS[chainId].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/${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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AA;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 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 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 VLTZ_MINTING_DETAILS[chainId].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;IAoCrD,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;IAsCrD,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.52.20",
3
+ "version": "0.52.21",
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.305.3",
14
- "@reyaxyz/sdk": "0.136.3",
13
+ "@reyaxyz/common": "0.305.4",
14
+ "@reyaxyz/sdk": "0.136.4",
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": "03ff9e970fec3c0283fbb51751f8f635b66eef65"
41
+ "gitHead": "42855f33c34008f82ca46eee5e152cd09e37a1da"
42
42
  }
@@ -2,6 +2,7 @@ import {
2
2
  executeTransaction,
3
3
  MoneyInOutChainId,
4
4
  RestClient,
5
+ scale,
5
6
  VLTZ_MINTING_DETAILS,
6
7
  } from '@reyaxyz/common';
7
8
  import {
@@ -30,6 +31,8 @@ export default class VltzModule extends RestClient implements Loggable {
30
31
  const chainId: MoneyInOutChainId = Number(network?.chainId);
31
32
  const walletAddress = await params.signer.getAddress();
32
33
 
34
+ const scaledAllocation = scale(18)(Number(params.allocation)).toString();
35
+
33
36
  if (
34
37
  !(
35
38
  chainId === MoneyInOutChainId.ethereumSepolia ||
@@ -41,7 +44,7 @@ export default class VltzModule extends RestClient implements Loggable {
41
44
 
42
45
  const { calldata: data, value } = encodeMint(
43
46
  walletAddress,
44
- params.allocation,
47
+ scaledAllocation,
45
48
  params.merkleProof,
46
49
  params.merkleRoot,
47
50
  );
@@ -62,7 +65,7 @@ export default class VltzModule extends RestClient implements Loggable {
62
65
  // READ
63
66
  @Logger('VltzModule.getVltzRoundInfo')
64
67
  async getVltzRoundInfo(params: VltzRoundInfoParams) {
65
- const uri = `/api/vltz/${params.id}`;
68
+ const uri = `/api/vltz/round/${params.id}`;
66
69
  return await this.get<VltzRoundInfoResult>(uri);
67
70
  }
68
71