repo_id
stringclasses
563 values
file_path
stringlengths
40
166
content
stringlengths
1
2.94M
__index_level_0__
int64
0
0
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/indexed
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/indexed/tests/tests.rs
use std::cell::{Ref, RefCell, RefMut}; use light_bounded_vec::BoundedVec; use light_concurrent_merkle_tree::{ errors::ConcurrentMerkleTreeError, event::IndexedMerkleTreeUpdate, light_hasher::{Hasher, Poseidon}, }; use light_hash_set::{HashSet, HashSetError}; use light_indexed_merkle_tree::{ array::{Ind...
0
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/indexed
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/indexed/src/copy.rs
use std::{fmt, marker::PhantomData, ops::Deref}; use crate::{errors::IndexedMerkleTreeError, IndexedMerkleTree}; use light_bounded_vec::CyclicBoundedVecMetadata; use light_concurrent_merkle_tree::{ copy::ConcurrentMerkleTreeCopy, errors::ConcurrentMerkleTreeError, }; use light_hasher::Hasher; use light_utils::offs...
0
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/indexed
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/indexed/src/zero_copy.rs
use std::{ fmt, marker::PhantomData, mem, ops::{Deref, DerefMut}, }; use light_bounded_vec::{CyclicBoundedVec, CyclicBoundedVecMetadata}; use light_concurrent_merkle_tree::{ errors::ConcurrentMerkleTreeError, zero_copy::{ConcurrentMerkleTreeZeroCopy, ConcurrentMerkleTreeZeroCopyMut}, Concur...
0
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/indexed
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/indexed/src/lib.rs
use std::{ fmt, marker::PhantomData, mem, ops::{Deref, DerefMut}, }; use array::{IndexedArray, IndexedElement}; use changelog::IndexedChangelogEntry; use light_bounded_vec::{BoundedVec, CyclicBoundedVec, CyclicBoundedVecMetadata}; use light_concurrent_merkle_tree::{ errors::ConcurrentMerkleTreeErro...
0
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/indexed
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/indexed/src/errors.rs
use light_bounded_vec::BoundedVecError; use light_concurrent_merkle_tree::{ errors::ConcurrentMerkleTreeError, light_hasher::errors::HasherError, }; use light_utils::UtilsError; use thiserror::Error; #[derive(Debug, Error)] pub enum IndexedMerkleTreeError { #[error("Integer overflow")] IntegerOverflow, ...
0
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/indexed
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/indexed/src/array.rs
use std::{cmp::Ordering, fmt::Debug, marker::PhantomData}; use crate::{errors::IndexedMerkleTreeError, HIGHEST_ADDRESS_PLUS_ONE}; use light_concurrent_merkle_tree::{event::RawIndexedElement, light_hasher::Hasher}; use light_utils::bigint::bigint_to_be_bytes_array; use num_bigint::BigUint; use num_traits::Zero; use num...
0
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/indexed
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/indexed/src/reference.rs
use std::marker::PhantomData; use light_bounded_vec::{BoundedVec, BoundedVecError}; use light_concurrent_merkle_tree::light_hasher::{errors::HasherError, Hasher}; use light_merkle_tree_reference::{MerkleTree, ReferenceMerkleTreeError}; use light_utils::bigint::bigint_to_be_bytes_array; use num_bigint::BigUint; use num...
0
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/indexed
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/indexed/src/changelog.rs
use light_concurrent_merkle_tree::event::RawIndexedElement; /// NET_HEIGHT = HEIGHT - CANOPY_DEPTH #[derive(Clone, Debug, PartialEq, Eq)] pub struct IndexedChangelogEntry<I, const NET_HEIGHT: usize> where I: Clone, { /// Element that was a subject to the change. pub element: RawIndexedElement<I>, /// ...
0
solana_public_repos/Lightprotocol/light-protocol/merkle-tree
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/bounded-vec/Cargo.toml
[package] name = "light-bounded-vec" version = "1.1.0" description = "Bounded and cyclic vector implementations" repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" edition = "2021" [features] solana = ["solana-program"] [dependencies] bytemuck = { version = "1.17", features = ["min_...
0
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/bounded-vec
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/bounded-vec/src/lib.rs
use std::{ alloc::{self, handle_alloc_error, Layout}, fmt, mem, ops::{Index, IndexMut}, ptr::{self, NonNull}, slice::{self, Iter, IterMut, SliceIndex}, }; use memoffset::span_of; use thiserror::Error; #[derive(Debug, Error, PartialEq)] pub enum BoundedVecError { #[error("The vector is full, ca...
0
solana_public_repos/Lightprotocol/light-protocol/merkle-tree
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/concurrent/Cargo.toml
[package] name = "light-concurrent-merkle-tree" version = "1.1.0" edition = "2021" description = "Concurrent Merkle tree implementation" repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" [features] heavy-tests = [] solana = [ "light-bounded-vec/solana", "light-hasher/solana", ...
0
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/concurrent
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/concurrent/tests/tests.rs
use ark_bn254::Fr; use ark_ff::{BigInteger, PrimeField, UniformRand}; use light_bounded_vec::{BoundedVec, BoundedVecError, CyclicBoundedVec}; use light_concurrent_merkle_tree::{ changelog::{ChangelogEntry, ChangelogPath}, errors::ConcurrentMerkleTreeError, zero_copy::ConcurrentMerkleTreeZeroCopyMut, Con...
0
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/concurrent
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/concurrent/src/copy.rs
use std::ops::Deref; use light_bounded_vec::{BoundedVecMetadata, CyclicBoundedVecMetadata}; use light_hasher::Hasher; use light_utils::offset::copy::{read_bounded_vec_at, read_cyclic_bounded_vec_at, read_value_at}; use memoffset::{offset_of, span_of}; use crate::{errors::ConcurrentMerkleTreeError, ConcurrentMerkleTre...
0
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/concurrent
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/concurrent/src/zero_copy.rs
use std::{ marker::PhantomData, mem, ops::{Deref, DerefMut}, }; use light_bounded_vec::{ BoundedVec, BoundedVecMetadata, CyclicBoundedVec, CyclicBoundedVecMetadata, }; use light_hasher::Hasher; use light_utils::offset::zero_copy::{read_array_like_ptr_at, read_ptr_at, write_at}; use memoffset::{offset_o...
0
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/concurrent
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/concurrent/src/lib.rs
use std::{ alloc::{self, handle_alloc_error, Layout}, iter::Skip, marker::PhantomData, mem, }; use changelog::ChangelogPath; use light_bounded_vec::{ BoundedVec, BoundedVecMetadata, CyclicBoundedVec, CyclicBoundedVecIterator, CyclicBoundedVecMetadata, }; pub use light_hasher; use light_hasher::...
0
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/concurrent
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/concurrent/src/event.rs
use borsh::{BorshDeserialize, BorshSerialize}; #[derive(BorshDeserialize, BorshSerialize, Debug)] pub struct MerkleTreeEvents { pub events: Vec<MerkleTreeEvent>, } /// Event containing the Merkle path of the given /// [`StateMerkleTree`](light_merkle_tree_program::state::StateMerkleTree) /// change. Indexers can u...
0
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/concurrent
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/concurrent/src/errors.rs
use light_bounded_vec::BoundedVecError; use light_hasher::errors::HasherError; use thiserror::Error; #[derive(Debug, Error)] pub enum ConcurrentMerkleTreeError { #[error("Integer overflow")] IntegerOverflow, #[error("Invalid height, it has to be greater than 0")] HeightZero, #[error("Invalud height...
0
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/concurrent
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/concurrent/src/hash.rs
use light_bounded_vec::BoundedVec; use light_hasher::Hasher; use crate::errors::ConcurrentMerkleTreeError; /// Returns the hash of the parent node based on the provided `node` (with its /// `node_index`) and `sibling` (with its `sibling_index`). pub fn compute_parent_node<H>( node: &[u8; 32], sibling: &[u8; 3...
0
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/concurrent
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/concurrent/src/changelog.rs
use std::ops::{Deref, DerefMut}; use light_bounded_vec::BoundedVec; use crate::errors::ConcurrentMerkleTreeError; #[derive(Clone, Debug, PartialEq, Eq)] #[repr(transparent)] pub struct ChangelogPath<const HEIGHT: usize>(pub [Option<[u8; 32]>; HEIGHT]); impl<const HEIGHT: usize> ChangelogPath<HEIGHT> { pub fn fr...
0
solana_public_repos/Lightprotocol/light-protocol/merkle-tree
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/reference/Cargo.toml
[package] name = "light-merkle-tree-reference" version = "1.1.0" description = "Non-sparse reference Merkle tree implementation" repository = "https://github.com/Lightprotocol/light-protocol" license = "Apache-2.0" edition = "2021" [dependencies] light-bounded-vec = { path = "../bounded-vec", version = "1.1.0" } light...
0
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/reference
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/reference/tests/tests.rs
use light_bounded_vec::BoundedVec; use light_hasher::{Hasher, Keccak, Poseidon, Sha256}; use light_merkle_tree_reference::MerkleTree; fn append<H>(canopy_depth: usize) where H: Hasher, { const HEIGHT: usize = 4; let mut mt = MerkleTree::<H>::new(4, canopy_depth); let leaf_1 = [1_u8; 32]; mt.appen...
0
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/reference
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/reference/src/lib.rs
pub mod sparse_merkle_tree; use std::marker::PhantomData; use light_bounded_vec::{BoundedVec, BoundedVecError}; use light_hasher::{errors::HasherError, Hasher}; use thiserror::Error; #[derive(Debug, Error)] pub enum ReferenceMerkleTreeError { #[error("Leaf {0} does not exist")] LeafDoesNotExist(usize), #...
0
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/reference
solana_public_repos/Lightprotocol/light-protocol/merkle-tree/reference/src/sparse_merkle_tree.rs
use light_hasher::Hasher; use num_bigint::BigUint; use std::marker::PhantomData; #[derive(Clone, Debug)] pub struct SparseMerkleTree<H: Hasher, const HEIGHT: usize> { subtrees: [[u8; 32]; HEIGHT], next_index: usize, root: [u8; 32], _hasher: PhantomData<H>, } impl<H, const HEIGHT: usize> SparseMerkleTr...
0
solana_public_repos/Lightprotocol/light-protocol/js
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/rollup.config.js
import typescript from '@rollup/plugin-typescript'; import nodePolyfills from 'rollup-plugin-polyfill-node'; import dts from 'rollup-plugin-dts'; import resolve from '@rollup/plugin-node-resolve'; import commonjs from '@rollup/plugin-commonjs'; const rolls = (fmt, env) => ({ input: 'src/index.ts', output: { ...
0
solana_public_repos/Lightprotocol/light-protocol/js
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/tsconfig.test.json
{ "compilerOptions": { "esModuleInterop": true, "rootDirs": ["src", "tests"] }, "extends": "./tsconfig.json", "include": ["./tests/**/*.ts", "vitest.config.ts"] }
0
solana_public_repos/Lightprotocol/light-protocol/js
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/package.json
{ "name": "@lightprotocol/stateless.js", "version": "0.16.0", "description": "JavaScript API for Light and ZK Compression", "sideEffects": false, "main": "dist/cjs/node/index.cjs", "type": "module", "exports": { ".": { "require": "./dist/cjs/node/index.cjs", "...
0
solana_public_repos/Lightprotocol/light-protocol/js
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/.prettierrc
{ "semi": true, "trailingComma": "all", "singleQuote": true, "printWidth": 80, "useTabs": false, "tabWidth": 4, "bracketSpacing": true, "arrowParens": "avoid" }
0
solana_public_repos/Lightprotocol/light-protocol/js
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/tsconfig.json
{ "$schema": "https://json.schemastore.org/tsconfig", "compilerOptions": { "importHelpers": true, "outDir": "./dist", "esModuleInterop": true, "allowSyntheticDefaultImports": true, "strict": true, "declaration": true, "target": "ESNext", "module": ...
0
solana_public_repos/Lightprotocol/light-protocol/js
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/.eslintignore
node_modules lib dist
0
solana_public_repos/Lightprotocol/light-protocol/js
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/playwright.config.ts
import { PlaywrightTestConfig } from '@playwright/test'; const config: PlaywrightTestConfig = { webServer: { command: 'npx http-server -p 4004 -c-1', port: 4004, cwd: '.', timeout: 15 * 1000, }, testDir: './tests/e2e/browser', }; export default config;
0
solana_public_repos/Lightprotocol/light-protocol/js
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/vitest.config.ts
import { defineConfig } from 'vitest/config'; export default defineConfig({ test: { include: ['tests/**/*.test.ts'], exclude: process.env.EXCLUDE_E2E ? ['tests/e2e/**'] : [], testTimeout: 30000, }, });
0
solana_public_repos/Lightprotocol/light-protocol/js
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/.eslintrc.json
{ "root": true, "ignorePatterns": ["node_modules", "lib"], "parser": "@typescript-eslint/parser", "parserOptions": { "project": ["./tsconfig.json", "./tsconfig.test.json"] }, "plugins": ["@typescript-eslint", "vitest"], "extends": [ "eslint:recommended", "plugin:@type...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/tests/unit
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/tests/unit/merkle-tree/merkle-tree.test.ts
import { IndexedArray } from '../../../src/test-helpers/merkle-tree/indexed-array'; import { beforeAll, describe, expect, it } from 'vitest'; import { IndexedElement } from '../../../src/test-helpers/merkle-tree/indexed-array'; import { HIGHEST_ADDRESS_PLUS_ONE } from '../../../src/constants'; import { bn } from '../.....
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/tests/unit
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/tests/unit/utils/conversion.test.ts
import { describe, it, expect } from 'vitest'; import { toArray } from '../../../src/utils/conversion'; import { calculateComputeUnitPrice } from '../../../src/utils'; describe('toArray', () => { it('should return same array if array is passed', () => { const arr = [1, 2, 3]; expect(toArray(arr)).t...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/tests/unit
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/tests/unit/utils/validation.test.ts
import { describe, it, expect } from 'vitest'; import { validateSufficientBalance } from '../../../src/utils/validation'; import { bn } from '../../../src/state'; describe('validateSufficientBalance', () => { it('should not throw error for positive balance', () => { expect(() => validateSufficientBalance(b...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/tests/unit
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/tests/unit/state/compressed-account.test.ts
import { describe, it, expect } from 'vitest'; import { createCompressedAccount, createCompressedAccountWithMerkleContext, createMerkleContext, } from '../../../src/state/compressed-account'; import { PublicKey } from '@solana/web3.js'; import { bn } from '../../../src/state'; describe('createCompressedAcc...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/tests/unit
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/tests/unit/state/bn254.test.ts
import { describe, it, expect } from 'vitest'; import { createBN254, encodeBN254toBase58 } from '../../../src/state/BN254'; import { bn } from '../../../src/state'; import { PublicKey } from '@solana/web3.js'; import { FIELD_SIZE } from '../../../src/constants'; describe('createBN254 function', () => { it('should ...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/tests/unit
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/tests/unit/instruction/pack-compressed-accounts.test.ts
import { describe, expect, it } from 'vitest'; import { PublicKey } from '@solana/web3.js'; import { padOutputStateMerkleTrees } from '../../../src/instruction/pack-compressed-accounts'; describe('padOutputStateMerkleTrees', () => { const treeA: any = PublicKey.unique(); const treeB: any = PublicKey.unique(); ...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/tests
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/tests/e2e/transfer.test.ts
import { describe, it, assert, beforeAll } from 'vitest'; import { Signer } from '@solana/web3.js'; import { newAccountWithLamports } from '../../src/utils/test-utils'; import { Rpc } from '../../src/rpc'; import { bn, compress } from '../../src'; import { transfer } from '../../src/actions/transfer'; import { getTestR...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/tests
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/tests/e2e/serde.test.ts
import { describe, it, expect } from 'vitest'; import { LightSystemProgram } from '../../src/programs'; import { CompressedAccount, PublicTransactionEvent, bn, useWallet, } from '../../src'; import { Connection, Keypair, PublicKey } from '@solana/web3.js'; import { AnchorProvider, Program, setProvider }...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/tests
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/tests/e2e/test-rpc.test.ts
import { describe, it, assert, beforeAll, expect } from 'vitest'; import { Signer } from '@solana/web3.js'; import { STATE_MERKLE_TREE_NETWORK_FEE, STATE_MERKLE_TREE_ROLLOVER_FEE, defaultTestStateTreeAccounts, } from '../../src/constants'; import { newAccountWithLamports } from '../../src/utils/test-utils';...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/tests
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/tests/e2e/compress.test.ts
import { describe, it, assert, beforeAll, expect } from 'vitest'; import { Signer } from '@solana/web3.js'; import { STATE_MERKLE_TREE_NETWORK_FEE, ADDRESS_QUEUE_ROLLOVER_FEE, STATE_MERKLE_TREE_ROLLOVER_FEE, defaultTestStateTreeAccounts, ADDRESS_TREE_NETWORK_FEE, } from '../../src/constants'; import...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/tests
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/tests/e2e/testnet.test.ts
import { describe, it, assert, beforeAll } from 'vitest'; import { Signer } from '@solana/web3.js'; import { newAccountWithLamports } from '../../src/utils/test-utils'; import { createRpc, Rpc } from '../../src/rpc'; import { bn, compress } from '../../src'; import { transfer } from '../../src/actions/transfer'; import...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/tests
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/tests/e2e/rpc-interop.test.ts
import { describe, it, assert, beforeAll, expect } from 'vitest'; import { PublicKey, Signer } from '@solana/web3.js'; import { newAccountWithLamports } from '../../src/utils/test-utils'; import { Rpc, createRpc } from '../../src/rpc'; import { LightSystemProgram, bn, compress, createAccount, create...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/tests/e2e
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/tests/e2e/browser/rpc.browser.spec.ts
import { test, expect } from '@playwright/test'; import { Rpc, bn, compress, createRpc, defaultTestStateTreeAccounts, newAccountWithLamports, } from '../../../src'; test.describe('RPC in browser', () => { const { merkleTree } = defaultTestStateTreeAccounts(); test.beforeAll(async ({ p...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/tests/e2e
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/tests/e2e/browser/test-page.html
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8" /> <title>Test Page</title> </head> <body> <!-- <script type="module" src="/dist/es/index.js"></script> --> <script type="module"> import * as stateless from '/dist/browser/index.js'; window...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/errors.ts
// TODO: Clean up export enum UtxoErrorCode { NEGATIVE_LAMPORTS = 'NEGATIVE_LAMPORTS', NOT_U64 = 'NOT_U64', BLINDING_EXCEEDS_FIELD_SIZE = 'BLINDING_EXCEEDS_FIELD_SIZE', } export enum SelectInUtxosErrorCode { FAILED_TO_FIND_UTXO_COMBINATION = 'FAILED_TO_FIND_UTXO_COMBINATION', INVALID_NUMBER_OF_IN_U...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/rpc.ts
import { Connection, ConnectionConfig, SolanaJSONRPCError, PublicKey, } from '@solana/web3.js'; import { Buffer } from 'buffer'; import { BalanceResult, CompressedAccountResult, CompressedAccountsByOwnerResult, CompressedProofWithContext, CompressedTokenAccountsByOwnerOrDelegateResul...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/constants.ts
import { BN } from '@coral-xyz/anchor'; import { Buffer } from 'buffer'; import { ConfirmOptions, PublicKey } from '@solana/web3.js'; export const FIELD_SIZE = new BN( '21888242871839275222246405745257275088548364400416034343698204186575808495617', ); export const HIGHEST_ADDRESS_PLUS_ONE = new BN( '4523128485...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/index.ts
export * from './actions'; export * from './idls'; export * from './instruction'; export * from './programs'; export * from './state'; export * from './utils'; export * from './wallet'; export * from './constants'; export * from './errors'; export * from './rpc-interface'; export * from './rpc'; export * from './test-h...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/rpc-interface.ts
import { PublicKey, MemcmpFilter, DataSlice } from '@solana/web3.js'; import { type as pick, number, string, array, literal, union, coerce, instance, create, unknown, any, nullable, Struct, } from 'superstruct'; import { BN254, createBN254, CompressedProof...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/utils/validation.ts
import { BN } from '@coral-xyz/anchor'; import { CompressedAccount, CompressedAccountWithMerkleContext, bn, } from '../state'; export const validateSufficientBalance = (balance: BN) => { if (balance.lt(bn(0))) { throw new Error('Not enough balance for transfer'); } }; export const validate...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/utils/pipe.ts
/** pipe function */ export function pipe<T, R>( initialFunction: (arg: T) => R, ...functions: ((arg: R) => R)[] ): (initialValue: T) => R { return (initialValue: T): R => functions.reduce( (currentValue, currentFunction) => currentFunction(currentValue), initialFunction(init...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/utils/airdrop.ts
import { Commitment, Connection, PublicKey, TransactionConfirmationStrategy, } from '@solana/web3.js'; export async function airdropSol({ connection, lamports, recipientPublicKey, }: { connection: Connection; lamports: number; recipientPublicKey: PublicKey; }) { const txHash...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/utils/sleep.ts
// zzz export function sleep(ms: number): Promise<void> { return new Promise(resolve => setTimeout(resolve, ms)); }
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/utils/calculate-compute-unit-price.ts
/** * @param targetLamports - Target priority fee in lamports * @param computeUnits - Expected compute units used by the transaction * @returns microLamports per compute unit (use in * `ComputeBudgetProgram.setComputeUnitPrice`) */ export function calculateComputeUnitPrice( targetLamports: number, computeU...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/utils/parse-validity-proof.ts
import { BN } from '@coral-xyz/anchor'; import { FIELD_SIZE } from '../constants'; import { CompressedProof } from '../state'; interface GnarkProofJson { ar: string[]; bs: string[][]; krs: string[]; } type ProofABC = { a: Uint8Array; b: Uint8Array; c: Uint8Array; }; export const placeholderVa...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/utils/test-utils.ts
import { Connection, Keypair, Signer } from '@solana/web3.js'; import { confirmTx } from '../utils/send-and-confirm'; import { Rpc } from '../rpc'; let c = 1; export const ALICE = getTestKeypair(255); export const BOB = getTestKeypair(254); export const CHARLIE = getTestKeypair(253); export const DAVE = getTestKeypai...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/utils/conversion.ts
import { Buffer } from 'buffer'; import { bn, createBN254 } from '../state/BN254'; import { FIELD_SIZE } from '../constants'; import { keccak_256 } from '@noble/hashes/sha3'; import { Keypair } from '@solana/web3.js'; import { BN } from '@coral-xyz/anchor'; export function byteArrayToKeypair(byteArray: number[]): Keyp...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/utils/send-and-confirm.ts
import { VersionedTransaction, TransactionConfirmationStrategy, SignatureResult, RpcResponseAndContext, Signer, TransactionInstruction, TransactionMessage, ConfirmOptions, TransactionSignature, PublicKey, AddressLookupTableAccount, } from '@solana/web3.js'; import { Rpc } fro...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/utils/index.ts
export * from './address'; export * from './airdrop'; export * from './conversion'; export * from './parse-validity-proof'; export * from './pipe'; export * from './send-and-confirm'; export * from './sleep'; export * from './test-utils'; export * from './validation'; export * from './calculate-compute-unit-price';
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/utils/address.ts
import { AccountMeta, PublicKey } from '@solana/web3.js'; import { hashToBn254FieldSizeBe, hashvToBn254FieldSizeBe } from './conversion'; import { defaultTestStateTreeAccounts } from '../constants'; import { getIndexOrAdd } from '../instruction'; export function deriveAddressSeed( seeds: Uint8Array[], programI...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/state/compressed-account.ts
import { BN } from '@coral-xyz/anchor'; import { PublicKey } from '@solana/web3.js'; import { CompressedAccount, CompressedAccountData } from './types'; import { BN254, bn } from './BN254'; export type CompressedAccountWithMerkleContext = CompressedAccount & MerkleContext & { readOnly: boolean; }; /**...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/state/types.ts
import { BN } from '@coral-xyz/anchor'; import { PublicKey } from '@solana/web3.js'; import { Buffer } from 'buffer'; import { NewAddressParamsPacked } from '../utils'; export interface PackedCompressedAccountWithMerkleContext { compressedAccount: CompressedAccount; merkleContext: PackedMerkleContext; root...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/state/index.ts
export * from './BN254'; export * from './compressed-account'; export * from './types';
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/state/BN254.ts
// TODO: consider implementing BN254 as wrapper class around _BN mirroring // PublicKey this would encapsulate our runtime checks and also enforce // typesafety at compile time import { FIELD_SIZE } from '../constants'; import { PublicKey } from '@solana/web3.js'; import { BN } from '@coral-xyz/anchor'; import { bs58 ...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/idls/account_compression.ts
export type AccountCompression = { version: '1.2.0'; name: 'account_compression'; constants: [ { name: 'CPI_AUTHORITY_PDA_SEED'; type: 'bytes'; value: '[99, 112, 105, 95, 97, 117, 116, 104, 111, 114, 105, 116, 121]'; }, { name: 'GROUP_A...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/idls/light_system_program.ts
export type LightSystemProgram = { version: '1.2.0'; name: 'light_system_program'; constants: [ { name: 'SOL_POOL_PDA_SEED'; type: 'bytes'; value: '[115, 111, 108, 95, 112, 111, 111, 108, 95, 112, 100, 97]'; }, ]; instructions: [ { ...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/idls/index.ts
import { IDL as AccountCompressionIDL, AccountCompression, } from './account_compression'; import { IDL as LightRegistryIDL, LightRegistry } from './light_registry'; import { IDL as LightSystemIDL, LightSystemProgram as LightSystem, } from './light_system_program'; import { IDL as LightCompressedT...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/idls/light_registry.ts
export type LightRegistry = { version: '1.2.0'; name: 'light_registry'; constants: [ { name: 'FORESTER_SEED'; type: 'bytes'; value: '[102, 111, 114, 101, 115, 116, 101, 114]'; }, { name: 'FORESTER_EPOCH_SEED'; type: 'bytes';...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/idls/light_compressed_token.ts
export type LightCompressedToken = { version: '1.2.0'; name: 'light_compressed_token'; instructions: [ { name: 'createTokenPool'; docs: [ 'This instruction creates a token pool for a given mint. Every spl mint', 'can have one token pool. When a...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/programs/index.ts
export * from './system';
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/programs/system.ts
import { Program, AnchorProvider, setProvider, BN } from '@coral-xyz/anchor'; import { PublicKey, Keypair, Connection, TransactionInstruction, SystemProgram, } from '@solana/web3.js'; import { Buffer } from 'buffer'; import { IDL, LightSystemProgram as LightSystemProgramIDL, } from '../idls...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/actions/create-account.ts
import { ComputeBudgetProgram, ConfirmOptions, PublicKey, Signer, TransactionSignature, } from '@solana/web3.js'; import { LightSystemProgram, selectMinCompressedSolAccountsForTransfer, } from '../programs'; import { Rpc } from '../rpc'; import { NewAddressParams, buildAndSignTx, ...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/actions/compress.ts
import { ComputeBudgetProgram, ConfirmOptions, PublicKey, Signer, TransactionSignature, } from '@solana/web3.js'; import { LightSystemProgram } from '../programs'; import { Rpc } from '../rpc'; import { buildAndSignTx, sendAndConfirmTx } from '../utils'; import { BN } from '@coral-xyz/anchor'; impo...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/actions/common.ts
import { Signer } from '@solana/web3.js'; /** @internal remove signer from signers if part of signers */ export function dedupeSigner(signer: Signer, signers: Signer[]): Signer[] { if (signers.includes(signer)) { return signers.filter( s => s.publicKey.toString() !== signer.publicKey.toString()...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/actions/transfer.ts
import { ComputeBudgetProgram, ConfirmOptions, PublicKey, Signer, TransactionSignature, } from '@solana/web3.js'; import { BN } from '@coral-xyz/anchor'; import { LightSystemProgram, selectMinCompressedSolAccountsForTransfer, } from '../programs'; import { Rpc } from '../rpc'; import { bn,...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/actions/index.ts
export * from './compress'; export * from './create-account'; export * from './decompress'; export * from './common'; export * from './transfer';
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/actions/decompress.ts
import { ComputeBudgetProgram, ConfirmOptions, PublicKey, Signer, TransactionSignature, } from '@solana/web3.js'; import { LightSystemProgram, sumUpLamports } from '../programs'; import { Rpc } from '../rpc'; import { buildAndSignTx, sendAndConfirmTx } from '../utils'; import { BN } from '@coral-xyz...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/wallet/interface.ts
/// TODO: extract wallet into its own npm package import { Commitment, Connection, Keypair, VersionedTransaction, sendAndConfirmTransaction, } from '@solana/web3.js'; import { PublicKey, Transaction } from '@solana/web3.js'; import nacl from 'tweetnacl'; const { sign } = nacl; export type Inclusion...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/wallet/index.ts
export * from './use-wallet';
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/wallet/use-wallet.ts
import { Keypair, Commitment } from '@solana/web3.js'; import { Wallet } from './interface'; // TODO consider adding isNodeWallet export const useWallet = ( keypair: Keypair, url: string = 'http://127.0.0.1:8899', commitment: Commitment = 'confirmed', ) => { url = url !== 'mock' ? url : 'http://127.0.0...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/instruction/index.ts
export * from './pack-compressed-accounts';
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/instruction/pack-compressed-accounts.ts
import { AccountMeta, PublicKey } from '@solana/web3.js'; import { CompressedAccount, OutputCompressedAccountWithPackedContext, PackedCompressedAccountWithMerkleContext, } from '../state'; import { CompressedAccountWithMerkleContext } from '../state/compressed-account'; import { toArray } from '../utils/con...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/test-helpers/index.ts
export * from './merkle-tree'; export * from './test-rpc';
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/test-helpers
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/test-helpers/merkle-tree/merkle-tree.ts
import { LightWasm } from '../test-rpc/test-rpc'; export const DEFAULT_ZERO = '0'; /** * @callback hashFunction * @param left Left leaf * @param right Right leaf */ /** * Merkle tree */ export class MerkleTree { /** * Constructor * @param {number} levels Number of levels in the tree * @param ...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/test-helpers
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/test-helpers/merkle-tree/indexed-array.ts
import { LightWasm } from '../test-rpc/test-rpc'; import { BN } from '@coral-xyz/anchor'; import { bn } from '../../state'; import { HIGHEST_ADDRESS_PLUS_ONE } from '../../constants'; export class IndexedElement { public index: number; public value: BN; public nextIndex: number; constructor(index: num...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/test-helpers
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/test-helpers/merkle-tree/index.ts
export * from './indexed-array'; export * from './merkle-tree';
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/test-helpers
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/test-helpers/test-rpc/get-compressed-accounts.ts
import { PublicKey } from '@solana/web3.js'; import { BN } from '@coral-xyz/anchor'; import { getParsedEvents } from './get-parsed-events'; import { defaultTestStateTreeAccounts } from '../../constants'; import { Rpc } from '../../rpc'; import { CompressedAccountWithMerkleContext, bn, MerkleContext, cr...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/test-helpers
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/test-helpers/test-rpc/get-compressed-token-accounts.ts
import { PublicKey } from '@solana/web3.js'; import { getParsedEvents } from './get-parsed-events'; import { BN, BorshCoder } from '@coral-xyz/anchor'; import { IDL } from '../../idls/light_compressed_token'; import { defaultTestStateTreeAccounts } from '../../constants'; import { Rpc } from '../../rpc'; import { Pars...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/test-helpers
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/test-helpers/test-rpc/test-rpc.ts
import { Connection, ConnectionConfig, PublicKey } from '@solana/web3.js'; import { BN } from '@coral-xyz/anchor'; import { getCompressedAccountByHashTest, getCompressedAccountsByOwnerTest, getMultipleCompressedAccountsByHashTest, } from './get-compressed-accounts'; import { getCompressedTokenAccountByH...
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/test-helpers
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/test-helpers/test-rpc/index.ts
export * from './test-rpc'; export * from './get-parsed-events'; export * from './get-compressed-token-accounts';
0
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/test-helpers
solana_public_repos/Lightprotocol/light-protocol/js/stateless.js/src/test-helpers/test-rpc/get-parsed-events.ts
import { ParsedMessageAccount, ParsedTransactionWithMeta, } from '@solana/web3.js'; import { bs58 } from '@coral-xyz/anchor/dist/cjs/utils/bytes'; import { defaultStaticAccountsStruct } from '../../constants'; import { LightSystemProgram } from '../../programs'; import { Rpc } from '../../rpc'; import { PublicT...
0
solana_public_repos/Lightprotocol/light-protocol/js
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/rollup.config.js
import typescript from '@rollup/plugin-typescript'; import nodePolyfills from 'rollup-plugin-polyfill-node'; import dts from 'rollup-plugin-dts'; import resolve from '@rollup/plugin-node-resolve'; import commonjs from '@rollup/plugin-commonjs'; import alias from '@rollup/plugin-alias'; import json from '@rollup/plugin-...
0
solana_public_repos/Lightprotocol/light-protocol/js
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tsconfig.test.json
{ "compilerOptions": { "esModuleInterop": true, "rootDirs": ["src", "tests"] }, "extends": "./tsconfig.json", "include": ["./tests/**/*.ts", "vitest.config.ts"] }
0
solana_public_repos/Lightprotocol/light-protocol/js
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/package.json
{ "name": "@lightprotocol/compressed-token", "version": "0.16.0", "description": "JS client to interact with the compressed-token program", "sideEffects": false, "main": "dist/cjs/node/index.cjs", "type": "module", "exports": { ".": { "require": "./dist/cjs/node/index.cjs...
0
solana_public_repos/Lightprotocol/light-protocol/js
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/.prettierrc
{ "semi": true, "trailingComma": "all", "singleQuote": true, "printWidth": 80, "useTabs": false, "tabWidth": 4, "bracketSpacing": true, "arrowParens": "avoid" }
0
solana_public_repos/Lightprotocol/light-protocol/js
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tsconfig.json
{ "$schema": "https://json.schemastore.org/tsconfig", "compilerOptions": { "importHelpers": true, "outDir": "./dist", "esModuleInterop": true, "allowSyntheticDefaultImports": true, "strict": true, "declaration": false, "target": "ESNext", "module":...
0
solana_public_repos/Lightprotocol/light-protocol/js
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/.eslintignore
node_modules lib dist
0
solana_public_repos/Lightprotocol/light-protocol/js
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/vitest.config.ts
import { defineConfig } from 'vitest/config'; import { resolve } from 'path'; export default defineConfig({ logLevel: 'info', test: { include: process.env.EXCLUDE_E2E ? [] : ['src/**/__tests__/*.test.ts', 'tests/**/*.test.ts'], includeSource: ['src/**/*.{js,ts}'], ...
0