Skip to content

Commit

Permalink
Merge #3063
Browse files Browse the repository at this point in the history
3063: Bump cardano-addresses to 3.7.0 r=piotr-iohk a=rvl

Updates cardano-addresses to [3.7.0](), which adds an `address_type` field to the inspectAddress output.

### Issue Number

[DDW-742](https://input-output.atlassian.net/browse/DDW-742)


Co-authored-by: Rodney Lorrimar <[email protected]>
Co-authored-by: IOHK <[email protected]>
Co-authored-by: Piotr Stachyra <[email protected]>
  • Loading branch information
4 people authored Dec 15, 2021
2 parents 7695502 + 5cc82ca commit 760140e
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 17 deletions.
2 changes: 1 addition & 1 deletion cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-addresses
tag: 4003fc09780da61bc09d85337bdd4c7664aa49ba
tag: 71006f9eb956b0004022e80aadd4ad50d837b621
subdir: command-line
core

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,25 +350,57 @@ spec = describe "SHELLEY_ADDRESSES" $ do
listAddresses @n ctx wB
>>= verifyAddrs (initialTotalB + 1) (initialUsedB + 1)

it "ADDRESS_INSPECT_01 - Address inspect OK" $ \ctx -> do
it "ADDRESS_INSPECT_01 - Address inspect OK Icarus" $ \ctx -> do
let str = "Ae2tdPwUPEYz6ExfbWubiXPB6daUuhJxikMEb4eXRp5oKZBKZwrbJ2k7EZe"
r <- request @Aeson.Value ctx (Link.inspectAddress str) Default Empty
expectResponseCode HTTP.status200 r
verify r
[ expectResponseCode HTTP.status200
, expectField (Aeson.key "address_style" . Aeson._String)
(`shouldBe` "Icarus")
, expectField (Aeson.key "address_type" . Aeson._Number)
(`shouldBe` 8)
]

it "ADDRESS_INSPECT_02 - Address inspect OK Byron" $ \ctx -> do
let str = "37btjrVyb4KE2ByiPiJUQfAUBGaMyKScg4mnYjzVAsN2PUxj1WxTg98ien3oAo8vKBhP2KTuC9wi76vZ9kDNFkjbmzywdLTJgaz8n3RD3Rueim3Pd3"
r <- request @Aeson.Value ctx (Link.inspectAddress str) Default Empty
verify r
[ expectResponseCode HTTP.status200
, expectField (Aeson.key "address_style" . Aeson._String)
(`shouldBe` "Byron")
, expectField (Aeson.key "address_type" . Aeson._Number)
(`shouldBe` 8)
]

it "ADDRESS_INSPECT_03 - Address inspect OK reward" $ \ctx -> do
let str = "stake1u8pn5jr7cfa0x8ndtdufyg5lty3avg3zd2tq35c06hpsh8gptdza4"
r <- request @Aeson.Value ctx (Link.inspectAddress str) Default Empty
verify r
[ expectResponseCode HTTP.status200
, expectField (Aeson.key "address_style" . Aeson._String)
(`shouldBe` "Shelley")
, expectField (Aeson.key "address_type" . Aeson._Number)
(`shouldBe` 14)
]

it "ADDRESS_INSPECT_02 - Address inspect KO" $ \ctx -> runResourceT $ do
it "ADDRESS_INSPECT_04 - Address inspect KO" $ \ctx -> runResourceT $ do
let str = "patate"
r <- request @Aeson.Value ctx (Link.inspectAddress str) Default Empty
expectResponseCode HTTP.status400 r

it "ADDRESS_INSPECT_03 - Address inspect bech32" $ \ctx -> do
it "ADDRESS_INSPECT_05 - Address inspect OK bech32" $ \ctx -> do
let str = "addr_test1qzamu40sglnsrylzv9jylekjmzgaqsg5v5z9u6yk3jpnnxjwck77fqu8deuumsvnazjnjhwasc2eetfqpa2pvygts78ssd5388"
r <- request @Aeson.Value ctx (Link.inspectAddress str) Default Empty
verify r
[ expectResponseCode HTTP.status200
, expectField (Aeson.key "address_style" . Aeson._String)
(`shouldBe` "Shelley")
, expectField (Aeson.key "spending_key_hash_bech32" . Aeson._String)
(`shouldBe` "addr_vkh1hwl9tuz8uuqe8cnpv387d5kcj8gyz9r9q30x395vsvue5e44fh7")
, expectField (Aeson.key "stake_key_hash_bech32" . Aeson._String)
(`shouldBe` "stake_vkh1fmzmmeyrsah8nnwpj0522w2amkrpt89dyq84g9s3pwrc7dqjnfu")
, expectField (Aeson.key "address_type" . Aeson._Number)
(`shouldBe` 0)
]

-- Generating golden test data for enterprise addresses - script credential:
Expand Down
10 changes: 5 additions & 5 deletions nix/.stack.nix/cardano-addresses-cli.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions nix/.stack.nix/cardano-addresses.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions specifications/api/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2085,6 +2085,28 @@ components:
description: Only for 'Byron' style.
type: string
format: base16
address_type:
description: |
The raw type field of the address.
Details about possible address types are following (refer also to [cddl](https://github.com/input-output-hk/cardano-ledger/blob/master/eras/alonzo/test-suite/cddl-files/alonzo.cddl)).
| address_type | binary prefix | Meaning |
| ------------ |:--------------:|:--------------------------------------------------------:|
| 0 | 0000 | base address: keyhash28,keyhash28 |
| 1 | 0001 | base address: scripthash28,keyhash28 |
| 2 | 0010 | base address: keyhash28,scripthash28 |
| 3 | 0011 | base address: scripthash28,scripthash28 |
| 4 | 0100 | pointer address: keyhash28, 3 variable length uint |
| 5 | 0101 | pointer address: scripthash28, 3 variable length uint |
| 6 | 0110 | enterprise address: keyhash28 |
| 7 | 0111 | enterprise address: scripthash28 |
| 8 | 1000 | byron/icarus |
| 14 | 1110 | reward account: keyhash28 |
| 15 | 1111 | reward account: scripthash28 |
type: integer
minimum: 0
maximum: 15

ApiNetworkTip: &ApiNetworkTip
<<: *slotReference
Expand Down
4 changes: 2 additions & 2 deletions stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ extra-deps:
- hspec-core-2.8.2
- hspec-discover-2.8.2

# cardano-addresses-3.6.0
# cardano-addresses-3.7.0
- git: https://github.com/input-output-hk/cardano-addresses
commit: 4003fc09780da61bc09d85337bdd4c7664aa49ba
commit: 71006f9eb956b0004022e80aadd4ad50d837b621
subdirs:
- command-line
- core
Expand Down

0 comments on commit 760140e

Please sign in to comment.