{"id":21759675,"url":"https://github.com/getsafle/asset-controller","last_synced_at":"2025-06-26T03:34:55.181Z","repository":{"id":42577948,"uuid":"360085216","full_name":"getsafle/asset-controller","owner":"getsafle","description":"This controller detects tokens for a user and returns token balances.","archived":false,"fork":false,"pushed_at":"2023-05-25T09:29:58.000Z","size":386,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-05-25T13:16:09.373Z","etag":null,"topics":["controller"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/getsafle.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"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}},"created_at":"2021-04-21T08:13:32.000Z","updated_at":"2022-12-18T16:23:24.000Z","dependencies_parsed_at":"2024-11-26T11:35:12.824Z","dependency_job_id":"9fc8a745-f5fa-4996-a647-59f970d38e31","html_url":"https://github.com/getsafle/asset-controller","commit_stats":{"total_commits":18,"total_committers":4,"mean_commits":4.5,"dds":0.5,"last_synced_commit":"9ea2e33c0cad08d7648e73795d7203e013331cf1"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/getsafle/asset-controller","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getsafle%2Fasset-controller","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getsafle%2Fasset-controller/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getsafle%2Fasset-controller/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getsafle%2Fasset-controller/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/getsafle","download_url":"https://codeload.github.com/getsafle/asset-controller/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getsafle%2Fasset-controller/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261995393,"owners_count":23242202,"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":["controller"],"created_at":"2024-11-26T11:34:37.450Z","updated_at":"2025-06-26T03:34:55.118Z","avatar_url":"https://github.com/getsafle.png","language":"JavaScript","readme":"# Safle Asset Controller\n\nThis SDK is used to detect the tokens and their balances in a given user's public address.\n\n## Installation\n\nTo install this SDK,\n\n```sh\nnpm install --save @getsafle/asset-controller\n```\n\n## Initialization\n\nInitialize the constructor,\n\n```js\nconst safleAssetController = require('@getsafle/asset-controller');\n\nconst assetController = new safleAssetController.AssetController({ rpcURL, chain });\n```\n\n\u003cbr\u003e\n\n\u003e Detect Tokens\n\n\u003cbr\u003e\n\nThis function will detect and return the list of all the tokens in the user's public address.\n\n```js\nconst tokenBalance = await assetController.detectTokens({ userAddress, tokenType });\n```\n\n* `userAddress` - User Public Address\n* `tokenType` - optional parameter - valid values- erc20/erc721\n\n\u003cbr\u003e\n\n\u003e Get list of chains on which a token exists\n\n\u003cbr\u003e\n\nThis function will return the list of all the chains which a particular token is supported\n\n```js\nconst chains = await assetController.getChains(tokenSymbol);\n```\n\n* `tokenSymbol` - Token Symbol\n\n\u003cbr\u003e\n\n\u003e Get token balances\n\n\u003cbr\u003e\n\nThis function will return the balances of all the tokens contract addresses passed in the array\n\n```js\nconst chains = await assetController.getTokenBalances(tokensToDetect, SINGLE_CALL_BALANCES_ADDRESS, userAddress);\n```\n\n* `tokensToDetect` - array of all the token addresses\n* `SINGLE_CALL_BALANCES_ADDRESS` - Contract address of the single call balance checker contract\n* `userAddress` - Public address of the user to query the balance of\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetsafle%2Fasset-controller","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgetsafle%2Fasset-controller","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetsafle%2Fasset-controller/lists"}