Class: Coinbase::FaucetTransaction

Inherits:
Object
  • Object
show all
Defined in:
lib/coinbase/faucet_transaction.rb

Overview

A representation of a transaction from a faucet. a user-controlled Wallet to another address. The fee is assumed to be paid in the native Asset of the Network. Transfers should be created through Wallet#transfer or Address#transfer.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model) ⇒ FaucetTransaction

Returns a new FaucetTransaction object. Do not use this method directly - instead, use Address#faucet.

Parameters:



11
12
13
# File 'lib/coinbase/faucet_transaction.rb', line 11

def initialize(model)
  @model = model
end

Instance Attribute Details

#modelObject (readonly)

Returns the value of attribute model.



15
16
17
# File 'lib/coinbase/faucet_transaction.rb', line 15

def model
  @model
end

Instance Method Details

#inspectString

Same as to_s.

Returns:

  • (String)

    a String representation of the FaucetTransaction



38
39
40
# File 'lib/coinbase/faucet_transaction.rb', line 38

def inspect
  to_s
end

#to_sString

Returns a String representation of the FaucetTransaction.

Returns:

  • (String)

    a String representation of the FaucetTransaction



32
33
34
# File 'lib/coinbase/faucet_transaction.rb', line 32

def to_s
  "Coinbase::FaucetTransaction{transaction_hash: '#{transaction_hash}', transaction_link: '#{transaction_link}'}"
end

#transaction_hashString

Returns the transaction hash.

Returns:

  • (String)

    The onchain transaction hash



19
20
21
# File 'lib/coinbase/faucet_transaction.rb', line 19

def transaction_hash
  model.transaction_hash
end

Returns the link to the transaction on the blockchain explorer.

Returns:

  • (String)

    The link to the transaction on the blockchain explorer



25
26
27
28
# File 'lib/coinbase/faucet_transaction.rb', line 25

def transaction_link
  # TODO: Parameterize this by Network.
  "https://sepolia.basescan.org/tx/#{transaction_hash}"
end