emulator.emulator
Home > @blaze-cardano/emulator > Emulator
Emulator class
The Emulator class is used to simulate the behavior of a ledger. It maintains a ledger of unspent transaction outputs, reward accounts, protocol parameters, and a clock. It also provides methods to start and stop an event loop for the ledger.
Signature:
export declare class Emulator 
Constructors
| Constructor | Modifiers | Description | 
|---|---|---|
| (constructor)(genesisOutputs, params, { evaluator, slotConfig }) | Constructs a new instance of the Emulator class. Initializes the ledger with the provided genesis outputs and parameters. | 
Properties
| Property | Modifiers | Type | Description | 
|---|---|---|---|
| Map<RewardAccount, bigint> | The map of reward accounts and their balances. | ||
| The clock of the ledger. | |||
| Record<DatumHash, PlutusData> | A lookup table of hashes to datums. | ||
| Evaluator | The script evaluator for the emulator | ||
| NodeJS.Timeout | (Optional) The event loop for the ledger. | ||
| Map<string, Wallet> | A map from label to blaze instance for that wallet | ||
| ProtocolParameters | The protocol parameters of the ledger. | 
Methods
| Method | Modifiers | Description | 
|---|---|---|
| Adds a given UTxO to the Emulator's ledger. Overwrites any existing UTxO with the same input. | ||
| Retrieves an output from the ledger by input. | ||
| Removes a given UTxO from the Emulator's ledger by input. | ||
| Starts the event loop for the ledger. If the event loop is already running, it is cleared and restarted. The event loop calls the stepForwardBlock method every 20 slots. | ||
| Stops the event loop for the ledger. If the event loop is running, it is cleared. | ||
| Submits a transaction to the ledger. | ||
| Retrieves the Emulator's ledger as an array of UTxOs. |