Choose the right integration
This page defines the provider-first and Passport-first approaches, the differences between the two and why you may choose one approach over the other.
What is a provider?
A provider is an interface for abstracting the user's wallet implementation from the application. Providers allow consumers to create functionality that is wallet-agnostic, rather than creating a separate implementation for each wallet that they wish to support.
For EVM chains, there is the well-standardised
Provider interface provided by ethers.js
. On IMX, we provide our own
provider, IMX Provider, which incorporates IMX specific features such as registration, transfers,
order creation, and much more.
The provider-first approach
In the provider-first approach, the consuming application performs all wallet interactions against an implementation of
the IMXProvider
, and the consuming application is wallet-agnostic. As the IMXProvider
interface is wallet-agnostic,
only base functionality of the IMX protocol is exposed, such as transfers, listing orders, etc.
This approach is better suited for marketplaces who wish to integrate a large number of IMX compatible wallets with the least amount of effort and do not require any Passport specific functionality, such as viewing information about the logged-in user.
For example, a marketplace may choose to list a number of IMXProvider
wallets and let the user select
which wallet option they wish to use. The consuming application would rely solely on the IMXProvider
interface and
would not be concerned with inner workings of the wallet that has been selected.
Note: The connectImx
function on the Passport instance returns an IMXProvider
instance.
The Passport-first approach
In the Passport-first approach, the consuming application would perform protocol specific interactions against the
IMXProvider
instance, but it would also implement Passport specific functionality that is exposed by the Passport
instance.
This approach is better suited for games that wish to use Passport as their primary form of identity, and also wish to leverage Passport specific functionality. While it is possible for a consuming application to follow a provider-first approach and make use of additional Passport functionality, the consuming application would need to ensure that this functionality is only available when Passport is the chosen wallet.