Casting Spells
Spells denotes a sequence of connector functions that will achieve a given use case. Spells can comprise of any number of functions across any number of connectors.
With this SDK, performing DeFi operations on your dapp consists of creating a spells
instance to add transactions. Here is where you can initiate complex transactions amongst different protocols.
Create an instance.
Add spells that you want to execute. Think of any actions, and by just adding new SPELLS, you can wonderfully CAST transactions across protocols. Let's try to execute the following actions:
Lend 1 ETH on Compound
Borrow 50 DAI on Compound
Note: Make sure, your smart account have the equivalent ETH balance before executing the above actions. Check this section for more details.
At last, cast your spell using cast()
method.
You can also pass an object to send optional parameters like sending ETH along with the transaction.
Last updated