@oracle-agent/oracle 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +99 -0
- package/README.md +531 -13
- package/SECURITY.md +112 -0
- package/SETUP.md +317 -0
- package/artifacts/inscription/oracle-was-here-preview.png +0 -0
- package/artifacts/inscription/oracle-was-here.svg +1 -0
- package/artifacts/specialist-packs/oracle-full-crypto.json +298 -0
- package/bin/desk-server.mjs +473 -0
- package/bin/oracle-data-mcp.mjs +1252 -0
- package/bin/oracle-equities.mjs +168 -0
- package/bin/oracle-init.mjs +525 -0
- package/bin/oracle-public-server.mjs +36 -0
- package/bin/oracle-route.mjs +254 -0
- package/bin/oracle-scan.mjs +192 -0
- package/bin/oracle-upgrade.mjs +42 -0
- package/bin/oracle.mjs +28 -19
- package/docs/adding-a-chain.md +229 -0
- package/docs/architecture.md +139 -0
- package/docs/buzz-integration.md +115 -0
- package/docs/cli.md +143 -0
- package/docs/connectors.md +13 -0
- package/docs/hyperliquid-builder-code.md +50 -0
- package/docs/locals-only-fee-waiver.md +34 -0
- package/docs/oracle-pack-standard.md +29 -0
- package/docs/profiles.md +151 -0
- package/docs/public-surface.md +206 -0
- package/examples/add-a-chain.mjs +65 -0
- package/examples/oracle-pack-template.mjs +38 -0
- package/examples/research-a-token.mjs +70 -0
- package/package.json +110 -14
- package/plugins/oracle-owner-gate/__init__.py +288 -0
- package/plugins/oracle-owner-gate/plugin.yaml +9 -0
- package/profiles/_template/SOUL.md +54 -0
- package/profiles/_template/profile.json +22 -0
- package/profiles/bitcoin-agent/SOUL.md +31 -0
- package/profiles/bitcoin-agent/profile.json +32 -0
- package/profiles/hyperliquid-agent/SOUL.md +34 -0
- package/profiles/hyperliquid-agent/profile.json +38 -0
- package/profiles/oracle/SOUL.md +120 -0
- package/profiles/oracle/profile.json +40 -0
- package/profiles/polymarket-agent/SOUL.md +35 -0
- package/profiles/polymarket-agent/profile.json +34 -0
- package/profiles/profile.schema.json +90 -0
- package/profiles/protocol-builder/SOUL.md +57 -0
- package/profiles/protocol-builder/profile.json +39 -0
- package/profiles/robinhood-agent/SOUL.md +53 -0
- package/profiles/robinhood-agent/profile.json +41 -0
- package/profiles/solana-agent/SOUL.md +37 -0
- package/profiles/solana-agent/profile.json +38 -0
- package/profiles/stable-agent/SOUL.md +43 -0
- package/profiles/stable-agent/profile.json +38 -0
- package/protocols/templates/safe-erc20/SECURITY.md +16 -0
- package/protocols/templates/safe-erc20/foundry.toml +12 -0
- package/protocols/templates/safe-erc20/remappings.txt +2 -0
- package/protocols/templates/safe-erc20/src/SafeERC20.sol +53 -0
- package/protocols/templates/safe-erc20/test/SafeERC20.t.sol +72 -0
- package/public/agent-connect/app.js +84 -0
- package/public/agent-connect/index.html +83 -0
- package/public/agent-connect/styles.css +70 -0
- package/public/index.html +12 -0
- package/public/oracle-console/app.js +272 -0
- package/public/oracle-console/bitcoin-wallets.js +206 -0
- package/public/oracle-console/index.html +91 -0
- package/public/oracle-console/styles.css +239 -0
- package/public/oracle-splash/_variants/ice.html +2073 -0
- package/public/oracle-splash/_variants/ivory.html +2075 -0
- package/public/oracle-splash/assets/agents/claude.png +0 -0
- package/public/oracle-splash/assets/agents/codex.png +0 -0
- package/public/oracle-splash/assets/cli-chain-hyperliquid.jpg +0 -0
- package/public/oracle-splash/assets/desktop-app.jpg +0 -0
- package/public/oracle-splash/assets/hero/cli-session-poster.jpg +0 -0
- package/public/oracle-splash/assets/hero/cli-session.mp4 +0 -0
- package/public/oracle-splash/assets/hero/cli-session.webm +0 -0
- package/public/oracle-splash/assets/hero/orb-poster.jpg +0 -0
- package/public/oracle-splash/assets/hero/orb.avif +0 -0
- package/public/oracle-splash/assets/hero/orb.webm +0 -0
- package/public/oracle-splash/assets/hero/risk-session-poster.jpg +0 -0
- package/public/oracle-splash/assets/hero/risk-session.mp4 +0 -0
- package/public/oracle-splash/assets/hero/risk-session.webm +0 -0
- package/public/oracle-splash/assets/hero/route-session-poster.jpg +0 -0
- package/public/oracle-splash/assets/hero/route-session.mp4 +0 -0
- package/public/oracle-splash/assets/hero/route-session.webm +0 -0
- package/public/oracle-splash/assets/llms/claude.svg +1 -0
- package/public/oracle-splash/assets/llms/codex-icon.svg +1 -0
- package/public/oracle-splash/assets/llms/codex.svg +1 -0
- package/public/oracle-splash/assets/llms/cursor-icon.svg +12 -0
- package/public/oracle-splash/assets/llms/cursor.svg +17 -0
- package/public/oracle-splash/assets/llms/deepseek.svg +1 -0
- package/public/oracle-splash/assets/llms/gemini-icon.svg +1 -0
- package/public/oracle-splash/assets/llms/gemini.svg +1 -0
- package/public/oracle-splash/assets/llms/grok.svg +8 -0
- package/public/oracle-splash/assets/llms/hermes.png +0 -0
- package/public/oracle-splash/assets/llms/kimi-icon.svg +1 -0
- package/public/oracle-splash/assets/llms/kimi.svg +1 -0
- package/public/oracle-splash/assets/llms/manus.svg +18 -0
- package/public/oracle-splash/assets/llms/openclaw.svg +22 -0
- package/public/oracle-splash/assets/llms/perplexity.svg +1 -0
- package/public/oracle-splash/assets/llms/qwen.svg +1 -0
- package/public/oracle-splash/assets/llms/windsurf.svg +1 -0
- package/public/oracle-splash/assets/protocols/abcdex.png +0 -0
- package/public/oracle-splash/assets/protocols/across.png +0 -0
- package/public/oracle-splash/assets/protocols/aerodrome.png +0 -0
- package/public/oracle-splash/assets/protocols/balancer.png +0 -0
- package/public/oracle-splash/assets/protocols/cowswap.png +0 -0
- package/public/oracle-splash/assets/protocols/curve.png +0 -0
- package/public/oracle-splash/assets/protocols/dreamcash.png +0 -0
- package/public/oracle-splash/assets/protocols/felix.png +0 -0
- package/public/oracle-splash/assets/protocols/gmx.png +0 -0
- package/public/oracle-splash/assets/protocols/hyena.png +0 -0
- package/public/oracle-splash/assets/protocols/hyperbeat.png +0 -0
- package/public/oracle-splash/assets/protocols/hyperliquid.png +0 -0
- package/public/oracle-splash/assets/protocols/hyperswap.png +0 -0
- package/public/oracle-splash/assets/protocols/jupiter.png +0 -0
- package/public/oracle-splash/assets/protocols/kinetiq.png +0 -0
- package/public/oracle-splash/assets/protocols/lfj.png +0 -0
- package/public/oracle-splash/assets/protocols/lifi.png +0 -0
- package/public/oracle-splash/assets/protocols/magic-eden.png +0 -0
- package/public/oracle-splash/assets/protocols/morpho.png +0 -0
- package/public/oracle-splash/assets/protocols/odos.png +0 -0
- package/public/oracle-splash/assets/protocols/oneinch.png +0 -0
- package/public/oracle-splash/assets/protocols/opensea.png +0 -0
- package/public/oracle-splash/assets/protocols/pancakeswap.png +0 -0
- package/public/oracle-splash/assets/protocols/paragon.png +0 -0
- package/public/oracle-splash/assets/protocols/paraswap.png +0 -0
- package/public/oracle-splash/assets/protocols/pendle.png +0 -0
- package/public/oracle-splash/assets/protocols/polymarket.png +0 -0
- package/public/oracle-splash/assets/protocols/quickswap.png +0 -0
- package/public/oracle-splash/assets/protocols/relay.png +0 -0
- package/public/oracle-splash/assets/protocols/stargate.png +0 -0
- package/public/oracle-splash/assets/protocols/tradexyz.png +0 -0
- package/public/oracle-splash/assets/protocols/uniswap.png +0 -0
- package/public/oracle-splash/assets/protocols/velodrome.png +0 -0
- package/public/oracle-splash/assets/protocols/ventuals.png +0 -0
- package/public/oracle-splash/assets/wordmarks/across-icon.webp +0 -0
- package/public/oracle-splash/assets/wordmarks/across.svg +4 -0
- package/public/oracle-splash/assets/wordmarks/aerodrome.svg +23 -0
- package/public/oracle-splash/assets/wordmarks/balancer.svg +3 -0
- package/public/oracle-splash/assets/wordmarks/cowswap.svg +1 -0
- package/public/oracle-splash/assets/wordmarks/curve.png +0 -0
- package/public/oracle-splash/assets/wordmarks/gmx.svg +13 -0
- package/public/oracle-splash/assets/wordmarks/hop-icon.webp +0 -0
- package/public/oracle-splash/assets/wordmarks/hyena.svg +7 -0
- package/public/oracle-splash/assets/wordmarks/hyperliquid.svg +21 -0
- package/public/oracle-splash/assets/wordmarks/hyperswap.svg +13 -0
- package/public/oracle-splash/assets/wordmarks/jupiter.svg +35 -0
- package/public/oracle-splash/assets/wordmarks/kinetiq.svg +1 -0
- package/public/oracle-splash/assets/wordmarks/lfj.webp +0 -0
- package/public/oracle-splash/assets/wordmarks/lifi.png +0 -0
- package/public/oracle-splash/assets/wordmarks/magic-eden.svg +1 -0
- package/public/oracle-splash/assets/wordmarks/markets.svg +1 -0
- package/public/oracle-splash/assets/wordmarks/morpho.svg +1 -0
- package/public/oracle-splash/assets/wordmarks/odos.svg +3 -0
- package/public/oracle-splash/assets/wordmarks/oneinch-icon.webp +0 -0
- package/public/oracle-splash/assets/wordmarks/oneinch.svg +6 -0
- package/public/oracle-splash/assets/wordmarks/opensea-icon.svg +17 -0
- package/public/oracle-splash/assets/wordmarks/opensea.svg +1 -0
- package/public/oracle-splash/assets/wordmarks/outcome.svg +16 -0
- package/public/oracle-splash/assets/wordmarks/pancakeswap.svg +18 -0
- package/public/oracle-splash/assets/wordmarks/paragon.svg +9 -0
- package/public/oracle-splash/assets/wordmarks/paraswap.svg +16 -0
- package/public/oracle-splash/assets/wordmarks/pendle.png +0 -0
- package/public/oracle-splash/assets/wordmarks/polymarket.png +0 -0
- package/public/oracle-splash/assets/wordmarks/quickswap.png +0 -0
- package/public/oracle-splash/assets/wordmarks/relay.svg +8 -0
- package/public/oracle-splash/assets/wordmarks/satflow-icon.png +0 -0
- package/public/oracle-splash/assets/wordmarks/stargate-icon.webp +0 -0
- package/public/oracle-splash/assets/wordmarks/stargate.svg +15 -0
- package/public/oracle-splash/assets/wordmarks/uniswap.svg +18 -0
- package/public/oracle-splash/assets/wordmarks/velodrome.svg +84 -0
- package/public/oracle-splash/assets/wordmarks/xyz.svg +12 -0
- package/public/oracle-splash/assets/wordmarks/zerox-icon.webp +0 -0
- package/public/oracle-splash/brand/aave.webp +0 -0
- package/public/oracle-splash/brand/aavev2.webp +0 -0
- package/public/oracle-splash/brand/aborean.webp +0 -0
- package/public/oracle-splash/brand/across.webp +0 -0
- package/public/oracle-splash/brand/aerodrome.webp +0 -0
- package/public/oracle-splash/brand/afi.webp +0 -0
- package/public/oracle-splash/brand/arcus.webp +0 -0
- package/public/oracle-splash/brand/aster.webp +0 -0
- package/public/oracle-splash/brand/avant.webp +0 -0
- package/public/oracle-splash/brand/balancer.webp +0 -0
- package/public/oracle-splash/brand/beefy.webp +0 -0
- package/public/oracle-splash/brand/benqi.webp +0 -0
- package/public/oracle-splash/brand/bestinslot.ico +0 -0
- package/public/oracle-splash/brand/bitfi.webp +0 -0
- package/public/oracle-splash/brand/bonkswap.webp +0 -0
- package/public/oracle-splash/brand/bouncebit.webp +0 -0
- package/public/oracle-splash/brand/camelot.webp +0 -0
- package/public/oracle-splash/brand/compound.webp +0 -0
- package/public/oracle-splash/brand/concrete.webp +0 -0
- package/public/oracle-splash/brand/cow.webp +0 -0
- package/public/oracle-splash/brand/curve.webp +0 -0
- package/public/oracle-splash/brand/derive.webp +0 -0
- package/public/oracle-splash/brand/dolomite.webp +0 -0
- package/public/oracle-splash/brand/eigenlayer.webp +0 -0
- package/public/oracle-splash/brand/ekubo.webp +0 -0
- package/public/oracle-splash/brand/ethena.webp +0 -0
- package/public/oracle-splash/brand/etherfi.webp +0 -0
- package/public/oracle-splash/brand/etherfiborrow.webp +0 -0
- package/public/oracle-splash/brand/felix.webp +0 -0
- package/public/oracle-splash/brand/fluid.webp +0 -0
- package/public/oracle-splash/brand/fluxbeam.webp +0 -0
- package/public/oracle-splash/brand/folks.webp +0 -0
- package/public/oracle-splash/brand/fortyacres.webp +0 -0
- package/public/oracle-splash/brand/gainsnetwork.webp +0 -0
- package/public/oracle-splash/brand/gassss.webp +0 -0
- package/public/oracle-splash/brand/gmx.webp +0 -0
- package/public/oracle-splash/brand/harmonix.webp +0 -0
- package/public/oracle-splash/brand/hlorderbook.webp +0 -0
- package/public/oracle-splash/brand/hlp.webp +0 -0
- package/public/oracle-splash/brand/hop.webp +0 -0
- package/public/oracle-splash/brand/hyperbeat.webp +0 -0
- package/public/oracle-splash/brand/hyperlend.webp +0 -0
- package/public/oracle-splash/brand/hyperliquid.webp +0 -0
- package/public/oracle-splash/brand/hyperliquidhpl.webp +0 -0
- package/public/oracle-splash/brand/hyperliquidspot.webp +0 -0
- package/public/oracle-splash/brand/hyperswap.webp +0 -0
- package/public/oracle-splash/brand/hypha.webp +0 -0
- package/public/oracle-splash/brand/joedex.webp +0 -0
- package/public/oracle-splash/brand/jupiter.webp +0 -0
- package/public/oracle-splash/brand/kelp.webp +0 -0
- package/public/oracle-splash/brand/kinetiq.webp +0 -0
- package/public/oracle-splash/brand/kmhype.webp +0 -0
- package/public/oracle-splash/brand/kona.webp +0 -0
- package/public/oracle-splash/brand/konalend.webp +0 -0
- package/public/oracle-splash/brand/lfj.webp +0 -0
- package/public/oracle-splash/brand/lido.webp +0 -0
- package/public/oracle-splash/brand/lifi.webp +0 -0
- package/public/oracle-splash/brand/lighter.webp +0 -0
- package/public/oracle-splash/brand/lista.webp +0 -0
- package/public/oracle-splash/brand/loopedhype.webp +0 -0
- package/public/oracle-splash/brand/lorenzo.webp +0 -0
- package/public/oracle-splash/brand/magic-eden.webp +0 -0
- package/public/oracle-splash/brand/magiceden.webp +0 -0
- package/public/oracle-splash/brand/mempool.png +0 -0
- package/public/oracle-splash/brand/meteora.webp +0 -0
- package/public/oracle-splash/brand/morpho.webp +0 -0
- package/public/oracle-splash/brand/myriad.webp +0 -0
- package/public/oracle-splash/brand/noxa.webp +0 -0
- package/public/oracle-splash/brand/odos.webp +0 -0
- package/public/oracle-splash/brand/oneinch.webp +0 -0
- package/public/oracle-splash/brand/openbook.webp +0 -0
- package/public/oracle-splash/brand/opensea.webp +0 -0
- package/public/oracle-splash/brand/orca.webp +0 -0
- package/public/oracle-splash/brand/ordinals.png +0 -0
- package/public/oracle-splash/brand/ostium.webp +0 -0
- package/public/oracle-splash/brand/pancakeswap.webp +0 -0
- package/public/oracle-splash/brand/pendle.webp +0 -0
- package/public/oracle-splash/brand/perena.webp +0 -0
- package/public/oracle-splash/brand/pharaoh.webp +0 -0
- package/public/oracle-splash/brand/phoenix.webp +0 -0
- package/public/oracle-splash/brand/polymarket.webp +0 -0
- package/public/oracle-splash/brand/polynomial.webp +0 -0
- package/public/oracle-splash/brand/projectx.webp +0 -0
- package/public/oracle-splash/brand/pumpfun.webp +0 -0
- package/public/oracle-splash/brand/quickswap.webp +0 -0
- package/public/oracle-splash/brand/rain.webp +0 -0
- package/public/oracle-splash/brand/raydium.webp +0 -0
- package/public/oracle-splash/brand/relay.webp +0 -0
- package/public/oracle-splash/brand/rocketpool.webp +0 -0
- package/public/oracle-splash/brand/saber.webp +0 -0
- package/public/oracle-splash/brand/sakuraswap.webp +0 -0
- package/public/oracle-splash/brand/sanctum.webp +0 -0
- package/public/oracle-splash/brand/satflow.png +0 -0
- package/public/oracle-splash/brand/sierra.webp +0 -0
- package/public/oracle-splash/brand/sky.webp +0 -0
- package/public/oracle-splash/brand/solv.webp +0 -0
- package/public/oracle-splash/brand/spark.webp +0 -0
- package/public/oracle-splash/brand/sparksavings.webp +0 -0
- package/public/oracle-splash/brand/sphere.webp +0 -0
- package/public/oracle-splash/brand/ssv.webp +0 -0
- package/public/oracle-splash/brand/stabble.webp +0 -0
- package/public/oracle-splash/brand/stableswap.webp +0 -0
- package/public/oracle-splash/brand/stakewise.webp +0 -0
- package/public/oracle-splash/brand/stargate.webp +0 -0
- package/public/oracle-splash/brand/sthype.webp +0 -0
- package/public/oracle-splash/brand/sushiswap.webp +0 -0
- package/public/oracle-splash/brand/unisat.png +0 -0
- package/public/oracle-splash/brand/uniswap.webp +0 -0
- package/public/oracle-splash/brand/uniswapv2.webp +0 -0
- package/public/oracle-splash/brand/uniswapv4.webp +0 -0
- package/public/oracle-splash/brand/unit.webp +0 -0
- package/public/oracle-splash/brand/velodrome.webp +0 -0
- package/public/oracle-splash/brand/velora.webp +0 -0
- package/public/oracle-splash/brand/venus.webp +0 -0
- package/public/oracle-splash/brand/wbeth.webp +0 -0
- package/public/oracle-splash/brand/xsy.webp +0 -0
- package/public/oracle-splash/brand/yieldyak.webp +0 -0
- package/public/oracle-splash/brand/zerobase.webp +0 -0
- package/public/oracle-splash/brand/zerox.webp +0 -0
- package/public/oracle-splash/downloads/index.html +52 -0
- package/public/oracle-splash/favicon.ico +0 -0
- package/public/oracle-splash/favicon.svg +6 -0
- package/public/oracle-splash/index.html +2537 -0
- package/public/oracle-splash/mesh-graph.png +0 -0
- package/public/oracle-splash/mesh-graph.svg +216 -0
- package/scripts/adversarial-bench.mjs +114 -0
- package/scripts/build-dist.mjs +119 -0
- package/scripts/build-inscription.py +230 -0
- package/scripts/check-doc-drift.mjs +123 -0
- package/scripts/check-test-count.mjs +105 -0
- package/scripts/e2e-hl-markets.mjs +21 -0
- package/scripts/e2e-hl-perps.mjs +48 -0
- package/scripts/e2e-hypercore-staking.mjs +128 -0
- package/scripts/e2e-solana-bitcoin.mjs +183 -0
- package/scripts/guard-publish.mjs +22 -0
- package/scripts/protocol-template-gate.mjs +15 -0
- package/scripts/public-api-scan.mjs +23 -0
- package/scripts/publish-dist.mjs +67 -0
- package/scripts/record-hero-cli.sh +80 -0
- package/scripts/secret-scan.mjs +168 -0
- package/scripts/smoke-dist-bins.mjs +89 -0
- package/scripts/verify-dist.mjs +29 -0
- package/scripts/verify-v3-venues.mjs +233 -0
- package/skills/balance/SKILL.md +176 -0
- package/skills/bitcoin-l1.md +33 -0
- package/skills/chain-defi-ecosystem-profiling.md +27 -0
- package/skills/evm-contract-research.md +27 -0
- package/skills/hyperliquid.md +26 -0
- package/skills/multichain-exec-desk.md +33 -0
- package/skills/oracle-action-semantics/SKILL.md +40 -0
- package/skills/oracle-best-execution/SKILL.md +127 -0
- package/skills/oracle-best-execution.md +27 -0
- package/skills/oracle-bitcoin/SKILL.md +53 -0
- package/skills/oracle-chain-graphs-telegram-cards/SKILL.md +59 -0
- package/skills/oracle-chat/SKILL.md +61 -0
- package/skills/oracle-chat/chain.SKILL.md +31 -0
- package/skills/oracle-chat/setup.SKILL.md +37 -0
- package/skills/oracle-circuit-breaker/SKILL.md +51 -0
- package/skills/oracle-contract-research/SKILL.md +55 -0
- package/skills/oracle-desk/SKILL.md +58 -0
- package/skills/oracle-desk.md +27 -0
- package/skills/oracle-dex-launch/SKILL.md +38 -0
- package/skills/oracle-equities/SKILL.md +62 -0
- package/skills/oracle-grants/SKILL.md +69 -0
- package/skills/oracle-hypercore-staking/SKILL.md +57 -0
- package/skills/oracle-hyperliquid/SKILL.md +56 -0
- package/skills/oracle-meme-token-sniper/SKILL.md +73 -0
- package/skills/oracle-multichain-nft-launch/SKILL.md +338 -0
- package/skills/oracle-multichain-token-launch/SKILL.md +300 -0
- package/skills/oracle-nft-gacha-launch/SKILL.md +48 -0
- package/skills/oracle-nft-mint-gas-war/SKILL.md +63 -0
- package/skills/oracle-polymarket/SKILL.md +60 -0
- package/skills/oracle-protocol-builder/SKILL.md +59 -0
- package/skills/oracle-protocol-security/SKILL.md +60 -0
- package/skills/oracle-public-product/SKILL.md +44 -0
- package/skills/oracle-receipts/SKILL.md +52 -0
- package/skills/oracle-receipts.md +29 -0
- package/skills/oracle-rfq-tokenized-assets/SKILL.md +69 -0
- package/skills/oracle-smart-wallet-scanner/SKILL.md +49 -0
- package/skills/oracle-solana/SKILL.md +65 -0
- package/skills/oracle-solana-nft/SKILL.md +54 -0
- package/skills/oracle-token-research/SKILL.md +67 -0
- package/skills/solana.md +22 -0
- package/skins/oracle.yaml +56 -0
- package/src/action-receipts.mjs +265 -0
- package/src/action-semantics.mjs +62 -0
- package/src/address-book.mjs +208 -0
- package/src/agent-auth.mjs +206 -0
- package/src/approval-guard.mjs +282 -0
- package/src/attestation-secret.mjs +94 -0
- package/src/audit-log.mjs +196 -0
- package/src/auth/oauth.mjs +672 -0
- package/src/auto-slippage.mjs +378 -0
- package/src/capability-posture.mjs +125 -0
- package/src/cards.mjs +422 -0
- package/src/chains.mjs +62 -0
- package/src/cli/chain-catalog.mjs +215 -0
- package/src/cli/chain-state.mjs +74 -0
- package/src/cli/commands/auth.mjs +193 -0
- package/src/cli/commands/bootstrap.mjs +87 -0
- package/src/cli/commands/chain.mjs +143 -0
- package/src/cli/commands/chat.mjs +465 -0
- package/src/cli/commands/credential.mjs +9 -0
- package/src/cli/commands/data-mcp.mjs +18 -0
- package/src/cli/commands/data.mjs +75 -0
- package/src/cli/commands/doctor.mjs +136 -0
- package/src/cli/commands/equities.mjs +41 -0
- package/src/cli/commands/farm.mjs +129 -0
- package/src/cli/commands/fees.mjs +109 -0
- package/src/cli/commands/follow.mjs +130 -0
- package/src/cli/commands/harness.mjs +63 -0
- package/src/cli/commands/help.mjs +7 -0
- package/src/cli/commands/init.mjs +27 -0
- package/src/cli/commands/mcp.mjs +154 -0
- package/src/cli/commands/model.mjs +106 -0
- package/src/cli/commands/plugins.mjs +241 -0
- package/src/cli/commands/prepare.mjs +12 -0
- package/src/cli/commands/public.mjs +20 -0
- package/src/cli/commands/resolve.mjs +64 -0
- package/src/cli/commands/route.mjs +12 -0
- package/src/cli/commands/runner.mjs +9 -0
- package/src/cli/commands/scan.mjs +12 -0
- package/src/cli/commands/setup.mjs +294 -0
- package/src/cli/commands/sign.mjs +21 -0
- package/src/cli/commands/signer.mjs +9 -0
- package/src/cli/commands/swap.mjs +102 -0
- package/src/cli/commands/upgrade.mjs +12 -0
- package/src/cli/commands/vault.mjs +9 -0
- package/src/cli/commands/version.mjs +22 -0
- package/src/cli/first-run.mjs +23 -0
- package/src/cli/kernel.mjs +262 -0
- package/src/cli/mcp-targets/chatgpt.mjs +51 -0
- package/src/cli/mcp-targets/claude-code.mjs +39 -0
- package/src/cli/mcp-targets/claude-desktop.mjs +24 -0
- package/src/cli/mcp-targets/codex.mjs +41 -0
- package/src/cli/mcp-targets/cursor.mjs +32 -0
- package/src/cli/mcp-targets/shared.mjs +71 -0
- package/src/cli/mcp-targets/vscode.mjs +39 -0
- package/src/cli/messaging-platforms.mjs +217 -0
- package/src/cli/model-config.mjs +78 -0
- package/src/cli/operator-dispatch.mjs +257 -0
- package/src/cli/oracle-harness.py +415 -0
- package/src/cli/paths.mjs +107 -0
- package/src/cli/runtime.mjs +351 -0
- package/src/cli/setup-state.mjs +168 -0
- package/src/cli/spawn-child.mjs +43 -0
- package/src/data/catalog.mjs +858 -0
- package/src/data/desk-data.mjs +877 -0
- package/src/data/http.mjs +253 -0
- package/src/data/names.mjs +188 -0
- package/src/data/provider-endpoint.mjs +94 -0
- package/src/data/providers/aave-v3.mjs +139 -0
- package/src/data/providers/across-bridge.mjs +41 -0
- package/src/data/providers/aerodrome.mjs +245 -0
- package/src/data/providers/aevo.mjs +33 -0
- package/src/data/providers/approval-indexer.mjs +133 -0
- package/src/data/providers/approvals.mjs +594 -0
- package/src/data/providers/babylon-staking.mjs +149 -0
- package/src/data/providers/balancer.mjs +209 -0
- package/src/data/providers/beefy-yields.mjs +45 -0
- package/src/data/providers/birdeye-tokens.mjs +33 -0
- package/src/data/providers/bisq-markets.mjs +145 -0
- package/src/data/providers/bitcoin-esplora.mjs +216 -0
- package/src/data/providers/bitcoin-meta.mjs +378 -0
- package/src/data/providers/blockscout.mjs +14 -0
- package/src/data/providers/bob-rootstock.mjs +198 -0
- package/src/data/providers/braiins-insights.mjs +103 -0
- package/src/data/providers/bridge-aggregator.mjs +259 -0
- package/src/data/providers/bridges.mjs +242 -0
- package/src/data/providers/bungee.mjs +29 -0
- package/src/data/providers/celestia-da.mjs +38 -0
- package/src/data/providers/changenow.mjs +135 -0
- package/src/data/providers/compound.mjs +32 -0
- package/src/data/providers/connext.mjs +28 -0
- package/src/data/providers/convex.mjs +30 -0
- package/src/data/providers/cow-protocol.mjs +110 -0
- package/src/data/providers/cowswap.mjs +415 -0
- package/src/data/providers/curve.mjs +201 -0
- package/src/data/providers/das-assets.mjs +59 -0
- package/src/data/providers/debridge.mjs +109 -0
- package/src/data/providers/defillama.mjs +88 -0
- package/src/data/providers/dexscreener.mjs +43 -0
- package/src/data/providers/drift.mjs +32 -0
- package/src/data/providers/dydx.mjs +41 -0
- package/src/data/providers/evm-rpc.mjs +225 -0
- package/src/data/providers/farming.mjs +291 -0
- package/src/data/providers/geckoterminal.mjs +34 -0
- package/src/data/providers/gmx.mjs +496 -0
- package/src/data/providers/hiro-stacks.mjs +150 -0
- package/src/data/providers/hl-assets.mjs +165 -0
- package/src/data/providers/hl-info.mjs +108 -0
- package/src/data/providers/hl-markets.mjs +210 -0
- package/src/data/providers/hl-outcome.mjs +61 -0
- package/src/data/providers/hl-perps.mjs +419 -0
- package/src/data/providers/hl-staking.mjs +353 -0
- package/src/data/providers/hl-ws.mjs +119 -0
- package/src/data/providers/hyperevm-dex.mjs +49 -0
- package/src/data/providers/jito-mev.mjs +117 -0
- package/src/data/providers/jupiter-venues.mjs +119 -0
- package/src/data/providers/jupiter.mjs +315 -0
- package/src/data/providers/kamino-strategies.mjs +143 -0
- package/src/data/providers/l2beat-tvl.mjs +42 -0
- package/src/data/providers/lifi.mjs +166 -0
- package/src/data/providers/liquid-esplora.mjs +152 -0
- package/src/data/providers/magiceden-ordinals.mjs +141 -0
- package/src/data/providers/magiceden-sol.mjs +406 -0
- package/src/data/providers/mempool-lightning.mjs +144 -0
- package/src/data/providers/mempool-mining.mjs +142 -0
- package/src/data/providers/meteora-dlmm.mjs +168 -0
- package/src/data/providers/morpho.mjs +177 -0
- package/src/data/providers/nft-gallery.mjs +163 -0
- package/src/data/providers/nft-portfolio.mjs +494 -0
- package/src/data/providers/odos.mjs +156 -0
- package/src/data/providers/ondo.mjs +31 -0
- package/src/data/providers/oneinch.mjs +174 -0
- package/src/data/providers/opensea-multichain.mjs +136 -0
- package/src/data/providers/opensea-nft.mjs +371 -0
- package/src/data/providers/orca.mjs +29 -0
- package/src/data/providers/ordinals-runes.mjs +180 -0
- package/src/data/providers/pancakeswap.mjs +28 -0
- package/src/data/providers/paraswap.mjs +125 -0
- package/src/data/providers/pendle.mjs +188 -0
- package/src/data/providers/poly-clob.mjs +283 -0
- package/src/data/providers/poly-public.mjs +96 -0
- package/src/data/providers/poly-ws.mjs +103 -0
- package/src/data/providers/polygon-staking.mjs +227 -0
- package/src/data/providers/portfolio-history.mjs +394 -0
- package/src/data/providers/portfolio.mjs +600 -0
- package/src/data/providers/pyth-price-feeds.mjs +172 -0
- package/src/data/providers/raydium.mjs +35 -0
- package/src/data/providers/relayscan-mev.mjs +72 -0
- package/src/data/providers/rfq.mjs +15 -0
- package/src/data/providers/rh-agent.mjs +59 -0
- package/src/data/providers/sanctum-lst.mjs +180 -0
- package/src/data/providers/satflow.mjs +341 -0
- package/src/data/providers/signed-material-guard.mjs +108 -0
- package/src/data/providers/solana-rpc.mjs +197 -0
- package/src/data/providers/solend-lending.mjs +166 -0
- package/src/data/providers/spark-lend.mjs +42 -0
- package/src/data/providers/squid-router.mjs +29 -0
- package/src/data/providers/stargate.mjs +29 -0
- package/src/data/providers/sushiswap.mjs +30 -0
- package/src/data/providers/symbiotic-restaking.mjs +41 -0
- package/src/data/providers/thorchain.mjs +36 -0
- package/src/data/providers/traderjoe.mjs +28 -0
- package/src/data/providers/twap.mjs +152 -0
- package/src/data/providers/uniswap-v3.mjs +457 -0
- package/src/data/providers/uniswap-v4.mjs +414 -0
- package/src/data/providers/vertex.mjs +41 -0
- package/src/data/providers/wallet-watch.mjs +264 -0
- package/src/data/providers/wormhole.mjs +28 -0
- package/src/data/providers/yearn.mjs +31 -0
- package/src/data/providers/zerox.mjs +167 -0
- package/src/data/public-api-scan.mjs +61 -0
- package/src/data/quote-placeholder.mjs +31 -0
- package/src/desk/swap-prepare.mjs +194 -0
- package/src/equities/bridge.mjs +388 -0
- package/src/equities/fixtures/bridge_routes.json +159 -0
- package/src/equities/fixtures/dst_transitions.json +29 -0
- package/src/equities/fixtures/equity_dex_pools.json +154 -0
- package/src/equities/fixtures/hip3_l2books.json +2711 -0
- package/src/equities/fixtures/nyse_holidays.json +1 -0
- package/src/equities/fixtures/oracles.json +100 -0
- package/src/equities/fixtures/rh_pool_state.json +244 -0
- package/src/equities/fixtures/solana_xstocks.json +704 -0
- package/src/equities/fixtures/ton_xstocks.json +35 -0
- package/src/equities/fixtures/universe.json +411 -0
- package/src/equities/fixtures/venues.json +3542 -0
- package/src/equities/fixtures.mjs +405 -0
- package/src/equities/funding.mjs +142 -0
- package/src/equities/index.mjs +166 -0
- package/src/equities/liveness.mjs +148 -0
- package/src/equities/marketHours.mjs +249 -0
- package/src/equities/normalize.mjs +295 -0
- package/src/equities/num.mjs +146 -0
- package/src/equities/prepare.mjs +95 -0
- package/src/equities/rank.mjs +260 -0
- package/src/equities/sourceNum.mjs +69 -0
- package/src/equities/types.mjs +220 -0
- package/src/equities/venues/arcus-perp.mjs +84 -0
- package/src/equities/venues/arcus-spot.mjs +105 -0
- package/src/equities/venues/hyperliquid-hip3.mjs +224 -0
- package/src/equities/venues/rh-uniswap.mjs +216 -0
- package/src/equities/venues/solana-xstocks.mjs +139 -0
- package/src/equities/venues/ton-stonfi.mjs +139 -0
- package/src/exact-integer.mjs +72 -0
- package/src/exec-policy.mjs +419 -0
- package/src/flags.mjs +15 -0
- package/src/fresh-window.mjs +76 -0
- package/src/gmx-attestation.mjs +176 -0
- package/src/index.mjs +107 -0
- package/src/licensing/locals-only.mjs +25 -0
- package/src/nft-gas-war-guard.mjs +139 -0
- package/src/onboarding/agent-keys.mjs +161 -0
- package/src/onboarding/harness-configs.mjs +102 -0
- package/src/onboarding/index.mjs +18 -0
- package/src/onboarding/tiers.mjs +139 -0
- package/src/oracle-env.mjs +55 -0
- package/src/package-manifest.mjs +42 -0
- package/src/plugins/agent-plugin-loader.mjs +225 -0
- package/src/portfolio-risk.mjs +170 -0
- package/src/prepare-envelope.mjs +204 -0
- package/src/profile-upgrade.mjs +277 -0
- package/src/protocol-execution.mjs +84 -0
- package/src/protocol-templates/gate.mjs +179 -0
- package/src/protocol-templates/prepare-deploy.mjs +81 -0
- package/src/public-api/agent-grants.mjs +57 -0
- package/src/public-api/buzz-integration.mjs +267 -0
- package/src/public-api/connect-agent.mjs +424 -0
- package/src/public-api/grants.mjs +142 -0
- package/src/public-api/http.mjs +707 -0
- package/src/public-api/metering.mjs +111 -0
- package/src/public-control/aa-adapter.mjs +402 -0
- package/src/public-control/build-registry.mjs +227 -0
- package/src/public-control/bundler-client.mjs +357 -0
- package/src/public-control/grant-indexer.mjs +296 -0
- package/src/public-control/policy-render.mjs +69 -0
- package/src/public-control/policy-schema.mjs +322 -0
- package/src/public-control/runtime-config.mjs +275 -0
- package/src/public-control/session-key-model.mjs +379 -0
- package/src/public-control/session-orchestrator.mjs +418 -0
- package/src/rfq/intent.mjs +180 -0
- package/src/rfq/sources.mjs +181 -0
- package/src/route-attestation.mjs +132 -0
- package/src/router/best-execution.mjs +326 -0
- package/src/router/index.mjs +250 -0
- package/src/router/integrator-fee.mjs +135 -0
- package/src/router/prepare-bridge.mjs +293 -0
- package/src/router/prepare-route.mjs +398 -0
- package/src/router/proposal.mjs +311 -0
- package/src/router/risk-classifier.mjs +119 -0
- package/src/router/route-sources.mjs +364 -0
- package/src/scanner/chains.config.mjs +543 -0
- package/src/scanner/contract.mjs +270 -0
- package/src/scanner/evm-scanner.mjs +394 -0
- package/src/scanner/index.mjs +9 -0
- package/src/scanner/v2-venue.mjs +351 -0
- package/src/scanner/v3-venue.mjs +308 -0
- package/src/scopes.mjs +44 -0
- package/src/sell-simulation.mjs +167 -0
- package/src/signals/engine.mjs +146 -0
- package/src/signals/index.mjs +1 -0
- package/src/token-transfer-guard.mjs +188 -0
- package/src/tui/app.mjs +438 -0
- package/src/tui/backend.mjs +215 -0
- package/src/tui/format.mjs +272 -0
- package/src/tui/gateway-client.mjs +177 -0
- package/src/tui/input.mjs +501 -0
- package/src/tui/memory.mjs +105 -0
- package/src/tui/meta-learn.mjs +85 -0
- package/src/tui/renderer.mjs +443 -0
- package/src/tui/scheduler.mjs +205 -0
- package/src/tui/skills-loader.mjs +140 -0
- package/src/tui/standalone-client.mjs +752 -0
- package/src/tui/theme.mjs +81 -0
- package/src/vault-attestation.mjs +146 -0
- package/src/venues.mjs +206 -0
- package/src/watch-preferences.mjs +85 -0
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
// Bitcoin L1 read/broadcast via Esplora HTTP (mempool.space / Blockstream).
|
|
2
|
+
// No Bitcoin Core RPC required. No keys, no signing.
|
|
3
|
+
|
|
4
|
+
import { httpJson } from "../http.mjs";
|
|
5
|
+
|
|
6
|
+
export const BTC_NETWORK_MAINNET = "mainnet";
|
|
7
|
+
export const BTC_ESPLORA_MAINNET = "https://mempool.space/api";
|
|
8
|
+
export const BTC_ESPLORA_TESTNET = "https://mempool.space/testnet/api";
|
|
9
|
+
|
|
10
|
+
function network(opts = {}) {
|
|
11
|
+
const n = String(opts.network || process.env.BTC_NETWORK || BTC_NETWORK_MAINNET).trim().toLowerCase();
|
|
12
|
+
return n === "testnet" ? "testnet" : "mainnet";
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function baseUrl(opts = {}) {
|
|
16
|
+
if (opts.baseUrl) return String(opts.baseUrl).replace(/\/$/, "");
|
|
17
|
+
if (process.env.BTC_ESPLORA_URL) return String(process.env.BTC_ESPLORA_URL).replace(/\/$/, "");
|
|
18
|
+
return network(opts) === "testnet" ? BTC_ESPLORA_TESTNET : BTC_ESPLORA_MAINNET;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function btcAddress(value, label = "address") {
|
|
22
|
+
const text = String(value || "").trim();
|
|
23
|
+
// bech32 / bech32m / legacy / p2sh — loose shape check, not full BIP validation
|
|
24
|
+
if (!/^(bc1|tb1|bcrt1)[a-z0-9]{20,90}$/i.test(text) && !/^[13mn2][a-km-zA-HJ-NP-Z1-9]{25,34}$/.test(text)) {
|
|
25
|
+
throw new Error(`bitcoin-esplora: ${label} must look like a Bitcoin address`);
|
|
26
|
+
}
|
|
27
|
+
return text;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function btcTxHex(value, label = "txHex") {
|
|
31
|
+
const text = String(value || "").trim().toLowerCase().replace(/^0x/, "");
|
|
32
|
+
if (!/^[0-9a-f]+$/.test(text) || text.length < 20 || text.length % 2 !== 0) {
|
|
33
|
+
throw new Error(`bitcoin-esplora: ${label} must be even-length hex`);
|
|
34
|
+
}
|
|
35
|
+
return text;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
async function getText(path, opts = {}) {
|
|
39
|
+
const url = `${baseUrl(opts)}${path.startsWith("/") ? path : `/${path}`}`;
|
|
40
|
+
const fetchImpl = opts.fetchImpl || fetch;
|
|
41
|
+
const res = await fetchImpl(url, {
|
|
42
|
+
method: "GET",
|
|
43
|
+
headers: { accept: "application/json,text/plain;q=0.9,*/*;q=0.8" },
|
|
44
|
+
signal: AbortSignal.timeout(opts.timeoutMs ?? 12_000),
|
|
45
|
+
});
|
|
46
|
+
const text = await res.text();
|
|
47
|
+
if (!res.ok) throw new Error(`bitcoin-esplora GET ${path}: HTTP ${res.status} ${text.slice(0, 160)}`);
|
|
48
|
+
return text;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async function getJson(path, opts = {}) {
|
|
52
|
+
const text = await getText(path, opts);
|
|
53
|
+
try {
|
|
54
|
+
return JSON.parse(text);
|
|
55
|
+
} catch {
|
|
56
|
+
return text;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
async function postText(path, body, opts = {}) {
|
|
61
|
+
const url = `${baseUrl(opts)}${path.startsWith("/") ? path : `/${path}`}`;
|
|
62
|
+
const fetchImpl = opts.fetchImpl || fetch;
|
|
63
|
+
const res = await fetchImpl(url, {
|
|
64
|
+
method: "POST",
|
|
65
|
+
headers: { "content-type": "text/plain", accept: "application/json,text/plain;q=0.9,*/*;q=0.8" },
|
|
66
|
+
body: String(body || ""),
|
|
67
|
+
signal: AbortSignal.timeout(opts.timeoutMs ?? 15_000),
|
|
68
|
+
});
|
|
69
|
+
const text = await res.text();
|
|
70
|
+
if (!res.ok) throw new Error(`bitcoin-esplora POST ${path}: HTTP ${res.status} ${text.slice(0, 200)}`);
|
|
71
|
+
return text.trim();
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export async function btcHealth(opts = {}) {
|
|
75
|
+
try {
|
|
76
|
+
const tip = await getText("/blocks/tip/height", opts);
|
|
77
|
+
const height = Number(tip);
|
|
78
|
+
return {
|
|
79
|
+
ok: Number.isFinite(height) && height > 0,
|
|
80
|
+
provider: "bitcoin-esplora",
|
|
81
|
+
network: network(opts),
|
|
82
|
+
baseUrl: baseUrl(opts),
|
|
83
|
+
tipHeight: height,
|
|
84
|
+
exec: false,
|
|
85
|
+
signing: "user-wallet",
|
|
86
|
+
};
|
|
87
|
+
} catch (error) {
|
|
88
|
+
return {
|
|
89
|
+
ok: false,
|
|
90
|
+
provider: "bitcoin-esplora",
|
|
91
|
+
network: network(opts),
|
|
92
|
+
baseUrl: baseUrl(opts),
|
|
93
|
+
error: String(error?.message || error),
|
|
94
|
+
exec: false,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export async function btcTipHeight(opts = {}) {
|
|
100
|
+
const tip = await getText("/blocks/tip/height", opts);
|
|
101
|
+
return {
|
|
102
|
+
provider: "bitcoin-esplora",
|
|
103
|
+
network: network(opts),
|
|
104
|
+
tipHeight: Number(tip),
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export async function btcFees(opts = {}) {
|
|
109
|
+
// mempool.space recommended fees; Blockstream may 404 — fall back empty
|
|
110
|
+
try {
|
|
111
|
+
const fees = await getJson("/v1/fees/recommended", opts);
|
|
112
|
+
return {
|
|
113
|
+
provider: "bitcoin-esplora",
|
|
114
|
+
network: network(opts),
|
|
115
|
+
fastestFee: fees.fastestFee ?? null,
|
|
116
|
+
halfHourFee: fees.halfHourFee ?? null,
|
|
117
|
+
hourFee: fees.hourFee ?? null,
|
|
118
|
+
economyFee: fees.economyFee ?? null,
|
|
119
|
+
minimumFee: fees.minimumFee ?? null,
|
|
120
|
+
raw: fees,
|
|
121
|
+
};
|
|
122
|
+
} catch {
|
|
123
|
+
return {
|
|
124
|
+
provider: "bitcoin-esplora",
|
|
125
|
+
network: network(opts),
|
|
126
|
+
fastestFee: null,
|
|
127
|
+
halfHourFee: null,
|
|
128
|
+
hourFee: null,
|
|
129
|
+
note: "fee endpoint unavailable on this Esplora host",
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export async function btcAddressInfo(args = {}, opts = {}) {
|
|
135
|
+
const address = btcAddress(args.address || args.addr, "address");
|
|
136
|
+
const info = await getJson(`/address/${address}`, opts);
|
|
137
|
+
const chain = info.chain_stats || {};
|
|
138
|
+
const mempool = info.mempool_stats || {};
|
|
139
|
+
const funded = Number(chain.funded_txo_sum || 0) + Number(mempool.funded_txo_sum || 0);
|
|
140
|
+
const spent = Number(chain.spent_txo_sum || 0) + Number(mempool.spent_txo_sum || 0);
|
|
141
|
+
return {
|
|
142
|
+
provider: "bitcoin-esplora",
|
|
143
|
+
network: network(opts),
|
|
144
|
+
address,
|
|
145
|
+
balanceSats: String(funded - spent),
|
|
146
|
+
chainStats: chain,
|
|
147
|
+
mempoolStats: mempool,
|
|
148
|
+
raw: info,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export async function btcUtxos(args = {}, opts = {}) {
|
|
153
|
+
const address = btcAddress(args.address || args.addr, "address");
|
|
154
|
+
const utxos = await getJson(`/address/${address}/utxo`, opts);
|
|
155
|
+
const list = Array.isArray(utxos) ? utxos : [];
|
|
156
|
+
return {
|
|
157
|
+
provider: "bitcoin-esplora",
|
|
158
|
+
network: network(opts),
|
|
159
|
+
address,
|
|
160
|
+
count: list.length,
|
|
161
|
+
totalSats: String(list.reduce((n, u) => n + Number(u.value || 0), 0)),
|
|
162
|
+
utxos: list.map((u) => ({
|
|
163
|
+
txid: u.txid,
|
|
164
|
+
vout: u.vout,
|
|
165
|
+
value: Number(u.value || 0),
|
|
166
|
+
status: u.status || null,
|
|
167
|
+
})),
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export async function btcTx(args = {}, opts = {}) {
|
|
172
|
+
const txid = String(args.txid || args.txId || "").trim().toLowerCase();
|
|
173
|
+
if (!/^[0-9a-f]{64}$/.test(txid)) throw new Error("bitcoin-esplora: txid must be 64-char hex");
|
|
174
|
+
const tx = await getJson(`/tx/${txid}`, opts);
|
|
175
|
+
return {
|
|
176
|
+
provider: "bitcoin-esplora",
|
|
177
|
+
network: network(opts),
|
|
178
|
+
txid,
|
|
179
|
+
confirmed: Boolean(tx.status?.confirmed),
|
|
180
|
+
fee: tx.fee ?? null,
|
|
181
|
+
size: tx.size ?? null,
|
|
182
|
+
weight: tx.weight ?? null,
|
|
183
|
+
vinCount: Array.isArray(tx.vin) ? tx.vin.length : null,
|
|
184
|
+
voutCount: Array.isArray(tx.vout) ? tx.vout.length : null,
|
|
185
|
+
raw: tx,
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
export async function btcDecodeTxHex(args = {}, opts = {}) {
|
|
190
|
+
const txHex = btcTxHex(args.txHex || args.hex || args.transaction, "txHex");
|
|
191
|
+
// Esplora has no universal decode; return structural summary from hex length + optional /tx/hex reverse via broadcast dry path.
|
|
192
|
+
return {
|
|
193
|
+
provider: "bitcoin-esplora",
|
|
194
|
+
network: network(opts),
|
|
195
|
+
encoding: "hex",
|
|
196
|
+
txHex,
|
|
197
|
+
byteLength: txHex.length / 2,
|
|
198
|
+
note: "full decode is wallet/client-side or via bitcoinjs; Esplora returns broadcast acceptance only",
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Broadcast a fully signed raw transaction hex.
|
|
204
|
+
*
|
|
205
|
+
* Posture: broadcasting is ARMED whenever the caller has signed bytes to send —
|
|
206
|
+
* possessing a signed transaction IS the authorization. What is still required
|
|
207
|
+
* is that the SEND be asked for: `execute:true` marks a user-initiated
|
|
208
|
+
* broadcast, so nothing goes out as a side effect of a read path. Oracle never
|
|
209
|
+
* signs here; the caller supplies the bytes.
|
|
210
|
+
*/
|
|
211
|
+
export async function btcBroadcast(_a = {}, _o = {}) {
|
|
212
|
+
throw new Error("bitcoin-esplora.btcBroadcast refused: @oracle-agent/oracle is prepare-only. Broadcast from the user wallet or a local operator process.");
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// Keep httpJson import usable for Core RPC optional path later without circular deps.
|
|
216
|
+
void httpJson;
|
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
// Bitcoin metaprotocol reads (ordinals / runes).
|
|
2
|
+
// Pluggable indexer base. No keys in repo — optional API keys via env.
|
|
3
|
+
//
|
|
4
|
+
// Free keyless tier: ordinals.com recursive ("/r/*") endpoints. Verified live
|
|
5
|
+
// 2026-07: blockheight, blockhash, blockinfo, inscription metadata, children,
|
|
6
|
+
// sat. These are the ord node's own recursive API and need no key.
|
|
7
|
+
//
|
|
8
|
+
// Indexer landscape as probed (do not re-litigate without re-probing):
|
|
9
|
+
// ordinals.com /r/* 200, keyless -> wired below
|
|
10
|
+
// Hiro ordinals/brc20 410 GONE, deprecated -> dead, do not use
|
|
11
|
+
// Ordiscan 402 payment required
|
|
12
|
+
// UniSat open-api 403 without Bearer
|
|
13
|
+
// BestInSlot 301 (moved; needs key)
|
|
14
|
+
// Magic Eden BTC 503 "no healthy upstream" -> dead
|
|
15
|
+
// Satflow 403 without x-api-key -> marketplace, separate provider
|
|
16
|
+
//
|
|
17
|
+
// Known gap: ordinals.com has NO address-indexed endpoint (/r/address 404).
|
|
18
|
+
// Address -> inscriptions/runes REQUIRES a keyed indexer. Keyless mode can
|
|
19
|
+
// answer "what is this inscription" but not "what does this wallet hold".
|
|
20
|
+
|
|
21
|
+
import { btcAddress } from "./bitcoin-esplora.mjs";
|
|
22
|
+
import { resolveProviderEndpoint, credentialedHeaders } from "../provider-endpoint.mjs";
|
|
23
|
+
|
|
24
|
+
export const ORDINALS_RECURSIVE_BASE = "https://ordinals.com";
|
|
25
|
+
|
|
26
|
+
function metaBase(opts = {}) {
|
|
27
|
+
return String(
|
|
28
|
+
opts.baseUrl ||
|
|
29
|
+
process.env.BTC_META_API_URL ||
|
|
30
|
+
process.env.UNISAT_API_URL ||
|
|
31
|
+
""
|
|
32
|
+
)
|
|
33
|
+
.trim()
|
|
34
|
+
.replace(/\/$/, "");
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// This provider has NO fixed default endpoint: the operator points it at their
|
|
38
|
+
// own UniSat / Best-in-Slot deployment. Trust is therefore decided by an
|
|
39
|
+
// explicit host allowlist rather than a built-in default.
|
|
40
|
+
const BTC_META_HOSTS = [
|
|
41
|
+
"open-api.unisat.io",
|
|
42
|
+
"open-api-testnet.unisat.io",
|
|
43
|
+
"api.bestinslot.xyz",
|
|
44
|
+
"api.hiro.so",
|
|
45
|
+
];
|
|
46
|
+
|
|
47
|
+
function metaEndpoint(opts = {}) {
|
|
48
|
+
const url = metaBase(opts);
|
|
49
|
+
if (!url) return { baseUrl: "", trusted: false, host: null };
|
|
50
|
+
return resolveProviderEndpoint({
|
|
51
|
+
provider: "bitcoin-meta",
|
|
52
|
+
defaultUrl: url,
|
|
53
|
+
hosts: BTC_META_HOSTS,
|
|
54
|
+
url,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
function headers(opts = {}) {
|
|
59
|
+
const key =
|
|
60
|
+
opts.apiKey ||
|
|
61
|
+
process.env.UNISAT_API_KEY ||
|
|
62
|
+
process.env.BESTINSLOT_API_KEY ||
|
|
63
|
+
process.env.BTC_META_API_KEY ||
|
|
64
|
+
"";
|
|
65
|
+
// An operator-configured base is only credentialed when its host is one of
|
|
66
|
+
// the known indexers; a redirected base gets the request without the key.
|
|
67
|
+
let trusted = false;
|
|
68
|
+
try {
|
|
69
|
+
const url = metaBase(opts);
|
|
70
|
+
if (url) {
|
|
71
|
+
const host = new URL(url).host;
|
|
72
|
+
const proto = new URL(url).protocol;
|
|
73
|
+
const loopback = /^(127\.0\.0\.1|localhost|\[::1\])(:\d+)?$/i.test(host);
|
|
74
|
+
trusted = BTC_META_HOSTS.includes(host) && (proto === "https:" || loopback);
|
|
75
|
+
}
|
|
76
|
+
} catch {
|
|
77
|
+
trusted = false;
|
|
78
|
+
}
|
|
79
|
+
return credentialedHeaders(
|
|
80
|
+
{ accept: "application/json", "user-agent": "oracle-btc-meta/0.1" },
|
|
81
|
+
{ authorization: key ? `Bearer ${key}` : "", "x-api-key": key },
|
|
82
|
+
trusted
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
async function getJson(url, opts = {}) {
|
|
87
|
+
const fetchImpl = opts.fetchImpl || fetch;
|
|
88
|
+
const res = await fetchImpl(url, {
|
|
89
|
+
method: "GET",
|
|
90
|
+
headers: headers(opts),
|
|
91
|
+
signal: AbortSignal.timeout(opts.timeoutMs ?? 12_000),
|
|
92
|
+
});
|
|
93
|
+
const text = await res.text();
|
|
94
|
+
let body;
|
|
95
|
+
try {
|
|
96
|
+
body = JSON.parse(text);
|
|
97
|
+
} catch {
|
|
98
|
+
body = text;
|
|
99
|
+
}
|
|
100
|
+
if (!res.ok) {
|
|
101
|
+
throw new Error(`bitcoin-meta GET ${url}: HTTP ${res.status} ${String(text).slice(0, 160)}`);
|
|
102
|
+
}
|
|
103
|
+
return body;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export async function btcMetaHealth(opts = {}) {
|
|
107
|
+
const base = metaBase(opts);
|
|
108
|
+
// Always can hit ordinals.com tip as chain liveness (not full meta)
|
|
109
|
+
let tip = null;
|
|
110
|
+
try {
|
|
111
|
+
const fetchImpl = opts.fetchImpl || fetch;
|
|
112
|
+
const r = await fetchImpl("https://ordinals.com/r/blockheight", {
|
|
113
|
+
signal: AbortSignal.timeout(8000),
|
|
114
|
+
});
|
|
115
|
+
tip = Number(await r.text());
|
|
116
|
+
} catch {
|
|
117
|
+
tip = null;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
if (!base) {
|
|
121
|
+
return {
|
|
122
|
+
ok: tip != null,
|
|
123
|
+
provider: "bitcoin-meta",
|
|
124
|
+
indexerConfigured: false,
|
|
125
|
+
ordinalsComTip: tip,
|
|
126
|
+
note: "Set BTC_META_API_URL and/or UNISAT_API_KEY / BESTINSLOT_API_KEY for balances. Marketplace = Satflow (SATFLOW_API_KEY). Magic Eden BTC is dead.",
|
|
127
|
+
capabilities: {
|
|
128
|
+
tip: tip != null,
|
|
129
|
+
runeBalances: false,
|
|
130
|
+
inscriptions: false,
|
|
131
|
+
marketplace: false,
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Probe common paths; tolerate 404
|
|
137
|
+
let probe = { ok: false, path: null, status: null };
|
|
138
|
+
for (const path of ["/v1/indexer/brc20/best-height", "/v1/health", "/health", "/"]) {
|
|
139
|
+
try {
|
|
140
|
+
const fetchImpl = opts.fetchImpl || fetch;
|
|
141
|
+
const res = await fetchImpl(`${base}${path}`, {
|
|
142
|
+
headers: headers(opts),
|
|
143
|
+
signal: AbortSignal.timeout(8000),
|
|
144
|
+
});
|
|
145
|
+
probe = { ok: res.status > 0 && res.status < 500, path, status: res.status };
|
|
146
|
+
if (res.ok) break;
|
|
147
|
+
} catch {
|
|
148
|
+
/* try next */
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
return {
|
|
153
|
+
ok: probe.ok || tip != null,
|
|
154
|
+
provider: "bitcoin-meta",
|
|
155
|
+
indexerConfigured: true,
|
|
156
|
+
baseUrl: base,
|
|
157
|
+
probe,
|
|
158
|
+
ordinalsComTip: tip,
|
|
159
|
+
apiKeyPresent: Boolean(
|
|
160
|
+
process.env.UNISAT_API_KEY ||
|
|
161
|
+
process.env.BESTINSLOT_API_KEY ||
|
|
162
|
+
process.env.BTC_META_API_KEY
|
|
163
|
+
),
|
|
164
|
+
capabilities: {
|
|
165
|
+
tip: tip != null,
|
|
166
|
+
runeBalances: true,
|
|
167
|
+
inscriptions: true,
|
|
168
|
+
marketplace: Boolean(process.env.SATFLOW_API_KEY),
|
|
169
|
+
},
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Rune balances for an address. Requires configured indexer.
|
|
175
|
+
* Normalizes heterogeneous API shapes into a common list.
|
|
176
|
+
*/
|
|
177
|
+
export async function btcRuneBalances(args = {}, opts = {}) {
|
|
178
|
+
const address = btcAddress(args.address || args.addr, "address");
|
|
179
|
+
const base = metaBase(opts);
|
|
180
|
+
if (!base) {
|
|
181
|
+
return {
|
|
182
|
+
provider: "bitcoin-meta",
|
|
183
|
+
address,
|
|
184
|
+
ok: false,
|
|
185
|
+
balances: [],
|
|
186
|
+
error: "no indexer configured (set BTC_META_API_URL or vendor API key env)",
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Try UniSat-shaped path first, then generic
|
|
191
|
+
const candidates = [
|
|
192
|
+
`${base}/v1/indexer/address/${address}/runes/balance-list?start=0&limit=100`,
|
|
193
|
+
`${base}/v1/runes/address/${address}`,
|
|
194
|
+
`${base}/runes/balance/${address}`,
|
|
195
|
+
`${base}/address/${address}/runes`,
|
|
196
|
+
];
|
|
197
|
+
|
|
198
|
+
let lastErr = null;
|
|
199
|
+
for (const url of candidates) {
|
|
200
|
+
try {
|
|
201
|
+
const body = await getJson(url, opts);
|
|
202
|
+
const list = normalizeRuneBalances(body);
|
|
203
|
+
return {
|
|
204
|
+
provider: "bitcoin-meta",
|
|
205
|
+
address,
|
|
206
|
+
ok: true,
|
|
207
|
+
count: list.length,
|
|
208
|
+
balances: list,
|
|
209
|
+
source: url,
|
|
210
|
+
};
|
|
211
|
+
} catch (e) {
|
|
212
|
+
lastErr = e;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return {
|
|
216
|
+
provider: "bitcoin-meta",
|
|
217
|
+
address,
|
|
218
|
+
ok: false,
|
|
219
|
+
balances: [],
|
|
220
|
+
error: String(lastErr?.message || lastErr || "all indexer paths failed"),
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
function normalizeRuneBalances(body) {
|
|
225
|
+
const raw =
|
|
226
|
+
body?.data?.detail ||
|
|
227
|
+
body?.data?.list ||
|
|
228
|
+
body?.data ||
|
|
229
|
+
body?.balances ||
|
|
230
|
+
body?.results ||
|
|
231
|
+
body?.runes ||
|
|
232
|
+
(Array.isArray(body) ? body : []);
|
|
233
|
+
const arr = Array.isArray(raw) ? raw : [];
|
|
234
|
+
return arr.map((r) => ({
|
|
235
|
+
rune: r.rune || r.runeid || r.runeId || r.spacedRune || r.name || r.ticker || null,
|
|
236
|
+
runeId: r.runeid || r.runeId || r.id || null,
|
|
237
|
+
amount: String(r.amount ?? r.balance ?? r.total ?? r.qty ?? "0"),
|
|
238
|
+
symbol: r.symbol || null,
|
|
239
|
+
divisibility: r.divisibility ?? r.div ?? null,
|
|
240
|
+
raw: r,
|
|
241
|
+
}));
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Inscriptions controlled by an address.
|
|
246
|
+
*
|
|
247
|
+
* NOTE: requires a KEYED indexer. ordinals.com recursive has no address index
|
|
248
|
+
* (verified: /r/address -> 404), so the free tier cannot answer this. We say so
|
|
249
|
+
* explicitly rather than returning an empty list that reads like "you own
|
|
250
|
+
* nothing" — a false negative here can get an inscription spent as fee change.
|
|
251
|
+
*/
|
|
252
|
+
export async function btcInscriptions(args = {}, opts = {}) {
|
|
253
|
+
const address = btcAddress(args.address || args.addr, "address");
|
|
254
|
+
const base = metaBase(opts);
|
|
255
|
+
if (!base) {
|
|
256
|
+
return {
|
|
257
|
+
provider: "bitcoin-meta",
|
|
258
|
+
address,
|
|
259
|
+
ok: false,
|
|
260
|
+
inscriptions: [],
|
|
261
|
+
error:
|
|
262
|
+
"no indexer configured — address-indexed lookups need a keyed indexer " +
|
|
263
|
+
"(BTC_META_API_URL + UNISAT_API_KEY / BESTINSLOT_API_KEY). " +
|
|
264
|
+
"ordinals.com recursive is keyless but has no address index.",
|
|
265
|
+
unknownNotEmpty: true,
|
|
266
|
+
keylessAlternatives: ["btc_inscription_info (by inscription id)", "btc_meta_health"],
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
const limit = Math.min(Number(args.limit || 50), 200);
|
|
270
|
+
const candidates = [
|
|
271
|
+
`${base}/v1/indexer/address/${address}/inscription-data?cursor=0&size=${limit}`,
|
|
272
|
+
`${base}/v1/inscriptions/address/${address}?limit=${limit}`,
|
|
273
|
+
`${base}/address/${address}/inscriptions?limit=${limit}`,
|
|
274
|
+
];
|
|
275
|
+
let lastErr = null;
|
|
276
|
+
for (const url of candidates) {
|
|
277
|
+
try {
|
|
278
|
+
const body = await getJson(url, opts);
|
|
279
|
+
const list = normalizeInscriptions(body);
|
|
280
|
+
return {
|
|
281
|
+
provider: "bitcoin-meta",
|
|
282
|
+
address,
|
|
283
|
+
ok: true,
|
|
284
|
+
count: list.length,
|
|
285
|
+
inscriptions: list,
|
|
286
|
+
source: url,
|
|
287
|
+
};
|
|
288
|
+
} catch (e) {
|
|
289
|
+
lastErr = e;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
return {
|
|
293
|
+
provider: "bitcoin-meta",
|
|
294
|
+
address,
|
|
295
|
+
ok: false,
|
|
296
|
+
inscriptions: [],
|
|
297
|
+
error: String(lastErr?.message || lastErr || "all indexer paths failed"),
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Inscription metadata by inscription id — KEYLESS via ordinals.com recursive.
|
|
303
|
+
* Verified live: returns content_type, content_length, height, sat, fee, etc.
|
|
304
|
+
*/
|
|
305
|
+
export async function btcInscriptionInfo(args = {}, opts = {}) {
|
|
306
|
+
const id = String(args.inscriptionId || args.id || "").trim();
|
|
307
|
+
if (!/^[0-9a-f]{64}i\d+$/i.test(id)) {
|
|
308
|
+
throw new Error("bitcoin-meta: inscriptionId must look like <64-hex-txid>i<index>");
|
|
309
|
+
}
|
|
310
|
+
const base = opts.ordinalsBase || ORDINALS_RECURSIVE_BASE;
|
|
311
|
+
const info = await getJson(`${base}/r/inscription/${id}`, opts);
|
|
312
|
+
return {
|
|
313
|
+
provider: "bitcoin-meta",
|
|
314
|
+
source: "ordinals.com/r",
|
|
315
|
+
keyless: true,
|
|
316
|
+
inscriptionId: id,
|
|
317
|
+
info,
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
* Child inscriptions (collection/parent-child) — KEYLESS via ordinals.com.
|
|
323
|
+
*/
|
|
324
|
+
export async function btcInscriptionChildren(args = {}, opts = {}) {
|
|
325
|
+
const id = String(args.inscriptionId || args.id || "").trim();
|
|
326
|
+
if (!/^[0-9a-f]{64}i\d+$/i.test(id)) {
|
|
327
|
+
throw new Error("bitcoin-meta: inscriptionId must look like <64-hex-txid>i<index>");
|
|
328
|
+
}
|
|
329
|
+
const base = opts.ordinalsBase || ORDINALS_RECURSIVE_BASE;
|
|
330
|
+
const page = Number(args.page || 0);
|
|
331
|
+
const body = await getJson(`${base}/r/children/${id}${page ? `/${page}` : ""}`, opts);
|
|
332
|
+
return {
|
|
333
|
+
provider: "bitcoin-meta",
|
|
334
|
+
source: "ordinals.com/r",
|
|
335
|
+
keyless: true,
|
|
336
|
+
inscriptionId: id,
|
|
337
|
+
page,
|
|
338
|
+
children: Array.isArray(body?.ids) ? body.ids : [],
|
|
339
|
+
more: Boolean(body?.more),
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* Block info from the ord node itself — KEYLESS. Useful to confirm the ord
|
|
345
|
+
* indexer is at the same tip as Esplora before trusting any metaprotocol read.
|
|
346
|
+
*/
|
|
347
|
+
export async function btcOrdBlockInfo(args = {}, opts = {}) {
|
|
348
|
+
const base = opts.ordinalsBase || ORDINALS_RECURSIVE_BASE;
|
|
349
|
+
const height = args.height ?? (await getJson(`${base}/r/blockheight`, opts));
|
|
350
|
+
const info = await getJson(`${base}/r/blockinfo/${Number(height)}`, opts);
|
|
351
|
+
return {
|
|
352
|
+
provider: "bitcoin-meta",
|
|
353
|
+
source: "ordinals.com/r",
|
|
354
|
+
keyless: true,
|
|
355
|
+
height: Number(height),
|
|
356
|
+
info,
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
function normalizeInscriptions(body) {
|
|
361
|
+
const raw =
|
|
362
|
+
body?.data?.inscription ||
|
|
363
|
+
body?.data?.detail ||
|
|
364
|
+
body?.data?.list ||
|
|
365
|
+
body?.data ||
|
|
366
|
+
body?.inscriptions ||
|
|
367
|
+
body?.results ||
|
|
368
|
+
(Array.isArray(body) ? body : []);
|
|
369
|
+
const arr = Array.isArray(raw) ? raw : [];
|
|
370
|
+
return arr.map((i) => ({
|
|
371
|
+
id: i.inscriptionId || i.id || i.inscription_id || null,
|
|
372
|
+
number: i.inscriptionNumber ?? i.number ?? null,
|
|
373
|
+
sat: i.sat || i.satoshi || null,
|
|
374
|
+
contentType: i.contentType || i.content_type || null,
|
|
375
|
+
utxo: i.utxo || i.output || (i.txid != null ? `${i.txid}:${i.vout ?? i.n}` : null),
|
|
376
|
+
raw: i,
|
|
377
|
+
}));
|
|
378
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Blockscout REST API v2 — verified public explorer instances, no key.
|
|
2
|
+
import { httpJson } from "../http.mjs";
|
|
3
|
+
export const BLOCKSCOUT_CHAINS=Object.freeze({
|
|
4
|
+
1:"https://eth.blockscout.com",
|
|
5
|
+
10:"https://optimism.blockscout.com",
|
|
6
|
+
137:"https://polygon.blockscout.com",
|
|
7
|
+
42161:"https://arbitrum.blockscout.com",
|
|
8
|
+
8453:"https://base.blockscout.com",
|
|
9
|
+
});
|
|
10
|
+
function base(chainId,o={}) { const id=Number(chainId); const u=o.baseUrl || BLOCKSCOUT_CHAINS[id]; if(!u) throw new Error(`Blockscout not configured for chainId ${id}`); return u.replace(/\/$/,""); }
|
|
11
|
+
export async function blockscoutStats(args={},opts={}) { return httpJson(`${base(args.chainId||1,opts)}/api/v2/stats`,{fetchImpl:opts.fetchImpl,timeoutMs:opts.timeoutMs}); }
|
|
12
|
+
export async function blockscoutAddress(args={},opts={}) { if(!args.address)throw new Error("address required"); return httpJson(`${base(args.chainId||1,opts)}/api/v2/addresses/${encodeURIComponent(args.address)}`,{fetchImpl:opts.fetchImpl,timeoutMs:opts.timeoutMs}); }
|
|
13
|
+
export async function blockscoutToken(args={},opts={}) { if(!args.address && !args.tokenAddress)throw new Error("token address required"); return httpJson(`${base(args.chainId||1,opts)}/api/v2/tokens/${encodeURIComponent(args.address||args.tokenAddress)}`,{fetchImpl:opts.fetchImpl,timeoutMs:opts.timeoutMs}); }
|
|
14
|
+
export async function blockscoutHealth(opts={}) { const data=await blockscoutStats({chainId:8453},opts); return {ok:data?.total_blocks!=null || data?.total_transactions!=null,chainId:8453}; }
|