Skip to content

Support optional auth headers for the bundler and paymaster #110

Description

@joalavedra

I'm submitting a...

  • feature request

What is the expected behaviour?

Allow passing custom HTTP headers to the bundler and paymaster clients, so the module works with
providers that require an Authorization header (or any other header) instead of authenticating
through the URL.

Proposed config additions:

  • bundlerHeaders?: Record<string, string> on the common config (next to bundlerUrl)
  • paymasterHeaders?: Record<string, string> on the paymaster configs (next to paymasterUrl)
const wallet = new WalletManagerEvmErc4337(seedPhrase, {
  chainId: 11155111,
  provider: 'https://sepolia.drpc.org',
  bundlerUrl: 'https://bundler.example.com/rpc',
  bundlerHeaders: { Authorization: 'Bearer YOUR_KEY' },
  safeModulesVersion: '0.3.0',
  isSponsored: true,
  paymasterUrl: 'https://paymaster.example.com/rpc',
  paymasterHeaders: { Authorization: 'Bearer YOUR_KEY' },
})

What is the current behaviour?

The module builds its bundler and paymaster clients from URL strings only
(new Bundler(bundlerUrl), new Erc7677Paymaster(paymasterUrl, ...)), with no way to attach
headers. Providers that require a header-based API key can't be used unless the key can be encoded
in the URL.

Possible solution

abstractionkit@0.4.0 already exposes an HttpTransport(url, { headers }) and accepts a
Transport anywhere a URL is accepted (Bundler, Erc7677Paymaster, createUserOperation,
createPaymasterUserOperation). When headers are configured, wrap the URL in an HttpTransport;
otherwise pass the plain URL unchanged (no behaviour change for existing configs).

I've opened a PR implementing this and will link it here.

Node version

Node v22.13.1 x64

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions