zilliqa_ledger_flutter 0.0.4 zilliqa_ledger_flutter: ^0.0.4 copied to clipboard
A Zilliqa Ledger Plugin for Flutter. Supports sending transactions and getting accounts from Ledger hardware wallets.
ledger-zilliqa
A Flutter Ledger App Plugin for the Zilliqa blockchain
Report Bug
ยท Request Feature
ยท Ledger Flutter
Overview #
Ledger Nano devices provide secure hardware wallet solutions for managing your cryptocurrencies. This Flutter package is a plugin for the ledger_flutter package that enables interaction with the Zilliqa blockchain, allowing you to retrieve accounts and sign transactions using your Ledger hardware wallet.
Features #
- ๐ Get public keys and addresses
- ๐ Sign transactions
- ๐ Sign message hashes
- ๐ฑ Cross-platform support (iOS & Android)
- โก๏ธ Fast and efficient BLE communication
- ๐ Secure transaction signing
Getting Started #
Installation #
Add the latest version of this package to your pubspec.yaml
:
dependencies:
zilliqa_ledger_flutter: ^latest-version
For integration with the Ledger Flutter package, check out the documentation here.
Setup #
Create a new instance of a ZilliqaLedgerApp
and pass an instance of your Ledger
object:
final app = ZilliqaLedgerApp(ledger);
Usage #
Get Public Key and Address #
You can retrieve the public key and address for a specific account index:
// Get public key
final publicKey = await app.getPublicKey(device, accountIndex);
// Get public address
final addressInfo = await app.getPublicAddress(device, accountIndex);
print('Address: ${addressInfo.address}');
print('Public Key: ${addressInfo.publicKey}');
Sign Transactions #
Sign Zilliqa transactions using your Ledger device:
// Prepare your transaction bytes
final transaction = // Your encoded transaction bytes
final signature = await app.signZilliqaTransaction(
device,
transaction,
accountIndex,
);
// Use the signature with your transaction
print('Transaction signature: $signature');
Sign Message Hash #
Sign message hashes for verification:
final hash = // Your message hash bytes
final signature = await app.signHash(
device,
hash,
accountIndex,
);
print('Message signature: $signature');
Error Handling #
The plugin includes comprehensive error handling for common Ledger operations:
try {
final publicKey = await app.getPublicKey(device, accountIndex);
} catch (e) {
if (e is LedgerException) {
// Handle Ledger-specific errors
print('Ledger error: ${e.message}');
} else {
// Handle other errors
print('Error: $e');
}
}
Contributing #
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag enhancement
.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/amazing-feature
) - Commit your Changes (
git commit -m 'feat: add some amazing feature'
) - Push to the Branch (
git push origin feature/amazing-feature
) - Open a Pull Request
License #
The zilliqa_ledger_flutter package is released under the MIT License. See LICENSE for details.
Support #
If you like this package, consider supporting it by:
- โญ๏ธ Starring the repository
- ๐ Reporting bugs
- ๐ Contributing to the codebase
- ๐ก Suggesting new featuresrom the package authors, and more.