nikhil22 / angular-truffle-starter-dapp Goto Github PK
View Code? Open in Web Editor NEWAngular CLI + Truffle Starter Dapp; write, compile & deploy smart contracts on Ethereum blockchains
Angular CLI + Truffle Starter Dapp; write, compile & deploy smart contracts on Ethereum blockchains
When calling the sendCoin method you are returning a Promise:
https://github.com/Nikhil22/angular4-truffle-starter-dapp/blob/master/src/app/app.component.ts#L118
But as far as I can see that will only confirm the transaction was sent, returning a transaction ID. But not when it was actually completed.
Looks like you need to listen for an event. It seems as thought there is an event in the contract called Transfer:
https://github.com/Nikhil22/angular4-truffle-starter-dapp/blob/master/contracts/MetaCoin.sol#L23
Which you could listen to using a variation of:
this.MetaCoin.deployed().Transfer().watch(function(error, result) {
if (!error) {
console.log(result);
} else {
console.log(error);
}
});
thanks for creating this template. save me a lot of time to going around. just a simple request which is to rename 'truffle.js' to 'truffle-config.js' so when doing the development in windows, it would not mix up as truffle.js now is a runnable file under windows.
Hi,
how to deploy contract with constructor? Is it possible guys
I am getting an error when trying to run the truffle commands.
ParserError: Source file requires different compiler version (current compiler is 0.5.12+commit.7709ece9.Emscripten.clang - note that nightly builds are considered to be strictly less than the released version pragma solidity ^0.4.2;
`Error: Truffle is currently using solc 0.5.12, but one or more of your contracts specify "pragma solidity ^0.4.2".
Please update your truffle config or pragma statement(s).
(See https://truffleframework.com/docs/truffle/reference/configuration#compiler-configuration for information on
configuring Truffle to use a specific solc compiler version.)
Compilation failed. See above.`
MetaMask is injected into the browser after the AppComponent has been instantiated. The checkAndInstantiateWeb3 method that is executed within the constructor of AppComponent will always execute the else clause because of this. When sending metacoins to an address, MetaMask will never appear to approve the transaction, even though MetaMask is active in the Chrome browser. It is not picked up by the application.
In order to keep the codebase clean app.component
should be refactored so that the web3 portions are in a web3 service and the MetaCoin portions are in a MetaCoin service.
This would allow for better separation of concerns. For devs familiar with the Angular2+ architecture but not web3 this would make it more clear which portions are web3-specefic and which portions are standard Angular UI features.
Hey there, quick question: Why did you not use the last version of angular?
"@angular/common": "^2.4.0" vs 4.2.4
same for cli 1.0.0-rc.1 vs 1.1.3
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.