diff --git a/src/main/java/co/dfns/sdk/DfnsAsyncClient.java b/src/main/java/co/dfns/sdk/DfnsAsyncClient.java index c49d907..51be687 100644 --- a/src/main/java/co/dfns/sdk/DfnsAsyncClient.java +++ b/src/main/java/co/dfns/sdk/DfnsAsyncClient.java @@ -1,6 +1,7 @@ package co.dfns.sdk; import co.dfns.sdk.internal.DfnsHttpClient; +import co.dfns.sdk.addresswatches.AddressWatchesAsyncClient; import co.dfns.sdk.agreements.AgreementsAsyncClient; import co.dfns.sdk.allocations.AllocationsAsyncClient; import co.dfns.sdk.auth.AuthAsyncClient; @@ -22,6 +23,7 @@ /** Dfns async SDK client. Provides access to all Dfns API domains. */ public class DfnsAsyncClient implements AutoCloseable { private final DfnsHttpClient httpClient; + public final AddressWatchesAsyncClient addressWatches; public final AgreementsAsyncClient agreements; public final AllocationsAsyncClient allocations; public final AuthAsyncClient auth; @@ -42,6 +44,7 @@ public class DfnsAsyncClient implements AutoCloseable { public DfnsAsyncClient(DfnsClientConfig config) { this.httpClient = new DfnsHttpClient(config); + this.addressWatches = new AddressWatchesAsyncClient(httpClient); this.agreements = new AgreementsAsyncClient(httpClient); this.allocations = new AllocationsAsyncClient(httpClient); this.auth = new AuthAsyncClient(httpClient); diff --git a/src/main/java/co/dfns/sdk/DfnsClient.java b/src/main/java/co/dfns/sdk/DfnsClient.java index 63ff7e6..d3e907d 100644 --- a/src/main/java/co/dfns/sdk/DfnsClient.java +++ b/src/main/java/co/dfns/sdk/DfnsClient.java @@ -1,6 +1,7 @@ package co.dfns.sdk; import co.dfns.sdk.internal.DfnsHttpClient; +import co.dfns.sdk.addresswatches.AddressWatchesClient; import co.dfns.sdk.agreements.AgreementsClient; import co.dfns.sdk.allocations.AllocationsClient; import co.dfns.sdk.auth.AuthClient; @@ -22,6 +23,7 @@ /** Dfns SDK client. Provides access to all Dfns API domains. */ public class DfnsClient implements AutoCloseable { private final DfnsHttpClient httpClient; + public final AddressWatchesClient addressWatches; public final AgreementsClient agreements; public final AllocationsClient allocations; public final AuthClient auth; @@ -42,6 +44,7 @@ public class DfnsClient implements AutoCloseable { public DfnsClient(DfnsClientConfig config) { this.httpClient = new DfnsHttpClient(config); + this.addressWatches = new AddressWatchesClient(httpClient); this.agreements = new AgreementsClient(httpClient); this.allocations = new AllocationsClient(httpClient); this.auth = new AuthClient(httpClient); diff --git a/src/main/java/co/dfns/sdk/DfnsClientConfig.java b/src/main/java/co/dfns/sdk/DfnsClientConfig.java index f6d2336..d151f55 100644 --- a/src/main/java/co/dfns/sdk/DfnsClientConfig.java +++ b/src/main/java/co/dfns/sdk/DfnsClientConfig.java @@ -1,6 +1,7 @@ package co.dfns.sdk; import co.dfns.sdk.auth.Signer; +import java.net.URI; import java.time.Duration; /** Configuration for all Dfns SDK clients. Build via {@link #builder()}. */ @@ -11,7 +12,7 @@ public class DfnsClientConfig { private final Duration requestTimeout; private DfnsClientConfig(Builder b) { - this.baseUrl = b.baseUrl; + this.baseUrl = normalizeBaseUrl(b.baseUrl); this.authToken = b.authToken; this.signer = b.signer; this.requestTimeout = b.requestTimeout; @@ -22,6 +23,26 @@ private DfnsClientConfig(Builder b) { public Signer getSigner() { return signer; } public Duration getRequestTimeout() { return requestTimeout; } + private static String normalizeBaseUrl(String baseUrl) { + if (baseUrl == null || baseUrl.isBlank()) + throw new IllegalStateException("baseUrl is required"); + + URI uri; + try { + uri = URI.create(baseUrl); + } catch (IllegalArgumentException e) { + throw new IllegalStateException("baseUrl must be a valid absolute URL", e); + } + if (!uri.isAbsolute() || uri.getHost() == null) + throw new IllegalStateException("baseUrl must be an absolute URL"); + if (uri.getRawQuery() != null) + throw new IllegalStateException("baseUrl must not include a query"); + if (uri.getRawFragment() != null) + throw new IllegalStateException("baseUrl must not include a fragment"); + + return baseUrl.replaceAll("/+$", ""); + } + public static Builder builder() { return new Builder(); } public static class Builder { diff --git a/src/main/java/co/dfns/sdk/DfnsDelegatedAsyncClient.java b/src/main/java/co/dfns/sdk/DfnsDelegatedAsyncClient.java index 12a2838..43c0792 100644 --- a/src/main/java/co/dfns/sdk/DfnsDelegatedAsyncClient.java +++ b/src/main/java/co/dfns/sdk/DfnsDelegatedAsyncClient.java @@ -1,6 +1,7 @@ package co.dfns.sdk; import co.dfns.sdk.internal.DfnsHttpClient; +import co.dfns.sdk.addresswatches.DelegatedAddressWatchesAsyncClient; import co.dfns.sdk.agreements.DelegatedAgreementsAsyncClient; import co.dfns.sdk.allocations.DelegatedAllocationsAsyncClient; import co.dfns.sdk.auth.DelegatedAuthAsyncClient; @@ -26,6 +27,7 @@ */ public class DfnsDelegatedAsyncClient implements AutoCloseable { private final DfnsHttpClient httpClient; + public final DelegatedAddressWatchesAsyncClient addressWatches; public final DelegatedAgreementsAsyncClient agreements; public final DelegatedAllocationsAsyncClient allocations; public final DelegatedAuthAsyncClient auth; @@ -46,6 +48,7 @@ public class DfnsDelegatedAsyncClient implements AutoCloseable { public DfnsDelegatedAsyncClient(DfnsClientConfig config) { this.httpClient = new DfnsHttpClient(config); + this.addressWatches = new DelegatedAddressWatchesAsyncClient(httpClient); this.agreements = new DelegatedAgreementsAsyncClient(httpClient); this.allocations = new DelegatedAllocationsAsyncClient(httpClient); this.auth = new DelegatedAuthAsyncClient(httpClient); diff --git a/src/main/java/co/dfns/sdk/DfnsDelegatedClient.java b/src/main/java/co/dfns/sdk/DfnsDelegatedClient.java index c4e3c32..b5e1052 100644 --- a/src/main/java/co/dfns/sdk/DfnsDelegatedClient.java +++ b/src/main/java/co/dfns/sdk/DfnsDelegatedClient.java @@ -1,6 +1,7 @@ package co.dfns.sdk; import co.dfns.sdk.internal.DfnsHttpClient; +import co.dfns.sdk.addresswatches.DelegatedAddressWatchesClient; import co.dfns.sdk.agreements.DelegatedAgreementsClient; import co.dfns.sdk.allocations.DelegatedAllocationsClient; import co.dfns.sdk.auth.DelegatedAuthClient; @@ -26,6 +27,7 @@ */ public class DfnsDelegatedClient implements AutoCloseable { private final DfnsHttpClient httpClient; + public final DelegatedAddressWatchesClient addressWatches; public final DelegatedAgreementsClient agreements; public final DelegatedAllocationsClient allocations; public final DelegatedAuthClient auth; @@ -46,6 +48,7 @@ public class DfnsDelegatedClient implements AutoCloseable { public DfnsDelegatedClient(DfnsClientConfig config) { this.httpClient = new DfnsHttpClient(config); + this.addressWatches = new DelegatedAddressWatchesClient(httpClient); this.agreements = new DelegatedAgreementsClient(httpClient); this.allocations = new DelegatedAllocationsClient(httpClient); this.auth = new DelegatedAuthClient(httpClient); diff --git a/src/main/java/co/dfns/sdk/addresswatches/AddressWatchesAsyncClient.java b/src/main/java/co/dfns/sdk/addresswatches/AddressWatchesAsyncClient.java new file mode 100644 index 0000000..36fca93 --- /dev/null +++ b/src/main/java/co/dfns/sdk/addresswatches/AddressWatchesAsyncClient.java @@ -0,0 +1,46 @@ +package co.dfns.sdk.addresswatches; + +import co.dfns.sdk.internal.DfnsHttpClient; +import co.dfns.sdk.addresswatches.model.*; +import java.util.List; +import co.dfns.sdk.PaginatedList; +import java.util.Map; +import java.util.concurrent.CompletableFuture; + +public class AddressWatchesAsyncClient { + private final DfnsHttpClient httpClient; + + public AddressWatchesAsyncClient(DfnsHttpClient httpClient) { + this.httpClient = httpClient; + } + + /** List Address Watches */ + public CompletableFuture> listAddressWatches(ListAddressWatchesQuery query) { + return httpClient.getAsync("/address-watches", query.toMap(), new com.fasterxml.jackson.core.type.TypeReference>() {}); + } + + /** Create Address Watch */ + public CompletableFuture createAddressWatch(CreateAddressWatchRequest body) { + return httpClient.postAsync("/address-watches", java.util.Map.of(), body, AddressWatch.class, true); + } + + /** Get Address Watch */ + public CompletableFuture getAddressWatch(String addressWatchId) { + return httpClient.getAsync("/address-watches/" + addressWatchId, java.util.Map.of(), AddressWatch.class); + } + + /** Get Address Watch Assets */ + public CompletableFuture getAddressWatchAssets(String addressWatchId, GetAddressWatchAssetsQuery query) { + return httpClient.getAsync("/address-watches/" + addressWatchId + "/assets", query.toMap(), GetAddressWatchAssetsResponse.class); + } + + /** Get Address Watch Blockchain Events */ + public CompletableFuture getAddressWatchBlockchainEvents(String addressWatchId, GetAddressWatchBlockchainEventsQuery query) { + return httpClient.getAsync("/address-watches/" + addressWatchId + "/blockchain-events", query.toMap(), GetAddressWatchBlockchainEventsResponse.class); + } + + /** Get Address Watch History */ + public CompletableFuture getAddressWatchHistory(String addressWatchId, GetAddressWatchHistoryQuery query) { + return httpClient.getAsync("/address-watches/" + addressWatchId + "/history", query.toMap(), GetAddressWatchHistoryResponse.class); + } +} diff --git a/src/main/java/co/dfns/sdk/addresswatches/AddressWatchesClient.java b/src/main/java/co/dfns/sdk/addresswatches/AddressWatchesClient.java new file mode 100644 index 0000000..b74f3c3 --- /dev/null +++ b/src/main/java/co/dfns/sdk/addresswatches/AddressWatchesClient.java @@ -0,0 +1,45 @@ +package co.dfns.sdk.addresswatches; + +import co.dfns.sdk.internal.DfnsHttpClient; +import co.dfns.sdk.addresswatches.model.*; +import java.util.List; +import co.dfns.sdk.PaginatedList; +import java.util.Map; + +public class AddressWatchesClient { + private final DfnsHttpClient httpClient; + + public AddressWatchesClient(DfnsHttpClient httpClient) { + this.httpClient = httpClient; + } + + /** List Address Watches */ + public PaginatedList listAddressWatches(ListAddressWatchesQuery query) { + return httpClient.get("/address-watches", query.toMap(), new com.fasterxml.jackson.core.type.TypeReference>() {}); + } + + /** Create Address Watch */ + public AddressWatch createAddressWatch(CreateAddressWatchRequest body) { + return httpClient.post("/address-watches", java.util.Map.of(), body, AddressWatch.class, true); + } + + /** Get Address Watch */ + public AddressWatch getAddressWatch(String addressWatchId) { + return httpClient.get("/address-watches/" + addressWatchId, java.util.Map.of(), AddressWatch.class); + } + + /** Get Address Watch Assets */ + public GetAddressWatchAssetsResponse getAddressWatchAssets(String addressWatchId, GetAddressWatchAssetsQuery query) { + return httpClient.get("/address-watches/" + addressWatchId + "/assets", query.toMap(), GetAddressWatchAssetsResponse.class); + } + + /** Get Address Watch Blockchain Events */ + public GetAddressWatchBlockchainEventsResponse getAddressWatchBlockchainEvents(String addressWatchId, GetAddressWatchBlockchainEventsQuery query) { + return httpClient.get("/address-watches/" + addressWatchId + "/blockchain-events", query.toMap(), GetAddressWatchBlockchainEventsResponse.class); + } + + /** Get Address Watch History */ + public GetAddressWatchHistoryResponse getAddressWatchHistory(String addressWatchId, GetAddressWatchHistoryQuery query) { + return httpClient.get("/address-watches/" + addressWatchId + "/history", query.toMap(), GetAddressWatchHistoryResponse.class); + } +} diff --git a/src/main/java/co/dfns/sdk/addresswatches/DelegatedAddressWatchesAsyncClient.java b/src/main/java/co/dfns/sdk/addresswatches/DelegatedAddressWatchesAsyncClient.java new file mode 100644 index 0000000..e625e86 --- /dev/null +++ b/src/main/java/co/dfns/sdk/addresswatches/DelegatedAddressWatchesAsyncClient.java @@ -0,0 +1,54 @@ +package co.dfns.sdk.addresswatches; + +import co.dfns.sdk.internal.DfnsHttpClient; +import co.dfns.sdk.addresswatches.model.*; +import java.util.List; +import co.dfns.sdk.PaginatedList; +import java.util.Map; +import java.util.concurrent.CompletableFuture; +import co.dfns.sdk.auth.UserActionChallenge; +import co.dfns.sdk.auth.CredentialAssertion; + +public class DelegatedAddressWatchesAsyncClient { + private final DfnsHttpClient httpClient; + + public DelegatedAddressWatchesAsyncClient(DfnsHttpClient httpClient) { + this.httpClient = httpClient; + } + + /** List Address Watches */ + public CompletableFuture> listAddressWatches(ListAddressWatchesQuery query) { + return httpClient.getAsync("/address-watches", query.toMap(), new com.fasterxml.jackson.core.type.TypeReference>() {}); + } + + /** Delegated signing step 1 for Create Address Watch: returns the challenge to sign out-of-band. */ + public CompletableFuture createAddressWatchInit(CreateAddressWatchRequest body) { + return httpClient.createUserActionChallengeAsync("POST", "/address-watches", body); + } + + /** Delegated signing step 2 for Create Address Watch: submits the signed challenge and issues the request. */ + public CompletableFuture createAddressWatchComplete(CreateAddressWatchRequest body, String challengeIdentifier, CredentialAssertion assertion) { + return httpClient.completeUserActionSigningAsync(challengeIdentifier, assertion) + .thenCompose(userAction -> httpClient.executeWithUserActionAsync("POST", "/address-watches", java.util.Map.of(), body, AddressWatch.class, userAction)); + } + + /** Get Address Watch */ + public CompletableFuture getAddressWatch(String addressWatchId) { + return httpClient.getAsync("/address-watches/" + addressWatchId, java.util.Map.of(), AddressWatch.class); + } + + /** Get Address Watch Assets */ + public CompletableFuture getAddressWatchAssets(String addressWatchId, GetAddressWatchAssetsQuery query) { + return httpClient.getAsync("/address-watches/" + addressWatchId + "/assets", query.toMap(), GetAddressWatchAssetsResponse.class); + } + + /** Get Address Watch Blockchain Events */ + public CompletableFuture getAddressWatchBlockchainEvents(String addressWatchId, GetAddressWatchBlockchainEventsQuery query) { + return httpClient.getAsync("/address-watches/" + addressWatchId + "/blockchain-events", query.toMap(), GetAddressWatchBlockchainEventsResponse.class); + } + + /** Get Address Watch History */ + public CompletableFuture getAddressWatchHistory(String addressWatchId, GetAddressWatchHistoryQuery query) { + return httpClient.getAsync("/address-watches/" + addressWatchId + "/history", query.toMap(), GetAddressWatchHistoryResponse.class); + } +} diff --git a/src/main/java/co/dfns/sdk/addresswatches/DelegatedAddressWatchesClient.java b/src/main/java/co/dfns/sdk/addresswatches/DelegatedAddressWatchesClient.java new file mode 100644 index 0000000..e5fd364 --- /dev/null +++ b/src/main/java/co/dfns/sdk/addresswatches/DelegatedAddressWatchesClient.java @@ -0,0 +1,53 @@ +package co.dfns.sdk.addresswatches; + +import co.dfns.sdk.internal.DfnsHttpClient; +import co.dfns.sdk.addresswatches.model.*; +import java.util.List; +import co.dfns.sdk.PaginatedList; +import java.util.Map; +import co.dfns.sdk.auth.UserActionChallenge; +import co.dfns.sdk.auth.CredentialAssertion; + +public class DelegatedAddressWatchesClient { + private final DfnsHttpClient httpClient; + + public DelegatedAddressWatchesClient(DfnsHttpClient httpClient) { + this.httpClient = httpClient; + } + + /** List Address Watches */ + public PaginatedList listAddressWatches(ListAddressWatchesQuery query) { + return httpClient.get("/address-watches", query.toMap(), new com.fasterxml.jackson.core.type.TypeReference>() {}); + } + + /** Delegated signing step 1 for Create Address Watch: returns the challenge to sign out-of-band. */ + public UserActionChallenge createAddressWatchInit(CreateAddressWatchRequest body) { + return httpClient.createUserActionChallenge("POST", "/address-watches", body); + } + + /** Delegated signing step 2 for Create Address Watch: submits the signed challenge and issues the request. */ + public AddressWatch createAddressWatchComplete(CreateAddressWatchRequest body, String challengeIdentifier, CredentialAssertion assertion) { + String userAction = httpClient.completeUserActionSigning(challengeIdentifier, assertion); + return httpClient.executeWithUserAction("POST", "/address-watches", java.util.Map.of(), body, AddressWatch.class, userAction); + } + + /** Get Address Watch */ + public AddressWatch getAddressWatch(String addressWatchId) { + return httpClient.get("/address-watches/" + addressWatchId, java.util.Map.of(), AddressWatch.class); + } + + /** Get Address Watch Assets */ + public GetAddressWatchAssetsResponse getAddressWatchAssets(String addressWatchId, GetAddressWatchAssetsQuery query) { + return httpClient.get("/address-watches/" + addressWatchId + "/assets", query.toMap(), GetAddressWatchAssetsResponse.class); + } + + /** Get Address Watch Blockchain Events */ + public GetAddressWatchBlockchainEventsResponse getAddressWatchBlockchainEvents(String addressWatchId, GetAddressWatchBlockchainEventsQuery query) { + return httpClient.get("/address-watches/" + addressWatchId + "/blockchain-events", query.toMap(), GetAddressWatchBlockchainEventsResponse.class); + } + + /** Get Address Watch History */ + public GetAddressWatchHistoryResponse getAddressWatchHistory(String addressWatchId, GetAddressWatchHistoryQuery query) { + return httpClient.get("/address-watches/" + addressWatchId + "/history", query.toMap(), GetAddressWatchHistoryResponse.class); + } +} diff --git a/src/main/java/co/dfns/sdk/addresswatches/model/AddressWatch.java b/src/main/java/co/dfns/sdk/addresswatches/model/AddressWatch.java new file mode 100644 index 0000000..cd1f9a5 --- /dev/null +++ b/src/main/java/co/dfns/sdk/addresswatches/model/AddressWatch.java @@ -0,0 +1,22 @@ +package co.dfns.sdk.addresswatches.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonInclude; +import java.util.List; + +@JsonIgnoreProperties(ignoreUnknown = true) +public record AddressWatch( + @JsonProperty("id") String id, + @JsonProperty("network") Network network, + @JsonProperty("address") String address, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("name") String name, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("externalId") String externalId, + @JsonProperty("tags") List tags, + @JsonProperty("status") String status, + @JsonProperty("dateCreated") String dateCreated, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("dateDeleted") String dateDeleted +) {} diff --git a/src/main/java/co/dfns/sdk/addresswatches/model/AddressWatchBlockchainEvent.java b/src/main/java/co/dfns/sdk/addresswatches/model/AddressWatchBlockchainEvent.java new file mode 100644 index 0000000..8e1ff5e --- /dev/null +++ b/src/main/java/co/dfns/sdk/addresswatches/model/AddressWatchBlockchainEvent.java @@ -0,0 +1,19 @@ +package co.dfns.sdk.addresswatches.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +@JsonIgnoreProperties(ignoreUnknown = true) +public record AddressWatchBlockchainEvent( + @JsonProperty("id") String id, + @JsonProperty("addressWatchId") String addressWatchId, + @JsonProperty("network") Network network, + @JsonProperty("name") String name, + @JsonProperty("blockNumber") double blockNumber, + @JsonProperty("txHash") String txHash, + @JsonProperty("index") String index, + @JsonProperty("timestamp") String timestamp, + @JsonProperty("status") String status, + @JsonProperty("data") Map data +) {} diff --git a/src/main/java/co/dfns/sdk/addresswatches/model/AddressWatchHistoryEvent.java b/src/main/java/co/dfns/sdk/addresswatches/model/AddressWatchHistoryEvent.java new file mode 100644 index 0000000..7f8c634 --- /dev/null +++ b/src/main/java/co/dfns/sdk/addresswatches/model/AddressWatchHistoryEvent.java @@ -0,0 +1,38 @@ +package co.dfns.sdk.addresswatches.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonInclude; +import java.util.Map; + +@JsonIgnoreProperties(ignoreUnknown = true) +public record AddressWatchHistoryEvent( + @JsonProperty("direction") String direction, + @JsonProperty("network") Network network, + @JsonProperty("blockNumber") double blockNumber, + @JsonProperty("txHash") String txHash, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("index") String index, + @JsonProperty("timestamp") String timestamp, + @JsonProperty("status") String status, + @JsonProperty("metadata") Map metadata, + @JsonProperty("kind") String kind, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("from") String from, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("to") String to, + @JsonProperty("value") String value, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("fee") String fee, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("memo") String memo, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("liquidityPool") String liquidityPool, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("balanceId") String balanceId, + @JsonProperty("symbol") String symbol, + @JsonProperty("decimals") double decimals, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("verified") Boolean verified, + @JsonProperty("addressWatchId") String addressWatchId +) {} diff --git a/src/main/java/co/dfns/sdk/addresswatches/model/CreateAddressWatchRequest.java b/src/main/java/co/dfns/sdk/addresswatches/model/CreateAddressWatchRequest.java new file mode 100644 index 0000000..68b47d5 --- /dev/null +++ b/src/main/java/co/dfns/sdk/addresswatches/model/CreateAddressWatchRequest.java @@ -0,0 +1,18 @@ +package co.dfns.sdk.addresswatches.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonInclude; +import java.util.List; + +@JsonIgnoreProperties(ignoreUnknown = true) +public record CreateAddressWatchRequest( + @JsonProperty("network") Network network, + @JsonProperty("address") String address, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("name") String name, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("externalId") String externalId, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("tags") List tags +) {} diff --git a/src/main/java/co/dfns/sdk/addresswatches/model/GetAddressWatchAssetsQuery.java b/src/main/java/co/dfns/sdk/addresswatches/model/GetAddressWatchAssetsQuery.java new file mode 100644 index 0000000..5df66d9 --- /dev/null +++ b/src/main/java/co/dfns/sdk/addresswatches/model/GetAddressWatchAssetsQuery.java @@ -0,0 +1,19 @@ +package co.dfns.sdk.addresswatches.model; + +import java.util.HashMap; +import java.util.Map; + +public class GetAddressWatchAssetsQuery { + private String netWorth; + + public GetAddressWatchAssetsQuery netWorth(String netWorth) { + this.netWorth = netWorth; + return this; + } + + public Map toMap() { + Map map = new HashMap<>(); + if (netWorth != null) map.put("netWorth", String.valueOf(netWorth)); + return map; + } +} diff --git a/src/main/java/co/dfns/sdk/addresswatches/model/GetAddressWatchAssetsResponse.java b/src/main/java/co/dfns/sdk/addresswatches/model/GetAddressWatchAssetsResponse.java new file mode 100644 index 0000000..65a40dc --- /dev/null +++ b/src/main/java/co/dfns/sdk/addresswatches/model/GetAddressWatchAssetsResponse.java @@ -0,0 +1,16 @@ +package co.dfns.sdk.addresswatches.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonInclude; +import java.util.List; +import java.util.Map; + +@JsonIgnoreProperties(ignoreUnknown = true) +public record GetAddressWatchAssetsResponse( + @JsonProperty("addressWatchId") String addressWatchId, + @JsonProperty("network") Network network, + @JsonProperty("assets") List assets, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("netWorth") Map netWorth +) {} diff --git a/src/main/java/co/dfns/sdk/addresswatches/model/GetAddressWatchBlockchainEventsQuery.java b/src/main/java/co/dfns/sdk/addresswatches/model/GetAddressWatchBlockchainEventsQuery.java new file mode 100644 index 0000000..70652bf --- /dev/null +++ b/src/main/java/co/dfns/sdk/addresswatches/model/GetAddressWatchBlockchainEventsQuery.java @@ -0,0 +1,47 @@ +package co.dfns.sdk.addresswatches.model; + +import java.util.HashMap; +import java.util.Map; + +public class GetAddressWatchBlockchainEventsQuery { + private Long limit; + private String paginationToken; + private String name; + private String contract; + private String txHash; + + public GetAddressWatchBlockchainEventsQuery limit(Long limit) { + this.limit = limit; + return this; + } + + public GetAddressWatchBlockchainEventsQuery paginationToken(String paginationToken) { + this.paginationToken = paginationToken; + return this; + } + + public GetAddressWatchBlockchainEventsQuery name(String name) { + this.name = name; + return this; + } + + public GetAddressWatchBlockchainEventsQuery contract(String contract) { + this.contract = contract; + return this; + } + + public GetAddressWatchBlockchainEventsQuery txHash(String txHash) { + this.txHash = txHash; + return this; + } + + public Map toMap() { + Map map = new HashMap<>(); + if (limit != null) map.put("limit", String.valueOf(limit)); + if (paginationToken != null) map.put("paginationToken", String.valueOf(paginationToken)); + if (name != null) map.put("name", String.valueOf(name)); + if (contract != null) map.put("contract", String.valueOf(contract)); + if (txHash != null) map.put("txHash", String.valueOf(txHash)); + return map; + } +} diff --git a/src/main/java/co/dfns/sdk/addresswatches/model/GetAddressWatchBlockchainEventsResponse.java b/src/main/java/co/dfns/sdk/addresswatches/model/GetAddressWatchBlockchainEventsResponse.java new file mode 100644 index 0000000..7aaf51b --- /dev/null +++ b/src/main/java/co/dfns/sdk/addresswatches/model/GetAddressWatchBlockchainEventsResponse.java @@ -0,0 +1,15 @@ +package co.dfns.sdk.addresswatches.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonInclude; +import java.util.List; + +@JsonIgnoreProperties(ignoreUnknown = true) +public record GetAddressWatchBlockchainEventsResponse( + @JsonProperty("items") List items, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("nextPageToken") String nextPageToken, + @JsonProperty("addressWatchId") String addressWatchId, + @JsonProperty("network") Network network +) {} diff --git a/src/main/java/co/dfns/sdk/addresswatches/model/GetAddressWatchHistoryQuery.java b/src/main/java/co/dfns/sdk/addresswatches/model/GetAddressWatchHistoryQuery.java new file mode 100644 index 0000000..d334273 --- /dev/null +++ b/src/main/java/co/dfns/sdk/addresswatches/model/GetAddressWatchHistoryQuery.java @@ -0,0 +1,47 @@ +package co.dfns.sdk.addresswatches.model; + +import java.util.HashMap; +import java.util.Map; + +public class GetAddressWatchHistoryQuery { + private Long limit; + private String paginationToken; + private String direction; + private String kind; + private String contract; + + public GetAddressWatchHistoryQuery limit(Long limit) { + this.limit = limit; + return this; + } + + public GetAddressWatchHistoryQuery paginationToken(String paginationToken) { + this.paginationToken = paginationToken; + return this; + } + + public GetAddressWatchHistoryQuery direction(String direction) { + this.direction = direction; + return this; + } + + public GetAddressWatchHistoryQuery kind(String kind) { + this.kind = kind; + return this; + } + + public GetAddressWatchHistoryQuery contract(String contract) { + this.contract = contract; + return this; + } + + public Map toMap() { + Map map = new HashMap<>(); + if (limit != null) map.put("limit", String.valueOf(limit)); + if (paginationToken != null) map.put("paginationToken", String.valueOf(paginationToken)); + if (direction != null) map.put("direction", String.valueOf(direction)); + if (kind != null) map.put("kind", String.valueOf(kind)); + if (contract != null) map.put("contract", String.valueOf(contract)); + return map; + } +} diff --git a/src/main/java/co/dfns/sdk/addresswatches/model/GetAddressWatchHistoryResponse.java b/src/main/java/co/dfns/sdk/addresswatches/model/GetAddressWatchHistoryResponse.java new file mode 100644 index 0000000..cdc9ca8 --- /dev/null +++ b/src/main/java/co/dfns/sdk/addresswatches/model/GetAddressWatchHistoryResponse.java @@ -0,0 +1,15 @@ +package co.dfns.sdk.addresswatches.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonInclude; +import java.util.List; + +@JsonIgnoreProperties(ignoreUnknown = true) +public record GetAddressWatchHistoryResponse( + @JsonProperty("items") List items, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("nextPageToken") String nextPageToken, + @JsonProperty("addressWatchId") String addressWatchId, + @JsonProperty("network") Network network +) {} diff --git a/src/main/java/co/dfns/sdk/addresswatches/model/ListAddressWatchesQuery.java b/src/main/java/co/dfns/sdk/addresswatches/model/ListAddressWatchesQuery.java new file mode 100644 index 0000000..b72d168 --- /dev/null +++ b/src/main/java/co/dfns/sdk/addresswatches/model/ListAddressWatchesQuery.java @@ -0,0 +1,26 @@ +package co.dfns.sdk.addresswatches.model; + +import java.util.HashMap; +import java.util.Map; + +public class ListAddressWatchesQuery { + private Long limit; + private String paginationToken; + + public ListAddressWatchesQuery limit(Long limit) { + this.limit = limit; + return this; + } + + public ListAddressWatchesQuery paginationToken(String paginationToken) { + this.paginationToken = paginationToken; + return this; + } + + public Map toMap() { + Map map = new HashMap<>(); + if (limit != null) map.put("limit", String.valueOf(limit)); + if (paginationToken != null) map.put("paginationToken", String.valueOf(paginationToken)); + return map; + } +} diff --git a/src/main/java/co/dfns/sdk/addresswatches/model/Network.java b/src/main/java/co/dfns/sdk/addresswatches/model/Network.java new file mode 100644 index 0000000..f6ca5d6 --- /dev/null +++ b/src/main/java/co/dfns/sdk/addresswatches/model/Network.java @@ -0,0 +1,139 @@ +package co.dfns.sdk.addresswatches.model; + +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonValue; + +public enum Network { + Algorand("Algorand"), + AlgorandTestnet("AlgorandTestnet"), + Aptos("Aptos"), + AptosTestnet("AptosTestnet"), + ArbitrumOne("ArbitrumOne"), + ArbitrumSepolia("ArbitrumSepolia"), + ArcTestnet("ArcTestnet"), + AvalancheC("AvalancheC"), + AvalancheCFuji("AvalancheCFuji"), + BabylonGenesis("BabylonGenesis"), + BabylonTestnet5("BabylonTestnet5"), + Base("Base"), + BaseSepolia("BaseSepolia"), + Berachain("Berachain"), + BerachainBepolia("BerachainBepolia"), + Bitcoin("Bitcoin"), + BitcoinSignet("BitcoinSignet"), + BitcoinTestnet4("BitcoinTestnet4"), + BitcoinCash("BitcoinCash"), + Bob("Bob"), + BobSepolia("BobSepolia"), + Bsc("Bsc"), + BscTestnet("BscTestnet"), + Canton("Canton"), + CantonTestnet("CantonTestnet"), + Cardano("Cardano"), + CardanoPreprod("CardanoPreprod"), + Concordium("Concordium"), + ConcordiumTestnet("ConcordiumTestnet"), + Celo("Celo"), + CeloAlfajores("CeloAlfajores"), + Codex("Codex"), + CodexSepolia("CodexSepolia"), + CosmosHub4("CosmosHub4"), + CosmosIcsTestnet("CosmosIcsTestnet"), + Dogecoin("Dogecoin"), + DogecoinTestnet("DogecoinTestnet"), + Ethereum("Ethereum"), + EthereumClassic("EthereumClassic"), + EthereumClassicMordor("EthereumClassicMordor"), + EthereumSepolia("EthereumSepolia"), + EthereumHoodi("EthereumHoodi"), + FlareC("FlareC"), + FlareCCoston2("FlareCCoston2"), + FlowEvm("FlowEvm"), + FlowEvmTestnet("FlowEvmTestnet"), + Hedera("Hedera"), + HederaTestnet("HederaTestnet"), + Ink("Ink"), + InkSepolia("InkSepolia"), + InternetComputer("InternetComputer"), + Ion("Ion"), + IonTestnet("IonTestnet"), + Iota("Iota"), + IotaTestnet("IotaTestnet"), + Kusama("Kusama"), + KusamaAssetHub("KusamaAssetHub"), + Litecoin("Litecoin"), + LitecoinTestnet("LitecoinTestnet"), + Movement("Movement"), + MovementTestnet("MovementTestnet"), + Near("Near"), + NearTestnet("NearTestnet"), + Optimism("Optimism"), + OptimismSepolia("OptimismSepolia"), + Origyn("Origyn"), + Plasma("Plasma"), + PlasmaTestnet("PlasmaTestnet"), + Plume("Plume"), + PlumeSepolia("PlumeSepolia"), + Paseo("Paseo"), + PaseoAssetHub("PaseoAssetHub"), + Polkadot("Polkadot"), + PolkadotAssetHub("PolkadotAssetHub"), + Polygon("Polygon"), + PolygonAmoy("PolygonAmoy"), + Polymesh("Polymesh"), + PolymeshTestnet("PolymeshTestnet"), + Race("Race"), + RaceSepolia("RaceSepolia"), + Rayls("Rayls"), + RaylsTestnet("RaylsTestnet"), + Robinhood("Robinhood"), + RobinhoodSepolia("RobinhoodSepolia"), + SeiAtlantic2("SeiAtlantic2"), + SeiPacific1("SeiPacific1"), + Solana("Solana"), + SolanaDevnet("SolanaDevnet"), + Sonic("Sonic"), + SonicTestnet("SonicTestnet"), + Starknet("Starknet"), + StarknetSepolia("StarknetSepolia"), + Stellar("Stellar"), + StellarTestnet("StellarTestnet"), + Sui("Sui"), + SuiTestnet("SuiTestnet"), + Tezos("Tezos"), + TezosGhostnet("TezosGhostnet"), + TezosShadownet("TezosShadownet"), + Tempo("Tempo"), + TempoModerato("TempoModerato"), + Tsc("Tsc"), + TscTestnet1("TscTestnet1"), + Ton("Ton"), + TonTestnet("TonTestnet"), + Tron("Tron"), + TronNile("TronNile"), + Westend("Westend"), + WestendAssetHub("WestendAssetHub"), + Xdc("Xdc"), + XdcApothem("XdcApothem"), + XLayer("XLayer"), + XLayerSepolia("XLayerSepolia"), + XrpLedger("XrpLedger"), + XrpLedgerTestnet("XrpLedgerTestnet"), + UNKNOWN(null); + + + private final String value; + + Network(String value) { this.value = value; } + + @JsonValue + public String getValue() { return value; } + + @JsonCreator + public static Network fromValue(String value) { + for (Network e : values()) { + if (e.value != null && e.value.equals(value)) return e; + } + return UNKNOWN; + } +} diff --git a/src/main/java/co/dfns/sdk/allocations/AllocationsAsyncClient.java b/src/main/java/co/dfns/sdk/allocations/AllocationsAsyncClient.java index 1746647..519cc19 100644 --- a/src/main/java/co/dfns/sdk/allocations/AllocationsAsyncClient.java +++ b/src/main/java/co/dfns/sdk/allocations/AllocationsAsyncClient.java @@ -4,6 +4,7 @@ import co.dfns.sdk.allocations.model.*; import java.util.List; import co.dfns.sdk.PaginatedList; +import java.util.Map; import java.util.concurrent.CompletableFuture; public class AllocationsAsyncClient { @@ -37,4 +38,9 @@ public CompletableFuture createAllocationAction(String allocationId, public CompletableFuture getAllocation(String allocationId) { return httpClient.getAsync("/allocations/" + allocationId, java.util.Map.of(), Allocation.class); } + + /** Get Allocations Info */ + public CompletableFuture getAllocationsInfo() { + return httpClient.getAsync("/allocations/info", java.util.Map.of(), GetAllocationsInfoResponse.class); + } } diff --git a/src/main/java/co/dfns/sdk/allocations/AllocationsClient.java b/src/main/java/co/dfns/sdk/allocations/AllocationsClient.java index 30daf60..d4cf1e6 100644 --- a/src/main/java/co/dfns/sdk/allocations/AllocationsClient.java +++ b/src/main/java/co/dfns/sdk/allocations/AllocationsClient.java @@ -4,6 +4,7 @@ import co.dfns.sdk.allocations.model.*; import java.util.List; import co.dfns.sdk.PaginatedList; +import java.util.Map; public class AllocationsClient { private final DfnsHttpClient httpClient; @@ -36,4 +37,9 @@ public Allocation createAllocationAction(String allocationId, Object body) { public Allocation getAllocation(String allocationId) { return httpClient.get("/allocations/" + allocationId, java.util.Map.of(), Allocation.class); } + + /** Get Allocations Info */ + public GetAllocationsInfoResponse getAllocationsInfo() { + return httpClient.get("/allocations/info", java.util.Map.of(), GetAllocationsInfoResponse.class); + } } diff --git a/src/main/java/co/dfns/sdk/allocations/DelegatedAllocationsAsyncClient.java b/src/main/java/co/dfns/sdk/allocations/DelegatedAllocationsAsyncClient.java index 065cc37..a4da417 100644 --- a/src/main/java/co/dfns/sdk/allocations/DelegatedAllocationsAsyncClient.java +++ b/src/main/java/co/dfns/sdk/allocations/DelegatedAllocationsAsyncClient.java @@ -4,6 +4,7 @@ import co.dfns.sdk.allocations.model.*; import java.util.List; import co.dfns.sdk.PaginatedList; +import java.util.Map; import java.util.concurrent.CompletableFuture; import co.dfns.sdk.auth.UserActionChallenge; import co.dfns.sdk.auth.CredentialAssertion; @@ -51,4 +52,9 @@ public CompletableFuture createAllocationActionComplete(String alloc public CompletableFuture getAllocation(String allocationId) { return httpClient.getAsync("/allocations/" + allocationId, java.util.Map.of(), Allocation.class); } + + /** Get Allocations Info */ + public CompletableFuture getAllocationsInfo() { + return httpClient.getAsync("/allocations/info", java.util.Map.of(), GetAllocationsInfoResponse.class); + } } diff --git a/src/main/java/co/dfns/sdk/allocations/DelegatedAllocationsClient.java b/src/main/java/co/dfns/sdk/allocations/DelegatedAllocationsClient.java index 27111c0..d34c484 100644 --- a/src/main/java/co/dfns/sdk/allocations/DelegatedAllocationsClient.java +++ b/src/main/java/co/dfns/sdk/allocations/DelegatedAllocationsClient.java @@ -4,6 +4,7 @@ import co.dfns.sdk.allocations.model.*; import java.util.List; import co.dfns.sdk.PaginatedList; +import java.util.Map; import co.dfns.sdk.auth.UserActionChallenge; import co.dfns.sdk.auth.CredentialAssertion; @@ -50,4 +51,9 @@ public Allocation createAllocationActionComplete(String allocationId, Object bod public Allocation getAllocation(String allocationId) { return httpClient.get("/allocations/" + allocationId, java.util.Map.of(), Allocation.class); } + + /** Get Allocations Info */ + public GetAllocationsInfoResponse getAllocationsInfo() { + return httpClient.get("/allocations/info", java.util.Map.of(), GetAllocationsInfoResponse.class); + } } diff --git a/src/main/java/co/dfns/sdk/allocations/model/GetAllocationsInfoResponse.java b/src/main/java/co/dfns/sdk/allocations/model/GetAllocationsInfoResponse.java new file mode 100644 index 0000000..f12cf66 --- /dev/null +++ b/src/main/java/co/dfns/sdk/allocations/model/GetAllocationsInfoResponse.java @@ -0,0 +1,24 @@ +package co.dfns.sdk.allocations.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonInclude; +import java.util.Map; + +@JsonIgnoreProperties(ignoreUnknown = true) +public record GetAllocationsInfoResponse( + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("0fns") Map ofns, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("SkySusds") Map skySusds, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("GauntletUsdcPrime") Map gauntletUsdcPrime, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("SteakhouseUsdt") Map steakhouseUsdt, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("GauntletUsdcPrimeBase") Map gauntletUsdcPrimeBase, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("SteakhouseUsdcBase") Map steakhouseUsdcBase, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("SentoraPyusdMain") Map sentoraPyusdMain +) {} diff --git a/src/main/java/co/dfns/sdk/auth/AuthAsyncClient.java b/src/main/java/co/dfns/sdk/auth/AuthAsyncClient.java index bb1bcc0..3974656 100644 --- a/src/main/java/co/dfns/sdk/auth/AuthAsyncClient.java +++ b/src/main/java/co/dfns/sdk/auth/AuthAsyncClient.java @@ -112,6 +112,16 @@ public CompletableFuture logout(LogoutRequest body) { return httpClient.putAsync("/auth/logout", java.util.Map.of(), body, LogoutResponse.class, false); } + /** Complete OIDC Login */ + public CompletableFuture completeOidcLogin(CompleteOidcLoginRequest body) { + return httpClient.postAsync("/auth/login/oidc", java.util.Map.of(), body, Object.class, false); + } + + /** Initiate OIDC Login */ + public CompletableFuture initiateOidcLogin(InitiateOidcLoginRequest body) { + return httpClient.postAsync("/auth/login/oidc/init", java.util.Map.of(), body, InitiateOidcLoginResponse.class, false); + } + /** Send Login Code */ public CompletableFuture sendLoginCode(SendLoginCodeRequest body) { return httpClient.postAsync("/auth/login/code", java.util.Map.of(), body, SendLoginCodeResponse.class, false); diff --git a/src/main/java/co/dfns/sdk/auth/AuthClient.java b/src/main/java/co/dfns/sdk/auth/AuthClient.java index e3037cc..0d8fdeb 100644 --- a/src/main/java/co/dfns/sdk/auth/AuthClient.java +++ b/src/main/java/co/dfns/sdk/auth/AuthClient.java @@ -111,6 +111,16 @@ public LogoutResponse logout(LogoutRequest body) { return httpClient.put("/auth/logout", java.util.Map.of(), body, LogoutResponse.class, false); } + /** Complete OIDC Login */ + public Object completeOidcLogin(CompleteOidcLoginRequest body) { + return httpClient.post("/auth/login/oidc", java.util.Map.of(), body, Object.class, false); + } + + /** Initiate OIDC Login */ + public InitiateOidcLoginResponse initiateOidcLogin(InitiateOidcLoginRequest body) { + return httpClient.post("/auth/login/oidc/init", java.util.Map.of(), body, InitiateOidcLoginResponse.class, false); + } + /** Send Login Code */ public SendLoginCodeResponse sendLoginCode(SendLoginCodeRequest body) { return httpClient.post("/auth/login/code", java.util.Map.of(), body, SendLoginCodeResponse.class, false); diff --git a/src/main/java/co/dfns/sdk/auth/DelegatedAuthAsyncClient.java b/src/main/java/co/dfns/sdk/auth/DelegatedAuthAsyncClient.java index 057905e..39a707e 100644 --- a/src/main/java/co/dfns/sdk/auth/DelegatedAuthAsyncClient.java +++ b/src/main/java/co/dfns/sdk/auth/DelegatedAuthAsyncClient.java @@ -150,6 +150,16 @@ public CompletableFuture logout(LogoutRequest body) { return httpClient.putAsync("/auth/logout", java.util.Map.of(), body, LogoutResponse.class, false); } + /** Complete OIDC Login */ + public CompletableFuture completeOidcLogin(CompleteOidcLoginRequest body) { + return httpClient.postAsync("/auth/login/oidc", java.util.Map.of(), body, Object.class, false); + } + + /** Initiate OIDC Login */ + public CompletableFuture initiateOidcLogin(InitiateOidcLoginRequest body) { + return httpClient.postAsync("/auth/login/oidc/init", java.util.Map.of(), body, InitiateOidcLoginResponse.class, false); + } + /** Send Login Code */ public CompletableFuture sendLoginCode(SendLoginCodeRequest body) { return httpClient.postAsync("/auth/login/code", java.util.Map.of(), body, SendLoginCodeResponse.class, false); diff --git a/src/main/java/co/dfns/sdk/auth/DelegatedAuthClient.java b/src/main/java/co/dfns/sdk/auth/DelegatedAuthClient.java index fe7f992..0f93a9a 100644 --- a/src/main/java/co/dfns/sdk/auth/DelegatedAuthClient.java +++ b/src/main/java/co/dfns/sdk/auth/DelegatedAuthClient.java @@ -149,6 +149,16 @@ public LogoutResponse logout(LogoutRequest body) { return httpClient.put("/auth/logout", java.util.Map.of(), body, LogoutResponse.class, false); } + /** Complete OIDC Login */ + public Object completeOidcLogin(CompleteOidcLoginRequest body) { + return httpClient.post("/auth/login/oidc", java.util.Map.of(), body, Object.class, false); + } + + /** Initiate OIDC Login */ + public InitiateOidcLoginResponse initiateOidcLogin(InitiateOidcLoginRequest body) { + return httpClient.post("/auth/login/oidc/init", java.util.Map.of(), body, InitiateOidcLoginResponse.class, false); + } + /** Send Login Code */ public SendLoginCodeResponse sendLoginCode(SendLoginCodeRequest body) { return httpClient.post("/auth/login/code", java.util.Map.of(), body, SendLoginCodeResponse.class, false); diff --git a/src/main/java/co/dfns/sdk/auth/model/CompleteOidcLoginRequest.java b/src/main/java/co/dfns/sdk/auth/model/CompleteOidcLoginRequest.java new file mode 100644 index 0000000..8f1e252 --- /dev/null +++ b/src/main/java/co/dfns/sdk/auth/model/CompleteOidcLoginRequest.java @@ -0,0 +1,10 @@ +package co.dfns.sdk.auth.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonIgnoreProperties(ignoreUnknown = true) +public record CompleteOidcLoginRequest( + @JsonProperty("code") String code, + @JsonProperty("state") String state +) {} diff --git a/src/main/java/co/dfns/sdk/auth/model/InitiateOidcLoginRequest.java b/src/main/java/co/dfns/sdk/auth/model/InitiateOidcLoginRequest.java new file mode 100644 index 0000000..aa61a85 --- /dev/null +++ b/src/main/java/co/dfns/sdk/auth/model/InitiateOidcLoginRequest.java @@ -0,0 +1,14 @@ +package co.dfns.sdk.auth.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonInclude; + +@JsonIgnoreProperties(ignoreUnknown = true) +public record InitiateOidcLoginRequest( + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("orgId") String orgId, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("tenantId") String tenantId, + @JsonProperty("redirectUri") String redirectUri +) {} diff --git a/src/main/java/co/dfns/sdk/auth/model/InitiateOidcLoginResponse.java b/src/main/java/co/dfns/sdk/auth/model/InitiateOidcLoginResponse.java new file mode 100644 index 0000000..56603ab --- /dev/null +++ b/src/main/java/co/dfns/sdk/auth/model/InitiateOidcLoginResponse.java @@ -0,0 +1,9 @@ +package co.dfns.sdk.auth.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonIgnoreProperties(ignoreUnknown = true) +public record InitiateOidcLoginResponse( + @JsonProperty("redirectUrl") String redirectUrl +) {} diff --git a/src/main/java/co/dfns/sdk/internal/DfnsHttpClient.java b/src/main/java/co/dfns/sdk/internal/DfnsHttpClient.java index 250e038..923f134 100644 --- a/src/main/java/co/dfns/sdk/internal/DfnsHttpClient.java +++ b/src/main/java/co/dfns/sdk/internal/DfnsHttpClient.java @@ -309,7 +309,7 @@ public CompletableFuture executeWithUserActionAsync(String method, String private HttpRequest buildRequest(String method, String path, Map query, Object body, String userAction) { try { - String url = config.getBaseUrl() + path; + String url = buildTransportUrl(path); if (!query.isEmpty()) { String qs = query.entrySet().stream() .map(e -> java.net.URLEncoder.encode(e.getKey(), java.nio.charset.StandardCharsets.UTF_8) + "=" + java.net.URLEncoder.encode(e.getValue(), java.nio.charset.StandardCharsets.UTF_8)) @@ -380,7 +380,7 @@ public CompletableFuture postMultipartAsync(String path, Map query, String dataJson, byte[] file, String userAction) { try { - String url = config.getBaseUrl() + path; + String url = buildTransportUrl(path); if (!query.isEmpty()) { String qs = query.entrySet().stream() .map(e -> java.net.URLEncoder.encode(e.getKey(), java.nio.charset.StandardCharsets.UTF_8) + "=" + java.net.URLEncoder.encode(e.getValue(), java.nio.charset.StandardCharsets.UTF_8)) @@ -416,6 +416,12 @@ private HttpRequest buildMultipartRequest(String method, String path, Map cancelFleetOperationInit(String storeId, CancelFleetOperationRequest body) { + return httpClient.createUserActionChallengeAsync("POST", "/key-stores/" + storeId + "/fleet-operations/cancel", body); + } + + /** Delegated signing step 2 for Cancel Fleet Operation: submits the signed challenge and issues the request. */ + public CompletableFuture cancelFleetOperationComplete(String storeId, CancelFleetOperationRequest body, String challengeIdentifier, CredentialAssertion assertion) { + return httpClient.completeUserActionSigningAsync(challengeIdentifier, assertion) + .thenCompose(userAction -> httpClient.executeWithUserActionAsync("POST", "/key-stores/" + storeId + "/fleet-operations/cancel", java.util.Map.of(), body, CancelFleetOperationResponse.class, userAction)); + } + /** Delegated signing step 1 for Create Add Mac User Input: returns the challenge to sign out-of-band. */ public CompletableFuture createAddMacUserInputInit(String storeId, CreateAddMacUserInputRequest body) { return httpClient.createUserActionChallengeAsync("POST", "/key-stores/" + storeId + "/add-mac-user/input", body); @@ -25,6 +36,17 @@ public CompletableFuture createAddMacUserInputComplete(String storeId, C .thenCompose(userAction -> httpClient.executeWithUserActionAsync("POST", "/key-stores/" + storeId + "/add-mac-user/input", java.util.Map.of(), body, Object.class, userAction)); } + /** Delegated signing step 1 for Create Add Provisioner Input: returns the challenge to sign out-of-band. */ + public CompletableFuture createAddProvisionerInputInit(String storeId, CreateAddProvisionerInputRequest body) { + return httpClient.createUserActionChallengeAsync("POST", "/key-stores/" + storeId + "/add-provisioner/input", body); + } + + /** Delegated signing step 2 for Create Add Provisioner Input: submits the signed challenge and issues the request. */ + public CompletableFuture createAddProvisionerInputComplete(String storeId, CreateAddProvisionerInputRequest body, String challengeIdentifier, CredentialAssertion assertion) { + return httpClient.completeUserActionSigningAsync(challengeIdentifier, assertion) + .thenCompose(userAction -> httpClient.executeWithUserActionAsync("POST", "/key-stores/" + storeId + "/add-provisioner/input", java.util.Map.of(), body, Object.class, userAction)); + } + /** Delegated signing step 1 for Create Clone Input: returns the challenge to sign out-of-band. */ public CompletableFuture createCloneInputInit(String storeId, CreateCloneInputRequest body) { return httpClient.createUserActionChallengeAsync("POST", "/key-stores/" + storeId + "/clone/input", body); @@ -95,6 +117,11 @@ public CompletableFuture submitAddMacUserOutput( return httpClient.postMultipartAsync("/key-stores/" + storeId + "/add-mac-user/output", java.util.Map.of(), body, file, SubmitAddMacUserOutputResponse.class, true); } + /** Submit Add Provisioner Output */ + public CompletableFuture submitAddProvisionerOutput(String storeId, SubmitAddProvisionerOutputRequest body, byte[] file) { + return httpClient.postMultipartAsync("/key-stores/" + storeId + "/add-provisioner/output", java.util.Map.of(), body, file, SubmitAddProvisionerOutputResponse.class, true); + } + /** Submit Clone Output */ public CompletableFuture submitCloneOutput(String storeId, SubmitCloneOutputRequest body, byte[] file) { return httpClient.postMultipartAsync("/key-stores/" + storeId + "/clone/output", java.util.Map.of(), body, file, SubmitCloneOutputResponse.class, true); diff --git a/src/main/java/co/dfns/sdk/signers/DelegatedSignersClient.java b/src/main/java/co/dfns/sdk/signers/DelegatedSignersClient.java index 46e9507..8bb1aa0 100644 --- a/src/main/java/co/dfns/sdk/signers/DelegatedSignersClient.java +++ b/src/main/java/co/dfns/sdk/signers/DelegatedSignersClient.java @@ -13,6 +13,17 @@ public DelegatedSignersClient(DfnsHttpClient httpClient) { this.httpClient = httpClient; } + /** Delegated signing step 1 for Cancel Fleet Operation: returns the challenge to sign out-of-band. */ + public UserActionChallenge cancelFleetOperationInit(String storeId, CancelFleetOperationRequest body) { + return httpClient.createUserActionChallenge("POST", "/key-stores/" + storeId + "/fleet-operations/cancel", body); + } + + /** Delegated signing step 2 for Cancel Fleet Operation: submits the signed challenge and issues the request. */ + public CancelFleetOperationResponse cancelFleetOperationComplete(String storeId, CancelFleetOperationRequest body, String challengeIdentifier, CredentialAssertion assertion) { + String userAction = httpClient.completeUserActionSigning(challengeIdentifier, assertion); + return httpClient.executeWithUserAction("POST", "/key-stores/" + storeId + "/fleet-operations/cancel", java.util.Map.of(), body, CancelFleetOperationResponse.class, userAction); + } + /** Delegated signing step 1 for Create Add Mac User Input: returns the challenge to sign out-of-band. */ public UserActionChallenge createAddMacUserInputInit(String storeId, CreateAddMacUserInputRequest body) { return httpClient.createUserActionChallenge("POST", "/key-stores/" + storeId + "/add-mac-user/input", body); @@ -24,6 +35,17 @@ public Object createAddMacUserInputComplete(String storeId, CreateAddMacUserInpu return httpClient.executeWithUserAction("POST", "/key-stores/" + storeId + "/add-mac-user/input", java.util.Map.of(), body, Object.class, userAction); } + /** Delegated signing step 1 for Create Add Provisioner Input: returns the challenge to sign out-of-band. */ + public UserActionChallenge createAddProvisionerInputInit(String storeId, CreateAddProvisionerInputRequest body) { + return httpClient.createUserActionChallenge("POST", "/key-stores/" + storeId + "/add-provisioner/input", body); + } + + /** Delegated signing step 2 for Create Add Provisioner Input: submits the signed challenge and issues the request. */ + public Object createAddProvisionerInputComplete(String storeId, CreateAddProvisionerInputRequest body, String challengeIdentifier, CredentialAssertion assertion) { + String userAction = httpClient.completeUserActionSigning(challengeIdentifier, assertion); + return httpClient.executeWithUserAction("POST", "/key-stores/" + storeId + "/add-provisioner/input", java.util.Map.of(), body, Object.class, userAction); + } + /** Delegated signing step 1 for Create Clone Input: returns the challenge to sign out-of-band. */ public UserActionChallenge createCloneInputInit(String storeId, CreateCloneInputRequest body) { return httpClient.createUserActionChallenge("POST", "/key-stores/" + storeId + "/clone/input", body); @@ -94,6 +116,11 @@ public SubmitAddMacUserOutputResponse submitAddMacUserOutput(String storeId, Sub return httpClient.postMultipart("/key-stores/" + storeId + "/add-mac-user/output", java.util.Map.of(), body, file, SubmitAddMacUserOutputResponse.class, true); } + /** Submit Add Provisioner Output */ + public SubmitAddProvisionerOutputResponse submitAddProvisionerOutput(String storeId, SubmitAddProvisionerOutputRequest body, byte[] file) { + return httpClient.postMultipart("/key-stores/" + storeId + "/add-provisioner/output", java.util.Map.of(), body, file, SubmitAddProvisionerOutputResponse.class, true); + } + /** Submit Clone Output */ public SubmitCloneOutputResponse submitCloneOutput(String storeId, SubmitCloneOutputRequest body, byte[] file) { return httpClient.postMultipart("/key-stores/" + storeId + "/clone/output", java.util.Map.of(), body, file, SubmitCloneOutputResponse.class, true); diff --git a/src/main/java/co/dfns/sdk/signers/SignersAsyncClient.java b/src/main/java/co/dfns/sdk/signers/SignersAsyncClient.java index 372e916..26087f8 100644 --- a/src/main/java/co/dfns/sdk/signers/SignersAsyncClient.java +++ b/src/main/java/co/dfns/sdk/signers/SignersAsyncClient.java @@ -12,11 +12,21 @@ public SignersAsyncClient(DfnsHttpClient httpClient) { this.httpClient = httpClient; } + /** Cancel Fleet Operation */ + public CompletableFuture cancelFleetOperation(String storeId, CancelFleetOperationRequest body) { + return httpClient.postAsync("/key-stores/" + storeId + "/fleet-operations/cancel", java.util.Map.of(), body, CancelFleetOperationResponse.class, true); + } + /** Create Add Mac User Input */ public CompletableFuture createAddMacUserInput(String storeId, CreateAddMacUserInputRequest body) { return httpClient.postAsync("/key-stores/" + storeId + "/add-mac-user/input", java.util.Map.of(), body, Object.class, true); } + /** Create Add Provisioner Input */ + public CompletableFuture createAddProvisionerInput(String storeId, CreateAddProvisionerInputRequest body) { + return httpClient.postAsync("/key-stores/" + storeId + "/add-provisioner/input", java.util.Map.of(), body, Object.class, true); + } + /** Create Clone Input */ public CompletableFuture createCloneInput(String storeId, CreateCloneInputRequest body) { return httpClient.postAsync("/key-stores/" + storeId + "/clone/input", java.util.Map.of(), body, Object.class, true); @@ -57,6 +67,11 @@ public CompletableFuture submitAddMacUserOutput( return httpClient.postMultipartAsync("/key-stores/" + storeId + "/add-mac-user/output", java.util.Map.of(), body, file, SubmitAddMacUserOutputResponse.class, true); } + /** Submit Add Provisioner Output */ + public CompletableFuture submitAddProvisionerOutput(String storeId, SubmitAddProvisionerOutputRequest body, byte[] file) { + return httpClient.postMultipartAsync("/key-stores/" + storeId + "/add-provisioner/output", java.util.Map.of(), body, file, SubmitAddProvisionerOutputResponse.class, true); + } + /** Submit Clone Output */ public CompletableFuture submitCloneOutput(String storeId, SubmitCloneOutputRequest body, byte[] file) { return httpClient.postMultipartAsync("/key-stores/" + storeId + "/clone/output", java.util.Map.of(), body, file, SubmitCloneOutputResponse.class, true); diff --git a/src/main/java/co/dfns/sdk/signers/SignersClient.java b/src/main/java/co/dfns/sdk/signers/SignersClient.java index f8fef4d..66202bf 100644 --- a/src/main/java/co/dfns/sdk/signers/SignersClient.java +++ b/src/main/java/co/dfns/sdk/signers/SignersClient.java @@ -11,11 +11,21 @@ public SignersClient(DfnsHttpClient httpClient) { this.httpClient = httpClient; } + /** Cancel Fleet Operation */ + public CancelFleetOperationResponse cancelFleetOperation(String storeId, CancelFleetOperationRequest body) { + return httpClient.post("/key-stores/" + storeId + "/fleet-operations/cancel", java.util.Map.of(), body, CancelFleetOperationResponse.class, true); + } + /** Create Add Mac User Input */ public Object createAddMacUserInput(String storeId, CreateAddMacUserInputRequest body) { return httpClient.post("/key-stores/" + storeId + "/add-mac-user/input", java.util.Map.of(), body, Object.class, true); } + /** Create Add Provisioner Input */ + public Object createAddProvisionerInput(String storeId, CreateAddProvisionerInputRequest body) { + return httpClient.post("/key-stores/" + storeId + "/add-provisioner/input", java.util.Map.of(), body, Object.class, true); + } + /** Create Clone Input */ public Object createCloneInput(String storeId, CreateCloneInputRequest body) { return httpClient.post("/key-stores/" + storeId + "/clone/input", java.util.Map.of(), body, Object.class, true); @@ -56,6 +66,11 @@ public SubmitAddMacUserOutputResponse submitAddMacUserOutput(String storeId, Sub return httpClient.postMultipart("/key-stores/" + storeId + "/add-mac-user/output", java.util.Map.of(), body, file, SubmitAddMacUserOutputResponse.class, true); } + /** Submit Add Provisioner Output */ + public SubmitAddProvisionerOutputResponse submitAddProvisionerOutput(String storeId, SubmitAddProvisionerOutputRequest body, byte[] file) { + return httpClient.postMultipart("/key-stores/" + storeId + "/add-provisioner/output", java.util.Map.of(), body, file, SubmitAddProvisionerOutputResponse.class, true); + } + /** Submit Clone Output */ public SubmitCloneOutputResponse submitCloneOutput(String storeId, SubmitCloneOutputRequest body, byte[] file) { return httpClient.postMultipart("/key-stores/" + storeId + "/clone/output", java.util.Map.of(), body, file, SubmitCloneOutputResponse.class, true); diff --git a/src/main/java/co/dfns/sdk/signers/model/CancelFleetOperationRequest.java b/src/main/java/co/dfns/sdk/signers/model/CancelFleetOperationRequest.java new file mode 100644 index 0000000..889f621 --- /dev/null +++ b/src/main/java/co/dfns/sdk/signers/model/CancelFleetOperationRequest.java @@ -0,0 +1,12 @@ +package co.dfns.sdk.signers.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonInclude; + +@JsonIgnoreProperties(ignoreUnknown = true) +public record CancelFleetOperationRequest( + @JsonProperty("groupId") String groupId, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("reason") String reason +) {} diff --git a/src/main/java/co/dfns/sdk/signers/model/CancelFleetOperationResponse.java b/src/main/java/co/dfns/sdk/signers/model/CancelFleetOperationResponse.java new file mode 100644 index 0000000..189e32f --- /dev/null +++ b/src/main/java/co/dfns/sdk/signers/model/CancelFleetOperationResponse.java @@ -0,0 +1,24 @@ +package co.dfns.sdk.signers.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.List; +import java.util.Map; + +@JsonIgnoreProperties(ignoreUnknown = true) +public record CancelFleetOperationResponse( + @JsonProperty("groupId") String groupId, + @JsonProperty("storeId") String storeId, + @JsonProperty("orgId") String orgId, + @JsonProperty("status") String status, + @JsonProperty("createdBy") String createdBy, + @JsonProperty("submittedBy") Object submittedBy, + @JsonProperty("dateSubmitted") Object dateSubmitted, + @JsonProperty("reviewedBy") Object reviewedBy, + @JsonProperty("dateReviewed") Object dateReviewed, + @JsonProperty("canceledBy") Object canceledBy, + @JsonProperty("dateCanceled") Object dateCanceled, + @JsonProperty("reason") Object reason, + @JsonProperty("dateCreated") String dateCreated, + @JsonProperty("operations") List> operations +) {} diff --git a/src/main/java/co/dfns/sdk/signers/model/CreateAddProvisionerInputRequest.java b/src/main/java/co/dfns/sdk/signers/model/CreateAddProvisionerInputRequest.java new file mode 100644 index 0000000..b767368 --- /dev/null +++ b/src/main/java/co/dfns/sdk/signers/model/CreateAddProvisionerInputRequest.java @@ -0,0 +1,11 @@ +package co.dfns.sdk.signers.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonIgnoreProperties(ignoreUnknown = true) +public record CreateAddProvisionerInputRequest( + @JsonProperty("kind") String kind, + @JsonProperty("yubikeySerial") String yubikeySerial, + @JsonProperty("hsmTargetSerial") String hsmTargetSerial +) {} diff --git a/src/main/java/co/dfns/sdk/signers/model/SubmitAddProvisionerOutputRequest.java b/src/main/java/co/dfns/sdk/signers/model/SubmitAddProvisionerOutputRequest.java new file mode 100644 index 0000000..c1be0c4 --- /dev/null +++ b/src/main/java/co/dfns/sdk/signers/model/SubmitAddProvisionerOutputRequest.java @@ -0,0 +1,11 @@ +package co.dfns.sdk.signers.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Map; + +@JsonIgnoreProperties(ignoreUnknown = true) +public record SubmitAddProvisionerOutputRequest( + @JsonProperty("fileChecksum") String fileChecksum, + @JsonProperty("outputJson") Map outputJson +) {} diff --git a/src/main/java/co/dfns/sdk/signers/model/SubmitAddProvisionerOutputResponse.java b/src/main/java/co/dfns/sdk/signers/model/SubmitAddProvisionerOutputResponse.java new file mode 100644 index 0000000..2b980ae --- /dev/null +++ b/src/main/java/co/dfns/sdk/signers/model/SubmitAddProvisionerOutputResponse.java @@ -0,0 +1,9 @@ +package co.dfns.sdk.signers.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonIgnoreProperties(ignoreUnknown = true) +public record SubmitAddProvisionerOutputResponse( + @JsonProperty("message") String message +) {} diff --git a/src/main/java/co/dfns/sdk/vaults/DelegatedVaultsAsyncClient.java b/src/main/java/co/dfns/sdk/vaults/DelegatedVaultsAsyncClient.java index b57a369..a2ae50b 100644 --- a/src/main/java/co/dfns/sdk/vaults/DelegatedVaultsAsyncClient.java +++ b/src/main/java/co/dfns/sdk/vaults/DelegatedVaultsAsyncClient.java @@ -43,6 +43,22 @@ public CompletableFuture createVaultAddressComplete(String vaultId .thenCompose(userAction -> httpClient.executeWithUserActionAsync("POST", "/vaults/" + vaultId + "/addresses", java.util.Map.of(), body, VaultAddress.class, userAction)); } + /** List Vault Locks */ + public CompletableFuture> listVaultLocks(String vaultId, ListVaultLocksQuery query) { + return httpClient.getAsync("/vaults/" + vaultId + "/locks", query.toMap(), new com.fasterxml.jackson.core.type.TypeReference>() {}); + } + + /** Delegated signing step 1 for Create Vault Lock: returns the challenge to sign out-of-band. */ + public CompletableFuture createVaultLockInit(String vaultId, CreateVaultLockRequest body) { + return httpClient.createUserActionChallengeAsync("POST", "/vaults/" + vaultId + "/locks", body); + } + + /** Delegated signing step 2 for Create Vault Lock: submits the signed challenge and issues the request. */ + public CompletableFuture createVaultLockComplete(String vaultId, CreateVaultLockRequest body, String challengeIdentifier, CredentialAssertion assertion) { + return httpClient.completeUserActionSigningAsync(challengeIdentifier, assertion) + .thenCompose(userAction -> httpClient.executeWithUserActionAsync("POST", "/vaults/" + vaultId + "/locks", java.util.Map.of(), body, VaultLock.class, userAction)); + } + /** Delegated signing step 1 for Create Vault Transfer: returns the challenge to sign out-of-band. */ public CompletableFuture createVaultTransferInit(String vaultId, CreateVaultTransferRequest body) { return httpClient.createUserActionChallengeAsync("POST", "/vaults/" + vaultId + "/transfers", body); @@ -54,6 +70,22 @@ public CompletableFuture createVaultTransferComplete(String vau .thenCompose(userAction -> httpClient.executeWithUserActionAsync("POST", "/vaults/" + vaultId + "/transfers", java.util.Map.of(), body, TransferRequest.class, userAction)); } + /** Get Vault Lock */ + public CompletableFuture getVaultLock(String vaultId, String lockId) { + return httpClient.getAsync("/vaults/" + vaultId + "/locks/" + lockId, java.util.Map.of(), VaultLock.class); + } + + /** Delegated signing step 1 for Delete Vault Lock: returns the challenge to sign out-of-band. */ + public CompletableFuture deleteVaultLockInit(String vaultId, String lockId) { + return httpClient.createUserActionChallengeAsync("DELETE", "/vaults/" + vaultId + "/locks/" + lockId, null); + } + + /** Delegated signing step 2 for Delete Vault Lock: submits the signed challenge and issues the request. */ + public CompletableFuture deleteVaultLockComplete(String vaultId, String lockId, String challengeIdentifier, CredentialAssertion assertion) { + return httpClient.completeUserActionSigningAsync(challengeIdentifier, assertion) + .thenCompose(userAction -> httpClient.executeWithUserActionAsync("DELETE", "/vaults/" + vaultId + "/locks/" + lockId, java.util.Map.of(), null, VaultLock.class, userAction)); + } + /** Get Vault */ public CompletableFuture getVault(String vaultId) { return httpClient.getAsync("/vaults/" + vaultId, java.util.Map.of(), Vault.class); @@ -80,6 +112,17 @@ public CompletableFuture> listVaultBalances(Str return httpClient.getAsync("/vaults/" + vaultId + "/balances", query.toMap(), new com.fasterxml.jackson.core.type.TypeReference>() {}); } + /** Delegated signing step 1 for Release Quarantine: returns the challenge to sign out-of-band. */ + public CompletableFuture releaseQuarantineInit(String vaultId, String quarantineId, ReleaseQuarantineRequest body) { + return httpClient.createUserActionChallengeAsync("POST", "/vaults/" + vaultId + "/quarantines/" + quarantineId + "/release", body); + } + + /** Delegated signing step 2 for Release Quarantine: submits the signed challenge and issues the request. */ + public CompletableFuture releaseQuarantineComplete(String vaultId, String quarantineId, ReleaseQuarantineRequest body, String challengeIdentifier, CredentialAssertion assertion) { + return httpClient.completeUserActionSigningAsync(challengeIdentifier, assertion) + .thenCompose(userAction -> httpClient.executeWithUserActionAsync("POST", "/vaults/" + vaultId + "/quarantines/" + quarantineId + "/release", java.util.Map.of(), body, ReleaseQuarantineResponse.class, userAction)); + } + /** Delegated signing step 1 for Tag Vault: returns the challenge to sign out-of-band. */ public CompletableFuture tagVaultInit(String vaultId, TagVaultRequest body) { return httpClient.createUserActionChallengeAsync("PUT", "/vaults/" + vaultId + "/tags", body); @@ -103,15 +146,4 @@ public CompletableFuture> untagVaultComplete(String vaultId, return httpClient.completeUserActionSigningAsync(challengeIdentifier, assertion) .thenCompose(userAction -> httpClient.executeWithUserActionAsync("DELETE", "/vaults/" + vaultId + "/tags", java.util.Map.of(), body, (Class>) (Class) Map.class, userAction)); } - - /** Delegated signing step 1 for Unquarantine: returns the challenge to sign out-of-band. */ - public CompletableFuture unquarantineInit(String vaultId, String quarantineId, UnquarantineRequest body) { - return httpClient.createUserActionChallengeAsync("DELETE", "/vaults/" + vaultId + "/quarantines/" + quarantineId, body); - } - - /** Delegated signing step 2 for Unquarantine: submits the signed challenge and issues the request. */ - public CompletableFuture unquarantineComplete(String vaultId, String quarantineId, UnquarantineRequest body, String challengeIdentifier, CredentialAssertion assertion) { - return httpClient.completeUserActionSigningAsync(challengeIdentifier, assertion) - .thenCompose(userAction -> httpClient.executeWithUserActionAsync("DELETE", "/vaults/" + vaultId + "/quarantines/" + quarantineId, java.util.Map.of(), body, UnquarantineResponse.class, userAction)); - } } diff --git a/src/main/java/co/dfns/sdk/vaults/DelegatedVaultsClient.java b/src/main/java/co/dfns/sdk/vaults/DelegatedVaultsClient.java index 0a12751..ac7b58d 100644 --- a/src/main/java/co/dfns/sdk/vaults/DelegatedVaultsClient.java +++ b/src/main/java/co/dfns/sdk/vaults/DelegatedVaultsClient.java @@ -42,6 +42,22 @@ public VaultAddress createVaultAddressComplete(String vaultId, CreateVaultAddres return httpClient.executeWithUserAction("POST", "/vaults/" + vaultId + "/addresses", java.util.Map.of(), body, VaultAddress.class, userAction); } + /** List Vault Locks */ + public PaginatedList listVaultLocks(String vaultId, ListVaultLocksQuery query) { + return httpClient.get("/vaults/" + vaultId + "/locks", query.toMap(), new com.fasterxml.jackson.core.type.TypeReference>() {}); + } + + /** Delegated signing step 1 for Create Vault Lock: returns the challenge to sign out-of-band. */ + public UserActionChallenge createVaultLockInit(String vaultId, CreateVaultLockRequest body) { + return httpClient.createUserActionChallenge("POST", "/vaults/" + vaultId + "/locks", body); + } + + /** Delegated signing step 2 for Create Vault Lock: submits the signed challenge and issues the request. */ + public VaultLock createVaultLockComplete(String vaultId, CreateVaultLockRequest body, String challengeIdentifier, CredentialAssertion assertion) { + String userAction = httpClient.completeUserActionSigning(challengeIdentifier, assertion); + return httpClient.executeWithUserAction("POST", "/vaults/" + vaultId + "/locks", java.util.Map.of(), body, VaultLock.class, userAction); + } + /** Delegated signing step 1 for Create Vault Transfer: returns the challenge to sign out-of-band. */ public UserActionChallenge createVaultTransferInit(String vaultId, CreateVaultTransferRequest body) { return httpClient.createUserActionChallenge("POST", "/vaults/" + vaultId + "/transfers", body); @@ -53,6 +69,22 @@ public TransferRequest createVaultTransferComplete(String vaultId, CreateVaultTr return httpClient.executeWithUserAction("POST", "/vaults/" + vaultId + "/transfers", java.util.Map.of(), body, TransferRequest.class, userAction); } + /** Get Vault Lock */ + public VaultLock getVaultLock(String vaultId, String lockId) { + return httpClient.get("/vaults/" + vaultId + "/locks/" + lockId, java.util.Map.of(), VaultLock.class); + } + + /** Delegated signing step 1 for Delete Vault Lock: returns the challenge to sign out-of-band. */ + public UserActionChallenge deleteVaultLockInit(String vaultId, String lockId) { + return httpClient.createUserActionChallenge("DELETE", "/vaults/" + vaultId + "/locks/" + lockId, null); + } + + /** Delegated signing step 2 for Delete Vault Lock: submits the signed challenge and issues the request. */ + public VaultLock deleteVaultLockComplete(String vaultId, String lockId, String challengeIdentifier, CredentialAssertion assertion) { + String userAction = httpClient.completeUserActionSigning(challengeIdentifier, assertion); + return httpClient.executeWithUserAction("DELETE", "/vaults/" + vaultId + "/locks/" + lockId, java.util.Map.of(), null, VaultLock.class, userAction); + } + /** Get Vault */ public Vault getVault(String vaultId) { return httpClient.get("/vaults/" + vaultId, java.util.Map.of(), Vault.class); @@ -79,6 +111,17 @@ public PaginatedList listVaultBalances(String vaultId, ListVa return httpClient.get("/vaults/" + vaultId + "/balances", query.toMap(), new com.fasterxml.jackson.core.type.TypeReference>() {}); } + /** Delegated signing step 1 for Release Quarantine: returns the challenge to sign out-of-band. */ + public UserActionChallenge releaseQuarantineInit(String vaultId, String quarantineId, ReleaseQuarantineRequest body) { + return httpClient.createUserActionChallenge("POST", "/vaults/" + vaultId + "/quarantines/" + quarantineId + "/release", body); + } + + /** Delegated signing step 2 for Release Quarantine: submits the signed challenge and issues the request. */ + public ReleaseQuarantineResponse releaseQuarantineComplete(String vaultId, String quarantineId, ReleaseQuarantineRequest body, String challengeIdentifier, CredentialAssertion assertion) { + String userAction = httpClient.completeUserActionSigning(challengeIdentifier, assertion); + return httpClient.executeWithUserAction("POST", "/vaults/" + vaultId + "/quarantines/" + quarantineId + "/release", java.util.Map.of(), body, ReleaseQuarantineResponse.class, userAction); + } + /** Delegated signing step 1 for Tag Vault: returns the challenge to sign out-of-band. */ public UserActionChallenge tagVaultInit(String vaultId, TagVaultRequest body) { return httpClient.createUserActionChallenge("PUT", "/vaults/" + vaultId + "/tags", body); @@ -102,15 +145,4 @@ public Map untagVaultComplete(String vaultId, UntagVaultRequest String userAction = httpClient.completeUserActionSigning(challengeIdentifier, assertion); return httpClient.executeWithUserAction("DELETE", "/vaults/" + vaultId + "/tags", java.util.Map.of(), body, (Class>) (Class) Map.class, userAction); } - - /** Delegated signing step 1 for Unquarantine: returns the challenge to sign out-of-band. */ - public UserActionChallenge unquarantineInit(String vaultId, String quarantineId, UnquarantineRequest body) { - return httpClient.createUserActionChallenge("DELETE", "/vaults/" + vaultId + "/quarantines/" + quarantineId, body); - } - - /** Delegated signing step 2 for Unquarantine: submits the signed challenge and issues the request. */ - public UnquarantineResponse unquarantineComplete(String vaultId, String quarantineId, UnquarantineRequest body, String challengeIdentifier, CredentialAssertion assertion) { - String userAction = httpClient.completeUserActionSigning(challengeIdentifier, assertion); - return httpClient.executeWithUserAction("DELETE", "/vaults/" + vaultId + "/quarantines/" + quarantineId, java.util.Map.of(), body, UnquarantineResponse.class, userAction); - } } diff --git a/src/main/java/co/dfns/sdk/vaults/VaultsAsyncClient.java b/src/main/java/co/dfns/sdk/vaults/VaultsAsyncClient.java index 003cf89..f7654ec 100644 --- a/src/main/java/co/dfns/sdk/vaults/VaultsAsyncClient.java +++ b/src/main/java/co/dfns/sdk/vaults/VaultsAsyncClient.java @@ -29,11 +29,31 @@ public CompletableFuture createVaultAddress(String vaultId, Create return httpClient.postAsync("/vaults/" + vaultId + "/addresses", java.util.Map.of(), body, VaultAddress.class, true); } + /** List Vault Locks */ + public CompletableFuture> listVaultLocks(String vaultId, ListVaultLocksQuery query) { + return httpClient.getAsync("/vaults/" + vaultId + "/locks", query.toMap(), new com.fasterxml.jackson.core.type.TypeReference>() {}); + } + + /** Create Vault Lock */ + public CompletableFuture createVaultLock(String vaultId, CreateVaultLockRequest body) { + return httpClient.postAsync("/vaults/" + vaultId + "/locks", java.util.Map.of(), body, VaultLock.class, true); + } + /** Create Vault Transfer */ public CompletableFuture createVaultTransfer(String vaultId, CreateVaultTransferRequest body) { return httpClient.postAsync("/vaults/" + vaultId + "/transfers", java.util.Map.of(), body, TransferRequest.class, true); } + /** Get Vault Lock */ + public CompletableFuture getVaultLock(String vaultId, String lockId) { + return httpClient.getAsync("/vaults/" + vaultId + "/locks/" + lockId, java.util.Map.of(), VaultLock.class); + } + + /** Delete Vault Lock */ + public CompletableFuture deleteVaultLock(String vaultId, String lockId) { + return httpClient.deleteAsync("/vaults/" + vaultId + "/locks/" + lockId, java.util.Map.of(), null, VaultLock.class, true); + } + /** Get Vault */ public CompletableFuture getVault(String vaultId) { return httpClient.getAsync("/vaults/" + vaultId, java.util.Map.of(), Vault.class); @@ -54,6 +74,11 @@ public CompletableFuture> listVaultBalances(Str return httpClient.getAsync("/vaults/" + vaultId + "/balances", query.toMap(), new com.fasterxml.jackson.core.type.TypeReference>() {}); } + /** Release Quarantine */ + public CompletableFuture releaseQuarantine(String vaultId, String quarantineId, ReleaseQuarantineRequest body) { + return httpClient.postAsync("/vaults/" + vaultId + "/quarantines/" + quarantineId + "/release", java.util.Map.of(), body, ReleaseQuarantineResponse.class, true); + } + /** Tag Vault */ @SuppressWarnings("unchecked") public CompletableFuture> tagVault(String vaultId, TagVaultRequest body) { @@ -65,9 +90,4 @@ public CompletableFuture> tagVault(String vaultId, TagVaultR public CompletableFuture> untagVault(String vaultId, UntagVaultRequest body) { return httpClient.deleteAsync("/vaults/" + vaultId + "/tags", java.util.Map.of(), body, (Class>) (Class) Map.class, true); } - - /** Unquarantine */ - public CompletableFuture unquarantine(String vaultId, String quarantineId, UnquarantineRequest body) { - return httpClient.deleteAsync("/vaults/" + vaultId + "/quarantines/" + quarantineId, java.util.Map.of(), body, UnquarantineResponse.class, true); - } } diff --git a/src/main/java/co/dfns/sdk/vaults/VaultsClient.java b/src/main/java/co/dfns/sdk/vaults/VaultsClient.java index c725dd5..90075ec 100644 --- a/src/main/java/co/dfns/sdk/vaults/VaultsClient.java +++ b/src/main/java/co/dfns/sdk/vaults/VaultsClient.java @@ -28,11 +28,31 @@ public VaultAddress createVaultAddress(String vaultId, CreateVaultAddressRequest return httpClient.post("/vaults/" + vaultId + "/addresses", java.util.Map.of(), body, VaultAddress.class, true); } + /** List Vault Locks */ + public PaginatedList listVaultLocks(String vaultId, ListVaultLocksQuery query) { + return httpClient.get("/vaults/" + vaultId + "/locks", query.toMap(), new com.fasterxml.jackson.core.type.TypeReference>() {}); + } + + /** Create Vault Lock */ + public VaultLock createVaultLock(String vaultId, CreateVaultLockRequest body) { + return httpClient.post("/vaults/" + vaultId + "/locks", java.util.Map.of(), body, VaultLock.class, true); + } + /** Create Vault Transfer */ public TransferRequest createVaultTransfer(String vaultId, CreateVaultTransferRequest body) { return httpClient.post("/vaults/" + vaultId + "/transfers", java.util.Map.of(), body, TransferRequest.class, true); } + /** Get Vault Lock */ + public VaultLock getVaultLock(String vaultId, String lockId) { + return httpClient.get("/vaults/" + vaultId + "/locks/" + lockId, java.util.Map.of(), VaultLock.class); + } + + /** Delete Vault Lock */ + public VaultLock deleteVaultLock(String vaultId, String lockId) { + return httpClient.delete("/vaults/" + vaultId + "/locks/" + lockId, java.util.Map.of(), null, VaultLock.class, true); + } + /** Get Vault */ public Vault getVault(String vaultId) { return httpClient.get("/vaults/" + vaultId, java.util.Map.of(), Vault.class); @@ -53,6 +73,11 @@ public PaginatedList listVaultBalances(String vaultId, ListVa return httpClient.get("/vaults/" + vaultId + "/balances", query.toMap(), new com.fasterxml.jackson.core.type.TypeReference>() {}); } + /** Release Quarantine */ + public ReleaseQuarantineResponse releaseQuarantine(String vaultId, String quarantineId, ReleaseQuarantineRequest body) { + return httpClient.post("/vaults/" + vaultId + "/quarantines/" + quarantineId + "/release", java.util.Map.of(), body, ReleaseQuarantineResponse.class, true); + } + /** Tag Vault */ @SuppressWarnings("unchecked") public Map tagVault(String vaultId, TagVaultRequest body) { @@ -64,9 +89,4 @@ public Map tagVault(String vaultId, TagVaultRequest body) { public Map untagVault(String vaultId, UntagVaultRequest body) { return httpClient.delete("/vaults/" + vaultId + "/tags", java.util.Map.of(), body, (Class>) (Class) Map.class, true); } - - /** Unquarantine */ - public UnquarantineResponse unquarantine(String vaultId, String quarantineId, UnquarantineRequest body) { - return httpClient.delete("/vaults/" + vaultId + "/quarantines/" + quarantineId, java.util.Map.of(), body, UnquarantineResponse.class, true); - } } diff --git a/src/main/java/co/dfns/sdk/vaults/model/CreateVaultAddressRequest.java b/src/main/java/co/dfns/sdk/vaults/model/CreateVaultAddressRequest.java index c3e912e..9240779 100644 --- a/src/main/java/co/dfns/sdk/vaults/model/CreateVaultAddressRequest.java +++ b/src/main/java/co/dfns/sdk/vaults/model/CreateVaultAddressRequest.java @@ -5,5 +5,5 @@ @JsonIgnoreProperties(ignoreUnknown = true) public record CreateVaultAddressRequest( - @JsonProperty("network") String network + @JsonProperty("network") Object network ) {} diff --git a/src/main/java/co/dfns/sdk/vaults/model/CreateVaultLockRequest.java b/src/main/java/co/dfns/sdk/vaults/model/CreateVaultLockRequest.java new file mode 100644 index 0000000..f8c5f37 --- /dev/null +++ b/src/main/java/co/dfns/sdk/vaults/model/CreateVaultLockRequest.java @@ -0,0 +1,16 @@ +package co.dfns.sdk.vaults.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonInclude; + +@JsonIgnoreProperties(ignoreUnknown = true) +public record CreateVaultLockRequest( + @JsonProperty("network") String network, + @JsonProperty("tid") String tid, + @JsonProperty("amount") String amount, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("externalId") String externalId, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("reason") String reason +) {} diff --git a/src/main/java/co/dfns/sdk/vaults/model/CreateVaultTransferRequest.java b/src/main/java/co/dfns/sdk/vaults/model/CreateVaultTransferRequest.java index a0df3b0..fd83a10 100644 --- a/src/main/java/co/dfns/sdk/vaults/model/CreateVaultTransferRequest.java +++ b/src/main/java/co/dfns/sdk/vaults/model/CreateVaultTransferRequest.java @@ -6,7 +6,7 @@ @JsonIgnoreProperties(ignoreUnknown = true) public record CreateVaultTransferRequest( - @JsonProperty("network") String network, + @JsonProperty("network") Object network, @JsonProperty("tid") String tid, @JsonProperty("to") String to, @JsonProperty("amount") String amount, diff --git a/src/main/java/co/dfns/sdk/vaults/model/ListVaultLocksQuery.java b/src/main/java/co/dfns/sdk/vaults/model/ListVaultLocksQuery.java new file mode 100644 index 0000000..a243c53 --- /dev/null +++ b/src/main/java/co/dfns/sdk/vaults/model/ListVaultLocksQuery.java @@ -0,0 +1,40 @@ +package co.dfns.sdk.vaults.model; + +import java.util.HashMap; +import java.util.Map; + +public class ListVaultLocksQuery { + private Long limit; + private String paginationToken; + private String network; + private String tid; + + public ListVaultLocksQuery limit(Long limit) { + this.limit = limit; + return this; + } + + public ListVaultLocksQuery paginationToken(String paginationToken) { + this.paginationToken = paginationToken; + return this; + } + + public ListVaultLocksQuery network(String network) { + this.network = network; + return this; + } + + public ListVaultLocksQuery tid(String tid) { + this.tid = tid; + return this; + } + + public Map toMap() { + Map map = new HashMap<>(); + if (limit != null) map.put("limit", String.valueOf(limit)); + if (paginationToken != null) map.put("paginationToken", String.valueOf(paginationToken)); + if (network != null) map.put("network", String.valueOf(network)); + if (tid != null) map.put("tid", String.valueOf(tid)); + return map; + } +} diff --git a/src/main/java/co/dfns/sdk/vaults/model/ReleaseQuarantineRequest.java b/src/main/java/co/dfns/sdk/vaults/model/ReleaseQuarantineRequest.java new file mode 100644 index 0000000..08de3bc --- /dev/null +++ b/src/main/java/co/dfns/sdk/vaults/model/ReleaseQuarantineRequest.java @@ -0,0 +1,11 @@ +package co.dfns.sdk.vaults.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonInclude; + +@JsonIgnoreProperties(ignoreUnknown = true) +public record ReleaseQuarantineRequest( + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("reason") String reason +) {} diff --git a/src/main/java/co/dfns/sdk/vaults/model/ReleaseQuarantineResponse.java b/src/main/java/co/dfns/sdk/vaults/model/ReleaseQuarantineResponse.java new file mode 100644 index 0000000..be2d965 --- /dev/null +++ b/src/main/java/co/dfns/sdk/vaults/model/ReleaseQuarantineResponse.java @@ -0,0 +1,9 @@ +package co.dfns.sdk.vaults.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonIgnoreProperties(ignoreUnknown = true) +public record ReleaseQuarantineResponse( + @JsonProperty("status") String status +) {} diff --git a/src/main/java/co/dfns/sdk/vaults/model/VaultBalanceEntry.java b/src/main/java/co/dfns/sdk/vaults/model/VaultBalanceEntry.java index 1fc54ba..e2293ca 100644 --- a/src/main/java/co/dfns/sdk/vaults/model/VaultBalanceEntry.java +++ b/src/main/java/co/dfns/sdk/vaults/model/VaultBalanceEntry.java @@ -14,5 +14,7 @@ public record VaultBalanceEntry( @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty("transferId") String transferId, @JsonInclude(JsonInclude.Include.NON_NULL) - @JsonProperty("quarantineId") String quarantineId + @JsonProperty("quarantineId") String quarantineId, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("lockId") String lockId ) {} diff --git a/src/main/java/co/dfns/sdk/vaults/model/VaultLock.java b/src/main/java/co/dfns/sdk/vaults/model/VaultLock.java new file mode 100644 index 0000000..d89ed5a --- /dev/null +++ b/src/main/java/co/dfns/sdk/vaults/model/VaultLock.java @@ -0,0 +1,22 @@ +package co.dfns.sdk.vaults.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonInclude; + +@JsonIgnoreProperties(ignoreUnknown = true) +public record VaultLock( + @JsonProperty("id") String id, + @JsonProperty("vaultId") String vaultId, + @JsonProperty("network") String network, + @JsonProperty("tid") String tid, + @JsonProperty("amount") String amount, + @JsonProperty("owner") String owner, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("externalId") String externalId, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("reason") String reason, + @JsonProperty("dateCreated") String dateCreated, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("dateDeleted") String dateDeleted +) {} diff --git a/src/main/java/co/dfns/sdk/wallets/model/GetWalletHistoryResponse.java b/src/main/java/co/dfns/sdk/wallets/model/GetWalletHistoryResponse.java index 31d60fd..c83f180 100644 --- a/src/main/java/co/dfns/sdk/wallets/model/GetWalletHistoryResponse.java +++ b/src/main/java/co/dfns/sdk/wallets/model/GetWalletHistoryResponse.java @@ -7,7 +7,7 @@ @JsonIgnoreProperties(ignoreUnknown = true) public record GetWalletHistoryResponse( - @JsonProperty("items") List items, + @JsonProperty("items") List items, @JsonInclude(JsonInclude.Include.NON_NULL) @JsonProperty("nextPageToken") String nextPageToken, @JsonProperty("walletId") String walletId, diff --git a/src/main/java/co/dfns/sdk/wallets/model/WalletHistoryEvent.java b/src/main/java/co/dfns/sdk/wallets/model/WalletHistoryEvent.java new file mode 100644 index 0000000..7e2f129 --- /dev/null +++ b/src/main/java/co/dfns/sdk/wallets/model/WalletHistoryEvent.java @@ -0,0 +1,38 @@ +package co.dfns.sdk.wallets.model; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonInclude; +import java.util.Map; + +@JsonIgnoreProperties(ignoreUnknown = true) +public record WalletHistoryEvent( + @JsonProperty("walletId") String walletId, + @JsonProperty("direction") String direction, + @JsonProperty("network") Network network, + @JsonProperty("blockNumber") double blockNumber, + @JsonProperty("txHash") String txHash, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("index") String index, + @JsonProperty("timestamp") String timestamp, + @JsonProperty("status") String status, + @JsonProperty("metadata") Map metadata, + @JsonProperty("kind") String kind, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("from") String from, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("to") String to, + @JsonProperty("value") String value, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("fee") String fee, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("memo") String memo, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("liquidityPool") String liquidityPool, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("balanceId") String balanceId, + @JsonProperty("symbol") String symbol, + @JsonProperty("decimals") double decimals, + @JsonInclude(JsonInclude.Include.NON_NULL) + @JsonProperty("verified") Boolean verified +) {}