sidan-lab / plutus-cborhex-automation

A Haskell package for creating RESTful API endpoints for dynamic parameterized Cardano Plutus script.
15 stars 3 forks source link

Haskell Research 1: Data type as input, data type plus instance declaration as output #21

Closed HinsonSIDAN closed 1 year ago

HinsonSIDAN commented 1 year ago

We want to explore this functionality due to issue 4. Taking example-validator as example:

-- Param data type
data TestParam = TestParam {
  testNumber :: Integer,
  testPpkh   :: PaymentPubKeyHash
}

-- Input data type accepted by post request endpoint
```haskell
data ParamInput = ParamInput {
  piNumber :: !Integer,
  piAddr   :: !String
} deriving (Show, Generic)

instance FromJSON ParamInput
instance ToJSON ParamInput

In order to accomplish the module wrapping style, this area has to be explored.

HinsonSIDAN commented 1 year ago

Given that frontend could handle this logic seamlessly upon research, closing this issue until community requests for the function