{"id":19854118,"url":"https://github.com/depayfi/web3-tokens","last_synced_at":"2026-03-10T11:33:36.053Z","repository":{"id":45935982,"uuid":"380228380","full_name":"DePayFi/web3-tokens","owner":"DePayFi","description":"🪙 JavaScript library providing basic functionalities to interact with web3 tokens.","archived":false,"fork":false,"pushed_at":"2025-04-17T14:51:50.000Z","size":1814,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-23T06:02:07.290Z","etag":null,"topics":["blockchains","cryptocurrencies","token","web3"],"latest_commit_sha":null,"homepage":"https://depay.com","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/DePayFi.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":{"custom":"https://tip.depay.com/6KFBECVsokSt0UKOAug8CI"}},"created_at":"2021-06-25T12:17:18.000Z","updated_at":"2025-04-17T14:51:44.000Z","dependencies_parsed_at":"2024-10-11T23:01:02.728Z","dependency_job_id":"c062b929-f534-4629-89e4-d2ea01b401cb","html_url":"https://github.com/DePayFi/web3-tokens","commit_stats":{"total_commits":109,"total_committers":4,"mean_commits":27.25,"dds":0.09174311926605505,"last_synced_commit":"1bf8603f5236ce333e60d500de2e65960eda2dd3"},"previous_names":["depayfi/depay-web3-token","depayfi/depay-blockchain-token"],"tags_count":85,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DePayFi%2Fweb3-tokens","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DePayFi%2Fweb3-tokens/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DePayFi%2Fweb3-tokens/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DePayFi%2Fweb3-tokens/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DePayFi","download_url":"https://codeload.github.com/DePayFi/web3-tokens/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251969238,"owners_count":21673180,"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":["blockchains","cryptocurrencies","token","web3"],"created_at":"2024-11-12T14:08:34.890Z","updated_at":"2026-03-10T11:33:30.999Z","avatar_url":"https://github.com/DePayFi.png","language":"JavaScript","funding_links":["https://tip.depay.com/6KFBECVsokSt0UKOAug8CI"],"categories":[],"sub_categories":[],"readme":"## Quickstart\n\n```\nyarn add @depay/web3-tokens\n```\n\nor \n\n```\nnpm install --save @depay/web3-tokens\n```\n\n```javascript\nimport Token from '@depay/web3-tokens'\n\nlet token = new Token({\n  blockchain: 'ethereum',\n  address: '0xa0bed124a09ac2bd941b10349d8d224fe3c955eb'\n});\n\ntoken.address // '0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb'\nawait token.decimals() // 18\nawait token.symbol() // 'DEPAY'\nawait token.name() // 'DePay'\n```\n\n## Support\n\nThis library supports the following blockchains:\n\n- [Ethereum](https://ethereum.org)\n- [BNB Smart Chain](https://www.binance.org/smartChain)\n- [Polygon](https://polygon.technology)\n- [Solana](https://solana.com)\n- [Fantom](https://fantom.foundation)\n- [Arbitrum](https://arbitrum.io)\n- [Avalanche](https://www.avax.network)\n- [Gnosis](https://gnosis.io)\n- [Optimism](https://www.optimism.io)\n- [Base](https://base.org)\n- [Worldchain](https://worldcoin.org/world-chain)\n\n## Platform specific packaging\n\nIn case you want to use and package only specific platforms, use platform-specific packages:\n\n### EVM (Ethereum Virtual Machine) specific packaging\n\n```javascript\nimport Token from '@depay/web3-tokens-evm'\n```\n\n### SVM (Solana Virtual Machine) specific packaging\n\n```javascript\nimport Token from '@depay/web3-tokens-solana'\n```\n\n## Functionalities\n\n### initalize (new)\n\n```javascript\nimport Token from '@depay/web3-tokens'\n\nlet token = new Token({\n  blockchain: 'ethereum',\n  address: '0xa0bed124a09ac2bd941b10349d8d224fe3c955eb'\n});\n```\n\n### decimals\n\nRetrieves token decimals\n\n```javascript\nawait token.decimals() // 18\n```\n\n### symbol\n\nRetrieves token symbol\n\n```javascript\nawait token.symbol() // DEPAY\n```\n\n### name\n\nRetrieves token name\n\n```javascript\nawait token.name() // DePay\n```\n\n### name for NFT by id\n\nRetrieves token name for token address by NFT id:\n\n```javascript\nawait token.name({ id: '42745998150656004690816543961586238000273307462307754421658803578179357246440' }) // NFT Butler Lifetime License\n```\n\n### balance\n\nProvides the balance (BigNumber) of the given account:\n\n```javascript\nawait token.balance('0xb0252f13850a4823706607524de0b146820F2240') // BigNumber {_hex: \"0x0b896d5e9eeaabf4f1\", _isBigNumber: true}\n```\n\nthis also works for the native token of the given blockchain:\n\n```javascript\nlet token = new Token({ ..., address: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE' })\nawait token.balance('0xb0252f13850a4823706607524de0b146820F2240') // BigNumber {_hex: \"0x0b896d5e9eeaabf4f1\", _isBigNumber: true}\n```\n\n#### balance for NFTs (by id)\n\nIf you pass a second parameter, it will be used to get the balance for the given account for the given token id:\n\n```javascript\nawait token.balance('0xb0252f13850a4823706607524de0b146820F2240', '42745998150656004690816543961586238000273307462307754421658803578179357246440')\n```\n\n### BigNumber\n\nProvides the BigNumber amount for a given token (based on the tokens decimals) based on a human readable amount:\n\n```javascript\nlet token = new Token({\n  blockchain: 'ethereum',\n  address: '0xa0bed124a09ac2bd941b10349d8d224fe3c955eb'\n}) \n\nawait token.BigNumber(1) // BigNumber '1000000000000000000'\n```\n\n```javascript\nawait Token.BigNumber({\n  amount: 1,\n  blockchain: 'ethereum',\n  address: '0xa0bed124a09ac2bd941b10349d8d224fe3c955eb'\n}) // BigNumber '1000000000000000000'\n```\n\n### readable\n\nProvides a human readable amount based on a given BigInt number.\n\n- Ending zeros will be eliminated `1.30000` -\u003e `1.3`\n\n- Decimals are dropped if there are none `1.00000` -\u003e `1`\n\n```javascript\nawait Token.readable({\n  amount: '1231211111210000000',\n  blockchain: 'ethereum',\n  address: '0xa0bed124a09ac2bd941b10349d8d224fe3c955eb'\n}) // \"1.23121111121\"\n```\n\n```javascript\nlet token = new Token({\n  blockchain: 'ethereum',\n  address: '0xa0bed124a09ac2bd941b10349d8d224fe3c955eb'\n})\n\nawait token.readable('1231211111210000000') // \"1.23121111121\"\n```\n\n### Token Standards\n\n#### EVM: Token Standards\n\n```javascript\nimport Token from '@depay/web3-tokens'\n\nToken.ethereum['20'] // [...] \u003cXYZ\u003e20 standard\nToken.bsc['20'] // [...] \u003cXYZ\u003e20 standard\n\nToken.ethereum.ERC20 // [...] ERC20 ABI\nToken.bsc.BEP20 // [...] BEP20 ABI\n\nToken.ethereum.WRAPPED // [...] WETH ABI\nToken.bsc.WRAPPED // [...] WETH ABI\n\n```\n\n`DEFAULT` references the broad default token standard on the respective blockchain:\n\n```javascript\nimport Token from '@depay/web3-tokens'\n\nToken.ethereum.DEFAULT // ERC20\nToken.bsc.DEFAULT // BEP20\n\nToken[blockchain].DEFAULT\n```\n\n#### Solana: Token Standards, Constants, Layouts and helper methods\n\n```javascript\nimport Token from '@depay/web3-tokens'\n\nToken.solana\n// MINT_LAYOUT,\n// METADATA_LAYOUT,\n// TRANSFER_LAYOUT,\n// METADATA_ACCOUNT,\n// TOKEN_PROGRAM,\n// ASSOCIATED_TOKEN_PROGRAM,\n// findProgramAddress({ token, owner })\n// findAccount({ token, owner })\n// async createTransferInstruction({ token, amount, from, to })\n// async createAssociatedTokenAccountInstruction({ token, owner, payer })\n// initializeAccountInstruction({ account, token, owner })\n// closeAccountInstruction({ account, owner })\n// getMetaData\n// getMetaDataPDA\n```\n\n## Development\n\n### Get started\n\n```\nyarn install\nyarn dev\n```\n\n### Release\n\n```\nnpm publish\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdepayfi%2Fweb3-tokens","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdepayfi%2Fweb3-tokens","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdepayfi%2Fweb3-tokens/lists"}