Function parseModuleEvent

  • Parses a token module event, decoding the details from CBOR format. If the desired outcome is to be able to handle arbitrary token events, it's recommended to use Cbor.decode instead.

    Returns

    The parsed token module event with decoded details.

    Throws

    If the event cannot be parsed as a token module event.

    Example

    try {
    const parsedEvent = parseModuleEvent(encodedEvent);
    switch (parsedEvent.type) {
    // typed details are now available, e.g.:
    case TokenOperationType.AddAllowList: console.log(parsedEvent.details.target);
    ...
    }
    } catch (error) {
    // Fall back to using Cbor.decode
    const decodedDetails = Cbor.decode(encodedEvent.details);
    switch (encodedEvent.type) {
    // do something with the decoded details
    }
    }

    Parameters

    Returns TokenModuleEvent

Generated using TypeDoc