us

package module
v0.0.0-...-539a134 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2021 License: MIT Imports: 12 Imported by: 0

README

gomobile bindings

iOS
go get -u lukechampine.com/us-bindings/gomobile
go get golang.org/x/mobile/cmd/gomobile
gomobile bind -target=ios lukechampine.com/us-bindings/gomobile

This will produce a framework, Us.framework, which you can import into Xcode.

Android

See https://github.com/golang/go/wiki/Mobile#building-and-deploying-to-android-1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateAddress

func ValidateAddress(addr string) bool

ValidateAddress returns true if addr is a valid Sia address.

Types

type Contract

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

A Contract is a file contract formed with a Sia host.

func NewContract

func NewContract(b []byte) (*Contract, error)

NewContract parses a binary-encoded contract.

type FileSystem

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

A FileSystem supports I/O operations on Sia files.

func NewFileSystem

func NewFileSystem(root string, hs *HostSet) (*FileSystem, error)

NewFileSystem returns a filesystem rooted at root using the provided hosts.

func (*FileSystem) Close

func (fs *FileSystem) Close() error

Close shuts down the filesystem, flushing any uncommitted writes.

func (*FileSystem) Download

func (fs *FileSystem) Download(name string) ([]byte, error)

Download retrieves the contents of the named file.

func (*FileSystem) Upload

func (fs *FileSystem) Upload(name string, data []byte, minHosts int) error

Upload creates a file with the given name, data, and redundancy.

type HostSet

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

A HostSet is a set of Sia hosts that can be used for uploading and downloading.

func NewHostSet

func NewHostSet(shardSrv string) (*HostSet, error)

NewHostSet returns an empty HostSet, using the provided shard server to resolve public keys to network addresses.

func (*HostSet) AddHost

func (hs *HostSet) AddHost(c *Contract)

AddHost adds a host to the set.

type Seed

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

func NewSeed

func NewSeed() *Seed

NewSeed returns a new random wallet seed.

func SeedFromPhrase

func SeedFromPhrase(phrase string) (*Seed, error)

SeedFromPhrase returns the seed derived from the supplied phrase.

func (*Seed) PublicKey

func (s *Seed) PublicKey(index int) string

PublicKey derives the specified public key.

func (*Seed) ToPhrase

func (s *Seed) ToPhrase() string

ToPhrase encodes a seed as a 12-word mnemonic phrase.

type Transaction

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

func NewTransaction

func NewTransaction(feePerByte string) *Transaction

func (*Transaction) AddInput

func (t *Transaction) AddInput(id string, value string, publicKey string, keyIndex int) bool

func (*Transaction) AddOutput

func (t *Transaction) AddOutput(addr string, amount string)

func (*Transaction) AsJSON

func (t *Transaction) AsJSON() string

func (*Transaction) Finalize

func (t *Transaction) Finalize(changeAddr string)

func (*Transaction) Sign

func (t *Transaction) Sign(s *Seed)

Jump to

Keyboard shortcuts

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