Skip to main content

RouterSDK

Installation

To install RouterSDK in your project, use the following command:

npm install @stichting-allianceblock-foundation/abridge-sdk

Usage

To use RouterSDK, you need to first import it into your JavaScript code:

import { RouterFactorySDK } from '@stichting-allianceblock-foundation/abridge-sdk';

After importing the SDK, you can create an instance of RouterFactorySDK as follows:

const routerFactory = new RouterFactorySDK();

With the RouterFactorySDK instance, you can create a connection to the AllianceBlock bridge protocol. The create method of the RouterFactorySDK class takes three parameters:

chainType: The type of blockchain network to connect to. This can be either EVM or SOLANA.

signerOrProvider: The wallet provider to use for signing transactions. This can be either a JsonRpcSigner instance (userWallet) or a JsonRpcProvider instance.

optionalParams: An optional object that contains additional parameters for the connection, such as gas prices and transaction confirmations.

Here's an example of how to create a connection to the AllianceBlock bridge protocol:

const sdk = await routerFactory.create(
'EVM', // or "SOLANA"
signerOrProvider,
optionalParams,
);

RouterFactorySDK returns an instance of SolanaRouter or EvmRouter. Each of these instances inherits from the RouterSDK class.

Methods that are common to both networks are created in RouterSDK and used equally. The methods that require a specific development due to the type of network must be created in their own class.

In the same way common or specific props can be set.

Development

Install dependencies

npm ci
npm link

cd ../your-project

npm link @stichting-allianceblock-foundation/abridge-sdk

Run development server

npm run dev

optionalParams

Common params