Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
hackermystique committed Apr 5, 2023
0 parents commit 1b10b86
Show file tree
Hide file tree
Showing 25 changed files with 10,054 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

.anchor
.DS_Store
target
**/*.rs.bk
node_modules
test-ledger
8 changes: 8 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

.anchor
.DS_Store
target
node_modules
dist
build
test-ledger
11 changes: 11 additions & 0 deletions .program_client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
name = "program_client"
version = "0.1.0"
edition = "2018"

[dependencies]
trdelnik-client = "0.3.0"

[dependencies.note]
path = "../programs/dnotes"
features = ["no-entrypoint"]
147 changes: 147 additions & 0 deletions .program_client/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
// DO NOT EDIT - automatically generated file (except `use` statements inside the `*_instruction` module
pub mod note_instruction {
use trdelnik_client::*;
pub static PROGRAM_ID: Pubkey = Pubkey::new_from_array([
139u8, 74u8, 138u8, 81u8, 17u8, 79u8, 176u8, 104u8, 179u8, 243u8, 235u8, 78u8, 157u8,
171u8, 83u8, 56u8, 243u8, 212u8, 115u8, 139u8, 21u8, 255u8, 180u8, 235u8, 28u8, 248u8,
138u8, 249u8, 248u8, 80u8, 24u8, 139u8,
]);
pub async fn create_note(
client: &Client,
i_parsed_id: u8,
i_title: String,
i_description: String,
a_note: anchor_lang::solana_program::pubkey::Pubkey,
a_user: anchor_lang::solana_program::pubkey::Pubkey,
a_rent: anchor_lang::solana_program::pubkey::Pubkey,
a_system_program: anchor_lang::solana_program::pubkey::Pubkey,
signers: impl IntoIterator<Item = Keypair> + Send + 'static,
) -> Result<EncodedConfirmedTransactionWithStatusMeta, ClientError> {
Ok(client
.send_instruction(
PROGRAM_ID,
note::instruction::CreateNote {
parsed_id: i_parsed_id,
title: i_title,
description: i_description,
},
note::accounts::CreateNote {
note: a_note,
user: a_user,
rent: a_rent,
system_program: a_system_program,
},
signers,
)
.await?)
}
pub fn create_note_ix(
i_parsed_id: u8,
i_title: String,
i_description: String,
a_note: anchor_lang::solana_program::pubkey::Pubkey,
a_user: anchor_lang::solana_program::pubkey::Pubkey,
a_rent: anchor_lang::solana_program::pubkey::Pubkey,
a_system_program: anchor_lang::solana_program::pubkey::Pubkey,
) -> Instruction {
Instruction {
program_id: PROGRAM_ID,
data: note::instruction::CreateNote {
parsed_id: i_parsed_id,
title: i_title,
description: i_description,
}
.data(),
accounts: note::accounts::CreateNote {
note: a_note,
user: a_user,
rent: a_rent,
system_program: a_system_program,
}
.to_account_metas(None),
}
}
pub async fn update_note(
client: &Client,
i_title: String,
i_description: String,
a_note: anchor_lang::solana_program::pubkey::Pubkey,
a_user: anchor_lang::solana_program::pubkey::Pubkey,
a_system_program: anchor_lang::solana_program::pubkey::Pubkey,
signers: impl IntoIterator<Item = Keypair> + Send + 'static,
) -> Result<EncodedConfirmedTransactionWithStatusMeta, ClientError> {
Ok(client
.send_instruction(
PROGRAM_ID,
note::instruction::UpdateNote {
title: i_title,
description: i_description,
},
note::accounts::UpdateNote {
note: a_note,
user: a_user,
system_program: a_system_program,
},
signers,
)
.await?)
}
pub fn update_note_ix(
i_title: String,
i_description: String,
a_note: anchor_lang::solana_program::pubkey::Pubkey,
a_user: anchor_lang::solana_program::pubkey::Pubkey,
a_system_program: anchor_lang::solana_program::pubkey::Pubkey,
) -> Instruction {
Instruction {
program_id: PROGRAM_ID,
data: note::instruction::UpdateNote {
title: i_title,
description: i_description,
}
.data(),
accounts: note::accounts::UpdateNote {
note: a_note,
user: a_user,
system_program: a_system_program,
}
.to_account_metas(None),
}
}
pub async fn delete_note(
client: &Client,
a_note: anchor_lang::solana_program::pubkey::Pubkey,
a_user: anchor_lang::solana_program::pubkey::Pubkey,
a_system_program: anchor_lang::solana_program::pubkey::Pubkey,
signers: impl IntoIterator<Item = Keypair> + Send + 'static,
) -> Result<EncodedConfirmedTransactionWithStatusMeta, ClientError> {
Ok(client
.send_instruction(
PROGRAM_ID,
note::instruction::DeleteNote {},
note::accounts::DeleteNote {
note: a_note,
user: a_user,
system_program: a_system_program,
},
signers,
)
.await?)
}
pub fn delete_note_ix(
a_note: anchor_lang::solana_program::pubkey::Pubkey,
a_user: anchor_lang::solana_program::pubkey::Pubkey,
a_system_program: anchor_lang::solana_program::pubkey::Pubkey,
) -> Instruction {
Instruction {
program_id: PROGRAM_ID,
data: note::instruction::DeleteNote {}.data(),
accounts: note::accounts::DeleteNote {
note: a_note,
user: a_user,
system_program: a_system_program,
}
.to_account_metas(None),
}
}
}
19 changes: 19 additions & 0 deletions Anchor.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[features]
seeds = false
skip-lint = false
[programs.localnet]
note = "ANjbSZys9sYrPfywRWk68GhW5eRFQG8qJ3QV3K6csoGE"

[registry]
url = "http://localhost:8899"

[provider]
cluster = "Localnet"
wallet = "/Users/miglesias/.config/solana/id.json"

[scripts]
test1 = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/allfunc.ts"
test2 = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/sectest.ts"
test3 = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/add.ts"
test4 = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/date.ts"
test5 = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/biggersize.ts"
Loading

0 comments on commit 1b10b86

Please sign in to comment.