{"id":23517072,"url":"https://github.com/izayl/zapperfi-api","last_synced_at":"2025-04-19T16:29:15.581Z","repository":{"id":48161540,"uuid":"516351048","full_name":"izayl/zapperfi-api","owner":"izayl","description":"A complete and heavily tested wrapper with typings for the zapper.fi API.","archived":false,"fork":false,"pushed_at":"2024-12-03T05:26:50.000Z","size":118,"stargazers_count":7,"open_issues_count":11,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2024-12-03T06:25:26.484Z","etag":null,"topics":["api","api-wrapper","typescript","zapper"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/izayl.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"izayl","patreon":"izayl"}},"created_at":"2022-07-21T11:53:51.000Z","updated_at":"2023-03-24T04:27:50.000Z","dependencies_parsed_at":"2022-09-10T13:51:07.086Z","dependency_job_id":"659bc2e0-a0ca-4055-9165-e5c217dd6fa8","html_url":"https://github.com/izayl/zapperfi-api","commit_stats":{"total_commits":27,"total_committers":2,"mean_commits":13.5,"dds":0.2962962962962963,"last_synced_commit":"333931ecc7a86ede5883a85e108e0c6fadc2b445"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":"izayl/template-typescript-npm-package","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izayl%2Fzapperfi-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izayl%2Fzapperfi-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izayl%2Fzapperfi-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/izayl%2Fzapperfi-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/izayl","download_url":"https://codeload.github.com/izayl/zapperfi-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231248733,"owners_count":18347530,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","api-wrapper","typescript","zapper"],"created_at":"2024-12-25T15:16:25.495Z","updated_at":"2024-12-25T15:16:26.161Z","avatar_url":"https://github.com/izayl.png","language":"TypeScript","readme":"\u003cp align='center'\u003e\n  \u003cimg width=\"400\" src=\"https://user-images.githubusercontent.com/10740043/180376574-dc43ca33-8678-441e-a2c4-df305616e95a.png\"\u003e\n  \u003ch3 align=\"center\"\u003eZapperfi API\u003c/h3\u003e\n  \u003cp align=\"center\"\u003eUnofficial wrapper for the Zapperfi API\u003c/p\u003e\n  \u003cp align=\"center\"\u003e\u003csub\u003eDon't forget to leave a ⭐ if you found this useful.\u003c/sub\u003e\u003c/p\u003e\n\u003c/p\u003e\n\n![Test](https://github.com/izayl/zapperfi-api/workflows/TEST/badge.svg)\n![npm](https://img.shields.io/npm/v/zapperfi-api)\n![npm](https://img.shields.io/npm/dm/zapperfi-api)\n![Lines](https://img.shields.io/badge/Coverage-96.88%25-brightgreen.svg)\n\n## Install\n\n```\n# use npm\n$ npm i zapperfi-api\n\n# use yarn\n$ yarn add zapperfi-api\n\n# use pnpm\n$ pnpm add zapperfi-api\n```\n\n## API\n\nbefore using the zapperfi-api, [you need to request a zapperfi api_key first](https://zapperfi.zendesk.com/hc/en-us/requests/new?ticket_form_id=7469559919121)\n\nthe [zapperfi v2 api](https://api.zapper.fi/api/static/index.html) have been wrapped.\n\n- [x] [apps](#apps)\n- [x] [balances](#balances)\n- [x] [exchange](#exchange)\n- [x] [misc](#misc)\n- [x] [transactions](#transactions)\n- [x] [zapIn](#zapin)\n- [x] [zapOut](#zapout)\n- [x] [nft](#nft)\n\n## Usage\n\n### Creating a client\n\nTo create a client, simply provide an object with your `apiKey`\n\nNOTE: If you're using `zapperfi-api` in a browser, you'll need to proxy your requests through your server with credentials, to keep the `apiKey` confidential. I will provide a convenient way to do this soon.\n\n```ts\nimport { V2Client } from 'zapperfi-api'\n\nconst client = new V2Client({\n  apiKey: '\u003cyour-api-key\u003e',\n})\n```\n\n### Make a request\n\nAll methods have 2 arguments: the first one includes all of the parameters for particular method. And the second one is a callback function, it's optional, if you don't provide it, the request will return a promise instead. All the parameters and responses types are already defined, so you can use them directly with safe type.\n\n```ts\n// callback style\nclient.misc.getGasPrices(parameters, callback)\n\n// async/await style\nconst response = await client.misc.getGasPrices(parameters)\n```\n\n## Examples\n\n### get wallet tokens breakdown\n\n```ts\nimport { V2Client, V2Models } from 'zapperfi-api'\n\nconst client = new V2Client({\n  apiKey: process.env.ZAPPER_API_KEY,\n})\n\nconst parameters = {\n  networks: [V2Models.Network.ETHEREUM_MAINNET],\n  addresses: ['0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D'],\n}\n\nawait client.balances.getAppBalance({ addresses, network, appId: 'tokens' })\n```\n\n### get addresses balances\n\n```ts\nimport { V2Client, V2Models } from 'zapperfi-api'\n\nconst client = new V2Client({\n  apiKey: process.env.ZAPPER_API_KEY\n})\n\nconst parameters = {\n  networks: [V2Models.Network.ETHEREUM_MAINNET],\n  addresses: ['0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D'],\n}\n\n// use callback style\nconst callback = (err, data) =\u003e {\n  if (err) throw err\n\n  const { type, payload } = data\n\n  if (type === 'partial') {\n    // process payload with every incoming message payload\n    // faster than full payload, but payload is not full\n    ...\n  }\n\n  if (type === 'full') {\n    // or, just process the final payload\n    // slower than partial payload, but payload is full\n    ...\n  }\n}\nclient.balances.get(parameters, callback)\n\n\n// or, use async/await style\n// but it only return the final full payload\nconst balances = await client.balances.get(parameters)\n```\n\n## Client Methods\n\n- [apps](#apps)\n- [balances](#balances)\n- [exchange](#exchange)\n- [misc](#misc)\n- [transactions](#transactions)\n- [zapIn](#zapin)\n- [zapOut](#zapout)\n- [nft](#nft)\n\n### apps\n\n---\n\nGet supported applications.\n\n#### apps.getPositions(parameters, callback?)\n\nRetrieve positions (non-tokenized) for a given application\n\n#### apps.getTokens(parameters, callback?)\n\nRetrieve tokens for a given application\n\n#### apps.supported(callback?)\n\nRetrieve all supported applications info\n\n#### apps.get(parameters, callback?)\n\nRetrieve application info by appId\n\n### balances\n\n---\n\n#### balances.get(parameters, callback?)\n\nGets the balances for given addresses.\n\n#### balances.getAppBalance(parameters, callback?)\n\nget wallets balance by appId\n\n#### balances.supported(parameters, callback?)\n\nget all the apps info have participated for given addresses\n\n### exchange\n\n---\n\nReturns an easy to submit transaction for exchanging assets.\n\n#### exchange.getPrice(parameters, callback?)\n\nReturns data about the amount received if a trade would be made. Should be called whenever a price needs to be calculated.\n\n#### exchange.getQuote(parameters, callback?)\n\nReturns both the relative price for a trade as well as the call data used to submit a transaction for a trade.Should only be called when a trade is ready to be submitted.\n\n#### exchange.supported(callback?)\n\nReturns the exchanges supported by Zapper API.\n\n### misc\n\n---\n\nMiscellaneous Data Endpoints\n\n#### misc.prices(parameters, callback?)\n\nRetrieve supported tokens and their prices\n\n#### misc.getTokenPrices(parameters, callback?)\n\nRetrieve given token and its prices\n\n#### misc.getGasPrices(parameters, callback?)\n\nRetrieve a gas price aggregated from multiple different sources\n\n### transactions\n\n---\n\nHistorical Transactions. Data on past transactions for a specific address.\n\n#### transactions.get(parameters, callback?)\n\nData on past transactions for addresses\n\n### zapIn\n\n---\n\nEndpoints for creating transactions for adding liquidity to different applications.\n\n#### zapIn.supported(parameters, callback?)\n\nProvides a list of networks to app IDs that are supported by the Zap In routes.\n\n#### zapIn.getApprovalState(parameters, callback?)\n\nRetrieves an ERC20 approval status for an application zap-in\n\n#### zapIn.getApprovalTransaction(parameters, callback?)\n\nBuilds an ERC20 approval transaction for an application zap-in\n\n### zapOut\n\n---\n\nEndpoints for creating transactions for removing liquidity from an application.\n\n#### zapOut.supported(parameters, callback?)\n\nProvides a list of networks to app IDs that are supported by the Zap Out routes.\n\n#### zapOut.getApprovalState(parameters, callback?)\n\nRetrieves an ERC20 approval status for an application zap-out.\n\n#### zapOut.getApprovalTransaction(parameters, callback?)\n\nBuilds an ERC20 approval transaction for an application zap-out.\n\n### nft\n\n---\n\nGet Ethereum NFT balances for addresses.\n\n#### nft.getNetWorth(parameters, callback?)\n\n#### nft.getCollections(parameters, callback?)\n\n#### nft.getCollectionsTotals(parameters, callback?)\n\n\n\n## Donations\n\nFeel free to use the GitHub Sponsor button to donate towards my work if you think this project is helpful. 🤗\n","funding_links":["https://github.com/sponsors/izayl","https://patreon.com/izayl"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fizayl%2Fzapperfi-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fizayl%2Fzapperfi-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fizayl%2Fzapperfi-api/lists"}