-
Notifications
You must be signed in to change notification settings - Fork 93
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 #247 from balancer-labs/develop
Release 0.1.41
- Loading branch information
Showing
36 changed files
with
980 additions
and
117 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ jobs: | |
- uses: actions/checkout@v3 | ||
with: | ||
ref: develop | ||
token: ${{ secrets.RELEASE_PAT }} | ||
persist-credentials: false | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18 | ||
|
@@ -32,21 +32,22 @@ jobs: | |
if: steps.cache.outputs.cache-hit != 'true' | ||
- env: | ||
SIGNING_KEY: ${{ secrets.SIGNING_KEY }} | ||
NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
GITHUB_TOKEN: ${{ secrets.RELEASE_PAT }} | ||
run: | | ||
echo -n "$SIGNING_KEY" | base64 --decode | gpg --import | ||
git config --global user.name "johngrantuk" | ||
git config --global user.email "[email protected]" | ||
git config user.signingkey AFFC8986D78B522F2999BAE053C748C476381000 | ||
git config gpg.program /usr/bin/gpg | ||
git checkout develop | ||
yarn version --prerelease --preid beta --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" | ||
git remote set-url origin "https://johngrantuk:[email protected]/balancer-labs/balancer-sdk" | ||
git push | ||
yarn build | ||
yarn publish --non-interactive --tag beta | ||
git push | ||
env: | ||
CI: true | ||
NPM_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
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,26 @@ | ||
/** | ||
* yarn examples:run ./examples/data/emissions.ts | ||
*/ | ||
import { BalancerSDK } from '@/.'; | ||
import { balEmissions } from '@/modules/data'; | ||
|
||
const sdk = new BalancerSDK({ | ||
network: 1, | ||
rpcUrl: 'https://eth-rpc.gateway.pokt.network' | ||
}) | ||
|
||
const { data } = sdk; | ||
|
||
const now = Math.round(new Date().getTime() / 1000) | ||
const totalBalEmissions = balEmissions.between(now, now + 365 * 86400) | ||
|
||
const main = async () => { | ||
if (data.liquidityGauges) { | ||
const gauge = await data.liquidityGauges.findBy('poolId', '0xa13a9247ea42d743238089903570127dda72fe4400000000000000000000035d'); | ||
if (gauge) { | ||
console.log(`yearly emissions share: ${totalBalEmissions * gauge.relativeWeight} BAL`); | ||
} | ||
} | ||
} | ||
|
||
main() |
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
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
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,20 @@ | ||
import { BalancerSDK } from '@/.'; | ||
|
||
const sdk = new BalancerSDK({ | ||
network: 1, | ||
rpcUrl: 'https://eth-rpc.gateway.pokt.network', | ||
}); | ||
|
||
(() => { | ||
[ | ||
'0xa5533a44d06800eaf2daad5aad3f9aa9e1dc36140002000000000000000001b8', | ||
].forEach(async (poolId) => { | ||
const pool = await sdk.pools.find(poolId); | ||
if (pool) { | ||
const fees = await sdk.pools.fees(pool); | ||
console.log(fees); | ||
} | ||
}) | ||
})(); | ||
|
||
// yarn examples:run ./examples/pools/fees.ts |
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,62 @@ | ||
/** | ||
* Shows how to query balancer helper contracts for | ||
* expected amounts when providing or exiting liquidity from pools | ||
* | ||
* yarn examples:run ./examples/pools/queries.ts | ||
*/ | ||
|
||
import { parseEther, formatEther } from '@ethersproject/units' | ||
import { BalancerSDK, PoolWithMethods } from '@/.' | ||
|
||
const sdk = new BalancerSDK({ | ||
network: 1, | ||
rpcUrl: 'https://eth-rpc.gateway.pokt.network', | ||
}) | ||
|
||
const { pools, balancerContracts: contracts } = sdk; | ||
|
||
// Joining with a single token | ||
const queryJoin = async (pool: PoolWithMethods) => { | ||
const token = pool.tokensList[0] | ||
const joinExactInQuery = pool.buildQueryJoinExactIn({ | ||
maxAmountsIn: pool.tokensList.map((t) => parseEther((t === token) ? '1' : '0')) | ||
}) | ||
|
||
const response = await contracts.balancerHelpers.queryJoin(...joinExactInQuery) | ||
|
||
console.log(`Joining ${pool.poolType}`) | ||
console.table({ | ||
tokens: pool.tokensList.map((t) => `${t.slice(0, 6)}...${t.slice(38, 42)}`), | ||
amountsIn: response.amountsIn.map(formatEther), | ||
bptOut: formatEther(response.bptOut), | ||
}); | ||
} | ||
|
||
// Exiting to single token | ||
const queryExit = async (pool: PoolWithMethods) => { | ||
const exitToSingleToken = pool.buildQueryExitToSingleToken({ | ||
bptIn: parseEther('1'), | ||
tokenOut: pool.tokensList[0] | ||
}) | ||
|
||
const response = await contracts.balancerHelpers.queryExit(...exitToSingleToken) | ||
|
||
console.log(`Exiting ${pool.poolType}`) | ||
console.table({ | ||
tokens: pool.tokensList.map((t) => `${t.slice(0, 6)}...${t.slice(38, 42)}`), | ||
amountsOut: response.amountsOut.map(formatEther), | ||
bptIn: formatEther(response.bptIn), | ||
}) | ||
} | ||
|
||
|
||
(async () => { | ||
const composableStable = await pools.find('0xa13a9247ea42d743238089903570127dda72fe4400000000000000000000035d') | ||
const weighted = await pools.find('0x25accb7943fd73dda5e23ba6329085a3c24bfb6a000200000000000000000387') | ||
const metaStable = await pools.find('0x32296969ef14eb0c6d29669c550d4a0449130230000200000000000000000080') | ||
|
||
for (const pool of [composableStable, weighted, metaStable]) { | ||
await queryJoin(pool!) | ||
await queryExit(pool!) | ||
} | ||
})() |
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
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
Oops, something went wrong.