After placing a cross-chain order, the maker must monitor for escrow deployment and reveal cryptographic secrets to finalize the swap. This page explains the secret submission lifecycle.
Secret Submission Flow
- Wait for escrow creation — After your order is matched, escrow contracts are deployed on both source and destination chains
- Check readiness — Use
getReadyToAcceptSecretFills(orderHash)to verify both escrows are in place and finality locks have passed - Submit secrets — Use
submitSecret(orderHash, secret)to reveal each secret and unlock the escrows - Verify completion — Use
getOrderStatus(orderHash)to confirm the order is marked asexecuted
Key Methods
- getReadyToAcceptSecretFills(orderHash) — Returns which fill indices are ready for secret submission. Poll this repeatedly after order placement.
- submitSecret(orderHash, secret) — Reveals a secret to unlock escrows. For multi-fill orders, submit secrets one at a time as each fill becomes ready.
- getOrderStatus(orderHash) — Returns the current order status (
pending,executed,expired,refunded). - getPublishedSecrets(orderHash) — Checks which secrets have already been revealed by other resolvers.
Partial Fill Handling
For large orders split across multiple resolvers, each fill gets its own secret. The fills array from getReadyToAcceptSecretFills tells you which indices need secrets. Track submitted indices to avoid duplicates.
Interactive Code Example
See the complete secret submission loop in context: