Catalog npm
Back to packageRELEASE DETAILS

1.1.30

npm

@0xshogun/sdk-react

Shogun SDK React

apibridgesdkshoguntypescript
Published12 Mar 2025
Direct dependencies43
Transitive dependenciesNot calculated

README

Current package documentation

Shogun SDK React Integration

Overview

The Shogun SDK React is a TypeScript library that enables cross-chain swaps and transfers between EVM chains and Solana. It provides quote fetching, transaction execution, and fee management capabilities.

Installation

npm install @0xshogun/sdk-react

or

yarn add @0xshogun/sdk-react

Features

  • Cross-chain token swaps between EVM chains and Solana
  • Quote fetching for optimal swap rates
  • Transaction execution management
  • Fee estimation and management
  • Balance tracking across chains
  • React hooks and context providers for seamless integration

Requirements

  • Node.js 16 or higher
  • TypeScript 4.5 or higher

Quick Start

import { useShogunQuote } from '@0xshogun/sdk';

...

function SwapComponent() {
    const { quote, isLoading, error } = useShogunQuote({
        fromChain: 'ethereum',
        toChain: 'solana',
        fromToken: '0x...',
        toToken: '...',
        amount: '1000000000000000000'
    });
}

React providers

'use client';
import { useSwap } from '@/store';
import { ShogunBalancesProvider, ShogunQuoteProvider, Token } from '@0xshogun/sdk';
import { useMemo } from 'react';

export const ShogunProvider = ({ children }: { children: React.ReactNode }) => {
  const {
    inputAmount,
    tokenIn,
    tokenOut,
    recipientAddress,
    slippage,
    setLatestSuggestedAutoSlippageValue,
    setInputAmount,
    dynamicSlippage // true/false, only for Solana transactions
  } = useSwap(); // Your swaps store

  const yourAddresses = {....} // Here your wallet addresses

  const affiliateWallets = useMemo(() => {
    return {
      solana: process.env.NEXT_PUBLIC_SOLANA_AFFILIATE_WALLET!, // Your affiliate wallet on solana
      evm: process.env.NEXT_PUBLIC_EVM_AFFILIATE_WALLET!, // Your affiliate wallet on evm chains
    };
  }, []);

  const api = useMemo(() => {
    return {
      key: process.env.NEXT_PUBLIC_DEXTRA_X_API_KEY!, // Dextra API keys
      url: process.env.NEXT_PUBLIC_DEXTRA_URL!, // Dextra API URL
    };
  }, []);

  return (
    <ShogunBalancesProvider apiKey={process.env.NEXT_PUBLIC_CODEX_API!}>
      <ShogunQuoteProvider
        swap={{
          tokenIn: tokenIn as Token,
          tokenOut: tokenOut as Token,
          setLatestSuggestedAutoSlippageValue,
          inputAmount,
          setInputAmount,
          recipientAddress,
          slippage,
        }}
        system={{
          api,
          systemFeePercent: 0.01,
          userEVMAddress: yourAddresses?.turnKeyEVMAddress as string,
          userSolanaAddress: yourAddresses?.turnkeySolanaAddress as string,
          affiliateWallets,
        }}
      >
        {children}
      </ShogunQuoteProvider>
    </ShogunBalancesProvider>
  );
};

Development

Install dependencies

npm install

Build the package

npm run build

Run tests

npm test

Format code

npm run format

Lint code

npm run lint

Contributing Contributions are welcome! Please read our Contributing Guide for details on our code of conduct and the process for submitting pull requests.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Declared dependencies 47

Native requirements
43 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
zod
Environment
{
  "local_name": "zod",
  "alias": false,
  "peer_metadata": null
}
^3.24.2runtime
bs58
Environment
{
  "local_name": "bs58",
  "alias": false,
  "peer_metadata": null
}
^6.0.0runtime
viem
Environment
{
  "local_name": "viem",
  "alias": false,
  "peer_metadata": null
}
^2.23.5runtime
axios
Environment
{
  "local_name": "axios",
  "alias": false,
  "peer_metadata": null
}
^1.8.1runtime
jsdom
Environment
{
  "local_name": "jsdom",
  "alias": false,
  "peer_metadata": null
}
^26.0.0runtime
react
Environment
{
  "local_name": "react",
  "alias": false,
  "peer_metadata": null
}
^18.0.0runtime
wagmi
Environment
{
  "local_name": "wagmi",
  "alias": false,
  "peer_metadata": null
}
^2.14.12runtime
dotenv
Environment
{
  "local_name": "dotenv",
  "alias": false,
  "peer_metadata": null
}
^16.4.7runtime
eslint
Environment
{
  "local_name": "eslint",
  "alias": false,
  "peer_metadata": null
}
^8.0.1runtime
ethers
Environment
{
  "local_name": "ethers",
  "alias": false,
  "peer_metadata": null
}
^6.13.5runtime
prettier
Environment
{
  "local_name": "prettier",
  "alias": false,
  "peer_metadata": null
}
^3.3.3runtime
react-dom
Environment
{
  "local_name": "react-dom",
  "alias": false,
  "peer_metadata": null
}
^18.0.0runtime
@types/react
Environment
{
  "local_name": "@types/react",
  "alias": false,
  "peer_metadata": null
}
^18.0.0runtime
@0xshogun/sdk
Environment
{
  "local_name": "@0xshogun/sdk",
  "alias": false,
  "peer_metadata": null
}
^1.1.35runtime
@codex-data/sdk
Environment
{
  "local_name": "@codex-data/sdk",
  "alias": false,
  "peer_metadata": null
}
^1.0.4runtime
@solana/web3.js
Environment
{
  "local_name": "@solana/web3.js",
  "alias": false,
  "peer_metadata": null
}
^1.98.0runtime
@types/react-dom
Environment
{
  "local_name": "@types/react-dom",
  "alias": false,
  "peer_metadata": null
}
^18.0.0runtime
@solana/spl-token
Environment
{
  "local_name": "@solana/spl-token",
  "alias": false,
  "peer_metadata": null
}
^0.4.12runtime
vite-tsconfig-paths
Environment
{
  "local_name": "vite-tsconfig-paths",
  "alias": false,
  "peer_metadata": null
}
^5.1.4runtime
@testing-library/dom
Environment
{
  "local_name": "@testing-library/dom",
  "alias": false,
  "peer_metadata": null
}
^10.4.0runtime
@vitejs/plugin-react
Environment
{
  "local_name": "@vitejs/plugin-react",
  "alias": false,
  "peer_metadata": null
}
^4.3.4runtime
eslint-plugin-import
Environment
{
  "local_name": "eslint-plugin-import",
  "alias": false,
  "peer_metadata": null
}
^2.31.0runtime
@tanstack/react-query
Environment
{
  "local_name": "@tanstack/react-query",
  "alias": false,
  "peer_metadata": null
}
^5.0.0runtime
@testing-library/react
Environment
{
  "local_name": "@testing-library/react",
  "alias": false,
  "peer_metadata": null
}
^16.2.0runtime
eslint-config-prettier
Environment
{
  "local_name": "eslint-config-prettier",
  "alias": false,
  "peer_metadata": null
}
^9.1.0runtime
eslint-plugin-prettier
Environment
{
  "local_name": "eslint-plugin-prettier",
  "alias": false,
  "peer_metadata": null
}
^5.2.1runtime
@testing-library/jest-dom
Environment
{
  "local_name": "@testing-library/jest-dom",
  "alias": false,
  "peer_metadata": null
}
^6.6.3runtime
@vitest/coverage-istanbul
Environment
{
  "local_name": "@vitest/coverage-istanbul",
  "alias": false,
  "peer_metadata": null
}
3.0.7runtime
eslint-plugin-unused-imports
Environment
{
  "local_name": "eslint-plugin-unused-imports",
  "alias": false,
  "peer_metadata": null
}
^4.1.4runtime
@tanstack/react-query-devtools
Environment
{
  "local_name": "@tanstack/react-query-devtools",
  "alias": false,
  "peer_metadata": null
}
^5.66.0runtime
jest
Environment
{
  "local_name": "jest",
  "alias": false,
  "peer_metadata": null
}
^29.7.0development
vitest
Environment
{
  "local_name": "vitest",
  "alias": false,
  "peer_metadata": null
}
^3.0.7development
esbuild
Environment
{
  "local_name": "esbuild",
  "alias": false,
  "peer_metadata": null
}
^0.20.1development
ts-jest
Environment
{
  "local_name": "ts-jest",
  "alias": false,
  "peer_metadata": null
}
^29.2.6development
typescript
Environment
{
  "local_name": "typescript",
  "alias": false,
  "peer_metadata": null
}
^5.7.3development
@types/jest
Environment
{
  "local_name": "@types/jest",
  "alias": false,
  "peer_metadata": null
}
^29.5.14development
@types/node
Environment
{
  "local_name": "@types/node",
  "alias": false,
  "peer_metadata": null
}
^22.13.5development
@types/react
Environment
{
  "local_name": "@types/react",
  "alias": false,
  "peer_metadata": null
}
^18.0.0development
@types/react-dom
Environment
{
  "local_name": "@types/react-dom",
  "alias": false,
  "peer_metadata": null
}
^18.0.0development
@vitest/coverage-v8
Environment
{
  "local_name": "@vitest/coverage-v8",
  "alias": false,
  "peer_metadata": null
}
^3.0.7development
eslint-plugin-promise
Environment
{
  "local_name": "eslint-plugin-promise",
  "alias": false,
  "peer_metadata": null
}
^7.1.0development
eslint-plugin-sonarjs
Environment
{
  "local_name": "eslint-plugin-sonarjs",
  "alias": false,
  "peer_metadata": null
}
^2.0.4development
@typescript-eslint/parser
Environment
{
  "local_name": "@typescript-eslint/parser",
  "alias": false,
  "peer_metadata": null
}
^8.26.1development
eslint-plugin-react-hooks
Environment
{
  "local_name": "eslint-plugin-react-hooks",
  "alias": false,
  "peer_metadata": null
}
^5.2.0development
@typescript-eslint/eslint-plugin
Environment
{
  "local_name": "@typescript-eslint/eslint-plugin",
  "alias": false,
  "peer_metadata": null
}
^8.26.1development
react
Environment
{
  "local_name": "react",
  "alias": false,
  "peer_metadata": null
}
^18.0.0peer
@tanstack/react-query
Environment
{
  "local_name": "@tanstack/react-query",
  "alias": false,
  "peer_metadata": null
}
^5.0.0peer

Distribution files

1 collected
Distribution 1

Source distribution

Source file
Checksums from source
{
  "shasum": "9bbb9b84f63d15e0f5357e0032cf2fccaf26d48e",
  "tarball": "https://registry.npmjs.org/@0xshogun/sdk-react/-/sdk-react-1.1.30.tgz",
  "fileCount": 24,
  "integrity": "sha512-SWfgPlt1gXzl7cmueBDm942SaLxwjVRgdh4RGiTi5bOgyvSE+kFscmJbQz2sl+TWmOJowVhCs4iTOIrGq2nSPA==",
  "signatures": [
    {
      "sig": "MEUCIQC9NIbOrzs8AMLKZp9NDg3JeAg8iTIKvMCsJousNgKPDQIgKU3LKOTECy3gYS1STiqaPSaf1PmAqlu7k6ZsR62ZYno=",
      "keyid": "SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"
    }
  ],
  "unpackedSize": 209425
}

Repository

PENDING
shogun-network/shogun-sdk-react

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 11:29 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package_version:5a21dbd76c7b19c5da0019fbcf6b28f37e3376e36e8b3f7ffd51d4f8a9de354f

Other collected versions

1.1.6528 Mar1.1.65-beta26 Mar1.1.64-beta26 Mar1.1.6325 Mar1.1.6225 Mar1.1.6125 MarView all collected versions →