Skip to content

Instantly share code, notes, and snippets.

View ChrisMarxDev's full-sized avatar

Chris ChrisMarxDev

View GitHub Profile
@ChrisMarxDev
ChrisMarxDev / load_contract.dart
Last active June 19, 2020 08:20
Function to load up a web3dart contract
// you will need the following import
// import 'package:flutter/services.dart';
Future<DeployedContract> loadContract() async {
String abiCode = await rootBundle.loadString("assets/abi.json");
String contractAddress = "0x8A30f78133176ed5E6CcB0AE8429AEEBf4c82Ffc";
final contract = DeployedContract(ContractAbi.fromJson(abiCode, "MetaCoin"),
EthereumAddress.fromHex(contractAddress));
@ChrisMarxDev
ChrisMarxDev / init_clients.dart
Last active June 19, 2020 08:19
Initialize a web3client for Flutter
import 'package:http/http.dart';
import 'package:web3dart/web3dart.dart';
class _MyHomePageState extends State<MyHomePage> {
Client httpClient;
Web3Client ethClient;
@override
void initState() {
super.initState();