Skip to content

Commit 3f2b1e8

Browse files
committed
feat: compressed token sdk
mint to spl works compress works token transfer works decompress works batch compress works refactor: sdk-token-test ixs into files with cpi context works fix: get_validity_proof order fix: process_update_deposit typo
1 parent ef0dd04 commit 3f2b1e8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+5360
-82
lines changed

Cargo.lock

Lines changed: 59 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ members = [
2525
"sdk-libs/sdk-types",
2626
"sdk-libs/photon-api",
2727
"sdk-libs/program-test",
28+
"sdk-libs/compressed-token-types",
29+
"sdk-libs/compressed-token-sdk",
2830
"xtask",
2931
"examples/anchor/token-escrow",
3032
# "examples/anchor/name-service-without-macros",
@@ -40,6 +42,7 @@ members = [
4042
# Issue is that anchor discriminator now returns a slice instead of an array
4143
"program-tests/sdk-anchor-test/programs/sdk-anchor-test",
4244
"program-tests/sdk-test",
45+
"program-tests/sdk-token-test",
4346
"program-tests/sdk-pinocchio-test",
4447
"program-tests/create-address-test-program",
4548
"program-tests/utils",
@@ -60,6 +63,10 @@ strip = "none"
6063
[profile.release]
6164
overflow-checks = true
6265

66+
[workspace.package]
67+
version = "0.1.0"
68+
edition = "2021"
69+
6370
[workspace.dependencies]
6471
solana-banks-client = { version = "2.2" }
6572
solana-banks-interface = { version = "2.2" }
@@ -175,7 +182,9 @@ account-compression = { path = "programs/account-compression", version = "2.0.0"
175182
light-compressed-token = { path = "programs/compressed-token", version = "2.0.0", features = [
176183
"cpi",
177184
] }
178-
light-system-program-anchor = { path = "anchor-programs/system", version = "2.0.0", features = [
185+
light-compressed-token-types = { path = "sdk-libs/compressed-token-types", name = "light-compressed-token-types" }
186+
light-compressed-token-sdk = { path = "sdk-libs/compressed-token-sdk" }
187+
light-system-program-anchor = { path = "anchor-programs/system", version = "1.2.0", features = [
179188
"cpi",
180189
] }
181190
light-registry = { path = "programs/registry", version = "2.0.0", features = [

program-libs/account-checks/src/account_info/account_info_trait.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::error::AccountError;
44

55
/// Trait to abstract over different AccountInfo implementations (pinocchio vs solana)
66
pub trait AccountInfoTrait {
7-
type Pubkey: Copy + Clone;
7+
type Pubkey: Copy + Clone + std::fmt::Debug;
88
type DataRef<'a>: Deref<Target = [u8]>
99
where
1010
Self: 'a;

program-libs/compressed-account/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ light-zero-copy = { workspace = true, features = ["std"] }
2222
light-macros = { workspace = true }
2323
pinocchio = { workspace = true, optional = true }
2424
solana-program-error = { workspace = true, optional = true }
25-
25+
solana-msg = { workspace = true }
2626
# Feature-gated dependencies
2727
anchor-lang = { workspace = true, optional = true }
2828
bytemuck = { workspace = true, optional = true, features = ["derive"] }

program-libs/compressed-account/src/compressed_account.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,6 @@ pub fn hash_with_hashed_values(
295295
vec.push(&discriminator_bytes);
296296
vec.push(data_hash);
297297
}
298-
299298
Ok(Poseidon::hashv(&vec)?)
300299
}
301300

program-tests/create-address-test-program/src/lib.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,9 @@ pub mod system_cpi_test {
7777
} else {
7878
use light_sdk::cpi::CpiAccounts;
7979
let cpi_accounts =
80-
CpiAccounts::new_with_config(&fee_payer, ctx.remaining_accounts, config);
81-
let account_infos = cpi_accounts
82-
.to_account_infos()
83-
.into_iter()
84-
.cloned()
85-
.collect::<Vec<_>>();
80+
CpiAccounts::try_new_with_config(&fee_payer, ctx.remaining_accounts, config)
81+
.unwrap();
82+
let account_infos = cpi_accounts.to_account_infos();
8683

8784
let account_metas =
8885
to_account_metas(cpi_accounts).map_err(|_| ErrorCode::AccountNotEnoughKeys)?;
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
[package]
2+
name = "sdk-token-test"
3+
version = "1.0.0"
4+
description = "Test program using compressed token SDK"
5+
repository = "https://github.com/Lightprotocol/light-protocol"
6+
license = "Apache-2.0"
7+
edition = "2021"
8+
9+
[lib]
10+
crate-type = ["cdylib", "lib"]
11+
name = "sdk_token_test"
12+
13+
[features]
14+
no-entrypoint = []
15+
no-idl = []
16+
no-log-ix-name = []
17+
cpi = ["no-entrypoint"]
18+
test-sbf = []
19+
default = []
20+
21+
[dependencies]
22+
light-compressed-token-sdk = { workspace = true, features = ["anchor"] }
23+
anchor-lang = { workspace = true }
24+
light-hasher = { workspace = true }
25+
light-sdk = { workspace = true }
26+
light-sdk-types = { workspace = true }
27+
light-compressed-account = { workspace = true }
28+
arrayvec = { workspace = true }
29+
light-batched-merkle-tree = { workspace = true }
30+
31+
[dev-dependencies]
32+
light-program-test = { workspace = true, features = ["devenv"] }
33+
light-test-utils = { workspace = true }
34+
tokio = { workspace = true }
35+
serial_test = { workspace = true }
36+
solana-sdk = { workspace = true }
37+
anchor-spl = { workspace = true }
38+
light-sdk = { workspace = true }
39+
light-compressed-account = { workspace = true, features = ["anchor"] }
40+
light-client = { workspace = true }
41+
42+
[lints.rust.unexpected_cfgs]
43+
level = "allow"
44+
check-cfg = [
45+
'cfg(target_os, values("solana"))',
46+
'cfg(feature, values("frozen-abi", "no-entrypoint"))',
47+
]
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[target.bpfel-unknown-unknown.dependencies.std]
2+
features = []

0 commit comments

Comments
 (0)