Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into sor-update-4.1.1-b…
Browse files Browse the repository at this point in the history
…eta.12

# Conflicts:
#	balancer-js/src/modules/sor/pool-data/onChainData.ts
  • Loading branch information
brunoguerios committed Jul 12, 2023
2 parents 5ca9a3d + 2992c19 commit e91e3d1
Show file tree
Hide file tree
Showing 64 changed files with 1,228 additions and 616 deletions.
14 changes: 7 additions & 7 deletions balancer-js/examples/pools/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import { BalancerSDK, PoolWithMethods } from '@balancer-labs/sdk'
import { parseEther, formatEther } from '@ethersproject/units'
import { BigNumber } from "@ethersproject/bignumber";

const sdk = new BalancerSDK({
network: 1,
Expand All @@ -21,19 +22,18 @@ const {
// Joining with a single token
const queryJoin = async (pool: PoolWithMethods) => {
const token = pool.tokensList[0];
const maxAmountsInByToken = new Map<string,BigNumber>([[token, parseEther('1')]]);
const joinExactInQuery = pool.buildQueryJoinExactIn({
maxAmountsIn: pool.tokensList.map((t) =>
parseEther(t === token ? '1' : '0')
),
maxAmountsInByToken
});

const response = await contracts.balancerHelpers.callStatic.queryJoin(
...joinExactInQuery
);

console.log(`Joining ${pool.poolType}`);
console.log(`Joining ${ pool.poolType }`);
console.table({
tokens: pool.tokensList.map((t) => `${t.slice(0, 6)}...${t.slice(38, 42)}`),
tokens: pool.tokensList.map((t) => `${ t.slice(0, 6) }...${ t.slice(38, 42) }`),
amountsIn: response.amountsIn.map(formatEther),
bptOut: formatEther(response.bptOut),
});
Expand All @@ -50,9 +50,9 @@ const queryExit = async (pool: PoolWithMethods) => {
...exitToSingleToken
);

console.log(`Exiting ${pool.poolType}`);
console.log(`Exiting ${ pool.poolType }`);
console.table({
tokens: pool.tokensList.map((t) => `${t.slice(0, 6)}...${t.slice(38, 42)}`),
tokens: pool.tokensList.map((t) => `${ t.slice(0, 6) }...${ t.slice(38, 42) }`),
amountsOut: response.amountsOut.map(formatEther),
bptIn: formatEther(response.bptIn),
});
Expand Down
2 changes: 1 addition & 1 deletion balancer-js/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@balancer-labs/sdk",
"version": "1.1.3-beta.1",
"version": "1.1.3-beta.5",
"description": "JavaScript SDK for interacting with the Balancer Protocol V2",
"license": "GPL-3.0-only",
"homepage": "https://github.com/balancer-labs/balancer-sdk#readme",
Expand Down
Loading

0 comments on commit e91e3d1

Please sign in to comment.