@asentum/types
v0.1.0
Published
Shared TypeScript types and SSZ schemas for AsentumChain. Accounts, transactions, blocks, headers.
Maintainers
Readme
@asentum/types
Shared TypeScript types and SSZ schemas for AsentumChain. Defines the canonical data shapes that the node, state, RPC, and SDK packages all agree on.
What's in here
- Primitives:
Uint256,Uint64,Hash,AddressSSZ schemas and constants (ADDRESS_BYTES,DILITHIUM3_PUBLIC_KEY_BYTES, etc.) - Accounts: the on-chain account state type (
balance,nonce,codeHash,storageRoot) - Transactions: EIP-1559-flavored transaction body + signing envelope, with Dilithium3 public key and signature fields
- Blocks: block header and block schemas
- Helpers:
emptyAccount(),emptyTransactionBody(),emptyBlockHeader()for tests and genesis
All schemas are defined using @chainsafe/ssz per decisions.md D17. Every type has both a runtime TypeScript shape and a canonical SSZ schema for deterministic encoding.
Usage
import {
AccountSchema,
emptyAccount,
TransactionBodySchema,
emptyTransactionBody,
BlockSchema,
emptyBlockHeader,
} from '@asentum/types';
// Create and serialize an account
const acct = { ...emptyAccount(), balance: 1_000_000_000_000_000_000n };
const bytes = AccountSchema.serialize(acct);
// Deserialize back
const restored = AccountSchema.deserialize(bytes);License
Apache License 2.0.
