{"id":18542733,"url":"https://github.com/coinbase/staking-client-library-ts","last_synced_at":"2025-08-06T13:29:58.190Z","repository":{"id":213321866,"uuid":"700103192","full_name":"coinbase/staking-client-library-ts","owner":"coinbase","description":"Programmatic access to Coinbase's best-in-class staking infrastructure and services. 🔵","archived":false,"fork":false,"pushed_at":"2025-03-31T18:09:16.000Z","size":365,"stargazers_count":18,"open_issues_count":3,"forks_count":5,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-31T19:24:45.427Z","etag":null,"topics":["rewards","staking"],"latest_commit_sha":null,"homepage":"https://github.com/coinbase/staking-client-library-ts","language":"TypeScript","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.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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}},"created_at":"2023-10-04T00:26:50.000Z","updated_at":"2025-01-29T12:34:26.000Z","dependencies_parsed_at":"2023-12-19T22:53:00.411Z","dependency_job_id":"682c67f9-30d8-4a6f-bdc5-3358766c4977","html_url":"https://github.com/coinbase/staking-client-library-ts","commit_stats":null,"previous_names":["coinbase/staking-client-library-ts"],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coinbase%2Fstaking-client-library-ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coinbase%2Fstaking-client-library-ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coinbase%2Fstaking-client-library-ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coinbase%2Fstaking-client-library-ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coinbase","download_url":"https://codeload.github.com/coinbase/staking-client-library-ts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248087842,"owners_count":21045598,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["rewards","staking"],"created_at":"2024-11-06T20:10:14.455Z","updated_at":"2025-04-09T18:32:00.758Z","avatar_url":"https://github.com/coinbase.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg src='docs/images/banner.svg' width='1100' alt='Coinbase Staking API'\u003e\n\n# [Coinbase Staking API](https://github.com/coinbase/staking-client-library-ts)\n\n\u003e Programmatic access to Coinbase's best-in-class staking infrastructure and services. :large_blue_circle:\n\n[![npm version](https://badge.fury.io/js/@coinbase%2Fstaking-client-library-ts.svg)](https://badge.fury.io/js/@coinbase%2Fstaking-client-library-ts) [![Current version](https://img.shields.io/github/tag/coinbase/staking-client-library-ts?color=3498DB\u0026label=version)](https://github.com/coinbase/staking-client-library-ts/releases) [![GitHub contributors](https://img.shields.io/github/contributors/coinbase/staking-client-library-ts?color=3498DB)](https://github.com/coinbase/staking-client-library-ts/graphs/contributors) [![GitHub Stars](https://img.shields.io/github/stars/coinbase/staking-client-library-ts.svg?color=3498DB)](https://github.com/coinbase/staking-client-library-ts/stargazers) [![GitHub](https://img.shields.io/github/license/coinbase/staking-client-library-ts?color=3498DB)](https://github.com/coinbase/staking-client-library-ts/blob/main/LICENSE)\n\n## Overview\n\n`staking-client-library-ts` is the Typescript SDK for the **Coinbase Staking API** :large_blue_circle:.\n\nThe Coinbase Staking API empowers developers to deliver a fully-featured staking experience in their Web2 apps, wallets, or dApps using *one common interface* across protocols.\n\nA traditional infrastructure-heavy staking integration can take months. Coinbase's Staking API enables onboarding within hours :sparkles:.\n\n## Quick Start\n\nPrerequisite: [Node 20+](https://www.npmjs.com/package/node/v/20.11.1)\n\n1. In a fresh directory, run:\n\n   ```shell\n   npm install @coinbase/staking-client-library-ts\n   ```\n\n2. Copy and paste a code sample from below or any other [example](./examples/) into an `example.ts` file.\n\n3. Create a new API Key in the [portal](https://portal.cdp.coinbase.com/access/api) and paste the API Key name and private key into the example.\n\n4. Run :rocket:\n\n   ```shell\n   npx ts-node example.ts\n   ```\n\n### Stake Partial ETH :diamond_shape_with_a_dot_inside:\n\nThis code sample helps stake partial ETH (non-multiples of 32 ETH). View the full source [here](examples/ethereum/create-workflow.ts)\n\n\u003cdetails open\u003e\n\n```typescript\n// examples/ethereum/create-workflow.ts\nimport { StakingClient } from \"@coinbase/staking-client-library-ts\";\n\n// Set your api key name and private key here. Get your keys from here: https://portal.cdp.coinbase.com/access/api\nconst apiKeyName: string = 'your-api-key-name';\nconst apiPrivateKey: string = 'your-api-private-key';\n\nconst client = new StakingClient(apiKeyName, apiPrivateKey);\n\nclient.Ethereum.stake('holesky', '0xdb816889F2a7362EF242E5a717dfD5B38Ae849FE', '123')\n  .then((workflow) =\u003e {\n    console.log(JSON.stringify(workflow, null, 2));\n  })\n  .catch(() =\u003e {\n    throw new Error('Error running stake action on ethereum');\n  });\n```\n\n\u003c/details\u003e\n\n   \u003cdetails\u003e\n     \u003csummary\u003eOutput\u003c/summary\u003e\n\n   ```text\n   {\n     \"name\": \"workflows/baecd951-838f-44ec-b7b5-20e1820c09dc\",\n     \"action\": \"protocols/ethereum_kiln/networks/holesky/actions/stake\",\n     \"ethereumKilnStakingParameters\": {\n       \"stakeParameters\": {\n         \"stakerAddress\": \"0xdb816889F2a7362EF242E5a717dfD5B38Ae849FE\",\n         \"integratorContractAddress\": \"0xA55416de5DE61A0AC1aa8970a280E04388B1dE4b\",\n         \"amount\": {\n           \"value\": \"123\",\n           \"currency\": \"ETH\"\n         }\n       }\n     },\n     \"state\": \"STATE_WAITING_FOR_EXT_BROADCAST\",\n     \"currentStepId\": 0,\n     \"steps\": [\n       {\n         \"name\": \"stake tx\",\n         \"txStepOutput\": {\n           \"unsignedTx\": \"02f3824268068502540be4008503c1b8346683061a8094a55416de5de61a0ac1aa8970a280e04388b1de4b7b843a4b66f1c0808080\",\n           \"signedTx\": \"\",\n           \"txHash\": \"\",\n           \"state\": \"STATE_PENDING_EXT_BROADCAST\",\n           \"errorMessage\": \"\"\n         }\n       }\n     ],\n     \"createTime\": \"2024-05-08T15:24:57.480231386Z\",\n     \"updateTime\": \"2024-05-08T15:24:57.480231386Z\",\n     \"completeTime\": null\n   }\n   ```\n\n   \u003c/details\u003e\n\n### Stake SOL :diamond_shape_with_a_dot_inside:\n\nThis code sample helps stake SOL from a given user wallet. View the full source [here](examples/solana/create-workflow.ts)\n\n\u003cdetails open\u003e\n\n```typescript\n// examples/solana/create-workflow.ts\nimport { StakingClient } from \"@coinbase/staking-client-library-ts\";\n\n// Set your api key name and private key here. Get your keys from here: https://portal.cdp.coinbase.com/access/api\nconst apiKeyName: string = 'your-api-key-name';\nconst apiPrivateKey: string = 'your-api-private-key';\n\nconst client = new StakingClient(apiKeyName, apiPrivateKey);\n\nclient.Solana.stake('devnet', '8rMGARtkJY5QygP1mgvBFLsE9JrvXByARJiyNfcSE5Z', '100000000')\n  .then((workflow) =\u003e {\n    console.log(JSON.stringify(workflow, null, 2));\n  })\n  .catch(() =\u003e {\n    throw new Error('Error running stake action on solana');\n  });\n```\n\n\u003c/details\u003e\n\n   \u003cdetails\u003e\n     \u003csummary\u003eOutput\u003c/summary\u003e\n\n   ```text\n   {\n     \"name\": \"workflows/2cd484db-56fe-4c8b-a53d-8039c8f27547\",\n     \"action\": \"protocols/solana/networks/devnet/actions/stake\",\n     \"solanaStakingParameters\": {\n       \"stakeParameters\": {\n         \"walletAddress\": \"8rMGARtkJY5QygP1mgvBFLsE9JrvXByARJiyNfcSE5Z\",\n         \"validatorAddress\": \"GkqYQysEGmuL6V2AJoNnWZUz2ZBGWhzQXsJiXm2CLKAN\",\n         \"amount\": {\n           \"value\": \"100000000\",\n           \"currency\": \"SOL\"\n         },\n         \"priorityFee\": {\n           \"computeUnitLimit\": \"0\",\n           \"unitPrice\": \"0\"\n         }\n       }\n     },\n     \"state\": \"STATE_WAITING_FOR_EXT_BROADCAST\",\n     \"currentStepId\": 0,\n     \"steps\": [\n       {\n         \"name\": \"stake tx\",\n         \"txStepOutput\": {\n           \"unsignedTx\": \"66hEYYWnwGWkGpMKF2H2sCzxnmoAfY8LPnYMgWdY6rC7hX2H6DEE2YdPxECFx8FeeNmea8N87L4KuZ6dirYXZi9XNr5uPJdf8W1jdShcSwzSmmqz4SA7dmFjdTM19hNEu7hMMF7C2Vcm8zka9FErt4wyshJNXYXM6cbJ8UUypGAb8g4vQDMoVavSiVFWxMGE5Sv7JL2gXkFEz2UbxvX7t6W2UbhDtt7545km4rQtFcrMTahmaoqaTMysLuoMcJpzps1c7pCigthYYcBN7yxF4zVZHJHbMXqFuap1BAb2MCYeBxk4krzGJNR3Avo6seVVthxMLHqExv8Yzrdvufn61xv6S4DGQdhbbUM2auGi5b45bkJ4EEHKMhEXqXWrYHSQQMbtgJ2EP4zNiSK8avPREuUQS4BS1aRUF3zT8bkEfWDfp5EjxAs6fumYZCkRKsyjRHEZMN6m9fwESmJqdJPeTJUrZkkvhJZCszPdeTNxSzrUnaeQ2oLvmw29MXVzdvx9gzpa1AKP9YcWjjbZGBkBrYnKzS6KkDBvi2uvo633eqJCrMzRDrVsvQPAi9kTQcqMFt567WotqbF9EBhfAKMss9G9eHXeVCGPa7P2kG9Whix2adaatpi6B6yUjfHFKwXNyXrTUM5UnjCBW9PoLyjPve8q6x6HqVb63v97B29HjguuEZhMjrMctXpPB4EVhemczKitdsYaQRFzsV1R3XVHnfha2BwTyw5B9U7uYFqdrfKwwszni5aqvAsSV3YwGEuwMrZSaCYVub5DtDaqKiJee138tGsn16bg6seb5jZeEiguaAmwDrXY9nT4ihvh4Gqtao4BoipSvb3vQJsjG4KAxTQWb3HFqQXUoVrs81sRh64amtg7or4Pwj8F5fMwx6VyqHW8BbfA4CaXrfunWLKo5Qap1gNnaV9WxoN9n9bKsJ9fS2PQgtX\",\n           \"signedTx\": \"\",\n           \"txHash\": \"\",\n           \"state\": \"STATE_PENDING_EXT_BROADCAST\",\n           \"errorMessage\": \"\"\n         }\n       }\n     ],\n     \"createTime\": \"2024-05-08T15:25:58.265307812Z\",\n     \"updateTime\": \"2024-05-08T15:25:58.265307812Z\",\n     \"completeTime\": null\n   }\n   ```\n\n   \u003c/details\u003e\n\n### View Partial ETH Rewards :moneybag:\n\nThis code sample helps view rewards for an Ethereum address. View the full source [here](examples/ethereum/list-rewards/partial-eth.ts).\n\n\u003cdetails open\u003e\n\n```typescript\n// examples/ethereum/list-rewards/partial-eth.ts\nimport { StakingClient } from \"@coinbase/staking-client-library-ts\";\n\n// Set your api key name and private key here. Get your keys from here: https://portal.cdp.coinbase.com/access/api\nconst apiKeyName: string = 'your-api-key-name';\nconst apiPrivateKey: string = 'your-api-private-key';\n\nconst client = new StakingClient(apiKeyName, apiPrivateKey);\n\n// Defines which address and rewards we want to see\nconst address: string =\n  '0x60c7e246344ae3856cf9abe3a2e258d495fc39e0';\nconst filter: string = `address='${address}' AND period_end_time \u003e '2024-05-01T00:00:00Z' AND period_end_time \u003c '2024-05-02T00:00:00Z'`;\n\n// Loops through rewards array and prints each reward\nvar list = async function () {\n  const resp = await client.Ethereum.listRewards(filter)\n  resp.rewards!.forEach((reward) =\u003e {\n    console.log(JSON.stringify(reward, null, 2));\n  });\n}\n\nlist();\n```\n\n\u003c/details\u003e\n\n   \u003cdetails\u003e\n     \u003csummary\u003eOutput\u003c/summary\u003e\n\n   ```json\n  {\n    \"address\": \"0x60c7e246344ae3856cf9abe3a2e258d495fc39e0\",\n    \"date\": \"2024-05-01\",\n    \"aggregationUnit\": \"DAY\",\n    \"periodStartTime\": \"2024-05-01T00:00:00Z\",\n    \"periodEndTime\": \"2024-05-01T23:59:59Z\",\n    \"totalEarnedNativeUnit\": {\n      \"amount\": \"0.001212525541415161\",\n      \"exp\": \"18\",\n      \"ticker\": \"ETH\",\n      \"rawNumeric\": \"1212525541415161\"\n    },\n    \"totalEarnedUsd\": [\n      {\n        \"source\": \"COINBASE_EXCHANGE\",\n        \"conversionTime\": \"2024-05-02T00:09:00Z\",\n        \"amount\": {\n          \"amount\": \"3.61\",\n          \"exp\": \"2\",\n          \"ticker\": \"USD\",\n          \"rawNumeric\": \"361\"\n        },\n        \"conversionPrice\": \"2971.419922\"\n      }\n    ],\n    \"endingBalance\": null,\n    \"protocol\": \"ethereum\",\n    \"rewardState\": \"PENDING_CLAIMABLE\"\n  }\n   ```\n\n   \u003c/details\u003e\n\n## Documentation\n\nThere are numerous examples in the [`examples directory`](./examples) to help get you started. For even more, refer to our [documentation website](https://docs.cdp.coinbase.com/staking/docs/welcome) for detailed definitions, [API specification](https://docs.cdp.coinbase.com/staking/reference), integration guides, and more!\n\n## Contributing\n\nThanks for considering contributing to the project! Please refer to [our contribution guide](./CONTRIBUTING.md).\n\n## Contact Us\n\nIf you have any questions, please reach out to us in the #staking channel on our [Discord](https://discord.com/invite/cdp) server.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoinbase%2Fstaking-client-library-ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoinbase%2Fstaking-client-library-ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoinbase%2Fstaking-client-library-ts/lists"}