Skip to content

Commit

Permalink
Merge pull request #36 from SIDANWhatever/feature/gimbalabs-integration
Browse files Browse the repository at this point in the history
docs: changing the docs according to update
  • Loading branch information
HinsonSIDAN authored Nov 21, 2022
2 parents dc122c4 + 3736538 commit 855ff4c
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 21 deletions.
26 changes: 21 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,34 @@

## 0.0.0.1 -- 2022-10-12

* First version. Released on an unsuspecting world.
* branch `main` builds locally and on a remote server; `cabal run` locally produces
- First version. Released on an unsuspecting world.
- branch `main` builds locally and on a remote server; `cabal run` locally produces

## 0.1.0.0 -- 2022-11-18

* Test release with 6 endpoints:
- Test release with 6 endpoints:
1. `createServer`
2. `createEndpoint`
3. `mkV1Validator`
4. `mkV2Validator`
5. `mkV1MintingPolicy`
6. `mkV2MintingPolicy`
* Supported checkout tags:
- Supported checkout tags:
1. Release tag: fb044b39dd8cbfe166b0fec376038f7980c3a398
* `plutus-apps` checkout tag: `next-node` (97b4c1da03faf9bc35f348802fb7927231657e75)
- `plutus-apps` checkout tag: `next-node` (97b4c1da03faf9bc35f348802fb7927231657e75)

## 0.1.0.1 -- 2022-11-22

- Adding ToJSON & FromJSON instances for below Plutus data types:
1. `TokenName`
2. `CurrencySymbol`
3. `AssetClass`
4. `POSIXTime`
5. `Address`
6. `Credential`
7. `PubKeyHash`
8. `ValidatorHash`
9. `StakingCredential`
- Supported checkout tags:
1. Release tag: dc122c4524f3c4bb34e2a8a951f0630554b14ba0
- `plutus-apps` checkout tag: `next-node` (97b4c1da03faf9bc35f348802fb7927231657e75)
43 changes: 31 additions & 12 deletions documentation/APIDoc.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,47 @@
## Setup

1. Include the `source-repository-package` in the `cabal.project` for your Plutus project:

```
source-repository-package
type: git
location: https://github.com/SIDANWhatever/plutus-cborhex-automation
tag: fb044b39dd8cbfe166b0fec376038f7980c3a398
tag: dc122c4524f3c4bb34e2a8a951f0630554b14ba0
```

> Note: This checkout tag is corresponding to `next-node` tag of `plutus-apps`. To avoid package version conflict, please follow the same exact content of `cabal.project` inside `example` sub-dir (remember to change the `packages` tag on line 4).
2. Include the `sidan-plutus-server` in your `build-depends`
3. Import the package

```haskell
import qualified SIDANPlutusServer as SIDAN
```

## APIs

1. `createServer`
> To create the server instance, example:

> To create the server instance, example:

2. `createEndpoint`
> To create a POST request endpoint for custom route, example:

> To create a POST request endpoint for custom route, example:

3. `mkV1Validator`
> To make PlutusV1 Validator, which is to be attached to one custom endpoint

> To make PlutusV1 Validator, which is to be attached to one custom endpoint

4. `mkV2Validator`
> To make PlutusV2 Validator, which is to be attached to one custom endpoint

> To make PlutusV2 Validator, which is to be attached to one custom endpoint

5. `mkV1MintingPolicy`
> To make PlutusV1 MintingPolicy, which is to be attached to one custom endpoint

> To make PlutusV1 MintingPolicy, which is to be attached to one custom endpoint

6. `mkV2MintingPolicy`
> To make PlutusV2 MintingPolicy, which is to be attached to one custom endpoint
> To make PlutusV2 MintingPolicy, which is to be attached to one custom endpoint

### Important note: You have to derive `FromJSON` and `ToJSON` instances for your custom param in order to utilize the above APIs.

Expand All @@ -50,6 +58,7 @@ data TestParam = TestParam {
```

## Example usage of all the above APIs

```haskell
{-# LANGUAGE OverloadedStrings #-}

Expand All @@ -73,7 +82,9 @@ app = do
```

## Endpoint usage example

Let's say you have a custom parameter of your V1 validator like below:

```haskell
data TestParam = TestParam {
testNumber :: Integer,
Expand All @@ -83,6 +94,7 @@ data TestParam = TestParam {
```

And you have implemented `sidan-plutus-server` like below:

```haskell
{-# LANGUAGE OverloadedStrings #-}

Expand All @@ -100,22 +112,29 @@ app = do
```

After your server is up:

```
Spock is running on port 8080
```

Your can craft the body of your post request like this:

```json
{
"testNumber": 245324,
"testPpkh": {"unPaymentPubKeyHash": {"getPubKeyHash": "8f2ac4b2a57a90feb7717c7361c7043af6c3646e9db2b0e616482f73"}}
"testNumber": 245324,
"testPpkh": {
"unPaymentPubKeyHash": {
"getPubKeyHash": "8f2ac4b2a57a90feb7717c7361c7043af6c3646e9db2b0e616482f73"
}
}
}
```

You can see we have to wrapped our `String` input from JSON body to the type `PaymentPubKeyHash`, while it is not needed for `Integer` typed param. Full list of endpoint crafting guideline for common Plutus parameters could be found [here](EndpointGuide.md)


## Supported `plutus-apps` checkout tags:
1. Release tag: fb044b39dd8cbfe166b0fec376038f7980c3a398
* `plutus-apps` checkout tag: `next-node` (97b4c1da03faf9bc35f348802fb7927231657e75)

1. Release tag: fb044b39dd8cbfe166b0fec376038f7980c3a398
- `plutus-apps` checkout tag: `next-node` (97b4c1da03faf9bc35f348802fb7927231657e75)

### Please request if you want us to support for `plutus-apps` checkout tag for your Dapp!
6 changes: 5 additions & 1 deletion example/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,8 @@

## 0.1.0.0 -- 2022-11-18

* Start developing with base example.
- Start developing with base example.

## 0.1.0.1 -- 2022-11-22

- Integrated with Gimbalabs [Contributor Token instance](https://gitlab.com/gimbalabs/plutus-pbl-summer-2022/projects/completion-token/ppbl-contributor-token/-/tree/main/)
2 changes: 1 addition & 1 deletion example/cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -362,4 +362,4 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/SIDANWhatever/plutus-cborhex-automation
tag: fb044b39dd8cbfe166b0fec376038f7980c3a398
tag: dc122c4524f3c4bb34e2a8a951f0630554b14ba0
File renamed without changes.
3 changes: 1 addition & 2 deletions example/src/ParamScriptAPI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ main = SIDAN.createServer app

app :: SIDAN.Api
app = do
SIDAN.createEndpoint "validatorV1" $ SIDAN.mkV1Validator validator
SIDAN.createEndpoint "contributor-token" $ SIDAN.mkV2Validator CTRV.validator
-- SIDAN.createEndpoint "validatorV1" $ SIDAN.mkV1Validator validator
-- SIDAN.createEndpoint "validatorV2" $ SIDAN.mkV2Validator validator

0 comments on commit 855ff4c

Please sign in to comment.