Algorand TypeScript
    Preparing search index...

    Function emit

    • 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

      Type Parameters

      • TEvent extends Record<string, any>

      Parameters

      • event: TEvent

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

      Returns void

      class Demo extends Struct<{ a: UintN64 }> {}
      emit(new Demo({ a: new UintN64(123) }))
      type Demo = { a: uint64 }
      emit<Demo>({a: 123})
      // or
      const d: Demo = { a: 123 }
      emit(d)
    • 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.

      Type Parameters

      • TProps extends any[]

      Parameters

      • eventName: string

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

      • ...eventProps: TProps

        A set of event properties (order is significant)

      Returns void

      emit("Demo", new UintN64(123))
      
      const a: uint64 = 123
      emit("Demo", a)