@streamflow/stream 9.0.2 → 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/cjs/{index-oCYfzJrc.d.cts → index-BgGtpOPg.d.cts} +5 -4
- package/dist/cjs/index.cjs +24 -11
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +2 -2
- package/dist/cjs/solana/index.cjs +24 -11
- package/dist/cjs/solana/index.cjs.map +1 -1
- package/dist/cjs/solana/index.d.cts +1 -1
- package/dist/esm/{index-BNQVJtIE.d.ts → index-Dp5DXxr-.d.ts} +5 -4
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +24 -11
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/solana/index.d.ts +1 -1
- package/dist/esm/solana/index.js +24 -11
- 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-BgGtpOPg.cjs';
|
|
2
2
|
export { ContractError, IChain, ICluster } from '@streamflow/common';
|
|
3
3
|
import 'p-queue';
|
|
4
4
|
import '@solana/web3.js';
|
|
@@ -219,6 +219,7 @@ declare class SolanaStreamClient extends BaseStreamClient {
|
|
|
219
219
|
getConnection(): Connection;
|
|
220
220
|
getCommitment(): Commitment | undefined;
|
|
221
221
|
getProgramId(): string;
|
|
222
|
+
getAlignedProxyProgramId(): string;
|
|
222
223
|
/**
|
|
223
224
|
* Builds transaction instructions for creating a new stream/vesting contract without creating a transaction.
|
|
224
225
|
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
@@ -493,14 +494,14 @@ declare class SolanaStreamClient extends BaseStreamClient {
|
|
|
493
494
|
* @returns Error code
|
|
494
495
|
*/
|
|
495
496
|
extractErrorCode(err: Error): string | null;
|
|
497
|
+
/**
|
|
498
|
+
* Utility function that checks whether the associated stream address is an aligned unlock contract, indicated by whether the sender/creator is a PDA
|
|
499
|
+
*/
|
|
500
|
+
isAlignedUnlock(streamPublicKey: PublicKey, senderPublicKey: PublicKey): boolean;
|
|
496
501
|
/**
|
|
497
502
|
* Utility function to generate metadata for a Contract or return existing Pubkey
|
|
498
503
|
*/
|
|
499
504
|
private getOrCreateStreamMetadata;
|
|
500
|
-
/**
|
|
501
|
-
* Utility function that checks whether the associated stream address is an aligned unlock contract, indicated by whether the sender/creator is a PDA
|
|
502
|
-
*/
|
|
503
|
-
private isAlignedUnlock;
|
|
504
505
|
/**
|
|
505
506
|
* Returns insrtuctions for creating associated token accounts for the provided owners
|
|
506
507
|
*/
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { A as AptosStreamClient, I as ICreateStreamAptosExt, a as ITransactionAp
|
|
|
2
2
|
export { i as StreamflowAptos } from './index-D54wSYym.js';
|
|
3
3
|
import { E as EvmStreamClient } from './index-elpYUBph.js';
|
|
4
4
|
export { i as StreamflowEVM } from './index-elpYUBph.js';
|
|
5
|
-
import { S as SolanaStreamClient, I as ICreateStreamSolanaExt, a as IInteractStreamSolanaExt, b as ITopUpStreamSolanaExt } from './index-
|
|
6
|
-
export { s as AIRDROP_AMOUNT, q as AIRDROP_TEST_TOKEN, j as ALIGNED_COMPUTE_LIMIT, A as ALIGNED_PRECISION_FACTOR_POW, h as ALIGNED_UNLOCKS_PROGRAM_ID, k as CONTRACT_DISCRIMINATOR, m as CONTRACT_SEED, C as CREATE_PARAMS_PADDING, D as DEFAULT_STREAMFLOW_FEE, E as ESCROW_SEED, r as FEES_METADATA_SEED, F as FEE_ORACLE_PUBLIC_KEY, O as ORIGINAL_CONTRACT_SENDER_OFFSET, u as PARTNERS_SCHEMA, o as PARTNER_ORACLE_PROGRAM_ID, t as PARTNER_SCHEMA, P as PROGRAM_ID, w as SOLANA_ERROR_MAP, v as SOLANA_ERROR_MATCH_REGEX, p as STREAMFLOW_TREASURY_PUBLIC_KEY, g as STREAM_STRUCT_OFFSETS, f as STREAM_STRUCT_OFFSET_CLOSED, e as STREAM_STRUCT_OFFSET_MINT, d as STREAM_STRUCT_OFFSET_RECIPIENT, c as STREAM_STRUCT_OFFSET_SENDER, i as StreamflowSolana, l as TEST_ORACLE_DISCRIMINATOR, n as TEST_ORACLE_SEED, T as TX_FINALITY_CONFIRMED, W as WITHDRAWOR_PUBLIC_KEY } from './index-
|
|
5
|
+
import { S as SolanaStreamClient, I as ICreateStreamSolanaExt, a as IInteractStreamSolanaExt, b as ITopUpStreamSolanaExt } from './index-Dp5DXxr-.js';
|
|
6
|
+
export { s as AIRDROP_AMOUNT, q as AIRDROP_TEST_TOKEN, j as ALIGNED_COMPUTE_LIMIT, A as ALIGNED_PRECISION_FACTOR_POW, h as ALIGNED_UNLOCKS_PROGRAM_ID, k as CONTRACT_DISCRIMINATOR, m as CONTRACT_SEED, C as CREATE_PARAMS_PADDING, D as DEFAULT_STREAMFLOW_FEE, E as ESCROW_SEED, r as FEES_METADATA_SEED, F as FEE_ORACLE_PUBLIC_KEY, O as ORIGINAL_CONTRACT_SENDER_OFFSET, u as PARTNERS_SCHEMA, o as PARTNER_ORACLE_PROGRAM_ID, t as PARTNER_SCHEMA, P as PROGRAM_ID, w as SOLANA_ERROR_MAP, v as SOLANA_ERROR_MATCH_REGEX, p as STREAMFLOW_TREASURY_PUBLIC_KEY, g as STREAM_STRUCT_OFFSETS, f as STREAM_STRUCT_OFFSET_CLOSED, e as STREAM_STRUCT_OFFSET_MINT, d as STREAM_STRUCT_OFFSET_RECIPIENT, c as STREAM_STRUCT_OFFSET_SENDER, i as StreamflowSolana, l as TEST_ORACLE_DISCRIMINATOR, n as TEST_ORACLE_SEED, T as TX_FINALITY_CONFIRMED, W as WITHDRAWOR_PUBLIC_KEY } from './index-Dp5DXxr-.js';
|
|
7
7
|
import { S as SuiStreamClient } from './index-DrzqsoIB.js';
|
|
8
8
|
export { i as StreamflowSui } from './index-DrzqsoIB.js';
|
|
9
9
|
import { S as Stream, A as AlignedStream, I as ICreateStreamData, a as ICreateAlignedStreamData, b as StreamType, B as BaseStreamClient, c as SolanaStreamClientOptions, d as AptosStreamClientOptions, e as SuiStreamClientOptions, E as EvmStreamClientOptions, f as ICreateStreamSuiExt, g as ICreateResult, h as ICreateMultipleStreamData, i as IMultiTransactionResult, j as IWithdrawData, k as ITransactionSuiExt, l as ITransactionResult, m as ICancelData, n as ITransferData, o as ITopUpData, p as IGetOneData, q as IGetAllData, r as IUpdateData, s as IGetFeesData, t as IFees } from './BaseStreamClient-DOyJqO7R.js';
|
package/dist/esm/index.js
CHANGED
|
@@ -5022,6 +5022,9 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
5022
5022
|
getProgramId() {
|
|
5023
5023
|
return this.programId.toBase58();
|
|
5024
5024
|
}
|
|
5025
|
+
getAlignedProxyProgramId() {
|
|
5026
|
+
return this.alignedProxyProgram.programId.toBase58();
|
|
5027
|
+
}
|
|
5025
5028
|
/**
|
|
5026
5029
|
* Builds transaction instructions for creating a new stream/vesting contract without creating a transaction.
|
|
5027
5030
|
* All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).
|
|
@@ -6152,10 +6155,20 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6152
6155
|
const accounts = await this.connection.getProgramAccounts(this.programId, {
|
|
6153
6156
|
filters
|
|
6154
6157
|
});
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
|
|
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;
|
|
6159
6172
|
}
|
|
6160
6173
|
/**
|
|
6161
6174
|
* Attempts updating the stream auto withdrawal params and amount per period
|
|
@@ -6250,6 +6263,13 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6250
6263
|
const logs = "logs" in err && Array.isArray(err.logs) ? err.logs : void 0;
|
|
6251
6264
|
return extractSolanaErrorCode(err.toString() ?? "Unknown error!", logs);
|
|
6252
6265
|
}
|
|
6266
|
+
/**
|
|
6267
|
+
* Utility function that checks whether the associated stream address is an aligned unlock contract, indicated by whether the sender/creator is a PDA
|
|
6268
|
+
*/
|
|
6269
|
+
isAlignedUnlock(streamPublicKey, senderPublicKey) {
|
|
6270
|
+
const pda = deriveContractPDA(this.alignedProxyProgram.programId, streamPublicKey);
|
|
6271
|
+
return senderPublicKey.equals(pda);
|
|
6272
|
+
}
|
|
6253
6273
|
/**
|
|
6254
6274
|
* Utility function to generate metadata for a Contract or return existing Pubkey
|
|
6255
6275
|
*/
|
|
@@ -6264,13 +6284,6 @@ var SolanaStreamClient = class extends BaseStreamClient {
|
|
|
6264
6284
|
}
|
|
6265
6285
|
return { metadata, metadataPubKey };
|
|
6266
6286
|
}
|
|
6267
|
-
/**
|
|
6268
|
-
* Utility function that checks whether the associated stream address is an aligned unlock contract, indicated by whether the sender/creator is a PDA
|
|
6269
|
-
*/
|
|
6270
|
-
isAlignedUnlock(streamPublicKey, senderPublicKey) {
|
|
6271
|
-
const pda = deriveContractPDA(this.alignedProxyProgram.programId, streamPublicKey);
|
|
6272
|
-
return senderPublicKey.equals(pda);
|
|
6273
|
-
}
|
|
6274
6287
|
/**
|
|
6275
6288
|
* Returns insrtuctions for creating associated token accounts for the provided owners
|
|
6276
6289
|
*/
|