def get_candidates(self, engine: contracts.ApplicationEngine) -> None: array = vm.ArrayStackItem(engine.reference_counter) for k, v in self._get_candidates(engine.snapshot): struct = vm.StructStackItem(engine.reference_counter) struct.append(vm.ByteStringStackItem(k.to_array())) struct.append(vm.IntegerStackItem(v)) array.append(struct) engine.push(array)
def get_candidates(self, engine: contracts.ApplicationEngine) -> None: """ Fetch all registered candidates, convert them to a StackItem and push them onto the evaluation stack. """ array = vm.ArrayStackItem(engine.reference_counter) for k, v in self._get_candidates(engine.snapshot): struct = vm.StructStackItem(engine.reference_counter) struct.append(vm.ByteStringStackItem(k.to_array())) struct.append(vm.IntegerStackItem(v)) array.append(struct) engine.push(array)