Exemple #1
0
def create_transfer(recipient, amount):
    '''
    Create the transfer transaction (v2) with the mosaics.

    :param recipient: Address to which XQC will be sent.
    :param amount: Number of XQC to send.
    '''

    time_stamp = nem.new_time_stamp()
    mosaic = nem.Mosaic(MOSAIC_DEFINITION.mosaic_id, int(amount))

    return nem.TransferTransaction(time_stamp=time_stamp,
                                   signature='',
                                   fee=estimate_fee(mosaic),
                                   type=nem.Transfer,
                                   deadline=time_stamp +
                                   datetime.timedelta(hours=1).seconds,
                                   version=nem.TestNetworkVersion,
                                   signer=CONFIG['public_key'],
                                   relative_version=2,
                                   amount=0,
                                   recipient=recipient,
                                   message=MESSAGE,
                                   mosaics=[mosaic])
Exemple #2
0
def transfer_max_error():
    '''Return a bad request.'''

    return nem.Error(nem.new_time_stamp(), "FAILURE_TRANSFER_MAX_EXCEEDED",
                     None, 400)
Exemple #3
0
def invalid_amount_error():
    '''Return am invalid amount error.'''

    return nem.Error(nem.new_time_stamp(), "FAILURE_INVALID_AMOUNT",
                     "Amount must be greater than 0.", 400)
Exemple #4
0
def daily_max_error():
    '''Return a bad request.'''

    return nem.Error(nem.new_time_stamp(), "FAILURE_DAILY_MAX_EXCEEDED", None,
                     400)
Exemple #5
0
def bad_request_error():
    '''Return a bad request.'''

    return nem.Error(nem.new_time_stamp(), "BAD_REQUEST", None, 400)