@ledgerhq/live-common
Version:
Common ground for the Ledger Live apps
34 lines • 1.29 kB
JavaScript
import { getSendDescriptor } from "../../bridge/descriptor/registry";
import { sendFeatures } from "../../bridge/descriptor/send/features";
export const DEFAULT_SEND_UI_CONFIG = {
hasMemo: false,
memoType: undefined,
memoMaxLength: undefined,
memoMaxValue: undefined,
memoOptions: undefined,
recipientSupportsDomain: false,
hasFeePresets: false,
hasCustomFees: false,
hasCoinControl: false,
};
export function getSendUiConfig(currency) {
if (!currency)
return DEFAULT_SEND_UI_CONFIG;
const descriptor = getSendDescriptor(currency);
if (!descriptor) {
return DEFAULT_SEND_UI_CONFIG;
}
const memoDescriptor = descriptor.inputs.memo;
return {
hasMemo: sendFeatures.hasMemo(currency),
memoType: memoDescriptor?.type,
memoMaxLength: sendFeatures.getMemoMaxLength(currency),
memoMaxValue: sendFeatures.getMemoMaxValue(currency),
memoOptions: sendFeatures.getMemoOptions(currency),
recipientSupportsDomain: sendFeatures.supportsDomain(currency),
hasFeePresets: sendFeatures.hasFeePresets(currency),
hasCustomFees: sendFeatures.hasCustomFees(currency),
hasCoinControl: sendFeatures.hasCoinControl(currency),
};
}
//# sourceMappingURL=uiConfig.js.map