nectarengine.wallet module

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

Bases: list

Access the hive-engine wallet

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

  • blockchain_instance (Hive) – Hive instance

Wallet example:

from nectarengine.wallet import Wallet
wallet = Wallet("test")
print(wallet)
cancel_unstake(trx_id: str) Dict[str, Any]

Cancel unstaking a token.

Parameters:

trx_id (str) – transaction id in which the tokan was unstaked

Cancel unstake example:

from nectarengine.wallet import Wallet
from nectar import Hive
active_wif = "5xxxx"
hv = Hive(keys=[active_wif])
wallet = Wallet("test", blockchain_instance=hv)
wallet.stake("cf39ecb8b846f1efffb8db526fada21a5fcf41c3")
change_account(account: str) None

Changes the wallet account

get_balances() List[Dict[str, Any]]

Returns all token within the wallet as list

get_buy_book(symbol: str | None = None, limit: int = 100, offset: int = 0) List[Dict[str, Any]]

Returns the buy book for the wallet account. When symbol is set, the order book from the given token is shown.

get_history(symbol: str, limit: int = 1000, offset: int = 0) List[Dict[str, Any]]

Returns the transfer history of a token

get_sell_book(symbol: str | None = None, limit: int = 100, offset: int = 0) List[Dict[str, Any]]

Returns the sell book for the wallet account. When symbol is set, the order book from the given token is shown.

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

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

issue(to: str, amount: float, symbol: str) Dict[str, Any]

Issues a specific token amount.

Parameters:
  • to (str) – Recipient

  • amount (float) – Amount to issue

  • symbol (str) – Token to issue

Issue example:

from nectarengine.wallet import Wallet
from nectar import Hive
active_wif = "5xxxx"
hv = Hive(keys=[active_wif])
wallet = Wallet("test", blockchain_instance=hv)
wallet.issue(1, "my_token")
refresh() None
set_id(ssc_id: str) None

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

stake(amount: float, symbol: str, receiver: str | None = None) Dict[str, Any]

Stake a token.

Parameters:
  • amount (float) – Amount to stake

  • symbol (str) – Token to stake

Stake example:

from nectarengine.wallet import Wallet
from nectar import Hive
active_wif = "5xxxx"
hv = Hive(keys=[active_wif])
wallet = Wallet("test", blockchain_instance=hv)
wallet.stake(1, "BEE")
transfer(to: str, amount: float, symbol: str, memo: str = '') Dict[str, Any]

Transfer a token to another account.

Parameters:
  • to (str) – Recipient

  • amount (float) – Amount to transfer

  • symbol (str) – Token to transfer

  • memo (str) – (optional) Memo

Transfer example:

from nectarengine.wallet import Wallet
from nectar import Hive
active_wif = "5xxxx"
hv = Hive(keys=[active_wif])
wallet = Wallet("test", blockchain_instance=hv)
wallet.transfer("test1", 1, "BEE", "test")
unstake(amount: float, symbol: str) Dict[str, Any]

Unstake a token.

Parameters:
  • amount (float) – Amount to unstake

  • symbol (str) – Token to unstake

Unstake example:

from nectarengine.wallet import Wallet
from nectar import Hive
active_wif = "5xxxx"
hv = Hive(keys=[active_wif])
wallet = Wallet("test", blockchain_instance=hv)
wallet.unstake(1, "BEE")