Research
Security News
Kill Switch Hidden in npm Packages Typosquatting Chalk and Chokidar
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
@beanstalk/sdk
Advanced tools
A JavaScript framework for interacting with the Beanstalk protocol and ecosystem
This is a JavaScript SDK for the Beanstalk web app.
The current version of the Beanstalk SDK is considered a beta release. The codebase is novel and has not been tested in the "real world" prior to use by Root and Paradox. Use of the Beanstalk SDK could result in loss of funds, whether due to bugs or misuse.
The SDK is dependent on Beanstalk, and therefore inherits all of the risks associated with Beanstalk. The security of Beanstalk is assumed. For an exhaustive list, consult the Beanstalk whitepaper and Beanstalk DAO Disclosures.
Create an instance
import { BeanstalkSDK } from "@beanstalk/sdk";
const sdk = new BeanstalkSDK(options);
SDK contructor options:
const options = {
// etherjs Signer. Optional
signer,
// etherjs Provider. Optional
provider,
// rpcUrl
rpcUrl,
// Data source for balances. Optional, either
// - DataSource.LEDGER (default)
// - DataSource.SUBGRAPH
source,
// bool, print debug output. default `false`
DEBUG
};
options
object is optional. If ommited, SDK will use an ethers.getDefaultProvider()
rpcUrl
is provided, SDK will use a WebSocketProvider
or JsonRpcProvider
, depending on the protocol in the url (ws
vs http
)signer
is provided, sdk.provider
will be set to signer.provider
The following objects are available for import from the library:
import {
BeanstalkSDK,
Utils,
TokenValue
Token,
NativeToken,
ERC20Token,
BeanstalkToken,
Address,
ChainID
} from "@beanstalk/sdk";
const sdk = new BeanstalkSDK({ signer });
const fromToken = sdk.tokens.ETH;
const toToken = sdk.tokens.BEAN;
const account = signer.address;
const amount = sdk.tokens.ETH.amount(1.5);
const slippage = 0.1; // 0.1% : 0.1/100
const swap = sdk.swap.buildSwap(fromToken, toToken, account);
const est = await swap.estimate(amount);
console.log(`You'd receive ${est.toHuman()} ${toToken.symbol}`);
const txr = await swap.execute(amount, slippage);
await txr.wait();
View full API documentation
FAQs
A JavaScript framework for interacting with the Beanstalk protocol and ecosystem
We found that @beanstalk/sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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 researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.