Testing and health checks
Test the app in a real iframe against the HydraOne web client. The SDK ships a health check to verify the bridge.
Diagnostics
checkBridgeHealth(clientOrTransport, options) from @hydraone-sdk/core runs three checks and returns a BridgeHealthReport:
| Check id | Verifies |
|---|---|
iframe-sandbox | The page is in an iframe with the sandbox permissions it needs. |
postmessage-latency | A ping round trip works and is fast enough (warns above warningThresholdMs, default 150 ms; fails after timeoutMs, default 3000 ms). |
storage-local and storage-relay | localStorage and the host relay are readable and writable. |
Each check has a status of PASS, WARN or FAIL, a message, and a hint when something needs fixing. report.status is FAIL if any check failed, WARN if any warned, otherwise PASS. Skip checks with skipSandboxCheck, skipLatencyCheck, skipStorageCheck. The storage checks write a temporary key and restore it afterwards; set testKey to choose the key and storage to test a specific IStorage adapter. Without storage, the relay check builds a HostStorageRelayAdapter on the client's transport. Outside an iframe the iframe and latency checks report WARN, not FAIL. client.checkHealth(options) runs the same report.
import { WalletBridgeClient, checkBridgeHealth } from '@hydraone-sdk/core';
const client = new WalletBridgeClient({
hostOrigin: 'https://alpha.hydraone.app',
});
await client.init(); // the latency check fails with ERR_BRIDGE_NOT_CONNECTED before the handshake
const report = await checkBridgeHealth(client, { warningThresholdMs: 200, skipStorageCheck: true });
console.log(report.status, report.summary);
Before you submit an app
- Run the app in a real iframe inside the HydraOne web client.
- Open it in Safari and confirm a reload keeps the user's saved data (see Safari ITP and host storage).
- Reject a signature in the wallet and confirm the UI recovers from the cancelled request.
- Run
checkBridgeHealthagainst the real host and fix everyFAIL.
Next steps
- Publish your app to register in the Developer Portal and submit a release.
