@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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { Z as Account, a5 as AlignedContract, M as AlignedUnlocksContract, a8 as BatchItem, aa as BatchItemError, ab as BatchItemResult, a9 as BatchItemSuccess, U as ChangeOracleParams, y as ClientCreationOptions, a4 as Contract, R as CreateParams, V as CreateTestOracleParams, a6 as DecodedStream, $ as ICreateSolanaExt, a3 as ICreateStreamInstructions, I as ICreateStreamSolanaExt, a as IInteractStreamSolanaExt, a1 as IPrepareCreateStreamSolanaExt, a2 as IPrepareStreamSolanaExt, Y as ISearchStreams, b as ITopUpStreamSolanaExt, a0 as ITransactionSolanaExtWithInstructions, ac as InstructionGenerator, a7 as MetadataRecipientHashMap, N as OracleType, S as SolanaStreamClient, Q as TestOracle, X as UpdateTestOracleParams, ah as cancelStreamInstruction, x as constants, ad as createStreamInstruction, ae as createUncheckedStreamInstruction, z as decodeStream, J as deriveContractPDA, K as deriveEscrowPDA, L as deriveTestOraclePDA, H as extractSolanaErrorCode, G as sendAndConfirmStreamRawTransaction, B as signAllTransactionWithRecipients, _ as timelockIDL, aj as topupStreamInstruction, ai as transferStreamInstruction, ag as updateStreamInstruction, af as withdrawStreamInstruction } from '../index-
|
|
1
|
+
export { Z as Account, a5 as AlignedContract, M as AlignedUnlocksContract, a8 as BatchItem, aa as BatchItemError, ab as BatchItemResult, a9 as BatchItemSuccess, U as ChangeOracleParams, y as ClientCreationOptions, a4 as Contract, R as CreateParams, V as CreateTestOracleParams, a6 as DecodedStream, $ as ICreateSolanaExt, a3 as ICreateStreamInstructions, I as ICreateStreamSolanaExt, a as IInteractStreamSolanaExt, a1 as IPrepareCreateStreamSolanaExt, a2 as IPrepareStreamSolanaExt, Y as ISearchStreams, b as ITopUpStreamSolanaExt, a0 as ITransactionSolanaExtWithInstructions, ac as InstructionGenerator, a7 as MetadataRecipientHashMap, N as OracleType, S as SolanaStreamClient, Q as TestOracle, X as UpdateTestOracleParams, ah as cancelStreamInstruction, x as constants, ad as createStreamInstruction, ae as createUncheckedStreamInstruction, z as decodeStream, J as deriveContractPDA, K as deriveEscrowPDA, L as deriveTestOraclePDA, H as extractSolanaErrorCode, G as sendAndConfirmStreamRawTransaction, B as signAllTransactionWithRecipients, _ as timelockIDL, aj as topupStreamInstruction, ai as transferStreamInstruction, ag as updateStreamInstruction, af as withdrawStreamInstruction } from '../index-DLVKn7Ae.js';
|
|
2
2
|
export { ContractError, IChain, ICluster } from '@streamflow/common';
|
|
3
3
|
import 'p-queue';
|
|
4
4
|
import '@solana/web3.js';
|
package/dist/esm/solana/index.js
CHANGED
|
@@ -3649,20 +3649,41 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
3649
3649
|
const accounts = await this.connection.getProgramAccounts(this.programId, {
|
|
3650
3650
|
filters
|
|
3651
3651
|
});
|
|
3652
|
-
const
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
|
|
3660
|
-
|
|
3661
|
-
|
|
3662
|
-
|
|
3663
|
-
|
|
3664
|
-
|
|
3665
|
-
|
|
3652
|
+
const decoded = this.decodeStreamsFromAccounts(accounts);
|
|
3653
|
+
const alignedEntries = this.collectAlignedEntries(decoded);
|
|
3654
|
+
const alignedProxies = await this.fetchAlignedProxiesByEntries(alignedEntries);
|
|
3655
|
+
return this.mapDecodedToProgramAccounts(decoded, alignedEntries, alignedProxies);
|
|
3656
|
+
}
|
|
3657
|
+
decodeStreamsFromAccounts(accounts) {
|
|
3658
|
+
return accounts.map(({ pubkey, account }) => ({
|
|
3659
|
+
pubkey,
|
|
3660
|
+
stream: decodeStream(account.data)
|
|
3661
|
+
}));
|
|
3662
|
+
}
|
|
3663
|
+
collectAlignedEntries(decoded) {
|
|
3664
|
+
const entries = [];
|
|
3665
|
+
decoded.forEach(({ pubkey, stream }, index) => {
|
|
3666
|
+
if (this.isAlignedUnlock(pubkey, stream.sender)) {
|
|
3667
|
+
entries.push({ index, pda: deriveContractPDA(this.alignedProxyProgram.programId, pubkey) });
|
|
3668
|
+
}
|
|
3669
|
+
});
|
|
3670
|
+
return entries;
|
|
3671
|
+
}
|
|
3672
|
+
async fetchAlignedProxiesByEntries(aligned) {
|
|
3673
|
+
if (aligned.length === 0) return [];
|
|
3674
|
+
const res = await this.alignedProxyProgram.account.contract.fetchMultiple(aligned.map((a) => a.pda));
|
|
3675
|
+
return res;
|
|
3676
|
+
}
|
|
3677
|
+
mapDecodedToProgramAccounts(decoded, alignedEntries, alignedProxies) {
|
|
3678
|
+
return decoded.map(({ pubkey, stream }, idx) => {
|
|
3679
|
+
const alignedIdx = alignedEntries.findIndex((a) => a.index === idx);
|
|
3680
|
+
if (alignedIdx !== -1) {
|
|
3681
|
+
const alignedProxy = alignedProxies[alignedIdx];
|
|
3682
|
+
invariant(alignedProxy, "Couldn't get aligned proxy account info");
|
|
3683
|
+
return { publicKey: pubkey, account: new AlignedContract(stream, alignedProxy) };
|
|
3684
|
+
}
|
|
3685
|
+
return { publicKey: pubkey, account: new Contract(stream) };
|
|
3686
|
+
});
|
|
3666
3687
|
}
|
|
3667
3688
|
/**
|
|
3668
3689
|
* Attempts updating the stream auto withdrawal params and amount per period
|