{"id":19986422,"url":"https://github.com/clockwork-xyz/sdk","last_synced_at":"2025-05-04T07:31:18.364Z","repository":{"id":65954269,"uuid":"603244838","full_name":"clockwork-xyz/sdk","owner":"clockwork-xyz","description":"Typescript SDK for interacting with the Clockwork program.","archived":false,"fork":false,"pushed_at":"2023-09-18T09:31:08.000Z","size":122,"stargazers_count":12,"open_issues_count":1,"forks_count":8,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-29T04:19:37.095Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://clockwork.xyz","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/clockwork-xyz.png","metadata":{"files":{"readme":"README.md","changelog":null,"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}},"created_at":"2023-02-17T23:36:06.000Z","updated_at":"2024-09-01T01:07:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"9a62081c-0872-45d0-b8e3-c9b37e76f159","html_url":"https://github.com/clockwork-xyz/sdk","commit_stats":{"total_commits":29,"total_committers":3,"mean_commits":9.666666666666666,"dds":"0.48275862068965514","last_synced_commit":"3d0070df2f1117d8f72131331cb04fddb8db5eba"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clockwork-xyz%2Fsdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clockwork-xyz%2Fsdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clockwork-xyz%2Fsdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clockwork-xyz%2Fsdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clockwork-xyz","download_url":"https://codeload.github.com/clockwork-xyz/sdk/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224390032,"owners_count":17303441,"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":[],"created_at":"2024-11-13T04:29:06.237Z","updated_at":"2024-11-13T04:29:07.065Z","avatar_url":"https://github.com/clockwork-xyz.png","language":"TypeScript","funding_links":[],"categories":["Development Tools and Libraries"],"sub_categories":["Development Frameworks and SDKs"],"readme":"\u003ch1 align=\"center\"\u003eClockwork SDK\u003c/h1\u003e\n\u003cp align=\"center\"\u003e\u003cstrong\u003eClockwork Typescript SDK\u003c/strong\u003e\u003c/p\u003e\n\n\u003cdiv align=\"center\"\u003e\n\n  \u003ca href=\"https://opensource.org/licenses/MIT\"\u003e![License](https://img.shields.io/badge/License-MIT-yellow.svg)\u003c/a\u003e  \n\n\u003c/div\u003e\n\n## Getting Started\n\nFor a quickstart guide and in depth tutorials, see the [Clockwork Docs](https://docs.clockwork.xyz/about/readme).\nTo jump straight to examples, go [here](https://github.com/clockwork-xyz/sdk/tree/main/tests). For the latest Rust API documentation, see [Clockwork Rust SDK](https://docs.rs/clockwork-sdk/latest/clockwork_sdk/).\n\n## Note\n\n- **Clockwork SDK is in active development, so all APIs are subject to change.**\n- **This code is unaudited. Use at your own risk.**\n\n## Usage\n\nFirst, initialize a `ClockworkProvider`\n\n```rust\nconst wallet = new NodeWallet(new Keypair());\nconst connection = new Connection(clusterApiUrl(\"devnet\"));\nconst clockworkProvider = new ClockworkProvider(wallet, connection);\n\n#or\nconst anchorProvider = new anchor.AnchorProvider(\n        connection,\n        wallet,\n        anchor.AnchorProvider.defaultOptions()\n);\nconst provider = new ClockworkProvider.fromAnchorProvider(provider);\n```\n\nGet Thread Address\n\n```rust\nconst [pubkey, bump] = provider.getThreadPDA(\n      wallet.publicKey,\n      \"ThreadProgramTest\"\n);\n```\n\nInitialize a Thread\n\n```rust\nconst ix = await provider.threadCreate(\n      wallet.publicKey,         // authority\n      \"ThreadProgramTest\",      // id\n      [],                       // instructions to execute\n      { now: {} },              // thread trigger\n      0.1 * LAMPORTS_PER_SOL    // amount to send to the thread\n);\nconst tx = new Transaction().add(ix);\nconst signature = await provider.anchorProvider.sendAndConfirm(tx);\n```\n\nGet Thread Data Deserialized\n\n```rust\nconst threadAccount = await provider.getThreadAccount(threadPubkey);\n```\n\nPause/Resume/Reset/Delete/ Thread\n\n```rust\nconst ix = await provider.threadPause(wallet.publicKey, threadPubkey);\nconst ix = await provider.threadResume(wallet.publicKey, threadPubkey);\nconst ix = await provider.threadReset(wallet.publicKey, threadPubkey);\nconst ix = await provider.threadDelete(wallet.publicKey, threadPubkey);\n```\n\nUpdate a Thread\n\n```rust\nconst ix = await provider.threadUpdate(wallet.publicKey, threadPubkey, {\n      name: \"TestUpdateThread\",\n      rateLimit: new BN(32),\n      trigger: { now: {} },\n});\nconst tx = new Transaction().add(ix);\nconst signature = await provider.anchorProvider.sendAndConfirm(tx);\n```\n\nWithdraw from Thread\n\n```rust\nconst ix = await provider.threadWithdraw(\n      wallet.publicKey,\n      threadPubkey,\n      0.01 * LAMPORTS_PER_SOL\n);\nconst tx = new Transaction().add(ix);\nconst signature = await provider.anchorProvider.sendAndConfirm(tx);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclockwork-xyz%2Fsdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclockwork-xyz%2Fsdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclockwork-xyz%2Fsdk/lists"}