Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create open-clockwork-sdk v0.1.0 #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
396 changes: 198 additions & 198 deletions Cargo.lock

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[package]
name = "clockwork-cli"
version = "2.0.19"
name = "open-clockwork-cli"
version = "0.1.0"
description = "Command line interface for Clockwork"
edition = "2021"
license = "AGPL-3.0-or-later"
homepage = "https://clockwork.xyz"
repository = "https://github.com/clockwork-xyz/cli"
repository = "https://github.com/open-clockwork/clockwork/cli"
documentation = "https://docs.clockwork.xyz"
readme = "./README.md"
keywords = ["solana"]
Expand All @@ -18,13 +18,13 @@ anyhow = "1.0.61"
bincode = "1.3.3"
bzip2 = "0.4"
clap = { version = "3.1.2", features = ["derive"] }
clockwork-cron = { path = "../cron", version = "=2.0.19" }
clockwork-network-program = { path = "../programs/network", version = "=2.0.19", features = ["no-entrypoint"] }
clockwork-relayer-api = { path = "../relayer/api", version = "=2.0.19" }
clockwork-plugin-utils= { path = "../plugin/utils", version = "=2.0.19" }
clockwork-thread-program = { path = "../programs/thread", version = "=2.0.19", features = ["no-entrypoint"] }
clockwork-utils = { path = "../utils", version = "=2.0.19" }
clockwork-webhook-program = { path = "../programs/webhook", version = "=2.0.19", features = ["no-entrypoint"] }
open-clockwork-cron = { path = "../cron", version = "=0.1.0" }
open-clockwork-network-program = { path = "../programs/network", version = "=0.1.0", features = ["no-entrypoint"] }
open-clockwork-relayer-api = { path = "../relayer/api", version = "=0.1.0" }
open-clockwork-plugin-utils= { path = "../plugin/utils", version = "=0.1.0" }
open-clockwork-thread-program = { path = "../programs/thread", version = "=0.1.0", features = ["no-entrypoint"] }
open-clockwork-utils = { path = "../utils", version = "=0.1.0" }
open-clockwork-webhook-program = { path = "../programs/webhook", version = "=0.1.0", features = ["no-entrypoint"] }
chrono = { version = "0.4.19", default-features = false, features = ["alloc"] }
dirs-next = "2.0.0"
indicatif = "0.16"
Expand Down
4 changes: 2 additions & 2 deletions cli/src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use clap::{crate_version, Arg, ArgGroup, Command};
use clockwork_thread_program::state::{SerializableInstruction, Trigger};
use clockwork_webhook_program::state::HttpMethod;
use open_clockwork_thread_program::state::{SerializableInstruction, Trigger};
use open_clockwork_webhook_program::state::HttpMethod;
use solana_sdk::{pubkey::Pubkey, signature::Keypair};

use crate::parser::ProgramInfo;
Expand Down
2 changes: 1 addition & 1 deletion cli/src/client.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use anchor_lang::{prelude::Clock, AccountDeserialize};
use clockwork_utils::ProgramLogsDeserializable;
use open_clockwork_utils::ProgramLogsDeserializable;
use solana_client::{
client_error, rpc_client::RpcClient,
rpc_response::RpcSimulateTransactionResult,
Expand Down
6 changes: 3 additions & 3 deletions cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ pub const CLOCKWORK_RELEASE_BASE_URL: &str =
"https://github.com/clockwork-xyz/clockwork/releases/download";
pub const CLOCKWORK_BIN_LOCAL: &str = "/bin/clockwork";
pub const CLOCKWORK_DEPS: &[&str] = &[
"clockwork_network_program.so",
"clockwork_thread_program.so",
"clockwork_webhook_program.so",
"open_clockwork_network_program.so",
"open_clockwork_thread_program.so",
"open_clockwork_webhook_program.so",
"libclockwork_plugin.so",
];
pub const SOLANA_RELEASE_BASE_URL: &str = "https://github.com/solana-labs/solana/releases/download";
Expand Down
4 changes: 2 additions & 2 deletions cli/src/parser.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::{convert::TryFrom, fs, path::PathBuf, str::FromStr};

use clap::ArgMatches;
use clockwork_thread_program::state::{SerializableAccount, SerializableInstruction, Trigger};
use clockwork_webhook_program::state::HttpMethod;
use open_clockwork_thread_program::state::{SerializableAccount, SerializableInstruction, Trigger};
use open_clockwork_webhook_program::state::HttpMethod;
use serde::{Deserialize as JsonDeserialize, Serialize as JsonSerialize};
use solana_sdk::{
pubkey::Pubkey,
Expand Down
8 changes: 4 additions & 4 deletions cli/src/processor/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use anchor_lang::{
},
InstructionData, ToAccountMetas
};
use clockwork_network_program::state::{Config, ConfigSettings};
use open_clockwork_network_program::state::{Config, ConfigSettings};

use crate::{client::Client, errors::CliError};

Expand Down Expand Up @@ -37,12 +37,12 @@ pub fn set(

// Submit tx
let ix = Instruction {
program_id: clockwork_network_program::ID,
accounts: clockwork_network_program::accounts::ConfigUpdate {
program_id: open_clockwork_network_program::ID,
accounts: open_clockwork_network_program::accounts::ConfigUpdate {
admin: client.payer_pubkey(),
config: Config::pubkey(),
}.to_account_metas(Some(false)),
data: clockwork_network_program::instruction::ConfigUpdate { settings }.data(),
data: open_clockwork_network_program::instruction::ConfigUpdate { settings }.data(),
};
client.send_and_confirm(&[ix], &[client.payer()]).unwrap();
get(client)?;
Expand Down
2 changes: 1 addition & 1 deletion cli/src/processor/crontab.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use chrono::{DateTime, NaiveDateTime, Utc};
use clockwork_cron::Schedule;
use open_clockwork_cron::Schedule;
use std::str::FromStr;

use crate::{client::Client, errors::CliError};
Expand Down
20 changes: 10 additions & 10 deletions cli/src/processor/delegation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use anchor_lang::{
},
InstructionData, AccountDeserialize, ToAccountMetas
};
use clockwork_network_program::state::{Config, Delegation, Worker};
use open_clockwork_network_program::state::{Config, Delegation, Worker};
use spl_associated_token_account::get_associated_token_address;

use crate::{client::Client, errors::CliError};
Expand All @@ -29,8 +29,8 @@ pub fn create(client: &Client, worker_id: u64) -> Result<(), CliError> {
// Build ix
let delegation_pubkey = Delegation::pubkey(worker_pubkey, worker.total_delegations);
let ix = Instruction {
program_id: clockwork_network_program::ID,
accounts: clockwork_network_program::accounts::DelegationCreate {
program_id: open_clockwork_network_program::ID,
accounts: open_clockwork_network_program::accounts::DelegationCreate {
associated_token_program: anchor_spl::associated_token::ID,
authority: client.payer_pubkey(),
config: Config::pubkey(),
Expand All @@ -42,7 +42,7 @@ pub fn create(client: &Client, worker_id: u64) -> Result<(), CliError> {
token_program: anchor_spl::token::ID,
worker: worker_pubkey,
}.to_account_metas(Some(false)),
data: clockwork_network_program::instruction::DelegationCreate {}.data(),
data: open_clockwork_network_program::instruction::DelegationCreate {}.data(),
};
client.send_and_confirm(&[ix], &[client.payer()]).unwrap();

Expand All @@ -69,16 +69,16 @@ pub fn deposit(
let worker_pubkey = Worker::pubkey(worker_id);
let delegation_pubkey = Delegation::pubkey(worker_pubkey, delegation_id);
let ix = Instruction {
program_id: clockwork_network_program::ID,
accounts: clockwork_network_program::accounts::DelegationDeposit {
program_id: open_clockwork_network_program::ID,
accounts: open_clockwork_network_program::accounts::DelegationDeposit {
authority: client.payer_pubkey(),
authority_tokens: get_associated_token_address(&client.payer_pubkey(), &config.mint),
config: Config::pubkey(),
delegation: delegation_pubkey,
delegation_tokens: get_associated_token_address(&delegation_pubkey, &config.mint),
token_program: anchor_spl::token::ID,
}.to_account_metas(Some(false)),
data: clockwork_network_program::instruction::DelegationDeposit { amount }.data(),
data: open_clockwork_network_program::instruction::DelegationDeposit { amount }.data(),
};
client.send_and_confirm(&[ix], &[client.payer()]).unwrap();

Expand All @@ -105,16 +105,16 @@ pub fn withdraw(
let worker_pubkey = Worker::pubkey(worker_id);
let delegation_pubkey = Delegation::pubkey(worker_pubkey, delegation_id);
let ix = Instruction {
program_id: clockwork_network_program::ID,
accounts: clockwork_network_program::accounts::DelegationWithdraw {
program_id: open_clockwork_network_program::ID,
accounts: open_clockwork_network_program::accounts::DelegationWithdraw {
authority: client.payer_pubkey(),
authority_tokens: get_associated_token_address(&client.payer_pubkey(), &config.mint),
config: Config::pubkey(),
delegation: delegation_pubkey,
delegation_tokens: get_associated_token_address(&delegation_pubkey, &config.mint),
token_program: anchor_spl::token::ID,
}.to_account_metas(Some(false)),
data: clockwork_network_program::instruction::DelegationWithdraw { amount }.data(),
data: open_clockwork_network_program::instruction::DelegationWithdraw { amount }.data(),
};
client.send_and_confirm(&[ix], &[client.payer()]).unwrap();

Expand Down
4 changes: 2 additions & 2 deletions cli/src/processor/explorer.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use {
crate::errors::CliError,
crate::config::CliConfig,
clockwork_utils::explorer::Explorer,
open_clockwork_utils::explorer::Explorer,
};

pub fn thread_url<T: std::fmt::Display>(thread: T, config: CliConfig) -> Result<(),
CliError> {
println!("thread: {}", explorer(config).thread_url(thread, clockwork_thread_program::ID));
println!("thread: {}", explorer(config).thread_url(thread, open_clockwork_thread_program::ID));
Ok(())
}

Expand Down
14 changes: 7 additions & 7 deletions cli/src/processor/initialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,36 @@ use anchor_lang::{
},
InstructionData, ToAccountMetas,
};
use clockwork_network_program::state::{Config, Pool, Registry, Snapshot};
use open_clockwork_network_program::state::{Config, Pool, Registry, Snapshot};

use crate::{client::Client, errors::CliError};

pub fn initialize(client: &Client, mint: Pubkey) -> Result<(), CliError> {
// Initialize the programs
let admin = client.payer_pubkey();
let ix_a = Instruction {
program_id: clockwork_network_program::ID,
accounts: clockwork_network_program::accounts::Initialize {
program_id: open_clockwork_network_program::ID,
accounts: open_clockwork_network_program::accounts::Initialize {
admin,
config: Config::pubkey(),
mint,
registry: Registry::pubkey(),
snapshot: Snapshot::pubkey(0),
system_program: system_program::ID,
}.to_account_metas(Some(false)),
data: clockwork_network_program::instruction::Initialize {}.data(),
data: open_clockwork_network_program::instruction::Initialize {}.data(),
};
let ix_b = Instruction {
program_id: clockwork_network_program::ID,
accounts: clockwork_network_program::accounts::PoolCreate {
program_id: open_clockwork_network_program::ID,
accounts: open_clockwork_network_program::accounts::PoolCreate {
admin,
config: Config::pubkey(),
payer: admin,
pool: Pool::pubkey(0),
registry: Registry::pubkey(),
system_program: system_program::ID,
}.to_account_metas(Some(false)),
data: clockwork_network_program::instruction::PoolCreate {}.data(),
data: open_clockwork_network_program::instruction::PoolCreate {}.data(),
};

// Submit tx
Expand Down
Loading