-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Minimum required Dart SDK version updated to 3.3. - The RPC method names and service class implementations have been updated. Please refer to the examples folder for guidance. - Update dependencies.
- Loading branch information
1 parent
0384879
commit f82665a
Showing
1,503 changed files
with
14,241 additions
and
14,111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,69 @@ | ||
# include: package:lints/recommended.yaml | ||
include: package:flutter_lints/flutter.yaml | ||
# Uncomment the following section to specify additional rules. | ||
# This file configures the analyzer to use the lint rule set from `package:lint` | ||
|
||
include: package:flutter_lints/flutter.yaml # For production apps | ||
# include: package:lint/casual.yaml # For code samples, hackathons and other non-production code | ||
# include: package:lint/package.yaml # Use this for packages with public API | ||
|
||
|
||
# You might want to exclude auto-generated files from dart analysis | ||
analyzer: | ||
exclude: | ||
#- '**.freezed.dart' | ||
#- '**.g.dart' | ||
|
||
# You can customize the lint rules set to your own liking. A list of all rules | ||
# can be found at https://dart-lang.github.io/linter/lints/options/options.html | ||
linter: | ||
rules: | ||
prefer_final_locals: true # Warns when a local variable could be final | ||
prefer_final_in_for_each: true # Warns when a forEach variable could be final | ||
prefer_const_constructors: true # Warns when a constructor could be const | ||
prefer_const_declarations: true # Warns when a declaration could be const | ||
# rules: | ||
# - unnecessary_const | ||
# - prefer_const_declarations | ||
# - prefer_final_locals # Warns when a local variable could be final | ||
# - prefer_final_in_for_each # Warns when a forEach variable could be final | ||
# - always_declare_return_types | ||
# - annotate_overrides | ||
# - avoid_init_to_null | ||
# - avoid_null_checks_in_equality_operators | ||
# - avoid_relative_lib_imports | ||
# - avoid_return_types_on_setters | ||
# - avoid_shadowing_type_parameters | ||
# - avoid_single_cascade_in_expression_statements | ||
# - avoid_types_as_parameter_names | ||
# - await_only_futures | ||
# - camel_case_extensions | ||
# - curly_braces_in_flow_control_structures | ||
# - empty_catches | ||
# - empty_constructor_bodies | ||
# - library_names | ||
# - library_prefixes | ||
# - no_duplicate_case_values | ||
# - null_closures | ||
# # - omit_local_variable_types | ||
# - prefer_adjacent_string_concatenation | ||
# - prefer_collection_literals | ||
# - prefer_conditional_assignment | ||
# - prefer_contains | ||
# - prefer_equal_for_default_values | ||
# - prefer_final_fields | ||
# - prefer_for_elements_to_map_fromIterable | ||
# - prefer_generic_function_type_aliases | ||
# - prefer_if_null_operators | ||
# - prefer_inlined_adds | ||
# - prefer_is_empty | ||
# - prefer_is_not_empty | ||
# - prefer_iterable_whereType | ||
# - prefer_single_quotes | ||
# - prefer_spread_collections | ||
# - recursive_getters | ||
# - slash_for_doc_comments | ||
# - sort_child_properties_last | ||
# - type_init_formals | ||
# - unawaited_futures | ||
# - unnecessary_brace_in_string_interps | ||
# - unnecessary_getters_setters | ||
# - unnecessary_new | ||
# - unnecessary_null_in_if_null_operators | ||
# - unnecessary_this | ||
# - unrelated_type_equality_checks | ||
# - use_function_type_syntax_for_parameters | ||
# - use_rethrow_when_possible | ||
# - valid_regexps |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 21 additions & 24 deletions
45
example/lib/example/cardano/provider_example/provider.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,46 @@ | ||
import 'dart:convert'; | ||
import 'package:blockchain_utils/service/models/params.dart'; | ||
import 'package:http/http.dart' as http; | ||
import 'package:on_chain/ada/src/provider/blockfrost/core/core.dart'; | ||
import 'package:on_chain/ada/src/provider/service/service.dart'; | ||
|
||
class BlockforestHTTPProvider implements BlockfrostServiceProvider { | ||
BlockforestHTTPProvider( | ||
class BlockFrostHTTPProvider implements BlockFrostServiceProvider { | ||
BlockFrostHTTPProvider( | ||
{required this.url, | ||
this.version = "v0", | ||
this.projectId, | ||
http.Client? client, | ||
this.defaultRequestTimeout = const Duration(seconds: 30)}) | ||
: client = client ?? http.Client(); | ||
@override | ||
|
||
final String url; | ||
final String version; | ||
final String? projectId; | ||
final http.Client client; | ||
final Duration defaultRequestTimeout; | ||
|
||
@override | ||
Future<dynamic> get(BlockforestRequestDetails params, | ||
[Duration? timeout]) async { | ||
final response = | ||
await client.get(Uri.parse(params.url(url, version)), headers: { | ||
'Content-Type': 'application/json', | ||
"Accept": "application/json", | ||
if (projectId != null) ...{"project_id": projectId!}, | ||
}).timeout(timeout ?? defaultRequestTimeout); | ||
final data = json.decode(response.body); | ||
return data; | ||
} | ||
|
||
@override | ||
Future<dynamic> post(BlockforestRequestDetails params, | ||
[Duration? timeout]) async { | ||
Future<BaseServiceResponse<T>> doRequest<T>(BlockFrostRequestDetails params, | ||
{Duration? timeout}) async { | ||
if (params.type == RequestServiceType.get) { | ||
final response = | ||
await client.get(params.toUri(url, version: version), headers: { | ||
'Content-Type': 'application/json', | ||
"Accept": "application/json", | ||
...params.headers, | ||
if (projectId != null) ...{"project_id": projectId!}, | ||
}).timeout(timeout ?? defaultRequestTimeout); | ||
return params.toResponse(response.bodyBytes, response.statusCode); | ||
} | ||
final response = await client | ||
.post(Uri.parse(params.url(url, version)), | ||
.post(params.toUri(url, version: version), | ||
headers: { | ||
'Content-Type': 'application/json', | ||
"Accept": "application/json", | ||
...params.headers, | ||
if (projectId != null) ...{"project_id": projectId!}, | ||
...params.header | ||
}, | ||
body: params.body) | ||
body: params.body()) | ||
.timeout(timeout ?? defaultRequestTimeout); | ||
final data = json.decode(response.body); | ||
return data; | ||
return params.toResponse(response.bodyBytes, response.statusCode); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.