Documentation ¶
Overview ¶
Package ethereum is a experimental GopherJS wrapper around web3js (v 0.20.x)
Index ¶
- type CallOpts
- type Contract
- type Ethereum
- func (eth *Ethereum) ActiveAccount() (string, error)
- func (eth *Ethereum) Balance(account string) (*big.Int, error)
- func (eth *Ethereum) Contract(abi, address string) *Contract
- func (eth *Ethereum) DeployContract(abi string, opts CallOpts, args ...interface{}) (string, *Contract, error)
- func (eth *Ethereum) FromWei(wei *big.Int) *big.Int
- func (eth *Ethereum) IsConnected() bool
- func (eth *Ethereum) IsMetamask() bool
- func (eth *Ethereum) NetworkID() (int, error)
- func (eth *Ethereum) ToWei(ether *big.Int) *big.Int
- type Event
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CallOpts ¶
CallOpts is an helper to perform transactions
func (*CallOpts) ToJSObject ¶
ToJSObject converts CallOpts to a JSObject (json like)
type Contract ¶
type Contract struct {
// contains filtered or unexported fields
}
Contract represents a smart contract wrapper
func (*Contract) SubscribeToEvent ¶
SubscribeToEvent will fetch all events from block 0 and watch new ones events are sent to channel chEvents
type Ethereum ¶
type Ethereum struct {
// contains filtered or unexported fields
}
Ethereum represents a connection to the blockchain through web3.js
func InitMetamask ¶
InitMetamask ensure the web3 object is initialized with Metamask provider Note: some contract functions are not functional with Metamask
func (*Ethereum) ActiveAccount ¶
ActiveAccount returns web3.eth.accounts[0]
func (*Ethereum) DeployContract ¶
func (eth *Ethereum) DeployContract(abi string, opts CallOpts, args ...interface{}) (string, *Contract, error)
DeployContract deploys a new contract and waits for it to be mined returns its address , the contract object or an error
func (*Ethereum) IsConnected ¶
IsConnected return connection status
func (*Ethereum) IsMetamask ¶
IsMetamask returns true if current provider of web3.js object === metamask