I know from Canlista that @noble/hashes has a way of converting principal id to account id, so presumably the plugin wallet works by generating a corresponding principal id for each account id.
By verifying the transaction history of the converted account id, I think my inference is correct.
However, I have now only found how to do this conversion with rust on the forums, but not how to do it with js.
I’ve tried looking for the ic-js nns library, and @dfinity/principal.
By the way, why not do this conversion directly into @dfinity/principal?
I assuming that with “account id” you mean an account identifier used for the ICP ledger transactions?
If yes, checkount the @dfinity/ledger-icp
library class AccountIdentifier
https://github.com/dfinity/ic-js/tree/main/packages/ledger-icp#factory-accountidentifier
Thanks for the reply Spider-Man, you are always so quick to solve our problems.
With @dfinity/ledger-icp
I did solve the problem, but I would also like to point out that the following two pieces of code were previously mentioned in the readme of the nns library for ic-js:
import { AccountIdentifier, LedgerCanister } from "@dfinity/nns";
const accountIdentifier = AccountIdentifier.fromHex(
"efa01544f509c56dd85449edf2381244a48fad1ede5183836229c00ab00d52df",
).
The AccountIdentifier in this now seems to have been moved to the @dfinity/ledger-icp
library, which caused a degree of misunderstanding on my part.
Cool! Thanks for the input, probably forgot to update the README when we migrated the code to the new library (related announcement). I’ll update the README next week.
Done https://github.com/dfinity/ic-js/pull/458.
Note: The new README will appears on npmjs next time we publish the lib.
cool, efficient work