Skip to content

Conversation

@rahulhegde-bitgo
Copy link
Contributor

Typed router for signtx api

Ticket: WP-5407

@rahulhegde-bitgo
Copy link
Contributor Author

rahulhegde-bitgo commented Aug 20, 2025

OpenApi Doc generated from @api-ts/openapi-generator:

/api/v1/wallet/{id}/signtransaction:
    post:
      summary: signTransaction
      description: Sign a previously created transaction with a keychain
      operationId: express.v1.wallet.signTransaction
      parameters:
        - name: id
          description: ID of the wallet
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                transactionHex:
                  type: string
                  description: Serialized form of the transaction in hex
                unspents:
                  type: array
                  items:
                    description: >-
                      array of unspent information, where each unspent is a
                      chainPath and redeemScript with the same index as the
                      inputs in the transactionHex
                keychain:
                  allOf:
                    - type: object
                      properties:
                        xprv:
                          type: string
                      required:
                        - xprv
                    - type: object
                      additionalProperties: {}
                  description: Keychain containing the xprv to sign with
                signingKey:
                  type: string
                  description: For legacy safe wallets, the private key string
                validate:
                  type: boolean
                  description: >-
                    extra verification of signatures (which are always verified
                    server-side) (defaults to global config)
              required:
                - transactionHex
                - unspents
                - keychain
                - signingKey
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                additionalProperties: {}
                description: Successfully accepted wallet share
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/BitgoExpressError'
                description: Error response

@rahulhegde-bitgo
Copy link
Contributor Author

rahulhegde-bitgo commented Aug 20, 2025

Tested the api with this curl:

--header 'Content-Type: application/json' \
--header 'Authorization: Bearer notGonnaShareThis' \
--data '{
    "transactionHex": "0100000001c7a6e16e2bcf94fba6e0a5839b7accd93f2d684b4b7d97a75a6c3b9b79644f0c0000000000ffffffff0188130000000000001976a914385ed68a0d08c9d34553774be5ee8d5ce2261fce88ac00000000",
    "unspents": [
      {
        "chainPath": "m/0/0",
        "redeemScript": "522103b31347f19510acbc7f50822ac4093ca80554946c471b43eb937d0c9118d1122d2102cd3787d12af6eb87e7b9af00118a225e2ce663a5c94f555460ae131139a2afee2103bd558669de622fc57a8157f449c52254218dfe4e843f58b214b710c4c36833c153ae"
      }
    ],
    "keychain": {
      "xprv": "xprv",
      "xpub": "xpub"
    },
    "signingKey": "s",
    "validate": true
  }'

@rahulhegde-bitgo rahulhegde-bitgo marked this pull request as ready for review August 20, 2025 20:42
@rahulhegde-bitgo rahulhegde-bitgo requested a review from a team as a code owner August 20, 2025 20:42
@rahulhegde-bitgo rahulhegde-bitgo force-pushed the WP-5407-typedrouter-signTransaction branch from a46057c to bba0560 Compare August 21, 2025 02:04
Typed router for signtx api

Ticket: WP-5407
@rahulhegde-bitgo rahulhegde-bitgo force-pushed the WP-5407-typedrouter-signTransaction branch from bba0560 to d44f2c5 Compare August 21, 2025 02:23
Copy link
Contributor

@lokesh-bitgo lokesh-bitgo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@0xPrabh 0xPrabh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rahulhegde-bitgo rahulhegde-bitgo merged commit 8f7ddc0 into master Aug 24, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants