[{"data":1,"prerenderedAt":730},["ShallowReactive",2],{"navigation_docs":3,"-guide-registry":180,"-guide-registry-surround":725},[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":179},"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,167,171,175],{"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",{"title":168,"path":169,"stem":170},"Arc","\u002Fchains\u002Farc","2.chains\u002F30.arc",{"title":172,"path":173,"stem":174},"Dogecoin","\u002Fchains\u002Fdogecoin","2.chains\u002F31.dogecoin",{"title":176,"path":177,"stem":178},"Bitcoin Cash","\u002Fchains\u002Fbitcoincash","2.chains\u002F32.bitcoincash","i-lucide-link",{"id":181,"title":12,"body":182,"description":718,"extension":719,"links":720,"meta":721,"navigation":264,"path":13,"seo":723,"stem":14,"__hash__":724},"docs\u002F1.guide\u002F02.registry.md",{"type":183,"value":184,"toc":712},"minimark",[185,190,358,371,375,378,517,534,628,638,642,650,660,678,682,708],[186,187,189],"h2",{"id":188},"five-functions","Five functions",[191,192,197],"pre",{"className":193,"code":194,"language":195,"meta":196,"style":196},"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","",[198,199,200,259,266,280,302,321,341],"code",{"__ignoreMap":196},[201,202,205,209,213,217,220,223,225,228,230,233,235,238,241,245,249,253,256],"span",{"class":203,"line":204},"line",1,[201,206,208],{"class":207},"sP0CR","import",[201,210,212],{"class":211},"sKlNE"," {",[201,214,216],{"class":215},"snHMy"," chains",[201,218,219],{"class":211},",",[201,221,222],{"class":215}," create",[201,224,219],{"class":211},[201,226,227],{"class":215}," getChain",[201,229,219],{"class":211},[201,231,232],{"class":215}," has",[201,234,219],{"class":211},[201,236,237],{"class":215}," register",[201,239,240],{"class":211}," }",[201,242,244],{"class":243},"stCPd"," from",[201,246,248],{"class":247},"scVjq"," \"",[201,250,252],{"class":251},"sQ7BG","@agntn\u002Fchains",[201,254,255],{"class":247},"\"",[201,257,258],{"class":211},";\n",[201,260,262],{"class":203,"line":261},2,[201,263,265],{"emptyLinePlaceholder":264},true,"\n",[201,267,269,273,276],{"class":203,"line":268},3,[201,270,272],{"class":271},"sULi6","chains",[201,274,275],{"class":211},"(); ",[201,277,279],{"class":278},"sjhu3","\u002F\u002F [\"ethereum\", \"base\", \"arbitrum\", ...] in registration order\n",[201,281,283,286,289,291,294,296,299],{"class":203,"line":282},4,[201,284,285],{"class":271},"has",[201,287,288],{"class":211},"(",[201,290,255],{"class":247},[201,292,293],{"class":251},"solana",[201,295,255],{"class":247},[201,297,298],{"class":211},"); ",[201,300,301],{"class":278},"\u002F\u002F true\n",[201,303,305,308,310,312,314,316,318],{"class":203,"line":304},5,[201,306,307],{"class":271},"create",[201,309,288],{"class":211},[201,311,255],{"class":247},[201,313,293],{"class":251},[201,315,255],{"class":247},[201,317,298],{"class":211},[201,319,320],{"class":278},"\u002F\u002F a fresh Solana instance\n",[201,322,324,327,329,331,334,336,338],{"class":203,"line":323},6,[201,325,326],{"class":271},"getChain",[201,328,288],{"class":211},[201,330,255],{"class":247},[201,332,333],{"class":251},"sol",[201,335,255],{"class":247},[201,337,298],{"class":211},[201,339,340],{"class":278},"\u002F\u002F the same class, by alias\n",[201,342,344,347,349,353,355],{"class":203,"line":343},7,[201,345,346],{"class":271},"register",[201,348,288],{"class":211},[201,350,352],{"class":351},"spVlQ","MyChain",[201,354,298],{"class":211},[201,356,357],{"class":278},"\u002F\u002F a class this package does not ship\n",[359,360,361,363,364,367,368,370],"p",{},[198,362,307],{}," takes a canonical key and throws ",[198,365,366],{},"UnknownChainError"," for anything else. ",[198,369,326],{}," is the forgiving one, and the one the CLI and the tools use.",[186,372,374],{"id":373},"what-getchain-accepts","What getChain accepts",[359,376,377],{},"Three spellings, tried in this order:",[379,380,381,410,505],"ol",{},[382,383,384,388,389,392,393,392,396,392,399,402,403,405,406,409],"li",{},[385,386,387],"strong",{},"The canonical key."," ",[198,390,391],{},"ethereum",", ",[198,394,395],{},"bsc",[198,397,398],{},"zksync",[198,400,401],{},"octra",". Lowercase, names the chain rather than its ticker. A short name is still a name, so ",[198,404,395],{}," and ",[198,407,408],{},"arbitrum"," stay keys.",[382,411,412,415,416,392,419,392,422,392,425,392,428,392,431,392,434,392,437,392,440,392,443,392,446,392,449,392,452,392,455,392,458,392,461,392,464,392,467,392,469,392,472,392,475,392,478,392,481,392,484,392,487,392,490,392,493,496,497,500,501,504],{},[385,413,414],{},"An alias."," The ticker spellings and nicknames a caller may already be holding: ",[198,417,418],{},"eth",[198,420,421],{},"matic",[198,423,424],{},"pol",[198,426,427],{},"btc",[198,429,430],{},"arb",[198,432,433],{},"arb1",[198,435,436],{},"op",[198,438,439],{},"bnb",[198,441,442],{},"binance",[198,444,445],{},"avax",[198,447,448],{},"ftm",[198,450,451],{},"xdai",[198,453,454],{},"bera",[198,456,457],{},"ltc",[198,459,460],{},"pep",[198,462,463],{},"xec",[198,465,466],{},"ada",[198,468,333],{},[198,470,471],{},"xlm",[198,473,474],{},"xrp",[198,476,477],{},"ripple",[198,479,480],{},"apt",[198,482,483],{},"trx",[198,485,486],{},"oct",[198,488,489],{},"ar",[198,491,492],{},"xmr",[198,494,495],{},"dcr",", and a few more like ",[198,498,499],{},"coinbase"," for Base and ",[198,502,503],{},"mainnet"," for Ethereum. Each chain's page lists its own.",[382,506,507,388,510,392,512,392,514,516],{},[385,508,509],{},"The display name.",[198,511,60],{},[198,513,72],{},[198,515,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.",[359,518,519,520,405,523,526,527,530,531,533],{},"Input is lowercased and trimmed first, so ",[198,521,522],{},"Matic",[198,524,525],{},"BTC "," work. Symbols aren't in the automatic index on purpose: six chains report ",[198,528,529],{},"ETH",", and matching on it would make the answer depend on registration order. ",[198,532,418],{}," resolves only because it's in the alias table, pointing at Ethereum.",[191,535,537],{"className":193,"code":536,"language":195,"meta":196,"style":196},"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",[198,538,539,563,584,605,614],{"__ignoreMap":196},[201,540,541,543,545,547,549,551,554,557,560],{"class":203,"line":204},[201,542,326],{"class":271},[201,544,288],{"class":211},[201,546,255],{"class":247},[201,548,421],{"class":251},[201,550,255],{"class":247},[201,552,553],{"class":211},").",[201,555,556],{"class":351},"key",[201,558,559],{"class":211},"; ",[201,561,562],{"class":278},"\u002F\u002F \"polygon\"\n",[201,564,565,567,569,571,573,575,577,579,581],{"class":203,"line":261},[201,566,326],{"class":271},[201,568,288],{"class":211},[201,570,255],{"class":247},[201,572,72],{"class":251},[201,574,255],{"class":247},[201,576,553],{"class":211},[201,578,556],{"class":351},[201,580,559],{"class":211},[201,582,583],{"class":278},"\u002F\u002F \"bsc\"\n",[201,585,586,588,590,592,594,596,598,600,602],{"class":203,"line":268},[201,587,326],{"class":271},[201,589,288],{"class":211},[201,591,255],{"class":247},[201,593,60],{"class":251},[201,595,255],{"class":247},[201,597,553],{"class":211},[201,599,556],{"class":351},[201,601,559],{"class":211},[201,603,604],{"class":278},"\u002F\u002F \"arbitrum\"\n",[201,606,607,609,611],{"class":203,"line":282},[201,608,326],{"class":271},[201,610,275],{"class":211},[201,612,613],{"class":278},"\u002F\u002F Ethereum\n",[201,615,616,618,620,623,625],{"class":203,"line":304},[201,617,326],{"class":271},[201,619,288],{"class":211},[201,621,622],{"class":247},"\"\"",[201,624,298],{"class":211},[201,626,627],{"class":278},"\u002F\u002F throws UnsupportedChainError\n",[359,629,630,633,634,637],{},[198,631,632],{},"getChain()"," with no argument still means Ethereum. ",[198,635,636],{},"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.",[186,639,641],{"id":640},"where-the-classes-come-from","Where the classes come from",[191,643,648],{"className":644,"code":646,"language":647,"meta":196},[645],"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",[198,649,646],{"__ignoreMap":196},[359,651,652,653,405,656,659],{},"Each chain is its own class holding its own metadata. ",[198,654,655],{},"EVM",[198,657,658],{},"Move"," own the family type and the address format, and everything else is declared per class, down to the coin type all fourteen EVM chains repeat.",[359,661,662,663,666,667,670,671,666,674,677],{},"One list puts them in the registry: ",[198,664,665],{},"builtins"," in ",[198,668,669],{},"src\u002Fchains\u002Findex.ts",". No module registers itself as it loads, so the CLI is the only entry that runs anything on import, and ",[198,672,673],{},"sideEffects",[198,675,676],{},"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.",[186,679,681],{"id":680},"registering-your-own","Registering your own",[359,683,684,687,688,690,691,392,693,392,695,392,697,405,700,703,704,707],{},[198,685,686],{},"register(ChainClass)"," puts a class under its static ",[198,689,556],{},". From then on ",[198,692,307],{},[198,694,326],{},[198,696,285],{},[198,698,699],{},"chains()",[198,701,702],{},"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 ",[705,706,36],"a",{"href":37},".",[709,710,711],"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":196,"searchDepth":261,"depth":261,"links":713},[714,715,716,717],{"id":188,"depth":261,"text":189},{"id":373,"depth":261,"text":374},{"id":640,"depth":261,"text":641},{"id":680,"depth":261,"text":681},"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":722},"i-lucide-list-tree",{"title":12,"description":718},"vKv2DeEBGvQCYWCmWjFFYfV9WZv4JWOZYkj1Dz92cHU",[726,728],{"title":10,"path":6,"stem":7,"description":727,"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":729,"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.",1790261451459]