opplasmairys

package module
v0.0.0-...-001b6a2 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: MIT Imports: 13 Imported by: 0

README

Optimism Plasma DA KVStore Store implementation(irys)

Introduction

This simple DA KVStore Store implementation based on irys. See the Irys doc for more information

Install

go get github.com/4everland/opplasmairys

Start

import (
  "github.com/4everland/opplasmairys"
)

config := opplasmairys.Config{
  //IrysPrivateKey
  IrysPrivateKey: os.Getenv("IRYS_PRIVATE_KEY"),
  //IrysPaymentNetwork supported networks: ethereum,matic,bnb,avalanche,arbitrum or fantom
  IrysPaymentNetwork: os.Getenv("IRYS_PAYMENT_NETWORK"),
  //IrysPaymentRPC, optional
  IrysPaymentRPC: os.Getenv("IRYS_PAYMENT_RPC"),
  //IrysFreeUpload, optional
  IrysFreeUpload: os.Getenv("IRYS_FREE_UPLOAD"),
}   
var (
  err error
  //backup kvstore, optional
  store opplasmairys.KVStore
)
//create a new irys store
store, err = opplasmairys.NewDAStore(config, store)

Simple Server

This simple DA server implementation supports irys. See the daserver for more information

Documentation

Index

Constants

View Source
const (
	Matic     = "matic"
	Bnb       = "bnb"
	Avalanche = "avalanche"
	Arbitrum  = "arbitrum"
	Fantom    = "fantom"
	Ethereum  = "ethereum"
)
View Source
const (
	GraphqlMainNet  = "https://arweave.mainnet.irys.xyz/graphql"
	GraphqlMainNet2 = "https://arweave.net/graphql"
)
View Source
const QueryTx_Operation = `` /* 214-byte string literal not displayed */

The query or mutation executed by QueryTx.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	NetworkName string
	PrivateKey  string
	NetWorkRpc  string

	FreeUpload bool
}

type DAStore

type DAStore struct {
	// contains filtered or unexported fields
}

func NewDAStore

func NewDAStore(c Config, store KVStore) (*DAStore, error)

func (*DAStore) Get

func (d *DAStore) Get(ctx context.Context, key []byte) (v []byte, err error)

func (*DAStore) Put

func (d *DAStore) Put(ctx context.Context, key []byte, value []byte) error

type IrysClient

type IrysClient struct {
	// contains filtered or unexported fields
}

func NewIrysClient

func NewIrysClient(networkName, rpc, privateKey string, enableFreeUpload bool) (*IrysClient, error)

NewIrysClient support tokens ethereum,matic,bnb,avalanche,arbitrum,fantom

func (*IrysClient) Download

func (c *IrysClient) Download(ctx context.Context, id []byte) (io.ReadCloser, error)

func (*IrysClient) Upload

func (c *IrysClient) Upload(ctx context.Context, id []byte, data []byte) error

type KVStore

type KVStore interface {
	// Get retrieves the given key if it's present in the key-value data store.
	Get(ctx context.Context, key []byte) ([]byte, error)
	// Put inserts the given value into the key-value data store.
	Put(ctx context.Context, key []byte, value []byte) error
}

type QueryTxResponse

type QueryTxResponse struct {
	Transactions QueryTxTransactionsEdges `json:"transactions"`
}

QueryTxResponse is returned by QueryTx on success.

func QueryTx

func QueryTx(
	ctx_ context.Context,
	client_ graphql.Client,
	address []string,
	key string,
) (*QueryTxResponse, error)

func (*QueryTxResponse) GetTransactions

func (v *QueryTxResponse) GetTransactions() QueryTxTransactionsEdges

GetTransactions returns QueryTxResponse.Transactions, and is useful for accessing the field via an interface.

type QueryTxTransactionsEdges

type QueryTxTransactionsEdges struct {
	Edges []QueryTxTransactionsEdgesEdgesNode `json:"edges"`
}

QueryTxTransactionsEdges includes the requested fields of the GraphQL type Edges.

func (*QueryTxTransactionsEdges) GetEdges

GetEdges returns QueryTxTransactionsEdges.Edges, and is useful for accessing the field via an interface.

type QueryTxTransactionsEdgesEdgesNode

type QueryTxTransactionsEdgesEdgesNode struct {
	Node QueryTxTransactionsEdgesEdgesNodeNodeTransaction `json:"node"`
}

QueryTxTransactionsEdgesEdgesNode includes the requested fields of the GraphQL type Node.

func (*QueryTxTransactionsEdgesEdgesNode) GetNode

GetNode returns QueryTxTransactionsEdgesEdgesNode.Node, and is useful for accessing the field via an interface.

type QueryTxTransactionsEdgesEdgesNodeNodeTransaction

type QueryTxTransactionsEdgesEdgesNodeNodeTransaction struct {
	Id   string                                                    `json:"id"`
	Tags []QueryTxTransactionsEdgesEdgesNodeNodeTransactionTagsTag `json:"tags"`
}

QueryTxTransactionsEdgesEdgesNodeNodeTransaction includes the requested fields of the GraphQL type Transaction.

func (*QueryTxTransactionsEdgesEdgesNodeNodeTransaction) GetId

GetId returns QueryTxTransactionsEdgesEdgesNodeNodeTransaction.Id, and is useful for accessing the field via an interface.

func (*QueryTxTransactionsEdgesEdgesNodeNodeTransaction) GetTags

GetTags returns QueryTxTransactionsEdgesEdgesNodeNodeTransaction.Tags, and is useful for accessing the field via an interface.

type QueryTxTransactionsEdgesEdgesNodeNodeTransactionTagsTag

type QueryTxTransactionsEdgesEdgesNodeNodeTransactionTagsTag struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

QueryTxTransactionsEdgesEdgesNodeNodeTransactionTagsTag includes the requested fields of the GraphQL type Tag.

func (*QueryTxTransactionsEdgesEdgesNodeNodeTransactionTagsTag) GetName

GetName returns QueryTxTransactionsEdgesEdgesNodeNodeTransactionTagsTag.Name, and is useful for accessing the field via an interface.

func (*QueryTxTransactionsEdgesEdgesNodeNodeTransactionTagsTag) GetValue

GetValue returns QueryTxTransactionsEdgesEdgesNodeNodeTransactionTagsTag.Value, and is useful for accessing the field via an interface.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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