@lightprotocol/stateless.js 0.22.1-alpha.1 → 0.22.1-alpha.3
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/README.md +4 -1
- package/dist/cjs/browser/constants.d.ts +29 -8
- package/dist/cjs/browser/index.cjs +1 -1
- package/dist/cjs/browser/index.cjs.map +1 -1
- package/dist/cjs/browser/rpc-interface.d.ts +96 -2
- package/dist/cjs/browser/rpc.d.ts +81 -3
- package/dist/cjs/browser/test-helpers/test-rpc/get-compressed-token-accounts.d.ts +0 -2
- package/dist/cjs/browser/test-helpers/test-rpc/test-rpc.d.ts +6 -0
- package/dist/cjs/browser/utils/get-state-tree-infos.d.ts +15 -0
- package/dist/cjs/browser/utils/index.d.ts +1 -0
- package/dist/cjs/browser/utils/pack-decompress.d.ts +31 -0
- package/dist/cjs/node/constants.d.ts +29 -8
- package/dist/cjs/node/index.cjs +1 -1
- package/dist/cjs/node/index.cjs.map +1 -1
- package/dist/cjs/node/rpc-interface.d.ts +96 -2
- package/dist/cjs/node/rpc.d.ts +81 -3
- package/dist/cjs/node/test-helpers/test-rpc/get-compressed-token-accounts.d.ts +0 -2
- package/dist/cjs/node/test-helpers/test-rpc/test-rpc.d.ts +6 -0
- package/dist/cjs/node/utils/get-state-tree-infos.d.ts +15 -0
- package/dist/cjs/node/utils/index.d.ts +1 -0
- package/dist/cjs/node/utils/pack-decompress.d.ts +31 -0
- package/dist/es/browser/constants.d.ts +29 -8
- package/dist/es/browser/index.js +1 -1
- package/dist/es/browser/index.js.map +1 -1
- package/dist/es/browser/rpc-interface.d.ts +96 -2
- package/dist/es/browser/rpc.d.ts +81 -3
- package/dist/es/browser/test-helpers/test-rpc/get-compressed-token-accounts.d.ts +0 -2
- package/dist/es/browser/test-helpers/test-rpc/test-rpc.d.ts +6 -0
- package/dist/es/browser/utils/get-state-tree-infos.d.ts +15 -0
- package/dist/es/browser/utils/index.d.ts +1 -0
- package/dist/es/browser/utils/pack-decompress.d.ts +31 -0
- package/dist/types/index.d.ts +251 -11
- package/package.json +5 -5
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, Signer, AccountMeta, TransactionInstruction, AddressLookupTableAccount, VersionedTransaction, ConfirmOptions, TransactionSignature, RpcResponseAndContext, SignatureResult, DataSlice, MemcmpFilter, ConnectionConfig, ParsedTransactionWithMeta } from '@solana/web3.js';
|
|
2
|
+
import { PublicKey, Connection, Commitment, Keypair, Signer, AccountMeta, TransactionInstruction, AddressLookupTableAccount, VersionedTransaction, ConfirmOptions, TransactionSignature, RpcResponseAndContext, SignatureResult, DataSlice, MemcmpFilter, GetAccountInfoConfig, AccountInfo, SignaturesForAddressOptions, ConfirmedSignatureInfo, TokenAmount, ConnectionConfig, ParsedTransactionWithMeta } from '@solana/web3.js';
|
|
3
3
|
import { Buffer as Buffer$1 } from 'buffer';
|
|
4
4
|
import { Struct } from 'superstruct';
|
|
5
5
|
import BN from 'bn.js';
|
|
@@ -375,14 +375,24 @@ declare const defaultStateTreeLookupTables: () => {
|
|
|
375
375
|
* @internal
|
|
376
376
|
*/
|
|
377
377
|
declare const isLocalTest: (url: string) => boolean;
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
378
|
+
declare const getDefaultAddressSpace: () => {
|
|
379
|
+
tree: PublicKey;
|
|
380
|
+
queue: PublicKey;
|
|
381
|
+
cpiContext: undefined;
|
|
382
|
+
treeType: TreeType;
|
|
383
|
+
nextTreeInfo: null;
|
|
384
|
+
};
|
|
382
385
|
declare const getDefaultAddressTreeInfo: () => {
|
|
383
386
|
tree: PublicKey;
|
|
384
387
|
queue: PublicKey;
|
|
385
|
-
cpiContext:
|
|
388
|
+
cpiContext: undefined;
|
|
389
|
+
treeType: TreeType;
|
|
390
|
+
nextTreeInfo: null;
|
|
391
|
+
};
|
|
392
|
+
declare const getBatchAddressTreeInfo: () => {
|
|
393
|
+
tree: PublicKey;
|
|
394
|
+
queue: PublicKey;
|
|
395
|
+
cpiContext: undefined;
|
|
386
396
|
treeType: TreeType;
|
|
387
397
|
nextTreeInfo: null;
|
|
388
398
|
};
|
|
@@ -407,6 +417,7 @@ declare const defaultTestStateTreeAccounts2: () => {
|
|
|
407
417
|
merkleTree2: PublicKey;
|
|
408
418
|
};
|
|
409
419
|
declare const COMPRESSED_TOKEN_PROGRAM_ID: PublicKey;
|
|
420
|
+
declare const CTOKEN_PROGRAM_ID: PublicKey;
|
|
410
421
|
declare const stateTreeLookupTableMainnet = "7i86eQs3GSqHjN47WdWLTCGMW6gde1q96G2EVnUyK2st";
|
|
411
422
|
declare const nullifiedStateTreeLookupTableMainnet = "H9QD4u1fG7KmkAzn2tDXhheushxFe1EcrjGGyEFXeMqT";
|
|
412
423
|
declare const stateTreeLookupTableDevnet = "Dk9mNkbiZXJZ4By8DfSP6HEE4ojZzRvucwpawLeuwq8q";
|
|
@@ -435,9 +446,15 @@ declare const batchMerkleTree5 = "bmt5yU97jC88YXTuSukYHa8Z5Bi2ZDUtmzfkDTA2mG2";
|
|
|
435
446
|
declare const batchQueue5 = "oq5oh5ZR3yGomuQgFduNDzjtGvVWfDRGLuDVjv9a96P";
|
|
436
447
|
declare const batchCpiContext5 = "cpi5ZTjdgYpZ1Xr7B1cMLLUE81oTtJbNNAyKary2nV6";
|
|
437
448
|
declare const batchAddressTree = "amt2kaJA14v3urZbZvnc5v2np8jqvc4Z8zDep5wbtzx";
|
|
438
|
-
declare const testBatchAddressTree = "EzKE84aVTkCUhDHLELqyJaq1Y7UVVmqxXqZjVHwHY3rK";
|
|
439
449
|
declare const batchMerkleTree = "bmt1LryLZUMmF7ZtqESaw7wifBXLfXHQYoE4GAmrahU";
|
|
440
450
|
declare const batchQueue = "oq1na8gojfdUhsfCpyjNt6h4JaDWtHf1yQj4koBWfto";
|
|
451
|
+
/**
|
|
452
|
+
* @internal
|
|
453
|
+
* Returns local test tree infos.
|
|
454
|
+
* V1: 2 state trees (smt/nfq/cpi pairs)
|
|
455
|
+
* V2: 5 batched state trees (bmt/oq/cpi triplets) + 1 address tree (amt2)
|
|
456
|
+
*/
|
|
457
|
+
declare const localTestActiveStateTreeInfos: () => TreeInfo[];
|
|
441
458
|
declare const confirmConfig: ConfirmOptions;
|
|
442
459
|
declare const DEFAULT_MERKLE_TREE_HEIGHT = 26;
|
|
443
460
|
declare const DEFAULT_MERKLE_TREE_ROOTS = 2800;
|
|
@@ -470,10 +487,28 @@ declare const ADDRESS_QUEUE_ROLLOVER_FEE: BN;
|
|
|
470
487
|
*/
|
|
471
488
|
declare const STATE_MERKLE_TREE_NETWORK_FEE: BN;
|
|
472
489
|
/**
|
|
473
|
-
* Is charged
|
|
490
|
+
* Is charged per address the transaction creates.
|
|
474
491
|
*/
|
|
475
|
-
declare const
|
|
492
|
+
declare const ADDRESS_TREE_NETWORK_FEE_V1: BN;
|
|
493
|
+
/**
|
|
494
|
+
* Is charged per address the transaction creates.
|
|
495
|
+
*/
|
|
496
|
+
declare const ADDRESS_TREE_NETWORK_FEE_V2: BN;
|
|
476
497
|
|
|
498
|
+
/**
|
|
499
|
+
* Get the currently active output queue from a merkle context.
|
|
500
|
+
*
|
|
501
|
+
* @param merkleContext The merkle context to get the output queue from
|
|
502
|
+
* @returns The output queue public key
|
|
503
|
+
*/
|
|
504
|
+
declare function getOutputQueue(merkleContext: MerkleContext): PublicKey;
|
|
505
|
+
/**
|
|
506
|
+
* Get the currently active output tree info from a merkle context.
|
|
507
|
+
*
|
|
508
|
+
* @param merkleContext The merkle context to get the output tree info from
|
|
509
|
+
* @returns The output tree info
|
|
510
|
+
*/
|
|
511
|
+
declare function getOutputTreeInfo(merkleContext: MerkleContext): TreeInfo;
|
|
477
512
|
/**
|
|
478
513
|
* @deprecated use {@link getTreeInfoByPubkey} instead
|
|
479
514
|
*/
|
|
@@ -520,6 +555,35 @@ declare function getAllStateTreeInfos({ connection, stateTreeLUTPairs, }: {
|
|
|
520
555
|
stateTreeLUTPairs: StateTreeLUTPair[];
|
|
521
556
|
}): Promise<TreeInfo[]>;
|
|
522
557
|
|
|
558
|
+
interface AccountDataWithTreeInfo {
|
|
559
|
+
key: string;
|
|
560
|
+
data: any;
|
|
561
|
+
treeInfo: TreeInfo;
|
|
562
|
+
}
|
|
563
|
+
interface PackedDecompressResult {
|
|
564
|
+
proofOption: {
|
|
565
|
+
0: ValidityProof | null;
|
|
566
|
+
};
|
|
567
|
+
compressedAccounts: any[];
|
|
568
|
+
systemAccountsOffset: number;
|
|
569
|
+
remainingAccounts: AccountMeta[];
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* Pack accounts and proof for decompressAccountsIdempotent instruction.
|
|
573
|
+
* This function prepares compressed account data, validity proof, and remaining accounts
|
|
574
|
+
* for idempotent decompression operations.
|
|
575
|
+
*
|
|
576
|
+
* @param programId - The program ID
|
|
577
|
+
* @param proof - The validity proof with context
|
|
578
|
+
* @param accountsData - Array of account data with tree info
|
|
579
|
+
* @param addresses - Array of account addresses
|
|
580
|
+
* @returns Packed instruction parameters
|
|
581
|
+
*/
|
|
582
|
+
declare function packDecompressAccountsIdempotent(programId: PublicKey, proof: {
|
|
583
|
+
compressedProof: ValidityProof | null;
|
|
584
|
+
treeInfos: TreeInfo[];
|
|
585
|
+
}, accountsData: AccountDataWithTreeInfo[], addresses: PublicKey[]): Promise<PackedDecompressResult>;
|
|
586
|
+
|
|
523
587
|
declare enum TreeType {
|
|
524
588
|
/**
|
|
525
589
|
* v1 state merkle tree
|
|
@@ -1248,6 +1312,14 @@ interface AddressWithTreeInfo {
|
|
|
1248
1312
|
address: BN254;
|
|
1249
1313
|
treeInfo: AddressTreeInfo;
|
|
1250
1314
|
}
|
|
1315
|
+
interface AddressWithTreeInfoV2 {
|
|
1316
|
+
address: Uint8Array;
|
|
1317
|
+
treeInfo: TreeInfo;
|
|
1318
|
+
}
|
|
1319
|
+
declare enum DerivationMode {
|
|
1320
|
+
compressible = "compressible",
|
|
1321
|
+
standard = "standard"
|
|
1322
|
+
}
|
|
1251
1323
|
interface CompressedTransaction {
|
|
1252
1324
|
compressionInfo: {
|
|
1253
1325
|
closedAccounts: {
|
|
@@ -3926,6 +3998,15 @@ interface CompressionApiInterface {
|
|
|
3926
3998
|
getLatestCompressionSignatures(cursor?: string, limit?: number): Promise<LatestNonVotingSignaturesPaginated>;
|
|
3927
3999
|
getIndexerHealth(): Promise<string>;
|
|
3928
4000
|
getIndexerSlot(): Promise<number>;
|
|
4001
|
+
getAccountInfoInterface(address: PublicKey, programId: PublicKey, commitmentOrConfig?: Commitment | GetAccountInfoConfig, addressSpace?: TreeInfo): Promise<{
|
|
4002
|
+
accountInfo: AccountInfo<Buffer>;
|
|
4003
|
+
isCold: boolean;
|
|
4004
|
+
loadContext?: MerkleContext;
|
|
4005
|
+
} | null>;
|
|
4006
|
+
getSignaturesForAddressInterface(address: PublicKey, options?: SignaturesForAddressOptions, compressedOptions?: PaginatedOptions): Promise<SignaturesForAddressInterfaceResult>;
|
|
4007
|
+
getSignaturesForOwnerInterface(owner: PublicKey, options?: SignaturesForAddressOptions, compressedOptions?: PaginatedOptions): Promise<SignaturesForAddressInterfaceResult>;
|
|
4008
|
+
getTokenAccountBalanceInterface(address: PublicKey, owner: PublicKey, mint: PublicKey, commitment?: Commitment): Promise<UnifiedTokenBalance>;
|
|
4009
|
+
getBalanceInterface(address: PublicKey, commitment?: Commitment): Promise<UnifiedBalance>;
|
|
3929
4010
|
}
|
|
3930
4011
|
type RpcResultSuccess<T> = {
|
|
3931
4012
|
jsonrpc: '2.0';
|
|
@@ -3942,6 +4023,83 @@ type RpcResultError = {
|
|
|
3942
4023
|
};
|
|
3943
4024
|
};
|
|
3944
4025
|
type RpcResult<T> = RpcResultSuccess<T> | RpcResultError;
|
|
4026
|
+
/**
|
|
4027
|
+
* Source type for signature data.
|
|
4028
|
+
*/
|
|
4029
|
+
declare const SignatureSource: {
|
|
4030
|
+
/** From standard Solana RPC (getSignaturesForAddress) */
|
|
4031
|
+
readonly Solana: "solana";
|
|
4032
|
+
/** From compression indexer (getCompressionSignaturesFor*) */
|
|
4033
|
+
readonly Compressed: "compressed";
|
|
4034
|
+
};
|
|
4035
|
+
type SignatureSourceType = (typeof SignatureSource)[keyof typeof SignatureSource];
|
|
4036
|
+
/**
|
|
4037
|
+
* Unified signature info combining data from both Solana RPC and compression indexer.
|
|
4038
|
+
*
|
|
4039
|
+
* Design rationale:
|
|
4040
|
+
* - `sources` array indicates where this signature was found (can be both!)
|
|
4041
|
+
* - Primary data comes from Solana RPC when available (richer: err, memo, confirmationStatus)
|
|
4042
|
+
* - Compression-only signatures still included for complete transaction history
|
|
4043
|
+
*/
|
|
4044
|
+
interface UnifiedSignatureInfo {
|
|
4045
|
+
/** Transaction signature (base58) */
|
|
4046
|
+
signature: string;
|
|
4047
|
+
/** Slot when the transaction was processed */
|
|
4048
|
+
slot: number;
|
|
4049
|
+
/** Block time (unix timestamp), null if not available */
|
|
4050
|
+
blockTime: number | null;
|
|
4051
|
+
/** Transaction error, null if successful. Only from Solana RPC. */
|
|
4052
|
+
err: any | null;
|
|
4053
|
+
/** Memo data. Only from Solana RPC. */
|
|
4054
|
+
memo: string | null;
|
|
4055
|
+
/** Confirmation status. Only from Solana RPC. */
|
|
4056
|
+
confirmationStatus?: string;
|
|
4057
|
+
/**
|
|
4058
|
+
* Sources where this signature was found.
|
|
4059
|
+
* - ['solana'] = only in Solana RPC
|
|
4060
|
+
* - ['compressed'] = only in compression indexer
|
|
4061
|
+
* - ['solana', 'compressed'] = found in both (compression tx indexed by both)
|
|
4062
|
+
*/
|
|
4063
|
+
sources: SignatureSourceType[];
|
|
4064
|
+
}
|
|
4065
|
+
/**
|
|
4066
|
+
* Result of getSignaturesForAddressInterface / getSignaturesForOwnerInterface.
|
|
4067
|
+
*
|
|
4068
|
+
* Design rationale:
|
|
4069
|
+
* - `signatures`: Unified view, merged and deduplicated, sorted by slot desc
|
|
4070
|
+
* - `solana` / `compressed`: Raw responses preserved for clients that need source-specific data
|
|
4071
|
+
* - Allows callers to use the unified view OR drill into specific sources
|
|
4072
|
+
*/
|
|
4073
|
+
interface SignaturesForAddressInterfaceResult {
|
|
4074
|
+
/** Merged signatures from all sources, sorted by slot (descending) */
|
|
4075
|
+
signatures: UnifiedSignatureInfo[];
|
|
4076
|
+
/** Raw signatures from Solana RPC */
|
|
4077
|
+
solana: ConfirmedSignatureInfo[];
|
|
4078
|
+
/** Raw signatures from compression indexer */
|
|
4079
|
+
compressed: SignatureWithMetadata[];
|
|
4080
|
+
}
|
|
4081
|
+
/**
|
|
4082
|
+
* Unified token balance combining hot and cold token balances.
|
|
4083
|
+
*/
|
|
4084
|
+
interface UnifiedTokenBalance {
|
|
4085
|
+
/** Total balance (hot + cold) */
|
|
4086
|
+
amount: BN;
|
|
4087
|
+
/** True if any cold balance exists - call load() before usage */
|
|
4088
|
+
hasColdBalance: boolean;
|
|
4089
|
+
/** Token decimals (from on-chain mint or 0 if unknown) */
|
|
4090
|
+
decimals: number;
|
|
4091
|
+
/** Raw Solana RPC TokenAmount response, null if no on-chain account */
|
|
4092
|
+
solana: TokenAmount | null;
|
|
4093
|
+
}
|
|
4094
|
+
/**
|
|
4095
|
+
* Unified SOL balance combining hot and cold SOL balances.
|
|
4096
|
+
*/
|
|
4097
|
+
interface UnifiedBalance {
|
|
4098
|
+
/** Total balance (hot + cold) in lamports */
|
|
4099
|
+
total: BN;
|
|
4100
|
+
/** True if any cold balance exists - call load() before usage */
|
|
4101
|
+
hasColdBalance: boolean;
|
|
4102
|
+
}
|
|
3945
4103
|
|
|
3946
4104
|
interface TestRpcConfig {
|
|
3947
4105
|
/**
|
|
@@ -4174,6 +4332,12 @@ declare class TestRpc extends Connection implements CompressionApiInterface {
|
|
|
4174
4332
|
*/
|
|
4175
4333
|
getValidityProof(hashes?: BN254[], newAddresses?: BN254[]): Promise<ValidityProofWithContext>;
|
|
4176
4334
|
getValidityProofV0(hashes?: HashWithTree[], newAddresses?: AddressWithTree[]): Promise<ValidityProofWithContext>;
|
|
4335
|
+
getValidityProofV2(accountMerkleContexts?: any[], newAddresses?: any[], derivationMode?: any): Promise<ValidityProofWithContext>;
|
|
4336
|
+
getAccountInfoInterface(_address: PublicKey, _programId: PublicKey, _addressSpaceInfo: any): Promise<any>;
|
|
4337
|
+
getSignaturesForAddressInterface(_address: PublicKey, _options?: any, _compressedOptions?: PaginatedOptions): Promise<any>;
|
|
4338
|
+
getSignaturesForOwnerInterface(_owner: PublicKey, _options?: any, _compressedOptions?: PaginatedOptions): Promise<any>;
|
|
4339
|
+
getTokenAccountBalanceInterface(_address: PublicKey, _owner: PublicKey, _mint: PublicKey, _commitment?: any): Promise<any>;
|
|
4340
|
+
getBalanceInterface(_address: PublicKey, _commitment?: any): Promise<any>;
|
|
4177
4341
|
}
|
|
4178
4342
|
|
|
4179
4343
|
declare class IndexedElement {
|
|
@@ -4371,7 +4535,6 @@ type TokenData = {
|
|
|
4371
4535
|
state: number;
|
|
4372
4536
|
tlv: Buffer | null;
|
|
4373
4537
|
};
|
|
4374
|
-
declare const TokenDataLayout: Layout<TokenData>;
|
|
4375
4538
|
type EventWithParsedTokenTlvData = {
|
|
4376
4539
|
inputCompressedAccountHashes: number[][];
|
|
4377
4540
|
outputCompressedAccounts: ParsedTokenAccount[];
|
|
@@ -4494,6 +4657,12 @@ interface NullifierMetadata {
|
|
|
4494
4657
|
nullifier: BN254;
|
|
4495
4658
|
txHash: BN254;
|
|
4496
4659
|
}
|
|
4660
|
+
/**
|
|
4661
|
+
* Merge signatures from Solana RPC and compression indexer.
|
|
4662
|
+
* Deduplicates by signature, tracking sources in the `sources` array.
|
|
4663
|
+
* When a signature exists in both, uses Solana data (richer) but marks both sources.
|
|
4664
|
+
*/
|
|
4665
|
+
declare function mergeSignatures(solanaSignatures: ConfirmedSignatureInfo[], compressedSignatures: SignatureWithMetadata[]): UnifiedSignatureInfo[];
|
|
4497
4666
|
/**
|
|
4498
4667
|
*
|
|
4499
4668
|
*/
|
|
@@ -4516,6 +4685,7 @@ declare class Rpc extends Connection implements CompressionApiInterface {
|
|
|
4516
4685
|
/**
|
|
4517
4686
|
* Get a list of all state tree infos. If not already cached, fetches from
|
|
4518
4687
|
* the cluster.
|
|
4688
|
+
* if featureFlags.isV2(), returns v2 trees too.
|
|
4519
4689
|
*/
|
|
4520
4690
|
getStateTreeInfos(): Promise<TreeInfo[]>;
|
|
4521
4691
|
/**
|
|
@@ -4686,6 +4856,17 @@ declare class Rpc extends Connection implements CompressionApiInterface {
|
|
|
4686
4856
|
* @returns validity proof with context
|
|
4687
4857
|
*/
|
|
4688
4858
|
getValidityProofV0(hashes?: HashWithTree[], newAddresses?: AddressWithTree[]): Promise<ValidityProofWithContext>;
|
|
4859
|
+
/**
|
|
4860
|
+
* Fetch the latest validity proof for (1) compressed accounts specified by
|
|
4861
|
+
* an array of account Merkle contexts, and (2) new unique addresses specified by
|
|
4862
|
+
* an array of address objects with tree info.
|
|
4863
|
+
*
|
|
4864
|
+
* Validity proofs prove the presence of compressed accounts in state trees
|
|
4865
|
+
* and the non-existence of addresses in address trees, respectively. They
|
|
4866
|
+
* enable verification without recomputing the merkle proof path, thus
|
|
4867
|
+
* lowering verification and data costs.
|
|
4868
|
+
*/
|
|
4869
|
+
getValidityProofV2(accountMerkleContexts?: (MerkleContext | undefined)[], newAddresses?: AddressWithTreeInfoV2[], derivationMode?: DerivationMode): Promise<ValidityProofWithContext>;
|
|
4689
4870
|
/**
|
|
4690
4871
|
* Fetch the latest validity proof for (1) compressed accounts specified by
|
|
4691
4872
|
* an array of account hashes. (2) new unique addresses specified by an
|
|
@@ -4703,6 +4884,65 @@ declare class Rpc extends Connection implements CompressionApiInterface {
|
|
|
4703
4884
|
* @returns validity proof with context
|
|
4704
4885
|
*/
|
|
4705
4886
|
getValidityProofAndRpcContext(hashes?: HashWithTree[], newAddresses?: AddressWithTree[]): Promise<WithContext<ValidityProofWithContext>>;
|
|
4887
|
+
/**
|
|
4888
|
+
* Fetch the account info for the specified public key. Returns metadata
|
|
4889
|
+
* to load in case the account is cold.
|
|
4890
|
+
* @param address The account address to fetch.
|
|
4891
|
+
* @param programId The owner program ID.
|
|
4892
|
+
* @param commitmentOrConfig Optional. The commitment or config to use
|
|
4893
|
+
* for the onchain account fetch.
|
|
4894
|
+
* @param addressSpace Optional. The address space info that was
|
|
4895
|
+
* used at init.
|
|
4896
|
+
*
|
|
4897
|
+
* @returns Account info with load info, or null if
|
|
4898
|
+
* account doesn't exist. LoadContext is always
|
|
4899
|
+
* some if the account is compressible. isCold
|
|
4900
|
+
* indicates the current state of the account,
|
|
4901
|
+
* if true the account must referenced in a
|
|
4902
|
+
* load instruction before use.
|
|
4903
|
+
*/
|
|
4904
|
+
getAccountInfoInterface(address: PublicKey, programId: PublicKey, commitmentOrConfig?: Commitment | GetAccountInfoConfig, addressSpace?: TreeInfo): Promise<{
|
|
4905
|
+
accountInfo: AccountInfo<Buffer$1>;
|
|
4906
|
+
isCold: boolean;
|
|
4907
|
+
loadContext?: MerkleContext;
|
|
4908
|
+
} | null>;
|
|
4909
|
+
/**
|
|
4910
|
+
* Get signatures for an address from both Solana and compression indexer.
|
|
4911
|
+
*
|
|
4912
|
+
* @param address Address to fetch signatures for.
|
|
4913
|
+
* @param options Options for the Solana getSignaturesForAddress call.
|
|
4914
|
+
* @param compressedOptions Options for the compression getCompressionSignaturesForAddress call.
|
|
4915
|
+
* @returns Unified signatures from both sources.
|
|
4916
|
+
*/
|
|
4917
|
+
getSignaturesForAddressInterface(address: PublicKey, options?: SignaturesForAddressOptions, compressedOptions?: PaginatedOptions): Promise<SignaturesForAddressInterfaceResult>;
|
|
4918
|
+
/**
|
|
4919
|
+
* Get signatures for an owner from both Solana and compression indexer.
|
|
4920
|
+
*
|
|
4921
|
+
* @param owner Owner address to fetch signatures for.
|
|
4922
|
+
* @param options Options for the Solana getSignaturesForAddress call.
|
|
4923
|
+
* @param compressedOptions Options for the compression getCompressionSignaturesForOwner call.
|
|
4924
|
+
* @returns Unified signatures from both sources.
|
|
4925
|
+
*/
|
|
4926
|
+
getSignaturesForOwnerInterface(owner: PublicKey, options?: SignaturesForAddressOptions, compressedOptions?: PaginatedOptions): Promise<SignaturesForAddressInterfaceResult>;
|
|
4927
|
+
/**
|
|
4928
|
+
* Get token account balance for an address, regardless of whether the token
|
|
4929
|
+
* account is hot or cold.
|
|
4930
|
+
*
|
|
4931
|
+
* @param address Token account address.
|
|
4932
|
+
* @param owner Owner public key.
|
|
4933
|
+
* @param mint Mint public key.
|
|
4934
|
+
* @param commitment Commitment level for on-chain query.
|
|
4935
|
+
* @returns Unified token balance from both sources.
|
|
4936
|
+
*/
|
|
4937
|
+
getTokenAccountBalanceInterface(address: PublicKey, owner: PublicKey, mint: PublicKey, commitment?: Commitment): Promise<UnifiedTokenBalance>;
|
|
4938
|
+
/**
|
|
4939
|
+
* Get SOL balance for an address, regardless of whether the account is hot or cold.
|
|
4940
|
+
*
|
|
4941
|
+
* @param address Address to fetch balance for.
|
|
4942
|
+
* @param commitment Commitment level for on-chain query.
|
|
4943
|
+
* @returns Unified SOL balance.
|
|
4944
|
+
*/
|
|
4945
|
+
getBalanceInterface(address: PublicKey, commitment?: Commitment): Promise<UnifiedBalance>;
|
|
4706
4946
|
}
|
|
4707
4947
|
|
|
4708
4948
|
/**
|
|
@@ -6180,4 +6420,4 @@ declare class MerkleTreeError extends MetaError {
|
|
|
6180
6420
|
declare class UtilsError extends MetaError {
|
|
6181
6421
|
}
|
|
6182
6422
|
|
|
6183
|
-
export { ADDRESS_QUEUE_ROLLOVER_FEE,
|
|
6423
|
+
export { ADDRESS_QUEUE_ROLLOVER_FEE, ADDRESS_TREE_NETWORK_FEE_V1, ADDRESS_TREE_NETWORK_FEE_V2, ALICE, type AccountDataWithTreeInfo, type AccountProofInput, AccountProofResult, type ActiveTreeBundle, type AddressTreeInfo, type AddressWithTree, type AddressWithTreeInfo, type AddressWithTreeInfoV2, AppendLeavesInputLayout, AppendNullifyCreateAddressInputsMetaLayout, type BN254, BOB, BalanceResult, CHARLIE, COMPRESSED_TOKEN_PROGRAM_ID, COMPUTE_BUDGET_PATTERN, CTOKEN_PROGRAM_ID, type ClientSubscriptionId, type CompressedAccount, type CompressedAccountData, CompressedAccountLayout, type CompressedAccountLegacy, type CompressedAccountMeta, CompressedAccountResult, CompressedAccountResultV2, type CompressedAccountWithMerkleContext, type CompressedAccountWithMerkleContextLegacy, CompressedAccountsByOwnerResult, CompressedAccountsByOwnerResultV2, type CompressedCpiContext, CompressedCpiContextLayout, type CompressedMintTokenHolders, CompressedMintTokenHoldersResult, type CompressedProof, CompressedProofLayout, type CompressedProofWithContext, CompressedTokenAccountResult, CompressedTokenAccountResultV2, CompressedTokenAccountsByOwnerOrDelegateResult, CompressedTokenAccountsByOwnerOrDelegateResultV2, type CompressedTransaction, CompressedTransactionResult, CompressedTransactionResultV2, type CompressionApiInterface, CreateUtxoError, CreateUtxoErrorCode, DAVE, DEFAULT_MERKLE_TREE_HEIGHT, DEFAULT_MERKLE_TREE_ROOTS, DEFAULT_ZERO, DerivationMode, type EventWithParsedTokenTlvData, FIELD_SIZE, type GetCompressedAccountConfig, type GetCompressedAccountsByOwnerConfig, type GetCompressedAccountsConfig, type GetCompressedAccountsFilter, type GetCompressedTokenAccountsByOwnerOrDelegateOptions, HIGHEST_ADDRESS_PLUS_ONE, HashError, HashErrorCode, type HashWithTree, type HashWithTreeInfo, HealthResult, type HexBatchInputsForProver, type HexInputsForProver, IDL, INSERT_INTO_QUEUES_DISCRIMINATOR, INVOKE_CPI_DISCRIMINATOR, INVOKE_CPI_WITH_ACCOUNT_INFO_DISCRIMINATOR, INVOKE_CPI_WITH_READ_ONLY_DISCRIMINATOR, INVOKE_DISCRIMINATOR, InAccountLayout, IndexedArray, IndexedElement, IndexedElementBundle, type InputTokenDataWithContext, InsertAddressInputLayout, InsertNullifierInputLayout, type InstructionDataInvoke, type InstructionDataInvokeCpi, InstructionDataInvokeCpiLayout, InstructionDataInvokeCpiWithReadOnlyLayout, InstructionDataInvokeLayout, type LatestNonVotingSignatures, type LatestNonVotingSignaturesPaginated, LatestNonVotingSignaturesResult, LatestNonVotingSignaturesResultPaginated, LightSystemProgram, type LightSystemProgram$1 as LightSystemProgramIDL, type LightWasm, LookupTableError, LookupTableErrorCode, type MerkleContext, MerkleContextLayout, type MerkleContextLegacy, type MerkleContextWithMerkleProof, type MerkleContextWithNewAddressProof, MerkleProofResult, MerkleProofResultV2, MerkleTree, MerkleTreeError, MerkleTreeErrorCode, type MerkleTreeSequenceNumber, MerkleTreeSequenceNumberLayout, MultipleCompressedAccountsResult, MultipleCompressedAccountsResultV2, MultipleMerkleProofsResult, MultipleMerkleProofsResultV2, NativeBalanceResult, type NewAddressParams, NewAddressParamsAssignedPackedLayout, NewAddressParamsLayout, type NewAddressParamsPacked, type NewAddressProofInput, NewAddressProofResult, type NonInclusionJsonStruct, type NonInclusionMerkleProofInputs, type NullifierMetadata, type OutputCompressedAccountWithPackedContext, PackedAccounts, type PackedAddressTreeInfo, type PackedCompressedAccountWithMerkleContext, type PackedDecompressResult, PackedMerkleContextLayout, type PackedMerkleContextLegacy, PackedReadOnlyAddressLayout, PackedReadOnlyCompressedAccountLayout, type PackedStateTreeInfo, type PackedStateTreeInfos, type PackedTreeInfos, type PaginatedOptions, type ParsedTokenAccount, ProofError, ProofErrorCode, type PublicTransactionEvent, PublicTransactionEventLayout, RootIndexResultV2, Rpc, RpcError, RpcErrorCode, type RpcResult, type RpcResultError, type RpcResultSuccess, STATE_MERKLE_TREE_NETWORK_FEE, STATE_MERKLE_TREE_ROLLOVER_FEE, SelectInUtxosError, SelectInUtxosErrorCode, SignatureListResult, SignatureListWithCursorResult, SignatureSource, type SignatureSourceType, type SignatureWithMetadata, type SignaturesForAddressInterfaceResult, SlotResult, type StateTreeInfo, type StateTreeLUTPair, SystemAccountMetaConfig, TRANSACTION_MERKLE_TREE_ROLLOVER_THRESHOLD, TestRpc, type TestRpcConfig, type TokenBalance, TokenBalanceListResult, TokenBalanceListResultV2, TokenBalanceResult, type TokenData$1 as TokenData, TokenDataResult, type TreeInfo, TreeType, UTXO_MERGE_MAXIMUM, UTXO_MERGE_THRESHOLD, type UnifiedBalance, type UnifiedSignatureInfo, type UnifiedTokenBalance, UtilsError, UtilsErrorCode, UtxoError, UtxoErrorCode, VERSION, type ValidityProof, ValidityProofResult, ValidityProofResultV2, type ValidityProofWithContext, type WithContext, type WithCursor, type WithRpcContext, accountCompressionProgram, addressQueue, addressTree, airdropSol, batchAddressTree, batchCpiContext1, batchCpiContext2, batchCpiContext3, batchCpiContext4, batchCpiContext5, batchMerkleTree, batchMerkleTree1, batchMerkleTree2, batchMerkleTree3, batchMerkleTree4, batchMerkleTree5, batchQueue, batchQueue1, batchQueue2, batchQueue3, batchQueue4, batchQueue5, bn, bufToDecStr, buildAndSignTx, buildTx, byteArrayToKeypair, calculateComputeUnitPrice, checkValidityProofShape, compress, confirmConfig, confirmTransaction, confirmTx, convertInvokeCpiWithReadOnlyToInvoke, convertMerkleProofsWithContextToHex, convertNonInclusionMerkleProofInputsToHex, convertToPublicTransactionEvent, cpiContext2Pubkey, cpiContextPubkey, createAccount, createAccountWithLamports, createBN254, createCompressedAccountLegacy, createCompressedAccountMeta, createCompressedAccountWithMerkleContextLegacy, createMerkleContextLegacy, createRpc, createRpcResult, createStateTreeLookupTable, decodeInstructionDataInvoke, decodeInstructionDataInvokeCpi, decodeInstructionDataInvokeCpiWithReadOnly, decodePublicTransactionEvent, decompress, dedupeSigner, deepEqual, defaultStateTreeLookupTables, defaultStaticAccounts, defaultStaticAccountsStruct, defaultTestStateTreeAccounts, defaultTestStateTreeAccounts2, deriveAddress, deriveAddressSeed, deriveAddressSeedV2, deriveAddressV2, deserializeAppendNullifyCreateAddressInputsIndexer, encodeBN254toBase58, encodeInstructionDataInvoke, encodePublicTransactionEvent, extendStateTreeLookupTable, featureFlags, getAccountCompressionAuthority, getAllStateTreeInfos, getBatchAddressTreeInfo, getCompressedTokenAccountByHashTest, getCompressedTokenAccounts, getCompressedTokenAccountsByDelegateTest, getCompressedTokenAccountsByOwnerTest, getConnection, getDefaultAddressSpace, getDefaultAddressTreeInfo, getIndexOrAdd, getLightSystemAccountMetas, getLightSystemAccountMetasV2, getOutputQueue, getOutputTreeInfo, getParsedEvents, getPublicInputHash, getRegisteredProgramPda, getStateTreeInfoByPubkey, getTestKeypair, getTestRpc, getTreeInfoByPubkey, hashToBn254FieldSizeBe, hashvToBn254FieldSizeBe, hashvToBn254FieldSizeBeU8Array, invokeAccountsLayout, type invokeAccountsLayoutParams, isLocalTest, isSmallerThanBn254FieldSizeBe, jsonRpcResult, jsonRpcResultAndContext, lightSystemProgram, localTestActiveStateTreeInfos, mergeSignatures, merkleTree2Pubkey, merkletreePubkey, negateAndCompressProof, newAccountWithLamports, noopProgram, nullifiedStateTreeLookupTableDevnet, nullifiedStateTreeLookupTableMainnet, nullifierQueue2Pubkey, nullifierQueuePubkey, nullifyLookupTable, packCompressedAccounts, packDecompressAccountsIdempotent, packNewAddressParams, packTreeInfos, padOutputStateMerkleTrees, parseAccountData, parseEvents, parseLightTransaction, parsePublicTransactionEventWithIdl, parseTokenLayoutWithIdl, pickRandomTreeAndQueue, pipe, placeholderValidityProof, proofFromJsonStruct, proverRequest, pushUniqueItems, rpcRequest, selectMinCompressedSolAccountsForTransfer, selectStateTreeInfo, sendAndConfirmTx, sleep, stateTreeLookupTableDevnet, stateTreeLookupTableMainnet, sumUpLamports, toAccountMetas, toArray, toCamelCase, toHex, toUnixTimestamp, transfer, validateNumbers, validateNumbersForInclusionProof, validateNumbersForNonInclusionProof, validateNumbersForProof, validateSameOwner, validateSufficientBalance, versionedEndpoint, wrapBigNumbersAsStrings };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lightprotocol/stateless.js",
|
|
3
|
-
"version": "0.22.1-alpha.
|
|
3
|
+
"version": "0.22.1-alpha.3",
|
|
4
4
|
"description": "JavaScript API for Light & ZK Compression",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/node/index.cjs",
|
|
@@ -103,9 +103,10 @@
|
|
|
103
103
|
},
|
|
104
104
|
"scripts": {
|
|
105
105
|
"test": "pnpm test:unit:all && pnpm test:e2e:all",
|
|
106
|
+
"test-ci": "vitest run tests/unit && pnpm test:e2e:all",
|
|
107
|
+
"test:v1": "pnpm build:v1 && LIGHT_PROTOCOL_VERSION=V1 vitest run tests/unit && LIGHT_PROTOCOL_VERSION=V1 pnpm test:e2e:all",
|
|
108
|
+
"test:v2": "pnpm build:v2 && LIGHT_PROTOCOL_VERSION=V2 vitest run tests/unit && LIGHT_PROTOCOL_VERSION=V2 pnpm test:e2e:all",
|
|
106
109
|
"test-all": "vitest run",
|
|
107
|
-
"test:v1": "LIGHT_PROTOCOL_VERSION=V1 pnpm test",
|
|
108
|
-
"test:v2": "LIGHT_PROTOCOL_VERSION=V2 pnpm test",
|
|
109
110
|
"test:unit:all": "vitest run tests/unit --reporter=verbose",
|
|
110
111
|
"test:unit:all:v1": "LIGHT_PROTOCOL_VERSION=V1 vitest run tests/unit --reporter=verbose",
|
|
111
112
|
"test:unit:all:v2": "LIGHT_PROTOCOL_VERSION=V2 vitest run tests/unit --reporter=verbose",
|
|
@@ -119,7 +120,7 @@
|
|
|
119
120
|
"test:e2e:rpc-interop": "pnpm test-validator && vitest run tests/e2e/rpc-interop.test.ts --reporter=verbose --bail=1",
|
|
120
121
|
"test:e2e:rpc-multi-trees": "pnpm test-validator && vitest run tests/e2e/rpc-multi-trees.test.ts --reporter=verbose --bail=1",
|
|
121
122
|
"test:e2e:browser": "pnpm playwright test",
|
|
122
|
-
"test:e2e:all": "pnpm test-validator && vitest run tests/e2e/test-rpc.test.ts && vitest run tests/e2e/compress.test.ts && vitest run tests/e2e/transfer.test.ts && vitest run tests/e2e/rpc-interop.test.ts && pnpm test-validator-skip-prover && vitest run tests/e2e/rpc-multi-trees.test.ts && vitest run tests/e2e/layout.test.ts && vitest run tests/e2e/safe-conversion.test.ts",
|
|
123
|
+
"test:e2e:all": "pnpm test-validator && vitest run tests/e2e/test-rpc.test.ts && vitest run tests/e2e/compress.test.ts && vitest run tests/e2e/transfer.test.ts && vitest run tests/e2e/rpc-interop.test.ts && vitest run tests/e2e/interface-methods.test.ts && pnpm test-validator-skip-prover && vitest run tests/e2e/rpc-multi-trees.test.ts && vitest run tests/e2e/layout.test.ts && vitest run tests/e2e/safe-conversion.test.ts",
|
|
123
124
|
"test:index": "vitest run tests/e2e/program.test.ts",
|
|
124
125
|
"test:e2e:layout": "vitest run tests/e2e/layout.test.ts --reporter=verbose",
|
|
125
126
|
"test:e2e:safe-conversion": "vitest run tests/e2e/safe-conversion.test.ts --reporter=verbose",
|
|
@@ -131,7 +132,6 @@
|
|
|
131
132
|
"build:v1": "LIGHT_PROTOCOL_VERSION=V1 pnpm build:bundle",
|
|
132
133
|
"build:v2": "LIGHT_PROTOCOL_VERSION=V2 pnpm build:bundle",
|
|
133
134
|
"build-ci": "if [ \"$LIGHT_PROTOCOL_VERSION\" = \"V2\" ]; then LIGHT_PROTOCOL_VERSION=V2 pnpm build:bundle; else LIGHT_PROTOCOL_VERSION=V1 pnpm build:bundle; fi",
|
|
134
|
-
"test-ci": "pnpm test",
|
|
135
135
|
"format": "prettier --write .",
|
|
136
136
|
"lint": "eslint ."
|
|
137
137
|
}
|