Closed nachomazzara closed 5 years ago
please add test
please add test
That's why it is WIP
🔥
@menduz @NicoSantangelo test added!
I'm starting feeling we should not add any other method to Contract.ts
and instead start creating functions that receive the contract. Like
await eth.callContract(ContractInstance, 'balanceOf', address)
await ContractInstance.balanceOf(address) // keep some overload in the contract
await eth.sendContractTransaction(ContractInstance, 'mint', address, amount)
await eth.sendContractTransaction(ContractInstance, 'mint', 'address,uint256', address, amount)
await ContractInstance.mint(address, amount) // keep some overload in the contract
I'm also in doubt about which overload should be the default in the contract. Lets assume we have
contract X {
mint(a: address, b: uint256) {...}
mint(a: address) {...}
}
Then we have the
function callMint(){
await XInstance.mint.apply(...arguments)
}
@menduz thanks for the review!
What mint are we choosing? I: It will get the first in the ABI
Is that choice stable?
I: No, but you will use sendCallByType
or sendTransactionByType
if you see the ABI with an overloaded method to execute the desired one. The main goal with those ...ByType
is to don't care about the order. We can remove the name
method and only keep byType methods when there is an overload.
I mean, if we have the mint
method overloaded. We can remove
contract.mint()
and only support contract.sendTransactionByType('mint', 'type1')
and contract.sendCallByType('mint', 'type2')
Will the solidity JSON ABI be emitted consistently in every release? I: The order of the overloaded method should keep consistent between versions
We support the legacy methods for the marketplace-contract
which has the same name but different parameters.
E.g:
// Cancel Order
function cancelOrder(address nftAddress, uint256 assetId);
// Cancel Order Legacy
function cancelOrder(uint256 assetId);
Nowadays is not a problem because we can manipulate the ABI and remove the legacy methods cause at the marketplace Dapp
we don't need the legacy ones, but would be great to stop removing methods from ABI and select the method from our Dapps by type
Ability to send transaction by type when there is an overloading with function names
Usage
Send Call
Send Transaction
Note
Also added
Marketplace-Contract
ABI with overloaded events