UNPKG

@ledgerhq/coin-stellar

Version:
38 lines 1.42 kB
"use strict"; // SPDX-FileCopyrightText: © 2026 LEDGER SAS // SPDX-License-Identifier: Apache-2.0 Object.defineProperty(exports, "__esModule", { value: true }); exports.STELLAR_BURN_ADDRESS = void 0; exports.isAccountMultiSign = isAccountMultiSign; exports.isAddressValid = isAddressValid; exports.assertUnreachable = assertUnreachable; const stellar_sdk_1 = require("@stellar/stellar-sdk"); const network_1 = require("../network"); exports.STELLAR_BURN_ADDRESS = 'GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF'; async function isAccountMultiSign(account) { const signers = await (0, network_1.fetchSigners)(account); return signers.length > 1; } /** * Returns true if address is valid, false if it's invalid (can't parse or wrong checksum) * * @param {*} address */ function isAddressValid(address) { if (!address) return false; // FIXME Workaround for burn address, see https://ledgerhq.atlassian.net/browse/LIVE-4014 if (address === exports.STELLAR_BURN_ADDRESS) return false; try { return stellar_sdk_1.StrKey.isValidEd25519PublicKey(address) || stellar_sdk_1.StrKey.isValidMed25519PublicKey(address); } catch { return false; } } /** Compile-time exhaustiveness helper: call when a value should be `never`. */ function assertUnreachable(_) { throw new Error('unreachable assertion failed'); } //# sourceMappingURL=utils.js.map