Documentation ¶
Overview ¶
Package web3 provides a wrapper for ethereum's web3.js for use with gopherjs.
Getting Started:
$ go get -u github.com/jaynagpaul/go-web3
$ go get -u github.com/gopherjs/gopherjs
import "github.com/jaynagpaul/go-web3" func main() { // Check if injected by browser w3 := web3.NewWeb3() w3.Version.GetEthereum(func(ver, err) { if err != nil { println(err) } else { println(ver) // Prints the version to the developer console. } }) // TODO }
$ gopherjs build
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Version ¶
type Version struct { API string // The ethereum JS api version. // contains filtered or unexported fields }
Version of the various protocols and apis
func (*Version) GetEthereum ¶
GetEthereum takes a callback with ethereum version and error as a params Returns the ethereum protocol version.
func (*Version) GetNetwork ¶
GetNetwork takes a callback with network version and error as a params Returns the network protocol version.
func (*Version) GetNode ¶
GetNode takes a callback with node version and error as a params Returns the client/node version.
func (*Version) GetWhisper ¶
GetWhisper takes a callback with whisper version and error as a params Returns the whisper protocol version.
type Web3 ¶
type Web3 struct { Version Version // contains filtered or unexported fields }
Web3 instance
func NewWeb3 ¶
func NewWeb3(args ...interface{}) *Web3
NewWeb3 creates a Web3 instance with args passed to Web3.providers.HttpProvider. HttpProvider takes 4 arguments (host, timeout, user, password)
func (*Web3) CurrentProvider ¶
CurrentProvider can be used to check if mist, metamask etc. have already set a provider.
func (*Web3) IsConnected ¶
IsConnected should be called to check if a connection to a node exists
func (*Web3) Reset ¶
Reset can be called to reset state of web3. Resets everything except manager. Uninstalls all filters. Stops polling. If keepIsSyncing is true it will uninstall all filters, but will keep the web3.eth.isSyncing() polls
func (*Web3) SetProvider ¶
func (w3 *Web3) SetProvider(args ...interface{})
SetProvider should be called to set provider. See NewWeb3 for more detailed information on args.