Angular example
The library is a plain async function with no framework dependency. A
binding owns three things: the wallets the component renders (from
wallets()), the one call, and its state. This page's
injectable service is all of it; the React
example is the same as a hook.
The whole binding
@Injectable({ providedIn: "root" })
export class CheckinService {
readonly wallets = signal<Wallet[]>([]);
readonly status = signal<Status>("idle");
readonly response = signal<CheckinResponse | undefined>(undefined);
readonly error = signal<string | undefined>(undefined);
// the wallets to offer in this browser
async configure(options: WalletsOptions) {
this.wallets.set(await wallets(options));
}
// call from the click handler: a web wallet's tab opens inside the click
async request(input: CheckinRequestInput, wallet: Wallet) {
const running = wallet.start(input);
this.status.set("waiting");
const result = await running;
this.status.set(result.status);
if (result.status === "completed") this.response.set(result.response);
if (result.status === "failed") this.error.set(result.error.message);
}
}
// …and the component renders one button per wallet
@for (w of checkin.wallets(); track w.id) {
<button class="smart-btn" (click)="start(w)">{{ w.name }}</button>
}
Compiled in the browser (JIT) so this page needs no Angular build step — which is why the bundle is large. A real app compiles ahead of time and ships only its own code plus this library.