@lightprotocol/stateless.js 0.15.1 → 0.15.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/dist/cjs/browser/index.cjs +111 -2
- package/dist/cjs/browser/index.cjs.map +1 -1
- package/dist/cjs/node/index.cjs +111 -2
- package/dist/cjs/node/index.cjs.map +1 -1
- package/dist/es/browser/index.js +107 -3
- package/dist/es/browser/index.js.map +1 -1
- package/dist/types/index.d.ts +138 -5
- package/package.json +1 -1
package/dist/types/index.d.ts
CHANGED
|
@@ -320,7 +320,7 @@ interface InputTokenDataWithContext {
|
|
|
320
320
|
lamports: BN | null;
|
|
321
321
|
tlv: Buffer$1 | null;
|
|
322
322
|
}
|
|
323
|
-
type TokenData = {
|
|
323
|
+
type TokenData$1 = {
|
|
324
324
|
mint: PublicKey;
|
|
325
325
|
owner: PublicKey;
|
|
326
326
|
amount: BN;
|
|
@@ -412,11 +412,11 @@ interface CompressedTransaction {
|
|
|
412
412
|
compressionInfo: {
|
|
413
413
|
closedAccounts: {
|
|
414
414
|
account: CompressedAccountWithMerkleContext;
|
|
415
|
-
maybeTokenData: TokenData | null;
|
|
415
|
+
maybeTokenData: TokenData$1 | null;
|
|
416
416
|
}[];
|
|
417
417
|
openedAccounts: {
|
|
418
418
|
account: CompressedAccountWithMerkleContext;
|
|
419
|
-
maybeTokenData: TokenData | null;
|
|
419
|
+
maybeTokenData: TokenData$1 | null;
|
|
420
420
|
}[];
|
|
421
421
|
preTokenBalances?: {
|
|
422
422
|
owner: PublicKey;
|
|
@@ -480,7 +480,7 @@ type GetCompressedAccountsConfig = {
|
|
|
480
480
|
};
|
|
481
481
|
interface ParsedTokenAccount {
|
|
482
482
|
compressedAccount: CompressedAccountWithMerkleContext;
|
|
483
|
-
parsed: TokenData;
|
|
483
|
+
parsed: TokenData$1;
|
|
484
484
|
}
|
|
485
485
|
type WithContext<T> = {
|
|
486
486
|
/** context */
|
|
@@ -5596,6 +5596,106 @@ type LightCompressedToken = {
|
|
|
5596
5596
|
}
|
|
5597
5597
|
];
|
|
5598
5598
|
},
|
|
5599
|
+
{
|
|
5600
|
+
name: 'compressSplTokenAccount';
|
|
5601
|
+
accounts: [
|
|
5602
|
+
{
|
|
5603
|
+
name: 'feePayer';
|
|
5604
|
+
isMut: true;
|
|
5605
|
+
isSigner: true;
|
|
5606
|
+
docs: ['UNCHECKED: only pays fees.'];
|
|
5607
|
+
},
|
|
5608
|
+
{
|
|
5609
|
+
name: 'authority';
|
|
5610
|
+
isMut: false;
|
|
5611
|
+
isSigner: true;
|
|
5612
|
+
docs: [
|
|
5613
|
+
'Authority is verified through proof since both owner and delegate',
|
|
5614
|
+
'are included in the token data hash, which is a public input to the',
|
|
5615
|
+
'validity proof.'
|
|
5616
|
+
];
|
|
5617
|
+
},
|
|
5618
|
+
{
|
|
5619
|
+
name: 'cpiAuthorityPda';
|
|
5620
|
+
isMut: false;
|
|
5621
|
+
isSigner: false;
|
|
5622
|
+
},
|
|
5623
|
+
{
|
|
5624
|
+
name: 'lightSystemProgram';
|
|
5625
|
+
isMut: false;
|
|
5626
|
+
isSigner: false;
|
|
5627
|
+
},
|
|
5628
|
+
{
|
|
5629
|
+
name: 'registeredProgramPda';
|
|
5630
|
+
isMut: false;
|
|
5631
|
+
isSigner: false;
|
|
5632
|
+
},
|
|
5633
|
+
{
|
|
5634
|
+
name: 'noopProgram';
|
|
5635
|
+
isMut: false;
|
|
5636
|
+
isSigner: false;
|
|
5637
|
+
},
|
|
5638
|
+
{
|
|
5639
|
+
name: 'accountCompressionAuthority';
|
|
5640
|
+
isMut: false;
|
|
5641
|
+
isSigner: false;
|
|
5642
|
+
},
|
|
5643
|
+
{
|
|
5644
|
+
name: 'accountCompressionProgram';
|
|
5645
|
+
isMut: false;
|
|
5646
|
+
isSigner: false;
|
|
5647
|
+
},
|
|
5648
|
+
{
|
|
5649
|
+
name: 'selfProgram';
|
|
5650
|
+
isMut: false;
|
|
5651
|
+
isSigner: false;
|
|
5652
|
+
docs: ['this program is the signer of the cpi.'];
|
|
5653
|
+
},
|
|
5654
|
+
{
|
|
5655
|
+
name: 'tokenPoolPda';
|
|
5656
|
+
isMut: true;
|
|
5657
|
+
isSigner: false;
|
|
5658
|
+
isOptional: true;
|
|
5659
|
+
},
|
|
5660
|
+
{
|
|
5661
|
+
name: 'compressOrDecompressTokenAccount';
|
|
5662
|
+
isMut: true;
|
|
5663
|
+
isSigner: false;
|
|
5664
|
+
isOptional: true;
|
|
5665
|
+
},
|
|
5666
|
+
{
|
|
5667
|
+
name: 'tokenProgram';
|
|
5668
|
+
isMut: false;
|
|
5669
|
+
isSigner: false;
|
|
5670
|
+
isOptional: true;
|
|
5671
|
+
},
|
|
5672
|
+
{
|
|
5673
|
+
name: 'systemProgram';
|
|
5674
|
+
isMut: false;
|
|
5675
|
+
isSigner: false;
|
|
5676
|
+
}
|
|
5677
|
+
];
|
|
5678
|
+
args: [
|
|
5679
|
+
{
|
|
5680
|
+
name: 'owner';
|
|
5681
|
+
type: 'publicKey';
|
|
5682
|
+
},
|
|
5683
|
+
{
|
|
5684
|
+
name: 'remainingAmount';
|
|
5685
|
+
type: {
|
|
5686
|
+
option: 'u64';
|
|
5687
|
+
};
|
|
5688
|
+
},
|
|
5689
|
+
{
|
|
5690
|
+
name: 'cpiContext';
|
|
5691
|
+
type: {
|
|
5692
|
+
option: {
|
|
5693
|
+
defined: 'CompressedCpiContext';
|
|
5694
|
+
};
|
|
5695
|
+
};
|
|
5696
|
+
}
|
|
5697
|
+
];
|
|
5698
|
+
},
|
|
5599
5699
|
{
|
|
5600
5700
|
name: 'transfer';
|
|
5601
5701
|
docs: [
|
|
@@ -7815,4 +7915,37 @@ declare function getParsedEvents(rpc: Rpc): Promise<PublicTransactionEvent[]>;
|
|
|
7815
7915
|
declare const parseEvents: <T>(indexerEventsTransactions: (ParsedTransactionWithMeta | null)[], deserializeFn: Deserializer<T>) => NonNullable<T>[];
|
|
7816
7916
|
declare const parsePublicTransactionEventWithIdl: (data: Buffer) => PublicTransactionEvent | null;
|
|
7817
7917
|
|
|
7818
|
-
|
|
7918
|
+
type TokenData = {
|
|
7919
|
+
mint: PublicKey;
|
|
7920
|
+
owner: PublicKey;
|
|
7921
|
+
amount: BN;
|
|
7922
|
+
delegate: PublicKey | null;
|
|
7923
|
+
state: number;
|
|
7924
|
+
tlv: Buffer | null;
|
|
7925
|
+
};
|
|
7926
|
+
type EventWithParsedTokenTlvData = {
|
|
7927
|
+
inputCompressedAccountHashes: number[][];
|
|
7928
|
+
outputCompressedAccounts: ParsedTokenAccount[];
|
|
7929
|
+
};
|
|
7930
|
+
/**
|
|
7931
|
+
* Manually parse the compressed token layout for a given compressed account.
|
|
7932
|
+
* @param compressedAccount - The compressed account
|
|
7933
|
+
* @returns The parsed token data
|
|
7934
|
+
*/
|
|
7935
|
+
declare function parseTokenLayoutWithIdl(compressedAccount: CompressedAccount): TokenData | null;
|
|
7936
|
+
/**
|
|
7937
|
+
* Retrieves all compressed token accounts for a given mint and owner.
|
|
7938
|
+
*
|
|
7939
|
+
* Note: This function is intended for testing purposes only. For production, use rpc.getCompressedTokenAccounts.
|
|
7940
|
+
*
|
|
7941
|
+
* @param events Public transaction events
|
|
7942
|
+
* @param owner PublicKey of the token owner
|
|
7943
|
+
* @param mint PublicKey of the token mint
|
|
7944
|
+
*/
|
|
7945
|
+
declare function getCompressedTokenAccounts(events: PublicTransactionEvent[]): Promise<ParsedTokenAccount[]>;
|
|
7946
|
+
/** @internal */
|
|
7947
|
+
declare function getCompressedTokenAccountsByOwnerTest(rpc: Rpc, owner: PublicKey, mint: PublicKey): Promise<WithCursor<ParsedTokenAccount[]>>;
|
|
7948
|
+
declare function getCompressedTokenAccountsByDelegateTest(rpc: Rpc, delegate: PublicKey, mint: PublicKey): Promise<WithCursor<ParsedTokenAccount[]>>;
|
|
7949
|
+
declare function getCompressedTokenAccountByHashTest(rpc: Rpc, hash: BN): Promise<ParsedTokenAccount>;
|
|
7950
|
+
|
|
7951
|
+
export { ADDRESS_QUEUE_ROLLOVER_FEE, ADDRESS_TREE_NETWORK_FEE, ALICE, type AccountCompression, IDL$3 as AccountCompressionIDL, AccountProofResult, type AddressWithTree, type BN254, BOB, BalanceResult, CHARLIE, type CompressedAccount, type CompressedAccountData, CompressedAccountResult, type CompressedAccountWithMerkleContext, CompressedAccountsByOwnerResult, type CompressedMintTokenHolders, CompressedMintTokenHoldersResult, 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, 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, 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 PaginatedOptions, 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, type TokenBalance, TokenBalanceListResult, TokenBalanceListResultV2, TokenBalanceResult, type TokenData$1 as 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, deriveAddressSeed, encodeBN254toBase58, getAccountCompressionAuthority, getCompressedTokenAccountByHashTest, getCompressedTokenAccounts, getCompressedTokenAccountsByDelegateTest, getCompressedTokenAccountsByOwnerTest, getConnection, getIndexOrAdd, getParsedEvents, getRegisteredProgramPda, getTestKeypair, getTestRpc, hashToBn254FieldSizeBe, hashvToBn254FieldSizeBe, jsonRpcResult, jsonRpcResultAndContext, lightProgram, merkletreePubkey, negateAndCompressProof, newAccountWithLamports, noopProgram, nullifierQueuePubkey, packCompressedAccounts, packNewAddressParams, padOutputStateMerkleTrees, parseAccountData, parseEvents, parsePublicTransactionEventWithIdl, parseTokenLayoutWithIdl, pipe, placeholderValidityProof, proofFromJsonStruct, proverRequest, pushUniqueItems, rpcRequest, selectMinCompressedSolAccountsForTransfer, sendAndConfirmTx, sleep, sumUpLamports, toAccountMetas, toArray, toCamelCase, toHex, toUnixTimestamp, transfer, useWallet, validateSameOwner, validateSufficientBalance };
|