Skip to content

fix(provider): standardize error handling, fix Blockfrost multi-asset format, accept tag-258/plain CBOR#210

Merged
solidsnakedev merged 6 commits intomainfrom
fix/provider-error-handling-and-blockfrost-value-format
Mar 17, 2026
Merged

fix(provider): standardize error handling, fix Blockfrost multi-asset format, accept tag-258/plain CBOR#210
solidsnakedev merged 6 commits intomainfrom
fix/provider-error-handling-and-blockfrost-value-format

Conversation

@solidsnakedev
Copy link
Collaborator

@solidsnakedev solidsnakedev commented Mar 17, 2026

Blockfrost evaluateTx with multi-asset UTxOs failed with "failed to decode payload from base64 or base16" because toBlockfrostValue formatted multi-asset values as a flat assets sub-object with concatenated policy-ID + asset-name keys. The Ogmios endpoint expects each policy ID as a top-level key in the value object mapping to { assetName: quantity }. Additionally, all four providers used inconsistent error-handling patterns and errors from non-Error causes were silently garbled.

Provider error handling

Standardizes all providers to Effect.catchAll + a shared wrapError helper. Adds JSONWSP fault detection to the Blockfrost evaluation response schema so real Ogmios errors surface instead of a generic "no result" message.

Blockfrost multi-asset value format

Changes toBlockfrostValue from { coins, assets: { "<policyId><assetName>": qty } } to { coins, "<policyId>": { "<assetName>": qty } }.

TransactionBody CBOR backward compat

FromCDDL now accepts both CBOR tag-258 (Conway-era sets) and plain arrays (Babbage-era) for inputs, collateral inputs, required signers, reference inputs, and proposal procedures.

Test improvements

Renames eval fixture file to evaluateTx.ts and gives each conformance test a descriptive name reflecting what it exercises.

Copilot AI review requested due to automatic review settings March 17, 2026 03:02
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR improves provider interoperability by standardizing provider error handling, fixing Blockfrost evaluateTx payload formatting for multi-asset UTxOs, and broadening CBOR decoding compatibility. It also adds provider conformance coverage for evaluateTx using real transaction/UTxO fixtures.

Changes:

  • Standardize provider error wrapping to a consistent catchAll + wrapError pattern (Blockfrost, Koios, Kupmios, Maestro).
  • Fix/extend evaluateTx support: Blockfrost multi-asset additional UTxO formatting; Maestro evaluate endpoint + schema + transformation.
  • Accept both CBOR tag-258 and plain array encodings when decoding TransactionBody inputs-related fields.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/evolution/test/provider/fixtures/evaluateTx.ts Adds transaction + UTxO fixtures covering multiple redeemer scenarios (spend/mint/reward/cert) for evaluateTx.
packages/evolution/test/provider/conformance.ts Enables conformance tests for evaluateTx using the new fixtures; adjusts awaitTx rejection expectation.
packages/evolution/src/sdk/provider/internal/MaestroEffect.ts Wraps Maestro errors consistently; updates endpoints/response wrappers; implements Maestro evaluateTx request/response handling.
packages/evolution/src/sdk/provider/internal/Maestro.ts Broadens schemas (string-or-number); adds eval result schema + transformation; starts decoding datum options into core types.
packages/evolution/src/sdk/provider/internal/KupmiosEffects.ts Standardizes error handling and improves submitTx error messaging.
packages/evolution/src/sdk/provider/internal/KoiosEffect.ts Standardizes error handling messages/patterns.
packages/evolution/src/sdk/provider/internal/BlockfrostEffect.ts Standardizes error handling; fixes additional UTxO set formatting for multi-assets/reference scripts in evaluateTx.
packages/evolution/src/sdk/provider/internal/Blockfrost.ts Adds JSONWSP fault detection and returns structured ProviderError failures from evaluation parsing.
packages/evolution/src/TransactionBody.ts Decodes both tag-258 and untagged arrays for inputs/collateral/requiredSigners/referenceInputs/proposals.
.changeset/fix-provider-error-handling.md Declares a patch release and summarizes provider fixes and decoding compatibility improvements.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +112 to +117
const addressStr =
addressOrCredential instanceof CoreAddress.Address
? CoreAddress.toBech32(addressOrCredential)
: addressOrCredential.hash

// Filter UTxOs that belong to the specified address/credential
// Use CoreAddress.toBech32 to convert Core Address to string for comparison
return transformedUtxos.filter((utxo) => CoreAddress.toBech32(utxo.address) === addressStr)
const allUtxos = yield* getUtxosWithPagination(`${baseUrl}/addresses/${addressStr}/utxos`, apiKey)
@solidsnakedev solidsnakedev merged commit c7ab056 into main Mar 17, 2026
7 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.

2 participants