// Generated by uniffi-bindgen-react-native
import installer from './NativeReactNativeFedimintClient';

// Register the rust crate with Hermes
// - the boolean flag ensures this loads exactly once, even if the JS
//   code is reloaded (e.g. during development with metro).
let rustInstalled = false;
if (!rustInstalled) {
  installer.installRustCrate();
  rustInstalled = true;
}

// Export the generated bindings to the app.
export * from './generated/fedimint_client_uniffi';

// Now import the bindings so we can:
// - intialize them
// - export them as namespaced objects as the default export.
import * as fedimint_client_uniffi from './generated/fedimint_client_uniffi';

// Initialize the generated bindings: mostly checksums, but also callbacks.
// - the boolean flag ensures this loads exactly once, even if the JS code
//   is reloaded (e.g. during development with metro).
let initialized = false;
if (!initialized) {
  fedimint_client_uniffi.default.initialize();
  initialized = true;
}

// This provides parity with the index.web.ts version of this file.
// The web version relies on an asynchronous fetch, which this doesn't
// need, so we just no-op.
export async function uniffiInitAsync() {
  // NOOP.
}

// Export the crates as individually namespaced objects.
export default {
  fedimint_client_uniffi,
};

