@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
package/dist/cjs/node/index.cjs
CHANGED
|
@@ -10138,21 +10138,44 @@ class Rpc extends web3_js.Connection {
|
|
|
10138
10138
|
* Fetch all the compressed accounts owned by the specified public key.
|
|
10139
10139
|
* Owner can be a program or user account
|
|
10140
10140
|
*/
|
|
10141
|
-
async
|
|
10142
|
-
|
|
10141
|
+
async getCompressedAccountsByOwnerWithCursor(owner, config) {
|
|
10142
|
+
var _a;
|
|
10143
|
+
const unsafeRes = await rpcRequest(this.compressionApiEndpoint, 'getCompressedAccountsByOwner', {
|
|
10144
|
+
owner: owner.toBase58(),
|
|
10145
|
+
filters: (config === null || config === void 0 ? void 0 : config.filters) || [],
|
|
10146
|
+
dataSlice: config === null || config === void 0 ? void 0 : config.dataSlice,
|
|
10147
|
+
cursor: config === null || config === void 0 ? void 0 : config.cursor,
|
|
10148
|
+
limit: (_a = config === null || config === void 0 ? void 0 : config.limit) === null || _a === void 0 ? void 0 : _a.toNumber(),
|
|
10149
|
+
});
|
|
10143
10150
|
const res = create(unsafeRes, jsonRpcResultAndContext(CompressedAccountsByOwnerResult));
|
|
10144
10151
|
if ('error' in res) {
|
|
10145
10152
|
throw new web3_js.SolanaJSONRPCError(res.error, `failed to get info for compressed accounts owned by ${owner.toBase58()}`);
|
|
10146
10153
|
}
|
|
10147
10154
|
if (res.result.value === null) {
|
|
10148
|
-
return [];
|
|
10155
|
+
return { cursor: null, value: [] };
|
|
10149
10156
|
}
|
|
10150
10157
|
const accounts = [];
|
|
10151
10158
|
res.result.value.items.map(item => {
|
|
10152
10159
|
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);
|
|
10153
10160
|
accounts.push(account);
|
|
10154
10161
|
});
|
|
10155
|
-
return
|
|
10162
|
+
return {
|
|
10163
|
+
value: accounts.sort((a, b) => b.leafIndex - a.leafIndex),
|
|
10164
|
+
cursor: res.result.value.cursor,
|
|
10165
|
+
};
|
|
10166
|
+
}
|
|
10167
|
+
/**
|
|
10168
|
+
* Fetch all the compressed accounts owned by the specified public key.
|
|
10169
|
+
* Owner can be a program or user account
|
|
10170
|
+
*
|
|
10171
|
+
* To use `config.limit` or `config.cursor`, please use {@link getCompressedAccountsByOwnerWithCursor} instead.
|
|
10172
|
+
*/
|
|
10173
|
+
async getCompressedAccountsByOwner(owner, config) {
|
|
10174
|
+
if ((config === null || config === void 0 ? void 0 : config.cursor) || (config === null || config === void 0 ? void 0 : config.limit)) {
|
|
10175
|
+
throw new Error('To use `limit` and `cursor`, please use getCompressedAccountsByOwnerWithCursor instead.');
|
|
10176
|
+
}
|
|
10177
|
+
const res = await this.getCompressedAccountsByOwnerWithCursor(owner, config);
|
|
10178
|
+
return res.value;
|
|
10156
10179
|
}
|
|
10157
10180
|
/**
|
|
10158
10181
|
* Fetch all the compressed token accounts owned by the specified public
|
|
@@ -15026,10 +15049,25 @@ class TestRpc extends web3_js.Connection {
|
|
|
15026
15049
|
* Fetch all the compressed accounts owned by the specified public key.
|
|
15027
15050
|
* Owner can be a program or user account
|
|
15028
15051
|
*/
|
|
15029
|
-
async getCompressedAccountsByOwner(owner) {
|
|
15052
|
+
async getCompressedAccountsByOwner(owner, _config) {
|
|
15053
|
+
if (_config) {
|
|
15054
|
+
throw new Error('dataSlice or filters are not supported in test-rpc. Please use rpc.ts instead.');
|
|
15055
|
+
}
|
|
15030
15056
|
const accounts = await getCompressedAccountsByOwnerTest(this, owner);
|
|
15031
15057
|
return accounts;
|
|
15032
15058
|
}
|
|
15059
|
+
/**
|
|
15060
|
+
* Fetch all the compressed accounts owned by the specified public key.
|
|
15061
|
+
* Owner can be a program or user account
|
|
15062
|
+
* Returns with cursor
|
|
15063
|
+
*/
|
|
15064
|
+
async getCompressedAccountsByOwnerWithCursor(owner, _config) {
|
|
15065
|
+
if (_config) {
|
|
15066
|
+
throw new Error('dataSlice or filters are not supported in test-rpc. Please use rpc.ts instead.');
|
|
15067
|
+
}
|
|
15068
|
+
const accounts = await getCompressedAccountsByOwnerTest(this, owner);
|
|
15069
|
+
return { cursor: null, value: accounts };
|
|
15070
|
+
}
|
|
15033
15071
|
/**
|
|
15034
15072
|
* Fetch the latest compression signatures on the cluster. Results are
|
|
15035
15073
|
* paginated.
|