How to import key created by near-cli into NEAR Wallet? [closed]

Solution 1:

See docs at https://docs.near.org/docs/tools/near-cli#4b-near-generate-key-accountid---seedphraseyour-seed-phrase

  1. Generate a new seed phrase (e.g. by trying to create an account here https://wallet.testnet.near.org but not following through).

    Any way of generating random seed phrase / password with enough entropy works (e.g. you can use pwgen 64 on Mac).

    Make sure it's 12 words on one line separated by spaces, such as other awake horn height much pipe radio scene cabbage mountain visual captain. You can use a BIP39 phrase generator online since NEAR protocol uses BIP39 seed phrases.

  2. Generate a public key from that seed phrase by running:

    near generate-key example-acct.near --seedPhrase "<your seed phrase>"

    This will produce a response like:

    Key pair with ed25519:GkMNfc92fwM1AmwH1MTjF4b7UZuceamsq96XPkHsQ9vi public key for an account "example-acct.near"

  3. Associate that public key with your account by running:

    NEAR_ENV=mainnet near add-key <your-account-id> <public-key-from-last-step>

  4. Visit https://wallet.near.org/recover-seed-phrase and paste the seed phrase you generated in Step 1. This will log you into that account.

A product manager for NEAR Wallet confirmed on 2022-01-13 that the Wallet does not support subaccounts. So the above steps likely will not work for a subaccount.