-
-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
reafactor(core) : #224 Split core module into spec, plutus, coinselec… #242
Conversation
…tion, core-api
reafactor -> refactor. Once this is there, I will use new library as part of merkle-tree-java project - removing core and putting plutus one from here. |
for (MultiAsset multiAsset : value.getMultiAssets()) { | ||
String policyId = multiAsset.getPolicyId(); | ||
for (com.bloxbean.cardano.client.transaction.spec.Asset asset : multiAsset.getAssets()) { | ||
amounts.add(new Amount(policyId + asset.getNameAsHex().replace("0x", ""), asset.getValue())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NULLPTR_DEREFERENCE: String Asset.getNameAsHex()
could be null (from the call to Asset.getNameAsHex()
on line 29) and is dereferenced.
ℹ️ Expand to see all @sonatype-lift commands
You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Command | Usage |
---|---|
@sonatype-lift ignore |
Leave out the above finding from this PR |
@sonatype-lift ignoreall |
Leave out all the existing findings from this PR |
@sonatype-lift exclude <file|issue|path|tool> |
Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file |
Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.
* This method is deprecated | ||
* Use {@link MinAdaCalculator#calculateMinAda(List)} instead | ||
* | ||
* @param multiAssetList |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EmptyBlockTag: A block tag (@param, @return, @throws, @deprecated) has an empty description. Block tags without descriptions don't add much value for future readers of the code; consider removing the tag entirely or adding a description.
* @param multiAssetList | |
* |
❗❗ 14 similar findings have been found in this PR
🔎 Expand here to view all instances of this finding
File Path | Line Number |
---|---|
core-api/src/main/java/com/bloxbean/cardano/client/api/util/UtxoUtil.java | 120 |
core-api/src/main/java/com/bloxbean/cardano/client/api/util/UtxoUtil.java | 26 |
core-api/src/main/java/com/bloxbean/cardano/client/api/util/AssetUtil.java | 73 |
core-api/src/main/java/com/bloxbean/cardano/client/api/util/UtxoUtil.java | 78 |
core-api/src/main/java/com/bloxbean/cardano/client/api/util/AssetUtil.java | 45 |
core-api/src/main/java/com/bloxbean/cardano/client/api/MinAdaCalculator.java | 69 |
core-api/src/main/java/com/bloxbean/cardano/client/api/util/CostModelUtil.java | 367 |
core-api/src/main/java/com/bloxbean/cardano/client/api/util/UtxoUtil.java | 27 |
core-api/src/main/java/com/bloxbean/cardano/client/api/util/AssetUtil.java | 72 |
core-api/src/main/java/com/bloxbean/cardano/client/api/util/CostModelUtil.java | 381 |
Showing 10 of 14 findings. Visit the Lift Web Console to see all.
ℹ️ Expand to see all @sonatype-lift commands
You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Command | Usage |
---|---|
@sonatype-lift ignore |
Leave out the above finding from this PR |
@sonatype-lift ignoreall |
Leave out all the existing findings from this PR |
@sonatype-lift exclude <file|issue|path|tool> |
Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file |
Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.
//getValue txout ≥ inject ( (serSize txout + 160) ∗ coinsPerUTxOByte pp ) | ||
TransactionOutput cloneOutput = output.toBuilder().build(); | ||
if (cloneOutput.getValue().getCoin() == null || cloneOutput.getValue().getCoin().equals(BigInteger.ZERO) | ||
|| cloneOutput.getValue().getCoin().compareTo(BigInteger.valueOf(100000)) == -1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CompareToZero: The result of #compareTo or #compare should only be compared to 0. It is an implementation detail whether a given type returns strictly the values {-1, 0, +1} or others.
|| cloneOutput.getValue().getCoin().compareTo(BigInteger.valueOf(100000)) == -1) { | |
|| cloneOutput.getValue().getCoin().compareTo(BigInteger.valueOf(100000)) < 0) { |
ℹ️ Expand to see all @sonatype-lift commands
You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Command | Usage |
---|---|
@sonatype-lift ignore |
Leave out the above finding from this PR |
@sonatype-lift ignoreall |
Leave out all the existing findings from this PR |
@sonatype-lift exclude <file|issue|path|tool> |
Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file |
Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.
|
||
import static com.bloxbean.cardano.client.common.CardanoConstants.LOVELACE; | ||
|
||
@Slf4j |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
UnnecessarilyFullyQualified: This fully qualified name is unambiguous to the compiler if imported.
@Slf4j | |
Logger |
❗❗ 8 similar findings have been found in this PR
🔎 Expand here to view all instances of this finding
File Path | Line Number |
---|---|
core-api/src/main/java/com/bloxbean/cardano/client/api/util/UtxoUtil.java | 122 |
core-api/src/main/java/com/bloxbean/cardano/client/api/util/ValueUtil.java | 23 |
core-api/src/main/java/com/bloxbean/cardano/client/api/util/ValueUtil.java | 28 |
core-api/src/main/java/com/bloxbean/cardano/client/api/util/UtxoUtil.java | 20 |
core-api/src/main/java/com/bloxbean/cardano/client/api/util/UtxoUtil.java | 110 |
core-api/src/main/java/com/bloxbean/cardano/client/api/util/UtxoUtil.java | 20 |
spec/src/main/java/com/bloxbean/cardano/client/transaction/Nonce.java | 17 |
core-api/src/main/java/com/bloxbean/cardano/client/api/util/UtxoUtil.java | 81 |
Visit the Lift Web Console to find more details in your report.
ℹ️ Expand to see all @sonatype-lift commands
You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Command | Usage |
---|---|
@sonatype-lift ignore |
Leave out the above finding from this PR |
@sonatype-lift ignoreall |
Leave out all the existing findings from this PR |
@sonatype-lift exclude <file|issue|path|tool> |
Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file |
Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.
public enum CoinselectionConfig { | ||
INSTANCE; | ||
|
||
private int coinSelectionLimit = 20; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ImmutableEnumChecker: enums should be immutable: 'CoinselectionConfig' has non-final field 'coinSelectionLimit'
private int coinSelectionLimit = 20; | |
private final int coinSelectionLimit = 20; |
ℹ️ Expand to see all @sonatype-lift commands
You can reply with the following commands. For example, reply with @sonatype-lift ignoreall to leave out all findings.
Command | Usage |
---|---|
@sonatype-lift ignore |
Leave out the above finding from this PR |
@sonatype-lift ignoreall |
Leave out all the existing findings from this PR |
@sonatype-lift exclude <file|issue|path|tool> |
Exclude specified file|issue|path|tool from Lift findings by updating your config.toml file |
Note: When talking to LiftBot, you need to refresh the page to see its response.
Click here to add LiftBot to another repo.
🛠 Lift Auto-fixSome of the Lift findings in this PR can be automatically fixed. You can download and apply these changes in your local project directory of your branch to review the suggestions before committing.1 # Download the patch
curl https://lift.sonatype.com/api/patch/github.com/bloxbean/cardano-client-lib/242.diff -o lift-autofixes.diff
# Apply the patch with git
git apply lift-autofixes.diff
# Review the changes
git diff Want it all in a single command? Open a terminal in your project's directory and copy and paste the following command: curl https://lift.sonatype.com/api/patch/github.com/bloxbean/cardano-client-lib/242.diff | git apply Once you're satisfied, commit and push your changes in your project. Footnotes |
This PR is for #224
The Core module is divided into multiple sub-modules. Each of these sub-modules can now be added independently.
Spec: This module contains the low-level CBOR serialization logic and a few utilities. To build a transaction using the low-level API, this module should be enough.
Plutus: This module contains Plutus annotations and helpers that can be used to convert/serialize a POJO to PlutusData and vice versa.
CoinSelection: This module contains the CoinSelection API and its implementations.
Core-API: This module contains the core APIs required for the transaction builder or other high-level modules, such as UtxoSupplier, ProtocolParamSupplier, Utxo, Amount, etc
Core: This module contains the remaining classes for legacy reasons, such as legacy high-level APIs. The legacy high-level APIs will be removed once we have the new high-level APIs later.
Known issues: