Skip to content

Commit

Permalink
Merge pull request #464 from balancer/develop
Browse files Browse the repository at this point in the history
Release v1.1.1
  • Loading branch information
johngrantuk authored Jun 12, 2023
2 parents 668efeb + 2ddb3d5 commit c02f1f5
Show file tree
Hide file tree
Showing 178 changed files with 7,701 additions and 19,166 deletions.
1 change: 1 addition & 0 deletions balancer-js/.eslintignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
dist
examples
**/generated
5 changes: 5 additions & 0 deletions balancer-js/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ module.exports = {
message:
"import from '@ethersproject/*' instead to avoid rollup build issues",
},
{
group: ['@balancer/sdk'],
message:
"import from '@balancer/sdk' allowed only in the examples",
},
],
},
]
Expand Down
13 changes: 7 additions & 6 deletions balancer-js/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ A JavaScript SDK which provides commonly used utilties for interacting with Bala

**In order to run the examples provided, you need to follow the next steps:**

1. git clone https://github.com/balancer-labs/balancer-sdk.git
2. cd balancer-sdk
3. cd balancer-js
1. ```git clone https://github.com/balancer-labs/balancer-sdk.git```
2. ```cd balancer-sdk```
3. ```cd balancer-js```
4. Create a .env file in the balancer-js folder
5. In the .env file you will need to define and initialize the following variables

Expand All @@ -24,9 +24,10 @@ A JavaScript SDK which provides commonly used utilties for interacting with Bala
6. Run 'npm run node', this runs a local Hardhat Network
7. Open a new terminal
8. cd to balancer-js
9. Install ts-node using: npm install ts-node
10. Install tsconfig-paths using: npm install --save-dev tsconfig-paths
11. Run one of the provided examples (eg: npm run examples:run -- examples/join.ts)
9. Install ts-node using: ```npm install ts-node```
10. Install tsconfig-paths using: ```npm install --save-dev tsconfig-paths```
11. Generate contracts using: ```npm run typechain:generate```
12. Run one of the provided examples (eg: npm run examples:run -- examples/join.ts)

## Installation

Expand Down
106 changes: 0 additions & 106 deletions balancer-js/examples/batchSwap.ts

This file was deleted.

64 changes: 0 additions & 64 deletions balancer-js/examples/constants.ts

This file was deleted.

31 changes: 0 additions & 31 deletions balancer-js/examples/contracts/feeDistributor.ts

This file was deleted.

44 changes: 0 additions & 44 deletions balancer-js/examples/contracts/liquidity-gauge.ts

This file was deleted.

29 changes: 14 additions & 15 deletions balancer-js/examples/contracts/veBAL-proxy.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
import { BalancerSDK } from '../../src/modules/sdk.module';
import { Network } from '../../src';
import dotenv from 'dotenv';
/**
* This example shows how to the adjusted veBAL balance from the active boost delegation contract
*
* How to run:
* yarn run example examples/contracts/veBAL-proxy.ts
*/
import { BalancerSDK, Network } from '@balancer-labs/sdk';

dotenv.config();

const sdk = new BalancerSDK(
{
network: Network.GOERLI,
rpcUrl: `https://goerli.infura.io/v3/${process.env.INFURA}`
const sdk = new BalancerSDK({
network: Network.GOERLI,
rpcUrl: 'https://rpc.ankr.com/eth_goerli'
});

const { veBalProxy } = sdk.contracts;

async function main() {

const USER = "0x91F450602455564A64207414c7Fbd1F1F0EbB425";

console.log("User's veBAL adjusted balance", await veBalProxy?.getAdjustedBalance(USER));
const USER = "0x91F450602455564A64207414c7Fbd1F1F0EbB425";
const balance = await veBalProxy?.getAdjustedBalance(USER);
console.log("User's veBAL adjusted balance", balance);
}

main();

// npm run examples:run -- ./examples/contracts/veBAL-proxy.ts
33 changes: 16 additions & 17 deletions balancer-js/examples/contracts/veBAL.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
import { BalancerSDK } from '../../src/modules/sdk.module';
import { Network } from '../../src';
import dotenv from 'dotenv';

dotenv.config();

const sdk = new BalancerSDK(
{
network: Network.GOERLI,
rpcUrl: `https://goerli.infura.io/v3/${process.env.INFURA}`
/**
* Shows how to interact with the veBAL contract
*
* How to run:
* yarn run example examples/contracts/veBAL.ts
*/
import { BalancerSDK, Network } from '@balancer-labs/sdk';

const sdk = new BalancerSDK({
network: Network.GOERLI,
rpcUrl: 'https://rpc.ankr.com/eth_goerli'
});

const { veBal } = sdk.contracts;

async function main() {
if (!veBal) throw new Error('veBal address must be defined');

if (!veBal) throw new Error('veBal address must be defined');
const USER = "0x91F450602455564A64207414c7Fbd1F1F0EbB425";

const USER = "0x91F450602455564A64207414c7Fbd1F1F0EbB425";

const lockInfo = await veBal.getLockInfo(USER);
console.log("veBAL lock info for user", lockInfo);
const lockInfo = await veBal.getLockInfo(USER);
console.log("veBAL lock info for user", lockInfo);
}

main();

// npm run examples:run -- ./examples/contracts/veBAL.ts
Loading

0 comments on commit c02f1f5

Please sign in to comment.