Class: Arweave::Wallet
- Inherits:
-
Object
- Object
- Arweave::Wallet
- Defined in:
- lib/arweave/wallet.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#api ⇒ Object
readonly
Returns the value of attribute api.
-
#owner ⇒ Object
readonly
Returns the value of attribute owner.
Instance Method Summary collapse
- #balance ⇒ Object
-
#initialize(jwk) ⇒ Wallet
constructor
A new instance of Wallet.
- #last_transaction_id ⇒ Object
- #sign(message) ⇒ Object
Constructor Details
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
8 9 10 |
# File 'lib/arweave/wallet.rb', line 8 def address @address end |
#api ⇒ Object (readonly)
Returns the value of attribute api.
8 9 10 |
# File 'lib/arweave/wallet.rb', line 8 def api @api end |
#owner ⇒ Object (readonly)
Returns the value of attribute owner.
8 9 10 |
# File 'lib/arweave/wallet.rb', line 8 def owner @owner end |
Instance Method Details
#balance ⇒ Object
34 35 36 37 38 39 40 41 |
# File 'lib/arweave/wallet.rb', line 34 def balance balance_in_winstons = BigDecimal(api.get_wallet_balance(address).body) OpenStruct.new( ar: balance_in_winstons / 1e12, winston: balance_in_winstons ) end |
#last_transaction_id ⇒ Object
43 44 45 |
# File 'lib/arweave/wallet.rb', line 43 def last_transaction_id api.get_last_transaction_id(address).body end |
#sign(message) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/arweave/wallet.rb', line 26 def sign() private_key.sign_pss( 'SHA256', , salt_length: 0, mgf1_hash: 'SHA256' ) end |