nectarengine.collection module

class nectarengine.collection.Collection(account: str, api: Api | None = None, blockchain_instance: Any | None = None)

Bases: dict

Access the hive-engine NFT collection

Parameters:
  • account (str) – Name of the account

  • blockchain_instance (Hive) – Hive instance

Wallet example:

from nectarengine.collection import Collection
collection = Collection("test")
print(collection)
burn(nfts: List[Dict[str, Any]]) Dict[str, Any]

Burn a token

Parameters:

nfts (list) – Amount to transfer

Transfer example:

from nectarengine.collection import Collection
from nectar import Hive
active_wif = "5xxxx"
hive = Hive(keys=[active_wif])
collection = Collection("test", blockchain_instance=hive)
nfts = [{"symbol": "STAR", "ids": ["100"]}]
collection.burn(nfts)
change_account(account: str) None

Changes the wallet account

delegate(to: str, nfts: List[Dict[str, Any]], from_type: str = 'user', to_type: str = 'user') Dict[str, Any]

Delegate a token to another account.

Parameters:
  • to (str) – Recipient

  • nfts (list) – Amount to transfer

  • from_type (str) – (optional) user / contract

  • to_type (str) – (optional) user / contract

Transfer example:

from nectarengine.collection import Collection
from nectar import Hive
active_wif = "5xxxx"
hive = Hive(keys=[active_wif])
collection = Collection("test", blockchain_instance=hive)
nfts = [{"symbol": "STAR", "ids": ["100"]}]
collection.delegate("test2", nfts)
get_collection() Dict[str, List[Dict[str, Any]]]

Returns all token within the wallet as list

get_nft(nft_id: str, symbol: str) Dict[str, Any] | None

Returns a token from the wallet. Is None when not available.

refresh() None
set_id(ssc_id: str) None

Sets the ssc id (default is ssc-mainnet-hive)

transfer(to: str, nfts: List[Dict[str, Any]], from_type: str = 'user', to_type: str = 'user') Dict[str, Any]

Transfer a token to another account.

Parameters:
  • to (str) – Recipient

  • nfts (list) – Amount to transfer

  • from_type (str) – (optional) user / contract

  • to_type (str) – (optional) user / contract

Transfer example:

from nectarengine.collection import Collection
from nectar import Hive
active_wif = "5xxxx"
hive = Hive(keys=[active_wif])
collection = Collection("test", blockchain_instance=hive)
nfts = [{"symbol": "STAR", "ids": ["100"]}]
collection.transfer("test2", nfts)
undelegate(to: str, nfts: List[Dict[str, Any]], from_type: str = 'user') Dict[str, Any]

Undelegate a token to another account.

Parameters:
  • to (str) – Recipient

  • nfts (list) – Amount to transfer

  • from_type (str) – (optional) user / contract

Transfer example:

from nectarengine.collection import Collection
from nectar import Hive
active_wif = "5xxxx"
hive = Hive(keys=[active_wif])
collection = Collection("test", blockchain_instance=hive)
nfts = [{"symbol": "STAR", "ids": ["100"]}]
collection.undelegate("test2", nfts)