Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error invoke requestTrade #44

Open
woodyjon opened this issue Jan 3, 2019 · 2 comments
Open

error invoke requestTrade #44

woodyjon opened this issue Jan 3, 2019 · 2 comments

Comments

@woodyjon
Copy link

woodyjon commented Jan 3, 2019

in page 106, I do $ peer chaincode invoke -n tw -c '{"Args":["requestTrade","50000","Wood for Toys"]}' -C tradechannel.
I get the following error: Incorrect number of arguments. Expecting 3: {ID, Amount, Description of Goods}. Found 2)

It seems logical to me as the in the go code of func requestTrade() (in tradeWorkflow.go), the args is only 2 elements long as the name of the function is not included.
But then also, I do not understand what you expect in line 206 in args[0] when you do tradeKey, err = getTradeKey(stub, args[0])

I use trade-finance-logistics master, fabric 1.1, trade_workflow_v1.

Thank you for your support.

@VRamakrishna
Copy link
Collaborator

VRamakrishna commented Jan 3, 2019

Please check the errata I mentioned on the other thread. We noticed a few errors as well as the version number omission and submitted them to the publishers.

If you can't find the errata on the Packt site, I'll post it here.

@woodyjon
Copy link
Author

woodyjon commented Jan 3, 2019

Ho I see. Yes indeed, it works with the errata ;-)
Big thank you for getting back so quickly.

For people who encounter the same issue, here it is:

Full errata here: https://www.packtpub.com/books/content/support/33475

specifically for this issue:

Errata type: code Page no 106

This:

  1. Put a new trade agreement on the ledger with the following command:
    $ peer chaincode invoke -n tw -c '{"Args":["requestTrade", "50000",
    "Wood for Toys"]}' -C tradechannel
  2. Retrieve the trade agreement from the ledger with the following command:
    $ peer chaincode invoke -n tw -c '{"Args":["getTradeStatus",
    "50000"]}' -C tradechannel

Should be:

  1. Put a new trade agreement with a unique ID trade-12 on the ledger with the following command:
    $ peer chaincode invoke -n tw -c '{"Args":["requestTrade", "trade-12", "50000", "Wood for Toys"]}' -C tradechannel

  2. Retrieve the trade agreement with the ID trade-12 from the ledger with the following command:
    $ peer chaincode invoke -n tw -c '{"Args":["getTradeStatus", "trade-12"]}' -C tradechannel

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants