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/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/README.md | <p align="center">
<img src="https://github.com/ldiego08/light-protocol/raw/main/assets/logo.svg" width="90" />
</p>
<h1 align="center">@lightprotocol/compressed-token</h1>
<p align="center">
<b>This is the JavaScript SDK for interacting with the Compressed Token program on Solana.</b>
</p>
<p align="center">
... | 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 |
solana_public_repos/Lightprotocol/light-protocol/js | solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/.eslintrc.json | {
"root": true,
"ignorePatterns": ["node_modules", "lib"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": ["./tsconfig.json", "./tsconfig.test.json"]
},
"plugins": ["@typescript-eslint"],
"extends": [
"eslint:recommended",
"plugin:@typescript-esl... | 0 |
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests | solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests/e2e/approve-and-mint-to.test.ts | import { describe, it, expect, beforeAll, assert } from 'vitest';
import { PublicKey, Signer, Keypair, SystemProgram } from '@solana/web3.js';
import {
MINT_SIZE,
TOKEN_2022_PROGRAM_ID,
TOKEN_PROGRAM_ID,
createInitializeMint2Instruction,
} from '@solana/spl-token';
import { approveAndMintTo, createToken... | 0 |
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests | solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests/e2e/merge-token-accounts.test.ts | import { describe, it, expect, beforeAll, beforeEach } from 'vitest';
import { PublicKey, Keypair, Signer } from '@solana/web3.js';
import {
Rpc,
bn,
defaultTestStateTreeAccounts,
newAccountWithLamports,
getTestRpc,
} from '@lightprotocol/stateless.js';
import { WasmFactory } from '@lightprotocol/ha... | 0 |
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests | solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests/e2e/create-mint.test.ts | import { describe, it, expect, beforeAll, assert } from 'vitest';
import { CompressedTokenProgram } from '../../src/program';
import { PublicKey, Signer, Keypair } from '@solana/web3.js';
import { unpackMint, unpackAccount } from '@solana/spl-token';
import { createMint } from '../../src/actions';
import {
Rpc,
... | 0 |
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests | solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests/e2e/transfer.test.ts | import { describe, it, expect, beforeAll, beforeEach, assert } from 'vitest';
import { PublicKey, Keypair, Signer } from '@solana/web3.js';
import { BN } from '@coral-xyz/anchor';
import {
ParsedTokenAccount,
Rpc,
bn,
defaultTestStateTreeAccounts,
newAccountWithLamports,
getTestRpc,
} from '@lig... | 0 |
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests | solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests/e2e/compress.test.ts | import { describe, it, expect, beforeAll } from 'vitest';
import {
PublicKey,
Keypair,
Signer,
ComputeBudgetProgram,
} from '@solana/web3.js';
import { BN } from '@coral-xyz/anchor';
import {
ParsedTokenAccount,
Rpc,
bn,
defaultTestStateTreeAccounts,
newAccountWithLamports,
dedup... | 0 |
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests | solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests/e2e/mint-to.test.ts | import { describe, it, expect, beforeAll } from 'vitest';
import {
PublicKey,
Signer,
Keypair,
ComputeBudgetProgram,
} from '@solana/web3.js';
import { BN } from '@coral-xyz/anchor';
import {
createMint,
createTokenProgramLookupTable,
mintTo,
} from '../../src/actions';
import {
getTest... | 0 |
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests | solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests/e2e/decompress.test.ts | import { describe, it, expect, beforeAll } from 'vitest';
import { PublicKey, Keypair, Signer } from '@solana/web3.js';
import { BN } from '@coral-xyz/anchor';
import {
ParsedTokenAccount,
Rpc,
bn,
defaultTestStateTreeAccounts,
newAccountWithLamports,
getTestRpc,
} from '@lightprotocol/stateless... | 0 |
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests | solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests/e2e/custom-program-id.test.ts | import { describe, it, expect } from 'vitest';
import { CompressedTokenProgram } from '../../src/program';
import { PublicKey } from '@solana/web3.js';
describe('custom programId', () => {
it('should switch programId', async () => {
const defaultProgramId = new PublicKey(
'cTokenmWW8bLPjZEBAUgY... | 0 |
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests | solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests/e2e/compress-spl-token-account.test.ts | import { describe, it, expect, beforeAll, assert } from 'vitest';
import { PublicKey, Keypair, Signer } from '@solana/web3.js';
import {
Rpc,
bn,
defaultTestStateTreeAccounts,
newAccountWithLamports,
getTestRpc,
} from '@lightprotocol/stateless.js';
import {
createMint,
decompress,
mintT... | 0 |
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests | solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests/e2e/rpc-token-interop.test.ts | import { describe, it, assert, beforeAll } from 'vitest';
import { Keypair, PublicKey, Signer } from '@solana/web3.js';
import {
Rpc,
newAccountWithLamports,
bn,
createRpc,
getTestRpc,
TestRpc,
} from '@lightprotocol/stateless.js';
import { WasmFactory } from '@lightprotocol/hasher.rs';
import {... | 0 |
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests | solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/tests/e2e/create-token-pool.test.ts | import { describe, it, expect, beforeAll, assert } from 'vitest';
import { CompressedTokenProgram } from '../../src/program';
import { PublicKey, Signer, Keypair, SystemProgram } from '@solana/web3.js';
import {
unpackMint,
unpackAccount,
MINT_SIZE,
TOKEN_PROGRAM_ID,
createInitializeMint2Instruction... | 0 |
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token | solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/program.ts | import {
PublicKey,
Keypair,
TransactionInstruction,
SystemProgram,
Connection,
AddressLookupTableProgram,
AccountMeta,
} from '@solana/web3.js';
import { BN, Program, AnchorProvider, setProvider } from '@coral-xyz/anchor';
import { IDL, LightCompressedToken } from './idl/light_compressed_to... | 0 |
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token | solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/types.ts | import { PublicKey } from '@solana/web3.js';
import { BN } from '@coral-xyz/anchor';
import { CompressedProof } from '@lightprotocol/stateless.js';
/// TODO: remove index_mt_account on-chain. passed as part of
/// CompressedTokenInstructionDataInvoke
export type TokenTransferOutputData = {
/**
* The owner of ... | 0 |
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token | solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/constants.ts | export const POOL_SEED = Buffer.from('pool');
export const CPI_AUTHORITY_SEED = Buffer.from('cpi_authority');
export const SPL_TOKEN_MINT_RENT_EXEMPT_BALANCE = 1461600;
| 0 |
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token | solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/index.ts | export * from './idl';
export * from './instructions';
export * from './constants';
export * from './program';
export * from './types';
export * from './actions';
| 0 |
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src | solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/idl/index.ts | export * from './light_compressed_token';
| 0 |
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src | solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/idl/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/compressed-token/src | solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/instructions/pack-compressed-token-accounts.ts | import {
ParsedTokenAccount,
InputTokenDataWithContext,
getIndexOrAdd,
bn,
padOutputStateMerkleTrees,
TokenTransferOutputData,
} from '@lightprotocol/stateless.js';
import { PublicKey, AccountMeta } from '@solana/web3.js';
import { PackedTokenTransferOutputData } from '../types';
export type Pa... | 0 |
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src | solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/instructions/index.ts | export * from './pack-compressed-token-accounts';
| 0 |
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src | solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/actions/create-token-pool.ts | import {
ConfirmOptions,
PublicKey,
Signer,
TransactionSignature,
} from '@solana/web3.js';
import { CompressedTokenProgram } from '../program';
import {
Rpc,
buildAndSignTx,
sendAndConfirmTx,
} from '@lightprotocol/stateless.js';
/**
* Register an existing mint with the CompressedToken pr... | 0 |
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src | solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/actions/create-mint.ts | import {
ConfirmOptions,
Keypair,
PublicKey,
Signer,
TransactionSignature,
} from '@solana/web3.js';
import { CompressedTokenProgram } from '../program';
import {
MINT_SIZE,
TOKEN_2022_PROGRAM_ID,
TOKEN_PROGRAM_ID,
} from '@solana/spl-token';
import {
Rpc,
buildAndSignTx,
sen... | 0 |
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src | solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/actions/create-token-program-lookup-table.ts | import { PublicKey, Signer, TransactionSignature } from '@solana/web3.js';
import {
sendAndConfirmTx,
buildAndSignTx,
Rpc,
dedupeSigner,
} from '@lightprotocol/stateless.js';
import { CompressedTokenProgram } from '../program';
/**
* Create a lookup table for the token program's default accounts
*
... | 0 |
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src | solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/actions/mint-to.ts | import {
ComputeBudgetProgram,
ConfirmOptions,
PublicKey,
Signer,
TransactionSignature,
} from '@solana/web3.js';
import { BN } from '@coral-xyz/anchor';
import {
sendAndConfirmTx,
buildAndSignTx,
Rpc,
dedupeSigner,
} from '@lightprotocol/stateless.js';
import { CompressedTokenProgra... | 0 |
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src | solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/actions/compress.ts | import {
ConfirmOptions,
PublicKey,
Signer,
TransactionSignature,
ComputeBudgetProgram,
} from '@solana/web3.js';
import {
sendAndConfirmTx,
buildAndSignTx,
Rpc,
dedupeSigner,
} from '@lightprotocol/stateless.js';
import { BN } from '@coral-xyz/anchor';
import { CompressedTokenProg... | 0 |
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src | solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/actions/merge-token-accounts.ts | import {
ComputeBudgetProgram,
ConfirmOptions,
PublicKey,
Signer,
TransactionSignature,
} from '@solana/web3.js';
import {
Rpc,
dedupeSigner,
buildAndSignTx,
sendAndConfirmTx,
bn,
} from '@lightprotocol/stateless.js';
import { CompressedTokenProgram } from '../program';
/**
* M... | 0 |
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src | solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/actions/transfer.ts | import {
ComputeBudgetProgram,
ConfirmOptions,
PublicKey,
Signer,
TransactionSignature,
} from '@solana/web3.js';
import {
bn,
sendAndConfirmTx,
buildAndSignTx,
Rpc,
ParsedTokenAccount,
dedupeSigner,
} from '@lightprotocol/stateless.js';
import { BN } from '@coral-xyz/anchor... | 0 |
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src | solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/actions/approve-and-mint-to.ts | import {
ComputeBudgetProgram,
ConfirmOptions,
PublicKey,
Signer,
TransactionSignature,
} from '@solana/web3.js';
import { BN } from '@coral-xyz/anchor';
import {
sendAndConfirmTx,
buildAndSignTx,
Rpc,
dedupeSigner,
} from '@lightprotocol/stateless.js';
import { CompressedTokenProgra... | 0 |
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src | solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/actions/compress-spl-token-account.ts | import {
ConfirmOptions,
PublicKey,
Signer,
TransactionSignature,
ComputeBudgetProgram,
} from '@solana/web3.js';
import {
sendAndConfirmTx,
buildAndSignTx,
Rpc,
dedupeSigner,
} from '@lightprotocol/stateless.js';
import { BN } from '@coral-xyz/anchor';
import { CompressedTokenProg... | 0 |
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src | solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/actions/index.ts | export * from './approve-and-mint-to';
export * from './compress';
export * from './decompress';
export * from './create-mint';
export * from './mint-to';
export * from './merge-token-accounts';
export * from './create-token-pool';
export * from './transfer';
export * from './create-token-program-lookup-table';
export ... | 0 |
solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src | solana_public_repos/Lightprotocol/light-protocol/js/compressed-token/src/actions/decompress.ts | import {
ComputeBudgetProgram,
ConfirmOptions,
PublicKey,
Signer,
TransactionSignature,
} from '@solana/web3.js';
import {
bn,
sendAndConfirmTx,
buildAndSignTx,
Rpc,
dedupeSigner,
} from '@lightprotocol/stateless.js';
import { BN } from '@coral-xyz/anchor';
import { CompressedT... | 0 |
solana_public_repos/Lightprotocol/light-protocol | solana_public_repos/Lightprotocol/light-protocol/tsconfig/README.md | # `tsconfig`
These are base shared `tsconfig.json`s from which all other `tsconfig.json`'s inherit from. | 0 |
solana_public_repos/Lightprotocol/light-protocol | solana_public_repos/Lightprotocol/light-protocol/tsconfig/package.json | {
"name": "@lightprotocol/tsconfig",
"version": "0.0.0",
"private": true,
"files": [
"base.json"
]
}
| 0 |
solana_public_repos/Lightprotocol/light-protocol | solana_public_repos/Lightprotocol/light-protocol/tsconfig/base.json | {
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Default",
"compilerOptions": {
"composite": false,
"declaration": true,
"declarationMap": true,
"forceConsistentCasingInFileNames": true,
"inlineSources": false,
"isolatedModules": true,
"moduleResolution": "node",
"... | 0 |
solana_public_repos/Lightprotocol/light-protocol | solana_public_repos/Lightprotocol/light-protocol/utils/Cargo.toml | [package]
name = "light-utils"
version = "1.1.0"
description = "Common utility functions used in Light Protocol"
repository = "https://github.com/Lightprotocol/light-protocol"
license = "Apache-2.0"
edition = "2021"
[dependencies]
anyhow = "1.0"
ark-ff = "0.4"
light-bounded-vec = { version = "1.1.0", path = "../merkle... | 0 |
solana_public_repos/Lightprotocol/light-protocol/utils | solana_public_repos/Lightprotocol/light-protocol/utils/src/bigint.rs | use num_bigint::BigUint;
use crate::UtilsError;
/// Converts the given [`num_bigint::BigUint`](num_bigint::BigUint) into a little-endian
/// byte array.
pub fn bigint_to_le_bytes_array<const BYTES_SIZE: usize>(
bigint: &BigUint,
) -> Result<[u8; BYTES_SIZE], UtilsError> {
let mut array = [0u8; BYTES_SIZE];
... | 0 |
solana_public_repos/Lightprotocol/light-protocol/utils | solana_public_repos/Lightprotocol/light-protocol/utils/src/fee.rs | use crate::UtilsError;
pub fn compute_rollover_fee(
rollover_threshold: u64,
tree_height: u32,
rent: u64,
) -> Result<u64, UtilsError> {
let number_of_transactions = 1 << tree_height;
if rollover_threshold > 100 {
return Err(UtilsError::InvalidRolloverThreshold);
}
if rollover_thres... | 0 |
solana_public_repos/Lightprotocol/light-protocol/utils | solana_public_repos/Lightprotocol/light-protocol/utils/src/lib.rs | use std::{
env,
io::{self, prelude::*},
process::{Command, Stdio},
thread::spawn,
};
use ark_ff::PrimeField;
use num_bigint::BigUint;
use solana_program::keccak::hashv;
use thiserror::Error;
pub mod bigint;
pub mod fee;
pub mod offset;
pub mod prime;
pub mod rand;
#[derive(Debug, Error, PartialEq)]
... | 0 |
solana_public_repos/Lightprotocol/light-protocol/utils | solana_public_repos/Lightprotocol/light-protocol/utils/src/prime.rs | /// Finds the lowest prime number which is greater than the provided number
/// `n`.
pub fn find_next_prime(mut n: u32) -> u32 {
// Handle small numbers separately
if n <= 2 {
return 2;
} else if n <= 3 {
return 3;
}
// All prime numbers greater than 3 are of the form 6k + 1 or 6k +... | 0 |
solana_public_repos/Lightprotocol/light-protocol/utils | solana_public_repos/Lightprotocol/light-protocol/utils/src/rand.rs | use std::ops::{Bound, RangeBounds};
use rand::{
distributions::uniform::{SampleRange, SampleUniform},
Rng,
};
use crate::prime::find_next_prime;
const PRIME_RETRIES: usize = 10;
/// Generates a random prime number in the given range. It returns `None` when
/// generating such number was not possible.
pub fn... | 0 |
solana_public_repos/Lightprotocol/light-protocol/utils/src | solana_public_repos/Lightprotocol/light-protocol/utils/src/offset/copy.rs | use std::{mem, ptr};
use light_bounded_vec::{
BoundedVec, BoundedVecMetadata, CyclicBoundedVec, CyclicBoundedVecMetadata,
};
/// Creates a copy of value of type `T` based on the provided `bytes` buffer.
///
/// # Safety
///
/// This is higly unsafe. This function doesn't ensure alignment and
/// correctness of pr... | 0 |
solana_public_repos/Lightprotocol/light-protocol/utils/src | solana_public_repos/Lightprotocol/light-protocol/utils/src/offset/zero_copy.rs | use std::mem;
/// Casts a part of provided `bytes` buffer with the given `offset` to a
/// mutable pointer to `T`.
///
/// Should be used for single values.
///
/// # Safety
///
/// This is higly unsafe. This function doesn't ensure alignment and
/// correctness of provided buffer. The responsibility of such checks is... | 0 |
solana_public_repos/Lightprotocol/light-protocol/utils/src | solana_public_repos/Lightprotocol/light-protocol/utils/src/offset/mod.rs | pub mod copy;
pub mod zero_copy;
| 0 |
solana_public_repos/Lightprotocol/light-protocol/circuit-lib | solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/Cargo.toml | [package]
name = "light-prover-client"
version = "1.2.0"
description = "Crate for interacting with Light Protocol circuits"
repository = "https://github.com/Lightprotocol/light-protocol"
license = "Apache-2.0"
edition = "2021"
[features]
gnark = ["tokio", "reqwest"]
default = ["gnark", "devenv"]
devenv = []
[dependen... | 0 |
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client | solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/tests/gnark.rs | use light_hasher::{Hasher, Poseidon};
use light_merkle_tree_reference::MerkleTree;
use light_prover_client::batch_append_with_proofs::get_batch_append_with_proofs_inputs;
use light_prover_client::batch_append_with_subtrees::{
calculate_hash_chain, get_batch_append_with_subtrees_inputs,
};
use light_prover_client::b... | 0 |
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client | solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/scripts/rapidsnark_bench.sh | #!/bin/bash
LOG_FILE="execution_times.log"
echo "Benchmarking started..." >> $LOG_FILE
for ((i=1; i<10; i++))
do
echo "Running iteration $i"
work_dir="test-data/merkle22_$i"
start_time=$(date +%s%6N)
prover "$work_dir/circuit.zkey" "$work_dir/22_$i.wtns" "$work_dir/proof_merkle22_$i.json" "$work_dir/p... | 0 |
solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client | solana_public_repos/Lightprotocol/light-protocol/circuit-lib/light-prover-client/src/prove_utils.rs | use groth16_solana::decompression::{decompress_g1, decompress_g2};
use crate::errors::CircuitsError;
pub struct ProofResult {
pub proof: ProofCompressed,
pub public_inputs: Vec<[u8; 32]>,
}
#[derive(Debug)]
pub struct ProofCompressed {
pub a: [u8; 32],
pub b: [u8; 64],
pub c: [u8; 32],
}
impl Pr... | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.