From fa6a69b9fa3ad75de6f00466eece7243a9c9959e Mon Sep 17 00:00:00 2001 From: diegolousx Date: Mon, 9 Jun 2025 17:25:53 -0600 Subject: [PATCH 1/2] fix: migrate ServerInfo to null safety and correct numeric types This updates the ServerInfo model and nested classes to be null-safe. Also fixes type mismatches where the API returns floating-point numbers (e.g. reserveBaseXrp) by using double instead of int. --- lib/src/rpc/on_chain_models/server_info.dart | 110 ++++++++++--------- 1 file changed, 58 insertions(+), 52 deletions(-) diff --git a/lib/src/rpc/on_chain_models/server_info.dart b/lib/src/rpc/on_chain_models/server_info.dart index 0ecfe63..f9d3fce 100644 --- a/lib/src/rpc/on_chain_models/server_info.dart +++ b/lib/src/rpc/on_chain_models/server_info.dart @@ -19,25 +19,25 @@ class ServerInfo { class Info { final String? buildVersion; - final String completeLedgers; - final String hostId; - final int initialSyncDurationUs; - final int ioLatencyMs; - final int jqTransOverflow; - final LastClose lastClose; - final int loadFactor; + final String? completeLedgers; + final String? hostId; + final int? initialSyncDurationUs; + final int? ioLatencyMs; + final int? jqTransOverflow; + final LastClose? lastClose; + final int? loadFactor; final int? networkId; - final int peerDisconnects; - final int peerDisconnectsResources; - final int peers; - final String pubkeyNode; - final String serverState; - final int serverStateDurationUs; - final StateAccounting stateAccounting; - final String time; - final int uptime; - final ValidatedLedger validatedLedger; - final int validationQuorum; + final int? peerDisconnects; + final int? peerDisconnectsResources; + final int? peers; + final String? pubkeyNode; + final String? serverState; + final int? serverStateDurationUs; + final StateAccounting? stateAccounting; + final String? time; + final int? uptime; + final ValidatedLedger? validatedLedger; + final int? validationQuorum; Info({ required this.buildVersion, @@ -68,25 +68,31 @@ class Info { completeLedgers: json['complete_ledgers'], hostId: json['hostid'], initialSyncDurationUs: - IntUtils.tryParse(json['initial_sync_duration_us'])!, - ioLatencyMs: IntUtils.tryParse(json['io_latency_ms'])!, - jqTransOverflow: IntUtils.tryParse(json['jq_trans_overflow'])!, - lastClose: LastClose.fromJson(json['last_close']), - loadFactor: IntUtils.tryParse(json['load_factor'])!, + IntUtils.tryParse(json['initial_sync_duration_us']), + ioLatencyMs: IntUtils.tryParse(json['io_latency_ms']), + jqTransOverflow: IntUtils.tryParse(json['jq_trans_overflow']), + lastClose: json['last_close'] != null + ? LastClose.fromJson(json['last_close']) + : null, + loadFactor: IntUtils.tryParse(json['load_factor']), networkId: IntUtils.tryParse(json['network_id']), - peerDisconnects: IntUtils.tryParse(json['peer_disconnects'])!, + peerDisconnects: IntUtils.tryParse(json['peer_disconnects']), peerDisconnectsResources: - IntUtils.tryParse(json['peer_disconnects_resources'])!, - peers: IntUtils.tryParse(json['peers'])!, + IntUtils.tryParse(json['peer_disconnects_resources']), + peers: IntUtils.tryParse(json['peers']), pubkeyNode: json['pubkey_node'], serverState: json['server_state'], serverStateDurationUs: - IntUtils.tryParse(json['server_state_duration_us'])!, - stateAccounting: StateAccounting.fromJson(json['state_accounting']), + IntUtils.tryParse(json['server_state_duration_us']), + stateAccounting: json['state_accounting'] != null + ? StateAccounting.fromJson(json['state_accounting']) + : null, time: json['time'], - uptime: IntUtils.tryParse(json['uptime'])!, - validatedLedger: ValidatedLedger.fromJson(json['validated_ledger']), - validationQuorum: IntUtils.tryParse(json['validation_quorum'])!, + uptime: IntUtils.tryParse(json['uptime']), + validatedLedger: json['validated_ledger'] != null + ? ValidatedLedger.fromJson(json['validated_ledger']) + : null, + validationQuorum: IntUtils.tryParse(json['validation_quorum']), ); } } @@ -135,46 +141,46 @@ class StateAccounting { } class AccountingDuration { - final int durationUs; - final int transitions; + final int? durationUs; + final int? transitions; AccountingDuration({ - required this.durationUs, - required this.transitions, + this.durationUs, + this.transitions, }); factory AccountingDuration.fromJson(Map json) { return AccountingDuration( - durationUs: IntUtils.tryParse(json['duration_us'])!, - transitions: IntUtils.tryParse(json['transitions'])!, + durationUs: IntUtils.tryParse(json['duration_us']), + transitions: IntUtils.tryParse(json['transitions']), ); } } class ValidatedLedger { - final int age; - final double baseFeeXrp; - final String hash; - final int? reserveBaseXrp; - final int? reserveIncXrp; - final int seq; + final int? age; + final double? baseFeeXrp; + final String? hash; + final double? reserveBaseXrp; + final double? reserveIncXrp; + final int? seq; ValidatedLedger({ - required this.age, - required this.baseFeeXrp, - required this.hash, - required this.reserveBaseXrp, - required this.reserveIncXrp, - required this.seq, + this.age, + this.baseFeeXrp, + this.hash, + this.reserveBaseXrp, + this.reserveIncXrp, + this.seq, }); factory ValidatedLedger.fromJson(Map json) { return ValidatedLedger( - age: IntUtils.tryParse(json['age'])!, + age: IntUtils.tryParse(json['age']), baseFeeXrp: json['base_fee_xrp'], hash: json['hash'], - reserveBaseXrp: IntUtils.tryParse(json['reserve_base_xrp']), - reserveIncXrp: IntUtils.tryParse(json['reserve_inc_xrp']), + reserveBaseXrp: json['reserve_base_xrp'], + reserveIncXrp: json['reserve_inc_xrp'], seq: IntUtils.tryParse(json['seq'])!, ); } From 0649357cedc297dddc0a689cad260a897e1492fa Mon Sep 17 00:00:00 2001 From: Mohsen <56779182+mrtnetwork@users.noreply.github.com> Date: Thu, 26 Jun 2025 19:09:52 +0330 Subject: [PATCH 2/2] V5.9.0 - Update dependencies. --- .dart_tool/package_config.json | 7 +- .dart_tool/package_config_subset | 4 +- .dart_tool/package_graph.json | 449 +++++++++++++++++++ .dart_tool/version | 2 +- CHANGELOG.md | 4 + example/pubspec.lock | 22 +- example/pubspec.yaml | 2 +- lib/src/rpc/on_chain_models/server_info.dart | 6 +- pubspec.lock | 4 +- pubspec.yaml | 4 +- 10 files changed, 478 insertions(+), 26 deletions(-) create mode 100644 .dart_tool/package_graph.json diff --git a/.dart_tool/package_config.json b/.dart_tool/package_config.json index cdbff40..2aca5d4 100644 --- a/.dart_tool/package_config.json +++ b/.dart_tool/package_config.json @@ -27,7 +27,7 @@ }, { "name": "blockchain_utils", - "rootUri": "file:///Users/macbookpro/.pub-cache/hosted/pub.dev/blockchain_utils-5.0.0", + "rootUri": "file:///Users/macbookpro/.pub-cache/hosted/pub.dev/blockchain_utils-5.1.0", "packageUri": "lib/", "languageVersion": "3.3" }, @@ -302,10 +302,9 @@ "languageVersion": "3.3" } ], - "generated": "2025-05-06T12:53:46.302656Z", "generator": "pub", - "generatorVersion": "3.7.2", + "generatorVersion": "3.8.1", "flutterRoot": "file:///Users/macbookpro/Documents/flutter", - "flutterVersion": "3.29.3", + "flutterVersion": "3.32.1", "pubCache": "file:///Users/macbookpro/.pub-cache" } diff --git a/.dart_tool/package_config_subset b/.dart_tool/package_config_subset index 49eb7ee..5da6b01 100644 --- a/.dart_tool/package_config_subset +++ b/.dart_tool/package_config_subset @@ -16,8 +16,8 @@ file:///Users/macbookpro/.pub-cache/hosted/pub.dev/async-2.11.0/ file:///Users/macbookpro/.pub-cache/hosted/pub.dev/async-2.11.0/lib/ blockchain_utils 3.3 -file:///Users/macbookpro/.pub-cache/hosted/pub.dev/blockchain_utils-5.0.0/ -file:///Users/macbookpro/.pub-cache/hosted/pub.dev/blockchain_utils-5.0.0/lib/ +file:///Users/macbookpro/.pub-cache/hosted/pub.dev/blockchain_utils-5.1.0/ +file:///Users/macbookpro/.pub-cache/hosted/pub.dev/blockchain_utils-5.1.0/lib/ boolean_selector 2.17 file:///Users/macbookpro/.pub-cache/hosted/pub.dev/boolean_selector-2.1.1/ diff --git a/.dart_tool/package_graph.json b/.dart_tool/package_graph.json new file mode 100644 index 0000000..8f71827 --- /dev/null +++ b/.dart_tool/package_graph.json @@ -0,0 +1,449 @@ +{ + "roots": [ + "xrpl_dart" + ], + "packages": [ + { + "name": "xrpl_dart", + "version": "5.9.0", + "dependencies": [ + "blockchain_utils" + ], + "devDependencies": [ + "flutter_lints", + "lints", + "test" + ] + }, + { + "name": "flutter_lints", + "version": "5.0.0", + "dependencies": [ + "lints" + ] + }, + { + "name": "test", + "version": "1.25.9", + "dependencies": [ + "analyzer", + "async", + "boolean_selector", + "collection", + "coverage", + "http_multi_server", + "io", + "js", + "matcher", + "node_preamble", + "package_config", + "path", + "pool", + "shelf", + "shelf_packages_handler", + "shelf_static", + "shelf_web_socket", + "source_span", + "stack_trace", + "stream_channel", + "test_api", + "test_core", + "typed_data", + "web_socket_channel", + "webkit_inspection_protocol", + "yaml" + ] + }, + { + "name": "lints", + "version": "5.1.1", + "dependencies": [] + }, + { + "name": "blockchain_utils", + "version": "5.1.0", + "dependencies": [] + }, + { + "name": "yaml", + "version": "3.1.2", + "dependencies": [ + "collection", + "source_span", + "string_scanner" + ] + }, + { + "name": "webkit_inspection_protocol", + "version": "1.2.1", + "dependencies": [ + "logging" + ] + }, + { + "name": "web_socket_channel", + "version": "2.4.5", + "dependencies": [ + "async", + "crypto", + "stream_channel", + "web" + ] + }, + { + "name": "typed_data", + "version": "1.3.2", + "dependencies": [ + "collection" + ] + }, + { + "name": "test_core", + "version": "0.6.6", + "dependencies": [ + "analyzer", + "args", + "async", + "boolean_selector", + "collection", + "coverage", + "frontend_server_client", + "glob", + "io", + "meta", + "package_config", + "path", + "pool", + "source_map_stack_trace", + "source_maps", + "source_span", + "stack_trace", + "stream_channel", + "test_api", + "vm_service", + "yaml" + ] + }, + { + "name": "test_api", + "version": "0.7.4", + "dependencies": [ + "async", + "boolean_selector", + "collection", + "meta", + "source_span", + "stack_trace", + "stream_channel", + "string_scanner", + "term_glyph" + ] + }, + { + "name": "stream_channel", + "version": "2.1.2", + "dependencies": [ + "async" + ] + }, + { + "name": "stack_trace", + "version": "1.11.1", + "dependencies": [ + "path" + ] + }, + { + "name": "source_span", + "version": "1.10.0", + "dependencies": [ + "collection", + "path", + "term_glyph" + ] + }, + { + "name": "shelf_web_socket", + "version": "1.0.4", + "dependencies": [ + "shelf", + "stream_channel", + "web_socket_channel" + ] + }, + { + "name": "shelf_static", + "version": "1.1.2", + "dependencies": [ + "convert", + "http_parser", + "mime", + "path", + "shelf" + ] + }, + { + "name": "shelf_packages_handler", + "version": "3.0.2", + "dependencies": [ + "path", + "shelf", + "shelf_static" + ] + }, + { + "name": "shelf", + "version": "1.4.1", + "dependencies": [ + "async", + "collection", + "http_parser", + "path", + "stack_trace", + "stream_channel" + ] + }, + { + "name": "pool", + "version": "1.5.1", + "dependencies": [ + "async", + "stack_trace" + ] + }, + { + "name": "path", + "version": "1.9.0", + "dependencies": [] + }, + { + "name": "package_config", + "version": "2.1.0", + "dependencies": [ + "path" + ] + }, + { + "name": "node_preamble", + "version": "2.0.2", + "dependencies": [] + }, + { + "name": "matcher", + "version": "0.12.16+1", + "dependencies": [ + "async", + "meta", + "stack_trace", + "term_glyph", + "test_api" + ] + }, + { + "name": "js", + "version": "0.7.1", + "dependencies": [] + }, + { + "name": "io", + "version": "1.0.4", + "dependencies": [ + "meta", + "path", + "string_scanner" + ] + }, + { + "name": "http_multi_server", + "version": "3.2.1", + "dependencies": [ + "async" + ] + }, + { + "name": "coverage", + "version": "1.7.2", + "dependencies": [ + "args", + "logging", + "package_config", + "path", + "source_maps", + "stack_trace", + "vm_service" + ] + }, + { + "name": "collection", + "version": "1.18.0", + "dependencies": [] + }, + { + "name": "boolean_selector", + "version": "2.1.1", + "dependencies": [ + "source_span", + "string_scanner" + ] + }, + { + "name": "async", + "version": "2.11.0", + "dependencies": [ + "collection", + "meta" + ] + }, + { + "name": "analyzer", + "version": "6.4.1", + "dependencies": [ + "_fe_analyzer_shared", + "collection", + "convert", + "crypto", + "glob", + "meta", + "package_config", + "path", + "pub_semver", + "source_span", + "watcher", + "yaml" + ] + }, + { + "name": "string_scanner", + "version": "1.2.0", + "dependencies": [ + "source_span" + ] + }, + { + "name": "logging", + "version": "1.2.0", + "dependencies": [] + }, + { + "name": "web", + "version": "0.5.1", + "dependencies": [] + }, + { + "name": "crypto", + "version": "3.0.3", + "dependencies": [ + "typed_data" + ] + }, + { + "name": "vm_service", + "version": "14.2.0", + "dependencies": [] + }, + { + "name": "source_maps", + "version": "0.10.12", + "dependencies": [ + "source_span" + ] + }, + { + "name": "source_map_stack_trace", + "version": "2.1.1", + "dependencies": [ + "path", + "source_maps", + "stack_trace" + ] + }, + { + "name": "meta", + "version": "1.14.0", + "dependencies": [] + }, + { + "name": "glob", + "version": "2.1.2", + "dependencies": [ + "async", + "collection", + "file", + "path", + "string_scanner" + ] + }, + { + "name": "frontend_server_client", + "version": "4.0.0", + "dependencies": [ + "async", + "path" + ] + }, + { + "name": "args", + "version": "2.5.0", + "dependencies": [] + }, + { + "name": "term_glyph", + "version": "1.2.1", + "dependencies": [] + }, + { + "name": "mime", + "version": "1.0.5", + "dependencies": [] + }, + { + "name": "http_parser", + "version": "4.0.2", + "dependencies": [ + "collection", + "source_span", + "string_scanner", + "typed_data" + ] + }, + { + "name": "convert", + "version": "3.1.1", + "dependencies": [ + "typed_data" + ] + }, + { + "name": "watcher", + "version": "1.1.0", + "dependencies": [ + "async", + "path" + ] + }, + { + "name": "pub_semver", + "version": "2.1.4", + "dependencies": [ + "collection", + "meta" + ] + }, + { + "name": "_fe_analyzer_shared", + "version": "67.0.0", + "dependencies": [ + "meta" + ] + }, + { + "name": "file", + "version": "7.0.0", + "dependencies": [ + "meta", + "path" + ] + } + ], + "configVersion": 1 +} \ No newline at end of file diff --git a/.dart_tool/version b/.dart_tool/version index de2819e..c058d50 100644 --- a/.dart_tool/version +++ b/.dart_tool/version @@ -1 +1 @@ -3.29.3 \ No newline at end of file +3.32.1 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 82261f1..00837fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 5.9.0 + +- Update dependencies. + ## 5.8.0 - Fix parsing RPC error diff --git a/example/pubspec.lock b/example/pubspec.lock index 6ff3356..52af0bb 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -13,18 +13,18 @@ packages: dependency: transitive description: name: async - sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63 + sha256: "758e6d74e971c3e5aceb4110bfd6698efc7f501675bcfe0c775459a8140750eb" url: "https://pub.dev" source: hosted - version: "2.12.0" + version: "2.13.0" blockchain_utils: dependency: "direct main" description: name: blockchain_utils - sha256: fbddd2a7f1849d2244a35bf996b6fb00bf6bd557f0e13aed65ba0c16ad133cb7 + sha256: "2681bc950d31fd12eff8b9ea803d686a845a69f94fa88fdefc8c12ad63f55837" url: "https://pub.dev" source: hosted - version: "5.0.0" + version: "5.1.0" boolean_selector: dependency: transitive description: @@ -77,10 +77,10 @@ packages: dependency: transitive description: name: fake_async - sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc" + sha256: "5368f224a74523e8d2e7399ea1638b37aecfca824a3cc4dfdf77bf1fa905ac44" url: "https://pub.dev" source: hosted - version: "1.3.2" + version: "1.3.3" flutter: dependency: "direct main" description: flutter @@ -119,10 +119,10 @@ packages: dependency: transitive description: name: leak_tracker - sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec + sha256: "6bb818ecbdffe216e81182c2f0714a2e62b593f4a4f13098713ff1685dfb6ab0" url: "https://pub.dev" source: hosted - version: "10.0.8" + version: "10.0.9" leak_tracker_flutter_testing: dependency: transitive description: @@ -252,10 +252,10 @@ packages: dependency: transitive description: name: vm_service - sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14" + sha256: ddfa8d30d89985b96407efce8acbdd124701f96741f2d981ca860662f1c0dc02 url: "https://pub.dev" source: hosted - version: "14.3.1" + version: "15.0.0" web: dependency: transitive description: @@ -278,7 +278,7 @@ packages: path: ".." relative: true source: path - version: "5.7.0" + version: "5.8.0" sdks: dart: ">=3.7.0-0 <4.0.0" flutter: ">=3.18.0-18.0.pre.54" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index a5b5a9d..3a998fe 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -35,7 +35,7 @@ dependencies: http: ^1.1.2 web_socket_channel: ^2.4.0 asn1lib: ^1.5.0 - blockchain_utils: ^5.0.0 + blockchain_utils: ^5.1.0 # blockchain_utils: # path: ../../blockchain_utils diff --git a/lib/src/rpc/on_chain_models/server_info.dart b/lib/src/rpc/on_chain_models/server_info.dart index f9d3fce..3447766 100644 --- a/lib/src/rpc/on_chain_models/server_info.dart +++ b/lib/src/rpc/on_chain_models/server_info.dart @@ -159,10 +159,10 @@ class AccountingDuration { class ValidatedLedger { final int? age; - final double? baseFeeXrp; + final num? baseFeeXrp; final String? hash; - final double? reserveBaseXrp; - final double? reserveIncXrp; + final num? reserveBaseXrp; + final num? reserveIncXrp; final int? seq; ValidatedLedger({ diff --git a/pubspec.lock b/pubspec.lock index 2a92914..478189b 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -37,10 +37,10 @@ packages: dependency: "direct main" description: name: blockchain_utils - sha256: fbddd2a7f1849d2244a35bf996b6fb00bf6bd557f0e13aed65ba0c16ad133cb7 + sha256: "2681bc950d31fd12eff8b9ea803d686a845a69f94fa88fdefc8c12ad63f55837" url: "https://pub.dev" source: hosted - version: "5.0.0" + version: "5.1.0" boolean_selector: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index b6d4b69..86bc11e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: xrpl_dart description: Easily sign, create, and send all types of XRP transactions using the xrpl_dart package. Manage your XRP Ledger transactions securely and with ease. -version: 5.8.0 +version: 5.9.0 homepage: "https://github.com/mrtnetwork/xrpl_dart" repository: "https://github.com/mrtnetwork/xrpl_dart" Author: mrhaydari.t@gmail.com @@ -15,7 +15,7 @@ environment: sdk: '>=3.3.0 <4.0.0' dependencies: - blockchain_utils: ^5.0.0 + blockchain_utils: ^5.1.0 # blockchain_utils: # path: ../blockchain_utils