We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In Javascript We Deploy Smart contract something like that
let contract = new web3.eth.Contract(DonactionsAbi); let deploy = await contract.deploy({ data: DonactionsByteCode, arguments: [address, Name] });
I just want to know how to Deploy smart contract in Dart
The text was updated successfully, but these errors were encountered:
perhaps try something like that. I hope it's a lead
import 'dart:convert'; import 'dart:developer'; import 'package:flutter/services.dart'; import 'package:http/http.dart'; import 'package:web3dart/web3dart.dart'; class Contract { final String apiUrl = 'http://127.0.0.1:7545'; Future<void> deploy( String privateKey, String address, String name, }) async { final privateKey = 'xxxxxxx'; final web3Client = Web3Client(apiUrl, Client()); final credentials = EthPrivateKey.fromHex(privateKey); final abiStringFile = await rootBundle.loadString('truffle/build/contracts/HTLC_ETH.json'); final jsonAbi = jsonDecode(abiStringFile); final contract = DeployedContract( jsonAbi, EthereumAddress.fromHex(address), ); final transaction = Transaction.callContract( contract: contract, function: contract.function('constructor'), parameters: [ EthereumAddress.fromHex(address), name, ], ); final transactionHash = await web3Client.sendTransaction( credentials, transaction, ); final receipt = await web3Client.getTransactionReceipt(transactionHash); log('Contract deployed at ${receipt!.contractAddress!.hex}'); } }
Sorry, something went wrong.
No branches or pull requests
In Javascript We Deploy Smart contract something like that
let contract = new web3.eth.Contract(DonactionsAbi);
let deploy = await contract.deploy({ data: DonactionsByteCode, arguments: [address, Name] });
I just want to know how to Deploy smart contract in Dart
The text was updated successfully, but these errors were encountered: