Skip to content

Commit fd90892

Browse files
committed
cardano-cli: Add tests on transaction view --json
1 parent 427bef3 commit fd90892

File tree

4 files changed

+254
-0
lines changed

4 files changed

+254
-0
lines changed

cardano-cli/test/Test/Golden/TxView.hs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,12 @@ golden_view_shelley = let
134134
["transaction", "view", "--tx-body-file", transactionBodyFile]
135135
diffVsGoldenFile result "test/data/golden/shelley/transaction-view.out"
136136

137+
-- JSON version
138+
resultJson <-
139+
execCardanoCLI
140+
["transaction", "view", "--json", "--tx-body-file", transactionBodyFile]
141+
diffVsGoldenFile resultJson "test/data/golden/shelley/transaction-view.json"
142+
137143
golden_view_allegra :: Property
138144
golden_view_allegra =
139145
propertyOnce $
@@ -229,6 +235,12 @@ golden_view_mary =
229235
["transaction", "view", "--tx-body-file", transactionBodyFile]
230236
diffVsGoldenFile result "test/data/golden/mary/transaction-view.out"
231237

238+
-- JSON version
239+
resultJson <-
240+
execCardanoCLI
241+
["transaction", "view", "--json", "--tx-body-file", transactionBodyFile]
242+
diffVsGoldenFile resultJson "test/data/golden/mary/transaction-view.json"
243+
232244
createAlonzoTxBody :: Maybe FilePath -> FilePath -> Integration ()
233245
createAlonzoTxBody mUpdateProposalFile transactionBodyFile = do
234246
void $
@@ -315,3 +327,9 @@ golden_view_alonzo_signed =
315327
execCardanoCLI
316328
["transaction", "view", "--tx-file", transactionFile]
317329
diffVsGoldenFile result (testData </> "signed-transaction-view.out")
330+
331+
-- JSON version
332+
resultJson <-
333+
execCardanoCLI
334+
["transaction", "view", "--json", "--tx-file", transactionFile]
335+
diffVsGoldenFile resultJson (testData </> "signed-transaction-view.json")
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"body": {
3+
"auxScripts": null,
4+
"certificates": null,
5+
"extraKeyWits": [
6+
"98717eaba8105a50a2a71831267552e337dfdc893bef5e40b8676d27",
7+
"fafaaac8681b5050a8987f95bce4a7f99362f189879258fdbf733fa4"
8+
],
9+
"fee": 213,
10+
"ins": [
11+
"ed7c8f68c194cc763ee65ad22ef0973e26481be058c65005fd39fb93f9c43a20#212"
12+
],
13+
"insCollateral": [
14+
"c9765d7d0e3955be8920e6d7a38e1f3f2032eac48c7c59b0b9193caa87727e7e#256"
15+
],
16+
"insReference": null,
17+
"metadata": null,
18+
"mintValue": null,
19+
"outs": [],
20+
"returnCollateral": null,
21+
"scriptValidity": "Valid",
22+
"totalCollateral": null,
23+
"updateProposal": null,
24+
"validityRange": {
25+
"lowerBound": null,
26+
"upperBound": null
27+
},
28+
"withdrawals": null
29+
},
30+
"era": "Alonzo",
31+
"witnesses": [
32+
{
33+
"key:TODO": "VKey (VerKeyEd25519DSIGN \"84ce03e08b05533685d593c14cd6ca5c7485824156ca11fb303ddac9dd3ef41c\")",
34+
"signature:TODO": "SignedDSIGN (SigEd25519DSIGN \"f6aae8023de4858244c6aac4b1ca7428f669a142731fe7354021059887b5366f24abba49355e14d435dbc7726df66dfeafe269e2752a7a6f752529600d1e9a00\")",
35+
"type": "key"
36+
}
37+
]
38+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
{
2+
"body": {
3+
"auxScripts": null,
4+
"certificates": null,
5+
"extraKeyWits": null,
6+
"fee": 139,
7+
"ins": [
8+
"fe5dd07fb576bff960d6e066eade5b26cdb5afebe29f76ea58d0a098bce5d891#135"
9+
],
10+
"insCollateral": null,
11+
"insReference": null,
12+
"metadata": null,
13+
"mintValue": {
14+
"a06ee5ffdd7f9b5bd992eb9543f44418323f81229526b77b0e4be067": {
15+
"736b79": 142,
16+
"cafe": 132,
17+
"dead": 136
18+
},
19+
"d441227553a0f1a965fee7d60a0f724b368dd1bddbc208730fccebcf": {
20+
"": 130,
21+
"736e6f77": 138,
22+
"f00d": 134
23+
}
24+
},
25+
"outs": [
26+
{
27+
"address": "addr_test1qrefnr4k09pvge6dq83v6s67ruter8sftmky8qrmkqqsxy7q5psgn8tgqmupq4r79jmxlyk4eqt6z6hj5g8jd8393msqaw47f4",
28+
"value": {
29+
"a06ee5ffdd7f9b5bd992eb9543f44418323f81229526b77b0e4be067": {
30+
"736b79": 142,
31+
"cafe": 132,
32+
"dead": 136
33+
},
34+
"d441227553a0f1a965fee7d60a0f724b368dd1bddbc208730fccebcf": {
35+
"": 130,
36+
"736e6f77": 138,
37+
"f00d": 134
38+
},
39+
"lovelace": 138
40+
}
41+
}
42+
],
43+
"returnCollateral": null,
44+
"scriptValidity": null,
45+
"totalCollateral": null,
46+
"updateProposal": null,
47+
"validityRange": {
48+
"lowerBound": {
49+
"slot": 140
50+
},
51+
"upperBound": null
52+
},
53+
"withdrawals": null
54+
},
55+
"era": "Mary"
56+
}
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
{
2+
"body": {
3+
"auxScripts": null,
4+
"certificates": [
5+
{
6+
"genesisDelegateKeyHash": "d52ac434259f2af7fd2a538ece5ef8d80386527aa93e207473acb31c",
7+
"genesisKeyHash": "c3db461200fa59c81a4ecc8495446d9e42de27483ff6ee4339c9ab94",
8+
"type": "GenesisKeyDelegation",
9+
"vrfKeyHash": "1b9de69baec0dff8dde6e81d71f40f8b65fb3df55bb6ece5783aade88b17354d"
10+
},
11+
{
12+
"pot": "reserves",
13+
"target": {
14+
"addresses": [
15+
[
16+
{
17+
"stakingKeyHash": "ee475cade27e95faf1093541b0783498016cdcfba0d6441055b2dfcb"
18+
},
19+
1000
20+
]
21+
],
22+
"type": "StakeAddresses"
23+
},
24+
"type": "MIR"
25+
},
26+
{
27+
"credential": {
28+
"stakingKeyHash": "d0efd9836e62225a47baf9bedfeaccbb86ba3f49d9edc4ac0aa26df5"
29+
},
30+
"type": "StakeAddressDeregistration"
31+
},
32+
{
33+
"credential": {
34+
"stakingKeyHash": "c6ea7e348d300b32798888497290db24a99a36f2238ed9668f602d7a"
35+
},
36+
"type": "StakeAddressRegistration"
37+
},
38+
{
39+
"epoch": 42,
40+
"pool": "pool13lllruv6rd63l70vkpgye2ea856f22k8xhujmf2vvlul5ytw7mx",
41+
"type": "StakePoolRetirement"
42+
},
43+
{
44+
"parameters": {
45+
"cost": 1000,
46+
"id": "pool1cxxj569g3x9akwv49vv6u5z8d3l7xrwzh7p2tf2g2ajkce894m3",
47+
"margin": {
48+
"denominator": 10,
49+
"numerator": 1
50+
},
51+
"metadata": null,
52+
"owners": [
53+
"f25fc5c9f341ec3bd785ddea746f76b6a9ac7f38fdd7aef1779bbe81"
54+
],
55+
"pledge": 5000,
56+
"relays": [],
57+
"rewardAccount": "stake1u8e9l3wf7dq7cw7hshw75ar0w6m2ntrl8r7a0th3w7dmaqgne5h5d",
58+
"vrf": "8d445260282cef45e4c6a862b8a924aeed1b316ccba779dd39f9517220e96407"
59+
},
60+
"type": "StakePoolRegistration"
61+
}
62+
],
63+
"extraKeyWits": null,
64+
"fee": 32,
65+
"ins": [
66+
"fe5dd07fb576bff960d6e066eade5b26cdb5afebe29f76ea58d0a098bce5d891#29"
67+
],
68+
"insCollateral": null,
69+
"insReference": null,
70+
"metadata": null,
71+
"mintValue": null,
72+
"outs": [
73+
{
74+
"address": "addr_test1vz7w0r9epak6nmnh3mc8e2ypkjyu8zsc3xf7dpct6k577acxmcfyv",
75+
"value": 31
76+
}
77+
],
78+
"returnCollateral": null,
79+
"scriptValidity": null,
80+
"totalCollateral": null,
81+
"updateProposal": {
82+
"epoch": 64,
83+
"updates": {
84+
"1bafa294233a5a7ffbf539ae798da0943aa83d2a19398c2d0e5af114": {
85+
"collateralPercent": null,
86+
"costModels": {},
87+
"decentralization": {
88+
"denominator": 64,
89+
"numerator": 63
90+
},
91+
"extraPraosEntropy": "88f04f011dcded879039ae4b9b20219d9448e5c7b42c2d1f638fb8740e0ab8be",
92+
"maxBlockBodySize": 72,
93+
"maxBlockExUnits": null,
94+
"maxBlockHeaderSize": 73,
95+
"maxCollateralInputs": null,
96+
"maxTxExUnits": null,
97+
"maxTxSize": 74,
98+
"maxValueSize": null,
99+
"minPoolCost": 77,
100+
"minUTxOValue": 78,
101+
"monetaryExpansion": {
102+
"denominator": 80,
103+
"numerator": 79
104+
},
105+
"poolPledgeInfluence": {
106+
"denominator": 83,
107+
"numerator": 82
108+
},
109+
"poolRetireMaxEpoch": 84,
110+
"prices": null,
111+
"protocolVersion": [
112+
85,
113+
86
114+
],
115+
"stakeAddressDeposit": 71,
116+
"stakePoolDeposit": 83,
117+
"stakePoolTargetNum": 80,
118+
"treasuryCut": {
119+
"denominator": 88,
120+
"numerator": 87
121+
},
122+
"txFeeFixed": 75,
123+
"txFeePerByte": 76,
124+
"utxoCostPerWord": null
125+
}
126+
}
127+
},
128+
"validityRange": {
129+
"lowerBound": null,
130+
"upperBound": {
131+
"slot": 33
132+
}
133+
},
134+
"withdrawals": [
135+
{
136+
"lovelace": 42,
137+
"stakeAddress": "stake_test1up00fz9lyqs5sjks82k22eqz7a9srym9vysjgp3h2ua2v2cm522kg"
138+
}
139+
]
140+
},
141+
"era": "Shelley"
142+
}

0 commit comments

Comments
 (0)