Skip to content

feat: complete typed Funding (Beta) API - #105

Merged
nyg merged 1 commit into
masterfrom
nyg/funding-beta-feature-7821e1
Sep 21, 2026
Merged

nyg merged 1 commit into
masterfrom
nyg/funding-beta-feature-7821e1

Conversation

@nyg

@nyg nyg commented Sep 21, 2026

Copy link
Copy Markdown
Owner

Completes the 15 Funding (Beta) operations from #82 with typed endpoints, parameter builders, response records and KrakenAPI methods: Calculate Funding Fees, List Funding Methods, List Funding Assets, List Funding Networks, List Funding Deposit Limits, List Funding Withdrawal Limits, Claim Funding Deposit Address, List Funding Claimed Addresses (v2), List Funding Deposits, List/Create/Update/Delete Funding Address, and List/Create Funding Withdrawal. They live in a new fundingbeta/ package with the usual {Name}Endpoint, params/ and response/ layout.

Endpoint model. These operations don't fit PublicEndpoint or PrivateEndpoint, so a third base class, FundingBetaEndpoint<T>, handles:

  • any HTTP method (GET, POST, PUT, DELETE) on /funding/{path}, with path parameters percent-encoded by the endpoint
  • query parameters from FundingBetaParams, with nested objects in the bracket notation Kraken documents, e.g. asset[class]=currency&scope[method_id]=…
  • an optional JSON body
  • the nonce in the API-Nonce header rather than the body
  • a signature over the path including its query string: KrakenCredentials.sign(signedPath, nonce, body) is the new overload, and the existing sign(URL, …) now delegates to it
  • responses without the {error, result} envelope, deserialized from the whole body

HTTP error statuses become a KrakenException whose only error is the status code followed by the response body. KrakenRestRequester gains execute(FundingBetaEndpoint, …) as a default method throwing UnsupportedOperationException, so existing custom requesters keep compiling. KrakenAPI.query(FundingBetaEndpoint) lets users run their own Funding (Beta) endpoints.

Signing. The signing rules come from Kraken's Funding (Beta) guide and match Kraken's api-go SDK. Tests check signatures against digests computed with the guide's Python helper, for both a GET with a query string and a POST with a JSON body. One requester test uses real credentials end to end, from the endpoint URL to the API-Sign header.

Types. Asset, AssetAmount and Scope (method, network or network group, created through Scope.method/network/networkGroup) are shared by parameters and responses. Amounts use BigDecimal, times use Instant, and limit time windows use Duration. Limit values are a count for attempt/success limits or amounts otherwise: Kraken sends both shapes, and a small deserializer reads them. Address details cover crypto addresses, fiat addresses and beneficiaries. Every enum falls back to UNKNOWN.

Validation before any connection opens. Create Funding Withdrawal rejects a fee token combined with maxFee, and a token or maxFee without feeIncluded. Create Funding Withdrawal and List Funding Claimed Addresses reject network group scopes, which Kraken doesn't accept there.

Not covered. The status filter of List Funding Deposits is left out. Its schema is a list/range object declared with style: form, unlike the other nested filters, and neither the spec nor the guide shows how it is encoded. Sending a guessed encoding could filter the wrong deposits without any error.

Validation. Temurin 25 mvnd -B clean package passes for both modules with 453 tests, 121 of them new. The library Javadoc jar passes with doclint=all,-missing. Fixtures are the Spot REST OpenAPI 1.1.0 examples, plus schema-based fixtures for Update and Delete Funding Address, which have no example. Tests use mocked connections, with no API keys, network calls, addresses or withdrawals. README, AGENTS.md and ARCHITECTURE.md (with a new sequence diagram) describe the new group. SimpleExamples lists USDC withdrawal methods.

Refs #82; the umbrella issue stays open for the remaining unit test coverage.

@nyg
nyg force-pushed the nyg/funding-beta-feature-7821e1 branch from 00ba4d2 to d0a1623 Compare September 21, 2026 17:05
@nyg
nyg merged commit 386b448 into master Sep 21, 2026
1 check passed
@nyg
nyg deleted the nyg/funding-beta-feature-7821e1 branch September 21, 2026 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant