Skip to content

Latest commit

 

History

History
55 lines (31 loc) · 1.8 KB

OnRampKitBasePack.md

File metadata and controls

55 lines (31 loc) · 1.8 KB

OnRampKitBasePack

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.

Install dependencies

To use the OnRampKitBasePack, you need to install the @safe-global/onramp-kit package.

yarn add @safe-global/onramp-kit

Reference

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
}

Abstract methods that OnRamp packs must implement

These methods are the common interface for all the OnRamp packs. Check each pack's documentation to get more details.

init(options?)

Provides the initialization options for the required packages, classes and properties.

open(options)

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.

close()

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.

subscribe(event, handler)

Provides a way to subscribe to events.

unsubscribe(event, handler)

Provides a way to unsubscribe from an event.

Specific OnRampKitBasePack methods

These methods provide the functionality associated with Safe so they can be used in the implementation of the packs.

To be defined