Skip to content

v2.0.0

Latest

Choose a tag to compare

@twwu123 twwu123 released this 02 Dec 11:20
208f4a2

Mesh 2.0.0

Mesh 2.0.0 introduces TxBuilder, a typed API for building, signing, and submitting Cardano transactions. It also adds durable multi-transaction plans, a local ledger emulator, and offline Plutus evaluation powered by Scalus. MeshTxBuilder remains available as a deprecated compatibility adapter.

Upgrading from Mesh 1.x

  • Replace @meshsdk/core-csl imports. The package was removed. Use @meshsdk/core-cst for serialization and parsing. CardanoSDKSerializer now implements ITxParser.
  • Review code that uses MeshTxBuilder. The fluent API, MeshTxBuilderV2, and Transaction now build through TxBuilder. Serialized CBOR can change, and invalid builds now fail with typed errors such as OUTPUT_BELOW_MIN_COIN, FEE_TOO_LOW, and NETWORK_MISMATCH. Custom legacy serializers and selectors are no longer accepted. Move custom input selection to TxBuilder’s coinSelection option. txEvaluationMultiplier is deprecated and has no effect. Migration guide (https://meshjs.dev/apis/txbuilder/migration)
  • Account for deposit-bearing stake certificates. Legacy stake registration and deregistration methods now emit Conway certificates 7 and 8, carry an explicit amount or the protocol keyDeposit, and require the stake credential’s witness. Use certificate.legacyStakeRegistration or certificate.legacyStakeDeregistration when you need certificates 0 and 1.
  • Pass builder to contract helpers. @meshsdk/contract now builds through a reusable TxBuilder and derives the network ID from it. The mesh constructor option remains as a deprecated fallback.
  • Update ScalusEmulator construction. Use await ScalusEmulator.create(utxos, cardanoInfo) to seed a ledger, or wrap an existing Scalus emulator. Set custom protocol parameters and cost models through CardanoInfo. Scalus emulator migration (https://github.com/MeshJS/mesh/blob/53639bf710c23e2cb0b443ea9c388d0e7b1f5bcf/packages/mesh-scalus-emulator/README.md#migrating-from-the-old-constructor)

Transactions and governance

  • Build from typed parts. Compose outputs, spends, reference inputs, collateral, minting, withdrawals, certificates, votes, proposals, metadata, treasury donations, and validity intervals. TxBuilder resolves inputs, selects coins, calculates fees and change, and evaluates scripts. It supports wallet, address, and snapshot payers, send-all transactions, and custom coin selection.
  • Run multi-transaction plans. TxPlan links steps through earlier outputs, accepts prebuilt transactions, and tracks signing, submission, and confirmation. A plan store lets work resume after a restart. Plans can wait for dependencies, recover from interrupted submissions, and replan when transactions expire or roll back. They can also consolidate fragmented wallet UTxOs.
  • Assemble, inspect, and sign transactions offline. The Conway TransactionPrototype represents transaction data with bigint amounts. APIs cover assembly without balancing, importing existing CBOR, discovering required signers, merging witnesses, and estimating minimum fees and output coin.
  • Build Conway governance transactions. New parts cover DRep and committee certificates, voting, and proposals. For parameter-change and treasury-withdrawal proposals, TxBuilder can resolve the active constitutional guardrail through the provider or use a known network default where available. Builds can supply an explicit guardrail, and the legacy adapter uses the scripts supplied by its caller. Transaction builder documentation (https://github.com/MeshJS/mesh/blob/53639bf710c23e2cb0b443ea9c388d0e7b1f5bcf/packages/mesh-transaction/README.md)

Local evaluation and testing

  • Evaluate Plutus scripts locally. TxBuilder defaults to a reusable Scalus evaluator. OfflineEvaluator is available from @meshsdk/core as an alias for OfflineEvaluatorScalus. Custom evaluators remain supported. Use evaluator: null to retain supplied execution units. Script failures surface as ScriptEvaluationError.
  • Test against a local ledger with @meshsdk/tx-emulator. TxEmulator can simulate and submit individual transactions or chains, move the clock, and start from seeded state or a snapshot read from a provider. It models UTxOs, stake balances, pools, DReps, committee state, and governance actions, with selectable Scalus and Cquisitor validators. Transaction emulator documentation (https://github.com/MeshJS/mesh/blob/53639bf710c23e2cb0b443ea9c388d0e7b1f5bcf/packages/mesh-tx-emulator/README.md)
  • Updated the Scalus integration to 1.5.0. Package checks cover installed builds in Node ESM, CommonJS, and headless Chrome. CI also runs the emulator suites and tests the transaction README example.

Wallets, providers, and payments

  • Expanded wallet signing support. The builder accepts CIP-30 wallet APIs directly. Wallet updates add witness-only signing and improve reward-address handling. Witness merging preserves the transaction’s existing witness encoding and untouched entries.
  • Reduced repeat provider calls. Wallets, builders, and contracts can share a CachedFetcher for the same provider object. The SDK reuses known UTxOs and reduces redundant evaluation calls. Shared interfaces now cover network configuration, confirmation waiting, structured provider errors, governance state, and stake-pool lookups.
  • Added @meshsdk/x402 0.0.1. This separately versioned package implements Cardano’s x402 exact scheme for clients, resource servers, and facilitators. It supports direct payments, script payments, and Masumi escrow, including offer verification, duplicate settlement protection, and confirmation-aware settlement. x402 documentation (https://github.com/MeshJS/mesh/blob/53639bf710c23e2cb0b443ea9c388d0e7b1f5bcf/packages/mesh-x402/README.md)

Fixes and maintenance

  • Corrected voting redeemer indexes to follow ledger voter order, preserved native reference scripts on outputs, and fixed collateral selection when a specific payment collateral UTxO is supplied.
  • Preserved large lovelace values and Map and bigint data when cloning outputs. MeshValue.eq now detects extra asset units, and mergeAssets leaves its inputs intact.
  • Rejected malformed UTxO indexes, invalid script references, and malformed datum, script, and witness encodings. Preserved supplied transaction CBOR and untouched witness entries where applicable.
  • Updated cost models to epoch 638, corrected the default transaction execution-memory limit, updated @cardano-sdk to 0.47.1, and addressed npm audit findings.
  • Refreshed the quick start, package and migration documentation, and transaction design notes. Updated versioning and publishing scripts for the current workspace packages.