hiveengine - NFT support has been added

@holger80 · 2020-07-04 22:35 · hive-139531

Repository

https://github.com/holgern/hiveengine

hiveengine

hiveengine is a python library for working with hive-engine.com tokens and NFTs.

I released version 0.2.1 which can be installed by

pip install hiveengine

hiveengine is using beem for broadcasting transfers and custom_json to the HIVE blockchain. hiveengine is only working when using HIVE nodes. You can check the currently set nodes with

beem config

Hive nodes can be set with

beem updatenodes --hive

Changelog

0.2.1

  • Fix nft_id list in nftbuy, nftcancel, nftchangeprice and nftsell

0.2.0

  • add NFT support has been added (collection, nft, nftmarket, nfts)
  • add NFT related commands to cli (collection, nftbuy, nftcancel, nftchangeprice, nftlist, nftopen, nftparams, nftsell, nftsellbook, nfttrades)

NFT support has been added to the command line tool

NFT support has been added to hiveengine in version 0.2.0. The following NFT related commands have been added.

collection

Usage: hiveengine collection [OPTIONS] ACCOUNT [SYMBOL]...

  Return NFT collection for an account

For example:

hiveengine collection holger80 CITY

which returns

NFT: CITY
+-------+---------------+---------------------------------------------------------------------+
| _id   | lockedTokens  | properties                                                          |
+-------+---------------+---------------------------------------------------------------------+
| 12659 | {'SIM': '20'} | {'name': 'Basic Home', 'population': 4, 'income': 1, 'type': '1st'} |
+-------+---------------+---------------------------------------------------------------------+

nftbuy

Usage: hiveengine nftbuy [OPTIONS] SYMBOL [NFT_IDS]...

  Buy nfts from the market

Options:
  -a, --account TEXT         Buy with this account (defaults to
                             "default_account")

  -m, --market_account TEXT  Market account which will receive the fee
                             (defaults to "nftmarket")

  -y, --yes                  Answer yes to all questions

The market account can be set to any account except the seller. The market account will receive the fees, when the token was successfully bought.

hiveengine default value for the market account is @nftmarket, which was created by me. I will decide later what to do with received token. When I figure it out to which buyer to received tokens are connected, @nftmarket would share 50% of the received fees with the buyer (the received fees are excluded from token transfer history).

Setting the market account can be used to send the fee to an alt account:

hiveengine nftbuy -a holger80 -m my_alt STAR 100

In this case, holger80 will receive the NFT 100 and my_alt will receive the fee share in tokens.

nftcancel

Usage: hiveengine nftcancel [OPTIONS] SYMBOL [NFT_IDS]...

  Cancel a nft sell order

Options:
  -a, --account TEXT  Buy with this account (defaults to "default_account")
  -y, --yes           Answer yes to all questions

This command can be used to cancel an open order:

hiveengine nftcancel -a holger80 STAR 7147

which asks me to proceed:

Canceling selling of following nfts:
+-------+-----------------+----------------------------------------------------------------+
| nftId | previousAccount | properties                                                     |
+-------+-----------------+----------------------------------------------------------------+
| 7147  | holger80        | {'type': 'FanBoost1', 'class': 'fanboost', 'stats': '1,0,0,0'} |
+-------+-----------------+----------------------------------------------------------------+
continue [y/n]?

nftchangeprice

Usage: hiveengine nftchangeprice [OPTIONS] SYMBOL [NFT_IDS]... NEWPRICE

  Changes a price of an open sell order

Options:
  -a, --account TEXT  Buy with this account (defaults to "default_account")
  -y, --yes           Answer yes to all questions

The following command changes the price of my order to 1160 STARBITS:

hiveengine nftchangeprice -a holger80 STAR 7147 1160

nftlist

hiveengine nftlist

returns all existing NFTs:

+----+---------+-----------------------------+
| id | Symbol  | Name                        |
+----+---------+-----------------------------+
| 1  | CITY    | dCITY NFT TOKEN             |
| 2  | CRITTER | Mischievous Crypto Critters |
| 3  | STAR    | Rising Star Game            |
| 4  | MUSIC   | Music                       |
| 5  | API     | dCITY API                   |
| 6  | NFTSR   | NFT Showroom                |
+----+---------+-----------------------------+

nftopen

Usage: hiveengine nftopen [OPTIONS] SYMBOL

  Returns the open interest book for the given symbol

Options:
  -g, --grouping TEXT      Can be set to a grouping parameter, or to
                           parameter.value

  -v, --value TEXT         Set property value, can be used when grouping is
                           set to a property parameter

  -s, --price-symbol TEXT  Limit to this price symbol

This command returns the currently open orders for each NFT type.

hiveengine nftopen -g name -v "Basic Home" CITY

would return the open orders for one specific NFT type:

+-------------+---------------------------------------+-------+
| priceSymbol | grouping                              | count |
+-------------+---------------------------------------+-------+
| SIM         | {'name': 'Basic Home', 'type': ''}    | 0     |
| BEER        | {'name': 'Basic Home', 'type': ''}    | 0     |
| SWAP.HIVE   | {'name': 'Basic Home', 'type': ''}    | 0     |
| SWAP.STEEM  | {'name': 'Basic Home', 'type': ''}    | 0     |
| STARBITS    | {'name': 'Basic Home', 'type': ''}    | 0     |
| LEO         | {'name': 'Basic Home', 'type': ''}    | 0     |
| SWAP.HIVE   | {'name': 'Basic Home', 'type': '1st'} | 344   |
| SIM         | {'name': 'Basic Home', 'type': '1st'} | 1194  |
| BEER        | {'name': 'Basic Home', 'type': '1st'} | 1     |
| WEED        | {'name': 'Basic Home', 'type': '1st'} | 1     |
| STEM        | {'name': 'Basic Home', 'type': '1st'} | 0     |
| SWAP.STEEM  | {'name': 'Basic Home', 'type': '1st'} | 0     |
+-------------+---------------------------------------+-------+

nftparams

hiveengine nftparams

returns the fees for creating NFTs:

+-------------------------+----------------------------------+
| key                     | value                            |
+-------------------------+----------------------------------+
| _id                     | 1                                |
| nftCreationFee          | 100                              |
| nftIssuanceFee          | {'BEE': '0.001', 'PAL': '0.001'} |
| dataPropertyCreationFee | 100                              |
| enableDelegationFee     | 1000                             |
+-------------------------+----------------------------------+

nftsell

Usage: hiveengine nftsell [OPTIONS] SYMBOL [NFT_IDS]... PRICE PRICE_SYMBOL

  Create a sell order on the market

Options:
  -a, --account TEXT  Buy with this account (uses the beem default account
                      when not set)

  -f, --fee INTEGER   Market fee 500 -> 5% (defaults is 500)
  -y, --yes           Answer yes to all questions

This command creates a new sell order:

hiveengine nftsell -a holger80 STAR 7147 1150 STARBITS

and I can then check if it has worked by:

hiveengine nftsellbook -g type -v FanBoost1 -l 5 STAR

nftsellbook

Usage: hiveengine nftsellbook [OPTIONS] SYMBOL

  Returns the sell book for the given symbol

Options:
  -a, --account TEXT       Buy with this account (defaults to
                           "default_account")

  -g, --grouping TEXT      Can be set to a grouping parameter, or to
                           parameter.value

  -v, --value TEXT         Set property value, can be used when grouping is
                           set to a property parameter

  -s, --price-symbol TEXT  Limit to this price symbol
  -n, --nft-id TEXT        Limit to this nft id
  -l, --limit TEXT         Limit to shown entries

It is possible to limit the returned open sell orders by a specific property:

hiveengine nftsellbook -g name -v "Basic Home" -s SIM -l 10 CITY

will return the 10 cheapest offers for Basic Home NFTs which are sold by SIM tokens:

+--------+------------+------------+---------+-------------+--------+-----------+
| nftId  | account    | name       | price   | priceSymbol | fee    | est. HIVE |
+--------+------------+------------+---------+-------------+--------+-----------+
| 191946 | lestrange  | Basic Home | 329.000 | SIM         | 2.50 % | 1.704     |
| 191944 | lestrange  | Basic Home | 329.000 | SIM         | 2.50 % | 1.704     |
| 191941 | lestrange  | Basic Home | 329.000 | SIM         | 2.50 % | 1.704     |
| 191936 | lestrange  | Basic Home | 329.000 | SIM         | 2.50 % | 1.704     |
| 191902 | lestrange  | Basic Home | 329.000 | SIM         | 2.50 % | 1.704     |
| 194596 | bobawondua | Basic Home | 330.000 | SIM         | 2.50 % | 1.709     |
| 194587 | bobawondua | Basic Home | 330.000 | SIM         | 2.50 % | 1.709     |
| 194584 | bobawondua | Basic Home | 330.000 | SIM         | 2.50 % | 1.709     |
| 194582 | bobawondua | Basic Home | 330.000 | SIM         | 2.50 % | 1.709     |
| 194581 | bobawondua | Basic Home | 330.000 | SIM         | 2.50 % | 1.709     |
+--------+------------+------------+---------+-------------+--------+-----------+

I added the estimated HIVE token price to each order. The result table is sorted by the estimated HIVE price. This allows to check which offer has currently the best price. The HIVE price is calculated by using the last token price which is returned by the API.

nfttrades

Usage: hiveengine nfttrades [OPTIONS] [SYMBOL]

  Returns the trades history

Options:
  -a, --account TEXT  Buy with this account (defaults to "default_account")

This shows the last trades for a NFT symbol.


If you like what I do, consider casting a vote for me as witness on Hivesigner or on PeakD

#development #hiveengine #python #nft
Payout: 0.000 HBD
Votes: 699
More interactions (upvote, reblog, reply) coming soon.