@explorins/web3-types
v1.0.3
Published
Shared TypeScript types and constants for the eXplorins Web3 ecosystem
Readme
@explorins/web3-types
Shared TypeScript types and constants for the eXplorins Web3 ecosystem.
Features
- ✅ Minimal bundle: ~1-2KB, zero runtime dependencies
- ✅ Type-safe: Full TypeScript support with strict types
- ✅ Tree-shakeable:
sideEffects: falsefor optimal bundling - ✅ Standards-compliant: Follows official EIP specifications
- ✅ Single source of truth: Used across all eXplorins Web3 packages
Installation
npm install @explorins/web3-typesUsage
Import Transaction Types
import {
TRANSACTION_FORMATS,
type TransactionFormat,
type LegacyTransaction,
type EIP1559Transaction,
type EIP712SignedTransactionData
} from '@explorins/web3-types';
// Use constants
const format = TRANSACTION_FORMATS.EIP_1559;
// Type-safe transaction
const tx: EIP1559Transaction = {
chainId: 137,
from: '0x...',
to: '0x...',
value: '1000000000000000000',
data: '0x',
gas: '21000',
nonce: 0,
format: TRANSACTION_FORMATS.EIP_1559,
maxFeePerGas: '30000000000',
maxPriorityFeePerGas: '2000000000',
type: 2
};Import Specific Modules
// Just transaction formats
import { TRANSACTION_FORMATS } from '@explorins/web3-types/transaction-formats';
// Just transaction types
import type { LegacyTransaction } from '@explorins/web3-types/transaction';Exported Types
Transaction Formats
TRANSACTION_FORMATS- Constant object with format valuesTRANSACTION_FORMAT_DESCRIPTIONS- Human-readable descriptionsTransactionFormat- Union type of all formats
Transaction Types
BaseTransaction- Common fields for all transactionsLegacyTransaction- Type 0 (gasPrice)EIP2930Transaction- Type 1 (accessList)EIP1559Transaction- Type 2 (fee market)EIP712TransactionData- Meta-transaction formatEIP712SignedTransactionData- Signed transaction dataCounterfactualWalletEIP712Data- Smart wallet typed dataAnyTransactionData- Union of all transaction types
Bundle Size
The entire package is ~1-2KB gzipped. With tree-shaking, you only bundle what you import.
Used By
@explorins/web3-ts- Full Web3 implementation librarypers-shared- PERS loyalty platform shared contracts- Other eXplorins Web3 packages
License
MIT © eXplorins
