@reyaxyz/community-sdk 0.52.19 → 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.
@@ -10,6 +10,7 @@ var lge_1 = __importDefault(require("../modules/lge"));
10
10
  var sbt_1 = __importDefault(require("../modules/sbt"));
11
11
  var referral_1 = __importDefault(require("../modules/referral"));
12
12
  var discord_1 = __importDefault(require("../modules/discord"));
13
+ var vltz_1 = __importDefault(require("../modules/vltz"));
13
14
  /**
14
15
  * @description Client for Community SDK, used to interact with the Reya community.
15
16
  */
@@ -17,6 +18,7 @@ var CommunityClient = /** @class */ (function () {
17
18
  function CommunityClient() {
18
19
  this._voteModule = new vote_1.default(CommunityClient.config.apiEndpoint, CommunityClient.config.logging);
19
20
  this._sbtModule = new sbt_1.default(CommunityClient.config.apiEndpoint, CommunityClient.config.logging);
21
+ this._vltzModule = new vltz_1.default(CommunityClient.config.apiEndpoint, CommunityClient.config.logging);
20
22
  this._lgeModule = new lge_1.default(CommunityClient.config.apiEndpoint, CommunityClient.config.logging);
21
23
  this._referralModule = new referral_1.default(CommunityClient.config.apiEndpoint, CommunityClient.config.logging);
22
24
  this._discordModule = new discord_1.default(CommunityClient.config.apiEndpoint, CommunityClient.config.logging);
@@ -59,6 +61,20 @@ var CommunityClient = /** @class */ (function () {
59
61
  enumerable: false,
60
62
  configurable: true
61
63
  });
64
+ Object.defineProperty(CommunityClient, "vltz", {
65
+ /**
66
+ * Provides access to the VltzModule instance.
67
+ * This getter allows for interacting with vote-related functionalities.
68
+ *
69
+ * @returns {VltzModule} An instance of VltzModule for vote operations.
70
+ * @memberof CommunityClient
71
+ */
72
+ get: function () {
73
+ return CommunityClient.getInstance()._vltzModule;
74
+ },
75
+ enumerable: false,
76
+ configurable: true
77
+ });
62
78
  Object.defineProperty(CommunityClient, "lge", {
63
79
  /**
64
80
  * Provides access to the LGEModule instance.
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources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AAW,CAAC;QACnD,CAAC;;;OAAA;IASD,sBAAkB,sBAAG;QAPrB;;;;;;WAMG;aACH;YACE,OAAO,eAAe,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC;QAClD,CAAC;;;OAAA;IASD,sBAAkB,sBAAG;QAPrB;;;;;;WAMG;aACH;YACE,OAAO,eAAe,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC;QAClD,CAAC;;;OAAA;IASD,sBAAkB,2BAAQ;QAP1B;;;;;;WAMG;aACH;YACE,OAAO,eAAe,CAAC,WAAW,EAAE,CAAC,eAAe,CAAC;QACvD,CAAC;;;OAAA;IASD,sBAAkB,0BAAO;QAPzB;;;;;;WAMG;aACH;YACE,OAAO,eAAe,CAAC,WAAW,EAAE,CAAC,cAAc,CAAC;QACtD,CAAC;;;OAAA;IAED,sBAAkB,iCAAc;aAAhC;YACE,OAAO,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC;QACtC,CAAC;;;OAAA;IAtGc,sBAAM,GAAkB,IAAA,2BAAkB,EAAC,MAAM,CAAC,CAAC;IAuGpE,sBAAC;CAAA,AAzGD,IAyGC;AAzGY,0CAAe","sourcesContent":["import { getApiClientConfig, ServiceConfig } from '@reyaxyz/common';\nimport VoteModule from '../modules/vote';\nimport LGEModule from '../modules/lge';\nimport SbtModule from '../modules/sbt';\nimport ReferralModule from '../modules/referral';\nimport DiscordModule from '../modules/discord';\n\n/**\n * @description Client for Community SDK, used to interact with the Reya community.\n */\nexport class CommunityClient {\n private static instance: CommunityClient;\n private static config: ServiceConfig = getApiClientConfig('test');\n\n private readonly _voteModule: VoteModule;\n private readonly _sbtModule: SbtModule;\n private readonly _lgeModule: LGEModule;\n private readonly _referralModule: ReferralModule;\n private readonly _discordModule: DiscordModule;\n\n private constructor() {\n this._voteModule = new VoteModule(\n CommunityClient.config.apiEndpoint,\n CommunityClient.config.logging,\n );\n this._sbtModule = new SbtModule(\n CommunityClient.config.apiEndpoint,\n CommunityClient.config.logging,\n );\n this._lgeModule = new LGEModule(\n CommunityClient.config.apiEndpoint,\n CommunityClient.config.logging,\n );\n this._referralModule = new ReferralModule(\n CommunityClient.config.apiEndpoint,\n CommunityClient.config.logging,\n );\n this._discordModule = new DiscordModule(\n CommunityClient.config.apiEndpoint,\n CommunityClient.config.logging,\n );\n }\n\n public static configure(environment: ServiceConfig['environment']): void {\n CommunityClient.config = getApiClientConfig(environment);\n CommunityClient.instance = new CommunityClient();\n }\n\n private static getInstance(): CommunityClient {\n if (!CommunityClient.instance) {\n throw new Error(\n 'Client is not configured. Please configure it before using.',\n );\n }\n return CommunityClient.instance;\n }\n\n /**\n * Provides access to the VoteModule instance.\n * This getter allows for interacting with vote-related functionalities.\n *\n * @returns {VoteModule} An instance of VoteModule for vote operations.\n * @memberof CommunityClient\n */\n public static get vote(): VoteModule {\n return CommunityClient.getInstance()._voteModule;\n }\n\n /**\n * Provides access to the SbtModule instance.\n * This getter allows for interacting with vote-related functionalities.\n *\n * @returns {SbtModule} An instance of SbtModule for vote operations.\n * @memberof CommunityClient\n */\n public static get sbt(): SbtModule {\n return CommunityClient.getInstance()._sbtModule;\n }\n\n /**\n * Provides access to the LGEModule instance.\n * This getter allows for interacting with LGE-related functionalities.\n *\n * @returns {LGEModule} An instance of LGEModule for LGE operations.\n * @memberof CommunityClient\n */\n public static get lge(): LGEModule {\n return CommunityClient.getInstance()._lgeModule;\n }\n\n /**\n * Provides access to the ReferralModule instance.\n * This getter allows for interacting with referral related functionalities.\n *\n * @returns {ReferralModule} An instance of ReferralModule .\n * @memberof CommunityClient\n */\n public static get referral(): ReferralModule {\n return CommunityClient.getInstance()._referralModule;\n }\n\n /**\n * Provides access to the DiscordModule instance.\n * This getter allows for interacting with discord-related functionalities.\n *\n * @returns {DiscordModule} An instance of DiscordModule.\n * @memberof CommunityClient\n */\n public static get discord(): DiscordModule {\n return CommunityClient.getInstance()._discordModule;\n }\n\n public static get supportedChain(): number {\n return CommunityClient.config.chain;\n }\n}\n"]}
1
+ {"version":3,"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AA6D,CAC9D,CAAC;QACJ,CAAC;QACD,OAAO,eAAe,CAAC,QAAQ,CAAC;IAClC,CAAC;IASD,sBAAkB,uBAAI;QAPtB;;;;;;WAMG;aACH;YACE,OAAO,eAAe,CAAC,WAAW,EAAE,CAAC,WAAW,CAAC;QACnD,CAAC;;;OAAA;IASD,sBAAkB,sBAAG;QAPrB;;;;;;WAMG;aACH;YACE,OAAO,eAAe,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC;QAClD,CAAC;;;OAAA;IASD,sBAAkB,uBAAI;QAPtB;;;;;;WAMG;aACH;YACE,OAAO,eAAe,CAAC,WAAW,EAAE,CAAC,WAAW,CAAC;QACnD,CAAC;;;OAAA;IASD,sBAAkB,sBAAG;QAPrB;;;;;;WAMG;aACH;YACE,OAAO,eAAe,CAAC,WAAW,EAAE,CAAC,UAAU,CAAC;QAClD,CAAC;;;OAAA;IASD,sBAAkB,2BAAQ;QAP1B;;;;;;WAMG;aACH;YACE,OAAO,eAAe,CAAC,WAAW,EAAE,CAAC,eAAe,CAAC;QACvD,CAAC;;;OAAA;IASD,sBAAkB,0BAAO;QAPzB;;;;;;WAMG;aACH;YACE,OAAO,eAAe,CAAC,WAAW,EAAE,CAAC,cAAc,CAAC;QACtD,CAAC;;;OAAA;IAED,sBAAkB,iCAAc;aAAhC;YACE,OAAO,eAAe,CAAC,MAAM,CAAC,KAAK,CAAC;QACtC,CAAC;;;OAAA;IAtHc,sBAAM,GAAkB,IAAA,2BAAkB,EAAC,MAAM,CAAC,CAAC;IAuHpE,sBAAC;CAAA,AAzHD,IAyHC;AAzHY,0CAAe","sourcesContent":["import { getApiClientConfig, ServiceConfig } from '@reyaxyz/common';\nimport VoteModule from '../modules/vote';\nimport LGEModule from '../modules/lge';\nimport SbtModule from '../modules/sbt';\nimport ReferralModule from '../modules/referral';\nimport DiscordModule from '../modules/discord';\nimport VltzModule from '../modules/vltz';\n\n/**\n * @description Client for Community SDK, used to interact with the Reya community.\n */\nexport class CommunityClient {\n private static instance: CommunityClient;\n private static config: ServiceConfig = getApiClientConfig('test');\n\n private readonly _voteModule: VoteModule;\n private readonly _sbtModule: SbtModule;\n private readonly _vltzModule: VltzModule;\n private readonly _lgeModule: LGEModule;\n private readonly _referralModule: ReferralModule;\n private readonly _discordModule: DiscordModule;\n\n private constructor() {\n this._voteModule = new VoteModule(\n CommunityClient.config.apiEndpoint,\n CommunityClient.config.logging,\n );\n this._sbtModule = new SbtModule(\n CommunityClient.config.apiEndpoint,\n CommunityClient.config.logging,\n );\n this._vltzModule = new VltzModule(\n CommunityClient.config.apiEndpoint,\n CommunityClient.config.logging,\n );\n this._lgeModule = new LGEModule(\n CommunityClient.config.apiEndpoint,\n CommunityClient.config.logging,\n );\n this._referralModule = new ReferralModule(\n CommunityClient.config.apiEndpoint,\n CommunityClient.config.logging,\n );\n this._discordModule = new DiscordModule(\n CommunityClient.config.apiEndpoint,\n CommunityClient.config.logging,\n );\n }\n\n public static configure(environment: ServiceConfig['environment']): void {\n CommunityClient.config = getApiClientConfig(environment);\n CommunityClient.instance = new CommunityClient();\n }\n\n private static getInstance(): CommunityClient {\n if (!CommunityClient.instance) {\n throw new Error(\n 'Client is not configured. Please configure it before using.',\n );\n }\n return CommunityClient.instance;\n }\n\n /**\n * Provides access to the VoteModule instance.\n * This getter allows for interacting with vote-related functionalities.\n *\n * @returns {VoteModule} An instance of VoteModule for vote operations.\n * @memberof CommunityClient\n */\n public static get vote(): VoteModule {\n return CommunityClient.getInstance()._voteModule;\n }\n\n /**\n * Provides access to the SbtModule instance.\n * This getter allows for interacting with vote-related functionalities.\n *\n * @returns {SbtModule} An instance of SbtModule for vote operations.\n * @memberof CommunityClient\n */\n public static get sbt(): SbtModule {\n return CommunityClient.getInstance()._sbtModule;\n }\n\n /**\n * Provides access to the VltzModule instance.\n * This getter allows for interacting with vote-related functionalities.\n *\n * @returns {VltzModule} An instance of VltzModule for vote operations.\n * @memberof CommunityClient\n */\n public static get vltz(): VltzModule {\n return CommunityClient.getInstance()._vltzModule;\n }\n\n /**\n * Provides access to the LGEModule instance.\n * This getter allows for interacting with LGE-related functionalities.\n *\n * @returns {LGEModule} An instance of LGEModule for LGE operations.\n * @memberof CommunityClient\n */\n public static get lge(): LGEModule {\n return CommunityClient.getInstance()._lgeModule;\n }\n\n /**\n * Provides access to the ReferralModule instance.\n * This getter allows for interacting with referral related functionalities.\n *\n * @returns {ReferralModule} An instance of ReferralModule .\n * @memberof CommunityClient\n */\n public static get referral(): ReferralModule {\n return CommunityClient.getInstance()._referralModule;\n }\n\n /**\n * Provides access to the DiscordModule instance.\n * This getter allows for interacting with discord-related functionalities.\n *\n * @returns {DiscordModule} An instance of DiscordModule.\n * @memberof CommunityClient\n */\n public static get discord(): DiscordModule {\n return CommunityClient.getInstance()._discordModule;\n }\n\n public static get supportedChain(): number {\n return CommunityClient.config.chain;\n }\n}\n"]}
package/dist/index.js CHANGED
@@ -20,4 +20,5 @@ __exportStar(require("./modules/lge/types"), exports);
20
20
  __exportStar(require("./modules/referral/types"), exports);
21
21
  __exportStar(require("./modules/discord/types"), exports);
22
22
  __exportStar(require("./modules/sbt/types"), exports);
23
+ __exportStar(require("./modules/vltz/types"), exports);
23
24
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,uDAAqC;AACrC,sDAAoC;AACpC,2DAAyC;AACzC,0DAAwC;AACxC,sDAAoC","sourcesContent":["export * from './client';\nexport * from './modules/vote/types';\nexport * from './modules/lge/types';\nexport * from './modules/referral/types';\nexport * from './modules/discord/types';\nexport * from './modules/sbt/types';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAAyB;AACzB,uDAAqC;AACrC,sDAAoC;AACpC,2DAAyC;AACzC,0DAAwC;AACxC,sDAAoC;AACpC,uDAAqC","sourcesContent":["export * from './client';\nexport * from './modules/vote/types';\nexport * from './modules/lge/types';\nexport * from './modules/referral/types';\nexport * from './modules/discord/types';\nexport * from './modules/sbt/types';\nexport * from './modules/vltz/types';\n"]}
@@ -19,4 +19,5 @@ __exportStar(require("./lge"), exports);
19
19
  __exportStar(require("./referral"), exports);
20
20
  __exportStar(require("./discord"), exports);
21
21
  __exportStar(require("./sbt"), exports);
22
+ __exportStar(require("./vltz"), exports);
22
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,wCAAsB;AACtB,6CAA2B;AAC3B,4CAA0B;AAC1B,wCAAsB","sourcesContent":["export * from './vote';\nexport * from './lge';\nexport * from './referral';\nexport * from './discord';\nexport * from './sbt';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["modules/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,wCAAsB;AACtB,6CAA2B;AAC3B,4CAA0B;AAC1B,wCAAsB;AACtB,yCAAuB","sourcesContent":["export * from './vote';\nexport * from './lge';\nexport * from './referral';\nexport * from './discord';\nexport * from './sbt';\nexport * from './vltz';\n"]}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.encodeMint = void 0;
4
+ var ethers_1 = require("ethers");
5
+ var abi = [
6
+ {
7
+ type: 'function',
8
+ name: 'mint',
9
+ inputs: [
10
+ {
11
+ name: 'leafInfo',
12
+ type: 'tuple',
13
+ internalType: 'struct LeafInfo',
14
+ components: [
15
+ {
16
+ name: 'owner',
17
+ type: 'address',
18
+ internalType: 'address',
19
+ },
20
+ {
21
+ name: 'allocation',
22
+ type: 'uint256',
23
+ internalType: 'uint256',
24
+ },
25
+ ],
26
+ },
27
+ {
28
+ name: 'proof',
29
+ type: 'bytes32[]',
30
+ internalType: 'bytes32[]',
31
+ },
32
+ {
33
+ name: 'merkleRoot',
34
+ type: 'bytes32',
35
+ internalType: 'bytes32',
36
+ },
37
+ ],
38
+ outputs: [
39
+ {
40
+ name: '',
41
+ type: 'uint256',
42
+ internalType: 'uint256',
43
+ },
44
+ ],
45
+ stateMutability: 'nonpayable',
46
+ },
47
+ ];
48
+ var encodeMint = function (owner, allocation, proof, merkleRoot) {
49
+ var functionSignature = 'mint';
50
+ var parameters = [{ owner: owner, allocation: allocation }, proof, merkleRoot];
51
+ var INTERFACE = new ethers_1.Interface(abi);
52
+ var calldata = INTERFACE.encodeFunctionData(functionSignature, parameters);
53
+ return { calldata: calldata, value: BigInt(0).toString(10) };
54
+ };
55
+ exports.encodeMint = encodeMint;
56
+ //# sourceMappingURL=encode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encode.js","sourceRoot":"/","sources":["modules/vltz/encode.ts"],"names":[],"mappings":";;;AACA,iCAAmC;AAEnC,IAAM,GAAG,GAAG;IACV;QACE,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,MAAM;QACZ,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,OAAO;gBACb,YAAY,EAAE,iBAAiB;gBAC/B,UAAU,EAAE;oBACV;wBACE,IAAI,EAAE,OAAO;wBACb,IAAI,EAAE,SAAS;wBACf,YAAY,EAAE,SAAS;qBACxB;oBACD;wBACE,IAAI,EAAE,YAAY;wBAClB,IAAI,EAAE,SAAS;wBACf,YAAY,EAAE,SAAS;qBACxB;iBACF;aACF;YACD;gBACE,IAAI,EAAE,OAAO;gBACb,IAAI,EAAE,WAAW;gBACjB,YAAY,EAAE,WAAW;aAC1B;YACD;gBACE,IAAI,EAAE,YAAY;gBAClB,IAAI,EAAE,SAAS;gBACf,YAAY,EAAE,SAAS;aACxB;SACF;QACD,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,SAAS;gBACf,YAAY,EAAE,SAAS;aACxB;SACF;QACD,eAAe,EAAE,YAAY;KAC9B;CACF,CAAC;AAEK,IAAM,UAAU,GAAG,UACxB,KAAa,EACb,UAAkB,EAClB,KAAe,EACf,UAAkB;IAElB,IAAM,iBAAiB,GAAG,MAAM,CAAC;IACjC,IAAM,UAAU,GAAG,CAAC,EAAE,KAAK,OAAA,EAAE,UAAU,YAAA,EAAE,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;IAC9D,IAAM,SAAS,GAAG,IAAI,kBAAS,CAAC,GAAG,CAAC,CAAC;IACrC,IAAM,QAAQ,GAAG,SAAS,CAAC,kBAAkB,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC;IAC7E,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;AAC/D,CAAC,CAAC;AAXW,QAAA,UAAU,cAWrB","sourcesContent":["import { MethodParameters } from '@reyaxyz/common';\nimport { Interface } from 'ethers';\n\nconst abi = [\n {\n type: 'function',\n name: 'mint',\n inputs: [\n {\n name: 'leafInfo',\n type: 'tuple',\n internalType: 'struct LeafInfo',\n components: [\n {\n name: 'owner',\n type: 'address',\n internalType: 'address',\n },\n {\n name: 'allocation',\n type: 'uint256',\n internalType: 'uint256',\n },\n ],\n },\n {\n name: 'proof',\n type: 'bytes32[]',\n internalType: 'bytes32[]',\n },\n {\n name: 'merkleRoot',\n type: 'bytes32',\n internalType: 'bytes32',\n },\n ],\n outputs: [\n {\n name: '',\n type: 'uint256',\n internalType: 'uint256',\n },\n ],\n stateMutability: 'nonpayable',\n },\n];\n\nexport const encodeMint = (\n owner: string,\n allocation: string,\n proof: string[],\n merkleRoot: string,\n): MethodParameters => {\n const functionSignature = 'mint';\n const parameters = [{ owner, allocation }, proof, merkleRoot];\n const INTERFACE = new Interface(abi);\n const calldata = INTERFACE.encodeFunctionData(functionSignature, parameters);\n return { calldata: calldata, value: BigInt(0).toString(10) };\n};\n"]}
@@ -0,0 +1,140 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ if (typeof b !== "function" && b !== null)
11
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
+ extendStatics(d, b);
13
+ function __() { this.constructor = d; }
14
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
+ };
16
+ })();
17
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
22
+ };
23
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
24
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
25
+ return new (P || (P = Promise))(function (resolve, reject) {
26
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
27
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
28
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
29
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
30
+ });
31
+ };
32
+ var __generator = (this && this.__generator) || function (thisArg, body) {
33
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
34
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
35
+ function verb(n) { return function (v) { return step([n, v]); }; }
36
+ function step(op) {
37
+ if (f) throw new TypeError("Generator is already executing.");
38
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
39
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
40
+ if (y = 0, t) op = [op[0] & 2, t.value];
41
+ switch (op[0]) {
42
+ case 0: case 1: t = op; break;
43
+ case 4: _.label++; return { value: op[1], done: false };
44
+ case 5: _.label++; y = op[1]; op = [0]; continue;
45
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
46
+ default:
47
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
48
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
49
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
50
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
51
+ if (t[2]) _.ops.pop();
52
+ _.trys.pop(); continue;
53
+ }
54
+ op = body.call(thisArg, _);
55
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
56
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
57
+ }
58
+ };
59
+ Object.defineProperty(exports, "__esModule", { value: true });
60
+ var common_1 = require("@reyaxyz/common");
61
+ var common_2 = require("@reyaxyz/common");
62
+ var encode_1 = require("./encode");
63
+ var VltzModule = /** @class */ (function (_super) {
64
+ __extends(VltzModule, _super);
65
+ function VltzModule(apiUrl, loggingEnabled) {
66
+ var _this = _super.call(this, apiUrl) || this;
67
+ _this.loggingEnabled = false;
68
+ _this.loggingEnabled = loggingEnabled;
69
+ return _this;
70
+ }
71
+ // WRITE
72
+ VltzModule.prototype.mint = function (params) {
73
+ var _a;
74
+ return __awaiter(this, void 0, void 0, function () {
75
+ var network, chainId, walletAddress, scaledAllocation, _b, data, value, result;
76
+ return __generator(this, function (_c) {
77
+ switch (_c.label) {
78
+ case 0: return [4 /*yield*/, ((_a = params.signer.provider) === null || _a === void 0 ? void 0 : _a.getNetwork())];
79
+ case 1:
80
+ network = _c.sent();
81
+ chainId = Number(network === null || network === void 0 ? void 0 : network.chainId);
82
+ return [4 /*yield*/, params.signer.getAddress()];
83
+ case 2:
84
+ walletAddress = _c.sent();
85
+ scaledAllocation = (0, common_1.scale)(18)(Number(params.allocation)).toString();
86
+ if (!(chainId === common_1.MoneyInOutChainId.ethereumSepolia ||
87
+ chainId === common_1.MoneyInOutChainId.ethereumMainnet)) {
88
+ throw new Error('Network not supported. Switch to Ethereum.');
89
+ }
90
+ _b = (0, encode_1.encodeMint)(walletAddress, scaledAllocation, params.merkleProof, params.merkleRoot), data = _b.calldata, value = _b.value;
91
+ return [4 /*yield*/, (0, common_1.executeTransaction)(params.signer, data, value, chainId, common_1.VLTZ_MINTING_DETAILS[chainId].contractAddress)];
92
+ case 3:
93
+ result = _c.sent();
94
+ return [2 /*return*/, {
95
+ transactionHash: (result === null || result === void 0 ? void 0 : result.hash) || null,
96
+ }];
97
+ }
98
+ });
99
+ });
100
+ };
101
+ // READ
102
+ VltzModule.prototype.getVltzRoundInfo = function (params) {
103
+ return __awaiter(this, void 0, void 0, function () {
104
+ var uri;
105
+ return __generator(this, function (_a) {
106
+ switch (_a.label) {
107
+ case 0:
108
+ uri = "/api/vltz/round/".concat(params.id);
109
+ return [4 /*yield*/, this.get(uri)];
110
+ case 1: return [2 /*return*/, _a.sent()];
111
+ }
112
+ });
113
+ });
114
+ };
115
+ VltzModule.prototype.getVltzWalletInfo = function (params) {
116
+ return __awaiter(this, void 0, void 0, function () {
117
+ var uri;
118
+ return __generator(this, function (_a) {
119
+ switch (_a.label) {
120
+ case 0:
121
+ uri = "/api/vltz/wallet/".concat(params.address, "/").concat(params.roundId);
122
+ return [4 /*yield*/, this.get(uri)];
123
+ case 1: return [2 /*return*/, _a.sent()];
124
+ }
125
+ });
126
+ });
127
+ };
128
+ __decorate([
129
+ (0, common_2.Logger)('VltzModule.mint')
130
+ ], VltzModule.prototype, "mint", null);
131
+ __decorate([
132
+ (0, common_2.Logger)('VltzModule.getVltzRoundInfo')
133
+ ], VltzModule.prototype, "getVltzRoundInfo", null);
134
+ __decorate([
135
+ (0, common_2.Logger)('VltzModule.getVltzWalletInfo')
136
+ ], VltzModule.prototype, "getVltzWalletInfo", null);
137
+ return VltzModule;
138
+ }(common_1.RestClient));
139
+ exports.default = VltzModule;
140
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
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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ADL,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"]}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"/","sources":["modules/vltz/types.ts"],"names":[],"mappings":"","sourcesContent":["import { VltzRoundInfo, VltzWalletInfo } from '@reyaxyz/common';\nimport { Signer } from 'ethers';\n\nexport type VltzMintResult = {\n transactionHash: string | null;\n};\nexport type VltzMintParams = {\n signer: Signer;\n allocation: string;\n merkleRoot: string;\n merkleProof: string[];\n};\n\nexport type VltzRoundInfoParams = {\n id: string;\n};\n\nexport type VltzRoundInfoResult = VltzRoundInfo;\n\nexport type VltzWalletInfoParams = {\n address: string;\n roundId: string;\n};\n\nexport type VltzWalletInfoResult = VltzWalletInfo;\n"]}
@@ -4,6 +4,7 @@ import LGEModule from '../modules/lge';
4
4
  import SbtModule from '../modules/sbt';
5
5
  import ReferralModule from '../modules/referral';
6
6
  import DiscordModule from '../modules/discord';
7
+ import VltzModule from '../modules/vltz';
7
8
  /**
8
9
  * @description Client for Community SDK, used to interact with the Reya community.
9
10
  */
@@ -12,6 +13,7 @@ export declare class CommunityClient {
12
13
  private static config;
13
14
  private readonly _voteModule;
14
15
  private readonly _sbtModule;
16
+ private readonly _vltzModule;
15
17
  private readonly _lgeModule;
16
18
  private readonly _referralModule;
17
19
  private readonly _discordModule;
@@ -34,6 +36,14 @@ export declare class CommunityClient {
34
36
  * @memberof CommunityClient
35
37
  */
36
38
  static get sbt(): SbtModule;
39
+ /**
40
+ * Provides access to the VltzModule instance.
41
+ * This getter allows for interacting with vote-related functionalities.
42
+ *
43
+ * @returns {VltzModule} An instance of VltzModule for vote operations.
44
+ * @memberof CommunityClient
45
+ */
46
+ static get vltz(): VltzModule;
37
47
  /**
38
48
  * Provides access to the LGEModule instance.
39
49
  * This getter allows for interacting with LGE-related functionalities.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,cAAc,MAAM,qBAAqB,CAAC;AACjD,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAE/C;;GAEG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAkB;IACzC,OAAO,CAAC,MAAM,CAAC,MAAM,CAA6C;IAElE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAa;IACzC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAY;IACvC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAY;IACvC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAiB;IACjD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAgB;IAE/C,OAAO;WAuBO,SAAS,CAAC,WAAW,EAAE,aAAa,CAAC,aAAa,CAAC,GAAG,IAAI;IAKxE,OAAO,CAAC,MAAM,CAAC,WAAW;IAS1B;;;;;;OAMG;IACH,WAAkB,IAAI,IAAI,UAAU,CAEnC;IAED;;;;;;OAMG;IACH,WAAkB,GAAG,IAAI,SAAS,CAEjC;IAED;;;;;;OAMG;IACH,WAAkB,GAAG,IAAI,SAAS,CAEjC;IAED;;;;;;OAMG;IACH,WAAkB,QAAQ,IAAI,cAAc,CAE3C;IAED;;;;;;OAMG;IACH,WAAkB,OAAO,IAAI,aAAa,CAEzC;IAED,WAAkB,cAAc,IAAI,MAAM,CAEzC;CACF"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACpE,OAAO,UAAU,MAAM,iBAAiB,CAAC;AACzC,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,SAAS,MAAM,gBAAgB,CAAC;AACvC,OAAO,cAAc,MAAM,qBAAqB,CAAC;AACjD,OAAO,aAAa,MAAM,oBAAoB,CAAC;AAC/C,OAAO,UAAU,MAAM,iBAAiB,CAAC;AAEzC;;GAEG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAkB;IACzC,OAAO,CAAC,MAAM,CAAC,MAAM,CAA6C;IAElE,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAa;IACzC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAY;IACvC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAa;IACzC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAY;IACvC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAiB;IACjD,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAgB;IAE/C,OAAO;WA2BO,SAAS,CAAC,WAAW,EAAE,aAAa,CAAC,aAAa,CAAC,GAAG,IAAI;IAKxE,OAAO,CAAC,MAAM,CAAC,WAAW;IAS1B;;;;;;OAMG;IACH,WAAkB,IAAI,IAAI,UAAU,CAEnC;IAED;;;;;;OAMG;IACH,WAAkB,GAAG,IAAI,SAAS,CAEjC;IAED;;;;;;OAMG;IACH,WAAkB,IAAI,IAAI,UAAU,CAEnC;IAED;;;;;;OAMG;IACH,WAAkB,GAAG,IAAI,SAAS,CAEjC;IAED;;;;;;OAMG;IACH,WAAkB,QAAQ,IAAI,cAAc,CAE3C;IAED;;;;;;OAMG;IACH,WAAkB,OAAO,IAAI,aAAa,CAEzC;IAED,WAAkB,cAAc,IAAI,MAAM,CAEzC;CACF"}
@@ -4,4 +4,5 @@ export * from './modules/lge/types';
4
4
  export * from './modules/referral/types';
5
5
  export * from './modules/discord/types';
6
6
  export * from './modules/sbt/types';
7
+ export * from './modules/vltz/types';
7
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC;AACrC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC"}
@@ -3,4 +3,5 @@ export * from './lge';
3
3
  export * from './referral';
4
4
  export * from './discord';
5
5
  export * from './sbt';
6
+ export * from './vltz';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["modules/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,OAAO,CAAC;AACtB,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,OAAO,CAAC;AACtB,cAAc,QAAQ,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { MethodParameters } from '@reyaxyz/common';
2
+ export declare const encodeMint: (owner: string, allocation: string, proof: string[], merkleRoot: string) => MethodParameters;
3
+ //# sourceMappingURL=encode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"encode.d.ts","sourceRoot":"/","sources":["modules/vltz/encode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AA+CnD,eAAO,MAAM,UAAU,UACd,MAAM,cACD,MAAM,SACX,MAAM,EAAE,cACH,MAAM,KACjB,gBAMF,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { RestClient } from '@reyaxyz/common';
2
+ import { VltzMintResult, VltzMintParams, VltzRoundInfoParams, VltzWalletInfoParams } from './types';
3
+ import { Loggable } from '@reyaxyz/common';
4
+ export default class VltzModule extends RestClient implements Loggable {
5
+ loggingEnabled: boolean;
6
+ constructor(apiUrl: string, loggingEnabled: boolean);
7
+ mint(params: VltzMintParams): Promise<VltzMintResult>;
8
+ getVltzRoundInfo(params: VltzRoundInfoParams): Promise<import("@reyaxyz/common").VltzRoundInfo>;
9
+ getVltzWalletInfo(params: VltzWalletInfoParams): Promise<import("@reyaxyz/common").VltzWalletInfo>;
10
+ }
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,21 @@
1
+ import { VltzRoundInfo, VltzWalletInfo } from '@reyaxyz/common';
2
+ import { Signer } from 'ethers';
3
+ export type VltzMintResult = {
4
+ transactionHash: string | null;
5
+ };
6
+ export type VltzMintParams = {
7
+ signer: Signer;
8
+ allocation: string;
9
+ merkleRoot: string;
10
+ merkleProof: string[];
11
+ };
12
+ export type VltzRoundInfoParams = {
13
+ id: string;
14
+ };
15
+ export type VltzRoundInfoResult = VltzRoundInfo;
16
+ export type VltzWalletInfoParams = {
17
+ address: string;
18
+ roundId: string;
19
+ };
20
+ export type VltzWalletInfoResult = VltzWalletInfo;
21
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["modules/vltz/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,MAAM,MAAM,cAAc,GAAG;IAC3B,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC,CAAC;AACF,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,aAAa,CAAC;AAEhD,MAAM,MAAM,oBAAoB,GAAG;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reyaxyz/community-sdk",
3
- "version": "0.52.19",
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.2",
14
- "@reyaxyz/sdk": "0.136.2",
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": "04a3f263ee78406901b93edddf4b13231ba4bfe0"
41
+ "gitHead": "42855f33c34008f82ca46eee5e152cd09e37a1da"
42
42
  }
@@ -4,6 +4,7 @@ import LGEModule from '../modules/lge';
4
4
  import SbtModule from '../modules/sbt';
5
5
  import ReferralModule from '../modules/referral';
6
6
  import DiscordModule from '../modules/discord';
7
+ import VltzModule from '../modules/vltz';
7
8
 
8
9
  /**
9
10
  * @description Client for Community SDK, used to interact with the Reya community.
@@ -14,6 +15,7 @@ export class CommunityClient {
14
15
 
15
16
  private readonly _voteModule: VoteModule;
16
17
  private readonly _sbtModule: SbtModule;
18
+ private readonly _vltzModule: VltzModule;
17
19
  private readonly _lgeModule: LGEModule;
18
20
  private readonly _referralModule: ReferralModule;
19
21
  private readonly _discordModule: DiscordModule;
@@ -27,6 +29,10 @@ export class CommunityClient {
27
29
  CommunityClient.config.apiEndpoint,
28
30
  CommunityClient.config.logging,
29
31
  );
32
+ this._vltzModule = new VltzModule(
33
+ CommunityClient.config.apiEndpoint,
34
+ CommunityClient.config.logging,
35
+ );
30
36
  this._lgeModule = new LGEModule(
31
37
  CommunityClient.config.apiEndpoint,
32
38
  CommunityClient.config.logging,
@@ -77,6 +83,17 @@ export class CommunityClient {
77
83
  return CommunityClient.getInstance()._sbtModule;
78
84
  }
79
85
 
86
+ /**
87
+ * Provides access to the VltzModule instance.
88
+ * This getter allows for interacting with vote-related functionalities.
89
+ *
90
+ * @returns {VltzModule} An instance of VltzModule for vote operations.
91
+ * @memberof CommunityClient
92
+ */
93
+ public static get vltz(): VltzModule {
94
+ return CommunityClient.getInstance()._vltzModule;
95
+ }
96
+
80
97
  /**
81
98
  * Provides access to the LGEModule instance.
82
99
  * This getter allows for interacting with LGE-related functionalities.
package/src/index.ts CHANGED
@@ -4,3 +4,4 @@ export * from './modules/lge/types';
4
4
  export * from './modules/referral/types';
5
5
  export * from './modules/discord/types';
6
6
  export * from './modules/sbt/types';
7
+ export * from './modules/vltz/types';
@@ -3,3 +3,4 @@ export * from './lge';
3
3
  export * from './referral';
4
4
  export * from './discord';
5
5
  export * from './sbt';
6
+ export * from './vltz';
@@ -0,0 +1,59 @@
1
+ import { MethodParameters } from '@reyaxyz/common';
2
+ import { Interface } from 'ethers';
3
+
4
+ const abi = [
5
+ {
6
+ type: 'function',
7
+ name: 'mint',
8
+ inputs: [
9
+ {
10
+ name: 'leafInfo',
11
+ type: 'tuple',
12
+ internalType: 'struct LeafInfo',
13
+ components: [
14
+ {
15
+ name: 'owner',
16
+ type: 'address',
17
+ internalType: 'address',
18
+ },
19
+ {
20
+ name: 'allocation',
21
+ type: 'uint256',
22
+ internalType: 'uint256',
23
+ },
24
+ ],
25
+ },
26
+ {
27
+ name: 'proof',
28
+ type: 'bytes32[]',
29
+ internalType: 'bytes32[]',
30
+ },
31
+ {
32
+ name: 'merkleRoot',
33
+ type: 'bytes32',
34
+ internalType: 'bytes32',
35
+ },
36
+ ],
37
+ outputs: [
38
+ {
39
+ name: '',
40
+ type: 'uint256',
41
+ internalType: 'uint256',
42
+ },
43
+ ],
44
+ stateMutability: 'nonpayable',
45
+ },
46
+ ];
47
+
48
+ export const encodeMint = (
49
+ owner: string,
50
+ allocation: string,
51
+ proof: string[],
52
+ merkleRoot: string,
53
+ ): MethodParameters => {
54
+ const functionSignature = 'mint';
55
+ const parameters = [{ owner, allocation }, proof, merkleRoot];
56
+ const INTERFACE = new Interface(abi);
57
+ const calldata = INTERFACE.encodeFunctionData(functionSignature, parameters);
58
+ return { calldata: calldata, value: BigInt(0).toString(10) };
59
+ };
@@ -0,0 +1,77 @@
1
+ import {
2
+ executeTransaction,
3
+ MoneyInOutChainId,
4
+ RestClient,
5
+ scale,
6
+ VLTZ_MINTING_DETAILS,
7
+ } from '@reyaxyz/common';
8
+ import {
9
+ VltzMintResult,
10
+ VltzMintParams,
11
+ VltzRoundInfoResult,
12
+ VltzRoundInfoParams,
13
+ VltzWalletInfoParams,
14
+ VltzWalletInfoResult,
15
+ } from './types';
16
+ import { Logger, Loggable } from '@reyaxyz/common';
17
+ import { encodeMint } from './encode';
18
+
19
+ export default class VltzModule extends RestClient implements Loggable {
20
+ loggingEnabled: boolean = false;
21
+
22
+ constructor(apiUrl: string, loggingEnabled: boolean) {
23
+ super(apiUrl);
24
+ this.loggingEnabled = loggingEnabled;
25
+ }
26
+
27
+ // WRITE
28
+ @Logger('VltzModule.mint')
29
+ async mint(params: VltzMintParams): Promise<VltzMintResult> {
30
+ const network = await params.signer.provider?.getNetwork();
31
+ const chainId: MoneyInOutChainId = Number(network?.chainId);
32
+ const walletAddress = await params.signer.getAddress();
33
+
34
+ const scaledAllocation = scale(18)(Number(params.allocation)).toString();
35
+
36
+ if (
37
+ !(
38
+ chainId === MoneyInOutChainId.ethereumSepolia ||
39
+ chainId === MoneyInOutChainId.ethereumMainnet
40
+ )
41
+ ) {
42
+ throw new Error('Network not supported. Switch to Ethereum.');
43
+ }
44
+
45
+ const { calldata: data, value } = encodeMint(
46
+ walletAddress,
47
+ scaledAllocation,
48
+ params.merkleProof,
49
+ params.merkleRoot,
50
+ );
51
+
52
+ const result = await executeTransaction(
53
+ params.signer,
54
+ data,
55
+ value,
56
+ chainId,
57
+ VLTZ_MINTING_DETAILS[chainId].contractAddress,
58
+ );
59
+
60
+ return {
61
+ transactionHash: result?.hash || null,
62
+ };
63
+ }
64
+
65
+ // READ
66
+ @Logger('VltzModule.getVltzRoundInfo')
67
+ async getVltzRoundInfo(params: VltzRoundInfoParams) {
68
+ const uri = `/api/vltz/round/${params.id}`;
69
+ return await this.get<VltzRoundInfoResult>(uri);
70
+ }
71
+
72
+ @Logger('VltzModule.getVltzWalletInfo')
73
+ async getVltzWalletInfo(params: VltzWalletInfoParams) {
74
+ const uri = `/api/vltz/wallet/${params.address}/${params.roundId}`;
75
+ return await this.get<VltzWalletInfoResult>(uri);
76
+ }
77
+ }
@@ -0,0 +1,25 @@
1
+ import { VltzRoundInfo, VltzWalletInfo } from '@reyaxyz/common';
2
+ import { Signer } from 'ethers';
3
+
4
+ export type VltzMintResult = {
5
+ transactionHash: string | null;
6
+ };
7
+ export type VltzMintParams = {
8
+ signer: Signer;
9
+ allocation: string;
10
+ merkleRoot: string;
11
+ merkleProof: string[];
12
+ };
13
+
14
+ export type VltzRoundInfoParams = {
15
+ id: string;
16
+ };
17
+
18
+ export type VltzRoundInfoResult = VltzRoundInfo;
19
+
20
+ export type VltzWalletInfoParams = {
21
+ address: string;
22
+ roundId: string;
23
+ };
24
+
25
+ export type VltzWalletInfoResult = VltzWalletInfo;