Drips docs

Drips docs

    ›Streams

    Intro and Basics

    • What's a Drip?
    • Drips v2 Features
    • Accessing Drips
    • FAQ

    The Drips App

    • Getting Started
    • Manage funds

      • Add funds
      • Withdraw funds
      • Collect earnings

      Streams

      • Create a stream
      • Edit, pause or delete a stream

      Splits

      • Set up & manage splits

      Explore the network

      • Drips profiles

      Advanced

      • Connecting to a Safe

    The Protocol

    • Overview
    • User Identities In Drips
    • Smart Contract and Subgraph Details
    • Security

    For Developers

    • The Drips JS SDK
    • Installing the SDK and Running the Example App
    • Initializing the SDK
    • Accounts

      • Intro to Accounts
      • Create an Account
      • List Sub-Accounts
      • Add Funds

      Streams

      • Start a Stream
      • Update a Stream
      • Scheduling

      Splitting

      • Create User Splits
      • Edit User Splits
      • List User Splits
      • Immutable Splits

      Collecting

      • How to Collect
      • Squeezing Drips

      Advanced Topics

      • Caller
      • Account Metadata
      • Dripping Fractional Amounts
      • Drips inner workings

    Get Involved

    • Join the Drips Community

    Update a Stream

    To update a Drips configuration you'll need to use the NFTDriver.setDrips method:

    setDrips(
        tokenId: string, 
        tokenAddress: string, 
        currentReceivers: DripsReceiverStruct[], 
        newReceivers: DripsReceiverStruct[], 
        transferToAddress: string, 
        balanceDelta?: BigNumberish)
    : Promise<ContractTransaction>
    

    Take a look at this method's documentation to understand what each parameter represents.

    To use this method you will first need to create a NFTDriverClient and a DripsSubgraphClient.

    You’ll also need to know the assetId of the ERC20 token you’re updating:

    const assetId = Utils.Asset.getIdFromAddress(tokenAddress);
    

    You'll need to have the list of current receivers in order to update the stream. You can get the current receivers by calling:

    const currentDripsConfiguration =
        await subgraphClient.getUserAssetConfigById(configuredUserId, assetId);
    const currentReceivers = currentDripsConfiguration.dripsEntries || [];
    

    Next, you’ll need to create a list of new receivers that you want to set. Take a look at this code sample, which shows how you can do this with the help of some utility functions the SDK exposes, from some form inputs. If you would like to see this code sample in action, you can do so by running the NFTDriverClient examples app.

    Finally call the setDrips method to update the Drips Configuration.

    ← Start a StreamScheduling →