Emulator
export interface Emulator {
blocks: EmulatorTx[][]
createUtxo(
wallet: SimpleWallet,
lovelace: bigint,
assets?: Assets
): TxOutputId
createWallet(
lovelace?: bigint,
assets?: Assets
): SimpleWallet
currentSlot: number
dump(): void
genesis: EmulatorGenesisTx[]
getUtxo(id: TxOutputId): Promise<TxInput>
getUtxos(addr: Address): Promise<TxInput[]>
hasUtxo(utxoId: TxOutputId): Promise<boolean>
isConsumed(utxo: TxInput): boolean
isMainnet(): boolean
mempool: EmulatorTx[]
now: number
parameters: Promise<NetworkParams>
parametersSync: NetworkParams
submitTx(tx: Tx): Promise<TxId>
tick(nSlots: IntLike): void
txIds: TxId[]
}
A simple emulated Network.
This can be used to do integration tests of whole dApps.
Staking is not yet supported.
Properties
blocks
blocks: EmulatorTx[][]
createUtxo
createUtxo(
wallet: SimpleWallet,
lovelace: bigint,
assets?: Assets
): TxOutputId
Creates a UTxO using a GenesisTx.
createWallet
createWallet(
lovelace?: bigint,
assets?: Assets
): SimpleWallet
Creates a new SimpleWallet and populates it with a given lovelace quantity and assets.
Special genesis transactions are added to the emulated chain in order to create these assets.
currentSlot
currentSlot: number
dump
dump(): void
genesis
genesis: EmulatorGenesisTx[]
getUtxo
getUtxo(id: TxOutputId): Promise<TxInput>
Throws an error if the UTxO isn't found
getUtxos
getUtxos(addr: Address): Promise<TxInput[]>
hasUtxo
hasUtxo(utxoId: TxOutputId): Promise<boolean>
true if the utxo is in the known set
isConsumed
isConsumed(utxo: TxInput): boolean
isMainnet
isMainnet(): boolean
mempool
mempool: EmulatorTx[]
now
now: number
parameters
parameters: Promise<NetworkParams>
parametersSync
parametersSync: NetworkParams
submitTx
submitTx(tx: Tx): Promise<TxId>
tick
tick(nSlots: IntLike): void
txIds
txIds: TxId[]
Ignores the genesis txs