[{"data":1,"prerenderedAt":718},["ShallowReactive",2],{"navigation_docs":3,"-guide-registry":168,"-guide-registry-surround":713},[4,44],{"title":5,"path":6,"stem":7,"children":8,"icon":43},"Guide","\u002Fguide","1.guide\u002F01.index",[9,11,15,19,23,27,31,35,39],{"title":10,"path":6,"stem":7},"Getting Started",{"title":12,"path":13,"stem":14},"Registry and aliases","\u002Fguide\u002Fregistry","1.guide\u002F02.registry",{"title":16,"path":17,"stem":18},"Address validation","\u002Fguide\u002Fvalidation","1.guide\u002F03.validation",{"title":20,"path":21,"stem":22},"Identify","\u002Fguide\u002Fidentify","1.guide\u002F04.identify",{"title":24,"path":25,"stem":26},"Metadata","\u002Fguide\u002Fmetadata","1.guide\u002F05.metadata",{"title":28,"path":29,"stem":30},"CLI","\u002Fguide\u002Fcli","1.guide\u002F06.cli",{"title":32,"path":33,"stem":34},"Agents","\u002Fguide\u002Fagents","1.guide\u002F07.agents",{"title":36,"path":37,"stem":38},"Custom chains","\u002Fguide\u002Fcustom","1.guide\u002F08.custom",{"title":40,"path":41,"stem":42},"Playground","\u002Fguide\u002Fplayground","1.guide\u002F09.playground","i-lucide-book-open",{"title":45,"path":46,"stem":47,"children":48,"icon":167},"Chains","\u002Fchains","2.chains\u002F00.index",[49,51,55,59,63,67,71,75,79,83,87,91,95,99,103,107,111,115,119,123,127,131,135,139,143,147,151,155,159,163],{"title":50,"path":46,"stem":47},"Overview",{"title":52,"path":53,"stem":54},"Ethereum","\u002Fchains\u002Fethereum","2.chains\u002F01.ethereum",{"title":56,"path":57,"stem":58},"Base","\u002Fchains\u002Fbase","2.chains\u002F02.base",{"title":60,"path":61,"stem":62},"Arbitrum One","\u002Fchains\u002Farbitrum","2.chains\u002F03.arbitrum",{"title":64,"path":65,"stem":66},"Optimism","\u002Fchains\u002Foptimism","2.chains\u002F04.optimism",{"title":68,"path":69,"stem":70},"Polygon PoS","\u002Fchains\u002Fpolygon","2.chains\u002F05.polygon",{"title":72,"path":73,"stem":74},"BNB Chain","\u002Fchains\u002Fbsc","2.chains\u002F06.bsc",{"title":76,"path":77,"stem":78},"Avalanche C-Chain","\u002Fchains\u002Favalanche","2.chains\u002F07.avalanche",{"title":80,"path":81,"stem":82},"Fantom Opera","\u002Fchains\u002Ffantom","2.chains\u002F08.fantom",{"title":84,"path":85,"stem":86},"Gnosis Chain","\u002Fchains\u002Fgnosis","2.chains\u002F09.gnosis",{"title":88,"path":89,"stem":90},"Linea","\u002Fchains\u002Flinea","2.chains\u002F10.linea",{"title":92,"path":93,"stem":94},"zkSync Era","\u002Fchains\u002Fzksync","2.chains\u002F11.zksync",{"title":96,"path":97,"stem":98},"Scroll","\u002Fchains\u002Fscroll","2.chains\u002F12.scroll",{"title":100,"path":101,"stem":102},"Berachain","\u002Fchains\u002Fberachain","2.chains\u002F13.berachain",{"title":104,"path":105,"stem":106},"Bitcoin","\u002Fchains\u002Fbitcoin","2.chains\u002F14.bitcoin",{"title":108,"path":109,"stem":110},"Litecoin","\u002Fchains\u002Flitecoin","2.chains\u002F15.litecoin",{"title":112,"path":113,"stem":114},"Pepecoin","\u002Fchains\u002Fpepecoin","2.chains\u002F16.pepecoin",{"title":116,"path":117,"stem":118},"eCash","\u002Fchains\u002Fecash","2.chains\u002F17.ecash",{"title":120,"path":121,"stem":122},"Cardano","\u002Fchains\u002Fcardano","2.chains\u002F18.cardano",{"title":124,"path":125,"stem":126},"Solana","\u002Fchains\u002Fsolana","2.chains\u002F19.solana",{"title":128,"path":129,"stem":130},"Stellar","\u002Fchains\u002Fstellar","2.chains\u002F20.stellar",{"title":132,"path":133,"stem":134},"XRP Ledger","\u002Fchains\u002Fxrpl","2.chains\u002F21.xrpl",{"title":136,"path":137,"stem":138},"Aptos","\u002Fchains\u002Faptos","2.chains\u002F22.aptos",{"title":140,"path":141,"stem":142},"Sui","\u002Fchains\u002Fsui","2.chains\u002F23.sui",{"title":144,"path":145,"stem":146},"TON (The Open Network)","\u002Fchains\u002Fton","2.chains\u002F24.ton",{"title":148,"path":149,"stem":150},"TRON","\u002Fchains\u002Ftron","2.chains\u002F25.tron",{"title":152,"path":153,"stem":154},"Octra","\u002Fchains\u002Foctra","2.chains\u002F26.octra",{"title":156,"path":157,"stem":158},"Arweave","\u002Fchains\u002Farweave","2.chains\u002F27.arweave",{"title":160,"path":161,"stem":162},"Monero","\u002Fchains\u002Fmonero","2.chains\u002F28.monero",{"title":164,"path":165,"stem":166},"Decred","\u002Fchains\u002Fdecred","2.chains\u002F29.decred","i-lucide-link",{"id":169,"title":12,"body":170,"description":706,"extension":707,"links":708,"meta":709,"navigation":252,"path":13,"seo":711,"stem":14,"__hash__":712},"docs\u002F1.guide\u002F02.registry.md",{"type":171,"value":172,"toc":700},"minimark",[173,178,346,359,363,366,505,522,616,626,630,638,648,666,670,696],[174,175,177],"h2",{"id":176},"five-functions","Five functions",[179,180,185],"pre",{"className":181,"code":182,"language":183,"meta":184,"style":184},"language-ts shiki shiki-themes github-light github-light poimandres","import { chains, create, getChain, has, register } from \"@agntn\u002Fchains\";\n\nchains(); \u002F\u002F [\"ethereum\", \"base\", \"arbitrum\", ...] in registration order\nhas(\"solana\"); \u002F\u002F true\ncreate(\"solana\"); \u002F\u002F a fresh Solana instance\ngetChain(\"sol\"); \u002F\u002F the same class, by alias\nregister(MyChain); \u002F\u002F a class this package does not ship\n","ts","",[186,187,188,247,254,268,290,309,329],"code",{"__ignoreMap":184},[189,190,193,197,201,205,208,211,213,216,218,221,223,226,229,233,237,241,244],"span",{"class":191,"line":192},"line",1,[189,194,196],{"class":195},"sP0CR","import",[189,198,200],{"class":199},"sKlNE"," {",[189,202,204],{"class":203},"snHMy"," chains",[189,206,207],{"class":199},",",[189,209,210],{"class":203}," create",[189,212,207],{"class":199},[189,214,215],{"class":203}," getChain",[189,217,207],{"class":199},[189,219,220],{"class":203}," has",[189,222,207],{"class":199},[189,224,225],{"class":203}," register",[189,227,228],{"class":199}," }",[189,230,232],{"class":231},"stCPd"," from",[189,234,236],{"class":235},"scVjq"," \"",[189,238,240],{"class":239},"sQ7BG","@agntn\u002Fchains",[189,242,243],{"class":235},"\"",[189,245,246],{"class":199},";\n",[189,248,250],{"class":191,"line":249},2,[189,251,253],{"emptyLinePlaceholder":252},true,"\n",[189,255,257,261,264],{"class":191,"line":256},3,[189,258,260],{"class":259},"sULi6","chains",[189,262,263],{"class":199},"(); ",[189,265,267],{"class":266},"sjhu3","\u002F\u002F [\"ethereum\", \"base\", \"arbitrum\", ...] in registration order\n",[189,269,271,274,277,279,282,284,287],{"class":191,"line":270},4,[189,272,273],{"class":259},"has",[189,275,276],{"class":199},"(",[189,278,243],{"class":235},[189,280,281],{"class":239},"solana",[189,283,243],{"class":235},[189,285,286],{"class":199},"); ",[189,288,289],{"class":266},"\u002F\u002F true\n",[189,291,293,296,298,300,302,304,306],{"class":191,"line":292},5,[189,294,295],{"class":259},"create",[189,297,276],{"class":199},[189,299,243],{"class":235},[189,301,281],{"class":239},[189,303,243],{"class":235},[189,305,286],{"class":199},[189,307,308],{"class":266},"\u002F\u002F a fresh Solana instance\n",[189,310,312,315,317,319,322,324,326],{"class":191,"line":311},6,[189,313,314],{"class":259},"getChain",[189,316,276],{"class":199},[189,318,243],{"class":235},[189,320,321],{"class":239},"sol",[189,323,243],{"class":235},[189,325,286],{"class":199},[189,327,328],{"class":266},"\u002F\u002F the same class, by alias\n",[189,330,332,335,337,341,343],{"class":191,"line":331},7,[189,333,334],{"class":259},"register",[189,336,276],{"class":199},[189,338,340],{"class":339},"spVlQ","MyChain",[189,342,286],{"class":199},[189,344,345],{"class":266},"\u002F\u002F a class this package does not ship\n",[347,348,349,351,352,355,356,358],"p",{},[186,350,295],{}," takes a canonical key and throws ",[186,353,354],{},"UnknownChainError"," for anything else. ",[186,357,314],{}," is the forgiving one, and the one the CLI and the tools use.",[174,360,362],{"id":361},"what-getchain-accepts","What getChain accepts",[347,364,365],{},"Three spellings, tried in this order:",[367,368,369,398,493],"ol",{},[370,371,372,376,377,380,381,380,384,380,387,390,391,393,394,397],"li",{},[373,374,375],"strong",{},"The canonical key."," ",[186,378,379],{},"ethereum",", ",[186,382,383],{},"bsc",[186,385,386],{},"zksync",[186,388,389],{},"octra",". Lowercase, names the chain rather than its ticker. A short name is still a name, so ",[186,392,383],{}," and ",[186,395,396],{},"arbitrum"," stay keys.",[370,399,400,403,404,380,407,380,410,380,413,380,416,380,419,380,422,380,425,380,428,380,431,380,434,380,437,380,440,380,443,380,446,380,449,380,452,380,455,380,457,380,460,380,463,380,466,380,469,380,472,380,475,380,478,380,481,484,485,488,489,492],{},[373,401,402],{},"An alias."," The ticker spellings and nicknames a caller may already be holding: ",[186,405,406],{},"eth",[186,408,409],{},"matic",[186,411,412],{},"pol",[186,414,415],{},"btc",[186,417,418],{},"arb",[186,420,421],{},"arb1",[186,423,424],{},"op",[186,426,427],{},"bnb",[186,429,430],{},"binance",[186,432,433],{},"avax",[186,435,436],{},"ftm",[186,438,439],{},"xdai",[186,441,442],{},"bera",[186,444,445],{},"ltc",[186,447,448],{},"pep",[186,450,451],{},"xec",[186,453,454],{},"ada",[186,456,321],{},[186,458,459],{},"xlm",[186,461,462],{},"xrp",[186,464,465],{},"ripple",[186,467,468],{},"apt",[186,470,471],{},"trx",[186,473,474],{},"oct",[186,476,477],{},"ar",[186,479,480],{},"xmr",[186,482,483],{},"dcr",", and a few more like ",[186,486,487],{},"coinbase"," for Base and ",[186,490,491],{},"mainnet"," for Ethereum. Each chain's page lists its own.",[370,494,495,376,498,380,500,380,502,504],{},[373,496,497],{},"The display name.",[186,499,60],{},[186,501,72],{},[186,503,92],{},", read straight off the registered classes. That round trip matters for agents, which get a name out of one call and put it into the next.",[347,506,507,508,393,511,514,515,518,519,521],{},"Input is lowercased and trimmed first, so ",[186,509,510],{},"Matic",[186,512,513],{},"BTC "," work. Symbols aren't in the automatic index on purpose: six chains report ",[186,516,517],{},"ETH",", and matching on it would make the answer depend on registration order. ",[186,520,406],{}," resolves only because it's in the alias table, pointing at Ethereum.",[179,523,525],{"className":181,"code":524,"language":183,"meta":184,"style":184},"getChain(\"matic\").key; \u002F\u002F \"polygon\"\ngetChain(\"BNB Chain\").key; \u002F\u002F \"bsc\"\ngetChain(\"Arbitrum One\").key; \u002F\u002F \"arbitrum\"\ngetChain(); \u002F\u002F Ethereum\ngetChain(\"\"); \u002F\u002F throws UnsupportedChainError\n",[186,526,527,551,572,593,602],{"__ignoreMap":184},[189,528,529,531,533,535,537,539,542,545,548],{"class":191,"line":192},[189,530,314],{"class":259},[189,532,276],{"class":199},[189,534,243],{"class":235},[189,536,409],{"class":239},[189,538,243],{"class":235},[189,540,541],{"class":199},").",[189,543,544],{"class":339},"key",[189,546,547],{"class":199},"; ",[189,549,550],{"class":266},"\u002F\u002F \"polygon\"\n",[189,552,553,555,557,559,561,563,565,567,569],{"class":191,"line":249},[189,554,314],{"class":259},[189,556,276],{"class":199},[189,558,243],{"class":235},[189,560,72],{"class":239},[189,562,243],{"class":235},[189,564,541],{"class":199},[189,566,544],{"class":339},[189,568,547],{"class":199},[189,570,571],{"class":266},"\u002F\u002F \"bsc\"\n",[189,573,574,576,578,580,582,584,586,588,590],{"class":191,"line":256},[189,575,314],{"class":259},[189,577,276],{"class":199},[189,579,243],{"class":235},[189,581,60],{"class":239},[189,583,243],{"class":235},[189,585,541],{"class":199},[189,587,544],{"class":339},[189,589,547],{"class":199},[189,591,592],{"class":266},"\u002F\u002F \"arbitrum\"\n",[189,594,595,597,599],{"class":191,"line":270},[189,596,314],{"class":259},[189,598,263],{"class":199},[189,600,601],{"class":266},"\u002F\u002F Ethereum\n",[189,603,604,606,608,611,613],{"class":191,"line":292},[189,605,314],{"class":259},[189,607,276],{"class":199},[189,609,610],{"class":235},"\"\"",[189,612,286],{"class":199},[189,614,615],{"class":266},"\u002F\u002F throws UnsupportedChainError\n",[347,617,618,621,622,625],{},[186,619,620],{},"getChain()"," with no argument still means Ethereum. ",[186,623,624],{},"getChain(\"\")"," or a blank string doesn't, that's a caller mistake, and it throws rather than quietly answering about the wrong chain. The error message quotes the input, so blank and control character input stays visible in a log.",[174,627,629],{"id":628},"where-the-classes-come-from","Where the classes come from",[179,631,636],{"className":632,"code":634,"language":635,"meta":184},[633],"language-text","Chain (abstract)\n├── EVM (abstract)\n│   ├── Ethereum\n│   ├── Base\n│   ├── Arbitrum\n│   └── ...\n├── Move (abstract)\n│   ├── Aptos\n│   └── Sui\n├── Bitcoin\n├── Solana\n├── Stellar\n├── Xrpl\n├── Ton\n├── Tron\n├── Octra\n├── Arweave\n├── Monero\n└── Decred\n","text",[186,637,634],{"__ignoreMap":184},[347,639,640,641,393,644,647],{},"Each chain is its own class holding its own metadata. ",[186,642,643],{},"EVM",[186,645,646],{},"Move"," own the family type and the address format, and everything else is declared per class, down to the coin type all thirteen EVM chains repeat.",[347,649,650,651,654,655,658,659,654,662,665],{},"One list puts them in the registry: ",[186,652,653],{},"builtins"," in ",[186,656,657],{},"src\u002Fchains\u002Findex.ts",". No module registers itself as it loads, so the CLI is the only entry that runs anything on import, and ",[186,660,661],{},"sideEffects",[186,663,664],{},"package.json"," says so, which lets a bundler drop whatever your project never touches. The cost is that a chain file counts for nothing until its class joins that list, and a test compares the two so it can't drift quietly.",[174,667,669],{"id":668},"registering-your-own","Registering your own",[347,671,672,675,676,678,679,380,681,380,683,380,685,393,688,691,692,695],{},[186,673,674],{},"register(ChainClass)"," puts a class under its static ",[186,677,544],{},". From then on ",[186,680,295],{},[186,682,314],{},[186,684,273],{},[186,686,687],{},"chains()",[186,689,690],{},"identify"," see it like any built-in. Registering the same key again replaces the class. The whole recipe, including the two casts the closed key and type unions ask for, is in ",[693,694,36],"a",{"href":37},".",[697,698,699],"style",{},"html pre.shiki code .sP0CR, html code.shiki .sP0CR{--shiki-light:#D73A49;--shiki-default:#D73A49;--shiki-dark:#5DE4C7}html pre.shiki code .sKlNE, html code.shiki .sKlNE{--shiki-light:#24292E;--shiki-default:#24292E;--shiki-dark:#A6ACCD}html pre.shiki code .snHMy, html code.shiki .snHMy{--shiki-light:#24292E;--shiki-default:#24292E;--shiki-dark:#ADD7FF}html pre.shiki code .stCPd, html code.shiki .stCPd{--shiki-light:#D73A49;--shiki-default:#D73A49;--shiki-dark:#A6ACCD}html pre.shiki code .scVjq, html code.shiki .scVjq{--shiki-light:#032F62;--shiki-default:#032F62;--shiki-dark:#A6ACCD}html pre.shiki code .sQ7BG, html code.shiki .sQ7BG{--shiki-light:#032F62;--shiki-default:#032F62;--shiki-dark:#5DE4C7}html pre.shiki code .sULi6, html code.shiki .sULi6{--shiki-light:#6F42C1;--shiki-default:#6F42C1;--shiki-dark:#E4F0FBD0}html pre.shiki code .sjhu3, html code.shiki .sjhu3{--shiki-light:#6A737D;--shiki-light-font-style:inherit;--shiki-default:#6A737D;--shiki-default-font-style:inherit;--shiki-dark:#767C9DB0;--shiki-dark-font-style:italic}html pre.shiki code .spVlQ, html code.shiki .spVlQ{--shiki-light:#24292E;--shiki-default:#24292E;--shiki-dark:#E4F0FB}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":184,"searchDepth":249,"depth":249,"links":701},[702,703,704,705],{"id":176,"depth":249,"text":177},{"id":361,"depth":249,"text":362},{"id":628,"depth":249,"text":629},{"id":668,"depth":249,"text":669},"Keys and display names plus the aliases people actually type. All land on the same class. How the registry is seeded and why nothing registers itself.","md",null,{"icon":710},"i-lucide-list-tree",{"title":12,"description":706},"2ce7AXUYeafbx8hf0ZYTGNMlnmJiQLKAlVplNtciypI",[714,716],{"title":10,"path":6,"stem":7,"description":715,"children":-1},"Install the package. Resolve one chain. Check one address. Every chain is a class and every answer comes from the class that knows the format.",{"title":16,"path":17,"stem":18,"description":717,"children":-1},"assertAddress on every chain. What each family decodes and which checksums are verified and which are left alone. A format check and nothing more.",1789393739617]