@@ -50,10 +50,153 @@ cardano-cli query utxo \
50
50
```
51
51
52
52
::: info
53
- You can also specify ` amount ` of lovelace you want to commit together with the ` UTxO ` and hydra-node would
54
- commit only the specified amount and return any leftover to the user address.
53
+ You can also specify ` amount ` of lovelace you want to commit as well as ` assets ` together with the ` UTxO ` and hydra-node would
54
+ commit only the specified amount of lovelace or any potential non ADA assets and return any leftover to the user address.
55
55
:::
56
56
57
+ ::: danger
58
+ This functionality should be treated as ** experimental** for the time being until we see some user reports that this API is
59
+ working well and is easy to use.
60
+ :::
61
+
62
+ <details >
63
+ <summary >Partial commit example: </summary >
64
+
65
+ If there exists a user UTxO that looks like this
66
+
67
+ ``` json
68
+ {"0bdf069df8fa1084989a7bda419c900810fd5d5a72a95f7ab487f96df9052fb8#0" :
69
+ { "address" :" addr_test1vq7j5vf74jw779y6ssxk2rwart5mltr2r7ju4gtfc3kcawcy0v2v8" ,
70
+ "datum" :null ,
71
+ "datumhash" :null ,
72
+ "inlineDatum" :null ,
73
+ "inlineDatumRaw" :null ,
74
+ "referenceScript" :null ,
75
+ "value" :
76
+ { "dcf5fdd1d01c04b0e6262bba173a89c4b81b6570211f08bc059c8a75" :
77
+ { "34" :2007797983096461947 ,
78
+ "7041ef64f4476c6f6d8a3c74b7" :4866145859671050979 ,
79
+ "b7a7b64d585f973e82be6ca36ae948" :2 ,
80
+ "beb7e61cb67dd301" :2
81
+ },
82
+ "lovelace" :5000000
83
+ }
84
+ }
85
+ }
86
+
87
+ ```
88
+ Then the user can decide to commit some amount of lovelace and assets while the _ change_ would be given back to the origin address.
89
+ In order to do that they can send a http POST request to the ` /commit ` endpoint
90
+ specifying the _ amount_ of ADA and map of _ tokens_ with quantities to commit:
91
+
92
+ ``` json
93
+
94
+ {
95
+ "amount" :3000000 ,
96
+ "tokens" :
97
+ [
98
+ [ " dcf5fdd1d01c04b0e6262bba173a89c4b81b6570211f08bc059c8a75" ,
99
+ { "34" :2007797983096461947 ,
100
+ "7041ef64f4476c6f6d8a3c74b7" :4866145859671050979
101
+ }
102
+ ]
103
+ ],
104
+ "utxoToCommit" :
105
+ { "0bdf069df8fa1084989a7bda419c900810fd5d5a72a95f7ab487f96df9052fb8#0" :
106
+ { "address" :" addr_test1vq7j5vf74jw779y6ssxk2rwart5mltr2r7ju4gtfc3kcawcy0v2v8" ,
107
+ "datum" :null ,
108
+ "datumhash" :null ,
109
+ "inlineDatum" :null ,
110
+ "inlineDatumRaw" :null ,
111
+ "referenceScript" :null ,
112
+ "value" :
113
+ { "dcf5fdd1d01c04b0e6262bba173a89c4b81b6570211f08bc059c8a75" :
114
+ { "34" :2007797983096461947 ,
115
+ "7041ef64f4476c6f6d8a3c74b7" :4866145859671050979 ,
116
+ "b7a7b64d585f973e82be6ca36ae948" :2 ,
117
+ "beb7e61cb67dd301" :2
118
+ },
119
+ "lovelace" :5000000
120
+ }
121
+ }
122
+ }
123
+ }
124
+
125
+ ```
126
+ Hydra node returns a deposit transaction which then needs to be signed and submitted to the network:
127
+
128
+ ```
129
+
130
+ "d22e92621c1b66d947eff97887feb19c1fb5751ecb7440cd6749ac8d734af04f"
131
+
132
+ == INPUTS (2)
133
+ - 0bdf069df8fa1084989a7bda419c900810fd5d5a72a95f7ab487f96df9052fb8#0
134
+ ShelleyAddress Testnet (KeyHashObj (KeyHash {unKeyHash = "3d2a313eac9def149a840d650ddd1ae9bfac6a1fa5caa169c46d8ebb"})) StakeRefNull
135
+ 5000000 lovelace
136
+ 2007797983096461947 dcf5fdd1d01c04b0e6262bba173a89c4b81b6570211f08bc059c8a75.34
137
+ 4866145859671050979 dcf5fdd1d01c04b0e6262bba173a89c4b81b6570211f08bc059c8a75.7041ef64f4476c6f6d8a3c74b7
138
+ 2 dcf5fdd1d01c04b0e6262bba173a89c4b81b6570211f08bc059c8a75.b7a7b64d585f973e82be6ca36ae948
139
+ 2 dcf5fdd1d01c04b0e6262bba173a89c4b81b6570211f08bc059c8a75.beb7e61cb67dd301
140
+ TxOutDatumNone
141
+ ReferenceScriptNone
142
+ - 799028d0132ec355d6870704e040b73dbab67dba40313cb4f5dbc42d0e66bd40#1
143
+
144
+ == COLLATERAL INPUTS (1)
145
+ - 799028d0132ec355d6870704e040b73dbab67dba40313cb4f5dbc42d0e66bd40#1
146
+
147
+ == REFERENCE INPUTS (0)
148
+
149
+ == OUTPUTS (3)
150
+ Total number of assets: 5
151
+ - ShelleyAddress Testnet (ScriptHashObj (ScriptHash "ae01dade3a9c346d5c93ae3ce339412b90a0b8f83f94ec6baa24e30c")) StakeRefNull
152
+ 3000000 lovelace
153
+ 2007797983096461947 dcf5fdd1d01c04b0e6262bba173a89c4b81b6570211f08bc059c8a75.34
154
+ 4866145859671050979 dcf5fdd1d01c04b0e6262bba173a89c4b81b6570211f08bc059c8a75.7041ef64f4476c6f6d8a3c74b7
155
+ TxOutDatumInline [0,["0x3fbb97e02ed6f34def7b87d9aaff67b4fe707f338d72bc2a7f93a409",1757516160812,[[0,[[0,["0x0bdf069df8fa1084989a7bda419c900810fd5d5a72a95f7ab487f96df9052fb8",0]],"0xd8799fd8799fd8799f581c3d2a313eac9def149a840d650ddd1ae9bfac6a1fa5caa169c46d8ebbffd87a80ffa240a1401a002dc6c0581cdcf5fdd1d01c04b0e6262bba173a89c4b81b6570211f08bc059c8a75a241341b1bdd21a0bb35da7b4d7041ef64f4476c6f6d8a3c74b71b438805e09eee4ae3d87980d87a80ff"]]]]]
156
+ - ShelleyAddress Testnet (KeyHashObj (KeyHash {unKeyHash = "3d2a313eac9def149a840d650ddd1ae9bfac6a1fa5caa169c46d8ebb"})) StakeRefNull
157
+ 2000000 lovelace
158
+ 2 dcf5fdd1d01c04b0e6262bba173a89c4b81b6570211f08bc059c8a75.b7a7b64d585f973e82be6ca36ae948
159
+ 2 dcf5fdd1d01c04b0e6262bba173a89c4b81b6570211f08bc059c8a75.beb7e61cb67dd301
160
+ TxOutDatumNone
161
+ - ShelleyAddress Testnet (KeyHashObj (KeyHash {unKeyHash = "f8a68cd18e59a6ace848155a0e967af64f4d00cf8acee8adc95a6b0d"})) StakeRefNull
162
+ 19625359 lovelace
163
+ TxOutDatumNone
164
+
165
+ == TOTAL COLLATERAL
166
+ TxTotalCollateralNone
167
+
168
+ == RETURN COLLATERAL
169
+ TxReturnCollateralNone
170
+
171
+ == FEE
172
+ TxFeeExplicit ShelleyBasedEraConway (Coin 197973)
173
+
174
+ == VALIDITY
175
+ TxValidityNoLowerBound
176
+ TxValidityUpperBound ShelleyBasedEraConway (Just (SlotNo 38))
177
+
178
+ == MINT/BURN
179
+ 0 lovelace
180
+
181
+ == SCRIPTS (0)
182
+ Total size (bytes): 0
183
+
184
+ == DATUMS (0)
185
+
186
+ == REDEEMERS (0)
187
+
188
+ == REQUIRED SIGNERS
189
+ []
190
+
191
+ == METADATA
192
+ TxMetadataInEra ShelleyBasedEraConway (TxMetadata {unTxMetadata = fromList [(55555,TxMetaText "HydraV1/DepositTx")]})
193
+ ```
194
+
195
+ If you take a look at the outputs you will see that we only locked specified ADA amount + tokens at the deposit address and gave back any leftover to the
196
+ user address.
197
+
198
+ </details >
199
+
57
200
Then a request to the ` /commit ` endpoint provides us with a transaction:
58
201
59
202
``` shell
0 commit comments