1

It might be a stupid question, but I am trying to learn how to work with Near Protocol in Near academy.

In chapter 6, you have a task to login to NEAR using CLI, register yourself as a meme museum contributor and register your meme.

Link to the Chapter 6: https://near.academy/near101/chapter-6

I have an issue when I try to register the meme. I am getting an error:

Unknown argument: {meme : bingoo, title : telephonememe, data : https://9gag.com/gag/a718nWb, category : 4}

I am not sure why those arguments are percevied as unknown.

Here's the code:

near call museum.testnet add_meme \ '{"meme" : "bingoo", "title" : "telephonememe", "data" : "https://9gag.com/gag/a718nWb", "category" : 4}' --accountId bingoo.testnet --amount 4

hjugo
  • 13
  • 3
  • I tried your command and it seemed to work; I got a different but (I think) expected error: `This method can only be called by a museum contributor or owner`. Maybe the terminal you are using is not parsing quotes or back-slashes properly – Marcelo Fornet Mar 07 '22 at 20:23
  • Thanks for the answer. It must be something with my terminal. You get this error Marcelo because you need to enter this line, which adds you as a museum contributor: near call museum.testnet add_myself_as_contributor --accountId YOUR_ACCOUNT_NAME.testnet Should I use different terminal or update it somehow? – hjugo Mar 08 '22 at 12:16

1 Answers1

0

I'm using a windows machine, and I was getting the same error.

I tried a bunch of things and I saw this AWS post on host to use quotes in the aws cli: https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-parameters-quoting-strings.html

I think for windows you can't use the single quotes around the json object, and you can't do the \ for the newline. I would just one long string and \ the " inside the json. like this:

near call museum.testnet add_meme "{\"meme\" : \"bingoo\", \"title\" : \"telephonememe\", \"data\" : \"https://9gag.com/gag/a718nWb\", \"category\" : 4}" --accountId bingoo.testnet --amount 4

I think this is why they recommend using wsl for windows in their github repo: Windows For Windows users, we recommend using Windows Subsystem for Linux (WSL).

Install WSL 
Install npm 
Install Node.js 
Change npm default directory 
This is to avoid any permission issues with WSL
Open WSL and install near-cli globally by running:
npm install -g near-cli
Quoc Duong
  • 16
  • 1
  • 4