UNPKG

@zlattice/lattice-js

Version:

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

48 lines 1.22 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TransactionBuilder = void 0; const index_1 = require("../../common/types/index.js"); class TransactionBuilder { constructor(type) { this.tx = index_1.Transaction.default(); this.tx.type = type; } static builder(type) { return new TransactionBuilder(type); } setBlock(block) { this.tx.number = block.currentTBlockNumber + 1; this.tx.parentHash = block.currentTBlockHash; this.tx.daemonHash = block.currentDBlockHash; return this; } setOwner(owner) { this.tx.owner = owner; return this; } setLinker(linker) { this.tx.linker = linker; return this; } setAmount(amount) { this.tx.amount = amount; return this; } setJoule(joule) { this.tx.joule = joule; return this; } setPayload(payload) { this.tx.payload = payload; return this; } setCode(code) { this.tx.code = code; return this; } build() { return this.tx; } } exports.TransactionBuilder = TransactionBuilder; //# sourceMappingURL=index.js.map