Clawback
Theclawback
function is a recovery mechanism for users who have sent funds to an AMM pool for an operation (like a swap or liquidity addition) that never completed. If a user’s inbound transfer gets “stuck,” this function allows them to request a refund from the AMM validators.
When to Use Clawback
You should only use theclawback
function after an operation has failed and you have a sparkTransferId
for a transfer that was sent to an LP wallet but was not processed. This is an exceptional recovery tool and should not be part of a normal application flow.
How it Works
The user signs an intent asserting ownership of the stuck transfer. The AMM validators verify that the transfer was indeed never used in a successful operation and then refund the assets to the original sender.Implementation
- The
sparkTransferId
of the original, stuck transfer. - The
lpIdentityPublicKey
(the pool ID) to which the funds were sent.
client
must be the one that originally sent the funds.