-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from bloxbean/fix_49
feat: #49 Add new redeemer purpose, gov action changes
- Loading branch information
Showing
17 changed files
with
202 additions
and
43 deletions.
There are no files selected for viewing
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
47 changes: 47 additions & 0 deletions
47
core/src/main/java/com/bloxbean/cardano/yaci/core/model/ExUnits.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,47 @@ | ||
package com.bloxbean.cardano.yaci.core.model; | ||
|
||
import co.nstant.in.cbor.model.Array; | ||
import co.nstant.in.cbor.model.DataItem; | ||
import co.nstant.in.cbor.model.UnsignedInteger; | ||
import com.bloxbean.cardano.yaci.core.exception.CborRuntimeException; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Data; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.math.BigInteger; | ||
import java.util.List; | ||
|
||
@Data | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Builder | ||
public class ExUnits { | ||
private BigInteger mem; | ||
private BigInteger steps; | ||
|
||
public Array serialize() { | ||
Array array = new Array(); | ||
array.add(new UnsignedInteger(mem)); | ||
array.add(new UnsignedInteger(steps)); | ||
|
||
return array; | ||
} | ||
|
||
public static ExUnits deserialize(Array exUnitDI) { | ||
List<DataItem> dataItemList = exUnitDI.getDataItems(); | ||
if (dataItemList == null || dataItemList.size() != 2) | ||
throw new CborRuntimeException("ExUnits deserialization error. Invalid no of DataItem"); | ||
|
||
DataItem memDI = dataItemList.get(0); | ||
DataItem stepsDI = dataItemList.get(1); | ||
|
||
ExUnits exUnits = new ExUnits(); | ||
exUnits.setMem(((UnsignedInteger) memDI).getValue()); | ||
exUnits.setSteps(((UnsignedInteger) stepsDI).getValue()); | ||
|
||
return exUnits; | ||
} | ||
|
||
} | ||
|
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
7 changes: 7 additions & 0 deletions
7
core/src/main/java/com/bloxbean/cardano/yaci/core/model/PlutusScriptType.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.yaci.core.model; | ||
|
||
public enum PlutusScriptType { | ||
PlutusScriptV1, | ||
PlutusScriptV2, | ||
PlutusScriptV3 | ||
} |
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
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
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
25 changes: 25 additions & 0 deletions
25
core/src/main/java/com/bloxbean/cardano/yaci/core/model/RedeemerTag.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,25 @@ | ||
package com.bloxbean.cardano.yaci.core.model; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
public enum RedeemerTag { | ||
@JsonProperty("spend") | ||
Spend(0), | ||
@JsonProperty("mint") | ||
Mint(1), | ||
@JsonProperty("cert") | ||
Cert(2), | ||
@JsonProperty("reward") | ||
Reward(3), | ||
@JsonProperty("voting") | ||
Voting(4), | ||
@JsonProperty("proposing") | ||
Proposing(5); | ||
|
||
public final int value; | ||
|
||
RedeemerTag(int value) { | ||
this.value = value; | ||
} | ||
} | ||
|
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
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
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
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
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
Oops, something went wrong.