Skip to content
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

Initial decimals support #2648

Merged
merged 1 commit into from
May 18, 2021
Merged

Conversation

sevanspowell
Copy link
Contributor

Issue Number

ADP-915

Overview

  • I have added initial support for the asset metadata "decimals" field

@sevanspowell sevanspowell self-assigned this May 11, 2021
Copy link
Contributor

@rvl rvl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.
Could you please also remove "unit" - I never got around to doing it.

@sevanspowell sevanspowell force-pushed the feature/ADP-916-add-decimals-minimal branch 6 times, most recently from 2b3ee37 to b220542 Compare May 12, 2021 06:54
@sevanspowell sevanspowell marked this pull request as ready for review May 12, 2021 08:08
@rvl
Copy link
Contributor

rvl commented May 13, 2021

bors r+

iohk-bors bot added a commit that referenced this pull request May 13, 2021
2648: Initial decimals support r=rvl a=sevanspowell

# Issue Number

ADP-915

# Overview

- [x] I have added initial support for the asset metadata "decimals" field

Co-authored-by: Samuel Evans-Powell <mail@sevanspowell.net>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented May 13, 2021

Build failed:

#expected

@sevanspowell
Copy link
Contributor Author

bors r+

iohk-bors bot added a commit that referenced this pull request May 13, 2021
2648: Initial decimals support r=sevanspowell a=sevanspowell

# Issue Number

ADP-915

# Overview

- [x] I have added initial support for the asset metadata "decimals" field

Co-authored-by: Samuel Evans-Powell <mail@sevanspowell.net>
Co-authored-by: Rodney Lorrimar <rodney.lorrimar@iohk.io>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented May 13, 2021

Build failed:

Failures:

  src/Test/Integration/Scenario/API/Shelley/Transactions.hs:605:44: 
  1) API Specifications, SHELLEY_TRANSACTIONS, TRANS_ASSETS_CREATE_01 - Multi-asset balance
       While verifying (Status {statusCode = 200, statusMessage = "OK"},Right [ApiAsset {policyId = ApiT {getApiT = UnsafeTokenPolicyId (Hash "K\254z\202\225\189%\153d\153b\177F\161\228}.\DC4\147\&8\t\179g\232\EOT\198\US\134")}, assetName = ApiT {getApiT = UnsafeTokenName ""}, fingerprint = ApiT {getApiT = UnsafeTokenFingerprint "asset12qd6g7n6h8unpra43ahax55s03awll8tf6pmjt"}, metadata = Nothing},ApiAsset {policyId = ApiT {getApiT = UnsafeTokenPolicyId (Hash "\179W\158c\ACK\165\179\244\155\169\RS\212\197\253y\219\233-T\134t3\255o\146\212{@")}, assetName = ApiT {getApiT = UnsafeTokenName ""}, fingerprint = ApiT {getApiT = UnsafeTokenFingerprint "asset1svcvm6kg7ghnvqyfeazp6v4g8ufqrggs650yev"}, metadata = Nothing},ApiAsset {policyId = ApiT {getApiT = UnsafeTokenPolicyId (Hash "\179W\158c\ACK\165\179\244\155\169\RS\212\197\253y\219\233-T\134t3\255o\146\212{@")}, assetName = ApiT {getApiT = UnsafeTokenName "apple"}, fingerprint = ApiT {getApiT = UnsafeTokenFingerprint "asset1gz7new73mmyd72wm8gxa9lg4xnh8uw2ev4wwjq"}, metadata = Nothing},ApiAsset {policyId = ApiT {getApiT = UnsafeTokenPolicyId (Hash "\179W\158c\ACK\165\179\244\155\169\RS\212\197\253y\219\233-T\134t3\255o\146\212{@")}, assetName = ApiT {getApiT = UnsafeTokenName "banana"}, fingerprint = ApiT {getApiT = UnsafeTokenFingerprint "asset195cyx5jgqn9ydfprxkptct08ytlw4knqdgqs3k"}, metadata = Nothing},ApiAsset {policyId = ApiT {getApiT = UnsafeTokenPolicyId (Hash "\179W\158c\ACK\165\179\244\155\169\RS\212\197\253y\219\233-T\134t3\255o\146\212{@")}, assetName = ApiT {getApiT = UnsafeTokenName "cherry"}, fingerprint = ApiT {getApiT = UnsafeTokenFingerprint "asset13qf84yy5jh7tym72e0y9afy9ezr62d2my7zxza"}, metadata = Nothing},ApiAsset {policyId = ApiT {getApiT = UnsafeTokenPolicyId (Hash "\244\DC3{\ACK\145\176\FS|\164l/\192Uv\244\240\171\142\235\184\248\228\148l\185\DLE~\SI")}, assetName = ApiT {getApiT = UnsafeTokenName "apple"}, fingerprint = ApiT {getApiT = UnsafeTokenFingerprint "asset18xhxuq4upfv3zk7ngqerfp2mradev2u68lvu4p"}, metadata = Nothing},ApiAsset {policyId = ApiT {getApiT = UnsafeTokenPolicyId (Hash "\244\DC3{\ACK\145\176\FS|\164l/\192Uv\244\240\171\142\235\184\248\228\148l\185\DLE~\SI")}, assetName = ApiT {getApiT = UnsafeTokenName "banana"}, fingerprint = ApiT {getApiT = UnsafeTokenFingerprint "asset1v59zpp0kfnws6t35talp3jh88ra8e67vsssu0w"}, metadata = Nothing},ApiAsset {policyId = ApiT {getApiT = UnsafeTokenPolicyId (Hash "\244\DC3{\ACK\145\176\FS|\164l/\192Uv\244\240\171\142\235\184\248\228\148l\185\DLE~\SI")}, assetName = ApiT {getApiT = UnsafeTokenName "cherry"}, fingerprint = ApiT {getApiT = UnsafeTokenFingerprint "asset1y04z9wfsx5u22hamclg3tl5zlkrwh83f704yv7"}, metadata = Nothing}])
       expected: Just (ApiAssetMetadata {name = "SteveToken", description = "A sample description", ticker = Just "STV", url = Just (ApiT {getApiT = AssetURL https://iohk.io/stevetoken}), logo = Just (ApiT {getApiT = AssetLogo "Almost a logo"}), decimals = Just (ApiT {getApiT = AssetDecimals 6})})
        but got: Nothing

  To rerun use: --match "/API Specifications/SHELLEY_TRANSACTIONS/TRANS_ASSETS_CREATE_01 - Multi-asset balance/"

Something's not quite right with the lib/shelley/test/data/token-metadata.json or the mock metadata server.

#expected

@piotr-iohk
Copy link
Contributor

@sevanspowell Just to note. Using wallet from this branch on testnet I'm not able to see decimals:

  1. I have added metadata with decimals: https://github.com/input-output-hk/metadata-registry-testnet/pull/109/files
  2. Decimals seem to be there on metadata server -> https://metadata.cardano-testnet.iohkdev.io/metadata/6b1b1cc20a8d37d1d7bea2ca5427335c7f4c586e70692333153ef38354455354444543494d414c533
  3. However in wallet I cannot see them...
$ curl -X GET http://localhost:8090/v2/wallets/1ceb45b37a94c7022837b5ca14045f11a5927c65/assets/6b1b1cc20a8d37d1d7bea2ca5427335c7f4c586e70692333153ef383/54455354444543494d414c5330 | jq
  
{
  "asset_name": "54455354444543494d414c5330",
  "fingerprint": "asset13sewuyf7e6hau2fjav3qmsev4jfdfxzlvakqmt",
  "policy_id": "6b1b1cc20a8d37d1d7bea2ca5427335c7f4c586e70692333153ef383",
  "metadata": {
    "name": "DECIMALSCOIN",
    "description": "Test Decimals"
  }
}

@sevanspowell sevanspowell force-pushed the feature/ADP-916-add-decimals-minimal branch 2 times, most recently from 2b77e84 to 8125b05 Compare May 17, 2021 05:34
- Add support for the "decimals" field in token metadata.
- Remove unit field
@sevanspowell sevanspowell force-pushed the feature/ADP-916-add-decimals-minimal branch from c0c1fba to 6e61ec6 Compare May 17, 2021 15:32
@sevanspowell
Copy link
Contributor Author

bors r+

iohk-bors bot added a commit that referenced this pull request May 18, 2021
2648: Initial decimals support r=sevanspowell a=sevanspowell

# Issue Number

ADP-915

# Overview

- [x] I have added initial support for the asset metadata "decimals" field

Co-authored-by: Samuel Evans-Powell <mail@sevanspowell.net>
@iohk-bors
Copy link
Contributor

iohk-bors bot commented May 18, 2021

Build failed:

Failures:

  src/Test/Integration/Scenario/API/Shelley/StakePools.hs:344:26:
  1) API Specifications, SHELLEY_STAKE_POOLS, STAKE_POOLS_JOIN_01rewards - Can join a pool, earn rewards and collect them
       While verifying (Status {statusCode = 200, statusMessage = "OK"},Right (ApiWallet {id = ApiT {getApiT = WalletId {getWalletId = c0f4bdd476f87635b22654b34550548ea07f3af0}}, addressPoolGap = ApiT {getApiT = AddressPoolGap {getAddressPoolGap = 20}}, balance = ApiWalletBalance {available = Quantity {getQuantity = 999996972165}, total = Quantity {getQuantity = 999999148680}, reward = Quantity {getQuantity = 2176515}}, assets = ApiWalletAssetsBalance {available = ApiT {getApiT = TokenMap (fromList [])}, total = ApiT {getApiT = TokenMap (fromList [])}}, delegation = ApiWalletDelegation {active = ApiWalletDelegationNext {status = Delegating, target = Just (ApiT {getApiT = PoolId {getPoolId = "\187\DC1L\179}u\250\ENQ&\ETX(\194\&5\163\218\226\149\163=\v\166t\165\235\RS>V\142"}}), changesAt = Nothing}, next = []}, name = ApiT {getApiT = WalletName {getWalletName = "Faucet Wallet"}}, passphrase = Just (ApiWalletPassphraseInfo {lastUpdatedAt = 2021-05-18 03:28:49.380140488 UTC}), state = ApiT {getApiT = Ready}, tip = ApiBlockReference {absoluteSlotNumber = ApiT {getApiT = SlotNo 8701}, slotId = ApiSlotId {epochNumber = ApiT {getApiT = EpochNo {unEpochNo = 174}}, slotNumber = ApiT {getApiT = SlotInEpoch {unSlotInEpoch = 1}}}, time = 2021-05-18 03:31:03.2 UTC, block = ApiBlockInfo {height = Quantity {getQuantity = 4412}}}}))
       Waited longer than 90s to resolve action: "Wallet has consumed rewards".
       expected: Quantity {getQuantity = 0}
        but got: Quantity {getQuantity = 2176515}

  To rerun use: --match "/API Specifications/SHELLEY_STAKE_POOLS/STAKE_POOLS_JOIN_01rewards - Can join a pool, earn rewards and collect them/"

#2415

@rvl
Copy link
Contributor

rvl commented May 18, 2021

Flakiness, sorry.

bors r+

@iohk-bors
Copy link
Contributor

iohk-bors bot commented May 18, 2021

Build succeeded:

@iohk-bors iohk-bors bot merged commit cf4485a into master May 18, 2021
@iohk-bors iohk-bors bot deleted the feature/ADP-916-add-decimals-minimal branch May 18, 2021 05:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants