Skip to content

Commit c593207

Browse files
authored
feat(cat-voices): Update stakeAssets endpoint to v2 (#3621)
1 parent fcc5adb commit c593207

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

catalyst_voices/packages/internal/catalyst_voices_repositories/lib/src/api/dio_cat_gateway_service.dart

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ import 'package:dio/dio.dart';
1717
/// # Catalyst Gateway API.
1818
/// The Catalyst Gateway API provides realtime data for all prior, current and future Catalyst Voices voting events.
1919
///
20-
/// Based on OpenAPI Catalyst Gateway API version 0.3.0
21-
/// catalyst-openapi/v0.3.0 - https://github.com/input-output-hk/catalyst-voices/releases/tag/catalyst-openapi%2Fv0.3.0
20+
/// Based on OpenAPI Catalyst Gateway API version 0.7.0
21+
/// catalyst-openapi/v0.7.0 - https://github.com/input-output-hk/catalyst-voices/releases/tag/catalyst-openapi%2Fv0.7.0
2222
abstract interface class CatGatewayService {
2323
factory CatGatewayService.dio({
2424
required String baseUrl,
@@ -98,12 +98,15 @@ abstract interface class CatGatewayService {
9898
bool? showAllInvalid,
9999
});
100100

101-
/// Get staked assets.
101+
/// Get staked assets v2.
102102
/// This endpoint returns the total Cardano's staked assets to the corresponded
103103
/// user's stake address.
104104
///
105-
/// [stakeAddress] The stake address of the user.
105+
/// [stakeAddress] Cardano stake address, also known as a reward address. An optional stake address of the user.
106106
/// Should be a valid Bech32 encoded address followed by the https://cips.cardano.org/cip/CIP-19/#stake-addresses.
107+
/// If missing, a list of associated stake addresses is taken using the RBAC token (for one RBAC registration
108+
/// chain could be assigned multiple different cardano stake addresses). An aggregated response would be returned
109+
/// (total ADA sum across all stake addresses, an aggregated native tokens list across all stake addresses etc.)
107110
/// [network] Cardano network type.
108111
/// If omitted network type is identified from the stake address.
109112
/// If specified it must be correspondent to the network type encoded in the stake address.
@@ -113,7 +116,7 @@ abstract interface class CatGatewayService {
113116
/// [asat] A time point at which the assets should be calculated.
114117
/// If omitted latest slot number is used.
115118
Future<FullStakeInfo> stakeAssets({
116-
required String stakeAddress,
119+
String? stakeAddress,
117120
Network? network,
118121
String? asat,
119122
String? authorization,
@@ -209,14 +212,15 @@ final class DioCatGatewayService implements CatGatewayService {
209212

210213
@override
211214
Future<FullStakeInfo> stakeAssets({
212-
required String stakeAddress,
215+
String? stakeAddress,
213216
Network? network,
214217
String? asat,
215218
String? authorization,
216219
}) {
217220
return _dio.get<Map<String, dynamic>, FullStakeInfo>(
218-
'/v1/cardano/assets/$stakeAddress',
221+
'/v2/cardano/assets',
219222
queryParameters: {
223+
'stake_address': ?stakeAddress,
220224
'network': ?network?.value,
221225
'asat': ?asat,
222226
},

0 commit comments

Comments
 (0)