trufflesuite / truffle-artifactor

A contract packager for Ethereum and Javascript (formerly ether-pudding)
MIT License
253 stars 54 forks source link

Contract .call() with "defaultBlock" param specified not working #34

Open abtr945 opened 8 years ago

abtr945 commented 8 years ago

Just wondering: is there any way to invoke Pudding's promisify abstraction of .call() for contract function, in which the defaultBlock optional parameter is specified? The web3 Javascript API equivalent for contract .call() is here: https://github.com/ethereum/wiki/wiki/JavaScript-API#contract-methods

It seems in Pudding's implementation of Utils.promisifyFunction():

args.push(tx_params, callback);

The contract function arguments list is manipulated in such a way that the last 2 arguments will always be the Transaction object (tx_params), then the callback.

However, in Web3:

myContractInstance.myMethod.call(param1 [, param2, ...] [, transactionObject] [, defaultBlock] [, callback]);

allows specifying the optional defaultBlock parameter after the Transaction object. Therefore, invoking Pudding's promisified .call() may not work as expected; because in such case, another tx_params will be appended to the argument list, then the callback.

gnidan commented 6 years ago

This issue is old, so it's from ether-pudding days. The work here likely lives in github.com/trufflesuite/truffle-contract.

gnidan commented 6 years ago

Ref: https://github.com/trufflesuite/truffle-contract/blob/develop/contract.js#L115