If you don't want to use Elements React UI, we provide elements-core and elements-hooks package to help you build your own swap UI.
We have released v1.0.0 of Elements with an improved UX and developer API. We recommend you to use v1.x. Here's the migration guide for v0.x users.
The following sections are in the "guide" format. For technical documentation of individual APIs, please refer to the typedoc hosted at https://leapwallet.github.io/elements/.
Using without React
Start with installing the elements core package
yarnadd@leapwallet/elements-core
Here's what we need to do to create a Swap UI powered by Skip
Show FROM chains and tokens
Show TO chains and tokens
Get swap quotes
Get transaction messages
Sign and broadcast the transaction(s)
Track the transaction(s)
For all these steps, we will use the SkipAPI class exported from the core package.
Show TO and FROM Chains and Tokens
Get Swap Quotes
Get Transaction Messages
Sign and Broadcast the Transaction(s)
Track the Transaction(s)
Using with React
Start with installing the elements hooks package (which depends on @leapwallet/elements-core package)
yarnadd@leapwallet/elements-hooks
Here's what we need to do to create a Swap UI powered by Skip
Show FROM chains and tokens
Show TO chains and tokens
Get swap quotes
Get transaction messages
Show swap summary
Sign and broadcast the transaction(s)
Track the transaction(s)
We will use SkipAPI class from the elements-core package and hooks from the elements-hooks package for this.