Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/netgum/netgum-utils
NetGum utilities
https://github.com/netgum/netgum-utils
ethereum netgum utils
Last synced: 9 days ago
JSON representation
NetGum utilities
- Host: GitHub
- URL: https://github.com/netgum/netgum-utils
- Owner: netgum
- Created: 2018-11-12T07:05:14.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-05-07T18:49:59.000Z (over 5 years ago)
- Last Synced: 2024-11-07T10:08:45.748Z (10 days ago)
- Topics: ethereum, netgum, utils
- Language: TypeScript
- Homepage:
- Size: 156 KB
- Stars: 8
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# NetGum utilities
[![NPM version][npm-image]][npm-url]
[![CircleCI](https://circleci.com/gh/netgum/netgum-utils.svg?style=svg)](https://circleci.com/gh/netgum/netgum-utils)
## Installation```bash
$ npm i @netgum/utils -S
```## API
### ABI
* `abiEncodePacked(...types: string[]): (...args: any[]) => Buffer`
### Address
* `toChecksumAddress(address: string): string`
* `bufferToAddress(buff: Buffer): string`
* `computeCreate2Address(deployer: string, salt: string | number | Buffer, byteCodeHash: Buffer | string): string`
* `verifyAddress(address: string, checksum: boolean = true): boolean`
* `targetToAddress(target: any): string`
* `convertAddress(address: string): string`
* `publicKeyToAddress(publicKey: Buffer): string`
* `privateKeyToAddress(privateKey: Buffer): string`### BN
* `anyToBN(data: any = 0, options: IAnyToBNOptions = {}): BN`
### Buffer
* `anyToBuffer(data: any = Buffer.alloc(0), options: IAnyToBufferOptions = {}): Buffer`
### Crypto
* `sha3(...args: any[]): Buffer`
### ECDSA
* `verifyPublicKey(publicKey: Buffer): boolean`
* `verifyPrivateKey(privateKey: Buffer): boolean`
* `privateToPublicKey(privateKey: Buffer): Buffer`
* `generateRandomPrivateKey(): Buffer`### ENS
* `normalizeEnsName(...parts: string[]): string`
* `getEnsNameInfo(...parts: string[]): IEnsNameInfo`
* `getEnsNameHash(name: string): string`
* `getEnsLabelHash(label: string): string`### Hex
* `anyToHex(data: any = Buffer.alloc(0), options: IAnyToHexOptions = {}): string`
* `prepareHex(hex: string, options: IPrepareHexOptions = {}): string`### JSON
* `jsonReplacer(key: string, value: any): any`
* `jsonReviver(key: any, value: any): any`### Signing
* `hashPersonalMessage(message: Buffer | string): Buffer`
* `signPersonalMessage(message: Buffer | string, privateKey: Buffer): Buffer`
* `recoverPublicKeyFromPersonalMessage(message: Buffer | string, signature: Buffer | string): Buffer`
* `recoverAddressFromPersonalMessage(message: Buffer | string, signature: Buffer | string): string`
* `getMethodSignature(name: string, ...args: string[]): Buffer`### Units
* `convertUnit(value: number | BN, from: Units = Units.Wei, to: Units = Units.Ether): BN`
* `ethToWei(value: number): BN`
* `weiToEth(value: BN): number`## License
The MIT License
[npm-image]: https://badge.fury.io/js/%40netgum%2Futils.svg
[npm-url]: https://npmjs.org/package/@netgum/utils