ether_dart 0.0.1+2 copy "ether_dart: ^0.0.1+2" to clipboard
ether_dart: ^0.0.1+2 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}");
  
}
5
likes
110
pub points
64%
popularity

Publisher

unverified uploader

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

Repository (GitHub)
View/report issues

Documentation

API reference

License

unknown (LICENSE)

Dependencies

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

More

Packages that depend on ether_dart