๐Ÿ“„ src/web3/vue/composables/useBootstrap.ts
D-OPEN SOVEREIGN

Documentation & Insights

Reads the BootstrapResult provided at app root (via `app.provide(BootstrapResultKey, result)`
after `bootstrapWebSDK()` resolves). Replaces DCODEReady / manual prop-drilling of
chain + connector data (spec ยง13.1 / ยง13.4 D7).
1import { inject, type InjectionKey } from 'vue';
2import type { BootstrapResult } from '../bootstrap';
3
4export const BootstrapResultKey: InjectionKey<BootstrapResult> = Symbol('web3-sdk:bootstrap-result');
5
6/**
7 * Reads the BootstrapResult provided at app root (via `app.provide(BootstrapResultKey, result)`
8 * after `bootstrapWebSDK()` resolves). Replaces DCODEReady / manual prop-drilling of
9 * chain + connector data (spec ยง13.1 / ยง13.4 D7).
10 */
11export function useBootstrap(): BootstrapResult {
12  const result = inject(BootstrapResultKey);
13  if (!result) {
14    throw new Error(
15      '[useBootstrap] BootstrapResult not provided โ€” call app.provide(BootstrapResultKey, await bootstrapWebSDK()) at the app root before using useBootstrap()'
16    );
17  }
18  return result;
19}
20