Skip to content

Commit dc9f354

Browse files
authored
Merge pull request #7575 from BitGo/WP-6950-pending-approval
docs(express): pendingApprovalV1 API definition
2 parents d7355e6 + 9fc1414 commit dc9f354

File tree

1 file changed

+38
-12
lines changed

1 file changed

+38
-12
lines changed

modules/express/src/typedRoutes/api/v1/pendingApproval.ts

Lines changed: 38 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,53 @@ export const pendingApprovalRequestParams = {
88
};
99

1010
export const pendingApprovalRequestBody = {
11-
/** State of the approval: 'approved' to approve, omit or 'rejected' to reject (defaults to rejection) */
11+
/** State of the approval: 'approved' to approve, any other value or omit to reject (defaults to rejection) */
1212
state: optional(t.string),
13-
/** Wallet passphrase for decrypting user keys (required for transaction signing) */
13+
/** Wallet passphrase for transaction signing (required for transactionRequest approvals unless tx or xprv provided) */
1414
walletPassphrase: optional(t.string),
1515
/** One-time password for 2FA verification */
1616
otp: optional(t.string),
17-
/** Transaction hex to use instead of the original transaction */
17+
/** Pre-signed transaction hex to use instead of reconstructing (for transactionRequest approvals) */
1818
tx: optional(t.string),
19-
/** Private key in string form (as an alternative to wallet passphrase) */
19+
/** Extended private key as alternative to walletPassphrase (for transactionRequest approvals) */
2020
xprv: optional(t.string),
21-
/** If true, returns information about pending transactions without approving */
21+
/** If true, returns information about pending transactions without approving (unused in V1) */
2222
previewPendingTxs: optional(t.boolean),
23-
/** Alternative ID for the pending approval */
23+
/** Alternative ID for the pending approval (unused in V1) */
2424
pendingApprovalId: optional(t.string),
2525
};
2626

2727
/**
28-
* Pending Approval Request
29-
* Approve or reject a pending approval by its ID.
30-
* Handles various approval scenarios including transaction approvals, policy rule changes,
31-
* and user change requests.
28+
* Approve or reject a pending approval
29+
*
30+
* Updates the state of a pending approval to either 'approved' or 'rejected' based on the
31+
* state parameter. If state is 'approved', the approval is approved; otherwise, it is rejected.
32+
* Default behavior (when state is omitted) is rejection.
33+
*
34+
* **Approval Types:**
35+
* - **transactionRequest**: Transaction approvals (may require walletPassphrase for signing)
36+
* - **policyRuleRequest**: Policy changes (no transaction signing needed)
37+
* - **tagUpdateRequest**: Tag updates
38+
* - Other types: User changes, enterprise updates, etc.
39+
*
40+
* **Transaction Approval Behavior (transactionRequest type):**
41+
* - If `tx` provided: Uses the provided transaction hex directly
42+
* - If `walletPassphrase` or `xprv` provided: Reconstructs and signs transaction with current unspents
43+
* - If neither provided: Uses original transaction (works for sweeps and view-only approvers)
44+
* - Automatically retries with reconstruction if unspents expire during approval
45+
*
46+
* **Multi-Approval Wallets:**
47+
* If approvalsRequired > 1, the state may be 'pending' after approval (not 'approved' until
48+
* all required approvals are received).
49+
*
50+
* **Response:** Returns the updated pending approval object including:
51+
* - id: Pending approval ID
52+
* - state: Current state ('approved', 'rejected', 'pending', or 'canceled')
53+
* - info: Approval-specific information (transactionRequest, policyRuleRequest, etc.)
54+
* - walletId: Wallet ID (if wallet-owned)
55+
* - enterprise: Enterprise ID (if enterprise-owned)
56+
* - creator: User ID who created the approval
57+
* - approvalsRequired: Number of approvals needed (for multi-approval wallets)
3258
*
3359
* @operationId express.v1.pendingapprovals
3460
* @tag express
@@ -42,9 +68,9 @@ export const PutPendingApproval = httpRoute({
4268
body: pendingApprovalRequestBody,
4369
}),
4470
response: {
45-
/** Successfully updated pending approval */
71+
/** Successfully updated pending approval. Returns the updated pending approval object with new state and info. */
4672
200: t.UnknownRecord,
47-
/** Error response */
73+
/** Error response (e.g., invalid ID, insufficient permissions, missing authentication, unspents expired without passphrase) */
4874
400: BitgoExpressError,
4975
},
5076
});

0 commit comments

Comments
 (0)