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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@swype-org/deposit

v0.3.16

Published

Lightweight merchant deposit SDK — open a hosted payment flow, handle completion, zero dependencies

Downloads

907

Readme

@swype-org/deposit

Lightweight merchant deposit SDK — open a hosted Blink payment flow, handle completion, zero runtime dependencies.

Quick Start

npm install @swype-org/deposit
import { Deposit } from '@swype-org/deposit';

const deposit = new Deposit({ signer: '/api/sign-payment' });

document.getElementById('deposit-btn')!.addEventListener('click', async () => {
  try {
    const { transfer: result } = await deposit.requestDeposit({
      amount: 50,
      chainId: 8453,
      address: '0x...', // destination wallet
      token: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
    });
    console.log('Transfer complete:', result.id, result.status);
  } catch (error) {
    console.error('Transfer failed:', error);
  }
});

Important: requestDeposit() must be called from a user-gesture handler (click, keypress, etc.) so the browser allows the iframe to open.

React Hook

A dedicated React entry point eliminates all boilerplate:

npm install @swype-org/deposit react
import { useBlinkDeposit } from '@swype-org/deposit/react';

function DepositButton() {
  const { status, result, error, displayMessage, requestDeposit } = useBlinkDeposit({
    signer: '/api/sign-payment',
  });

  return (
    <>
      <button
        onClick={() =>
          requestDeposit({ amount: 50, chainId: 8453, address: '0x...', token: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913' })
        }
        disabled={status === 'signer-loading'}
      >
        {status === 'signer-loading' ? 'Preparing…' : 'Deposit'}
      </button>
      {error && <p>{displayMessage}</p>}
      {result && <p>Transfer {result.transfer.id} complete!</p>}
    </>
  );
}

The hook returns reactive status, result, error, displayMessage, and isActive values, plus requestDeposit, focus, and close actions. It manages the Deposit lifecycle and cleans up on unmount.

How It Works

Merchant App / SDK              Merchant Signer                Hosted Flow (iframe)
     │                               │                               │
     │  1. requestDeposit(request)    │                               │
     │──────────────────────────────► │                               │
     │                                │  2. signer(data) or POST URL  │
     │                                │  (includes webviewBaseUrl)    │
     │  3. { signature, payload, ...} │                               │
     │◄───────────────────────────────│                               │
     │                                                                │
     │  4. SDK builds URL, opens iframe                               │
     │───────────────────────────────────────────────────────────────► │
     │                                                                │
     │  5. User completes payment in hosted flow                      │
     │                                                                │
     │  6. postMessage: blink:transfer-complete                       │
     │◄──────────────────────────────────────────────────────────────  │
     │                                                                │
     │  7. Promise resolves with DepositResult                        │

Configuration

const deposit = new Deposit({
  signer: '/api/sign-payment',
  webviewBaseUrl: 'https://pay.blink.cash',
  hostedFlowOrigin: 'https://pay.blink.cash',
  containerElement: document.getElementById('deposit-root')!,
  signerTimeoutMs: 15_000,
  flowTimeoutMs: 300_000,
  debug: false,
});

Error Handling

Every error is a DepositError with a machine-readable code:

| Code | Meaning | | ------------------------ | ----------------------------------------------- | | DEPOSIT_DISMISSED | User closed the transfer before completing | | SIGNER_REQUEST_FAILED | Signer returned a non-2xx response | | SIGNER_NETWORK_ERROR | Network failure reaching the signer | | SIGNER_RESPONSE_INVALID| Signer response missing required fields | | SIGNER_TIMEOUT | Signer did not respond within signerTimeoutMs | | FLOW_TIMEOUT | Entire flow exceeded flowTimeoutMs | | INVALID_REQUEST | Bad input (amount, address, etc.) |

import { DepositError, getDisplayMessage } from '@swype-org/deposit';

try {
  await deposit.requestDeposit({ /* ... */ });
} catch (err) {
  if (err instanceof DepositError) {
    showToast(getDisplayMessage(err));
  }
}

Events

transfer.on('complete', (result) => { /* DepositResult */ });
transfer.on('error', (error) => { /* DepositError */ });
transfer.on('close', () => { /* iframe closed */ });
transfer.on('status-change', (status) => { /* DepositStatus */ });

Lifecycle

transfer.focus();   // No-op — retained for API compatibility
transfer.close();   // Close the iframe without waiting for completion
transfer.destroy(); // Tear down and release all resources (call on unmount)

TypeScript

All types are exported:

import type {
  DepositConfig,
  DepositStatus,
  DepositRequest,
  DepositResult,
  SignerFunction,
  SignerRequest,
  SignerResponse,
  TransferSummary,
} from '@swype-org/deposit'; 

import type { DepositErrorCode } from '@swype-org/deposit';

Backward Compatibility

The previous Checkout-named symbols are re-exported as deprecated aliases:

import { Checkout } from '@swype-org/deposit';       // deprecated alias for Transfer
import { CheckoutError } from '@swype-org/deposit';   // deprecated alias for DepositError
import { useBlinkCheckout } from '@swype-org/deposit/react'; // deprecated alias for useBlinkDeposit