Routing Strategies
Understand delegate
and route
routing strategies for shortcuts APIs.
When using the Shortcuts endpoints (/shortcuts/route
and /shortcuts/bundle
), you must choose between two routing strategies: router
and delegate
.
Based on the strategy you choose, the Enso API will route your transaction through the appropriate smart contract.
Use the tx.to
response value when sending on-chain a shortcut transaction you obtained.
By avoiding hardcoded addresses, your shortcuts will always be routed to the correct contract, even if the address changes in the future. For specific addresses, check out Deployments
When to use delegate
or router
?
You must use delegate when:
- dealing with non-tokenized positions where the state is stored in the protocol rather than represented by a token
- you need the state to persist in the user’s smart wallet.
Smart Wallets with delegate
Use delegate
for smart wallets supporting delegatecall
:
- Enables both tokenized and non-tokenized interactions
- The state stays in the smart wallet itself.
- Complex, multi-step operations are more efficient and safer when executed through a smart wallet
- Simple approval model
- Limited to token-based operations
EOAs with router
Use router
strategy for EOAs or simpler smart wallets:
- Works with tokenized interactions only
- Uses the universal router contract.
- Supports tokenized and non-tokenized interactions
- Enables complex DeFi strategies
- Works with lending positions and other stateful interactions
Updated
Was this page helpful?