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.