class Arweave::Api
Public Class Methods
instance()
click to toggle source
# File lib/arweave/api.rb, line 8 def instance @instance ||= new( scheme: Client.configuration&.scheme || 'https', host: Client.configuration&.host || 'arweave.net', port: Client.configuration&.port || '443' ) end
new(scheme:, host:, port:)
click to toggle source
# File lib/arweave/api.rb, line 56 def initialize(scheme:, host:, port:) self.class.base_uri URI::Generic.build( scheme: scheme, host: host, port: port ).to_s end
Public Instance Methods
commit(transaction)
click to toggle source
# File lib/arweave/api.rb, line 46 def commit(transaction) self.class.post( '/tx', body: transaction.attributes.to_json, headers: { 'Content-Type' => 'application/json' } ) end
get_last_transaction_id(wallet_address)
click to toggle source
# File lib/arweave/api.rb, line 34 def get_last_transaction_id(wallet_address) self.class.get("/wallet/#{wallet_address}/last_tx") end
get_transaction(transaction_id)
click to toggle source
# File lib/arweave/api.rb, line 22 def get_transaction(transaction_id) self.class.get("/tx/#{transaction_id}") end
get_transaction_anchor()
click to toggle source
# File lib/arweave/api.rb, line 18 def get_transaction_anchor self.class.get('/tx_anchor') end
get_transaction_data(transaction_id)
click to toggle source
# File lib/arweave/api.rb, line 26 def get_transaction_data(transaction_id) self.class.get("/tx/#{transaction_id}/data") end
get_transaction_status(transaction_id)
click to toggle source
# File lib/arweave/api.rb, line 30 def get_transaction_status(transaction_id) self.class.get("/tx/#{transaction_id}/status") end
get_wallet_balance(wallet_address)
click to toggle source
# File lib/arweave/api.rb, line 38 def get_wallet_balance(wallet_address) self.class.get("/wallet/#{wallet_address}/balance") end
reward(byte_size, address = '')
click to toggle source
# File lib/arweave/api.rb, line 42 def reward(byte_size, address = '') self.class.get("/price/#{byte_size}/#{address}") end