Skip to content

Commit 55f6288

Browse files
Merge pull request #18 from onix-labs/feature-v4
Feature v4
2 parents 82197de + 4188a6d commit 55f6288

File tree

113 files changed

+397
-195
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+397
-195
lines changed

.editorconfig

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
root = true
2+
3+
[*]
4+
end_of_line = lf
5+
insert_final_newline = true
6+
max_line_length = 140

HEADER

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2020-2021 ONIXLabs
1+
Copyright 2020-2022 ONIXLabs
22

33
Licensed under the Apache License, Version 2.0 (the "License");
44
you may not use this file except in compliance with the License.
@@ -10,4 +10,4 @@ Unless required by applicable law or agreed to in writing, software
1010
distributed under the License is distributed on an "AS IS" BASIS,
1111
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
See the License for the specific language governing permissions and
13-
limitations under the License.
13+
limitations under the License.

docs/CHANGELOG-1.0.0.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
![ONIX Labs](https://raw.githubusercontent.com/onix-labs/onix-labs.github.io/master/content/logo/master_full_md.png)
1+
![ONIX Labs](https://raw.githubusercontent.com/onix-labs/onixlabs-website/main/src/assets/images/logo/full/original/original-md.png)
22

33
# Change Log - Version 1.0.0
44

docs/CHANGELOG-1.1.0.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
![ONIX Labs](https://raw.githubusercontent.com/onix-labs/onix-labs.github.io/master/content/logo/master_full_md.png)
1+
![ONIX Labs](https://raw.githubusercontent.com/onix-labs/onixlabs-website/main/src/assets/images/logo/full/original/original-md.png)
22

33
# Change Log - Version 1.1.0
44

docs/CHANGELOG-1.2.0.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
![ONIX Labs](https://raw.githubusercontent.com/onix-labs/onix-labs.github.io/master/content/logo/master_full_md.png)
1+
![ONIX Labs](https://raw.githubusercontent.com/onix-labs/onixlabs-website/main/src/assets/images/logo/full/original/original-md.png)
22

33
# Change Log - Version 1.2.0
44

docs/CHANGELOG-2.0.0.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
![ONIX Labs](https://raw.githubusercontent.com/onix-labs/onix-labs.github.io/master/content/logo/master_full_md.png)
1+
![ONIX Labs](https://raw.githubusercontent.com/onix-labs/onixlabs-website/main/src/assets/images/logo/full/original/original-md.png)
22

33
# Change Log - Version 2.0.0
44

docs/CHANGELOG-2.1.0.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
![ONIX Labs](https://raw.githubusercontent.com/onix-labs/onix-labs.github.io/master/content/logo/master_full_md.png)
1+
![ONIX Labs](https://raw.githubusercontent.com/onix-labs/onixlabs-website/main/src/assets/images/logo/full/original/original-md.png)
22

33
# Change Log - Version 2.1.0
44

docs/CHANGELOG-2.1.1.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
![ONIX Labs](https://raw.githubusercontent.com/onix-labs/onix-labs.github.io/master/content/logo/master_full_md.png)
1+
![ONIX Labs](https://raw.githubusercontent.com/onix-labs/onixlabs-website/main/src/assets/images/logo/full/original/original-md.png)
22

33
# Change Log - Version 2.1.1
44

docs/CHANGELOG-2.1.2.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
![ONIX Labs](https://raw.githubusercontent.com/onix-labs/onix-labs.github.io/master/content/logo/master_full_md.png)
1+
![ONIX Labs](https://raw.githubusercontent.com/onix-labs/onixlabs-website/main/src/assets/images/logo/full/original/original-md.png)
22

33
# Change Log - Version 2.1.2
44

docs/CHANGELOG-3.0.0.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
![ONIX Labs](https://raw.githubusercontent.com/onix-labs/onix-labs.github.io/master/content/logo/master_full_md.png)
1+
![ONIX Labs](https://raw.githubusercontent.com/onix-labs/onixlabs-website/main/src/assets/images/logo/full/original/original-md.png)
22

33
# Change Log - Version 3.0.0
44

docs/CHANGELOG-4.0.0.md

+129
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
![ONIX Labs](https://raw.githubusercontent.com/onix-labs/onixlabs-website/main/src/assets/images/logo/full/original/original-md.png)
2+
3+
# Change Log - Version 4.0.0
4+
5+
This document serves as the change log for the ONIXLabs Corda Core API.
6+
7+
## Release Notes
8+
9+
This release supports major features in the ONIXLabs Corda Identity Framework, and the ONIXLabs Corda Business Network Management System.
10+
11+
---
12+
13+
### strictEquals _Extension Function_
14+
15+
**Module:** onixlabs-corda-core-contract
16+
17+
**Package:** io.onixlabs.corda.core.contract
18+
19+
Guarantees strict equality between the current `AbstractParty` and the other `AbstractParty`.
20+
21+
```kotlin
22+
fun AbstractParty.strictEquals(other: AbstractParty): Boolean
23+
```
24+
25+
---
26+
27+
### StatePosition _Enum Class_
28+
29+
**Module:** onixlabs-corda-core-contract
30+
31+
**Package:** io.onixlabs.corda.core.contract
32+
33+
Determines the position of a state within a transaction.
34+
35+
```kotlin
36+
enum class StatePosition
37+
```
38+
39+
#### Entries
40+
41+
| Name | Description |
42+
| ------------- | ------------------------------------------------------------ |
43+
| **INPUT** | Defines that a resolvable should resolve from a transaction input state. |
44+
| **OUTPUT** | Defines that a resolvable should resolve from a transaction output state. |
45+
| **REFERENCE** | Defines that a resolvable should resolve from a transaction reference input state. |
46+
47+
#### Remarks
48+
49+
This class replaces `TransactionResolution` which has been part of the API since version 1.0.0, and includes new functionality to resolve input, output and reference states from a `LedgerTransaction` instance.
50+
51+
---
52+
53+
### checkSufficientSessionsForCounterparties _Extension Function_
54+
55+
**Module:** onixlabs-corda-core-workflow
56+
57+
**Package:** io.onixlabs.corda.core.workflow
58+
59+
Checks that sufficient flow sessions have been provided for the specified counter-parties.
60+
61+
```kotlin
62+
@Suspendable
63+
fun FlowLogic<*>.checkSufficientSessionsForCounterparties(
64+
sessions: Iterable<FlowSession>,
65+
counterparties: Iterable<AbstractParty>,
66+
projectParty: (AbstractParty) -> AbstractParty = { it }
67+
): Unit
68+
```
69+
70+
---
71+
72+
### checkSufficientSessionsForContractStates _Extension Function_
73+
74+
**Module:** onixlabs-corda-core-workflow
75+
76+
**Package:** io.onixlabs.corda.core.workflow
77+
78+
Checks that sufficient flow sessions have been provided for the specified states.
79+
80+
```kotlin
81+
@Suspendable
82+
fun FlowLogic<*>.checkSufficientSessionsForContractStates(
83+
sessions: Iterable<FlowSession>,
84+
states: Iterable<ContractState>,
85+
partyProjection: (AbstractParty) -> AbstractParty = { it }
86+
): Unit
87+
```
88+
89+
---
90+
91+
### checkSufficientSessionsForContractStates _Extension Function_
92+
93+
**Module:** onixlabs-corda-core-workflow
94+
95+
**Package:** io.onixlabs.corda.core.workflow
96+
97+
Checks that sufficient flow sessions have been provided for the specified states.
98+
99+
```kotlin
100+
@Suspendable
101+
fun FlowLogic<*>.checkSufficientSessionsForContractStates(
102+
sessions: Iterable<FlowSession>,
103+
vararg states: ContractState,
104+
projectParty: (AbstractParty) -> AbstractParty = { it }
105+
): Unit
106+
```
107+
108+
---
109+
110+
### checkSufficientSessionsForTransactionBuilder _Extension Function_
111+
112+
**Module:** onixlabs-corda-core-workflow
113+
114+
**Package:** io.onixlabs.corda.core.workflow
115+
116+
Checks that sufficient flow sessions have been provided for the specified transaction.
117+
118+
```kotlin
119+
@Suspendable
120+
fun FlowLogic<*>.checkSufficientSessionsForTransactionBuilder(
121+
sessions: Iterable<FlowSession>,
122+
transaction: TransactionBuilder,
123+
partyProjection: (AbstractParty) -> AbstractParty = { it }
124+
projectParty: (AbstractParty) -> AbstractParty = { it }
125+
): Unit
126+
```
127+
128+
---
129+

docs/CHANGELOG-TEMPLATE.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
![ONIX Labs](https://raw.githubusercontent.com/onix-labs/onix-labs.github.io/master/content/logo/master_full_md.png)
1+
![ONIX Labs](https://raw.githubusercontent.com/onix-labs/onixlabs-website/main/src/assets/images/logo/full/original/original-md.png)
22

33
# Change Log - Version 0.0.0
44

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name=onixlabs-corda-core
22
group=io.onixlabs
3-
version=3.2.0
3+
version=4.0.0-rc4
44
onixlabs.development.jarsign.keystore=../lib/onixlabs.development.pkcs12
55
onixlabs.development.jarsign.password=5891f47942424d2acbe108691fdb5ba258712fca7e4762be4327241ebf3dbfa3

onixlabs-corda-core-contract/src/main/kotlin/io/onixlabs/corda/core/Extensions.Class.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020-2021 ONIXLabs
2+
* Copyright 2020-2022 ONIXLabs
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

onixlabs-corda-core-contract/src/main/kotlin/io/onixlabs/corda/core/Extensions.Type.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020-2021 ONIXLabs
2+
* Copyright 2020-2022 ONIXLabs
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

onixlabs-corda-core-contract/src/main/kotlin/io/onixlabs/corda/core/contract/AbstractPluralResolvable.kt

+4-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020-2021 ONIXLabs
2+
* Copyright 2020-2022 ONIXLabs
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -61,16 +61,10 @@ abstract class AbstractPluralResolvable<T> : PluralResolvable<T> where T : Contr
6161
* Resolves a [ContractState] using a [LedgerTransaction] instance.
6262
*
6363
* @param transaction The [LedgerTransaction] instance to use to resolve the state.
64-
* @param resolution The transaction resolution method to use to resolve the [ContractState] instance.
64+
* @param position The position of the [ContractState] instances to resolve in the transaction.
6565
* @return Returns a list of resolved [ContractState] elements, or an empty list if no matching state is found.
6666
*/
67-
override fun resolve(transaction: LedgerTransaction, resolution: TransactionResolution): List<StateAndRef<T>> {
68-
val states = when (resolution) {
69-
TransactionResolution.INPUT -> transaction.inRefsOfType(contractStateType)
70-
TransactionResolution.OUTPUT -> transaction.outRefsOfType(contractStateType)
71-
TransactionResolution.REFERENCE -> transaction.referenceInputRefsOfType(contractStateType)
72-
}
73-
74-
return states.filter { isPointingTo(it) }
67+
override fun resolve(transaction: LedgerTransaction, position: StatePosition): List<StateAndRef<T>> {
68+
return position.getStateAndRefs(transaction, contractStateType).filter { isPointingTo(it) }
7569
}
7670
}

onixlabs-corda-core-contract/src/main/kotlin/io/onixlabs/corda/core/contract/AbstractSingularResolvable.kt

+4-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020-2021 ONIXLabs
2+
* Copyright 2020-2022 ONIXLabs
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -61,16 +61,10 @@ abstract class AbstractSingularResolvable<T> : SingularResolvable<T> where T : C
6161
* Resolves a [ContractState] using a [LedgerTransaction] instance.
6262
*
6363
* @param transaction The [LedgerTransaction] instance to use to resolve the state.
64-
* @param resolution The transaction resolution method to use to resolve the [ContractState] instance.
64+
* @param position The position of the [ContractState] instance to resolve in the transaction.
6565
* @return Returns the resolved [ContractState], or null if no matching state is found.
6666
*/
67-
override fun resolve(transaction: LedgerTransaction, resolution: TransactionResolution): StateAndRef<T>? {
68-
val states = when (resolution) {
69-
TransactionResolution.INPUT -> transaction.inRefsOfType(contractStateType)
70-
TransactionResolution.OUTPUT -> transaction.outRefsOfType(contractStateType)
71-
TransactionResolution.REFERENCE -> transaction.referenceInputRefsOfType(contractStateType)
72-
}
73-
74-
return states.singleOrNull { isPointingTo(it) }
67+
override fun resolve(transaction: LedgerTransaction, position: StatePosition): StateAndRef<T>? {
68+
return position.getStateAndRefs(transaction, contractStateType).singleOrNull { isPointingTo(it) }
7569
}
7670
}

onixlabs-corda-core-contract/src/main/kotlin/io/onixlabs/corda/core/contract/ChainState.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020-2021 ONIXLabs
2+
* Copyright 2020-2022 ONIXLabs
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

onixlabs-corda-core-contract/src/main/kotlin/io/onixlabs/corda/core/contract/ContractID.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020-2021 ONIXLabs
2+
* Copyright 2020-2022 ONIXLabs
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

onixlabs-corda-core-contract/src/main/kotlin/io/onixlabs/corda/core/contract/DummyContract.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020-2021 ONIXLabs
2+
* Copyright 2020-2022 ONIXLabs
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

onixlabs-corda-core-contract/src/main/kotlin/io/onixlabs/corda/core/contract/Extensions.AbstractParty.kt

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020-2021 ONIXLabs
2+
* Copyright 2020-2022 ONIXLabs
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,6 +20,20 @@ import net.corda.core.crypto.SecureHash
2020
import net.corda.core.identity.AbstractParty
2121
import java.security.PublicKey
2222

23+
/**
24+
* Guarantees strict equality between the current [AbstractParty] and the other [AbstractParty].
25+
*
26+
* @param other The other [AbstractParty] to compare with the current [AbstractParty].
27+
* @return Returns true if the current [AbstractParty] and the other [AbstractParty] are strictly equal; otherwise, false.
28+
*/
29+
fun AbstractParty.strictEquals(other: AbstractParty): Boolean {
30+
val equalByReference = this === other
31+
val equalByThisOther = equals(other)
32+
val equalByOtherThis = other == this
33+
34+
return equalByReference || (equalByThisOther && equalByOtherThis)
35+
}
36+
2337
/**
2438
* Gets the owning keys from an [Iterable] of [AbstractParty].
2539
*

onixlabs-corda-core-contract/src/main/kotlin/io/onixlabs/corda/core/contract/Extensions.ChainState.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020-2021 ONIXLabs
2+
* Copyright 2020-2022 ONIXLabs
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

onixlabs-corda-core-contract/src/main/kotlin/io/onixlabs/corda/core/contract/Extensions.LedgerTransaction.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020-2021 ONIXLabs
2+
* Copyright 2020-2022 ONIXLabs
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

onixlabs-corda-core-contract/src/main/kotlin/io/onixlabs/corda/core/contract/Extensions.SecureHash.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020-2021 ONIXLabs
2+
* Copyright 2020-2022 ONIXLabs
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

onixlabs-corda-core-contract/src/main/kotlin/io/onixlabs/corda/core/contract/Extensions.SingularResolvable.kt

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020-2021 ONIXLabs
2+
* Copyright 2020-2022 ONIXLabs
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -52,12 +52,12 @@ fun <T : ContractState> SingularResolvable<T>.resolveOrThrow(
5252
* Resolves a [ContractState] using a [LedgerTransaction] instance.
5353
*
5454
* @param transaction The [LedgerTransaction] instance to use to resolve the state.
55-
* @param resolution The transaction resolution method to use to resolve the [ContractState] instance.
55+
* @param position The position of the [ContractState] instance to resolve in the transaction.
5656
* @param message The exception message to throw if the state cannot be resolved.
5757
* @return Returns the resolved [ContractState], or throws an exception if the state cannot be resolved.
5858
*/
5959
fun <T : ContractState> SingularResolvable<T>.resolveOrThrow(
6060
transaction: LedgerTransaction,
61-
resolution: TransactionResolution,
61+
position: StatePosition,
6262
message: () -> String = { MESSAGE }
63-
): StateAndRef<T> = resolve(transaction, resolution) ?: throw IllegalArgumentException(message())
63+
): StateAndRef<T> = resolve(transaction, position) ?: throw IllegalArgumentException(message())

onixlabs-corda-core-contract/src/main/kotlin/io/onixlabs/corda/core/contract/Extensions.StateAndRef.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020-2021 ONIXLabs
2+
* Copyright 2020-2022 ONIXLabs
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

onixlabs-corda-core-contract/src/main/kotlin/io/onixlabs/corda/core/contract/Hashable.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020-2021 ONIXLabs
2+
* Copyright 2020-2022 ONIXLabs
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)