@lightprotocol/stateless.js 0.6.0 → 0.7.0
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 +44 -5
- package/dist/cjs/browser/index.cjs.map +1 -1
- package/dist/cjs/node/index.cjs +44 -5
- package/dist/cjs/node/index.cjs.map +1 -1
- package/dist/es/browser/index.js +43 -5
- package/dist/es/browser/index.js.map +1 -1
- package/dist/types/index.d.ts +39 -7
- package/package.json +3 -3
|
@@ -11716,6 +11716,7 @@ const LatestNonVotingSignaturesResult = type({
|
|
|
11716
11716
|
signature: string(),
|
|
11717
11717
|
slot: number(),
|
|
11718
11718
|
blockTime: number(),
|
|
11719
|
+
error: nullable(string()),
|
|
11719
11720
|
})),
|
|
11720
11721
|
});
|
|
11721
11722
|
/**
|
|
@@ -12167,21 +12168,44 @@ class Rpc extends web3_js.Connection {
|
|
|
12167
12168
|
* Fetch all the compressed accounts owned by the specified public key.
|
|
12168
12169
|
* Owner can be a program or user account
|
|
12169
12170
|
*/
|
|
12170
|
-
async
|
|
12171
|
-
|
|
12171
|
+
async getCompressedAccountsByOwnerWithCursor(owner, config) {
|
|
12172
|
+
var _a;
|
|
12173
|
+
const unsafeRes = await rpcRequest(this.compressionApiEndpoint, 'getCompressedAccountsByOwner', {
|
|
12174
|
+
owner: owner.toBase58(),
|
|
12175
|
+
filters: (config === null || config === void 0 ? void 0 : config.filters) || [],
|
|
12176
|
+
dataSlice: config === null || config === void 0 ? void 0 : config.dataSlice,
|
|
12177
|
+
cursor: config === null || config === void 0 ? void 0 : config.cursor,
|
|
12178
|
+
limit: (_a = config === null || config === void 0 ? void 0 : config.limit) === null || _a === void 0 ? void 0 : _a.toNumber(),
|
|
12179
|
+
});
|
|
12172
12180
|
const res = create(unsafeRes, jsonRpcResultAndContext(CompressedAccountsByOwnerResult));
|
|
12173
12181
|
if ('error' in res) {
|
|
12174
12182
|
throw new web3_js.SolanaJSONRPCError(res.error, `failed to get info for compressed accounts owned by ${owner.toBase58()}`);
|
|
12175
12183
|
}
|
|
12176
12184
|
if (res.result.value === null) {
|
|
12177
|
-
return [];
|
|
12185
|
+
return { cursor: null, value: [] };
|
|
12178
12186
|
}
|
|
12179
12187
|
const accounts = [];
|
|
12180
12188
|
res.result.value.items.map(item => {
|
|
12181
12189
|
const account = createCompressedAccountWithMerkleContext(createMerkleContext(item.tree, mockNullifierQueue, item.hash.toArray('be', 32), item.leafIndex), item.owner, bn(item.lamports), item.data ? parseAccountData(item.data) : undefined, item.address || undefined);
|
|
12182
12190
|
accounts.push(account);
|
|
12183
12191
|
});
|
|
12184
|
-
return
|
|
12192
|
+
return {
|
|
12193
|
+
value: accounts.sort((a, b) => b.leafIndex - a.leafIndex),
|
|
12194
|
+
cursor: res.result.value.cursor,
|
|
12195
|
+
};
|
|
12196
|
+
}
|
|
12197
|
+
/**
|
|
12198
|
+
* Fetch all the compressed accounts owned by the specified public key.
|
|
12199
|
+
* Owner can be a program or user account
|
|
12200
|
+
*
|
|
12201
|
+
* To use `config.limit` or `config.cursor`, please use {@link getCompressedAccountsByOwnerWithCursor} instead.
|
|
12202
|
+
*/
|
|
12203
|
+
async getCompressedAccountsByOwner(owner, config) {
|
|
12204
|
+
if ((config === null || config === void 0 ? void 0 : config.cursor) || (config === null || config === void 0 ? void 0 : config.limit)) {
|
|
12205
|
+
throw new Error('To use `limit` and `cursor`, please use getCompressedAccountsByOwnerWithCursor instead.');
|
|
12206
|
+
}
|
|
12207
|
+
const res = await this.getCompressedAccountsByOwnerWithCursor(owner, config);
|
|
12208
|
+
return res.value;
|
|
12185
12209
|
}
|
|
12186
12210
|
/**
|
|
12187
12211
|
* Fetch all the compressed token accounts owned by the specified public
|
|
@@ -18158,10 +18182,25 @@ class TestRpc extends web3_js.Connection {
|
|
|
18158
18182
|
* Fetch all the compressed accounts owned by the specified public key.
|
|
18159
18183
|
* Owner can be a program or user account
|
|
18160
18184
|
*/
|
|
18161
|
-
async getCompressedAccountsByOwner(owner) {
|
|
18185
|
+
async getCompressedAccountsByOwner(owner, _config) {
|
|
18186
|
+
if (_config) {
|
|
18187
|
+
throw new Error('dataSlice or filters are not supported in test-rpc. Please use rpc.ts instead.');
|
|
18188
|
+
}
|
|
18162
18189
|
const accounts = await getCompressedAccountsByOwnerTest(this, owner);
|
|
18163
18190
|
return accounts;
|
|
18164
18191
|
}
|
|
18192
|
+
/**
|
|
18193
|
+
* Fetch all the compressed accounts owned by the specified public key.
|
|
18194
|
+
* Owner can be a program or user account
|
|
18195
|
+
* Returns with cursor
|
|
18196
|
+
*/
|
|
18197
|
+
async getCompressedAccountsByOwnerWithCursor(owner, _config) {
|
|
18198
|
+
if (_config) {
|
|
18199
|
+
throw new Error('dataSlice or filters are not supported in test-rpc. Please use rpc.ts instead.');
|
|
18200
|
+
}
|
|
18201
|
+
const accounts = await getCompressedAccountsByOwnerTest(this, owner);
|
|
18202
|
+
return { cursor: null, value: accounts };
|
|
18203
|
+
}
|
|
18165
18204
|
/**
|
|
18166
18205
|
* Fetch the latest compression signatures on the cluster. Results are
|
|
18167
18206
|
* paginated.
|