[{"data":1,"prerenderedAt":661},["ShallowReactive",2],{"navigation_docs":3,"-guide-errors":120,"-guide-errors-surround":656},[4,56,116],{"title":5,"path":6,"stem":7,"children":8,"icon":55},"Guide","\u002Fguide","1.guide\u002F01.index",[9,11,15,19,23,27,31,35,39,43,47,51],{"title":10,"path":6,"stem":7},"Getting Started",{"title":12,"path":13,"stem":14},"CLI","\u002Fguide\u002Fcli","1.guide\u002F02.cli",{"title":16,"path":17,"stem":18},"Provider selection","\u002Fguide\u002Fselection","1.guide\u002F03.selection",{"title":20,"path":21,"stem":22},"Balances","\u002Fguide\u002Fbalances","1.guide\u002F04.balances",{"title":24,"path":25,"stem":26},"Transactions","\u002Fguide\u002Ftransactions","1.guide\u002F05.transactions",{"title":28,"path":29,"stem":30},"Tokens","\u002Fguide\u002Ftokens","1.guide\u002F06.tokens",{"title":32,"path":33,"stem":34},"Contracts","\u002Fguide\u002Fcontracts","1.guide\u002F07.contracts",{"title":36,"path":37,"stem":38},"Gas and blocks","\u002Fguide\u002Fgas-and-blocks","1.guide\u002F08.gas-and-blocks",{"title":40,"path":41,"stem":42},"Errors","\u002Fguide\u002Ferrors","1.guide\u002F09.errors",{"title":44,"path":45,"stem":46},"Agents","\u002Fguide\u002Fagents","1.guide\u002F10.agents",{"title":48,"path":49,"stem":50},"Custom providers","\u002Fguide\u002Fcustom","1.guide\u002F11.custom",{"title":52,"path":53,"stem":54},"Explorer","\u002Fguide\u002Fexplorer","1.guide\u002F12.explorer","i-solar-book-2-linear",{"title":57,"path":58,"stem":59,"children":60,"icon":115},"Providers","\u002Fproviders","2.providers\u002F0.index",[61,63,67,71,75,79,83,87,91,95,99,103,107,111],{"title":62,"path":58,"stem":59},"Overview",{"title":64,"path":65,"stem":66},"Etherscan","\u002Fproviders\u002Fetherscan","2.providers\u002F01.etherscan",{"title":68,"path":69,"stem":70},"Blockscout","\u002Fproviders\u002Fblockscout","2.providers\u002F02.blockscout",{"title":72,"path":73,"stem":74},"Blockchair","\u002Fproviders\u002Fblockchair","2.providers\u002F03.blockchair",{"title":76,"path":77,"stem":78},"Mempool","\u002Fproviders\u002Fmempool","2.providers\u002F04.mempool",{"title":80,"path":81,"stem":82},"Blockstream","\u002Fproviders\u002Fblockstream","2.providers\u002F05.blockstream",{"title":84,"path":85,"stem":86},"Solscan","\u002Fproviders\u002Fsolscan","2.providers\u002F06.solscan",{"title":88,"path":89,"stem":90},"Helius","\u002Fproviders\u002Fhelius","2.providers\u002F07.helius",{"title":92,"path":93,"stem":94},"TONAPI","\u002Fproviders\u002Fton","2.providers\u002F08.ton",{"title":96,"path":97,"stem":98},"TRONSCAN","\u002Fproviders\u002Ftronscan","2.providers\u002F09.tronscan",{"title":100,"path":101,"stem":102},"Aptos Explorer","\u002Fproviders\u002Faptos","2.providers\u002F10.aptos",{"title":104,"path":105,"stem":106},"Blockberry","\u002Fproviders\u002Fblockberry","2.providers\u002F11.blockberry",{"title":108,"path":109,"stem":110},"Koios","\u002Fproviders\u002Fkoios","2.providers\u002F12.koios",{"title":112,"path":113,"stem":114},"Arweave gateway","\u002Fproviders\u002Farweave","2.providers\u002F13.arweave","i-solar-library-linear",{"title":117,"path":118,"stem":119},"Chains","\u002Fchains","3.chains",{"id":121,"title":40,"body":122,"description":648,"extension":649,"links":650,"meta":651,"navigation":653,"path":41,"seo":654,"stem":42,"__hash__":655},"docs\u002F1.guide\u002F09.errors.md",{"type":123,"value":124,"toc":642},"minimark",[125,130,251,391,407,550,554,583,587,623,627,638],[126,127,129],"h2",{"id":128},"the-hierarchy","The hierarchy",[131,132,137],"pre",{"className":133,"code":134,"language":135,"meta":136,"style":136},"language-ts shiki shiki-themes github-light github-light poimandres","import {\n  ExplorerError,\n  HTTPError,\n  AuthError,\n  RateLimitError,\n  PlanRestrictedError,\n  NotFoundError,\n  UnsupportedChainError,\n  UnsupportedOperationError,\n  UnknownProviderError,\n} from \"@agntn\u002Fexplorers\";\n","ts","",[138,139,140,153,163,171,179,187,195,203,211,219,227],"code",{"__ignoreMap":136},[141,142,145,149],"span",{"class":143,"line":144},"line",1,[141,146,148],{"class":147},"sP0CR","import",[141,150,152],{"class":151},"sKlNE"," {\n",[141,154,156,160],{"class":143,"line":155},2,[141,157,159],{"class":158},"snHMy","  ExplorerError",[141,161,162],{"class":151},",\n",[141,164,166,169],{"class":143,"line":165},3,[141,167,168],{"class":158},"  HTTPError",[141,170,162],{"class":151},[141,172,174,177],{"class":143,"line":173},4,[141,175,176],{"class":158},"  AuthError",[141,178,162],{"class":151},[141,180,182,185],{"class":143,"line":181},5,[141,183,184],{"class":158},"  RateLimitError",[141,186,162],{"class":151},[141,188,190,193],{"class":143,"line":189},6,[141,191,192],{"class":158},"  PlanRestrictedError",[141,194,162],{"class":151},[141,196,198,201],{"class":143,"line":197},7,[141,199,200],{"class":158},"  NotFoundError",[141,202,162],{"class":151},[141,204,206,209],{"class":143,"line":205},8,[141,207,208],{"class":158},"  UnsupportedChainError",[141,210,162],{"class":151},[141,212,214,217],{"class":143,"line":213},9,[141,215,216],{"class":158},"  UnsupportedOperationError",[141,218,162],{"class":151},[141,220,222,225],{"class":143,"line":221},10,[141,223,224],{"class":158},"  UnknownProviderError",[141,226,162],{"class":151},[141,228,230,233,237,241,245,248],{"class":143,"line":229},11,[141,231,232],{"class":151},"}",[141,234,236],{"class":235},"stCPd"," from",[141,238,240],{"class":239},"scVjq"," \"",[141,242,244],{"class":243},"sQ7BG","@agntn\u002Fexplorers",[141,246,247],{"class":239},"\"",[141,249,250],{"class":151},";\n",[252,253,254,270],"table",{},[255,256,257],"thead",{},[258,259,260,264,267],"tr",{},[261,262,263],"th",{},"Class",[261,265,266],{},"When",[261,268,269],{},"Extra",[271,272,273,296,308,324,336,348,360,372],"tbody",{},[258,274,275,281,284],{},[276,277,278],"td",{},[138,279,280],{},"HTTPError",[276,282,283],{},"a transport failure with a status",[276,285,286,289,290,289,293],{},[138,287,288],{},"statusCode",", ",[138,291,292],{},"rawUrl",[138,294,295],{},"body",[258,297,298,303,306],{},[276,299,300],{},[138,301,302],{},"AuthError",[276,304,305],{},"credentials missing or rejected, 401, 403",[276,307],{},[258,309,310,315,318],{},[276,311,312],{},[138,313,314],{},"RateLimitError",[276,316,317],{},"429 or an explorer saying so in words",[276,319,320,323],{},[138,321,322],{},"retryAfter"," in seconds",[258,325,326,331,334],{},[276,327,328],{},[138,329,330],{},"PlanRestrictedError",[276,332,333],{},"valid key, but the read needs a paid tier",[276,335],{},[258,337,338,343,346],{},[276,339,340],{},[138,341,342],{},"NotFoundError",[276,344,345],{},"404, an unknown address, hash, block or an ENS name that does not resolve",[276,347],{},[258,349,350,355,358],{},[276,351,352],{},[138,353,354],{},"UnsupportedChainError",[276,356,357],{},"this provider does not serve that chain",[276,359],{},[258,361,362,367,370],{},[276,363,364],{},[138,365,366],{},"UnsupportedOperationError",[276,368,369],{},"this provider does not have that operation",[276,371],{},[258,373,374,379,389],{},[276,375,376],{},[138,377,378],{},"UnknownProviderError",[276,380,381,384,385,388],{},[138,382,383],{},"create()"," or ",[138,386,387],{},"resolveProvider()"," asked for a name nobody registered",[276,390],{},[392,393,394,395,398,399,402,403,406],"p",{},"Every one extends ",[138,396,397],{},"ExplorerError"," and carries ",[138,400,401],{},"provider",", so a ",[138,404,405],{},"catch"," can be as broad or as narrow as the caller likes.",[131,408,410],{"className":133,"code":409,"language":135,"meta":136,"style":136},"try {\n  await provider.getTxDetail?.(hash, \"ethereum\");\n} catch (error) {\n  if (error instanceof RateLimitError) {\n    console.log(error.retryAfter); \u002F\u002F seconds, when the explorer said\n  }\n  if (error instanceof NotFoundError) {\n    \u002F\u002F the hash is unknown to this explorer\n  }\n}\n",[138,411,412,420,455,471,490,516,521,536,541,545],{"__ignoreMap":136},[141,413,414,418],{"class":143,"line":144},[141,415,417],{"class":416},"szlwh","try",[141,419,152],{"class":151},[141,421,422,426,430,433,437,440,443,445,447,450,452],{"class":143,"line":155},[141,423,425],{"class":424},"sZW6a","  await",[141,427,429],{"class":428},"spVlQ"," provider",[141,431,432],{"class":151},".",[141,434,436],{"class":435},"sULi6","getTxDetail",[141,438,439],{"class":151},"?.(",[141,441,442],{"class":428},"hash",[141,444,289],{"class":151},[141,446,247],{"class":239},[141,448,449],{"class":243},"ethereum",[141,451,247],{"class":239},[141,453,454],{"class":151},");\n",[141,456,457,460,462,465,468],{"class":143,"line":165},[141,458,459],{"class":151},"} ",[141,461,405],{"class":416},[141,463,464],{"class":151}," (",[141,466,467],{"class":428},"error",[141,469,470],{"class":151},") {\n",[141,472,473,476,478,480,484,488],{"class":143,"line":173},[141,474,475],{"class":235},"  if",[141,477,464],{"class":151},[141,479,467],{"class":428},[141,481,483],{"class":482},"s1TYA"," instanceof",[141,485,487],{"class":486},"sCrqT"," RateLimitError",[141,489,470],{"class":151},[141,491,492,495,497,500,503,505,507,509,512],{"class":143,"line":181},[141,493,494],{"class":428},"    console",[141,496,432],{"class":151},[141,498,499],{"class":435},"log",[141,501,502],{"class":151},"(",[141,504,467],{"class":428},[141,506,432],{"class":151},[141,508,322],{"class":428},[141,510,511],{"class":151},"); ",[141,513,515],{"class":514},"sjhu3","\u002F\u002F seconds, when the explorer said\n",[141,517,518],{"class":143,"line":189},[141,519,520],{"class":151},"  }\n",[141,522,523,525,527,529,531,534],{"class":143,"line":197},[141,524,475],{"class":235},[141,526,464],{"class":151},[141,528,467],{"class":428},[141,530,483],{"class":482},[141,532,533],{"class":486}," NotFoundError",[141,535,470],{"class":151},[141,537,538],{"class":143,"line":205},[141,539,540],{"class":514},"    \u002F\u002F the hash is unknown to this explorer\n",[141,542,543],{"class":143,"line":213},[141,544,520],{"class":151},[141,546,547],{"class":143,"line":221},[141,548,549],{"class":151},"}\n",[126,551,553],{"id":552},"normalizeerror","normalizeError",[392,555,556,557,560,561,564,565,567,568,570,571,573,574,576,577,579,580,582],{},"Providers do not write their own classification. ",[138,558,559],{},"normalizeError(error, provider, url)"," turns whatever ",[138,562,563],{},"ofetch"," or a provider's own check threw into the hierarchy: 404 or \"not found\" in the message becomes ",[138,566,342],{},", 429 or \"rate limit\" becomes ",[138,569,314],{},", 401, 403 or \"unauthorized\" becomes ",[138,572,302],{},", anything else with a status or a URL becomes ",[138,575,280],{},", and an ",[138,578,397],{}," passes through untouched. A failure with no status and no URL stays a plain ",[138,581,397],{}," with the original message.",[126,584,586],{"id":585},"keys-never-leak","Keys never leak",[392,588,589,591,592,289,595,289,598,289,601,604,605,608,609,612,613,615,616,618,619,622],{},[138,590,397],{},"'s constructor runs every message through one redaction: ",[138,593,594],{},"api_key",[138,596,597],{},"apikey",[138,599,600],{},"key",[138,602,603],{},"secret"," and ",[138,606,607],{},"token"," query parameters become ",[138,610,611],{},"REDACTED",". ",[138,614,280],{}," does the same to ",[138,617,292],{}," and to the response body, in case the explorer echoed the request back. Helius carries its key as ",[138,620,621],{},"api-key"," in the query, which is exactly the case this guards. Log an error, paste it in an issue, fine.",[126,624,626],{"id":625},"two-retries-both-explicit","Two retries, both explicit",[392,628,629,632,633,384,635,637],{},[138,630,631],{},"withProvider()"," retries an automatic selection once after ",[138,634,314],{},[138,636,330],{},", on the next provider that serves the chain. Nothing else is retried, and nothing at all is retried under an explicit provider. The HTTP client itself never retries. If you want more, wrap the call; the library will not do it behind your back.",[639,640,641],"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 .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 .szlwh, html code.shiki .szlwh{--shiki-light:#D73A49;--shiki-default:#D73A49;--shiki-dark:#D0679D}html pre.shiki code .sZW6a, html code.shiki .sZW6a{--shiki-light:#D73A49;--shiki-default:#D73A49;--shiki-dark:#5DE4C7C0}html pre.shiki code .spVlQ, html code.shiki .spVlQ{--shiki-light:#24292E;--shiki-default:#24292E;--shiki-dark:#E4F0FB}html pre.shiki code .sULi6, html code.shiki .sULi6{--shiki-light:#6F42C1;--shiki-default:#6F42C1;--shiki-dark:#E4F0FBD0}html pre.shiki code .s1TYA, html code.shiki .s1TYA{--shiki-light:#D73A49;--shiki-default:#D73A49;--shiki-dark:#91B4D5}html pre.shiki code .sCrqT, html code.shiki .sCrqT{--shiki-light:#6F42C1;--shiki-default:#6F42C1;--shiki-dark:#A6ACCDC0}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}",{"title":136,"searchDepth":155,"depth":155,"links":643},[644,645,646,647],{"id":128,"depth":155,"text":129},{"id":552,"depth":155,"text":553},{"id":585,"depth":155,"text":586},{"id":625,"depth":155,"text":626},"One hierarchy for thirteen ways to fail, normalizeError for the rest, and API keys stripped from every message before it exists.","md",null,{"icon":652},"i-solar-danger-triangle-linear",true,{"title":40,"description":648},"NaHFKwVb3SJgVN_SHtDdcKDwqMnWWUnkVRuAzHZDneg",[657,659],{"title":36,"path":37,"stem":38,"description":658,"children":-1},"getGasData in the provider's own unit, getBlockInfo by number, and the chains where neither is a thing.",{"title":44,"path":45,"stem":46,"description":660,"children":-1},"The same nine read-only tools over MCP, the Pi extension and the OMP extension, how a provider is chosen for a tool call, and what a tool never does.",1788626962638]