-
-
Notifications
You must be signed in to change notification settings - Fork 268
feat: Attach metadata when submitting a revocation to the permission provider snap #7503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
c4ef167
8df3ad6
e065992
970b799
8b709c0
85210a0
85570cf
378443a
9002511
b345334
52b2bef
50338af
6b0625d
5417702
2ea2304
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,7 +34,10 @@ import { | |
| } from './errors'; | ||
| import { controllerLog } from './logger'; | ||
| import { GatorPermissionsSnapRpcMethod } from './types'; | ||
| import type { StoredGatorPermissionSanitized } from './types'; | ||
| import type { | ||
| RevocationMetadata, | ||
| StoredGatorPermissionSanitized, | ||
| } from './types'; | ||
| import type { | ||
| GatorPermissionsMap, | ||
| PermissionTypesWithCustom, | ||
|
|
@@ -944,9 +947,28 @@ export default class GatorPermissionsController extends BaseController< | |
| controllerLog('Transaction confirmed, submitting revocation', { | ||
| txId, | ||
| permissionContext, | ||
| txHash: transactionMeta.hash, | ||
| }); | ||
|
|
||
| this.submitRevocation({ permissionContext }) | ||
| // Attach metadata by parsing the confirmed transactionMeta | ||
| const { hash } = transactionMeta; | ||
| const revocationMetadata: RevocationMetadata = { | ||
| txHash: hash as Hex | undefined, | ||
| }; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Metadata object contains undefined key instead of being emptyMedium Severity When |
||
| if (hash === undefined) { | ||
| controllerLog( | ||
| 'Failed to attach transaction hash after revocation transaction confirmed', | ||
| { | ||
| txId, | ||
| permissionContext, | ||
| error: new Error( | ||
| 'Confirmed transaction is missing transaction hash', | ||
| ), | ||
| }, | ||
| ); | ||
| } | ||
|
|
||
| this.submitRevocation({ permissionContext, revocationMetadata }) | ||
| .catch((error) => { | ||
cursor[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| controllerLog( | ||
| 'Failed to submit revocation after transaction confirmed', | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not strictly related to this PR - but do we need to check
transactionMeta.statushere?When a transaction is confirmed, do we explicitly guard against failed transactions?