Class: Hyperliquid::Transport

Inherits:
Object
  • Object
show all
Defined in:
lib/hyperliquid/transport.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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.options.timeout = 30
    f.options.open_timeout = 10
  end
end

Instance Attribute Details

#base_urlObject (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 (body)
  post("/info", body)
end