-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #238 from balancer-labs/develop
Release 0.1.39
- Loading branch information
Showing
101 changed files
with
11,221 additions
and
2,063 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Beta release | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- closed | ||
branches: | ||
- develop | ||
|
||
defaults: | ||
run: | ||
working-directory: balancer-js | ||
|
||
jobs: | ||
build_and_release: | ||
if: github.event.pull_request.merged == true | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
ref: develop | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
- uses: actions/cache@v2 | ||
id: cache | ||
with: | ||
path: "**/node_modules" | ||
key: yarn-v1-${{ hashFiles('**/yarn.lock') }} | ||
- run: yarn --immutable | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
- env: | ||
SIGNING_KEY: ${{ secrets.SIGNING_KEY }} | ||
run: | | ||
echo -n "$SIGNING_KEY" | base64 --decode | gpg --import | ||
git config --global user.name "gmbronco" | ||
git config --global user.email "[email protected]" | ||
git config user.signingkey A33ABD316E6629F6 | ||
git config gpg.program /usr/bin/gpg | ||
yarn version --prerelease --no-git-tag-version | ||
export NEW_VERSION=$(jq -r '.version' package.json) | ||
git commit -S -am "chore: version bump v$NEW_VERSION" | ||
git tag "v$NEW_VERSION" | ||
yarn build | ||
yarn publish --non-interactive --tag beta | ||
git push | ||
env: | ||
CI: true | ||
GITHUB_TOKEN: ${{ secrets.RELEASE_PAT }} | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,4 @@ yarn-error.log | |
dist/ | ||
src/subgraph/generated/ | ||
cache/ | ||
balancer-js.iml |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import { BalancerSDK, Network } from '../../src'; | ||
import { InvestType } from '../../src/modules/subgraph/generated/balancer-subgraph-types'; | ||
import { PoolJoinExit } from '../../src/modules/data/pool-joinExit'; | ||
|
||
// Balancer subgraph : https://api.thegraph.com/subgraphs/name/balancer-labs/balancer-polygon-v2 | ||
|
||
// npm run examples:run -- ./examples/data/pool-joinExit.ts | ||
|
||
const sdk = new BalancerSDK({ | ||
network: Network.POLYGON, | ||
rpcUrl: '', | ||
}); | ||
const { poolJoinExits } = sdk.data; | ||
|
||
const format = (result: PoolJoinExit[]): string => { | ||
return result | ||
.map( | ||
(it) => | ||
`${it.poolId}\t${it.type}\t${new Date( | ||
it.timestamp * 1000 | ||
).toLocaleString()}` | ||
) | ||
.join('\n'); | ||
}; | ||
|
||
(async function () { | ||
const USER_ADDR = '0xdfe6e354ce787944e67cc04ad4404a43f3112a10'; | ||
const POOL_ID = | ||
'0x36128d5436d2d70cab39c9af9cce146c38554ff0000100000000000000000008'; | ||
let result; | ||
|
||
result = await poolJoinExits.findByPool(POOL_ID, 5); | ||
if (result.length) { | ||
const item = result[0]; | ||
console.log( | ||
`Pool JoinExit by Pool Id:\n${item.type}\t${new Date( | ||
item.timestamp * 1000 | ||
).toLocaleString()}\t${item.tokens}` | ||
); | ||
} | ||
|
||
result = await poolJoinExits.findByUser(USER_ADDR, 5); | ||
console.log(`Pool JoinExit by User:\n${format(result)}`); | ||
|
||
const poolId = result[0].poolId; | ||
|
||
result = await poolJoinExits.query({ | ||
where: { pool: poolId, sender: USER_ADDR }, | ||
}); | ||
console.log(`Pool JoinExit Query by PoolId and User:\n${format(result)}`); | ||
|
||
result = await poolJoinExits.findJoins(USER_ADDR, poolId); | ||
console.log( | ||
`Pool JoinExit Query by PoolId and User and Type Join:\n${format(result)}` | ||
); | ||
|
||
result = await poolJoinExits.findExits(USER_ADDR, poolId); | ||
console.log( | ||
`Pool JoinExit Query by PoolId and User and Type Exit:\n${format(result)}` | ||
); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* Display APRs for pool ids hardcoded under `const ids` | ||
* Run command: yarn examples:run ./examples/data/token-prices.ts | ||
*/ | ||
import { BalancerSDK } from '@/.'; | ||
|
||
const sdk = new BalancerSDK({ network: 1, rpcUrl: '' }); | ||
const { data } = sdk; | ||
const dai = '0x6b175474e89094c44da98b954eedeac495271d0f'; | ||
const eth = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE'; | ||
const matic = '0x0000000000000000000000000000000000001010'; | ||
const tetuBal = '0x7fc9e0aa043787bfad28e29632ada302c790ce33'; | ||
|
||
(async () => { | ||
// It will be just one request to coingecko | ||
const ps = [eth, dai, tetuBal, matic, eth, dai, tetuBal, matic].map((t) => data.tokenPrices.find(t)); | ||
const price = await Promise.all(ps); | ||
|
||
console.log(price); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.