Skip to content

feat(api-kit): split into queue, indexer and decoder clients - #1454

Merged
Yago Pérez Vázquez (yagopv) merged 38 commits into
mainfrom
feat/api-kit-queue-decoder-migration
Dec 1, 2026
Merged

Yago Pérez Vázquez (yagopv) merged 38 commits into
mainfrom
feat/api-kit-queue-decoder-migration

Conversation

@yagopv

@yagopv Yago Pérez Vázquez (yagopv) commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

What it solves

Splits @safe-global/api-kit into one client per Safe service, with one method per endpoint, and removes the chain from the kit: each request carries its own.

What changes

api-kit (major)

  • apiKit.queue: Safe Queue Service (new, multi-chain). Proposals, confirmations, deletions, off-chain messages and delegates. Signed requests (addDelegate, updateDelegate, removeDelegate, deleteTransaction) use the service's EIP-712 domain.
  • apiKit.indexer: Safe Transaction Service. Same endpoints and responses as before; every method takes { chainId } to select the service of the chain.
  • apiKit.decoder: Safe Decoder Service (new, multi-chain). decodeData with accuracy, getContracts, getContract.
  • Chain of a request: always the chainId passed to the method. An EIP-3770 prefix in an address is only a check: it is accepted together with chainId and must match it; a prefix without chainId throws. chainId is required in the queue writes, the delegates (or allChains: true), every indexer method and getPendingTransactions (the service needs the chain of every Safe). It is optional in the other queue reads and in the decoder, where no chain means every chain, so allChains is gone from getSafeTransactions and getMessages. To mix chains use getTransactions with chainIds per Safe.
  • Config: chainId and txServiceUrl are removed. indexerUrls: [{ chainId, url }] overrides the hosted Transaction Service per chain (self-hosted services, chains Safe doesn't run); chainId can be a number or a string, as in a JSON config, and duplicates throw. queueServiceUrl and decoderServiceUrl added. apiKit.getIndexerUrls() lists every chain the indexer can be used with.
  • apiKey is only sent to the Safe hosted services, matched by exact hostname (api.safe.global, api.5afe.dev); a custom URL never receives it.
  • Clients are created lazily and only check their own configuration, so new SafeApiKit() no longer throws and a self-hosted indexer works without an API key. Note for self-hosters: proposals, confirmations, messages and delegates now go to the Queue Service and decodeData to the Decoder Service, so a self-hosted Transaction Service alone only serves apiKit.indexer; queue and decoder need the API key or their own service URL.
  • HTTP: PATCH added, error messages built from the queue/decoder detail payloads.

types-kit (major): SafeMultisigTransactionResponse and SafeMultisigConfirmationResponse follow the queue schema; ProposalRoute added; SafeMultisigConfirmationListResponse removed. The Transaction Service shape is now IndexerMultisigTransactionResponse in api-kit.

protocol-kit (major): toSafeTransactionType, signTransaction, executeTransaction and isValidTransaction accept the queue response (nullable to, gasToken, refundReceiver).

sdk-starter-kit (major): transactions and messages go through apiKit.queue, SafeOperations through apiKit.indexer, passing the chain of the Safe. The config takes the API Kit options as they are: apiKey, indexerUrls, queueServiceUrl, decoderServiceUrl; txServiceUrl is removed. confirm reads the threshold on-chain.

Migration

See .changeset/api-kit-queue-service.md.

Tests

  • api-kit: endpoint tests rewritten per client (queue, indexer, decoder, multichain, SafeApiKit), 118 passing. e2e split under tests/e2e/queue and tests/e2e/indexer; the SafeOperation e2e tests read the Pimlico key from the PIMLICO_API_KEY secret.
  • sdk-starter-kit: unit tests updated (29 passing). Playground and guides updated.

Replace the Safe Transaction Service client with a Safe Queue Service
client. The service is multi-chain (chainId sent per request), computes
the safeTxHash and derives the proposer from the signature, and signs
delegate and deletion requests with its own EIP-712 typed data.

Methods without an equivalent in the queue service (Safe info, history,
tokens, data decoder, ERC-4337 SafeOperations) are removed.
updateSafeDelegate and deleteTransaction are added.

types-kit and protocol-kit adopt the new SafeMultisigTransactionResponse
shape, and sdk-starter-kit drops the safeOperations extension and reads
the threshold on-chain to decide when a transaction can be executed.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Addresses the CodeQL polynomial regex warning on the queueServiceUrl
normalization.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@coveralls

Coveralls (coveralls) commented Oct 22, 2026 •

Copy link
Copy Markdown

Coverage Report for CI Build 46513592543

Coverage increased (+7.8%) to 87.065%

Details

  • Coverage increased (+7.8%) from the base build.
  • Patch coverage: 28 uncovered changes across 6 files (363 of 391 lines covered, 92.84%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
packages/api-kit/src/clients/IndexerClient.ts 117 99 84.62%
packages/api-kit/src/clients/QueueClient.ts 112 108 96.43%
packages/api-kit/src/utils/httpRequests.ts 14 11 78.57%
packages/api-kit/src/clients/BaseClient.ts 21 20 95.24%
packages/api-kit/src/utils/config.ts 7 6 85.71%
packages/sdk-starter-kit/src/utils/proposeTransaction.ts 1 0 0.0%
Total (16 files) 391 363 92.84%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 1111
Covered Lines: 1008
Line Coverage: 90.73%
Relevant Branches: 412
Covered Branches: 318
Branch Coverage: 77.18%
Branches in Coverage %: Yes
Coverage Strength: 9.73 hits per line

💛 - Coveralls

@datadog-official

datadog-official Bot commented Oct 22, 2026 •

Copy link
Copy Markdown

Pipelines

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: eabab7a | Docs | Give us feedback!

Comment thread packages/api-kit/src/SafeApiKit.ts Resolved
Comment thread packages/api-kit/src/SafeApiKit.ts Resolved
Comment thread packages/api-kit/src/SafeApiKit.ts Resolved
Comment thread packages/api-kit/src/SafeApiKit.ts Resolved
- Introduced `indexerServiceUrl` as a new configuration option in `createSafeClient`, alongside `queueServiceUrl` and `decoderServiceUrl`.
- Deprecated `txServiceUrl` in favor of `indexerServiceUrl`, while still accepting it for backward compatibility.
- Updated documentation to reflect changes in service URL usage and configuration.
- Adjusted client implementations to ensure proper handling of new service URLs, including the required `/api` path.
- Enhanced tests to cover scenarios with new service URL configurations and ensure correct error handling for missing API keys.
…/api-kit-queue-decoder-migration

# Conflicts:
#	packages/api-kit/src/SafeApiKit.ts
Comment thread packages/api-kit/README.md Resolved
Comment thread packages/types-kit/src/types.ts Resolved
Comment thread .changeset/api-kit-queue-service.md Resolved
Comment thread .changeset/api-kit-queue-service.md Resolved
@yagopv
Yago Pérez Vázquez (yagopv) merged commit 472afb2 into main Dec 1, 2026
24 checks passed
@yagopv
Yago Pérez Vázquez (yagopv) deleted the feat/api-kit-queue-decoder-migration branch December 1, 2026 08:14
@github-actions github-actions Bot locked and limited conversation to collaborators Dec 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants