Most developers should use
revoke() instead, which handles execution automatically using CDP wallets. This function is for advanced use cases requiring custom transaction handling.The
prepareRevoke function prepares the necessary transaction call to revoke a subscription. It returns call data that you can execute through your own wallet infrastructure using wallet_sendCalls or eth_sendTransaction.When to Use This
UseprepareRevoke only if you need:
- Custom wallet infrastructure (not using CDP)
- Manual transaction control
- Integration with existing wallet systems
revoke() instead.
Parameters
The subscription ID (permission hash) returned from
subscribe().Pattern: ^0x[0-9a-fA-F]{64}$Must match the testnet setting used in the original subscribe call. Default: false
Returns
Single transaction call to execute the revocation.
Error Handling
Comparison with revoke()
- Using prepareRevoke (Advanced)
- Using revoke() (Recommended)
Important Notes
Security: You must execute the revoke call from the subscription owner wallet. Executing from any other wallet will fail.
Network Matching: The
testnet parameter must match the network used when creating the subscription with subscribe().Common Errors
Subscription Not Found
Subscription Not Found
Wrong Signer
Wrong Signer
If you execute the transaction from a wallet that isn’t the subscription owner, the transaction will revert.Solution: Ensure you’re using the same wallet address that was specified as
subscriptionOwner in the subscribe() call.Network Mismatch
Network Mismatch
Using
testnet: false for a subscription created on testnet (or vice versa) will cause errors.Solution: Match the testnet parameter to the network where the subscription was created.Migration to revoke()
If you’re currently usingprepareRevoke, consider migrating to revoke():
Before (prepareRevoke)
After (revoke)