Socket
Book a DemoInstallSign in
Socket

@0xsequence/anypay-sdk

Package Overview
Dependencies
Maintainers
5
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@0xsequence/anypay-sdk

SDK for Anypay functionality

0.0.5
latest
npmnpm
Version published
Weekly downloads
8
-11.11%
Maintainers
5
Weekly downloads
 
Created
Source

@0xsequence/anypay-sdk

Anypay SDK for sending any token from any chain.

⚠️ This is a work in progress!

Installation

npm install @0xsequence/anypay-sdk

Usage

React Widget Component

The easiest way to integrate Anypay is using our pre-built React widget:

import { AnyPayWidget } from '@0xsequence/anypay-sdk/widget'

export const App = () => {
  const sequenceApiKey = import.meta.env.VITE_SEQUENCE_API_KEY

  return (
    <AnyPayWidget
      sequenceApiKey={sequenceApiKey}
    />
  )
}

Low-level API Usage

If you need more control, you can use the low-level APIs directly:

Basic Example

import { prepareSend } from '@0xsequence/anypay-sdk'
import { createWalletClient, custom } from 'viem'

// Initialize a wallet client
const client = createWalletClient({
  account,
  chain: getChainConfig(chainId),
  transport: custom(window.ethereum),
})

// Prepare and send a transaction
const options = {
  account,
  originTokenAddress: '0x0000000000000000000000000000000000000000', // ETH
  originChainId: 42161, // Arbitrum
  originTokenAmount: '1000000000000000',
  destinationChainId: 8453, // Base
  recipient: '0xYourRecipientAddress',
  destinationTokenAddress: '0x833589fcd6edb6e08f4c7c32d4f71b54bda02913', // USDC on Base
  destinationTokenAmount: '300003', // Amount in USDC decimals (6)
  sequenceApiKey: 'your-api-key',
  fee: '5600000000000',
  client,
}

const { intentAddress, send } = await prepareSend(options)
console.log('Intent address:', intentAddress.toString())

// Send the transaction
await send()

Advanced Example

import {
  getAPIClient,
  getRelayer,
  getIntentCallsPayloads,
  calculateIntentAddress,
  commitIntentConfig,
  sendOriginTransaction,
  getERC20TransferData,
} from '@0xsequence/anypay-sdk'
import { createWalletClient, http } from 'viem'
import { arbitrum } from 'viem/chains'

async function sendCrossChainToken() {
  // Initialize clients
  const apiClient = getAPIClient('http://localhost:4422', process.env.SEQUENCE_API_KEY)
  const originRelayer = getRelayer({ env: 'local' }, originChainId)
  const destinationRelayer = getRelayer({ env: 'local' }, destinationChainId)

  // Create intent
  const args = {
    userAddress: account.address,
    originChainId: 42161,
    originTokenAddress: '0x0000000000000000000000000000000000000000',
    originTokenAmount: '1000000000000000',
    destinationChainId: 8453,
    destinationToAddress: destinationTokenAddress,
    destinationTokenAddress: destinationTokenAddress,
    destinationTokenAmount: destinationTokenAmount,
    destinationCallData: getERC20TransferData(recipient, BigInt(destinationTokenAmount)),
    destinationCallValue: '0',
  }

  const intent = await getIntentCallsPayloads(apiClient, args)

  // Calculate and commit intent
  const intentAddress = calculateIntentAddress(account.address, intent.calls, intent.lifiInfos)
  await commitIntentConfig(apiClient, account.address, intent.calls, intent.preconditions, intent.lifiInfos)

  // Monitor transaction status
  const status = await getMetaTxStatus(relayer, metaTxId, chainId)
  console.log('Transaction status:', status)
}

Development

# Install dependencies
pnpm install

# Build the package
pnpm run build

# Run tests
pnpm test

License

MIT License

Keywords

anypay

FAQs

Package last updated on 24 Jun 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.