@oracle-agent/oracle 0.14.1 → 0.16.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/README.md +2 -2
- package/SETUP.md +4 -4
- package/dist/action-receipts.mjs +1 -0
- package/dist/action-semantics.mjs +1 -0
- package/dist/address-book.mjs +2 -0
- package/dist/bin/desk-server.mjs +60 -0
- package/dist/bin/oracle-data-mcp.mjs +9 -0
- package/dist/bin/oracle-equities.mjs +20 -0
- package/dist/bin/oracle-init.mjs +24 -0
- package/dist/bin/oracle-public-server.mjs +5 -0
- package/dist/bin/oracle-route.mjs +22 -0
- package/dist/bin/oracle-scan.mjs +18 -0
- package/dist/bin/oracle-upgrade.mjs +21 -0
- package/dist/bin/oracle.mjs +63 -0
- package/dist/chains.mjs +1 -0
- package/dist/cli/commands/auth.mjs +16 -0
- package/dist/cli/commands/bootstrap.mjs +18 -0
- package/dist/cli/commands/chain.mjs +21 -0
- package/dist/cli/commands/chat.mjs +45 -0
- package/dist/cli/commands/credential.mjs +1 -0
- package/dist/cli/commands/data-mcp.mjs +2 -0
- package/dist/cli/commands/data.mjs +12 -0
- package/dist/cli/commands/doctor.mjs +5 -0
- package/dist/cli/commands/equities.mjs +15 -0
- package/dist/cli/commands/farm.mjs +59 -0
- package/dist/cli/commands/fees.mjs +10 -0
- package/dist/cli/commands/follow.mjs +28 -0
- package/dist/cli/commands/harness.mjs +15 -0
- package/dist/cli/commands/help.mjs +1 -0
- package/dist/cli/commands/init.mjs +3 -0
- package/dist/cli/commands/mcp.mjs +36 -0
- package/dist/cli/commands/model.mjs +54 -0
- package/dist/cli/commands/plugins.mjs +43 -0
- package/dist/cli/commands/prepare.mjs +2 -0
- package/dist/cli/commands/public.mjs +3 -0
- package/dist/cli/commands/resolve.mjs +23 -0
- package/dist/cli/commands/route.mjs +2 -0
- package/dist/cli/commands/runner.mjs +1 -0
- package/dist/cli/commands/scan.mjs +2 -0
- package/dist/cli/commands/setup.mjs +34 -0
- package/dist/cli/commands/sign.mjs +4 -0
- package/dist/cli/commands/signer.mjs +1 -0
- package/dist/cli/commands/strategy.mjs +18 -0
- package/dist/cli/commands/swap.mjs +36 -0
- package/dist/cli/commands/upgrade.mjs +2 -0
- package/dist/cli/commands/vault.mjs +1 -0
- package/dist/cli/commands/version.mjs +2 -0
- package/dist/data/desk-data.mjs +55 -0
- package/dist/data/names.mjs +2 -0
- package/dist/data/providers/farming.mjs +2 -0
- package/dist/equities/index.mjs +1 -0
- package/dist/index.mjs +60 -0
- package/dist/nft-gas-war-guard.mjs +1 -0
- package/dist/onboarding/harness-configs.mjs +4 -0
- package/dist/portfolio-risk.mjs +1 -0
- package/dist/prepare-envelope.mjs +1 -0
- package/dist/public-api/agent-grants.mjs +3 -0
- package/dist/public-control/policy-schema.mjs +1 -0
- package/dist/router/index.mjs +2 -0
- package/dist/scanner/index.mjs +4 -0
- package/dist/signals/index.mjs +1 -0
- package/dist/strategy/index.mjs +3 -0
- package/dist/watch-preferences.mjs +1 -0
- package/package.json +33 -78
- package/public/oracle-splash/_variants/ice.html +5 -18
- package/public/oracle-splash/_variants/ivory.html +5 -18
- package/public/oracle-splash/downloads/index.html +4 -4
- package/public/oracle-splash/index.html +113 -34
- package/CONTRIBUTING.md +0 -99
- package/bin/desk-server.mjs +0 -473
- package/bin/oracle-data-mcp.mjs +0 -1252
- package/bin/oracle-equities.mjs +0 -168
- package/bin/oracle-init.mjs +0 -525
- package/bin/oracle-public-server.mjs +0 -36
- package/bin/oracle-route.mjs +0 -254
- package/bin/oracle-scan.mjs +0 -192
- package/bin/oracle-upgrade.mjs +0 -42
- package/bin/oracle.mjs +0 -34
- package/docs/adding-a-chain.md +0 -229
- package/docs/architecture.md +0 -139
- package/docs/buzz-integration.md +0 -115
- package/docs/cli.md +0 -143
- package/docs/connectors.md +0 -13
- package/docs/hyperliquid-builder-code.md +0 -50
- package/docs/locals-only-fee-waiver.md +0 -34
- package/docs/oracle-pack-standard.md +0 -29
- package/docs/profiles.md +0 -151
- package/docs/public-surface.md +0 -206
- package/examples/add-a-chain.mjs +0 -65
- package/examples/oracle-pack-template.mjs +0 -38
- package/examples/research-a-token.mjs +0 -70
- package/plugins/oracle-owner-gate/__init__.py +0 -288
- package/plugins/oracle-owner-gate/plugin.yaml +0 -9
- package/protocols/templates/safe-erc20/SECURITY.md +0 -16
- package/protocols/templates/safe-erc20/foundry.toml +0 -12
- package/protocols/templates/safe-erc20/remappings.txt +0 -2
- package/protocols/templates/safe-erc20/src/SafeERC20.sol +0 -53
- package/protocols/templates/safe-erc20/test/SafeERC20.t.sol +0 -72
- package/scripts/adversarial-bench.mjs +0 -114
- package/scripts/build-dist.mjs +0 -119
- package/scripts/build-inscription.py +0 -230
- package/scripts/check-doc-drift.mjs +0 -123
- package/scripts/check-test-count.mjs +0 -105
- package/scripts/e2e-hl-markets.mjs +0 -21
- package/scripts/e2e-hl-perps.mjs +0 -48
- package/scripts/e2e-hypercore-staking.mjs +0 -128
- package/scripts/e2e-solana-bitcoin.mjs +0 -183
- package/scripts/guard-publish.mjs +0 -22
- package/scripts/protocol-template-gate.mjs +0 -15
- package/scripts/public-api-scan.mjs +0 -23
- package/scripts/publish-dist.mjs +0 -67
- package/scripts/record-hero-cli.sh +0 -80
- package/scripts/secret-scan.mjs +0 -169
- package/scripts/smoke-dist-bins.mjs +0 -89
- package/scripts/verify-dist.mjs +0 -29
- package/scripts/verify-v3-venues.mjs +0 -233
- package/skins/oracle.yaml +0 -56
- package/src/action-receipts.mjs +0 -265
- package/src/action-semantics.mjs +0 -62
- package/src/address-book.mjs +0 -208
- package/src/agent-auth.mjs +0 -206
- package/src/approval-guard.mjs +0 -282
- package/src/attestation-secret.mjs +0 -94
- package/src/audit-log.mjs +0 -196
- package/src/auth/oauth.mjs +0 -672
- package/src/auto-slippage.mjs +0 -378
- package/src/capability-posture.mjs +0 -125
- package/src/cards.mjs +0 -422
- package/src/chains.mjs +0 -62
- package/src/cli/chain-catalog.mjs +0 -215
- package/src/cli/chain-state.mjs +0 -74
- package/src/cli/commands/auth.mjs +0 -193
- package/src/cli/commands/bootstrap.mjs +0 -87
- package/src/cli/commands/chain.mjs +0 -143
- package/src/cli/commands/chat.mjs +0 -465
- package/src/cli/commands/credential.mjs +0 -9
- package/src/cli/commands/data-mcp.mjs +0 -18
- package/src/cli/commands/data.mjs +0 -75
- package/src/cli/commands/doctor.mjs +0 -136
- package/src/cli/commands/equities.mjs +0 -41
- package/src/cli/commands/farm.mjs +0 -129
- package/src/cli/commands/fees.mjs +0 -109
- package/src/cli/commands/follow.mjs +0 -130
- package/src/cli/commands/harness.mjs +0 -63
- package/src/cli/commands/help.mjs +0 -7
- package/src/cli/commands/init.mjs +0 -27
- package/src/cli/commands/mcp.mjs +0 -154
- package/src/cli/commands/model.mjs +0 -106
- package/src/cli/commands/plugins.mjs +0 -275
- package/src/cli/commands/prepare.mjs +0 -12
- package/src/cli/commands/public.mjs +0 -20
- package/src/cli/commands/resolve.mjs +0 -64
- package/src/cli/commands/route.mjs +0 -12
- package/src/cli/commands/runner.mjs +0 -9
- package/src/cli/commands/scan.mjs +0 -12
- package/src/cli/commands/setup.mjs +0 -294
- package/src/cli/commands/sign.mjs +0 -21
- package/src/cli/commands/signer.mjs +0 -9
- package/src/cli/commands/swap.mjs +0 -102
- package/src/cli/commands/upgrade.mjs +0 -12
- package/src/cli/commands/vault.mjs +0 -9
- package/src/cli/commands/version.mjs +0 -22
- package/src/cli/first-run.mjs +0 -23
- package/src/cli/kernel.mjs +0 -262
- package/src/cli/mcp-targets/chatgpt.mjs +0 -51
- package/src/cli/mcp-targets/claude-code.mjs +0 -39
- package/src/cli/mcp-targets/claude-desktop.mjs +0 -24
- package/src/cli/mcp-targets/codex.mjs +0 -41
- package/src/cli/mcp-targets/cursor.mjs +0 -32
- package/src/cli/mcp-targets/shared.mjs +0 -71
- package/src/cli/mcp-targets/vscode.mjs +0 -39
- package/src/cli/messaging-platforms.mjs +0 -217
- package/src/cli/model-config.mjs +0 -78
- package/src/cli/operator-dispatch.mjs +0 -194
- package/src/cli/oracle-harness.py +0 -415
- package/src/cli/paths.mjs +0 -107
- package/src/cli/runtime.mjs +0 -351
- package/src/cli/setup-state.mjs +0 -168
- package/src/cli/spawn-child.mjs +0 -43
- package/src/data/catalog.mjs +0 -858
- package/src/data/desk-data.mjs +0 -877
- package/src/data/http.mjs +0 -253
- package/src/data/names.mjs +0 -188
- package/src/data/provider-endpoint.mjs +0 -94
- package/src/data/providers/aave-v3.mjs +0 -139
- package/src/data/providers/across-bridge.mjs +0 -41
- package/src/data/providers/aerodrome.mjs +0 -245
- package/src/data/providers/aevo.mjs +0 -33
- package/src/data/providers/approval-indexer.mjs +0 -133
- package/src/data/providers/approvals.mjs +0 -594
- package/src/data/providers/babylon-staking.mjs +0 -149
- package/src/data/providers/balancer.mjs +0 -209
- package/src/data/providers/beefy-yields.mjs +0 -45
- package/src/data/providers/birdeye-tokens.mjs +0 -33
- package/src/data/providers/bisq-markets.mjs +0 -145
- package/src/data/providers/bitcoin-esplora.mjs +0 -216
- package/src/data/providers/bitcoin-meta.mjs +0 -378
- package/src/data/providers/blockscout.mjs +0 -14
- package/src/data/providers/bob-rootstock.mjs +0 -198
- package/src/data/providers/braiins-insights.mjs +0 -103
- package/src/data/providers/bridge-aggregator.mjs +0 -259
- package/src/data/providers/bridges.mjs +0 -242
- package/src/data/providers/bungee.mjs +0 -29
- package/src/data/providers/celestia-da.mjs +0 -38
- package/src/data/providers/changenow.mjs +0 -135
- package/src/data/providers/compound.mjs +0 -32
- package/src/data/providers/connext.mjs +0 -28
- package/src/data/providers/convex.mjs +0 -30
- package/src/data/providers/cow-protocol.mjs +0 -110
- package/src/data/providers/cowswap.mjs +0 -415
- package/src/data/providers/curve.mjs +0 -201
- package/src/data/providers/das-assets.mjs +0 -59
- package/src/data/providers/debridge.mjs +0 -109
- package/src/data/providers/defillama.mjs +0 -88
- package/src/data/providers/dexscreener.mjs +0 -43
- package/src/data/providers/drift.mjs +0 -32
- package/src/data/providers/dydx.mjs +0 -41
- package/src/data/providers/evm-rpc.mjs +0 -225
- package/src/data/providers/farming.mjs +0 -291
- package/src/data/providers/geckoterminal.mjs +0 -34
- package/src/data/providers/gmx.mjs +0 -496
- package/src/data/providers/hiro-stacks.mjs +0 -150
- package/src/data/providers/hl-assets.mjs +0 -165
- package/src/data/providers/hl-info.mjs +0 -108
- package/src/data/providers/hl-markets.mjs +0 -210
- package/src/data/providers/hl-outcome.mjs +0 -61
- package/src/data/providers/hl-perps.mjs +0 -419
- package/src/data/providers/hl-staking.mjs +0 -353
- package/src/data/providers/hl-ws.mjs +0 -119
- package/src/data/providers/hyperevm-dex.mjs +0 -49
- package/src/data/providers/jito-mev.mjs +0 -117
- package/src/data/providers/jupiter-venues.mjs +0 -119
- package/src/data/providers/jupiter.mjs +0 -315
- package/src/data/providers/kamino-strategies.mjs +0 -143
- package/src/data/providers/l2beat-tvl.mjs +0 -42
- package/src/data/providers/lifi.mjs +0 -166
- package/src/data/providers/liquid-esplora.mjs +0 -152
- package/src/data/providers/magiceden-ordinals.mjs +0 -141
- package/src/data/providers/magiceden-sol.mjs +0 -406
- package/src/data/providers/mempool-lightning.mjs +0 -144
- package/src/data/providers/mempool-mining.mjs +0 -142
- package/src/data/providers/meteora-dlmm.mjs +0 -168
- package/src/data/providers/morpho.mjs +0 -177
- package/src/data/providers/nft-gallery.mjs +0 -163
- package/src/data/providers/nft-portfolio.mjs +0 -494
- package/src/data/providers/odos.mjs +0 -156
- package/src/data/providers/ondo.mjs +0 -31
- package/src/data/providers/oneinch.mjs +0 -174
- package/src/data/providers/opensea-multichain.mjs +0 -136
- package/src/data/providers/opensea-nft.mjs +0 -371
- package/src/data/providers/orca.mjs +0 -29
- package/src/data/providers/ordinals-runes.mjs +0 -180
- package/src/data/providers/pancakeswap.mjs +0 -28
- package/src/data/providers/paraswap.mjs +0 -125
- package/src/data/providers/pendle.mjs +0 -188
- package/src/data/providers/poly-clob.mjs +0 -283
- package/src/data/providers/poly-public.mjs +0 -96
- package/src/data/providers/poly-ws.mjs +0 -103
- package/src/data/providers/polygon-staking.mjs +0 -227
- package/src/data/providers/portfolio-history.mjs +0 -394
- package/src/data/providers/portfolio.mjs +0 -600
- package/src/data/providers/pyth-price-feeds.mjs +0 -172
- package/src/data/providers/raydium.mjs +0 -35
- package/src/data/providers/relayscan-mev.mjs +0 -72
- package/src/data/providers/rfq.mjs +0 -15
- package/src/data/providers/rh-agent.mjs +0 -59
- package/src/data/providers/sanctum-lst.mjs +0 -180
- package/src/data/providers/satflow.mjs +0 -341
- package/src/data/providers/signed-material-guard.mjs +0 -108
- package/src/data/providers/solana-rpc.mjs +0 -197
- package/src/data/providers/solend-lending.mjs +0 -166
- package/src/data/providers/spark-lend.mjs +0 -42
- package/src/data/providers/squid-router.mjs +0 -29
- package/src/data/providers/stargate.mjs +0 -29
- package/src/data/providers/sushiswap.mjs +0 -30
- package/src/data/providers/symbiotic-restaking.mjs +0 -41
- package/src/data/providers/thorchain.mjs +0 -36
- package/src/data/providers/traderjoe.mjs +0 -28
- package/src/data/providers/twap.mjs +0 -152
- package/src/data/providers/uniswap-v3.mjs +0 -457
- package/src/data/providers/uniswap-v4.mjs +0 -414
- package/src/data/providers/vertex.mjs +0 -41
- package/src/data/providers/wallet-watch.mjs +0 -264
- package/src/data/providers/wormhole.mjs +0 -28
- package/src/data/providers/yearn.mjs +0 -31
- package/src/data/providers/zerox.mjs +0 -167
- package/src/data/public-api-scan.mjs +0 -61
- package/src/data/quote-placeholder.mjs +0 -31
- package/src/desk/swap-prepare.mjs +0 -194
- package/src/equities/bridge.mjs +0 -388
- package/src/equities/fixtures/bridge_routes.json +0 -159
- package/src/equities/fixtures/dst_transitions.json +0 -29
- package/src/equities/fixtures/equity_dex_pools.json +0 -154
- package/src/equities/fixtures/hip3_l2books.json +0 -2711
- package/src/equities/fixtures/nyse_holidays.json +0 -1
- package/src/equities/fixtures/oracles.json +0 -100
- package/src/equities/fixtures/rh_pool_state.json +0 -244
- package/src/equities/fixtures/solana_xstocks.json +0 -704
- package/src/equities/fixtures/ton_xstocks.json +0 -35
- package/src/equities/fixtures/universe.json +0 -411
- package/src/equities/fixtures/venues.json +0 -3542
- package/src/equities/fixtures.mjs +0 -405
- package/src/equities/funding.mjs +0 -142
- package/src/equities/index.mjs +0 -166
- package/src/equities/liveness.mjs +0 -148
- package/src/equities/marketHours.mjs +0 -249
- package/src/equities/normalize.mjs +0 -295
- package/src/equities/num.mjs +0 -146
- package/src/equities/prepare.mjs +0 -95
- package/src/equities/rank.mjs +0 -260
- package/src/equities/sourceNum.mjs +0 -69
- package/src/equities/types.mjs +0 -220
- package/src/equities/venues/arcus-perp.mjs +0 -84
- package/src/equities/venues/arcus-spot.mjs +0 -105
- package/src/equities/venues/hyperliquid-hip3.mjs +0 -224
- package/src/equities/venues/rh-uniswap.mjs +0 -216
- package/src/equities/venues/solana-xstocks.mjs +0 -139
- package/src/equities/venues/ton-stonfi.mjs +0 -139
- package/src/exact-integer.mjs +0 -72
- package/src/exec-policy.mjs +0 -419
- package/src/flags.mjs +0 -15
- package/src/fresh-window.mjs +0 -76
- package/src/gmx-attestation.mjs +0 -176
- package/src/index.mjs +0 -107
- package/src/licensing/locals-only.mjs +0 -25
- package/src/nft-gas-war-guard.mjs +0 -139
- package/src/onboarding/agent-keys.mjs +0 -161
- package/src/onboarding/harness-configs.mjs +0 -102
- package/src/onboarding/index.mjs +0 -18
- package/src/onboarding/tiers.mjs +0 -139
- package/src/oracle-env.mjs +0 -55
- package/src/package-manifest.mjs +0 -42
- package/src/plugins/agent-plugin-loader.mjs +0 -225
- package/src/portfolio-risk.mjs +0 -170
- package/src/prepare-envelope.mjs +0 -204
- package/src/profile-upgrade.mjs +0 -277
- package/src/protocol-execution.mjs +0 -84
- package/src/protocol-templates/gate.mjs +0 -179
- package/src/protocol-templates/prepare-deploy.mjs +0 -81
- package/src/public-api/agent-grants.mjs +0 -57
- package/src/public-api/buzz-integration.mjs +0 -267
- package/src/public-api/connect-agent.mjs +0 -424
- package/src/public-api/grants.mjs +0 -142
- package/src/public-api/http.mjs +0 -707
- package/src/public-api/metering.mjs +0 -111
- package/src/public-control/aa-adapter.mjs +0 -402
- package/src/public-control/build-registry.mjs +0 -227
- package/src/public-control/bundler-client.mjs +0 -357
- package/src/public-control/grant-indexer.mjs +0 -296
- package/src/public-control/policy-render.mjs +0 -69
- package/src/public-control/policy-schema.mjs +0 -322
- package/src/public-control/runtime-config.mjs +0 -275
- package/src/public-control/session-key-model.mjs +0 -379
- package/src/public-control/session-orchestrator.mjs +0 -418
- package/src/rfq/intent.mjs +0 -180
- package/src/rfq/sources.mjs +0 -181
- package/src/route-attestation.mjs +0 -132
- package/src/router/best-execution.mjs +0 -326
- package/src/router/index.mjs +0 -250
- package/src/router/integrator-fee.mjs +0 -135
- package/src/router/prepare-bridge.mjs +0 -293
- package/src/router/prepare-route.mjs +0 -398
- package/src/router/proposal.mjs +0 -311
- package/src/router/risk-classifier.mjs +0 -119
- package/src/router/route-sources.mjs +0 -364
- package/src/scanner/chains.config.mjs +0 -543
- package/src/scanner/contract.mjs +0 -270
- package/src/scanner/evm-scanner.mjs +0 -394
- package/src/scanner/index.mjs +0 -9
- package/src/scanner/v2-venue.mjs +0 -351
- package/src/scanner/v3-venue.mjs +0 -308
- package/src/scopes.mjs +0 -44
- package/src/sell-simulation.mjs +0 -167
- package/src/signals/engine.mjs +0 -146
- package/src/signals/index.mjs +0 -1
- package/src/token-transfer-guard.mjs +0 -188
- package/src/tui/app.mjs +0 -438
- package/src/tui/backend.mjs +0 -215
- package/src/tui/format.mjs +0 -272
- package/src/tui/gateway-client.mjs +0 -177
- package/src/tui/input.mjs +0 -501
- package/src/tui/memory.mjs +0 -105
- package/src/tui/meta-learn.mjs +0 -85
- package/src/tui/renderer.mjs +0 -443
- package/src/tui/scheduler.mjs +0 -205
- package/src/tui/skills-loader.mjs +0 -140
- package/src/tui/standalone-client.mjs +0 -752
- package/src/tui/theme.mjs +0 -81
- package/src/vault-attestation.mjs +0 -146
- package/src/venues.mjs +0 -206
- package/src/watch-preferences.mjs +0 -85
- /package/{profiles → dist/assets/profiles}/_template/SOUL.md +0 -0
- /package/{profiles → dist/assets/profiles}/_template/profile.json +0 -0
- /package/{profiles → dist/assets/profiles}/bitcoin-agent/SOUL.md +0 -0
- /package/{profiles → dist/assets/profiles}/bitcoin-agent/profile.json +0 -0
- /package/{profiles → dist/assets/profiles}/hyperliquid-agent/SOUL.md +0 -0
- /package/{profiles → dist/assets/profiles}/hyperliquid-agent/profile.json +0 -0
- /package/{profiles → dist/assets/profiles}/oracle/SOUL.md +0 -0
- /package/{profiles → dist/assets/profiles}/oracle/profile.json +0 -0
- /package/{profiles → dist/assets/profiles}/polymarket-agent/SOUL.md +0 -0
- /package/{profiles → dist/assets/profiles}/polymarket-agent/profile.json +0 -0
- /package/{profiles → dist/assets/profiles}/profile.schema.json +0 -0
- /package/{profiles → dist/assets/profiles}/protocol-builder/SOUL.md +0 -0
- /package/{profiles → dist/assets/profiles}/protocol-builder/profile.json +0 -0
- /package/{profiles → dist/assets/profiles}/robinhood-agent/SOUL.md +0 -0
- /package/{profiles → dist/assets/profiles}/robinhood-agent/profile.json +0 -0
- /package/{profiles → dist/assets/profiles}/solana-agent/SOUL.md +0 -0
- /package/{profiles → dist/assets/profiles}/solana-agent/profile.json +0 -0
- /package/{profiles → dist/assets/profiles}/stable-agent/SOUL.md +0 -0
- /package/{profiles → dist/assets/profiles}/stable-agent/profile.json +0 -0
- /package/{skills → dist/assets/skills}/balance/SKILL.md +0 -0
- /package/{skills → dist/assets/skills}/bitcoin-l1.md +0 -0
- /package/{skills → dist/assets/skills}/chain-defi-ecosystem-profiling.md +0 -0
- /package/{skills → dist/assets/skills}/evm-contract-research.md +0 -0
- /package/{skills → dist/assets/skills}/hyperliquid.md +0 -0
- /package/{skills → dist/assets/skills}/multichain-exec-desk.md +0 -0
- /package/{skills → dist/assets/skills}/oracle-action-semantics/SKILL.md +0 -0
- /package/{skills → dist/assets/skills}/oracle-best-execution/SKILL.md +0 -0
- /package/{skills → dist/assets/skills}/oracle-best-execution.md +0 -0
- /package/{skills → dist/assets/skills}/oracle-bitcoin/SKILL.md +0 -0
- /package/{skills → dist/assets/skills}/oracle-chain-graphs-telegram-cards/SKILL.md +0 -0
- /package/{skills → dist/assets/skills}/oracle-chat/SKILL.md +0 -0
- /package/{skills → dist/assets/skills}/oracle-chat/chain.SKILL.md +0 -0
- /package/{skills → dist/assets/skills}/oracle-chat/setup.SKILL.md +0 -0
- /package/{skills → dist/assets/skills}/oracle-circuit-breaker/SKILL.md +0 -0
- /package/{skills → dist/assets/skills}/oracle-contract-research/SKILL.md +0 -0
- /package/{skills → dist/assets/skills}/oracle-desk/SKILL.md +0 -0
- /package/{skills → dist/assets/skills}/oracle-desk.md +0 -0
- /package/{skills → dist/assets/skills}/oracle-dex-launch/SKILL.md +0 -0
- /package/{skills → dist/assets/skills}/oracle-equities/SKILL.md +0 -0
- /package/{skills → dist/assets/skills}/oracle-grants/SKILL.md +0 -0
- /package/{skills → dist/assets/skills}/oracle-hypercore-staking/SKILL.md +0 -0
- /package/{skills → dist/assets/skills}/oracle-hyperliquid/SKILL.md +0 -0
- /package/{skills → dist/assets/skills}/oracle-meme-token-sniper/SKILL.md +0 -0
- /package/{skills → dist/assets/skills}/oracle-multichain-nft-launch/SKILL.md +0 -0
- /package/{skills → dist/assets/skills}/oracle-multichain-token-launch/SKILL.md +0 -0
- /package/{skills → dist/assets/skills}/oracle-nft-gacha-launch/SKILL.md +0 -0
- /package/{skills → dist/assets/skills}/oracle-nft-mint-gas-war/SKILL.md +0 -0
- /package/{skills → dist/assets/skills}/oracle-polymarket/SKILL.md +0 -0
- /package/{skills → dist/assets/skills}/oracle-protocol-builder/SKILL.md +0 -0
- /package/{skills → dist/assets/skills}/oracle-protocol-security/SKILL.md +0 -0
- /package/{skills → dist/assets/skills}/oracle-public-product/SKILL.md +0 -0
- /package/{skills → dist/assets/skills}/oracle-receipts/SKILL.md +0 -0
- /package/{skills → dist/assets/skills}/oracle-receipts.md +0 -0
- /package/{skills → dist/assets/skills}/oracle-rfq-tokenized-assets/SKILL.md +0 -0
- /package/{skills → dist/assets/skills}/oracle-smart-wallet-scanner/SKILL.md +0 -0
- /package/{skills → dist/assets/skills}/oracle-solana/SKILL.md +0 -0
- /package/{skills → dist/assets/skills}/oracle-solana-nft/SKILL.md +0 -0
- /package/{skills → dist/assets/skills}/oracle-token-research/SKILL.md +0 -0
- /package/{skills → dist/assets/skills}/solana.md +0 -0
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
// BOB and Rootstock — the two Bitcoin L2s that speak EVM — via Blockscout v2.
|
|
2
|
-
//
|
|
3
|
-
// Grouped in one module because they are the same integration: both run a
|
|
4
|
-
// Blockscout v2 instance with an identical REST schema, so one code path serves
|
|
5
|
-
// both and the only difference is the base URL.
|
|
6
|
-
//
|
|
7
|
-
// BOB chainId 60808 https://explorer.gobob.xyz
|
|
8
|
-
// Rootstock chainId 30 https://rootstock.blockscout.com
|
|
9
|
-
//
|
|
10
|
-
// Verified live:
|
|
11
|
-
// GET /api/v2/stats 200 on both
|
|
12
|
-
// GET /api/v2/addresses/{address} 200 on both (coin balance + flags)
|
|
13
|
-
// GET /api/v2/addresses/{a}/token-balances token holdings
|
|
14
|
-
//
|
|
15
|
-
// Distinct from the generic `blockscout` provider, which is registered for L1
|
|
16
|
-
// and EVM L2 rollups only — these two chains are absent from that map, and
|
|
17
|
-
// their Bitcoin-L2 framing is the reason to surface them separately.
|
|
18
|
-
//
|
|
19
|
-
// Read-only.
|
|
20
|
-
|
|
21
|
-
import { httpJson } from "../http.mjs";
|
|
22
|
-
|
|
23
|
-
export const BTC_L2_CHAINS = Object.freeze({
|
|
24
|
-
60808: { name: "bob", label: "BOB (Build on Bitcoin)", url: "https://explorer.gobob.xyz", nativeSymbol: "ETH" },
|
|
25
|
-
30: { name: "rootstock", label: "Rootstock (RSK)", url: "https://rootstock.blockscout.com", nativeSymbol: "RBTC" },
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
const ALIASES = new Map([
|
|
29
|
-
["bob", 60808],
|
|
30
|
-
["rootstock", 30],
|
|
31
|
-
["rsk", 30],
|
|
32
|
-
]);
|
|
33
|
-
|
|
34
|
-
export const BTC_L2_DEFAULT_CHAIN_ID = 60808;
|
|
35
|
-
|
|
36
|
-
/** Accepts a chainId (60808/30) or a name ("bob"/"rootstock"/"rsk"). */
|
|
37
|
-
export function btcL2ChainId(value) {
|
|
38
|
-
if (value == null || value === "") return BTC_L2_DEFAULT_CHAIN_ID;
|
|
39
|
-
const asName = ALIASES.get(String(value).trim().toLowerCase());
|
|
40
|
-
if (asName) return asName;
|
|
41
|
-
const id = Number(value);
|
|
42
|
-
if (!BTC_L2_CHAINS[id]) {
|
|
43
|
-
throw new Error(`bob-rootstock: unsupported chain ${value} (supported: ${Object.keys(BTC_L2_CHAINS).join(", ")} / bob, rootstock)`);
|
|
44
|
-
}
|
|
45
|
-
return id;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function baseUrl(chainId, opts = {}) {
|
|
49
|
-
if (opts.baseUrl) return String(opts.baseUrl).replace(/\/$/, "");
|
|
50
|
-
const id = btcL2ChainId(chainId);
|
|
51
|
-
const env = id === 30 ? process.env.ROOTSTOCK_EXPLORER_URL : process.env.BOB_EXPLORER_URL;
|
|
52
|
-
return String(env || BTC_L2_CHAINS[id].url).replace(/\/$/, "");
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function evmAddress(value, label = "address") {
|
|
56
|
-
const text = String(value || "").trim();
|
|
57
|
-
// Rootstock renders EIP-1191 checksums (chain-id salted), so case is NOT
|
|
58
|
-
// validated here — only shape. Blockscout accepts either casing.
|
|
59
|
-
if (!/^0x[0-9a-fA-F]{40}$/.test(text)) throw new Error(`bob-rootstock: ${label} must be a 0x EVM address`);
|
|
60
|
-
return text;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
function get(chainId, path, opts = {}) {
|
|
64
|
-
return httpJson(`${baseUrl(chainId, opts)}${path.startsWith("/") ? path : `/${path}`}`, {
|
|
65
|
-
fetchImpl: opts.fetchImpl,
|
|
66
|
-
timeoutMs: opts.timeoutMs ?? 15_000,
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export async function btcL2Health(opts = {}, args = {}) {
|
|
71
|
-
// Health accepts an optional chain so a sweep can probe either instance;
|
|
72
|
-
// default is BOB.
|
|
73
|
-
let chainId;
|
|
74
|
-
try {
|
|
75
|
-
chainId = btcL2ChainId(args.chainId ?? args.chain ?? opts.chainId);
|
|
76
|
-
} catch (error) {
|
|
77
|
-
return { ok: false, provider: "bob-rootstock", error: String(error?.message || error), exec: false };
|
|
78
|
-
}
|
|
79
|
-
const meta = BTC_L2_CHAINS[chainId];
|
|
80
|
-
try {
|
|
81
|
-
const stats = await get(chainId, "/api/v2/stats", opts);
|
|
82
|
-
return {
|
|
83
|
-
ok: stats?.total_blocks != null || stats?.total_transactions != null,
|
|
84
|
-
provider: "bob-rootstock",
|
|
85
|
-
chainId,
|
|
86
|
-
chain: meta.name,
|
|
87
|
-
baseUrl: baseUrl(chainId, opts),
|
|
88
|
-
totalBlocks: stats?.total_blocks ?? null,
|
|
89
|
-
averageBlockTimeMs: stats?.average_block_time ?? null,
|
|
90
|
-
exec: false,
|
|
91
|
-
};
|
|
92
|
-
} catch (error) {
|
|
93
|
-
return {
|
|
94
|
-
ok: false,
|
|
95
|
-
provider: "bob-rootstock",
|
|
96
|
-
chainId,
|
|
97
|
-
chain: meta.name,
|
|
98
|
-
baseUrl: baseUrl(chainId, opts),
|
|
99
|
-
error: String(error?.message || error),
|
|
100
|
-
exec: false,
|
|
101
|
-
};
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
/** Chain stats for one L2. Pass `chainId: "all"` to fan out across both. */
|
|
106
|
-
export async function btcL2Stats(args = {}, opts = {}) {
|
|
107
|
-
const which = args.chainId ?? args.chain;
|
|
108
|
-
if (String(which).trim().toLowerCase() === "all") {
|
|
109
|
-
const ids = Object.keys(BTC_L2_CHAINS).map(Number);
|
|
110
|
-
const rows = await Promise.all(
|
|
111
|
-
ids.map(async (id) => {
|
|
112
|
-
try {
|
|
113
|
-
return await btcL2Stats({ chainId: id }, opts);
|
|
114
|
-
} catch (error) {
|
|
115
|
-
return { provider: "bob-rootstock", chainId: id, chain: BTC_L2_CHAINS[id].name, error: String(error?.message || error) };
|
|
116
|
-
}
|
|
117
|
-
})
|
|
118
|
-
);
|
|
119
|
-
return { provider: "bob-rootstock", chains: rows };
|
|
120
|
-
}
|
|
121
|
-
const chainId = btcL2ChainId(which);
|
|
122
|
-
const meta = BTC_L2_CHAINS[chainId];
|
|
123
|
-
const s = await get(chainId, "/api/v2/stats", opts);
|
|
124
|
-
return {
|
|
125
|
-
provider: "bob-rootstock",
|
|
126
|
-
chainId,
|
|
127
|
-
chain: meta.name,
|
|
128
|
-
label: meta.label,
|
|
129
|
-
nativeSymbol: meta.nativeSymbol,
|
|
130
|
-
// Blockscout reports average_block_time in MILLISECONDS. Emitting seconds
|
|
131
|
-
// too because a 29409 vs 2000 comparison across these two chains is
|
|
132
|
-
// otherwise easy to misread as blocks-per-second.
|
|
133
|
-
averageBlockTimeMs: s.average_block_time ?? null,
|
|
134
|
-
averageBlockTimeSec: s.average_block_time == null ? null : Number(s.average_block_time) / 1000,
|
|
135
|
-
gasPrices: s.gas_prices ?? null,
|
|
136
|
-
gasPriceUpdatedAt: s.gas_price_updated_at ?? null,
|
|
137
|
-
gasUsedToday: s.gas_used_today ?? null,
|
|
138
|
-
coinPrice: s.coin_price ?? null,
|
|
139
|
-
coinPriceChangePct: s.coin_price_change_percentage ?? null,
|
|
140
|
-
marketCap: s.market_cap ?? null,
|
|
141
|
-
tvl: s.tvl ?? null,
|
|
142
|
-
totalBlocks: s.total_blocks ?? null,
|
|
143
|
-
totalAddresses: s.total_addresses ?? null,
|
|
144
|
-
totalTransactions: s.total_transactions ?? null,
|
|
145
|
-
transactionsToday: s.transactions_today ?? null,
|
|
146
|
-
networkUtilizationPct: s.network_utilization_percentage ?? null,
|
|
147
|
-
raw: s,
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
/** Native balance + account flags for an address on either L2. */
|
|
152
|
-
export async function btcL2AddressInfo(args = {}, opts = {}) {
|
|
153
|
-
const chainId = btcL2ChainId(args.chainId ?? args.chain);
|
|
154
|
-
const address = evmAddress(args.address || args.addr, "address");
|
|
155
|
-
const meta = BTC_L2_CHAINS[chainId];
|
|
156
|
-
const a = await get(chainId, `/api/v2/addresses/${encodeURIComponent(address)}`, opts);
|
|
157
|
-
return {
|
|
158
|
-
provider: "bob-rootstock",
|
|
159
|
-
chainId,
|
|
160
|
-
chain: meta.name,
|
|
161
|
-
address,
|
|
162
|
-
nativeSymbol: meta.nativeSymbol,
|
|
163
|
-
coinBalanceWei: a.coin_balance == null ? null : String(a.coin_balance),
|
|
164
|
-
coinBalance: a.coin_balance == null ? null : Number(a.coin_balance) / 1e18,
|
|
165
|
-
isContract: a.is_contract ?? null,
|
|
166
|
-
isVerified: a.is_verified ?? null,
|
|
167
|
-
name: a.name ?? null,
|
|
168
|
-
blockNumberBalanceUpdatedAt: a.block_number_balance_updated_at ?? null,
|
|
169
|
-
raw: a,
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
/** ERC-20 token holdings for an address on either L2. */
|
|
174
|
-
export async function btcL2TokenBalances(args = {}, opts = {}) {
|
|
175
|
-
const chainId = btcL2ChainId(args.chainId ?? args.chain);
|
|
176
|
-
const address = evmAddress(args.address || args.addr, "address");
|
|
177
|
-
const rows = await get(chainId, `/api/v2/addresses/${encodeURIComponent(address)}/token-balances`, opts);
|
|
178
|
-
const list = Array.isArray(rows) ? rows : [];
|
|
179
|
-
const limit = Math.min(500, Math.max(1, Number(args.limit || list.length || 1)));
|
|
180
|
-
return {
|
|
181
|
-
provider: "bob-rootstock",
|
|
182
|
-
chainId,
|
|
183
|
-
chain: BTC_L2_CHAINS[chainId].name,
|
|
184
|
-
address,
|
|
185
|
-
count: list.length,
|
|
186
|
-
tokens: list.slice(0, limit).map((t) => ({
|
|
187
|
-
symbol: t.token?.symbol ?? null,
|
|
188
|
-
name: t.token?.name ?? null,
|
|
189
|
-
address: t.token?.address ?? t.token?.address_hash ?? null,
|
|
190
|
-
type: t.token?.type ?? null,
|
|
191
|
-
decimals: t.token?.decimals ?? null,
|
|
192
|
-
rawBalance: t.value == null ? null : String(t.value),
|
|
193
|
-
balance:
|
|
194
|
-
t.value == null || t.token?.decimals == null ? null : Number(t.value) / 10 ** Number(t.token.decimals),
|
|
195
|
-
exchangeRate: t.token?.exchange_rate ?? null,
|
|
196
|
-
})),
|
|
197
|
-
};
|
|
198
|
-
}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
// Braiins mining insights — BTC price stats + pool distribution, keyless.
|
|
2
|
-
//
|
|
3
|
-
// HOST NOTE (measured): use insights.braiins.com. Two traps:
|
|
4
|
-
// - pool.braiins.com/api/... returns 403 (that host is the pool dashboard,
|
|
5
|
-
// not the public insights API).
|
|
6
|
-
// - insights.braiins.com/api/v1.0/* answers 302 and redirects to
|
|
7
|
-
// learn.braiins.com/api/v1.0/*. Following redirects is required; http.mjs
|
|
8
|
-
// follows same-scheme redirects for GET, so the documented host is kept
|
|
9
|
-
// here as the entry point and the redirect resolves transparently.
|
|
10
|
-
//
|
|
11
|
-
// Verified live (after redirect):
|
|
12
|
-
// GET /api/v1.0/price-stats 200 { price, percent_change_24h, timestamp }
|
|
13
|
-
// GET /api/v1.0/pool-stats 200 [ { pool_name, blocks_mined{1d,1w,5w}, … } ]
|
|
14
|
-
//
|
|
15
|
-
// Complements mempool-mining: mempool gives block-count pool share from chain
|
|
16
|
-
// data; Braiins publishes miner-economics framing (block value, hashrate share)
|
|
17
|
-
// plus a price tick to value it against.
|
|
18
|
-
//
|
|
19
|
-
// Read-only.
|
|
20
|
-
|
|
21
|
-
import { httpJson } from "../http.mjs";
|
|
22
|
-
|
|
23
|
-
export const BRAIINS_INSIGHTS_API = "https://insights.braiins.com/api/v1.0";
|
|
24
|
-
|
|
25
|
-
function baseUrl(opts = {}) {
|
|
26
|
-
return String(opts.baseUrl || process.env.BRAIINS_INSIGHTS_URL || BRAIINS_INSIGHTS_API).replace(/\/$/, "");
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function get(path, opts = {}) {
|
|
30
|
-
return httpJson(`${baseUrl(opts)}${path.startsWith("/") ? path : `/${path}`}`, {
|
|
31
|
-
fetchImpl: opts.fetchImpl,
|
|
32
|
-
timeoutMs: opts.timeoutMs ?? 15_000,
|
|
33
|
-
headers: { Accept: "application/json" },
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export async function braiinsHealth(opts = {}) {
|
|
38
|
-
try {
|
|
39
|
-
const p = await get("/price-stats", opts);
|
|
40
|
-
const price = Number(p?.price ?? 0);
|
|
41
|
-
return {
|
|
42
|
-
ok: Number.isFinite(price) && price > 0,
|
|
43
|
-
provider: "braiins-insights",
|
|
44
|
-
baseUrl: baseUrl(opts),
|
|
45
|
-
btcUsd: Number.isFinite(price) ? price : null,
|
|
46
|
-
timestamp: p?.timestamp ?? null,
|
|
47
|
-
exec: false,
|
|
48
|
-
};
|
|
49
|
-
} catch (error) {
|
|
50
|
-
return {
|
|
51
|
-
ok: false,
|
|
52
|
-
provider: "braiins-insights",
|
|
53
|
-
baseUrl: baseUrl(opts),
|
|
54
|
-
error: String(error?.message || error),
|
|
55
|
-
exec: false,
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export async function braiinsPriceStats(_args = {}, opts = {}) {
|
|
61
|
-
const p = await get("/price-stats", opts);
|
|
62
|
-
return {
|
|
63
|
-
provider: "braiins-insights",
|
|
64
|
-
btcUsd: p?.price == null ? null : Number(p.price),
|
|
65
|
-
percentChange24h: p?.percent_change_24h ?? null,
|
|
66
|
-
timestamp: p?.timestamp ?? null,
|
|
67
|
-
raw: p,
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Per-pool mining stats. Braiins nests block counts by window
|
|
73
|
-
* ({ "1d": { absolute, relative_pct }, "1w": …, "5w": … }) — flattened here
|
|
74
|
-
* to the requested window so callers do not have to walk the shape.
|
|
75
|
-
*/
|
|
76
|
-
export async function braiinsPoolStats(args = {}, opts = {}) {
|
|
77
|
-
const res = await get("/pool-stats", opts);
|
|
78
|
-
const list = Array.isArray(res) ? res : Array.isArray(res?.pools) ? res.pools : [];
|
|
79
|
-
const win = String(args.window || "1w").trim().toLowerCase();
|
|
80
|
-
const pick = (row) => row?.blocks_mined?.[win] || null;
|
|
81
|
-
const rows = [...list].sort((a, b) => Number(pick(b)?.absolute || 0) - Number(pick(a)?.absolute || 0));
|
|
82
|
-
const limit = Math.min(200, Math.max(1, Number(args.limit || rows.length || 1)));
|
|
83
|
-
const windows = list.length ? Object.keys(list[0]?.blocks_mined || {}) : [];
|
|
84
|
-
if (windows.length && !windows.includes(win)) {
|
|
85
|
-
throw new Error(`braiins-insights: window must be one of ${windows.join(", ")}`);
|
|
86
|
-
}
|
|
87
|
-
return {
|
|
88
|
-
provider: "braiins-insights",
|
|
89
|
-
window: win,
|
|
90
|
-
availableWindows: windows,
|
|
91
|
-
count: rows.length,
|
|
92
|
-
pools: rows.slice(0, limit).map((r) => ({
|
|
93
|
-
name: r.pool_name ?? r.name ?? null,
|
|
94
|
-
blocksMined: pick(r)?.absolute ?? null,
|
|
95
|
-
sharePct: pick(r)?.relative_pct ?? null,
|
|
96
|
-
blockValueAvg: r.block_value_avg ?? null,
|
|
97
|
-
hashrate: r.hashrate ?? null,
|
|
98
|
-
luck: r.luck ?? null,
|
|
99
|
-
blocksMinedAllWindows: r.blocks_mined ?? null,
|
|
100
|
-
})),
|
|
101
|
-
raw: rows.slice(0, limit),
|
|
102
|
-
};
|
|
103
|
-
}
|
|
@@ -1,259 +0,0 @@
|
|
|
1
|
-
// Cross-chain bridge aggregator: 9 providers + revoke check.
|
|
2
|
-
// Quotes every available route in parallel, ranks by net output.
|
|
3
|
-
|
|
4
|
-
import { bestBridgeRoute } from "../../router/index.mjs";
|
|
5
|
-
import { debridgeQuote, debridgeHealth, DEBRIDGE_API } from "./debridge.mjs";
|
|
6
|
-
import { changenowQuote, changenowHealth, CHANGENOW_API } from "./changenow.mjs";
|
|
7
|
-
import { squidQuote, squidHealth, SQUID_API } from "./squid-router.mjs";
|
|
8
|
-
import { stargateQuote, stargateHealth, STARGATE_API } from "./stargate.mjs";
|
|
9
|
-
import { thorchainQuote, thorchainHealth, THORCHAIN_API } from "./thorchain.mjs";
|
|
10
|
-
import { bungeeQuote, bungeeHealth, BUNGEE_API } from "./bungee.mjs";
|
|
11
|
-
import { connextQuote, connextHealth, CONNEXT_API } from "./connext.mjs";
|
|
12
|
-
import { wormholeQuote, wormholeHealth, WORMHOLE_API } from "./wormhole.mjs";
|
|
13
|
-
import { approvalsScan } from "./approvals.mjs";
|
|
14
|
-
|
|
15
|
-
const PROVIDERS = Object.freeze(["debridge", "lifi-relay", "squid", "stargate", "thorchain", "bungee", "connext", "wormhole", "changenow"]);
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Quote all available bridge routes for a cross-chain transfer.
|
|
19
|
-
* Runs all providers concurrently; partial failures are non-fatal.
|
|
20
|
-
*
|
|
21
|
-
* @param {{ fromChainId: number, toChainId: number, tokenIn: string, tokenOut: string, amount: string, taker: string, fromSymbol?: string, toSymbol?: string, fromDecimals?: number, toDecimals?: number }} params
|
|
22
|
-
*/
|
|
23
|
-
export async function aggregateBridgeQuotes(params = {}) {
|
|
24
|
-
const {
|
|
25
|
-
fromChainId, toChainId, tokenIn, tokenOut, amount, taker,
|
|
26
|
-
fromSymbol = "?", toSymbol = "?", fromDecimals = 18, toDecimals = 18,
|
|
27
|
-
} = params;
|
|
28
|
-
|
|
29
|
-
const results = [];
|
|
30
|
-
const errors = [];
|
|
31
|
-
|
|
32
|
-
// ── deBridge ──
|
|
33
|
-
const debridgeP = debridgeQuote({
|
|
34
|
-
srcChainId: fromChainId,
|
|
35
|
-
srcChainTokenIn: tokenIn,
|
|
36
|
-
srcChainTokenInAmount: amount,
|
|
37
|
-
dstChainId: toChainId,
|
|
38
|
-
dstChainTokenOut: tokenOut,
|
|
39
|
-
}).then(r => {
|
|
40
|
-
if (r.error) { errors.push(`debridge: ${r.error}`); return null; }
|
|
41
|
-
return {
|
|
42
|
-
provider: "debridge",
|
|
43
|
-
amountOut: r.estimation?.dstChainTokenOut?.amount ?? r.estimation?.toAmount,
|
|
44
|
-
feeUsd: r.estimation?.fixFee ?? r.fixFee,
|
|
45
|
-
estimatedTime: r.estimation?.execution?.estimatedTransferTime
|
|
46
|
-
? `${r.estimation.execution.estimatedTransferTime}s`
|
|
47
|
-
: "unknown",
|
|
48
|
-
preparable: true,
|
|
49
|
-
raw: r,
|
|
50
|
-
};
|
|
51
|
-
}).catch(e => { errors.push(`debridge: ${e.message}`); return null; });
|
|
52
|
-
|
|
53
|
-
// ── LI.FI / Relay (existing bridge router) ──
|
|
54
|
-
const lifiP = bestBridgeRoute({
|
|
55
|
-
fromChainId, toChainId, tokenIn, tokenOut, amountIn: amount, taker,
|
|
56
|
-
}).then(r => {
|
|
57
|
-
if (!r || r.error) { errors.push(`lifi: ${r?.error ?? "no route"}`); return null; }
|
|
58
|
-
return {
|
|
59
|
-
provider: "lifi-relay",
|
|
60
|
-
amountOut: r.amountOut ?? r.quote?.amountOut,
|
|
61
|
-
feeUsd: r.feeUsd ?? r.totalFee,
|
|
62
|
-
estimatedTime: r.estimatedTime ?? r.duration ?? "unknown",
|
|
63
|
-
preparable: !!r.transaction,
|
|
64
|
-
raw: r,
|
|
65
|
-
};
|
|
66
|
-
}).catch(e => { errors.push(`lifi: ${e.message}`); return null; });
|
|
67
|
-
|
|
68
|
-
// ── Squid (Axelar) ──
|
|
69
|
-
const squidP = squidQuote({
|
|
70
|
-
fromChain: fromChainId, toChain: toChainId,
|
|
71
|
-
fromToken: tokenIn, toToken: tokenOut,
|
|
72
|
-
fromAmount: amount, fromAddress: taker,
|
|
73
|
-
}).then(r => {
|
|
74
|
-
if (r.error) { errors.push(`squid: ${r.error}`); return null; }
|
|
75
|
-
return {
|
|
76
|
-
provider: "squid",
|
|
77
|
-
amountOut: r.toAmount,
|
|
78
|
-
feeUsd: Array.isArray(r.fee) ? r.fee.reduce((a, b) => a + (Number(b.amountUsd) || 0), 0) : null,
|
|
79
|
-
estimatedTime: "30s - 3min",
|
|
80
|
-
preparable: false,
|
|
81
|
-
raw: r,
|
|
82
|
-
};
|
|
83
|
-
}).catch(e => { errors.push(`squid: ${e.message}`); return null; });
|
|
84
|
-
|
|
85
|
-
// ── Stargate (LayerZero) ──
|
|
86
|
-
const stargateP = stargateQuote({
|
|
87
|
-
srcChainId: fromChainId, dstChainId: toChainId,
|
|
88
|
-
token: tokenIn, amount,
|
|
89
|
-
}).then(r => {
|
|
90
|
-
if (r.error) { errors.push(`stargate: ${r.error}`); return null; }
|
|
91
|
-
return {
|
|
92
|
-
provider: "stargate",
|
|
93
|
-
amountOut: r.amountOut,
|
|
94
|
-
feeUsd: r.fee,
|
|
95
|
-
estimatedTime: r.estimatedTime || "1-5 min",
|
|
96
|
-
preparable: false,
|
|
97
|
-
raw: r,
|
|
98
|
-
};
|
|
99
|
-
}).catch(e => { errors.push(`stargate: ${e.message}`); return null; });
|
|
100
|
-
|
|
101
|
-
// ── THORChain (native swaps) ──
|
|
102
|
-
const thorchainP = thorchainQuote({
|
|
103
|
-
fromAsset: fromSymbol, toAsset: toSymbol, amount, destination: taker,
|
|
104
|
-
}).then(r => {
|
|
105
|
-
if (r.error) { errors.push(`thorchain: ${r.error}`); return null; }
|
|
106
|
-
return {
|
|
107
|
-
provider: "thorchain",
|
|
108
|
-
amountOut: r.expectedAmountOut,
|
|
109
|
-
feeUsd: r.fees?.total,
|
|
110
|
-
estimatedTime: r.estimatedTime || "10-30 min",
|
|
111
|
-
preparable: false,
|
|
112
|
-
raw: r,
|
|
113
|
-
};
|
|
114
|
-
}).catch(e => { errors.push(`thorchain: ${e.message}`); return null; });
|
|
115
|
-
|
|
116
|
-
// ── ChangeNOW ──
|
|
117
|
-
const changenowP = (async () => {
|
|
118
|
-
if (!fromSymbol || !toSymbol || fromSymbol === "?" || toSymbol === "?") {
|
|
119
|
-
errors.push("changenow: ticker symbols required, skipping");
|
|
120
|
-
return null;
|
|
121
|
-
}
|
|
122
|
-
try {
|
|
123
|
-
const q = await changenowQuote({ fromTicker: fromSymbol, toTicker: toSymbol, fromAmount: amount });
|
|
124
|
-
if (q.error) { errors.push(`changenow: ${q.error}`); return null; }
|
|
125
|
-
return {
|
|
126
|
-
provider: "changenow",
|
|
127
|
-
amountOut: q.toAmount,
|
|
128
|
-
feeUsd: q.networkFee,
|
|
129
|
-
estimatedTime: q.flow === "standard" ? "5-30 min" : "instant",
|
|
130
|
-
preparable: false, // CEX - user sends funds themselves
|
|
131
|
-
kycRequired: q.kycRequired,
|
|
132
|
-
raw: q,
|
|
133
|
-
};
|
|
134
|
-
} catch (e) { errors.push(`changenow: ${e.message}`); return null; }
|
|
135
|
-
})();
|
|
136
|
-
|
|
137
|
-
// ── Bungee/Socket ──
|
|
138
|
-
const bungeeP = bungeeQuote({ fromChainId, toChainId, fromToken: tokenIn, toToken: tokenOut, fromAmount: amount, userAddress: taker }).then(r => {
|
|
139
|
-
if (r.error) { errors.push(`bungee: ${r.error}`); return null; }
|
|
140
|
-
return { provider: "bungee", amountOut: r.amountOut, feeUsd: r.feeUsd, estimatedTime: r.estimatedTime, preparable: false, raw: r };
|
|
141
|
-
}).catch(e => { errors.push(`bungee: ${e.message}`); return null; });
|
|
142
|
-
|
|
143
|
-
// ── Connext ──
|
|
144
|
-
const connextP = connextQuote({ originDomain: fromChainId, destinationDomain: toChainId, originToken: tokenIn, destinationToken: tokenOut, amount }).then(r => {
|
|
145
|
-
if (r.error) { errors.push(`connext: ${r.error}`); return null; }
|
|
146
|
-
return { provider: "connext", amountOut: r.amountOut, feeUsd: r.fee, estimatedTime: r.estimatedTime || "5-20 min", preparable: false, raw: r };
|
|
147
|
-
}).catch(e => { errors.push(`connext: ${e.message}`); return null; });
|
|
148
|
-
|
|
149
|
-
// ── Wormhole ──
|
|
150
|
-
const wormholeP = wormholeQuote({ fromChain: fromChainId, toChain: toChainId, token: tokenIn, amount }).then(r => {
|
|
151
|
-
if (r.error) { errors.push(`wormhole: ${r.error}`); return null; }
|
|
152
|
-
return { provider: "wormhole", amountOut: r.amountOut, feeUsd: r.fee, estimatedTime: r.estimatedTime || "5-15 min", preparable: false, raw: r };
|
|
153
|
-
}).catch(e => { errors.push(`wormhole: ${e.message}`); return null; });
|
|
154
|
-
|
|
155
|
-
const settled = await Promise.allSettled([debridgeP, lifiP, squidP, stargateP, thorchainP, bungeeP, connextP, wormholeP, changenowP]);
|
|
156
|
-
for (const s of settled) {
|
|
157
|
-
if (s.status === "fulfilled" && s.value) results.push(s.value);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// Rank by output amount (descending). Preparable routes preferred on tie.
|
|
161
|
-
results.sort((a, b) => {
|
|
162
|
-
const aOut = Number(a.amountOut ?? 0);
|
|
163
|
-
const bOut = Number(b.amountOut ?? 0);
|
|
164
|
-
if (aOut !== bOut) return bOut - aOut;
|
|
165
|
-
if (a.preparable && !b.preparable) return -1;
|
|
166
|
-
if (!a.preparable && b.preparable) return 1;
|
|
167
|
-
return 0;
|
|
168
|
-
});
|
|
169
|
-
|
|
170
|
-
return {
|
|
171
|
-
providers: results.map(r => r.provider),
|
|
172
|
-
bestRoute: results[0]?.provider ?? "none",
|
|
173
|
-
winner: results[0] ?? null,
|
|
174
|
-
runnersUp: results.slice(1),
|
|
175
|
-
errors: errors.length ? errors : null,
|
|
176
|
-
};
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* Check if the taker has any active ERC-20 approvals on the origin chain
|
|
181
|
-
* that should be revoked before bridging. Uses the existing approval scanner.
|
|
182
|
-
*/
|
|
183
|
-
export async function checkRevokeNeeded({ chainId, taker, tokenIn } = {}) {
|
|
184
|
-
if (!chainId || !taker) return { needsRevoke: false, note: "no wallet to check" };
|
|
185
|
-
|
|
186
|
-
try {
|
|
187
|
-
const result = await approvalsScan({ chainIds: [chainId], address: taker });
|
|
188
|
-
const approvals = result.approvals;
|
|
189
|
-
if (!approvals?.length) return { needsRevoke: false, note: "no active approvals found" };
|
|
190
|
-
|
|
191
|
-
// Token-specific: check if the token being bridged has active approvals
|
|
192
|
-
const tokenApproval = tokenIn
|
|
193
|
-
? approvals.find(a => String(a.token).toLowerCase() === String(tokenIn).toLowerCase())
|
|
194
|
-
: null;
|
|
195
|
-
|
|
196
|
-
if (tokenApproval && BigInt(tokenApproval.allowance ?? "0") > 0n) {
|
|
197
|
-
return {
|
|
198
|
-
needsRevoke: true,
|
|
199
|
-
spender: tokenApproval.spender,
|
|
200
|
-
amount: tokenApproval.allowance,
|
|
201
|
-
symbol: tokenApproval.symbol ?? "?",
|
|
202
|
-
decimals: tokenApproval.decimals ?? 18,
|
|
203
|
-
note: `approval found for ${tokenApproval.spender}, revoke before bridging`,
|
|
204
|
-
};
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
return {
|
|
208
|
-
needsRevoke: false,
|
|
209
|
-
note: `no active approval for this token (${approvals.length} total approvals on chain)`,
|
|
210
|
-
};
|
|
211
|
-
} catch (e) {
|
|
212
|
-
return { needsRevoke: false, note: `revoke check unavailable: ${String(e.message || e).slice(0, 100)}` };
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* Full bridge scan: quote all routes + revoke check.
|
|
218
|
-
* Returns data shaped for the bridge card renderer.
|
|
219
|
-
*/
|
|
220
|
-
export async function scanBridgeRoutes(params = {}) {
|
|
221
|
-
const [quotes, revoke] = await Promise.all([
|
|
222
|
-
aggregateBridgeQuotes(params),
|
|
223
|
-
checkRevokeNeeded({ chainId: params.fromChainId, taker: params.taker, tokenIn: params.tokenIn }),
|
|
224
|
-
]);
|
|
225
|
-
|
|
226
|
-
const best = quotes.winner ?? {};
|
|
227
|
-
|
|
228
|
-
return {
|
|
229
|
-
kind: "bridge",
|
|
230
|
-
fromChainId: params.fromChainId,
|
|
231
|
-
toChainId: params.toChainId,
|
|
232
|
-
fromSymbol: params.fromSymbol,
|
|
233
|
-
toSymbol: params.toSymbol,
|
|
234
|
-
amount: params.amount,
|
|
235
|
-
fromDecimals: params.fromDecimals ?? 18,
|
|
236
|
-
toDecimals: params.toDecimals ?? 18,
|
|
237
|
-
bestRoute: best.provider ?? "none",
|
|
238
|
-
amountOut: best.amountOut,
|
|
239
|
-
feeUsd: best.feeUsd,
|
|
240
|
-
estimatedTime: best.estimatedTime,
|
|
241
|
-
preparable: best.preparable ? "yes" : "no (manual send)",
|
|
242
|
-
providers: quotes.providers,
|
|
243
|
-
runnersUp: quotes.runnersUp,
|
|
244
|
-
revokeCheck: revoke,
|
|
245
|
-
errors: quotes.errors,
|
|
246
|
-
confidence: quotes.providers.length >= 2 ? 0.85 : quotes.providers.length === 1 ? 0.6 : 0.1,
|
|
247
|
-
};
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* Health check: verify all bridge providers are reachable.
|
|
252
|
-
*/
|
|
253
|
-
export async function bridgeAggregatorHealth() {
|
|
254
|
-
const [d, c] = await Promise.all([
|
|
255
|
-
debridgeHealth().catch(e => ({ ok: false, error: e.message })),
|
|
256
|
-
changenowHealth().catch(e => ({ ok: false, error: e.message })),
|
|
257
|
-
]);
|
|
258
|
-
return { debridge: d, changenow: c, lifi: { ok: true, note: "integrated via router" } };
|
|
259
|
-
}
|