New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

web3-hpb

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

web3-hpb

  • 0.1.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Web3::Hpb

Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file lib/web3/hpb. To experiment with that code, run bin/console for an interactive prompt.

TODO: Delete this and the text above, and describe your gem

Installation

Add this line to your application's Gemfile:

gem 'web3-hpb'

And then execute:

$ bundle

Or install it yourself as:

$ gem install web3-hpb

Usage

连接

初始化一个web3对象

web3 = Web3::Hpb::Rpc.new

默认配置为

web3 = Web3::Hpb::Rpc.new host: 'node.host.com',
                          port: 8545,
                          connect_options: { use_ssl: true, read_timeout: 120 }

使用hpb接口

>> web3.hpb.blockNumber
4376369

>> web3.hpb.getBalance '0x4c8a1996754c11ac255c747fdb36a4288d230541'
3916.6597314456685

>> block = web3.hpb.getBlockByNumber 4376369
#<Web3::Hpb::Block:0x007f844d6f1138 @block_data={"author"=>"0x4c8a1996754c11ac255c797fdb36f4288d230541", ...

>> block.timestamp_time
2017-10-17 12:51:36 +0300

>> block.transactions.count
129

>> block.transactions[0].from
"0x4c8a199481ac255c747fdb36f4288d230541"

>> block.transactions[0].value_eth
0.51896811

使用abi接口

# creation of contract object
myContract = web3.hpb.contract(abi);

# initiate contract for an address
myContractInstance = myContract.at('0x57d180cbaffbc97237f572148fc1b283b68d8861');

# call constant function
result = myContractInstance.balanceOf('0x...'); # any constant method works

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/web3-hpb. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

Code of Conduct

Everyone interacting in the Web3::Hpb project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

FAQs

Package last updated on 03 Dec 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc