genius-intents 0.18.2 → 0.20.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/CHANGELOG.md +73 -3
- package/dist/direct-pools/fourmeme/fourmeme-direct.service.js +16 -16
- package/dist/direct-pools/fourmeme/fourmeme-direct.service.js.map +1 -1
- package/dist/direct-pools/meteora/pool-info/meteora-damm-v1-pool-info.service.d.ts +1 -1
- package/dist/direct-pools/meteora/pool-info/meteora-damm-v1-pool-info.service.d.ts.map +1 -1
- package/dist/direct-pools/meteora/pool-info/meteora-damm-v1-pool-info.service.js +9 -2
- package/dist/direct-pools/meteora/pool-info/meteora-damm-v1-pool-info.service.js.map +1 -1
- package/dist/direct-pools/meteora/pool-info/meteora-damm-v2-pool-info.service.d.ts +1 -1
- package/dist/direct-pools/meteora/pool-info/meteora-damm-v2-pool-info.service.d.ts.map +1 -1
- package/dist/direct-pools/meteora/pool-info/meteora-damm-v2-pool-info.service.js +9 -2
- package/dist/direct-pools/meteora/pool-info/meteora-damm-v2-pool-info.service.js.map +1 -1
- package/dist/direct-pools/meteora/pool-info/meteora-dbc-pool-info.service.d.ts +1 -1
- package/dist/direct-pools/meteora/pool-info/meteora-dbc-pool-info.service.d.ts.map +1 -1
- package/dist/direct-pools/meteora/pool-info/meteora-dbc-pool-info.service.js +9 -2
- package/dist/direct-pools/meteora/pool-info/meteora-dbc-pool-info.service.js.map +1 -1
- package/dist/direct-pools/meteora/pool-info/meteora-dlmm-pool-info.service.d.ts +1 -1
- package/dist/direct-pools/meteora/pool-info/meteora-dlmm-pool-info.service.d.ts.map +1 -1
- package/dist/direct-pools/meteora/pool-info/meteora-dlmm-pool-info.service.js +9 -2
- package/dist/direct-pools/meteora/pool-info/meteora-dlmm-pool-info.service.js.map +1 -1
- package/dist/direct-pools/pump-fun/pool-info/pump-fun-pool-info.service.d.ts +1 -1
- package/dist/direct-pools/pump-fun/pool-info/pump-fun-pool-info.service.d.ts.map +1 -1
- package/dist/direct-pools/pump-fun/pool-info/pump-fun-pool-info.service.js +9 -2
- package/dist/direct-pools/pump-fun/pool-info/pump-fun-pool-info.service.js.map +1 -1
- package/dist/direct-pools/pump-fun/pool-info/pump-swap-amm-pool-info.service.d.ts +1 -1
- package/dist/direct-pools/pump-fun/pool-info/pump-swap-amm-pool-info.service.d.ts.map +1 -1
- package/dist/direct-pools/pump-fun/pool-info/pump-swap-amm-pool-info.service.js +9 -2
- package/dist/direct-pools/pump-fun/pool-info/pump-swap-amm-pool-info.service.js.map +1 -1
- package/dist/direct-pools/raydium/pool-info/raydium-amm-pool-info.service.d.ts +1 -1
- package/dist/direct-pools/raydium/pool-info/raydium-amm-pool-info.service.d.ts.map +1 -1
- package/dist/direct-pools/raydium/pool-info/raydium-amm-pool-info.service.js +9 -2
- package/dist/direct-pools/raydium/pool-info/raydium-amm-pool-info.service.js.map +1 -1
- package/dist/direct-pools/raydium/pool-info/raydium-clmm-pool-info.service.d.ts +1 -1
- package/dist/direct-pools/raydium/pool-info/raydium-clmm-pool-info.service.d.ts.map +1 -1
- package/dist/direct-pools/raydium/pool-info/raydium-clmm-pool-info.service.js +9 -2
- package/dist/direct-pools/raydium/pool-info/raydium-clmm-pool-info.service.js.map +1 -1
- package/dist/direct-pools/raydium/pool-info/raydium-cpmm-pool-info.service.d.ts +1 -1
- package/dist/direct-pools/raydium/pool-info/raydium-cpmm-pool-info.service.d.ts.map +1 -1
- package/dist/direct-pools/raydium/pool-info/raydium-cpmm-pool-info.service.js +9 -2
- package/dist/direct-pools/raydium/pool-info/raydium-cpmm-pool-info.service.js.map +1 -1
- package/dist/direct-pools/raydium/pool-info/raydium-launchlab-pool-info.service.d.ts +1 -1
- package/dist/direct-pools/raydium/pool-info/raydium-launchlab-pool-info.service.d.ts.map +1 -1
- package/dist/direct-pools/raydium/pool-info/raydium-launchlab-pool-info.service.js +9 -2
- package/dist/direct-pools/raydium/pool-info/raydium-launchlab-pool-info.service.js.map +1 -1
- package/dist/direct-pools/whirlpools/pool-info/whirlpools-pool-info.service.d.ts +1 -1
- package/dist/direct-pools/whirlpools/pool-info/whirlpools-pool-info.service.d.ts.map +1 -1
- package/dist/direct-pools/whirlpools/pool-info/whirlpools-pool-info.service.js +9 -2
- package/dist/direct-pools/whirlpools/pool-info/whirlpools-pool-info.service.js.map +1 -1
- package/dist/genius-intents.d.ts.map +1 -1
- package/dist/genius-intents.js +11 -2
- package/dist/genius-intents.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/dex/algebra/algebra-dex-deployments.d.ts +3 -0
- package/dist/lib/dex/algebra/algebra-dex-deployments.d.ts.map +1 -0
- package/dist/lib/dex/algebra/algebra-dex-deployments.js +34 -0
- package/dist/lib/dex/algebra/algebra-dex-deployments.js.map +1 -0
- package/dist/lib/dex/algebra/algebra-factory.abi.d.ts +3 -0
- package/dist/lib/dex/algebra/algebra-factory.abi.d.ts.map +1 -0
- package/dist/lib/dex/algebra/algebra-factory.abi.js +34 -0
- package/dist/lib/dex/algebra/algebra-factory.abi.js.map +1 -0
- package/dist/lib/dex/algebra/algebra-quoter.abi.d.ts +3 -0
- package/dist/lib/dex/algebra/algebra-quoter.abi.d.ts.map +1 -0
- package/dist/lib/dex/algebra/algebra-quoter.abi.js +135 -0
- package/dist/lib/dex/algebra/algebra-quoter.abi.js.map +1 -0
- package/dist/lib/dex/algebra/algebra-router.abi.d.ts +3 -0
- package/dist/lib/dex/algebra/algebra-router.abi.d.ts.map +1 -0
- package/dist/lib/dex/algebra/algebra-router.abi.js +273 -0
- package/dist/lib/dex/algebra/algebra-router.abi.js.map +1 -0
- package/dist/lib/dex/algebra/quickswap-quoter.abi.d.ts +3 -0
- package/dist/lib/dex/algebra/quickswap-quoter.abi.d.ts.map +1 -0
- package/dist/lib/dex/algebra/quickswap-quoter.abi.js +103 -0
- package/dist/lib/dex/algebra/quickswap-quoter.abi.js.map +1 -0
- package/dist/lib/dex/fourmeme/fourmeme-v3-helper.abi.d.ts +3 -0
- package/dist/lib/dex/fourmeme/fourmeme-v3-helper.abi.d.ts.map +1 -0
- package/dist/lib/dex/fourmeme/fourmeme-v3-helper.abi.js +61 -0
- package/dist/lib/dex/fourmeme/fourmeme-v3-helper.abi.js.map +1 -0
- package/dist/lib/dex/lfj/lfj-dex-deployments.d.ts +3 -0
- package/dist/lib/dex/lfj/lfj-dex-deployments.d.ts.map +1 -0
- package/dist/lib/dex/lfj/lfj-dex-deployments.js +21 -0
- package/dist/lib/dex/lfj/lfj-dex-deployments.js.map +1 -0
- package/dist/lib/dex/lfj/lfj-quoter.abi.d.ts +3 -0
- package/dist/lib/dex/lfj/lfj-quoter.abi.d.ts.map +1 -0
- package/dist/lib/dex/lfj/lfj-quoter.abi.js +135 -0
- package/dist/lib/dex/lfj/lfj-quoter.abi.js.map +1 -0
- package/dist/lib/dex/lfj/lfj-router.abi.d.ts +3 -0
- package/dist/lib/dex/lfj/lfj-router.abi.d.ts.map +1 -0
- package/dist/lib/dex/lfj/lfj-router.abi.js +587 -0
- package/dist/lib/dex/lfj/lfj-router.abi.js.map +1 -0
- package/dist/lib/dex/pair-discovery/adapters/algebra-dex-pair-discovery.adapter.d.ts +22 -0
- package/dist/lib/dex/pair-discovery/adapters/algebra-dex-pair-discovery.adapter.d.ts.map +1 -0
- package/dist/lib/dex/pair-discovery/adapters/algebra-dex-pair-discovery.adapter.js +225 -0
- package/dist/lib/dex/pair-discovery/adapters/algebra-dex-pair-discovery.adapter.js.map +1 -0
- package/dist/lib/dex/pair-discovery/adapters/fourmeme-dex-pair-discovery.adapter.d.ts +20 -0
- package/dist/lib/dex/pair-discovery/adapters/fourmeme-dex-pair-discovery.adapter.d.ts.map +1 -0
- package/dist/lib/dex/pair-discovery/adapters/fourmeme-dex-pair-discovery.adapter.js +265 -0
- package/dist/lib/dex/pair-discovery/adapters/fourmeme-dex-pair-discovery.adapter.js.map +1 -0
- package/dist/lib/dex/pair-discovery/adapters/lfj-v3-dex-pair-doscovery.adapter.d.ts +19 -0
- package/dist/lib/dex/pair-discovery/adapters/lfj-v3-dex-pair-doscovery.adapter.d.ts.map +1 -0
- package/dist/lib/dex/pair-discovery/adapters/lfj-v3-dex-pair-doscovery.adapter.js +130 -0
- package/dist/lib/dex/pair-discovery/adapters/lfj-v3-dex-pair-doscovery.adapter.js.map +1 -0
- package/dist/lib/dex/pair-discovery/adapters/v2-dex-pair-discovery.adapter.d.ts +29 -0
- package/dist/lib/dex/pair-discovery/adapters/v2-dex-pair-discovery.adapter.d.ts.map +1 -0
- package/dist/lib/dex/pair-discovery/adapters/v2-dex-pair-discovery.adapter.js +179 -0
- package/dist/lib/dex/pair-discovery/adapters/v2-dex-pair-discovery.adapter.js.map +1 -0
- package/dist/lib/dex/pair-discovery/adapters/v3-dex-pair-discovery.adapter.d.ts +29 -0
- package/dist/lib/dex/pair-discovery/adapters/v3-dex-pair-discovery.adapter.d.ts.map +1 -0
- package/dist/lib/dex/pair-discovery/adapters/v3-dex-pair-discovery.adapter.js +345 -0
- package/dist/lib/dex/pair-discovery/adapters/v3-dex-pair-discovery.adapter.js.map +1 -0
- package/dist/lib/dex/pair-discovery/adapters/ve33-dex-pair-discovery.adapter.d.ts +36 -0
- package/dist/lib/dex/pair-discovery/adapters/ve33-dex-pair-discovery.adapter.d.ts.map +1 -0
- package/dist/lib/dex/pair-discovery/adapters/ve33-dex-pair-discovery.adapter.js +275 -0
- package/dist/lib/dex/pair-discovery/adapters/ve33-dex-pair-discovery.adapter.js.map +1 -0
- package/dist/lib/dex/pair-discovery/pair-discovery.service.d.ts +16 -0
- package/dist/lib/dex/pair-discovery/pair-discovery.service.d.ts.map +1 -0
- package/dist/lib/dex/pair-discovery/pair-discovery.service.js +98 -0
- package/dist/lib/dex/pair-discovery/pair-discovery.service.js.map +1 -0
- package/dist/lib/dex/pair-discovery/pair-discovery.types.d.ts +189 -0
- package/dist/lib/dex/pair-discovery/pair-discovery.types.d.ts.map +1 -0
- package/dist/lib/dex/pair-discovery/pair-discovery.types.js +3 -0
- package/dist/lib/dex/pair-discovery/pair-discovery.types.js.map +1 -0
- package/dist/lib/dex/uniswapV2/v2-dex-deployments.d.ts +5 -0
- package/dist/lib/dex/uniswapV2/v2-dex-deployments.d.ts.map +1 -0
- package/dist/lib/dex/uniswapV2/v2-dex-deployments.js +166 -0
- package/dist/lib/dex/uniswapV2/v2-dex-deployments.js.map +1 -0
- package/dist/lib/dex/uniswapv3/{v3-offchain-quoter.service.d.ts → offchain-quoter/v3-offchain-quoter.service.d.ts} +1 -1
- package/dist/lib/dex/uniswapv3/offchain-quoter/v3-offchain-quoter.service.d.ts.map +1 -0
- package/dist/lib/dex/uniswapv3/{v3-offchain-quoter.service.js → offchain-quoter/v3-offchain-quoter.service.js} +3 -3
- package/dist/lib/dex/uniswapv3/offchain-quoter/v3-offchain-quoter.service.js.map +1 -0
- package/dist/lib/dex/uniswapv3/offchain-quoter/v3-offchain-quoter.types.d.ts +162 -0
- package/dist/lib/dex/uniswapv3/offchain-quoter/v3-offchain-quoter.types.d.ts.map +1 -0
- package/dist/lib/dex/uniswapv3/offchain-quoter/v3-offchain-quoter.types.js +3 -0
- package/dist/lib/dex/uniswapv3/offchain-quoter/v3-offchain-quoter.types.js.map +1 -0
- package/dist/lib/dex/uniswapv3/ramses-quoter.abi.d.ts +3 -0
- package/dist/lib/dex/uniswapv3/ramses-quoter.abi.d.ts.map +1 -0
- package/dist/lib/dex/uniswapv3/ramses-quoter.abi.js +114 -0
- package/dist/lib/dex/uniswapv3/ramses-quoter.abi.js.map +1 -0
- package/dist/lib/dex/uniswapv3/slipstream-quoter.abi.d.ts +3 -0
- package/dist/lib/dex/uniswapv3/slipstream-quoter.abi.d.ts.map +1 -0
- package/dist/lib/dex/uniswapv3/slipstream-quoter.abi.js +30 -0
- package/dist/lib/dex/uniswapv3/slipstream-quoter.abi.js.map +1 -0
- package/dist/lib/dex/uniswapv3/slipstream-router.abi.d.ts +3 -0
- package/dist/lib/dex/uniswapv3/slipstream-router.abi.d.ts.map +1 -0
- package/dist/lib/dex/uniswapv3/slipstream-router.abi.js +45 -0
- package/dist/lib/dex/uniswapv3/slipstream-router.abi.js.map +1 -0
- package/dist/lib/dex/uniswapv3/v3-dex-deployments.d.ts +32 -0
- package/dist/lib/dex/uniswapv3/v3-dex-deployments.d.ts.map +1 -0
- package/dist/lib/dex/uniswapv3/v3-dex-deployments.js +283 -0
- package/dist/lib/dex/uniswapv3/v3-dex-deployments.js.map +1 -0
- package/dist/lib/dex/ve33/aerodrome-factory.abi.d.ts +3 -0
- package/dist/lib/dex/ve33/aerodrome-factory.abi.d.ts.map +1 -0
- package/dist/lib/dex/ve33/aerodrome-factory.abi.js +17 -0
- package/dist/lib/dex/ve33/aerodrome-factory.abi.js.map +1 -0
- package/dist/lib/dex/ve33/aerodrome-router.abi.d.ts +3 -0
- package/dist/lib/dex/ve33/aerodrome-router.abi.d.ts.map +1 -0
- package/dist/lib/dex/ve33/aerodrome-router.abi.js +119 -0
- package/dist/lib/dex/ve33/aerodrome-router.abi.js.map +1 -0
- package/dist/lib/dex/ve33/blackhole-router.abi.d.ts +3 -0
- package/dist/lib/dex/ve33/blackhole-router.abi.d.ts.map +1 -0
- package/dist/lib/dex/ve33/blackhole-router.abi.js +1492 -0
- package/dist/lib/dex/ve33/blackhole-router.abi.js.map +1 -0
- package/dist/lib/dex/ve33/pharaoh-router.abi.d.ts +3 -0
- package/dist/lib/dex/ve33/pharaoh-router.abi.d.ts.map +1 -0
- package/dist/lib/dex/ve33/pharaoh-router.abi.js +502 -0
- package/dist/lib/dex/ve33/pharaoh-router.abi.js.map +1 -0
- package/dist/lib/dex/ve33/pharaoh-swap-router.abi.d.ts +3 -0
- package/dist/lib/dex/ve33/pharaoh-swap-router.abi.d.ts.map +1 -0
- package/dist/lib/dex/ve33/pharaoh-swap-router.abi.js +239 -0
- package/dist/lib/dex/ve33/pharaoh-swap-router.abi.js.map +1 -0
- package/dist/lib/dex/ve33/ve33-dex-deployments.d.ts +4 -0
- package/dist/lib/dex/ve33/ve33-dex-deployments.d.ts.map +1 -0
- package/dist/lib/dex/ve33/ve33-dex-deployments.js +34 -0
- package/dist/lib/dex/ve33/ve33-dex-deployments.js.map +1 -0
- package/dist/lib/dex/ve33/velodrome-router.abi.d.ts +3 -0
- package/dist/lib/dex/ve33/velodrome-router.abi.d.ts.map +1 -0
- package/dist/lib/dex/ve33/velodrome-router.abi.js +634 -0
- package/dist/lib/dex/ve33/velodrome-router.abi.js.map +1 -0
- package/dist/protocols/algebra/algebra.service.d.ts +63 -0
- package/dist/protocols/algebra/algebra.service.d.ts.map +1 -0
- package/dist/protocols/algebra/algebra.service.js +532 -0
- package/dist/protocols/algebra/algebra.service.js.map +1 -0
- package/dist/protocols/algebra/algebra.types.d.ts +98 -0
- package/dist/protocols/algebra/algebra.types.d.ts.map +1 -0
- package/dist/protocols/algebra/algebra.types.js +9 -0
- package/dist/protocols/algebra/algebra.types.js.map +1 -0
- package/dist/protocols/algebra/index.d.ts +3 -0
- package/dist/protocols/algebra/index.d.ts.map +1 -0
- package/dist/protocols/algebra/index.js +21 -0
- package/dist/protocols/algebra/index.js.map +1 -0
- package/dist/protocols/four-meme/four-meme.service.d.ts.map +1 -1
- package/dist/protocols/four-meme/four-meme.service.js +49 -57
- package/dist/protocols/four-meme/four-meme.service.js.map +1 -1
- package/dist/protocols/four-meme/four-meme.types.d.ts +8 -3
- package/dist/protocols/four-meme/four-meme.types.d.ts.map +1 -1
- package/dist/protocols/genius-bridge/genius-bridge.service.d.ts +2 -1
- package/dist/protocols/genius-bridge/genius-bridge.service.d.ts.map +1 -1
- package/dist/protocols/genius-bridge/genius-bridge.service.js.map +1 -1
- package/dist/protocols/genius-bridge/index.d.ts +1 -1
- package/dist/protocols/genius-bridge/index.d.ts.map +1 -1
- package/dist/protocols/lfj/index.d.ts +3 -0
- package/dist/protocols/lfj/index.d.ts.map +1 -0
- package/dist/protocols/lfj/index.js +21 -0
- package/dist/protocols/lfj/index.js.map +1 -0
- package/dist/protocols/lfj/lfj.service.d.ts +45 -0
- package/dist/protocols/lfj/lfj.service.d.ts.map +1 -0
- package/dist/protocols/lfj/lfj.service.js +323 -0
- package/dist/protocols/lfj/lfj.service.js.map +1 -0
- package/dist/protocols/lfj/lfj.types.d.ts +136 -0
- package/dist/protocols/lfj/lfj.types.d.ts.map +1 -0
- package/dist/protocols/lfj/lfj.types.js +16 -0
- package/dist/protocols/lfj/lfj.types.js.map +1 -0
- package/dist/protocols/okx/okx.service.d.ts +9 -8
- package/dist/protocols/okx/okx.service.d.ts.map +1 -1
- package/dist/protocols/okx/okx.service.js +133 -143
- package/dist/protocols/okx/okx.service.js.map +1 -1
- package/dist/protocols/okx/okx.types.d.ts +9 -3
- package/dist/protocols/okx/okx.types.d.ts.map +1 -1
- package/dist/protocols/relay/relay.service.d.ts +3 -0
- package/dist/protocols/relay/relay.service.d.ts.map +1 -1
- package/dist/protocols/relay/relay.service.js +7 -1
- package/dist/protocols/relay/relay.service.js.map +1 -1
- package/dist/protocols/v2-dex/index.d.ts +1 -1
- package/dist/protocols/v2-dex/index.d.ts.map +1 -1
- package/dist/protocols/v2-dex/index.js +15 -0
- package/dist/protocols/v2-dex/index.js.map +1 -1
- package/dist/protocols/v2-dex/v2-dex.service.d.ts +9 -16
- package/dist/protocols/v2-dex/v2-dex.service.d.ts.map +1 -1
- package/dist/protocols/v2-dex/v2-dex.service.js +107 -530
- package/dist/protocols/v2-dex/v2-dex.service.js.map +1 -1
- package/dist/protocols/v2-dex/v2-dex.types.d.ts +32 -32
- package/dist/protocols/v2-dex/v2-dex.types.d.ts.map +1 -1
- package/dist/protocols/v2-dex/v2-dex.types.js.map +1 -1
- package/dist/protocols/v3-dex/adapters/slipstream.adapter.d.ts +42 -0
- package/dist/protocols/v3-dex/adapters/slipstream.adapter.d.ts.map +1 -0
- package/dist/protocols/v3-dex/adapters/slipstream.adapter.js +185 -0
- package/dist/protocols/v3-dex/adapters/slipstream.adapter.js.map +1 -0
- package/dist/protocols/v3-dex/adapters/uniswap-fork.adapter.d.ts +40 -0
- package/dist/protocols/v3-dex/adapters/uniswap-fork.adapter.d.ts.map +1 -0
- package/dist/protocols/v3-dex/adapters/uniswap-fork.adapter.js +237 -0
- package/dist/protocols/v3-dex/adapters/uniswap-fork.adapter.js.map +1 -0
- package/dist/protocols/v3-dex/adapters/uniswap.adapter.d.ts +39 -0
- package/dist/protocols/v3-dex/adapters/uniswap.adapter.d.ts.map +1 -0
- package/dist/protocols/v3-dex/adapters/uniswap.adapter.js +226 -0
- package/dist/protocols/v3-dex/adapters/uniswap.adapter.js.map +1 -0
- package/dist/protocols/v3-dex/index.d.ts +1 -1
- package/dist/protocols/v3-dex/index.d.ts.map +1 -1
- package/dist/protocols/v3-dex/index.js +15 -0
- package/dist/protocols/v3-dex/index.js.map +1 -1
- package/dist/protocols/v3-dex/v3-dex.service.d.ts +21 -76
- package/dist/protocols/v3-dex/v3-dex.service.d.ts.map +1 -1
- package/dist/protocols/v3-dex/v3-dex.service.js +387 -1196
- package/dist/protocols/v3-dex/v3-dex.service.js.map +1 -1
- package/dist/protocols/v3-dex/v3-dex.types.d.ts +154 -365
- package/dist/protocols/v3-dex/v3-dex.types.d.ts.map +1 -1
- package/dist/protocols/v3-dex/v3-dex.types.js +13 -1
- package/dist/protocols/v3-dex/v3-dex.types.js.map +1 -1
- package/dist/protocols/ve33/adapters/blackhole.adapter.d.ts +29 -0
- package/dist/protocols/ve33/adapters/blackhole.adapter.d.ts.map +1 -0
- package/dist/protocols/ve33/adapters/blackhole.adapter.js +59 -0
- package/dist/protocols/ve33/adapters/blackhole.adapter.js.map +1 -0
- package/dist/protocols/ve33/adapters/pharaoh.adapter.d.ts +34 -0
- package/dist/protocols/ve33/adapters/pharaoh.adapter.d.ts.map +1 -0
- package/dist/protocols/ve33/adapters/pharaoh.adapter.js +51 -0
- package/dist/protocols/ve33/adapters/pharaoh.adapter.js.map +1 -0
- package/dist/protocols/ve33/adapters/solidly.adapter.d.ts +42 -0
- package/dist/protocols/ve33/adapters/solidly.adapter.d.ts.map +1 -0
- package/dist/protocols/ve33/adapters/solidly.adapter.js +63 -0
- package/dist/protocols/ve33/adapters/solidly.adapter.js.map +1 -0
- package/dist/protocols/ve33/index.d.ts +3 -0
- package/dist/protocols/ve33/index.d.ts.map +1 -0
- package/dist/protocols/ve33/index.js +21 -0
- package/dist/protocols/ve33/index.js.map +1 -0
- package/dist/protocols/ve33/ve33.handlers.d.ts +3 -0
- package/dist/protocols/ve33/ve33.handlers.d.ts.map +1 -0
- package/dist/protocols/ve33/ve33.handlers.js +187 -0
- package/dist/protocols/ve33/ve33.handlers.js.map +1 -0
- package/dist/protocols/ve33/ve33.service.d.ts +31 -0
- package/dist/protocols/ve33/ve33.service.d.ts.map +1 -0
- package/dist/protocols/ve33/ve33.service.js +488 -0
- package/dist/protocols/ve33/ve33.service.js.map +1 -0
- package/dist/protocols/ve33/ve33.types.d.ts +137 -0
- package/dist/protocols/ve33/ve33.types.d.ts.map +1 -0
- package/dist/protocols/ve33/ve33.types.js +16 -0
- package/dist/protocols/ve33/ve33.types.js.map +1 -0
- package/dist/token-launches/jupiter/jupiter-studio-launch.constants.d.ts +40 -0
- package/dist/token-launches/jupiter/jupiter-studio-launch.constants.d.ts.map +1 -0
- package/dist/token-launches/jupiter/jupiter-studio-launch.constants.js +43 -0
- package/dist/token-launches/jupiter/jupiter-studio-launch.constants.js.map +1 -0
- package/dist/token-launches/jupiter/jupiter-studio-launch.service.d.ts +10 -0
- package/dist/token-launches/jupiter/jupiter-studio-launch.service.d.ts.map +1 -0
- package/dist/token-launches/jupiter/jupiter-studio-launch.service.js +56 -0
- package/dist/token-launches/jupiter/jupiter-studio-launch.service.js.map +1 -0
- package/dist/token-launches/jupiter/jupiter-studio-launch.types.d.ts +49 -0
- package/dist/token-launches/jupiter/jupiter-studio-launch.types.d.ts.map +1 -0
- package/dist/token-launches/jupiter/jupiter-studio-launch.types.js +3 -0
- package/dist/token-launches/jupiter/jupiter-studio-launch.types.js.map +1 -0
- package/dist/token-launches/jupiter/jupiter-studio-launch.utils.d.ts +9 -0
- package/dist/token-launches/jupiter/jupiter-studio-launch.utils.d.ts.map +1 -0
- package/dist/token-launches/jupiter/jupiter-studio-launch.utils.js +82 -0
- package/dist/token-launches/jupiter/jupiter-studio-launch.utils.js.map +1 -0
- package/dist/token-launches/meteora/meteora-launch.constants.d.ts +11 -0
- package/dist/token-launches/meteora/meteora-launch.constants.d.ts.map +1 -0
- package/dist/token-launches/meteora/meteora-launch.constants.js +15 -0
- package/dist/token-launches/meteora/meteora-launch.constants.js.map +1 -0
- package/dist/token-launches/meteora/meteora-launch.service.d.ts +13 -0
- package/dist/token-launches/meteora/meteora-launch.service.d.ts.map +1 -0
- package/dist/token-launches/meteora/meteora-launch.service.js +64 -0
- package/dist/token-launches/meteora/meteora-launch.service.js.map +1 -0
- package/dist/token-launches/meteora/meteora-launch.types.d.ts +18 -0
- package/dist/token-launches/meteora/meteora-launch.types.d.ts.map +1 -0
- package/dist/token-launches/meteora/meteora-launch.types.js +3 -0
- package/dist/token-launches/meteora/meteora-launch.types.js.map +1 -0
- package/dist/token-launches/meteora/meteora-launch.utils.d.ts +4 -0
- package/dist/token-launches/meteora/meteora-launch.utils.d.ts.map +1 -0
- package/dist/token-launches/meteora/meteora-launch.utils.js +54 -0
- package/dist/token-launches/meteora/meteora-launch.utils.js.map +1 -0
- package/dist/token-launches/pump-fun/pump-fun-launch.service.d.ts +13 -0
- package/dist/token-launches/pump-fun/pump-fun-launch.service.d.ts.map +1 -0
- package/dist/token-launches/pump-fun/pump-fun-launch.service.js +63 -0
- package/dist/token-launches/pump-fun/pump-fun-launch.service.js.map +1 -0
- package/dist/token-launches/pump-fun/pump-fun-launch.types.d.ts +12 -0
- package/dist/token-launches/pump-fun/pump-fun-launch.types.d.ts.map +1 -0
- package/dist/token-launches/pump-fun/pump-fun-launch.types.js +3 -0
- package/dist/token-launches/pump-fun/pump-fun-launch.types.js.map +1 -0
- package/dist/token-launches/raydium-launchlab/raydium-launch.constants.d.ts +13 -0
- package/dist/token-launches/raydium-launchlab/raydium-launch.constants.d.ts.map +1 -0
- package/dist/token-launches/raydium-launchlab/raydium-launch.constants.js +18 -0
- package/dist/token-launches/raydium-launchlab/raydium-launch.constants.js.map +1 -0
- package/dist/token-launches/raydium-launchlab/raydium-launch.service.d.ts +13 -0
- package/dist/token-launches/raydium-launchlab/raydium-launch.service.d.ts.map +1 -0
- package/dist/token-launches/raydium-launchlab/raydium-launch.service.js +102 -0
- package/dist/token-launches/raydium-launchlab/raydium-launch.service.js.map +1 -0
- package/dist/token-launches/raydium-launchlab/raydium-launch.types.d.ts +57 -0
- package/dist/token-launches/raydium-launchlab/raydium-launch.types.d.ts.map +1 -0
- package/dist/token-launches/raydium-launchlab/raydium-launch.types.js +3 -0
- package/dist/token-launches/raydium-launchlab/raydium-launch.types.js.map +1 -0
- package/dist/types/enums.d.ts +8 -3
- package/dist/types/enums.d.ts.map +1 -1
- package/dist/types/enums.js +5 -0
- package/dist/types/enums.js.map +1 -1
- package/dist/types/price-params.d.ts +12 -3
- package/dist/types/price-params.d.ts.map +1 -1
- package/dist/types/price-response.d.ts +7 -4
- package/dist/types/price-response.d.ts.map +1 -1
- package/dist/types/quote-response.d.ts +6 -3
- package/dist/types/quote-response.d.ts.map +1 -1
- package/dist/utils/chainId-to-chain.d.ts +4 -0
- package/dist/utils/chainId-to-chain.d.ts.map +1 -0
- package/dist/utils/chainId-to-chain.js +44 -0
- package/dist/utils/chainId-to-chain.js.map +1 -0
- package/dist/utils/dex-deployment-key.d.ts +14 -0
- package/dist/utils/dex-deployment-key.d.ts.map +1 -0
- package/dist/utils/dex-deployment-key.js +17 -0
- package/dist/utils/dex-deployment-key.js.map +1 -0
- package/dist/utils/min-amount-out.d.ts +12 -0
- package/dist/utils/min-amount-out.d.ts.map +1 -0
- package/dist/utils/min-amount-out.js +18 -0
- package/dist/utils/min-amount-out.js.map +1 -0
- package/dist/utils/norm-dex-token.d.ts +13 -0
- package/dist/utils/norm-dex-token.d.ts.map +1 -0
- package/dist/utils/norm-dex-token.js +19 -0
- package/dist/utils/norm-dex-token.js.map +1 -0
- package/dist/utils/pair-result.d.ts +3 -0
- package/dist/utils/pair-result.d.ts.map +1 -0
- package/dist/utils/pair-result.js +11 -0
- package/dist/utils/pair-result.js.map +1 -0
- package/dist/utils/sort-addresses.d.ts +3 -0
- package/dist/utils/sort-addresses.d.ts.map +1 -0
- package/dist/utils/sort-addresses.js +16 -0
- package/dist/utils/sort-addresses.js.map +1 -0
- package/dist/utils/to-pool-key.d.ts +4 -0
- package/dist/utils/to-pool-key.d.ts.map +1 -0
- package/dist/utils/to-pool-key.js +15 -0
- package/dist/utils/to-pool-key.js.map +1 -0
- package/dist/utils/transaction-builder.util.d.ts +3 -0
- package/dist/utils/transaction-builder.util.d.ts.map +1 -0
- package/dist/utils/transaction-builder.util.js +13 -0
- package/dist/utils/transaction-builder.util.js.map +1 -0
- package/package.json +2 -2
- package/dist/lib/dex/uniswapv3/v3-offchain-quoter.service.d.ts.map +0 -1
- package/dist/lib/dex/uniswapv3/v3-offchain-quoter.service.js.map +0 -1
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.V2StyleDexService = void 0;
|
|
4
4
|
const viem_1 = require("viem");
|
|
5
|
-
// import { arbitrum, avalanche, base, bsc, mainnet, optimism, polygon } from 'viem/chains';
|
|
6
5
|
const v2_dex_types_1 = require("./v2-dex.types");
|
|
6
|
+
const v2_dex_deployments_1 = require("../../lib/dex/uniswapV2/v2-dex-deployments");
|
|
7
7
|
const constants_1 = require("../../utils/constants");
|
|
8
8
|
const enums_1 = require("../../types/enums");
|
|
9
9
|
const erc20_abi_1 = require("../../lib/erc20/erc20.abi");
|
|
@@ -16,6 +16,9 @@ const logger_1 = require("../../utils/logger");
|
|
|
16
16
|
const utils_1 = require("../../utils");
|
|
17
17
|
const wrapped_native_1 = require("../../utils/wrapped-native");
|
|
18
18
|
const is_native_1 = require("../../utils/is-native");
|
|
19
|
+
const min_amount_out_1 = require("../../utils/min-amount-out");
|
|
20
|
+
const dex_deployment_key_1 = require("../../utils/dex-deployment-key");
|
|
21
|
+
const chainId_to_chain_1 = require("../../utils/chainId-to-chain");
|
|
19
22
|
let logger;
|
|
20
23
|
/**
|
|
21
24
|
* V2StyleDexService implements the IIntentProtocol interface for Uniswap V2-style DEX protocols.
|
|
@@ -49,25 +52,15 @@ class V2StyleDexService {
|
|
|
49
52
|
* The rpc urls to utilize in order to fetch onchain data to build prices and quotes
|
|
50
53
|
*/
|
|
51
54
|
this.rpcs = {};
|
|
55
|
+
/**
|
|
56
|
+
* The supported chains for the protocol
|
|
57
|
+
*/
|
|
58
|
+
this.chains = v2_dex_deployments_1.uniV2SupportedChains;
|
|
52
59
|
/**
|
|
53
60
|
* Optional external _rpcs keyed by network/chain id
|
|
54
61
|
* If not provided for a network, on-chain calls for that network will be skipped with a descriptive error.
|
|
55
62
|
*/
|
|
56
63
|
this._rpcs = {};
|
|
57
|
-
/**
|
|
58
|
-
* The supported chains for the protocol
|
|
59
|
-
*/
|
|
60
|
-
this.chains = [
|
|
61
|
-
enums_1.ChainIdEnum.ETHEREUM,
|
|
62
|
-
enums_1.ChainIdEnum.BSC,
|
|
63
|
-
enums_1.ChainIdEnum.POLYGON,
|
|
64
|
-
enums_1.ChainIdEnum.AVALANCHE,
|
|
65
|
-
enums_1.ChainIdEnum.ARBITRUM,
|
|
66
|
-
enums_1.ChainIdEnum.OPTIMISM,
|
|
67
|
-
enums_1.ChainIdEnum.BASE,
|
|
68
|
-
enums_1.ChainIdEnum.POLYGON,
|
|
69
|
-
enums_1.ChainIdEnum.HYPEREVM,
|
|
70
|
-
];
|
|
71
64
|
if (config?.debug) {
|
|
72
65
|
logger_1.LoggerFactory.configure(logger_1.LoggerFactory.createConsoleLogger({ level: logger_1.LogLevelEnum.DEBUG }));
|
|
73
66
|
}
|
|
@@ -76,7 +69,7 @@ class V2StyleDexService {
|
|
|
76
69
|
logger_1.LoggerFactory.configure(config.logger);
|
|
77
70
|
}
|
|
78
71
|
logger = logger_1.LoggerFactory.getLogger();
|
|
79
|
-
if (config?.rpcs
|
|
72
|
+
if (config?.rpcs) {
|
|
80
73
|
this.rpcs = {};
|
|
81
74
|
this._rpcs = {};
|
|
82
75
|
for (const [chainIdStr, rpc] of Object.entries(config.rpcs)) {
|
|
@@ -90,7 +83,11 @@ class V2StyleDexService {
|
|
|
90
83
|
logger.warn(`No RPC URL found for chainId ${chainId}, skipping client creation`);
|
|
91
84
|
continue;
|
|
92
85
|
}
|
|
93
|
-
const chainConfig =
|
|
86
|
+
const chainConfig = chainId_to_chain_1.chainIdToChain[chainId];
|
|
87
|
+
if (!chainConfig) {
|
|
88
|
+
logger.warn(`No chain config found for chainId ${chainId}, skipping client creation`);
|
|
89
|
+
continue;
|
|
90
|
+
}
|
|
94
91
|
this._rpcs[chainId] = (0, viem_1.createPublicClient)({
|
|
95
92
|
chain: chainConfig,
|
|
96
93
|
transport: (0, viem_1.http)(rpc),
|
|
@@ -127,20 +124,6 @@ class V2StyleDexService {
|
|
|
127
124
|
if (!deployments.length) {
|
|
128
125
|
throw (0, utils_1.sdkError)(enums_1.SdkErrorEnum.INVALID_PARAMS, `No V2-style deployments configured for network ${networkIn}.`);
|
|
129
126
|
}
|
|
130
|
-
// Optional native-liquidity sanity check (mirror of V3 behavior)
|
|
131
|
-
if (overrideParamsV2Dex &&
|
|
132
|
-
overrideParamsV2Dex.nativePrice &&
|
|
133
|
-
overrideParamsV2Dex.tokenInPrice &&
|
|
134
|
-
overrideParamsV2Dex.tokenInDecimals) {
|
|
135
|
-
await this._validateNativeLiquidityV2({
|
|
136
|
-
tokenIn: tokenIn,
|
|
137
|
-
networkIn: networkIn,
|
|
138
|
-
dexes: deployments.map(d => d.dex),
|
|
139
|
-
nativePrice: overrideParamsV2Dex.nativePrice,
|
|
140
|
-
tokenInPrice: overrideParamsV2Dex.tokenInPrice,
|
|
141
|
-
tokenInDecimals: overrideParamsV2Dex.tokenInDecimals,
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
127
|
const initialPath = [(0, viem_1.getAddress)(tokenIn), (0, viem_1.getAddress)(tokenOut)];
|
|
145
128
|
const formattedPath = this._validatePath(networkIn, initialPath);
|
|
146
129
|
const path = [formattedPath.tokenIn, formattedPath.tokenOut];
|
|
@@ -151,68 +134,29 @@ class V2StyleDexService {
|
|
|
151
134
|
if (amountInBig <= 0n) {
|
|
152
135
|
throw (0, utils_1.sdkError)(enums_1.SdkErrorEnum.INVALID_PARAMS, 'amountIn must be greater than zero');
|
|
153
136
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
const uniV2PriceResponse = {
|
|
164
|
-
dex: this._buildDexKey(networkIn, (0, viem_1.getAddress)(chosenRouter)),
|
|
165
|
-
route: [(0, viem_1.getAddress)(path[0]), (0, viem_1.getAddress)(path[1])],
|
|
166
|
-
router: (0, viem_1.getAddress)(chosenRouter),
|
|
167
|
-
slippage,
|
|
168
|
-
expectedAmountOut: overrideParamsV2Dex.amountOutMin,
|
|
169
|
-
minAmountOut: overrideParamsV2Dex.amountOutMin,
|
|
170
|
-
};
|
|
171
|
-
return {
|
|
172
|
-
amountIn: amountInBig.toString(),
|
|
173
|
-
amountOut: overrideParamsV2Dex.amountOutMin,
|
|
174
|
-
protocol: this.protocol,
|
|
175
|
-
networkIn,
|
|
176
|
-
networkOut,
|
|
177
|
-
tokenIn,
|
|
178
|
-
tokenOut,
|
|
179
|
-
slippage,
|
|
180
|
-
protocolResponse: uniV2PriceResponse,
|
|
181
|
-
};
|
|
137
|
+
const overridePair = overrideParamsV2Dex?.pair;
|
|
138
|
+
const overrideKey = overrideParamsV2Dex?.key;
|
|
139
|
+
const overrideAmountOutMin = overrideParamsV2Dex?.amountOutMin;
|
|
140
|
+
const useFastRoute = overridePair && overrideKey && overrideAmountOutMin;
|
|
141
|
+
const overrideDex = overrideKey
|
|
142
|
+
? overrideKey.split(':')[0]
|
|
143
|
+
: undefined;
|
|
144
|
+
if (!overrideDex) {
|
|
145
|
+
throw (0, utils_1.sdkError)(enums_1.SdkErrorEnum.INVALID_PARAMS, 'Invalid override key');
|
|
182
146
|
}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
const fast = await this._fetchKnownPairPriceV2({
|
|
186
|
-
network: networkIn,
|
|
187
|
-
tokenInForQuote: (0, viem_1.getAddress)(path[0]),
|
|
188
|
-
tokenOutForQuote: (0, viem_1.getAddress)(path[1]),
|
|
189
|
-
amountInBI: amountInBig,
|
|
190
|
-
pair: (0, viem_1.getAddress)(overrideParamsV2Dex.pair),
|
|
191
|
-
});
|
|
192
|
-
const slippageNum = Number(slippage ?? 0);
|
|
193
|
-
const minAmountOut = this._calculateMinAmountOut({
|
|
194
|
-
amountOut: fast.amountOut.toString(),
|
|
195
|
-
slippage: slippageNum,
|
|
196
|
-
});
|
|
197
|
-
const uniV2PriceResponse = {
|
|
198
|
-
dex: this._buildDexKey(networkIn, fast.payload.router),
|
|
199
|
-
route: [(0, viem_1.getAddress)(path[0]), (0, viem_1.getAddress)(path[1])],
|
|
200
|
-
router: fast.payload.router,
|
|
201
|
-
slippage,
|
|
202
|
-
expectedAmountOut: fast.amountOut.toString(),
|
|
203
|
-
minAmountOut,
|
|
204
|
-
};
|
|
205
|
-
return {
|
|
206
|
-
amountIn: amountInBig.toString(),
|
|
207
|
-
amountOut: fast.amountOut.toString(),
|
|
208
|
-
protocol: this.protocol,
|
|
147
|
+
if (useFastRoute) {
|
|
148
|
+
return this._buildFastRoutePriceResponse({
|
|
209
149
|
networkIn,
|
|
210
150
|
networkOut,
|
|
211
151
|
tokenIn,
|
|
212
152
|
tokenOut,
|
|
153
|
+
amountIn,
|
|
213
154
|
slippage,
|
|
214
|
-
|
|
215
|
-
|
|
155
|
+
deployments,
|
|
156
|
+
overrideDex,
|
|
157
|
+
overrideAmountOutMin: overrideAmountOutMin,
|
|
158
|
+
overridePair: overridePair,
|
|
159
|
+
});
|
|
216
160
|
}
|
|
217
161
|
// === Original discovery logic ===
|
|
218
162
|
let best;
|
|
@@ -253,6 +197,7 @@ class V2StyleDexService {
|
|
|
253
197
|
router: routerAddr,
|
|
254
198
|
factory: dep.factory ? (0, viem_1.getAddress)(dep.factory) : undefined,
|
|
255
199
|
amountOut,
|
|
200
|
+
pair: undefined,
|
|
256
201
|
};
|
|
257
202
|
}
|
|
258
203
|
});
|
|
@@ -350,25 +295,36 @@ class V2StyleDexService {
|
|
|
350
295
|
router: routerAddr,
|
|
351
296
|
factory: factoryDeployment,
|
|
352
297
|
amountOut,
|
|
298
|
+
pair: pair.pair,
|
|
353
299
|
};
|
|
354
300
|
}
|
|
355
301
|
}
|
|
356
302
|
}
|
|
357
|
-
if (!best) {
|
|
303
|
+
if (!best || best === undefined) {
|
|
358
304
|
throw (0, utils_1.sdkError)(enums_1.SdkErrorEnum.PRICE_NOT_FOUND, `No "best" price found for network: ${networkIn}.`);
|
|
359
305
|
}
|
|
360
306
|
const slippageNum = Number(slippage ?? 0);
|
|
361
|
-
const minAmountOut =
|
|
307
|
+
const minAmountOut = (0, min_amount_out_1.calculateMinAmountOut)({
|
|
362
308
|
amountOut: best.amountOut.toString(),
|
|
363
309
|
slippage: slippageNum,
|
|
364
310
|
});
|
|
311
|
+
// use best router to find the dex deployment
|
|
312
|
+
const bestDeployment = deployments.find(d => d.router.toLowerCase() === best.router.toLowerCase());
|
|
313
|
+
if (!bestDeployment) {
|
|
314
|
+
throw (0, utils_1.sdkError)(enums_1.SdkErrorEnum.PRICE_NOT_FOUND, `No deployment found for router: ${best.router}.`);
|
|
315
|
+
}
|
|
365
316
|
const uniV2PriceResponse = {
|
|
366
|
-
dex:
|
|
317
|
+
dex: (0, dex_deployment_key_1.dexDeploymentKey)({
|
|
318
|
+
dex: bestDeployment.dex,
|
|
319
|
+
router: best.router,
|
|
320
|
+
network: networkIn,
|
|
321
|
+
}),
|
|
367
322
|
route: [(0, viem_1.getAddress)(path[0]), (0, viem_1.getAddress)(path[1])],
|
|
368
323
|
router: best.router,
|
|
369
324
|
slippage,
|
|
370
325
|
expectedAmountOut: best.amountOut.toString(),
|
|
371
326
|
minAmountOut,
|
|
327
|
+
pair: best.pair,
|
|
372
328
|
};
|
|
373
329
|
const response = {
|
|
374
330
|
amountIn: amountInBig.toString(),
|
|
@@ -384,14 +340,10 @@ class V2StyleDexService {
|
|
|
384
340
|
return response;
|
|
385
341
|
}
|
|
386
342
|
catch (error) {
|
|
387
|
-
const
|
|
388
|
-
throw (0, utils_1.sdkError)(enums_1.SdkErrorEnum.PRICE_NOT_FOUND,
|
|
343
|
+
const errorMessage = error?.message || String(error);
|
|
344
|
+
throw (0, utils_1.sdkError)(enums_1.SdkErrorEnum.PRICE_NOT_FOUND, errorMessage);
|
|
389
345
|
}
|
|
390
346
|
}
|
|
391
|
-
/**
|
|
392
|
-
* Build an executable quote (tx data + approval info).
|
|
393
|
-
* Uses `_decideUniV2SwapMethodWithOverride` to select the correct router method (fee-on-transfer safe).
|
|
394
|
-
*/
|
|
395
347
|
async fetchQuote(params) {
|
|
396
348
|
const { from, receiver, tokenIn, tokenOut, amountIn, networkIn, networkOut, slippage, overrideParamsV2Dex, } = params;
|
|
397
349
|
if (!from || !receiver) {
|
|
@@ -409,21 +361,6 @@ class V2StyleDexService {
|
|
|
409
361
|
throw (0, utils_1.sdkError)(enums_1.SdkErrorEnum.INVALID_PARAMS, `No V2-style deployments configured for network ${networkIn}.`);
|
|
410
362
|
}
|
|
411
363
|
try {
|
|
412
|
-
// Optional native-liquidity sanity check (mirror of V3 behavior)
|
|
413
|
-
if (overrideParamsV2Dex &&
|
|
414
|
-
overrideParamsV2Dex.nativePrice &&
|
|
415
|
-
overrideParamsV2Dex.tokenInPrice &&
|
|
416
|
-
overrideParamsV2Dex.tokenInDecimals) {
|
|
417
|
-
console.log(`WARNING: SHOULD NOT BE LOGGING IN PROD CODE`);
|
|
418
|
-
await this._validateNativeLiquidityV2({
|
|
419
|
-
tokenIn: tokenIn,
|
|
420
|
-
networkIn: networkIn,
|
|
421
|
-
dexes: deployments.map(d => d.dex),
|
|
422
|
-
nativePrice: overrideParamsV2Dex.nativePrice,
|
|
423
|
-
tokenInPrice: overrideParamsV2Dex.tokenInPrice,
|
|
424
|
-
tokenInDecimals: overrideParamsV2Dex.tokenInDecimals,
|
|
425
|
-
});
|
|
426
|
-
}
|
|
427
364
|
const formattedTokens = this._validatePath(networkIn, [
|
|
428
365
|
(0, viem_1.getAddress)(tokenIn),
|
|
429
366
|
(0, viem_1.getAddress)(tokenOut),
|
|
@@ -436,19 +373,22 @@ class V2StyleDexService {
|
|
|
436
373
|
const fromAddr = (0, viem_1.getAddress)(from);
|
|
437
374
|
const toAddr = (0, viem_1.getAddress)(receiver);
|
|
438
375
|
// Price discovery honors overrides (early return or known pair fast path)
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
376
|
+
let price;
|
|
377
|
+
if (params?.priceResponse) {
|
|
378
|
+
price = params.priceResponse;
|
|
379
|
+
}
|
|
380
|
+
else {
|
|
381
|
+
price = await this.fetchPrice({
|
|
382
|
+
from: fromAddr,
|
|
383
|
+
networkIn,
|
|
384
|
+
networkOut,
|
|
385
|
+
amountIn: amountInBig.toString(),
|
|
386
|
+
tokenIn: path[0],
|
|
387
|
+
tokenOut: path[1],
|
|
388
|
+
slippage,
|
|
389
|
+
overrideParamsV2Dex,
|
|
390
|
+
});
|
|
391
|
+
}
|
|
452
392
|
const priceResponse = price;
|
|
453
393
|
const bestRouter = (0, viem_1.getAddress)(priceResponse.protocolResponse.router ??
|
|
454
394
|
priceResponse.protocolResponse?.router);
|
|
@@ -517,7 +457,11 @@ class V2StyleDexService {
|
|
|
517
457
|
...(approval && { approval }),
|
|
518
458
|
};
|
|
519
459
|
const protocolResponse = {
|
|
520
|
-
dex:
|
|
460
|
+
dex: (0, dex_deployment_key_1.dexDeploymentKey)({
|
|
461
|
+
dex: bestDeployment.dex,
|
|
462
|
+
router: bestRouter,
|
|
463
|
+
network: networkIn,
|
|
464
|
+
}),
|
|
521
465
|
router: bestRouter,
|
|
522
466
|
route: [(0, viem_1.getAddress)(path[0]), (0, viem_1.getAddress)(path[1])],
|
|
523
467
|
decision: functionDetails.decision,
|
|
@@ -546,221 +490,6 @@ class V2StyleDexService {
|
|
|
546
490
|
throw (0, utils_1.sdkError)(enums_1.SdkErrorEnum.QUOTE_NOT_FOUND, formattedError, { cause: error });
|
|
547
491
|
}
|
|
548
492
|
}
|
|
549
|
-
// NEW: Fast-quote for a known V2 pair using on-chain reserves (Uniswap V2 formula)
|
|
550
|
-
async _fetchKnownPairPriceV2(params) {
|
|
551
|
-
const { network, tokenInForQuote, tokenOutForQuote, amountInBI, pair } = params;
|
|
552
|
-
const client = this._rpcs[network];
|
|
553
|
-
if (!client) {
|
|
554
|
-
throw (0, utils_1.sdkError)(enums_1.SdkErrorEnum.INVALID_PARAMS, `No RPC client configured for chainId ${network}`);
|
|
555
|
-
}
|
|
556
|
-
const { token0, token1, deployment } = await this._resolveV2PairDeploymentFast(network, pair);
|
|
557
|
-
// Validate direction
|
|
558
|
-
const inLower = (0, viem_1.getAddress)(tokenInForQuote).toLowerCase();
|
|
559
|
-
const outLower = (0, viem_1.getAddress)(tokenOutForQuote).toLowerCase();
|
|
560
|
-
const t0 = token0.toLowerCase();
|
|
561
|
-
const t1 = token1.toLowerCase();
|
|
562
|
-
const directionValid = (inLower === t0 && outLower === t1) || (inLower === t1 && outLower === t0);
|
|
563
|
-
if (!directionValid) {
|
|
564
|
-
throw (0, utils_1.sdkError)(enums_1.SdkErrorEnum.INVALID_PARAMS, `Supplied pair/token direction mismatch. Pair ${pair} tokens are ${token0}/${token1}; received ${tokenInForQuote}/${tokenOutForQuote}`);
|
|
565
|
-
}
|
|
566
|
-
// Read reserves
|
|
567
|
-
const [r0, r1] = (await client.readContract({
|
|
568
|
-
address: pair,
|
|
569
|
-
abi: uniswapV2_pair_abi_1.uniswapV2PairAbi,
|
|
570
|
-
functionName: 'getReserves',
|
|
571
|
-
}));
|
|
572
|
-
const [reserveIn, reserveOut] = token0.toLowerCase() === inLower ? [r0, r1] : [r1, r0];
|
|
573
|
-
if (reserveIn === 0n || reserveOut === 0n) {
|
|
574
|
-
throw (0, utils_1.sdkError)(enums_1.SdkErrorEnum.PRICE_NOT_FOUND, `No liquidity in supplied pair ${pair}`);
|
|
575
|
-
}
|
|
576
|
-
// Uniswap V2 0.30% fee
|
|
577
|
-
const amountInWithFee = amountInBI * 997n;
|
|
578
|
-
const numerator = amountInWithFee * reserveOut;
|
|
579
|
-
const denominator = reserveIn * 1000n + amountInWithFee;
|
|
580
|
-
if (denominator === 0n) {
|
|
581
|
-
throw (0, utils_1.sdkError)(enums_1.SdkErrorEnum.PRICE_NOT_FOUND, `Invalid reserves math for pair ${pair}`);
|
|
582
|
-
}
|
|
583
|
-
const amountOut = numerator / denominator;
|
|
584
|
-
const dexKey = this._buildDexKey(network, deployment.router);
|
|
585
|
-
return {
|
|
586
|
-
amountOut,
|
|
587
|
-
payload: {
|
|
588
|
-
dex: dexKey,
|
|
589
|
-
router: deployment.router,
|
|
590
|
-
method: 'Pair.getReserves',
|
|
591
|
-
amountOut: amountOut.toString(),
|
|
592
|
-
notes: `Known pair fast path (${pair}).`,
|
|
593
|
-
},
|
|
594
|
-
};
|
|
595
|
-
}
|
|
596
|
-
// NEW: Resolve V2 pair -> tokens/factory/deployment in O(1) calls
|
|
597
|
-
async _resolveV2PairDeploymentFast(network, pair) {
|
|
598
|
-
const client = this._rpcs[network];
|
|
599
|
-
if (!client) {
|
|
600
|
-
throw (0, utils_1.sdkError)(enums_1.SdkErrorEnum.INVALID_PARAMS, `No RPC client configured for chainId ${network}`);
|
|
601
|
-
}
|
|
602
|
-
const [t0, t1, fac] = (await client.multicall({
|
|
603
|
-
allowFailure: false,
|
|
604
|
-
contracts: [
|
|
605
|
-
{ address: pair, abi: uniswapV2_pair_abi_1.uniswapV2PairAbi, functionName: 'token0' },
|
|
606
|
-
{ address: pair, abi: uniswapV2_pair_abi_1.uniswapV2PairAbi, functionName: 'token1' },
|
|
607
|
-
{ address: pair, abi: uniswapV2_pair_abi_1.uniswapV2PairAbi, functionName: 'factory' },
|
|
608
|
-
],
|
|
609
|
-
}));
|
|
610
|
-
if (t0.status !== 'success' || t1.status !== 'success' || fac.status !== 'success') {
|
|
611
|
-
throw (0, utils_1.sdkError)(enums_1.SdkErrorEnum.INVALID_PARAMS, `Failed to read pair data from ${pair} on chain ${network}`);
|
|
612
|
-
}
|
|
613
|
-
const token0 = (0, viem_1.getAddress)(t0.result);
|
|
614
|
-
const token1 = (0, viem_1.getAddress)(t1.result);
|
|
615
|
-
const factory = (0, viem_1.getAddress)(fac.result);
|
|
616
|
-
const deployments = V2StyleDexService.deployments[network] ?? [];
|
|
617
|
-
const matched = deployments.find(d => d.factory?.toLowerCase() === factory.toLowerCase());
|
|
618
|
-
if (!matched) {
|
|
619
|
-
throw (0, utils_1.sdkError)(enums_1.SdkErrorEnum.INVALID_PARAMS, `Pair ${pair} factory ${factory} does not match any configured V2 deployments on chain ${network}`);
|
|
620
|
-
}
|
|
621
|
-
return {
|
|
622
|
-
token0,
|
|
623
|
-
token1,
|
|
624
|
-
factory,
|
|
625
|
-
deployment: {
|
|
626
|
-
dex: matched.dex,
|
|
627
|
-
router: (0, viem_1.getAddress)(matched.router),
|
|
628
|
-
factory: (0, viem_1.getAddress)(matched.factory),
|
|
629
|
-
// if your deployment type carries initCodeHash, surface it here for diagnostics
|
|
630
|
-
initCodeHash: matched?.initHash,
|
|
631
|
-
},
|
|
632
|
-
};
|
|
633
|
-
}
|
|
634
|
-
// NEW: Native-liquidity validation for V2 (mirror of V3 behavior)
|
|
635
|
-
async _validateNativeLiquidityV2(params) {
|
|
636
|
-
const { tokenIn, networkIn, dexes, nativePrice, tokenInPrice, tokenInDecimals } = params;
|
|
637
|
-
// Stable & wrapped native mappings must exist in your constants (same as V3)
|
|
638
|
-
const stable = constants_1.networkStablecoins[networkIn];
|
|
639
|
-
if (!stable) {
|
|
640
|
-
throw (0, utils_1.sdkError)(enums_1.SdkErrorEnum.INVALID_PARAMS, `No stablecoin mapping for chainId ${networkIn}`);
|
|
641
|
-
}
|
|
642
|
-
const usdcEntry = stable.usdc;
|
|
643
|
-
const usdtEntry = stable.usdt;
|
|
644
|
-
const wrappedNative = wrapped_native_1.wrappedNativeTokens[networkIn];
|
|
645
|
-
const tokenInAddr = (0, viem_1.getAddress)(tokenIn);
|
|
646
|
-
const baseTokenAddrs = [wrappedNative, usdcEntry?.address, usdtEntry?.address]
|
|
647
|
-
.filter((a) => !!a)
|
|
648
|
-
.filter(a => !(0, is_native_1.isNative)(a))
|
|
649
|
-
.map(a => (0, viem_1.getAddress)(a))
|
|
650
|
-
.filter(a => a !== tokenInAddr);
|
|
651
|
-
if (baseTokenAddrs.length === 0) {
|
|
652
|
-
throw (0, utils_1.sdkError)(enums_1.SdkErrorEnum.INVALID_PARAMS, `No valid base tokens (WETH/USDC/USDT) for liquidity check on chainId ${networkIn}`);
|
|
653
|
-
}
|
|
654
|
-
const deployments = (V2StyleDexService.deployments[networkIn] ?? []).filter(d => dexes.includes(d.dex));
|
|
655
|
-
if (!deployments.length) {
|
|
656
|
-
throw (0, utils_1.sdkError)(enums_1.SdkErrorEnum.INVALID_PARAMS, `No V2-style deployments configured for network ${networkIn} (requested: ${dexes.join(', ')})`);
|
|
657
|
-
}
|
|
658
|
-
const client = this._rpcs[networkIn];
|
|
659
|
-
if (!client) {
|
|
660
|
-
throw (0, utils_1.sdkError)(enums_1.SdkErrorEnum.INVALID_PARAMS, `No RPC client configured for chainId ${networkIn}`);
|
|
661
|
-
}
|
|
662
|
-
const isWrappedNative = (addr) => !!wrappedNative &&
|
|
663
|
-
(0, viem_1.getAddress)(addr).toLowerCase() === (0, viem_1.getAddress)(wrappedNative).toLowerCase();
|
|
664
|
-
const stableAddrLower = new Set([
|
|
665
|
-
usdcEntry?.address ? (0, viem_1.getAddress)(usdcEntry.address).toLowerCase() : '',
|
|
666
|
-
usdtEntry?.address ? (0, viem_1.getAddress)(usdtEntry.address).toLowerCase() : '',
|
|
667
|
-
].filter(Boolean));
|
|
668
|
-
const isStable = (addr) => stableAddrLower.has(addr.toLowerCase());
|
|
669
|
-
const getBaseDecimals = (base) => {
|
|
670
|
-
const lower = base.toLowerCase();
|
|
671
|
-
if (usdcEntry && (0, viem_1.getAddress)(usdcEntry.address).toLowerCase() === lower)
|
|
672
|
-
return usdcEntry.decimals;
|
|
673
|
-
if (usdtEntry && (0, viem_1.getAddress)(usdtEntry.address).toLowerCase() === lower)
|
|
674
|
-
return usdtEntry.decimals;
|
|
675
|
-
if (isWrappedNative(base))
|
|
676
|
-
return 18;
|
|
677
|
-
return 18;
|
|
678
|
-
};
|
|
679
|
-
const getBasePriceUSD = (base) => (isStable(base) ? 1 : nativePrice);
|
|
680
|
-
const candidates = [];
|
|
681
|
-
for (const d of deployments) {
|
|
682
|
-
const initCodeHash = d?.initHash;
|
|
683
|
-
if (!initCodeHash) {
|
|
684
|
-
// cannot construct deterministic pair addr without init code hash
|
|
685
|
-
continue;
|
|
686
|
-
}
|
|
687
|
-
for (const base of baseTokenAddrs) {
|
|
688
|
-
const [token0, token1] = this._sortAddresses(tokenInAddr, base);
|
|
689
|
-
const pairAddr = this._computeV2PairAddress({
|
|
690
|
-
factory: (0, viem_1.getAddress)(d.factory),
|
|
691
|
-
initCodeHash,
|
|
692
|
-
tokenA: token0,
|
|
693
|
-
tokenB: token1,
|
|
694
|
-
});
|
|
695
|
-
candidates.push({ pair: (0, viem_1.getAddress)(pairAddr), baseToken: (0, viem_1.getAddress)(base), dex: d.dex });
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
if (!candidates.length) {
|
|
699
|
-
throw (0, utils_1.sdkError)(enums_1.SdkErrorEnum.INVALID_PARAMS, `No candidate V2 pairs could be constructed for chainId ${networkIn}`);
|
|
700
|
-
}
|
|
701
|
-
// Read reserves for all candidates
|
|
702
|
-
const contracts = candidates.map(c => ({
|
|
703
|
-
address: c.pair,
|
|
704
|
-
abi: uniswapV2_pair_abi_1.uniswapV2PairAbi,
|
|
705
|
-
functionName: 'getReserves',
|
|
706
|
-
args: [],
|
|
707
|
-
}));
|
|
708
|
-
const reservesResults = await client.multicall({
|
|
709
|
-
allowFailure: true,
|
|
710
|
-
contracts,
|
|
711
|
-
});
|
|
712
|
-
const tvls = [];
|
|
713
|
-
for (let i = 0; i < candidates.length; i++) {
|
|
714
|
-
const cand = candidates[i];
|
|
715
|
-
const res = reservesResults[i];
|
|
716
|
-
if (!res || res.status !== 'success' || !cand)
|
|
717
|
-
continue;
|
|
718
|
-
const [r0, r1] = res.result;
|
|
719
|
-
// Need to know token0 order to map reserves; fetch token0 for this pair
|
|
720
|
-
const token0Addr = (await client.readContract({
|
|
721
|
-
address: cand.pair,
|
|
722
|
-
abi: uniswapV2_pair_abi_1.uniswapV2PairAbi,
|
|
723
|
-
functionName: 'token0',
|
|
724
|
-
}));
|
|
725
|
-
const token0Lower = (0, viem_1.getAddress)(token0Addr).toLowerCase();
|
|
726
|
-
const isTokenInToken0 = token0Lower === (0, viem_1.getAddress)(tokenInAddr).toLowerCase();
|
|
727
|
-
const reserveIn = isTokenInToken0 ? r0 : r1;
|
|
728
|
-
const reserveBase = isTokenInToken0 ? r1 : r0;
|
|
729
|
-
const tokenInAmt = Number(reserveIn) / 10 ** tokenInDecimals;
|
|
730
|
-
const baseAmt = Number(reserveBase) / 10 ** getBaseDecimals(cand.baseToken);
|
|
731
|
-
const usdValue = tokenInAmt * tokenInPrice + baseAmt * getBasePriceUSD(cand.baseToken);
|
|
732
|
-
tvls.push({
|
|
733
|
-
pair: cand.pair,
|
|
734
|
-
baseToken: cand.baseToken,
|
|
735
|
-
usdValue,
|
|
736
|
-
baseIsNative: isWrappedNative(cand.baseToken) ?? false,
|
|
737
|
-
});
|
|
738
|
-
}
|
|
739
|
-
if (!tvls.length) {
|
|
740
|
-
throw (0, utils_1.sdkError)(enums_1.SdkErrorEnum.PRICE_NOT_FOUND, `No liquidity detected for ${tokenIn} on chainId ${networkIn} across requested dexes: ${dexes.join(', ')}`);
|
|
741
|
-
}
|
|
742
|
-
tvls.sort((a, b) => b.usdValue - a.usdValue);
|
|
743
|
-
const top = tvls[0];
|
|
744
|
-
if (!top) {
|
|
745
|
-
throw (0, utils_1.sdkError)(enums_1.SdkErrorEnum.PRICE_NOT_FOUND, `No liquidity detected for ${tokenIn} on chainId ${networkIn} across requested dexes: ${dexes.join(', ')}`);
|
|
746
|
-
}
|
|
747
|
-
if (isStable(top.baseToken)) {
|
|
748
|
-
throw (0, utils_1.sdkError)(enums_1.SdkErrorEnum.PRICE_NOT_FOUND, `Most liquid pool for ${tokenIn} on chain ${networkIn} is against a stablecoin, not native.`);
|
|
749
|
-
}
|
|
750
|
-
if (!top.baseIsNative) {
|
|
751
|
-
throw (0, utils_1.sdkError)(enums_1.SdkErrorEnum.PRICE_NOT_FOUND, `Most liquid pool for ${tokenIn} is not against the native token.`);
|
|
752
|
-
}
|
|
753
|
-
// success
|
|
754
|
-
return;
|
|
755
|
-
}
|
|
756
|
-
_buildDexKey(network, router) {
|
|
757
|
-
// Find the deployment from `deployments` where the router address is equal to the router param
|
|
758
|
-
const deployment = V2StyleDexService.deployments[network]?.find(d => d.router.toLowerCase() === router.toLowerCase());
|
|
759
|
-
if (!deployment) {
|
|
760
|
-
throw (0, utils_1.sdkError)(enums_1.SdkErrorEnum.INVALID_PARAMS, `No deployment found for router ${router} on network ${network}.`);
|
|
761
|
-
}
|
|
762
|
-
return `${deployment.dex}:${router}:${network}`;
|
|
763
|
-
}
|
|
764
493
|
_selectSwapFunction(params) {
|
|
765
494
|
const { deployment, decision, isNativeIn, isNativeOut, network } = params;
|
|
766
495
|
const isAvaxEdgecase = this._isAvaxEdgecase(deployment, network);
|
|
@@ -834,6 +563,40 @@ class V2StyleDexService {
|
|
|
834
563
|
return { decision: 'supportingFeeOnTransfer', reason: 'erc20 input' };
|
|
835
564
|
}
|
|
836
565
|
}
|
|
566
|
+
_buildFastRoutePriceResponse(params) {
|
|
567
|
+
const { networkIn, networkOut, tokenIn, tokenOut, amountIn, slippage, deployments, overrideDex, overrideAmountOutMin, overridePair, } = params;
|
|
568
|
+
// route using the router from the matching dex deployment
|
|
569
|
+
const chosenRouter = deployments.find(d => d.dex === overrideDex)?.router;
|
|
570
|
+
if (!chosenRouter) {
|
|
571
|
+
throw (0, utils_1.sdkError)(enums_1.SdkErrorEnum.INVALID_PARAMS, `No router found for dex ${overrideDex} on chainId ${networkIn}`);
|
|
572
|
+
}
|
|
573
|
+
const amountInBig = BigInt(amountIn);
|
|
574
|
+
const path = [(0, viem_1.getAddress)(tokenIn), (0, viem_1.getAddress)(tokenOut)];
|
|
575
|
+
const uniV2PriceResponse = {
|
|
576
|
+
dex: (0, dex_deployment_key_1.dexDeploymentKey)({
|
|
577
|
+
dex: overrideDex,
|
|
578
|
+
router: (0, viem_1.getAddress)(chosenRouter),
|
|
579
|
+
network: networkIn,
|
|
580
|
+
}),
|
|
581
|
+
route: [(0, viem_1.getAddress)(path[0]), (0, viem_1.getAddress)(path[1])],
|
|
582
|
+
router: (0, viem_1.getAddress)(chosenRouter),
|
|
583
|
+
slippage,
|
|
584
|
+
expectedAmountOut: overrideAmountOutMin,
|
|
585
|
+
minAmountOut: overrideAmountOutMin,
|
|
586
|
+
pair: (0, viem_1.getAddress)(overridePair),
|
|
587
|
+
};
|
|
588
|
+
return {
|
|
589
|
+
amountIn: amountInBig.toString(),
|
|
590
|
+
amountOut: overrideAmountOutMin,
|
|
591
|
+
protocol: this.protocol,
|
|
592
|
+
networkIn,
|
|
593
|
+
networkOut,
|
|
594
|
+
tokenIn,
|
|
595
|
+
tokenOut,
|
|
596
|
+
slippage,
|
|
597
|
+
protocolResponse: uniV2PriceResponse,
|
|
598
|
+
};
|
|
599
|
+
}
|
|
837
600
|
_mergeDeployments(base, extras) {
|
|
838
601
|
const norm = (addr) => (0, viem_1.getAddress)(addr);
|
|
839
602
|
// Work on normalized copies
|
|
@@ -884,22 +647,6 @@ class V2StyleDexService {
|
|
|
884
647
|
}
|
|
885
648
|
return out;
|
|
886
649
|
}
|
|
887
|
-
_calculateMinAmountOut(params) {
|
|
888
|
-
const { amountOut, slippage } = params;
|
|
889
|
-
const pct = Number(slippage);
|
|
890
|
-
if (!Number.isFinite(pct) || pct < 0) {
|
|
891
|
-
throw (0, utils_1.sdkError)(enums_1.SdkErrorEnum.INVALID_PARAMS, `Invalid slippage: ${slippage}`);
|
|
892
|
-
}
|
|
893
|
-
// Round to the nearest basis point and clamp [0, 10000]
|
|
894
|
-
let bps = Math.round(pct * 100);
|
|
895
|
-
if (bps > 10000)
|
|
896
|
-
bps = 10000;
|
|
897
|
-
const OUT = BigInt(amountOut);
|
|
898
|
-
const BASE_BPS = 10000n;
|
|
899
|
-
// minOut = amountOut * (1 - bps/10000)
|
|
900
|
-
const min = (OUT * (BASE_BPS - BigInt(bps))) / BASE_BPS;
|
|
901
|
-
return min.toString();
|
|
902
|
-
}
|
|
903
650
|
_isAvaxEdgecase(dex, network) {
|
|
904
651
|
return ((dex === v2_dex_types_1.UniswapV2StyleDexEnum.PANGOLIN_V2 || dex === v2_dex_types_1.UniswapV2StyleDexEnum.TRADERJOE_V2) &&
|
|
905
652
|
network === enums_1.ChainIdEnum.AVALANCHE);
|
|
@@ -927,30 +674,6 @@ class V2StyleDexService {
|
|
|
927
674
|
tokenOut,
|
|
928
675
|
};
|
|
929
676
|
}
|
|
930
|
-
_computeV2PairAddress(params) {
|
|
931
|
-
const { factory, initCodeHash, tokenA, tokenB } = params;
|
|
932
|
-
const [token0, token1] = this._sortAddresses(tokenA, tokenB);
|
|
933
|
-
// from (factory) as bytes
|
|
934
|
-
const from = (0, viem_1.toBytes)((0, viem_1.getAddress)(factory));
|
|
935
|
-
// salt = keccak256(abi.encodePacked(address, address))
|
|
936
|
-
const saltHex = (0, viem_1.keccak256)((0, viem_1.encodePacked)(['address', 'address'], [token0, token1]));
|
|
937
|
-
const salt = (0, viem_1.toBytes)(saltHex);
|
|
938
|
-
// init code hash (pair creation code hash) as bytes
|
|
939
|
-
const bytecodeHash = (0, viem_1.toBytes)(initCodeHash);
|
|
940
|
-
// keccak256( 0xff ++ factory ++ salt ++ init_code_hash )
|
|
941
|
-
const create2Input = (0, viem_1.concat)([(0, viem_1.toBytes)('0xff'), from, salt, bytecodeHash]);
|
|
942
|
-
const create2Hash = (0, viem_1.keccak256)(create2Input);
|
|
943
|
-
// Take the last 20 bytes, then checksum it to an Address
|
|
944
|
-
const pair = (0, viem_1.getAddress)((0, viem_1.slice)(create2Hash, 12)); // drop first 12 bytes -> 20 bytes left
|
|
945
|
-
return pair;
|
|
946
|
-
}
|
|
947
|
-
_sortAddresses(a, b) {
|
|
948
|
-
const aa = (0, viem_1.getAddress)(a);
|
|
949
|
-
const bb = (0, viem_1.getAddress)(b);
|
|
950
|
-
if (aa === bb)
|
|
951
|
-
throw new Error('IDENTICAL_ADDRESSES');
|
|
952
|
-
return aa.toLowerCase() < bb.toLowerCase() ? [aa, bb] : [bb, aa];
|
|
953
|
-
}
|
|
954
677
|
_getRouterAbi(dex, network) {
|
|
955
678
|
if (this._isAvaxEdgecase(dex, network))
|
|
956
679
|
return avax_uniswapv2_router_abi_1.avaxUniswapV2RouterAbi;
|
|
@@ -960,154 +683,8 @@ class V2StyleDexService {
|
|
|
960
683
|
}
|
|
961
684
|
}
|
|
962
685
|
exports.V2StyleDexService = V2StyleDexService;
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
router: '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D',
|
|
968
|
-
factory: '0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f',
|
|
969
|
-
initHash: '0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f',
|
|
970
|
-
},
|
|
971
|
-
{
|
|
972
|
-
dex: v2_dex_types_1.UniswapV2StyleDexEnum.SUSHISWAP_V2,
|
|
973
|
-
router: '0xd9e1ce17f2641f24ae83637ab66a2cca9c378b9f',
|
|
974
|
-
factory: '0xc0aee478e3658e2610c5f7a4a2e1777ce9e4f2ac',
|
|
975
|
-
initHash: '0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303',
|
|
976
|
-
},
|
|
977
|
-
{
|
|
978
|
-
dex: v2_dex_types_1.UniswapV2StyleDexEnum.PANCAKESWAP_V2,
|
|
979
|
-
router: '0xEfF92A263d31888d860bD50809A8D171709b7b1c',
|
|
980
|
-
factory: '0x1097053Fd2ea711dad45caCcc45EfF7548fCB362',
|
|
981
|
-
initHash: '0x00fb7f630766e6a796048ea87d01acd3068e8ff67d078148a3fa3f4a84f69bd5',
|
|
982
|
-
},
|
|
983
|
-
],
|
|
984
|
-
[enums_1.ChainIdEnum.BSC]: [
|
|
985
|
-
{
|
|
986
|
-
dex: v2_dex_types_1.UniswapV2StyleDexEnum.PANCAKESWAP_V2,
|
|
987
|
-
router: '0x10ED43C718714eb63d5aA57B78B54704E256024E',
|
|
988
|
-
factory: '0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73',
|
|
989
|
-
initHash: '0x00fb7f630766e6a796048ea87d01acd3068e8ff67d078148a3fa3f4a84f69bd5',
|
|
990
|
-
},
|
|
991
|
-
{
|
|
992
|
-
dex: v2_dex_types_1.UniswapV2StyleDexEnum.UNISWAP_V2,
|
|
993
|
-
router: '0x4752ba5DBc23f44D87826276BF6Fd6b1C372aD24',
|
|
994
|
-
factory: '0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6',
|
|
995
|
-
initHash: '0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f',
|
|
996
|
-
},
|
|
997
|
-
{
|
|
998
|
-
dex: v2_dex_types_1.UniswapV2StyleDexEnum.SUSHISWAP_V2,
|
|
999
|
-
router: '0x1b02da8cb0d097eb8d57a175b88c7d8b47997506',
|
|
1000
|
-
factory: '0xc35dadb65012ec5796536bd9864ed8773abc74c4',
|
|
1001
|
-
initHash: '0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303',
|
|
1002
|
-
},
|
|
1003
|
-
],
|
|
1004
|
-
[enums_1.ChainIdEnum.POLYGON]: [
|
|
1005
|
-
{
|
|
1006
|
-
dex: v2_dex_types_1.UniswapV2StyleDexEnum.QUICKSWAP_V2,
|
|
1007
|
-
router: '0xa5E0829CaCEd8fFDD4De3c43696c57F7D7A678ff',
|
|
1008
|
-
factory: '0x5757371414417b8C6CAad45bAeF941aBc7d3Ab32',
|
|
1009
|
-
initHash: '0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f',
|
|
1010
|
-
},
|
|
1011
|
-
{
|
|
1012
|
-
dex: v2_dex_types_1.UniswapV2StyleDexEnum.UNISWAP_V2,
|
|
1013
|
-
router: '0xedf6066a2b290C185783862C7F4776A2C8077AD1',
|
|
1014
|
-
factory: '0x9e5A52f57b3038F1B8EeE45F28b3C1967e22799C',
|
|
1015
|
-
initHash: '0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f',
|
|
1016
|
-
},
|
|
1017
|
-
{
|
|
1018
|
-
dex: v2_dex_types_1.UniswapV2StyleDexEnum.SUSHISWAP_V2,
|
|
1019
|
-
router: '0x1b02da8cb0d097eb8d57a175b88c7d8b47997506',
|
|
1020
|
-
factory: '0xc35dadb65012ec5796536bd9864ed8773abc74c4',
|
|
1021
|
-
initHash: '0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303',
|
|
1022
|
-
},
|
|
1023
|
-
],
|
|
1024
|
-
[enums_1.ChainIdEnum.AVALANCHE]: [
|
|
1025
|
-
{
|
|
1026
|
-
dex: v2_dex_types_1.UniswapV2StyleDexEnum.TRADERJOE_V2,
|
|
1027
|
-
router: '0x60aE616a2155Ee3d9A68541Ba4544862310933d4',
|
|
1028
|
-
factory: '0x9Ad6C38BE94206cA50bb0d90783181662f0Cfa10',
|
|
1029
|
-
initHash: '0x0bbca9af0511ad1a1da383135cf3a8d2ac620e549ef9f6ae3a4c33c2fed0af91',
|
|
1030
|
-
},
|
|
1031
|
-
{
|
|
1032
|
-
dex: v2_dex_types_1.UniswapV2StyleDexEnum.SUSHISWAP_V2,
|
|
1033
|
-
router: '0x1b02da8cb0d097eb8d57a175b88c7d8b47997506',
|
|
1034
|
-
factory: '0xc35dadb65012ec5796536bd9864ed8773abc74c4',
|
|
1035
|
-
initHash: '0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303',
|
|
1036
|
-
},
|
|
1037
|
-
{
|
|
1038
|
-
dex: v2_dex_types_1.UniswapV2StyleDexEnum.UNISWAP_V2,
|
|
1039
|
-
router: '0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24',
|
|
1040
|
-
factory: '0x9e5A52f57b3038F1B8EeE45F28b3C1967e22799C',
|
|
1041
|
-
initHash: '0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f',
|
|
1042
|
-
},
|
|
1043
|
-
{
|
|
1044
|
-
dex: v2_dex_types_1.UniswapV2StyleDexEnum.PANGOLIN_V2,
|
|
1045
|
-
router: '0xE54Ca86531e17Ef3616d22Ca28b0D458b6C89106',
|
|
1046
|
-
factory: '0xefa94DE7a4656D787667C749f7E1223D71E9FD88',
|
|
1047
|
-
initHash: '0x40231f6b438bce0797c9ada29b718a87ea0a5cea3fe9a771abdd76bd41a3e545',
|
|
1048
|
-
},
|
|
1049
|
-
],
|
|
1050
|
-
[enums_1.ChainIdEnum.ARBITRUM]: [
|
|
1051
|
-
{
|
|
1052
|
-
dex: v2_dex_types_1.UniswapV2StyleDexEnum.SUSHISWAP_V2,
|
|
1053
|
-
router: '0x1b02da8cb0d097eb8d57a175b88c7d8b47997506',
|
|
1054
|
-
factory: '0xc35dadb65012ec5796536bd9864ed8773abc74c4',
|
|
1055
|
-
initHash: '0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303',
|
|
1056
|
-
},
|
|
1057
|
-
{
|
|
1058
|
-
dex: v2_dex_types_1.UniswapV2StyleDexEnum.UNISWAP_V2,
|
|
1059
|
-
router: '0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24',
|
|
1060
|
-
factory: '0xf1D7CC64Fb4452F05c498126312eBE29f30Fbcf9',
|
|
1061
|
-
initHash: '0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f',
|
|
1062
|
-
},
|
|
1063
|
-
{
|
|
1064
|
-
dex: v2_dex_types_1.UniswapV2StyleDexEnum.PANCAKESWAP_V2,
|
|
1065
|
-
router: '0x10ED43C718714eb63d5aA57B78B54704E256024E',
|
|
1066
|
-
factory: '0x02a84c1b3BBD7401a5f7fa98a384EBC70bB5749E',
|
|
1067
|
-
initHash: '0x00fb7f630766e6a796048ea87d01acd3068e8ff67d078148a3fa3f4a84f69bd5',
|
|
1068
|
-
},
|
|
1069
|
-
],
|
|
1070
|
-
[enums_1.ChainIdEnum.OPTIMISM]: [
|
|
1071
|
-
{
|
|
1072
|
-
dex: v2_dex_types_1.UniswapV2StyleDexEnum.SUSHISWAP_V2,
|
|
1073
|
-
router: '0x2abf469074dc0b54d793850807e6eb5faf2625b1',
|
|
1074
|
-
factory: '0xfbc12984689e5f15626bad03ad60160fe98b303c',
|
|
1075
|
-
initHash: '0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303',
|
|
1076
|
-
},
|
|
1077
|
-
{
|
|
1078
|
-
dex: v2_dex_types_1.UniswapV2StyleDexEnum.UNISWAP_V2,
|
|
1079
|
-
router: '0x4A7b5Da61326A6379179b40d00F57E5bbDC962c2',
|
|
1080
|
-
factory: '0x0c3c1c532F1e39EdF36BE9Fe0bE1410313E074Bf',
|
|
1081
|
-
initHash: '0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f',
|
|
1082
|
-
},
|
|
1083
|
-
],
|
|
1084
|
-
[enums_1.ChainIdEnum.BASE]: [
|
|
1085
|
-
{
|
|
1086
|
-
dex: v2_dex_types_1.UniswapV2StyleDexEnum.SUSHISWAP_V2,
|
|
1087
|
-
router: '0x6bded42c6da8fbf0d2ba55b2fa120c5e0c8d7891',
|
|
1088
|
-
factory: '0x71524b4f93c58fcbf659783284e38825f0622859',
|
|
1089
|
-
initHash: '0xe18a34eb0e04b04f7a0ac29a6e80748dca96319b42c54d679cb821dca90c6303',
|
|
1090
|
-
},
|
|
1091
|
-
{
|
|
1092
|
-
dex: v2_dex_types_1.UniswapV2StyleDexEnum.UNISWAP_V2,
|
|
1093
|
-
router: '0x4752ba5dbc23f44d87826276bf6fd6b1c372ad24',
|
|
1094
|
-
factory: '0x8909Dc15e40173Ff4699343b6eB8132c65e18eC6',
|
|
1095
|
-
initHash: '0x96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f',
|
|
1096
|
-
},
|
|
1097
|
-
{
|
|
1098
|
-
dex: v2_dex_types_1.UniswapV2StyleDexEnum.PANCAKESWAP_V2,
|
|
1099
|
-
router: '0x8cFe327CEc66d1C090Dd72bd0FF11d690C33a2Eb',
|
|
1100
|
-
factory: '0x02a84c1b3BBD7401a5f7fa98a384EBC70bB5749E',
|
|
1101
|
-
initHash: '0x00fb7f630766e6a796048ea87d01acd3068e8ff67d078148a3fa3f4a84f69bd5',
|
|
1102
|
-
},
|
|
1103
|
-
],
|
|
1104
|
-
[enums_1.ChainIdEnum.HYPEREVM]: [
|
|
1105
|
-
{
|
|
1106
|
-
dex: v2_dex_types_1.UniswapV2StyleDexEnum.HYPERSWAP_V2,
|
|
1107
|
-
router: '0xb4a9C4e6Ea8E2191d2FA5B380452a634Fb21240A',
|
|
1108
|
-
factory: '0x724412C00059bf7d6ee7d4a1d0D5cd4de3ea1C48',
|
|
1109
|
-
initHash: '0xc83d9df19c8c8a0a1229bd3122cbb86fd8ff56f79cc6781c15999d39425466e9',
|
|
1110
|
-
},
|
|
1111
|
-
],
|
|
1112
|
-
};
|
|
686
|
+
/**
|
|
687
|
+
* The deployments of V2-style DEXes on various chains
|
|
688
|
+
*/
|
|
689
|
+
V2StyleDexService.deployments = v2_dex_deployments_1.uniV2DexDeployments;
|
|
1113
690
|
//# sourceMappingURL=v2-dex.service.js.map
|