@lightprotocol/stateless.js 0.6.0 → 0.7.0
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.
- package/dist/cjs/browser/index.cjs +44 -5
- package/dist/cjs/browser/index.cjs.map +1 -1
- package/dist/cjs/node/index.cjs +44 -5
- package/dist/cjs/node/index.cjs.map +1 -1
- package/dist/es/browser/index.js +43 -5
- package/dist/es/browser/index.js.map +1 -1
- package/dist/types/index.d.ts +39 -7
- package/package.json +3 -3
package/dist/types/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as _solana_web3_js from '@solana/web3.js';
|
|
2
|
-
import { PublicKey, Connection, Commitment, Keypair, TransactionInstruction, VersionedTransaction, ConfirmOptions, TransactionSignature, RpcResponseAndContext, SignatureResult, Signer,
|
|
2
|
+
import { PublicKey, Connection, Commitment, Keypair, TransactionInstruction, VersionedTransaction, ConfirmOptions, TransactionSignature, RpcResponseAndContext, SignatureResult, Signer, DataSlice, MemcmpFilter, ConnectionConfig, AccountMeta, ParsedTransactionWithMeta } from '@solana/web3.js';
|
|
3
3
|
import { Buffer as Buffer$1 } from 'buffer';
|
|
4
4
|
import * as superstruct_dist_utils from 'superstruct/dist/utils';
|
|
5
5
|
import { Struct } from 'superstruct';
|
|
@@ -342,9 +342,16 @@ interface LatestNonVotingSignatures {
|
|
|
342
342
|
signature: string;
|
|
343
343
|
slot: number;
|
|
344
344
|
blockTime: number;
|
|
345
|
+
error: string | null;
|
|
345
346
|
}[];
|
|
346
347
|
};
|
|
347
348
|
}
|
|
349
|
+
interface GetCompressedAccountsByOwnerConfig {
|
|
350
|
+
filters?: GetCompressedAccountsFilter[];
|
|
351
|
+
dataSlice?: DataSlice;
|
|
352
|
+
cursor?: string;
|
|
353
|
+
limit?: BN;
|
|
354
|
+
}
|
|
348
355
|
interface LatestNonVotingSignaturesPaginated {
|
|
349
356
|
context: {
|
|
350
357
|
slot: number;
|
|
@@ -399,12 +406,15 @@ interface GetCompressedTokenAccountsByOwnerOrDelegateOptions {
|
|
|
399
406
|
cursor?: string;
|
|
400
407
|
limit?: BN;
|
|
401
408
|
}
|
|
402
|
-
|
|
409
|
+
/**
|
|
410
|
+
* Note, DataSizeFilter is currently not available.
|
|
411
|
+
*/
|
|
412
|
+
type GetCompressedAccountsFilter = MemcmpFilter;
|
|
403
413
|
type GetCompressedAccountConfig = {
|
|
404
414
|
encoding?: string;
|
|
405
415
|
};
|
|
406
416
|
type GetCompressedAccountsConfig = {
|
|
407
|
-
|
|
417
|
+
dataSlice: DataSlice;
|
|
408
418
|
filters?: GetCompressedAccountsFilter[];
|
|
409
419
|
};
|
|
410
420
|
interface ParsedTokenAccount {
|
|
@@ -419,6 +429,10 @@ type WithContext<T> = {
|
|
|
419
429
|
/** response value */
|
|
420
430
|
value: T;
|
|
421
431
|
};
|
|
432
|
+
type WithCursor<T> = {
|
|
433
|
+
cursor: PublicKey | null;
|
|
434
|
+
value: T;
|
|
435
|
+
};
|
|
422
436
|
/**
|
|
423
437
|
* @internal
|
|
424
438
|
*/
|
|
@@ -873,22 +887,26 @@ declare const HealthResult: Struct<string, null>;
|
|
|
873
887
|
declare const LatestNonVotingSignaturesResult: Struct<{
|
|
874
888
|
items: {
|
|
875
889
|
signature: string;
|
|
890
|
+
error: string | null;
|
|
876
891
|
slot: number;
|
|
877
892
|
blockTime: number;
|
|
878
893
|
}[];
|
|
879
894
|
}, {
|
|
880
895
|
items: Struct<{
|
|
881
896
|
signature: string;
|
|
897
|
+
error: string | null;
|
|
882
898
|
slot: number;
|
|
883
899
|
blockTime: number;
|
|
884
900
|
}[], Struct<{
|
|
885
901
|
signature: string;
|
|
902
|
+
error: string | null;
|
|
886
903
|
slot: number;
|
|
887
904
|
blockTime: number;
|
|
888
905
|
}, {
|
|
889
906
|
signature: Struct<string, null>;
|
|
890
907
|
slot: Struct<number, null>;
|
|
891
908
|
blockTime: Struct<number, null>;
|
|
909
|
+
error: Struct<string | null, null>;
|
|
892
910
|
}>>;
|
|
893
911
|
}>;
|
|
894
912
|
/**
|
|
@@ -1406,7 +1424,8 @@ interface CompressionApiInterface {
|
|
|
1406
1424
|
getMultipleCompressedAccountProofs(hashes: BN254[]): Promise<MerkleContextWithMerkleProof[]>;
|
|
1407
1425
|
getValidityProof(hashes: BN254[], newAddresses: BN254[]): Promise<CompressedProofWithContext>;
|
|
1408
1426
|
getValidityProofAndRpcContext(hashes: BN254[], newAddresses: BN254[]): Promise<WithContext<CompressedProofWithContext>>;
|
|
1409
|
-
getCompressedAccountsByOwner(owner: PublicKey): Promise<CompressedAccountWithMerkleContext[]>;
|
|
1427
|
+
getCompressedAccountsByOwner(owner: PublicKey, config?: GetCompressedAccountsByOwnerConfig): Promise<CompressedAccountWithMerkleContext[]>;
|
|
1428
|
+
getCompressedAccountsByOwnerWithCursor(owner: PublicKey, config?: GetCompressedAccountsByOwnerConfig): Promise<WithCursor<CompressedAccountWithMerkleContext[]>>;
|
|
1410
1429
|
getCompressedTokenAccountsByOwner(publicKey: PublicKey, options: GetCompressedTokenAccountsByOwnerOrDelegateOptions): Promise<ParsedTokenAccount[]>;
|
|
1411
1430
|
getCompressedTokenAccountsByDelegate(delegate: PublicKey, options: GetCompressedTokenAccountsByOwnerOrDelegateOptions): Promise<ParsedTokenAccount[]>;
|
|
1412
1431
|
getCompressedTokenAccountBalance(hash: BN254): Promise<{
|
|
@@ -1529,7 +1548,14 @@ declare class Rpc extends Connection implements CompressionApiInterface {
|
|
|
1529
1548
|
* Fetch all the compressed accounts owned by the specified public key.
|
|
1530
1549
|
* Owner can be a program or user account
|
|
1531
1550
|
*/
|
|
1532
|
-
|
|
1551
|
+
getCompressedAccountsByOwnerWithCursor(owner: PublicKey, config?: GetCompressedAccountsByOwnerConfig): Promise<WithCursor<CompressedAccountWithMerkleContext[]>>;
|
|
1552
|
+
/**
|
|
1553
|
+
* Fetch all the compressed accounts owned by the specified public key.
|
|
1554
|
+
* Owner can be a program or user account
|
|
1555
|
+
*
|
|
1556
|
+
* To use `config.limit` or `config.cursor`, please use {@link getCompressedAccountsByOwnerWithCursor} instead.
|
|
1557
|
+
*/
|
|
1558
|
+
getCompressedAccountsByOwner(owner: PublicKey, config?: GetCompressedAccountsByOwnerConfig): Promise<CompressedAccountWithMerkleContext[]>;
|
|
1533
1559
|
/**
|
|
1534
1560
|
* Fetch all the compressed token accounts owned by the specified public
|
|
1535
1561
|
* key. Owner can be a program or user account
|
|
@@ -6752,7 +6778,13 @@ declare class TestRpc extends Connection implements CompressionApiInterface {
|
|
|
6752
6778
|
* Fetch all the compressed accounts owned by the specified public key.
|
|
6753
6779
|
* Owner can be a program or user account
|
|
6754
6780
|
*/
|
|
6755
|
-
getCompressedAccountsByOwner(owner: PublicKey): Promise<CompressedAccountWithMerkleContext[]>;
|
|
6781
|
+
getCompressedAccountsByOwner(owner: PublicKey, _config?: GetCompressedAccountsByOwnerConfig): Promise<CompressedAccountWithMerkleContext[]>;
|
|
6782
|
+
/**
|
|
6783
|
+
* Fetch all the compressed accounts owned by the specified public key.
|
|
6784
|
+
* Owner can be a program or user account
|
|
6785
|
+
* Returns with cursor
|
|
6786
|
+
*/
|
|
6787
|
+
getCompressedAccountsByOwnerWithCursor(owner: PublicKey, _config?: GetCompressedAccountsByOwnerConfig): Promise<WithCursor<CompressedAccountWithMerkleContext[]>>;
|
|
6756
6788
|
/**
|
|
6757
6789
|
* Fetch the latest compression signatures on the cluster. Results are
|
|
6758
6790
|
* paginated.
|
|
@@ -7051,4 +7083,4 @@ declare function getParsedEvents(rpc: Rpc): Promise<PublicTransactionEvent[]>;
|
|
|
7051
7083
|
declare const parseEvents: <T>(indexerEventsTransactions: (ParsedTransactionWithMeta | null)[], deserializeFn: Deserializer<T>) => NonNullable<T>[];
|
|
7052
7084
|
declare const parsePublicTransactionEventWithIdl: (data: Buffer) => PublicTransactionEvent | null;
|
|
7053
7085
|
|
|
7054
|
-
export { ADDRESS_QUEUE_ROLLOVER_FEE, ADDRESS_TREE_NETWORK_FEE, ALICE, type AccountCompression, IDL$3 as AccountCompressionIDL, AccountProofResult, type BN254, BOB, BalanceResult, CHARLIE, type CompressedAccount, type CompressedAccountData, CompressedAccountResult, type CompressedAccountWithMerkleContext, CompressedAccountsByOwnerResult, type CompressedProof, type CompressedProofWithContext, CompressedTokenAccountResult, CompressedTokenAccountsByOwnerOrDelegateResult, type CompressedTokenInstructionDataTransfer, type CompressedTransaction, CompressedTransactionResult, type CompressionApiInterface, CreateUtxoError, CreateUtxoErrorCode, DAVE, DEFAULT_MERKLE_TREE_HEIGHT, DEFAULT_MERKLE_TREE_ROOTS, DEFAULT_ZERO, FIELD_SIZE, type GetCompressedAccountConfig, type GetCompressedAccountsConfig, type GetCompressedAccountsFilter, type GetCompressedTokenAccountsByOwnerOrDelegateOptions, HIGHEST_ADDRESS_PLUS_ONE, HashError, HashErrorCode, HealthResult, type HexBatchInputsForProver, type HexInputsForProver, IndexedArray, IndexedElement, IndexedElementBundle, type InputTokenDataWithContext, type InstructionDataInvoke, type LatestNonVotingSignatures, type LatestNonVotingSignaturesPaginated, LatestNonVotingSignaturesResult, LatestNonVotingSignaturesResultPaginated, type LightCompressedToken, IDL as LightCompressedTokenIDL, type LightRegistry, IDL$2 as LightRegistryIDL, type LightSystemProgram$1 as LightSystem, IDL$1 as LightSystemIDL, LightSystemProgram, type LightWasm, LookupTableError, LookupTableErrorCode, MerkeProofResult, type MerkleContext, type MerkleContextWithMerkleProof, type MerkleContextWithNewAddressProof, MerkleTree, MerkleTreeError, MerkleTreeErrorCode, MultipleCompressedAccountsResult, MultipleMerkleProofsResult, NativeBalanceResult, type NewAddressParams, type NewAddressParamsPacked, NewAddressProofResult, type NonInclusionJsonStruct, type NonInclusionMerkleProofInputs, type OutputCompressedAccountWithPackedContext, type PackedCompressedAccountWithMerkleContext, type PackedMerkleContext, type ParsedTokenAccount, ProofError, ProofErrorCode, type PublicTransactionEvent, type QueueIndex, Rpc, RpcError, RpcErrorCode, STATE_MERKLE_TREE_NETWORK_FEE, STATE_MERKLE_TREE_ROLLOVER_FEE, SelectInUtxosError, SelectInUtxosErrorCode, SignatureListResult, SignatureListWithCursorResult, type SignatureWithMetadata, SlotResult, TRANSACTION_MERKLE_TREE_ROLLOVER_THRESHOLD, TestRpc, type TestRpcConfig, TokenBalanceListResult, TokenBalanceResult, type TokenData, TokenDataResult, type TokenTransferOutputData, UTXO_MERGE_MAXIMUM, UTXO_MERGE_THRESHOLD, UtilsError, UtilsErrorCode, UtxoError, UtxoErrorCode, ValidityProofResult, type WithContext, accountCompressionProgram, addressQueue, addressTree, airdropSol, bn, bufToDecStr, buildAndSignTx, buildTx, byteArrayToKeypair, checkValidityProofShape, compress, confirmConfig, confirmTransaction, confirmTx, convertMerkleProofsWithContextToHex, convertNonInclusionMerkleProofInputsToHex, createAccount, createAccountWithLamports, createBN254, createCompressedAccount, createCompressedAccountWithMerkleContext, createMerkleContext, createRpc, createRpcResult, decompress, dedupeSigner, defaultStaticAccounts, defaultStaticAccountsStruct, defaultTestStateTreeAccounts, deriveAddress, encodeBN254toBase58, getAccountCompressionAuthority, getConnection, getIndexOrAdd, getParsedEvents, getRegisteredProgramPda, getTestKeypair, getTestRpc, hashToBn254FieldSizeBe, jsonRpcResult, jsonRpcResultAndContext, lightProgram, merkletreePubkey, negateAndCompressProof, newAccountWithLamports, noopProgram, nullifierQueuePubkey, packCompressedAccounts, packNewAddressParams, padOutputStateMerkleTrees, parseAccountData, parseEvents, parsePublicTransactionEventWithIdl, pipe, placeholderValidityProof, proofFromJsonStruct, proverRequest, pushUniqueItems, rpcRequest, selectMinCompressedSolAccountsForTransfer, sendAndConfirmTx, sleep, sumUpLamports, toAccountMetas, toArray, toCamelCase, toHex, toUnixTimestamp, transfer, useWallet, validateSameOwner, validateSufficientBalance };
|
|
7086
|
+
export { ADDRESS_QUEUE_ROLLOVER_FEE, ADDRESS_TREE_NETWORK_FEE, ALICE, type AccountCompression, IDL$3 as AccountCompressionIDL, AccountProofResult, type BN254, BOB, BalanceResult, CHARLIE, type CompressedAccount, type CompressedAccountData, CompressedAccountResult, type CompressedAccountWithMerkleContext, CompressedAccountsByOwnerResult, type CompressedProof, type CompressedProofWithContext, CompressedTokenAccountResult, CompressedTokenAccountsByOwnerOrDelegateResult, type CompressedTokenInstructionDataTransfer, type CompressedTransaction, CompressedTransactionResult, type CompressionApiInterface, CreateUtxoError, CreateUtxoErrorCode, DAVE, DEFAULT_MERKLE_TREE_HEIGHT, DEFAULT_MERKLE_TREE_ROOTS, DEFAULT_ZERO, FIELD_SIZE, type GetCompressedAccountConfig, type GetCompressedAccountsByOwnerConfig, type GetCompressedAccountsConfig, type GetCompressedAccountsFilter, type GetCompressedTokenAccountsByOwnerOrDelegateOptions, HIGHEST_ADDRESS_PLUS_ONE, HashError, HashErrorCode, HealthResult, type HexBatchInputsForProver, type HexInputsForProver, IndexedArray, IndexedElement, IndexedElementBundle, type InputTokenDataWithContext, type InstructionDataInvoke, type LatestNonVotingSignatures, type LatestNonVotingSignaturesPaginated, LatestNonVotingSignaturesResult, LatestNonVotingSignaturesResultPaginated, type LightCompressedToken, IDL as LightCompressedTokenIDL, type LightRegistry, IDL$2 as LightRegistryIDL, type LightSystemProgram$1 as LightSystem, IDL$1 as LightSystemIDL, LightSystemProgram, type LightWasm, LookupTableError, LookupTableErrorCode, MerkeProofResult, type MerkleContext, type MerkleContextWithMerkleProof, type MerkleContextWithNewAddressProof, MerkleTree, MerkleTreeError, MerkleTreeErrorCode, MultipleCompressedAccountsResult, MultipleMerkleProofsResult, NativeBalanceResult, type NewAddressParams, type NewAddressParamsPacked, NewAddressProofResult, type NonInclusionJsonStruct, type NonInclusionMerkleProofInputs, type OutputCompressedAccountWithPackedContext, type PackedCompressedAccountWithMerkleContext, type PackedMerkleContext, type ParsedTokenAccount, ProofError, ProofErrorCode, type PublicTransactionEvent, type QueueIndex, Rpc, RpcError, RpcErrorCode, STATE_MERKLE_TREE_NETWORK_FEE, STATE_MERKLE_TREE_ROLLOVER_FEE, SelectInUtxosError, SelectInUtxosErrorCode, SignatureListResult, SignatureListWithCursorResult, type SignatureWithMetadata, SlotResult, TRANSACTION_MERKLE_TREE_ROLLOVER_THRESHOLD, TestRpc, type TestRpcConfig, TokenBalanceListResult, TokenBalanceResult, type TokenData, TokenDataResult, type TokenTransferOutputData, UTXO_MERGE_MAXIMUM, UTXO_MERGE_THRESHOLD, UtilsError, UtilsErrorCode, UtxoError, UtxoErrorCode, ValidityProofResult, type WithContext, type WithCursor, accountCompressionProgram, addressQueue, addressTree, airdropSol, bn, bufToDecStr, buildAndSignTx, buildTx, byteArrayToKeypair, checkValidityProofShape, compress, confirmConfig, confirmTransaction, confirmTx, convertMerkleProofsWithContextToHex, convertNonInclusionMerkleProofInputsToHex, createAccount, createAccountWithLamports, createBN254, createCompressedAccount, createCompressedAccountWithMerkleContext, createMerkleContext, createRpc, createRpcResult, decompress, dedupeSigner, defaultStaticAccounts, defaultStaticAccountsStruct, defaultTestStateTreeAccounts, deriveAddress, encodeBN254toBase58, getAccountCompressionAuthority, getConnection, getIndexOrAdd, getParsedEvents, getRegisteredProgramPda, getTestKeypair, getTestRpc, hashToBn254FieldSizeBe, jsonRpcResult, jsonRpcResultAndContext, lightProgram, merkletreePubkey, negateAndCompressProof, newAccountWithLamports, noopProgram, nullifierQueuePubkey, packCompressedAccounts, packNewAddressParams, padOutputStateMerkleTrees, parseAccountData, parseEvents, parsePublicTransactionEventWithIdl, pipe, placeholderValidityProof, proofFromJsonStruct, proverRequest, pushUniqueItems, rpcRequest, selectMinCompressedSolAccountsForTransfer, sendAndConfirmTx, sleep, sumUpLamports, toAccountMetas, toArray, toCamelCase, toHex, toUnixTimestamp, transfer, useWallet, validateSameOwner, validateSufficientBalance };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightprotocol/stateless.js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "JavaScript API for Light and ZK Compression",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/node/index.cjs",
|
|
@@ -72,8 +72,8 @@
|
|
|
72
72
|
"tslib": "^2.6.2",
|
|
73
73
|
"typescript": "^5.5.3",
|
|
74
74
|
"vitest": "^1.6.0",
|
|
75
|
-
"@lightprotocol/
|
|
76
|
-
"@lightprotocol/
|
|
75
|
+
"@lightprotocol/programs": "0.3.0",
|
|
76
|
+
"@lightprotocol/hasher.rs": "0.2.0"
|
|
77
77
|
},
|
|
78
78
|
"nx": {
|
|
79
79
|
"targets": {
|