如何使用eztz参数调用智能合约方法?
2 个回答
- 投票数
-
- 2019-02-03
您可以使用合同发送方法:
eztz.contract.send(contract, keys, amount, parameter, fee, gasLimit, storageLimit)
对于参数,您只需输入原始的Michelson输入(与通过tezos-client命令使用的输入相同).例如您可以这样做:
eztz.contract.send(contract, keys, amount, '(Left (Pair "test" 1))', fee, gasLimit, storageLimit) //For contract parameter (or (pair string int) (int))
对于我们的特定合同,我们需要知道全部流动性和迈克尔逊合同的样子,因为可能会有多个使用"或"方法的切入点.
You 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.
-
https://pastebin.com/CF3bByjE-我的合同,我怎么称呼" createFile"入口点https://pastebin.com/CF3bByjE - my contract, how me call "createFile" entry point
- 1
- 2019-02-03
- Михаил Магомедов
-
您能否也分享编译后的迈克尔逊代码Can you share the compiled Michelson code as well please
- 0
- 2019-02-03
- Stephen Andrews
-
斯蒂芬·安德鲁斯(Stephen Andrews),https://pastebin.com/XYY7KuMtStephen Andrews , https://pastebin.com/XYY7KuMt
- 1
- 2019-02-03
- Михаил Магомедов
-
您可以使用:'(左(配对" string""tz1keyhash"))'You can use: '(Left (Pair "string" "tz1keyhash"))'
- 0
- 2019-02-03
- Stephen Andrews
-
抱歉,但是我要说的是哪个入口点使用?Sorry, but where i'm say which entry point use ?
- 0
- 2019-02-03
- Михаил Магомедов
-
- 2019-02-03
我没有适合您的示例,但是在eztz中,合同具有
send
方法和parameter
参数.应该可以解决问题.
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);
I don't have a readily available example for you but in eztz, contracts have a method
send
with aparameter
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);
Eztz是否有某种方法可以调用带参数的智能合约方法?
例如,如果我的合同中有方法
如何使用Eztz在浏览器中调用此方法?