{"_id":"0xppl-solana-portfolio","name":"0xppl-solana-portfolio","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"0xppl-solana-portfolio","version":"1.0.0","license":"MIT","scripts":{"build":"nx build","nx:version":"run-s nx:version:core nx:version:plugins postversion","nx:version:plugins":"nx run plugins:version --releaseAs=patch","nx:version:core":"nx run core:version --releaseAs=patch","postversion":"git push && git push --tags"},"engines":{"node":">18"},"devDependencies":{"@jscutlery/semver":"3.4.1","@nx/devkit":"16.8.1","@nx/esbuild":"16.8.1","@nx/eslint-plugin":"16.8.1","@nx/jest":"16.8.1","@nx/js":"16.8.1","@nx/linter":"16.8.1","@nx/node":"16.8.1","@nx/plugin":"16.8.1","@types/bn.js":"^5.1.1","@types/jest":"^29.4.0","@types/node":"20.10.3","@typescript-eslint/eslint-plugin":"5.62.0","@typescript-eslint/parser":"5.62.0","esbuild":"0.19.9","eslint":"8.46.0","eslint-config-airbnb-base":"^15.0.0","eslint-config-airbnb-typescript":"^17.0.0","eslint-config-prettier":"8.1.0","jest":"^29.4.1","jest-environment-node":"^29.4.1","listhen":"^1.5.5","ngx-deploy-npm":"^6.0.0","npm-run-all":"^4.1.5","nx":"16.8.1","prettier":"^2.6.2","ts-jest":"^29.1.0","ts-node":"^10.9.1","tsconfig-paths":"^4.2.0","typedoc":"^0.25.4","typescript":"~5.3.2","verdaccio":"^5.0.4"},"workspaces":["packages/*"],"dependencies":{"@aave/contract-helpers":"^1.28.2","@aave/math-utils":"^1.28.2","@aptos-labs/ts-sdk":"^1.19.0","@bonfida/spl-name-service":"^1.0.10","@cosmjs/cosmwasm-stargate":"^0.31.1","@ethersproject/address":"^5.7.0","@ethersproject/bignumber":"^5.7.0","@ethersproject/bytes":"^5.7.0","@ethersproject/constants":"^5.7.0","@ethersproject/providers":"^5.7.2","@ethersproject/units":"^5.7.0","@metaplex-foundation/beet":"^0.7.1","@metaplex-foundation/beet-solana":"^0.4.0","@metaplex-foundation/umi-serializers-encodings":"^0.8.9","@mysten/bcs":"^0.11.1","@mysten/sui":"^1.12.0","@onsol/tldparser":"^0.6.1","@sei-js/core":"^3.0.1","@sei-js/proto":"^3.0.1","@solana/web3.js":"^1.91.8","@solanafm/explorer-kit":"^1.1.3","@solanafm/explorer-kit-idls":"^1.1.3","axios":"^1.7.7","bignumber.js":"^9.1.2","bitcoin-address-validation":"^2.2.1","bn.js":"^5.2.1","decimal.js":"^10.4.3","dsa-connect":"^0.6.47","ethers":"^5.7.2","graphql":"^16.8.1","graphql-request":"^6.1.0","ioredis":"^5.4.1","js-sha256":"^0.11.0","long":"^5.2.3","osmojs":"^16.5.1","reflect-metadata":"^0.1.13","tslib":"^2.3.0","unstorage":"^1.10.2","viem":"^1.16.5","web3-v1":"npm:web3@^1.5.0","web3-v4":"npm:web3@^4.0.3"},"nx":{"includedScripts":[]},"packageManager":"yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e","description":"[![Core NPM Version](https://img.shields.io/npm/v/@sonarwatch/portfolio-core?color=33cd56&label=npm%20core)](https://www.npmjs.com/package/@sonarwatch/portfolio-core) [![Plugins NPM Version](https://img.shields.io/npm/v/@sonarwatch/portfolio-plugins?color","main":"jest.preset.js","author":{"name":"0xPPL"},"repository":{"type":"git","url":"git+https://github.com/0xPeople/solana-portfolio.git"},"bugs":{"url":"https://github.com/0xPeople/solana-portfolio/issues"},"homepage":"https://github.com/0xPeople/solana-portfolio#readme","_id":"0xppl-solana-portfolio@1.0.0","gitHead":"e3bacfddbe717834d90f9707af6cfc4bcf98784b","_nodeVersion":"22.11.0","_npmVersion":"10.9.0","dist":{"integrity":"sha512-dV5U4EL5+QtIikKBSpiTdHNJqyhgEKruxZvtmsqfrrH0By35RQJS2XL4cE/6PAze8RDcpxizhhbYHIpJeqaLWQ==","shasum":"950b9817662ad38ea43b8061de923e5860cfc094","tarball":"https://registry.npmjs.org/0xppl-solana-portfolio/-/0xppl-solana-portfolio-1.0.0.tgz","fileCount":1383,"unpackedSize":3483073,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDH9h/P5XWzTMij7vocQ/s3XjaA4RjA9AUGjUigRxdlIAiEAytszwrm97zBbiIhmue+Bn4GNP+50BG6eO81uRub7c4w="}]},"_npmUser":{"name":"anshugarg","email":"anshu@0xppl.com"},"directories":{},"maintainers":[{"name":"anshugarg","email":"anshu@0xppl.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/0xppl-solana-portfolio_1.0.0_1730985364583_0.45576909541564103"},"_hasShrinkwrap":false}},"time":{"created":"2024-11-07T13:16:04.495Z","1.0.0":"2024-11-07T13:16:04.870Z","modified":"2024-11-07T13:16:05.115Z"},"maintainers":[{"name":"anshugarg","email":"anshu@0xppl.com"}],"description":"[![Core NPM Version](https://img.shields.io/npm/v/@sonarwatch/portfolio-core?color=33cd56&label=npm%20core)](https://www.npmjs.com/package/@sonarwatch/portfolio-core) [![Plugins NPM Version](https://img.shields.io/npm/v/@sonarwatch/portfolio-plugins?color","homepage":"https://github.com/0xPeople/solana-portfolio#readme","repository":{"type":"git","url":"git+https://github.com/0xPeople/solana-portfolio.git"},"author":{"name":"0xPPL"},"bugs":{"url":"https://github.com/0xPeople/solana-portfolio/issues"},"license":"MIT","readme":"# SonarWatch Portfolio\n\n[![Core NPM Version](https://img.shields.io/npm/v/@sonarwatch/portfolio-core?color=33cd56&label=npm%20core)](https://www.npmjs.com/package/@sonarwatch/portfolio-core)\n[![Plugins NPM Version](https://img.shields.io/npm/v/@sonarwatch/portfolio-plugins?color=33cd56&label=npm%20plugins)](https://www.npmjs.com/package/@sonarwatch/portfolio-plugins)\n\nUseful links:\n\n- [Github repository](https://github.com/sonarwatch/portfolio)\n- [API Rest](https://portfolio-api.sonar.watch/api)\n- [Documentation](https://sonarwatch.github.io/portfolio/)\n- [Integration Documentation](https://docs.sonar.watch/open-source/list-your-project)\n\nThis repository powers SonarWatch website by fetching all DeFi assets for a wallet on multiple chains, it covers:\n\n- Tokens value\n- NFTs (listed included)\n- LP Tokens value\n- Lending and borrowing amount\n- Spot accounts\n- Native stake accounts\n- many other to come!\n\n# How does it works?\n\nAnyone can contribute to this repository to help us cover more protocols and create a better coverage for the user.\n\nThis repository is divided in <b>plugins</b>, each plugin can have :\n\n- <b>Job(s)</b> : they retrieve common data for all users and store it in the <b>Cache</b>\n- <b>Fetcher(s)</b> : they retrieve information for a single user and send back a list of assets\n\n## What is a Job ?\n\nA <b>Job</b> will store data into our <b>Cache</b>, those data are usually common data for all users (information about the amounts of a tokens on a lending protocol, liquidity pools prices, etc..)\n\nTo add data to the Cache, you will mainly use the following methods on the `cache` object :\n\n- Add a price for a specific Token address (token, lp, etc...) : `cache.setTokenPriceSource()`\n- Add any item : `cache.setItem()`\n\n<u><b>Warning</b></u> If your Job is adding prices for tokens, make sure to verify those prices by :\n\n1. Running your local cache.\n2. Running your Job, this will add prices into your local cache.\n3. Running the Fetcher `wallet-tokens-<networkId>`, this will fetch all tokens within the wallet and get the prices from the Cache (local + distant). (see below for commands)\n\nYou can create as many <b>Jobs</b> as needed by plugins.\n\n## What is a Fetcher ?\n\nA <b>Fetcher</b> is were the logic stand, it usually (not necessarily) recover some data from the <b>Cache</b>, then use it to compute the value of the assets deposited by a user on a protocol.\n\nSome examples of <b>Fetchers</b> :\n\n- Get all Concentrated Liquidity Positions of a user from an AMM\n- Get all deposits and loans of a user on a Lending protocol\n- Get all listed NFTs for a user on a marketplace\n- etc...\n\nYou can create as many <b>Fetchers</b> as needed by plugins, each <b>Fetcher</b> being entitled to a Networkd (Solana, Sui, Aptos etc..).\n\nYou always need to provide a <b>user address</b> to run a fetcher.\n\n# How to start ?\n\n## Setup your environment\n\n1. <b>Clone</b> this repository.\n2. Run\n\n```bash\nnpm install\n```\n\n3. Setup your own `.env` file by running :\n\n```bash\ncp .env.example .env\n```\n\n4. If you need a new plugin, run :\n\n```bash\nnpx nx generate @sonarwatch/portfolio-plugins:plugin my-super-protocol\n```\n\n5. Depending on what you're trying to achieve, either create a `Job` or a `Fetcher` (see commands below)\n\n## Import your fetchers and jobs\n\nOnce you're down writing the logic on your `Job` or `Fetcher` :\n\n1. Add your `Job`(s) and `Fetcher`(s) to your `index.ts` file in your `plugin` folder\n2. Add your `Fetchers` and `Jobs` to the `packages\\plugins\\src\\index.ts` file\n\n## Test your job/fetcher\n\nBefore anything, you need to run the <b>Cache</b> on your local network, simply run :\n\n```bash\nnpx nx run plugins:serve-cache\n```\n\nIf you are adding a liquidity protocol\nYou're now ready to try your `Fetcher` or `Job` by running the following commands :\n\n- Job :\n\n```bash\nnpx nx run plugins:run-job jobId\n```\n\nExample :\n\n```bash\n# Run the job mango-banks\nnpx nx run plugins:run-job mango-banks\n```\n\n- Fetcher (remember to provide an address):\n\n```bash\nnpx nx run plugins:run-fetcher fetcherId userAddress\n```\n\nExample :\n\n```bash\n# Run the fetcher mango-collateral on the address Demo...tKG\nnpx nx run plugins:run-fetcher mango-collateral DemoSX9F2zXfQLtBr56Yr5he15P7viZWsYJpSDAX3tKG\n```\n\n# Missing a token price ?\n\nIf you need the price of a token but don't find it in the Cache, please submit a PR to our [token list repository](https://github.com/sonarwatch/token-lists)\n\n# Useful commands\n\nHere is a list of useful command that can help you during your integration.\n\n```bash\n# Getting started\nnpm install\ncp .env.example .env\n# Set your RPCs\n\n# Generate a plugin\nnpx nx generate @sonarwatch/portfolio-plugins:plugin my-super-protocol\n\n# Generator a job\nnpx nx generate @sonarwatch/portfolio-plugins:job --jobName=myJob --pluginId=my-super-protocol\n\n# Generator a fetcher\nnpx nx generate @sonarwatch/portfolio-plugins:fetcher --fetcherName=myFetcher --pluginId=my-super-protocol\n\n# Serve cache in background\nnpx nx run plugins:serve-cache\n\n# Run a job\nnpx nx run plugins:run-job mango-banks\nnpx nx run plugins:run-job wallet-tokens-aptos\n\n# Run a fetcher\nnpx nx run plugins:run-fetcher mango-collateral DemoSX9F2zXfQLtBr56Yr5he15P7viZWsYJpSDAX3tKG\nnpx nx run plugins:run-fetcher marinade-tickets DemoSX9F2zXfQLtBr56Yr5he15P7viZWsYJpSDAX3tKG\nnpx nx run plugins:run-fetcher wallet-tokens-aptos \\\"0xaa3fca2b46efb0c9b63e9c92ee31a28b9f22ca52a36967151416706f2ca138c6\\\"\nnpx nx run plugins:run-fetcher wallet-tokens-aptos aa3fca2b46efb0c9b63e9c92ee31a28b9f22ca52a36967151416706f2ca138c6\nnpx nx run plugins:run-fetcher wallet-tokens-ethereum-top \\\"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045\\\"\nnpx nx run plugins:run-fetcher wallet-tokens-ethereum-top d8dA6BF26964aF9D7eEd9e03E53415D37aA96045\n\n# Run a airdrop fetcher\nnpx nx run plugins:run-airdrop-fetcher drift-airdrop-1 DemoSX9F2zXfQLtBr56Yr5he15P7viZWsYJpSDAX3tKG\n```\n\n## Build\n\n```bash\nnpx nx run core:build\nnpx nx run plugins:build\n```\n\n## Deploy\n\n```bash\nnpx nx run core:version --releaseAs=patch\nnpx nx run plugins:version --releaseAs=patch\n\nnpx nx run core:version --releaseAs=minor\nnpx nx run plugins:version --releaseAs=minor\n\nnpm run nx:version\n```\n","readmeFilename":"README.md"}