Skip to content

Commit

Permalink
I don't think we need to specify the candid usually
Browse files Browse the repository at this point in the history
  • Loading branch information
anchpop committed Aug 19, 2024
1 parent 0ee7ebb commit 711c234
Show file tree
Hide file tree
Showing 20 changed files with 21 additions and 63 deletions.
4 changes: 1 addition & 3 deletions add_hot_key.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ HOTKEY_PRINCIPAL=$(dfx identity get-principal)

export DEVELOPER_NEURON_ID="$(dfx canister \
--network "${NETWORK}" \
call "${SNS_GOVERNANCE_CANISTER_ID}" \
--candid candid/sns_governance.did \
list_neurons "(record {of_principal = opt principal\"${OWNER_PRINCIPAL}\"; limit = 1})" \
call "${SNS_GOVERNANCE_CANISTER_ID}" \ list_neurons "(record {of_principal = opt principal\"${OWNER_PRINCIPAL}\"; limit = 1})" \
| idl2json \
| jq -r ".neurons[0].id[0].id" \
| python3 -c "import sys; ints=sys.stdin.readlines(); sys.stdout.write(bytearray(eval(''.join(ints))).hex())")"
Expand Down
4 changes: 1 addition & 3 deletions developer_neuron_id.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ cd -- "$(dirname -- "${BASH_SOURCE[0]}")"

echo "$(dfx canister \
--network "${NETWORK}" \
call "${SNS_GOVERNANCE_CANISTER_ID}" \
--candid candid/sns_governance.did \
list_neurons "(record {of_principal = opt principal\"${DX_PRINCIPAL}\"; limit = 1})" \
call "${SNS_GOVERNANCE_CANISTER_ID}" \ list_neurons "(record {of_principal = opt principal\"${DX_PRINCIPAL}\"; limit = 1})" \
| idl2json \
| jq -r ".neurons[0].id[0].id" \
| python3 -c "import sys; ints=sys.stdin.readlines(); sys.stdout.write(bytearray(eval(''.join(ints))).hex())")"
4 changes: 1 addition & 3 deletions execute_generic_functions_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ export TEXT="${1:-Hoi}"

export DEVELOPER_NEURON_ID="$(dfx canister \
--network "${NETWORK}" \
call "${SNS_GOVERNANCE_CANISTER_ID}" \
--candid candid/sns_governance.did \
list_neurons "(record {of_principal = opt principal\"${DX_PRINCIPAL}\"; limit = 1})" \
call "${SNS_GOVERNANCE_CANISTER_ID}" \ list_neurons "(record {of_principal = opt principal\"${DX_PRINCIPAL}\"; limit = 1})" \
| idl2json \
| jq -r ".neurons[0].id[0].id" \
| python3 -c "import sys; ints=sys.stdin.readlines(); sys.stdout.write(bytearray(eval(''.join(ints))).hex())")"
Expand Down
4 changes: 1 addition & 3 deletions get_all_sns_neurons.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,4 @@ cd -- "$(dirname -- "${BASH_SOURCE[0]}")"

dfx canister \
--network "${NETWORK}" \
call "${SNS_GOVERNANCE_CANISTER_ID}" \
--candid candid/sns_governance.did \
list_neurons "(record {of_principal = null; limit = 0})"
call "${SNS_GOVERNANCE_CANISTER_ID}" \ list_neurons "(record {of_principal = null; limit = 0})"
4 changes: 1 addition & 3 deletions get_last_sns_proposal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,4 @@ cd -- "$(dirname -- "${BASH_SOURCE[0]}")"

dfx canister \
--network "${NETWORK}" \
call "${SNS_GOVERNANCE_CANISTER_ID}" \
--candid candid/sns_governance.did \
list_proposals '(record {include_reward_status = vec {}; limit = 1:nat32; exclude_type = vec {}; include_status = vec {};})'
call "${SNS_GOVERNANCE_CANISTER_ID}" \ list_proposals '(record {include_reward_status = vec {}; limit = 1:nat32; exclude_type = vec {}; include_status = vec {};})'
4 changes: 1 addition & 3 deletions get_sns_canisters.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,4 @@ cd -- "$(dirname -- "${BASH_SOURCE[0]}")"

dfx canister \
--network "${NETWORK}" \
call "${SNS_ROOT_CANISTER_ID}" \
--candid candid/sns_root.did \
list_sns_canisters '(record {})'
call "${SNS_ROOT_CANISTER_ID}" \ list_sns_canisters '(record {})'
4 changes: 1 addition & 3 deletions get_sns_neuron.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@ ID="${1}"

dfx canister \
--network "${NETWORK}" \
call "${SNS_GOVERNANCE_CANISTER_ID}" \
--candid candid/sns_governance.did \
get_neuron "(record {neuron_id = opt record {id = blob \"${ID}\"};})"
call "${SNS_GOVERNANCE_CANISTER_ID}" \ get_neuron "(record {neuron_id = opt record {id = blob \"${ID}\"};})"
4 changes: 1 addition & 3 deletions get_sns_neurons.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,4 @@ cd -- "$(dirname -- "${BASH_SOURCE[0]}")"

dfx canister \
--network "${NETWORK}" \
call "${SNS_GOVERNANCE_CANISTER_ID}" \
--candid candid/sns_governance.did \
list_neurons "(record {of_principal = opt principal\"$(dfx identity get-principal)\"; limit = 0})"
call "${SNS_GOVERNANCE_CANISTER_ID}" \ list_neurons "(record {of_principal = opt principal\"$(dfx identity get-principal)\"; limit = 0})"
4 changes: 1 addition & 3 deletions get_sns_proposal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@ export ID="${1:-1}"

dfx canister \
--network "${NETWORK}" \
call "${SNS_GOVERNANCE_CANISTER_ID}" \
--candid candid/sns_governance.did \
get_proposal "(record {proposal_id = opt record {id = (${ID}:nat64)}})"
call "${SNS_GOVERNANCE_CANISTER_ID}" \ get_proposal "(record {proposal_id = opt record {id = (${ID}:nat64)}})"
8 changes: 2 additions & 6 deletions list_sns_dev_neurons.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ for DEV_IDENT in "${HOME}"/.config/dfx/identity/dev-ident-*; do
export DX_PRINCIPAL="$(dfx identity get-principal)"
export NEURON_IDS="$(dfx canister \
--network "${NETWORK}" \
call "${SNS_GOVERNANCE_CANISTER_ID}" list_neurons \
--candid candid/sns_governance.did \
"(record {of_principal = opt principal\"${DX_PRINCIPAL}\"; limit = 0})")"
call "${SNS_GOVERNANCE_CANISTER_ID}" list_neurons \ "(record {of_principal = opt principal\"${DX_PRINCIPAL}\"; limit = 0})")"
echo "Listing Developer Neurons for Identity ${DEV_IDENT}, Principal ${DX_PRINCIPAL}"
echo "${NEURON_IDS}"
done
Expand All @@ -26,9 +24,7 @@ CANISTER_DEV_NEURON=n2xex-iyaaa-aaaar-qaaeq-cai
echo "Listing for ${CANISTER_DEV_NEURON}"
dfx canister \
--network "${NETWORK}" \
call "${SNS_GOVERNANCE_CANISTER_ID}" \
--candid candid/sns_governance.did \
list_neurons "(record {of_principal = opt principal\"${CANISTER_DEV_NEURON}\"; limit = 0})"
call "${SNS_GOVERNANCE_CANISTER_ID}" \ list_neurons "(record {of_principal = opt principal\"${CANISTER_DEV_NEURON}\"; limit = 0})"

# Switch back to the previous identity
dfx identity use "${CURRENT_DX_IDENT}"
4 changes: 1 addition & 3 deletions perform_neuron_operation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ cd -- "$(dirname -- "${BASH_SOURCE[0]}")"

export DEVELOPER_NEURON_ID="$(dfx canister \
--network "${NETWORK}" \
call "${SNS_GOVERNANCE_CANISTER_ID}" \
--candid candid/sns_governance.did \
list_neurons "(record {of_principal = opt principal\"${DX_PRINCIPAL}\"; limit = 1})" \
call "${SNS_GOVERNANCE_CANISTER_ID}" \ list_neurons "(record {of_principal = opt principal\"${DX_PRINCIPAL}\"; limit = 1})" \
| idl2json \
| jq -r ".neurons[0].id[0].id" \
| python3 -c "import sys; ints=sys.stdin.readlines(); sys.stdout.write(bytearray(eval(''.join(ints))).hex())")"
Expand Down
4 changes: 1 addition & 3 deletions register_dapp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ dfx canister --network "${NETWORK}" update-settings --add-controller "${SNS_ROOT

export DEVELOPER_NEURON_ID="$(dfx canister \
--network "${NETWORK}" \
call "${SNS_GOVERNANCE_CANISTER_ID}" \
--candid candid/sns_governance.did \
list_neurons "(record {of_principal = opt principal\"${DX_PRINCIPAL}\"; limit = 1})" \
call "${SNS_GOVERNANCE_CANISTER_ID}" \ list_neurons "(record {of_principal = opt principal\"${DX_PRINCIPAL}\"; limit = 1})" \
| idl2json \
| jq -r ".neurons[0].id[0].id" \
| python3 -c "import sys; ints=sys.stdin.readlines(); sys.stdout.write(bytearray(eval(''.join(ints))).hex())")"
Expand Down
4 changes: 1 addition & 3 deletions register_generic_functions_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ cd -- "$(dirname -- "${BASH_SOURCE[0]}")"

export DEVELOPER_NEURON_ID="$(dfx canister \
--network "${NETWORK}" \
call "${SNS_GOVERNANCE_CANISTER_ID}" \
--candid candid/sns_governance.did \
list_neurons "(record {of_principal = opt principal\"${DX_PRINCIPAL}\"; limit = 1})" \
call "${SNS_GOVERNANCE_CANISTER_ID}" \ list_neurons "(record {of_principal = opt principal\"${DX_PRINCIPAL}\"; limit = 1})" \
| idl2json \
| jq -r ".neurons[0].id[0].id" \
| python3 -c "import sys; ints=sys.stdin.readlines(); sys.stdout.write(bytearray(eval(''.join(ints))).hex())")"
Expand Down
4 changes: 1 addition & 3 deletions transfer_sns_treasury_funds.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ export TO_PRINCIPAL="${2:-$DX_PRINCIPAL}"

export DEVELOPER_NEURON_ID="$(dfx canister \
--network "${NETWORK}" \
call "${SNS_GOVERNANCE_CANISTER_ID}" \
--candid candid/sns_governance.did \
list_neurons "(record {of_principal = opt principal\"${DX_PRINCIPAL}\"; limit = 1})" \
call "${SNS_GOVERNANCE_CANISTER_ID}" \ list_neurons "(record {of_principal = opt principal\"${DX_PRINCIPAL}\"; limit = 1})" \
| idl2json \
| jq -r ".neurons[0].id[0].id" \
| python3 -c "import sys; ints=sys.stdin.readlines(); sys.stdout.write(bytearray(eval(''.join(ints))).hex())")"
Expand Down
4 changes: 1 addition & 3 deletions update_sns_neuron.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,4 @@ ARG="${1}"

dfx canister \
--network "${NETWORK}" \
call "${SNS_GOVERNANCE_CANISTER_ID}" \
--candid candid/sns_governance.did \
update_neuron "(${ARG})"
call "${SNS_GOVERNANCE_CANISTER_ID}" \ update_neuron "(${ARG})"
4 changes: 1 addition & 3 deletions upgrade_dapp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ export ARG="${3:-()}"

export DEVELOPER_NEURON_ID="$(dfx canister \
--network "${NETWORK}" \
call "${SNS_GOVERNANCE_CANISTER_ID}" \
--candid candid/sns_governance.did \
list_neurons "(record {of_principal = opt principal\"${DX_PRINCIPAL}\"; limit = 1})" \
call "${SNS_GOVERNANCE_CANISTER_ID}" \ list_neurons "(record {of_principal = opt principal\"${DX_PRINCIPAL}\"; limit = 1})" \
| idl2json \
| jq -r ".neurons[0].id[0].id" \
| python3 -c "import sys; ints=sys.stdin.readlines(); sys.stdout.write(bytearray(eval(''.join(ints))).hex())")"
Expand Down
4 changes: 1 addition & 3 deletions vote_on_sns_proposal.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ do
export DX_PRINCIPAL="$(dfx identity get-principal)"
export JSON="$(dfx canister \
--network "${NETWORK}" \
call "${SNS_GOVERNANCE_CANISTER_ID}" \
--candid candid/sns_governance.did \
list_neurons "(record {of_principal = opt principal\"${DX_PRINCIPAL}\"; limit = 0})" \
call "${SNS_GOVERNANCE_CANISTER_ID}" \ list_neurons "(record {of_principal = opt principal\"${DX_PRINCIPAL}\"; limit = 0})" \
| idl2json \
| jq -r ".neurons")"
for((i=0; i<"$(echo $JSON | jq length)"; i++))
Expand Down
4 changes: 1 addition & 3 deletions vote_with_developer_neurons.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ for DEV_IDENT in "$HOME"/.config/dfx/identity/dev-ident-*; do
export DX_PRINCIPAL="$(dfx identity get-principal)"
export JSON="$(dfx canister \
--network "${NETWORK}" \
call "${SNS_GOVERNANCE_CANISTER_ID}" \
--candid candid/sns_governance.did \
list_neurons "(record {of_principal = opt principal\"${DX_PRINCIPAL}\"; limit = 0})" \
call "${SNS_GOVERNANCE_CANISTER_ID}" \ list_neurons "(record {of_principal = opt principal\"${DX_PRINCIPAL}\"; limit = 0})" \
| idl2json \
| jq -r ".neurons")"
for((i=0; i<"$(echo $JSON | jq length)"; i++))
Expand Down
4 changes: 1 addition & 3 deletions vote_with_single_identity.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ PEM_FILE="$(readlink -f "$HOME/.config/dfx/identity/${VOTING_IDENTITY}/identity.
export DX_PRINCIPAL="$(dfx identity get-principal)"
export JSON="$(dfx canister \
--network "${NETWORK}" \
call "${SNS_GOVERNANCE_CANISTER_ID}" \
--candid candid/sns_governance.did \
list_neurons "(record {of_principal = opt principal\"${DX_PRINCIPAL}\"; limit = 0})" \
call "${SNS_GOVERNANCE_CANISTER_ID}" \ list_neurons "(record {of_principal = opt principal\"${DX_PRINCIPAL}\"; limit = 0})" \
| idl2json \
| jq -r ".neurons")"

Expand Down
4 changes: 1 addition & 3 deletions wait_for_canister_running.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ export CID="${1}"

while [ "$(./bin/dfx canister \
--network "${NETWORK}" \
call ${SNS_ROOT_CANISTER_ID} \
--candid candid/sns_root.did \
canister_status "(record {canister_id=principal\"${CID}\"})" \
call ${SNS_ROOT_CANISTER_ID} \ canister_status "(record {canister_id=principal\"${CID}\"})" \
| ./bin/idl2json \
| jq -r '.status')" != "$(echo -e "{\n \"running\": null\n}")" ]
do
Expand Down

0 comments on commit 711c234

Please sign in to comment.