diff --git a/src/bindings/typescript/writeStruct.ts b/src/bindings/typescript/writeStruct.ts index c5c0d00334..2e5f94327b 100644 --- a/src/bindings/typescript/writeStruct.ts +++ b/src/bindings/typescript/writeStruct.ts @@ -89,6 +89,7 @@ export function writeSerializer( s: ABIType, allocation: AllocationCell, w: Writer, + opcodesVar?: string, ) { w.append(`export function store${s.name}(src: ${s.name}) {`); w.inIndent(() => { @@ -96,7 +97,7 @@ export function writeSerializer( w.inIndent(() => { w.append(`const b_0 = builder;`); if (s.header) { - w.append(`b_0.storeUint(${s.header}, 32);`); + w.append(`b_0.storeUint(${opcodesVar!}.${s.name}, 32);`); } writeSerializerCell(0, allocation, w); }); diff --git a/src/bindings/writeTypescript.ts b/src/bindings/writeTypescript.ts index 25ccac4358..41a34337ed 100644 --- a/src/bindings/writeTypescript.ts +++ b/src/bindings/writeTypescript.ts @@ -152,7 +152,12 @@ export function writeTypescript( for (const s of abi.types) { writeStruct(s.name, s.fields, true, w); - writeSerializer(s, allocations[s.name]!.root, w); + writeSerializer( + s, + allocations[s.name]!.root, + w, + `${abi.name}_opcodes`, + ); writeParser(s, allocations[s.name]!.root, w); writeTupleParser(s, w); writeGetterTupleParser(s, w);