move interface_getter.go from ens_watcher to vDB pkging- used to construct a custom ABI based on results from calls to supportsInterface; also moved fetcher.go from examples to pkg

This commit is contained in:
Ian Norden
2019-01-15 15:49:18 -06:00
parent 59cdaa05e6
commit aa4e698240
10 changed files with 342 additions and 12 deletions
+10
View File
@@ -31,6 +31,7 @@ import (
// It is dependent on etherscan's api
type Parser interface {
Parse(contractAddr string) error
ParseAbiStr(abiStr string) error
Abi() string
ParsedAbi() abi.ABI
GetMethods(wanted []string) []types.Method
@@ -83,6 +84,15 @@ func (p *parser) Parse(contractAddr string) error {
return err
}
// Loads and parses an abi from a given abi string
func (p *parser) ParseAbiStr(abiStr string) error {
var err error
p.abi = abiStr
p.parsedAbi, err = geth.ParseAbi(abiStr)
return err
}
func (p *parser) lookUp(contractAddr string) (string, error) {
if v, ok := constants.Abis[common.HexToAddress(contractAddr)]; ok {
return v, nil