-
Originally from Stack Overflow. I am trying to create a token collection using the Aptos Typescript SDK.
But I get the following error:
What am I doing wrong? Tried replicating the Aptos official example but instead of creating a new account, I want to use an existing funded account. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Let's say you have a private key as a string, you can do it like this: // Create a private key instance for the Ed25519 scheme.
const privateKey = new Ed25519PrivateKey("0xdcaf65ead38f7cf0eb4f81961f8fc7f9b7f1e2f45e2d4a6da0dbef85f46f6057");
// Or for the Secp256k1 scheme
const privateKey = new Secp256k1PrivateKey("0xdcaf65ead38f7cf0eb4f81961f8fc7f9b7f1e2f45e2d4a6da0dbef85f46f6057");
// Create the account. Note, this only works for accounts that haven't had their authentication key rotated.
const account = await Account.fromPrivateKey({ privateKey }); If you aren't sure which scheme it is, you can use the following code:
Note, this makes network calls to figure out the scheme, so the previous code is preferred. |
Beta Was this translation helpful? Give feedback.
Let's say you have a private key as a string, you can do it like this:
If you aren't sure which scheme it is, you can use the following code: