Libticketto
    Preparing search index...

    Module @ticketto/web-stub

    Libticketto: Stub Web

    This library implements The Ticketto Protocol, based on an in-memory (design goal, use dedicated storage, like the IndexedDB API).

    First, make sure your client supports IndexedDB.

    Then, before starting the application (at the entrypoint), import reflect-metadata:

    import 'reflect-metadata';
    
    1. Define the configuration. Consider that your stub AccountProvider must return the actual AccountId associated to the account logged-in on your application. Also, the signer must receive a Uint8Array, and return a Promise<Uint8Array> that contains the signed transaction. For local testing purposes, we can use this demo:
    // src/config.ts
    import { ClientConfig } from '@ticketto/protocol';

    export const defaultConfig: ClientConfig<Uint8Array> = {
    accountProvider: {
    getAccountId: () => "5DD8bv4RnTDuJt47SAjpWMT78N7gfBQNF2YiZpVUgbXkizMG",
    sign: (payload: Uint8Array) => Promise.resolve(payload),
    },
    };
    1. Initialize the ticketto client, passing the TickettoWebStubConsumer as well as the config.
    // src/index.ts
    import { TickettoClientBuilder } from '@ticketto/protocol';
    import { TickettoWebStubConsumer } from '@ticketto/web-stub';
    import { defaultConfig } from './config.ts'

    const client = await new TickettoClientBuilder()
    .withConsumer(TickettoWebStubConsumer)
    .withConfig(defaultConfig)
    .build();
    1. Enjoy!
    // Example of the client validating and submitting the contents of an attendance QR (let's call it `input`).

    /** In our example, the QR payload is a base-64 encoded input representing the call */
    const qr = await readQrCode();
    const input: Uint8Array = fromBase64();

    await client.tickets.calls.submitAttendanceCall(input);

    Classes

    TickettoWebStubConsumer