Class: SolscanApiRuby::Methods::Public

Inherits:
Base
  • Object
show all
Defined in:
lib/solscan_api_ruby/methods/public.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from SolscanApiRuby::Methods::Base

Instance Method Details

#account(account) ⇒ Response, ApiError

Get overall account information, including program account, NFT metadata information

Parameters:

  • account (String)

Returns:

  • (Response, ApiError)

    Response when success, ApiError on failure.

See Also:



202
203
204
205
206
# File 'lib/solscan_api_ruby/methods/public.rb', line 202

def ()
  method = "#{__method__}/#{}"

  send_request(method)
end

#account_exportTransactions(account, type:, from_time:, to_time:) ⇒ Response, ApiError

Export transactions to CSV. MaxLimit 5000 records per request

Parameters:

  • account (String)
  • type (String)

    Allowed types: tokenchange | soltransfer | all

  • fromTime (Integer)
  • toTime (Integer)

Returns:

  • (Response, ApiError)

    Response when success, ApiError on failure.

See Also:



184
185
186
187
188
189
190
191
192
193
# File 'lib/solscan_api_ruby/methods/public.rb', line 184

def (, type:, from_time:, to_time:)
  params = {}

  params[:account] = 
  params[:type] = type
  params[:fromTime] = from_time
  params[:toTime] = to_time

  send_request(__method__, params: params)
end

#account_solTransfers(account, from_time: nil, to_time: nil, offset: nil, limit: nil) ⇒ Response, ApiError

Get list of transactions make tokenBalance changes. MaxLimit 50 records per request

Parameters:

  • account (String)
  • fromTime (Integer)
  • toTime (Integer)
  • offset (Integer) (defaults to: nil)
  • limit (Integer) (defaults to: nil)

Returns:

  • (Response, ApiError)

    Response when success, ApiError on failure.

See Also:



162
163
164
165
166
167
168
169
170
171
172
# File 'lib/solscan_api_ruby/methods/public.rb', line 162

def (, from_time: nil, to_time: nil, offset: nil, limit: nil)
  params = {}

  params[:account] = 
  params[:fromTime] = from_time if from_time
  params[:toTime] = to_time if to_time
  params[:offset] = offset if offset
  params[:limit] = limit if limit

  send_request(__method__, params: params)
end

#account_splTransfers(account, from_time: nil, to_time: nil, offset: nil, limit: nil) ⇒ Response, ApiError

Get list of transactions make tokenBalance changes. MaxLimit 50 records per request

Parameters:

  • account (String)
  • fromTime (Integer)
  • toTime (Integer)
  • offset (Integer) (defaults to: nil)
  • limit (Integer) (defaults to: nil)

Returns:

  • (Response, ApiError)

    Response when success, ApiError on failure.

See Also:



139
140
141
142
143
144
145
146
147
148
149
# File 'lib/solscan_api_ruby/methods/public.rb', line 139

def (, from_time: nil, to_time: nil, offset: nil, limit: nil)
  params = {}

  params[:account] = 
  params[:fromTime] = from_time if from_time
  params[:toTime] = to_time if to_time
  params[:offset] = offset if offset
  params[:limit] = limit if limit

  send_request(__method__, params: params)
end

#account_stakeAccounts(account) ⇒ Response, ApiError

Get staking accounts of the given account

Parameters:

  • account (String)

Returns:

  • (Response, ApiError)

    Response when success, ApiError on failure.

See Also:



120
121
122
123
124
125
126
# File 'lib/solscan_api_ruby/methods/public.rb', line 120

def ()
  params = {}

  params[:account] =  if 

  send_request(__method__, params: params)
end

#account_tokens(account) ⇒ Response, ApiError

Get token balances of the given account

Parameters:

  • account (String)

Returns:

  • (Response, ApiError)

    Response when success, ApiError on failure.

See Also:



86
87
88
89
90
91
92
# File 'lib/solscan_api_ruby/methods/public.rb', line 86

def ()
  params = {}

  params[:account] =  if 

  send_request(__method__, params: params)
end

#account_transactions(account, before_hash: '', limit: nil) ⇒ Response, ApiError

Get list of transactions of the given account. MaxLimit 50 records per request

Parameters:

  • account (String)
  • beforeHash (String)
  • limit (String) (defaults to: nil)

Returns:

  • (Response, ApiError)

    Response when success, ApiError on failure.

See Also:



103
104
105
106
107
108
109
110
111
# File 'lib/solscan_api_ruby/methods/public.rb', line 103

def (, before_hash: '', limit: nil)
  params = {}

  params[:account] = 
  params[:beforeHash] = before_hash if before_hash
  params[:limit] = limit if limit

  send_request(__method__, params: params)
end

#block(block) ⇒ Response, ApiError

Detail information of given block

Parameters:

  • block (Integer)

Returns:

  • (Response, ApiError)

    Response when success, ApiError on failure.

See Also:



45
46
47
48
49
# File 'lib/solscan_api_ruby/methods/public.rb', line 45

def block(block)
  method = "#{__method__}/#{block}"

  send_request(method)
end

#block_last(limit: nil) ⇒ Response, ApiError

Get last [limit] blocks

Parameters:

  • limit (Integer) (defaults to: nil)

Returns:

  • (Response, ApiError)

    Response when success, ApiError on failure.

See Also:



11
12
13
14
15
16
17
# File 'lib/solscan_api_ruby/methods/public.rb', line 11

def block_last(limit: nil)
  params = {}

  params[:limit] = limit if limit

  send_request(__method__, params: params)
end

#block_transactions(block, offset: nil, limit: nil) ⇒ Response, ApiError

Get block transactions. MaxLimit 50 records per request

Parameters:

  • block (Integer)
  • offset (Integer) (defaults to: nil)
  • limit (Integer) (defaults to: nil)

Returns:

  • (Response, ApiError)

    Response when success, ApiError on failure.

See Also:



28
29
30
31
32
33
34
35
36
# File 'lib/solscan_api_ruby/methods/public.rb', line 28

def block_transactions(block, offset: nil, limit: nil)
  params = {}

  params[:block] = block
  params[:offset] = offset if offset
  params[:limit] = limit if limit

  send_request(__method__, params: params)
end

#chaininfoResponse, ApiError

Blockchain overall information

Returns:

  • (Response, ApiError)

    Response when success, ApiError on failure.

See Also:



287
288
289
# File 'lib/solscan_api_ruby/methods/public.rb', line 287

def chaininfo
  send_request(__method__)
end

#market_token(token_address) ⇒ Response, ApiError

Get market information of the given token

Parameters:

  • token_address (String)

Returns:

  • (Response, ApiError)

    Response when success, ApiError on failure.

See Also:



276
277
278
279
280
# File 'lib/solscan_api_ruby/methods/public.rb', line 276

def market_token(token_address)
  method = "#{__method__}/#{token_address}"

  send_request(method)
end

#token_holders(token_address, offset: nil, limit: nil) ⇒ Response, ApiError

Get token holders

Parameters:

  • token_address (String)
  • offset (Integer) (defaults to: nil)
  • limit (Integer) (defaults to: nil)

Returns:

  • (Response, ApiError)

    Response when success, ApiError on failure.

See Also:



218
219
220
221
222
223
224
225
226
# File 'lib/solscan_api_ruby/methods/public.rb', line 218

def token_holders(token_address, offset: nil, limit: nil)
  params = {}

  params[:tokenAddress] = token_address
  params[:offset] = offset if offset
  params[:limit] = limit if limit

  send_request(__method__, params: params)
end

#token_list(sort_by: 'market_cap', direction: 'desc', limit: nil, offset: nil) ⇒ Response, ApiError

Get list of tokens. MaxLimit 50 records per request.

Parameters:

  • sort_by (String) (defaults to: 'market_cap')

    Available values : market_cap, volume, holder, price, price_change_24h, price_change_7d, price_change_14d, price_change_30d, price_change_60d, price_change_200d, price_change_1y

  • direction (String) (defaults to: 'desc')

    desc or asc, default desc

  • limit (Integer) (defaults to: nil)
  • offset (Integer) (defaults to: nil)

Returns:

  • (Response, ApiError)

    Response when success, ApiError on failure.

See Also:



258
259
260
261
262
263
264
265
266
267
# File 'lib/solscan_api_ruby/methods/public.rb', line 258

def token_list(sort_by: 'market_cap', direction: 'desc', limit: nil, offset: nil)
  params = {}

  params[:sortBy] = sort_by if sort_by
  params[:direction] = direction if direction
  params[:limit] = limit if limit
  params[:offset] = offset if offset

  send_request(__method__, params: params)
end

#token_meta(token_address) ⇒ Response, ApiError

Get metadata of given token.

Parameters:

  • token_address (String)

Returns:

  • (Response, ApiError)

    Response when success, ApiError on failure.

See Also:



235
236
237
238
239
240
241
# File 'lib/solscan_api_ruby/methods/public.rb', line 235

def token_meta(token_address)
  params = {}

  params[:tokenAddress] = token_address

  send_request(__method__, params: params)
end

#transaction(signature) ⇒ Response, ApiError

Detail information of given transaction signature

Parameters:

  • signature (String)

Returns:

  • (Response, ApiError)

    Response when success, ApiError on failure.

See Also:



73
74
75
76
77
# File 'lib/solscan_api_ruby/methods/public.rb', line 73

def transaction(signature)
  method = "#{__method__}/#{signature}"

  send_request(method)
end

#transaction_last(limit: nil) ⇒ Response, ApiError

Get last [limit] transactions

Parameters:

  • limit (Integer) (defaults to: nil)

Returns:

  • (Response, ApiError)

    Response when success, ApiError on failure.

See Also:



58
59
60
61
62
63
64
# File 'lib/solscan_api_ruby/methods/public.rb', line 58

def transaction_last(limit: nil)
  params = {}

  params[:limit] = limit if limit

  send_request(__method__, params: params)
end