near

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: MIT Imports: 7 Imported by: 0

README

go-near

This library exposes a thin go module around near-op-sys. This enables DA capabilities with minimal intrusion.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidSize    = errors.New("NEAR DA unmarshal blob: invalid size")
	ErrInvalidNetwork = errors.New("NEAR DA client relative URL without a base")
)

Functions

func GetDAError

func GetDAError() (err error)

func NewBlobSafe

func NewBlobSafe(data []byte) *C.BlobSafe

func TestSetError

func TestSetError(msg string)

func To32Bytes

func To32Bytes(ptr unsafe.Pointer) []byte

func ToBytes

func ToBytes(b *C.BlobSafe) []byte

Types

type BlobRef

type BlobRef struct {
	TxId []byte
}

BlobRef contains the reference to the specific blob on near and satisfies the Framer interface.

func (*BlobRef) MarshalBinary

func (f *BlobRef) MarshalBinary() ([]byte, error)

MarshalBinary encodes the Ref into a format that can be serialized.

func (*BlobRef) UnmarshalBinary

func (f *BlobRef) UnmarshalBinary(ref []byte) error

type Config

type Config struct {
	Namespace Namespace
	Client    *C.Client
}

func NewConfig

func NewConfig(accountN, contractN, keyN, networkN string, ns uint32) (*Config, error)

Note, networkN value can be either Mainnet, Testnet or loopback address in [ip]:[port] format.

func NewConfigFile

func NewConfigFile(keyPathN, contractN, networkN string, ns uint32) (*Config, error)

Note, networkN value can be either Mainnet, Testnet or loopback address in [ip]:[port] format.

func (*Config) ForceSubmit

func (config *Config) ForceSubmit(data []byte) ([]byte, error)

Used by other rollups without candidate semantics, if you know for sure you want to submit the data to NEAR

func (*Config) FreeClient

func (config *Config) FreeClient()

func (*Config) Get

func (config *Config) Get(frameRefBytes []byte, txIndex uint32) ([]byte, error)

func (*Config) Submit

func (config *Config) Submit(candidateHex string, data []byte) ([]byte, error)

Note, candidateHex has to be "0xfF00000000000000000000000000000000000000" for the data to be submitted in the case of other Rollups. If concerned, use ForceSubmit

type Framer

Framer defines a way to encode/decode a FrameRef.

type Namespace

type Namespace struct {
	Version uint8
	Id      uint32
}

Jump to

Keyboard shortcuts

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