{"id":41464100,"url":"https://github.com/coinbase-samples/prime-sdk-java","last_synced_at":"2026-04-28T22:01:34.352Z","repository":{"id":244824004,"uuid":"740656024","full_name":"coinbase-samples/prime-sdk-java","owner":"coinbase-samples","description":"Sample Java SDK for the Coinbase Prime REST APIs","archived":false,"fork":false,"pushed_at":"2026-04-22T01:57:37.000Z","size":1545,"stargazers_count":14,"open_issues_count":4,"forks_count":9,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-04-22T03:37:10.114Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://docs.cdp.coinbase.com/prime/reference/","language":"Java","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-01-08T19:44:37.000Z","updated_at":"2026-03-25T01:36:56.000Z","dependencies_parsed_at":"2025-02-20T00:25:19.634Z","dependency_job_id":"5660a30e-767f-49f5-b2e9-a6bf499fccbd","html_url":"https://github.com/coinbase-samples/prime-sdk-java","commit_stats":null,"previous_names":["coinbase-samples/prime-sdk-java"],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/coinbase-samples/prime-sdk-java","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coinbase-samples%2Fprime-sdk-java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coinbase-samples%2Fprime-sdk-java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coinbase-samples%2Fprime-sdk-java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coinbase-samples%2Fprime-sdk-java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coinbase-samples","download_url":"https://codeload.github.com/coinbase-samples/prime-sdk-java/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coinbase-samples%2Fprime-sdk-java/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32400873,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T19:38:08.556Z","status":"ssl_error","status_checked_at":"2026-04-28T19:37:55.688Z","response_time":56,"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:57.861Z","updated_at":"2026-04-28T22:01:34.323Z","avatar_url":"https://github.com/coinbase-samples.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Coinbase Prime Java SDK\n\n## Overview\n\nThe *Coinbase Prime Java SDK* is a sample library that demonstrates the structure of a [Coinbase Prime](https://prime.coinbase.com/) driver for\nthe [REST APIs](https://docs.cdp.coinbase.com/prime/reference).\n\n## License\n\nThe *Coinbase Prime Java SDK* sample library is free and open source and released under the [Apache License, Version 2.0](LICENSE).\n\nThe application and code are only available for demonstration purposes.\n\n## Usage\n\nTo use the *Coinbase Prime Java SDK*, initialize the Credentials class and create a new client. The Credentials struct is JSON\nenabled. Ensure that Prime API credentials are stored in a secure manner. This client can then be used to instantiate \nCoinbase Prime Services. An example using the PortfoliosService is shown below:\n\n```java\npublic class Main {\n    public static void main(String[] args) {\n        String credsStringBlob = System.getenv(\"COINBASE_PRIME_CREDENTIALS\");\n        ObjectMapper mapper = new ObjectMapper();\n\n        try {\n            CoinbasePrimeCredentials credentials = new CoinbasePrimeCredentials(credsStringBlob);\n            CoinbasePrimeClient client = new CoinbasePrimeClient(credentials);\n\n            String portfolioId = System.getenv(\"COINBASE_PRIME_PORTFOLIO_ID\");\n\n            PortfoliosService portfoliosService = PrimeServiceFactory.createPortfoliosService(client);\n            GetPortfolioByIdResponse portfolioResponse = portfoliosService.getPortfolioById(\n                    new GetPortfolioByIdRequest.Builder()\n                            .portfolioId(portfolioId)\n                            .build());\n\n            System.out.println(mapper.writeValueAsString(portfolioResponse));\n        } catch (Exception e) {\n            e.printStackTrace(e);\n        }\n    }\n}\n```\n\nThe JSON format expected for `COINBASE_PRIME_CREDENTIALS` is:\n\n```\n{\n  \"accessKey\": \"\",\n  \"passphrase\": \"\",\n  \"signingKey\": \"\"\n}\n```\n\nFor a full example on using the SDK, see the [`Main`](src/main/java/com/coinbase/examples/Main.java) class under the com.coinbase.examples package.\n\n**Warning**: this does place a market order for a very small amount of ADA. Please ensure that you have the necessary funds in your account before running this code.\n\n## Binaries\n\nBinaries and dependency information for Maven, Gradle, Ivy and others can be found at the [Maven Central Repository](https://central.sonatype.com/search?q=g%3Acom.coinbase.prime+a%3Acoinbase-prime-sdk-java\u0026smo=true)\n\nMaven example:\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003ecom.coinbase.prime\u003c/groupId\u003e\n    \u003cartifactId\u003ecoinbase-prime-sdk-java\u003c/artifactId\u003e\n    \u003cversion\u003ex.y.z\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n## Build\n\nTo build the sample library, ensure that Java Development Kit (JDK) 11+ is installed and then run:\n\n```bash\nmvn clean install\n```\n\n## Running Examples\n\nThe SDK includes several example classes demonstrating how to use various endpoints. \n\n### Setup Environment Variables\n\nFirst, set up your credentials as environment variables:\n\n```bash\nexport COINBASE_PRIME_CREDENTIALS='{\"accessKey\":\"your-access-key\",\"passphrase\":\"your-passphrase\",\"signingKey\":\"your-signing-key\"}'\nexport COINBASE_PRIME_PORTFOLIO_ID=\"your-portfolio-id\"\n```\n\n### Option 1: Using Maven directly\n\n```bash\nmvn exec:java -Dexec.mainClass=\"com.coinbase.examples.transactions.ListPortfolioTransactions\"\n```\n\n**Note:** Make sure the environment variables are exported in your current shell session before running the examples.\n\n### Available Examples\n\n**Transactions:**\n- `com.coinbase.examples.transactions.ListPortfolioTransactions` - List portfolio transactions\n\n**Wallets:**\n- `com.coinbase.examples.wallets.ListPortfolioWallets` - List all wallets in a portfolio\n- `com.coinbase.examples.wallets.GetWallet \u003cwallet-id\u003e` - Get wallet details\n- `com.coinbase.examples.wallets.ListWalletAddresses \u003cwallet-id\u003e \u003cnetwork-id\u003e` - List addresses for a wallet\n- `com.coinbase.examples.wallets.GetWalletDepositInstructions \u003cwallet-id\u003e [deposit-type]` - Get deposit instructions (deposit-type: CRYPTO, WIRE, SEN, SWIFT, SEPA)\n\n**Other:**\n- `com.coinbase.examples.Main` - Comprehensive example with multiple API calls\n\n**Example Usage:**\n\n```bash\n# List all wallets\nmvn exec:java -Dexec.mainClass=\"com.coinbase.examples.wallets.ListPortfolioWallets\"\n\n# Get specific wallet details\nmvn exec:java -Dexec.mainClass=\"com.coinbase.examples.wallets.GetWallet\" -Dexec.args=\"wallet-id-here\"\n\n# List wallet addresses\nmvn exec:java -Dexec.mainClass=\"com.coinbase.examples.wallets.ListWalletAddresses\" -Dexec.args=\"wallet-id network-id\"\n\n# Get deposit instructions (defaults to CRYPTO)\nmvn exec:java -Dexec.mainClass=\"com.coinbase.examples.wallets.GetWalletDepositInstructions\" -Dexec.args=\"wallet-id\"\n\n# Get deposit instructions for WIRE\nmvn exec:java -Dexec.mainClass=\"com.coinbase.examples.wallets.GetWalletDepositInstructions\" -Dexec.args=\"wallet-id WIRE\"\n```\n\n## Model Generation\n\nThe SDK includes an automated model generator that creates Java domain models and enums from the OpenAPI specification. This ensures the SDK stays in sync with the Prime API specification.\n\nThe OpenAPI spec is fetched automatically from the live API (`https://api.prime.coinbase.com/v1/openapi.yaml`) during model generation and is not committed to source control.\n\n### Generate Models from Root Directory\n\nTo generate new models from the OpenAPI spec:\n\n```bash\nmvn -Pgenerate-models\n```\n\nThis command:\n- Runs in **incremental mode** (safe - only creates new models that don't exist)\n- Generates domain models in `src/main/java/com/coinbase/prime/model/`\n- Generates enums in `src/main/java/com/coinbase/prime/model/enums/`\n- Automatically applies SDK conventions (Builder patterns, license headers, etc.)\n\n### Advanced Model Generation\n\nFor more control over model generation, see the detailed documentation in [`tools/model-generator/README.md`](tools/model-generator/README.md), which covers:\n\n- Force regenerating all models (dangerous - use with caution)\n- Regenerating specific models\n- Understanding the generation pipeline\n- Troubleshooting generation issues\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoinbase-samples%2Fprime-sdk-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoinbase-samples%2Fprime-sdk-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoinbase-samples%2Fprime-sdk-java/lists"}