Skip to content

Commit

Permalink
add inclusion and order test
Browse files Browse the repository at this point in the history
  • Loading branch information
arobsn committed Sep 16, 2024
1 parent b119f40 commit a7f4372
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion packages/core/src/builder/transactionBuilder.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -818,6 +818,19 @@ describe("Building", () => {
}
});

it("Should ensure inclusion and order or inputs", () => {
const transaction = new TransactionBuilder(height)
.from(regularBoxes)
.and.from(manyTokensBoxes, { ensureInclusion: true })
.sendChangeTo(a1.address)
.build();

expect(transaction.inputs).to.have.length(manyTokensBoxes.length);
for (let i = 0; i < transaction.inputs.length; i++) {
expect(transaction.inputs[i].boxId).to.be.equal(manyTokensBoxes[i].boxId);
}
});

it("Should produce multiple change boxes based on maxTokensPerChangeBox and isolate erg in a exclusive box ", () => {
const tokensPerBox = 3;

Expand Down Expand Up @@ -908,7 +921,7 @@ describe("Building", () => {

it("Should preserve inputs extension", () => {
const input = new ErgoUnsignedInput(regularBoxes[0]);
input.setContextVars({ 0: "0580c0fc82aa02" });
input.setContextExtension({ 0: "0580c0fc82aa02" });

const unsignedTransaction = new TransactionBuilder(height)
.from(regularBoxes[1])
Expand Down

0 comments on commit a7f4372

Please sign in to comment.