Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@clockwork-xyz/sdk

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@clockwork-xyz/sdk - npm Package Compare versions

Comparing version 0.1.0 to 0.2.0

2

package.json
{
"name": "@clockwork-xyz/sdk",
"author": "Clockwork",
"version": "0.1.0",
"version": "0.2.0",
"description": "Clockwork Typescript SDK",

@@ -6,0 +6,0 @@ "license": "MIT",

@@ -13,1 +13,97 @@ <p align="center">

</div>
## Getting Started
For a quickstart guide and in depth tutorials, see the [Clockwork Docs](https://docs.clockwork.xyz/about/readme).
To 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/).
## Note
- **Clockwork SDK is in active development, so all APIs are subject to change.**
- **This code is unaudited. Use at your own risk.**
## Usage
First, initialize a `ClockworkProvider`
```rust
const wallet = new NodeWallet(new Keypair());
const connection = new Connection(clusterApiUrl("devnet"));
const provider = new ClockworkProvider(wallet, connection);
```
Get Thread Address
```rust
let [pubkey, bump] = provider.getThreadPDA(
wallet.publicKey,
"ThreadProgramTest"
);
```
Initialize a Thread
```rust
let tx = await provider.threadCreate(
wallet.publicKey, // authority
"ThreadProgramTest", // id
[], // instructions to execute
{ now: {} }, // thread trigger
0.1 * LAMPORTS_PER_SOL // amount to send to the thread
);
```
Get Thread Data Deserialized
```rust
let threadAccount = await provider.getThreadAccount(threadPubkey);
```
Pause/Resume/Reset/Delete/ Thread
```rust
let tx = await provider.threadPause(wallet.publicKey, threadPubkey);
let tx = await provider.threadResume(wallet.publicKey, threadPubkey);
let tx = await provider.threadReset(wallet.publicKey, threadPubkey);
let tx = await provider.threadDelete(wallet.publicKey, threadPubkey);
```
Update a Thread
```rust
let tx = await provider.threadUpdate(wallet.publicKey, threadPubkey, {
name: "TestUpdateThread",
rateLimit: new BN(32),
trigger: { now: {} },
});
```
Withdraw from Thread
```rust
let tx = await provider.threadWithdraw(
wallet.publicKey,
threadPubkey,
0.01 * LAMPORTS_PER_SOL
);
```
Get Crate Info
```rust
let tx = await provider.getCrateInfo();
```
Get Worker Address
```rust
let [pubkey, bump] = provider.getWorkerPDA("8");
```
Get Worker Account
```rust
let workerAccount = await provider.getWorkerAccount(workerPubkey);
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc