@streamflow/stream 9.0.3 → 9.0.4

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/esm/index.js CHANGED
@@ -6155,10 +6155,20 @@ var SolanaStreamClient = class extends BaseStreamClient {
6155
6155
  const accounts = await this.connection.getProgramAccounts(this.programId, {
6156
6156
  filters
6157
6157
  });
6158
- return accounts.map(({ pubkey, account }) => ({
6159
- publicKey: pubkey,
6160
- account: new Contract2(decodeStream(account.data))
6161
- }));
6158
+ const mapped = await Promise.all(
6159
+ accounts.map(async ({ pubkey, account }) => {
6160
+ const stream = decodeStream(account.data);
6161
+ if (this.isAlignedUnlock(pubkey, stream.sender)) {
6162
+ const alignedProxy = await this.alignedProxyProgram.account.contract.fetch(
6163
+ deriveContractPDA(this.alignedProxyProgram.programId, pubkey)
6164
+ );
6165
+ invariant(alignedProxy, "Couldn't get aligned proxy account info");
6166
+ return { publicKey: pubkey, account: new AlignedContract(stream, alignedProxy) };
6167
+ }
6168
+ return { publicKey: pubkey, account: new Contract2(stream) };
6169
+ })
6170
+ );
6171
+ return mapped;
6162
6172
  }
6163
6173
  /**
6164
6174
  * Attempts updating the stream auto withdrawal params and amount per period