Skip to content

Instantly share code, notes, and snippets.

@ninegua
Last active May 6, 2022 16:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ninegua/6fa1863837556766e0bcfd8b3aeb4c30 to your computer and use it in GitHub Desktop.
Save ninegua/6fa1863837556766e0bcfd8b3aeb4c30 to your computer and use it in GitHub Desktop.
Get started to call NNS from command line (using dfx)
FILES=governance.did cmc.did canister_ids.json dfx.json
setup: $(FILES)
@echo You are all set! Run 'dfx canister --network=ic call nns get_monthly_node_provider_rewards' to test if it works.
@echo Please read the governance.did file to find the complete interface.
governance.did:
@curl -L https://github.com/dfinity/ic/raw/master/rs/nns/governance/canister/governance.did -o $@
cmc.did:
@curl -L https://github.com/dfinity/ic/raw/master/rs/nns/cmc/cmc.did -o $@
canister_ids.json:
@echo '{ "nns": { "ic": "rrkah-fqaaa-aaaaa-aaaaq-cai" }, "cmc": { "ic": "rkp4c-7iaaa-aaaaa-aaaca-cai" } }' > $@
dfx.json:
@echo '{ "canisters": { "nns": { "type": "custom", "candid": "governance.did", "wasm": "" }, "cmc": { "type": "custom", "candid": "cmc.did", "wasm": "" } } }' > $@
clean:
rm -f $(FILES)
.PNONY: clean setup
@ninegua
Copy link
Author

ninegua commented May 1, 2022

Before you start, you need to have a working version of dfx, curl, and GNU Make on your system.

  1. Download this file to an empty directory.
  2. Run 'make'.

Then you should be able to use dfx to call NNS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment