Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Account

If you are familiar with Ethereum, you will find that Muta's account system is similar to Ethereum. Simply put, Muta's account is also secured by ECDSA cryptography. A private key corresponds to a Muta account. We can use the private key to create an account like this new Account('0x...'). Generally used for signTransaction

Here is an example:

import { Account } from '@mutadev/account';
import { Client } from '@mutadev/client';

async function example() {
  const client = new Client();
  const account = new Account('0x...'); // private key

  // create an UDT
  const rawTransaction = await client.composeTransaction({
    serviceName: 'asset',
    method: 'create_asset',
    payload: {
      name: 'MyToken',
      symbol: 'MT',
      supply: 100_000_000,
    }
  });

  const signedTransaction = account.signTransaction(rawTransaction);
  client.sendTransaction(signedTransaction);
}

Hierarchy

  • Account

Index

Constructors

constructor

Properties

Private #privateKey

#privateKey: Buffer

Accessors

Private _address

Private _publicKey

  • get _publicKey(): Buffer

address

  • get address(): string

publicKey

  • get publicKey(): string

Methods

signTransaction

Static fromPrivateKey

  • fromPrivateKey(privateKey: string): Account

Generated using TypeDoc