UNPKG

@zlattice/lattice-js

Version:

Lattice blockchain TypeScript SDK with dual module support (CJS + ESM)

109 lines 2.92 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ProposalContract = void 0; const types_1 = require("./types.js"); class ProposalContract { constructor() { this.iface = proposal.getLatticeInterface(); } async approve(proposalId) { return await this.iface.encodeFunctionData("vote", [proposalId, 1]); } async reject(proposalId) { return await this.iface.encodeFunctionData("vote", [proposalId, 0]); } async refresh(proposalId) { return await this.iface.encodeFunctionData("refresh", [proposalId]); } async refreshBatch(proposalIds) { return await this.iface.encodeFunctionData("batchRefresh", [proposalIds]); } async cancel(proposalId) { return await this.iface.encodeFunctionData("cancel", [proposalId]); } } exports.ProposalContract = ProposalContract; const proposal = new types_1.BuiltinContract("提案合约", "zltc_amgWuhifLRUoZc3GSbv9wUUz6YUfTuWy5", `[ { "inputs": [ { "internalType": "string", "name": "ProposalId", "type": "string" }, { "internalType": "uint8", "name": "VoteSuggestion", "type": "uint8" } ], "name": "vote", "outputs": [ { "internalType": "bytes", "name": "", "type": "bytes" } ], "stateMutability": "pure", "type": "function" }, { "inputs": [ { "internalType": "string", "name": "ProposalId", "type": "string" } ], "name": "refresh", "outputs": [ { "internalType": "bytes", "name": "", "type": "bytes" } ], "stateMutability": "pure", "type": "function" }, { "inputs": [ { "internalType": "string[]", "name": "proposalIds", "type": "string[]" } ], "name": "batchRefresh", "outputs": [ { "internalType": "bytes", "name": "", "type": "bytes" } ], "stateMutability": "pure", "type": "function" }, { "inputs": [ { "internalType": "string", "name": "proposalId", "type": "string" } ], "name": "cancel", "outputs": [ { "internalType": "bytes", "name": "", "type": "bytes" } ], "stateMutability": "pure", "type": "function" } ]`); //# sourceMappingURL=proposal.js.map