@lightprotocol/stateless.js 0.20.2 → 0.20.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,4 +9,3 @@ export * from './rpc-interface';
9
9
  export * from './rpc';
10
10
  export * from './test-helpers';
11
11
  export { LightSystemProgram as LightSystemProgramIDL, IDL } from './idl';
12
- export * from './logger';
@@ -656,8 +656,8 @@ export declare const NewAddressProofResult: Struct<{
656
656
  export declare const ValidityProofResult: Struct<{
657
657
  compressedProof: {
658
658
  a: number[];
659
- b: number[];
660
659
  c: number[];
660
+ b: number[];
661
661
  };
662
662
  leafIndices: number[];
663
663
  leaves: BN[];
@@ -667,8 +667,8 @@ export declare const ValidityProofResult: Struct<{
667
667
  }, {
668
668
  compressedProof: Struct<{
669
669
  a: number[];
670
- b: number[];
671
670
  c: number[];
671
+ b: number[];
672
672
  }, {
673
673
  a: Struct<number[], Struct<number, null>>;
674
674
  b: Struct<number[], Struct<number, null>>;
@@ -9,6 +9,9 @@ export declare function byteArrayToKeypair(byteArray: number[]): Keypair;
9
9
  export declare function toHex(bn: BN): string;
10
10
  export declare const toArray: <T>(value: T | T[]) => T[];
11
11
  export declare const bufToDecStr: (buf: Buffer) => string;
12
+ export declare function isSmallerThanBn254FieldSizeBe(bytes: Buffer): boolean;
13
+ export declare const toCamelCase: (object: any) => any;
14
+ /**
12
15
  /**
13
16
  * Hash the provided `bytes` with Keccak256 and ensure the result fits in the
14
17
  * BN254 prime field by repeatedly hashing the inputs with various "bump seeds"
@@ -28,4 +31,3 @@ export declare function hashToBn254FieldSizeBe(bytes: Buffer): [Buffer, number]
28
31
  export declare function hashvToBn254FieldSizeBe(bytes: Uint8Array[]): Uint8Array;
29
32
  /** Mutates array in place */
30
33
  export declare function pushUniqueItems<T>(items: T[], map: T[]): void;
31
- export declare function toCamelCase(obj: Array<any> | unknown | any): Array<any> | unknown | any;
@@ -2,3 +2,7 @@ import BN from 'bn.js';
2
2
  import { CompressedAccount, CompressedAccountWithMerkleContext } from '../state';
3
3
  export declare const validateSufficientBalance: (balance: BN) => void;
4
4
  export declare const validateSameOwner: (compressedAccounts: CompressedAccount[] | CompressedAccountWithMerkleContext[]) => void;
5
+ export declare const validateNumbersForProof: (hashesLength: number, newAddressesLength: number) => void;
6
+ export declare const validateNumbersForInclusionProof: (hashesLength: number) => void;
7
+ export declare const validateNumbersForNonInclusionProof: (newAddressesLength: number) => void;
8
+ export declare const validateNumbers: (length: number, allowedNumbers: number[], type: string) => void;
@@ -97,6 +97,9 @@ declare function byteArrayToKeypair(byteArray: number[]): Keypair;
97
97
  declare function toHex(bn: BN): string;
98
98
  declare const toArray: <T>(value: T | T[]) => T[];
99
99
  declare const bufToDecStr: (buf: Buffer$1) => string;
100
+ declare function isSmallerThanBn254FieldSizeBe(bytes: Buffer$1): boolean;
101
+ declare const toCamelCase: (object: any) => any;
102
+ /**
100
103
  /**
101
104
  * Hash the provided `bytes` with Keccak256 and ensure the result fits in the
102
105
  * BN254 prime field by repeatedly hashing the inputs with various "bump seeds"
@@ -116,7 +119,6 @@ declare function hashToBn254FieldSizeBe(bytes: Buffer$1): [Buffer$1, number] | n
116
119
  declare function hashvToBn254FieldSizeBe(bytes: Uint8Array[]): Uint8Array;
117
120
  /** Mutates array in place */
118
121
  declare function pushUniqueItems<T>(items: T[], map: T[]): void;
119
- declare function toCamelCase(obj: Array<any> | unknown | any): Array<any> | unknown | any;
120
122
 
121
123
  interface GnarkProofJson {
122
124
  ar: string[];
@@ -195,6 +197,10 @@ declare function sleep(ms: number): Promise<void>;
195
197
 
196
198
  declare const validateSufficientBalance: (balance: BN) => void;
197
199
  declare const validateSameOwner: (compressedAccounts: CompressedAccount[] | CompressedAccountWithMerkleContext[]) => void;
200
+ declare const validateNumbersForProof: (hashesLength: number, newAddressesLength: number) => void;
201
+ declare const validateNumbersForInclusionProof: (hashesLength: number) => void;
202
+ declare const validateNumbersForNonInclusionProof: (newAddressesLength: number) => void;
203
+ declare const validateNumbers: (length: number, allowedNumbers: number[], type: string) => void;
198
204
 
199
205
  /**
200
206
  * @param targetLamports - Target priority fee in lamports
@@ -3998,6 +4004,4 @@ type LightSystemProgram = {
3998
4004
  };
3999
4005
  declare const IDL: LightSystemProgram;
4000
4006
 
4001
- declare const logger: any;
4002
-
4003
- export { ADDRESS_QUEUE_ROLLOVER_FEE, ADDRESS_TREE_NETWORK_FEE, ALICE, AccountProofResult, type ActiveTreeBundle, type AddressWithTree, AppendLeavesInputLayout, AppendNullifyCreateAddressInputsMetaLayout, type BN254, BOB, BalanceResult, CHARLIE, COMPUTE_BUDGET_PATTERN, type ClientSubscriptionId, type CompressedAccount, type CompressedAccountData, CompressedAccountLayout, CompressedAccountResult, type CompressedAccountWithMerkleContext, CompressedAccountsByOwnerResult, type CompressedCpiContext, type CompressedMintTokenHolders, CompressedMintTokenHoldersResult, type CompressedProof, type CompressedProofWithContext, CompressedTokenAccountResult, CompressedTokenAccountsByOwnerOrDelegateResult, type CompressedTransaction, CompressedTransactionResult, type CompressionApiInterface, CreateUtxoError, CreateUtxoErrorCode, DAVE, DEFAULT_MERKLE_TREE_HEIGHT, DEFAULT_MERKLE_TREE_ROOTS, DEFAULT_ZERO, type EventWithParsedTokenTlvData, FIELD_SIZE, type GetCompressedAccountConfig, type GetCompressedAccountsByOwnerConfig, type GetCompressedAccountsConfig, type GetCompressedAccountsFilter, type GetCompressedTokenAccountsByOwnerOrDelegateOptions, HIGHEST_ADDRESS_PLUS_ONE, HashError, HashErrorCode, type HashWithTree, HealthResult, type HexBatchInputsForProver, type HexInputsForProver, IDL, INSERT_INTO_QUEUES_DISCRIMINATOR, INVOKE_CPI_DISCRIMINATOR, INVOKE_DISCRIMINATOR, IndexedArray, IndexedElement, IndexedElementBundle, type InputTokenDataWithContext, InsertAddressInputLayout, InsertNullifierInputLayout, type InstructionDataInvoke, type InstructionDataInvokeCpi, InstructionDataInvokeCpiLayout, InstructionDataInvokeLayout, type LatestNonVotingSignatures, type LatestNonVotingSignaturesPaginated, LatestNonVotingSignaturesResult, LatestNonVotingSignaturesResultPaginated, LightSystemProgram$1 as LightSystemProgram, type LightSystemProgram as LightSystemProgramIDL, type LightWasm, LookupTableError, LookupTableErrorCode, MerkeProofResult, type MerkleContext, MerkleContextLayout, type MerkleContextWithMerkleProof, type MerkleContextWithNewAddressProof, MerkleTree, MerkleTreeError, MerkleTreeErrorCode, type MerkleTreeSequenceNumber, MerkleTreeSequenceNumberLayout, MultipleCompressedAccountsResult, MultipleMerkleProofsResult, NativeBalanceResult, type NewAddressParams, NewAddressParamsLayout, type NewAddressParamsPacked, NewAddressProofResult, type NonInclusionJsonStruct, type NonInclusionMerkleProofInputs, type OutputCompressedAccountWithPackedContext, type PackedCompressedAccountWithMerkleContext, type PackedMerkleContext, type PaginatedOptions, type ParsedTokenAccount, ProofError, ProofErrorCode, type PublicTransactionEvent, PublicTransactionEventLayout, type QueueIndex, Rpc, RpcError, RpcErrorCode, type RpcResult, type RpcResultError, type RpcResultSuccess, STATE_MERKLE_TREE_NETWORK_FEE, STATE_MERKLE_TREE_ROLLOVER_FEE, SelectInUtxosError, SelectInUtxosErrorCode, SignatureListResult, SignatureListWithCursorResult, type SignatureWithMetadata, SlotResult, type StateTreeLUTPair, TRANSACTION_MERKLE_TREE_ROLLOVER_THRESHOLD, TestRpc, type TestRpcConfig, type TokenBalance, TokenBalanceListResult, TokenBalanceListResultV2, TokenBalanceResult, type TokenData$1 as TokenData, TokenDataLayout, TokenDataResult, TreeType, UTXO_MERGE_MAXIMUM, UTXO_MERGE_THRESHOLD, UtilsError, UtilsErrorCode, UtxoError, UtxoErrorCode, ValidityProofResult, type WithContext, type WithCursor, type WithRpcContext, accountCompressionProgram, addressQueue, addressTree, airdropSol, bn, bufToDecStr, buildAndSignTx, buildTx, byteArrayToKeypair, calculateComputeUnitPrice, checkValidityProofShape, compress, confirmConfig, confirmTransaction, confirmTx, convertMerkleProofsWithContextToHex, convertNonInclusionMerkleProofInputsToHex, convertToPublicTransactionEvent, cpiContext2Pubkey, cpiContextPubkey, createAccount, createAccountWithLamports, createBN254, createCompressedAccount, createCompressedAccountWithMerkleContext, createMerkleContext, createRpc, createRpcResult, createStateTreeLookupTable, decodeInstructionDataInvoke, decodeInstructionDataInvokeCpi, decodePublicTransactionEvent, decompress, dedupeSigner, deepEqual, defaultStateTreeLookupTables, defaultStaticAccounts, defaultStaticAccountsStruct, defaultTestStateTreeAccounts, defaultTestStateTreeAccounts2, deriveAddress, deriveAddressSeed, deserializeAppendNullifyCreateAddressInputsIndexer, encodeBN254toBase58, encodeInstructionDataInvoke, encodePublicTransactionEvent, extendStateTreeLookupTable, getAccountCompressionAuthority, getCompressedTokenAccountByHashTest, getCompressedTokenAccounts, getCompressedTokenAccountsByDelegateTest, getCompressedTokenAccountsByOwnerTest, getConnection, getIndexOrAdd, getLightStateTreeInfo, getParsedEvents, getPublicInputHash, getQueueForTree, getRegisteredProgramPda, getTestKeypair, getTestRpc, getTreeForQueue, hashToBn254FieldSizeBe, hashvToBn254FieldSizeBe, invokeAccountsLayout, type invokeAccountsLayoutParams, isLocalTest, jsonRpcResult, jsonRpcResultAndContext, lightProgram, localTestActiveStateTreeInfo, logger, merkleTree2Pubkey, merkletreePubkey, negateAndCompressProof, newAccountWithLamports, noopProgram, nullifiedStateTreeLookupTableDevnet, nullifiedStateTreeLookupTableMainnet, nullifierQueue2Pubkey, nullifierQueuePubkey, nullifyLookupTable, packCompressedAccounts, packNewAddressParams, padOutputStateMerkleTrees, parseAccountData, parseEvents, parseLightTransaction, parsePublicTransactionEventWithIdl, parseTokenLayoutWithIdl, pickRandomTreeAndQueue, pipe, placeholderValidityProof, proofFromJsonStruct, proverRequest, pushUniqueItems, rpcRequest, selectMinCompressedSolAccountsForTransfer, sendAndConfirmTx, sleep, stateTreeLookupTableDevnet, stateTreeLookupTableMainnet, sumUpLamports, toAccountMetas, toArray, toCamelCase, toHex, toUnixTimestamp, transfer, validateSameOwner, validateSufficientBalance, wrapBigNumbersAsStrings };
4007
+ export { ADDRESS_QUEUE_ROLLOVER_FEE, ADDRESS_TREE_NETWORK_FEE, ALICE, AccountProofResult, type ActiveTreeBundle, type AddressWithTree, AppendLeavesInputLayout, AppendNullifyCreateAddressInputsMetaLayout, type BN254, BOB, BalanceResult, CHARLIE, COMPUTE_BUDGET_PATTERN, type ClientSubscriptionId, type CompressedAccount, type CompressedAccountData, CompressedAccountLayout, CompressedAccountResult, type CompressedAccountWithMerkleContext, CompressedAccountsByOwnerResult, type CompressedCpiContext, type CompressedMintTokenHolders, CompressedMintTokenHoldersResult, type CompressedProof, type CompressedProofWithContext, CompressedTokenAccountResult, CompressedTokenAccountsByOwnerOrDelegateResult, type CompressedTransaction, CompressedTransactionResult, type CompressionApiInterface, CreateUtxoError, CreateUtxoErrorCode, DAVE, DEFAULT_MERKLE_TREE_HEIGHT, DEFAULT_MERKLE_TREE_ROOTS, DEFAULT_ZERO, type EventWithParsedTokenTlvData, FIELD_SIZE, type GetCompressedAccountConfig, type GetCompressedAccountsByOwnerConfig, type GetCompressedAccountsConfig, type GetCompressedAccountsFilter, type GetCompressedTokenAccountsByOwnerOrDelegateOptions, HIGHEST_ADDRESS_PLUS_ONE, HashError, HashErrorCode, type HashWithTree, HealthResult, type HexBatchInputsForProver, type HexInputsForProver, IDL, INSERT_INTO_QUEUES_DISCRIMINATOR, INVOKE_CPI_DISCRIMINATOR, INVOKE_DISCRIMINATOR, IndexedArray, IndexedElement, IndexedElementBundle, type InputTokenDataWithContext, InsertAddressInputLayout, InsertNullifierInputLayout, type InstructionDataInvoke, type InstructionDataInvokeCpi, InstructionDataInvokeCpiLayout, InstructionDataInvokeLayout, type LatestNonVotingSignatures, type LatestNonVotingSignaturesPaginated, LatestNonVotingSignaturesResult, LatestNonVotingSignaturesResultPaginated, LightSystemProgram$1 as LightSystemProgram, type LightSystemProgram as LightSystemProgramIDL, type LightWasm, LookupTableError, LookupTableErrorCode, MerkeProofResult, type MerkleContext, MerkleContextLayout, type MerkleContextWithMerkleProof, type MerkleContextWithNewAddressProof, MerkleTree, MerkleTreeError, MerkleTreeErrorCode, type MerkleTreeSequenceNumber, MerkleTreeSequenceNumberLayout, MultipleCompressedAccountsResult, MultipleMerkleProofsResult, NativeBalanceResult, type NewAddressParams, NewAddressParamsLayout, type NewAddressParamsPacked, NewAddressProofResult, type NonInclusionJsonStruct, type NonInclusionMerkleProofInputs, type OutputCompressedAccountWithPackedContext, type PackedCompressedAccountWithMerkleContext, type PackedMerkleContext, type PaginatedOptions, type ParsedTokenAccount, ProofError, ProofErrorCode, type PublicTransactionEvent, PublicTransactionEventLayout, type QueueIndex, Rpc, RpcError, RpcErrorCode, type RpcResult, type RpcResultError, type RpcResultSuccess, STATE_MERKLE_TREE_NETWORK_FEE, STATE_MERKLE_TREE_ROLLOVER_FEE, SelectInUtxosError, SelectInUtxosErrorCode, SignatureListResult, SignatureListWithCursorResult, type SignatureWithMetadata, SlotResult, type StateTreeLUTPair, TRANSACTION_MERKLE_TREE_ROLLOVER_THRESHOLD, TestRpc, type TestRpcConfig, type TokenBalance, TokenBalanceListResult, TokenBalanceListResultV2, TokenBalanceResult, type TokenData$1 as TokenData, TokenDataLayout, TokenDataResult, TreeType, UTXO_MERGE_MAXIMUM, UTXO_MERGE_THRESHOLD, UtilsError, UtilsErrorCode, UtxoError, UtxoErrorCode, ValidityProofResult, type WithContext, type WithCursor, type WithRpcContext, accountCompressionProgram, addressQueue, addressTree, airdropSol, bn, bufToDecStr, buildAndSignTx, buildTx, byteArrayToKeypair, calculateComputeUnitPrice, checkValidityProofShape, compress, confirmConfig, confirmTransaction, confirmTx, convertMerkleProofsWithContextToHex, convertNonInclusionMerkleProofInputsToHex, convertToPublicTransactionEvent, cpiContext2Pubkey, cpiContextPubkey, createAccount, createAccountWithLamports, createBN254, createCompressedAccount, createCompressedAccountWithMerkleContext, createMerkleContext, createRpc, createRpcResult, createStateTreeLookupTable, decodeInstructionDataInvoke, decodeInstructionDataInvokeCpi, decodePublicTransactionEvent, decompress, dedupeSigner, deepEqual, defaultStateTreeLookupTables, defaultStaticAccounts, defaultStaticAccountsStruct, defaultTestStateTreeAccounts, defaultTestStateTreeAccounts2, deriveAddress, deriveAddressSeed, deserializeAppendNullifyCreateAddressInputsIndexer, encodeBN254toBase58, encodeInstructionDataInvoke, encodePublicTransactionEvent, extendStateTreeLookupTable, getAccountCompressionAuthority, getCompressedTokenAccountByHashTest, getCompressedTokenAccounts, getCompressedTokenAccountsByDelegateTest, getCompressedTokenAccountsByOwnerTest, getConnection, getIndexOrAdd, getLightStateTreeInfo, getParsedEvents, getPublicInputHash, getQueueForTree, getRegisteredProgramPda, getTestKeypair, getTestRpc, getTreeForQueue, hashToBn254FieldSizeBe, hashvToBn254FieldSizeBe, invokeAccountsLayout, type invokeAccountsLayoutParams, isLocalTest, isSmallerThanBn254FieldSizeBe, jsonRpcResult, jsonRpcResultAndContext, lightProgram, localTestActiveStateTreeInfo, merkleTree2Pubkey, merkletreePubkey, negateAndCompressProof, newAccountWithLamports, noopProgram, nullifiedStateTreeLookupTableDevnet, nullifiedStateTreeLookupTableMainnet, nullifierQueue2Pubkey, nullifierQueuePubkey, nullifyLookupTable, packCompressedAccounts, packNewAddressParams, padOutputStateMerkleTrees, parseAccountData, parseEvents, parseLightTransaction, parsePublicTransactionEventWithIdl, parseTokenLayoutWithIdl, pickRandomTreeAndQueue, pipe, placeholderValidityProof, proofFromJsonStruct, proverRequest, pushUniqueItems, rpcRequest, selectMinCompressedSolAccountsForTransfer, sendAndConfirmTx, sleep, stateTreeLookupTableDevnet, stateTreeLookupTableMainnet, sumUpLamports, toAccountMetas, toArray, toCamelCase, toHex, toUnixTimestamp, transfer, validateNumbers, validateNumbersForInclusionProof, validateNumbersForNonInclusionProof, validateNumbersForProof, validateSameOwner, validateSufficientBalance, wrapBigNumbersAsStrings };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightprotocol/stateless.js",
3
- "version": "0.20.2",
3
+ "version": "0.20.4",
4
4
  "description": "JavaScript API for Light & ZK Compression",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/node/index.cjs",
@@ -45,6 +45,7 @@
45
45
  "buffer": "6.0.3",
46
46
  "buffer-layout": "^1.2.2",
47
47
  "camelcase": "^8.0.0",
48
+ "camelcase-keys": "^9.1.3",
48
49
  "superstruct": "2.0.2"
49
50
  },
50
51
  "devDependencies": {
@@ -81,7 +82,6 @@
81
82
  "tweetnacl": "1.0.3",
82
83
  "typescript": "^5.6.2",
83
84
  "vitest": "^2.1.1",
84
- "winston": "^3.17.0",
85
85
  "@lightprotocol/programs": "0.3.0"
86
86
  },
87
87
  "nx": {
@@ -1 +0,0 @@
1
- export declare const logger: any;
@@ -1 +0,0 @@
1
- export declare const logger: any;