@lightprotocol/stateless.js 0.15.2 → 0.15.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.
- package/dist/cjs/browser/index.cjs +12 -3
- package/dist/cjs/browser/index.cjs.map +1 -1
- package/dist/cjs/node/index.cjs +12 -3
- package/dist/cjs/node/index.cjs.map +1 -1
- package/dist/es/browser/index.js +8 -4
- package/dist/es/browser/index.js.map +1 -1
- package/dist/types/index.d.ts +38 -5
- package/package.json +3 -3
|
@@ -16952,14 +16952,18 @@ async function getCompressedAccountsForTest(rpc) {
|
|
|
16952
16952
|
const tokenProgramId = new web3_js.PublicKey(
|
|
16953
16953
|
// TODO: can add check to ensure its consistent with the idl
|
|
16954
16954
|
'cTokenmWW8bLPjZEBAUgYy3zKxQZW6VKi7bqNFEVv3m');
|
|
16955
|
-
/**
|
|
16956
|
-
|
|
16955
|
+
/**
|
|
16956
|
+
* Manually parse the compressed token layout for a given compressed account.
|
|
16957
|
+
* @param compressedAccount - The compressed account
|
|
16958
|
+
* @returns The parsed token data
|
|
16959
|
+
*/
|
|
16960
|
+
function parseTokenLayoutWithIdl(compressedAccount, programId = tokenProgramId) {
|
|
16957
16961
|
if (compressedAccount.data === null)
|
|
16958
16962
|
return null;
|
|
16959
16963
|
const { data } = compressedAccount.data;
|
|
16960
16964
|
if (data.length === 0)
|
|
16961
16965
|
return null;
|
|
16962
|
-
if (compressedAccount.owner.toBase58() !==
|
|
16966
|
+
if (compressedAccount.owner.toBase58() !== programId.toBase58()) {
|
|
16963
16967
|
throw new Error(`Invalid owner ${compressedAccount.owner.toBase58()} for token layout`);
|
|
16964
16968
|
}
|
|
16965
16969
|
const decodedLayout = new anchor.BorshCoder(IDL).types.decode('TokenData', Buffer.from(data));
|
|
@@ -17626,6 +17630,10 @@ exports.deriveAddress = deriveAddress;
|
|
|
17626
17630
|
exports.deriveAddressSeed = deriveAddressSeed;
|
|
17627
17631
|
exports.encodeBN254toBase58 = encodeBN254toBase58;
|
|
17628
17632
|
exports.getAccountCompressionAuthority = getAccountCompressionAuthority;
|
|
17633
|
+
exports.getCompressedTokenAccountByHashTest = getCompressedTokenAccountByHashTest;
|
|
17634
|
+
exports.getCompressedTokenAccounts = getCompressedTokenAccounts;
|
|
17635
|
+
exports.getCompressedTokenAccountsByDelegateTest = getCompressedTokenAccountsByDelegateTest;
|
|
17636
|
+
exports.getCompressedTokenAccountsByOwnerTest = getCompressedTokenAccountsByOwnerTest;
|
|
17629
17637
|
exports.getConnection = getConnection;
|
|
17630
17638
|
exports.getIndexOrAdd = getIndexOrAdd;
|
|
17631
17639
|
exports.getParsedEvents = getParsedEvents;
|
|
@@ -17648,6 +17656,7 @@ exports.padOutputStateMerkleTrees = padOutputStateMerkleTrees;
|
|
|
17648
17656
|
exports.parseAccountData = parseAccountData;
|
|
17649
17657
|
exports.parseEvents = parseEvents;
|
|
17650
17658
|
exports.parsePublicTransactionEventWithIdl = parsePublicTransactionEventWithIdl;
|
|
17659
|
+
exports.parseTokenLayoutWithIdl = parseTokenLayoutWithIdl;
|
|
17651
17660
|
exports.pipe = pipe;
|
|
17652
17661
|
exports.placeholderValidityProof = placeholderValidityProof;
|
|
17653
17662
|
exports.proofFromJsonStruct = proofFromJsonStruct;
|