Drips docs

Drips docs

    ›Splitting

    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

    Create User Splits

    To create splits for a NFTDriver-based sub-account, you will need to use the NFTDriver.setSplits method:

    setSplits(
        tokenId: string,
        receivers: SplitsReceiverStruct[])
    : 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.

    You will also need to know the tokenId of the NFT-based sub-account you wish to setSplits for. You can find all of the sub-accounts owned by an Ethereum address, and their tokenIds, which are the same as their user IDs, by getting an account list for the address.

    Next you will need to build the new list of splits receivers that you want to set. This means building a new SplitsReceiverStruct[] array and adding a new DripsReceiverStruct to define the new Split you wish to create.

    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 setSplits method to set the new Splits configuration for the account.

    ← SchedulingEdit User Splits →