Class: OmiseGO::Wallet
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
- .all(provider_user_id:, client: nil) ⇒ Object
- .all_for_account(account_id:, client: nil) ⇒ Object
- .credit(provider_user_id:, token_id:, amount:, metadata: {}, user_address: nil, encrypted_metadata: {}, idempotency_token:, account_id:, account_address: nil, client: nil) ⇒ Object
- .debit(provider_user_id:, user_address: nil, token_id:, amount:, metadata: {}, encrypted_metadata: {}, idempotency_token:, account_id:, account_address: nil, client: nil) ⇒ Object
Instance Method Summary collapse
Methods inherited from Base
attributes, #error?, global_client, #initialize, #inspect, request, #success?
Constructor Details
This class inherits a constructor from OmiseGO::Base
Class Method Details
.all(provider_user_id:, client: nil) ⇒ Object
8 9 10 |
# File 'lib/omisego/wallet.rb', line 8 def all(provider_user_id:, client: nil) request(client).send('user.get_wallets', provider_user_id: provider_user_id).data end |
.all_for_account(account_id:, client: nil) ⇒ Object
12 13 14 |
# File 'lib/omisego/wallet.rb', line 12 def all_for_account(account_id:, client: nil) request(client).send('account.get_wallets', id: account_id).data end |
.credit(provider_user_id:, token_id:, amount:, metadata: {}, user_address: nil, encrypted_metadata: {}, idempotency_token:, account_id:, account_address: nil, client: nil) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/omisego/wallet.rb', line 16 def credit(provider_user_id:, token_id:, amount:, metadata: {}, user_address: nil, encrypted_metadata: {}, idempotency_token:, account_id:, account_address: nil, client: nil) params = { to_provider_user_id: provider_user_id, to_address: user_address, from_account_id: account_id, from_address: account_address, token_id: token_id, amount: amount, metadata: , encrypted_metadata: , account_address: account_address, idempotency_token: idempotency_token } request(client).send('transaction.create', params).data end |
.debit(provider_user_id:, user_address: nil, token_id:, amount:, metadata: {}, encrypted_metadata: {}, idempotency_token:, account_id:, account_address: nil, client: nil) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/omisego/wallet.rb', line 32 def debit(provider_user_id:, user_address: nil, token_id:, amount:, metadata: {}, encrypted_metadata: {}, idempotency_token:, account_id:, account_address: nil, client: nil) params = { from_provider_user_id: provider_user_id, from_address: user_address, to_account_id: account_id, to_address: account_address, token_id: token_id, amount: amount, metadata: , encrypted_metadata: , account_address: account_address, idempotency_token: idempotency_token } request(client).send('transaction.create', params).data end |
Instance Method Details
#account ⇒ Object
53 54 55 |
# File 'lib/omisego/wallet.rb', line 53 def account @_account ||= Account.new(@account) end |
#balances ⇒ Object
57 58 59 60 61 |
# File 'lib/omisego/wallet.rb', line 57 def balances @_balances ||= @balances.map do |balance| Balance.new(balance) end end |
#user ⇒ Object
49 50 51 |
# File 'lib/omisego/wallet.rb', line 49 def user @_user ||= User.new(@user) end |