コード例 #1
0
def test_transfer_ownership():
    client = EpochClient()
    name = AEName(random_domain())
    name.full_claim_blocking(keypair)
    assert name.status == AEName.Status.CLAIMED
    client.wait_for_next_block()

    new_key_pair = KeyPair.generate()
    # put some coins into the account so the account is in the state tree
    # otherwise it couldn't become the owner of an address.
    client.spend(keypair, new_key_pair.get_address(), 1)
    client.wait_for_next_block()
    # now transfer the name to the other account
    name.transfer_ownership(keypair, new_key_pair.get_address())
    assert name.status == AEName.Status.TRANSFERRED
    client.wait_for_next_block()
    # try changing the target using that new keypair
    name.update_status()
    name.update(new_key_pair, target=keypair.get_address())
    client.wait_for_next_block()
    name.update_status()
    assert name.pointers != [], 'Pointers should not be empty'
    assert name.pointers['account_pubkey'] == new_key_pair.get_address()
コード例 #2
0
def name_transfer(ctx, address):
    """
    Transfer a name to another account
    """
    # retrieve the domain from the context
    domain = ctx.obj.get(CTX_AET_DOMAIN)
    # retrieve the keypair
    kp, _ = _keypair()
    name = AEName(domain)
    name.update_status()
    if name.status != AEName.Status.CLAIMED:
        print(f"Domain is {name.status} and cannot be transferred")
        exit(0)
    tx = name.transfer_ownership(kp, address)
    _pp([('Transaction hash', tx.tx_hash)],
        title=f"Name {domain} status {name.status}")