@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
package/dist/cjs/node/index.cjs
CHANGED
|
@@ -13972,14 +13972,18 @@ async function getCompressedAccountsForTest(rpc) {
|
|
|
13972
13972
|
const tokenProgramId = new web3_js.PublicKey(
|
|
13973
13973
|
// TODO: can add check to ensure its consistent with the idl
|
|
13974
13974
|
'cTokenmWW8bLPjZEBAUgYy3zKxQZW6VKi7bqNFEVv3m');
|
|
13975
|
-
/**
|
|
13976
|
-
|
|
13975
|
+
/**
|
|
13976
|
+
* Manually parse the compressed token layout for a given compressed account.
|
|
13977
|
+
* @param compressedAccount - The compressed account
|
|
13978
|
+
* @returns The parsed token data
|
|
13979
|
+
*/
|
|
13980
|
+
function parseTokenLayoutWithIdl(compressedAccount, programId = tokenProgramId) {
|
|
13977
13981
|
if (compressedAccount.data === null)
|
|
13978
13982
|
return null;
|
|
13979
13983
|
const { data } = compressedAccount.data;
|
|
13980
13984
|
if (data.length === 0)
|
|
13981
13985
|
return null;
|
|
13982
|
-
if (compressedAccount.owner.toBase58() !==
|
|
13986
|
+
if (compressedAccount.owner.toBase58() !== programId.toBase58()) {
|
|
13983
13987
|
throw new Error(`Invalid owner ${compressedAccount.owner.toBase58()} for token layout`);
|
|
13984
13988
|
}
|
|
13985
13989
|
const decodedLayout = new anchor.BorshCoder(IDL).types.decode('TokenData', Buffer.from(data));
|
|
@@ -14646,6 +14650,10 @@ exports.deriveAddress = deriveAddress;
|
|
|
14646
14650
|
exports.deriveAddressSeed = deriveAddressSeed;
|
|
14647
14651
|
exports.encodeBN254toBase58 = encodeBN254toBase58;
|
|
14648
14652
|
exports.getAccountCompressionAuthority = getAccountCompressionAuthority;
|
|
14653
|
+
exports.getCompressedTokenAccountByHashTest = getCompressedTokenAccountByHashTest;
|
|
14654
|
+
exports.getCompressedTokenAccounts = getCompressedTokenAccounts;
|
|
14655
|
+
exports.getCompressedTokenAccountsByDelegateTest = getCompressedTokenAccountsByDelegateTest;
|
|
14656
|
+
exports.getCompressedTokenAccountsByOwnerTest = getCompressedTokenAccountsByOwnerTest;
|
|
14649
14657
|
exports.getConnection = getConnection;
|
|
14650
14658
|
exports.getIndexOrAdd = getIndexOrAdd;
|
|
14651
14659
|
exports.getParsedEvents = getParsedEvents;
|
|
@@ -14668,6 +14676,7 @@ exports.padOutputStateMerkleTrees = padOutputStateMerkleTrees;
|
|
|
14668
14676
|
exports.parseAccountData = parseAccountData;
|
|
14669
14677
|
exports.parseEvents = parseEvents;
|
|
14670
14678
|
exports.parsePublicTransactionEventWithIdl = parsePublicTransactionEventWithIdl;
|
|
14679
|
+
exports.parseTokenLayoutWithIdl = parseTokenLayoutWithIdl;
|
|
14671
14680
|
exports.pipe = pipe;
|
|
14672
14681
|
exports.placeholderValidityProof = placeholderValidityProof;
|
|
14673
14682
|
exports.proofFromJsonStruct = proofFromJsonStruct;
|