adjusted FetchContractData to work with variable number of contract method arguments, changed fetcher's FetchSupply method to more general FetchBigInt method and added FetchBool and FetchAddress methods
This commit is contained in:
@@ -80,8 +80,15 @@ var _ = Describe("Reading contracts", func() {
|
||||
|
||||
contract := testing.SampleContract()
|
||||
var balance = new(big.Int)
|
||||
args := common.HexToHash("0xd26114cd6ee289accf82350c8d8487fedb8a0c07")
|
||||
err = blockChain.FetchContractData(contract.Abi, "0xd26114cd6ee289accf82350c8d8487fedb8a0c07", "balanceOf", args, &balance, 5167471)
|
||||
|
||||
arg := common.HexToHash("0xd26114cd6ee289accf82350c8d8487fedb8a0c07")
|
||||
hashArgs := []common.Hash{arg}
|
||||
balanceOfArgs := make([]interface{}, len(hashArgs))
|
||||
for i, s := range hashArgs {
|
||||
balanceOfArgs[i] = s
|
||||
}
|
||||
|
||||
err = blockChain.FetchContractData(contract.Abi, "0xd26114cd6ee289accf82350c8d8487fedb8a0c07", "balanceOf", balanceOfArgs, &balance, 5167471)
|
||||
Expect(err).NotTo(HaveOccurred())
|
||||
expected := new(big.Int)
|
||||
expected.SetString("10897295492887612977137", 10)
|
||||
|
||||
Reference in New Issue
Block a user