Skip to content

Commit

Permalink
feat(nns-tools): nns_claim_or_refresh helper (#3424)
Browse files Browse the repository at this point in the history
Add a simple way to claim or refresh a neuron (for reference)
  • Loading branch information
max-dfinity authored Jan 13, 2025
1 parent cf53688 commit 66ff234
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions testnet/tools/nns-tools/lib/include.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ source "$LIB_DIR/canisters.sh"
source "$LIB_DIR/constants.sh"
source "$LIB_DIR/functions.sh"
source "$LIB_DIR/installers.sh"
source "$LIB_DIR/nns_neurons.sh"
source "$LIB_DIR/proposals.sh"
source "$LIB_DIR/sns_upgrades.sh"
source "$LIB_DIR/topology.sh"
Expand Down
32 changes: 32 additions & 0 deletions testnet/tools/nns-tools/lib/nns_neurons.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
##: claim_or_refresh
## Usage: $1 <NETWORK> <NEURON_ID>
## Claim or refresh an NNS neuron with a particular ID
## NETWORK: The network to use.
## NEURON_ID: The neuron id to claim or refresh.
## Example: claim_or_refresh ic 1234567890
nns_claim_or_refresh() {
local network=$1
local neuron_id=$2

local IC=$(repo_root)
local GOV_DID="$IC/rs/nns/governance/canister/governance.did"

dfx canister \
--network ic \
call \
--candid "$GOV_DID" \
rrkah-fqaaa-aaaaa-aaaaq-cai \
manage_neuron "(
record {
id = opt record { id = ${neuron_id}: nat64 };
command = opt variant {
ClaimOrRefresh = record {
controller = null;
by = opt variant {
NeuronIdOrSubaccount = record { }
}
}
}
}
)"
}

0 comments on commit 66ff234

Please sign in to comment.