Skip to content

Add transport context to enrichSettleResponse#1101

Open
phdargen wants to merge 6 commits intocoinbase:mainfrom
phdargen:enrichSettleResponseWithHTTP
Open

Add transport context to enrichSettleResponse#1101
phdargen wants to merge 6 commits intocoinbase:mainfrom
phdargen:enrichSettleResponseWithHTTP

Conversation

@phdargen
Copy link
Contributor

@phdargen phdargen commented Feb 6, 2026

Description

Adds additional transport context to enrichPaymentRequiredResponse (request ctx) and enrichSettleResponse (request ctx + response ctx) hooks (#1003) allowing extensions to append transport specific data such as a signed request/responseBody discussed in #1024.

Example usage:

  enrichSettlementResponse: async (
    _declaration: unknown,
    context: SettleResultContext,
  ): Promise<unknown> => {
    const httpData = context.transportContext as HTTPTransportContext | undefined;

    return {
      request: {
        path: httpData.request.path,
        method: httpData.request.method,
      },
      responseBody: httpData.responseBody?.toString("utf-8"),
    };
  }

with Payment response:

{
  "success": true,
  "transaction": "0x...",
  "network": "eip155:84532",
  "payer": "0x...",
  "extensions": {
    "transport-context-test": {
      "request": {
        "path": "/weather",
        "method": "GET"
      },
      "responseBody": "{\"report\":{\"weather\":\"sunny\",\"temperature\":70}}"
    }
  }
}

Checklist

  • I have formatted and linted my code
  • All new and existing tests pass
  • My commits are signed (required for merge) -- you may need to rebase if you initially pushed unsigned commits
  • I added a changelog fragment for user-facing changes (docs-only changes can skip)

@cb-heimdall
Copy link

cb-heimdall commented Feb 6, 2026

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
2 if repo is sensitive 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

@vercel
Copy link

vercel bot commented Feb 6, 2026

@phdargen is attempting to deploy a commit to the Coinbase Team on Vercel.

A member of the Team first needs to authorize it.

@phdargen phdargen marked this pull request as draft February 6, 2026 01:56
@github-actions github-actions bot added typescript sdk Changes to core v2 packages examples Changes to examples labels Feb 6, 2026
@github-actions github-actions bot removed the examples Changes to examples label Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

sdk Changes to core v2 packages typescript

Development

Successfully merging this pull request may close these issues.

3 participants