arweave

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultArweaveNodeURL is a default arweave node URL
	DefaultArweaveNodeURL = "https://arweave.net"
)

Variables

View Source
var (
	ErrFailedToCalcPrice  = errors.New("failed to calculate arweave transaction price")
	ErrFailedToUploadData = errors.New("failed to upload data to arweave")
)

Predefined package errors.

Functions

This section is empty.

Types

type Client

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

Client is a wrapper for goar.Wallet

func NewClient

func NewClient(opts ...ClientOption) *Client

NewClient creates a new arweave client

func (*Client) CalcPrice

func (c *Client) CalcPrice(data []byte) (float64, int64, error)

CalcPrice returns price for store data 1 AR = 1000000000000 Winston (12 zeros) and 1 Winston = 0.000000000001 AR [0] - float64 - price in AR coins [1] - int64 - price in Winstons [2] - error

func (*Client) Upload

func (c *Client) Upload(data []byte, contentType, ext string) (string, error)

Upload function uploads data to Arweave returns file URL or error

type ClientOption

type ClientOption func(*Client)

Client option function interface to configure the client.

func InitWalletWithPath

func InitWalletWithPath(walletPath string) ClientOption

InitWalletWithPath initializes a wallet instance from a given path.

func InitWalletWithPathAndNode

func InitWalletWithPathAndNode(walletPath string, nodeURL string) ClientOption

InitWalletWithPathAndNode initializes a wallet instance from a given path and custom node URL.

func InitWalletWithPrivateKey

func InitWalletWithPrivateKey(privateKey []byte) ClientOption

InitWalletWithPrivateKey initializes a wallet instance from a given private key.

func InitWalletWithPrivateKeyAndNode

func InitWalletWithPrivateKeyAndNode(privateKey []byte, nodeURL string) ClientOption

InitWalletWithPrivateKeyAndNode initializes a wallet instance from a given private key and custom node URL.

func WithCustomSpeedFactor

func WithCustomSpeedFactor(speedFactor int64) ClientOption

WithCustomSpeedFactor sets the speed factor to be used for transactions. Default is 0.

func WithWalletInstance

func WithWalletInstance(wallet *goar.Wallet) ClientOption

WithWalletInstance sets the wallet instance to be used for transactions.

Jump to

Keyboard shortcuts

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