hiveengine.nft¶
-
class
hiveengine.nft.
Nft
(symbol, api=None, blockchain_instance=None)¶ Bases:
dict
Access the hive-engine Nfts
Adds Hive accounts to the list of accounts that are authorized to issue new tokens on behalf of the NFT owner.
param list accounts: A list of hive accounts to add to the authorized list example:
from hiveengine.nft import Nft from beem import Hive active_wif = "5xxxx" hive = Hive(keys=[active_wif]) nft = Nft("TESTNFT", blockchain_instance=hive) nft.add_authorized_issuing_accounts(["satoshi","aggroed","cryptomancer"])
Adds smart contracts to the list of contracts that are authorized to issue new tokens on behalf of the NFT owner.
param list contracts: A list of smart contracts t to add to the authorized list example:
from hiveengine.nft import Nft from beem import Hive active_wif = "5xxxx" hive = Hive(keys=[active_wif]) nft = Nft("TESTNFT", blockchain_instance=hive) nft.add_authorized_issuing_contracts(["mycontract","anothercontract","mygamecontract"])
-
add_property
(name, prop_type, is_read_only=None, authorized_editing_accounts=None, authorized_editing_contracts=None)¶ Adds a new data property schema to an existing NFT definition
Parameters: - name (str) – Name of the new property
- prop_type (str) – must be number, string or boolean
- is_read_only (bool) –
- authorized_editing_accounts (list) –
- authorized_editing_contracts (list) –
example:
from hiveengine.nft import Nft from beem import Hive active_wif = "5xxxx" hive = Hive(keys=[active_wif]) nft = Nft("TESTNFT", blockchain_instance=hive) nft.add_property("color", "string")
-
enable_delegation
(undelegation_cooldown)¶ Enables the delegation feature for a NFT
Parameters: undelegation_cooldown (int) – Cooldown in days example:
from hiveengine.nft import Nft from beem import Hive active_wif = "5xxxx" hive = Hive(keys=[active_wif]) nft = Nft("TESTNFT", blockchain_instance=hive) nft.enable_delegation(30)
-
get_collection
(account)¶ Get NFT collection
-
get_id
(_id)¶ Get info about a token
-
get_info
()¶ Returns information about the nft
-
get_open_interest
(query={}, limit=-1, offset=0)¶ Returns open interests :param dict query: side, priceSymbol, grouping
-
get_property
(property_name)¶ Returns all token properties
-
get_sell_book
(query={}, limit=-1, offset=0)¶ Returns the sell book :param dict query: can be ownedBy, account, nftId, grouping, priceSymbol
-
get_trade_history
(query={}, limit=-1, offset=0)¶ Returns market information :param dict query: can be priceSymbol, timestamp
-
issue
(to, fee_symbol, from_type=None, to_type=None, lock_tokens=None, lock_nfts=None, properties=None, authorized_account=None)¶ Issues a new instance of an NFT to a Hive account or smart contract.
Parameters: - to (str) –
- fee_symbol (str) –
- from_type (str) –
- to_type (str) –
- lock_tokens (dict) –
- lock_nfts (list) –
- properties (dict) –
- authorized_account (str) – authorized hive account
example:
from hiveengine.nft import Nft from beem import Hive active_wif = "5xxxx" hive = Hive(keys=[active_wif]) nft = Nft("TESTNFT", blockchain_instance=hive) nft.issue("aggroed", "PAL")
-
issue_multiple
(instances, authorized_account=None)¶ Issues multiple NFT instances at once.
Parameters: - instances (list) –
- authorized_account (str) – authorized hive account
example:
from hiveengine.nft import Nft from beem import Hive active_wif = "5xxxx" hive = Hive(keys=[active_wif]) nft = Nft("TESTNFT", blockchain_instance=hive) nft.issue_multiple([{"fromType": "contract", "symbol": "TSTNFT", "to": "marc", "feeSymbol": "PAL"}])
-
issuer
¶
-
properties
¶
-
refresh
()¶
Removes Hive accounts from the list of accounts that are authorized to issue new tokens on behalf of the NFT owner.
param list accounts: A list of hive accounts to remove from the authorized list example:
from hiveengine.nft import Nft from beem import Hive active_wif = "5xxxx" hive = Hive(keys=[active_wif]) nft = Nft("TESTNFT", blockchain_instance=hive) nft.remove_authorized_issuing_accounts(["aggroed","cryptomancer"])
Remvoes smart contracts from the list of contracts that are authorized to issue new tokens on behalf of the NFT owner.
param list contracts: A list of smart contracts to remove from the authorized list example:
from hiveengine.nft import Nft from beem import Hive active_wif = "5xxxx" hive = Hive(keys=[active_wif]) nft = Nft("TESTNFT", blockchain_instance=hive) nft.remove_authorized_issuing_contracts(["mycontract","mygamecontract"])
-
set_group_by
(properties)¶ Can be used after calling the addProperty action to change the lists of authorized editing accounts & contracts for a given data property.
param list properties: example:
from hiveengine.nft import Nft from beem import Hive active_wif = "5xxxx" hive = Hive(keys=[active_wif]) nft = Nft("TESTNFT", blockchain_instance=hive) nft.set_group_by(["level", "isFood"])
-
set_properties
(nfts, from_type=None, authorized_account=None)¶ Edits one or more data properties on one or more instances of an NFT.
Parameters: - nfts (list) –
- from_type (str) –
- authorized_account (str) – authorized hive account
example:
from hiveengine.nft import Nft from beem import Hive posting_wif = "5xxxx" hive = Hive(keys=[posting_wif]) nft = Nft("TESTNFT", blockchain_instance=hive) nft.set_properties([{ "id":"573", "properties": {"color": "red", "level": 2}}])
-
set_property_permissions
(name, accounts=None, contracts=None)¶ Can be used after calling the addProperty action to change the lists of authorized editing accounts & contracts for a given data property.
param str name: Name of the new property param list accounts: param list contracts: example:
from hiveengine.nft import Nft from beem import Hive active_wif = "5xxxx" hive = Hive(keys=[active_wif]) nft = Nft("TESTNFT", blockchain_instance=hive) nft.set_property_permissions("color", accounts=["cryptomancer","marc"])
-
transfer_ownership
(to)¶ Transfers ownership of an NFT from the current owner to another Hive account.
Parameters: to (str) – Hive accounts to become the new owner example:
from hiveengine.nft import Nft from beem import Hive active_wif = "5xxxx" hive = Hive(keys=[active_wif]) nft = Nft("TESTNFT", blockchain_instance=hive) nft.transfer_ownership("aggroed")
-
update_metadata
(medadata)¶ Updates the metadata of a token.
Parameters: medadata (dict) – new medadata example:
from hiveengine.nft import Nft from beem import Hive active_wif = "5xxxx" hive = Hive(keys=[active_wif]) nft = Nft("STAR", blockchain_instance=hive) metadata = {"url": "https://mycoolnft.com", "icon": "https://mycoolnft.com/token.jpg", "desc": "This NFT will rock your world! It has features x, y, and z. So cool!"} nft.update_metadata(metadata)
-
update_name
(name)¶ Updates the user friendly name of an NFT.
Parameters: name (str) – new name example:
from hiveengine.nft import Nft from beem import Hive posting_wif = "5xxxx" hive = Hive(keys=[posting_wif]) nft = Nft("STAR", blockchain_instance=hive) nft.update_name("My Awesome NFT")
-
update_org_name
(org_name)¶ Updates the name of the company/organization that manages an NFT.
Parameters: org_name (str) – new org_name example:
from hiveengine.nft import Nft from beem import Hive posting_wif = "5xxxx" hive = Hive(keys=[posting_wif]) nft = Nft("STAR", blockchain_instance=hive) nft.update_org_name("Nifty Company Inc")
-
update_product_name
(product_name)¶ Updates the name of the company/organization that manages an NFT.
Parameters: org_name (str) – new org_name example:
from hiveengine.nft import Nft from beem import Hive posting_wif = "5xxxx" hive = Hive(keys=[posting_wif]) nft = Nft("STAR", blockchain_instance=hive) nft.update_product_name("Acme Exploding NFTs")
-
update_property_definition
(name, new_name=None, prop_type=None, is_read_only=None)¶ Updates the schema of a data property. This action can only be called if no tokens for this NFT have been issued yet.
Parameters: - name (str) – Name of the new property
- name –
- new_name (str) –
- prop_type (str) –
- is_read_only (bool) –
example:
from hiveengine.nft import Nft from beem import Hive active_wif = "5xxxx" hive = Hive(keys=[active_wif]) nft = Nft("TESTNFT", blockchain_instance=hive) nft.update_property_definition("color", new_name="Color")
-
update_url
(url)¶ Updates the NFT project website
Parameters: url (str) – new url example:
from hiveengine.nft import Nft from beem import Hive active_wif = "5xxxx" hive = Hive(keys=[active_wif]) nft = Nft("STAR", blockchain_instance=hive) nft.update_url("https://new_url.com")