Skip to content

Commit 1f59bbb

Browse files
Merge branch 'main' into feat/aa21
2 parents 5f12f3d + bf266b8 commit 1f59bbb

2 files changed

Lines changed: 36 additions & 1 deletion

File tree

smart-accounts-kit/troubleshooting/error-codes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Error codes from the [MetaMask Delegation Framework contracts](https://github.co
1414
| Error code | Error name | Description |
1515
| ---------- | ---------- | ----------- |
1616
| `0xb5863604` | `InvalidDelegate()` | The caller is not the delegate specified in the delegation.<br/><br/>See [Invalid delegate troubleshooting page](./invalid-delegate.md) to learn more. |
17-
| `0xb9f0f171` | `InvalidDelegator()` | The caller is not the delegator specificed in the delegation, or the delegator is not deployed. |
17+
| `0xb9f0f171` | `InvalidDelegator()` | The caller is not the delegator specificed in the delegation.<br/><br/>See [Invalid delegator troubleshooting page](./invalid-delegator.md) to learn more. |
1818
| `0x05baa052` | `CannotUseADisabledDelegation()` | The delegation has been disabled by the delegator. |
1919
| `0xded4370e` | `InvalidAuthority()` | The delegation chain authority validation failed. The authority hash of a child delegation does not match the hash of its parent delegation. |
2020
| `0x1bcaf69f` | `BatchDataLengthMismatch()` | The array lengths do not match in a batch `redeemDelegations` contract call. |
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
description: How to resolve the InvalidDelegator error.
3+
sidebar_label: Invalid delegator
4+
keywords: [InvalidDelegator, error code, delegation, troubleshooting]
5+
---
6+
7+
# Invalid delegator
8+
9+
The Delegation Manager reverts with `InvalidDelegator()` when the caller is not the delegator
10+
specified in the delegation.
11+
12+
This error is thrown by the `disableDelegation` and `enableDelegation` contract functions. Only the
13+
account that created the delegation can [disable](../guides/delegation/disable-delegation.md)
14+
or enable it.
15+
16+
## Solution
17+
18+
Verify that you're sending the transaction from the delegator's account. If the delegator is a smart account, submit a user operation through the smart account.
19+
20+
```typescript
21+
import { DelegationManager } from "@metamask/smart-accounts-kit/contracts";
22+
23+
// Generate calldata to disable the delegation.
24+
const disableCalldata = DelegationManager.encode.disableDelegation({
25+
delegation: signedDelegation, // Signed by delegatorSmartAccount
26+
});
27+
28+
const userOpHash = await bundlerClient.sendUserOperation({
29+
account: delegatorSmartAccount,
30+
calls: [{
31+
to: delegatorSmartAccount.environment.DelegationManager,
32+
data: disableCalldata,
33+
}],
34+
});
35+
```

0 commit comments

Comments
 (0)