ether_dart 0.0.1+1 copy "ether_dart: ^0.0.1+1" to clipboard
ether_dart: ^0.0.1+1 copied to clipboard

A libary that helps you generate memonic phrase, and connect to the etherium blockchain using web3dart Client

example/lib/main.dart

import 'package:ether_dart/ether_dart.dart';

void main() async {
  ///Create EtherDart without immediate connection
  final etherDart = EtherDart();

  ///Generate memomic phrase (can be called seed phrase (Eg : cow ram pig goat ))
  final memonicPhrase = etherDart.generateMemonicPhrase();
  print(memonicPhrase);

  ///Verify seed phrase
  if (memonicPhrase != null) {
    etherDart.verifyMemonicPhrase(memonicPhrase);
  }

  ///i would expose more api in the future
  ///Eg - memonicToSeedPhrase and the rest

  ///Create Wallet from private key
  final wallet = etherDart.walletFromMemonicPhrase(memonicPhrase!);

  print(wallet?.privateKey);

  ///Create wallet from private key (NOTE: Wallet from private doesnt contain memonic seed phrase)
  final walletFromPrivateKey = etherDart.walletFromPrivateKey(
      "0x7bda80e5a0873b022832654346b5313063265a2d627ff8609bcb35d714e641e0");
  print(walletFromPrivateKey?.address);

  ///This my own RpcHost- you can create us with quickNode also
  final myHost =
      "https://bold-multi-arrow.discover.quiknode.pro/2440878aa102c59f436e9e5d84e9cea302a47356/";

  ///Connect ether to a provider
  ///Client in this case is an http client (Used in sending request to your rpc host)
  final provider = etherDart.connectProvider(Web3Client(myHost, Client()));

  ///Use the provider to perform different action
  ///Eg - getGasPrice
  ///Eg - send transaction and the rest
  final gasPrice = await provider.getGasPrice();
  print("Ether gas price ${gasPrice.getInWei}");

  ///Create an EtherDart with immediate connection
  final etherDartWithConnect = EtherDart.connect(Web3Client(myHost, Client()));

  final gasPriceWithConnect =
      await etherDartWithConnect.provider?.getGasPrice();

  print("Ether gas price with Connect ${gasPriceWithConnect?.getInWei}");
  
}
8
likes
130
points
0
downloads

Publisher

unverified uploader

Weekly Downloads

A libary that helps you generate memonic phrase, and connect to the etherium blockchain using web3dart Client

Homepage
Repository (GitHub)

Documentation

API reference

License

unknown (license)

Dependencies

bip32, bip39, convert, decimal, http, meta, mocktail, pointycastle, web3dart

More

Packages that depend on ether_dart