Skip to content

Commit 4be5f41

Browse files
committed
Update docs for decommit
1 parent f94fd0f commit 4be5f41

File tree

4 files changed

+42
-32
lines changed

4 files changed

+42
-32
lines changed

docs/docs/hydra-js-client/decommit.md

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,17 @@
55
## Function Signature
66

77
```typescript
8-
async decommit(utxos: Commit, wait: boolean = false, submit: boolean = false): Promise<any>
8+
async decommit(tx: HexString, wait: boolean = false): Promise<DecommitResult>
99
```
1010

1111
## Parameters
1212

13-
- `utxos`: A `Commit` object specifying the UTxOs to be decommitted.
13+
- `tx`: A `HexString` representing the CBOR-encoded transaction to be decommitted.
1414
- `wait`: An optional `boolean` indicating whether to wait for the decommit to complete. Defaults to `false`.
15-
- `submit`: An optional `boolean` indicating whether to submit the transaction to the chain. Defaults to `false`.
1615

1716
## Returns
1817

19-
A `Promise` that resolves to an object containing information about the decommit process.
18+
A `Promise` that resolves to a `DecommitResult` object containing information about the decommit process.
2019

2120
## Example
2221

@@ -29,21 +28,19 @@ async function main() {
2928

3029
const hydra = new KuberHydraApiProvider("http://localhost:8081"); // Replace with your Hydra API URL
3130

32-
const utxosToDecommit = {
33-
utxos: [
34-
{
35-
txIn: "yourTxHash#0", // Replace with a valid UTxO from the head
36-
value: {
37-
lovelace: "500000", // 0.5 ADA
38-
},
39-
},
40-
],
41-
};
31+
// First, create the decommit transaction
32+
const utxoToDecommit = "yourTxHash#0"; // Replace with a valid UTxO from the head
33+
const decommitTx = await hydra.createDecommitTx(utxoToDecommit);
34+
35+
// Then, sign the transaction (assuming you have a wallet setup)
36+
// const signedTx = await wallet.signTx(decommitTx.cborHex); // Replace 'wallet' with your actual wallet instance
37+
const signedTxCbor = decommitTx.cborHex; // For demonstration, using unsigned CBOR
4238

4339
try {
4440
console.log("Decommitting UTxOs...");
45-
const result = await hydra.decommit(utxosToDecommit, true, true); // Wait and submit
41+
const result = await hydra.decommit(signedTxCbor, true); // Pass the signed transaction CBOR and wait
4642
console.log("Decommit result:", result);
43+
console.log("Decommit transaction hash:", result.decommitTx.txHash);
4744
} catch (error) {
4845
console.error("Error decommitting UTxOs:", error);
4946
}

docs/docs/kuber-hydra-api-reference.md

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -58,25 +58,38 @@ This section provides detailed documentation for the Kuber-Hydra backend API end
5858
]}
5959
/>
6060

61+
<ApiEndpoint
62+
method="GET"
63+
path="/hydra/decommit"
64+
title="Build Decommit Transaction"
65+
description="Builds a decommit transaction."
66+
queryParams={[
67+
{ name: "txin", type: "Array of T.Text", description: "List of transaction inputs to decommit." },
68+
]}
69+
responses={[
70+
{ code: "200 OK", description: "Returns TxModal (transaction details)." },
71+
]}
72+
/>
73+
6174
<ApiEndpoint
6275
method="POST"
6376
path="/hydra/decommit"
64-
title="Decommit UTxOs from Hydra Head"
65-
description="Decommits UTxOs from the Hydra Head."
77+
title="Submit Decommit Transaction"
78+
description="Submits a decommit transaction."
6679
queryParams={[
67-
{ name: "submit", type: "Boolean", description: "If true, the transaction will be submitted to the chain.", optional: true },
6880
{ name: "wait", type: "Boolean", description: "If true, the request will wait for the transaction to be confirmed.", optional: true },
6981
]}
7082
requestBody={{
71-
type: "CommitUTxOs",
72-
description: "Payload containing UTxOs to decommit and an optional signing key.",
83+
type: "TxModal",
84+
description: "Signed transaction details.",
7385
fields: [
74-
{ name: "utxos", type: "Array of TxIn (string)", description: "List of transaction inputs to decommit." },
75-
{ name: "signKey", type: "A.Value", description: "The signing key for the transaction.", optional: true },
86+
{ name: "cborHex", type: "string", description: "The CBOR-encoded transaction in hexadecimal format." },
87+
{ name: "type", type: "string", description: "The type of transaction (e.g., 'Witnessed Tx ConwayEra')." },
88+
{ name: "description", type: "string", description: "An optional description for the transaction." },
7689
],
7790
}}
7891
responses={[
79-
{ code: "200 OK", description: "Success message." },
92+
{ code: "200 OK", description: "Returns DecommitResult (decommit transaction details)." },
8093
]}
8194
/>
8295

@@ -154,9 +167,9 @@ This section provides detailed documentation for the Kuber-Hydra backend API end
154167
type: "TxModal",
155168
description: "Signed transaction details.",
156169
fields: [
157-
{ name: "signedTx", type: "string", description: "The signed transaction." },
158-
{ name: "witnesses", type: "Array", description: "Transaction witnesses." },
159-
// Add more TxModal fields as needed based on its actual structure
170+
{ name: "cborHex", type: "string", description: "The CBOR-encoded transaction in hexadecimal format." },
171+
{ name: "type", type: "string", description: "The type of transaction (e.g., 'Witnessed Tx ConwayEra')." },
172+
{ name: "description", type: "string", description: "An optional description for the transaction." },
160173
],
161174
}}
162175
responses={[
@@ -206,7 +219,7 @@ This section provides detailed documentation for the Kuber-Hydra backend API end
206219
title="Retrieve Hydra State"
207220
description="Retrieves the current state of the Hydra."
208221
responses={[
209-
{ code: "200 OK", description: "Returns the Hydra state." },
222+
{ code: "200 OK", description: "Returns an object containing the current HydraHeadState (e.g., { state: 'Open' })." },
210223
]}
211224
/>
212225

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"@docusaurus/theme-mermaid": "^3.8.0",
2222
"@mdx-js/react": "^3.0.0",
2323
"clsx": "^2.0.0",
24-
"kuber-client": "3.3.2",
24+
"kuber-client": "3.3.4",
2525
"libcardano": "2.2.8",
2626
"libcardano-wallet": "2.2.14",
2727
"prism-react-renderer": "^2.3.0",

docs/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7839,10 +7839,10 @@ kolorist@^1.8.0:
78397839
resolved "https://registry.npmjs.org/kolorist/-/kolorist-1.8.0.tgz"
78407840
integrity sha512-Y+60/zizpJ3HRH8DCss+q95yr6145JXZo46OTpFvDZWLfRCE4qChOyk1b26nMaNpfHHgxagk9dXT5OP0Tfe+dQ==
78417841

7842-
kuber-client@3.3.2:
7843-
version "3.3.2"
7844-
resolved "https://registry.yarnpkg.com/kuber-client/-/kuber-client-3.3.2.tgz#29c233074b915c8a5af4b60bc0219b8d269a4d16"
7845-
integrity sha512-I4QHnnRaK4gBnsCjDv5EJzU/svd8WLQLG8dTERBPPWBSU53F4ncYAA1P9Vl9yoDoOgVCdWjZEBShKsNv3yxuFg==
7842+
kuber-client@3.3.4:
7843+
version "3.3.4"
7844+
resolved "https://registry.yarnpkg.com/kuber-client/-/kuber-client-3.3.4.tgz#bdba16593def3e2f6c3cbe60ae8b18ba02c1cf93"
7845+
integrity sha512-NAOdZTVDN/gwnvkGCPvDiBU7UCPHqHM05HcbJuyFMqrB1yT2foPX8eD9Dr71p8onAeNxHGRKRb/pncRw4PJ1Kg==
78467846
dependencies:
78477847
axios "^1.9.0"
78487848
buffer "^6.0.3"

0 commit comments

Comments
 (0)