Created
November 6, 2025 09:21
-
-
Save ilyar/7a13c637a492ea3653791e0aa3730820 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // npx ts-node hex-to-boc.ts | |
| import { BitReader, BitString, Builder, Slice } from "@ton/core"; | |
| async function main() { | |
| const data = Buffer.from('000000000000000000000000000000000000000000000000000000000000002a', 'hex'); | |
| const bs = new BitString(data, 0, data.length * 8); | |
| const r = new BitReader(bs); | |
| const s = new Slice(r, []); | |
| const b = new Builder(); | |
| const c = b.storeSlice(s).endCell(); | |
| console.log(c.toBoc().toString('base64')); | |
| } | |
| main().catch((error) => { | |
| if (error instanceof Error) { | |
| console.log(error.message); | |
| console.log(error.stack); | |
| } else { | |
| console.log('Unknown error:', error); | |
| } | |
| process.exit(1); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment