dart_web3_core 2.5.19 copy "dart_web3_core: ^2.5.19" to clipboard
dart_web3_core: ^2.5.19 copied to clipboard

dart_web3_core - a web3 library for dart for interaction with ethereum nodes using HTTP or WebSocket. Supports custom credentials providers like WalletConnect and Metamask.

example/main.dart

import 'package:http/http.dart';
import 'package:dart_web3_core/dart_web3_core.dart';

const String privateKey =
    'a2fd51b96dc55aeb14b30d55a6b3121c7b9c599500c1beb92a389c3377adc86e';
const String rpcUrl = 'http://localhost:7545';

Future<void> main() async {
  // start a client we can use to send transactions
  final client = Web3Client(rpcUrl, Client());

  final credentials = EthPrivateKey.fromHex(privateKey);
  final address = credentials.address;

  print(address.hexEip55);
  print(await client.getBalance(address));

  await client.sendTransaction(
    credentials,
    Transaction(
      to: EthereumAddress.fromHex('0xC914Bb2ba888e3367bcecEb5C2d99DF7C7423706'),
      gasPrice: EtherAmount.inWei(BigInt.one),
      maxGas: 100000,
      value: EtherAmount.fromInt(EtherUnit.ether, 1),
    ),
  );

  await client.dispose();
}
copied to clipboard
5
likes
130
points
68
downloads

Publisher

verified publisherstarkleytech.com

Weekly Downloads

2024.09.23 - 2025.04.07

dart_web3_core - a web3 library for dart for interaction with ethereum nodes using HTTP or WebSocket. Supports custom credentials providers like WalletConnect and Metamask.

Homepage
Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

build, build_config, built_collection, code_builder, collection, convert, dart_style, http, js, json_rpc_2, meta, path, pointycastle, stream_channel, stream_transform, typed_data, universal_html, uuid

More

Packages that depend on dart_web3_core