3

im tryng to send the operation to a deployed contract, this is my function ...

eztz.contract
.send(
  "KT18qHvhEZUwiawA8QEURwuK8RGJj184725L",
  keysext.pkh,
  keysext.sk,
  5,
  "RIGHT LEFT UNIT",
  "01000",
  50000,
  10000
)
.then(res => {
  console.log(res);
})
.catch(err => {
  console.log(err);
});

and all i get is this result ...

TypeError: "Expected String"
s eztz.min.js:8
decode eztz.min.js:8
decode eztz.min.js:8
b58cdecode eztz.min.js:8
sign eztz.min.js:8
sendOperation eztz.min.js:8
run es6.promise.js:75
notify es6.promise.js:92
flush _microtask.js:18

signcontract.js:25

... any ideia of what might be happening??

this my contract parameters and storage,

    parameter
  (or :_entries
     (pair :proposition %_Liq_entry_create_proposition
        (key_hash %destination)
        (mutez %amount))
     (or (unit %_Liq_entry_sign_proposition) (unit %_Liq_entry_execute_proposition)));
storage
  (pair :storage
     (set %owners address)
     (pair (set %owners_signed address)
           (option %last_proposition
              (pair :proposition (key_hash %destination) (mutez %amount)))));

and the entry point i want to call is the sign_proposition

  • 1
    In that case it's probably keysext.sk that is the problem. I assume that's the private key and the function expects a key pair. So, if you change that to just keysext instead? – Klassare Jul 7 at 1:10
  • 1
    No need to extract it. Just pass the whole keys object. ``` .send( "KT18qHvhEZUwiawA8QEURwuK8RGJj184725L", keysext.pkh, keysext, 5, "RIGHT LEFT UNIT", 1000, 50000, 10000 ) ``` – Klassare Jul 7 at 1:17
  • 1
    Not a problem unless you need a higher gas limit than 400 000. But in this case it shouldn't be a problem. – Klassare Jul 7 at 1:59
  • 1
    Btw, looking at the parameter it looks like you are missing parentheses. Could be worth to try something like "(Right (Left Unit))", but not 100% sure. – Klassare Jul 7 at 2:24
  • 1
    Probably too low fee in that case, increase it to 1000000 or something. – Klassare Jul 7 at 2:36
1

Extracting an answer from the comments (kudos to @Klassare)

  • That the private key (keysext.sk) is passed as an argument when eztz expects a keys object (keys = {pkh: string, sk: string, pk: string}) is one problem. Just pass the whole keys object instead. eztz.contract.send( "KT18qHvhEZUwiawA8QEURwuK8RGJj184725L", keysext.pkh, keysext, 5, "RIGHT LEFT UNIT", 1000, 50000, 10000 )
  • looking at the parameter it looks like you are missing parentheses. Could be worth to try something like "(Right (Left Unit))".
  • Try to increase the gas limit from 50 000 to something higher, 800 000 is the highest value you can set it to.
  • Try increase the fees to 1000000 or something

.send( "KT18qHvhEZUwiawA8QEURwuK8RGJj184725L", keysext.pkh, keysext, 5, "(RIGHT (LEFT UNIT))", 1000000, 400000, 10000 )

Gas limit, storage limit and the fee is not optimized now. You should tweak this values before interacting with this contract on the mainnet. You can do so by doing a simulation (dry-run) or a preapply.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.