dfinity / sdk

IC SDK: a Software Development Kit for creating and managing canister smart contracts on the ICP blockchain.
https://internetcomputer.org/developers
Apache License 2.0
170 stars 82 forks source link

feat: subaccount can be derived from principal in dfx ledger account-id #3755

Closed mraszyk closed 3 months ago

mraszyk commented 3 months ago

Description

This PR makes it possible to derive the subaccount from a principal in the dfx ledger account-id command. This is useful for NNS voters to validate NNS subnet rental request proposals by deriving the ledger account (controlled by the subnet rental canister's principal and using the proposer's principal as the subaccount) to which the proposer should have transfered the deposit.

How Has This Been Tested?

A new e2e test has been added comparing the account ID returned by DFX against the account ID computed by the SRC for the caller.