Skip to content

Commit 8b4b0df

Browse files
Fix parameter forwarding in Spot Funding client and mark it as deprecated (#464)
Fixing the forwarding of parameters and marking the funding client as deprecated.
1 parent 6a917fa commit 8b4b0df

1 file changed

Lines changed: 165 additions & 4 deletions

File tree

‎src/kraken/spot/funding.py‎

Lines changed: 165 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,31 @@
1313
from typing import Self
1414

1515
from kraken.base_api import SpotClient, defined
16+
from kraken.utils.utils import deprecated
17+
18+
_FUNDING_LEGACY_NOTE = (
19+
"will remain active but will no longer receive updates. Kraken is"
20+
" introducing a new Funding (Beta) API with stable"
21+
" method/network/address IDs, fee pinning, and cursor pagination."
22+
" Review the Funding guide"
23+
" (https://docs.kraken.com/exchange/guides/rest/funding). This method"
24+
" keeps wrapping the legacy endpoint, so reach the new endpoints"
25+
" through this client's request() method."
26+
)
1627

1728

1829
class Funding(SpotClient):
1930
"""
31+
.. deprecated::
32+
Every endpoint wrapped by this class belongs to Kraken's Funding
33+
(Legacy) API, which will remain active but will no longer receive
34+
updates. Kraken is introducing a new Funding (Beta) API with stable
35+
method/network/address IDs, fee pinning, and cursor pagination.
36+
Review the `Funding guide
37+
<https://docs.kraken.com/exchange/guides/rest/funding>`_. These
38+
methods keep wrapping the legacy endpoints, so reach the new
39+
endpoints through this client's ``request`` method.
40+
2041
Class that implements the Spot Funding client. Currently there are no
2142
funding endpoints that could be accesses without authentication.
2243
@@ -60,13 +81,27 @@ def __enter__(self: Self) -> Self:
6081
super().__enter__()
6182
return self
6283

84+
@deprecated(
85+
f"The 'get_deposit_methods' function uses a deprecated Kraken endpoint,"
86+
f" which {_FUNDING_LEGACY_NOTE}",
87+
)
6388
def get_deposit_methods(
6489
self: Funding,
6590
asset: str,
6691
*,
6792
extra_params: dict | None = None,
6893
) -> list[dict]:
6994
"""
95+
.. deprecated::
96+
This endpoint belongs to Kraken's Funding (Legacy) API, which
97+
will remain active but will no longer receive updates. Kraken is
98+
introducing a new Funding (Beta) API with stable
99+
method/network/address IDs, fee pinning, and cursor pagination.
100+
Review the `Funding guide
101+
<https://docs.kraken.com/exchange/guides/rest/funding>`_. This
102+
method keeps wrapping the legacy endpoint, so reach the new
103+
endpoints through this client's ``request`` method.
104+
70105
Get the available deposit methods for a specific asset.
71106
72107
- https://docs.kraken.com/api/docs/rest-api/get-deposit-methods
@@ -102,6 +137,10 @@ def get_deposit_methods(
102137
extra_params=extra_params,
103138
)
104139

140+
@deprecated(
141+
f"The 'get_deposit_address' function uses a deprecated Kraken endpoint,"
142+
f" which {_FUNDING_LEGACY_NOTE}",
143+
)
105144
def get_deposit_address(
106145
self: Funding,
107146
asset: str,
@@ -111,12 +150,22 @@ def get_deposit_address(
111150
extra_params: dict | None = None,
112151
) -> list[dict]:
113152
"""
153+
.. deprecated::
154+
This endpoint belongs to Kraken's Funding (Legacy) API, which
155+
will remain active but will no longer receive updates. Kraken is
156+
introducing a new Funding (Beta) API with stable
157+
method/network/address IDs, fee pinning, and cursor pagination.
158+
Review the `Funding guide
159+
<https://docs.kraken.com/exchange/guides/rest/funding>`_. This
160+
method keeps wrapping the legacy endpoint, so reach the new
161+
endpoints through this client's ``request`` method.
162+
114163
Get the deposit addresses for a specific asset. New deposit addresses
115164
can be generated.
116165
117166
Requires the ``Deposit funds`` API key permission.
118167
119-
- https://docs.kraken.com/api/docs/rest-api/get-deposit-addresses
168+
- https://docs.kraken.com/api-reference/funding/get-deposit-addresses
120169
121170
:param asset: Asset being deposited
122171
:type asset: str
@@ -155,6 +204,10 @@ def get_deposit_address(
155204
extra_params=extra_params,
156205
)
157206

207+
@deprecated(
208+
f"The 'get_recent_deposits_status' function uses a deprecated Kraken"
209+
f" endpoint, which {_FUNDING_LEGACY_NOTE}",
210+
)
158211
def get_recent_deposits_status(
159212
self: Funding,
160213
asset: str | None = None,
@@ -166,6 +219,16 @@ def get_recent_deposits_status(
166219
extra_params: dict | None = None,
167220
) -> list[dict] | dict:
168221
"""
222+
.. deprecated::
223+
This endpoint belongs to Kraken's Funding (Legacy) API, which
224+
will remain active but will no longer receive updates. Kraken is
225+
introducing a new Funding (Beta) API with stable
226+
method/network/address IDs, fee pinning, and cursor pagination.
227+
Review the `Funding guide
228+
<https://docs.kraken.com/exchange/guides/rest/funding>`_. This
229+
method keeps wrapping the legacy endpoint, so reach the new
230+
endpoints through this client's ``request`` method.
231+
169232
Get information about the recent deposit status. The look back period is
170233
90 days and only the last 25 deposits will be returned.
171234
@@ -248,6 +311,10 @@ def get_recent_deposits_status(
248311
extra_params=extra_params,
249312
)
250313

314+
@deprecated(
315+
f"The 'withdraw_methods' function uses a deprecated Kraken endpoint,"
316+
f" which {_FUNDING_LEGACY_NOTE}",
317+
)
251318
def withdraw_methods(
252319
self: Funding,
253320
asset: str | None = None,
@@ -257,6 +324,16 @@ def withdraw_methods(
257324
extra_params: dict | None = None,
258325
) -> dict:
259326
"""
327+
.. deprecated::
328+
This endpoint belongs to Kraken's Funding (Legacy) API, which
329+
will remain active but will no longer receive updates. Kraken is
330+
introducing a new Funding (Beta) API with stable
331+
method/network/address IDs, fee pinning, and cursor pagination.
332+
Review the `Funding guide
333+
<https://docs.kraken.com/exchange/guides/rest/funding>`_. This
334+
method keeps wrapping the legacy endpoint, so reach the new
335+
endpoints through this client's ``request`` method.
336+
260337
Returns the list of available withdraw methods for that user.
261338
262339
Requires the ``Funds permissions - Query`` and ``Funds permissions -
@@ -275,7 +352,7 @@ def withdraw_methods(
275352
if defined(asset):
276353
params["asset"] = asset
277354
if defined(aclass):
278-
params["network"] = aclass
355+
params["aclass"] = aclass
279356
if defined(network):
280357
params["network"] = network
281358
return self.request( # type: ignore[return-value]
@@ -285,6 +362,10 @@ def withdraw_methods(
285362
extra_params=extra_params,
286363
)
287364

365+
@deprecated(
366+
f"The 'withdraw_addresses' function uses a deprecated Kraken endpoint,"
367+
f" which {_FUNDING_LEGACY_NOTE}",
368+
)
288369
def withdraw_addresses(
289370
self: Funding,
290371
asset: str | None = None,
@@ -296,6 +377,16 @@ def withdraw_addresses(
296377
extra_params: dict | None = None,
297378
) -> dict:
298379
"""
380+
.. deprecated::
381+
This endpoint belongs to Kraken's Funding (Legacy) API, which
382+
will remain active but will no longer receive updates. Kraken is
383+
introducing a new Funding (Beta) API with stable
384+
method/network/address IDs, fee pinning, and cursor pagination.
385+
Review the `Funding guide
386+
<https://docs.kraken.com/exchange/guides/rest/funding>`_. This
387+
method keeps wrapping the legacy endpoint, so reach the new
388+
endpoints through this client's ``request`` method.
389+
299390
Returns the list of available withdrawal addresses for that user.
300391
301392
Requires the ``Funds permissions - Query`` and ``Funds permissions -
@@ -318,7 +409,7 @@ def withdraw_addresses(
318409
if defined(asset):
319410
params["asset"] = asset
320411
if defined(aclass):
321-
params["network"] = aclass
412+
params["aclass"] = aclass
322413
if defined(method):
323414
params["method"] = method
324415
if defined(key):
@@ -327,11 +418,15 @@ def withdraw_addresses(
327418
params["verified"] = verified
328419
return self.request( # type: ignore[return-value]
329420
method="POST",
330-
uri="/0/private/WithdrawMethods",
421+
uri="/0/private/WithdrawAddresses",
331422
params=params,
332423
extra_params=extra_params,
333424
)
334425

426+
@deprecated(
427+
f"The 'get_withdrawal_info' function uses a deprecated Kraken endpoint,"
428+
f" which {_FUNDING_LEGACY_NOTE}",
429+
)
335430
def get_withdrawal_info(
336431
self: Funding,
337432
asset: str,
@@ -341,6 +436,16 @@ def get_withdrawal_info(
341436
extra_params: dict | None = None,
342437
) -> dict:
343438
"""
439+
.. deprecated::
440+
This endpoint belongs to Kraken's Funding (Legacy) API, which
441+
will remain active but will no longer receive updates. Kraken is
442+
introducing a new Funding (Beta) API with stable
443+
method/network/address IDs, fee pinning, and cursor pagination.
444+
Review the `Funding guide
445+
<https://docs.kraken.com/exchange/guides/rest/funding>`_. This
446+
method keeps wrapping the legacy endpoint, so reach the new
447+
endpoints through this client's ``request`` method.
448+
344449
Get information about a possible withdraw, including fee and limit
345450
information. The ``key`` must be the name of the key defined in the
346451
account.
@@ -384,6 +489,10 @@ def get_withdrawal_info(
384489
extra_params=extra_params,
385490
)
386491

492+
@deprecated(
493+
f"The 'withdraw_funds' function uses a deprecated Kraken endpoint,"
494+
f" which {_FUNDING_LEGACY_NOTE}",
495+
)
387496
def withdraw_funds(
388497
self: Funding,
389498
asset: str,
@@ -394,6 +503,16 @@ def withdraw_funds(
394503
extra_params: dict | None = None,
395504
) -> dict:
396505
"""
506+
.. deprecated::
507+
This endpoint belongs to Kraken's Funding (Legacy) API, which
508+
will remain active but will no longer receive updates. Kraken is
509+
introducing a new Funding (Beta) API with stable
510+
method/network/address IDs, fee pinning, and cursor pagination.
511+
Review the `Funding guide
512+
<https://docs.kraken.com/exchange/guides/rest/funding>`_. This
513+
method keeps wrapping the legacy endpoint, so reach the new
514+
endpoints through this client's ``request`` method.
515+
397516
Create a new withdraw. The key must be the name of the withdraw key
398517
defined in the withdraw section of the Kraken WebUI.
399518
@@ -437,6 +556,10 @@ def withdraw_funds(
437556
extra_params=extra_params,
438557
)
439558

559+
@deprecated(
560+
f"The 'get_recent_withdraw_status' function uses a deprecated Kraken"
561+
f" endpoint, which {_FUNDING_LEGACY_NOTE}",
562+
)
440563
def get_recent_withdraw_status(
441564
self: Funding,
442565
asset: str | None = None,
@@ -448,6 +571,16 @@ def get_recent_withdraw_status(
448571
extra_params: dict | None = None,
449572
) -> list[dict]:
450573
"""
574+
.. deprecated::
575+
This endpoint belongs to Kraken's Funding (Legacy) API, which
576+
will remain active but will no longer receive updates. Kraken is
577+
introducing a new Funding (Beta) API with stable
578+
method/network/address IDs, fee pinning, and cursor pagination.
579+
Review the `Funding guide
580+
<https://docs.kraken.com/exchange/guides/rest/funding>`_. This
581+
method keeps wrapping the legacy endpoint, so reach the new
582+
endpoints through this client's ``request`` method.
583+
451584
Get information about the recent withdraw status, including withdraws of
452585
the past 90 days but at max 500 results.
453586
@@ -507,6 +640,10 @@ def get_recent_withdraw_status(
507640
extra_params=extra_params,
508641
)
509642

643+
@deprecated(
644+
f"The 'cancel_withdraw' function uses a deprecated Kraken endpoint,"
645+
f" which {_FUNDING_LEGACY_NOTE}",
646+
)
510647
def cancel_withdraw(
511648
self: Funding,
512649
asset: str,
@@ -515,6 +652,16 @@ def cancel_withdraw(
515652
extra_params: dict | None = None,
516653
) -> dict:
517654
"""
655+
.. deprecated::
656+
This endpoint belongs to Kraken's Funding (Legacy) API, which
657+
will remain active but will no longer receive updates. Kraken is
658+
introducing a new Funding (Beta) API with stable
659+
method/network/address IDs, fee pinning, and cursor pagination.
660+
Review the `Funding guide
661+
<https://docs.kraken.com/exchange/guides/rest/funding>`_. This
662+
method keeps wrapping the legacy endpoint, so reach the new
663+
endpoints through this client's ``request`` method.
664+
518665
Cancel a requested withdraw. This will only be successful if the
519666
withdraw is not being processed so far.
520667
@@ -545,6 +692,10 @@ def cancel_withdraw(
545692
extra_params=extra_params,
546693
)
547694

695+
@deprecated(
696+
f"The 'wallet_transfer' function uses a deprecated Kraken endpoint,"
697+
f" which {_FUNDING_LEGACY_NOTE}",
698+
)
548699
def wallet_transfer(
549700
self: Funding,
550701
asset: str,
@@ -555,6 +706,16 @@ def wallet_transfer(
555706
extra_params: dict | None = None,
556707
) -> dict:
557708
"""
709+
.. deprecated::
710+
This endpoint belongs to Kraken's Funding (Legacy) API, which
711+
will remain active but will no longer receive updates. Kraken is
712+
introducing a new Funding (Beta) API with stable
713+
method/network/address IDs, fee pinning, and cursor pagination.
714+
Review the `Funding guide
715+
<https://docs.kraken.com/exchange/guides/rest/funding>`_. This
716+
method keeps wrapping the legacy endpoint, so reach the new
717+
endpoints through this client's ``request`` method.
718+
558719
Transfer assets between the Spot and Futures wallet.
559720
560721
Requires the ``Withdraw funds`` API key permissions.

0 commit comments

Comments
 (0)