Frontend Examples

Getting Started with the Constant Flow Agreement

Let's walk through creating Superfluid streams using the Superfluid SDK Core. We'll get straight into the code with some examples, but you can scroll down to learn about how the SDK works in more detail.

We recommend using the Superfluid Console and the Superfluid Dashboard as you go through these interactive tutorials. They'll help you view your streams in action.

Also, these examples require Mumbai MATIC and test super tokens. You can get some from our faucet here.

Within each example, you'll see that we're importing the Superfluid SDK in each key component, then initializing the SDK using the following logic:

// initialization of the core SDK

const sf = await Framework.create({ 
   chainId: Number, 
   provider: ethersProvider 
});

Here we're using a web3Provider (i.e. a Metamask connection in the browser) instead of an RPC URL for our provider.

Creating a Flow

Updating a Flow

Deleting a Flow

Updating Flow Permissions

Modify permissions of an account to manage streams on your behalf.

Create Flow with Operator Permissions

Update Flow with Operator Permissions

Delete Flow with Operator Permissions

Calculating Flow Rates

The flow rate is the # of tokens you'd like to send per second, denominated in wei. You can use the calculator below to get the flow rate for an amount of tokens you want to send per month. You can pass this calculated flow rate into the examples above to create & update your streams.

Last updated