def land_init(index: int, owner: UInt160) -> dict: seed = get_seed(index) land = { "seed": seed, "owner": owner, "index": "i_" + itoa(index), "wood": get_rand(seed[0]), "wheat": get_rand(seed[1]), "gold": get_rand(seed[2]), "stone": get_rand(seed[3]), "water": get_rand(seed[4]), "genesis": get_time } return land
def getRecipientStreams(recipient: UInt160) -> str: """ Get all streams where address is recipient Args: recipient (UInt160): address as UInt160 Returns: str: JSON array of stream IDs """ recipient64 = base64_encode(recipient) streams = find('byrecipient/' + recipient64) ret = '' while streams.next(): ret = ret + itoa(cast(bytes, streams.value[1]).to_int()) + ',' if len(ret) > 0: ret = '[' + ret[:-1] return ret + ']' return '[]'
def getSenderStreams(sender: UInt160) -> str: """ Get all streams where address is sender Args: sender (UInt160): address as UInt160 Returns: str: JSON array of stream IDs """ sender64 = base64_encode(sender) streams = find('bysender/' + sender64) ret = '' while streams.next(): ret = ret + itoa(cast(bytes, streams.value[1]).to_int()) + ',' if len(ret) > 0: ret = '[' + ret[:-1] return ret + ']' return '[]'
def main(value: int) -> str: return itoa(value)
def main(): itoa('123', 10)
def main(): itoa(123, 10, 10)
def main(): itoa()
def main(value: int, base: int) -> str: return itoa(value, base)