CoinbaseSdk.Core 0.1.0

dotnet add package CoinbaseSdk.Core --version 0.1.0
                    
NuGet\Install-Package CoinbaseSdk.Core -Version 0.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CoinbaseSdk.Core" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CoinbaseSdk.Core" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="CoinbaseSdk.Core" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CoinbaseSdk.Core --version 0.1.0
                    
#r "nuget: CoinbaseSdk.Core, 0.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CoinbaseSdk.Core@0.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CoinbaseSdk.Core&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=CoinbaseSdk.Core&version=0.1.0
                    
Install as a Cake Tool

Coinbase .NET Core Library

Overview

The Coinbase .NET Core Library (CoinbaseSdk.Core) is the foundational building block for Coinbase .NET SDKs. It provides a standardized, robust, and thread-safe infrastructure for building API clients, handling authentication, HTTP communication, and serialization.

This library is primarily intended for internal use by Coinbase SDKs but is also available for advanced users building custom integrations requiring a standardized base.

Key Features

  • Base Client Architecture: Abstract CoinbaseClient managing request lifecycles with extensible hooks (BuildRequest, ConfigureRequest, ValidateResponse).
  • Resilient HTTP Communication: Wrapper around System.Net.Http.HttpClient with built-in Polly retry policies for transient failure handling.
  • Robust Serialization: JsonUtility wrapper around System.Text.Json featuring:
    • NullOnUnknownEnumConverter: Graceful handling of new/unknown enum members.
    • UtcIso8601DateTimeOffsetConverter: Standardized ISO-8601 date/time processing.
    • Thread-safe initialization using Lazy<T>.
  • Centralized Configuration: HttpClientDefaults and RetryPolicyDefaults ensuring consistent default behavior across SDKs.
  • Standardized Error Handling: Hierarchy of exceptions (CoinbaseException, CoinbaseClientException) for uniform error reporting.

HTTP Client & Retries

The library uses SystemNetHttpClient to execute requests. By default, it performs a single attempt. You can enable retries using CallOptions, which leverages Polly's decorrelated jitter backoff strategy to handle transient failures (like rate limits or 5xx errors) without causing retry storms.

Retries can be configured at two levels:

  1. Per-Client: Set default behavior for all requests made by a client instance.
  2. Per-Request: Override behavior for a specific API call.

Configuration Examples

Per-Request Configuration:

var callOptions = new CallOptions
{
    MaxRetries = 2,
    ShouldRetryOnStatusCodes = true,
    RetryableStatusCodes = new HashSet<HttpStatusCode> { HttpStatusCode.TooManyRequests }
};

// options are passed to the SendRequestAsync method
var response = await client.SendRequestAsync<MyResponse>(..., callOptions);

Per-Client Configuration:

var httpClient = new SystemNetHttpClient(
    defaultCallOptions: new CallOptions
    {
        MaxRetries = 3,
        ShouldRetryOnStatusCodes = true,
        RetryableStatusCodes = new HashSet<HttpStatusCode> { HttpStatusCode.TooManyRequests }
    });

var client = new MyCoinbaseClient(credentials, httpClient: httpClient);

Retry Configuration Options

Option Default Description
MaxRetries 0 Maximum number of retry attempts (0 disables retries).
MedianFirstRetryDelay 500ms Target median delay for the first retry (subject to jitter).
MaxRetryDelay 1s Maximum delay cap for any retry attempt.
ShouldRetryOnStatusCodes false Whether to retry on specific HTTP status codes.
RetryableStatusCodes empty Set of status codes to retry (e.g., 429, 503).

Note: Retry attempts honor the CancellationToken provided to the request. If canceled, pending retries are aborted.

Installation

dotnet add package CoinbaseSdk.Core

License

This project is licensed under the Apache License, Version 2.0.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on CoinbaseSdk.Core:

Package Downloads
CoinbaseSdk.Prime

Coinbase Prime .NET SDK

CoinbaseSdk.Intx

Coinbase INTX .NET SDK

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0 395 12/10/2025
0.0.1 2,288 8/13/2024