@ledgerhq/coin-stellar
Version:
Ledger Stellar Coin integration
32 lines • 1.13 kB
JavaScript
// SPDX-FileCopyrightText: © 2026 LEDGER SAS
// SPDX-License-Identifier: Apache-2.0
import { StrKey } from '@stellar/stellar-sdk';
import { fetchSigners } from '../network';
export const STELLAR_BURN_ADDRESS = 'GAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAWHF';
export async function isAccountMultiSign(account) {
const signers = await 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
*/
export function isAddressValid(address) {
if (!address)
return false;
// FIXME Workaround for burn address, see https://ledgerhq.atlassian.net/browse/LIVE-4014
if (address === STELLAR_BURN_ADDRESS)
return false;
try {
return StrKey.isValidEd25519PublicKey(address) || StrKey.isValidMed25519PublicKey(address);
}
catch {
return false;
}
}
/** Compile-time exhaustiveness helper: call when a value should be `never`. */
export function assertUnreachable(_) {
throw new Error('unreachable assertion failed');
}
//# sourceMappingURL=utils.js.map