Does Eztz have some method for calling smart contract methods with parameters?
For example if my contract has a method
let%entry createFile ((fileHash : string),(manager:key_hash)) storage
How can I call this method from browser with Eztz?
Tezos Stack Exchange is a question and answer site for users, experts, and developers of the Tezos blockchain project. It only takes a minute to sign up.
Sign up to join this communityYou can use the contract send method:
eztz.contract.send(contract, keys, amount, parameter, fee, gasLimit, storageLimit)
For parameter, you just enter in the raw Michelson input (the same you would use via the tezos-client command). e.g. You could do:
eztz.contract.send(contract, keys, amount, '(Left (Pair "test" 1))', fee, gasLimit, storageLimit)
//For contract parameter (or (pair string int) (int))
For our specific contract, we need to know what the full liquidity and Michelson contract looks like as there can be multiple entry points which use the "or" method.
I don't have a readily available example for you but in eztz, contracts have a method send
with a parameter
parameter.
That should do the trick.
send : function(contract, keys, amount, parameter, fee){
return eztz.rpc.sendOperation({
"kind": "transaction",
"amount": amount*100,
"destination": contract,
"parameters": eztz.utility.ml2tzjson(parameter)
}, keys, fee);