コード例 #1
0
                        if str(k) == "inputs":
                            inputs = str(v)
                        if str(k) == "outputs":
                            outputs = str(v)

        print("Type: " + typeOuter)
        print("Name: " + nameOuter)
        print("Inputs" + inputs)
        print("Outputs" + outputs)
        print("\n")


# Test the sorting and hashing of all ABIs in the abiUrls list (please add any new oddly ordered ABIs to that list so that we can ensure this code is robust)
outputHashes = []
for singleAbiUrl in abiUrls:
    singleAbiString = requests.get(singleAbiUrl).content
    singleAbiJSON = json.loads(singleAbiString)
    abiWithSortedInternals = sortInternalListsInJsonObject(singleAbiJSON)
    abiWithSortedKeys = sortABIKeys(abiWithSortedInternals)

    abiFullySorted = sort(abiWithSortedKeys)
    sanitizedString = harvester.sanitizeString(json.dumps(abiFullySorted))
    print("ABI")
    print(sanitizedString)
    hashOfAbi = harvester.createHashFromString(sanitizedString)
    outputHashes.append(hashOfAbi)

print("Output hashes are as follows, these should all be exactly the same")
for singleHash in outputHashes:
    print(singleHash)