New:Introducing Socket Scanning for VS Code Marketplace Extensions.Learn more →
Get Started

@layerhop/solana

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@layerhop/solana

Execute LayerHop quotes with a Solana wallet: decode the transaction, sign and send it through @solana/wallet-adapter, Wallet Standard or an injected provider, submit-via-API and co-signed modes, then report it

latest
Source
npmnpm
Version
0.7.0
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

@layerhop/solana

npm license docs

Execute LayerHop quotes with a Solana wallet. It decodes the base64 SvmTx, has the wallet sign it (and send it, when the route allows), submits it through POST /v1/orders/submit when the route requires that, and reports the signature to LayerHop.

Never holds keys. Every transaction is confirmed by the user in their wallet.

Install

npm install @layerhop/solana @layerhop/sdk @solana/web3.js
# peer: @solana/web3.js ^1.98.4

Usage

import { useConnection, useWallet } from "@solana/wallet-adapter-react";
import { executeSolanaQuote, fromWalletAdapter, LayerHop } from "@layerhop/solana";

const lh = new LayerHop({ integrator: "myapp" });
const wallet = useWallet();
const { connection } = useConnection();

const { best } = await lh.quote({
  srcChain: "solana", srcToken: "SOL", amount: "100000000", dstChain: "base", dstToken: "USDC",
  sender: wallet.publicKey!.toBase58(), recipient: "0xYourEvmAddress",
});
const sent = await executeSolanaQuote(fromWalletAdapter(wallet), { quote: best, client: lh, connection });
await sent.wait(); // true once confirmed

Signers

Wallet stackSigner
@solana/wallet-adapter (useWallet() or an adapter)fromWalletAdapter(wallet)
Wallet Standard (getWallets())fromWalletStandard(wallet, account, "solana:mainnet")
Reown AppKit walletProvider, Phantom, Dynamic getSigner(), other injected/embedded providersfromInjectedProvider(provider)
Anything elseimplement SolanaSigner (signTransaction, optional signAndSendTransaction)

Send modes

sendSvmTx / executeSolanaQuote pick the mode from the transaction:

  • api (submitViaApi: true, e.g. Jupiter): the wallet only signs, then the signed bytes go to POST /v1/orders/submit.
  • cosigned (the provider already signed, e.g. Mayan): the wallet only signs (signing and sending could rewrite the transaction and void the provider's signature), then your connection broadcasts the exact bytes.
  • wallet: the wallet signs and sends. Sign-only wallets are broadcast through your connection.

Test-mode (sandbox) transactions never reach the wallet. executeSolanaQuote reports a placeholder signature instead.

Other exports: decodeSvmTx, solanaSendMode, confirmSignature, base64ToBytes, bytesToBase64, bytesToBase58.

Guide (Privy, Dynamic, Reown and more): https://docs.layerhop.com/guides/wallets. Example: example/swap.ts.

License

MIT

Keywords

layerhop

FAQs

Package last updated on 19 Oct 2026

Related posts