Convertor.set_conversions()

set_conversions(conversions: dict) โ†’ None

Set allowed conversions.

Deletes any previous conversions added to the Convertor. Takes as an argument a dictionary with as keys the convertible types and as values the lists of allowed converted types.

from glider import *

def query():
  # Create a Convertor object 
  convertor = Convertor()

  # Set conversion from address to bytes20
  convertor.set_conversions({"bytes20": ["address", "uint160"]})

  # Fetch a list of functions
  funs = Functions().exec(10)

  # Return the functions with at least one argument convertible to bytes20
  # It will be only the argument of type address
  output = []
  for fun in funs:
    args = fun.arguments().with_type_convertible(["bytes20"], convertor)
    if args:
      output.append(fun)
  return output

Output (first result only):

Last updated