Skip to content

Commit

Permalink
feat: lightning message + bip39 support (#6)
Browse files Browse the repository at this point in the history
* doc: readme

* doc: readme fix

* feat: setup lightning_message dart and native package

* feat: rust code for lightning_message package

* feat: add lightning_message package to scripts

* feat: separate bip39 out of unified_mnemonic package

* feat: lightning message package + remove unified mnemonic package for bip39 and unified wallet packages

* fix: analyzer errors and warnings

* fix: build
  • Loading branch information
kumulynja authored Aug 7, 2023
1 parent 08282f2 commit f60f4a6
Show file tree
Hide file tree
Showing 380 changed files with 9,552 additions and 2,028 deletions.
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ Link to Issue (optional):

- [ ] tested
- [ ] documented
- [ ] dependency versions consistent with other packages
7 changes: 5 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ jobs:
components: rustfmt, clippy

# Rust
- name: Check Rust format
working-directory: ./packages/unified_mnemonic/native/src
- name: Check Rust format in bip39
working-directory: ./packages/bip39/native/src
run: rustfmt --check lib.rs
- name: Check Rust format in lightning_message
working-directory: ./packages/lightning_message/native/src
run: rustfmt --check lib.rs
- name: Rust code analysis
run: cargo clippy -- -D warnings
Expand Down
6 changes: 5 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
{
"C_Cpp.errorSquiggles": "disabled"
"C_Cpp.errorSquiggles": "disabled",
"rust-analyzer.linkedProjects": [
"./packages/bip39/native/Cargo.toml",
"./packages/bip39/native/Cargo.toml"
]
}
14 changes: 14 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Contributing to Fluttoshi packages

## Communication channels

- [GitHub Discussions](https://github.com/kumuly/fluttoshi_packages/discussions)
- [Telegram](https://t.me/kumulydev)

## Contribution workflow

### Pull requests

The repository uses a pull request template to make sure that all pull requests contain the necessary information to be reviewed and merged.
Please make sure to fill in the template when creating a pull request. If you are not sure about some of the information, please ask in the pull request comments.
It also has a code checklist, make sure that your pull request checks all the boxes before asking a review.
6 changes: 2 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
[workspace]
members = [
"packages/unified_mnemonic/native",
]
members = ["packages/lightning_message/native", "packages/bip39/native"]

[profile.release]
lto = true
codegen-units = 1
debug = true
debug = true
566 changes: 565 additions & 1 deletion README.md

Large diffs are not rendered by default.

File renamed without changes.
File renamed without changes.
File renamed without changes.
32 changes: 32 additions & 0 deletions packages/bip39/example/bip39_example.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import 'dart:ffi';
import 'dart:io';

import 'package:bip39/bip39.dart';

Future<void> main() async {
final bip39 = createWrapper(useLibrary());
final mnemonic = await bip39.generateInStaticMethodMnemonic(
language: Language.English,
wordCount: WordCount.Words12,
);

assert(mnemonic.words.length == 12, 'Mnemonic should have 12 words');
}

DynamicLibrary useLibrary() {
// If you are running these tests locally, you will need to run
// `cargo build -r` to generate the needed dylib.
const libName = 'bip39';
final libPrefix = {
Platform.isWindows: '',
Platform.isMacOS: 'lib',
Platform.isLinux: 'lib',
}[true]!;
final libSuffix = {
Platform.isWindows: 'dll',
Platform.isMacOS: 'dylib',
Platform.isLinux: 'so',
}[true]!;
final dylibPath = '../../target/release/$libPrefix$libName.$libSuffix';
return DynamicLibrary.open(dylibPath);
}
8 changes: 8 additions & 0 deletions packages/bip39/lib/bip39.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/// Document the library here.
library;

// Export any libraries intended for clients of this package.
export 'package:flutter_rust_bridge/flutter_rust_bridge.dart' show WasmModule;

export 'src/bridge_generated.dart';
export 'src/ffi.dart';
Loading

0 comments on commit f60f4a6

Please sign in to comment.