@streamflow/stream 9.2.1 → 9.3.1
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/{index-ByMlPIUq.d.cts → index-CPUhIwK2.d.cts} +4 -0
- package/dist/cjs/index.cjs +35 -14
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +2 -2
- package/dist/cjs/solana/index.cjs +35 -14
- package/dist/cjs/solana/index.cjs.map +1 -1
- package/dist/cjs/solana/index.d.cts +1 -1
- package/dist/esm/{index-DsFyl13W.d.ts → index-DLVKn7Ae.d.ts} +4 -0
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +35 -14
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/solana/index.d.ts +1 -1
- package/dist/esm/solana/index.js +35 -14
- package/dist/esm/solana/index.js.map +1 -1
- package/package.json +4 -4
|
@@ -463,6 +463,10 @@ declare class SolanaStreamClient extends BaseStreamClient {
|
|
|
463
463
|
* @returns Record of stream data
|
|
464
464
|
*/
|
|
465
465
|
searchStreams(data: ISearchStreams): Promise<IProgramAccount<Stream>[]>;
|
|
466
|
+
private decodeStreamsFromAccounts;
|
|
467
|
+
private collectAlignedEntries;
|
|
468
|
+
private fetchAlignedProxiesByEntries;
|
|
469
|
+
private mapDecodedToProgramAccounts;
|
|
466
470
|
/**
|
|
467
471
|
* Attempts updating the stream auto withdrawal params and amount per period
|
|
468
472
|
* @param {IUpdateData} data - Update parameters including stream ID and new settings
|
package/dist/cjs/index.cjs
CHANGED
|
@@ -6269,20 +6269,41 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6269
6269
|
const accounts = await this.connection.getProgramAccounts(this.programId, {
|
|
6270
6270
|
filters
|
|
6271
6271
|
});
|
|
6272
|
-
const
|
|
6273
|
-
|
|
6274
|
-
|
|
6275
|
-
|
|
6276
|
-
|
|
6277
|
-
|
|
6278
|
-
|
|
6279
|
-
|
|
6280
|
-
|
|
6281
|
-
|
|
6282
|
-
|
|
6283
|
-
|
|
6284
|
-
|
|
6285
|
-
|
|
6272
|
+
const decoded = this.decodeStreamsFromAccounts(accounts);
|
|
6273
|
+
const alignedEntries = this.collectAlignedEntries(decoded);
|
|
6274
|
+
const alignedProxies = await this.fetchAlignedProxiesByEntries(alignedEntries);
|
|
6275
|
+
return this.mapDecodedToProgramAccounts(decoded, alignedEntries, alignedProxies);
|
|
6276
|
+
}
|
|
6277
|
+
decodeStreamsFromAccounts(accounts) {
|
|
6278
|
+
return accounts.map(({ pubkey, account }) => ({
|
|
6279
|
+
pubkey,
|
|
6280
|
+
stream: decodeStream(account.data)
|
|
6281
|
+
}));
|
|
6282
|
+
}
|
|
6283
|
+
collectAlignedEntries(decoded) {
|
|
6284
|
+
const entries = [];
|
|
6285
|
+
decoded.forEach(({ pubkey, stream }, index) => {
|
|
6286
|
+
if (this.isAlignedUnlock(pubkey, stream.sender)) {
|
|
6287
|
+
entries.push({ index, pda: deriveContractPDA(this.alignedProxyProgram.programId, pubkey) });
|
|
6288
|
+
}
|
|
6289
|
+
});
|
|
6290
|
+
return entries;
|
|
6291
|
+
}
|
|
6292
|
+
async fetchAlignedProxiesByEntries(aligned) {
|
|
6293
|
+
if (aligned.length === 0) return [];
|
|
6294
|
+
const res = await this.alignedProxyProgram.account.contract.fetchMultiple(aligned.map((a) => a.pda));
|
|
6295
|
+
return res;
|
|
6296
|
+
}
|
|
6297
|
+
mapDecodedToProgramAccounts(decoded, alignedEntries, alignedProxies) {
|
|
6298
|
+
return decoded.map(({ pubkey, stream }, idx) => {
|
|
6299
|
+
const alignedIdx = alignedEntries.findIndex((a) => a.index === idx);
|
|
6300
|
+
if (alignedIdx !== -1) {
|
|
6301
|
+
const alignedProxy = alignedProxies[alignedIdx];
|
|
6302
|
+
common.invariant(alignedProxy, "Couldn't get aligned proxy account info");
|
|
6303
|
+
return { publicKey: pubkey, account: new AlignedContract(stream, alignedProxy) };
|
|
6304
|
+
}
|
|
6305
|
+
return { publicKey: pubkey, account: new Contract2(stream) };
|
|
6306
|
+
});
|
|
6286
6307
|
}
|
|
6287
6308
|
/**
|
|
6288
6309
|
* Attempts updating the stream auto withdrawal params and amount per period
|