Research
Security News
Threat Actor Exposes Playbook for Exploiting npm to Build Blockchain-Powered Botnets
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
@project-serum/serum
Advanced tools
JavaScript client library for interacting with the Project Serum DEX.
Using npm:
npm install @solana/web3.js @project-serum/serum
Using yarn:
yarn add @solana/web3.js @project-serum/serum
import { Account, Connection, PublicKey } from '@solana/web3.js';
import { Market } from '@project-serum/serum';
let connection = new Connection('https://testnet.solana.com');
let marketAddress = new PublicKey('...');
let market = await Market.load(connection, marketAddress);
// Fetching orderbooks
let bids = await market.loadBids(connection);
let asks = await market.loadAsks(connection);
// L2 orderbook data
for (let [price, size] of bids.getL2(20)) {
console.log(price, size);
}
// Full orderbook data
for (let order of asks) {
console.log(
order.orderId,
order.owner.toBase58(),
order.price,
order.size,
order.side, // 'buy' or 'sell'
);
}
// Placing orders
let owner = new Account('...');
let payer = new PublicKey('...'); // spl-token account
await market.placeOrder(connection, {
owner,
payer,
side: 'buy', // 'buy' or 'sell'
price: 123.45,
size: 17.0,
orderType: 'limit', // 'limit', 'ioc', 'postOnly'
});
// Retrieving open orders by owner
let myOrders = await market.loadOrdersForOwner(connection, owner.publicKey);
// Cancelling orders
for (let order of myOrders) {
await market.cancelOrder(connection, owner, order);
}
// Retrieving fills
for (let fill of await market.loadFills(connection)) {
console.log(
fill.orderId,
fill.owner.toBase58(),
fill.price,
fill.size,
fill.side,
);
}
// Settle funds
for (let openOrders of await market.findOpenOrdersAccountsForOwner(
connection,
owner.publicKey,
)) {
if (openOrders.baseTokenFree > 0 || openOrders.quoteTokenFree > 0) {
// spl-token accounts to which to send the proceeds from trades
let baseTokenAccount = new PublicKey('...');
let quoteTokenAccount = new PublicKey('...');
await market.settleFunds(
connection,
owner,
openOrders,
baseTokenAccount,
quoteTokenAccount,
);
}
}
FAQs
Library for interacting with the serum dex
The npm package @project-serum/serum receives a total of 0 weekly downloads. As such, @project-serum/serum popularity was classified as not popular.
We found that @project-serum/serum demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 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
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.
Security News
NVD’s backlog surpasses 20,000 CVEs as analysis slows and NIST announces new system updates to address ongoing delays.
Security News
Research
A malicious npm package disguised as a WhatsApp client is exploiting authentication flows with a remote kill switch to exfiltrate data and destroy files.