
Security News
The Next Open Source Security Race: Triage at Machine Speed
Claude Opus 4.6 has uncovered more than 500 open source vulnerabilities, raising new considerations for disclosure, triage, and patching at scale.
@balancer/sdk
Advanced tools
WIP upgrade of the SDK. Not meant for production usage yet and interfaces may have frequent breaking changes until a stable release.
pnpm install
fetchIf your platform does not support one of the required features, it is also possible to import a polyfill.
fetch -> node-fetchTesting requires access to an archive node for onchain quote comparisons. This can be done using Infura.
pnpm test
The Balancer API Provider is a provider that facilitates data fetching from the Balancer API, it can be used for:
import { BalancerApi, AddLiquidity } from "@balancer/sdk";
...
const addLiquidityInput: AddLiquidityProportionalInput = {
bptOut,
chainId,
rpcUrl,
kind: AddLiquidityKind.Proportional,
};
const balancerApi = new BalancerApi('https://backend-v3-canary.beets-ftm-node.com/graphql', 1);
const poolState = await balancerApi.pools.fetchPoolState('0x5f1d6874cb1e7156e79a7563d2b61c6cbce03150000200000000000000000586');
const addLiquidity = new AddLiquidity();
const queryOutput = await addLiquidity.query(addLiquidityInput, poolState);
const { call, to, value, maxAmountsIn, minBptOut } =
addLiquidity.buildCall({
...queryOutput,
slippage,
sender: signerAddress,
recipient: signerAddress,
});
const client = createClient({
...
})
await client.sendTransaction({
account: signerAddress,
chain: client.chain,
data: call,
to,
value,
});
Full working add liquidity example: examples/addLiquidity.ts
import { BalancerApi, RemoveLiquidity } from "@balancer/sdk";
...
const removeLiquidityInput: RemoveLiquiditySingleTokenInput = {
chainId,
rpcUrl,
bptIn,
tokenOut,
kind: RemoveLiquidityKind.SingleToken,
};
const balancerApi = new BalancerApi('https://backend-v3-canary.beets-ftm-node.com/graphql', 1);
const poolState = await balancerApi.pools.fetchPoolState('0x5f1d6874cb1e7156e79a7563d2b61c6cbce03150000200000000000000000586');
const removeLiquidity = new RemoveLiquidity();
const queryOutput = await removeLiquidity.query(removeLiquidityInput, poolState);
const { call, to, value, maxAmountsIn, minBptOut } =
removeLiquidity.buildCall({
...queryOutput,
slippage,
sender: signerAddress,
recipient: signerAddress,
});
const client = createClient({
...
})
await client.sendTransaction({
account: signerAddress,
chain: client.chain,
data: call,
to,
value,
});
Full working remove liquidity example: examples/removeLiquidity.ts
Pool Creation functionality is available for the latest versions of Weighted Pools (V4) and Composable Stable Pools (V5). For usage check our examples:
To download and install the anvil client, run the following commands (MacOS):
curl -L https://foundry.paradigm.xyz | bashbrew install libusbsource /Users/$(whoami)/.zshenvfoundryupFor other SO's check https://book.getfoundry.sh/getting-started/installation
FAQs
SDK for interacting with the Balancer protocol
We found that @balancer/sdk demonstrated a healthy version release cadence and project activity because the last version was released less than 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.

Security News
Claude Opus 4.6 has uncovered more than 500 open source vulnerabilities, raising new considerations for disclosure, triage, and patching at scale.

Research
/Security News
Malicious dYdX client packages were published to npm and PyPI after a maintainer compromise, enabling wallet credential theft and remote code execution.

Security News
gem.coop is testing registry-level dependency cooldowns to limit exposure during the brief window when malicious gems are most likely to spread.