{"_id":"@blockcoders/harmony-providers","name":"@blockcoders/harmony-providers","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@blockcoders/harmony-providers","version":"1.0.0","description":"This library provides a collection of methods to interact with the Harmony blockchain.","main":"index.js","scripts":{"build":"tsc --build ./tsconfig.json","test":"NODE_ENV=test mocha -t 60000 --require ts-node/register ./src/**/*.spec.ts","lint:ci":"eslint \"{src,apps,libs,test}/**/*.ts\"","lint":"eslint \"{src,apps,libs,test}/**/*.ts\" --fix"},"author":{"name":"fer@blockcoders.io"},"license":"ISC","devDependencies":{"@types/chai":"^4.3.0","@types/mocha":"^9.1.0","@types/node":"^17.0.23","@typescript-eslint/eslint-plugin":"^5.19.0","chai":"^4.3.6","eslint":"^8.11.0","eslint-config-prettier":"^8.5.0","eslint-plugin-import":"^2.25.4","eslint-plugin-prettier":"^4.0.0","mocha":"^9.2.2","ts-node":"^10.7.0","typescript":"^4.6.3"},"dependencies":{"@ethersproject/networks":"^5.6.1","@ethersproject/providers":"^5.6.2"},"bugs":{"url":"https://github.com/blockcoders/sdk/issues"},"homepage":"https://github.com/blockcoders/sdk#readme","_id":"@blockcoders/harmony-providers@1.0.0","_nodeVersion":"16.14.0","_npmVersion":"8.3.1","dist":{"integrity":"sha512-LXEYD9pfN5Ds9OtmKrGZKv2FnGzDjLxDYsNENcU7LruWubAcZ7zOGcWhGnysJH8vVH/SNETzGWYl1BEKGd8JXA==","shasum":"44fecd84aa689e836a4b5d8d182fba208306f35d","tarball":"https://registry.npmjs.org/@blockcoders/harmony-providers/-/harmony-providers-1.0.0.tgz","fileCount":27,"unpackedSize":82562,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICSwqrjQlmzpGA6yQ+Gsq8y3wJYSeoAT/wkLyIrW31rQAiEAxcnsL8EwH0GMXD6Y+95miqXSt5rdbO2PkqYP+1M0nW0="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJiYWZ8ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpbRxAAoFBPpNY3SEZA8OvZ+UbrAec1JXLkhHCcxXN0ZLuQN9OhepWw\r\nINqxSGOTz53gZlbJy9KxGHOZJ0dDm0VlT2po63LZ3kdGIvatHLLzahNsS7o1\r\n2HiYw7eDvrk9tXVvoXPyR8imSgnL+9Yp4ygVj5a8JsmED9BxK9s1KhV2SbWj\r\nHYkiLxGQC88iFG3unyRJSNsgrJL4ps3QsbJ4o1nqosxzE3AYgOiWM1c1f5Os\r\nXyYbycUV4fxr2AmHm+TRjchfmBTuN2MAKOqCvSPTuU0q7LDh9zJp8FQDpwBE\r\nH4crTGgYiOmoeIoF+4y1JVkmFnDLyt4qIBtadtRexWmnU1QCRegqMEoqVzHV\r\nNNlv5Xxoa1Uyatj6aSCdm2WDXxUfdXUfdKoC/kDFwgqPrK6aOH9OZKN6DmN9\r\nJ3X4GSEphJPLQT3L7BTuTX101kkZKMJQVfuqRcbu5bw+xQ4YCAleaju36BIH\r\nz09SQ9HrBE2uXHOjOQyU93V+4AtPpw0sMzLRc58yug60hz1jE/l7iKJdXfHn\r\nlbklz7J3qboMRtS6zp6b43otzzplKL4MLBTq9oIlekxMG2gQaG+1k1Cd9aaU\r\nF9CC9qKseht32CcNthWxJeQXCGQXKK0EMxfCggyJ3TOHfgxSOZFDQndr1RuT\r\nCREkeAya/9qTT0bGw3SFqR0QrPKwLa5hfgQ=\r\n=clEs\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"fsirni","email":"fsirni@gmail.com"},"directories":{},"maintainers":[{"name":"fsirni","email":"fsirni@gmail.com"},{"name":"jarcodallo","email":"jarcodallo@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/harmony-providers_1.0.0_1650550396383_0.045483043858490335"},"_hasShrinkwrap":false}},"time":{"created":"2022-04-21T14:13:16.313Z","1.0.0":"2022-04-21T14:13:16.581Z","modified":"2022-04-21T14:13:16.763Z"},"maintainers":[{"name":"fsirni","email":"fsirni@gmail.com"},{"name":"jarcodallo","email":"jarcodallo@gmail.com"}],"description":"This library provides a collection of methods to interact with the Harmony blockchain.","homepage":"https://github.com/blockcoders/sdk#readme","author":{"name":"fer@blockcoders.io"},"bugs":{"url":"https://github.com/blockcoders/sdk/issues"},"license":"ISC","readme":"# Harmony RPC Providers\n\nThis library provides a collection of methods to interact with the Harmony blockchain.\n\nCurrently under developement 🤓\n\n## Install\n\n```sh\nnpm i @blockcoders/harmony-providers\n```\n\n## Usage\n\n### Node\n\n```typescript\n// JavaScript\nconst { HarmonyProvider } = require('@blockcoders/harmony-providers')\n\n// TypeScript\nimport { HarmonyProvider } from '@blockcoders/harmony-providers'\n```\n\n## Harmony SDK\n\nExpected Methods:\n| Method | Description |\n| ------------- | ------------- |\n| getBlockNumber | Gets the last block number. |\n| getBlock | Gets the block data by block number or block hash (retrieves transactions hashes only). |\n| getBlockWithTransactions | Gets the block data by block number or block hash and retrieve the transactions data. |\n| getTransaction | Gets the transaction data by transaction hash. |\n\n### Initializing\n\n```typescript\nimport { HarmonyProvider, HMY_TESTNET_NETWORK } from '@blockcoders/harmony-providers'\n\nconst provider = new HarmonyProvider(HMY_TESTNET_NETWORK) // Use HMY_NETWORK to interact with Harmony's mainnet\n```\n\n### Methods\n\n#### getBlockNumber\n\nReturns the last block number on the blockchain.\n\n```ts\nimport { HarmonyProvider, HarmonyProviderMethods, HMY_TESTNET_NETWORK } from '@blockcoders/harmony-providers'\n\nconst provider = new HarmonyProvider(HMY_TESTNET_NETWORK)\nconst blockNumber = await provider.getBlockNumber()\n// Executing the perform method \nconst otherWayToGetBlockNumber = await provider.perform(HarmonyProviderMethods.getBlockNumber, {})\n```\n#### getBlock and getBlockWithTransactions\n\nReturns the block data. The block can be searched by it's hash or number. It can retrieve the block transactions data or just the transactions hashes.\n\n```ts\nimport { HarmonyProvider, HarmonyProviderMethods, HMY_TESTNET_NETWORK } from '@blockcoders/harmony-providers'\n\nconst provider = new HarmonyProvider(HMY_TESTNET_NETWORK)\n\n// Searching with number\n\nconst searchByTag = \"0x47db8e\" // The block number can be an hexadecimal, number or \"latest\"\nconst block = await provider.getBlock(searchByTag)\nconst blockWithTransactionsData = await provider.getBlockWithTransactions(searchByTag)\n\n// Searching with hash\n\nconst searchByHash = \"0xd5258b03ae6b7d1ad8e932bf1aed6257241101e98be7ac6dab74013f267596de\"\nconst sameBlock = await provider.getBlock(searchByHash)\nconst sameBlockWithTransactionsData = await provider.getBlockWithTransactions(searchByHash)\n\n// Using perform\nconst params = {\n    blockTag: \"0x47db8e\", // Change this property for blockHash if you want touse the hash to search the block\n    includeTransactions: true // This will indicate the method whether or not to get the transactions data\n}\nconst someBlock = await provider.perform(HarmonyProviderMethods.getBlock, params)\n```\n#### getTransaction\n\nReturns the transaction data by hash.\n\n```ts\nimport { HarmonyProvider, HarmonyProviderMethods, HMY_TESTNET_NETWORK } from '@blockcoders/harmony-providers'\n\nconst provider = new HarmonyProvider(HMY_TESTNET_NETWORK)\n\nconst txHash = \"0x371ec289c5973c16d58cf600f8f2ce040fe8b429a6007976040d55a1759b8993\"\nconst transaction = await provider.getTransaction(txHash)\n\n// Executing the perform method \nconst params = {\n    transactionHash: \"0x371ec289c5973c16d58cf600f8f2ce040fe8b429a6007976040d55a1759b8993\"\n}\nconst otherWayToGetBlockNumber = await provider.perform(HarmonyProviderMethods.getTransaction, params)\n```\n\n## Change Log\n\nSee [Changelog](CHANGELOG.md) for more information.\n\n## Contributing\n\nContributions welcome! See [Contributing](CONTRIBUTING.md).\n\n## Collaborators\n\n- [**Jose Ramirez**](https://github.com/0xslipk)\n- [**Brian Zuker**](https://github.com/bzuker)\n- [**Fernando Sirni**](https://github.com/fersirni)\n\n## Acknowledgements\n\nThis project was kindly sponsored by [Harmony](https://www.harmony.one/).\n\n## License\n\nLicensed under the MIT - see the [LICENSE](LICENSE) file for details.\n\n\n","readmeFilename":"README.md"}