@@ -15,8 +15,9 @@ module Cardano.Wasm.Api.Info
1515where
1616
1717import Cardano.Api (pretty )
18+ import Cardano.Api.Experimental.Era qualified as Exp
1819
19- import Cardano.Wasm.Api.Tx ( UnsignedTxObject ( .. ), newExperimentalEraTxImpl , newTxImpl )
20+ import Cardano.Wasm.Internal. Api.Era ( currentEra , experimentalEra )
2021
2122import Data.Aeson qualified as Aeson
2223import Data.Text qualified as Text
@@ -196,10 +197,10 @@ instance Aeson.ToJSON ApiInfo where
196197 ]
197198
198199-- | Get a comment about the era for unsigned transaction creation methods.
199- getEraCommentForUnsignedTx :: Maybe UnsignedTxObject -> String
200- getEraCommentForUnsignedTx utxMonad =
201- case utxMonad of
202- Just ( UnsignedTxObject era _) -> " (currently " ++ show (pretty era) ++ " )"
200+ getEraCommentFor :: Maybe ( Exp. Era era ) -> String
201+ getEraCommentFor era =
202+ case era of
203+ Just era' -> " (currently " ++ show (pretty era' ) ++ " )"
203204 Nothing -> " (currently unavailable)"
204205
205206-- | Provides metadata about the "virtual objects" and their methods.
@@ -441,7 +442,7 @@ apiInfo =
441442 { methodName = " newTx"
442443 , methodDoc =
443444 " Create a new unsigned transaction in the current era "
444- ++ getEraCommentForUnsignedTx (Just newTxImpl )
445+ ++ getEraCommentFor (Just currentEra )
445446 ++ " ."
446447 , methodParams = []
447448 , methodReturnType = NewObject (virtualObjectName unsignedTxObj)
@@ -452,20 +453,12 @@ apiInfo =
452453 { methodName = " newExperimentalEraTx"
453454 , methodDoc =
454455 " Create a new unsigned transaction in the current experimental era "
455- ++ getEraCommentForUnsignedTx newExperimentalEraTxImpl
456+ ++ getEraCommentFor experimentalEra
456457 ++ " ."
457458 , methodParams = []
458459 , methodReturnType = NewObject (virtualObjectName unsignedTxObj)
459460 , methodReturnDoc = " A promise that resolves to a new `UnsignedTx` object."
460461 }
461- , MethodInfoEntry $
462- MethodInfo
463- { methodName = " newConwayTx"
464- , methodDoc = " Create a new unsigned transaction in the Conway era."
465- , methodParams = []
466- , methodReturnType = NewObject (virtualObjectName unsignedTxObj)
467- , methodReturnDoc = " A promise that resolves to a new `UnsignedTx` object."
468- }
469462 ]
470463 }
471464 , MethodInfoEntry $
@@ -483,13 +476,18 @@ apiInfo =
483476 , groupMethods =
484477 [ MethodGroupEntry $
485478 MethodGroup
486- { groupName = " conway"
487- , groupDoc = [" Methods for creating certificates in Conway era." ]
479+ { groupName = " currentEra"
480+ , groupDoc =
481+ [ " Methods for creating certificates in the current era " ++ getEraCommentFor (Just currentEra) ++ " ."
482+ ]
488483 , groupMethods =
489484 [ MethodInfoEntry $
490485 MethodInfo
491486 { methodName = " makeStakeAddressStakeDelegationCertificate"
492- , methodDoc = " Make a certificate that delegates a stake address to a stake pool in Conway era."
487+ , methodDoc =
488+ " Make a certificate that delegates a stake address to a stake pool in the current era "
489+ ++ getEraCommentFor (Just currentEra)
490+ ++ " ."
493491 , methodParams =
494492 [ ParamInfo " stakeKeyHash" TSString " The stake key hash in base16 format."
495493 , ParamInfo " poolId" TSString " The pool ID in base16 format."
@@ -500,7 +498,10 @@ apiInfo =
500498 , MethodInfoEntry $
501499 MethodInfo
502500 { methodName = " makeStakeAddressRegistrationCertificate"
503- , methodDoc = " Make a stake address registration certificate in Conway era."
501+ , methodDoc =
502+ " Make a stake address registration certificate in the current era "
503+ ++ getEraCommentFor (Just currentEra)
504+ ++ " ."
504505 , methodParams =
505506 [ ParamInfo " stakeKeyHash" TSString " The stake key hash in base16 format."
506507 , ParamInfo " deposit" TSBigInt " The deposit amount in lovelaces."
@@ -511,7 +512,10 @@ apiInfo =
511512 , MethodInfoEntry $
512513 MethodInfo
513514 { methodName = " makeStakeAddressUnregistrationCertificate"
514- , methodDoc = " Make a stake address unregistration certificate in Conway era."
515+ , methodDoc =
516+ " Make a stake address unregistration certificate in the current era "
517+ ++ getEraCommentFor (Just currentEra)
518+ ++ " ."
515519 , methodParams =
516520 [ ParamInfo " stakeKeyHash" TSString " The stake key hash in base16 format."
517521 , ParamInfo " deposit" TSBigInt " The deposit amount in lovelaces."
@@ -524,13 +528,19 @@ apiInfo =
524528 , MethodGroupEntry $
525529 MethodGroup
526530 { groupName = " experimentalEra"
527- , groupDoc = [" Methods for creating certificates in the current experimental era." ]
531+ , groupDoc =
532+ [ " Methods for creating certificates in the current experimental era "
533+ ++ getEraCommentFor experimentalEra
534+ ++ " ."
535+ ]
528536 , groupMethods =
529537 [ MethodInfoEntry $
530538 MethodInfo
531539 { methodName = " makeStakeAddressStakeDelegationCertificateExperimentalEra"
532540 , methodDoc =
533- " Make a certificate that delegates a stake address to a stake pool in the current experimental era."
541+ " Make a certificate that delegates a stake address to a stake pool in the current experimental era "
542+ ++ getEraCommentFor experimentalEra
543+ ++ " ."
534544 , methodParams =
535545 [ ParamInfo " stakeKeyHash" TSString " The stake key hash in base16 format."
536546 , ParamInfo " poolId" TSString " The pool ID in base16 format."
@@ -541,7 +551,10 @@ apiInfo =
541551 , MethodInfoEntry $
542552 MethodInfo
543553 { methodName = " makeStakeAddressRegistrationCertificateExperimentalEra"
544- , methodDoc = " Make a stake address registration certificate in the current experimental era."
554+ , methodDoc =
555+ " Make a stake address registration certificate in the current experimental era "
556+ ++ getEraCommentFor experimentalEra
557+ ++ " ."
545558 , methodParams =
546559 [ ParamInfo " stakeKeyHash" TSString " The stake key hash in base16 format."
547560 , ParamInfo " deposit" TSBigInt " The deposit amount in lovelaces."
@@ -552,7 +565,10 @@ apiInfo =
552565 , MethodInfoEntry $
553566 MethodInfo
554567 { methodName = " makeStakeAddressUnregistrationCertificateExperimentalEra"
555- , methodDoc = " Make a stake address unregistration certificate in the current experimental era."
568+ , methodDoc =
569+ " Make a stake address unregistration certificate in the current experimental era "
570+ ++ getEraCommentFor experimentalEra
571+ ++ " ."
556572 , methodParams =
557573 [ ParamInfo " stakeKeyHash" TSString " The stake key hash in base16 format."
558574 , ParamInfo " deposit" TSBigInt " The deposit amount in lovelaces."
0 commit comments