@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/es/browser/index.js
CHANGED
|
@@ -10372,6 +10372,106 @@ const IDL = {
|
|
|
10372
10372
|
},
|
|
10373
10373
|
],
|
|
10374
10374
|
},
|
|
10375
|
+
{
|
|
10376
|
+
name: 'compressSplTokenAccount',
|
|
10377
|
+
accounts: [
|
|
10378
|
+
{
|
|
10379
|
+
name: 'feePayer',
|
|
10380
|
+
isMut: true,
|
|
10381
|
+
isSigner: true,
|
|
10382
|
+
docs: ['UNCHECKED: only pays fees.'],
|
|
10383
|
+
},
|
|
10384
|
+
{
|
|
10385
|
+
name: 'authority',
|
|
10386
|
+
isMut: false,
|
|
10387
|
+
isSigner: true,
|
|
10388
|
+
docs: [
|
|
10389
|
+
'Authority is verified through proof since both owner and delegate',
|
|
10390
|
+
'are included in the token data hash, which is a public input to the',
|
|
10391
|
+
'validity proof.',
|
|
10392
|
+
],
|
|
10393
|
+
},
|
|
10394
|
+
{
|
|
10395
|
+
name: 'cpiAuthorityPda',
|
|
10396
|
+
isMut: false,
|
|
10397
|
+
isSigner: false,
|
|
10398
|
+
},
|
|
10399
|
+
{
|
|
10400
|
+
name: 'lightSystemProgram',
|
|
10401
|
+
isMut: false,
|
|
10402
|
+
isSigner: false,
|
|
10403
|
+
},
|
|
10404
|
+
{
|
|
10405
|
+
name: 'registeredProgramPda',
|
|
10406
|
+
isMut: false,
|
|
10407
|
+
isSigner: false,
|
|
10408
|
+
},
|
|
10409
|
+
{
|
|
10410
|
+
name: 'noopProgram',
|
|
10411
|
+
isMut: false,
|
|
10412
|
+
isSigner: false,
|
|
10413
|
+
},
|
|
10414
|
+
{
|
|
10415
|
+
name: 'accountCompressionAuthority',
|
|
10416
|
+
isMut: false,
|
|
10417
|
+
isSigner: false,
|
|
10418
|
+
},
|
|
10419
|
+
{
|
|
10420
|
+
name: 'accountCompressionProgram',
|
|
10421
|
+
isMut: false,
|
|
10422
|
+
isSigner: false,
|
|
10423
|
+
},
|
|
10424
|
+
{
|
|
10425
|
+
name: 'selfProgram',
|
|
10426
|
+
isMut: false,
|
|
10427
|
+
isSigner: false,
|
|
10428
|
+
docs: ['this program is the signer of the cpi.'],
|
|
10429
|
+
},
|
|
10430
|
+
{
|
|
10431
|
+
name: 'tokenPoolPda',
|
|
10432
|
+
isMut: true,
|
|
10433
|
+
isSigner: false,
|
|
10434
|
+
isOptional: true,
|
|
10435
|
+
},
|
|
10436
|
+
{
|
|
10437
|
+
name: 'compressOrDecompressTokenAccount',
|
|
10438
|
+
isMut: true,
|
|
10439
|
+
isSigner: false,
|
|
10440
|
+
isOptional: true,
|
|
10441
|
+
},
|
|
10442
|
+
{
|
|
10443
|
+
name: 'tokenProgram',
|
|
10444
|
+
isMut: false,
|
|
10445
|
+
isSigner: false,
|
|
10446
|
+
isOptional: true,
|
|
10447
|
+
},
|
|
10448
|
+
{
|
|
10449
|
+
name: 'systemProgram',
|
|
10450
|
+
isMut: false,
|
|
10451
|
+
isSigner: false,
|
|
10452
|
+
},
|
|
10453
|
+
],
|
|
10454
|
+
args: [
|
|
10455
|
+
{
|
|
10456
|
+
name: 'owner',
|
|
10457
|
+
type: 'publicKey',
|
|
10458
|
+
},
|
|
10459
|
+
{
|
|
10460
|
+
name: 'remainingAmount',
|
|
10461
|
+
type: {
|
|
10462
|
+
option: 'u64',
|
|
10463
|
+
},
|
|
10464
|
+
},
|
|
10465
|
+
{
|
|
10466
|
+
name: 'cpiContext',
|
|
10467
|
+
type: {
|
|
10468
|
+
option: {
|
|
10469
|
+
defined: 'CompressedCpiContext',
|
|
10470
|
+
},
|
|
10471
|
+
},
|
|
10472
|
+
},
|
|
10473
|
+
],
|
|
10474
|
+
},
|
|
10375
10475
|
{
|
|
10376
10476
|
name: 'transfer',
|
|
10377
10477
|
docs: [
|
|
@@ -12653,7 +12753,7 @@ async function getCompressedTokenAccountsByOwnerOrDelegate(rpc, ownerOrDelegate,
|
|
|
12653
12753
|
res.result.value.items.map(item => {
|
|
12654
12754
|
const _account = item.account;
|
|
12655
12755
|
const _tokenData = item.tokenData;
|
|
12656
|
-
const compressedAccount = createCompressedAccountWithMerkleContext(createMerkleContext(_account.tree, mockNullifierQueue, _account.hash.toArray('be', 32), _account.leafIndex),
|
|
12756
|
+
const compressedAccount = createCompressedAccountWithMerkleContext(createMerkleContext(_account.tree, mockNullifierQueue, _account.hash.toArray('be', 32), _account.leafIndex), _account.owner, bn(_account.lamports), _account.data ? parseAccountData(_account.data) : undefined, _account.address || undefined);
|
|
12657
12757
|
const parsed = {
|
|
12658
12758
|
mint: _tokenData.mint,
|
|
12659
12759
|
owner: _tokenData.owner,
|
|
@@ -16907,7 +17007,11 @@ async function getCompressedAccountsForTest(rpc) {
|
|
|
16907
17007
|
const tokenProgramId = new PublicKey(
|
|
16908
17008
|
// TODO: can add check to ensure its consistent with the idl
|
|
16909
17009
|
'cTokenmWW8bLPjZEBAUgYy3zKxQZW6VKi7bqNFEVv3m');
|
|
16910
|
-
/**
|
|
17010
|
+
/**
|
|
17011
|
+
* Manually parse the compressed token layout for a given compressed account.
|
|
17012
|
+
* @param compressedAccount - The compressed account
|
|
17013
|
+
* @returns The parsed token data
|
|
17014
|
+
*/
|
|
16911
17015
|
function parseTokenLayoutWithIdl(compressedAccount) {
|
|
16912
17016
|
if (compressedAccount.data === null)
|
|
16913
17017
|
return null;
|
|
@@ -17492,5 +17596,5 @@ class TestRpc extends Connection {
|
|
|
17492
17596
|
}
|
|
17493
17597
|
}
|
|
17494
17598
|
|
|
17495
|
-
export { ADDRESS_QUEUE_ROLLOVER_FEE, ADDRESS_TREE_NETWORK_FEE, ALICE, IDL$2 as AccountCompressionIDL, AccountProofResult, BOB, BalanceResult, CHARLIE, CompressedAccountResult, CompressedAccountsByOwnerResult, CompressedMintTokenHoldersResult, CompressedTokenAccountResult, CompressedTokenAccountsByOwnerOrDelegateResult, CompressedTransactionResult, CreateUtxoError, CreateUtxoErrorCode, DAVE, DEFAULT_MERKLE_TREE_HEIGHT, DEFAULT_MERKLE_TREE_ROOTS, DEFAULT_ZERO, FIELD_SIZE, HIGHEST_ADDRESS_PLUS_ONE, HashError, HashErrorCode, HealthResult, IndexedArray, IndexedElement, IndexedElementBundle, LatestNonVotingSignaturesResult, LatestNonVotingSignaturesResultPaginated, IDL as LightCompressedTokenIDL, IDL$1 as LightRegistryIDL, IDL$3 as LightSystemIDL, LightSystemProgram, LookupTableError, LookupTableErrorCode, MerkeProofResult, MerkleTree, MerkleTreeError, MerkleTreeErrorCode, MultipleCompressedAccountsResult, MultipleMerkleProofsResult, NativeBalanceResult, NewAddressProofResult, ProofError, ProofErrorCode, Rpc, RpcError, RpcErrorCode, STATE_MERKLE_TREE_NETWORK_FEE, STATE_MERKLE_TREE_ROLLOVER_FEE, SelectInUtxosError, SelectInUtxosErrorCode, SignatureListResult, SignatureListWithCursorResult, SlotResult, TRANSACTION_MERKLE_TREE_ROLLOVER_THRESHOLD, TestRpc, TokenBalanceListResult, TokenBalanceListResultV2, TokenBalanceResult, TokenDataResult, UTXO_MERGE_MAXIMUM, UTXO_MERGE_THRESHOLD, UtilsError, UtilsErrorCode, UtxoError, UtxoErrorCode, ValidityProofResult, 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, getConnection, getIndexOrAdd, getParsedEvents, getRegisteredProgramPda, getTestKeypair, getTestRpc, hashToBn254FieldSizeBe, hashvToBn254FieldSizeBe, 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$1 as toArray, toCamelCase, toHex, toUnixTimestamp, transfer, useWallet, validateSameOwner, validateSufficientBalance };
|
|
17599
|
+
export { ADDRESS_QUEUE_ROLLOVER_FEE, ADDRESS_TREE_NETWORK_FEE, ALICE, IDL$2 as AccountCompressionIDL, AccountProofResult, BOB, BalanceResult, CHARLIE, CompressedAccountResult, CompressedAccountsByOwnerResult, CompressedMintTokenHoldersResult, CompressedTokenAccountResult, CompressedTokenAccountsByOwnerOrDelegateResult, CompressedTransactionResult, CreateUtxoError, CreateUtxoErrorCode, DAVE, DEFAULT_MERKLE_TREE_HEIGHT, DEFAULT_MERKLE_TREE_ROOTS, DEFAULT_ZERO, FIELD_SIZE, HIGHEST_ADDRESS_PLUS_ONE, HashError, HashErrorCode, HealthResult, IndexedArray, IndexedElement, IndexedElementBundle, LatestNonVotingSignaturesResult, LatestNonVotingSignaturesResultPaginated, IDL as LightCompressedTokenIDL, IDL$1 as LightRegistryIDL, IDL$3 as LightSystemIDL, LightSystemProgram, LookupTableError, LookupTableErrorCode, MerkeProofResult, MerkleTree, MerkleTreeError, MerkleTreeErrorCode, MultipleCompressedAccountsResult, MultipleMerkleProofsResult, NativeBalanceResult, NewAddressProofResult, ProofError, ProofErrorCode, Rpc, RpcError, RpcErrorCode, STATE_MERKLE_TREE_NETWORK_FEE, STATE_MERKLE_TREE_ROLLOVER_FEE, SelectInUtxosError, SelectInUtxosErrorCode, SignatureListResult, SignatureListWithCursorResult, SlotResult, TRANSACTION_MERKLE_TREE_ROLLOVER_THRESHOLD, TestRpc, TokenBalanceListResult, TokenBalanceListResultV2, TokenBalanceResult, TokenDataResult, UTXO_MERGE_MAXIMUM, UTXO_MERGE_THRESHOLD, UtilsError, UtilsErrorCode, UtxoError, UtxoErrorCode, ValidityProofResult, 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$1 as toArray, toCamelCase, toHex, toUnixTimestamp, transfer, useWallet, validateSameOwner, validateSufficientBalance };
|
|
17496
17600
|
//# sourceMappingURL=index.js.map
|