{"_id":"@bbuilders/djeon402-core","_rev":"6-399edf5a3a563e569fe3d6f9ac7e1034","name":"@bbuilders/djeon402-core","dist-tags":{"latest":"2.1.0"},"versions":{"1.0.1":{"name":"@bbuilders/djeon402-core","version":"1.0.1","_id":"@bbuilders/djeon402-core@1.0.1","maintainers":[{"name":"b-builders","email":"dev@bbuilders.xyz"}],"dist":{"shasum":"294d4868997ec5ac68e938a9f673f9954d1895f9","tarball":"https://registry.npmjs.org/@bbuilders/djeon402-core/-/djeon402-core-1.0.1.tgz","fileCount":8,"integrity":"sha512-xoExd60YfSL/W5fApVICCFCDICeEqqQGCtqLcfv6BmeBmF3NAQo0LJLW6C6IjHRAF3DdMCES12NVJ/wnWNypHg==","signatures":[{"sig":"MEYCIQDfAXjyetZFOMCPc6hnPKy+QO1cFbs9x0urEd1T/imQNwIhAKRuQcRqCkhelfFPc49J/0L7OO9nxrJefsngcbzD65iA","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":167881},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"dev":"tsup --watch","build":"tsup","clean":"rm -rf dist","typecheck":"tsc --noEmit"},"_npmUser":{"name":"b-builders","email":"dev@bbuilders.xyz"},"_npmVersion":"11.3.0","description":"Core types and utilities for DJEON402 SDK","directories":{},"_nodeVersion":"24.2.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","viem":"^2.0.0","typescript":"^5.0.0"},"peerDependencies":{"viem":"^2.0.0"},"_npmOperationalInternal":{"tmp":"tmp/djeon402-core_1.0.1_1775536634187_0.42932468555643544","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@bbuilders/djeon402-core","version":"1.0.2","_id":"@bbuilders/djeon402-core@1.0.2","maintainers":[{"name":"b-builders","email":"dev@bbuilders.xyz"}],"dist":{"shasum":"a2b81e5b6065ecfc8d4454c7699d6f60afce5515","tarball":"https://registry.npmjs.org/@bbuilders/djeon402-core/-/djeon402-core-1.0.2.tgz","fileCount":8,"integrity":"sha512-dzWHX5UqM0aiTT0ZS4A+WVCKzXBiQE4IQGGTh+iATgvfaBQ6Ebbwn2dQCFQwJ9fWLs4F32KFcapjY8oYkvOFRg==","signatures":[{"sig":"MEUCIHyYExhts7SVknoApzkhtuHv9fzXEBazjvQO8e9w8eyEAiEA3aBSvdy/ADTjSkyTH+OYnKRA4QD8SJtA+G0/EPesHzQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":167934},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"dev":"tsup --watch","build":"tsup","clean":"rm -rf dist","typecheck":"tsc --noEmit"},"_npmUser":{"name":"b-builders","email":"dev@bbuilders.xyz"},"_npmVersion":"11.3.0","description":"Core types and utilities for DJEON402 SDK","directories":{},"_nodeVersion":"24.2.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","viem":"^2.0.0","typescript":"^5.0.0"},"peerDependencies":{"viem":"^2.0.0"},"_npmOperationalInternal":{"tmp":"tmp/djeon402-core_1.0.2_1775537769674_0.4858171378094893","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@bbuilders/djeon402-core","version":"1.0.3","_id":"@bbuilders/djeon402-core@1.0.3","maintainers":[{"name":"b-builders","email":"dev@bbuilders.xyz"}],"dist":{"shasum":"c967277fa8e16847008632ce6c0e89631a2d6ae4","tarball":"https://registry.npmjs.org/@bbuilders/djeon402-core/-/djeon402-core-1.0.3.tgz","fileCount":8,"integrity":"sha512-tepS7HYvyvxoet8dPwA/ZxHAJRvyJmG058QBaSVwoXVka4uE9o8HHUtI4OIPnovQk7lxhg47IJc8ZJnvqueSlw==","signatures":[{"sig":"MEUCIHH/ulWPa3hDfvzpatoNv36X+bkPWp+5Y0VwcYIYEfY7AiEApdhLr0ji0dUZ1pksgycTpRA6hvacGls1oB21jyaTFwk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":167934},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"dev":"tsup --watch","build":"tsup","clean":"rm -rf dist","typecheck":"tsc --noEmit"},"_npmUser":{"name":"b-builders","email":"dev@bbuilders.xyz"},"_npmVersion":"11.3.0","description":"Core types and utilities for DJEON402 SDK","directories":{},"_nodeVersion":"24.2.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","viem":"^2.0.0","typescript":"^5.0.0"},"peerDependencies":{"viem":"^2.0.0"},"_npmOperationalInternal":{"tmp":"tmp/djeon402-core_1.0.3_1775540867295_0.27689005297120173","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@bbuilders/djeon402-core","version":"1.0.4","_id":"@bbuilders/djeon402-core@1.0.4","maintainers":[{"name":"b-builders","email":"dev@bbuilders.xyz"}],"dist":{"shasum":"5c5b83fdade76385e97cc762f8610027e9031687","tarball":"https://registry.npmjs.org/@bbuilders/djeon402-core/-/djeon402-core-1.0.4.tgz","fileCount":8,"integrity":"sha512-1qJZibZZjci26pVzfP6WAPodw/hFFZ4vrx227HK7X8VQfdnL95knIsWg5R/XNKRArerYrBikiS76CP4NrlUiyw==","signatures":[{"sig":"MEQCHw2pB9eEaZt0uK1Vtv5X+mjdgt4Ej2WfpI9tAiGfCgwCIQDVoyrIykL5WD0YaIHc+jrDkzgRy+DUul/JUs9xpHWgtA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":175172},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"dev":"tsup --watch","build":"tsup","clean":"rm -rf dist","typecheck":"tsc --noEmit"},"_npmUser":{"name":"b-builders","email":"dev@bbuilders.xyz"},"_npmVersion":"11.3.0","description":"Core types and utilities for DJEON402 SDK","directories":{},"_nodeVersion":"24.2.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","viem":"^2.0.0","typescript":"^5.0.0"},"peerDependencies":{"viem":"^2.0.0"},"_npmOperationalInternal":{"tmp":"tmp/djeon402-core_1.0.4_1775560978317_0.21530979572315","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@bbuilders/djeon402-core","version":"2.0.0","_id":"@bbuilders/djeon402-core@2.0.0","maintainers":[{"name":"b-builders","email":"dev@bbuilders.xyz"}],"dist":{"shasum":"04f8c07022f880e72db5c63b26ebb17e21be47cb","tarball":"https://registry.npmjs.org/@bbuilders/djeon402-core/-/djeon402-core-2.0.0.tgz","fileCount":8,"integrity":"sha512-nNi+8Nd/gUtwNjM2swqmWOVFfpYxyEwuKKJ4Edh+zLo51EadyF5OEGx6ioeaJBGVTL0EvQKQILmrlzndRuyqTw==","signatures":[{"sig":"MEUCIFD5GTLs8cOjgV2UTvQ+Zqum6a0Yb7gom/dvmYXmTSBLAiEA5Uk3F0hdRmCXShKdwq2S4IJqiQn2wPAfxS/dwp/Oulg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":177274},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"dev":"tsup --watch","build":"tsup","clean":"rm -rf dist","typecheck":"tsc --noEmit"},"_npmUser":{"name":"b-builders","email":"dev@bbuilders.xyz"},"_npmVersion":"11.3.0","description":"Core types and utilities for DJEON402 SDK","directories":{},"_nodeVersion":"24.2.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","viem":"^2.0.0","typescript":"^5.0.0"},"peerDependencies":{"viem":"^2.0.0"},"_npmOperationalInternal":{"tmp":"tmp/djeon402-core_2.0.0_1784531193238_0.22607715604169298","host":"s3://npm-registry-packages-npm-production"}},"2.1.0":{"name":"@bbuilders/djeon402-core","version":"2.1.0","description":"Core types and utilities for DJEON402 SDK","type":"module","main":"./dist/index.cjs","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"build":"tsup","dev":"tsup --watch","typecheck":"tsc --noEmit","clean":"rm -rf dist"},"peerDependencies":{"viem":"^2.0.0"},"devDependencies":{"tsup":"^8.0.0","typescript":"^5.0.0","viem":"^2.0.0"},"publishConfig":{"registry":"https://registry.npmjs.org","access":"public"},"_id":"@bbuilders/djeon402-core@2.1.0","_nodeVersion":"24.2.0","_npmVersion":"11.3.0","dist":{"integrity":"sha512-kBaZeLyRvQN3illHrxZvp66zlI7EgHKXtG4SJcijYLFEqxkWdkme9300B+lnl/+hV7YqECQ6dfcqxXpvcDDghQ==","shasum":"f8c3b8b7955e0859bfa30272d2d019a430bc149e","tarball":"https://registry.npmjs.org/@bbuilders/djeon402-core/-/djeon402-core-2.1.0.tgz","fileCount":8,"unpackedSize":205298,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCsR7PTYVaGi13utF7ZEh0uXAtPg8cYFA4xIYWTXeYktwIhAMwwn1qaeviA51r7cSO0PiVgpyn68vG8p2TiFgQT6g8/"}]},"_npmUser":{"name":"b-builders","email":"dev@bbuilders.xyz"},"directories":{},"maintainers":[{"name":"b-builders","email":"dev@bbuilders.xyz"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/djeon402-core_2.1.0_1784988103309_0.539678137905004"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-07T04:37:14.079Z","modified":"2026-07-25T14:01:43.645Z","1.0.1":"2026-04-07T04:37:14.342Z","1.0.2":"2026-04-07T04:56:09.824Z","1.0.3":"2026-04-07T05:47:47.436Z","1.0.4":"2026-04-07T11:22:58.475Z","2.0.0":"2026-07-20T07:06:33.394Z","2.1.0":"2026-07-25T14:01:43.462Z"},"description":"Core types and utilities for DJEON402 SDK","maintainers":[{"name":"b-builders","email":"dev@bbuilders.xyz"}],"readme":"# @bbuilders/djeon402-core\n\nCore types, ABIs, constants, and utilities for the DJEON402 token ecosystem.\n\n## What's New in 2.0\n\n**Breaking changes** (aligned with the on-chain token):\n\n- **Token decimals are 6** (USDC/x402 convention) — `DJEON402_DECIMALS` changed from `18` to `6`; `formatTokenAmount`/`parseTokenAmount` defaults follow\n- **`EIP712_DOMAIN_NAME` constant removed** — the EIP-712 domain name is the deploy-time token name; read it from the contract (`name()` / `DOMAIN_SEPARATOR()`)\n- `validateKYCLevel` now accepts levels 0-4 (Tier4 included)\n- `KYCVerifyParams` gained an optional `kycHash`; `RemainingDailyLimit` type documented as the canonical remaining-limit shape\n\n## Overview\n\nThis package provides the foundational building blocks shared across all DJEON402 SDK packages:\n\n- **TypeScript type definitions** for all contract interactions\n- **Smart contract ABIs** (DJEON402 token and KYC Registry)\n- **EIP-712 constants** for typed structured data signing\n- **Utility functions** for formatting, validation, and data transformation\n\nThis package is designed to be used as a dependency by other SDK packages (@bbuilders/djeon402-sdk-node, @bbuilders/djeon402-sdk-client) and is not typically installed directly by end users.\n\n## Units & Decimals\n\nThe DJEON402 token uses **6 decimals** (USDC/x402 convention): `$1 = 1_000_000` base units.\n\n- `DJEON402_DECIMALS = 6` is exported from this package and used as the default by `formatTokenAmount` / `parseTokenAmount`\n- All on-chain amounts (transfers, registry limits, x402 `amount` fields) are 6-decimal base-unit values\n- x402 v2 payment requirements carry amounts **already in base units** — never run them through `parseTokenAmount` again\n\n## Installation\n\n```bash\nnpm install @bbuilders/djeon402-core\n```\n\n## Package Contents\n\n### ABIs\n\nContract Application Binary Interfaces for interacting with DJEON402 smart contracts:\n\n```typescript\nimport { DJEON402_ABI, KYC_REGISTRY_ABI } from '@bbuilders/djeon402-core';\n```\n\n- `DJEON402_ABI` - ERC-20 token contract with x402, KYC, admin features\n- `KYC_REGISTRY_ABI` - KYC registry contract for user verification\n\n### Types\n\nComprehensive TypeScript type definitions:\n\n#### Token Types\n```typescript\ninterface TokenInfo {\n  name: string;\n  symbol: string;\n  decimals: number;\n  totalSupply: string;\n  totalSupplyRaw: string;\n  paused: boolean;\n  contractAddress: Address;\n}\n\ninterface BalanceResult {\n  address: Address;\n  balance: string;\n  balanceRaw: string;\n}\n\ninterface TransferResult {\n  success: boolean;\n  hash: Hash;\n  blockNumber: string;\n}\n```\n\n#### Admin Types\n```typescript\ninterface RolesResult {\n  DEFAULT_ADMIN_ROLE: Hex;\n  MINTER_ROLE: Hex;\n  BURNER_ROLE: Hex;\n  PAUSER_ROLE: Hex;\n  BLACKLISTER_ROLE: Hex;\n}\n\ninterface BlacklistResult {\n  address: Address;\n  isBlacklisted: boolean;\n}\n```\n\n#### KYC Types\n```typescript\ntype KYCLevel = 0 | 1 | 2 | 3 | 4;\ntype KYCLevelName = 'None' | 'Tier1' | 'Tier2' | 'Tier3' | 'Tier4';\n\ninterface KYCData {\n  level: KYCLevel;\n  levelName: KYCLevelName;\n  expiryDate: number;\n  expiryDateReadable: string; // ISO string, or \"No Expiry\" when expiryDate is 0\n  kycHash: string;\n  isActive: boolean;\n  dailyLimit: string;\n  dailyLimitRaw: string;\n  dailySpent: string;\n  dailySpentRaw: string;\n  userAddress: Address;\n}\n\ninterface KYCVerifyParams {\n  adminPrivateKey: `0x${string}`;\n  userAddress: Address;\n  level: KYCLevel;\n  expiryDate?: number;\n  documents: KYCDocument[];\n  kycHash?: string; // IPFS hash; derived deterministically from documents when omitted\n}\n\ninterface RemainingDailyLimit {\n  remaining: string;      // human-readable (6 decimals)\n  remainingRaw: string;   // base units\n  userAddress: Address;\n}\n```\n\n#### x402 Types (EIP-3009)\n```typescript\ninterface TransferAuthorizationSignature {\n  from: Address;\n  to: Address;\n  value: bigint;\n  validAfter: bigint;\n  validBefore: bigint;\n  nonce: Hex;\n  v: number;\n  r: Hex;\n  s: Hex;\n}\n\ninterface ReceiveAuthorizationSignature {\n  from: Address;\n  to: Address;\n  value: bigint;\n  validAfter: bigint;\n  validBefore: bigint;\n  nonce: Hex;\n  v: number;\n  r: Hex;\n  s: Hex;\n}\n\ninterface SignTransferAuthParams {\n  privateKey: `0x${string}`;\n  from: Address;\n  to: Address;\n  amount: string;\n  validAfter?: bigint;\n  validBefore?: bigint;\n  nonce?: Hex;\n}\n\ninterface SignReceiveAuthParams {\n  privateKey: `0x${string}`;\n  from: Address;\n  to: Address;\n  amount: string;\n  validAfter?: bigint;\n  validBefore?: bigint;\n  nonce?: Hex;\n}\n\ninterface CancelAuthorizationParams {\n  privateKey: `0x${string}`;\n  authorizer: Address;\n  nonce: Hex;\n}\n\ninterface CancelAuthorizationResult {\n  success: boolean;\n  hash: Hash;\n  blockNumber: string;\n}\n```\n\n### Constants\n\n```typescript\nimport {\n  DJEON402_DECIMALS, // 6 (USDC/x402 convention)\n  EIP712_DOMAIN_VERSION, // \"1\"\n  TRANSFER_WITH_AUTHORIZATION_TYPEHASH,\n  RECEIVE_WITH_AUTHORIZATION_TYPEHASH,\n  CANCEL_AUTHORIZATION_TYPEHASH,\n  DEFAULT_VALID_AFTER,\n  DEFAULT_VALID_BEFORE,\n} from '@bbuilders/djeon402-core';\n```\n\n> **Note:** There is intentionally no `EIP712_DOMAIN_NAME` constant. The EIP-712\n> domain name is the token name chosen at deploy time — always read it from the\n> contract (`name()` or `DOMAIN_SEPARATOR()`). The SDK signing paths do this\n> automatically.\n\n### Utilities\n\nHelper functions for formatting and validation:\n\n#### Formatting\n```typescript\nimport {\n  formatTokenAmount,\n  parseTokenAmount,\n  formatTimestamp,\n  getKYCLevelName,\n} from '@bbuilders/djeon402-core';\n\n// Format raw token amount to human-readable string (decimals default: 6)\nconst formatted = formatTokenAmount(1000000n); // \"1\"\n\n// Parse human-readable amount to raw bigint (decimals default: 6)\nconst raw = parseTokenAmount('1.5'); // 1500000n\n\n// Format UNIX timestamp to readable date (0 => \"No Expiry\")\nconst date = formatTimestamp(1735632000); // \"2024-12-31T00:00:00.000Z\"\n\n// Get KYC level name\nconst levelName = getKYCLevelName(2); // \"Tier2\"\n```\n\n#### Validation\n```typescript\nimport {\n  validateAddress,\n  validatePrivateKey,\n  validateAmount,\n  validateKYCLevel, // accepts 0-4 (None, Tier1-Tier4)\n} from '@bbuilders/djeon402-core';\n\n// Validate Ethereum address\nvalidateAddress('0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb'); // throws if invalid\n\n// Validate private key format\nvalidatePrivateKey('0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80');\n\n// Validate amount string\nvalidateAmount('100.5'); // throws if invalid\n```\n\n## Usage in SDK Packages\n\nThis package is designed to be imported by other SDK packages:\n\n```typescript\n// In @bbuilders/djeon402-sdk-node\nimport {\n  DJEON402_ABI,\n  type TokenInfo,\n  type TransferResult,\n  formatTokenAmount,\n  validateAddress,\n} from '@bbuilders/djeon402-core';\n```\n\n## License\n\nMIT\n\n## Related Packages\n\n- [@bbuilders/djeon402-contracts](https://www.npmjs.com/package/@bbuilders/djeon402-contracts) - Smart Contracts (Solidity / Foundry)\n- [@bbuilders/djeon402-sdk-node](https://www.npmjs.com/package/@bbuilders/djeon402-sdk-node) - Node.js/Backend SDK\n- [@bbuilders/djeon402-sdk-client](https://www.npmjs.com/package/@bbuilders/djeon402-sdk-client) - Browser/Frontend SDK\n","readmeFilename":"README.md"}