@@ -8,13 +8,11 @@ export const signTransactionRequestParams = {
88} ;
99
1010export const signTransactionRequestBody = {
11- /** Serialized form of the transaction in hex */
11+ /** Serialized unsigned transaction in hex format (required for regular signing, not used with psbt) */
1212 transactionHex : t . string ,
13- /** array of unspent information, where each unspent is a chainPath
14- and redeemScript with the same index as the inputs in the
15- transactionHex */
13+ /** Array of unspent information matching transaction inputs - each contains chainPath and redeemScript (required for regular signing, not used with psbt) */
1614 unspents : t . array ( t . any ) ,
17- /** Keychain containing the xprv to sign with (either this or signingKey required ) */
15+ /** Keychain containing xprv for signing (required for PSBT signing, or for regular signing if signingKey not provided ) */
1816 keychain : optional (
1917 t . intersection ( [
2018 t . type ( {
@@ -23,23 +21,44 @@ export const signTransactionRequestBody = {
2321 t . record ( t . string , t . any ) ,
2422 ] )
2523 ) ,
26- /** For legacy safe wallets, the private key string (either this or keychain required ) */
24+ /** For legacy safe wallets, WIF private key (alternative to keychain for regular signing only, not used with psbt ) */
2725 signingKey : optional ( t . string ) ,
28- /** extra verification of signatures (which are always verified server-side) (defaults to global config ) */
26+ /** Extra signature verification (defaults to global BitGo config, always verified server-side) */
2927 validate : optional ( t . boolean ) ,
30- /** PSBT (Partially Signed Bitcoin Transaction) in hex format for PSBT signing flow */
28+ /** PSBT (Partially Signed Bitcoin Transaction) in hex format - when provided, uses PSBT signing flow instead of regular signing */
3129 psbt : optional ( t . string ) ,
32- /** Private key in WIF format for single-key fee address */
30+ /** WIF private key for signing single-key fee address inputs (used when transaction has fee inputs from single-key addresses) */
3331 feeSingleKeyWIF : optional ( t . string ) ,
34- /** Enable Bitcoin Cash signing mode */
32+ /** Enable Bitcoin Cash signing mode for BCH transactions */
3533 forceBCH : optional ( t . boolean ) ,
3634 /** Require at least two valid signatures for full local signing */
3735 fullLocalSigning : optional ( t . boolean ) ,
3836} ;
3937
4038/**
41- * signTransaction
42- * Sign a previously created transaction with a keychain
39+ * Sign a transaction with wallet's user key
40+ *
41+ * Signs a previously created unsigned transaction with the wallet's user key. This endpoint
42+ * supports two signing flows: regular transaction signing and PSBT (Partially Signed Bitcoin
43+ * Transaction) signing.
44+ *
45+ * **Regular Transaction Signing:**
46+ * Required parameters:
47+ * - transactionHex: The unsigned transaction in hex format
48+ * - unspents: Array of unspent information (chainPath, redeemScript) matching transaction inputs
49+ * - keychain.xprv OR signingKey: Private key for signing
50+ *
51+ * **PSBT Signing:**
52+ * Required parameters:
53+ * - psbt: The PSBT in hex format
54+ * - keychain.xprv: Extended private key for HD signing
55+ *
56+ * **Response:**
57+ * - Regular signing: Returns { tx: string } - signed transaction hex
58+ * - PSBT signing: Returns { psbt: string } - signed PSBT hex
59+ *
60+ * **Note:** The validate parameter controls signature verification. If omitted, uses the
61+ * global BitGo validation setting. Signature verification is always performed server-side.
4362 *
4463 * @operationId express.v1.wallet.signTransaction
4564 * @tag express
@@ -52,9 +71,9 @@ export const PostSignTransaction = httpRoute({
5271 body : signTransactionRequestBody ,
5372 } ) ,
5473 response : {
55- /** Successfully accepted wallet share */
74+ /** Successfully signed transaction. Returns { tx: string } for regular signing or { psbt: string } for PSBT signing. */
5675 200 : t . UnknownRecord ,
57- /** Error response */
76+ /** Error response (e.g., missing required parameters, invalid transaction hex, invalid keychain, signature verification failure) */
5877 400 : BitgoExpressError ,
5978 } ,
6079} ) ;
0 commit comments