public void extractCallableMethods() { //extracts the callable methods names, and their inputs from parsed ABI //creates method objects for all of them and stores them on a hashtable methods //@to-do throws errors if user enters an incorrect ABI Hashtable methods = new Hashtable(); for (int i = 0; i < parsedContractABI.Count; i++) { Hashtable element = parsedContractABI [i] as Hashtable; //check if element is a function if (!element.ContainsKey("constant")) { continue; } //now check what the value of constant //may also need to check the length of inputs if ((element ["constant"] is Boolean) && ((bool)element ["constant"] == false)) { string name = (string)element ["name"]; ArrayList inputs = element ["inputs"] as ArrayList; CallableMethod method = new CallableMethod(name, contractAddress, inputs); methods [name] = method; } } //return a hash table {name: CallableMethod} //could probably replace with a generic callableMethods = methods; }
public void setSelectedMethod(int index) { //Sets the selectedMethod variable string selectedName = methodDropdown.options [index].text; selectedMethod = selectedContract.callableMethods [selectedName] as CallableMethod; //Refresh Text methodDropdown.captionText.text = "Methods"; }