@zlattice/lattice-js
Version:
Lattice blockchain TypeScript SDK with dual module support (CJS + ESM)
45 lines • 1.08 kB
JavaScript
import { Transaction } from "../../common/types/index.js";
class TransactionBuilder {
constructor(type) {
this.tx = 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;
}
}
export { TransactionBuilder };
//# sourceMappingURL=index.js.map