[{"data":1,"prerenderedAt":943},["ShallowReactive",2],{"navigation_docs":3,"-guide":196,"-guide-surround":940},[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":195},"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,179,183,187,191],{"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",{"title":180,"path":181,"stem":182},"Bitcoin SV","\u002Fchains\u002Fbitcoinsv","2.chains\u002F33.bitcoinsv",{"title":184,"path":185,"stem":186},"Bitcoin Gold","\u002Fchains\u002Fbitcoingold","2.chains\u002F34.bitcoingold",{"title":188,"path":189,"stem":190},"Dash","\u002Fchains\u002Fdash","2.chains\u002F35.dash",{"title":192,"path":193,"stem":194},"Zcash","\u002Fchains\u002Fzcash","2.chains\u002F36.zcash","i-lucide-link",{"id":197,"title":10,"body":198,"description":934,"extension":935,"links":936,"meta":937,"navigation":302,"path":6,"seo":938,"stem":7,"__hash__":939},"docs\u002F1.guide\u002F01.index.md",{"type":199,"value":200,"toc":926},"minimark",[201,209,216,221,225,237,241,266,270,469,483,487,705,716,720,825,862,866,922],[202,203,204,208],"warning",{},[205,206,207],"strong",{},"Pre-1.0."," The API and the tool list can still move. Pin exact versions if you build on it now.",[210,211,212,215],"caution",{},[205,213,214],{},"A passing check is a format check."," It says the string fits the chain's rules. It doesn't say the address exists, holds anything, or belongs to who you think. Where a format has a checksum, the chain's page says whether it's verified.",[217,218,220],"h2",{"id":219},"why-this-exists","Why this exists",[222,223,224],"p",{},"Every web3 library I write needs the same handful of facts: Polygon's chain ID, Bitcoin's coin type, which explorer to link, whether an address even looks right. Re-declared in every one of them, and slightly different each time. So they live here once, as classes, and everything else imports them.",[222,226,227,228,232,233,236],{},"The second reason is the address check. A regex that counts characters takes a Bitcoin address, a TRON address and half the typos in between. Here the validators decode: Solana wants 32 bytes behind the base58, TRON wants 25 under version ",[229,230,231],"code",{},"0x41",", a ",[229,234,235],{},"bc1"," address has to pass its Bech32 checksum. Rejected is an answer with the chain key on it.",[217,238,240],{"id":239},"install","Install",[242,243,248],"pre",{"className":244,"code":245,"language":246,"meta":247,"style":247},"language-bash shiki shiki-themes chains chains chains","pnpm add @agntn\u002Fchains\n","bash","",[229,249,250],{"__ignoreMap":247},[251,252,255,259,263],"span",{"class":253,"line":254},"line",1,[251,256,258],{"class":257},"sK71F","pnpm",[251,260,262],{"class":261},"shU9J"," add",[251,264,265],{"class":261}," @agntn\u002Fchains\n",[217,267,269],{"id":268},"first-call","First call",[242,271,276],{"className":272,"code":273,"filename":274,"language":275,"meta":247,"style":247},"language-ts shiki shiki-themes chains chains chains","import { Ethereum, EVM, create, getChain } from \"@agntn\u002Fchains\";\n\nconst ethereum = create(\"ethereum\");\n\nethereum instanceof Ethereum; \u002F\u002F true\nethereum instanceof EVM; \u002F\u002F true\nethereum.name; \u002F\u002F \"Ethereum\"\nethereum.symbol; \u002F\u002F \"ETH\"\nethereum.chainId; \u002F\u002F \"0x1\"\nethereum.caip2; \u002F\u002F \"eip155:1\"\n\n\u002F** Aliases resolve to the same concrete classes. *\u002F\nconst polygon = getChain(\"matic\");\npolygon.key; \u002F\u002F \"polygon\"\n\n\u002F** Validation lives on the class that knows the format. *\u002F\nethereum.assertAddress(\"0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984\");\n","ethereum.ts","ts",[229,277,278,297,304,328,333,352,366,375,384,393,402,407,413,433,442,447,453],{"__ignoreMap":247},[251,279,280,284,288,291,294],{"class":253,"line":254},[251,281,283],{"class":282},"skH_V","import",[251,285,287],{"class":286},"s38Sx"," { Ethereum, EVM, create, getChain } ",[251,289,290],{"class":282},"from",[251,292,293],{"class":261}," \"@agntn\u002Fchains\"",[251,295,296],{"class":286},";\n",[251,298,300],{"class":253,"line":299},2,[251,301,303],{"emptyLinePlaceholder":302},true,"\n",[251,305,307,310,313,316,319,322,325],{"class":253,"line":306},3,[251,308,309],{"class":282},"const",[251,311,312],{"class":286}," ethereum ",[251,314,315],{"class":282},"=",[251,317,318],{"class":257}," create",[251,320,321],{"class":286},"(",[251,323,324],{"class":261},"\"ethereum\"",[251,326,327],{"class":286},");\n",[251,329,331],{"class":253,"line":330},4,[251,332,303],{"emptyLinePlaceholder":302},[251,334,336,339,342,345,348],{"class":253,"line":335},5,[251,337,338],{"class":286},"ethereum ",[251,340,341],{"class":282},"instanceof",[251,343,344],{"class":257}," Ethereum",[251,346,347],{"class":286},"; ",[251,349,351],{"class":350},"scIB-","\u002F\u002F true\n",[251,353,355,357,359,362,364],{"class":253,"line":354},6,[251,356,338],{"class":286},[251,358,341],{"class":282},[251,360,361],{"class":257}," EVM",[251,363,347],{"class":286},[251,365,351],{"class":350},[251,367,369,372],{"class":253,"line":368},7,[251,370,371],{"class":286},"ethereum.name; ",[251,373,374],{"class":350},"\u002F\u002F \"Ethereum\"\n",[251,376,378,381],{"class":253,"line":377},8,[251,379,380],{"class":286},"ethereum.symbol; ",[251,382,383],{"class":350},"\u002F\u002F \"ETH\"\n",[251,385,387,390],{"class":253,"line":386},9,[251,388,389],{"class":286},"ethereum.chainId; ",[251,391,392],{"class":350},"\u002F\u002F \"0x1\"\n",[251,394,396,399],{"class":253,"line":395},10,[251,397,398],{"class":286},"ethereum.caip2; ",[251,400,401],{"class":350},"\u002F\u002F \"eip155:1\"\n",[251,403,405],{"class":253,"line":404},11,[251,406,303],{"emptyLinePlaceholder":302},[251,408,410],{"class":253,"line":409},12,[251,411,412],{"class":350},"\u002F** Aliases resolve to the same concrete classes. *\u002F\n",[251,414,416,418,421,423,426,428,431],{"class":253,"line":415},13,[251,417,309],{"class":282},[251,419,420],{"class":286}," polygon ",[251,422,315],{"class":282},[251,424,425],{"class":257}," getChain",[251,427,321],{"class":286},[251,429,430],{"class":261},"\"matic\"",[251,432,327],{"class":286},[251,434,436,439],{"class":253,"line":435},14,[251,437,438],{"class":286},"polygon.key; ",[251,440,441],{"class":350},"\u002F\u002F \"polygon\"\n",[251,443,445],{"class":253,"line":444},15,[251,446,303],{"emptyLinePlaceholder":302},[251,448,450],{"class":253,"line":449},16,[251,451,452],{"class":350},"\u002F** Validation lives on the class that knows the format. *\u002F\n",[251,454,456,459,462,464,467],{"class":253,"line":455},17,[251,457,458],{"class":286},"ethereum.",[251,460,461],{"class":257},"assertAddress",[251,463,321],{"class":286},[251,465,466],{"class":261},"\"0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984\"",[251,468,327],{"class":286},[222,470,471,474,475,478,479,482],{},[229,472,473],{},"create(key)"," wants the canonical key and builds a fresh instance. ",[229,476,477],{},"getChain(input)"," takes whatever spelling you're holding, a key, a display name or an alias like ",[229,480,481],{},"matic",", and gives you the same class. With no argument it means Ethereum. With an empty string it throws, because a blank input is a mistake, not a request for the default.",[217,484,486],{"id":485},"what-is-on-a-chain","What is on a chain",[488,489,490,506],"table",{},[491,492,493],"thead",{},[494,495,496,500,503],"tr",{},[497,498,499],"th",{},"Field",[497,501,502],{},"Type",[497,504,505],{},"Description",[507,508,509,532,547,561,576,605,619,634,648,662,677,691],"tbody",{},[494,510,511,517,522],{},[512,513,514],"td",{},[229,515,516],{},"key",[512,518,519],{},[229,520,521],{},"ChainKey",[512,523,524,525,528,529],{},"Canonical class key, ",[229,526,527],{},"ethereum"," not ",[229,530,531],{},"eth",[494,533,534,539,544],{},[512,535,536],{},[229,537,538],{},"name",[512,540,541],{},[229,542,543],{},"string",[512,545,546],{},"Display name",[494,548,549,554,558],{},[512,550,551],{},[229,552,553],{},"symbol",[512,555,556],{},[229,557,543],{},[512,559,560],{},"Native token symbol",[494,562,563,568,573],{},[512,564,565],{},[229,566,567],{},"decimals",[512,569,570],{},[229,571,572],{},"number?",[512,574,575],{},"Native currency decimal places",[494,577,578,583,588],{},[512,579,580],{},[229,581,582],{},"type",[512,584,585],{},[229,586,587],{},"ChainType",[512,589,590,591,594,595,594,598,594,601,604],{},"Family: ",[229,592,593],{},"evm",", ",[229,596,597],{},"utxo",[229,599,600],{},"move",[229,602,603],{},"solana"," and so on",[494,606,607,612,616],{},[512,608,609],{},[229,610,611],{},"bip44",[512,613,614],{},[229,615,572],{},[512,617,618],{},"BIP-44 \u002F SLIP-0044 coin type",[494,620,621,626,631],{},[512,622,623],{},[229,624,625],{},"chainId",[512,627,628],{},[229,629,630],{},"string?",[512,632,633],{},"EVM chain ID in hexadecimal",[494,635,636,641,645],{},[512,637,638],{},[229,639,640],{},"caip2",[512,642,643],{},[229,644,630],{},[512,646,647],{},"CAIP-2 identifier",[494,649,650,655,659],{},[512,651,652],{},[229,653,654],{},"magic",[512,656,657],{},[229,658,630],{},[512,660,661],{},"P2P magic bytes, hex in wire order",[494,663,664,669,674],{},[512,665,666],{},[229,667,668],{},"pow",[512,670,671],{},[229,672,673],{},"PowAlgorithm?",[512,675,676],{},"Proof-of-work algorithm",[494,678,679,684,688],{},[512,680,681],{},[229,682,683],{},"explorer",[512,685,686],{},[229,687,543],{},[512,689,690],{},"Block explorer base URL",[494,692,693,698,702],{},[512,694,695],{},[229,696,697],{},"rpcDefault",[512,699,700],{},[229,701,630],{},[512,703,704],{},"Default public RPC endpoint",[222,706,707,708,711,712,715],{},"Optional fields stay empty when the chain has no registered value. Octra has no BIP-44 coin type and no CAIP-2 namespace, so both are ",[229,709,710],{},"undefined"," rather than invented. The full story of each field, decimals included, is in ",[713,714,24],"a",{"href":25},".",[217,717,719],{"id":718},"errors","Errors",[242,721,723],{"className":272,"code":722,"language":275,"meta":247,"style":247},"import { ChainsError, InvalidAddressError, UnsupportedChainError } from \"@agntn\u002Fchains\";\n\ntry {\n  getChain(\"btc\").assertAddress(\"bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t5\");\n} catch (error) {\n  if (error instanceof InvalidAddressError) {\n    error.chain; \u002F\u002F \"bitcoin\", the canonical key\n    error.address; \u002F\u002F the string that failed\n  }\n}\n",[229,724,725,738,742,750,772,783,799,807,815,820],{"__ignoreMap":247},[251,726,727,729,732,734,736],{"class":253,"line":254},[251,728,283],{"class":282},[251,730,731],{"class":286}," { ChainsError, InvalidAddressError, UnsupportedChainError } ",[251,733,290],{"class":282},[251,735,293],{"class":261},[251,737,296],{"class":286},[251,739,740],{"class":253,"line":299},[251,741,303],{"emptyLinePlaceholder":302},[251,743,744,747],{"class":253,"line":306},[251,745,746],{"class":282},"try",[251,748,749],{"class":286}," {\n",[251,751,752,755,757,760,763,765,767,770],{"class":253,"line":330},[251,753,754],{"class":257},"  getChain",[251,756,321],{"class":286},[251,758,759],{"class":261},"\"btc\"",[251,761,762],{"class":286},").",[251,764,461],{"class":257},[251,766,321],{"class":286},[251,768,769],{"class":261},"\"bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t5\"",[251,771,327],{"class":286},[251,773,774,777,780],{"class":253,"line":335},[251,775,776],{"class":286},"} ",[251,778,779],{"class":282},"catch",[251,781,782],{"class":286}," (error) {\n",[251,784,785,788,791,793,796],{"class":253,"line":354},[251,786,787],{"class":282},"  if",[251,789,790],{"class":286}," (error ",[251,792,341],{"class":282},[251,794,795],{"class":257}," InvalidAddressError",[251,797,798],{"class":286},") {\n",[251,800,801,804],{"class":253,"line":368},[251,802,803],{"class":286},"    error.chain; ",[251,805,806],{"class":350},"\u002F\u002F \"bitcoin\", the canonical key\n",[251,808,809,812],{"class":253,"line":377},[251,810,811],{"class":286},"    error.address; ",[251,813,814],{"class":350},"\u002F\u002F the string that failed\n",[251,816,817],{"class":253,"line":386},[251,818,819],{"class":286},"  }\n",[251,821,822],{"class":253,"line":395},[251,823,824],{"class":286},"}\n",[222,826,827,828,831,832,835,836,839,840,835,843,846,847,850,851,854,855,858,859,861],{},"Everything thrown here descends from ",[229,829,830],{},"ChainsError",", so you catch one type and read fields instead of parsing messages. ",[229,833,834],{},"UnknownChainError"," is ",[229,837,838],{},"create()"," with a key nobody registered, ",[229,841,842],{},"UnsupportedChainError",[229,844,845],{},"getChain()"," with a spelling that matches nothing, ",[229,848,849],{},"InvalidAddressError"," is a failed format check, and ",[229,852,853],{},"AddressValidationUnsupportedError"," is a chain that carries no validator at all. ",[229,856,857],{},".chain"," holds the canonical key on the last two, the same value ",[229,860,838],{}," takes.",[217,863,865],{"id":864},"next","Next",[867,868,869,878,883,888,893,902,907,916],"ul",{},[870,871,872,874,875,715],"li",{},[713,873,12],{"href":13},": keys, names, aliases and ",[229,876,877],{},"register",[870,879,880,882],{},[713,881,16],{"href":17},": what each family decodes and which checksums it verifies.",[870,884,885,887],{},[713,886,20],{"href":21},": one address through every validator.",[870,889,890,892],{},[713,891,24],{"href":25},": every field, and where the decimals come from.",[870,894,895,897,898,901],{},[713,896,28],{"href":29},": the ",[229,899,900],{},"chains"," command.",[870,903,904,906],{},[713,905,32],{"href":33},": five tools over MCP, Pi and OMP.",[870,908,909,911,912,915],{},[713,910,36],{"href":37},": extend ",[229,913,914],{},"Chain",", register it.",[870,917,918,921],{},[713,919,40],{"href":920},"\u002Fplayground",": the library, in the page.",[923,924,925],"style",{},"html pre.shiki code .sK71F, html code.shiki .sK71F{--shiki-light:var(--shiki-token-function);--shiki-default:var(--shiki-token-function);--shiki-dark:var(--shiki-token-function)}html pre.shiki code .shU9J, html code.shiki .shU9J{--shiki-light:var(--shiki-token-string);--shiki-default:var(--shiki-token-string);--shiki-dark:var(--shiki-token-string)}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);}html pre.shiki code .skH_V, html code.shiki .skH_V{--shiki-light:var(--shiki-token-keyword);--shiki-default:var(--shiki-token-keyword);--shiki-dark:var(--shiki-token-keyword)}html pre.shiki code .s38Sx, html code.shiki .s38Sx{--shiki-light:var(--ui-text-highlighted);--shiki-default:var(--ui-text-highlighted);--shiki-dark:var(--ui-text-highlighted)}html pre.shiki code .scIB-, html code.shiki .scIB-{--shiki-light:var(--shiki-token-comment);--shiki-default:var(--shiki-token-comment);--shiki-dark:var(--shiki-token-comment)}",{"title":247,"searchDepth":299,"depth":299,"links":927},[928,929,930,931,932,933],{"id":219,"depth":299,"text":220},{"id":239,"depth":299,"text":240},{"id":268,"depth":299,"text":269},{"id":485,"depth":299,"text":486},{"id":718,"depth":299,"text":719},{"id":864,"depth":299,"text":865},"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.","md",null,{"icon":43},{"title":10,"description":934},"OrGc0OCllbJr-Izncw09WJImXS813I0NXmueWfqdua8",[936,941],{"title":12,"path":13,"stem":14,"description":942,"children":-1},"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.",1791199001600]