Skip to content

Commit 4705499

Browse files
authored
CORE-8431 Interfaces and functions for getting data out of signed TX (#713)
Adding accessors for unresolved transaction data to signed transaction.
1 parent 9b8dd07 commit 4705499

File tree

4 files changed

+133
-1
lines changed

4 files changed

+133
-1
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ cordaProductVersion = 5.0.0
77
# NOTE: update this each time this module contains a breaking change
88
## NOTE: currently this is a top level revision, so all API versions will line up, but this could be moved to
99
## a per module property in which case module versions can change independently.
10-
cordaApiRevision = 506
10+
cordaApiRevision = 507
1111

1212
# Main
1313
kotlinVersion = 1.7.21
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package net.corda.v5.ledger.common.transaction
2+
3+
/**
4+
* Summary of the metadata of a corda package (CPK or CPI)
5+
*/
6+
interface CordaPackageSummary {
7+
/**
8+
* @property name Name of the package
9+
*/
10+
val name: String
11+
12+
/**
13+
* @property version Version of the pacakge
14+
*/
15+
val version: String
16+
17+
/**
18+
* @property signerSummaryHash hash sum identifying the signer for signed packages (CPIs). Null for CPKs
19+
*/
20+
val signerSummaryHash: String?
21+
22+
/**
23+
* @property fileChecksum checksum of the package file
24+
*/
25+
val fileChecksum: String
26+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
package net.corda.v5.ledger.common.transaction
2+
3+
/**
4+
* This interface represents the metadata governing a transaction, capturing a snapshot
5+
* of the system and software versions as the transaction was created.
6+
*/
7+
interface TransactionMetadata {
8+
9+
/**
10+
* Returns the ledger model this transaction belongs to.
11+
*
12+
* @return the class name of the transaction implementation
13+
*/
14+
fun getLedgerModel(): String
15+
16+
/**
17+
* Returns the version of the ledger this transaction was created with
18+
*
19+
* @return the ledger version at creation time
20+
*/
21+
fun getLedgerVersion(): Int
22+
23+
/**
24+
* Returns the transaction subtype. This is ledger specific, check with the documentation of the
25+
* ledger model you are using.
26+
*
27+
* @return Transaction subtype as string defined in the ledger model
28+
*/
29+
fun getTransactionSubtype(): String?
30+
31+
/**
32+
* Get information about the CPI running on the virtual node creating the transaction
33+
*
34+
* @return a summary of the CPI
35+
*/
36+
fun getCpiMetadata(): CordaPackageSummary?
37+
38+
/**
39+
* Get information about the contract CPKs governing the transaction (installed on the
40+
* virtual node when the transaction was created)
41+
*
42+
* @return list of CPK summaries
43+
*/
44+
fun getCpkMetadata(): List<CordaPackageSummary>
45+
46+
/**
47+
* Get the digest settings used to calculate the transaction hashes
48+
*
49+
* @return digest settings as map
50+
*/
51+
fun getDigestSettings(): LinkedHashMap<String, Any>
52+
53+
/**
54+
* Version of the metadata JSON schema to parse this metadata entity
55+
*
56+
* @return The schema version
57+
*/
58+
fun getSchemaVersion(): Int
59+
}

ledger/ledger-utxo/src/main/kotlin/net/corda/v5/ledger/utxo/transaction/UtxoSignedTransaction.kt

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@ package net.corda.v5.ledger.utxo.transaction
33
import net.corda.v5.application.crypto.DigitalSignatureAndMetadata
44
import net.corda.v5.base.annotations.DoNotImplement
55
import net.corda.v5.crypto.SecureHash
6+
import net.corda.v5.ledger.common.Party
7+
import net.corda.v5.ledger.common.transaction.TransactionMetadata
8+
import net.corda.v5.ledger.utxo.Command
9+
import net.corda.v5.ledger.utxo.StateAndRef
10+
import net.corda.v5.ledger.utxo.StateRef
11+
import net.corda.v5.ledger.utxo.TimeWindow
12+
import java.security.PublicKey
613

714
/**
815
* Defines a signed UTXO transaction.
@@ -34,6 +41,46 @@ interface UtxoSignedTransaction {
3441
*/
3542
val signatures: List<DigitalSignatureAndMetadata>
3643

44+
/**
45+
* @property inputStateRefs The stateRefs of the inputs to this transaction
46+
*/
47+
val inputStateRefs: List<StateRef>
48+
49+
/**
50+
* @property referenceStateRefs The state refs of any reference states used by this transaction
51+
*/
52+
val referenceStateRefs: List<StateRef>
53+
54+
/**
55+
* @property outputStateAndRefs The state and ref of the ouputs of this transaction
56+
*/
57+
val outputStateAndRefs: List<StateAndRef<*>>
58+
59+
/**
60+
* @property notary The notary used for notarising this transaction
61+
*/
62+
val notary: Party
63+
64+
/**
65+
* @property timeWindow The validity time window for completing/notarising this transaction
66+
*/
67+
val timeWindow: TimeWindow
68+
69+
/**
70+
* @property metadata The metadata for this transaction
71+
*/
72+
val metadata: TransactionMetadata
73+
74+
/**
75+
* @property commands The list of commands for this transaction
76+
*/
77+
val commands: List<Command>
78+
79+
/**
80+
* @property signatories The list of keys that need to sign this transaction
81+
*/
82+
val signatories: List<PublicKey>
83+
3784
/**
3885
* Converts the current [UtxoSignedTransaction] into a [UtxoLedgerTransaction].
3986
*

0 commit comments

Comments
 (0)