Initialization
How to initialize the SDK Core
Required Imports
To install the Superfluid SDK Core, you can run
You'll need to have a project which already includes graphql and ethers as dependencies.
From here, you can install the Superfluid SDK Core like so:
npm install @superfluid-finance/sdk-corePeer Dependencies
You'll also need to install graphql and ethers.js to work with the SDK.
npm install graphql ethersInitializing the SDK Core
When creating the framework, you'll use Framework.create() like so:
const sf = await Framework.create({
chainId: Number, //i.e. 137 for matic
provider: ethersProvider // i.e. the provider being used
});Framework Options
When creating the framework, you must pass in the following options. The only required params are the provider and a chainId
chainId: number - the chain Id for the network
provider: SupportedProvider - the provider being used
The Signer Class [Optional]
Web3Provider Signer Example
Below is an example of using the Web3Provider object to create a signer. This will likely be the way that most client-side applications create a signer.
Hardhat Signer Example
Below is an example of creating a signer in a Hardhat + ethers.js environment. This will likely be the way that the sdk-core is used in a testing environment.
Signer/Wallet Example
Below is an example of creating a signer passing in a signer object (this can be a wallet for example). This will likely be the way that the sdk-core is used in a Node.js environment (back-end) or a testing environment.
Operations
The Operation class is an object that is returned after you execute a contract call from this package - instead of immediately executing, we return the Operation class which can be either executed to broadcast the transaction or used to create and execute a BatchCall. We'll make use of this class in our next sections.
Last updated
Was this helpful?

