Skip to content

Releases: IntersectMBO/evolution-sdk

@evolution-sdk/[email protected]

24 Dec 03:34
a6ca7e0

Choose a tag to compare

Patch Changes

  • #113 7905507 Thanks @solidsnakedev! - Add attachMetadata() operation to TransactionBuilder for attaching transaction metadata according to CIP-10 standard.

    Changes:

    • Added attachMetadata() method to attach metadata with custom labels
    • Metadata labels are now bigint (unbounded positive integers) supporting CIP-20 messages (label 674) and custom labels
    • Automatic computation of auxiliaryDataHash in transaction body when metadata is present
    • Proper fee calculation accounting for auxiliary data size
    • TransactionMetadatum refactored to simple union type: string | bigint | Uint8Array | Map | Array
    • Added NonNegativeInteger schema to Numeric module for unbounded non-negative integers

    Example:

    await client
      .newTx()
      .attachMetadata({
        label: 674n, // CIP-20 message label
        metadata: "Hello Cardano!"
      })
      .payToAddress({ address, assets })
      .build()
      .then((tx) => tx.sign().submit())

@evolution-sdk/[email protected]

24 Dec 03:34
a6ca7e0

Choose a tag to compare

Patch Changes

@evolution-sdk/[email protected]

23 Dec 21:59
2221acf

Choose a tag to compare

Patch Changes

  • #112 c59507e Thanks @solidsnakedev! - Add transaction chaining support via SignBuilder.chainResult()

    • Add chainResult() method to SignBuilder for building dependent transactions
    • Returns ChainResult with consumed, available UTxOs and pre-computed txHash
    • Lazy evaluation with memoization - computed on first call, cached for subsequent calls
    • Add signAndSubmit() convenience method combining sign and submit in one call
    • Remove redundant chain(), chainEffect(), chainEither() methods from TransactionBuilder
  • #110 9ddc79d Thanks @solidsnakedev! - ### Native Scripts & Multi-Sig Support

    • addSigner operation: Add required signers to transactions for multi-sig and script validation
    • Native script minting: Full support for ScriptAll, ScriptAny, ScriptNOfK, InvalidBefore, InvalidHereafter
    • Reference scripts: Use native scripts via readFrom instead of attaching them to transactions
    • Multi-sig spending: Spend from native script addresses with multi-party signing
    • Improved fee calculation: Accurate fee estimation for transactions with native scripts and reference scripts

    API Changes

    • UTxO.scriptRef type changed from ScriptRef to Script for better type safety
    • PayToAddressParams.scriptRef renamed to script for consistency
    • Wallet signTx now accepts referenceUtxos context for native script signer detection
    • Client signTx auto-fetches reference UTxOs when signing transactions with reference inputs
  • #109 0730f23 Thanks @solidsnakedev! - ### TxBuilder setValidity API

    Add setValidity() method to TxBuilder for setting transaction validity intervals:

    client.newTx()
      .setValidity({
        from: Date.now(),           // Valid after this Unix time (optional)
        to: Date.now() + 300_000    // Expires after this Unix time (optional)
      })
      .payToAddress({ ... })
      .build()
    • Times are provided as Unix milliseconds and converted to slots during transaction assembly
    • At least one of from or to must be specified
    • Validates that from < to when both are provided

    slotConfig support for devnets

    Add slotConfig parameter to createClient() for custom slot configurations:

    const slotConfig = Cluster.getSlotConfig(devnetCluster)
    const client = createClient({
      network: 0,
      slotConfig,  // Custom slot config for devnet
      provider: { ... },
      wallet: { ... }
    })

    Priority chain for slot config resolution:

    1. BuildOptions.slotConfig (per-transaction override)
    2. TxBuilderConfig.slotConfig (client default)
    3. SLOT_CONFIG_NETWORK[network] (hardcoded fallback)

    Cluster.getSlotConfig helper

    Add getSlotConfig() helper to derive slot configuration from devnet cluster genesis:

    const slotConfig = Cluster.getSlotConfig(cluster)
    // Returns: { zeroTime, zeroSlot, slotLength }

@evolution-sdk/[email protected]

23 Dec 22:00
2221acf

Choose a tag to compare

Patch Changes

  • #109 0730f23 Thanks @solidsnakedev! - ### TxBuilder setValidity API

    Add setValidity() method to TxBuilder for setting transaction validity intervals:

    client.newTx()
      .setValidity({
        from: Date.now(),           // Valid after this Unix time (optional)
        to: Date.now() + 300_000    // Expires after this Unix time (optional)
      })
      .payToAddress({ ... })
      .build()
    • Times are provided as Unix milliseconds and converted to slots during transaction assembly
    • At least one of from or to must be specified
    • Validates that from < to when both are provided

    slotConfig support for devnets

    Add slotConfig parameter to createClient() for custom slot configurations:

    const slotConfig = Cluster.getSlotConfig(devnetCluster)
    const client = createClient({
      network: 0,
      slotConfig,  // Custom slot config for devnet
      provider: { ... },
      wallet: { ... }
    })

    Priority chain for slot config resolution:

    1. BuildOptions.slotConfig (per-transaction override)
    2. TxBuilderConfig.slotConfig (client default)
    3. SLOT_CONFIG_NETWORK[network] (hardcoded fallback)

    Cluster.getSlotConfig helper

    Add getSlotConfig() helper to derive slot configuration from devnet cluster genesis:

    const slotConfig = Cluster.getSlotConfig(cluster)
    // Returns: { zeroTime, zeroSlot, slotLength }
  • Updated dependencies [c59507e, 9ddc79d, 0730f23]:

@evolution-sdk/[email protected]

22 Dec 16:55
6014fbe

Choose a tag to compare

Patch Changes

  • #107 1e1aec8 Thanks @solidsnakedev! - ### Added: Redeemer Labels for Script Debugging

    Added optional label property to redeemer operations (collectFrom, withdraw, mint, and stake operations) to help identify which script failed during evaluation.

    client
      .newTx()
      .collectFrom({
        inputs: [utxo],
        redeemer: makeSpendRedeemer(999n),
        label: "coordinator-spend-utxo" // Shows in failure output
      })
      .withdraw({
        stakeCredential,
        amount: 0n,
        redeemer: makeWithdrawRedeemer([999n]),
        label: "coordinator-withdrawal"
      })

    When scripts fail, the EvaluationError now includes a structured failures array:

    interface ScriptFailure {
      purpose: "spend" | "mint" | "withdraw" | "cert"
      index: number
      label?: string // User-provided label
      redeemerKey: string // e.g., "spend:0", "withdraw:0"
      utxoRef?: string // For spend failures
      credential?: string // For withdraw/cert failures
      policyId?: string // For mint failures
      validationError: string
      traces: string[]
    }

    Added: Stake Operations

    Full support for Conway-era stake operations:

    • registerStake - Register stake credential (RegCert)
    • deregisterStake - Deregister stake credential (UnregCert)
    • delegateTo - Delegate to pool and/or DRep (StakeDelegation, VoteDelegCert, StakeVoteDelegCert)
    • registerAndDelegateTo - Combined registration + delegation (StakeRegDelegCert, VoteRegDelegCert, StakeVoteRegDelegCert)
    • withdraw - Withdraw staking rewards (supports coordinator pattern with amount: 0n)

    All operations support script-controlled credentials with RedeemerBuilder for deferred redeemer resolution.

@evolution-sdk/[email protected]

22 Dec 16:55
6014fbe

Choose a tag to compare

Patch Changes

  • #107 1e1aec8 Thanks @solidsnakedev! - ### Added: Redeemer Labels for Script Debugging

    Added optional label property to redeemer operations (collectFrom, withdraw, mint, and stake operations) to help identify which script failed during evaluation.

    client
      .newTx()
      .collectFrom({
        inputs: [utxo],
        redeemer: makeSpendRedeemer(999n),
        label: "coordinator-spend-utxo" // Shows in failure output
      })
      .withdraw({
        stakeCredential,
        amount: 0n,
        redeemer: makeWithdrawRedeemer([999n]),
        label: "coordinator-withdrawal"
      })

    When scripts fail, the EvaluationError now includes a structured failures array:

    interface ScriptFailure {
      purpose: "spend" | "mint" | "withdraw" | "cert"
      index: number
      label?: string // User-provided label
      redeemerKey: string // e.g., "spend:0", "withdraw:0"
      utxoRef?: string // For spend failures
      credential?: string // For withdraw/cert failures
      policyId?: string // For mint failures
      validationError: string
      traces: string[]
    }

    Added: Stake Operations

    Full support for Conway-era stake operations:

    • registerStake - Register stake credential (RegCert)
    • deregisterStake - Deregister stake credential (UnregCert)
    • delegateTo - Delegate to pool and/or DRep (StakeDelegation, VoteDelegCert, StakeVoteDelegCert)
    • registerAndDelegateTo - Combined registration + delegation (StakeRegDelegCert, VoteRegDelegCert, StakeVoteRegDelegCert)
    • withdraw - Withdraw staking rewards (supports coordinator pattern with amount: 0n)

    All operations support script-controlled credentials with RedeemerBuilder for deferred redeemer resolution.

  • Updated dependencies [1e1aec8]:

@evolution-sdk/[email protected]

18 Dec 16:38
5b8478e

Choose a tag to compare

Patch Changes

  • #105 98b59fa Thanks @solidsnakedev! - Add deferred redeemer construction for dynamic index resolution

    RedeemerBuilder module (RedeemerBuilder.ts):

    • IndexedInput type: { index: number, utxo: UTxO } - provides the final sorted index and original UTxO after coin selection
    • Three modes for redeemer construction:
      • Static: Direct Data value when index not needed
      • Self: Per-input function (input: IndexedInput) => Data for single UTxO index
      • Batch: Multi-input function (inputs: IndexedInput[]) => Data for stake validator coordinator pattern
    • Type guards: isSelfFn, isBatchBuilder, isStaticData
    • Internal types: DeferredRedeemer, toDeferredRedeemer

    Evaluation phase updates:

    • Add resolveDeferredRedeemers to convert deferred redeemers after coin selection
    • Build refToIndex and refToUtxo mappings from sorted inputs
    • Invoke Self/Batch callbacks with resolved IndexedInput objects

    Operations updates:

    • collectFrom and mintTokens now accept RedeemerArg (Data | SelfRedeemerFn | BatchRedeemerBuilder)
    • Store deferred redeemers in state.deferredRedeemers for later resolution

    Test coverage (TxBuilder.RedeemerBuilder.test.ts):

    • Tests for all three modes with mint_multi_validator.ak spec

    Architecture docs (redeemer-indexing.mdx):

    • Document the circular dependency problem and deferred construction solution
    • Explain stake validator coordinator pattern with O(1) index lookup

@evolution-sdk/[email protected]

18 Dec 16:38
5b8478e

Choose a tag to compare

Patch Changes

  • #105 98b59fa Thanks @solidsnakedev! - Add deferred redeemer construction for dynamic index resolution

    RedeemerBuilder module (RedeemerBuilder.ts):

    • IndexedInput type: { index: number, utxo: UTxO } - provides the final sorted index and original UTxO after coin selection
    • Three modes for redeemer construction:
      • Static: Direct Data value when index not needed
      • Self: Per-input function (input: IndexedInput) => Data for single UTxO index
      • Batch: Multi-input function (inputs: IndexedInput[]) => Data for stake validator coordinator pattern
    • Type guards: isSelfFn, isBatchBuilder, isStaticData
    • Internal types: DeferredRedeemer, toDeferredRedeemer

    Evaluation phase updates:

    • Add resolveDeferredRedeemers to convert deferred redeemers after coin selection
    • Build refToIndex and refToUtxo mappings from sorted inputs
    • Invoke Self/Batch callbacks with resolved IndexedInput objects

    Operations updates:

    • collectFrom and mintTokens now accept RedeemerArg (Data | SelfRedeemerFn | BatchRedeemerBuilder)
    • Store deferred redeemers in state.deferredRedeemers for later resolution

    Test coverage (TxBuilder.RedeemerBuilder.test.ts):

    • Tests for all three modes with mint_multi_validator.ak spec

    Architecture docs (redeemer-indexing.mdx):

    • Document the circular dependency problem and deferred construction solution
    • Explain stake validator coordinator pattern with O(1) index lookup
  • Updated dependencies [98b59fa]:

@evolution-sdk/[email protected]

17 Dec 17:46
2e12239

Choose a tag to compare

Patch Changes

  • #101 aaf0882 Thanks @solidsnakedev! - ### Core Module Enhancements

    Mint Module

    • Added Mint.getByHex() and Mint.getAssetsByPolicyHex() utilities for hex-based lookups
    • Fixed Mint.insert, removePolicy, removeAsset, and get to use content-based equality (Equal.equals) instead of reference equality for PolicyId/AssetName lookups

    Fee Calculation

    • Fixed calculateFeeIteratively to include mint field in fee calculation via TxContext access
    • Removed unnecessary 5000n fee buffer that caused fee overpayment

    Transaction Builder

    • Added .mint() method to TransactionBuilder for native token minting/burning
    • .attachScript() now accepts { script: CoreScript } parameter format
    • Improved type safety by using Core types directly instead of SDK wrappers

    Devnet Package

    Test Infrastructure

    • Added TxBuilder.Mint.test.ts with devnet submit tests for minting and burning
    • Updated TxBuilder.Scripts.test.ts to use Core types (PlutusV2.PlutusV2) instead of SDK format
    • Refactored createCoreTestUtxo helper to accept Core Script types directly
    • Removed unused createTestUtxo (SDK format) helper
    • Added Genesis.calculateUtxosFromConfig() for retrieving initial UTxOs from genesis config
    • Replaced all Buffer.from().toString("hex") with Text.toHex() in tests

    Breaking Changes

    • attachScript() now requires { script: ... } object format instead of passing script directly
    • Test helpers now use Core types exclusively
  • #103 65b7259 Thanks @solidsnakedev! - ### Remove Buffer Usage from Source Code

    Replaced all Buffer.from() usage with Bytes.fromHex() and Bytes.toHex() from the core module for better cross-platform compatibility.

    Files Updated:

    • TxBuilderImpl.ts - Use Bytes.toHex() for key hash hex conversion in buildFakeWitnessSet
    • Assets/index.ts - Use Bytes.fromHex() for policy ID and asset name decoding
    • MaestroEffect.ts - Use Bytes.fromHex() for transaction CBOR conversion
    • Ogmios.ts - Use Bytes.toHex() for datum hash hex conversion
    • KupmiosEffects.ts - Use Bytes.fromHex() for datum hash and script bytes decoding
  • #104 c26391a Thanks @solidsnakedev! - ### PlutusV3 Minting Support

    • Add PlutusV3 script minting with automatic script evaluation via Ogmios
    • Add mintAssets builder method for Plutus script-based minting policies
    • Add attachScript builder method for attaching Plutus scripts to transactions
    • Support both minting (positive amounts) and burning (negative amounts)

    Redeemer API Improvements

    • Breaking: Change redeemer parameter type from string (CBOR hex) to Data.Data
      • Affects collectFrom() and mintAssets() builder methods
      • Provides type-safe redeemer construction without manual CBOR encoding
      • Example: redeemer: Data.constr(0n, [Data.int(1n)]) instead of hex strings

    Core Module Additions

    • Add Redeemers module with Conway CDDL-compliant encoding (array format)
    • Refactor hashScriptData to use proper module encoders for redeemers and datums
    • Add Redeemers.toCBORBytes() for script data hash computation

    Internal Improvements

    • Store PlutusData.Data directly in builder state instead of CBOR hex strings
    • Remove redundant CBOR hex encoding/decoding in transaction assembly
    • Add PlutusV3 minting devnet tests with real script evaluation

@evolution-sdk/[email protected]

17 Dec 17:46
2e12239

Choose a tag to compare

Patch Changes

  • #101 aaf0882 Thanks @solidsnakedev! - ### Core Module Enhancements

    Mint Module

    • Added Mint.getByHex() and Mint.getAssetsByPolicyHex() utilities for hex-based lookups
    • Fixed Mint.insert, removePolicy, removeAsset, and get to use content-based equality (Equal.equals) instead of reference equality for PolicyId/AssetName lookups

    Fee Calculation

    • Fixed calculateFeeIteratively to include mint field in fee calculation via TxContext access
    • Removed unnecessary 5000n fee buffer that caused fee overpayment

    Transaction Builder

    • Added .mint() method to TransactionBuilder for native token minting/burning
    • .attachScript() now accepts { script: CoreScript } parameter format
    • Improved type safety by using Core types directly instead of SDK wrappers

    Devnet Package

    Test Infrastructure

    • Added TxBuilder.Mint.test.ts with devnet submit tests for minting and burning
    • Updated TxBuilder.Scripts.test.ts to use Core types (PlutusV2.PlutusV2) instead of SDK format
    • Refactored createCoreTestUtxo helper to accept Core Script types directly
    • Removed unused createTestUtxo (SDK format) helper
    • Added Genesis.calculateUtxosFromConfig() for retrieving initial UTxOs from genesis config
    • Replaced all Buffer.from().toString("hex") with Text.toHex() in tests

    Breaking Changes

    • attachScript() now requires { script: ... } object format instead of passing script directly
    • Test helpers now use Core types exclusively
  • #104 c26391a Thanks @solidsnakedev! - ### PlutusV3 Minting Support

    • Add PlutusV3 script minting with automatic script evaluation via Ogmios
    • Add mintAssets builder method for Plutus script-based minting policies
    • Add attachScript builder method for attaching Plutus scripts to transactions
    • Support both minting (positive amounts) and burning (negative amounts)

    Redeemer API Improvements

    • Breaking: Change redeemer parameter type from string (CBOR hex) to Data.Data
      • Affects collectFrom() and mintAssets() builder methods
      • Provides type-safe redeemer construction without manual CBOR encoding
      • Example: redeemer: Data.constr(0n, [Data.int(1n)]) instead of hex strings

    Core Module Additions

    • Add Redeemers module with Conway CDDL-compliant encoding (array format)
    • Refactor hashScriptData to use proper module encoders for redeemers and datums
    • Add Redeemers.toCBORBytes() for script data hash computation

    Internal Improvements

    • Store PlutusData.Data directly in builder state instead of CBOR hex strings
    • Remove redundant CBOR hex encoding/decoding in transaction assembly
    • Add PlutusV3 minting devnet tests with real script evaluation
  • Updated dependencies [aaf0882, 65b7259, c26391a]: