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

@moveflow-dev/moveflow-evm-sdk

v1.0.1

Published

TypeScript SDK for Moveflow EVM payment streaming protocol

Downloads

6

Readme

Moveflow SDK (EVM)

A comprehensive TypeScript SDK for interacting with the Moveflow payment streaming protocol on EVM-compatible networks.

Features

  • 🚀 Easy Integration: Simple, intuitive API for payment streaming
  • 🏗️ Type Safety: Full TypeScript support with comprehensive type definitions
  • 🔧 Multi-Network Support: Built-in support for multiple EVM networks
  • Batch Operations: Efficient batch processing for multiple streams
  • 📊 Real-time Monitoring: Event listeners and stream tracking
  • 💰 Token Management: Built-in ERC20 token utilities

Installation

npm install moveflow-sdk-evm
# or
yarn add moveflow-sdk-evm
# or
pnpm add moveflow-sdk-evm

Quick Start

Basic Usage

import { MoveflowSDK } from 'moveflow-sdk-evm';

// Initialize SDK
const sdk = MoveflowSDK.create('edu_mainnet');

// Get stream details
const stream = await sdk.streamClient.getStream('123');
console.log('Stream:', stream);

// Get user streams
const userStreams = await sdk.streamClient.getRecipientStreams('0x...');

Create a Stream

import { MoveflowSDK } from 'moveflow-sdk-evm';
import { ethers } from 'ethers';

const provider = new ethers.JsonRpcProvider('https://rpc.edu-chain.raas.gelato.cloud');
const signer = new ethers.Wallet('your-private-key', provider);

const sdk = new MoveflowSDK({
  network: 'edu_mainnet',
  signer,
});

// Create a simple payment stream
const streamId = await sdk.createSimpleStream({
  sender: await signer.getAddress(),
  recipient: '0xrecipient-address',
  deposit: ethers.parseUnits('1000', 6), // 1000 USDC
  tokenAddress: '0xA0b86a33E6441b171DFe8AB681D8f0Bc3c3ceAE5', // USDC
  startTime: Math.floor(Date.now() / 1000) + 3600, // 1 hour from now
  stopTime: Math.floor(Date.now() / 1000) + 86400 * 30, // 30 days
  interval: 86400, // Daily payments
});

console.log('Stream created:', streamId);

API Reference

MoveflowSDK

The main SDK class that provides high-level access to all functionality.

Constructor

const sdk = new MoveflowSDK({
  network: 'edu_mainnet',
  provider?, // Optional: ethers.JsonRpcProvider
  signer?,   // Optional: ethers.Signer
  customNetworkConfig? // Optional: Custom network configuration
});

Factory Methods

// Create with default provider
const sdk = MoveflowSDK.create('edu_mainnet');

// Create with custom provider
const sdk = MoveflowSDK.withProvider('edu_mainnet', provider);

// Create with signer
const sdk = MoveflowSDK.withSigner('edu_mainnet', signer);

StreamClient

Handles all stream-related operations.

Create Streams

// Single stream
const streamId = await sdk.streamClient.createStream({
  sender: '0x...',
  recipient: '0x...',
  deposit: ethers.parseUnits('1000', 6),
  tokenAddress: '0x...',
  startTime: 1234567890,
  stopTime: 1234567890,
  interval: 86400,
  cliffAmount: 0,
  cliffTime: 0,
  autoWithdrawInterval: 0,
  autoWithdraw: false,
  pauseable: 1,
  closeable: 1,
  recipientModifiable: 0,
});

// Batch create streams
const streamIds = await sdk.streamClient.batchCreateStreams([
  { /* stream params */ },
  { /* stream params */ }
]);

Manage Streams

// Close stream
await sdk.streamClient.closeStream(streamId);

// Pause/Resume streams
await sdk.streamClient.pauseStream(streamId);
await sdk.streamClient.resumeStream(streamId);

// Extend stream duration
await sdk.streamClient.extendStream(streamId, newStopTime);

// Change recipient
await sdk.streamClient.setNewRecipient(streamId, newRecipient);

// Withdraw funds
await sdk.streamClient.withdrawFromStream(streamId);

Get Stream Information

// Get single stream
const stream = await sdk.streamClient.getStream(streamId);

// Get balance in stream
const balance = await sdk.streamClient.balanceOf(streamId, address);

// Get streams by filter
const senderStreams = await sdk.streamClient.getSenderStreams(senderAddress);
const recipientStreams = await sdk.streamClient.getRecipientStreams(recipientAddress);
const activeStreams = await sdk.streamClient.getActiveStreams();

TokenClient

Handles ERC20 token operations.

// Get token information
const tokenInfo = await sdk.tokenClient.getTokenInfo(tokenAddress);

// Get balance
const balance = await sdk.tokenClient.getBalance(tokenAddress, address);

// Check allowance
const allowance = await sdk.tokenClient.getAllowance(tokenAddress, owner, spender);

// Approve tokens
const tx = await sdk.tokenClient.approve(tokenAddress, spender, amount);

// Transfer tokens
const tx = await sdk.tokenClient.transfer(tokenAddress, recipient, amount);

Network Configuration

Supported Networks

  • edu_mainnet: Open Campus mainnet
  • arbitrum_mainnet: Arbitrum One

Custom Networks

const customConfig = {
  name: 'custom_network',
  chainId: '12345',
  StreamProxy: '0x...',
  StreamGatewayProxy: '0x...',
};

const sdk = new MoveflowSDK({
  network: 'custom_network',
  customNetworkConfig: customConfig,
});

Error Handling

All methods include proper error handling and validation:

try {
  const validation = await sdk.validateCreateStreamParams(params);
  if (!validation.valid) {
    console.error('Validation errors:', validation.errors);
    return;
  }
  
  const streamId = await sdk.createSimpleStream(params);
} catch (error) {
  console.error('Error creating stream:', error);
}

Batch Operations

Efficiently handle multiple streams:

// Batch create
const streamIds = await sdk.streamClient.batchCreateStreams([params1, params2, params3]);

// Batch close
await sdk.streamClient.batchCloseStreams(['1', '2', '3']);

// Batch pause/resume
await sdk.streamClient.batchPauseStreams(['1', '2', '3']);
await sdk.streamClient.batchResumeStreams(['1', '2', '3']);

// Batch withdraw
await sdk.streamClient.batchWithdrawFromStreams(['1', '2', '3']);

Event Monitoring

Listen for contract events:

// Listen for stream creation
sdk.streamClient.onCreateStream((streamId, sender, recipient, deposit) => {
  console.log('New stream created:', streamId);
});

// Listen for token transfers
sdk.tokenClient.onTransfer(tokenAddress, (from, to, value) => {
  console.log('Token transfer:', from, '→', to, value);
});

Examples

Check the examples/ directory for complete usage examples:

  • basic-usage.ts - Basic SDK initialization and queries
  • create-stream.ts - Creating payment streams
  • batch-operations.ts - Batch operations example
  • monitoring.ts - Event monitoring and real-time updates

Development

Building

npm run build

Testing

npm test

Development Mode

npm run dev

License

MIT License - see LICENSE file for details.

Support

For issues and questions, please visit our GitHub repository.