
Security News
PEP 810 Proposes Explicit Lazy Imports for Python 3.15
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
@ton-community/tlb-runtime
Advanced tools
TL‑B Runtime is a library for parsing and (de)serializing data according to TL‑B schemas
TL‑B Runtime is a library for parsing and (de)serializing data according to TL‑B schemas, enabling programmatic work with binary structures and Cell & Bag of Cells (BoC)
npm install @ton-community/tlb-runtime
import { parseTLB } from '@ton-community/tlb-runtime';
interface Data {
kind: 'Foo';
x: number;
}
// language=tlb
const runtime = parseTLB<Data>('_ x:# = Foo;')
const pack = runtime.serialize({
kind: 'Foo',
x: 73,
})
if (pack.success) {
console.log({ pack: pack.value.endCell().toBoc().toString('base64')});
} else {
console.error(pack.error.message);
}
// { pack: 'te6cckEBAQEABgAACAAAAEmTxmY2' }
const unpack = runtime.deserialize('te6cckEBAQEABgAACAAAACoFpvBE')
if (unpack.success) {
console.log({ unpack: unpack.value});
} else {
console.error(unpack.error.message);
}
// { unpack: { kind: 'Foo', x: 42 } }
import { parseTLB } from '@ton-community/tlb-runtime';
// language=tlb
const schema = `nothing$0 {X:Type} = Maybe X;
just$1 {X:Type} value:X = Maybe X;
var_uint$_ {n:#} len:(#< n) value:(uint (len * 8)) = VarUInteger n;
addr_none$00 = MsgAddressExt;
addr_extern$01 len:(## 9) external_address:(bits len) = MsgAddressExt;
anycast_info$_ depth:(#<= 30) { depth >= 1 } rewrite_pfx:(bits depth) = Anycast;
addr_std$10 anycast:(Maybe Anycast) workchain_id:int8 address:bits256 = MsgAddressInt;
addr_var$11 anycast:(Maybe Anycast) addr_len:(## 9) workchain_id:int32 address:(bits addr_len) = MsgAddressInt;
_ _:MsgAddressInt = MsgAddress;
_ _:MsgAddressExt = MsgAddress;
burn#595f07bc
query_id:uint64
amount:(VarUInteger 16)
response_destination:MsgAddress
custom_payload:(Maybe ^Cell)
= InternalMsgBody;`
const runtime = parseTLB(schema)
const pack = runtime.serialize({
kind: 'InternalMsgBody',
query_id: 0,
amount: 1n,
response_destination: 'Ef8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAU',
custom_payload: { kind: 'Maybe_nothing' }
})
if (pack.success) {
console.log(pack.value.endCell().toBoc().toString('base64'));
} else {
console.error(pack.error.message);
}
// te6cckEBAQEAMQAAXllfB7wAAAAAAAAAABAZ/gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA8gPSJw==
const unpack = runtime.deserialize('te6cckEBAQEAMQAAXllfB7wAAAAAAAAAABKp/gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA4/EP1Q==')
if (unpack.success) {
console.log(unpack.value);
} else {
console.error(unpack.error.message);
}
// { kind: 'InternalMsgBody', query_id: 0n, amount: 42n, response_destination: Ef8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAU, custom_payload: { kind: 'Maybe_nothing' } }
yarn install
yarn build
yarn test
yarn lint
yarn lint:fix
yarn install --frozen-lockfile && yarn build && npm publish --tag=alpha --try-run
FAQs
TL‑B Runtime is a library for parsing and (de)serializing data according to TL‑B schemas
The npm package @ton-community/tlb-runtime receives a total of 37 weekly downloads. As such, @ton-community/tlb-runtime popularity was classified as not popular.
We found that @ton-community/tlb-runtime demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
Security News
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.