@shogun-sdk/intents-sdk 1.3.0 → 1.4.1
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 +9008 -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 +9257 -0
- package/dist/index.js.map +1 -0
- package/package.json +28 -15
- package/src/auth/siwe.ts +8 -3
- package/src/chains.ts +24 -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 +41 -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
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from '../../types/intent.js';
|
|
11
11
|
import { CrossChainOrderValidator } from '../../utils/order-validator.js';
|
|
12
12
|
import { Parsers } from '../../utils/parsers.js';
|
|
13
|
-
import { type ExtraTransfer } from './common.js';
|
|
13
|
+
import { type ExtraTransfer, type StopLossType } from './common.js';
|
|
14
14
|
import type { ApiResponse } from '../../types/api.js';
|
|
15
15
|
import { BaseSDK } from '../sdk.js';
|
|
16
16
|
import { getEVMCrossChainOrderTypedData } from '../evm/order-signature.js';
|
|
@@ -40,8 +40,9 @@ export type CreateCrossChainOrderParams = {
|
|
|
40
40
|
/** Extra transfers to be made */
|
|
41
41
|
extraTransfers?: ExtraTransfer[];
|
|
42
42
|
|
|
43
|
-
/** Stop loss
|
|
44
|
-
|
|
43
|
+
/** Stop loss */
|
|
44
|
+
stopLossType?: StopLossType;
|
|
45
|
+
stopLossTriggerPrice?: string;
|
|
45
46
|
/** Take profit min out */
|
|
46
47
|
takeProfitMinOut?: bigint;
|
|
47
48
|
};
|
|
@@ -73,8 +74,9 @@ export class CrossChainOrder {
|
|
|
73
74
|
public deadline: number;
|
|
74
75
|
/** Extra transfers to be made */
|
|
75
76
|
public extraTransfers?: ExtraTransfer[];
|
|
76
|
-
/** Stop loss
|
|
77
|
-
public
|
|
77
|
+
/** Stop loss */
|
|
78
|
+
public stopLossType?: StopLossType;
|
|
79
|
+
public stopLossTriggerPrice?: string;
|
|
78
80
|
/** Take profit min out */
|
|
79
81
|
public takeProfitMinOut?: bigint;
|
|
80
82
|
|
|
@@ -90,7 +92,8 @@ export class CrossChainOrder {
|
|
|
90
92
|
this.minStablecoinAmount = params.minStablecoinAmount ?? 1n;
|
|
91
93
|
this.deadline = params.deadline;
|
|
92
94
|
this.extraTransfers = params.extraTransfers;
|
|
93
|
-
this.
|
|
95
|
+
this.stopLossType = params.stopLossType;
|
|
96
|
+
this.stopLossTriggerPrice = params.stopLossTriggerPrice;
|
|
94
97
|
this.takeProfitMinOut = params.takeProfitMinOut;
|
|
95
98
|
}
|
|
96
99
|
|
|
@@ -154,15 +157,16 @@ export class CrossChainOrder {
|
|
|
154
157
|
private static async calculateAmountOutMin(
|
|
155
158
|
input: CreateCrossChainOrderParams,
|
|
156
159
|
): Promise<{ minStablecoinAmount: bigint; destinationTokenMinAmount: bigint }> {
|
|
157
|
-
const { destinationTokenMinAmount,
|
|
160
|
+
const { destinationTokenMinAmount, stopLossType, stopLossTriggerPrice, minStablecoinAmount } = input;
|
|
158
161
|
|
|
159
|
-
if (
|
|
162
|
+
if (stopLossType !== undefined && stopLossTriggerPrice !== undefined) {
|
|
160
163
|
return {
|
|
161
164
|
destinationTokenMinAmount: 1n,
|
|
162
165
|
minStablecoinAmount: 1n,
|
|
163
166
|
};
|
|
164
167
|
}
|
|
165
168
|
|
|
169
|
+
// TODO: Change this
|
|
166
170
|
if (!minStablecoinAmount || !destinationTokenMinAmount) {
|
|
167
171
|
const quote = await QuoteProvider.getQuote({
|
|
168
172
|
sourceChainId: input.sourceChainId,
|
|
@@ -196,6 +200,9 @@ export class CrossChainOrder {
|
|
|
196
200
|
destinationAddress: this.destinationAddress,
|
|
197
201
|
amountOutMin: this.destinationTokenMinAmount,
|
|
198
202
|
extraTransfers: this.extraTransfers,
|
|
203
|
+
stopLossType: this.stopLossType,
|
|
204
|
+
stopLossTriggerPrice: this.stopLossTriggerPrice,
|
|
205
|
+
takeProfitMinOut: this.takeProfitMinOut,
|
|
199
206
|
};
|
|
200
207
|
}
|
|
201
208
|
|
|
@@ -4,10 +4,13 @@ import type { ApiResponse } from '../../types/api.js';
|
|
|
4
4
|
import type { SingleChainPreparedData, SingleChainUserIntentRequest } from '../../types/intent.js';
|
|
5
5
|
import { SingleChainOrderValidator } from '../../utils/order-validator.js';
|
|
6
6
|
import { QuoteProvider } from '../../utils/quote/aggregator.js';
|
|
7
|
+
import { estimateAmountOut } from '../../utils/quote/pricing/estimate-amount-out.js';
|
|
8
|
+
import { estimateExpensesInTokenOut } from '../../utils/quote/pricing/expenses.js';
|
|
9
|
+
import { DEFAULT_COMMISSION_BPS, EVM_SINGLE_CHAIN_GAS_LIMIT, SINGLE_CHAIN_COMMISSION_DENOMINATOR } from '../../utils/quote/pricing/constants.js';
|
|
7
10
|
import { getEVMSingleChainOrderTypedData } from '../evm/order-signature.js';
|
|
8
11
|
import { BaseSDK } from '../sdk.js';
|
|
9
12
|
import { getSolanaSingleChainOrderInstructions } from '../solana/order-instructions.js';
|
|
10
|
-
import { type ExtraTransfer } from './common.js';
|
|
13
|
+
import { type ExtraTransfer, type StopLossType } from './common.js';
|
|
11
14
|
|
|
12
15
|
export type CreateSingleChainOrderParams = {
|
|
13
16
|
chainId: SupportedChain;
|
|
@@ -19,7 +22,8 @@ export type CreateSingleChainOrderParams = {
|
|
|
19
22
|
extraTransfers?: ExtraTransfer[];
|
|
20
23
|
deadline: number;
|
|
21
24
|
|
|
22
|
-
|
|
25
|
+
stopLossType?: StopLossType;
|
|
26
|
+
stopLossTriggerPrice?: string;
|
|
23
27
|
takeProfitMinOut?: bigint;
|
|
24
28
|
};
|
|
25
29
|
|
|
@@ -35,7 +39,8 @@ export class SingleChainOrder {
|
|
|
35
39
|
public destinationAddress: string;
|
|
36
40
|
public extraTransfers?: ExtraTransfer[];
|
|
37
41
|
public deadline: number;
|
|
38
|
-
public
|
|
42
|
+
public stopLossType?: StopLossType;
|
|
43
|
+
public stopLossTriggerPrice?: string;
|
|
39
44
|
public takeProfitMinOut?: bigint;
|
|
40
45
|
|
|
41
46
|
private constructor(params: CreateSingleChainOrderParams & { user: string }) {
|
|
@@ -48,7 +53,8 @@ export class SingleChainOrder {
|
|
|
48
53
|
this.destinationAddress = params.destinationAddress;
|
|
49
54
|
this.extraTransfers = params.extraTransfers;
|
|
50
55
|
this.deadline = params.deadline;
|
|
51
|
-
this.
|
|
56
|
+
this.stopLossType = params.stopLossType;
|
|
57
|
+
this.stopLossTriggerPrice = params.stopLossTriggerPrice;
|
|
52
58
|
this.takeProfitMinOut = params.takeProfitMinOut;
|
|
53
59
|
}
|
|
54
60
|
|
|
@@ -104,22 +110,33 @@ export class SingleChainOrder {
|
|
|
104
110
|
}
|
|
105
111
|
|
|
106
112
|
private static async calculateAmountOutMin(input: CreateSingleChainOrderParams): Promise<bigint> {
|
|
107
|
-
const { amountOutMin,
|
|
113
|
+
const { amountOutMin, stopLossType, stopLossTriggerPrice } = input;
|
|
108
114
|
|
|
109
115
|
const scenario = this.getSingleChainOrderScenario({
|
|
110
116
|
hasAmountOutMin: !!amountOutMin,
|
|
111
|
-
hasStopLoss: !!
|
|
117
|
+
hasStopLoss: !!stopLossType && !!stopLossTriggerPrice,
|
|
112
118
|
});
|
|
113
119
|
|
|
114
120
|
switch (scenario) {
|
|
115
121
|
case 'QUOTE_REQUIRED': {
|
|
116
|
-
const quote = await
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
122
|
+
const [quote, expenses] = await Promise.all([
|
|
123
|
+
QuoteProvider.getSingleChainQuote({
|
|
124
|
+
tokenIn: input.tokenIn,
|
|
125
|
+
amount: input.amountIn,
|
|
126
|
+
chainId: input.chainId,
|
|
127
|
+
tokenOut: input.tokenOut,
|
|
128
|
+
}),
|
|
129
|
+
estimateExpensesInTokenOut({
|
|
130
|
+
chainId: input.chainId,
|
|
131
|
+
tokenOut: input.tokenOut,
|
|
132
|
+
gasLimit: EVM_SINGLE_CHAIN_GAS_LIMIT,
|
|
133
|
+
getQuote: (p) => QuoteProvider.getSingleChainQuote(p),
|
|
134
|
+
}),
|
|
135
|
+
]);
|
|
136
|
+
|
|
137
|
+
// Worst-case output already carries provider slippage; never use the nominal amountOut.
|
|
138
|
+
const swapOutput = quote.amountOutMin ?? quote.amountOut;
|
|
139
|
+
return estimateAmountOut(swapOutput, DEFAULT_COMMISSION_BPS, expenses, SINGLE_CHAIN_COMMISSION_DENOMINATOR);
|
|
123
140
|
}
|
|
124
141
|
|
|
125
142
|
case 'USE_PROVIDED_AMOUNT':
|
package/src/core/sdk.ts
CHANGED
|
@@ -4,6 +4,7 @@ import type { ApiResponse } from '../types/api.js';
|
|
|
4
4
|
import type {
|
|
5
5
|
CrossChainOrderPrepared,
|
|
6
6
|
CrossChainUserIntentRequest,
|
|
7
|
+
DcaCrossChainUserIntentRequest,
|
|
7
8
|
DcaSingleChainOrderPrepared,
|
|
8
9
|
DcaSingleChainUserIntentRequest,
|
|
9
10
|
SingleChainOrderPrepared,
|
|
@@ -32,6 +33,7 @@ export abstract class BaseSDK {
|
|
|
32
33
|
body,
|
|
33
34
|
});
|
|
34
35
|
|
|
36
|
+
console.debug(`url`, url, `body`, body)
|
|
35
37
|
if (!response.ok) {
|
|
36
38
|
const errorJson: ApiResponse = await response.json();
|
|
37
39
|
const mainError = errorJson.error;
|
|
@@ -121,4 +123,13 @@ export abstract class BaseSDK {
|
|
|
121
123
|
public static async validateDcaSingleChainOrder(intentRequest: DcaSingleChainUserIntentRequest): Promise<void> {
|
|
122
124
|
return BaseSDK.validateOrder(intentRequest, '/validate_intent/single_chain/dca_order');
|
|
123
125
|
}
|
|
126
|
+
|
|
127
|
+
public static async validateDcaCrossChainOrder(intentRequest: DcaCrossChainUserIntentRequest): Promise<void> {
|
|
128
|
+
return BaseSDK.validateOrder(intentRequest, '/validate_intent/cross_chain/dca_order');
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
public static async sendDcaCrossChainOrder(intentRequest: DcaCrossChainUserIntentRequest): Promise<ApiResponse> {
|
|
132
|
+
const body = JSON.stringify(intentRequest, Parsers.bigIntReplacer);
|
|
133
|
+
return BaseSDK.makeRequest(`${AUCTIONEER_URL}/user_intent/cross_chain/dca_order`, body);
|
|
134
|
+
}
|
|
124
135
|
}
|
|
@@ -86,13 +86,14 @@ export async function cancelSingleChainOrderInstructions(
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
const cancelLimitOrderIx = getCancelLimitOrderInstruction({
|
|
89
|
-
user: createNoopSigner(orderUserAddress),
|
|
90
89
|
order: orderId,
|
|
91
90
|
guard: guardAddress,
|
|
92
91
|
tokenInMint: chainOrder.data.tokenInMint,
|
|
93
92
|
userTokenInAccount: userTokenInAccount.address,
|
|
94
93
|
guardTokenInAccount: guardProgramAccount,
|
|
95
94
|
tokenInProgram: tokenMintProgram.programAddress,
|
|
95
|
+
signer: createNoopSigner(orderUserAddress),
|
|
96
|
+
user: orderUserAddress
|
|
96
97
|
});
|
|
97
98
|
|
|
98
99
|
instructions.push(cancelLimitOrderIx);
|
|
@@ -245,7 +246,7 @@ export async function cancelCrossChainOrderInstructions(
|
|
|
245
246
|
|
|
246
247
|
// Create the cancel order instruction
|
|
247
248
|
const cancelOrderIx = getCancelOrderInstruction({
|
|
248
|
-
user:
|
|
249
|
+
user: orderUserAddress,
|
|
249
250
|
order: orderId,
|
|
250
251
|
guard: guardAddress,
|
|
251
252
|
recoveredTokenMint: recoverTokenMint,
|
|
@@ -256,6 +257,7 @@ export async function cancelCrossChainOrderInstructions(
|
|
|
256
257
|
userCollateralTokenAccount: userCollateralTokenAccount,
|
|
257
258
|
guardCollateralTokenAccount: guardCollateralTokenAccount,
|
|
258
259
|
collateralTokenProgram: collateralTokenMintProgram.programAddress,
|
|
260
|
+
signer: createNoopSigner(orderUserAddress)
|
|
259
261
|
});
|
|
260
262
|
|
|
261
263
|
instructions.push(cancelOrderIx);
|
|
@@ -76,7 +76,8 @@ export async function cancelDcaSingleChainOrderInstructions(
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
const cancelLimitOrderIx = getCancelDcaOrderInstruction({
|
|
79
|
-
user:
|
|
79
|
+
user: orderUserAddress,
|
|
80
|
+
signer: createNoopSigner(orderUserAddress),
|
|
80
81
|
order: orderId,
|
|
81
82
|
guard: guardAddress,
|
|
82
83
|
tokenInMint: chainOrder.data.tokenInMint,
|
|
@@ -1,32 +1,29 @@
|
|
|
1
|
-
import { BN } from
|
|
2
|
-
import { PublicKey } from
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
1
|
+
import { BN } from 'bn.js';
|
|
2
|
+
import { PublicKey } from '@solana/web3.js';
|
|
3
|
+
import type { ExtraTransfer } from './single-chain-limit-order.js';
|
|
4
|
+
import pkg from 'js-sha3';
|
|
5
|
+
const { keccak256 } = pkg;
|
|
6
6
|
/**
|
|
7
7
|
* Generate secret number and prepare secret hash for single chain DCA orders
|
|
8
8
|
* @param tokenOut Token OUT Pubkey
|
|
9
9
|
* @param receiver Token OUT receiver Pubkey
|
|
10
10
|
* @param extraTransfers Requested extra transfers
|
|
11
11
|
*/
|
|
12
|
-
export function prepareDcaSecretData(
|
|
13
|
-
tokenOut: PublicKey,
|
|
14
|
-
receiver: PublicKey,
|
|
15
|
-
extraTransfers: ExtraTransfer[],
|
|
16
|
-
) {
|
|
12
|
+
export function prepareDcaSecretData(tokenOut: PublicKey, receiver: PublicKey, extraTransfers: ExtraTransfer[]) {
|
|
17
13
|
const secretNumber = new BN(crypto.getRandomValues(new Uint8Array(8)));
|
|
18
|
-
const secretHash = [
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
14
|
+
const secretHash = [
|
|
15
|
+
...Uint8Array.from(
|
|
16
|
+
Buffer.from(
|
|
17
|
+
keccak256([
|
|
18
|
+
...tokenOut.toBuffer(),
|
|
19
|
+
...receiver.toBuffer(),
|
|
20
|
+
...Buffer.concat(extraTransfers.map((t) => Buffer.concat([t.token.toBuffer(), t.receiver.toBuffer()]))),
|
|
21
|
+
...secretNumber.toBuffer('le', 8),
|
|
22
|
+
]),
|
|
23
|
+
'hex',
|
|
24
|
+
),
|
|
25
|
+
),
|
|
26
|
+
];
|
|
30
27
|
|
|
31
28
|
return { secretHash, secretNumber };
|
|
32
29
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { BN } from
|
|
2
|
-
import { PublicKey } from
|
|
3
|
-
import
|
|
1
|
+
import { BN } from 'bn.js';
|
|
2
|
+
import { PublicKey } from '@solana/web3.js';
|
|
3
|
+
import pkg from 'js-sha3';
|
|
4
|
+
const { keccak256 } = pkg;
|
|
4
5
|
|
|
5
6
|
export type ExtraTransfer = {
|
|
6
7
|
token: PublicKey;
|
|
@@ -14,31 +15,28 @@ export type ExtraTransfer = {
|
|
|
14
15
|
* @param receiver Token OUT receiver Pubkey
|
|
15
16
|
* @param extraTransfers Requested extra transfers
|
|
16
17
|
*/
|
|
17
|
-
export function prepareSecretData(
|
|
18
|
-
tokenOut: PublicKey,
|
|
19
|
-
receiver: PublicKey,
|
|
20
|
-
extraTransfers: ExtraTransfer[],
|
|
21
|
-
) {
|
|
18
|
+
export function prepareSecretData(tokenOut: PublicKey, receiver: PublicKey, extraTransfers: ExtraTransfer[]) {
|
|
22
19
|
const secretNumber = new BN(crypto.getRandomValues(new Uint8Array(8)));
|
|
23
|
-
const secretHash = [
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
20
|
+
const secretHash = [
|
|
21
|
+
...Uint8Array.from(
|
|
22
|
+
Buffer.from(
|
|
23
|
+
keccak256([
|
|
24
|
+
...tokenOut.toBuffer(),
|
|
25
|
+
...receiver.toBuffer(),
|
|
26
|
+
...Buffer.concat(extraTransfers.map((t) => Buffer.concat([t.token.toBuffer(), t.receiver.toBuffer()]))),
|
|
27
|
+
...secretNumber.toBuffer('le', 8),
|
|
28
|
+
]),
|
|
29
|
+
'hex',
|
|
30
|
+
),
|
|
31
|
+
),
|
|
32
|
+
];
|
|
35
33
|
|
|
36
34
|
return { secretHash, secretNumber };
|
|
37
35
|
}
|
|
38
36
|
|
|
39
37
|
export function formatTokenPubkey(token: PublicKey) {
|
|
40
|
-
if (token.equals(new PublicKey(
|
|
41
|
-
return PublicKey.default
|
|
38
|
+
if (token.equals(new PublicKey('So11111111111111111111111111111111111111111'))) {
|
|
39
|
+
return PublicKey.default;
|
|
42
40
|
}
|
|
43
41
|
|
|
44
42
|
return token;
|
|
@@ -88,7 +88,7 @@ export type DcaOrder = {
|
|
|
88
88
|
intervalIndexOfLatestExecutionStart: number;
|
|
89
89
|
/** Total number of already executed intervals */
|
|
90
90
|
totalExecutedIntervals: number;
|
|
91
|
-
/** INDEX of last
|
|
91
|
+
/** INDEX of last successfully fulfilled interval */
|
|
92
92
|
lastExecutedIntervalIndex: number;
|
|
93
93
|
};
|
|
94
94
|
|
|
@@ -132,7 +132,7 @@ export type DcaOrderArgs = {
|
|
|
132
132
|
intervalIndexOfLatestExecutionStart: number;
|
|
133
133
|
/** Total number of already executed intervals */
|
|
134
134
|
totalExecutedIntervals: number;
|
|
135
|
-
/** INDEX of last
|
|
135
|
+
/** INDEX of last successfully fulfilled interval */
|
|
136
136
|
lastExecutedIntervalIndex: number;
|
|
137
137
|
};
|
|
138
138
|
|
|
@@ -24,6 +24,8 @@ import {
|
|
|
24
24
|
combineCodec,
|
|
25
25
|
fixDecoderSize,
|
|
26
26
|
fixEncoderSize,
|
|
27
|
+
getArrayDecoder,
|
|
28
|
+
getArrayEncoder,
|
|
27
29
|
getBytesDecoder,
|
|
28
30
|
getBytesEncoder,
|
|
29
31
|
getStructDecoder,
|
|
@@ -33,9 +35,9 @@ import {
|
|
|
33
35
|
getU8Decoder,
|
|
34
36
|
getU8Encoder,
|
|
35
37
|
transformEncoder,
|
|
36
|
-
type
|
|
37
|
-
type
|
|
38
|
-
type
|
|
38
|
+
type Codec,
|
|
39
|
+
type Decoder,
|
|
40
|
+
type Encoder,
|
|
39
41
|
type ReadonlyUint8Array,
|
|
40
42
|
} from '@solana/codecs';
|
|
41
43
|
|
|
@@ -59,6 +61,12 @@ export type Guard = {
|
|
|
59
61
|
auctioneerPubKey: Address;
|
|
60
62
|
/** Amount of collected fees, in collateral tokens */
|
|
61
63
|
collectedFees: bigint;
|
|
64
|
+
/**
|
|
65
|
+
* List of wallets that can cancel user orders. They will be authorized by Admin
|
|
66
|
+
* and used to enhance UX, allowing to avoid paying gas for order cancellation and
|
|
67
|
+
* tokens recovery
|
|
68
|
+
*/
|
|
69
|
+
cancelAuthorities: Array<Address>;
|
|
62
70
|
};
|
|
63
71
|
|
|
64
72
|
export type GuardArgs = {
|
|
@@ -74,9 +82,15 @@ export type GuardArgs = {
|
|
|
74
82
|
auctioneerPubKey: Address;
|
|
75
83
|
/** Amount of collected fees, in collateral tokens */
|
|
76
84
|
collectedFees: number | bigint;
|
|
85
|
+
/**
|
|
86
|
+
* List of wallets that can cancel user orders. They will be authorized by Admin
|
|
87
|
+
* and used to enhance UX, allowing to avoid paying gas for order cancellation and
|
|
88
|
+
* tokens recovery
|
|
89
|
+
*/
|
|
90
|
+
cancelAuthorities: Array<Address>;
|
|
77
91
|
};
|
|
78
92
|
|
|
79
|
-
export function getGuardEncoder():
|
|
93
|
+
export function getGuardEncoder(): Encoder<GuardArgs> {
|
|
80
94
|
return transformEncoder(
|
|
81
95
|
getStructEncoder([
|
|
82
96
|
['discriminator', fixEncoderSize(getBytesEncoder(), 8)],
|
|
@@ -86,12 +100,13 @@ export function getGuardEncoder(): FixedSizeEncoder<GuardArgs> {
|
|
|
86
100
|
['bump', getU8Encoder()],
|
|
87
101
|
['auctioneerPubKey', getAddressEncoder()],
|
|
88
102
|
['collectedFees', getU64Encoder()],
|
|
103
|
+
['cancelAuthorities', getArrayEncoder(getAddressEncoder())],
|
|
89
104
|
]),
|
|
90
105
|
(value) => ({ ...value, discriminator: GUARD_DISCRIMINATOR })
|
|
91
106
|
);
|
|
92
107
|
}
|
|
93
108
|
|
|
94
|
-
export function getGuardDecoder():
|
|
109
|
+
export function getGuardDecoder(): Decoder<Guard> {
|
|
95
110
|
return getStructDecoder([
|
|
96
111
|
['discriminator', fixDecoderSize(getBytesDecoder(), 8)],
|
|
97
112
|
['collateralToken', getAddressDecoder()],
|
|
@@ -100,10 +115,11 @@ export function getGuardDecoder(): FixedSizeDecoder<Guard> {
|
|
|
100
115
|
['bump', getU8Decoder()],
|
|
101
116
|
['auctioneerPubKey', getAddressDecoder()],
|
|
102
117
|
['collectedFees', getU64Decoder()],
|
|
118
|
+
['cancelAuthorities', getArrayDecoder(getAddressDecoder())],
|
|
103
119
|
]);
|
|
104
120
|
}
|
|
105
121
|
|
|
106
|
-
export function getGuardCodec():
|
|
122
|
+
export function getGuardCodec(): Codec<GuardArgs, Guard> {
|
|
107
123
|
return combineCodec(getGuardEncoder(), getGuardDecoder());
|
|
108
124
|
}
|
|
109
125
|
|
|
@@ -156,7 +172,3 @@ export async function fetchAllMaybeGuard(
|
|
|
156
172
|
const maybeAccounts = await fetchEncodedAccounts(rpc, addresses, config);
|
|
157
173
|
return maybeAccounts.map((maybeAccount) => decodeGuard(maybeAccount));
|
|
158
174
|
}
|
|
159
|
-
|
|
160
|
-
export function getGuardSize(): number {
|
|
161
|
-
return 114;
|
|
162
|
-
}
|
|
@@ -21,72 +21,74 @@ export const SOURCE_CHAIN_GUARD_ERROR__NOT_PENDING_ADMIN = 0x1772; // 6002
|
|
|
21
21
|
export const SOURCE_CHAIN_GUARD_ERROR__NOT_A_SOLVER = 0x1773; // 6003
|
|
22
22
|
/** NotAUser: Account is not a User */
|
|
23
23
|
export const SOURCE_CHAIN_GUARD_ERROR__NOT_A_USER = 0x1774; // 6004
|
|
24
|
+
/** NotAUserOrCancelAuthority: Account is not a User or Cancel authority */
|
|
25
|
+
export const SOURCE_CHAIN_GUARD_ERROR__NOT_A_USER_OR_CANCEL_AUTHORITY = 0x1775; // 6005
|
|
24
26
|
/** ZeroAmount: Amount must not be zero */
|
|
25
|
-
export const SOURCE_CHAIN_GUARD_ERROR__ZERO_AMOUNT =
|
|
27
|
+
export const SOURCE_CHAIN_GUARD_ERROR__ZERO_AMOUNT = 0x1776; // 6006
|
|
26
28
|
/** ZeroAmountIn: Amount IN must not be zero */
|
|
27
|
-
export const SOURCE_CHAIN_GUARD_ERROR__ZERO_AMOUNT_IN =
|
|
29
|
+
export const SOURCE_CHAIN_GUARD_ERROR__ZERO_AMOUNT_IN = 0x1777; // 6007
|
|
28
30
|
/** ZeroMinStablecoins: Min stablecoins amount must not be zero */
|
|
29
|
-
export const SOURCE_CHAIN_GUARD_ERROR__ZERO_MIN_STABLECOINS =
|
|
31
|
+
export const SOURCE_CHAIN_GUARD_ERROR__ZERO_MIN_STABLECOINS = 0x1778; // 6008
|
|
30
32
|
/** WrongOrder: Wrong order */
|
|
31
|
-
export const SOURCE_CHAIN_GUARD_ERROR__WRONG_ORDER =
|
|
33
|
+
export const SOURCE_CHAIN_GUARD_ERROR__WRONG_ORDER = 0x1779; // 6009
|
|
32
34
|
/** InvalidGuard: Invalid Guard */
|
|
33
|
-
export const SOURCE_CHAIN_GUARD_ERROR__INVALID_GUARD =
|
|
35
|
+
export const SOURCE_CHAIN_GUARD_ERROR__INVALID_GUARD = 0x177a; // 6010
|
|
34
36
|
/** ExpiredDeadline: Expired deadline */
|
|
35
|
-
export const SOURCE_CHAIN_GUARD_ERROR__EXPIRED_DEADLINE =
|
|
37
|
+
export const SOURCE_CHAIN_GUARD_ERROR__EXPIRED_DEADLINE = 0x177b; // 6011
|
|
36
38
|
/** InvalidStartPermission: Invalid permission */
|
|
37
|
-
export const SOURCE_CHAIN_GUARD_ERROR__INVALID_START_PERMISSION =
|
|
39
|
+
export const SOURCE_CHAIN_GUARD_ERROR__INVALID_START_PERMISSION = 0x177c; // 6012
|
|
38
40
|
/** InvalidSuccessConfirmation: Invalid success confirmation */
|
|
39
|
-
export const SOURCE_CHAIN_GUARD_ERROR__INVALID_SUCCESS_CONFIRMATION =
|
|
41
|
+
export const SOURCE_CHAIN_GUARD_ERROR__INVALID_SUCCESS_CONFIRMATION = 0x177d; // 6013
|
|
40
42
|
/** OrderIsBeingExecuted: Order is being executed */
|
|
41
|
-
export const SOURCE_CHAIN_GUARD_ERROR__ORDER_IS_BEING_EXECUTED =
|
|
43
|
+
export const SOURCE_CHAIN_GUARD_ERROR__ORDER_IS_BEING_EXECUTED = 0x177e; // 6014
|
|
42
44
|
/** InvalidRecoverToken: Invalid recover token */
|
|
43
|
-
export const SOURCE_CHAIN_GUARD_ERROR__INVALID_RECOVER_TOKEN =
|
|
45
|
+
export const SOURCE_CHAIN_GUARD_ERROR__INVALID_RECOVER_TOKEN = 0x177f; // 6015
|
|
44
46
|
/** AccountNotProvided: Account not provided */
|
|
45
|
-
export const SOURCE_CHAIN_GUARD_ERROR__ACCOUNT_NOT_PROVIDED =
|
|
47
|
+
export const SOURCE_CHAIN_GUARD_ERROR__ACCOUNT_NOT_PROVIDED = 0x1780; // 6016
|
|
46
48
|
/** CpiCallNotAllowed: CPI call is not allowed */
|
|
47
|
-
export const SOURCE_CHAIN_GUARD_ERROR__CPI_CALL_NOT_ALLOWED =
|
|
49
|
+
export const SOURCE_CHAIN_GUARD_ERROR__CPI_CALL_NOT_ALLOWED = 0x1781; // 6017
|
|
48
50
|
/** FeeTransferNotAllowed: Fee transfer not allowed */
|
|
49
|
-
export const SOURCE_CHAIN_GUARD_ERROR__FEE_TRANSFER_NOT_ALLOWED =
|
|
51
|
+
export const SOURCE_CHAIN_GUARD_ERROR__FEE_TRANSFER_NOT_ALLOWED = 0x1782; // 6018
|
|
50
52
|
/** InvalidIntervalDuration: Invalid interval duration */
|
|
51
|
-
export const SOURCE_CHAIN_GUARD_ERROR__INVALID_INTERVAL_DURATION =
|
|
53
|
+
export const SOURCE_CHAIN_GUARD_ERROR__INVALID_INTERVAL_DURATION = 0x1783; // 6019
|
|
52
54
|
/** SwapNotAllowed: Swap is not allowed */
|
|
53
|
-
export const SOURCE_CHAIN_GUARD_ERROR__SWAP_NOT_ALLOWED =
|
|
55
|
+
export const SOURCE_CHAIN_GUARD_ERROR__SWAP_NOT_ALLOWED = 0x1784; // 6020
|
|
54
56
|
/** NoAfterSwapInstructionFound: No _after_swap instruction found */
|
|
55
|
-
export const SOURCE_CHAIN_GUARD_ERROR__NO_AFTER_SWAP_INSTRUCTION_FOUND =
|
|
57
|
+
export const SOURCE_CHAIN_GUARD_ERROR__NO_AFTER_SWAP_INSTRUCTION_FOUND = 0x1785; // 6021
|
|
56
58
|
/** InvalidAfterSwapInstruction: Invalid _after_swap instruction */
|
|
57
|
-
export const SOURCE_CHAIN_GUARD_ERROR__INVALID_AFTER_SWAP_INSTRUCTION =
|
|
59
|
+
export const SOURCE_CHAIN_GUARD_ERROR__INVALID_AFTER_SWAP_INSTRUCTION = 0x1786; // 6022
|
|
58
60
|
/** AlreadySwapped: Tokens IN were already swapped */
|
|
59
|
-
export const SOURCE_CHAIN_GUARD_ERROR__ALREADY_SWAPPED =
|
|
61
|
+
export const SOURCE_CHAIN_GUARD_ERROR__ALREADY_SWAPPED = 0x1787; // 6023
|
|
60
62
|
/** SwapWasNotInitiated: Swap wasn't initiated */
|
|
61
|
-
export const SOURCE_CHAIN_GUARD_ERROR__SWAP_WAS_NOT_INITIATED =
|
|
63
|
+
export const SOURCE_CHAIN_GUARD_ERROR__SWAP_WAS_NOT_INITIATED = 0x1788; // 6024
|
|
62
64
|
/** BelowMinStablecoinsAmount: Below minimum stablecoins amount */
|
|
63
|
-
export const SOURCE_CHAIN_GUARD_ERROR__BELOW_MIN_STABLECOINS_AMOUNT =
|
|
65
|
+
export const SOURCE_CHAIN_GUARD_ERROR__BELOW_MIN_STABLECOINS_AMOUNT = 0x1789; // 6025
|
|
64
66
|
/** CollateralTokenAccountsNotProvided: Collateral token accounts not provided */
|
|
65
|
-
export const SOURCE_CHAIN_GUARD_ERROR__COLLATERAL_TOKEN_ACCOUNTS_NOT_PROVIDED =
|
|
67
|
+
export const SOURCE_CHAIN_GUARD_ERROR__COLLATERAL_TOKEN_ACCOUNTS_NOT_PROVIDED = 0x178a; // 6026
|
|
66
68
|
/** StablecoinAccountsNotProvided: Stablecoin accounts not provided */
|
|
67
|
-
export const SOURCE_CHAIN_GUARD_ERROR__STABLECOIN_ACCOUNTS_NOT_PROVIDED =
|
|
69
|
+
export const SOURCE_CHAIN_GUARD_ERROR__STABLECOIN_ACCOUNTS_NOT_PROVIDED = 0x178b; // 6027
|
|
68
70
|
/** RecoverTokenAccountsNotProvided: Recover token accounts not provided */
|
|
69
|
-
export const SOURCE_CHAIN_GUARD_ERROR__RECOVER_TOKEN_ACCOUNTS_NOT_PROVIDED =
|
|
71
|
+
export const SOURCE_CHAIN_GUARD_ERROR__RECOVER_TOKEN_ACCOUNTS_NOT_PROVIDED = 0x178c; // 6028
|
|
70
72
|
/** InvalidDestTokenAccount: Invalid dest token account */
|
|
71
|
-
export const SOURCE_CHAIN_GUARD_ERROR__INVALID_DEST_TOKEN_ACCOUNT =
|
|
73
|
+
export const SOURCE_CHAIN_GUARD_ERROR__INVALID_DEST_TOKEN_ACCOUNT = 0x178d; // 6029
|
|
72
74
|
/** OrderIsCancelled: Order is cancelled */
|
|
73
|
-
export const SOURCE_CHAIN_GUARD_ERROR__ORDER_IS_CANCELLED =
|
|
75
|
+
export const SOURCE_CHAIN_GUARD_ERROR__ORDER_IS_CANCELLED = 0x178e; // 6030
|
|
74
76
|
/** OrderIsFulfilled: Order is fulfilled */
|
|
75
|
-
export const SOURCE_CHAIN_GUARD_ERROR__ORDER_IS_FULFILLED =
|
|
77
|
+
export const SOURCE_CHAIN_GUARD_ERROR__ORDER_IS_FULFILLED = 0x178f; // 6031
|
|
76
78
|
/** InvalidDcaOrder: Invalid DCA order */
|
|
77
|
-
export const SOURCE_CHAIN_GUARD_ERROR__INVALID_DCA_ORDER =
|
|
79
|
+
export const SOURCE_CHAIN_GUARD_ERROR__INVALID_DCA_ORDER = 0x1790; // 6032
|
|
78
80
|
/** IntervalWasAlreadyClaimed: Interval was already claimed */
|
|
79
|
-
export const SOURCE_CHAIN_GUARD_ERROR__INTERVAL_WAS_ALREADY_CLAIMED =
|
|
81
|
+
export const SOURCE_CHAIN_GUARD_ERROR__INTERVAL_WAS_ALREADY_CLAIMED = 0x1791; // 6033
|
|
80
82
|
/** CantStartOrderExecutionDuringThisInterval: Cant start order execution during this interval */
|
|
81
|
-
export const SOURCE_CHAIN_GUARD_ERROR__CANT_START_ORDER_EXECUTION_DURING_THIS_INTERVAL =
|
|
83
|
+
export const SOURCE_CHAIN_GUARD_ERROR__CANT_START_ORDER_EXECUTION_DURING_THIS_INTERVAL = 0x1792; // 6034
|
|
82
84
|
/** PreviousIntervalCollateralTokenAccountNotProvided: Previous interval collateral token account not provided */
|
|
83
|
-
export const SOURCE_CHAIN_GUARD_ERROR__PREVIOUS_INTERVAL_COLLATERAL_TOKEN_ACCOUNT_NOT_PROVIDED =
|
|
85
|
+
export const SOURCE_CHAIN_GUARD_ERROR__PREVIOUS_INTERVAL_COLLATERAL_TOKEN_ACCOUNT_NOT_PROVIDED = 0x1793; // 6035
|
|
84
86
|
/** InstructionNotFound: Ed25519Program instruction */
|
|
85
|
-
export const SOURCE_CHAIN_GUARD_ERROR__INSTRUCTION_NOT_FOUND =
|
|
87
|
+
export const SOURCE_CHAIN_GUARD_ERROR__INSTRUCTION_NOT_FOUND = 0x1794; // 6036
|
|
86
88
|
/** SigVerificationFailed: Signature verification failed */
|
|
87
|
-
export const SOURCE_CHAIN_GUARD_ERROR__SIG_VERIFICATION_FAILED =
|
|
89
|
+
export const SOURCE_CHAIN_GUARD_ERROR__SIG_VERIFICATION_FAILED = 0x1795; // 6037
|
|
88
90
|
/** InvalidSigner: Invalid signer */
|
|
89
|
-
export const SOURCE_CHAIN_GUARD_ERROR__INVALID_SIGNER =
|
|
91
|
+
export const SOURCE_CHAIN_GUARD_ERROR__INVALID_SIGNER = 0x1796; // 6038
|
|
90
92
|
|
|
91
93
|
export type SourceChainGuardError =
|
|
92
94
|
| typeof SOURCE_CHAIN_GUARD_ERROR__ACCOUNT_NOT_PROVIDED
|
|
@@ -112,6 +114,7 @@ export type SourceChainGuardError =
|
|
|
112
114
|
| typeof SOURCE_CHAIN_GUARD_ERROR__NOT_ADMIN
|
|
113
115
|
| typeof SOURCE_CHAIN_GUARD_ERROR__NOT_A_SOLVER
|
|
114
116
|
| typeof SOURCE_CHAIN_GUARD_ERROR__NOT_A_USER
|
|
117
|
+
| typeof SOURCE_CHAIN_GUARD_ERROR__NOT_A_USER_OR_CANCEL_AUTHORITY
|
|
115
118
|
| typeof SOURCE_CHAIN_GUARD_ERROR__NOT_PENDING_ADMIN
|
|
116
119
|
| typeof SOURCE_CHAIN_GUARD_ERROR__NOT_UPGRADE_AUTHORITY
|
|
117
120
|
| typeof SOURCE_CHAIN_GUARD_ERROR__ORDER_IS_BEING_EXECUTED
|
|
@@ -154,6 +157,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
154
157
|
[SOURCE_CHAIN_GUARD_ERROR__NOT_ADMIN]: `Account is not Admin`,
|
|
155
158
|
[SOURCE_CHAIN_GUARD_ERROR__NOT_A_SOLVER]: `Account is not a Solver`,
|
|
156
159
|
[SOURCE_CHAIN_GUARD_ERROR__NOT_A_USER]: `Account is not a User`,
|
|
160
|
+
[SOURCE_CHAIN_GUARD_ERROR__NOT_A_USER_OR_CANCEL_AUTHORITY]: `Account is not a User or Cancel authority`,
|
|
157
161
|
[SOURCE_CHAIN_GUARD_ERROR__NOT_PENDING_ADMIN]: `Account is not Pending Admin`,
|
|
158
162
|
[SOURCE_CHAIN_GUARD_ERROR__NOT_UPGRADE_AUTHORITY]: `Account is not upgrade authority`,
|
|
159
163
|
[SOURCE_CHAIN_GUARD_ERROR__ORDER_IS_BEING_EXECUTED]: `Order is being executed`,
|