Skip to content

Commit

Permalink
created: inital commit from precious_the_app_guy
Browse files Browse the repository at this point in the history
  • Loading branch information
venbrinoDev committed Mar 3, 2024
0 parents commit 3c5680a
Show file tree
Hide file tree
Showing 11 changed files with 864 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# https://dart.dev/guides/libraries/private-files
# Created by `dart pub`
.dart_tool/
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 1.0.0

- Initial version.
68 changes: 68 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# Chain Manager CLI

This is a command-line interface (CLI) tool written in Dart that helps you create, manage seed phrase, and interact with blockchain and cryptocurrency wallets.

## Features

- **Create Seed Phrase:** Generate a new mnemonic seed phrase.
- **Manage Seed Phrase:** Store and manage your mnemonic seed phrases securely.
- **Manage Wallet Addresses:** Add, remove, and label wallet addresses for easy reference.
- **Send Crypto:** Send cryptocurrency from your wallet to another address.
- **And More:** Explore additional features to manage your cryptocurrency assets efficiently.


## Installation

To use this tool, you need to have Dart installed. You can install Dart from the [Dart website](https://dart.dev/get-dart).

Once Dart is installed, you can install the tool using the following command:

```bash
dart pub global activate --source path <path_to_tool_directory>
```

# Commands

### Generate Seed Phrase
To generate a new mnemonic seed phrase, use the following command:

```bash
chain generate
```
This command will output a new mnemonic seed phrase that can be used to generate a wallet.

### Verify Seed Phrase
To verify if a seed phrase is correct, use the following command:

```bash
chain verify --seed="<seed_phrase>"
```
Replace <seed_phrase> with the seed phrase you want to verify. If the seed phrase is correct, it will output "Your seed phrase is correct"; otherwise, it will output "Incorrect seed phrase".

## Send Crypto
Coming soon
```bash
chain send --amount
```

## Check Wallet Balance
Coming soon
```bash
chain send --balance="<wallet_address>"
```

## Help
if you are stuck you can run this command any time to find your way

```bash
chain help
```

## Contributing

If you would like to contribute to this project, feel free to fork the repository and submit a pull request. Your contributions are welcome!





30 changes: 30 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This file configures the static analysis results for your project (errors,
# warnings, and lints).
#
# This enables the 'recommended' set of lints from `package:lints`.
# This set helps identify many issues that may lead to problems when running
# or consuming Dart code, and enforces writing Dart using a single, idiomatic
# style and format.
#
# If you want a smaller set of lints you can change this to specify
# 'package:lints/core.yaml'. These are just the most critical lints
# (the recommended set includes the core lints).
# The core lints are also what is used by pub.dev for scoring packages.

include: package:lints/recommended.yaml

# Uncomment the following section to specify additional rules.

# linter:
# rules:
# - camel_case_types

# analyzer:
# exclude:
# - path/to/excluded/files/**

# For more information about the core and recommended set of lints, see
# https://dart.dev/go/core-lints

# For additional information about configuring this file, see
# https://dart.dev/guides/language/analysis-options
3 changes: 3 additions & 0 deletions bin/chain_install.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import 'package:chain/chain.dart' as chain;

void main(List<String> args) => chain.start(args);
3 changes: 3 additions & 0 deletions lib/chain.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
library generate;

export 'src/chain_base.dart';
11 changes: 11 additions & 0 deletions lib/src/chain_base.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import 'package:args/command_runner.dart';
import 'package:chain/src/commands/seed.dart';
import 'package:chain/src/commands/verify.dart';

///Start the cli tool
void start(List<String> args) {
final runner = CommandRunner('chain', 'Manage and generate seed pharse')
..addCommand(GenerateSeedPharse())
..addCommand(VerifySeedPhrase());
runner.run(args);
}
24 changes: 24 additions & 0 deletions lib/src/commands/seed.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import 'package:args/command_runner.dart';
import 'package:bip39/bip39.dart' as bip39;
import 'package:dcli/dcli.dart';

///A simple seed pharse generator
class GenerateSeedPharse extends Command {
GenerateSeedPharse() {
init();
}

void init() {}

@override
void run() {
final seed = bip39.generateMnemonic();
print(blue(seed));
}

@override
String get description => 'Helps create a new seedpharse ';

@override
String get name => "generate";
}
46 changes: 46 additions & 0 deletions lib/src/commands/verify.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import 'dart:io';

import 'package:args/command_runner.dart';
import 'package:bip39/bip39.dart' as bip39;
import 'package:dcli/dcli.dart';

///A simple seed pharse generator
class VerifySeedPhrase extends Command {
VerifySeedPhrase() {
init();
}

void init() {
argParser.addOption('seed',
aliases: ['seeds'],
help:
'''Pass the seed pharse by doing chain verify --seed="seed pharse"''');
}

@override
void run() {
if (argResults == null) {
print(exists('Try running chain -h'));
exit(1);
}

if (argResults!.wasParsed('seed')) {
final isVerified = bip39.validateMnemonic(argResults!['seed']);
if (isVerified) {
print(green('Your seed pharse is correct'));
exit(0);
} else {
print(red('Incorrect seed phrase'));
exit(0);
}
}

print(red('please pass in seed pharse '));
}

@override
String get description => 'Verify if a seed pharse is correct';

@override
String get name => "verify";
}
Loading

0 comments on commit 3c5680a

Please sign in to comment.