LogoLogo
  • ๐ŸŒŠSuperfluid
  • Protocol Overview
    • ๐Ÿ’กWhat is Superfluid?
    • ๐Ÿ“„In-Depth Overview
      • Super Tokens
      • Super Agreements
        • ๐ŸšฐMoney Streaming (CFA)
        • โœณ๏ธDistributions (IDA)
        • ๐ŸŒŠStreaming Distributions
      • Super Apps
      • Superfluid Host
    • ๐Ÿง Use Cases
      • Recurring Payments
      • DeFi
      • Social & Community
      • Gaming
    • ๐Ÿ“”Glossary of Terms
  • Developers
    • ๐ŸƒQuickstart
    • ๐Ÿช™Super Tokens
      • Super Tokens - Solidity
      • Super Tokens - SDK Core
      • Super Tokens - Frontend Examples
      • Types of Super Tokens
      • Deploy a Super Token
        • Deploying a Wrapper Super Token
        • Deploying a Self Governed Super Token
        • Deploying a Pure Super Token
      • In-Depth
        • Tracking Super Token Balances
        • ERC777 in Super Tokens
      • Test Super Token Faucet
    • ๐ŸŒŠMoney Streaming (CFA)
      • Solidity
        • Read Methods
          • getFlowInfo
          • getFlowRate
          • getNetFlowRate
        • Write Methods
          • createFlow
          • updateFlow
          • deleteFlow
          • With User Data
          • With Context
      • SDK Core
        • Read Methods
          • getFlow
          • getNetFlow
          • getAccountFlowInfo
        • Write Methods
          • createFlow
          • updateFlow
          • deleteFlow
      • Access Control List (ACL)
        • Solidity
          • createFlowFrom
          • updateFlowFrom
          • deleteFlowFrom
          • setFlowPermissions
          • setMaxFlowPermissions
          • revokeFlowPermissions
          • increaseFlowRateAllowanceWithPermissions
          • decreaseFlowRateAllowanceWithPermissions
          • getFlowPermissions
        • SDK Core
          • createFlowByOperator
          • updateFlowByOperator
          • deleteFlowByOperator
          • updateFlowOperatorPermissions
          • revokeFlowOperatorPermissions
          • increaseFlowRateAllowanceWithPermissions
          • getFlowOperatorData
      • Frontend Examples
      • More...
        • Flow Rate Time Frames
        • Building Batched Streams in Safe
        • Flow NFTs
    • โœณ๏ธDistributions (IDA)
      • IDA - Solidity
      • IDA - SDK Core
      • IDA - Frontend Examples
    • ๐Ÿค–Super Apps
      • Super Apps in Depth
      • Super App Callbacks
        • Calling Agreements In Super Apps
      • User Data
        • NFT Billboard Example
      • SuperAppBaseFlow
      • Super App Examples
      • Super App Deployment Guide
    • ๐ŸงบBatch Calls
      • Batch Calls - SDK Core
      • Batch Calls - Frontend Examples
    • โš™๏ธAutomations
      • Auto-Wrap
        • Dev Guide
      • Stream Scheduler
        • Dev Guide
      • Vesting Scheduler
        • Dev Guide
      • Stream Accounting API
        • Dev Guide
      • Automation Subgraphs
        • Stream Scheduler Subgraph
        • Vesting Scheduler Subgraph
        • Auto Wrap Subgraph
    • ๐Ÿ—๏ธIntegration Guides
      • For Your Integration: The Basics
        • Supporting Super Tokens
        • Supporting Money Streams
        • Supporting Instant Distributions
      • Gating with Superfluid Subscriptions & Guild.xyz
      • Displaying Token Balances
      • Useful Queries for Your Integration
        • Instant Distribution Events
        • Money Streaming Events
        • Super Token Events
        • Other Helpful Queries
      • Constructing Links to The Superfluid Dashboard
    • ๐Ÿ”Superfluid Subscriptions
      • Superfluid Checkout Widget
      • Implementing Subscriptions in your App
    • SDK Core General
      • Initialization
      • Functionality
      • Getting Data
      • Resolver
      • Reference Docs
    • Solidity General
      • Calling Super Agreements
      • Libraries
      • Resolver
    • Testing Guide
      • Hardhat Testing
      • Foundry Testing
      • In-Depth
        • Hardhat Mainnet Fork Testing
        • Super App Testing on Mainnet Forks
    • Subgraph
    • Reference
      • Deploying The Framework
      • EVM Contracts
      • SDK Redux
      • Superfluid Console
      • Superfluid Protocol Addresses
    • Contract Addresses
  • Sentinels
    • ๐Ÿฅ…Liquidations & TOGA
    • ๐Ÿค–Running a Sentinel
    • ๐Ÿ—บ๏ธSolvency Dashboard
  • Resources
    • ๐ŸŒŠSuperfluid Wave Pool
    • ๐Ÿ“œSuperfluid on Ethereum Mainnet
    • ๐Ÿ’ฐBounty Program
    • ๐Ÿ›ก๏ธSecurity & Bug Bounties
    • ๐Ÿ’กProject Ideas
    • ๐Ÿ—ณ๏ธToken Dashboard Submission
    • ๐ŸŽฅVideos
    • Superfluid Deployment Guide
    • Learn about Ethereum
    • Code of Conduct
Powered by GitBook
On this page

Was this helpful?

  1. Developers
  2. Batch Calls

Batch Calls - Frontend Examples

Batching transactions to improve your UX

PreviousBatch Calls - SDK CoreNextAutomations

Last updated 1 year ago

Was this helpful?

Creating a Batch Call

Another game changing feature of the Superfluid protocol is the ability to batch transactions together to improve the quality of UX for your users. We elaborate much more on batch calls inside of our guide on the topic. However, what you need to know for this interactive section is that batch calls can be created with the following operations:

Type
Internal Call

Super Token

ISuperToken.sol

operationApprove, operationTransferFrom, operationUpgrade, operationDowngrade

Agreement

ISuperfluid.sol

_callAgreement

Super App

ISuperfluid.sol

_callAppAction

You can learn more about callAppAction in our - it will allow you to add any function on your Super App contract to a batch call - even if that function performs functionality that's outside of the normal scope of a superfluid operation (such as a standard ERC20 transfer or calling another contract of a separate DeFi protocol)

In our example, we'll be focusing on a simple usage of batch calls: upgrading tokens to super tokens, and creating a flow in the same transaction. We'll achieve this by using the operationUpgrade super token call, and the _callAgreement call (to create the flow).

First, we'll need to approve the super token contract (in this case, fDAIx on Kovan) to spend our fDAI. Because this is an operation that is done outside of the Superfluid protocol on the ERC20 token contract, it cannot be batched.

After the approval, you can enter the number of tokens you'd like to upgrade, and information about the flow you'd like to create and click the 2nd button to run your batch call. You'll be able to see the upgrade and createFlow operation happen in a single transaction (just check the console for details!)

NOTE: we recommend using the and the as you go through these interactive tutorials.

Keep in mind that this is a short example, you could run many upgrade operations & callAgreement operations in this single transaction if you wanted to.

๐Ÿงบ
sdk overview section
Superfluid Console
Superfluid Dashboard
Approve the DAI spend, then enter an upgrade amount and the receiver + flowRate for your stream