Skip to content

Commit

Permalink
Merge pull request #12 from sethforprivacy/patch-5
Browse files Browse the repository at this point in the history
Properly request a new address with each deposit
  • Loading branch information
Keeqler authored Oct 15, 2024
2 parents 4d48a64 + 7524579 commit 155d0ec
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/autoforward.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,18 @@ def get_new_kraken_address(asset: Literal['XBT', 'XMR']) -> str:

result = util.kraken_request('/0/private/DepositAddresses', payload)

for address in result:
if address.get('new'):
return address['address']
first_new_address = next((addr for addr in result if addr.get('new', False)), None)
if first_new_address:
return(first_new_address['address'])
else:
payload = {
'asset': asset,
'method': 'Bitcoin' if asset == 'XBT' else 'Monero',
'new': True
}
result = util.kraken_request('/0/private/DepositAddresses', payload)
first_new_address = next((addr for addr in result if addr.get('new', False)), None)
return(first_new_address['address'])

raise Exception(f'Kraken did not return a new address: {json.dumps(result, indent=2)}')

Expand Down

0 comments on commit 155d0ec

Please sign in to comment.