@coinbase/cdp-sdk
Version:
SDK for interacting with the Coinbase Developer Platform Wallet API
37 lines • 1.32 kB
JavaScript
// This file was auto-generated by Fern from our API Definition.
import { BearerAuthProvider } from "./auth/BearerAuthProvider.js";
import * as core from "./core/index.js";
export function normalizeClientOptions(options) {
return {
...options,
logging: core.logging.createLogger(options?.logging),
};
}
export function normalizeClientOptionsWithAuth(options) {
const normalized = normalizeClientOptions(options);
if (options.auth === false) {
normalized.authProvider = new core.NoOpAuthProvider();
return normalized;
}
if (options.auth != null) {
if (typeof options.auth === "function") {
normalized.authProvider = { getAuthRequest: options.auth };
return normalized;
}
if (core.isAuthProvider(options.auth)) {
normalized.authProvider = options.auth;
return normalized;
}
Object.assign(normalized, options.auth);
}
const normalizedWithNoOpAuthProvider = withNoOpAuthProvider(normalized);
normalized.authProvider ??= new BearerAuthProvider(normalizedWithNoOpAuthProvider);
return normalized;
}
function withNoOpAuthProvider(options) {
return {
...options,
authProvider: new core.NoOpAuthProvider(),
};
}
//# sourceMappingURL=BaseClient.js.map