Class MobileConnection

Manages persistence of the mobile wallet connection across page navigations.

Since mobile wallet interaction happens via deep links with redirects, the wallet instance doesn't survive page transitions. This class provides a simple API to persist and retrieve the public key returned from the connect callback.

All methods return Promises, so both sync and async storage backends are supported transparently.

// On the callback page after connect:
const data = MobileWallet.parseConnectCallback();
await MobileConnection.save(data);

// Later, anywhere in the app:
if (await MobileConnection.isConnected()) {
const publicKey = await MobileConnection.getPublicKey();
// use publicKey for transactions...
}

// To disconnect:
await MobileConnection.disconnect();
// Using custom async storage (e.g. for React Native):
MobileConnection.useStorage(AsyncStorage);
await MobileConnection.save(data);

Constructors

Methods