DestinationTransferPeerPath default id value for ONE_TIME_ADDRESS
pumpstation opened this issue · comments
class DestinationTransferPeerPath(TransferPeerPath):
def __init__(self, peer_type, peer_id=None, one_time_address=None):
"""Defines a destination for a transfer
Args:
peer_type (str): either VAULT_ACCOUNT, EXCHANGE_ACCOUNT, INTERNAL_WALLET, EXTERNAL_WALLET, FIAT_ACCOUNT, NETWORK_CONNECTION, ONE_TIME_ADDRESS or UNKNOWN_PEER
peer_id (str): the account/wallet id
one_time_address (JSON object): The destination address (and tag) for a non whitelisted address.
"""
TransferPeerPath.__init__(self, peer_type, peer_id)
if one_time_address != None:
self.oneTimeAddress = one_time_address
Default value of peer_id is None . So if I try to create transaction to ONE_TIME_ADDRESS destination like this:
destination = DestinationTransferPeerPath(peer_type='ONE_TIME_ADDRESS',
one_time_address={'address': destination_address})
I get the following error:
Got an error from fireblocks server: {"message":"Destination ID must not be provided for one time address transactions","code":1409}
The only way to avoid the error is to delete id attribute.
del destination.id
This is because the dict method of DestinationTransferPeerPath converts a None id attribute to a 'None' string like so:
>>> test = DestinationTransferPeerPath(ONE_TIME_ADDRESS, one_time_address={'address': 'some_destination_address'})
>>> test.__dict__
{'type': 'ONE_TIME_ADDRESS', 'id': 'None', 'oneTimeAddress': {'address': 'some_destination_address'}}
So the API thinks we're specifying an ID called 'None'
I can see it's not reproduced in latest versions (checked your test case, it returns correct dictionary)
Please reopen if problem still exists in latest versions