npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@paraport/core

v0.1.11

Published

Core functionality for ParaPort SDK

Downloads

487

Readme

ParaPort Core

npm version License: MIT

Overview

The @paraport/core package provides the foundational functionality for the ParaPort SDK, enabling seamless cross-chain token movement within the Polkadot/Kusama ecosystem. It serves as the backbone for the automated token movement feature, which automatically handles the process of ensuring users have sufficient funds on destination chains for transactions.

This package can be used directly for programmatic control of cross-chain transfers or as the foundation for UI integrations through the @paraport/sdk package.

Features

  • Cross-Chain Token Movement: Facilitates asset transfers between different parachains using XCM protocol
  • Session Management: Handles token movement sessions with various states (Created, Ready, Processing, Completed, Failed)
  • Event System: Comprehensive event emitters for tracking token movement and session status changes
  • Balance Management: Utilities for checking and managing balances across chains
  • Transaction Handling: Robust transaction management with status tracking and error handling
  • Automated Token Movement: Automatically ensures users have sufficient funds on destination chains for transactions
  • Chain Support: Works with Polkadot, Kusama, and their respective parachains
  • Quote Selection: Automatically selects the best available route for asset transfers
  • Fund Status Tracking: Monitors available funds and determines if additional funds are needed

Architecture

The core package is structured around several key components:

  • ParaPortSDK: Main entry point that orchestrates all functionality
  • Managers: Session, Teleport, and Transaction managers for handling different aspects of the teleport process
  • Bridges: Adapters for different cross-chain protocols (currently XCM)
  • Services: Substrate API, Balance, and Fee services for blockchain interactions
  • Types: Comprehensive type definitions for the entire system

Usage

SDK Initialization

const sdk = new ParaPortSDK({
  getSigner: () => yourPolkadotSigner, // Required
  logLevel: 'INFO', // Optional
  bridgeProtocols: ['XCM'], // Optional
  chains: customChainConfigurations // Optional
});

await sdk.initialize();

Session Management and Events

// Create a teleport session
const session = await sdk.initSession({
  chain: 'AssetHubPolkadot', // Polkadot, Kusama, AssetHubPolkadot, AssetHubKusama, Hydration
  asset: 'DOT',
  amount: '10000000000', // 1 DOT (10^10 planck)
  address: 'yourPolkadotAddress'
});

// Subscribe to session events
sdk.onSession('session:updated', (payload) => {
  console.log('Session state changed:', payload.status);
});

// Subscribe to teleport events
sdk.onTeleport('teleport:completed', (payload) => {
  console.log('Teleport completed with hash:', payload.txHash);
});

// Execute when ready
await sdk.executeSession(session.id);

// Retry Session
sdk.retrySession(session.id)

Event Types

Session Events

  • session:created: New token movement session created
  • session:updated: Session state changes
  • session:deleted: Session removed
  • session:completed: Session successfully completed
  • session:failed: Session failed

Token Movement Events

  • movement:started: Token movement transaction begins
  • movement:updated: Token movement status changes
  • movement:completed: Token movement successfully completed

Dependencies

  • @paraport/static: Static data about chains and assets
  • polkadot-api: High-performance Substrate/Polkadot API used for network interactions

Installation

pnpm add @paraport/core polkadot-api

Install Peer Dependencies

ParaPort Core declares polkadot-api as a peer dependency. Install it alongside the package:

pnpm add polkadot-api

Build

  • Prerequisite: build @paraport/static first (core depends on it)
  • From repo root:
    • pnpm --filter @paraport/static build
    • pnpm --filter @paraport/core build

Topological order across packages:

  • @paraport/static@paraport/core@paraport/vue@paraport/sdk@paraport/react

See TESTING.md for end-to-end build and test flow.

Automated Token Movement Process

The automated token movement feature simplifies cross-chain transfers by:

  1. Checking Balances: Verifies if the user has sufficient funds on both source and destination chains
  2. Quote Selection: Automatically selects the best available route for the transfer
  3. Fund Status Determination: Determines if additional funds are needed on the destination chain
  4. Session Management: Creates and manages the teleport session through its lifecycle
  5. Transaction Execution: Handles the actual transfer when the session is ready

License

MIT