Class: Hyperliquid::Transport
- Inherits:
-
Object
- Object
- Hyperliquid::Transport
- Defined in:
- lib/hyperliquid/transport.rb
Instance Attribute Summary collapse
-
#base_url ⇒ Object
readonly
Returns the value of attribute base_url.
Instance Method Summary collapse
-
#initialize(base_url: MAINNET_URL) ⇒ Transport
constructor
A new instance of Transport.
- #post_exchange(body) ⇒ Object
- #post_info(body) ⇒ Object
Constructor Details
#initialize(base_url: MAINNET_URL) ⇒ Transport
Returns a new instance of Transport.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/hyperliquid/transport.rb', line 10 def initialize(base_url: MAINNET_URL) @base_url = base_url @connection = Faraday.new(url: base_url) do |f| f.request :json f.response :json f.adapter Faraday.default_adapter f..timeout = 30 f..open_timeout = 10 end end |
Instance Attribute Details
#base_url ⇒ Object (readonly)
Returns the value of attribute base_url.
8 9 10 |
# File 'lib/hyperliquid/transport.rb', line 8 def base_url @base_url end |
Instance Method Details
#post_exchange(body) ⇒ Object
25 26 27 |
# File 'lib/hyperliquid/transport.rb', line 25 def post_exchange(body) post("/exchange", body) end |
#post_info(body) ⇒ Object
21 22 23 |
# File 'lib/hyperliquid/transport.rb', line 21 def post_info(body) post("/info", body) end |