forked from cerc-io/ipld-eth-server
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user