@shogun-sdk/intents-sdk 1.3.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -22
- package/dist/index.cjs +8997 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +1654 -0
- package/dist/index.d.ts +1654 -0
- package/dist/index.js +9246 -0
- package/dist/index.js.map +1 -0
- package/package.json +28 -15
- package/src/auth/siwe.ts +8 -3
- package/src/chains.ts +6 -0
- package/src/constants.ts +67 -13
- package/src/core/evm/chain-provider.ts +4 -1
- package/src/core/evm/connectors/monad.ts +27 -0
- package/src/core/evm/cross-chain-limit-order.ts +14 -14
- package/src/core/evm/intent-helpers.ts +153 -19
- package/src/core/evm/intent-provider.ts +5 -4
- package/src/core/evm/permit2.ts +36 -0
- package/src/core/evm/single-chain-dca-order.ts +18 -18
- package/src/core/evm/single-chain-limit-order.ts +15 -15
- package/src/core/evm/types.ts +4 -4
- package/src/core/evm/validator.ts +1 -1
- package/src/core/orders/api/fetch.ts +33 -16
- package/src/core/orders/api/index.ts +39 -8
- package/src/core/orders/common.ts +2 -0
- package/src/core/orders/cross-chain.ts +15 -8
- package/src/core/orders/single-chain.ts +30 -13
- package/src/core/sdk.ts +11 -0
- package/src/core/solana/cancel-order.ts +4 -2
- package/src/core/solana/client.ts +1 -1
- package/src/core/solana/dca/cancel-order.ts +2 -1
- package/src/core/solana/dca/single-chain-dca-order.ts +19 -22
- package/src/core/solana/dca/single-chain-limit-order.ts +20 -22
- package/src/core/solana/generated/cross-chain/accounts/dcaOrder.ts +2 -2
- package/src/core/solana/generated/cross-chain/accounts/guard.ts +22 -10
- package/src/core/solana/generated/cross-chain/errors/sourceChainGuard.ts +37 -33
- package/src/core/solana/generated/cross-chain/instructions/cancelDcaOrder.ts +36 -22
- package/src/core/solana/generated/cross-chain/instructions/cancelOrder.ts +32 -18
- package/src/core/solana/generated/cross-chain/instructions/claimTokensForDcaInterval.ts +396 -0
- package/src/core/solana/generated/cross-chain/instructions/index.ts +5 -0
- package/src/core/solana/generated/cross-chain/instructions/preStartDcaOrderExecution.ts +504 -0
- package/src/core/solana/generated/cross-chain/instructions/setCancelAuthorities.ts +326 -0
- package/src/core/solana/generated/cross-chain/instructions/startDcaOrderExecution.ts +440 -0
- package/src/core/solana/generated/cross-chain/instructions/startDcaOrderExecutionAfterSwap.ts +322 -0
- package/src/core/solana/generated/cross-chain/programs/sourceChainGuard.ts +80 -0
- package/src/core/solana/generated/cross-chain/types/cancelAuthoritiesUpdated.ts +40 -0
- package/src/core/solana/generated/cross-chain/types/index.ts +1 -0
- package/src/core/solana/generated/single-chain/accounts/guard.ts +22 -10
- package/src/core/solana/generated/single-chain/errors/singleChainGuard.ts +24 -20
- package/src/core/solana/generated/single-chain/instructions/cancelDcaOrder.ts +28 -14
- package/src/core/solana/generated/single-chain/instructions/cancelLimitOrder.ts +28 -14
- package/src/core/solana/generated/single-chain/instructions/fulfillDcaOrderInterval.ts +30 -4
- package/src/core/solana/generated/single-chain/instructions/fulfillLimitOrder.ts +30 -4
- package/src/core/solana/generated/single-chain/instructions/index.ts +1 -0
- package/src/core/solana/generated/single-chain/instructions/setCancelAuthorities.ts +326 -0
- package/src/core/solana/generated/single-chain/programs/singleChainGuard.ts +17 -1
- package/src/core/solana/generated/single-chain/types/cancelAuthoritiesUpdated.ts +40 -0
- package/src/core/solana/generated/single-chain/types/index.ts +1 -0
- package/src/core/solana/intent-helpers.ts +31 -23
- package/src/core/solana/sdk.ts +1 -1
- package/src/core/solana/utils.ts +10 -1
- package/src/core/sui/cross-chain-limit-order.ts +1 -4
- package/src/core/sui/intent-helpers.ts +28 -31
- package/src/core/sui/order-transaction.ts +1 -1
- package/src/core/sui/single-chain-dca-order.ts +19 -32
- package/src/core/sui/single-chain-limit-order.ts +19 -34
- package/src/index.ts +8 -2
- package/src/types/api.ts +22 -2
- package/src/types/intent.ts +40 -4
- package/src/types/token-list.ts +2 -2
- package/src/utils/base-validator.ts +0 -4
- package/src/utils/defillama.ts +2 -0
- package/src/utils/generate-execution-details-hash.ts +11 -32
- package/src/utils/quote/address.ts +4 -0
- package/src/utils/quote/aggregator.ts +266 -106
- package/src/utils/quote/liquidswap.ts +42 -13
- package/src/utils/quote/paraswap.ts +2 -0
- package/src/utils/quote/pricing/constants.ts +33 -0
- package/src/utils/quote/pricing/decimals.ts +11 -0
- package/src/utils/quote/pricing/estimate-amount-out.ts +36 -0
- package/src/utils/quote/pricing/expenses.ts +62 -0
- package/src/utils/quote/pricing/gas.ts +28 -0
- package/src/utils/quote/pumpfun/estimations.ts +206 -0
- package/src/utils/quote/pumpfun/estimations_amm.ts +165 -0
- package/src/utils/quote/pumpfun/index.ts +266 -0
- package/src/utils/quote/pumpfun/models.ts +163 -0
- package/src/utils/quote/pumpfun/utils.ts +343 -0
- package/src/utils/quote/raydium.ts +350 -9
- package/src/utils/quote/relay.ts +99 -0
- package/src/utils/quote/stablecoins-tokens.ts +35 -8
- package/src/utils/quote/utils.ts +8 -0
- package/dist/esm/auth/siwe.js +0 -26
- package/dist/esm/auth/siwe.js.map +0 -1
- package/dist/esm/chains.js +0 -62
- package/dist/esm/chains.js.map +0 -1
- package/dist/esm/config.js +0 -2
- package/dist/esm/config.js.map +0 -1
- package/dist/esm/constants.js +0 -107
- package/dist/esm/constants.js.map +0 -1
- package/dist/esm/core/evm/abi/erc20.js +0 -313
- package/dist/esm/core/evm/abi/erc20.js.map +0 -1
- package/dist/esm/core/evm/abi/permit2.js +0 -395
- package/dist/esm/core/evm/abi/permit2.js.map +0 -1
- package/dist/esm/core/evm/abi/single-chain-guard-limit.js +0 -768
- package/dist/esm/core/evm/abi/single-chain-guard-limit.js.map +0 -1
- package/dist/esm/core/evm/abi/source-chain-guard.js +0 -1121
- package/dist/esm/core/evm/abi/source-chain-guard.js.map +0 -1
- package/dist/esm/core/evm/cancel-order.js +0 -130
- package/dist/esm/core/evm/cancel-order.js.map +0 -1
- package/dist/esm/core/evm/chain-provider.js +0 -118
- package/dist/esm/core/evm/chain-provider.js.map +0 -1
- package/dist/esm/core/evm/connectors/hyperevm.js +0 -23
- package/dist/esm/core/evm/connectors/hyperevm.js.map +0 -1
- package/dist/esm/core/evm/cross-chain-limit-order.js +0 -43
- package/dist/esm/core/evm/cross-chain-limit-order.js.map +0 -1
- package/dist/esm/core/evm/intent-helpers.js +0 -135
- package/dist/esm/core/evm/intent-helpers.js.map +0 -1
- package/dist/esm/core/evm/intent-provider.js +0 -162
- package/dist/esm/core/evm/intent-provider.js.map +0 -1
- package/dist/esm/core/evm/order-signature.js +0 -41
- package/dist/esm/core/evm/order-signature.js.map +0 -1
- package/dist/esm/core/evm/permit2.js +0 -82
- package/dist/esm/core/evm/permit2.js.map +0 -1
- package/dist/esm/core/evm/sdk.js +0 -175
- package/dist/esm/core/evm/sdk.js.map +0 -1
- package/dist/esm/core/evm/single-chain-dca-order.js +0 -49
- package/dist/esm/core/evm/single-chain-dca-order.js.map +0 -1
- package/dist/esm/core/evm/single-chain-limit-order.js +0 -45
- package/dist/esm/core/evm/single-chain-limit-order.js.map +0 -1
- package/dist/esm/core/evm/types.js +0 -8
- package/dist/esm/core/evm/types.js.map +0 -1
- package/dist/esm/core/evm/validator.js +0 -111
- package/dist/esm/core/evm/validator.js.map +0 -1
- package/dist/esm/core/orders/api/fetch.js +0 -17
- package/dist/esm/core/orders/api/fetch.js.map +0 -1
- package/dist/esm/core/orders/api/index.js +0 -31
- package/dist/esm/core/orders/api/index.js.map +0 -1
- package/dist/esm/core/orders/common.js +0 -8
- package/dist/esm/core/orders/common.js.map +0 -1
- package/dist/esm/core/orders/cross-chain.js +0 -311
- package/dist/esm/core/orders/cross-chain.js.map +0 -1
- package/dist/esm/core/orders/dca-single-chain.js +0 -172
- package/dist/esm/core/orders/dca-single-chain.js.map +0 -1
- package/dist/esm/core/orders/single-chain.js +0 -197
- package/dist/esm/core/orders/single-chain.js.map +0 -1
- package/dist/esm/core/sdk.js +0 -86
- package/dist/esm/core/sdk.js.map +0 -1
- package/dist/esm/core/solana/cancel-order.js +0 -176
- package/dist/esm/core/solana/cancel-order.js.map +0 -1
- package/dist/esm/core/solana/client.js +0 -19
- package/dist/esm/core/solana/client.js.map +0 -1
- package/dist/esm/core/solana/dca/cancel-order.js +0 -61
- package/dist/esm/core/solana/dca/cancel-order.js.map +0 -1
- package/dist/esm/core/solana/dca/create-order.js +0 -82
- package/dist/esm/core/solana/dca/create-order.js.map +0 -1
- package/dist/esm/core/solana/dca/single-chain-dca-order.js +0 -23
- package/dist/esm/core/solana/dca/single-chain-dca-order.js.map +0 -1
- package/dist/esm/core/solana/dca/single-chain-limit-order.js +0 -29
- package/dist/esm/core/solana/dca/single-chain-limit-order.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/accounts/adminSingleton.js +0 -60
- package/dist/esm/core/solana/generated/cross-chain/accounts/adminSingleton.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/accounts/dcaOrder.js +0 -90
- package/dist/esm/core/solana/generated/cross-chain/accounts/dcaOrder.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/accounts/guard.js +0 -64
- package/dist/esm/core/solana/generated/cross-chain/accounts/guard.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/accounts/index.js +0 -12
- package/dist/esm/core/solana/generated/cross-chain/accounts/index.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/accounts/order.js +0 -78
- package/dist/esm/core/solana/generated/cross-chain/accounts/order.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/errors/index.js +0 -9
- package/dist/esm/core/solana/generated/cross-chain/errors/index.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/errors/sourceChainGuard.js +0 -140
- package/dist/esm/core/solana/generated/cross-chain/errors/sourceChainGuard.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/index.js +0 -13
- package/dist/esm/core/solana/generated/cross-chain/index.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/instructions/acceptAdmin.js +0 -88
- package/dist/esm/core/solana/generated/cross-chain/instructions/acceptAdmin.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/instructions/cancelDcaOrder.js +0 -118
- package/dist/esm/core/solana/generated/cross-chain/instructions/cancelDcaOrder.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/instructions/cancelOrder.js +0 -107
- package/dist/esm/core/solana/generated/cross-chain/instructions/cancelOrder.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/instructions/claimTokens.js +0 -127
- package/dist/esm/core/solana/generated/cross-chain/instructions/claimTokens.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/instructions/collectProtocolFees.js +0 -133
- package/dist/esm/core/solana/generated/cross-chain/instructions/collectProtocolFees.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/instructions/createDcaOrder.js +0 -170
- package/dist/esm/core/solana/generated/cross-chain/instructions/createDcaOrder.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/instructions/createGuard.js +0 -188
- package/dist/esm/core/solana/generated/cross-chain/instructions/createGuard.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/instructions/createOrder.js +0 -166
- package/dist/esm/core/solana/generated/cross-chain/instructions/createOrder.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/instructions/index.js +0 -22
- package/dist/esm/core/solana/generated/cross-chain/instructions/index.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/instructions/initialize.js +0 -126
- package/dist/esm/core/solana/generated/cross-chain/instructions/initialize.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/instructions/preStartOrderExecution.js +0 -110
- package/dist/esm/core/solana/generated/cross-chain/instructions/preStartOrderExecution.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/instructions/setAdmin.js +0 -98
- package/dist/esm/core/solana/generated/cross-chain/instructions/setAdmin.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/instructions/setAuctioneerPubKey.js +0 -111
- package/dist/esm/core/solana/generated/cross-chain/instructions/setAuctioneerPubKey.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/instructions/startOrderExecution.js +0 -98
- package/dist/esm/core/solana/generated/cross-chain/instructions/startOrderExecution.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/instructions/startOrderExecutionAfterSwap.js +0 -106
- package/dist/esm/core/solana/generated/cross-chain/instructions/startOrderExecutionAfterSwap.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/programs/index.js +0 -9
- package/dist/esm/core/solana/generated/cross-chain/programs/index.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/programs/sourceChainGuard.js +0 -98
- package/dist/esm/core/solana/generated/cross-chain/programs/sourceChainGuard.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/shared/index.js +0 -79
- package/dist/esm/core/solana/generated/cross-chain/shared/index.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/types/adminUpdateStarted.js +0 -18
- package/dist/esm/core/solana/generated/cross-chain/types/adminUpdateStarted.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/types/adminUpdated.js +0 -18
- package/dist/esm/core/solana/generated/cross-chain/types/adminUpdated.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/types/auctioneerPubkeyUpdated.js +0 -24
- package/dist/esm/core/solana/generated/cross-chain/types/auctioneerPubkeyUpdated.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/types/dcaExecutionStarted.js +0 -32
- package/dist/esm/core/solana/generated/cross-chain/types/dcaExecutionStarted.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/types/dcaOrderCreated.js +0 -42
- package/dist/esm/core/solana/generated/cross-chain/types/dcaOrderCreated.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/types/dcaOrderIntervalFulfilled.js +0 -26
- package/dist/esm/core/solana/generated/cross-chain/types/dcaOrderIntervalFulfilled.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/types/dcaTokenInSwapped.js +0 -28
- package/dist/esm/core/solana/generated/cross-chain/types/dcaTokenInSwapped.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/types/executionStarted.js +0 -30
- package/dist/esm/core/solana/generated/cross-chain/types/executionStarted.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/types/failedDcaIntervalExecution.js +0 -26
- package/dist/esm/core/solana/generated/cross-chain/types/failedDcaIntervalExecution.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/types/guardCreated.js +0 -28
- package/dist/esm/core/solana/generated/cross-chain/types/guardCreated.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/types/index.js +0 -22
- package/dist/esm/core/solana/generated/cross-chain/types/index.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/types/orderCancelled.js +0 -18
- package/dist/esm/core/solana/generated/cross-chain/types/orderCancelled.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/types/orderCreated.js +0 -36
- package/dist/esm/core/solana/generated/cross-chain/types/orderCreated.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/types/orderFulfilled.js +0 -18
- package/dist/esm/core/solana/generated/cross-chain/types/orderFulfilled.js.map +0 -1
- package/dist/esm/core/solana/generated/cross-chain/types/tokenInSwapped.js +0 -26
- package/dist/esm/core/solana/generated/cross-chain/types/tokenInSwapped.js.map +0 -1
- package/dist/esm/core/solana/generated/single-chain/accounts/adminSingleton.js +0 -60
- package/dist/esm/core/solana/generated/single-chain/accounts/adminSingleton.js.map +0 -1
- package/dist/esm/core/solana/generated/single-chain/accounts/dcaOrder.js +0 -75
- package/dist/esm/core/solana/generated/single-chain/accounts/dcaOrder.js.map +0 -1
- package/dist/esm/core/solana/generated/single-chain/accounts/guard.js +0 -62
- package/dist/esm/core/solana/generated/single-chain/accounts/guard.js.map +0 -1
- package/dist/esm/core/solana/generated/single-chain/accounts/index.js +0 -12
- package/dist/esm/core/solana/generated/single-chain/accounts/index.js.map +0 -1
- package/dist/esm/core/solana/generated/single-chain/accounts/limitOrder.js +0 -65
- package/dist/esm/core/solana/generated/single-chain/accounts/limitOrder.js.map +0 -1
- package/dist/esm/core/solana/generated/single-chain/errors/index.js +0 -9
- package/dist/esm/core/solana/generated/single-chain/errors/index.js.map +0 -1
- package/dist/esm/core/solana/generated/single-chain/errors/singleChainGuard.js +0 -101
- package/dist/esm/core/solana/generated/single-chain/errors/singleChainGuard.js.map +0 -1
- package/dist/esm/core/solana/generated/single-chain/index.js +0 -13
- package/dist/esm/core/solana/generated/single-chain/index.js.map +0 -1
- package/dist/esm/core/solana/generated/single-chain/instructions/acceptAdmin.js +0 -88
- package/dist/esm/core/solana/generated/single-chain/instructions/acceptAdmin.js.map +0 -1
- package/dist/esm/core/solana/generated/single-chain/instructions/cancelDcaOrder.js +0 -84
- package/dist/esm/core/solana/generated/single-chain/instructions/cancelDcaOrder.js.map +0 -1
- package/dist/esm/core/solana/generated/single-chain/instructions/cancelLimitOrder.js +0 -84
- package/dist/esm/core/solana/generated/single-chain/instructions/cancelLimitOrder.js.map +0 -1
- package/dist/esm/core/solana/generated/single-chain/instructions/collectProtocolFees.js +0 -121
- package/dist/esm/core/solana/generated/single-chain/instructions/collectProtocolFees.js.map +0 -1
- package/dist/esm/core/solana/generated/single-chain/instructions/createDcaOrder.js +0 -172
- package/dist/esm/core/solana/generated/single-chain/instructions/createDcaOrder.js.map +0 -1
- package/dist/esm/core/solana/generated/single-chain/instructions/createGuard.js +0 -163
- package/dist/esm/core/solana/generated/single-chain/instructions/createGuard.js.map +0 -1
- package/dist/esm/core/solana/generated/single-chain/instructions/createLimitOrder.js +0 -168
- package/dist/esm/core/solana/generated/single-chain/instructions/createLimitOrder.js.map +0 -1
- package/dist/esm/core/solana/generated/single-chain/instructions/fulfillDcaOrderInterval.js +0 -146
- package/dist/esm/core/solana/generated/single-chain/instructions/fulfillDcaOrderInterval.js.map +0 -1
- package/dist/esm/core/solana/generated/single-chain/instructions/fulfillLimitOrder.js +0 -146
- package/dist/esm/core/solana/generated/single-chain/instructions/fulfillLimitOrder.js.map +0 -1
- package/dist/esm/core/solana/generated/single-chain/instructions/index.js +0 -20
- package/dist/esm/core/solana/generated/single-chain/instructions/index.js.map +0 -1
- package/dist/esm/core/solana/generated/single-chain/instructions/initialize.js +0 -126
- package/dist/esm/core/solana/generated/single-chain/instructions/initialize.js.map +0 -1
- package/dist/esm/core/solana/generated/single-chain/instructions/setAdmin.js +0 -98
- package/dist/esm/core/solana/generated/single-chain/instructions/setAdmin.js.map +0 -1
- package/dist/esm/core/solana/generated/single-chain/instructions/setAuctioneerPubKey.js +0 -111
- package/dist/esm/core/solana/generated/single-chain/instructions/setAuctioneerPubKey.js.map +0 -1
- package/dist/esm/core/solana/generated/single-chain/programs/index.js +0 -9
- package/dist/esm/core/solana/generated/single-chain/programs/index.js.map +0 -1
- package/dist/esm/core/solana/generated/single-chain/programs/singleChainGuard.js +0 -90
- package/dist/esm/core/solana/generated/single-chain/programs/singleChainGuard.js.map +0 -1
- package/dist/esm/core/solana/generated/single-chain/shared/index.js +0 -79
- package/dist/esm/core/solana/generated/single-chain/shared/index.js.map +0 -1
- package/dist/esm/core/solana/generated/single-chain/types/adminUpdateStarted.js +0 -18
- package/dist/esm/core/solana/generated/single-chain/types/adminUpdateStarted.js.map +0 -1
- package/dist/esm/core/solana/generated/single-chain/types/adminUpdated.js +0 -18
- package/dist/esm/core/solana/generated/single-chain/types/adminUpdated.js.map +0 -1
- package/dist/esm/core/solana/generated/single-chain/types/auctioneerPubkeyUpdated.js +0 -24
- package/dist/esm/core/solana/generated/single-chain/types/auctioneerPubkeyUpdated.js.map +0 -1
- package/dist/esm/core/solana/generated/single-chain/types/dcaOrderCreated.js +0 -42
- package/dist/esm/core/solana/generated/single-chain/types/dcaOrderCreated.js.map +0 -1
- package/dist/esm/core/solana/generated/single-chain/types/dcaOrderFulfilled.js +0 -18
- package/dist/esm/core/solana/generated/single-chain/types/dcaOrderFulfilled.js.map +0 -1
- package/dist/esm/core/solana/generated/single-chain/types/dcaOrderIntervalFulfilled.js +0 -30
- package/dist/esm/core/solana/generated/single-chain/types/dcaOrderIntervalFulfilled.js.map +0 -1
- package/dist/esm/core/solana/generated/single-chain/types/guardCreated.js +0 -26
- package/dist/esm/core/solana/generated/single-chain/types/guardCreated.js.map +0 -1
- package/dist/esm/core/solana/generated/single-chain/types/index.js +0 -18
- package/dist/esm/core/solana/generated/single-chain/types/index.js.map +0 -1
- package/dist/esm/core/solana/generated/single-chain/types/limitOrderCreated.js +0 -36
- package/dist/esm/core/solana/generated/single-chain/types/limitOrderCreated.js.map +0 -1
- package/dist/esm/core/solana/generated/single-chain/types/limitOrderFulfilled.js +0 -24
- package/dist/esm/core/solana/generated/single-chain/types/limitOrderFulfilled.js.map +0 -1
- package/dist/esm/core/solana/generated/single-chain/types/orderCancelled.js +0 -18
- package/dist/esm/core/solana/generated/single-chain/types/orderCancelled.js.map +0 -1
- package/dist/esm/core/solana/inspect.js +0 -43
- package/dist/esm/core/solana/inspect.js.map +0 -1
- package/dist/esm/core/solana/intent-helpers.js +0 -180
- package/dist/esm/core/solana/intent-helpers.js.map +0 -1
- package/dist/esm/core/solana/order-instructions.js +0 -163
- package/dist/esm/core/solana/order-instructions.js.map +0 -1
- package/dist/esm/core/solana/sdk.js +0 -220
- package/dist/esm/core/solana/sdk.js.map +0 -1
- package/dist/esm/core/solana/utils.js +0 -19
- package/dist/esm/core/solana/utils.js.map +0 -1
- package/dist/esm/core/solana/validator.js +0 -28
- package/dist/esm/core/solana/validator.js.map +0 -1
- package/dist/esm/core/sui/cancel.js +0 -36
- package/dist/esm/core/sui/cancel.js.map +0 -1
- package/dist/esm/core/sui/client.js +0 -3
- package/dist/esm/core/sui/client.js.map +0 -1
- package/dist/esm/core/sui/cross-chain-limit-order.js +0 -9
- package/dist/esm/core/sui/cross-chain-limit-order.js.map +0 -1
- package/dist/esm/core/sui/intent-helpers.js +0 -140
- package/dist/esm/core/sui/intent-helpers.js.map +0 -1
- package/dist/esm/core/sui/order-transaction.js +0 -58
- package/dist/esm/core/sui/order-transaction.js.map +0 -1
- package/dist/esm/core/sui/sdk.js +0 -119
- package/dist/esm/core/sui/sdk.js.map +0 -1
- package/dist/esm/core/sui/single-chain-dca-order.js +0 -99
- package/dist/esm/core/sui/single-chain-dca-order.js.map +0 -1
- package/dist/esm/core/sui/single-chain-limit-order.js +0 -103
- package/dist/esm/core/sui/single-chain-limit-order.js.map +0 -1
- package/dist/esm/core/sui/validator.js +0 -31
- package/dist/esm/core/sui/validator.js.map +0 -1
- package/dist/esm/errors/index.js +0 -68
- package/dist/esm/errors/index.js.map +0 -1
- package/dist/esm/index.js +0 -41
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/types/api.js +0 -7
- package/dist/esm/types/api.js.map +0 -1
- package/dist/esm/types/intent.js +0 -2
- package/dist/esm/types/intent.js.map +0 -1
- package/dist/esm/types/token-list.js +0 -2
- package/dist/esm/types/token-list.js.map +0 -1
- package/dist/esm/utils/base-validator.js +0 -91
- package/dist/esm/utils/base-validator.js.map +0 -1
- package/dist/esm/utils/defillama.js +0 -104
- package/dist/esm/utils/defillama.js.map +0 -1
- package/dist/esm/utils/generate-execution-details-hash.js +0 -15
- package/dist/esm/utils/generate-execution-details-hash.js.map +0 -1
- package/dist/esm/utils/logger.js +0 -109
- package/dist/esm/utils/logger.js.map +0 -1
- package/dist/esm/utils/order-validator.js +0 -112
- package/dist/esm/utils/order-validator.js.map +0 -1
- package/dist/esm/utils/parsers.js +0 -28
- package/dist/esm/utils/parsers.js.map +0 -1
- package/dist/esm/utils/quote/aftermath.js +0 -15
- package/dist/esm/utils/quote/aftermath.js.map +0 -1
- package/dist/esm/utils/quote/aggregator.js +0 -329
- package/dist/esm/utils/quote/aggregator.js.map +0 -1
- package/dist/esm/utils/quote/jupiter.js +0 -31
- package/dist/esm/utils/quote/jupiter.js.map +0 -1
- package/dist/esm/utils/quote/liquidswap.js +0 -22
- package/dist/esm/utils/quote/liquidswap.js.map +0 -1
- package/dist/esm/utils/quote/paraswap.js +0 -67
- package/dist/esm/utils/quote/paraswap.js.map +0 -1
- package/dist/esm/utils/quote/raydium.js +0 -82
- package/dist/esm/utils/quote/raydium.js.map +0 -1
- package/dist/esm/utils/quote/stablecoins-tokens.js +0 -13
- package/dist/esm/utils/quote/stablecoins-tokens.js.map +0 -1
- package/dist/esm/utils/tokens/index.js +0 -37
- package/dist/esm/utils/tokens/index.js.map +0 -1
- package/dist/esm/utils/type-utils.js +0 -2
- package/dist/esm/utils/type-utils.js.map +0 -1
- package/dist/types/auth/siwe.d.ts +0 -13
- package/dist/types/auth/siwe.d.ts.map +0 -1
- package/dist/types/chains.d.ts +0 -62
- package/dist/types/chains.d.ts.map +0 -1
- package/dist/types/config.d.ts +0 -21
- package/dist/types/config.d.ts.map +0 -1
- package/dist/types/constants.d.ts +0 -44
- package/dist/types/constants.d.ts.map +0 -1
- package/dist/types/core/evm/abi/erc20.d.ts +0 -240
- package/dist/types/core/evm/abi/erc20.d.ts.map +0 -1
- package/dist/types/core/evm/abi/permit2.d.ts +0 -304
- package/dist/types/core/evm/abi/permit2.d.ts.map +0 -1
- package/dist/types/core/evm/abi/single-chain-guard-limit.d.ts +0 -596
- package/dist/types/core/evm/abi/single-chain-guard-limit.d.ts.map +0 -1
- package/dist/types/core/evm/abi/source-chain-guard.d.ts +0 -877
- package/dist/types/core/evm/abi/source-chain-guard.d.ts.map +0 -1
- package/dist/types/core/evm/cancel-order.d.ts +0 -28
- package/dist/types/core/evm/cancel-order.d.ts.map +0 -1
- package/dist/types/core/evm/chain-provider.d.ts +0 -62338
- package/dist/types/core/evm/chain-provider.d.ts.map +0 -1
- package/dist/types/core/evm/connectors/hyperevm.d.ts +0 -38
- package/dist/types/core/evm/connectors/hyperevm.d.ts.map +0 -1
- package/dist/types/core/evm/cross-chain-limit-order.d.ts +0 -22
- package/dist/types/core/evm/cross-chain-limit-order.d.ts.map +0 -1
- package/dist/types/core/evm/intent-helpers.d.ts +0 -105
- package/dist/types/core/evm/intent-helpers.d.ts.map +0 -1
- package/dist/types/core/evm/intent-provider.d.ts +0 -19
- package/dist/types/core/evm/intent-provider.d.ts.map +0 -1
- package/dist/types/core/evm/order-signature.d.ts +0 -22
- package/dist/types/core/evm/order-signature.d.ts.map +0 -1
- package/dist/types/core/evm/permit2.d.ts +0 -261
- package/dist/types/core/evm/permit2.d.ts.map +0 -1
- package/dist/types/core/evm/sdk.d.ts +0 -63
- package/dist/types/core/evm/sdk.d.ts.map +0 -1
- package/dist/types/core/evm/single-chain-dca-order.d.ts +0 -26
- package/dist/types/core/evm/single-chain-dca-order.d.ts.map +0 -1
- package/dist/types/core/evm/single-chain-limit-order.d.ts +0 -23
- package/dist/types/core/evm/single-chain-limit-order.d.ts.map +0 -1
- package/dist/types/core/evm/types.d.ts +0 -8
- package/dist/types/core/evm/types.d.ts.map +0 -1
- package/dist/types/core/evm/validator.d.ts +0 -23
- package/dist/types/core/evm/validator.d.ts.map +0 -1
- package/dist/types/core/orders/api/fetch.d.ts +0 -3
- package/dist/types/core/orders/api/fetch.d.ts.map +0 -1
- package/dist/types/core/orders/api/index.d.ts +0 -8
- package/dist/types/core/orders/api/index.d.ts.map +0 -1
- package/dist/types/core/orders/common.d.ts +0 -12
- package/dist/types/core/orders/common.d.ts.map +0 -1
- package/dist/types/core/orders/cross-chain.d.ts +0 -123
- package/dist/types/core/orders/cross-chain.d.ts.map +0 -1
- package/dist/types/core/orders/dca-single-chain.d.ts +0 -47
- package/dist/types/core/orders/dca-single-chain.d.ts.map +0 -1
- package/dist/types/core/orders/single-chain.d.ts +0 -47
- package/dist/types/core/orders/single-chain.d.ts.map +0 -1
- package/dist/types/core/sdk.d.ts +0 -30
- package/dist/types/core/sdk.d.ts.map +0 -1
- package/dist/types/core/solana/cancel-order.d.ts +0 -18
- package/dist/types/core/solana/cancel-order.d.ts.map +0 -1
- package/dist/types/core/solana/client.d.ts +0 -11
- package/dist/types/core/solana/client.d.ts.map +0 -1
- package/dist/types/core/solana/dca/cancel-order.d.ts +0 -5
- package/dist/types/core/solana/dca/cancel-order.d.ts.map +0 -1
- package/dist/types/core/solana/dca/create-order.d.ts +0 -8
- package/dist/types/core/solana/dca/create-order.d.ts.map +0 -1
- package/dist/types/core/solana/dca/single-chain-dca-order.d.ts +0 -14
- package/dist/types/core/solana/dca/single-chain-dca-order.d.ts.map +0 -1
- package/dist/types/core/solana/dca/single-chain-limit-order.d.ts +0 -19
- package/dist/types/core/solana/dca/single-chain-limit-order.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/accounts/adminSingleton.d.ts +0 -40
- package/dist/types/core/solana/generated/cross-chain/accounts/adminSingleton.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/accounts/dcaOrder.d.ts +0 -110
- package/dist/types/core/solana/generated/cross-chain/accounts/dcaOrder.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/accounts/guard.d.ts +0 -52
- package/dist/types/core/solana/generated/cross-chain/accounts/guard.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/accounts/index.d.ts +0 -12
- package/dist/types/core/solana/generated/cross-chain/accounts/index.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/accounts/order.d.ts +0 -92
- package/dist/types/core/solana/generated/cross-chain/accounts/order.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/errors/index.d.ts +0 -9
- package/dist/types/core/solana/generated/cross-chain/errors/index.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/errors/sourceChainGuard.d.ts +0 -97
- package/dist/types/core/solana/generated/cross-chain/errors/sourceChainGuard.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/index.d.ts +0 -13
- package/dist/types/core/solana/generated/cross-chain/index.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/instructions/acceptAdmin.d.ts +0 -56
- package/dist/types/core/solana/generated/cross-chain/instructions/acceptAdmin.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/instructions/cancelDcaOrder.d.ts +0 -124
- package/dist/types/core/solana/generated/cross-chain/instructions/cancelDcaOrder.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/instructions/cancelOrder.d.ts +0 -108
- package/dist/types/core/solana/generated/cross-chain/instructions/cancelOrder.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/instructions/claimTokens.d.ts +0 -131
- package/dist/types/core/solana/generated/cross-chain/instructions/claimTokens.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/instructions/collectProtocolFees.d.ts +0 -91
- package/dist/types/core/solana/generated/cross-chain/instructions/collectProtocolFees.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/instructions/createDcaOrder.d.ts +0 -130
- package/dist/types/core/solana/generated/cross-chain/instructions/createDcaOrder.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/instructions/createGuard.d.ts +0 -137
- package/dist/types/core/solana/generated/cross-chain/instructions/createGuard.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/instructions/createOrder.d.ts +0 -122
- package/dist/types/core/solana/generated/cross-chain/instructions/createOrder.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/instructions/index.d.ts +0 -22
- package/dist/types/core/solana/generated/cross-chain/instructions/index.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/instructions/initialize.d.ts +0 -86
- package/dist/types/core/solana/generated/cross-chain/instructions/initialize.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/instructions/preStartOrderExecution.d.ts +0 -105
- package/dist/types/core/solana/generated/cross-chain/instructions/preStartOrderExecution.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/instructions/setAdmin.d.ts +0 -61
- package/dist/types/core/solana/generated/cross-chain/instructions/setAdmin.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/instructions/setAuctioneerPubKey.d.ts +0 -68
- package/dist/types/core/solana/generated/cross-chain/instructions/setAuctioneerPubKey.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/instructions/startOrderExecution.d.ts +0 -85
- package/dist/types/core/solana/generated/cross-chain/instructions/startOrderExecution.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/instructions/startOrderExecutionAfterSwap.d.ts +0 -95
- package/dist/types/core/solana/generated/cross-chain/instructions/startOrderExecutionAfterSwap.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/programs/index.d.ts +0 -9
- package/dist/types/core/solana/generated/cross-chain/programs/index.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/programs/sourceChainGuard.d.ts +0 -69
- package/dist/types/core/solana/generated/cross-chain/programs/sourceChainGuard.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/shared/index.d.ts +0 -52
- package/dist/types/core/solana/generated/cross-chain/shared/index.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/types/adminUpdateStarted.d.ts +0 -16
- package/dist/types/core/solana/generated/cross-chain/types/adminUpdateStarted.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/types/adminUpdated.d.ts +0 -16
- package/dist/types/core/solana/generated/cross-chain/types/adminUpdated.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/types/auctioneerPubkeyUpdated.d.ts +0 -17
- package/dist/types/core/solana/generated/cross-chain/types/auctioneerPubkeyUpdated.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/types/dcaExecutionStarted.d.ts +0 -28
- package/dist/types/core/solana/generated/cross-chain/types/dcaExecutionStarted.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/types/dcaOrderCreated.d.ts +0 -38
- package/dist/types/core/solana/generated/cross-chain/types/dcaOrderCreated.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/types/dcaOrderIntervalFulfilled.d.ts +0 -18
- package/dist/types/core/solana/generated/cross-chain/types/dcaOrderIntervalFulfilled.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/types/dcaTokenInSwapped.d.ts +0 -24
- package/dist/types/core/solana/generated/cross-chain/types/dcaTokenInSwapped.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/types/executionStarted.d.ts +0 -26
- package/dist/types/core/solana/generated/cross-chain/types/executionStarted.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/types/failedDcaIntervalExecution.d.ts +0 -18
- package/dist/types/core/solana/generated/cross-chain/types/failedDcaIntervalExecution.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/types/guardCreated.d.ts +0 -19
- package/dist/types/core/solana/generated/cross-chain/types/guardCreated.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/types/index.d.ts +0 -22
- package/dist/types/core/solana/generated/cross-chain/types/index.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/types/orderCancelled.d.ts +0 -16
- package/dist/types/core/solana/generated/cross-chain/types/orderCancelled.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/types/orderCreated.d.ts +0 -32
- package/dist/types/core/solana/generated/cross-chain/types/orderCreated.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/types/orderFulfilled.d.ts +0 -16
- package/dist/types/core/solana/generated/cross-chain/types/orderFulfilled.d.ts.map +0 -1
- package/dist/types/core/solana/generated/cross-chain/types/tokenInSwapped.d.ts +0 -22
- package/dist/types/core/solana/generated/cross-chain/types/tokenInSwapped.d.ts.map +0 -1
- package/dist/types/core/solana/generated/single-chain/accounts/adminSingleton.d.ts +0 -40
- package/dist/types/core/solana/generated/single-chain/accounts/adminSingleton.d.ts.map +0 -1
- package/dist/types/core/solana/generated/single-chain/accounts/dcaOrder.d.ts +0 -99
- package/dist/types/core/solana/generated/single-chain/accounts/dcaOrder.d.ts.map +0 -1
- package/dist/types/core/solana/generated/single-chain/accounts/guard.d.ts +0 -48
- package/dist/types/core/solana/generated/single-chain/accounts/guard.d.ts.map +0 -1
- package/dist/types/core/solana/generated/single-chain/accounts/index.d.ts +0 -12
- package/dist/types/core/solana/generated/single-chain/accounts/index.d.ts.map +0 -1
- package/dist/types/core/solana/generated/single-chain/accounts/limitOrder.d.ts +0 -79
- package/dist/types/core/solana/generated/single-chain/accounts/limitOrder.d.ts.map +0 -1
- package/dist/types/core/solana/generated/single-chain/errors/index.d.ts +0 -9
- package/dist/types/core/solana/generated/single-chain/errors/index.d.ts.map +0 -1
- package/dist/types/core/solana/generated/single-chain/errors/singleChainGuard.d.ts +0 -71
- package/dist/types/core/solana/generated/single-chain/errors/singleChainGuard.d.ts.map +0 -1
- package/dist/types/core/solana/generated/single-chain/index.d.ts +0 -13
- package/dist/types/core/solana/generated/single-chain/index.d.ts.map +0 -1
- package/dist/types/core/solana/generated/single-chain/instructions/acceptAdmin.d.ts +0 -56
- package/dist/types/core/solana/generated/single-chain/instructions/acceptAdmin.d.ts.map +0 -1
- package/dist/types/core/solana/generated/single-chain/instructions/cancelDcaOrder.d.ts +0 -72
- package/dist/types/core/solana/generated/single-chain/instructions/cancelDcaOrder.d.ts.map +0 -1
- package/dist/types/core/solana/generated/single-chain/instructions/cancelLimitOrder.d.ts +0 -72
- package/dist/types/core/solana/generated/single-chain/instructions/cancelLimitOrder.d.ts.map +0 -1
- package/dist/types/core/solana/generated/single-chain/instructions/collectProtocolFees.d.ts +0 -91
- package/dist/types/core/solana/generated/single-chain/instructions/collectProtocolFees.d.ts.map +0 -1
- package/dist/types/core/solana/generated/single-chain/instructions/createDcaOrder.d.ts +0 -134
- package/dist/types/core/solana/generated/single-chain/instructions/createDcaOrder.d.ts.map +0 -1
- package/dist/types/core/solana/generated/single-chain/instructions/createGuard.d.ts +0 -107
- package/dist/types/core/solana/generated/single-chain/instructions/createGuard.d.ts.map +0 -1
- package/dist/types/core/solana/generated/single-chain/instructions/createLimitOrder.d.ts +0 -126
- package/dist/types/core/solana/generated/single-chain/instructions/createLimitOrder.d.ts.map +0 -1
- package/dist/types/core/solana/generated/single-chain/instructions/fulfillDcaOrderInterval.d.ts +0 -179
- package/dist/types/core/solana/generated/single-chain/instructions/fulfillDcaOrderInterval.d.ts.map +0 -1
- package/dist/types/core/solana/generated/single-chain/instructions/fulfillLimitOrder.d.ts +0 -179
- package/dist/types/core/solana/generated/single-chain/instructions/fulfillLimitOrder.d.ts.map +0 -1
- package/dist/types/core/solana/generated/single-chain/instructions/index.d.ts +0 -20
- package/dist/types/core/solana/generated/single-chain/instructions/index.d.ts.map +0 -1
- package/dist/types/core/solana/generated/single-chain/instructions/initialize.d.ts +0 -86
- package/dist/types/core/solana/generated/single-chain/instructions/initialize.d.ts.map +0 -1
- package/dist/types/core/solana/generated/single-chain/instructions/setAdmin.d.ts +0 -61
- package/dist/types/core/solana/generated/single-chain/instructions/setAdmin.d.ts.map +0 -1
- package/dist/types/core/solana/generated/single-chain/instructions/setAuctioneerPubKey.d.ts +0 -68
- package/dist/types/core/solana/generated/single-chain/instructions/setAuctioneerPubKey.d.ts.map +0 -1
- package/dist/types/core/solana/generated/single-chain/programs/index.d.ts +0 -9
- package/dist/types/core/solana/generated/single-chain/programs/index.d.ts.map +0 -1
- package/dist/types/core/solana/generated/single-chain/programs/singleChainGuard.d.ts +0 -63
- package/dist/types/core/solana/generated/single-chain/programs/singleChainGuard.d.ts.map +0 -1
- package/dist/types/core/solana/generated/single-chain/shared/index.d.ts +0 -52
- package/dist/types/core/solana/generated/single-chain/shared/index.d.ts.map +0 -1
- package/dist/types/core/solana/generated/single-chain/types/adminUpdateStarted.d.ts +0 -16
- package/dist/types/core/solana/generated/single-chain/types/adminUpdateStarted.d.ts.map +0 -1
- package/dist/types/core/solana/generated/single-chain/types/adminUpdated.d.ts +0 -16
- package/dist/types/core/solana/generated/single-chain/types/adminUpdated.d.ts.map +0 -1
- package/dist/types/core/solana/generated/single-chain/types/auctioneerPubkeyUpdated.d.ts +0 -17
- package/dist/types/core/solana/generated/single-chain/types/auctioneerPubkeyUpdated.d.ts.map +0 -1
- package/dist/types/core/solana/generated/single-chain/types/dcaOrderCreated.d.ts +0 -38
- package/dist/types/core/solana/generated/single-chain/types/dcaOrderCreated.d.ts.map +0 -1
- package/dist/types/core/solana/generated/single-chain/types/dcaOrderFulfilled.d.ts +0 -16
- package/dist/types/core/solana/generated/single-chain/types/dcaOrderFulfilled.d.ts.map +0 -1
- package/dist/types/core/solana/generated/single-chain/types/dcaOrderIntervalFulfilled.d.ts +0 -26
- package/dist/types/core/solana/generated/single-chain/types/dcaOrderIntervalFulfilled.d.ts.map +0 -1
- package/dist/types/core/solana/generated/single-chain/types/guardCreated.d.ts +0 -18
- package/dist/types/core/solana/generated/single-chain/types/guardCreated.d.ts.map +0 -1
- package/dist/types/core/solana/generated/single-chain/types/index.d.ts +0 -18
- package/dist/types/core/solana/generated/single-chain/types/index.d.ts.map +0 -1
- package/dist/types/core/solana/generated/single-chain/types/limitOrderCreated.d.ts +0 -32
- package/dist/types/core/solana/generated/single-chain/types/limitOrderCreated.d.ts.map +0 -1
- package/dist/types/core/solana/generated/single-chain/types/limitOrderFulfilled.d.ts +0 -20
- package/dist/types/core/solana/generated/single-chain/types/limitOrderFulfilled.d.ts.map +0 -1
- package/dist/types/core/solana/generated/single-chain/types/orderCancelled.d.ts +0 -16
- package/dist/types/core/solana/generated/single-chain/types/orderCancelled.d.ts.map +0 -1
- package/dist/types/core/solana/inspect.d.ts +0 -14
- package/dist/types/core/solana/inspect.d.ts.map +0 -1
- package/dist/types/core/solana/intent-helpers.d.ts +0 -120
- package/dist/types/core/solana/intent-helpers.d.ts.map +0 -1
- package/dist/types/core/solana/order-instructions.d.ts +0 -16
- package/dist/types/core/solana/order-instructions.d.ts.map +0 -1
- package/dist/types/core/solana/sdk.d.ts +0 -73
- package/dist/types/core/solana/sdk.d.ts.map +0 -1
- package/dist/types/core/solana/utils.d.ts +0 -7
- package/dist/types/core/solana/utils.d.ts.map +0 -1
- package/dist/types/core/solana/validator.d.ts +0 -11
- package/dist/types/core/solana/validator.d.ts.map +0 -1
- package/dist/types/core/sui/cancel.d.ts +0 -3
- package/dist/types/core/sui/cancel.d.ts.map +0 -1
- package/dist/types/core/sui/client.d.ts +0 -3
- package/dist/types/core/sui/client.d.ts.map +0 -1
- package/dist/types/core/sui/cross-chain-limit-order.d.ts +0 -5
- package/dist/types/core/sui/cross-chain-limit-order.d.ts.map +0 -1
- package/dist/types/core/sui/intent-helpers.d.ts +0 -90
- package/dist/types/core/sui/intent-helpers.d.ts.map +0 -1
- package/dist/types/core/sui/order-transaction.d.ts +0 -11
- package/dist/types/core/sui/order-transaction.d.ts.map +0 -1
- package/dist/types/core/sui/sdk.d.ts +0 -57
- package/dist/types/core/sui/sdk.d.ts.map +0 -1
- package/dist/types/core/sui/single-chain-dca-order.d.ts +0 -22
- package/dist/types/core/sui/single-chain-dca-order.d.ts.map +0 -1
- package/dist/types/core/sui/single-chain-limit-order.d.ts +0 -26
- package/dist/types/core/sui/single-chain-limit-order.d.ts.map +0 -1
- package/dist/types/core/sui/validator.d.ts +0 -11
- package/dist/types/core/sui/validator.d.ts.map +0 -1
- package/dist/types/errors/index.d.ts +0 -20
- package/dist/types/errors/index.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -43
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/types/api.d.ts +0 -65
- package/dist/types/types/api.d.ts.map +0 -1
- package/dist/types/types/intent.d.ts +0 -136
- package/dist/types/types/intent.d.ts.map +0 -1
- package/dist/types/types/token-list.d.ts +0 -30
- package/dist/types/types/token-list.d.ts.map +0 -1
- package/dist/types/utils/base-validator.d.ts +0 -46
- package/dist/types/utils/base-validator.d.ts.map +0 -1
- package/dist/types/utils/defillama.d.ts +0 -61
- package/dist/types/utils/defillama.d.ts.map +0 -1
- package/dist/types/utils/generate-execution-details-hash.d.ts +0 -11
- package/dist/types/utils/generate-execution-details-hash.d.ts.map +0 -1
- package/dist/types/utils/logger.d.ts +0 -35
- package/dist/types/utils/logger.d.ts.map +0 -1
- package/dist/types/utils/order-validator.d.ts +0 -64
- package/dist/types/utils/order-validator.d.ts.map +0 -1
- package/dist/types/utils/parsers.d.ts +0 -6
- package/dist/types/utils/parsers.d.ts.map +0 -1
- package/dist/types/utils/quote/aftermath.d.ts +0 -9
- package/dist/types/utils/quote/aftermath.d.ts.map +0 -1
- package/dist/types/utils/quote/aggregator.d.ts +0 -80
- package/dist/types/utils/quote/aggregator.d.ts.map +0 -1
- package/dist/types/utils/quote/jupiter.d.ts +0 -16
- package/dist/types/utils/quote/jupiter.d.ts.map +0 -1
- package/dist/types/utils/quote/liquidswap.d.ts +0 -16
- package/dist/types/utils/quote/liquidswap.d.ts.map +0 -1
- package/dist/types/utils/quote/paraswap.d.ts +0 -23
- package/dist/types/utils/quote/paraswap.d.ts.map +0 -1
- package/dist/types/utils/quote/raydium.d.ts +0 -79
- package/dist/types/utils/quote/raydium.d.ts.map +0 -1
- package/dist/types/utils/quote/stablecoins-tokens.d.ts +0 -11
- package/dist/types/utils/quote/stablecoins-tokens.d.ts.map +0 -1
- package/dist/types/utils/tokens/index.d.ts +0 -20
- package/dist/types/utils/tokens/index.d.ts.map +0 -1
- package/dist/types/utils/type-utils.d.ts +0 -2
- package/dist/types/utils/type-utils.d.ts.map +0 -1
|
@@ -2,16 +2,18 @@ import { ChainID, isEvmChain, type SupportedEvmChain } from '../../chains.js';
|
|
|
2
2
|
import { JupiterQuoteProvider } from './jupiter.js';
|
|
3
3
|
import { type QuoteResponse as JupiterQuoteResponse } from '@jup-ag/api';
|
|
4
4
|
import { ParaswapQuoteProvider, type SwapEstimateResult } from './paraswap.js';
|
|
5
|
-
import {
|
|
5
|
+
import { CROSS_CHAIN_STABLES } from './stablecoins-tokens.js';
|
|
6
6
|
import { AftermathQuoteProvider } from './aftermath.js';
|
|
7
7
|
import type { RouterCompleteTradeRoute } from 'aftermath-ts-sdk';
|
|
8
|
-
import { calculateAmounts } from '../defillama.js';
|
|
9
8
|
import { LiquidSwapQuoteProvider, type LiquidSwapQuoteResponse } from './liquidswap.js';
|
|
10
|
-
import { RaydiumQuoteProvider, type RaydiumQuoteResponse } from './raydium.js';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
};
|
|
9
|
+
import { RaydiumQuoteProvider, type RaydiumPumpQuoteParams, type RaydiumQuoteResponse } from './raydium.js';
|
|
10
|
+
import { PumpFunQuoteProvider } from './pumpfun/index.js';
|
|
11
|
+
import { RelayQuoteProvider } from './relay.js';
|
|
12
|
+
import { convertDecimals } from './pricing/decimals.js';
|
|
13
|
+
import { estimateAmountOut, IntentNotViableError } from './pricing/estimate-amount-out.js';
|
|
14
|
+
import { estimateExpensesInTokenOut } from './pricing/expenses.js';
|
|
15
|
+
import { DEFAULT_COMMISSION_BPS, CROSS_CHAIN_COMMISSION_DENOMINATOR, EVM_CROSS_CHAIN_GAS_LIMIT } from './pricing/constants.js';
|
|
16
|
+
import { compareAddresses } from './address.js';
|
|
15
17
|
|
|
16
18
|
type SingleChainQuoteParams = {
|
|
17
19
|
chainId: ChainID;
|
|
@@ -22,11 +24,12 @@ type SingleChainQuoteParams = {
|
|
|
22
24
|
provider?: RouteProvider; // Optional provider override
|
|
23
25
|
};
|
|
24
26
|
|
|
25
|
-
export type RouteProvider = 'paraswap' | 'jupiter' | 'aftermath' | 'liquidswap' | 'raydium';
|
|
27
|
+
export type RouteProvider = 'paraswap' | 'jupiter' | 'aftermath' | 'liquidswap' | 'raydium' | 'pumpfun' | 'relay';
|
|
26
28
|
|
|
27
29
|
export type Quote = {
|
|
28
30
|
amountIn: bigint;
|
|
29
31
|
amountOut: bigint;
|
|
32
|
+
amountOutMin?: bigint; // Optional, for quotes that provide a minimum guaranteed output
|
|
30
33
|
amountOutUsd: number;
|
|
31
34
|
amountInUsd: number;
|
|
32
35
|
slippage: number;
|
|
@@ -35,6 +38,13 @@ export type Quote = {
|
|
|
35
38
|
rawQuote: any;
|
|
36
39
|
};
|
|
37
40
|
|
|
41
|
+
export type SimpleQuote = {
|
|
42
|
+
amountIn: bigint;
|
|
43
|
+
amountOut: bigint;
|
|
44
|
+
amountOutMin?: bigint;
|
|
45
|
+
slippage: number;
|
|
46
|
+
};
|
|
47
|
+
|
|
38
48
|
export type IntentsQuoteParams = {
|
|
39
49
|
sourceChainId: ChainID;
|
|
40
50
|
destChainId: ChainID;
|
|
@@ -43,7 +53,7 @@ export type IntentsQuoteParams = {
|
|
|
43
53
|
tokenOut: string;
|
|
44
54
|
};
|
|
45
55
|
|
|
46
|
-
export type
|
|
56
|
+
export type QuoteResponseInternal = {
|
|
47
57
|
amountInUsd: number;
|
|
48
58
|
estimatedAmountInAsMinStablecoinAmount: bigint;
|
|
49
59
|
|
|
@@ -54,44 +64,44 @@ export type QuoteResponse = {
|
|
|
54
64
|
estimatedAmountOutUsdReduced: number;
|
|
55
65
|
};
|
|
56
66
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
amountInUsd: 0,
|
|
72
|
-
estimatedAmountOutUsd: 0,
|
|
73
|
-
estimatedAmountOutUsdReduced: 0,
|
|
74
|
-
|
|
75
|
-
estimatedAmountInAsMinStablecoinAmount: defillamaQuote.minStablecoinsAmount,
|
|
76
|
-
estimatedAmountOut: defillamaQuote.amountOut,
|
|
77
|
-
estimatedAmountOutReduced: defillamaQuote.amountOut,
|
|
78
|
-
};
|
|
79
|
-
}
|
|
67
|
+
// Public response with metadata and derived fields
|
|
68
|
+
export type QuoteResponse = QuoteResponseInternal & {
|
|
69
|
+
/** Metadata for source token */
|
|
70
|
+
tokenIn: {
|
|
71
|
+
address: string;
|
|
72
|
+
chainId: ChainID;
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
/** Metadata for destination token */
|
|
76
|
+
tokenOut: {
|
|
77
|
+
address: string;
|
|
78
|
+
chainId: ChainID;
|
|
79
|
+
};
|
|
80
|
+
};
|
|
80
81
|
|
|
81
|
-
|
|
82
|
+
export class QuoteProvider {
|
|
83
|
+
public static async getQuote(params: IntentsQuoteParams): Promise<QuoteResponse> {
|
|
82
84
|
try {
|
|
83
85
|
const quote = await this.getQuoteFromRouters(params);
|
|
84
|
-
|
|
86
|
+
// Adapt QuoteResponseInternal to QuoteResponse by adding tokenIn and tokenOut metadata fields
|
|
87
|
+
return {
|
|
88
|
+
...quote,
|
|
89
|
+
tokenIn: {
|
|
90
|
+
address: params.tokenIn,
|
|
91
|
+
chainId: params.sourceChainId,
|
|
92
|
+
},
|
|
93
|
+
tokenOut: {
|
|
94
|
+
address: params.tokenOut,
|
|
95
|
+
chainId: params.destChainId,
|
|
96
|
+
},
|
|
97
|
+
};
|
|
85
98
|
} catch (e) {
|
|
86
|
-
|
|
87
|
-
|
|
99
|
+
if (e instanceof IntentNotViableError) throw e;
|
|
100
|
+
console.error('Error getting quote from routers:', e);
|
|
101
|
+
throw new Error('Failed to get quote from routers');
|
|
88
102
|
}
|
|
89
103
|
}
|
|
90
104
|
|
|
91
|
-
public static async getQuote(params: IntentsQuoteParams): Promise<QuoteResponse> {
|
|
92
|
-
return this.getQuoteWithDefillamaFallback(params);
|
|
93
|
-
}
|
|
94
|
-
|
|
95
105
|
/**
|
|
96
106
|
* Get a quote for Solana with explicit provider selection
|
|
97
107
|
* @param params - Quote parameters including provider preference
|
|
@@ -102,7 +112,7 @@ export class QuoteProvider {
|
|
|
102
112
|
tokenIn: string;
|
|
103
113
|
tokenOut: string;
|
|
104
114
|
slippageBps?: number;
|
|
105
|
-
provider?: 'jupiter' | 'raydium';
|
|
115
|
+
provider?: 'jupiter' | 'raydium' | 'pumpfun';
|
|
106
116
|
}): Promise<Quote> {
|
|
107
117
|
const singleChainParams: SingleChainQuoteParams = {
|
|
108
118
|
chainId: ChainID.Solana,
|
|
@@ -116,39 +126,57 @@ export class QuoteProvider {
|
|
|
116
126
|
return this.getSingleChainQuote(singleChainParams);
|
|
117
127
|
}
|
|
118
128
|
|
|
119
|
-
private static async getQuoteFromRouters(params: IntentsQuoteParams): Promise<
|
|
120
|
-
const
|
|
121
|
-
|
|
122
|
-
const sourceBridgeToken = CROSS_CHAIN_TOKENS[bridgeTokenSymbol]?.[params.sourceChainId] || '';
|
|
123
|
-
const destBridgeToken = CROSS_CHAIN_TOKENS[bridgeTokenSymbol]?.[params.destChainId] || '';
|
|
129
|
+
private static async getQuoteFromRouters(params: IntentsQuoteParams): Promise<QuoteResponseInternal> {
|
|
130
|
+
const sourceStable = getStableForChain(params.sourceChainId);
|
|
131
|
+
const destStable = getStableForChain(params.destChainId);
|
|
124
132
|
|
|
133
|
+
// Step 1: Get quote from tokenIn → bridge stable on source chain ---
|
|
125
134
|
const sourceSingleChainQuoteParams: SingleChainQuoteParams = {
|
|
126
135
|
chainId: params.sourceChainId,
|
|
127
136
|
amount: params.amount,
|
|
128
137
|
tokenIn: params.tokenIn,
|
|
129
|
-
tokenOut:
|
|
138
|
+
tokenOut: sourceStable.address,
|
|
130
139
|
};
|
|
131
140
|
|
|
132
|
-
const sourceQuote = await
|
|
141
|
+
const [sourceQuote, expenses] = await Promise.all([
|
|
142
|
+
this.getSingleChainQuote(sourceSingleChainQuoteParams),
|
|
143
|
+
estimateExpensesInTokenOut({
|
|
144
|
+
chainId: params.destChainId,
|
|
145
|
+
tokenOut: params.tokenOut,
|
|
146
|
+
gasLimit: EVM_CROSS_CHAIN_GAS_LIMIT,
|
|
147
|
+
getQuote: (p) => this.getSingleChainQuote(p),
|
|
148
|
+
}),
|
|
149
|
+
]);
|
|
150
|
+
|
|
151
|
+
// Step 2: Normalize stable amount between source and destination ---
|
|
152
|
+
// Adjust for decimal difference between stables (e.g. 6 → 18)
|
|
153
|
+
const normalizedBridgeAmount = convertDecimals(
|
|
154
|
+
sourceQuote.amountOut,
|
|
155
|
+
sourceStable.decimals,
|
|
156
|
+
destStable.decimals,
|
|
157
|
+
);
|
|
133
158
|
|
|
159
|
+
// Step 3: Get quote from dest bridge stable → target token ---
|
|
134
160
|
const destSingleChainQuoteParams: SingleChainQuoteParams = {
|
|
135
161
|
chainId: params.destChainId,
|
|
136
|
-
amount:
|
|
137
|
-
tokenIn:
|
|
162
|
+
amount: normalizedBridgeAmount,
|
|
163
|
+
tokenIn: destStable.address,
|
|
138
164
|
tokenOut: params.tokenOut,
|
|
139
165
|
};
|
|
140
166
|
|
|
141
167
|
const destQuote = await this.getSingleChainQuote(destSingleChainQuoteParams);
|
|
142
168
|
|
|
143
|
-
//
|
|
144
|
-
const weightedReductionFactor = this.calculateWeightedReductionFactorForUsd(destQuote.amountOutUsd);
|
|
145
|
-
|
|
146
|
-
const estimatedAmountOutReduced = BigInt(Math.floor(Number(destQuote.amountOut) * weightedReductionFactor));
|
|
147
|
-
const estimatedAmountOutUsdReduced = destQuote.amountOutUsd * weightedReductionFactor;
|
|
148
|
-
|
|
149
|
-
const reducedAmountInUsd = this.calculateWeightedReductionFactorForUsd(sourceQuote.amountInUsd);
|
|
169
|
+
// Step 4: Compute stable min-amount with correct decimals ---
|
|
150
170
|
const estimatedAmountInAsMinStablecoinAmount = BigInt(
|
|
151
|
-
Math.floor(
|
|
171
|
+
Math.floor(sourceQuote.amountInUsd * 10 ** sourceStable.decimals),
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
const swapOutput = destQuote.amountOutMin ?? destQuote.amountOut;
|
|
175
|
+
const estimatedAmountOutReduced = estimateAmountOut(
|
|
176
|
+
swapOutput,
|
|
177
|
+
DEFAULT_COMMISSION_BPS,
|
|
178
|
+
expenses,
|
|
179
|
+
CROSS_CHAIN_COMMISSION_DENOMINATOR,
|
|
152
180
|
);
|
|
153
181
|
|
|
154
182
|
return {
|
|
@@ -157,16 +185,23 @@ export class QuoteProvider {
|
|
|
157
185
|
amountInUsd: sourceQuote.amountInUsd,
|
|
158
186
|
estimatedAmountInAsMinStablecoinAmount,
|
|
159
187
|
estimatedAmountOutReduced,
|
|
160
|
-
estimatedAmountOutUsdReduced,
|
|
188
|
+
estimatedAmountOutUsdReduced: destQuote.amountOutUsd,
|
|
161
189
|
};
|
|
162
190
|
}
|
|
163
191
|
|
|
164
192
|
public static async getSingleChainQuote(params: SingleChainQuoteParams): Promise<Quote> {
|
|
193
|
+
// Handle same-token case (self-swap)
|
|
165
194
|
if (compareAddresses(params.tokenIn, params.tokenOut)) {
|
|
166
195
|
let amountUsd = 0;
|
|
167
196
|
|
|
168
|
-
|
|
169
|
-
|
|
197
|
+
// Pick correct stable for this chain
|
|
198
|
+
const stable = getStableForChain(params.chainId);
|
|
199
|
+
const stableAddress = stable.address;
|
|
200
|
+
const stableDecimals = stable.decimals;
|
|
201
|
+
|
|
202
|
+
// If it's the chain's stable token, derive USD value correctly
|
|
203
|
+
if (compareAddresses(params.tokenIn, stableAddress)) {
|
|
204
|
+
amountUsd = Number(params.amount) / 10 ** stableDecimals;
|
|
170
205
|
}
|
|
171
206
|
|
|
172
207
|
return {
|
|
@@ -181,44 +216,53 @@ export class QuoteProvider {
|
|
|
181
216
|
};
|
|
182
217
|
}
|
|
183
218
|
|
|
219
|
+
// Hyperliquid
|
|
184
220
|
if (params.chainId === ChainID.Hyperliquid) {
|
|
185
221
|
const liquidSwapQuote = await QuoteProvider.getLiquidSwapQuote(params);
|
|
186
222
|
return QuoteProvider.transformLiquidSwapQuote(liquidSwapQuote);
|
|
187
223
|
}
|
|
188
224
|
|
|
225
|
+
// Solana (Jupiter / Raydium / Pumpfun)
|
|
189
226
|
if (params.chainId === ChainID.Solana) {
|
|
190
|
-
// Check if provider is explicitly specified
|
|
191
227
|
if (params.provider === 'jupiter') {
|
|
192
228
|
const jupiterQuote = await QuoteProvider.getJupiterQuote(params);
|
|
193
229
|
return QuoteProvider.transformJupiterQuote(jupiterQuote);
|
|
194
230
|
} else if (params.provider === 'raydium') {
|
|
195
231
|
const raydiumQuote = await QuoteProvider.getRaydiumQuote(params);
|
|
196
|
-
return
|
|
232
|
+
return raydiumQuote;
|
|
233
|
+
} else if (params.provider === 'pumpfun') {
|
|
234
|
+
const pumpfunQuote = await QuoteProvider.getPumpFunQuote(params);
|
|
235
|
+
return pumpfunQuote;
|
|
197
236
|
} else {
|
|
198
|
-
// Default: Try Jupiter first, fallback to Raydium if it fails
|
|
199
237
|
try {
|
|
200
238
|
const jupiterQuote = await QuoteProvider.getJupiterQuote(params);
|
|
201
|
-
if(!jupiterQuote.quote)
|
|
202
|
-
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
const transformedQuote = QuoteProvider.transformJupiterQuote(jupiterQuote);
|
|
206
|
-
return transformedQuote;
|
|
239
|
+
if (!jupiterQuote.quote) throw new Error('Jupiter quote failed');
|
|
240
|
+
return QuoteProvider.transformJupiterQuote(jupiterQuote);
|
|
207
241
|
} catch (error) {
|
|
208
242
|
console.warn('Jupiter quote failed, falling back to Raydium:', error);
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
243
|
+
try {
|
|
244
|
+
const raydiumQuote = await QuoteProvider.getRaydiumQuote(params);
|
|
245
|
+
return raydiumQuote;
|
|
246
|
+
} catch {
|
|
247
|
+
const pumpfunQuote = await QuoteProvider.getPumpFunQuote(params);
|
|
248
|
+
return pumpfunQuote;
|
|
249
|
+
}
|
|
212
250
|
}
|
|
213
251
|
}
|
|
214
252
|
}
|
|
215
253
|
|
|
254
|
+
// Sui (Aftermath)
|
|
216
255
|
if (params.chainId === ChainID.Sui) {
|
|
217
256
|
const quote = await QuoteProvider.getAftermathQuote(params);
|
|
218
257
|
return QuoteProvider.transformAftermathQuote({ quote, request: params });
|
|
219
258
|
}
|
|
220
259
|
|
|
260
|
+
// EVM chains (Paraswap)
|
|
221
261
|
if (isEvmChain(params.chainId)) {
|
|
262
|
+
if (params.chainId === ChainID.MONAD) {
|
|
263
|
+
const relayQuote = await QuoteProvider.getRelayQuote(params);
|
|
264
|
+
return QuoteProvider.transformRelayQuote(relayQuote);
|
|
265
|
+
}
|
|
222
266
|
const paraswapQuote = await QuoteProvider.getParaswapQuote(params);
|
|
223
267
|
return QuoteProvider.transformParaswapQuote(paraswapQuote);
|
|
224
268
|
}
|
|
@@ -228,8 +272,8 @@ export class QuoteProvider {
|
|
|
228
272
|
|
|
229
273
|
static transformLiquidSwapQuote(liquidSwapQuote: LiquidSwapQuoteResponse): Quote {
|
|
230
274
|
return {
|
|
231
|
-
amountIn:
|
|
232
|
-
amountOut:
|
|
275
|
+
amountIn: liquidSwapQuote.execution.details.amountIn,
|
|
276
|
+
amountOut: liquidSwapQuote.execution.details.amountOut,
|
|
233
277
|
amountOutUsd: 0,
|
|
234
278
|
amountInUsd: 0,
|
|
235
279
|
slippage: 0,
|
|
@@ -263,7 +307,7 @@ export class QuoteProvider {
|
|
|
263
307
|
return liquidSwapQuoter.getQuote({
|
|
264
308
|
tokenIn: params.tokenIn,
|
|
265
309
|
tokenOut: params.tokenOut,
|
|
266
|
-
amountIn: params.amount
|
|
310
|
+
amountIn: params.amount,
|
|
267
311
|
});
|
|
268
312
|
}
|
|
269
313
|
|
|
@@ -275,7 +319,7 @@ export class QuoteProvider {
|
|
|
275
319
|
tokenIn: params.tokenIn,
|
|
276
320
|
tokenOut: params.tokenOut,
|
|
277
321
|
swapMode: 'ExactIn',
|
|
278
|
-
slippageBps: params.slippageBps,
|
|
322
|
+
slippageBps: params.slippageBps ? params.slippageBps : 20, // Default 0.2% slippage
|
|
279
323
|
});
|
|
280
324
|
}
|
|
281
325
|
|
|
@@ -289,7 +333,15 @@ export class QuoteProvider {
|
|
|
289
333
|
side: 'SELL',
|
|
290
334
|
});
|
|
291
335
|
}
|
|
336
|
+
protected static async getRelayQuote(params: SingleChainQuoteParams) {
|
|
337
|
+
const relayQuoter = new RelayQuoteProvider(params.chainId as SupportedEvmChain);
|
|
292
338
|
|
|
339
|
+
return relayQuoter.getSwapEstimation({
|
|
340
|
+
amount: BigInt(params.amount),
|
|
341
|
+
srcToken: params.tokenIn,
|
|
342
|
+
destToken: params.tokenOut,
|
|
343
|
+
});
|
|
344
|
+
}
|
|
293
345
|
protected static async getAftermathQuote(params: SingleChainQuoteParams) {
|
|
294
346
|
const aftermathQuoter = new AftermathQuoteProvider();
|
|
295
347
|
|
|
@@ -300,15 +352,34 @@ export class QuoteProvider {
|
|
|
300
352
|
});
|
|
301
353
|
}
|
|
302
354
|
|
|
303
|
-
|
|
355
|
+
//TODO: For Raydium and Pump we are applying slippage twice if there are 2 swaps (e.g., USDC -> SOL -> Token), should we just apply half and half on each swap?
|
|
356
|
+
|
|
357
|
+
protected static async getRaydiumQuote(params: SingleChainQuoteParams): Promise<Quote> {
|
|
304
358
|
const raydiumQuoter = new RaydiumQuoteProvider();
|
|
359
|
+
let request: RaydiumPumpQuoteParams = {
|
|
360
|
+
inputMint: params.tokenIn,
|
|
361
|
+
outputMint: params.tokenOut,
|
|
362
|
+
amount: params.amount.toString(),
|
|
363
|
+
slippageBps: params.slippageBps || 20, // Default 0.2% slippage
|
|
364
|
+
};
|
|
365
|
+
try {
|
|
366
|
+
return this.transformRaydiumQuote(await raydiumQuoter.getQuote(request));
|
|
367
|
+
} catch (e) {
|
|
368
|
+
console.log('Raydium AMM quote cannot find a route, trying with prebonded raydium');
|
|
369
|
+
return simpleQuoteToQuote(await raydiumQuoter.getQuotePrebonded(request), 'raydium');
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
protected static async getPumpFunQuote(params: SingleChainQuoteParams): Promise<Quote> {
|
|
374
|
+
const pumpfunQuoter = new PumpFunQuoteProvider();
|
|
305
375
|
|
|
306
|
-
|
|
376
|
+
let request: RaydiumPumpQuoteParams = {
|
|
307
377
|
inputMint: params.tokenIn,
|
|
308
378
|
outputMint: params.tokenOut,
|
|
309
379
|
amount: params.amount.toString(),
|
|
310
|
-
slippageBps: params.slippageBps ||
|
|
311
|
-
}
|
|
380
|
+
slippageBps: params.slippageBps || 20, // Default 0.2% slippage
|
|
381
|
+
};
|
|
382
|
+
return simpleQuoteToQuote(await pumpfunQuoter.getQuote(request), 'pumpfun');
|
|
312
383
|
}
|
|
313
384
|
|
|
314
385
|
private static transformAftermathQuote({
|
|
@@ -318,14 +389,18 @@ export class QuoteProvider {
|
|
|
318
389
|
quote: RouterCompleteTradeRoute;
|
|
319
390
|
request: SingleChainQuoteParams;
|
|
320
391
|
}): Quote {
|
|
321
|
-
|
|
392
|
+
const chainId = request.chainId;
|
|
393
|
+
const stable = getStableForChain(chainId);
|
|
394
|
+
const stableAddress = stable.address;
|
|
395
|
+
const stableDecimals = stable.decimals;
|
|
322
396
|
|
|
323
|
-
|
|
324
|
-
amountUsd = Number(quote.coinIn.amount) / 10 ** this.DEFAULT_BRIDGE_TOKEN_DECIMALS;
|
|
325
|
-
}
|
|
397
|
+
let amountUsd = 0;
|
|
326
398
|
|
|
327
|
-
if
|
|
328
|
-
|
|
399
|
+
// Determine if input or output token is the stablecoin
|
|
400
|
+
if (compareAddresses(request.tokenIn, stableAddress)) {
|
|
401
|
+
amountUsd = Number(quote.coinIn.amount) / 10 ** stableDecimals;
|
|
402
|
+
} else if (compareAddresses(request.tokenOut, stableAddress)) {
|
|
403
|
+
amountUsd = Number(quote.coinOut.amount) / 10 ** stableDecimals;
|
|
329
404
|
}
|
|
330
405
|
|
|
331
406
|
return {
|
|
@@ -352,25 +427,72 @@ export class QuoteProvider {
|
|
|
352
427
|
rawQuote: paraswapQuote,
|
|
353
428
|
};
|
|
354
429
|
}
|
|
430
|
+
private static transformRelayQuote(data: any): Quote {
|
|
431
|
+
const relayQuote = data.quote;
|
|
432
|
+
// If details missing → fallback zero quote
|
|
433
|
+
if (!relayQuote || !relayQuote.details) {
|
|
434
|
+
return {
|
|
435
|
+
amountIn: 0n,
|
|
436
|
+
amountOut: 0n,
|
|
437
|
+
amountOutUsd: 0,
|
|
438
|
+
amountInUsd: 0,
|
|
439
|
+
slippage: 0,
|
|
440
|
+
priceImpact: 0,
|
|
441
|
+
provider: 'relay',
|
|
442
|
+
rawQuote: relayQuote,
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
const details = relayQuote.details;
|
|
447
|
+
|
|
448
|
+
const amountIn = details?.currencyIn?.amount ? BigInt(details.currencyIn.amount) : 0n;
|
|
449
|
+
|
|
450
|
+
const amountOut = details?.currencyOut?.amount ? BigInt(details.currencyOut.amount) : 0n;
|
|
451
|
+
|
|
452
|
+
const amountInUsd = details?.currencyIn?.amountUsd ? Number(details.currencyIn.amountUsd) : 0;
|
|
453
|
+
|
|
454
|
+
const amountOutUsd = details?.currencyOut?.amountUsd ? Number(details.currencyOut.amountUsd) : 0;
|
|
455
|
+
|
|
456
|
+
const slippage = details?.slippageTolerance?.origin?.percent ? Number(details.slippageTolerance.origin.percent) : 0;
|
|
355
457
|
|
|
356
|
-
|
|
458
|
+
const priceImpact = details?.totalImpact?.percent ? Number(details.totalImpact.percent) : 0;
|
|
459
|
+
|
|
460
|
+
return {
|
|
461
|
+
amountIn,
|
|
462
|
+
amountOut,
|
|
463
|
+
amountInUsd,
|
|
464
|
+
amountOutUsd,
|
|
465
|
+
slippage,
|
|
466
|
+
priceImpact,
|
|
467
|
+
provider: 'relay',
|
|
468
|
+
rawQuote: relayQuote,
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
public static transformJupiterQuote({ quote }: { quote: JupiterQuoteResponse }): Quote {
|
|
357
473
|
const amountIn = Number(quote.inAmount);
|
|
358
474
|
const amountOut = Number(quote.outAmount);
|
|
359
|
-
|
|
475
|
+
const amountOutMin = Number(quote.otherAmountThreshold);
|
|
476
|
+
|
|
477
|
+
const chainId = ChainID.Solana; // Jupiter runs only on Solana
|
|
478
|
+
const stable = getStableForChain(chainId);
|
|
479
|
+
const stableAddress = stable.address;
|
|
480
|
+
const stableDecimals = stable.decimals;
|
|
481
|
+
|
|
360
482
|
let amountUsd = 0;
|
|
361
483
|
const priceImpact = quote.priceImpactPct ? Number(quote.priceImpactPct) * 100 : 0;
|
|
362
484
|
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
amountUsd = amountIn / 10 ** this.DEFAULT_BRIDGE_TOKEN_DECIMALS;
|
|
485
|
+
// Use stable decimals dynamically for USD conversions
|
|
486
|
+
if (compareAddresses(quote.outputMint, stableAddress)) {
|
|
487
|
+
amountUsd = amountOut / 10 ** stableDecimals;
|
|
488
|
+
} else if (compareAddresses(quote.inputMint, stableAddress)) {
|
|
489
|
+
amountUsd = amountIn / 10 ** stableDecimals;
|
|
369
490
|
}
|
|
370
491
|
|
|
371
492
|
return {
|
|
372
493
|
amountIn: BigInt(amountIn),
|
|
373
494
|
amountOut: BigInt(amountOut),
|
|
495
|
+
amountOutMin: BigInt(amountOutMin),
|
|
374
496
|
amountOutUsd: amountUsd,
|
|
375
497
|
amountInUsd: amountUsd,
|
|
376
498
|
slippage: quote.slippageBps ? quote.slippageBps / 100 : 0,
|
|
@@ -381,22 +503,27 @@ export class QuoteProvider {
|
|
|
381
503
|
}
|
|
382
504
|
|
|
383
505
|
private static transformRaydiumQuote(raydiumQuote: RaydiumQuoteResponse): Quote {
|
|
384
|
-
const amountIn =
|
|
385
|
-
const amountOut =
|
|
506
|
+
const amountIn = BigInt(raydiumQuote.data.inAmount);
|
|
507
|
+
const amountOut = BigInt(raydiumQuote.data.outAmount);
|
|
508
|
+
|
|
509
|
+
const chainId = ChainID.Solana; // Raydium runs on Solana
|
|
510
|
+
const stable = getStableForChain(chainId);
|
|
511
|
+
const stableAddress = stable.address;
|
|
512
|
+
const stableDecimals = stable.decimals;
|
|
513
|
+
|
|
386
514
|
let amountUsd = 0;
|
|
387
515
|
const priceImpact = Number(raydiumQuote.data.priceImpactPct) * 100;
|
|
388
516
|
|
|
389
|
-
if (
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
amountUsd = amountIn / 10 ** this.DEFAULT_BRIDGE_TOKEN_DECIMALS;
|
|
517
|
+
// Determine if the input or output is the stablecoin (USDC/USDT)
|
|
518
|
+
if (compareAddresses(raydiumQuote.data.outputMint, stableAddress)) {
|
|
519
|
+
amountUsd = Number(amountOut) / 10 ** stableDecimals;
|
|
520
|
+
} else if (compareAddresses(raydiumQuote.data.inputMint, stableAddress)) {
|
|
521
|
+
amountUsd = Number(amountIn) / 10 ** stableDecimals;
|
|
395
522
|
}
|
|
396
523
|
|
|
397
524
|
return {
|
|
398
|
-
amountIn
|
|
399
|
-
amountOut
|
|
525
|
+
amountIn,
|
|
526
|
+
amountOut,
|
|
400
527
|
amountOutUsd: amountUsd,
|
|
401
528
|
amountInUsd: amountUsd,
|
|
402
529
|
slippage: raydiumQuote.data.slippageBps / 100,
|
|
@@ -407,15 +534,48 @@ export class QuoteProvider {
|
|
|
407
534
|
}
|
|
408
535
|
}
|
|
409
536
|
|
|
537
|
+
function getStableForChain(chainId: ChainID) {
|
|
538
|
+
// Prefer USDC if available, else USDT
|
|
539
|
+
if (CROSS_CHAIN_STABLES.USDC?.[chainId]) {
|
|
540
|
+
return { symbol: 'USDC', ...CROSS_CHAIN_STABLES.USDC[chainId] };
|
|
541
|
+
}
|
|
542
|
+
if (CROSS_CHAIN_STABLES.USDT?.[chainId]) {
|
|
543
|
+
return { symbol: 'USDT', ...CROSS_CHAIN_STABLES.USDT[chainId] };
|
|
544
|
+
}
|
|
545
|
+
throw new Error(`No stablecoin found for chain ${chainId}`);
|
|
546
|
+
}
|
|
410
547
|
function getProviderNameByChainId(chainId: ChainID): RouteProvider {
|
|
411
548
|
switch (chainId) {
|
|
412
549
|
case ChainID.Sui:
|
|
413
550
|
return 'aftermath';
|
|
414
551
|
case ChainID.Solana:
|
|
415
|
-
return 'jupiter'; // Primary provider, with Raydium as
|
|
552
|
+
return 'jupiter'; // Primary provider, with Raydium and Pumpfun as fallbacks
|
|
416
553
|
case ChainID.Hyperliquid:
|
|
417
554
|
return 'liquidswap';
|
|
418
555
|
default:
|
|
419
556
|
return 'paraswap';
|
|
420
557
|
}
|
|
421
558
|
}
|
|
559
|
+
|
|
560
|
+
export function quoteToSimpleQuote(quote: Quote): SimpleQuote {
|
|
561
|
+
return {
|
|
562
|
+
amountIn: quote.amountIn,
|
|
563
|
+
amountOut: quote.amountOut,
|
|
564
|
+
amountOutMin: quote.amountOutMin,
|
|
565
|
+
slippage: quote.slippage,
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
export function simpleQuoteToQuote(simpleQuote: SimpleQuote, provider: RouteProvider): Quote {
|
|
570
|
+
return {
|
|
571
|
+
amountIn: simpleQuote.amountIn,
|
|
572
|
+
amountOut: simpleQuote.amountOut,
|
|
573
|
+
amountOutMin: simpleQuote.amountOutMin,
|
|
574
|
+
slippage: simpleQuote.slippage,
|
|
575
|
+
amountInUsd: 0,
|
|
576
|
+
amountOutUsd: 0,
|
|
577
|
+
priceImpact: 0,
|
|
578
|
+
provider,
|
|
579
|
+
rawQuote: simpleQuote,
|
|
580
|
+
};
|
|
581
|
+
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { formatUnits } from 'viem';
|
|
1
2
|
import { ChainID } from '../../chains.js';
|
|
2
3
|
import { isNativeEvmToken, WRAPPED_ETH_ADDRESSES } from '../../constants.js';
|
|
4
|
+
import { CROSS_CHAIN_STABLES } from './stablecoins-tokens.js';
|
|
3
5
|
|
|
4
6
|
type LiquidSwapQuoteParams = {
|
|
5
7
|
tokenIn: string;
|
|
6
8
|
tokenOut: string;
|
|
7
|
-
amountIn:
|
|
9
|
+
amountIn: bigint;
|
|
8
10
|
};
|
|
9
11
|
|
|
10
12
|
export type LiquidSwapQuoteResponse = {
|
|
@@ -12,31 +14,58 @@ export type LiquidSwapQuoteResponse = {
|
|
|
12
14
|
amountIn: string;
|
|
13
15
|
amountOut: string;
|
|
14
16
|
averagePriceImpact: string;
|
|
17
|
+
execution: any;
|
|
15
18
|
};
|
|
16
19
|
|
|
17
20
|
const LIQUID_SWAP_API_URL = 'https://api.liqd.ag';
|
|
18
21
|
|
|
19
22
|
export class LiquidSwapQuoteProvider {
|
|
20
|
-
public async getQuote(
|
|
21
|
-
const
|
|
23
|
+
public async getQuote(params: LiquidSwapQuoteParams): Promise<LiquidSwapQuoteResponse> {
|
|
24
|
+
const chainId = ChainID.Hyperliquid;
|
|
25
|
+
let tokenIn = params.tokenIn;
|
|
26
|
+
let tokenOut = params.tokenOut;
|
|
22
27
|
|
|
23
|
-
if
|
|
24
|
-
|
|
28
|
+
// 1️ Wrap native tokens if needed
|
|
29
|
+
if (isNativeEvmToken(tokenIn)) {
|
|
30
|
+
tokenIn = WRAPPED_ETH_ADDRESSES[chainId];
|
|
25
31
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
params.tokenIn = WRAPPED_ETH_ADDRESSES[ChainID.Hyperliquid];
|
|
32
|
+
if (isNativeEvmToken(tokenOut)) {
|
|
33
|
+
tokenOut = WRAPPED_ETH_ADDRESSES[chainId];
|
|
29
34
|
}
|
|
30
35
|
|
|
31
|
-
|
|
36
|
+
// 2️Detect decimals
|
|
37
|
+
const tokenInDecimals = this.getTokenDecimals(tokenIn, chainId);
|
|
38
|
+
|
|
39
|
+
// 3️ Convert amountIn (wei → human)
|
|
40
|
+
const formattedAmountIn = formatUnits(BigInt(params.amountIn), tokenInDecimals);
|
|
41
|
+
|
|
42
|
+
// 4️ Build request URL — amountIn should still be in base units for API
|
|
43
|
+
const url = `${LIQUID_SWAP_API_URL}/v2/route?tokenIn=${tokenIn}&tokenOut=${tokenOut}&amountIn=${formattedAmountIn}`;
|
|
44
|
+
|
|
32
45
|
const response = await fetch(url);
|
|
46
|
+
if (!response.ok) throw new Error('Failed to fetch quote from LiquidSwap API');
|
|
47
|
+
|
|
48
|
+
const data = await response.json();
|
|
33
49
|
|
|
34
|
-
|
|
35
|
-
|
|
50
|
+
return data;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
private getTokenDecimals(addressOrSymbol: string, chainId: ChainID): number {
|
|
54
|
+
const lower = addressOrSymbol.toLowerCase();
|
|
55
|
+
|
|
56
|
+
// Match by address
|
|
57
|
+
for (const symbol in CROSS_CHAIN_STABLES) {
|
|
58
|
+
const stable = CROSS_CHAIN_STABLES[symbol]?.[chainId];
|
|
59
|
+
if (stable && stable.address.toLowerCase() === lower) {
|
|
60
|
+
return stable.decimals;
|
|
61
|
+
}
|
|
36
62
|
}
|
|
37
63
|
|
|
38
|
-
|
|
64
|
+
// Match by symbol
|
|
65
|
+
const stableBySymbol = CROSS_CHAIN_STABLES[addressOrSymbol.toUpperCase()]?.[chainId];
|
|
66
|
+
if (stableBySymbol?.decimals) return stableBySymbol.decimals;
|
|
39
67
|
|
|
40
|
-
|
|
68
|
+
// Default fallback
|
|
69
|
+
return 18;
|
|
41
70
|
}
|
|
42
71
|
}
|
|
@@ -10,6 +10,8 @@ const rpcProvidersUrl: Record<SupportedEvmChain, string> = {
|
|
|
10
10
|
[ChainID.Optimism]: 'https://optimism-rpc.publicnode.com',
|
|
11
11
|
[ChainID.Base]: 'https://base-rpc.publicnode.com',
|
|
12
12
|
[ChainID.Hyperliquid]: 'https://rpc.hyperliquid.xyz/evm',
|
|
13
|
+
[ChainID.BSC]: 'https://bsc-dataseed.ninicoin.io',
|
|
14
|
+
[ChainID.MONAD]: 'https://rpc4.monad.xyz',
|
|
13
15
|
};
|
|
14
16
|
|
|
15
17
|
export type ParaswapQuoteRequestParams = {
|