repo_id
stringclasses
279 values
file_path
stringlengths
43
179
content
stringlengths
1
4.18M
__index_level_0__
int64
0
0
solana_public_repos/Lightprotocol/light-protocol/test-programs/account-compression-test
solana_public_repos/Lightprotocol/light-protocol/test-programs/account-compression-test/tests/group_authority_tests.rs
#![cfg(feature = "test-sbf")] use account_compression::errors::AccountCompressionErrorCode; use account_compression::{ self, utils::constants::GROUP_AUTHORITY_SEED, GroupAuthority, RegisteredProgram, ID, }; use anchor_lang::{system_program, InstructionData, ToAccountMetas}; use light_program_test::test_env::{get_g...
0
solana_public_repos/Lightprotocol/light-protocol/test-programs/account-compression-test
solana_public_repos/Lightprotocol/light-protocol/test-programs/account-compression-test/tests/merkle_tree_tests.rs
#![cfg(feature = "test-sbf")] use std::{collections::HashMap, mem}; use account_compression::{ self, errors::AccountCompressionErrorCode, queue_from_bytes_copy, sdk::{create_initialize_merkle_tree_instruction, create_insert_leaves_instruction}, state::{queue_from_bytes_zero_copy_mut, QueueAccount},...
0
solana_public_repos/Lightprotocol/light-protocol/test-programs/account-compression-test
solana_public_repos/Lightprotocol/light-protocol/test-programs/account-compression-test/tests/address_merkle_tree_tests.rs
#![cfg(feature = "test-sbf")] use std::mem; use account_compression::{ errors::AccountCompressionErrorCode, state::QueueAccount, utils::constants::{ADDRESS_MERKLE_TREE_CANOPY_DEPTH, ADDRESS_MERKLE_TREE_HEIGHT}, AddressMerkleTreeAccount, AddressMerkleTreeConfig, AddressQueueConfig, ID, SAFETY_MARGIN, }...
0
solana_public_repos/Lightprotocol/light-protocol/test-programs/account-compression-test
solana_public_repos/Lightprotocol/light-protocol/test-programs/account-compression-test/src/lib.rs
// placeholder
0
solana_public_repos/Lightprotocol/light-protocol/test-programs
solana_public_repos/Lightprotocol/light-protocol/test-programs/registry-test/Cargo.toml
[package] name = "registry-test" version = "1.1.0" description = "Created with Anchor" edition = "2021" [lib] crate-type = ["cdylib", "lib"] name = "registry_test" [features] no-entrypoint = [] no-idl = [] no-log-ix-name = [] cpi = ["no-entrypoint"] test-sbf = [] custom-heap = [] default = ["custom-heap"] [dependenc...
0
solana_public_repos/Lightprotocol/light-protocol/test-programs
solana_public_repos/Lightprotocol/light-protocol/test-programs/registry-test/Xargo.toml
[target.bpfel-unknown-unknown.dependencies.std] features = []
0
solana_public_repos/Lightprotocol/light-protocol/test-programs/registry-test
solana_public_repos/Lightprotocol/light-protocol/test-programs/registry-test/tests/tests.rs
#![cfg(feature = "test-sbf")] use account_compression::{ AddressMerkleTreeConfig, AddressQueueConfig, NullifierQueueConfig, StateMerkleTreeConfig, }; use anchor_lang::{InstructionData, ToAccountMetas}; use forester_utils::forester_epoch::get_epoch_phases; use light_program_test::test_env::{ create_address_merk...
0
solana_public_repos/Lightprotocol/light-protocol/test-programs/registry-test
solana_public_repos/Lightprotocol/light-protocol/test-programs/registry-test/src/lib.rs
// placeholder
0
solana_public_repos/Lightprotocol/light-protocol/test-programs
solana_public_repos/Lightprotocol/light-protocol/test-programs/e2e-test/Cargo.toml
[package] name = "e2e-test" version = "1.1.0" description = "Created with Anchor" edition = "2021" [lib] crate-type = ["cdylib", "lib"] name = "e2e_test" [features] no-entrypoint = [] no-idl = [] no-log-ix-name = [] cpi = ["no-entrypoint"] test-sbf = [] custom-heap = [] default = ["custom-heap"] [dependencies] ancho...
0
solana_public_repos/Lightprotocol/light-protocol/test-programs
solana_public_repos/Lightprotocol/light-protocol/test-programs/e2e-test/Xargo.toml
[target.bpfel-unknown-unknown.dependencies.std] features = []
0
solana_public_repos/Lightprotocol/light-protocol/test-programs/e2e-test
solana_public_repos/Lightprotocol/light-protocol/test-programs/e2e-test/tests/test.rs
#![cfg(feature = "test-sbf")] use light_program_test::test_env::setup_test_programs_with_accounts_with_protocol_config; use light_program_test::test_rpc::ProgramTestRpcConnection; use light_registry::protocol_config::state::ProtocolConfig; use light_test_utils::e2e_test_env::{E2ETestEnv, GeneralActionConfig, KeypairAc...
0
solana_public_repos/Lightprotocol/light-protocol/test-programs/e2e-test
solana_public_repos/Lightprotocol/light-protocol/test-programs/e2e-test/src/lib.rs
// placeholder
0
solana_public_repos/Lightprotocol/light-protocol/test-programs
solana_public_repos/Lightprotocol/light-protocol/test-programs/sdk-test-program/.prettierignore
.anchor .DS_Store target node_modules dist build test-ledger
0
solana_public_repos/Lightprotocol/light-protocol/test-programs
solana_public_repos/Lightprotocol/light-protocol/test-programs/sdk-test-program/README.md
# SDK test program
0
solana_public_repos/Lightprotocol/light-protocol/test-programs
solana_public_repos/Lightprotocol/light-protocol/test-programs/sdk-test-program/Anchor.toml
[toolchain] [features] seeds = false skip-lint = false [programs.localnet] sdk_test = "2tzfijPBGbrR5PboyFUFKzfEoLTwdDSHUjANCw929wyt" [registry] url = "https://api.apr.dev" [provider] cluster = "Localnet" wallet = "~/.config/solana/id.json" [scripts] test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/...
0
solana_public_repos/Lightprotocol/light-protocol/test-programs
solana_public_repos/Lightprotocol/light-protocol/test-programs/sdk-test-program/package.json
{ "scripts": { "lint:fix": "prettier \"*/**/*{.js,.ts}\" -w", "lint": "prettier \"*/**/*{.js,.ts}\" --check", "test": "cargo test-sbf -p sdk-test -- --test-threads 1" }, "dependencies": { "@coral-xyz/anchor": "^0.29.0" }, "devDependencies": { "@lightprotocol/zk-compression-cli": "workspac...
0
solana_public_repos/Lightprotocol/light-protocol/test-programs
solana_public_repos/Lightprotocol/light-protocol/test-programs/sdk-test-program/tsconfig.json
{ "compilerOptions": { "types": ["mocha", "chai"], "typeRoots": ["./node_modules/@types"], "lib": ["es2015"], "module": "commonjs", "target": "es6", "esModuleInterop": true } }
0
solana_public_repos/Lightprotocol/light-protocol/test-programs/sdk-test-program/programs
solana_public_repos/Lightprotocol/light-protocol/test-programs/sdk-test-program/programs/sdk-test/Cargo.toml
[package] name = "sdk-test" version = "0.7.0" description = "Test program for Light SDK and Light Macros" edition = "2021" rust-version = "1.75.0" license = "Apache-2.0" [lib] crate-type = ["cdylib", "lib"] name = "sdk_test" [features] no-entrypoint = [] no-idl = [] no-log-ix-name = [] cpi = ["no-entrypoint"] defaul...
0
solana_public_repos/Lightprotocol/light-protocol/test-programs/sdk-test-program/programs
solana_public_repos/Lightprotocol/light-protocol/test-programs/sdk-test-program/programs/sdk-test/Xargo.toml
[target.bpfel-unknown-unknown.dependencies.std] features = []
0
solana_public_repos/Lightprotocol/light-protocol/test-programs/sdk-test-program/programs/sdk-test
solana_public_repos/Lightprotocol/light-protocol/test-programs/sdk-test-program/programs/sdk-test/tests/test.rs
#![cfg(feature = "test-sbf")] use anchor_lang::{AnchorDeserialize, InstructionData, ToAccountMetas}; use light_client::indexer::{AddressMerkleTreeAccounts, Indexer, StateMerkleTreeAccounts}; use light_client::rpc::merkle_tree::MerkleTreeExt; use light_program_test::test_env::{setup_test_programs_with_accounts_v2, EnvA...
0
solana_public_repos/Lightprotocol/light-protocol/test-programs/sdk-test-program/programs/sdk-test
solana_public_repos/Lightprotocol/light-protocol/test-programs/sdk-test-program/programs/sdk-test/src/lib.rs
use anchor_lang::prelude::*; use light_hasher::Discriminator; use light_sdk::{ account::LightAccount, address::derive_address, error::LightSdkError, instruction_data::LightInstructionData, light_account, light_system_accounts, program_merkle_context::unpack_address_merkle_context, verify::verify_light_accou...
0
solana_public_repos/Lightprotocol/light-protocol/test-programs
solana_public_repos/Lightprotocol/light-protocol/test-programs/compressed-token-test/Cargo.toml
[package] name = "compressed-token-test" version = "1.1.0" description = "Created with Anchor" edition = "2021" [lib] crate-type = ["cdylib", "lib"] name = "compressed_token_test" [features] no-entrypoint = [] no-idl = [] no-log-ix-name = [] cpi = ["no-entrypoint"] test-sbf = [] custom-heap = [] default = ["custom-he...
0
solana_public_repos/Lightprotocol/light-protocol/test-programs
solana_public_repos/Lightprotocol/light-protocol/test-programs/compressed-token-test/Xargo.toml
[target.bpfel-unknown-unknown.dependencies.std] features = []
0
solana_public_repos/Lightprotocol/light-protocol/test-programs/compressed-token-test
solana_public_repos/Lightprotocol/light-protocol/test-programs/compressed-token-test/tests/test.rs
#![cfg(feature = "test-sbf")] use anchor_lang::{ system_program, AnchorDeserialize, AnchorSerialize, InstructionData, ToAccountMetas, }; use anchor_spl::token::{Mint, TokenAccount}; use anchor_spl::token_2022::spl_token_2022; use anchor_spl::token_2022::spl_token_2022::extension::ExtensionType; use light_compresse...
0
solana_public_repos/Lightprotocol/light-protocol/test-programs/compressed-token-test
solana_public_repos/Lightprotocol/light-protocol/test-programs/compressed-token-test/src/lib.rs
// placeholder
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/heap/Cargo.toml
[package] name = "light-heap" version = "1.1.0" description = "Custom heap allocator used in Light Protocol" repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" edition = "2021" [dependencies] anchor-lang = { workspace = true }
0
solana_public_repos/Lightprotocol/light-protocol/heap
solana_public_repos/Lightprotocol/light-protocol/heap/src/lib.rs
use std::{alloc::Layout, mem::size_of, ptr::null_mut}; pub mod bench; #[cfg(target_os = "solana")] use anchor_lang::{ prelude::*, solana_program::entrypoint::{HEAP_LENGTH, HEAP_START_ADDRESS}, }; #[cfg(target_os = "solana")] #[global_allocator] pub static GLOBAL_ALLOCATOR: BumpAllocator = BumpAllocator { ...
0
solana_public_repos/Lightprotocol/light-protocol/heap
solana_public_repos/Lightprotocol/light-protocol/heap/src/bench.rs
#[macro_export] macro_rules! bench_sbf_start { ($custom_msg:literal) => { // Conditionally compile only if on Solana OS and feature "bench-sbf" is enabled #[cfg(all(target_os = "solana", feature = "bench-sbf"))] { // Log the total heap with a custom message indicating the start ...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/light-program-test/Cargo.toml
[package] name = "light-program-test" version = "0.1.0" edition = "2021" [features] default = [] devenv = [] [dependencies] light-client = { workspace = true } light-prover-client = { workspace = true } light-sdk = { workspace = true } light-indexed-merkle-tree = { workspace = true } light-merkle-tree-reference = { w...
0
solana_public_repos/Lightprotocol/light-protocol/light-program-test
solana_public_repos/Lightprotocol/light-protocol/light-program-test/src/test_env.rs
use crate::env_accounts; use crate::test_rpc::ProgramTestRpcConnection; use account_compression::sdk::create_initialize_address_merkle_tree_and_queue_instruction; use account_compression::utils::constants::GROUP_AUTHORITY_SEED; use account_compression::{ sdk::create_initialize_merkle_tree_instruction, GroupAuthorit...
0
solana_public_repos/Lightprotocol/light-protocol/light-program-test
solana_public_repos/Lightprotocol/light-protocol/light-program-test/src/lib.rs
pub mod env_accounts; pub mod test_env; pub mod test_indexer; pub mod test_rpc;
0
solana_public_repos/Lightprotocol/light-protocol/light-program-test
solana_public_repos/Lightprotocol/light-protocol/light-program-test/src/env_accounts.rs
// This file is generated by getAccountState.sh. Do not edit it manually. use solana_sdk::account::Account; use solana_sdk::pubkey::Pubkey; use std::str::FromStr; pub fn get_registered_program_pda() -> Account { Account { lamports: 1392000u64, data: vec![ 31u8, 251u8, 180u8, 235u8, 3u8,...
0
solana_public_repos/Lightprotocol/light-protocol/light-program-test
solana_public_repos/Lightprotocol/light-protocol/light-program-test/src/test_rpc.rs
use std::fmt::{Debug, Formatter}; use async_trait::async_trait; use borsh::BorshDeserialize; use solana_banks_client::BanksClientError; use solana_program_test::ProgramTestContext; use solana_sdk::{ account::{Account, AccountSharedData}, clock::Slot, commitment_config::CommitmentConfig, epoch_info::Epo...
0
solana_public_repos/Lightprotocol/light-protocol/light-program-test
solana_public_repos/Lightprotocol/light-protocol/light-program-test/src/test_indexer.rs
use borsh::BorshDeserialize; use light_client::{ indexer::{ AddressMerkleTreeAccounts, AddressMerkleTreeBundle, Indexer, StateMerkleTreeAccounts, StateMerkleTreeBundle, }, rpc::{merkle_tree::MerkleTreeExt, RpcConnection}, transaction_params::FeeConfig, }; use light_hasher::Poseidon; use ...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/sdk/Cargo.toml
[package] name = "light-sdk" version = "0.11.0" description = "Rust SDK for ZK Compression on Solana" repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" edition = "2021" [lib] crate-type = ["cdylib", "lib"] name = "light_sdk" [features] no-entrypoint = [] no-idl = [] no-log-ix-name ...
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/sdk/readme.md
# Light SDK Rust SDK with helpers to interact with ZK Compression on Solana. Documentation is available at https://zkcompression.com Source code: https://github.com/Lightprotocol/light-protocol/tree/main/programs/system ## Audit This code is unaudited. Use at your own risk.
0
solana_public_repos/Lightprotocol/light-protocol
solana_public_repos/Lightprotocol/light-protocol/sdk/Xargo.toml
[target.bpfel-unknown-unknown.dependencies.std] features = []
0
solana_public_repos/Lightprotocol/light-protocol/sdk
solana_public_repos/Lightprotocol/light-protocol/sdk/src/account_meta.rs
//! Types used use anchor_lang::{AnchorDeserialize, AnchorSerialize}; use solana_program::pubkey::Pubkey; use crate::{ compressed_account::CompressedAccountWithMerkleContext, error::LightSdkError, merkle_context::{ pack_address_merkle_context, pack_merkle_context, AddressMerkleContext, Pac...
0
solana_public_repos/Lightprotocol/light-protocol/sdk
solana_public_repos/Lightprotocol/light-protocol/sdk/src/account_info.rs
use std::{cell::RefCell, rc::Rc}; use anchor_lang::prelude::Result; use solana_program::pubkey::Pubkey; use crate::{ account_meta::LightAccountMeta, address::PackedNewAddressParams, compressed_account::{ CompressedAccount, CompressedAccountData, OutputCompressedAccountWithPackedContext, Pa...
0
solana_public_repos/Lightprotocol/light-protocol/sdk
solana_public_repos/Lightprotocol/light-protocol/sdk/src/constants.rs
use light_macros::pubkey; use solana_program::pubkey::Pubkey; /// Seed of the CPI authority. pub const CPI_AUTHORITY_PDA_SEED: &[u8] = b"cpi_authority"; /// ID of the account-compression program. pub const PROGRAM_ID_ACCOUNT_COMPRESSION: Pubkey = pubkey!("compr6CUsB5m2jS4Y3831ztGSTnDpnKJTKS95d64XVq"); pub const P...
0
solana_public_repos/Lightprotocol/light-protocol/sdk
solana_public_repos/Lightprotocol/light-protocol/sdk/src/legacy.rs
#![cfg(feature = "legacy")] //! Legacy types re-imported from programs which should be removed as soon as //! possible. pub use light_system_program::{ invoke::processor::CompressedProof, sdk::{ compressed_account::{ CompressedAccount, CompressedAccountData, CompressedAccountWithMerkleCont...
0
solana_public_repos/Lightprotocol/light-protocol/sdk
solana_public_repos/Lightprotocol/light-protocol/sdk/src/error.rs
use anchor_lang::prelude::error_code; #[error_code] pub enum LightSdkError { #[msg("Constraint violation")] ConstraintViolation, #[msg("Invalid light-system-program ID")] InvalidLightSystemProgram, #[msg("Expected accounts in the instruction")] ExpectedAccounts, #[msg("Expected address Merk...
0
solana_public_repos/Lightprotocol/light-protocol/sdk
solana_public_repos/Lightprotocol/light-protocol/sdk/src/token.rs
use anchor_lang::{AnchorDeserialize, AnchorSerialize}; use solana_program::pubkey::Pubkey; use crate::compressed_account::CompressedAccountWithMerkleContext; #[derive(Clone, Copy, Debug, PartialEq, Eq, AnchorDeserialize, AnchorSerialize)] #[repr(u8)] pub enum AccountState { Initialized, Frozen, } #[derive(De...
0
solana_public_repos/Lightprotocol/light-protocol/sdk
solana_public_repos/Lightprotocol/light-protocol/sdk/src/lib.rs
pub use light_macros::*; pub use light_sdk_macros::*; pub mod account; pub mod account_info; pub mod account_meta; pub mod address; pub mod compressed_account; pub mod constants; pub use constants::*; pub mod context; pub mod error; pub mod event; pub mod instruction_data; pub mod legacy; pub mod merkle_context; pub m...
0
solana_public_repos/Lightprotocol/light-protocol/sdk
solana_public_repos/Lightprotocol/light-protocol/sdk/src/merkle_context.rs
use std::collections::HashMap; use anchor_lang::prelude::{AccountMeta, AnchorDeserialize, AnchorSerialize, Pubkey}; /// Collection of remaining accounts which are sent to the program. #[derive(Default)] pub struct RemainingAccounts { next_index: u8, map: HashMap<Pubkey, u8>, } impl RemainingAccounts { //...
0
solana_public_repos/Lightprotocol/light-protocol/sdk
solana_public_repos/Lightprotocol/light-protocol/sdk/src/address.rs
use anchor_lang::{solana_program::pubkey::Pubkey, AnchorDeserialize, AnchorSerialize}; use light_utils::{hash_to_bn254_field_size_be, hashv_to_bn254_field_size_be}; use solana_program::account_info::AccountInfo; use crate::merkle_context::{AddressMerkleContext, RemainingAccounts}; #[derive(Debug, PartialEq, Default, ...
0
solana_public_repos/Lightprotocol/light-protocol/sdk
solana_public_repos/Lightprotocol/light-protocol/sdk/src/instruction_data.rs
use std::io::{self, Cursor}; use borsh::{BorshDeserialize, BorshSerialize}; use crate::{account_meta::LightAccountMeta, proof::ProofRpcResult}; pub struct LightInstructionData { pub proof: Option<ProofRpcResult>, pub accounts: Option<Vec<LightAccountMeta>>, } impl LightInstructionData { pub fn deseriali...
0
solana_public_repos/Lightprotocol/light-protocol/sdk
solana_public_repos/Lightprotocol/light-protocol/sdk/src/event.rs
use anchor_lang::{AnchorDeserialize, AnchorSerialize}; use solana_program::pubkey::Pubkey; use crate::compressed_account::OutputCompressedAccountWithPackedContext; #[derive(Debug, Clone, AnchorDeserialize, AnchorSerialize, Default, PartialEq)] pub struct MerkleTreeSequenceNumber { pub pubkey: Pubkey, pub seq:...
0
solana_public_repos/Lightprotocol/light-protocol/sdk
solana_public_repos/Lightprotocol/light-protocol/sdk/src/program_merkle_context.rs
use anchor_lang::{prelude::AccountInfo, Key}; use crate::merkle_context::{AddressMerkleContext, PackedAddressMerkleContext}; pub fn pack_address_merkle_contexts( address_merkle_contexts: &[AddressMerkleContext], remaining_accounts: &[AccountInfo], ) -> Vec<PackedAddressMerkleContext> { address_merkle_cont...
0
solana_public_repos/Lightprotocol/light-protocol/sdk
solana_public_repos/Lightprotocol/light-protocol/sdk/src/account.rs
use std::ops::{Deref, DerefMut}; use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize, Result}; use light_hasher::{DataHasher, Discriminator, Poseidon}; use solana_program::{program_error::ProgramError, pubkey::Pubkey}; use crate::{ account_info::LightAccountInfo, account_meta::LightAccountMeta, ...
0
solana_public_repos/Lightprotocol/light-protocol/sdk
solana_public_repos/Lightprotocol/light-protocol/sdk/src/state.rs
use anchor_lang::{AnchorDeserialize, AnchorSerialize}; use solana_program::pubkey::Pubkey; #[derive(AnchorDeserialize, AnchorSerialize, Debug, PartialEq, Default)] pub struct MerkleTreeMetadata { pub access_metadata: AccessMetadata, pub rollover_metadata: RolloverMetadata, // Queue associated with this Mer...
0
solana_public_repos/Lightprotocol/light-protocol/sdk
solana_public_repos/Lightprotocol/light-protocol/sdk/src/verify.rs
use anchor_lang::{prelude::*, Bumps}; use light_hasher::{DataHasher, Discriminator}; use solana_program::{instruction::Instruction, program::invoke_signed}; use crate::{ account::LightAccount, address::PackedNewAddressParams, compressed_account::{ OutputCompressedAccountWithPackedContext, PackedCom...
0
solana_public_repos/Lightprotocol/light-protocol/sdk
solana_public_repos/Lightprotocol/light-protocol/sdk/src/compressed_account.rs
use anchor_lang::prelude::{AnchorDeserialize, AnchorSerialize, ProgramError, Pubkey, Result}; use light_hasher::{DataHasher, Discriminator, Hasher, Poseidon}; use light_utils::hash_to_bn254_field_size_be; use crate::merkle_context::{ pack_merkle_context, MerkleContext, PackedMerkleContext, RemainingAccounts, }; #...
0
solana_public_repos/Lightprotocol/light-protocol/sdk
solana_public_repos/Lightprotocol/light-protocol/sdk/src/traits.rs
// Ported from light-system-program, adjusted for caller programs. use anchor_lang::prelude::*; pub trait InvokeAccounts<'info> { fn get_registered_program_pda(&self) -> &AccountInfo<'info>; fn get_noop_program(&self) -> &AccountInfo<'info>; fn get_account_compression_authority(&self) -> &AccountInfo<'info...
0
solana_public_repos/Lightprotocol/light-protocol/sdk
solana_public_repos/Lightprotocol/light-protocol/sdk/src/proof.rs
use anchor_lang::{AnchorDeserialize, AnchorSerialize}; use light_indexed_merkle_tree::array::IndexedElement; use num_bigint::BigUint; use solana_program::pubkey::Pubkey; #[derive(Debug, Clone)] pub struct MerkleProof { pub hash: [u8; 32], pub leaf_index: u64, pub merkle_tree: Pubkey, pub proof: Vec<[u8...
0
solana_public_repos/Lightprotocol/light-protocol/sdk
solana_public_repos/Lightprotocol/light-protocol/sdk/src/transfer.rs
use anchor_lang::Result; use crate::{account_info::LightAccountInfo, error::LightSdkError}; /// Transfers a specified amount of lamports from one account to another. /// /// Attempts to transfer `lamports` from the `from` account to the `to` /// account. It will update the lamport balances of both accounts if the ///...
0
solana_public_repos/Lightprotocol/light-protocol/sdk
solana_public_repos/Lightprotocol/light-protocol/sdk/src/utils.rs
use anchor_lang::solana_program::pubkey::Pubkey; use crate::{ address::PackedNewAddressParams, compressed_account::{ OutputCompressedAccountWithPackedContext, PackedCompressedAccountWithMerkleContext, }, proof::CompressedProof, verify::{CompressedCpiContext, InstructionDataInvokeCpi}, P...
0
solana_public_repos/Lightprotocol/light-protocol/sdk
solana_public_repos/Lightprotocol/light-protocol/sdk/src/context.rs
use std::ops::{Deref, DerefMut}; use anchor_lang::{context::Context, Bumps, Result}; use crate::{ account::LightAccounts, account_info::LightAccountInfo, traits::{ InvokeAccounts, InvokeCpiAccounts, InvokeCpiContextAccount, LightSystemAccount, SignerAccounts, }, }; /// Provides non-ar...
0
solana_public_repos/Lightprotocol/light-protocol/examples
solana_public_repos/Lightprotocol/light-protocol/examples/name-service/.prettierignore
.anchor .DS_Store target node_modules dist build test-ledger
0
solana_public_repos/Lightprotocol/light-protocol/examples
solana_public_repos/Lightprotocol/light-protocol/examples/name-service/README.md
# Name Service program example
0
solana_public_repos/Lightprotocol/light-protocol/examples
solana_public_repos/Lightprotocol/light-protocol/examples/name-service/Anchor.toml
[toolchain] [features] seeds = false skip-lint = false [programs.localnet] name_service = "7yucc7fL3JGbyMwg4neUaenNSdySS39hbAk89Ao3t1Hz" [registry] url = "https://api.apr.dev" [provider] cluster = "Localnet" wallet = "~/.config/solana/id.json" [scripts] test = "yarn run ts-mocha -p ./tsconfig.json -t 1000000 tests...
0
solana_public_repos/Lightprotocol/light-protocol/examples
solana_public_repos/Lightprotocol/light-protocol/examples/name-service/package.json
{ "scripts": { "lint:fix": "prettier \"*/**/*{.js,.ts}\" -w", "lint": "prettier \"*/**/*{.js,.ts}\" --check", "test": "cargo test-sbf -p name-service -- --test-threads 1" }, "dependencies": { "@coral-xyz/anchor": "^0.29.0" }, "devDependencies": { "@lightprotocol/zk-compression-cli": "work...
0
solana_public_repos/Lightprotocol/light-protocol/examples
solana_public_repos/Lightprotocol/light-protocol/examples/name-service/tsconfig.json
{ "compilerOptions": { "types": ["mocha", "chai"], "typeRoots": ["./node_modules/@types"], "lib": ["es2015"], "module": "commonjs", "target": "es6", "esModuleInterop": true } }
0
solana_public_repos/Lightprotocol/light-protocol/examples/name-service
solana_public_repos/Lightprotocol/light-protocol/examples/name-service/migrations/deploy.ts
// Migrations are an early feature. Currently, they're nothing more than this // single deploy script that's invoked from the CLI, injecting a provider // configured from the workspace's Anchor.toml. const anchor = require("@coral-xyz/anchor"); module.exports = async function (provider) { // Configure client to use...
0
solana_public_repos/Lightprotocol/light-protocol/examples/name-service/programs
solana_public_repos/Lightprotocol/light-protocol/examples/name-service/programs/name-service-without-macros/Cargo.toml
[package] name = "name-service-without-macros" version = "0.7.0" description = "Created with Anchor" edition = "2021" rust-version = "1.75.0" license = "Apache-2.0" [lib] crate-type = ["cdylib", "lib"] name = "name_service_without_macros" [features] no-entrypoint = [] no-idl = [] no-log-ix-name = [] cpi = ["no-entry...
0
solana_public_repos/Lightprotocol/light-protocol/examples/name-service/programs
solana_public_repos/Lightprotocol/light-protocol/examples/name-service/programs/name-service-without-macros/Xargo.toml
[target.bpfel-unknown-unknown.dependencies.std] features = []
0
solana_public_repos/Lightprotocol/light-protocol/examples/name-service/programs/name-service-without-macros
solana_public_repos/Lightprotocol/light-protocol/examples/name-service/programs/name-service-without-macros/tests/test.rs
#![cfg(feature = "test-sbf")] use std::net::{Ipv4Addr, Ipv6Addr}; use anchor_lang::{AnchorDeserialize, InstructionData, ToAccountMetas}; use light_client::indexer::{AddressMerkleTreeAccounts, Indexer, StateMerkleTreeAccounts}; use light_client::rpc::merkle_tree::MerkleTreeExt; use light_program_test::test_env::{setup...
0
solana_public_repos/Lightprotocol/light-protocol/examples/name-service/programs/name-service-without-macros
solana_public_repos/Lightprotocol/light-protocol/examples/name-service/programs/name-service-without-macros/src/lib.rs
use std::net::{Ipv4Addr, Ipv6Addr}; use anchor_lang::prelude::*; use borsh::{BorshDeserialize, BorshSerialize}; use light_hasher::bytes::AsByteVec; use light_sdk::{ account::LightAccount, instruction_data::LightInstructionData, light_system_accounts, verify::verify_light_accounts, LightDiscriminator, LightHash...
0
solana_public_repos/Lightprotocol/light-protocol/examples/name-service/programs
solana_public_repos/Lightprotocol/light-protocol/examples/name-service/programs/name-service/Cargo.toml
[package] name = "name-service" version = "0.7.0" description = "Created with Anchor" edition = "2021" rust-version = "1.75.0" license = "Apache-2.0" [lib] crate-type = ["cdylib", "lib"] name = "name_service" [features] no-entrypoint = [] no-idl = [] no-log-ix-name = [] cpi = ["no-entrypoint"] default = ["idl-build"...
0
solana_public_repos/Lightprotocol/light-protocol/examples/name-service/programs
solana_public_repos/Lightprotocol/light-protocol/examples/name-service/programs/name-service/Xargo.toml
[target.bpfel-unknown-unknown.dependencies.std] features = []
0
solana_public_repos/Lightprotocol/light-protocol/examples/name-service/programs/name-service
solana_public_repos/Lightprotocol/light-protocol/examples/name-service/programs/name-service/tests/test.rs
#![cfg(feature = "test-sbf")] use std::net::{Ipv4Addr, Ipv6Addr}; use anchor_lang::{AnchorDeserialize, InstructionData, ToAccountMetas}; use light_client::indexer::{AddressMerkleTreeAccounts, Indexer, StateMerkleTreeAccounts}; use light_client::rpc::merkle_tree::MerkleTreeExt; use light_program_test::test_env::{setup...
0
solana_public_repos/Lightprotocol/light-protocol/examples/name-service/programs/name-service
solana_public_repos/Lightprotocol/light-protocol/examples/name-service/programs/name-service/src/lib.rs
use std::net::{Ipv4Addr, Ipv6Addr}; use anchor_lang::prelude::*; use borsh::{BorshDeserialize, BorshSerialize}; use light_hasher::bytes::AsByteVec; use light_sdk::{ account::LightAccount, light_account, light_accounts, light_program, merkle_context::PackedAddressMerkleContext, }; declare_id!("7yucc7fL3JGbyMwg...
0
solana_public_repos/Lightprotocol/light-protocol/examples/browser
solana_public_repos/Lightprotocol/light-protocol/examples/browser/nextjs/next.config.mjs
/** @type {import('next').NextConfig} */ const nextConfig = { webpack: (config, { isServer }) => { // Fix for Node.js modules in Webpack 5+ if (!isServer) { config.resolve.fallback = { ...config.resolve.fallback, fs: false, path: false, ...
0
solana_public_repos/Lightprotocol/light-protocol/examples/browser
solana_public_repos/Lightprotocol/light-protocol/examples/browser/nextjs/README.md
This project demonstrates how to use `@lightprotocol/stateless.js` to interact with the ZK Compression API in a browser environment. 0. Build the Monorepo. ```bash cd ../../../ && . ./scripts/devenv.sh && ./scripts/install.sh && ./scripts/build.sh ``` 1. Start a light test-validator using the CLI ```bash cd cli && ...
0
solana_public_repos/Lightprotocol/light-protocol/examples/browser
solana_public_repos/Lightprotocol/light-protocol/examples/browser/nextjs/package.json
{ "name": "nextjs", "version": "0.1.0", "private": true, "scripts": { "dev": "next dev -p 1234", "build": "next build", "build:browser": "next build", "start": "next start -p 1234", "test-validator": "./../../../cli/test_bin/run test-validator", "lint": "n...
0
solana_public_repos/Lightprotocol/light-protocol/examples/browser
solana_public_repos/Lightprotocol/light-protocol/examples/browser/nextjs/.prettierrc
{ "semi": true, "trailingComma": "all", "singleQuote": true, "printWidth": 80, "useTabs": false, "tabWidth": 4, "bracketSpacing": true, "arrowParens": "avoid" }
0
solana_public_repos/Lightprotocol/light-protocol/examples/browser
solana_public_repos/Lightprotocol/light-protocol/examples/browser/nextjs/tsconfig.json
{ "compilerOptions": { "lib": [ "dom", "dom.iterable", "esnext" ], "allowJs": true, "skipLibCheck": true, "strict": true, "noEmit": true, "esModuleInterop": true, "module": "esnext", "moduleResolution": "bundler", "resolveJsonModule": true, "isolatedModule...
0
solana_public_repos/Lightprotocol/light-protocol/examples/browser
solana_public_repos/Lightprotocol/light-protocol/examples/browser/nextjs/.eslintrc.json
{ "extends": "next/core-web-vitals" }
0
solana_public_repos/Lightprotocol/light-protocol/examples/browser/nextjs
solana_public_repos/Lightprotocol/light-protocol/examples/browser/nextjs/public/vercel.svg
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 283 64"><path fill="black" d="M141 16c-11 0-19 7-19 18s9 18 20 18c7 0 13-3 16-7l-7-5c-2 3-6 4-9 4-5 0-9-3-10-7h28v-3c0-11-8-18-19-18zm-9 15c1-4 4-7 9-7s8 3 9 7h-18zm117-15c-11 0-19 7-19 18s9 18 20 18c6 0 12-3 16-7l-8-5c-2 3-5 4-8 4-5 0-9-3-11-7h28l1-3c0-1...
0
solana_public_repos/Lightprotocol/light-protocol/examples/browser/nextjs
solana_public_repos/Lightprotocol/light-protocol/examples/browser/nextjs/public/next.svg
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="...
0
solana_public_repos/Lightprotocol/light-protocol/examples/browser/nextjs/src
solana_public_repos/Lightprotocol/light-protocol/examples/browser/nextjs/src/app/page.module.css
.main { display: flex; flex-direction: column; justify-content: space-between; align-items: center; padding: 6rem; min-height: 100vh; } .description { display: inherit; justify-content: inherit; align-items: inherit; font-size: 0.85rem; max-width: var(--max-width); width: 100%; z-index: 2; ...
0
solana_public_repos/Lightprotocol/light-protocol/examples/browser/nextjs/src
solana_public_repos/Lightprotocol/light-protocol/examples/browser/nextjs/src/app/layout.tsx
import type { Metadata } from 'next'; import { Inter } from 'next/font/google'; import './globals.css'; const inter = Inter({ subsets: ['latin'] }); export const metadata: Metadata = { title: 'Create Next App', description: 'Generated by create next app', }; export default function RootLayout({ children,...
0
solana_public_repos/Lightprotocol/light-protocol/examples/browser/nextjs/src
solana_public_repos/Lightprotocol/light-protocol/examples/browser/nextjs/src/app/page.tsx
'use client'; import React, { FC, useCallback, useMemo } from 'react'; import { ComputeBudgetProgram, Keypair, TransactionMessage, VersionedTransaction, } from '@solana/web3.js'; import { ConnectionProvider, WalletProvider, useWallet, } from '@solana/wallet-adapter-react'; import { WalletNo...
0
solana_public_repos/Lightprotocol/light-protocol/examples/browser/nextjs/src
solana_public_repos/Lightprotocol/light-protocol/examples/browser/nextjs/src/app/globals.css
:root { --max-width: 1100px; --border-radius: 12px; --font-mono: ui-monospace, Menlo, Monaco, "Cascadia Mono", "Segoe UI Mono", "Roboto Mono", "Oxygen Mono", "Ubuntu Monospace", "Source Code Pro", "Fira Mono", "Droid Sans Mono", "Courier New", monospace; --foreground-rgb: 0, 0, 0; --background-start-...
0
solana_public_repos/Lightprotocol/light-protocol/examples
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/.prettierignore
.anchor .DS_Store target node_modules dist build test-ledger
0
solana_public_repos/Lightprotocol/light-protocol/examples
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/README.md
# Token Escrow program example This example program escrows compressed tokens into (1) a regular Solana program account and (2) a compressed-pda account. **Note:** Breaking changes to interfaces can occur. To ensure compatibility with the latest release, please check out the [latest release branch](https://github.com...
0
solana_public_repos/Lightprotocol/light-protocol/examples
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/Anchor.toml
[toolchain] [features] seeds = false skip-lint = false [programs.localnet] token_escrow = "GRLu2hKaAiMbxpkAM1HeXzks9YeGuz18SEgXEizVvPqX" [programs.testnet] token_escrow = "GRLu2hKaAiMbxpkAM1HeXzks9YeGuz18SEgXEizVvPqX" [registry] url = "https://api.apr.dev" [provider] cluster = "testnet" wallet = "$HOME/.config/sol...
0
solana_public_repos/Lightprotocol/light-protocol/examples
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/package.json
{ "scripts": { "lint:fix": "prettier \"*/**/*{.js,.ts}\" -w", "lint": "prettier \"*/**/*{.js,.ts}\" --check", "test": "cargo test-sbf -p token-escrow -- --test-threads=1" }, "dependencies": { "@coral-xyz/anchor": "0.29.0" }, "devDependencies": { "chai": "^5.1.2", "mocha": "^10.7.3", ...
0
solana_public_repos/Lightprotocol/light-protocol/examples
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/tsconfig.json
{ "compilerOptions": { "types": ["mocha", "chai"], "typeRoots": ["./node_modules/@types"], "lib": ["es2015"], "module": "commonjs", "target": "es6", "esModuleInterop": true } }
0
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/migrations/deploy.ts
// Migrations are an early feature. Currently, they're nothing more than this // single deploy script that's invoked from the CLI, injecting a provider // configured from the workspace's Anchor.toml. const anchor = require("@coral-xyz/anchor"); module.exports = async function (provider) { // Configure client to use...
0
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/tests/token-escrow.ts
import * as anchor from "@coral-xyz/anchor"; import { Program } from "@coral-xyz/anchor"; import { TokenEscrow } from "../target/types/token_escrow"; describe("token-escrow", () => { // Configure the client to use the local cluster. anchor.setProvider(anchor.AnchorProvider.env()); const program = anchor.workspa...
0
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/programs
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/programs/token-escrow/Cargo.toml
[package] name = "token-escrow" version = "0.9.0" description = "Solana escrow implementation using account compression" repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" edition = "2021" [lib] crate-type = ["cdylib", "lib"] name = "token_escrow" [features] no-entrypoint = [] no-lo...
0
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/programs
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/programs/token-escrow/Xargo.toml
[target.bpfel-unknown-unknown.dependencies.std] features = []
0
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/programs/token-escrow
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/programs/token-escrow/tests/test.rs
#![cfg(feature = "test-sbf")] // TODO: extend this example with a swap function // TODO: implement a version with delegate and approve // 1. escrow tokens with pda // create test env // create mint and mint tokens // escrow compressed tokens - with normal pda // - transfer tokens to compressed token account owned by p...
0
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/programs/token-escrow
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/programs/token-escrow/tests/test_compressed_pda.rs
#![cfg(feature = "test-sbf")] // 2. escrow tokens with compressed pda // create test env // create mint and mint tokens // escrow compressed tokens - with compressed pda // release compressed tokens // TODO: 3. escrow tokens by decompression with compressed pda // this design pattern can be used to use compressed acc...
0
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/programs/token-escrow
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/programs/token-escrow/src/lib.rs
#![allow(clippy::too_many_arguments)] use anchor_lang::prelude::*; use anchor_lang::solana_program::pubkey::Pubkey; use light_compressed_token::process_transfer::InputTokenDataWithContext; use light_compressed_token::process_transfer::PackedTokenTransferOutputData; use light_system_program::invoke::processor::Compresse...
0
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/programs/token-escrow/src
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/programs/token-escrow/src/escrow_with_compressed_pda/sdk.rs
#![cfg(not(target_os = "solana"))] use crate::escrow_with_compressed_pda::escrow::PackedInputCompressedPda; use anchor_lang::{InstructionData, ToAccountMetas}; use light_compressed_token::process_transfer::{ get_cpi_authority_pda, transfer_sdk::{create_inputs_and_remaining_accounts_checked, to_account_metas}, ...
0
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/programs/token-escrow/src
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/programs/token-escrow/src/escrow_with_compressed_pda/withdrawal.rs
use account_compression::utils::constants::CPI_AUTHORITY_PDA_SEED; use anchor_lang::prelude::*; use light_compressed_token::process_transfer::{ CompressedTokenInstructionDataTransfer, InputTokenDataWithContext, PackedTokenTransferOutputData, }; use light_hasher::{DataHasher, Poseidon}; use light_sdk::verify::ve...
0
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/programs/token-escrow/src
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/programs/token-escrow/src/escrow_with_compressed_pda/mod.rs
pub mod escrow; pub mod sdk; pub mod withdrawal; pub use escrow::*;
0
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/programs/token-escrow/src
solana_public_repos/Lightprotocol/light-protocol/examples/token-escrow/programs/token-escrow/src/escrow_with_compressed_pda/escrow.rs
use crate::{create_change_output_compressed_token_account, program::TokenEscrow, EscrowTimeLock}; use account_compression::utils::constants::CPI_AUTHORITY_PDA_SEED; use anchor_lang::prelude::*; use light_compressed_token::{ process_transfer::{ CompressedTokenInstructionDataTransfer, InputTokenDataWithContex...
0