nectarengine.nft module

class nectarengine.nft.Nft(symbol: str | Dict[str, Any], api: Api | None = None, blockchain_instance: Any | None = None)

Bases: dict

Access the hive-engine Nfts

add_authorized_issuing_accounts(accounts: List[str]) Dict[str, Any]

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 nectarengine.nft import Nft
from nectar import Hive
active_wif = "5xxxx"
hive = Hive(keys=[active_wif])
nft = Nft("TESTNFT", blockchain_instance=hive)
nft.add_authorized_issuing_accounts(["satoshi","aggroed","cryptomancer"])
add_authorized_issuing_contracts(contracts: List[str]) Dict[str, Any]

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 nectarengine.nft import Nft
from nectar 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: str, prop_type: str, is_read_only: bool | None = None, authorized_editing_accounts: List[str] | None = None, authorized_editing_contracts: List[str] | None = None) Dict[str, Any]

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 nectarengine.nft import Nft
from nectar 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: int) Dict[str, Any]

Enables the delegation feature for a NFT

Parameters:

undelegation_cooldown (int) – Cooldown in days

example:

from nectarengine.nft import Nft
from nectar import Hive
active_wif = "5xxxx"
hive = Hive(keys=[active_wif])
nft = Nft("TESTNFT", blockchain_instance=hive)
nft.enable_delegation(30)
get_collection(account: str) List[Dict[str, Any]]

Get NFT collection

get_id(_id: int) Dict[str, Any] | None

Get info about a token

get_info() Dict[str, Any] | None

Returns information about the nft

get_open_interest(query: Dict[str, Any] = {}, limit: int = -1, offset: int = 0) List[Dict[str, Any]]

Returns open interests :param dict query: side, priceSymbol, grouping

get_property(property_name: str) List[Dict[str, Any]]

Returns all token properties

get_sell_book(query: Dict[str, Any] = {}, limit: int = -1, offset: int = 0) List[Dict[str, Any]]

Returns the sell book :param dict query: can be ownedBy, account, nftId, grouping, priceSymbol

get_trade_history(query: Dict[str, Any] = {}, limit: int = -1, offset: int = 0) List[Dict[str, Any]]

Returns market information :param dict query: can be priceSymbol, timestamp

issue(to: str, fee_symbol: str, from_type: str | None = None, to_type: str | None = None, lock_tokens: Dict[str, Any] | None = None, lock_nfts: List[str] | None = None, properties: Dict[str, Any] | None = None, authorized_account: str | None = None) Dict[str, Any]

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 nectarengine.nft import Nft
from nectar import Hive
active_wif = "5xxxx"
hive = Hive(keys=[active_wif])
nft = Nft("TESTNFT", blockchain_instance=hive)
nft.issue("aggroed", "PAL")
issue_multiple(instances: List[Dict[str, Any]], authorized_account: str | None = None) Dict[str, Any]

Issues multiple NFT instances at once.

Parameters:
  • instances (list)

  • authorized_account (str) – authorized hive account

example:

from nectarengine.nft import Nft
from nectar 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"}])
property issuer: str
property properties: List[str]
refresh() None
remove_authorized_issuing_accounts(accounts: List[str]) Dict[str, Any]

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 nectarengine.nft import Nft
from nectar import Hive
active_wif = "5xxxx"
hive = Hive(keys=[active_wif])
nft = Nft("TESTNFT", blockchain_instance=hive)
nft.remove_authorized_issuing_accounts(["aggroed","cryptomancer"])
remove_authorized_issuing_contracts(contracts: List[str]) Dict[str, Any]

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 nectarengine.nft import Nft
from nectar 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: List[str]) Dict[str, Any]

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 nectarengine.nft import Nft
from nectar 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: List[Dict[str, Any]], from_type: str | None = None, authorized_account: str | None = None) Dict[str, Any]

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 nectarengine.nft import Nft
from nectar 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: str, accounts: List[str] | None = None, contracts: List[str] | None = None) Dict[str, Any]

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 nectarengine.nft import Nft
from nectar 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: str) Dict[str, Any]

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 nectarengine.nft import Nft
from nectar import Hive
active_wif = "5xxxx"
hive = Hive(keys=[active_wif])
nft = Nft("TESTNFT", blockchain_instance=hive)
nft.transfer_ownership("aggroed")
update_metadata(metadata: Dict[str, Any]) Dict[str, Any]

Updates the metadata of a token.

Parameters:

medadata (dict) – new medadata

example:

from nectarengine.nft import Nft
from nectar 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: str) Dict[str, Any]

Updates the user friendly name of an NFT.

Parameters:

name (str) – new name

example:

from nectarengine.nft import Nft
from nectar 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: str) Dict[str, Any]

Updates the name of the company/organization that manages an NFT.

Parameters:

org_name (str) – new org_name

example:

from nectarengine.nft import Nft
from nectar 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: str) Dict[str, Any]

Updates the name of the company/organization that manages an NFT.

Parameters:

org_name (str) – new org_name

example:

from nectarengine.nft import Nft
from nectar 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: str, new_name: str | None = None, prop_type: str | None = None, is_read_only: bool | None = None) Dict[str, Any]

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 nectarengine.nft import Nft
from nectar 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: str) Dict[str, Any]

Updates the NFT project website

Parameters:

url (str) – new url

example:

from nectarengine.nft import Nft
from nectar import Hive
active_wif = "5xxxx"
hive = Hive(keys=[active_wif])
nft = Nft("STAR", blockchain_instance=hive)
nft.update_url("https://new_url.com")