Last active
June 19, 2020 08:20
-
-
Save ChrisMarxDev/959770d5e43b717a70ce8ae7d829b328 to your computer and use it in GitHub Desktop.
Function to load up a web3dart contract
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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)); | |
return contract; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment