0

I am trying to call FA-2.0 transfer entry point using tezos taquito, I have also gone through https://tezostaquito.io/docs/complex_parameters/. however I get the error below when I try to call transfer entrypoint

const op = kalaTokenContract.methods.transfer( [from_ = sender, txs= [to_ = receiver,
          amount = 1, token_id = 0]]).send();
connecting to Tezos chain: https://delphinet.smartpy.io
[
  [ 'balance_of', 'list', 'contract' ],
  [ 'mint', 'address', 'nat', 'string', 'nat' ],
  [ 'set_administrator', 'address' ],
  [ 'set_pause', 'bool' ],
  [ 'token_metadata', 'list', { lambda: [Object] } ],
  [ 'token_metadata_registry', 'contract' ],
  [ 'transfer', 'list' ],
  [ 'update_operators', 'list' ]
]
AddressValidationError {
  value: undefined,
  token: AddressToken {
    val: { prim: 'address', annots: [Array] },
    idx: 0,
    fac: [Function: createToken],
    createToken: [Function: createToken]
  },
  name: 'AddressValidationError',
  message: '[from_] Address is not valid: undefined'
}```



and here is my full code snippet  
https://gist.github.com/harshabakku/fd45691502aec6e7b50f9b188719ab89
0

First of all, there is an error in your Javascript, you cannot name the array indices and assign them a value, instead of [from_ = sender ...], just write [sender ...].
Then, the argument for the creation of an FA2 token through Taquito is formatted in this way: [{ from_: sender, txs: [{to_: recipient, token_id: token_id, amount: amountOfTokens}]}]. This is the case because the contract expects a list of transfers and for each transfer, the same sender can transfer different tokens to different recipients.

5
  • Hi Claude, thanks for answering, the below code also throws the exact same error const op = kalaTokenContract.methods.transfer( [sender, [ receiver, tokenId, amount]]).send(); full code snippet gist.github.com/harshabakku/aaaa7cfa1c0fa6989be2a194779f9317 – Harsha Bakku Dec 29 '20 at 13:16
  • My first comment was about JavaScript syntax, not the parameters :) You have the correct arguments in the second part, you must provide an array of objects, each object representing 1 or multiple transactions sent from a unique sender. – Claude Barde Dec 29 '20 at 20:22
  • Hi Claude, I'm a little confused what is first part and second part here... . I have done lots of trial and error resulting in the same error no matter what. If you can paste the one line of how one can call transfer entrypoint with correct params, it would be of great help ..... something like const op = kalaTokenContract.methods.transfer( [sender, [ receiver, tokenId, amount]]).send(); – Harsha Bakku Dec 30 '20 at 9:10
  • also batch_transfer param type involving arrays/objects within arrays is more complex than the example here... tezostaquito.io/docs/complex_parameters/…. so I believe it can help other developers as reference as well – Harsha Bakku Dec 30 '20 at 9:11
  • const op = kalaTokenContract.methods.transfer([{ from_: sender, txs: [{to_: recipient, token_id: token_id, amount: amountOfTokens}]}]) – Claude Barde Dec 30 '20 at 13:57

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.