How to Collect
You can use the SDK to collect funds that were sent to an NFT-based sub-account in completed cycles by calling the function NFTDriverClient.collect
:
collect(
tokenId: string,
tokenAddress: string,
transferToAddress: string)
: Promise<ContractTransaction>
Take a look at this method's documentation to understand what each parameter represents.
Note in particular that the tokenId
parameter here is the userId for the NFT-based sub-account to collect funds for, since tokenIds are always userIds, as you can see from the tokenId-generation code.
Calling collect will move all of the funds that have currently been received by the account in past/completed cycles to the wallet at transferToAddress
. To collect funds from Drips that have been received during the current cycle, you will need to "squeeze" those Drips - see the next section on Squeezing Drips.
If the account you are interested in collecting funds from is an address-based account rather than an NFT-based sub-account, you can collect funds by calling the function AddressDriverClient.collect