@shogun-sdk/intents-sdk 1.2.31 → 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 +76 -25
- 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 +44 -30
- package/src/auth/siwe.ts +8 -3
- package/src/chains.ts +6 -0
- package/src/constants.ts +71 -15
- 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 +162 -21
- 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 -18
- 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 +38 -27
- 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 -29
- package/src/core/sui/intent-helpers.ts +39 -41
- 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 +22 -9
- package/src/types/api.ts +22 -2
- package/src/types/intent.ts +42 -5
- package/src/types/token-list.ts +35 -0
- package/src/utils/base-validator.ts +0 -4
- package/src/utils/defillama.ts +2 -0
- package/src/utils/generate-execution-details-hash.ts +13 -0
- package/src/utils/quote/address.ts +4 -0
- package/src/utils/quote/aggregator.ts +326 -76
- 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 +506 -0
- 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/src/utils/tokens/index.ts +38 -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 -106
- 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 -130
- 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 -319
- 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/cross-chain-limit-order.js +0 -18
- package/dist/esm/core/solana/cross-chain-limit-order.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 -177
- 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 -26
- package/dist/esm/core/sui/cross-chain-limit-order.js.map +0 -1
- package/dist/esm/core/sui/intent-helpers.js +0 -136
- 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 -38
- 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/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/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 -254
- 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/stablecoins-tokens.js +0 -13
- package/dist/esm/utils/quote/stablecoins-tokens.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 -43
- 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 -125
- 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/cross-chain-limit-order.d.ts +0 -9
- package/dist/types/core/solana/cross-chain-limit-order.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 -14
- package/dist/types/core/sui/cross-chain-limit-order.d.ts.map +0 -1
- package/dist/types/core/sui/intent-helpers.d.ts +0 -89
- 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 -42
- 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/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/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 -64
- 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/stablecoins-tokens.d.ts +0 -11
- package/dist/types/utils/quote/stablecoins-tokens.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
- package/src/core/solana/cross-chain-limit-order.ts +0 -24
|
@@ -2,11 +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';
|
|
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';
|
|
10
17
|
|
|
11
18
|
type SingleChainQuoteParams = {
|
|
12
19
|
chainId: ChainID;
|
|
@@ -14,13 +21,15 @@ type SingleChainQuoteParams = {
|
|
|
14
21
|
tokenIn: string;
|
|
15
22
|
tokenOut: string;
|
|
16
23
|
slippageBps?: number;
|
|
24
|
+
provider?: RouteProvider; // Optional provider override
|
|
17
25
|
};
|
|
18
26
|
|
|
19
|
-
export type RouteProvider = 'paraswap' | 'jupiter' | 'aftermath' | 'liquidswap';
|
|
27
|
+
export type RouteProvider = 'paraswap' | 'jupiter' | 'aftermath' | 'liquidswap' | 'raydium' | 'pumpfun' | 'relay';
|
|
20
28
|
|
|
21
29
|
export type Quote = {
|
|
22
30
|
amountIn: bigint;
|
|
23
31
|
amountOut: bigint;
|
|
32
|
+
amountOutMin?: bigint; // Optional, for quotes that provide a minimum guaranteed output
|
|
24
33
|
amountOutUsd: number;
|
|
25
34
|
amountInUsd: number;
|
|
26
35
|
slippage: number;
|
|
@@ -29,7 +38,14 @@ export type Quote = {
|
|
|
29
38
|
rawQuote: any;
|
|
30
39
|
};
|
|
31
40
|
|
|
32
|
-
export type
|
|
41
|
+
export type SimpleQuote = {
|
|
42
|
+
amountIn: bigint;
|
|
43
|
+
amountOut: bigint;
|
|
44
|
+
amountOutMin?: bigint;
|
|
45
|
+
slippage: number;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export type IntentsQuoteParams = {
|
|
33
49
|
sourceChainId: ChainID;
|
|
34
50
|
destChainId: ChainID;
|
|
35
51
|
amount: bigint;
|
|
@@ -37,7 +53,7 @@ export type QuoteParams = {
|
|
|
37
53
|
tokenOut: string;
|
|
38
54
|
};
|
|
39
55
|
|
|
40
|
-
export type
|
|
56
|
+
export type QuoteResponseInternal = {
|
|
41
57
|
amountInUsd: number;
|
|
42
58
|
estimatedAmountInAsMinStablecoinAmount: bigint;
|
|
43
59
|
|
|
@@ -48,77 +64,119 @@ export type QuoteResponse = {
|
|
|
48
64
|
estimatedAmountOutUsdReduced: number;
|
|
49
65
|
};
|
|
50
66
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
amountInUsd: 0,
|
|
66
|
-
estimatedAmountOutUsd: 0,
|
|
67
|
-
estimatedAmountOutUsdReduced: 0,
|
|
68
|
-
|
|
69
|
-
estimatedAmountInAsMinStablecoinAmount: defillamaQuote.minStablecoinsAmount,
|
|
70
|
-
estimatedAmountOut: defillamaQuote.amountOut,
|
|
71
|
-
estimatedAmountOutReduced: defillamaQuote.amountOut,
|
|
72
|
-
};
|
|
73
|
-
}
|
|
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
|
+
};
|
|
74
81
|
|
|
75
|
-
|
|
82
|
+
export class QuoteProvider {
|
|
83
|
+
public static async getQuote(params: IntentsQuoteParams): Promise<QuoteResponse> {
|
|
76
84
|
try {
|
|
77
85
|
const quote = await this.getQuoteFromRouters(params);
|
|
78
|
-
|
|
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
|
+
};
|
|
79
98
|
} catch (e) {
|
|
80
|
-
|
|
81
|
-
|
|
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');
|
|
82
102
|
}
|
|
83
103
|
}
|
|
84
104
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
105
|
+
/**
|
|
106
|
+
* Get a quote for Solana with explicit provider selection
|
|
107
|
+
* @param params - Quote parameters including provider preference
|
|
108
|
+
* @returns Quote response
|
|
109
|
+
*/
|
|
110
|
+
public static async getSolanaQuote(params: {
|
|
111
|
+
amount: bigint;
|
|
112
|
+
tokenIn: string;
|
|
113
|
+
tokenOut: string;
|
|
114
|
+
slippageBps?: number;
|
|
115
|
+
provider?: 'jupiter' | 'raydium' | 'pumpfun';
|
|
116
|
+
}): Promise<Quote> {
|
|
117
|
+
const singleChainParams: SingleChainQuoteParams = {
|
|
118
|
+
chainId: ChainID.Solana,
|
|
119
|
+
amount: params.amount,
|
|
120
|
+
tokenIn: params.tokenIn,
|
|
121
|
+
tokenOut: params.tokenOut,
|
|
122
|
+
slippageBps: params.slippageBps,
|
|
123
|
+
provider: params.provider,
|
|
124
|
+
};
|
|
88
125
|
|
|
89
|
-
|
|
90
|
-
|
|
126
|
+
return this.getSingleChainQuote(singleChainParams);
|
|
127
|
+
}
|
|
91
128
|
|
|
92
|
-
|
|
93
|
-
const
|
|
129
|
+
private static async getQuoteFromRouters(params: IntentsQuoteParams): Promise<QuoteResponseInternal> {
|
|
130
|
+
const sourceStable = getStableForChain(params.sourceChainId);
|
|
131
|
+
const destStable = getStableForChain(params.destChainId);
|
|
94
132
|
|
|
133
|
+
// Step 1: Get quote from tokenIn → bridge stable on source chain ---
|
|
95
134
|
const sourceSingleChainQuoteParams: SingleChainQuoteParams = {
|
|
96
135
|
chainId: params.sourceChainId,
|
|
97
136
|
amount: params.amount,
|
|
98
137
|
tokenIn: params.tokenIn,
|
|
99
|
-
tokenOut:
|
|
138
|
+
tokenOut: sourceStable.address,
|
|
100
139
|
};
|
|
101
140
|
|
|
102
|
-
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
|
+
);
|
|
103
158
|
|
|
159
|
+
// Step 3: Get quote from dest bridge stable → target token ---
|
|
104
160
|
const destSingleChainQuoteParams: SingleChainQuoteParams = {
|
|
105
161
|
chainId: params.destChainId,
|
|
106
|
-
amount:
|
|
107
|
-
tokenIn:
|
|
162
|
+
amount: normalizedBridgeAmount,
|
|
163
|
+
tokenIn: destStable.address,
|
|
108
164
|
tokenOut: params.tokenOut,
|
|
109
165
|
};
|
|
110
166
|
|
|
111
167
|
const destQuote = await this.getSingleChainQuote(destSingleChainQuoteParams);
|
|
112
168
|
|
|
113
|
-
//
|
|
114
|
-
const weightedReductionFactor = this.calculateWeightedReductionFactorForUsd(destQuote.amountOutUsd);
|
|
115
|
-
|
|
116
|
-
const estimatedAmountOutReduced = BigInt(Math.floor(Number(destQuote.amountOut) * weightedReductionFactor));
|
|
117
|
-
const estimatedAmountOutUsdReduced = destQuote.amountOutUsd * weightedReductionFactor;
|
|
118
|
-
|
|
119
|
-
const reducedAmountInUsd = this.calculateWeightedReductionFactorForUsd(sourceQuote.amountInUsd);
|
|
169
|
+
// Step 4: Compute stable min-amount with correct decimals ---
|
|
120
170
|
const estimatedAmountInAsMinStablecoinAmount = BigInt(
|
|
121
|
-
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,
|
|
122
180
|
);
|
|
123
181
|
|
|
124
182
|
return {
|
|
@@ -127,16 +185,23 @@ export class QuoteProvider {
|
|
|
127
185
|
amountInUsd: sourceQuote.amountInUsd,
|
|
128
186
|
estimatedAmountInAsMinStablecoinAmount,
|
|
129
187
|
estimatedAmountOutReduced,
|
|
130
|
-
estimatedAmountOutUsdReduced,
|
|
188
|
+
estimatedAmountOutUsdReduced: destQuote.amountOutUsd,
|
|
131
189
|
};
|
|
132
190
|
}
|
|
133
191
|
|
|
134
192
|
public static async getSingleChainQuote(params: SingleChainQuoteParams): Promise<Quote> {
|
|
135
|
-
|
|
193
|
+
// Handle same-token case (self-swap)
|
|
194
|
+
if (compareAddresses(params.tokenIn, params.tokenOut)) {
|
|
136
195
|
let amountUsd = 0;
|
|
137
196
|
|
|
138
|
-
|
|
139
|
-
|
|
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;
|
|
140
205
|
}
|
|
141
206
|
|
|
142
207
|
return {
|
|
@@ -146,27 +211,58 @@ export class QuoteProvider {
|
|
|
146
211
|
amountInUsd: amountUsd,
|
|
147
212
|
slippage: 0,
|
|
148
213
|
priceImpact: 0,
|
|
149
|
-
provider: getProviderNameByChainId(params.chainId),
|
|
214
|
+
provider: params.provider || getProviderNameByChainId(params.chainId),
|
|
150
215
|
rawQuote: null,
|
|
151
216
|
};
|
|
152
217
|
}
|
|
153
218
|
|
|
219
|
+
// Hyperliquid
|
|
154
220
|
if (params.chainId === ChainID.Hyperliquid) {
|
|
155
221
|
const liquidSwapQuote = await QuoteProvider.getLiquidSwapQuote(params);
|
|
156
222
|
return QuoteProvider.transformLiquidSwapQuote(liquidSwapQuote);
|
|
157
223
|
}
|
|
158
224
|
|
|
225
|
+
// Solana (Jupiter / Raydium / Pumpfun)
|
|
159
226
|
if (params.chainId === ChainID.Solana) {
|
|
160
|
-
|
|
161
|
-
|
|
227
|
+
if (params.provider === 'jupiter') {
|
|
228
|
+
const jupiterQuote = await QuoteProvider.getJupiterQuote(params);
|
|
229
|
+
return QuoteProvider.transformJupiterQuote(jupiterQuote);
|
|
230
|
+
} else if (params.provider === 'raydium') {
|
|
231
|
+
const raydiumQuote = await QuoteProvider.getRaydiumQuote(params);
|
|
232
|
+
return raydiumQuote;
|
|
233
|
+
} else if (params.provider === 'pumpfun') {
|
|
234
|
+
const pumpfunQuote = await QuoteProvider.getPumpFunQuote(params);
|
|
235
|
+
return pumpfunQuote;
|
|
236
|
+
} else {
|
|
237
|
+
try {
|
|
238
|
+
const jupiterQuote = await QuoteProvider.getJupiterQuote(params);
|
|
239
|
+
if (!jupiterQuote.quote) throw new Error('Jupiter quote failed');
|
|
240
|
+
return QuoteProvider.transformJupiterQuote(jupiterQuote);
|
|
241
|
+
} catch (error) {
|
|
242
|
+
console.warn('Jupiter quote failed, falling back to Raydium:', error);
|
|
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
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
162
252
|
}
|
|
163
253
|
|
|
254
|
+
// Sui (Aftermath)
|
|
164
255
|
if (params.chainId === ChainID.Sui) {
|
|
165
256
|
const quote = await QuoteProvider.getAftermathQuote(params);
|
|
166
257
|
return QuoteProvider.transformAftermathQuote({ quote, request: params });
|
|
167
258
|
}
|
|
168
259
|
|
|
260
|
+
// EVM chains (Paraswap)
|
|
169
261
|
if (isEvmChain(params.chainId)) {
|
|
262
|
+
if (params.chainId === ChainID.MONAD) {
|
|
263
|
+
const relayQuote = await QuoteProvider.getRelayQuote(params);
|
|
264
|
+
return QuoteProvider.transformRelayQuote(relayQuote);
|
|
265
|
+
}
|
|
170
266
|
const paraswapQuote = await QuoteProvider.getParaswapQuote(params);
|
|
171
267
|
return QuoteProvider.transformParaswapQuote(paraswapQuote);
|
|
172
268
|
}
|
|
@@ -176,8 +272,8 @@ export class QuoteProvider {
|
|
|
176
272
|
|
|
177
273
|
static transformLiquidSwapQuote(liquidSwapQuote: LiquidSwapQuoteResponse): Quote {
|
|
178
274
|
return {
|
|
179
|
-
amountIn:
|
|
180
|
-
amountOut:
|
|
275
|
+
amountIn: liquidSwapQuote.execution.details.amountIn,
|
|
276
|
+
amountOut: liquidSwapQuote.execution.details.amountOut,
|
|
181
277
|
amountOutUsd: 0,
|
|
182
278
|
amountInUsd: 0,
|
|
183
279
|
slippage: 0,
|
|
@@ -211,7 +307,7 @@ export class QuoteProvider {
|
|
|
211
307
|
return liquidSwapQuoter.getQuote({
|
|
212
308
|
tokenIn: params.tokenIn,
|
|
213
309
|
tokenOut: params.tokenOut,
|
|
214
|
-
amountIn: params.amount
|
|
310
|
+
amountIn: params.amount,
|
|
215
311
|
});
|
|
216
312
|
}
|
|
217
313
|
|
|
@@ -223,7 +319,7 @@ export class QuoteProvider {
|
|
|
223
319
|
tokenIn: params.tokenIn,
|
|
224
320
|
tokenOut: params.tokenOut,
|
|
225
321
|
swapMode: 'ExactIn',
|
|
226
|
-
slippageBps: params.slippageBps,
|
|
322
|
+
slippageBps: params.slippageBps ? params.slippageBps : 20, // Default 0.2% slippage
|
|
227
323
|
});
|
|
228
324
|
}
|
|
229
325
|
|
|
@@ -237,7 +333,15 @@ export class QuoteProvider {
|
|
|
237
333
|
side: 'SELL',
|
|
238
334
|
});
|
|
239
335
|
}
|
|
336
|
+
protected static async getRelayQuote(params: SingleChainQuoteParams) {
|
|
337
|
+
const relayQuoter = new RelayQuoteProvider(params.chainId as SupportedEvmChain);
|
|
240
338
|
|
|
339
|
+
return relayQuoter.getSwapEstimation({
|
|
340
|
+
amount: BigInt(params.amount),
|
|
341
|
+
srcToken: params.tokenIn,
|
|
342
|
+
destToken: params.tokenOut,
|
|
343
|
+
});
|
|
344
|
+
}
|
|
241
345
|
protected static async getAftermathQuote(params: SingleChainQuoteParams) {
|
|
242
346
|
const aftermathQuoter = new AftermathQuoteProvider();
|
|
243
347
|
|
|
@@ -248,6 +352,36 @@ export class QuoteProvider {
|
|
|
248
352
|
});
|
|
249
353
|
}
|
|
250
354
|
|
|
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> {
|
|
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();
|
|
375
|
+
|
|
376
|
+
let request: RaydiumPumpQuoteParams = {
|
|
377
|
+
inputMint: params.tokenIn,
|
|
378
|
+
outputMint: params.tokenOut,
|
|
379
|
+
amount: params.amount.toString(),
|
|
380
|
+
slippageBps: params.slippageBps || 20, // Default 0.2% slippage
|
|
381
|
+
};
|
|
382
|
+
return simpleQuoteToQuote(await pumpfunQuoter.getQuote(request), 'pumpfun');
|
|
383
|
+
}
|
|
384
|
+
|
|
251
385
|
private static transformAftermathQuote({
|
|
252
386
|
quote,
|
|
253
387
|
request,
|
|
@@ -255,14 +389,18 @@ export class QuoteProvider {
|
|
|
255
389
|
quote: RouterCompleteTradeRoute;
|
|
256
390
|
request: SingleChainQuoteParams;
|
|
257
391
|
}): Quote {
|
|
258
|
-
|
|
392
|
+
const chainId = request.chainId;
|
|
393
|
+
const stable = getStableForChain(chainId);
|
|
394
|
+
const stableAddress = stable.address;
|
|
395
|
+
const stableDecimals = stable.decimals;
|
|
259
396
|
|
|
260
|
-
|
|
261
|
-
amountUsd = Number(quote.coinIn.amount) / 10 ** this.DEFAULT_BRIDGE_TOKEN_DECIMALS;
|
|
262
|
-
}
|
|
397
|
+
let amountUsd = 0;
|
|
263
398
|
|
|
264
|
-
if
|
|
265
|
-
|
|
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;
|
|
266
404
|
}
|
|
267
405
|
|
|
268
406
|
return {
|
|
@@ -289,24 +427,72 @@ export class QuoteProvider {
|
|
|
289
427
|
rawQuote: paraswapQuote,
|
|
290
428
|
};
|
|
291
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;
|
|
457
|
+
|
|
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
|
+
}
|
|
292
471
|
|
|
293
|
-
|
|
472
|
+
public static transformJupiterQuote({ quote }: { quote: JupiterQuoteResponse }): Quote {
|
|
294
473
|
const amountIn = Number(quote.inAmount);
|
|
295
474
|
const amountOut = Number(quote.outAmount);
|
|
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
|
+
|
|
296
482
|
let amountUsd = 0;
|
|
297
483
|
const priceImpact = quote.priceImpactPct ? Number(quote.priceImpactPct) * 100 : 0;
|
|
298
484
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
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;
|
|
305
490
|
}
|
|
306
491
|
|
|
307
492
|
return {
|
|
308
493
|
amountIn: BigInt(amountIn),
|
|
309
494
|
amountOut: BigInt(amountOut),
|
|
495
|
+
amountOutMin: BigInt(amountOutMin),
|
|
310
496
|
amountOutUsd: amountUsd,
|
|
311
497
|
amountInUsd: amountUsd,
|
|
312
498
|
slippage: quote.slippageBps ? quote.slippageBps / 100 : 0,
|
|
@@ -315,17 +501,81 @@ export class QuoteProvider {
|
|
|
315
501
|
rawQuote: quote,
|
|
316
502
|
};
|
|
317
503
|
}
|
|
504
|
+
|
|
505
|
+
private static transformRaydiumQuote(raydiumQuote: RaydiumQuoteResponse): Quote {
|
|
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
|
+
|
|
514
|
+
let amountUsd = 0;
|
|
515
|
+
const priceImpact = Number(raydiumQuote.data.priceImpactPct) * 100;
|
|
516
|
+
|
|
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;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
return {
|
|
525
|
+
amountIn,
|
|
526
|
+
amountOut,
|
|
527
|
+
amountOutUsd: amountUsd,
|
|
528
|
+
amountInUsd: amountUsd,
|
|
529
|
+
slippage: raydiumQuote.data.slippageBps / 100,
|
|
530
|
+
priceImpact,
|
|
531
|
+
provider: 'raydium',
|
|
532
|
+
rawQuote: raydiumQuote,
|
|
533
|
+
};
|
|
534
|
+
}
|
|
318
535
|
}
|
|
319
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
|
+
}
|
|
320
547
|
function getProviderNameByChainId(chainId: ChainID): RouteProvider {
|
|
321
548
|
switch (chainId) {
|
|
322
549
|
case ChainID.Sui:
|
|
323
550
|
return 'aftermath';
|
|
324
551
|
case ChainID.Solana:
|
|
325
|
-
return 'jupiter';
|
|
552
|
+
return 'jupiter'; // Primary provider, with Raydium and Pumpfun as fallbacks
|
|
326
553
|
case ChainID.Hyperliquid:
|
|
327
554
|
return 'liquidswap';
|
|
328
555
|
default:
|
|
329
556
|
return 'paraswap';
|
|
330
557
|
}
|
|
331
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 = {
|