@lightprotocol/stateless.js 0.5.1 → 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 +43 -5
- package/dist/cjs/browser/index.cjs.map +1 -1
- package/dist/cjs/node/index.cjs +43 -5
- package/dist/cjs/node/index.cjs.map +1 -1
- package/dist/es/browser/index.js +42 -5
- package/dist/es/browser/index.js.map +1 -1
- package/dist/types/index.d.ts +34 -7
- package/package.json +3 -3
|
@@ -12168,21 +12168,44 @@ class Rpc extends web3_js.Connection {
|
|
|
12168
12168
|
* Fetch all the compressed accounts owned by the specified public key.
|
|
12169
12169
|
* Owner can be a program or user account
|
|
12170
12170
|
*/
|
|
12171
|
-
async
|
|
12172
|
-
|
|
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
|
+
});
|
|
12173
12180
|
const res = create(unsafeRes, jsonRpcResultAndContext(CompressedAccountsByOwnerResult));
|
|
12174
12181
|
if ('error' in res) {
|
|
12175
12182
|
throw new web3_js.SolanaJSONRPCError(res.error, `failed to get info for compressed accounts owned by ${owner.toBase58()}`);
|
|
12176
12183
|
}
|
|
12177
12184
|
if (res.result.value === null) {
|
|
12178
|
-
return [];
|
|
12185
|
+
return { cursor: null, value: [] };
|
|
12179
12186
|
}
|
|
12180
12187
|
const accounts = [];
|
|
12181
12188
|
res.result.value.items.map(item => {
|
|
12182
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);
|
|
12183
12190
|
accounts.push(account);
|
|
12184
12191
|
});
|
|
12185
|
-
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;
|
|
12186
12209
|
}
|
|
12187
12210
|
/**
|
|
12188
12211
|
* Fetch all the compressed token accounts owned by the specified public
|
|
@@ -18159,10 +18182,25 @@ class TestRpc extends web3_js.Connection {
|
|
|
18159
18182
|
* Fetch all the compressed accounts owned by the specified public key.
|
|
18160
18183
|
* Owner can be a program or user account
|
|
18161
18184
|
*/
|
|
18162
|
-
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
|
+
}
|
|
18163
18189
|
const accounts = await getCompressedAccountsByOwnerTest(this, owner);
|
|
18164
18190
|
return accounts;
|
|
18165
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
|
+
}
|
|
18166
18204
|
/**
|
|
18167
18205
|
* Fetch the latest compression signatures on the cluster. Results are
|
|
18168
18206
|
* paginated.
|