To be used as part of the Onramp Kit, new packs need to extend the OnRampKitBasePack
class. This abstract class provides a common interface that subclasses must implement. It provides the specific Safe common functionality that any custom implementation can leverage.
To use the OnRampKitBasePack
, you need to install the @safe-global/onramp-kit
package.
yarn add @safe-global/onramp-kit
This class is used to create new packs. Any new pack should extend this class and implement the abstract methods. Extending from the OnRampKitBasePack
class will give the subclass access to common Safe features.
class MyPack extends OnRampKitBasePack {
// Implementation of the abstract methods
}
These methods are the common interface for all the OnRamp packs. Check each pack's documentation to get more details.
Provides the initialization options for the required packages, classes and properties.
Initiates the interaction with the pack. It can create a widget (e.g. Stripe) or redirect to a website (e.g. Monerium).
It returns the outcome of interacting with the pack.
Disconnects the provider services and cleans up any data related to the current interaction.
This method is usually called when you are done using the pack, such as when you leave a page, or when you want to end the interaction with the pack.
Provides a way to subscribe to events.
Provides a way to unsubscribe from an event.
These methods provide the functionality associated with Safe so they can be used in the implementation of the packs.
To be defined