File tree Expand file tree Collapse file tree 3 files changed +30
-0
lines changed
src-wasm/Cardano/Wasm/Internal/JavaScript Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,13 @@ declare interface UnsignedTx {
2727 */
2828 addSimpleTxOut ( destAddr : string , lovelaceAmount : bigint ) : UnsignedTx ;
2929
30+ /**
31+ * Appends a certificate (in CBOR hex string format) to the transaction.
32+ * @param certCbor The certificate in CBOR hex string format.
33+ * @returns The `UnsignedTx` object with the added certificate.
34+ */
35+ appendCertificateToTx ( certCbor : string ) : UnsignedTx ;
36+
3037 /**
3138 * Sets the fee for the transaction.
3239 * @param lovelaceAmount The fee amount in lovelaces.
Original file line number Diff line number Diff line change @@ -302,6 +302,16 @@ apiInfo =
302302 , methodReturnType = Fluent
303303 , methodReturnDoc = " The `UnsignedTx` object with the added output."
304304 }
305+ , MethodInfoEntry $
306+ MethodInfo
307+ { methodName = " appendCertificateToTx"
308+ , methodDoc = " Appends a certificate (in CBOR hex string format) to the transaction."
309+ , methodParams =
310+ [ ParamInfo " certCbor" TSString " The certificate in CBOR hex string format."
311+ ]
312+ , methodReturnType = Fluent
313+ , methodReturnDoc = " The `UnsignedTx` object with the added certificate."
314+ }
305315 , MethodInfoEntry $
306316 MethodInfo
307317 { methodName = " setFee"
Original file line number Diff line number Diff line change @@ -353,6 +353,9 @@ foreign export javascript "addTxInput"
353353foreign export javascript " addSimpleTxOut"
354354 addSimpleTxOut :: JSUnsignedTx -> JSString -> JSCoin -> IO JSUnsignedTx
355355
356+ foreign export javascript " appendCertificateToTx"
357+ appendCertificateToTx :: JSUnsignedTx -> JSString -> IO JSUnsignedTx
358+
356359foreign export javascript " setFee"
357360 setFee :: JSUnsignedTx -> JSCoin -> IO JSUnsignedTx
358361
@@ -394,6 +397,16 @@ addSimpleTxOut jsUnsignedTx jsDestAddr jsCoin =
394397 <*> fromJSVal jsCoin
395398 )
396399
400+ -- | Append a certificate (in CBOR hex string format) to an unsigned transaction.
401+ appendCertificateToTx :: HasCallStack => JSUnsignedTx -> JSString -> IO JSUnsignedTx
402+ appendCertificateToTx jsUnsignedTx jsCertCbor =
403+ toJSVal
404+ =<< join
405+ ( Wasm. appendCertificateToTxImpl
406+ <$> fromJSVal jsUnsignedTx
407+ <*> fromJSVal jsCertCbor
408+ )
409+
397410-- | Set the transaction fee for an unsigned transaction.
398411setFee :: HasCallStack => JSUnsignedTx -> JSCoin -> IO JSUnsignedTx
399412setFee jsUnsignedTx jsCoin =
You can’t perform that action at this time.
0 commit comments