Documentation
¶
Index ¶
- func UnmarshallSolcAbiJson(jsonReader io.Reader) (*abi.ABI, []byte, error)
- type Contract
- func (c *Contract) Abi() *abi.ABI
- func (c *Contract) Address() *common.Address
- func (c *Contract) ByteCode() []byte
- func (c *Contract) Call(ret interface{}, funcname string, params ...interface{}) error
- func (c *Contract) Client() *Web3Client
- func (c *Contract) DeploySync(params ...interface{}) (*types.Transaction, *types.Receipt, error)
- func (c *Contract) SendTransactionSync(value *big.Int, gasLimit uint64, funcname string, params ...interface{}) (*types.Transaction, *types.Receipt, error)
- func (c *Contract) VerifyBytecode() error
- type EventHandlerFunc
- type ReceiptDownloader
- func (r *ReceiptDownloader) Forget(txid common.Hash)
- func (r *ReceiptDownloader) Get(txid common.Hash) (*types.Receipt, error)
- func (r *ReceiptDownloader) Join()
- func (r *ReceiptDownloader) Request(txid common.Hash)
- func (r *ReceiptDownloader) Start()
- func (r *ReceiptDownloader) Stats() (queuelen, pendinglen int)
- func (r *ReceiptDownloader) Stop()
- type ReceiptTask
- type SavePoint
- type ScanEventDispatcher
- func (e *ScanEventDispatcher) Join()
- func (e *ScanEventDispatcher) RegisterHandler(address common.Address, abi *abi.ABI, event string, handler EventHandlerFunc, ...)
- func (e *ScanEventDispatcher) Start()
- func (e *ScanEventDispatcher) Stop()
- func (e *ScanEventDispatcher) UnregisterHandler(address common.Address, event string)
- type ScanEventHandler
- type Web3Client
- func (w *Web3Client) BalanceInfo() (string, error)
- func (w *Web3Client) Call(to *common.Address, value *big.Int, calldata []byte) ([]byte, error)
- func (w *Web3Client) SendTransactionSync(to *common.Address, value *big.Int, gasLimit uint64, calldata []byte) (*types.Transaction, *types.Receipt, error)
- func (w *Web3Client) Sign(data ...[]byte) ([3][32]byte, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Contract ¶
type Contract struct {
// contains filtered or unexported fields
}
Contract is a smartcontract with optional address
func NewContract ¶
func NewContract(client *Web3Client, abi *abi.ABI, byteCode []byte, address *common.Address) (*Contract, error)
NewContract initiates a contract ABI & bytecode from json file associated to a web3 client
func NewContractFromJson ¶
func NewContractFromJson(client *Web3Client, solcjson io.Reader, address *common.Address) (*Contract, error)
NewContractFromJson initiates a contract ABI & bytecode from json file associated to a web3 client
func (*Contract) Client ¶
func (c *Contract) Client() *Web3Client
func (*Contract) DeploySync ¶
Deploy the contract
func (*Contract) SendTransactionSync ¶
func (c *Contract) SendTransactionSync(value *big.Int, gasLimit uint64, funcname string, params ...interface{}) (*types.Transaction, *types.Receipt, error)
SendTransactionSync executes a contract method and wait it finalizes
func (*Contract) VerifyBytecode ¶
VerifyBytecode verifies is the bytecode is the same than the JSON
type EventHandlerFunc ¶
type EventHandlerFunc func(*types.Log, *ScanEventHandler) error
type ReceiptDownloader ¶
receiptDownloader allows to download multiple receipts at the same time.
func NewReceiptDownloader ¶
func NewReceiptDownloader(client *ethclient.Client, concurrency int) *ReceiptDownloader
func (*ReceiptDownloader) Forget ¶
func (r *ReceiptDownloader) Forget(txid common.Hash)
Forget (deletes) an already downloaded transaction.
func (*ReceiptDownloader) Join ¶
func (r *ReceiptDownloader) Join()
Join waits until all background jobs stopped
func (*ReceiptDownloader) Request ¶
func (r *ReceiptDownloader) Request(txid common.Hash)
Request to download a transaction.
func (*ReceiptDownloader) Stats ¶
func (r *ReceiptDownloader) Stats() (queuelen, pendinglen int)
Stats retrieves the status.
type ReceiptTask ¶
type ReceiptTask struct { Tx common.Hash Err error Receipt *types.Receipt // contains filtered or unexported fields }
receiptTask is a single receipt download task.
type ScanEventDispatcher ¶
func NewScanEventDispatcher ¶
func NewScanEventDispatcher(client *ethclient.Client, savepoint SavePoint) *ScanEventDispatcher
func (*ScanEventDispatcher) Join ¶
func (e *ScanEventDispatcher) Join()
Join waits all background jobs finished
func (*ScanEventDispatcher) RegisterHandler ¶
func (e *ScanEventDispatcher) RegisterHandler(address common.Address, abi *abi.ABI, event string, handler EventHandlerFunc, userdata interface{})
Register registers a function to be called on event emission. Call NotifyUpdate if this is done
when everything started
func (*ScanEventDispatcher) Start ¶
func (e *ScanEventDispatcher) Start()
Start scanning the blockchain for events
func (*ScanEventDispatcher) Stop ¶
func (e *ScanEventDispatcher) Stop()
Stop scanning the blockchain for events
func (*ScanEventDispatcher) UnregisterHandler ¶
func (e *ScanEventDispatcher) UnregisterHandler(address common.Address, event string)
type ScanEventHandler ¶
type ScanEventHandler struct { Address common.Address EventName string Topic string Handler EventHandlerFunc UserData interface{} }
type Web3Client ¶
type Web3Client struct { ClientMutex *sync.Mutex Client *ethclient.Client Account *accounts.Account Ks *keystore.KeyStore ReceiptTimeout time.Duration MaxGasPrice uint64 }
Web3Client defines a connection to a client via websockets
func NewWeb3Client ¶
func NewWeb3Client(client *ethclient.Client, ks *keystore.KeyStore, account *accounts.Account) *Web3Client
NewWeb3Client creates a client, using a keystore and an account for transactions
func NewWeb3ClientWithURL ¶
func NewWeb3ClientWithURL(rpcURL string, ks *keystore.KeyStore, account *accounts.Account) (*Web3Client, error)
NewWeb3Client creates a client, using a keystore and an account for transactions
func (*Web3Client) BalanceInfo ¶
func (w *Web3Client) BalanceInfo() (string, error)
BalanceInfo retieves information about the default account
func (*Web3Client) SendTransactionSync ¶
func (w *Web3Client) SendTransactionSync(to *common.Address, value *big.Int, gasLimit uint64, calldata []byte) (*types.Transaction, *types.Receipt, error)
SendTransactionSync executes a contract method and wait it finalizes