Skip to main content

Modules

As mentioned before, the Nexera Bridge SDK is organized into modules, with a core module that provides access to the core functionality and the Teleport contract, and custom SDK modules. Developers can create these custom modules and register them in the SDK to provide additional functionality for specific dApps.

Modules registering and deregistering is done in the teleport SDK factory, and the consumer can configure when instantiating which modules should the created instance have.

There are currently two SDK modules already developed, that integrate the functionality of the ERC20 and ERC721 bridges. These modules are configured and added by default on all the instances created by the SDK factory.

How to use a default module

To access a module, use the dapp method of the TeleportSDK, providing the name of the module. You must specify the expected module type in order to access all module-specific methods and properties.

To do this you can import the module class you want to use, e.g. for ERC20

import { ERC20RouterSDK } from "@stichting-allianceblock-foundation/abridge-sdk";

const erc20Module = await sdk.dapp<ERC20RouterSDK>(ERC20RouterSDK.DAPP_NAME);

Now that you have an instance of your module, you can use all of its methods and properties. Remember that each module can have different methods and properties, as defined by the developer.

For example, with this module, you can send an ERC20 token to another chain.