Skip to content

add Blockchain Applied (BCA) provider - #453

Open
CodiePP wants to merge 2 commits into
IntersectMBO:mainfrom
Blockchain-Data-Analytics:add-bca-provider
Open

CodiePP wants to merge 2 commits into
IntersectMBO:mainfrom
Blockchain-Data-Analytics:add-bca-provider

Conversation

@CodiePP

@CodiePP CodiePP commented Jul 14, 2026

Copy link
Copy Markdown

This PR adds Blockchain Applied (BCA) as a data provider and tx submit API.

Signed-off-by: Alexander Diemand <codieplusplus@apax.net>
…xact integers

Upstream dropped @effect/platform (IntersectMBO#548) and now hands every JSON number to
the response schemas as its source text (IntersectMBO#558).

- Detect 404s via HttpUtils.HttpResponseError instead of HttpClientError
- Decode integer fields with Schema.BigInt and decimals with
  Schema.NumberFromString; convert to number only where the public
  ProtocolParameters / EvalRedeemer types require it
- Keep the evaluate request's additional_utxos wire format unchanged via an
  explicit AdditionalUtxo type
- Make total_count / total_pages optional: the API no longer returns them,
  and pagination only relies on has_next

Signed-off-by: Alexander Diemand <codieplusplus@apax.net>

@solidsnakedev solidsnakedev left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for this, and for moving it onto the new HTTP layer.

It needs another round before it can merge. A datum-hash output comes back as an inline datum, and no test runs without a BCA token. CI is green, but none of the provider code runs there, and we can't run the live suite ourselves.

Needed:

  1. Datum-hash outputs: when /datum/{hash} answers, resolveUtxo turns a hash-only output into an InlineDatum (BlockchainAppliedEffect.ts:84-91). Please return DatumHash for these, as Koios, Maestro and Kupmios do. Callers get the datum through getDatum. #687 tracks the same bug in Blockfrost.
  2. Offline tests: please add test/provider/BlockchainApplied.test.ts with fetch stubbed, like Maestro.test.ts, built from recorded BCA responses. Cover each method, pagination, the 404 paths, /tx/evaluate with additional_utxos, and the bearer header.
  3. Reference scripts: resolveUtxo swallows any /script failure (line 81), so the UTxO comes back without its script. The builder then leaves that script out of the reference script fee, and the node rejects the transaction. Please fail with a ProviderError instead. Also, ScriptDetails requires bytes and size, which the spec marks nullable, and your backend stores no CBOR for native scripts. The provider drops every native reference script that reaches this path. Please build it from json or fail.
  4. Cost models: please decode them strictly as arrays, as Koios does (Koios.ts:64-67). The object branch in normalizeCostModel keeps the server's key order, and that order gives a wrong script integrity hash (#303 was this failure in Blockfrost). This also removes the two Record<string, unknown> casts.
  5. Protocol parameters: a missing coins_per_utxo_size or min_fee_ref_script_cost_per_byte becomes 0 (BlockchainApplied.ts:232-241). That gives a minimum ADA of 0 and a reference script fee of 0. It also skips the builder's own fallback for the fee. Please fail instead, as Koios, Maestro and Kupmios do.
  6. awaitTx: please retry only on a 404, and decode only hash. Today a 401 keeps polling until the 160 s timeout and then fails as a timeout.
  7. Casts: as Redeemer.RedeemerTag (line 280) and as Provider.Delegation (BlockchainAppliedEffect.ts:217) both compile without the cast. Typing the schema field as Redeemer.RedeemerTag covers the first.

Questions about the API:

  • Is asset_name hex or text in the UTxO responses? The spec's /tx/{txhash} example shows "USDCx", which the provider can't decode. If it is hex, the example needs fixing.
  • Which tag strings does /tx/evaluate return for certificate and withdrawal scripts? If it passes publish and withdraw through, please map them as Kupmios and Koios do.
  • Does /utxos/{address} accept a payment credential (addr_vkh1..., script1...)? If not, please fail for credentials as Maestro does (MaestroEffect.ts:91-97). If it does, set supportsCredentialQueries: true in providers.test.ts.
  • Is reference_script_cbor filled for native scripts?

Smaller:

  • Every endpoint needs a token, so please make token required in the presets and the config.
  • provider-types.mdx, providers/index.mdx and the README still list four providers. Please update them, or leave the docs to a follow-up PR. In the table, a use case such as "Hosted REST API, bearer token" fits the other rows better.
  • Please drop the formatting-only changes in conformance.ts, providers.test.ts, client/internal/Client.ts and the docs, and the **/*.local line in .gitignore.
  • Please make the changeset a patch.

This branch has not been deployed

No deployments
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.

2 participants