Skip to content

Commit

Permalink
feat(dart/catalyst_cardano_serialization): add support for additional…
Browse files Browse the repository at this point in the history
… transaction body fields (#858)

* feat(transaction_builder): add support for additional transaction body fields (#710)

* fix(catalyst_cardano_serialization): add missing properties to Transaction constructor in `_buildBody()`

* docs(catalyst_cardano_serialization): Correct typo in transaction builder class

Co-authored-by: Dominik Toton <[email protected]>

---------

Co-authored-by: Steven Johnson <[email protected]>
Co-authored-by: Dominik Toton <[email protected]>
  • Loading branch information
3 people committed Sep 23, 2024
1 parent 177e2ee commit b2a1dde
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,15 @@ Byron era addresses are not supported.
| 5 = reward withdrawals | ❌️ |
| 6 = protocol parameter update | ❌️ |
| 7 = auxiliary_data_hash | ✔️ |
| 8 = validity interval start | ️ |
| 9 = mint | ️ |
| 11 = script_data_hash | ️ |
| 13 = collateral inputs | ️ |
| 8 = validity interval start | ️ |
| 9 = mint | ️ |
| 11 = script_data_hash | ️ |
| 13 = collateral inputs | ️ |
| 14 = required signers | ✔️ |
| 15 = network_id | ✔️ |
| 16 = collateral return | ️ |
| 17 = total collateral | ️ |
| 18 = reference inputs | ️ |
| 16 = collateral return | ️ |
| 17 = total collateral | ️ |
| 18 = reference inputs | ️ |

## Reference documentation

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,34 @@ final class TransactionBuilder extends Equatable {
/// The transaction metadata as a list of key-value pairs (a map).
final AuxiliaryData? auxiliaryData;

/// The list of public key hashes of addresses
/// that are required to sign the transaction.
/// Validity interval start as integer.
final SlotBigNum? validityStart;

/// Mint as a non-zero uint64 multiasset.
final MultiAsset? mint;

/// The transaction metadata as a list of key-value pairs (a map).
final ScriptData? scriptData;

/// Collateral inputs as nonempty set.
final Set<TransactionInput>? collateralInputs;

/// The list of public key hashes of addresses that are required to sign the
/// transaction. A nonempty set of addr key hashes.
final Set<Ed25519PublicKeyHash>? requiredSigners;

/// Specifies on which network the code will run.
final NetworkId? networkId;

/// Collateral return's transaction output.
final ShelleyMultiAssetTransactionOutput? collateralReturn;

/// Total collateral as coin (uint64).
final Coin? totalCollateral;

/// Reference inputs as nonempty set of transaction inputs.
final Set<TransactionInput>? referenceInputs;

/// The builder that builds the witness set of the transaction.
///
/// The caller must know in advance how many witnesses there will be to
Expand All @@ -60,8 +81,15 @@ final class TransactionBuilder extends Equatable {
this.fee,
this.ttl,
this.auxiliaryData,
this.validityStart,
this.mint,
this.scriptData,
this.collateralInputs,
this.requiredSigners,
this.networkId,
this.collateralReturn,
this.totalCollateral,
this.referenceInputs,
this.witnessBuilder = const TransactionWitnessSetBuilder(
vkeys: {},
vkeysCount: 1,
Expand Down Expand Up @@ -232,8 +260,15 @@ final class TransactionBuilder extends Equatable {
fee,
ttl,
auxiliaryData,
validityStart,
mint,
scriptData,
collateralInputs,
requiredSigners,
networkId,
collateralReturn,
totalCollateral,
referenceInputs,
witnessBuilder,
];

Expand Down Expand Up @@ -476,8 +511,17 @@ final class TransactionBuilder extends Equatable {
auxiliaryDataHash: auxiliaryData != null
? AuxiliaryDataHash.fromAuxiliaryData(auxiliaryData!)
: null,
validityStart: validityStart,
mint: mint,
scriptDataHash: scriptData != null
? ScriptDataHash.fromScriptData(scriptData!)
: null,
collateralInputs: collateralInputs,
requiredSigners: requiredSigners,
networkId: networkId,
collateralReturn: collateralReturn,
totalCollateral: totalCollateral,
referenceInputs: referenceInputs,
);
}

Expand All @@ -493,8 +537,15 @@ final class TransactionBuilder extends Equatable {
fee: fee ?? this.fee,
ttl: ttl,
auxiliaryData: auxiliaryData,
validityStart: validityStart,
mint: mint,
scriptData: scriptData,
collateralInputs: collateralInputs,
requiredSigners: requiredSigners,
networkId: networkId,
collateralReturn: collateralReturn,
totalCollateral: totalCollateral,
referenceInputs: referenceInputs,
witnessBuilder: witnessBuilder ?? this.witnessBuilder,
);
}
Expand Down

0 comments on commit b2a1dde

Please sign in to comment.