@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
12 lines • 667 B
JavaScript
import { WALLET_API_VERSION } from "../../wallet-api/constants";
import semver from "semver";
/** The dapp connector "v3" uses the ledger live account ID to find the correct account. Live app and dapp browser manifests require wallet API ID. */
export function deriveAccountIdForManifest(accountId, walletApiAccountId, manifest) {
const isDapp = "dapp" in manifest;
if (isDapp && manifest.apiVersion && semver.satisfies(WALLET_API_VERSION, manifest.apiVersion)) {
return accountId;
}
/** Assume dapp browser <=v2 or live app, fallback to wallet ID. */
return walletApiAccountId;
}
//# sourceMappingURL=deriveAccountIdForManifest.js.map