Class: Bytom::Wallet
- Inherits:
-
Object
- Object
- Bytom::Wallet
- Defined in:
- lib/bytom/api/wallet.rb
Instance Method Summary collapse
-
#backup_wallet ⇒ Object
Backup wallet to image file, it contain accounts image, assets image and keys image.
-
#initialize(client) ⇒ Wallet
constructor
A new instance of Wallet.
-
#recovery_wallet(xpubs: []) ⇒ Object
Recovery wallet and accounts from root XPubs.
-
#rescan_wallet ⇒ Object
Trigger to rescan block information into related wallet.
-
#restore_wallet(account_image: {}, asset_image: {}, key_images: {}) ⇒ Object
Restore wallet by image file.
-
#wallet_info ⇒ Object
Return the information of wallet.
Constructor Details
#initialize(client) ⇒ Wallet
Returns a new instance of Wallet.
6 7 8 |
# File 'lib/bytom/api/wallet.rb', line 6 def initialize(client) @client = client end |
Instance Method Details
#backup_wallet ⇒ Object
Backup wallet to image file, it contain accounts image, assets image and keys image.
13 14 15 |
# File 'lib/bytom/api/wallet.rb', line 13 def backup_wallet client.make_request('/backup-wallet', 'post', params: {}) end |
#recovery_wallet(xpubs: []) ⇒ Object
Recovery wallet and accounts from root XPubs. All accounts and balances of bip44 multi-account hierarchy for deterministic wallets can be restored via root xpubs.
46 47 48 |
# File 'lib/bytom/api/wallet.rb', line 46 def recovery_wallet(xpubs: []) client.make_request('/recovery-wallet', 'post', params: {xpubs: xpubs}) end |
#rescan_wallet ⇒ Object
Trigger to rescan block information into related wallet.
36 37 38 |
# File 'lib/bytom/api/wallet.rb', line 36 def rescan_wallet client.make_request('/rescan-wallet', 'post', params: {}) end |
#restore_wallet(account_image: {}, asset_image: {}, key_images: {}) ⇒ Object
Restore wallet by image file.
24 25 26 27 28 29 30 31 |
# File 'lib/bytom/api/wallet.rb', line 24 def restore_wallet(account_image: {}, asset_image: {}, key_images: {}) params = { account_image: account_image, asset_image: asset_image, key_images: key_images } client.make_request('/restore-wallet', 'post', params: params) end |
#wallet_info ⇒ Object
Return the information of wallet.
53 54 55 |
# File 'lib/bytom/api/wallet.rb', line 53 def wallet_info client.make_request('/wallet-info', 'post', params: {}) end |