示例#1
0
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
示例#2
0
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 '[]'
示例#3
0
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 '[]'
示例#4
0
def main(value: int) -> str:
    return itoa(value)
示例#5
0
def main():
    itoa('123', 10)
def main():
    itoa(123, 10, 10)
def main():
    itoa()
示例#8
0
def main(value: int, base: int) -> str:
    return itoa(value, base)