Skip to content

emit

Algorand TypeScript


Algorand TypeScript / index / emit

emit<TEvent>(event): void

Defined in: arc-28.ts:22

Emit an arc28 event log using either an ARC4Struct type or a named object type. Object types must have an ARC4 equivalent type.

Anonymous types cannot be used as the type name is used to determine the event prefix

TEvent extends Record<string, any>

TEvent

An ARC4Struct instance, or a plain object with a named type

void

class Demo extends Struct<{ a: Uint64 }> {}
emit(new Demo({ a: new Uint64(123) }));
type Demo = { a: uint64 };
emit<Demo>({ a: 123 });
// or
const d: Demo = { a: 123 };
emit(d);

emit<TProps>(eventName, …eventProps): void

Defined in: arc-28.ts:36

Emit an arc28 event log using an explicit name and inferred property/field types. Property types must be ARC4 or have an ARC4 equivalent type.

TProps extends any[]

string

The name of the event (must be a compile time constant)

TProps

A set of event properties (order is significant)

void

emit('Demo', new Uint64(123));
const a: uint64 = 123;
emit('Demo', a);