gondlr

package module
v0.0.0-...-9b281af Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2022 License: MIT Imports: 11 Imported by: 0

README

gondlr

pronounced gondola -- a light flat-bottomed boat used on Venetian canals, having a high point at each end and worked by one oar at the stern.

WORK IN PROGRESS! - Do not use this for production use, just yet!

A golang implementation of the Bundlr SDK and CLI

TODO:

The current list of todo to get this aligned with the JS SKD/CLI

CLI Commands:

  • Balance
  • Withdraw
  • Upload
  • Upload-dir
  • Fund
  • Price

Supported Networks/Wallets/Signers:

  • Arweave
  • Ethereum
  • Solana
  • Near
  • ERC20

Misc:

  • Mock Bundlr node
  • Get unit tests up to scratch

Part of my mission while doing this is to create a swagger spec for Bundlr, as the API is currently not documented.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorHTTP = func(expected int, received int) error {
		return fmt.Errorf("request returned [ %s ] not [ %s ]", http.StatusText(received), http.StatusText(expected))
	}

	ErrorJSONUnmarshal = func(err error) error {
		return fmt.Errorf("unable to unmarshal json: %w", err)
	}

	ErrorUnmarshalTextToBigInt = func(e error) error {
		return fmt.Errorf("unable to unmarshal text to big.Int: %w", e)
	}
)

Functions

This section is empty.

Types

type BalanceResponse

type BalanceResponse struct {
	Balance string `json:"balance"`
}

type Gondlr

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

func New

func New(opts ...Option) (*Gondlr, error)

func (*Gondlr) Balance

func (g *Gondlr) Balance() (*big.Int, error)

func (*Gondlr) Base

func (g *Gondlr) Base() float64

func (*Gondlr) Currency

func (g *Gondlr) Currency() []string

func (*Gondlr) Fund

func (g *Gondlr) Fund()

func (*Gondlr) Network

func (g *Gondlr) Network() string

func (*Gondlr) Price

func (g *Gondlr) Price(bytes string) (*big.Float, error)

func (*Gondlr) Upload

func (g *Gondlr) Upload()

func (*Gondlr) UploadDir

func (g *Gondlr) UploadDir()

func (*Gondlr) Withdraw

func (g *Gondlr) Withdraw()

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

type Network

type Network interface {
	Name() string
	Currency() []string
	Base() float64
	Tx(transactionID string) (network.Transaction, error)
	CurrentHeight() int
	Fee() *big.Int
	SendTransaction(data interface{}) error
	CreateTransaction(amount *big.Int, to string) error
}

type Option

type Option func(g *Gondlr) error

func WithClient

func WithClient(client HTTPClient) Option

WithClient allows the user to implement their own HTTP client and supply it to Gondlr

func WithHost

func WithHost(host string) Option

func WithNetwork

func WithNetwork(n Network) Option

func WithSigner

func WithSigner(s Signer) Option

func WithWallet

func WithWallet(w Wallet) Option

type Signer

type Signer interface {
	Sign(data []byte) ([]byte, error)
	Verify(data []byte, sig []byte) bool
}

type Transaction

type Transaction struct{}

type Wallet

type Wallet interface {
	PrivateKeyBytes() []byte
	PublicKeyBytes() []byte
	PublicKey() wallet.PublicKey
	PrivateKey() wallet.PrivateKey
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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