go-rollups

module
v0.5.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 27, 2024 License: Apache-2.0

README

Cartesi Rollups GO high level framework

This works for Cartesi Rollups version 1.0.x

Create cartesi rolllups DApp with codes like:

package main

import (
  "fmt"
  "github.com/prototyp3-dev/go-rollups/handler"
)

var infolog = log.New(os.Stderr, "[ info ]  ", log.Lshortfile)

func Handle(payload string) error {
  fmt.Println("Handle: Received payload:",payload)
  return nil
}

func main() {
  handler.HandleDefault(Handle)

  err := handler.RunDebug()
  if err != nil {
    log.Panicln(err)
  }
}

Check the examples for more use cases.

You will need sunodo cli to create and run the example, and curl to interact with the dapp.

To run an example

cd examples
rm -rf example.go
ln -sr example1_rollups_helpers.go example.go
sunodo build
sunodo run

You can send inputs with (account and private key of anvil test accounts)

sunodo send generic --input="test"

Send inspects with

curl http://localhost:8080/inspect/test

View notices with

curl -H 'Content-Type: application/json' -X POST http://localhost:8080/graphql -d '{"query": "query { notices { edges { node { index payload }}}}"}'
DISCLAIMER: This is a prototype to showcase the Cartesi Rollups features and is not intended to be used as-is in the production environment

Directories

Path Synopsis
abi
uri

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL