Create Supra Accounts

How to create new and import existing accounts.

SupraAccount class constructor

new SupraAccount();
new SupraAccount(Buffer.from("YOUR_PRIVATE_KEY","hex"));

Create a new supra account or create one from the provided private key. If no privateKeyBytes parameter is provided, a new account will be generated.

Parameters

Name
Type
Optional

privateKeyBytes

Uint8Array

address

MaybeHexString

Returns SupraAccount


Create a new SupraAccount from mnemonic.

SupraAccount.fromDerivePath(path, mnemonic);

Parameters

Name
Type
Optional

path

string

mnemonics

string

Returns SupraAccount


Example

The SupraAccount class allows you to generate new accounts, import private key, or derive from mnemonics.

1

Initialize a new project

2

Install Supra's TypeScript SDK

3

Create supra_account_example.ts and import dependencies

4

Generate a new account

5

Generate an account from private key

6

Generate an account from mnemonics

7

Complete code

8

Execute code npx ts-node supra_account_example.ts