@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.
Files changed (450) hide show
  1. package/README.md +2 -2
  2. package/SETUP.md +4 -4
  3. package/dist/action-receipts.mjs +1 -0
  4. package/dist/action-semantics.mjs +1 -0
  5. package/dist/address-book.mjs +2 -0
  6. package/dist/bin/desk-server.mjs +60 -0
  7. package/dist/bin/oracle-data-mcp.mjs +9 -0
  8. package/dist/bin/oracle-equities.mjs +20 -0
  9. package/dist/bin/oracle-init.mjs +24 -0
  10. package/dist/bin/oracle-public-server.mjs +5 -0
  11. package/dist/bin/oracle-route.mjs +22 -0
  12. package/dist/bin/oracle-scan.mjs +18 -0
  13. package/dist/bin/oracle-upgrade.mjs +21 -0
  14. package/dist/bin/oracle.mjs +63 -0
  15. package/dist/chains.mjs +1 -0
  16. package/dist/cli/commands/auth.mjs +16 -0
  17. package/dist/cli/commands/bootstrap.mjs +18 -0
  18. package/dist/cli/commands/chain.mjs +21 -0
  19. package/dist/cli/commands/chat.mjs +45 -0
  20. package/dist/cli/commands/credential.mjs +1 -0
  21. package/dist/cli/commands/data-mcp.mjs +2 -0
  22. package/dist/cli/commands/data.mjs +12 -0
  23. package/dist/cli/commands/doctor.mjs +5 -0
  24. package/dist/cli/commands/equities.mjs +15 -0
  25. package/dist/cli/commands/farm.mjs +59 -0
  26. package/dist/cli/commands/fees.mjs +10 -0
  27. package/dist/cli/commands/follow.mjs +28 -0
  28. package/dist/cli/commands/harness.mjs +15 -0
  29. package/dist/cli/commands/help.mjs +1 -0
  30. package/dist/cli/commands/init.mjs +3 -0
  31. package/dist/cli/commands/mcp.mjs +36 -0
  32. package/dist/cli/commands/model.mjs +54 -0
  33. package/dist/cli/commands/plugins.mjs +43 -0
  34. package/dist/cli/commands/prepare.mjs +2 -0
  35. package/dist/cli/commands/public.mjs +3 -0
  36. package/dist/cli/commands/resolve.mjs +23 -0
  37. package/dist/cli/commands/route.mjs +2 -0
  38. package/dist/cli/commands/runner.mjs +1 -0
  39. package/dist/cli/commands/scan.mjs +2 -0
  40. package/dist/cli/commands/setup.mjs +34 -0
  41. package/dist/cli/commands/sign.mjs +4 -0
  42. package/dist/cli/commands/signer.mjs +1 -0
  43. package/dist/cli/commands/strategy.mjs +18 -0
  44. package/dist/cli/commands/swap.mjs +36 -0
  45. package/dist/cli/commands/upgrade.mjs +2 -0
  46. package/dist/cli/commands/vault.mjs +1 -0
  47. package/dist/cli/commands/version.mjs +2 -0
  48. package/dist/data/desk-data.mjs +55 -0
  49. package/dist/data/names.mjs +2 -0
  50. package/dist/data/providers/farming.mjs +2 -0
  51. package/dist/equities/index.mjs +1 -0
  52. package/dist/index.mjs +60 -0
  53. package/dist/nft-gas-war-guard.mjs +1 -0
  54. package/dist/onboarding/harness-configs.mjs +4 -0
  55. package/dist/portfolio-risk.mjs +1 -0
  56. package/dist/prepare-envelope.mjs +1 -0
  57. package/dist/public-api/agent-grants.mjs +3 -0
  58. package/dist/public-control/policy-schema.mjs +1 -0
  59. package/dist/router/index.mjs +2 -0
  60. package/dist/scanner/index.mjs +4 -0
  61. package/dist/signals/index.mjs +1 -0
  62. package/dist/strategy/index.mjs +3 -0
  63. package/dist/watch-preferences.mjs +1 -0
  64. package/package.json +33 -78
  65. package/public/oracle-splash/_variants/ice.html +5 -18
  66. package/public/oracle-splash/_variants/ivory.html +5 -18
  67. package/public/oracle-splash/downloads/index.html +4 -4
  68. package/public/oracle-splash/index.html +113 -34
  69. package/CONTRIBUTING.md +0 -99
  70. package/bin/desk-server.mjs +0 -473
  71. package/bin/oracle-data-mcp.mjs +0 -1252
  72. package/bin/oracle-equities.mjs +0 -168
  73. package/bin/oracle-init.mjs +0 -525
  74. package/bin/oracle-public-server.mjs +0 -36
  75. package/bin/oracle-route.mjs +0 -254
  76. package/bin/oracle-scan.mjs +0 -192
  77. package/bin/oracle-upgrade.mjs +0 -42
  78. package/bin/oracle.mjs +0 -34
  79. package/docs/adding-a-chain.md +0 -229
  80. package/docs/architecture.md +0 -139
  81. package/docs/buzz-integration.md +0 -115
  82. package/docs/cli.md +0 -143
  83. package/docs/connectors.md +0 -13
  84. package/docs/hyperliquid-builder-code.md +0 -50
  85. package/docs/locals-only-fee-waiver.md +0 -34
  86. package/docs/oracle-pack-standard.md +0 -29
  87. package/docs/profiles.md +0 -151
  88. package/docs/public-surface.md +0 -206
  89. package/examples/add-a-chain.mjs +0 -65
  90. package/examples/oracle-pack-template.mjs +0 -38
  91. package/examples/research-a-token.mjs +0 -70
  92. package/plugins/oracle-owner-gate/__init__.py +0 -288
  93. package/plugins/oracle-owner-gate/plugin.yaml +0 -9
  94. package/protocols/templates/safe-erc20/SECURITY.md +0 -16
  95. package/protocols/templates/safe-erc20/foundry.toml +0 -12
  96. package/protocols/templates/safe-erc20/remappings.txt +0 -2
  97. package/protocols/templates/safe-erc20/src/SafeERC20.sol +0 -53
  98. package/protocols/templates/safe-erc20/test/SafeERC20.t.sol +0 -72
  99. package/scripts/adversarial-bench.mjs +0 -114
  100. package/scripts/build-dist.mjs +0 -119
  101. package/scripts/build-inscription.py +0 -230
  102. package/scripts/check-doc-drift.mjs +0 -123
  103. package/scripts/check-test-count.mjs +0 -105
  104. package/scripts/e2e-hl-markets.mjs +0 -21
  105. package/scripts/e2e-hl-perps.mjs +0 -48
  106. package/scripts/e2e-hypercore-staking.mjs +0 -128
  107. package/scripts/e2e-solana-bitcoin.mjs +0 -183
  108. package/scripts/guard-publish.mjs +0 -22
  109. package/scripts/protocol-template-gate.mjs +0 -15
  110. package/scripts/public-api-scan.mjs +0 -23
  111. package/scripts/publish-dist.mjs +0 -67
  112. package/scripts/record-hero-cli.sh +0 -80
  113. package/scripts/secret-scan.mjs +0 -169
  114. package/scripts/smoke-dist-bins.mjs +0 -89
  115. package/scripts/verify-dist.mjs +0 -29
  116. package/scripts/verify-v3-venues.mjs +0 -233
  117. package/skins/oracle.yaml +0 -56
  118. package/src/action-receipts.mjs +0 -265
  119. package/src/action-semantics.mjs +0 -62
  120. package/src/address-book.mjs +0 -208
  121. package/src/agent-auth.mjs +0 -206
  122. package/src/approval-guard.mjs +0 -282
  123. package/src/attestation-secret.mjs +0 -94
  124. package/src/audit-log.mjs +0 -196
  125. package/src/auth/oauth.mjs +0 -672
  126. package/src/auto-slippage.mjs +0 -378
  127. package/src/capability-posture.mjs +0 -125
  128. package/src/cards.mjs +0 -422
  129. package/src/chains.mjs +0 -62
  130. package/src/cli/chain-catalog.mjs +0 -215
  131. package/src/cli/chain-state.mjs +0 -74
  132. package/src/cli/commands/auth.mjs +0 -193
  133. package/src/cli/commands/bootstrap.mjs +0 -87
  134. package/src/cli/commands/chain.mjs +0 -143
  135. package/src/cli/commands/chat.mjs +0 -465
  136. package/src/cli/commands/credential.mjs +0 -9
  137. package/src/cli/commands/data-mcp.mjs +0 -18
  138. package/src/cli/commands/data.mjs +0 -75
  139. package/src/cli/commands/doctor.mjs +0 -136
  140. package/src/cli/commands/equities.mjs +0 -41
  141. package/src/cli/commands/farm.mjs +0 -129
  142. package/src/cli/commands/fees.mjs +0 -109
  143. package/src/cli/commands/follow.mjs +0 -130
  144. package/src/cli/commands/harness.mjs +0 -63
  145. package/src/cli/commands/help.mjs +0 -7
  146. package/src/cli/commands/init.mjs +0 -27
  147. package/src/cli/commands/mcp.mjs +0 -154
  148. package/src/cli/commands/model.mjs +0 -106
  149. package/src/cli/commands/plugins.mjs +0 -275
  150. package/src/cli/commands/prepare.mjs +0 -12
  151. package/src/cli/commands/public.mjs +0 -20
  152. package/src/cli/commands/resolve.mjs +0 -64
  153. package/src/cli/commands/route.mjs +0 -12
  154. package/src/cli/commands/runner.mjs +0 -9
  155. package/src/cli/commands/scan.mjs +0 -12
  156. package/src/cli/commands/setup.mjs +0 -294
  157. package/src/cli/commands/sign.mjs +0 -21
  158. package/src/cli/commands/signer.mjs +0 -9
  159. package/src/cli/commands/swap.mjs +0 -102
  160. package/src/cli/commands/upgrade.mjs +0 -12
  161. package/src/cli/commands/vault.mjs +0 -9
  162. package/src/cli/commands/version.mjs +0 -22
  163. package/src/cli/first-run.mjs +0 -23
  164. package/src/cli/kernel.mjs +0 -262
  165. package/src/cli/mcp-targets/chatgpt.mjs +0 -51
  166. package/src/cli/mcp-targets/claude-code.mjs +0 -39
  167. package/src/cli/mcp-targets/claude-desktop.mjs +0 -24
  168. package/src/cli/mcp-targets/codex.mjs +0 -41
  169. package/src/cli/mcp-targets/cursor.mjs +0 -32
  170. package/src/cli/mcp-targets/shared.mjs +0 -71
  171. package/src/cli/mcp-targets/vscode.mjs +0 -39
  172. package/src/cli/messaging-platforms.mjs +0 -217
  173. package/src/cli/model-config.mjs +0 -78
  174. package/src/cli/operator-dispatch.mjs +0 -194
  175. package/src/cli/oracle-harness.py +0 -415
  176. package/src/cli/paths.mjs +0 -107
  177. package/src/cli/runtime.mjs +0 -351
  178. package/src/cli/setup-state.mjs +0 -168
  179. package/src/cli/spawn-child.mjs +0 -43
  180. package/src/data/catalog.mjs +0 -858
  181. package/src/data/desk-data.mjs +0 -877
  182. package/src/data/http.mjs +0 -253
  183. package/src/data/names.mjs +0 -188
  184. package/src/data/provider-endpoint.mjs +0 -94
  185. package/src/data/providers/aave-v3.mjs +0 -139
  186. package/src/data/providers/across-bridge.mjs +0 -41
  187. package/src/data/providers/aerodrome.mjs +0 -245
  188. package/src/data/providers/aevo.mjs +0 -33
  189. package/src/data/providers/approval-indexer.mjs +0 -133
  190. package/src/data/providers/approvals.mjs +0 -594
  191. package/src/data/providers/babylon-staking.mjs +0 -149
  192. package/src/data/providers/balancer.mjs +0 -209
  193. package/src/data/providers/beefy-yields.mjs +0 -45
  194. package/src/data/providers/birdeye-tokens.mjs +0 -33
  195. package/src/data/providers/bisq-markets.mjs +0 -145
  196. package/src/data/providers/bitcoin-esplora.mjs +0 -216
  197. package/src/data/providers/bitcoin-meta.mjs +0 -378
  198. package/src/data/providers/blockscout.mjs +0 -14
  199. package/src/data/providers/bob-rootstock.mjs +0 -198
  200. package/src/data/providers/braiins-insights.mjs +0 -103
  201. package/src/data/providers/bridge-aggregator.mjs +0 -259
  202. package/src/data/providers/bridges.mjs +0 -242
  203. package/src/data/providers/bungee.mjs +0 -29
  204. package/src/data/providers/celestia-da.mjs +0 -38
  205. package/src/data/providers/changenow.mjs +0 -135
  206. package/src/data/providers/compound.mjs +0 -32
  207. package/src/data/providers/connext.mjs +0 -28
  208. package/src/data/providers/convex.mjs +0 -30
  209. package/src/data/providers/cow-protocol.mjs +0 -110
  210. package/src/data/providers/cowswap.mjs +0 -415
  211. package/src/data/providers/curve.mjs +0 -201
  212. package/src/data/providers/das-assets.mjs +0 -59
  213. package/src/data/providers/debridge.mjs +0 -109
  214. package/src/data/providers/defillama.mjs +0 -88
  215. package/src/data/providers/dexscreener.mjs +0 -43
  216. package/src/data/providers/drift.mjs +0 -32
  217. package/src/data/providers/dydx.mjs +0 -41
  218. package/src/data/providers/evm-rpc.mjs +0 -225
  219. package/src/data/providers/farming.mjs +0 -291
  220. package/src/data/providers/geckoterminal.mjs +0 -34
  221. package/src/data/providers/gmx.mjs +0 -496
  222. package/src/data/providers/hiro-stacks.mjs +0 -150
  223. package/src/data/providers/hl-assets.mjs +0 -165
  224. package/src/data/providers/hl-info.mjs +0 -108
  225. package/src/data/providers/hl-markets.mjs +0 -210
  226. package/src/data/providers/hl-outcome.mjs +0 -61
  227. package/src/data/providers/hl-perps.mjs +0 -419
  228. package/src/data/providers/hl-staking.mjs +0 -353
  229. package/src/data/providers/hl-ws.mjs +0 -119
  230. package/src/data/providers/hyperevm-dex.mjs +0 -49
  231. package/src/data/providers/jito-mev.mjs +0 -117
  232. package/src/data/providers/jupiter-venues.mjs +0 -119
  233. package/src/data/providers/jupiter.mjs +0 -315
  234. package/src/data/providers/kamino-strategies.mjs +0 -143
  235. package/src/data/providers/l2beat-tvl.mjs +0 -42
  236. package/src/data/providers/lifi.mjs +0 -166
  237. package/src/data/providers/liquid-esplora.mjs +0 -152
  238. package/src/data/providers/magiceden-ordinals.mjs +0 -141
  239. package/src/data/providers/magiceden-sol.mjs +0 -406
  240. package/src/data/providers/mempool-lightning.mjs +0 -144
  241. package/src/data/providers/mempool-mining.mjs +0 -142
  242. package/src/data/providers/meteora-dlmm.mjs +0 -168
  243. package/src/data/providers/morpho.mjs +0 -177
  244. package/src/data/providers/nft-gallery.mjs +0 -163
  245. package/src/data/providers/nft-portfolio.mjs +0 -494
  246. package/src/data/providers/odos.mjs +0 -156
  247. package/src/data/providers/ondo.mjs +0 -31
  248. package/src/data/providers/oneinch.mjs +0 -174
  249. package/src/data/providers/opensea-multichain.mjs +0 -136
  250. package/src/data/providers/opensea-nft.mjs +0 -371
  251. package/src/data/providers/orca.mjs +0 -29
  252. package/src/data/providers/ordinals-runes.mjs +0 -180
  253. package/src/data/providers/pancakeswap.mjs +0 -28
  254. package/src/data/providers/paraswap.mjs +0 -125
  255. package/src/data/providers/pendle.mjs +0 -188
  256. package/src/data/providers/poly-clob.mjs +0 -283
  257. package/src/data/providers/poly-public.mjs +0 -96
  258. package/src/data/providers/poly-ws.mjs +0 -103
  259. package/src/data/providers/polygon-staking.mjs +0 -227
  260. package/src/data/providers/portfolio-history.mjs +0 -394
  261. package/src/data/providers/portfolio.mjs +0 -600
  262. package/src/data/providers/pyth-price-feeds.mjs +0 -172
  263. package/src/data/providers/raydium.mjs +0 -35
  264. package/src/data/providers/relayscan-mev.mjs +0 -72
  265. package/src/data/providers/rfq.mjs +0 -15
  266. package/src/data/providers/rh-agent.mjs +0 -59
  267. package/src/data/providers/sanctum-lst.mjs +0 -180
  268. package/src/data/providers/satflow.mjs +0 -341
  269. package/src/data/providers/signed-material-guard.mjs +0 -108
  270. package/src/data/providers/solana-rpc.mjs +0 -197
  271. package/src/data/providers/solend-lending.mjs +0 -166
  272. package/src/data/providers/spark-lend.mjs +0 -42
  273. package/src/data/providers/squid-router.mjs +0 -29
  274. package/src/data/providers/stargate.mjs +0 -29
  275. package/src/data/providers/sushiswap.mjs +0 -30
  276. package/src/data/providers/symbiotic-restaking.mjs +0 -41
  277. package/src/data/providers/thorchain.mjs +0 -36
  278. package/src/data/providers/traderjoe.mjs +0 -28
  279. package/src/data/providers/twap.mjs +0 -152
  280. package/src/data/providers/uniswap-v3.mjs +0 -457
  281. package/src/data/providers/uniswap-v4.mjs +0 -414
  282. package/src/data/providers/vertex.mjs +0 -41
  283. package/src/data/providers/wallet-watch.mjs +0 -264
  284. package/src/data/providers/wormhole.mjs +0 -28
  285. package/src/data/providers/yearn.mjs +0 -31
  286. package/src/data/providers/zerox.mjs +0 -167
  287. package/src/data/public-api-scan.mjs +0 -61
  288. package/src/data/quote-placeholder.mjs +0 -31
  289. package/src/desk/swap-prepare.mjs +0 -194
  290. package/src/equities/bridge.mjs +0 -388
  291. package/src/equities/fixtures/bridge_routes.json +0 -159
  292. package/src/equities/fixtures/dst_transitions.json +0 -29
  293. package/src/equities/fixtures/equity_dex_pools.json +0 -154
  294. package/src/equities/fixtures/hip3_l2books.json +0 -2711
  295. package/src/equities/fixtures/nyse_holidays.json +0 -1
  296. package/src/equities/fixtures/oracles.json +0 -100
  297. package/src/equities/fixtures/rh_pool_state.json +0 -244
  298. package/src/equities/fixtures/solana_xstocks.json +0 -704
  299. package/src/equities/fixtures/ton_xstocks.json +0 -35
  300. package/src/equities/fixtures/universe.json +0 -411
  301. package/src/equities/fixtures/venues.json +0 -3542
  302. package/src/equities/fixtures.mjs +0 -405
  303. package/src/equities/funding.mjs +0 -142
  304. package/src/equities/index.mjs +0 -166
  305. package/src/equities/liveness.mjs +0 -148
  306. package/src/equities/marketHours.mjs +0 -249
  307. package/src/equities/normalize.mjs +0 -295
  308. package/src/equities/num.mjs +0 -146
  309. package/src/equities/prepare.mjs +0 -95
  310. package/src/equities/rank.mjs +0 -260
  311. package/src/equities/sourceNum.mjs +0 -69
  312. package/src/equities/types.mjs +0 -220
  313. package/src/equities/venues/arcus-perp.mjs +0 -84
  314. package/src/equities/venues/arcus-spot.mjs +0 -105
  315. package/src/equities/venues/hyperliquid-hip3.mjs +0 -224
  316. package/src/equities/venues/rh-uniswap.mjs +0 -216
  317. package/src/equities/venues/solana-xstocks.mjs +0 -139
  318. package/src/equities/venues/ton-stonfi.mjs +0 -139
  319. package/src/exact-integer.mjs +0 -72
  320. package/src/exec-policy.mjs +0 -419
  321. package/src/flags.mjs +0 -15
  322. package/src/fresh-window.mjs +0 -76
  323. package/src/gmx-attestation.mjs +0 -176
  324. package/src/index.mjs +0 -107
  325. package/src/licensing/locals-only.mjs +0 -25
  326. package/src/nft-gas-war-guard.mjs +0 -139
  327. package/src/onboarding/agent-keys.mjs +0 -161
  328. package/src/onboarding/harness-configs.mjs +0 -102
  329. package/src/onboarding/index.mjs +0 -18
  330. package/src/onboarding/tiers.mjs +0 -139
  331. package/src/oracle-env.mjs +0 -55
  332. package/src/package-manifest.mjs +0 -42
  333. package/src/plugins/agent-plugin-loader.mjs +0 -225
  334. package/src/portfolio-risk.mjs +0 -170
  335. package/src/prepare-envelope.mjs +0 -204
  336. package/src/profile-upgrade.mjs +0 -277
  337. package/src/protocol-execution.mjs +0 -84
  338. package/src/protocol-templates/gate.mjs +0 -179
  339. package/src/protocol-templates/prepare-deploy.mjs +0 -81
  340. package/src/public-api/agent-grants.mjs +0 -57
  341. package/src/public-api/buzz-integration.mjs +0 -267
  342. package/src/public-api/connect-agent.mjs +0 -424
  343. package/src/public-api/grants.mjs +0 -142
  344. package/src/public-api/http.mjs +0 -707
  345. package/src/public-api/metering.mjs +0 -111
  346. package/src/public-control/aa-adapter.mjs +0 -402
  347. package/src/public-control/build-registry.mjs +0 -227
  348. package/src/public-control/bundler-client.mjs +0 -357
  349. package/src/public-control/grant-indexer.mjs +0 -296
  350. package/src/public-control/policy-render.mjs +0 -69
  351. package/src/public-control/policy-schema.mjs +0 -322
  352. package/src/public-control/runtime-config.mjs +0 -275
  353. package/src/public-control/session-key-model.mjs +0 -379
  354. package/src/public-control/session-orchestrator.mjs +0 -418
  355. package/src/rfq/intent.mjs +0 -180
  356. package/src/rfq/sources.mjs +0 -181
  357. package/src/route-attestation.mjs +0 -132
  358. package/src/router/best-execution.mjs +0 -326
  359. package/src/router/index.mjs +0 -250
  360. package/src/router/integrator-fee.mjs +0 -135
  361. package/src/router/prepare-bridge.mjs +0 -293
  362. package/src/router/prepare-route.mjs +0 -398
  363. package/src/router/proposal.mjs +0 -311
  364. package/src/router/risk-classifier.mjs +0 -119
  365. package/src/router/route-sources.mjs +0 -364
  366. package/src/scanner/chains.config.mjs +0 -543
  367. package/src/scanner/contract.mjs +0 -270
  368. package/src/scanner/evm-scanner.mjs +0 -394
  369. package/src/scanner/index.mjs +0 -9
  370. package/src/scanner/v2-venue.mjs +0 -351
  371. package/src/scanner/v3-venue.mjs +0 -308
  372. package/src/scopes.mjs +0 -44
  373. package/src/sell-simulation.mjs +0 -167
  374. package/src/signals/engine.mjs +0 -146
  375. package/src/signals/index.mjs +0 -1
  376. package/src/token-transfer-guard.mjs +0 -188
  377. package/src/tui/app.mjs +0 -438
  378. package/src/tui/backend.mjs +0 -215
  379. package/src/tui/format.mjs +0 -272
  380. package/src/tui/gateway-client.mjs +0 -177
  381. package/src/tui/input.mjs +0 -501
  382. package/src/tui/memory.mjs +0 -105
  383. package/src/tui/meta-learn.mjs +0 -85
  384. package/src/tui/renderer.mjs +0 -443
  385. package/src/tui/scheduler.mjs +0 -205
  386. package/src/tui/skills-loader.mjs +0 -140
  387. package/src/tui/standalone-client.mjs +0 -752
  388. package/src/tui/theme.mjs +0 -81
  389. package/src/vault-attestation.mjs +0 -146
  390. package/src/venues.mjs +0 -206
  391. package/src/watch-preferences.mjs +0 -85
  392. /package/{profiles → dist/assets/profiles}/_template/SOUL.md +0 -0
  393. /package/{profiles → dist/assets/profiles}/_template/profile.json +0 -0
  394. /package/{profiles → dist/assets/profiles}/bitcoin-agent/SOUL.md +0 -0
  395. /package/{profiles → dist/assets/profiles}/bitcoin-agent/profile.json +0 -0
  396. /package/{profiles → dist/assets/profiles}/hyperliquid-agent/SOUL.md +0 -0
  397. /package/{profiles → dist/assets/profiles}/hyperliquid-agent/profile.json +0 -0
  398. /package/{profiles → dist/assets/profiles}/oracle/SOUL.md +0 -0
  399. /package/{profiles → dist/assets/profiles}/oracle/profile.json +0 -0
  400. /package/{profiles → dist/assets/profiles}/polymarket-agent/SOUL.md +0 -0
  401. /package/{profiles → dist/assets/profiles}/polymarket-agent/profile.json +0 -0
  402. /package/{profiles → dist/assets/profiles}/profile.schema.json +0 -0
  403. /package/{profiles → dist/assets/profiles}/protocol-builder/SOUL.md +0 -0
  404. /package/{profiles → dist/assets/profiles}/protocol-builder/profile.json +0 -0
  405. /package/{profiles → dist/assets/profiles}/robinhood-agent/SOUL.md +0 -0
  406. /package/{profiles → dist/assets/profiles}/robinhood-agent/profile.json +0 -0
  407. /package/{profiles → dist/assets/profiles}/solana-agent/SOUL.md +0 -0
  408. /package/{profiles → dist/assets/profiles}/solana-agent/profile.json +0 -0
  409. /package/{profiles → dist/assets/profiles}/stable-agent/SOUL.md +0 -0
  410. /package/{profiles → dist/assets/profiles}/stable-agent/profile.json +0 -0
  411. /package/{skills → dist/assets/skills}/balance/SKILL.md +0 -0
  412. /package/{skills → dist/assets/skills}/bitcoin-l1.md +0 -0
  413. /package/{skills → dist/assets/skills}/chain-defi-ecosystem-profiling.md +0 -0
  414. /package/{skills → dist/assets/skills}/evm-contract-research.md +0 -0
  415. /package/{skills → dist/assets/skills}/hyperliquid.md +0 -0
  416. /package/{skills → dist/assets/skills}/multichain-exec-desk.md +0 -0
  417. /package/{skills → dist/assets/skills}/oracle-action-semantics/SKILL.md +0 -0
  418. /package/{skills → dist/assets/skills}/oracle-best-execution/SKILL.md +0 -0
  419. /package/{skills → dist/assets/skills}/oracle-best-execution.md +0 -0
  420. /package/{skills → dist/assets/skills}/oracle-bitcoin/SKILL.md +0 -0
  421. /package/{skills → dist/assets/skills}/oracle-chain-graphs-telegram-cards/SKILL.md +0 -0
  422. /package/{skills → dist/assets/skills}/oracle-chat/SKILL.md +0 -0
  423. /package/{skills → dist/assets/skills}/oracle-chat/chain.SKILL.md +0 -0
  424. /package/{skills → dist/assets/skills}/oracle-chat/setup.SKILL.md +0 -0
  425. /package/{skills → dist/assets/skills}/oracle-circuit-breaker/SKILL.md +0 -0
  426. /package/{skills → dist/assets/skills}/oracle-contract-research/SKILL.md +0 -0
  427. /package/{skills → dist/assets/skills}/oracle-desk/SKILL.md +0 -0
  428. /package/{skills → dist/assets/skills}/oracle-desk.md +0 -0
  429. /package/{skills → dist/assets/skills}/oracle-dex-launch/SKILL.md +0 -0
  430. /package/{skills → dist/assets/skills}/oracle-equities/SKILL.md +0 -0
  431. /package/{skills → dist/assets/skills}/oracle-grants/SKILL.md +0 -0
  432. /package/{skills → dist/assets/skills}/oracle-hypercore-staking/SKILL.md +0 -0
  433. /package/{skills → dist/assets/skills}/oracle-hyperliquid/SKILL.md +0 -0
  434. /package/{skills → dist/assets/skills}/oracle-meme-token-sniper/SKILL.md +0 -0
  435. /package/{skills → dist/assets/skills}/oracle-multichain-nft-launch/SKILL.md +0 -0
  436. /package/{skills → dist/assets/skills}/oracle-multichain-token-launch/SKILL.md +0 -0
  437. /package/{skills → dist/assets/skills}/oracle-nft-gacha-launch/SKILL.md +0 -0
  438. /package/{skills → dist/assets/skills}/oracle-nft-mint-gas-war/SKILL.md +0 -0
  439. /package/{skills → dist/assets/skills}/oracle-polymarket/SKILL.md +0 -0
  440. /package/{skills → dist/assets/skills}/oracle-protocol-builder/SKILL.md +0 -0
  441. /package/{skills → dist/assets/skills}/oracle-protocol-security/SKILL.md +0 -0
  442. /package/{skills → dist/assets/skills}/oracle-public-product/SKILL.md +0 -0
  443. /package/{skills → dist/assets/skills}/oracle-receipts/SKILL.md +0 -0
  444. /package/{skills → dist/assets/skills}/oracle-receipts.md +0 -0
  445. /package/{skills → dist/assets/skills}/oracle-rfq-tokenized-assets/SKILL.md +0 -0
  446. /package/{skills → dist/assets/skills}/oracle-smart-wallet-scanner/SKILL.md +0 -0
  447. /package/{skills → dist/assets/skills}/oracle-solana/SKILL.md +0 -0
  448. /package/{skills → dist/assets/skills}/oracle-solana-nft/SKILL.md +0 -0
  449. /package/{skills → dist/assets/skills}/oracle-token-research/SKILL.md +0 -0
  450. /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
- }