@streamflow/stream 9.3.0 → 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 +40 -19
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +2 -2
- package/dist/cjs/solana/index.cjs +40 -19
- 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 +40 -19
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/solana/index.d.ts +1 -1
- package/dist/esm/solana/index.js +40 -19
- 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
|
@@ -5166,7 +5166,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5166
5166
|
const { partner, amount, tokenProgramId } = data;
|
|
5167
5167
|
const { isNative, sender, customInstructions } = extParams;
|
|
5168
5168
|
common.assertHasPublicKey(sender, "Sender's PublicKey is not available, check passed wallet adapter!");
|
|
5169
|
-
const partnerPublicKey = partner ? new web3_js.PublicKey(partner) :
|
|
5169
|
+
const partnerPublicKey = partner ? new web3_js.PublicKey(partner) : WITHDRAWOR_PUBLIC_KEY;
|
|
5170
5170
|
const mintPublicKey = new web3_js.PublicKey(data.tokenId);
|
|
5171
5171
|
const ixs = await this.getCreateATAInstructions(
|
|
5172
5172
|
[partnerPublicKey],
|
|
@@ -5302,7 +5302,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5302
5302
|
if (!tokenProgramId) {
|
|
5303
5303
|
tokenProgramId = (await solana.getMintAndProgram(this.connection, mintPublicKey)).tokenProgramId;
|
|
5304
5304
|
}
|
|
5305
|
-
const partnerPublicKey = partner ? new web3_js.PublicKey(partner) :
|
|
5305
|
+
const partnerPublicKey = partner ? new web3_js.PublicKey(partner) : WITHDRAWOR_PUBLIC_KEY;
|
|
5306
5306
|
const streamflowProgramPublicKey = new web3_js.PublicKey(this.programId);
|
|
5307
5307
|
const escrowPDA = deriveEscrowPDA(streamflowProgramPublicKey, metadataPubKey);
|
|
5308
5308
|
const oracle = priceOracle ?? deriveTestOraclePDA(this.alignedProxyProgram.programId, mintPublicKey, sender.publicKey);
|
|
@@ -5405,7 +5405,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5405
5405
|
const senderTokens = await solana.ata(mintPublicKey, sender.publicKey, tokenProgramId);
|
|
5406
5406
|
const recipientTokens = await solana.ata(mintPublicKey, recipientPublicKey, tokenProgramId);
|
|
5407
5407
|
const streamflowTreasuryTokens = await solana.ata(mintPublicKey, STREAMFLOW_TREASURY_PUBLIC_KEY, tokenProgramId);
|
|
5408
|
-
const partnerPublicKey = partner ? new web3_js.PublicKey(partner) :
|
|
5408
|
+
const partnerPublicKey = partner ? new web3_js.PublicKey(partner) : WITHDRAWOR_PUBLIC_KEY;
|
|
5409
5409
|
const partnerTokens = await solana.ata(mintPublicKey, partnerPublicKey, tokenProgramId);
|
|
5410
5410
|
ixs.push(
|
|
5411
5411
|
await createStreamInstruction(
|
|
@@ -5529,7 +5529,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5529
5529
|
);
|
|
5530
5530
|
const { tokenProgramId } = await solana.getMintAndProgram(this.connection, mintPublicKey);
|
|
5531
5531
|
const senderTokens = await solana.ata(mintPublicKey, sender.publicKey, tokenProgramId);
|
|
5532
|
-
const partnerPublicKey = partner ? new web3_js.PublicKey(partner) :
|
|
5532
|
+
const partnerPublicKey = partner ? new web3_js.PublicKey(partner) : WITHDRAWOR_PUBLIC_KEY;
|
|
5533
5533
|
const ixs = solana.prepareBaseInstructions(this.connection, {
|
|
5534
5534
|
computePrice,
|
|
5535
5535
|
computeLimit
|
|
@@ -5593,7 +5593,7 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5593
5593
|
const metadataToRecipient = {};
|
|
5594
5594
|
const instructionsBatch = [];
|
|
5595
5595
|
const metadataPubKeys = metadataPubKeysExt || [];
|
|
5596
|
-
const partnerPublicKey = data.partner ? new web3_js.PublicKey(data.partner) :
|
|
5596
|
+
const partnerPublicKey = data.partner ? new web3_js.PublicKey(data.partner) : WITHDRAWOR_PUBLIC_KEY;
|
|
5597
5597
|
const mintPublicKey = new web3_js.PublicKey(data.tokenId);
|
|
5598
5598
|
if (recipients.length === 0) {
|
|
5599
5599
|
throw new Error("Recipients array is empty!");
|
|
@@ -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
|