sale

sale()

async def sale(nft_id: str, price: int|float, authData: str) -> SaleResult

Sale / relist your nft

Returns

SaleResult object

Raises

  • authDataError - if authData is not provided

  • tradingError :

    • if nft_id is not provided

    • if price <= 0 or price isn't int or float

  • requestError - if request fails

Parameters

  • authData (str) - authentication data required for the api request

  • nft_id (str) - id of the nft to list for sale

  • price (int | float) - price of the nft to list for sale

SaleResult object

Methods:

  • .toDict() - Convert SaleResult object back to the dict

Attributes:

  • .successful_nfts - Returns a list of successfully listed nfts ids

  • .failed_nfts - Returns a list of failed to list nfts ids

Example

List all unlisted gifts for sale at floor price

from aportalsmp.gifts import myPortalsGifts, sale
from aportalsmp.auth import update_auth
import asyncio

auth = asyncio.run(update_auth(api_id=123, api_hash="..."))

async def main():
    myUnlistedGifts = await myPortalsGifts(listed = False, authData = auth)
    for gift in myUnlistedGifts:
        result = await sale(nft_id = gift.id, price = gift.floor_price, authData = auth
        if gift.id in result.successful_nfts:
            print(f"Listed {gift.name} at {gift.floor_price} TON successfully")

See used functions: update_auth, myPortalsGifts

Last updated