From b9cdba8f4543d292e70393ffa044bd0ccb43c2bf Mon Sep 17 00:00:00 2001 From: polyprogrammist Date: Sun, 11 Feb 2024 12:49:23 -0500 Subject: [PATCH] Switch to @ton-community/tlb-parser and add one more Block cell to tests --- .github/workflows/jest.yml | 1 - package-lock.json | 4 ++-- src/astbuilder/fill_constructors.ts | 2 +- src/astbuilder/handle_field.ts | 2 +- src/astbuilder/handle_type.ts | 2 +- src/astbuilder/utils.ts | 2 +- src/main.ts | 4 ++-- test/tlbgen.spec.ts | 7 +++++++ 8 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.github/workflows/jest.yml b/.github/workflows/jest.yml index 76c9ab9..283c7fd 100644 --- a/.github/workflows/jest.yml +++ b/.github/workflows/jest.yml @@ -11,7 +11,6 @@ jobs: node-version: '20' - run: npm install - run: npm install -g ts-node - - run: sed -i 's/"+", "Type"/"#", "Type"/g' "node_modules/@igorivaniuk/tlb-parser/dist/ast/nodes.d.ts" - run: npm run build - run: ts-node generate_tests.ts - run: npm run test diff --git a/package-lock.json b/package-lock.json index a102bac..3593f42 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "@polyprogrammist_test/tlbgen", + "name": "@ton-community/tlb-codegen", "version": "1.0.13", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "@polyprogrammist_test/tlbgen", + "name": "@ton-community/tlb-codegen", "version": "1.0.13", "license": "ISC", "dependencies": { diff --git a/src/astbuilder/fill_constructors.ts b/src/astbuilder/fill_constructors.ts index 78440e2..23a4047 100644 --- a/src/astbuilder/fill_constructors.ts +++ b/src/astbuilder/fill_constructors.ts @@ -8,7 +8,7 @@ import { NameExpr, NegateExpr, NumberExpr, -} from "@igorivaniuk/tlb-parser/dist/ast/nodes"; +} from "@ton-community/tlb-parser/dist/ast/nodes"; import * as crc32 from "crc-32"; import { TLBBinaryOp, diff --git a/src/astbuilder/handle_field.ts b/src/astbuilder/handle_field.ts index 0ac9119..5e88e4f 100644 --- a/src/astbuilder/handle_field.ts +++ b/src/astbuilder/handle_field.ts @@ -11,7 +11,7 @@ import { FieldNamedDef, MathExpr, NameExpr, -} from "@igorivaniuk/tlb-parser/dist/ast/nodes"; +} from "@ton-community/tlb-parser/dist/ast/nodes"; import { TLBField } from "../ast"; import { getType } from "./handle_type"; import { TLBConstructorBuild, TLBTypeBuild } from "./utils"; diff --git a/src/astbuilder/handle_type.ts b/src/astbuilder/handle_type.ts index 94fe4c3..83d0b23 100644 --- a/src/astbuilder/handle_type.ts +++ b/src/astbuilder/handle_type.ts @@ -9,7 +9,7 @@ import { NegateExpr, NumberExpr, Expression as ParserExpression, -} from "@igorivaniuk/tlb-parser/dist/ast/nodes"; +} from "@ton-community/tlb-parser/dist/ast/nodes"; import { TLBBinaryOp, TLBFieldType, diff --git a/src/astbuilder/utils.ts b/src/astbuilder/utils.ts index 097e22d..1d530d5 100644 --- a/src/astbuilder/utils.ts +++ b/src/astbuilder/utils.ts @@ -5,7 +5,7 @@ import { NegateExpr, NumberExpr, SimpleExpr, -} from "@igorivaniuk/tlb-parser/dist/ast/nodes"; +} from "@ton-community/tlb-parser/dist/ast/nodes"; import { TLBBinaryOp, TLBConstructorTag, diff --git a/src/main.ts b/src/main.ts index 3105570..60f2f83 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,4 +1,4 @@ -import { Program } from "@igorivaniuk/tlb-parser/dist/ast/nodes"; +import { Program } from "@ton-community/tlb-parser/dist/ast/nodes"; import { TLBCode, TLBType } from "./ast"; import { TLBCodeBuild, @@ -10,7 +10,7 @@ import { CodeBuilder } from "./generators/CodeBuilder"; import { CodeGenerator, CommonGenDeclaration } from "./generators/generator"; import { TypescriptGenerator } from "./generators/typescript/generator"; -import { ast } from '@igorivaniuk/tlb-parser' +import { ast } from "@ton-community/tlb-parser"; import fs from 'fs' diff --git a/test/tlbgen.spec.ts b/test/tlbgen.spec.ts index 0f51b51..c04afde 100644 --- a/test/tlbgen.spec.ts +++ b/test/tlbgen.spec.ts @@ -519,5 +519,12 @@ describe('Generating tlb code', () => { // expect(deepEqual(cs.hash(), builder.endCell().hash())).toBeTruthy() checkSameOnStoreLoad(blk, loadBlock, storeBlock) + + const state2 = 'te6cckECEQEAAt0AJBAR71Wq////EQECAwQCoJvHqYcAAAAAgAECfjyTAAAAAQAAAAAAAAAAAAAAAABlyLWCAAAogZ67zMAAACiBnrvM0GBwTmIACCBSAiVwRAIlWR/EAAAABQAAAAAAAAAuBQYCEbjkjftFjQskhAcIKooETrjlNgwuHXtEbLkDiuPrh7ZsS5HcxL7sNQNLOzzxOJ8XpFaKmfMqRiqpTnODMFdkpeK+t1j9zpUGcLCGnyCbQQIcAhwJCiOJSjP2/QsLOJrSCYuSECQN4EQ1pAkI/Vq884HrhAXxgd/DMXKL3mNyX4QAmdB48ZNajadP6O+MetbFj9DF2crDtBqc+RNACwwNAJgAACiBnqyKhAIlcESQSl3z7iZHMb+ZzHB8UIicVmATlmlWML4cDjyK41AJDYwykU65Oj8VFycT567wJMI2c1Fp8XEpQ0oBBl7EszbpAJgAACiBnqyKigJ+PJIwkmdyOJaxAUgUAn96h7ctdbYa5ZqyLAxMr2CCCwI53+D63OzKxdebePB4BjmKCG0WpYdB4mhfQTshVEFholJiAiWCyjMIQaAjO2wWUZhB/mYlt0AIDg4ADQAQ7msoAAhojAEDTrjlNgwuHXtEbLkDiuPrh7ZsS5HcxL7sNQNLOzzxOJ8eUBr0CDsnKj+rfShCIEjNWz4L02mNMNBkMZ/Gt7d08wIcAB9ojAEDF6RWipnzKkYqqU5zgzBXZKXivrdY/c6VBnCwhp8gm0F20Jc6TiScBHS6NjRcwVkdaQJ0Gui4rsOnO0bOcbXHBAIcAB8oSAEBDImrgKWVyalum/bej1OHSpOS2UkgmMuIkBF7MzHXi7MAGChIAQEVd40DOrZ4FN5JCQjeUCvgm+Lo7v7TK7JOTt/GFqoW0AAZKEgBARILJG1IfD7ez2RrP8gh/dsLILjLke5aI27M3MaDIy1bABgCASAPEAATvgAAA7yRYnrqkAATv////7yLlvycUBOzqtE='; + const cs2 = Cell.fromBase64(state2); + + let blk2 = loadBlock(cs2.beginParse()); + + checkSameOnStoreLoad(blk2, loadBlock, storeBlock) }) })