Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion 0-quickstart_transfer/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
LAMPORTS_PER_SOL,
SystemProgram,
Transaction,
PublicKey,
} from "@solana/web3.js";
import * as anchor from "@coral-xyz/anchor";
import NodeWallet from "@coral-xyz/anchor/dist/cjs/nodewallet";
Expand All @@ -13,7 +14,7 @@ import { ClockworkProvider, PAYER_PUBKEY } from "@clockwork-xyz/sdk";
const connection = new Connection("http://localhost:8899", "processed");
const payer = Keypair.fromSecretKey(
Buffer.from(JSON.parse(require("fs").readFileSync(
require("os").homedir() + "/.config/solana/id.json",
require("os").homedir() + "/.config/solana/id.json", // double check this path on your machine
"utf-8"
)))
);
Expand All @@ -35,7 +36,12 @@ describe("transfer", async () => {
threadId
)

// comment out the line below which generates a random address
const recipient = Keypair.generate().publicKey;

// replace it with this, and add your pubkey:
// const recipient = new PublicKey('YOUR_PUBKEY')

console.log(`🫴 recipient: ${recipient.toString()}\n`);

// 1️⃣ Prepare an instruction to be automated.
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# **Clockwork examples**

This repo contains example automated smart-contracts built with the [**Clockwork SDK**](https://docs.clockwork.xyz).
- [**0. Quickstart Sol Transfer (Typescript)**](https://github.com/clockwork-xyz/examples/tree/main/0-quickstart_transfer) – Executes an SOL transfer on a user-defined schedule.
- [**0. Quickstart SOL Transfer (Typescript)**](https://github.com/clockwork-xyz/examples/tree/main/0-quickstart_transfer) – Executes a SOL transfer on a user-defined schedule.
- [**1. SPL Transfer (Typescript)**](https://github.com/clockwork-xyz/examples/tree/main/1-spl_transfer) – Executes an SPL token transfer on a user-defined schedule.
- [**2. Counter**](https://github.com/clockwork-xyz/examples/tree/main/2-counter) – Creates a thread via CPI that increments a counter every 10 seconds
- [**Recurring payments**](https://github.com/clockwork-xyz/examples/tree/main/payments) – Executes an SPL token transfer on a user-defined schedule.
- [**Token distributor**](https://github.com/clockwork-xyz/examples/tree/main/distributor) – Mints a new token and sends it to a target user every 60 seconds.
- [**Dollar cost averaging**](https://github.com/clockwork-xyz/examples/tree/main/investments) – Executes a swap on Serum on a user-defined schedule.
- [**Serum crank**](https://github.com/clockwork-xyz/examples/tree/main/serum_crank) – Indefinitely processes open orders on a permissioned Serum market.
- [**Subscriptions**](https://github.com/clockwork-xyz/examples/tree/main/subscriptions) – Allow users to subscribe to subscriptions by paying on a recurrent schedule.
- [**3. Recurring payments**](https://github.com/clockwork-xyz/examples/tree/main/payments) – Executes an SPL token transfer on a user-defined schedule.
- [**4. Token distributor**](https://github.com/clockwork-xyz/examples/tree/main/distributor) – Mints a new token and sends it to a target user every 60 seconds.
- [**5. Dollar cost averaging**](https://github.com/clockwork-xyz/examples/tree/main/investments) – Executes a swap on Serum on a user-defined schedule.
- [**6. Serum crank**](https://github.com/clockwork-xyz/examples/tree/main/serum_crank) – Indefinitely processes open orders on a permissioned Serum market.
- [**7. Subscriptions**](https://github.com/clockwork-xyz/examples/tree/main/subscriptions) – Allow users to subscribe to subscriptions by paying on a recurrent schedule.