For the complete documentation index, see llms.txt. This page is also available as Markdown.

Delegate the TPSL bot

Why. This is separate from delegating the session key. The conditional-orders handler (the service that holds your TP/SL orders and fires them when triggers hit) also checks that its own operator address is authorized on your sub-account, not just your session key. If only the session-key delegation ran, the TP/SL endpoint returns "parent subaccount has not delegated required access to COH for selectors=REQUEST_TO_CLOSE_POSITION" even though the session key is fine. The bot needs permission to execute closes on your behalf when a trigger fires.

Signed by. Owner EOA, again on the InstantLayer's grantDelegation.

DelegationInfo:

  • account: (subAccount, isPartyB=false)

  • delegatedSigner: <TPSL bot operator address> (the deployment's TPSL bot operator)

  • selectors: four entries: 0x501e891f (real requestToClosePosition), 0xeaa31b19 (Conditional Order Handler's ID), 0xee9ef781 (requestToClosePosition overload that takes a upnlSig), and 0x00000001. The COH probes more than one of these depending on the position state, so granting them all is the path of least surprise.

  • expiryTimestamp: same as the session key's expiry.

So per session refresh you do two grantDelegation calls: one for the session key with five selectors, one for the bot operator with four selectors. Same EOA signs both.

Last updated