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

Expose memoToNeuronSubaccount and memoToNeuronAccountIdentifier #745

Merged
merged 3 commits into from
Nov 1, 2024

Conversation

dskloetd
Copy link
Collaborator

@dskloetd dskloetd commented Nov 1, 2024

Motivation

We want to be able to claim a neuron from NNS dapp if the stake process was interrupted after the transfer but before the claim.
For this we need to be able to calculate the neuron account identifier to confirm that a transaction was made for the purpose of staking.
So we would like to reuse the code that calculates the account identifier of the neuron from a memo.

Changes

Extract the code to calculate a neuron account identifier from packages/nns/src/governance.canister.ts and export it from packages/nns/src/utils/neurons.utils.ts.

Tests

  1. Added some "change detector" unit tests.
  2. The original code is covered by test coverage added in Improve stakeNeuron test coverage #743

Todos

  • Add entry to changelog (if necessary).

Copy link
Contributor

github-actions bot commented Nov 1, 2024

size-limit report 📦

Path Size
@dfinity/ckbtc 8.02 KB (0%)
@dfinity/cketh 3.57 KB (0%)
@dfinity/cmc 1.4 KB (0%)
@dfinity/ledger-icrc 4.17 KB (0%)
@dfinity/ledger-icp 15.43 KB (0%)
@dfinity/nns 36.59 KB (+1.14% 🔺)
@dfinity/nns-proto 140.98 KB (0%)
@dfinity/sns 16.19 KB (0%)
@dfinity/utils 4.64 KB (0%)
@dfinity/ic-management 3.01 KB (0%)

@dskloetd dskloetd marked this pull request as ready for review November 1, 2024 14:38
@dskloetd dskloetd requested review from a team as code owners November 1, 2024 14:38
@dskloetd dskloetd enabled auto-merge (squash) November 1, 2024 14:39
Copy link
Contributor

@lmuntaner lmuntaner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@dskloetd dskloetd merged commit 398daf4 into main Nov 1, 2024
11 checks passed
@dskloetd dskloetd deleted the kloet/memo-utils branch November 1, 2024 14:42
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

Successfully merging this pull request may close these issues.

2 participants