-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for Optional types in blueprint processing (#463)
* Add support for Optional types in blueprint processing Implemented changes to handle Optional types in blueprint definitions. Added tests for processing blueprints with basic option types and ensured proper compilation. Updated schema and processing utilities to accommodate new Optional type handling. * Add Pair type support and serialization logic Added the Pair type to Type and JavaType enums. Updated BlueprintSchema, ConverterCodeGenerator, and ClassDefinitionGenerator to handle Pair serialization and deserialization. Introduced unit tests to verify Pair functionality. * Fix package issue due to aiken stdlib definitions * To fix #452 Add tests for ScheduledTransactionRedeemer model and related tests
- Loading branch information
Showing
37 changed files
with
2,130 additions
and
60 deletions.
There are no files selected for viewing
7 changes: 7 additions & 0 deletions
7
...r/src/it/java/com/bloxbean/cardano/client/plutus/annotation/processor/it/BasicOption.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.bloxbean.cardano.client.plutus.annotation.processor.it; | ||
|
||
import com.bloxbean.cardano.client.plutus.annotation.Blueprint; | ||
|
||
@Blueprint(fileInResources = "blueprint/basic_option_plutus.json", packageName = "com.bloxbean.cardano.client.plutus.annotation.blueprint.basicoption") | ||
public class BasicOption { | ||
} |
7 changes: 7 additions & 0 deletions
7
...sor/src/it/java/com/bloxbean/cardano/client/plutus/annotation/processor/it/BasicPair.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.bloxbean.cardano.client.plutus.annotation.processor.it; | ||
|
||
import com.bloxbean.cardano.client.plutus.annotation.Blueprint; | ||
|
||
@Blueprint(fileInResources = "blueprint/basic_pair.json", packageName = "com.bloxbean.cardano.client.plutus.annotation.blueprint.basicpair") | ||
public class BasicPair { | ||
} |
7 changes: 7 additions & 0 deletions
7
...com/bloxbean/cardano/client/plutus/annotation/processor/it/RecurringPaymentBlueprint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
package com.bloxbean.cardano.client.plutus.annotation.processor.it; | ||
|
||
import com.bloxbean.cardano.client.plutus.annotation.Blueprint; | ||
|
||
@Blueprint(fileInResources = "blueprint/recurring_payment.json", packageName = "com.bloxbean.cardano.client.plutus.annotation.blueprint.recurringpayment") | ||
public class RecurringPaymentBlueprint { | ||
} |
187 changes: 187 additions & 0 deletions
187
annotation-processor/src/it/resources/blueprint/basic_option_plutus.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,187 @@ | ||
{ | ||
"preamble": { | ||
"title": "satya/hello6", | ||
"description": "Aiken contracts for project 'satya/hello6'", | ||
"version": "0.0.0", | ||
"plutusVersion": "v3", | ||
"compiler": { | ||
"name": "Aiken", | ||
"version": "v1.1.3+3d77b5c" | ||
}, | ||
"license": "Apache-2.0" | ||
}, | ||
"validators": [ | ||
{ | ||
"title": "hello6.option_test.spend", | ||
"datum": { | ||
"title": "datum", | ||
"schema": { | ||
"$ref": "#/definitions/hello6~1Datum" | ||
} | ||
}, | ||
"redeemer": { | ||
"title": "redeemer", | ||
"schema": { | ||
"$ref": "#/definitions/hello6~1Redeemer" | ||
} | ||
}, | ||
"compiledCode": "590214010100323232323232253330023232323232533233008300130093754004264646464a6646601a6002601c6ea80204c8c8c8c8c8c8c8c94ccc060c0680084c8c94ccc05cc02c0044c8c94ccc070c0780085401058dd7180e000980c9baa0091533301730100011533301a301937540122a0042c2c602e6ea80204cc028014894ccc0680084c8c94ccc064c0340044c8c94ccc078c0800084c8c94ccc074c04400454ccc080c07cdd50018a8010b0a99980e980b0008a999810180f9baa003150021616301d37540042a0082c603c00260366ea801c54ccc064c04800454ccc070c06cdd50038a8010b0b180c9baa00613300c00322533301c00215333019300d301a375401e26464a666036601e60386ea80044c94ccc07000c400452819b8f375c603e603a6ea800522010548656c6c6f0016301e301c375402a66e1cdd6980e980d9baa301d301b375401e90020b0999119299980e180800089919299981098118010a8020b1bad3021001301e37540062a666038602a0022a66603e603c6ea800c540085858c070dd5001180e80109800980f0010991801180e8019bad301b00216375860300026030004602c002602c0046eb0c050004c050008c048004c03cdd50041b87480005888c8cc00400400c88cc00c004c008008c038c03c008c034004c028dd50011b874800858c028c02c008c024004c024008c01c004c010dd50008a4c26cacae6955ceaab9e5573eae855d11", | ||
"hash": "259dcba0e8629ce7acabb4e4424f9da53be27aa2f5ee32c323fa0963" | ||
}, | ||
{ | ||
"title": "hello6.option_test.else", | ||
"compiledCode": "590214010100323232323232253330023232323232533233008300130093754004264646464a6646601a6002601c6ea80204c8c8c8c8c8c8c8c94ccc060c0680084c8c94ccc05cc02c0044c8c94ccc070c0780085401058dd7180e000980c9baa0091533301730100011533301a301937540122a0042c2c602e6ea80204cc028014894ccc0680084c8c94ccc064c0340044c8c94ccc078c0800084c8c94ccc074c04400454ccc080c07cdd50018a8010b0a99980e980b0008a999810180f9baa003150021616301d37540042a0082c603c00260366ea801c54ccc064c04800454ccc070c06cdd50038a8010b0b180c9baa00613300c00322533301c00215333019300d301a375401e26464a666036601e60386ea80044c94ccc07000c400452819b8f375c603e603a6ea800522010548656c6c6f0016301e301c375402a66e1cdd6980e980d9baa301d301b375401e90020b0999119299980e180800089919299981098118010a8020b1bad3021001301e37540062a666038602a0022a66603e603c6ea800c540085858c070dd5001180e80109800980f0010991801180e8019bad301b00216375860300026030004602c002602c0046eb0c050004c050008c048004c03cdd50041b87480005888c8cc00400400c88cc00c004c008008c038c03c008c034004c028dd50011b874800858c028c02c008c024004c024008c01c004c010dd50008a4c26cacae6955ceaab9e5573eae855d11", | ||
"hash": "259dcba0e8629ce7acabb4e4424f9da53be27aa2f5ee32c323fa0963" | ||
} | ||
], | ||
"definitions": { | ||
"ByteArray": { | ||
"dataType": "bytes" | ||
}, | ||
"Int": { | ||
"dataType": "integer" | ||
}, | ||
"List$Int": { | ||
"dataType": "list", | ||
"items": { | ||
"$ref": "#/definitions/Int" | ||
} | ||
}, | ||
"List$Option$Int": { | ||
"dataType": "list", | ||
"items": { | ||
"$ref": "#/definitions/Option$Int" | ||
} | ||
}, | ||
"Option$ByteArray": { | ||
"title": "Option", | ||
"anyOf": [ | ||
{ | ||
"title": "Some", | ||
"description": "An optional value.", | ||
"dataType": "constructor", | ||
"index": 0, | ||
"fields": [ | ||
{ | ||
"$ref": "#/definitions/ByteArray" | ||
} | ||
] | ||
}, | ||
{ | ||
"title": "None", | ||
"description": "Nothing.", | ||
"dataType": "constructor", | ||
"index": 1, | ||
"fields": [] | ||
} | ||
] | ||
}, | ||
"Option$Int": { | ||
"title": "Option", | ||
"anyOf": [ | ||
{ | ||
"title": "Some", | ||
"description": "An optional value.", | ||
"dataType": "constructor", | ||
"index": 0, | ||
"fields": [ | ||
{ | ||
"$ref": "#/definitions/Int" | ||
} | ||
] | ||
}, | ||
{ | ||
"title": "None", | ||
"description": "Nothing.", | ||
"dataType": "constructor", | ||
"index": 1, | ||
"fields": [] | ||
} | ||
] | ||
}, | ||
"Option$hello6/Action": { | ||
"title": "Option", | ||
"anyOf": [ | ||
{ | ||
"title": "Some", | ||
"description": "An optional value.", | ||
"dataType": "constructor", | ||
"index": 0, | ||
"fields": [ | ||
{ | ||
"$ref": "#/definitions/hello6~1Action" | ||
} | ||
] | ||
}, | ||
{ | ||
"title": "None", | ||
"description": "Nothing.", | ||
"dataType": "constructor", | ||
"index": 1, | ||
"fields": [] | ||
} | ||
] | ||
}, | ||
"hello6/Action": { | ||
"title": "Action", | ||
"anyOf": [ | ||
{ | ||
"title": "Mint", | ||
"dataType": "constructor", | ||
"index": 0, | ||
"fields": [] | ||
}, | ||
{ | ||
"title": "Burn", | ||
"dataType": "constructor", | ||
"index": 1, | ||
"fields": [] | ||
} | ||
] | ||
}, | ||
"hello6/Datum": { | ||
"title": "Datum", | ||
"anyOf": [ | ||
{ | ||
"title": "Datum", | ||
"dataType": "constructor", | ||
"index": 0, | ||
"fields": [ | ||
{ | ||
"title": "count", | ||
"$ref": "#/definitions/Int" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"hello6/Redeemer": { | ||
"title": "Redeemer", | ||
"anyOf": [ | ||
{ | ||
"title": "Redeemer", | ||
"dataType": "constructor", | ||
"index": 0, | ||
"fields": [ | ||
{ | ||
"title": "msg", | ||
"$ref": "#/definitions/Option$ByteArray" | ||
}, | ||
{ | ||
"title": "list", | ||
"$ref": "#/definitions/List$Int" | ||
}, | ||
{ | ||
"title": "act", | ||
"$ref": "#/definitions/Option$hello6~1Action" | ||
}, | ||
{ | ||
"title": "act2", | ||
"$ref": "#/definitions/List$Option$Int" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} |
167 changes: 167 additions & 0 deletions
167
annotation-processor/src/it/resources/blueprint/basic_pair.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,167 @@ | ||
{ | ||
"preamble": { | ||
"title": "satya/hello6", | ||
"description": "Aiken contracts for project 'satya/hello6'", | ||
"version": "0.0.0", | ||
"plutusVersion": "v3", | ||
"compiler": { | ||
"name": "Aiken", | ||
"version": "v1.1.3+3d77b5c" | ||
}, | ||
"license": "Apache-2.0" | ||
}, | ||
"validators": [ | ||
{ | ||
"title": "hello6.option_test.spend", | ||
"datum": { | ||
"title": "datum", | ||
"schema": { | ||
"$ref": "#/definitions/hello6~1Datum" | ||
} | ||
}, | ||
"redeemer": { | ||
"title": "redeemer", | ||
"schema": { | ||
"$ref": "#/definitions/hello6~1Redeemer" | ||
} | ||
}, | ||
"compiledCode": "5901e201010032323232323225333002323232323253323300830013009375400426464646464a66601a6004601c6ea80204c8c8c8c8c8c94ccc058c0600084c8c94ccc054c0280044c8c94ccc068c0700085401058dd7180d000980b9baa00715333015300e001153330183017375400e2a0042c2c602a6ea80184c8cc020c0580104c8cc00400400c88c94ccc06800854ccc05cc030c060dd500689919299980c9807180d1baa001132533301a003100114a066e3cdd7180e980d9baa00148810548656c6c6f0016301c301a375402666e1cdd6980d980c9baa301b3019375401a90020b09919199119299980e180880089919299981098118010998090008a8020b1810800980f1baa0031533301c30150011533301f301e37540062a0042c2c60386ea8008c06c0084c00cc078010dd6980c800980d80118010011bad3014003163756602c002602c00464a666028602c602c002266ec0c054004c054c05800458dd6180a000980a001180900098079baa008162232533300f300400115333012301137540062a0042c2a66601e60100022a66602460226ea800c540085858c03cdd50011b8748000c038c03c008c034004c028dd50011b874800858c028c02c008c024004c024008c01c004c010dd50008a4c26cacae6955ceaab9e5573eae855d101", | ||
"hash": "7d6957063c7c52d9de05a799a33996d36c98427f06c9cc51d2dc77c8" | ||
}, | ||
{ | ||
"title": "hello6.option_test.else", | ||
"compiledCode": "5901e201010032323232323225333002323232323253323300830013009375400426464646464a66601a6004601c6ea80204c8c8c8c8c8c94ccc058c0600084c8c94ccc054c0280044c8c94ccc068c0700085401058dd7180d000980b9baa00715333015300e001153330183017375400e2a0042c2c602a6ea80184c8cc020c0580104c8cc00400400c88c94ccc06800854ccc05cc030c060dd500689919299980c9807180d1baa001132533301a003100114a066e3cdd7180e980d9baa00148810548656c6c6f0016301c301a375402666e1cdd6980d980c9baa301b3019375401a90020b09919199119299980e180880089919299981098118010998090008a8020b1810800980f1baa0031533301c30150011533301f301e37540062a0042c2c60386ea8008c06c0084c00cc078010dd6980c800980d80118010011bad3014003163756602c002602c00464a666028602c602c002266ec0c054004c054c05800458dd6180a000980a001180900098079baa008162232533300f300400115333012301137540062a0042c2a66601e60100022a66602460226ea800c540085858c03cdd50011b8748000c038c03c008c034004c028dd50011b874800858c028c02c008c024004c024008c01c004c010dd50008a4c26cacae6955ceaab9e5573eae855d101", | ||
"hash": "7d6957063c7c52d9de05a799a33996d36c98427f06c9cc51d2dc77c8" | ||
} | ||
], | ||
"definitions": { | ||
"ByteArray": { | ||
"dataType": "bytes" | ||
}, | ||
"Int": { | ||
"dataType": "integer" | ||
}, | ||
"List$Pair$Int_Option$hello6/Action": { | ||
"dataType": "map", | ||
"keys": { | ||
"$ref": "#/definitions/Int" | ||
}, | ||
"values": { | ||
"$ref": "#/definitions/Option$hello6~1Action" | ||
} | ||
}, | ||
"Option$ByteArray": { | ||
"title": "Option", | ||
"anyOf": [ | ||
{ | ||
"title": "Some", | ||
"description": "An optional value.", | ||
"dataType": "constructor", | ||
"index": 0, | ||
"fields": [ | ||
{ | ||
"$ref": "#/definitions/ByteArray" | ||
} | ||
] | ||
}, | ||
{ | ||
"title": "None", | ||
"description": "Nothing.", | ||
"dataType": "constructor", | ||
"index": 1, | ||
"fields": [] | ||
} | ||
] | ||
}, | ||
"Option$hello6/Action": { | ||
"title": "Option", | ||
"anyOf": [ | ||
{ | ||
"title": "Some", | ||
"description": "An optional value.", | ||
"dataType": "constructor", | ||
"index": 0, | ||
"fields": [ | ||
{ | ||
"$ref": "#/definitions/hello6~1Action" | ||
} | ||
] | ||
}, | ||
{ | ||
"title": "None", | ||
"description": "Nothing.", | ||
"dataType": "constructor", | ||
"index": 1, | ||
"fields": [] | ||
} | ||
] | ||
}, | ||
"Pair$Int_hello6/Action": { | ||
"title": "Pair", | ||
"dataType": "#pair", | ||
"left": { | ||
"$ref": "#/definitions/Int" | ||
}, | ||
"right": { | ||
"$ref": "#/definitions/hello6~1Action" | ||
} | ||
}, | ||
"hello6/Action": { | ||
"title": "Action", | ||
"anyOf": [ | ||
{ | ||
"title": "Mint", | ||
"dataType": "constructor", | ||
"index": 0, | ||
"fields": [] | ||
}, | ||
{ | ||
"title": "Burn", | ||
"dataType": "constructor", | ||
"index": 1, | ||
"fields": [] | ||
} | ||
] | ||
}, | ||
"hello6/Datum": { | ||
"title": "Datum", | ||
"anyOf": [ | ||
{ | ||
"title": "Datum", | ||
"dataType": "constructor", | ||
"index": 0, | ||
"fields": [ | ||
{ | ||
"title": "count", | ||
"$ref": "#/definitions/Int" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"hello6/Redeemer": { | ||
"title": "Redeemer", | ||
"anyOf": [ | ||
{ | ||
"title": "Redeemer", | ||
"dataType": "constructor", | ||
"index": 0, | ||
"fields": [ | ||
{ | ||
"title": "msg", | ||
"$ref": "#/definitions/Option$ByteArray" | ||
}, | ||
{ | ||
"title": "p", | ||
"$ref": "#/definitions/Pair$Int_hello6~1Action" | ||
}, | ||
{ | ||
"title": "l", | ||
"$ref": "#/definitions/List$Pair$Int_Option$hello6~1Action" | ||
} | ||
] | ||
} | ||
] | ||
} | ||
} | ||
} |
Oops, something went wrong.