Skip to content

Commit

Permalink
fix code serialization issue
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelmanzanera committed Dec 20, 2024
1 parent 4a26cef commit d4420d7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/transaction_builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ export default class TransactionBuilder {
intToUint32Array(VERSION),
this.address,
Uint8Array.from([getTransactionTypeId(this.type)]),
intToUint32Array(0), // Default code size
bufContract,
bufContentSize,
new TextEncoder().encode(this.data.content),
Expand Down
4 changes: 3 additions & 1 deletion tests/transaction_builder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe("Transaction builder", () => {
it("should insert the code into the transaction data", () => {
const contract = new Contract(new Uint8Array(), { abi: {state: {}, functions: {}}})
const tx = new TransactionBuilder("transfer").setContract(contract)
expect(tx.data.contract?.bytecode).toStrictEqual(contract);
expect(tx.data.contract?.bytecode).toStrictEqual(contract.bytecode);
});
});

Expand Down Expand Up @@ -192,6 +192,7 @@ describe("Transaction builder", () => {
intToUint32Array(VERSION),
tx.address,
Uint8Array.from([253]),
intToUint32Array(0), // Default code size
//Contract bytecode size
intToUint32Array(contract.bytecode.length),
contract.bytecode,
Expand Down Expand Up @@ -272,6 +273,7 @@ describe("Transaction builder", () => {
intToUint32Array(VERSION),
tx.address,
Uint8Array.from([253]),
intToUint32Array(0), // Default code size
//Contract size
intToUint32Array(0),
//Content size
Expand Down

0 comments on commit d4420d7

Please sign in to comment.