Type alias SuperstreamClient

SuperstreamClient: {
    getProvider: (() => AnchorProvider);
    getConnection: (() => web3.Connection);
    getWalletPublicKey: (() => web3.PublicKey);
    getCurrentTime: (() => Promise<BN | undefined>);
    mustGetCurrentTime: (() => Promise<BN>);
    maybeGetStream: ((publicKey) => Promise<Stream | undefined>);
    getStream: ((publicKey) => Promise<Stream>);
    getMultipleStreams: ((publicKeys) => Promise<(Stream | undefined)[]>);
    getAllStreams: ((filters?) => Promise<Stream[]>);
    getAllStreamsPagination: ((filters?) => StreamPagination);
    getPrepaidAmountNeeded: ((at, params) => BN);
    getNonPrepaidDepositNeeded: ((at, params) => BN);
    validateCreatePrepaidStream: ((at, params) => void);
    validateCreateNonPrepaidStream: ((at, params) => void);
    createPrepaidStream: ((params) => Promise<Stream>);
    createNonPrepaidStream: ((params) => Promise<Stream>);
}

Superstream client is a client used to interact with on-chain Superstream stream data - fetch streams, create new streams and do operations on those streams. Look at the class methods for more information.

Type declaration

  • Readonly getProvider: (() => AnchorProvider)
      • (): AnchorProvider
      • Get the Anchor provider used by the Superstream client.

        Returns AnchorProvider

        The Anchor provider

  • Readonly getConnection: (() => web3.Connection)
      • (): web3.Connection
      • Get the Solana connection used by the Superstream client.

        Returns web3.Connection

        The Solana connection

  • Readonly getWalletPublicKey: (() => web3.PublicKey)
      • (): web3.PublicKey
      • Get the public key of the Solana wallet used by the Superstream client. If no wallet was provided while creating the client, a default public key will be returned by this method.

        Returns web3.PublicKey

        The public key of the Solana wallet

  • Readonly getCurrentTime: (() => Promise<BN | undefined>)
      • (): Promise<BN | undefined>
      • Get the current Solana on-chain time in seconds. If there is an issue fetching the time, undefined is returned.

        Returns Promise<BN | undefined>

        The current Solana on-chain time in seconds or undefined if there was an issue

  • Readonly mustGetCurrentTime: (() => Promise<BN>)
      • (): Promise<BN>
      • Get the current Solana on-chain time in seconds. If there is an issue fetching the time, an error is thrown.

        Returns Promise<BN>

        The current Solana on-chain time in seconds

        Throws

        An error is thrown if there is an issue fetching the time

  • Readonly maybeGetStream: ((publicKey) => Promise<Stream | undefined>)
      • (publicKey): Promise<Stream | undefined>
      • Get a stream by public key. If such a stream doesn't exist, undefined is returned. If there is a Solana RPC issue, an error is thrown.

        Parameters

        • publicKey: web3.PublicKey

        Returns Promise<Stream | undefined>

        The stream with the given public key or undefined if not found

        Throws

        An error is thrown if there is a Solana RPC issue

  • Readonly getStream: ((publicKey) => Promise<Stream>)
      • (publicKey): Promise<Stream>
      • Get a stream by public key. If such a stream doesn't exist or there is a Solana RPC issue, an error is thrown.

        Parameters

        • publicKey: web3.PublicKey

        Returns Promise<Stream>

        The stream with the given public key

        Throws

        An error is thrown if a stream with the given public key doesn't exist or there is a Solana RPC issue.

  • Readonly getMultipleStreams: ((publicKeys) => Promise<(Stream | undefined)[]>)
      • (publicKeys): Promise<(Stream | undefined)[]>
      • Get multiple streams by public key. If some public keys don't exist, they are excluded from the return list. If there is a Solana RPC issue, an error is thrown.

        Parameters

        • publicKeys: web3.PublicKey[]

        Returns Promise<(Stream | undefined)[]>

        The streams with the given public keys

        Throws

        An error is thrown if there is a Solana RPC issue

  • Readonly getAllStreams: ((filters?) => Promise<Stream[]>)
      • (filters?): Promise<Stream[]>
      • Get all streams that satisfy the given filters. If there is a Solana RPC issue, an error is thrown.

        Parameters

        Returns Promise<Stream[]>

        The streams that satisfy the given filters

        Throws

        An error is thrown if there is a Solana RPC issue

  • Readonly getAllStreamsPagination: ((filters?) => StreamPagination)
      • (filters?): StreamPagination
      • Get all streams with pagination that satisfy the given filters. If there is a Solana RPC issue, an error is thrown.

        Parameters

        Returns StreamPagination

        The StreamPagination object which returns all streams that satisfy the given filters

        Throws

        An error is thrown if there is a Solana RPC issue

  • Readonly getPrepaidAmountNeeded: ((at, params) => BN)
      • (at, params): BN
      • Get the prepaid amount needed to create a new prepaid stream with the given parameters.

        Parameters

        • at: BN

          The on-chain time at which the prepaid amount calculation is needed

        • params: {
              startsAt: BN;
              endsAt: BN;
              initialAmount: BN;
              flowInterval: BN;
              flowRate: BN;
          }

          For more information on the parameters, look at the Stream class documentation

          • startsAt: BN
          • endsAt: BN
          • initialAmount: BN
          • flowInterval: BN
          • flowRate: BN

        Returns BN

        The prepaid amount needed to create a new prepaid stream with the given parameters

  • Readonly getNonPrepaidDepositNeeded: ((at, params) => BN)
      • (at, params): BN
      • Get the deposit amount needed to create a new non-prepaid stream with the given parameters. For more information on the deposit needed, look at the DEPOSIT_AMOUNT_PERIOD_IN_SECS documentation.

        Parameters

        • at: BN

          The on-chain time at which the deposit amount calculation is needed

        • params: {
              startsAt: BN;
              endsAt: BN;
              flowInterval: BN;
              flowRate: BN;
          }

          For more information on the parameters, look at the Stream class documentation

          • startsAt: BN
          • endsAt: BN
          • flowInterval: BN
          • flowRate: BN

        Returns BN

        The deposit amount needed to create a new non-prepaid stream with the given parameters

  • Readonly validateCreatePrepaidStream: ((at, params) => void)
      • (at, params): void
      • Validate the parameters to create a new prepaid stream.

        Parameters

        • at: BN

          The on-chain time at which the validation is needed

        • params: {
              recipient: web3.PublicKey;
              name: string;
              startsAt: BN;
              endsAt: BN;
              initialAmount: BN;
              flowRate: BN;
          }

          For more information on the parameters, look at the Stream class documentation

          • recipient: web3.PublicKey
          • name: string
          • startsAt: BN
          • endsAt: BN
          • initialAmount: BN
          • flowRate: BN

        Returns void

        Throws

        An error is thrown is a prepaid stream cannot be created with the given parameters

  • Readonly validateCreateNonPrepaidStream: ((at, params) => void)
      • (at, params): void
      • Validate the parameters to create a new non-prepaid stream.

        Parameters

        • at: BN

          The on-chain time at which the validation is needed

        • params: {
              recipient: web3.PublicKey;
              name: string;
              startsAt: BN;
              endsAt: BN;
              initialAmount: BN;
              flowInterval: BN;
              flowRate: BN;
              topupAmount: BN;
          }

          The topupAmount field is the amount that the stream would be topped up with. It should be >= amount returned by getNonPrepaidDepositNeeded. For more information on the other parameters, look at the Stream class documentation

          • recipient: web3.PublicKey
          • name: string
          • startsAt: BN
          • endsAt: BN
          • initialAmount: BN
          • flowInterval: BN
          • flowRate: BN
          • topupAmount: BN

        Returns void

        Throws

        An error is thrown is a non-prepaid stream cannot be created with the given parameters

  • Readonly createPrepaidStream: ((params) => Promise<Stream>)
      • (params): Promise<Stream>
      • Create a new prepaid stream.

        Parameters

        • params: {
              mint: web3.PublicKey;
              recipient: web3.PublicKey;
              name: string;
              startsAt: BN;
              endsAt: BN;
              initialAmount: BN;
              flowInterval: BN;
              flowRate: BN;
              senderCanCancel: boolean;
              senderCanCancelAt: BN;
              senderCanChangeSender: boolean;
              senderCanChangeSenderAt: BN;
              senderCanPause: boolean;
              senderCanPauseAt: BN;
              recipientCanResumePauseBySender: boolean;
              recipientCanResumePauseBySenderAt: BN;
              anyoneCanWithdrawForRecipient: boolean;
              anyoneCanWithdrawForRecipientAt: BN;
          }

          For more information on the parameters, look at the Stream class documentation

          • mint: web3.PublicKey
          • recipient: web3.PublicKey
          • name: string
          • startsAt: BN
          • endsAt: BN
          • initialAmount: BN
          • flowInterval: BN
          • flowRate: BN
          • senderCanCancel: boolean
          • senderCanCancelAt: BN
          • senderCanChangeSender: boolean
          • senderCanChangeSenderAt: BN
          • senderCanPause: boolean
          • senderCanPauseAt: BN
          • recipientCanResumePauseBySender: boolean
          • recipientCanResumePauseBySenderAt: BN
          • anyoneCanWithdrawForRecipient: boolean
          • anyoneCanWithdrawForRecipientAt: BN

        Returns Promise<Stream>

        Throws

        An error is thrown is a prepaid stream cannot be created with the given parameters or a user wallet wasn't provided to the Superstream client or there is a Solana RPC issue

  • Readonly createNonPrepaidStream: ((params) => Promise<Stream>)
      • (params): Promise<Stream>
      • Create a new non-prepaid stream.

        Parameters

        • params: {
              mint: web3.PublicKey;
              recipient: web3.PublicKey;
              name: string;
              startsAt: BN;
              endsAt: BN;
              initialAmount: BN;
              flowInterval: BN;
              flowRate: BN;
              senderCanCancel: boolean;
              senderCanCancelAt: BN;
              senderCanChangeSender: boolean;
              senderCanChangeSenderAt: BN;
              senderCanPause: boolean;
              senderCanPauseAt: BN;
              recipientCanResumePauseBySender: boolean;
              recipientCanResumePauseBySenderAt: BN;
              anyoneCanWithdrawForRecipient: boolean;
              anyoneCanWithdrawForRecipientAt: BN;
              topupAmount: BN;
          }

          The topupAmount field is the amount that the stream would be topped up with. It should be >= amount returned by getNonPrepaidDepositNeeded. For more information on the other parameters, look at the Stream class documentation

          • mint: web3.PublicKey
          • recipient: web3.PublicKey
          • name: string
          • startsAt: BN
          • endsAt: BN
          • initialAmount: BN
          • flowInterval: BN
          • flowRate: BN
          • senderCanCancel: boolean
          • senderCanCancelAt: BN
          • senderCanChangeSender: boolean
          • senderCanChangeSenderAt: BN
          • senderCanPause: boolean
          • senderCanPauseAt: BN
          • recipientCanResumePauseBySender: boolean
          • recipientCanResumePauseBySenderAt: BN
          • anyoneCanWithdrawForRecipient: boolean
          • anyoneCanWithdrawForRecipientAt: BN
          • topupAmount: BN

        Returns Promise<Stream>

        Throws

        An error is thrown is a non-prepaid stream cannot be created with the given parameters or a user wallet wasn't provided to the Superstream client or there is a Solana RPC issue

Generated using TypeDoc