Skip to content

Commit

Permalink
[RA-122] fix: fixes wrong assetname. Using the assetname from the uni…
Browse files Browse the repository at this point in the history
…t. (#173)

* fix: fixes wrong assetname. Using the assetname from the unit.

* fix: fixing tests because behaviour changed

* fix: spotless issues
  • Loading branch information
Kammerlo authored May 16, 2024
1 parent f3ce1a2 commit b9957c6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import jakarta.validation.constraints.NotNull;

import org.springframework.beans.factory.annotation.Autowired;
import org.apache.commons.codec.binary.Hex;
import org.apache.commons.lang3.mutable.MutableInt;
import org.modelmapper.builder.ConfigurableConditionExpression;
import org.openapitools.client.model.Amount;
Expand Down Expand Up @@ -52,7 +51,7 @@ protected OperationMetadata mapToOperationMetaData(boolean spent, List<Amt> amou
tokenBundleItem.setPolicyId(amount.getPolicyId());
Amount amt = new Amount();
amt.setValue(DataMapper.mapValue(amount.getQuantity().toString(), spent));
String hexAssetName = Hex.encodeHexString(amount.getAssetName().getBytes());
String hexAssetName = amount.getUnit().replace(amount.getPolicyId(), "");
amt.setCurrency(Currency.builder()
.symbol(hexAssetName)
.decimals(0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import org.springframework.beans.factory.annotation.Autowired;
import com.bloxbean.cardano.yaci.core.model.certs.CertificateType;
import org.apache.commons.codec.binary.Hex;
import org.assertj.core.util.introspection.CaseFormatUtils;
import org.openapitools.client.model.Amount;
import org.openapitools.client.model.CoinAction;
Expand Down Expand Up @@ -285,8 +284,7 @@ void toDto_Test_getOutputsAsOperations() {

Amount token = bundle.getTokens().getFirst();
assertThat(token.getCurrency().getSymbol())
.isEqualTo(Hex.encodeHexString(
from.getOutputs().getFirst().getAmounts().getFirst().getAssetName().getBytes()));
.isEqualTo("unit1");
assertThat(token.getCurrency().getDecimals()).isZero();
}

Expand Down Expand Up @@ -333,8 +331,7 @@ void toDto_Test_getInputsAsOperations() {

Amount token = bundle.getTokens().getFirst();
assertThat(token.getCurrency().getSymbol())
.isEqualTo(Hex.encodeHexString(
from.getInputs().getFirst().getAmounts().getFirst().getAssetName().getBytes()));
.isEqualTo("unit1");
assertThat(token.getCurrency().getDecimals()).isZero();
}

Expand Down

0 comments on commit b9957c6

Please sign in to comment.