@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
package/dist/cjs/node/index.cjs
CHANGED
|
@@ -9686,6 +9686,7 @@ const LatestNonVotingSignaturesResult = type({
|
|
|
9686
9686
|
signature: string(),
|
|
9687
9687
|
slot: number(),
|
|
9688
9688
|
blockTime: number(),
|
|
9689
|
+
error: nullable(string()),
|
|
9689
9690
|
})),
|
|
9690
9691
|
});
|
|
9691
9692
|
/**
|
|
@@ -10137,21 +10138,44 @@ class Rpc extends web3_js.Connection {
|
|
|
10137
10138
|
* Fetch all the compressed accounts owned by the specified public key.
|
|
10138
10139
|
* Owner can be a program or user account
|
|
10139
10140
|
*/
|
|
10140
|
-
async
|
|
10141
|
-
|
|
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
|
+
});
|
|
10142
10150
|
const res = create(unsafeRes, jsonRpcResultAndContext(CompressedAccountsByOwnerResult));
|
|
10143
10151
|
if ('error' in res) {
|
|
10144
10152
|
throw new web3_js.SolanaJSONRPCError(res.error, `failed to get info for compressed accounts owned by ${owner.toBase58()}`);
|
|
10145
10153
|
}
|
|
10146
10154
|
if (res.result.value === null) {
|
|
10147
|
-
return [];
|
|
10155
|
+
return { cursor: null, value: [] };
|
|
10148
10156
|
}
|
|
10149
10157
|
const accounts = [];
|
|
10150
10158
|
res.result.value.items.map(item => {
|
|
10151
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);
|
|
10152
10160
|
accounts.push(account);
|
|
10153
10161
|
});
|
|
10154
|
-
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;
|
|
10155
10179
|
}
|
|
10156
10180
|
/**
|
|
10157
10181
|
* Fetch all the compressed token accounts owned by the specified public
|
|
@@ -15025,10 +15049,25 @@ class TestRpc extends web3_js.Connection {
|
|
|
15025
15049
|
* Fetch all the compressed accounts owned by the specified public key.
|
|
15026
15050
|
* Owner can be a program or user account
|
|
15027
15051
|
*/
|
|
15028
|
-
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
|
+
}
|
|
15029
15056
|
const accounts = await getCompressedAccountsByOwnerTest(this, owner);
|
|
15030
15057
|
return accounts;
|
|
15031
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
|
+
}
|
|
15032
15071
|
/**
|
|
15033
15072
|
* Fetch the latest compression signatures on the cluster. Results are
|
|
15034
15073
|
* paginated.
|