Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@jup-ag/core
Advanced tools
Jupiter core typescript library
Yarn
yarn add @jup-ag/core
NPM
npm install @jup-ag/core
import { Connection } from '@solana/web3.js';
import { Jupiter } from '@jup-ag/core';
import { Wallet } from '@project-serum/anchor';
const wallet = Wallet.local()
const main = async () => {
const connection = new Connection('https://solana-api.projectserum.com');
const wallet = new Wallet
// load Jupiter
const jupiter = await Jupiter.load({
connection,
cluster: 'mainnet-beta',
user: wallet.payer // or public key
})
// RouteMap which map each tokenMint and their respective tokenMints that are swappable
const routeMap = jupiter.getRouteMap();
const possibleSOLPairs = routeMap.get('So11111111111111111111111111111111111111112'); // return an array of token mints that can be swapped with SOL
// Calculate routes for swapping 1 SOL to USDC with 1% slippage
// routes are sorted based on outputAmount, so ideally the first route is the best.
const routes = jupiter.computeRoutes('So11111111111111111111111111111111111111112', 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', 1_000_000_000, 1);
console.log('Quoted out amount', routes[0].outAmount);
// Prepare execute exchange
const { execute } = await jupiter.exchange({
route: routes[0]
})
// Swap for keypair
const swapResult = await execute()
// Swap for publicKey
// const swapResult = await execute({
// wallet: SignerWalletAdapter // from @solana/wallet-adapter-base, mainly need signTransaction and signAllTransactions
// })
if (swapResult.error) {
console.log(swapResult.error)
} else {
console.log(swapResult.txid)
console.log(swapResult.inputAddress)
console.log(swapResult.outputAddress)
console.log(swapResult.inputAmount)
console.log(swapResult.outputAmount)
}
FAQs
![1*cXNgzu0Pvj4HwOLw4Akwqg](https://user-images.githubusercontent.com/34560707/145749257-e48cb199-521b-476e-9d81-f79bb45ef834.png)
The npm package @jup-ag/core receives a total of 1,072 weekly downloads. As such, @jup-ag/core popularity was classified as popular.
We found that @jup-ag/core demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?
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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.