How to specify actions to perform after a route of transfers/swaps is completed
post_route_handler
parameter of /v2/fungible/msgs
endpoint to define actions that will be executed on the destination chain after a route transfer or swap is completed. These actions are executed within the same transaction as the original swap or transfer.
This handler allows developers to build omni-chain and omni-token workflows where users can swap, liquid stake, deposit, buy an NFT, or take any other action starting from any chain or any token in Cosmos — all in a single transaction.
This parameter currently supports:
autopilot
support for liquid staking interactions on Stridepost_route
actions must have the following characteristics:
ibc-hooks
and ibc-callbacks
depending on which module the destination chain has implemented (they are incompatible approaches), automatically generating the appropriate message payloads for each. This means one user originating on two different chains or starting with two different tokens will eventually call the final contract / module with different addresses. You can only reliably permission actions that you know will 1) always originate on the same chain and 2) always take the same path to the destination chain. In general, we recommend not making this assumption unless you are an interoperability expertpost_route_handler
must not require multiple token denoms sent to it simultaneously. For example, a classic LP action where the user must provide tokens in both sides of the pool simultaneously would not work.receiver
parameter in the provide_liquidity
messageon_behalf_of
parameter in the deposit
messageto
parameter in the swap
messageibc-hooks
or ibc-callbacks
.packet-forward-middleware
.wasm_msg
as the post_route_handler
in the /v2/fungible/msgs
call with:
contract_address
: The target contract addressmsg
: JSON string of the message to pass to the contractaddress_list
to the address of the contract.
For example, this is a request for a transfer of USDC from Axelar to Neutron, with a post-route handler that swaps the USDC to Neutron using an Astroport pool on Neutron:
address_list
is the address of the pool contract on Neutron, rather than a user address.
The message returned from this request uses ibc-hooks
on Neutron to perform the CosmWasm contract call atomically with the IBC transfer.
autopilot
module. Currently, this means the destination chain must be stride-1
.packet-forward-middleware
.autopilot_msg
as the post_route_handler
in the /v2/fungible/msgs
call with:
receiver
: Set to the address on behalf of which you’re performing the actionaction
: An enum giving the action that you wish to execute
LIQUID_STAKE
(for liquid staking an asset) or CLAIM
for updating airdrop claim addresses.