-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: cardano multiplatform lib plugin structure (#441)
* chore: melos bootstrap * feat: add federated package structure for cardano_multiplatform_lib * style: improve changelog style to fix analyzer issues * docs: document better instance initialization with assertions * chore: add cardano multiplatform lib related words to cspell dictionary * chore: run melos bootstrap before running tests to make sure melos overrides paths to local packages * fix: remove empty tests which cause code coverage failure * refactor: rename cardano_multiplatform_lib to catalyst_cardano
- Loading branch information
Showing
24 changed files
with
194 additions
and
70 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -185,3 +185,5 @@ xctest | |
xctestrun | ||
xcworkspace | ||
yoroi | ||
multiplatform | ||
Multiplatform |
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 |
---|---|---|
|
@@ -91,6 +91,7 @@ coverage/ | |
|
||
# Melos | ||
*pubspec_overrides.yaml | ||
melos*.iml | ||
|
||
# Secrets | ||
dev-catalyst-voice-9f78f27c6bc5.json | ||
|
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 was deleted.
Oops, something went wrong.
29 changes: 0 additions & 29 deletions
29
catalyst_voices/packages/catalyst_voices_models/melos_catalyst_voices_models.iml
This file was deleted.
Oops, something went wrong.
3 changes: 3 additions & 0 deletions
3
catalyst_voices_packages/catalyst_cardano/catalyst_cardano/CHANGELOG.md
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# 1.0.0 | ||
|
||
* Initial release. |
1 change: 1 addition & 0 deletions
1
catalyst_voices_packages/catalyst_cardano/catalyst_cardano/README.md
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
# catalyst_cardano |
4 changes: 4 additions & 0 deletions
4
catalyst_voices_packages/catalyst_cardano/catalyst_cardano/analysis_options.yaml
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
include: package:catalyst_analysis/analysis_options.1.0.0.yaml | ||
|
||
analyzer: | ||
exclude: [build/**, lib/*.g.dart, lib/generated/**] |
1 change: 1 addition & 0 deletions
1
catalyst_voices_packages/catalyst_cardano/catalyst_cardano/lib/catalyst_cardano.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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export 'src/catalyst_cardano.dart'; |
8 changes: 8 additions & 0 deletions
8
catalyst_voices_packages/catalyst_cardano/catalyst_cardano/lib/src/catalyst_cardano.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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import 'package:catalyst_cardano_platform_interface/catalyst_cardano_platform_interface.dart'; | ||
|
||
/// Prints hello message, function to be removed later by providing actual | ||
/// implementations of methods related to cardano multiplatform lib. | ||
Future<void> printCatalystCardanoHello() async { | ||
// ignore: avoid_print, will be replaced later by actual implementation | ||
await CatalystCardanoPlatform.instance.printHello(); | ||
} |
29 changes: 29 additions & 0 deletions
29
catalyst_voices_packages/catalyst_cardano/catalyst_cardano/pubspec.yaml
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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: catalyst_cardano | ||
description: Flutter plugin wrapping the Cardano Multiplatform Lib Rust library. | ||
repository: https://github.com/input-output-hk/catalyst-voices/tree/main/catalyst_voices_packages/catalyst_cardano/catalyst_cardano | ||
issue_tracker: https://github.com/input-output-hk/catalyst-voices/issues | ||
topics: [blockchain, cardano, cryptocurrency, wallet] | ||
version: 1.0.0 | ||
|
||
environment: | ||
sdk: ">=3.3.0 <4.0.0" | ||
flutter: 3.19.5 | ||
|
||
flutter: | ||
plugin: | ||
platforms: | ||
web: | ||
default_package: catalyst_cardano_web | ||
|
||
dependencies: | ||
catalyst_cardano_platform_interface: ^1.0.0 | ||
catalyst_cardano_web: ^1.0.0 | ||
flutter: | ||
sdk: flutter | ||
|
||
dev_dependencies: | ||
catalyst_analysis: | ||
path: ../../catalyst_analysis | ||
flutter_test: | ||
sdk: flutter | ||
plugin_platform_interface: ^2.1.7 |
3 changes: 3 additions & 0 deletions
3
...ices_packages/catalyst_cardano/catalyst_cardano_platform_interface/CHANGELOG.md
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# 1.0.0 | ||
|
||
* Initial release. |
1 change: 1 addition & 0 deletions
1
..._voices_packages/catalyst_cardano/catalyst_cardano_platform_interface/README.md
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
# catalyst_cardano_platform_interface |
4 changes: 4 additions & 0 deletions
4
...oices_packages/catalyst_cardano/catalyst_cardano_platform_interface/analysis_options.yaml
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
include: package:catalyst_analysis/analysis_options.1.0.0.yaml | ||
|
||
analyzer: | ||
exclude: [build/**, lib/*.g.dart, lib/generated/**] |
1 change: 1 addition & 0 deletions
1
..._cardano/catalyst_cardano_platform_interface/lib/catalyst_cardano_platform_interface.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 |
---|---|---|
@@ -0,0 +1 @@ | ||
export 'src/catalyst_cardano_platform.dart'; |
47 changes: 47 additions & 0 deletions
47
...talyst_cardano/catalyst_cardano_platform_interface/lib/src/catalyst_cardano_platform.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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import 'dart:async'; | ||
|
||
import 'package:plugin_platform_interface/plugin_platform_interface.dart'; | ||
|
||
/// The interface that implementations of catalyst_cardano must | ||
/// implement. | ||
/// | ||
/// Platform implementations should extend this class rather than implement | ||
/// it as `catalyst_cardano` does not consider newly added methods to | ||
/// be breaking changes. Extending this class (using `extends`) ensures that the | ||
/// subclass will get the default implementation, while platform implementations | ||
/// that `implements` this interface will be broken by newly added | ||
/// [CatalystCardanoPlatform] methods. | ||
abstract class CatalystCardanoPlatform extends PlatformInterface { | ||
static final Object _token = Object(); | ||
|
||
static CatalystCardanoPlatform? _instance; | ||
|
||
/// The default instance of [CatalystCardanoPlatform] to use. | ||
/// | ||
/// Must be set with [instance] setter before it can be used. | ||
static CatalystCardanoPlatform get instance { | ||
assert( | ||
_instance != null, | ||
'Make sure to register the instance via ' | ||
'instance setter before it is used.', | ||
); | ||
return _instance!; | ||
} | ||
|
||
/// Platform-specific plugins should set this with their own platform-specific | ||
/// class that extends [CatalystCardanoPlatform] when they register | ||
/// themselves. | ||
static set instance(CatalystCardanoPlatform instance) { | ||
PlatformInterface.verify(instance, _token); | ||
_instance = instance; | ||
} | ||
|
||
/// Constructs a CatalystCardanoPlatform. | ||
CatalystCardanoPlatform() : super(token: _token); | ||
|
||
/// Temporary method which will be replaced by actual implementation of | ||
/// cardano multiplatform lib. | ||
Future<void> printHello() { | ||
throw UnimplementedError('printHello() has not been implemented.'); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
catalyst_voices_packages/catalyst_cardano/catalyst_cardano_platform_interface/pubspec.yaml
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
name: catalyst_cardano_platform_interface | ||
description: A common platform interface for the catalyst_cardano plugin. | ||
repository: https://github.com/input-output-hk/catalyst-voices/tree/main/catalyst_voices_packages/catalyst_cardano/catalyst_cardano_platform_interface | ||
issue_tracker: https://github.com/input-output-hk/catalyst-voices/issues | ||
topics: [blockchain, cardano, cryptocurrency, wallet] | ||
version: 1.0.0 | ||
|
||
environment: | ||
sdk: ">=3.3.0 <4.0.0" | ||
flutter: 3.19.5 | ||
|
||
dependencies: | ||
flutter: | ||
sdk: flutter | ||
plugin_platform_interface: ^2.1.7 | ||
|
||
dev_dependencies: | ||
catalyst_analysis: | ||
path: ../../catalyst_analysis | ||
flutter_test: | ||
sdk: flutter |
3 changes: 3 additions & 0 deletions
3
catalyst_voices_packages/catalyst_cardano/catalyst_cardano_web/CHANGELOG.md
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# 1.0.0 | ||
|
||
* Initial release. |
1 change: 1 addition & 0 deletions
1
catalyst_voices_packages/catalyst_cardano/catalyst_cardano_web/README.md
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
# catalyst_cardano_web |
4 changes: 4 additions & 0 deletions
4
catalyst_voices_packages/catalyst_cardano/catalyst_cardano_web/analysis_options.yaml
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 |
---|---|---|
@@ -0,0 +1,4 @@ | ||
include: package:catalyst_analysis/analysis_options.1.0.0.yaml | ||
|
||
analyzer: | ||
exclude: [build/**, lib/*.g.dart, lib/generated/**] |
26 changes: 26 additions & 0 deletions
26
catalyst_voices_packages/catalyst_cardano/catalyst_cardano_web/lib/catalyst_cardano_web.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 |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import 'dart:async'; | ||
|
||
import 'package:catalyst_cardano_platform_interface/catalyst_cardano_platform_interface.dart'; | ||
import 'package:flutter_web_plugins/flutter_web_plugins.dart' show Registrar; | ||
|
||
/// The web implementation of [CatalystCardanoPlatform]. | ||
/// | ||
/// This class implements the `package:catalyst_cardano` functionality | ||
/// for the web. | ||
class CatalystCardanoPlugin extends CatalystCardanoPlatform { | ||
/// A constructor that allows tests to override the window object used by the | ||
/// plugin. | ||
CatalystCardanoPlugin(); | ||
|
||
@override | ||
Future<void> printHello() async { | ||
// ignore: avoid_print | ||
print('hello world from cardano multiplatform'); | ||
} | ||
|
||
/// Registers this class as the default instance of | ||
/// [CatalystCardanoPlatform]. | ||
static void registerWith(Registrar registrar) { | ||
CatalystCardanoPlatform.instance = CatalystCardanoPlugin(); | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
catalyst_voices_packages/catalyst_cardano/catalyst_cardano_web/pubspec.yaml
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 |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: catalyst_cardano_web | ||
description: Web platform implementation of catalyst_cardano | ||
repository: https://github.com/input-output-hk/catalyst-voices/tree/main/catalyst_voices_packages/catalyst_cardano/catalyst_cardano_web | ||
issue_tracker: https://github.com/input-output-hk/catalyst-voices/issues | ||
topics: [blockchain, cardano, cryptocurrency, wallet] | ||
version: 1.0.0 | ||
|
||
environment: | ||
sdk: ^3.3.0 | ||
flutter: 3.19.5 | ||
|
||
flutter: | ||
plugin: | ||
implements: catalyst_cardano | ||
platforms: | ||
web: | ||
pluginClass: CatalystCardanoPlugin | ||
fileName: catalyst_cardano_web.dart | ||
|
||
dependencies: | ||
catalyst_cardano_platform_interface: ^1.0.0 | ||
flutter: | ||
sdk: flutter | ||
flutter_web_plugins: | ||
sdk: flutter | ||
web: ^0.5.0 | ||
|
||
dev_dependencies: | ||
catalyst_analysis: | ||
path: ../../catalyst_analysis | ||
flutter_test: | ||
sdk: flutter |
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 was deleted.
Oops, something went wrong.