Package

purescript-rmrk-parser

Repository
rmrk-team/purescript-rmrk-parser
License
Apache-2.0
Uploaded by
gorillatron
Published on
2022-01-11T11:49:26Z

RMRK 2.0.0 protocol purescript parser

RMRK protocoll parser and primitives in purescript.

Build & Test

Quick Example

module Main where

import Prelude
import Data.Either (Either(..))
import Data.Maybe (Maybe(..))
import Data.Tuple (Tuple(..))
import Effect (Effect)
import Effect.Class.Console (log, logShow)
import Lib.Parsing.Combinators (ParserError(..), runParser)
import RMRK.Primitives.Version (Version(..))
import RMRK.Syntax (Stmt(..))
import RMRK.Syntax.Parser (parser)

main :: Effect Boolean
main = do
  pure $ parse "rmrk::BUY::2.0.0::5105000-0aff6865bed3a66b-DLEP-DL15-00000001::H9eSvWe34vQDJAWckeTHWSqSChRat8bgKHG39GC1fjvEm7y"
    == ( Right
          $ BUY V2 (NFTId "5105000-0aff6865bed3a66b-DLEP-DL15-00000001")
              (Just $ Recipient.Account $ Address "H9eSvWe34vQDJAWckeTHWSqSChRat8bgKHG39GC1fjvEm7y")
      )

Spec

Go to the spec repo for full documentation of the RMRK v2 spec. rmrk-team/rmrk-spec/tree/master/standards/rmrk2.0.0

The following interactions are implemented:

  • ACCEPT (Accept the addition of a new resource to an existing NFT, or the additiona of a child into a parent NFT)
  • BASE (Create a Base)
  • BUY (Buy an NFT)
  • CHANGEISSUER (Changing the issuer of a collection or base)
  • BURN (Burn an NFT)
  • CREATE (Minting a collection of NFTs)
  • EMOTE (Send a reaction/emoticon)
  • EQUIP (Equip a child NFT into a parent's slot, or unequip)
  • EQUIPPABLE (Changes the list of equippable collections on a base's part)
  • LOCK (Locking a collection)
  • MINT (Minting an NFT inside a collection)
  • LIST (List an NFT for sale)
  • SEND (Sending an NFT to a recipient)
  • RESADD (Add a new resource to an NFT as the collection issuer)
  • SETPROPERTY (Set a custom value on an NFT)
  • SETPRIORITY (Set a different order of resource priority)
  • THEMEADD (Add a new theme to a base)

Docs

Find the docs at Pursuit

Goal

Write a dumb protocol parser that parses RMRK strings to strong rich types. Spec of protocol consolidation is not defined or handled in this package.

Run Tests

npm run test