Skip to content

Commit 55aca4a

Browse files
committed
V2.5.0
- Fix variable types in some API models
1 parent 39e426f commit 55aca4a

File tree

9 files changed

+33
-32
lines changed

9 files changed

+33
-32
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 2.5.0
2+
- Fix variable types in some API models
3+
14
## 2.4.0
25

36
- Update dependencies.

assets/chains.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

cosmos_chain_builder.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,12 @@ void main() async {
5151
ChainRegistryProvider(ChainRegistryHTTPProvider(url: getUrl(chain)));
5252
final chains =
5353
await provider.request(ChainRegistryRequestCosmosDirectoryChains());
54-
print("chains done!");
5554
final List<Map<String, dynamic>> infos = [];
5655
for (final i in chains) {
5756
final data = await provider
5857
.request(ChainRegistryRequestCosmosDirectoryChain(chainName: i.name));
5958
final natvieAsset = data.assets?.firstWhere((e) => e.denom == i.denom);
6059
if (natvieAsset == null) {
61-
print("native not found ${i.chainId}");
6260
continue;
6361
}
6462
List<String> accountPageUrls = [];
@@ -124,12 +122,10 @@ void main() async {
124122
fees.add(fee);
125123
}
126124
if (fees.isEmpty) {
127-
print("noo fee ${data.chainId}");
128125
continue;
129126
}
130127
chainData["fees"] = fees;
131128
infos.add(chainData);
132-
print("done ${data.chainId}");
133129
}
134130
chainInfos[chain.name] = infos;
135131
}

example/test/test_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
void main() {}
1+
void main() async {}

lib/src/models/sdk_v1beta1/cosmos_tx_v1beta1/query/get_tx_request.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class GetTxRequest extends CosmosMessage with QueryMessage<GetTxResponse> {
2323

2424
@override
2525
GetTxResponse onResponse(List<int> bytes) {
26+
print("got bytes ? $bytes");
2627
return GetTxResponse.deserialize(bytes);
2728
}
2829

lib/src/provider/chain_registery/models/models/cosmos_sdk.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ class CosmosSdkAsset {
2828
required this.imageSvg,
2929
required this.coingeckoId,
3030
required this.symbol,
31-
required this.averageGasPrice,
32-
required this.lowGasPrice,
33-
required this.fixedMinGasPrice,
34-
required this.highGasPrice});
31+
this.averageGasPrice,
32+
this.lowGasPrice,
33+
this.fixedMinGasPrice,
34+
this.highGasPrice});
3535
factory CosmosSdkAsset.fromJson(Map<String, dynamic> json) {
3636
return CosmosSdkAsset(
3737
name: json.as("name"),

lib/src/provider/thornode/methods/quote/swap_quote.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ class ThorNodeRequestSwapQuote extends ThorNodeRequestParam<
8282

8383
@override
8484
ThoreNodeQouteSwapResponse onResonse(Map<String, dynamic> result) {
85+
print("result $result");
8586
return ThoreNodeQouteSwapResponse.fromJson(result);
8687
}
8788
}

lib/src/provider/thornode/models/models/quote_response.dart

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import 'package:cosmos_sdk/src/utils/quick.dart';
33
class ThoreNodeQouteSwapResponse {
44
final String inboundAddress;
55
final BigInt? inboundConfirmationBlocks;
6-
final BigInt? inboundConfirmationSeconds;
6+
final int inboundConfirmationSeconds;
77
final BigInt? outboundDelayBlocks;
88
final BigInt? outboundDelaySeconds;
99
final String? router;
@@ -16,10 +16,10 @@ class ThoreNodeQouteSwapResponse {
1616
final String? gasRateUnits;
1717
final String? memo;
1818
final BigInt expectedAmountOut;
19-
final BigInt? maxStreamingQuantity;
20-
final BigInt? streamingSwapBlocks;
21-
final BigInt? streamingSwapSeconds;
22-
final int? totalSwapSeconds;
19+
final int maxStreamingQuantity;
20+
final int streamingSwapBlocks;
21+
final int streamingSwapSeconds;
22+
final int totalSwapSeconds;
2323
final ThoreNodeQouteSwapFeeResponse fees;
2424
ThoreNodeQouteSwapResponse(
2525
{required this.inboundAddress,
@@ -48,7 +48,7 @@ class ThoreNodeQouteSwapResponse {
4848
inboundAddress: json.as("inbound_address"),
4949
inboundConfirmationBlocks: json.asBigInt("inbound_confirmation_blocks"),
5050
inboundConfirmationSeconds:
51-
json.asBigInt("inbound_confirmation_seconds"),
51+
json.asInt<int?>("inbound_confirmation_seconds") ?? 0,
5252
outboundDelayBlocks: json.asBigInt("outbound_delay_blocks"),
5353
outboundDelaySeconds: json.asBigInt("outbound_delay_seconds"),
5454
router: json.as("router"),
@@ -61,17 +61,17 @@ class ThoreNodeQouteSwapResponse {
6161
gasRateUnits: json.as("gas_rate_units"),
6262
memo: json.as("memo"),
6363
expectedAmountOut: json.asBigInt("expected_amount_out"),
64-
maxStreamingQuantity: json.asBigInt("max_streaming_quantity"),
65-
streamingSwapBlocks: json.asBigInt("streaming_swap_blocks"),
66-
streamingSwapSeconds: json.asBigInt("streaming_swap_seconds"),
67-
totalSwapSeconds: json.asInt("total_swap_seconds"),
64+
maxStreamingQuantity: json.asInt<int?>("max_streaming_quantity") ?? 0,
65+
streamingSwapBlocks: json.asInt<int?>("streaming_swap_blocks") ?? 0,
66+
streamingSwapSeconds: json.asInt<int?>("streaming_swap_seconds") ?? 0,
67+
totalSwapSeconds: json.asInt<int?>("total_swap_seconds") ?? 0,
6868
fees: ThoreNodeQouteSwapFeeResponse.fromJson(json.asMap("fees")));
6969
}
7070
Map<String, dynamic> toJson() {
7171
return {
7272
"inbound_address": inboundAddress,
7373
"inbound_confirmation_blocks": inboundConfirmationBlocks?.toString(),
74-
"inbound_confirmation_seconds": inboundConfirmationSeconds?.toString(),
74+
"inbound_confirmation_seconds": inboundConfirmationSeconds.toString(),
7575
"outbound_delay_blocks": outboundDelayBlocks?.toString(),
7676
"outbound_delay_seconds": outboundDelaySeconds?.toString(),
7777
"router": router,
@@ -84,10 +84,10 @@ class ThoreNodeQouteSwapResponse {
8484
"gas_rate_units": gasRateUnits,
8585
"memo": memo,
8686
"expected_amount_out": expectedAmountOut.toString(),
87-
"max_streaming_quantity": maxStreamingQuantity?.toString(),
88-
"streaming_swap_blocks": streamingSwapBlocks?.toString(),
89-
"streaming_swap_seconds": streamingSwapSeconds?.toString(),
90-
"total_swap_seconds": totalSwapSeconds?.toString(),
87+
"max_streaming_quantity": maxStreamingQuantity,
88+
"streaming_swap_blocks": streamingSwapBlocks,
89+
"streaming_swap_seconds": streamingSwapSeconds,
90+
"total_swap_seconds": totalSwapSeconds,
9191
"fees": fees.toJson(),
9292
};
9393
}
@@ -99,8 +99,8 @@ class ThoreNodeQouteSwapFeeResponse {
9999
final String? outbound;
100100
final String liquidity;
101101
final String total;
102-
final BigInt slippageBps;
103-
final BigInt totalBps;
102+
final int slippageBps;
103+
final int totalBps;
104104
const ThoreNodeQouteSwapFeeResponse(
105105
{required this.asset,
106106
required this.affiliate,
@@ -116,8 +116,8 @@ class ThoreNodeQouteSwapFeeResponse {
116116
outbound: json.as("outbound"),
117117
liquidity: json.as("liquidity"),
118118
total: json.as("total"),
119-
slippageBps: json.asBigInt("slippage_bps"),
120-
totalBps: json.asBigInt("total_bps"));
119+
slippageBps: json.asInt("slippage_bps"),
120+
totalBps: json.asInt("total_bps"));
121121
}
122122
Map<String, dynamic> toJson() {
123123
return {
@@ -126,8 +126,8 @@ class ThoreNodeQouteSwapFeeResponse {
126126
"outbound": outbound,
127127
"liquidity": liquidity,
128128
"total": total,
129-
"slippage_bps": slippageBps.toString(),
130-
"total_bps": totalBps.toString(),
129+
"slippage_bps": slippageBps,
130+
"total_bps": totalBps,
131131
};
132132
}
133133
}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: cosmos_sdk
22
description: Engage seamlessly with a Cosmos SDK-based network (cosmos hub, osmosis, thor, kujira and etc ... ), enabling the creation, signing, and transmission of transactions. (Beta version)
3-
version: 2.4.0
3+
version: 2.5.0
44
homepage: "https://github.com/mrtnetwork/cosmos_sdk"
55
repository: "https://github.com/mrtnetwork/cosmos_sdk"
66

0 commit comments

Comments
 (0)