Hey, I really appreciate there being an alternative to web3.
Have you considered converting this to TypeScript or providing typescript type definitions for the classes and methods in the package? It would be a real differentiator in terms of usability vs. web3.
EDIT: FWIW, I'm exploring alternatives to web3.js because web3-eth-abi is choking on decoding a log. So far I've only used web3-eth-abi for decoding parameters and encoding method/event signatures, and I've been sticking to custom TypeScript clients for interacting the ethereum JSON rpc. see https://github.com/Ethercast/ethercast-model/blob/master/src/ethercast-models.ts
Heya!
I will be porting this to TypeScript soon; it鈥檚 alreay in the works. :)
If you check out the pull requests, you will also find someone has already done a lot of work to create some definition files. I haven鈥檛 tested them yet though.
Web3.js does have tentative plans to include the ethers.js ABI Coder, so hopefully soon that will solve a lot of those problems.
@ricmoo good day,have you added Typescript??? really looking for that now
It鈥檚 coming. It just takes time, and is important to not rush... More speed, less haste. :)
There is a PR though, which you can pull to use community contributed TypeScript definititions.
Since TS will be a major version change, some of the legacy bumps will be removed too. I鈥檒l be releasing an article tomorrow on some of the new features.
@ricmoo thanks for the update
(notice this issue now has the "on-deck" label... ;))
Will be great to see this in ethers. Keep up the good work guys!
The initial TypeScript implementation passes all JavaScript test cases: https://github.com/ethers-io/ethers.js/tree/typescript
There is obviously still a lot of work, and this is my first foray into TypeScript. There are still lots of places to add types to.
I think it is important for me to fully understand TypeScript though, since I need to be able to maintain it. So at this point I would prefer pointers and suggestions, rather than PR's, so I can learn from it. I believe suffering is learning; I won't learn anything from too much hand-holding. :)
I will be working on getting the dist files and phantomjs test cases working next, and then duplicating all the tests to test the TypeScript variation (both are required, testing JS and TS).
New Feature:
Providers and Promises
Anything passed into a Provider can be a promise, so for example:
var tx = {
to: somePromiseThatGetsTheAddressFromTheUI,
value: somePromiseThatGetsTheAmountFromTheUI
}
// A Promise!
tx.gasPrice = provider.getGasPrice()
// A Promise that uses the tx.to Promise from above
tx.gasLimit = provider.getCode(tx.to).then((code) => {
if (code === '0x') {
return 21000;
}
return provider.estimateGas(tx);
});
wallet.sendTransaction(tx);
Coming Soon
This major version will also include implicit ENS support for contract address parameters... That will be done soon.
Implicit ENS support is done. :)
var abi = [
"function foo(address bar, tuple(uint, address), tuple(address baz))"
];
var contract = new Contract("awesome.eth", abi, provider);
contract.foo("ricmoo.firefly.eth", [ 42, "yuetloo.xyz" ], { baz: "anemone.eth" }).then((result) => {
console.log(result);
});
:)
Done! :)
Most helpful comment
Done! :)