diff --git a/README.md b/README.md index ef19ce4..6024d35 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,28 @@ # beefy-balances-api -``` +Access api for the CLM subgraph: https://github.com/beefyfinance/beefy-balances-subgraph + +## add a new chain + +- Add the chain to `src/config/chains.ts` +- `npm run update:addressbook` +- `npm run test:ts` and fix errs +- `npm run format` +- `npm run dev` + - http://localhost:4000/api/v1/status + - http://localhost:4000/api/v1/holders/counts/all + - http://localhost:4000/api/v1/config/:chain/vaults + - http://localhost:4000/api/v1/contract/:chain/:vault_address/:block_number/share-tokens-balances + + +## Deploy the api + +- `npm run deploy` to deploy the api + + +# Test urls +``` https://balance-api.beefy.finance/api/v1/status http://localhost:4000/api/v1/status diff --git a/package-lock.json b/package-lock.json index 863142c..1c391a0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -21,7 +21,7 @@ "@sinclair/typebox": "^0.32.33", "@types/lodash-es": "^4.17.12", "async-lock": "^1.4.1", - "blockchain-addressbook": "^0.47.98", + "blockchain-addressbook": "^0.47.107", "decimal.js": "^10.4.3", "dotenv": "^16.4.5", "fastify": "^4.26.2", @@ -31,7 +31,7 @@ "lodash": "^4.17.21", "node-cache": "^5.1.2", "pino": "^8.19.0", - "viem": "^2.21.54" + "viem": "^2.21.56" }, "devDependencies": { "@biomejs/biome": "1.8.2", @@ -5491,9 +5491,9 @@ } }, "node_modules/blockchain-addressbook": { - "version": "0.47.98", - "resolved": "https://registry.npmjs.org/blockchain-addressbook/-/blockchain-addressbook-0.47.98.tgz", - "integrity": "sha512-U4FbqU3pb3ZN+/tC+NlL+6V5KUnliOcHnmYbq7Ft3+VuuJaqLoMeC/w1GnfzJvBnd7fSv3FdFTFS3o7nVyYHJA==" + "version": "0.47.107", + "resolved": "https://registry.npmjs.org/blockchain-addressbook/-/blockchain-addressbook-0.47.107.tgz", + "integrity": "sha512-lCRACmURiEIKM6OmJ8TUBzUi6txO2O/A1fhWaMmstMf4t0z5Jlu8FUKrMFxa96brhJAy69th3pI+W5PG9N1bhw==" }, "node_modules/boxen": { "version": "7.1.1", @@ -15760,9 +15760,9 @@ } }, "node_modules/viem": { - "version": "2.21.54", - "resolved": "https://registry.npmjs.org/viem/-/viem-2.21.54.tgz", - "integrity": "sha512-G9mmtbua3UtnVY9BqAtWdNp+3AO+oWhD0B9KaEsZb6gcrOWgmA4rz02yqEMg+qW9m6KgKGie7q3zcHqJIw6AqA==", + "version": "2.21.56", + "resolved": "https://registry.npmjs.org/viem/-/viem-2.21.56.tgz", + "integrity": "sha512-lHcVd1sFDlVWu482Sb4j22a5+hXJWE8HwqLgXDH49L7mfdA5QHfkQgeyl7K2kKg6pBbPbxIwd9so/u3LcynKTg==", "funding": [ { "type": "github", diff --git a/package.json b/package.json index 4d02357..402b622 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "package:fix": "ncu -u && npm install", "postinstall": "npm --silent run codegen", "codegen": "graphql-codegen --config ./src/queries/codegen/codegen.ts", + "update:addressbook": "ncu --upgrade blockchain-addressbook viem && i install", "lint-staged": "lint-staged" }, "dependencies": { @@ -38,7 +39,7 @@ "@sinclair/typebox": "^0.32.33", "@types/lodash-es": "^4.17.12", "async-lock": "^1.4.1", - "blockchain-addressbook": "^0.47.98", + "blockchain-addressbook": "^0.47.107", "decimal.js": "^10.4.3", "dotenv": "^16.4.5", "fastify": "^4.26.2", @@ -48,7 +49,7 @@ "lodash": "^4.17.21", "node-cache": "^5.1.2", "pino": "^8.19.0", - "viem": "^2.21.54" + "viem": "^2.21.56" }, "lint-staged": { "src/**/*.{ts,graphql,json}": "biome check --write" diff --git a/src/config/chains.ts b/src/config/chains.ts index 3865d9c..d9bc5ea 100644 --- a/src/config/chains.ts +++ b/src/config/chains.ts @@ -20,8 +20,9 @@ export enum ChainId { optimism = 'optimism', polygon = 'polygon', rootstock = 'rootstock', - sei = 'sei', scroll = 'scroll', + sei = 'sei', + sonic = 'sonic', zksync = 'zksync', } diff --git a/src/utils/viemClient.ts b/src/utils/viemClient.ts index 618bf9a..68dc906 100644 --- a/src/utils/viemClient.ts +++ b/src/utils/viemClient.ts @@ -7,7 +7,6 @@ import { fantom, fraxtal, gnosis, - //kava, linea, lisk, mainnet, @@ -21,6 +20,7 @@ import { rootstock, scroll, sei, + sonic, zksync, } from 'viem/chains'; import type { ChainId } from '../config/chains'; @@ -47,6 +47,7 @@ const mapping: Record = { rootstock: rootstock, scroll: scroll, sei: sei, + sonic: sonic, zksync: zksync, };