New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@sophon-labs/account-react

Package Overview
Dependencies
Maintainers
4
Versions
141
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sophon-labs/account-react

React components for Sophon Account

latest
npmnpm
Version
2.3.8
Version published
Weekly downloads
4
-60%
Maintainers
4
Weekly downloads
 
Created
Source

@sophon-labs/account-react

React hooks and utilities for integrating Sophon swap functionality into React applications. This package provides a comprehensive set of hooks for managing token swaps, ERC-20 approvals, and gas estimation within the Sophon ecosystem.

Features

  • 🔄 Swap Transaction Management - Prepare and execute token swaps
  • 📊 Swap Status Tracking - Monitor transaction progress and completion
  • ERC-20 Token Approvals - Handle token approval workflows
  • Gas Estimation - Accurate gas cost predictions for transactions
  • 🔧 TypeScript Support - Fully typed for better developer experience
  • 🧪 Well Tested - Comprehensive test coverage with Vitest

Installation

npm install @sophon-labs/account-react
# or
yarn add @sophon-labs/account-react

Hooks

useGetSwapTransaction

Prepare a swap transaction by calling the /swap/transaction endpoint.

import { useGetSwapTransaction } from '@sophon-labs/account-react';

const { data, isLoading, error } = useGetSwapTransaction(
  {
    config: {
      fromToken: '0x...',
      toToken: '0x...',
      amount: '1000000000000000000',
      slippage: 0.005
    },
    enabled: true
  },
  {
    baseUrl: 'https://api.sophon.xyz',
    partnerId: 'your-partner-id'
  }
);

useGetSwapStatus

Track the status of a swap transaction.

import { useGetSwapStatus } from '@sophon-labs/account-react';

const { data, isLoading, error } = useGetSwapStatus(
  {
    txHash: '0x...',
    enabled: true
  },
  {
    baseUrl: 'https://api.sophon.xyz',
    partnerId: 'your-partner-id'
  }
);

useERC20Approval

Manage ERC-20 token approvals for swap contracts.

import { useERC20Approval } from '@sophon-labs/account-react';

const { approve, allowance, isLoading, error } = useERC20Approval({
  tokenAddress: '0x...',
  spenderAddress: '0x...',
  account: '0x...'
});

useGasEstimation

Estimate gas costs for transactions.

import { useGasEstimation } from '@sophon-labs/account-react';

const { gasEstimate, isLoading, error } = useGasEstimation({
  transaction: {
    to: '0x...',
    data: '0x...',
    value: '0'
  }
});

Utilities

API Client

The package includes utilities for making API calls to Sophon services:

import { createApiClient, serializeSwapConfig } from '@sophon-labs/account-react';

const apiClient = createApiClient({
  baseUrl: 'https://api.sophon.xyz',
  partnerId: 'your-partner-id'
});

TypeScript Types

All hooks and utilities are fully typed. Import types for better development experience:

import type { 
  SwapApiConfig,
  UnifiedTransactionResponse,
  SwapStatus 
} from '@sophon-labs/account-react';

Dependencies

Peer Dependencies

  • React (>=19.x)
  • React DOM (>=19.x)
  • viem (>=2.x)
  • wagmi (>=2.x)
  • @tanstack/react-query (>=5.x)

Core Dependencies

  • axios (for API calls)
  • clsx (for utility functions)

Development

# Install dependencies
npm install

# Build the package
npm run build

# Run tests
npm run test

# Run tests in watch mode
npm run test:watch

# Run tests with coverage
npm run test:ci

FAQs

Package last updated on 05 Nov 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