{"id":41464117,"url":"https://github.com/coinbase-samples/core-dotnet","last_synced_at":"2026-01-23T16:18:03.691Z","repository":{"id":253014709,"uuid":"829139755","full_name":"coinbase-samples/core-dotnet","owner":"coinbase-samples","description":"Coinbase .Net Core is a library that is used by other Java samples","archived":false,"fork":false,"pushed_at":"2025-11-22T00:33:23.000Z","size":82,"stargazers_count":8,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-11-22T02:26:21.432Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://www.nuget.org/packages/CoinbaseSdk.Core","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coinbase-samples.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-07-15T20:57:06.000Z","updated_at":"2025-06-20T01:30:49.000Z","dependencies_parsed_at":"2024-08-14T00:53:15.287Z","dependency_job_id":"50a0497e-d6fd-48b3-8062-d6dc7476bf70","html_url":"https://github.com/coinbase-samples/core-dotnet","commit_stats":null,"previous_names":["coinbase-samples/core-dotnet"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/coinbase-samples/core-dotnet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coinbase-samples%2Fcore-dotnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coinbase-samples%2Fcore-dotnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coinbase-samples%2Fcore-dotnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coinbase-samples%2Fcore-dotnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coinbase-samples","download_url":"https://codeload.github.com/coinbase-samples/core-dotnet/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coinbase-samples%2Fcore-dotnet/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28695529,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T15:57:05.722Z","status":"ssl_error","status_checked_at":"2026-01-23T15:56:27.656Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-01-23T16:17:59.073Z","updated_at":"2026-01-23T16:18:03.672Z","avatar_url":"https://github.com/coinbase-samples.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Coinbase .NET Core Library\n\n## Overview\n\nThe **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.\n\nThis library is primarily intended for internal use by Coinbase SDKs but is also available for advanced users building custom integrations requiring a standardized base.\n\n## Key Features\n\n*   **Base Client Architecture**: Abstract `CoinbaseClient` managing request lifecycles with extensible hooks (`BuildRequest`, `ConfigureRequest`, `ValidateResponse`).\n*   **Resilient HTTP Communication**: Wrapper around `System.Net.Http.HttpClient` with built-in Polly retry policies for transient failure handling.\n*   **Robust Serialization**: `JsonUtility` wrapper around `System.Text.Json` featuring:\n    *   `NullOnUnknownEnumConverter`: Graceful handling of new/unknown enum members.\n    *   `UtcIso8601DateTimeOffsetConverter`: Standardized ISO-8601 date/time processing.\n    *   Thread-safe initialization using `Lazy\u003cT\u003e`.\n*   **Centralized Configuration**: `HttpClientDefaults` and `RetryPolicyDefaults` ensuring consistent default behavior across SDKs.\n*   **Standardized Error Handling**: Hierarchy of exceptions (`CoinbaseException`, `CoinbaseClientException`) for uniform error reporting.\n\n## HTTP Client \u0026 Retries\n\nThe 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.\n\nRetries can be configured at two levels:\n\n1.  **Per-Client**: Set default behavior for all requests made by a client instance.\n2.  **Per-Request**: Override behavior for a specific API call.\n\n### Configuration Examples\n\n**Per-Request Configuration:**\n\n```csharp\nvar callOptions = new CallOptions\n{\n    MaxRetries = 2,\n    ShouldRetryOnStatusCodes = true,\n    RetryableStatusCodes = new HashSet\u003cHttpStatusCode\u003e { HttpStatusCode.TooManyRequests }\n};\n\n// options are passed to the SendRequestAsync method\nvar response = await client.SendRequestAsync\u003cMyResponse\u003e(..., callOptions);\n```\n\n**Per-Client Configuration:**\n\n```csharp\nvar httpClient = new SystemNetHttpClient(\n    defaultCallOptions: new CallOptions\n    {\n        MaxRetries = 3,\n        ShouldRetryOnStatusCodes = true,\n        RetryableStatusCodes = new HashSet\u003cHttpStatusCode\u003e { HttpStatusCode.TooManyRequests }\n    });\n\nvar client = new MyCoinbaseClient(credentials, httpClient: httpClient);\n```\n\n### Retry Configuration Options\n\n| Option | Default | Description |\n| --- | --- | --- |\n| `MaxRetries` | `0` | Maximum number of retry attempts (0 disables retries). |\n| `MedianFirstRetryDelay` | 500ms | Target median delay for the first retry (subject to jitter). |\n| `MaxRetryDelay` | 1s | Maximum delay cap for any retry attempt. |\n| `ShouldRetryOnStatusCodes` | `false` | Whether to retry on specific HTTP status codes. |\n| `RetryableStatusCodes` | empty | Set of status codes to retry (e.g., 429, 503). |\n\n\u003e **Note:** Retry attempts honor the `CancellationToken` provided to the request. If canceled, pending retries are aborted.\n\n## Installation\n\n```bash\ndotnet add package CoinbaseSdk.Core\n```\n\n## License\n\nThis project is licensed under the [Apache License, Version 2.0](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoinbase-samples%2Fcore-dotnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoinbase-samples%2Fcore-dotnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoinbase-samples%2Fcore-dotnet/lists"}