Como ligar para um método de contrato inteligente com params com EZTZ?
2 respostas
- votos
-
- 2019-02-03
Vocêpode usar ométodo deenvio do contrato:
eztz.contract.send(contract, keys, amount, parameter, fee, gasLimit, storageLimit)
Para oparâmetro,você acabou deentrarnaentrada Raw Michelson (omesmo que usaria através do comando Tezos-Client).porexemplo.Vocêpoderiafazer:
eztz.contract.send(contract, keys, amount, '(Left (Pair "test" 1))', fee, gasLimit, storageLimit) //For contract parameter (or (pair string int) (int))
Para onosso contratoespecífico,precisamos saber o que é o contrato de liquideztotale Michelson,poispode haver váriospontos deentrada que usam ométodo "ou".
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://pasterbin.com/cf3bbyje -meu contrato,comoeu chamo de "createfile"ponto deentradahttps://pastebin.com/CF3bByjE - my contract, how me call "createFile" entry point
- 1
- 2019-02-03
- Михаил Магомедов
-
Vocêpode compartilhar o código compilado Michelson,porfavorCan you share the compiled Michelson code as well please
- 0
- 2019-02-03
- Stephen Andrews
-
Stephen Andrews,https://pasterbin.com/xyy7kumtStephen Andrews , https://pastebin.com/XYY7KuMt
- 1
- 2019-02-03
- Михаил Магомедов
-
Vocêpode usar: '(Parte (par "string" "tz1keyhash"))You can use: '(Left (Pair "string" "tz1keyhash"))'
- 0
- 2019-02-03
- Stephen Andrews
-
Desculpe,mas ondeeu digoem qual uso depontos deentrada?Sorry, but where i'm say which entry point use ?
- 0
- 2019-02-03
- Михаил Магомедов
-
- 2019-02-03
Eunãotenho umexemploprontamente disponívelpara você,masno EZTZ,os contratostêm ummétodo
send
com umparâmetroparameter
.Isso devefazer otruque.
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);
A EZTZtem algummétodopara chamarmétodos de contratointeligentes comparâmetros?
Porexemplo,se omeu contratotiver ummétodo
Comoposso chamaressemétodo donavegador com EZTZ?