Class: Bytom::Asset
- Inherits:
-
Object
- Object
- Bytom::Asset
- Defined in:
- lib/bytom/api/asset.rb
Instance Method Summary collapse
-
#create_asset(alias_name:, definition: {}, root_xpubs: [], quorum: 1, issuance_program: nil) ⇒ Hash
Create asset definition, it prepares for the issuance of asset.
-
#get_asset(id:) ⇒ Object
Query detail asset by asset ID.
-
#initialize(client) ⇒ Asset
constructor
A new instance of Asset.
-
#list_assets ⇒ Object
Returns the list of all available assets.
-
#update_asset_alias(id:, alias_name:) ⇒ Object
Update asset alias by assetID.
Constructor Details
#initialize(client) ⇒ Asset
Returns a new instance of Asset.
6 7 8 |
# File 'lib/bytom/api/asset.rb', line 6 def initialize(client) @client = client end |
Instance Method Details
#create_asset(alias_name:, definition: {}, root_xpubs: [], quorum: 1, issuance_program: nil) ⇒ Hash
Create asset definition, it prepares for the issuance of asset.
21 22 23 24 25 26 27 28 29 |
# File 'lib/bytom/api/asset.rb', line 21 def create_asset(alias_name:, definition: {}, root_xpubs: [], quorum: 1, issuance_program: nil) params = { alias: alias_name, definition: definition, } params.merge!(issuance_program: issuance_program) if issuance_program params.merge!(root_xpubs: root_xpubs, quorum: quorum) if not root_xpubs.empty? client.make_request('/create-asset', 'post', params: params) end |
#get_asset(id:) ⇒ Object
Query detail asset by asset ID.
36 37 38 39 40 41 |
# File 'lib/bytom/api/asset.rb', line 36 def get_asset(id:) params = { id: id } client.make_request('/get-asset', 'post', params: params) end |
#list_assets ⇒ Object
Returns the list of all available assets.
45 46 47 |
# File 'lib/bytom/api/asset.rb', line 45 def list_assets client.make_request('/list-assets', 'post', params: {}) end |
#update_asset_alias(id:, alias_name:) ⇒ Object
Update asset alias by assetID.
55 56 57 58 59 60 61 |
# File 'lib/bytom/api/asset.rb', line 55 def update_asset_alias(id:, alias_name:) params = { id: id, alias: alias_name } client.make_request('/update-asset-alias', 'post', params: params) end |