Open
Add revoke-operator flow to AI Credits Manage tab with signed backend action and confirmation dialog#189
Conversation
Contributor
There was a problem hiding this comment.
Copilot wasn't able to review any files in this pull request.
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
6 tasks
Co-authored-by: sirpy <671095+sirpy@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add red 'Revoke Operator' button with confirmation dialog
Add revoke-operator flow to AI Credits Manage tab with signed backend action and confirmation dialog
Aug 20, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 12 changed files in this pull request and generated no new comments.
Suppressed comments (3)
packages/ai-credits-widget/src/components/manage/BuyerOperatorCard.tsx:194
onAcceptalways callscloseDialog()viafinally, so the dialog closes even ifactions.revokeOperatorConsent()fails. That preventsGoodWidgetDialogfrom showing its built-in error state and can look like the revoke succeeded even when it didn’t. Close the dialog only after a successful revoke and let thrown errors keep the dialog open (so status can flip to error).
onAccept: async () => {
try {
await actions.revokeOperatorConsent()
} finally {
closeDialog()
packages/ai-credits-widget/src/mocked/chainClient.ts:91
AiCreditsChainClient.getBuyerAuthNoncetakes abuyerargument, butMockAiCreditsChainClient.getBuyerAuthNoncedoesn’t. Even though extra args are ignored at runtime, keeping the mock signature aligned avoids confusion and prevents future refactors from accidentally relying on an unused parameter.
async getBuyerAuthNonce(): Promise<bigint> {
return 0n
}
packages/ai-credits-widget/src/backendClient.ts:56
- This PR changes the signed request contract for existing operations by replacing the
timestampfield withnonce(e.g.,WithdrawPrincipalRequest, and similarlyChannelOperationRequest+ the EIP-712 types inbuyerSignatures.ts). That’s an API/contract change that will break older backends unless they’ve been updated in lockstep. Please confirm backend compatibility (or consider supporting bothtimestampandnonceduring a transition) since the PR/issue scope is primarily the revoke-operator flow.
export type WithdrawPrincipalRequest = {
amount: string
recipient: string
nonce: string
signature: string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Users could grant operator consent in
BuyerOperatorCardbut had no revoke path. This adds a deliberate revoke flow in the Manage tab: a red action button gated by current consent state, a confirmation dialog with bonus-impact warnings, and an end-to-end signed revoke request to the backend.Manage-tab UX: conditional revoke control
BuyerOperatorCard.operatorConsented === true.Confirmation gate via existing dialog primitives
createDialog+GoodWidgetDialog), without introducing new UI primitives.Runtime/action plumbing for revoke
revokeOperatorConsentto widget action contract and adapter action surface.falseon success,Backend client integration
backendClient.POST /v1/accounts/:account/operator-revokecall with{ nonce, signature }.Story/QA fixture updates
revokeOperatorConsent.