Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
@clockwork-xyz/sdk
Advanced tools
Clockwork Typescript SDK
For a quickstart guide and in depth tutorials, see the Clockwork Docs. To jump straight to examples, go here. For the latest Rust API documentation, see Clockwork Rust SDK.
First, initialize a ClockworkProvider
const wallet = new NodeWallet(new Keypair());
const connection = new Connection(clusterApiUrl("devnet"));
const clockworkProvider = new ClockworkProvider(wallet, connection);
#or
const anchorProvider = new anchor.AnchorProvider(
connection,
wallet,
anchor.AnchorProvider.defaultOptions()
);
const provider = new ClockworkProvider.fromAnchorProvider(provider);
Get Thread Address
const [pubkey, bump] = provider.getThreadPDA(
wallet.publicKey,
"ThreadProgramTest"
);
Initialize a Thread
const ix = 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
);
const tx = new Transaction().add(ix);
const signature = await provider.anchorProvider.sendAndConfirm(tx);
Get Thread Data Deserialized
const threadAccount = await provider.getThreadAccount(threadPubkey);
Pause/Resume/Reset/Delete/ Thread
const ix = await provider.threadPause(wallet.publicKey, threadPubkey);
const ix = await provider.threadResume(wallet.publicKey, threadPubkey);
const ix = await provider.threadReset(wallet.publicKey, threadPubkey);
const ix = await provider.threadDelete(wallet.publicKey, threadPubkey);
Update a Thread
const ix = await provider.threadUpdate(wallet.publicKey, threadPubkey, {
name: "TestUpdateThread",
rateLimit: new BN(32),
trigger: { now: {} },
});
const tx = new Transaction().add(ix);
const signature = await provider.anchorProvider.sendAndConfirm(tx);
Withdraw from Thread
const ix = await provider.threadWithdraw(
wallet.publicKey,
threadPubkey,
0.01 * LAMPORTS_PER_SOL
);
const tx = new Transaction().add(ix);
const signature = await provider.anchorProvider.sendAndConfirm(tx);
FAQs
Clockwork Typescript SDK
The npm package @clockwork-xyz/sdk receives a total of 218 weekly downloads. As such, @clockwork-xyz/sdk popularity was classified as not popular.
We found that @clockwork-xyz/sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.