Class SupraAccount

Class for creating and managing Aptos account

Constructors

  • Creates new account instance. Constructor allows passing in an address, to handle account key rotation, where auth_key != public_key

    Parameters

    • Optional privateKeyBytes: Uint8Array

      Private key from which account key pair will be generated. If not specified, new key pair is going to be created.

    • Optional address: MaybeHexString

      Account address (e.g. 0xe8012714cd17606cee7188a2a365eef3fe760be598750678c8c5954eb548a591). If not specified, a new one will be generated from public key

    Returns SupraAccount

Properties

accountAddress: any

Address associated with the given account

signingKey: SignKeyPair

A private key and public key, associated with the given account

Methods

  • This is the key by which Aptos account is referenced. It is the 32-byte of the SHA-3 256 cryptographic hash of the public key(s) concatenated with a signature scheme identifier byte

    Returns HexString

    Address associated with the given account

  • This key is generated with Ed25519 scheme. Public key is used to check a signature of transaction, signed by given account

    Returns HexString

    The public key for the associated account

  • Signs specified buffer with account's private key

    Parameters

    • buffer: Uint8Array

      A buffer to sign

    Returns HexString

    A signature HexString

  • Signs specified hexString with account's private key

    Parameters

    • hexString: MaybeHexString

      A regular string or HexString to sign

    Returns HexString

    A signature HexString

  • Derives account address, public key and private key

    Returns AptosAccountObject

    AptosAccountObject instance.

    Example: An example of the returned AptosAccountObject object

    {
    address: "0xe8012714cd17606cee7188a2a365eef3fe760be598750678c8c5954eb548a591",
    publicKeyHex: "0xf56d8524faf79fbc0f48c13aeed3b0ce5dd376b4db93b8130a107c0a5e04ba04",
    privateKeyHex: `0x009c9f7c992a06cfafe916f125d8adb7a395fca243e264a8e56a4b3e6accf940
    d2b11e9ece3049ce60e3c7b4a1c58aebfa9298e29a30a58a67f1998646135204`
    }
  • Verifies the signature of the message with the public key of the account

    Parameters

    • message: MaybeHexString

      a signed message

    • signature: MaybeHexString

      the signature of the message

    Returns boolean

  • Parameters

    • obj: AptosAccountObject

    Returns SupraAccount

  • Creates new account with bip44 path and mnemonics,

    Parameters

    • path: string
    • mnemonics: string

    Returns SupraAccount

    AptosAccount

  • Takes creator address and collection name and returns the collection id hash. Collection id hash are generated as sha256 hash of (creator_address::collection_name)

    Parameters

    • creatorAddress: MaybeHexString

      Collection creator address

    • collectionName: string

      The collection name

    Returns HexString

    The collection id hash

  • Takes source address and seeds and returns the resource account address

    Parameters

    • sourceAddress: MaybeHexString

      Address used to derive the resource account

    • seed: Uint8Array

      The seed bytes

    Returns HexString

    The resource account address

  • Check's if the derive path is valid

    Parameters

    • path: string

    Returns boolean