irys

package
v0.0.0-...-3968f94 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: MIT Imports: 17 Imported by: 0

README

Documentation

Index

Constants

This section is empty.

Variables

View Source
var InsufficientBalance = errors.New("insufficient balance")

Functions

func Must

func Must(err error)

func Must1

func Must1[T any](arg T, err error) T

func Must2

func Must2[T any, T2 any](arg T, arg2 T2, err error) (T, T2)

func Recover

func Recover(err *error)

func UploadLogoAndMetadata

func UploadLogoAndMetadata(
	ctx context.Context,
	connection *web3.Connection,
	node *IrysNode,
	signer web3.Signer,
	gateway string,
	name string,
	symbol string,
	description string,
	additional map[string]string,
	logo []byte,
) (string, error)

Types

type BundlrTx

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

func (*BundlrTx) Sign

func (tx *BundlrTx) Sign(signer web3.Signer) error

type Endpoint

type Endpoint string
const (
	NODE1 Endpoint = "https://node1.irys.xyz"
	NODE2 Endpoint = "https://node2.irys.xyz"
	DEV   Endpoint = "https://devnet.irys.xyz"
)

func (Endpoint) String

func (e Endpoint) String() string

type IrysNode

type IrysNode struct {
	HttpClient *http.Client
	// contains filtered or unexported fields
}

IrysNode represents the Irys node.

func NewIrys

func NewIrys(node Endpoint) *IrysNode

func (*IrysNode) Fund

func (i *IrysNode) Fund(ctx context.Context, transfer func(to web3.PublicKey) (web3.TransactionSignature, error)) (err error)

func (*IrysNode) FundByBytes

func (i *IrysNode) FundByBytes(ctx context.Context, connection *web3.Connection, signer web3.Signer, bs int) error

func (*IrysNode) GetBalance

func (i *IrysNode) GetBalance(address string) (uint64, error)

func (*IrysNode) GetPrice

func (i *IrysNode) GetPrice(bytes int) (uint64, error)

GetPrice calculates the price for bytes bytes paid for with [token] for the loaded Irys node.

func (*IrysNode) Upload

func (i *IrysNode) Upload(data []byte, signer web3.Signer, tags map[string]string) (_ *UploadResponse, err error)

func (*IrysNode) UploadData

func (i *IrysNode) UploadData(ctx context.Context, connection *web3.Connection, signer web3.Signer, data []byte, contentType string) (*UploadResponse, error)

func (*IrysNode) UploadImage

func (i *IrysNode) UploadImage(ctx context.Context, connection *web3.Connection, signer web3.Signer, image_ []byte) (*UploadResponse, error)

func (*IrysNode) UploadJson

func (i *IrysNode) UploadJson(ctx context.Context, connection *web3.Connection, signer web3.Signer, data any) (_ *UploadResponse, err error)

type Tag

type Tag struct {
	Name  string
	Value string
}

type UploadResponse

type UploadResponse struct {
	Id             string `json:"id"`
	Timestamp      int64  `json:"timestamp"`
	Version        string `json:"version"`
	Public         string `json:"public"`
	Signature      string `json:"signature"`
	DeadlineHeight int    `json:"deadlineHeight"`
	Block          int    `json:"block"`
}

Jump to

Keyboard shortcuts

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