{"id":15789859,"url":"https://github.com/zilpay/zilpay-web3","last_synced_at":"2026-01-05T06:20:49.471Z","repository":{"id":241858579,"uuid":"807980539","full_name":"zilpay/zilpay-web3","owner":"zilpay","description":null,"archived":false,"fork":false,"pushed_at":"2024-05-31T08:23:04.000Z","size":72,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2024-10-19T08:17:59.543Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zilpay.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2024-05-30T06:37:56.000Z","updated_at":"2024-05-31T08:23:08.000Z","dependencies_parsed_at":"2024-05-30T11:20:56.681Z","dependency_job_id":"108000d5-4bd4-4c4c-ae08-bd9e3b139ba9","html_url":"https://github.com/zilpay/zilpay-web3","commit_stats":{"total_commits":14,"total_committers":1,"mean_commits":14.0,"dds":0.0,"last_synced_commit":"ce4ed6a9895a217d8f1dbae4bc6cd9289703dd3a"},"previous_names":["zilpay/zilpay-web3"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zilpay%2Fzilpay-web3","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zilpay%2Fzilpay-web3/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zilpay%2Fzilpay-web3/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zilpay%2Fzilpay-web3/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zilpay","download_url":"https://codeload.github.com/zilpay/zilpay-web3/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245168891,"owners_count":20571803,"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":[],"created_at":"2024-10-04T22:03:59.890Z","updated_at":"2026-01-05T06:20:49.432Z","avatar_url":"https://github.com/zilpay.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ZilPay Web3.js\n\nZilPay Web3.js is a JavaScript library that provides a convenient way to interact with the Zilliqa blockchain and the ZilPay wallet extension. It allows developers to easily integrate Zilliqa functionality into their web applications.\n\n## Installation\n\nTo use ZilPay Web3.js in your project, you can include it via a script tag or install it using npm.\n\n### npm\n\nInstall the package using npm:\n\n```bash\nnpm install @zilpay/zilpay-web3\nyarn add @zilpay/zilpay-web3\nbun add @zilpay/zilpay-web3\n```\n\nThen, you can import the library in your JavaScript file:\n\n```javascript\nimport { initZilPayWeb3, zilPay } from 'zilpay-web3';\n```\n\n## Initialization\n\nThis will inject into global onject the `windows.zilPay`.\nTo initialize ZilPay Web3.js, call the `initZilPayWeb3()` function:\n\n```javascript\ninitZilPayWeb3();\n```\n\nThis function checks if the ZilPay wallet extension is available and initializes the `zilPay` object on the global `window` object.\n\n## Usage\n\nAfter initializing ZilPay Web3.js, you can access the `zilPay` object to interact with the Zilliqa blockchain and the ZilPay wallet.\n\n### Wallet\n\nThe `zilPay.wallet` object provides methods to interact with the user's ZilPay wallet.\n\n#### Connecting to the Wallet\n\nTo connect to the user's ZilPay wallet, use the `connect()` method:\n\n```javascript\nconst isConnected = await zilPay.wallet.connect();\n```\n\nThis method prompts the user to grant permission to your application to access their wallet.\n\n#### Disconnecting from the Wallet\n\nTo disconnect from the user's ZilPay wallet, use the `disconnect()` method:\n\n```javascript\nawait zilPay.wallet.disconnect();\n```\n\nThis method revokes the permission granted to your application to access the user's wallet.\n\n#### Signing Transactions\n\nTo sign a transaction using the user's ZilPay wallet, use the `sign()` method:\n\n```javascript\nconst signedTransaction = await zilPay.wallet.sign(transaction);\n```\n\nThis method prompts the user to sign the provided transaction using their ZilPay wallet.\n\n### Blockchain\n\nThe `zilPay.blockchain` object provides methods to interact with the Zilliqa blockchain.\n\n#### Getting Blockchain Information\n\nTo retrieve information about the Zilliqa blockchain, use the `getBlockChainInfo()` method:\n\n```javascript\nconst blockchainInfo = await zilPay.blockchain.getBlockChainInfo();\n```\n\nThis method returns information such as the current block number, network ID, and more.\n\n#### Getting Account Balance\n\nTo retrieve the balance of a specific account, use the `getBalance()` method:\n\n```javascript\nconst balance = await zilPay.blockchain.getBalance(address);\n```\n\nThis method returns the balance of the specified account address.\n\n### Contracts\n\nThe `zilPay.contracts` object provides methods to interact with smart contracts on the Zilliqa blockchain.\n\n#### Deploying a Contract\n\nTo deploy a new contract, use the `deploy()` method:\n\n```javascript\nconst [transaction, contract] = await zilPay.contracts.new(code, init).deploy(params, priority);\n```\n\nThis method deploys a new contract with the provided code and initialization parameters.\n\n#### Calling a Contract Function\n\nTo call a function on a deployed contract, use the `call()` method:\n\n```javascript\nconst transaction = await contract.call(functionName, args, params, priority);\n```\n\nThis method calls the specified function on the contract with the provided arguments and parameters.\n\n## Examples\n\nHere are a few examples of how to use ZilPay Web3.js:\n\n### Connecting to the Wallet\n\n```javascript\nasync function connectToWallet() {\n  const isConnected = await zilPay.wallet.connect();\n  if (isConnected) {\n    console.log('Connected to ZilPay wallet');\n  } else {\n    console.log('Failed to connect to ZilPay wallet');\n  }\n}\n```\n\n### Getting Account Balance\n\n```javascript\nasync function getAccountBalance(address) {\n  const balance = await zilPay.blockchain.getBalance(address);\n  console.log(`Account balance: ${balance}`);\n}\n```\n\n### Deploying a Contract\n\n```javascript\nasync function deployContract(code, init, params) {\n  const [transaction, contract] = await zilPay.contracts.new(code, init).deploy(params);\n  console.log(`Contract deployed: ${contract.address}`);\n}\n```\n\n## Contributing\n\nContributions to ZilPay Web3.js are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the [GitHub repository](https://github.com/your/repository).\n\n## License\n\nZilPay Web3.js is released under the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzilpay%2Fzilpay-web3","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzilpay%2Fzilpay-web3","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzilpay%2Fzilpay-web3/lists"}