github.com/iotexproject/iotex-core@v1.14.1-rc1/action/protocol/abiutil/abiutil.go (about)

     1  package abiutil
     2  
     3  import (
     4  	"strings"
     5  
     6  	"github.com/ethereum/go-ethereum/accounts/abi"
     7  )
     8  
     9  // MustLoadMethod must load abi method
    10  func MustLoadMethod(abiStr, method string) abi.Method {
    11  	_interface, err := abi.JSON(strings.NewReader(abiStr))
    12  	if err != nil {
    13  		panic(err)
    14  	}
    15  	_method, ok := _interface.Methods[method]
    16  	if !ok {
    17  		panic("fail to load the method")
    18  	}
    19  	return _method
    20  }