@base-org/account
Version: 
Base Account SDK
30 lines • 942 B
JavaScript
/**
 * Validates user supplied preferences. Throws if keys are not valid.
 * @param preference
 */
export function validatePreferences(preference) {
    if (!preference) {
        return;
    }
    if (preference.attribution) {
        if (preference.attribution.auto !== undefined &&
            preference.attribution.dataSuffix !== undefined) {
            throw new Error(`Attribution cannot contain both auto and dataSuffix properties`);
        }
    }
    if (preference.telemetry) {
        if (typeof preference.telemetry !== 'boolean') {
            throw new Error(`Telemetry must be a boolean`);
        }
    }
}
/**
 * Validates user supplied toSubAccountSigner function. Throws if keys are not valid.
 * @param toAccount
 */
export function validateSubAccount(toAccount) {
    if (typeof toAccount !== 'function') {
        throw new Error(`toAccount is not a function`);
    }
}
//# sourceMappingURL=validatePreferences.js.map