Constructors

Properties

alignedProxyProgram: Program<StreamflowAlignedUnlocks>

Methods

  • Builds transaction instructions for creating multiple stream/vesting contracts without creating transactions. All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).

    Parameters

    • data: ICreateMultipleStreamData

      Stream base parameters and array of recipients with individual amounts and settings

    • extParams: IPrepareCreateStreamExt

      Transaction configuration including sender public key, native token handling, and custom instructions

    • applyCustomAfterInstructions: boolean = true

    Returns Promise<
        {
            instructionsBatch: {
                ixs: TransactionInstruction[];
                metadata: Keypair;
                recipient: string;
            }[];
            metadatas: string[];
            metadataToRecipient: MetadataRecipientHashMap;
            prepareInstructions: TransactionInstruction[];
        },
    >

    Create multiple transaction instructions

  • Builds multiple transactions for creating stream/vesting contracts without signing or executing them. All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).

    IMPORTANT: When using native SOL (isNative: true), you MUST execute the prepareTx FIRST and wait for confirmation before executing the stream creation transactions. Otherwise, stream creation will fail with "InvalidAccountData".

    Parameters

    • data: ICreateMultipleStreamData

      Stream base parameters and array of recipients with individual amounts and settings

    • extParams: IPrepareCreateStreamExt

      Transaction configuration including sender public key, native token handling, and custom instructions

    • applyCustomAfterInstructions: boolean = true

    Returns Promise<
        {
            context: any;
            hash: Readonly<{ blockhash: string; lastValidBlockHeight: number }>;
            metadatas: string[];
            metadataToRecipient: MetadataRecipientHashMap;
            prepareTx?: VersionedTransaction;
            transactions: BatchItem[];
        },
    >

    Multiple transaction information

    const result = await streamClient.buildCreateMultipleTransactions(data, { isNative: true, senderPublicKey });

    // CRITICAL: Execute prepareTx first if it exists
    if (result.prepareTx) {
    await connection.sendAndConfirmTransaction(result.prepareTx, [signer]);
    }

    // Only then execute stream creation transactions
    for (const item of result.transactions) {
    await connection.sendAndConfirmTransaction(item.tx, [signer]);
    }
  • Builds a transaction for creating a new stream/vesting contract without signing or executing it. All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).

    For native SOL (isNative: true), SOL wrapping instructions are automatically included in the correct order (before stream creation) to ensure the WSOL account exists when the stream creation instruction executes.

    Parameters

    • data: ICreateStreamData

      Stream parameters including recipient, token, amount, schedule, and permissions

    • extParams: IPrepareCreateStreamExt

      Transaction configuration including sender public key, native token handling, and custom instructions

    Returns Promise<
        {
            context: any;
            hash: string;
            metadata?: Keypair;
            metadataId: string;
            tx: VersionedTransaction;
        },
    >

    Transaction and metadata information

  • Builds transaction instructions for creating a new stream/vesting contract without creating a transaction. All fees are paid by sender (escrow metadata account rent, escrow token account rent, recipient's associated token account rent, Streamflow's service fee).

    For native SOL (isNative: true), SOL wrapping instructions are automatically included in the correct order (before stream creation) to ensure the WSOL account exists when the stream creation instruction executes.

    Parameters

    • data: ICreateStreamData

      Stream parameters including recipient, token, amount, schedule, and permissions

    • extParams: IPrepareCreateStreamExt

      Transaction configuration including sender public key, native token handling, and custom instructions

    Returns Promise<
        {
            ixs: TransactionInstruction[];
            metadata?: Keypair;
            metadataId: string;
        },
    >

    Transaction instructions and metadata ID

  • Creates a new stream/vesting contract using unchecked instruction.

    Unchecked instruction differs from the regular in:

    • does not check for initialized associated token account (wallets with no control over their ATA should not be used as sender/recipient/partner or there are risks of funds being locked in the contract)
    • initialized contract PDA off chain

    If you are not sure if you should use create or create_unchecked, go for create to be safer.

    Parameters

    • data: ICreateStreamData

      Stream parameters including recipient, token, amount, schedule, and permissions

    • extParams: ICreateStreamExt

      Transaction configuration including sender wallet, metadata keys, and compute settings

    Returns Promise<ICreateResult>

    Create result

  • Returns total fee percent, streamflow fees + partner fees

    Parameters

    • getFeesData: IGetFeesData

      structure with address for which we need to derive fee, either sender or partner usually

    Returns Promise<number>

    fee as floating number, so if fee is 0.99%, it will return 0.99

  • Utility function that checks whether the associated stream address is an aligned unlock contract, indicated by whether the sender/creator is a PDA

    Parameters

    • streamPublicKey: PublicKey
    • senderPublicKey: PublicKey

    Returns boolean

  • Creates Transaction Instructions for cancel

    Parameters

    • cancelData: IInteractData

      Cancellation parameters including stream ID

    • extParams: IPrepareStreamExt

      Transaction configuration including invoker wallet, token account validation, and compute settings

    Returns Promise<TransactionInstruction[]>

    Transaction instructions

  • Create Transaction instructions for createUnchecked

    Parameters

    Returns Promise<
        {
            ixs: TransactionInstruction[];
            metadata: Keypair;
            metadataPubKey: PublicKey;
        },
    >

  • Create Transaction instructions for topup

    Parameters

    • topupData: ITopUpData

      Top-up parameters including stream ID and amount to add

    • extParams: ITopUpStreamExt

      Transaction configuration including invoker wallet, native token handling, and compute settings

    Returns Promise<TransactionInstruction[]>

    Transaction instructions

  • Attempts changing the stream/vesting contract's recipient (effectively transferring the stream/vesting contract). Potential associated token account rent fee (to make it rent-exempt) is paid by the transaction initiator.

    Parameters

    • transferData: ITransferData

      Transfer parameters including stream ID and new recipient address

    • extParams: IPrepareStreamExt

      Transaction configuration including invoker wallet and compute settings

    Returns Promise<TransactionInstruction[]>

    Transaction instructions

  • Creates Transaction Instructions for withdrawal

    Parameters

    • withdrawData: IWithdrawData

      Withdrawal parameters including stream ID and amount to withdraw

    • extParams: IPrepareStreamExt

      Transaction configuration including invoker wallet address, token account validation, and compute settings

    Returns Promise<TransactionInstruction[]>

    Transaction instructions