For SDK documentation, see here.
The following is for existing bridge developer or DEX who wish to integrate with the SDK.
The bridge adapter provides information on:
- Supported chains
- Supported tokens
- A way to get a swap route between two asset on similar or different chains
- A way to instantiate the bridging process while having insights on what's happening
Here's a minimal interface that's needed in order to add support for your bridge
export abstract class AbstractBridgeAdapter {
constructor({ sourceChain, targetChain, settings }: BridgeAdapterArgs) {
this.sourceChain = sourceChain;
this.targetChain = targetChain;
this.settings = settings;
}
abstract name(): Bridges;
abstract getSupportedChains(): Promise<ChainName[]>;
abstract getSupportedTokens(
interestedTokenList: ChainDestType,
chains?: Partial<ChainSourceAndTarget>,
tokens?: { sourceToken: Token; targetToken: Token }
): Promise<Token[]>;
abstract getSwapDetails(
sourceToken: Token,
targetToken: Token
): Promise<SwapInformation>;
abstract bridge({
onStatusUpdate,
sourceAccount,
targetAccount,
swapInformation,
}: {
swapInformation: SwapInformation;
sourceAccount: SolanaOrEvmAccount;
targetAccount: SolanaOrEvmAccount;
onStatusUpdate: (args: BridgeStatus) => void;
}): Promise<boolean>;
}
To start developing, simply run pnpm dev
. This will build all the packages in watch mode as well as spin up a local development server with the react sdk which uses the js sdk under the hood.
Run pnpm build
to confirm compilation is working correctly. You should see a folder acme-core/dist
which contains the compiled output.
acme-core
└── dist
├── index.d.ts <-- Types
├── index.js <-- CommonJS version
└── index.mjs <-- ES Modules version
This repo uses Changesets to manage versions, create changelogs, and publish to npm.
To generate your changelog, run pnpm changeset
locally:
- Which packages would you like to include? – This shows which packages and changed and which have remained the same. By default, no packages are included. Press
space
to select the packages you want to include in thechangeset
. - Which packages should have a major bump? – Press
space
to select the packages you want to bump versions for. - If doing the first major version, confirm you want to release.
- Write a summary for the changes.
- Confirm the changeset looks as expected.
- A new Markdown file will be created in the
changeset
folder with the summary and a list of the packages included.
When you push your code to GitHub, the GitHub Action will run the release
script defined in the root package.json
:
turbo run build && changeset publish
Turborepo runs the build
script for all publishable packages (excluding docs) and publishes the packages to npm.