cic-go/batch_balance/batch_balance.go
Mohammed Sohail c34e1444dc
add: implement and test
changes to contract:
- returns 0 instead of false error status
- func return type is []big.Int
2022-05-17 16:06:19 +03:00

33 lines
568 B
Go

package balance
import (
"github.com/ethereum/go-ethereum/common"
"github.com/lmittmann/w3"
)
type BatchBalance struct {
ethClient *w3.Client
batchContract common.Address
}
func NewBatchBalance(rpcEndpoint string, batchContract common.Address) (*BatchBalance, error) {
ethClient, err := w3.Dial(rpcEndpoint)
if err != nil {
return nil, err
}
return &BatchBalance{
ethClient: ethClient,
batchContract: batchContract,
}, nil
}
func (c *BatchBalance) Close() error {
err := c.ethClient.Close()
if err != nil {
return err
}
return nil
}