Paras Documentation v2
  • Overview
  • Contract
  • Getting Started
  • Using near-api-js
  • NFT contract function calls
    • Creating new NFT series
    • NFT series functions
    • NFT functions
  • Marketplace contract function calls
    • Marketplace functions
  • NFT smart contract integration
  • NFT Metadata
  • Reference
    • API Reference
  • Examples
Powered by GitBook
On this page
  • Storage deposit
  • Add storage deposit
  • Change methods
  • Add market data
  • Delete market data
  • Buy
  • Add offer
  • Delete offer (token series)
  • Delete offer (token id)
  • View methods
  • Get market data
  • Get offer
  1. Marketplace contract function calls

Marketplace functions

Storage deposit

Every offer and market data (sale) needs to store some NEAR as storage staking fee. The fee is 8590000000000000000000 yoctoNEAR / 0.00859 per sale.

$ near view paras-marketplace-v2.testnet storage_minimum_balance
View call: paras-marketplace-v2.testnet.storage_minimum_balance()
'8590000000000000000000'

Add storage deposit

pub fn storage_deposit(
        &mut self,
        account_id: Option<AccountId>
)
$ near call paras-marketplace-v2.testnet storage_deposit '{"accountId":"orang.testnet"}' --accountId orang.testnet --depositYocto 8590000000000000000000
Scheduling a call: paras-marketplace-v2.testnet.storage_deposit({"accountId":"orang.testnet"}) with attached 0.00859 NEAR
Doing account.functionCall()
Transaction Id 8c7D58VNkRJQ6ABwCK1hE9DoBsuEPaUhCrLCwTSQFgzc
To see the transaction in the transaction explorer, please open this url in your browser
https://explorer.testnet.near.org/transactions/8c7D58VNkRJQ6ABwCK1hE9DoBsuEPaUhCrLCwTSQFgzc
''

Change methods

Add market data

This action will create a listing on Paras marketplace. If you want to change the price, do this action again with different price.

fn nft_approve(
        &mut self,
        token_id: TokenId,
        account_id: AccountId,
        msg: Option<String>,
) -> Option<Promise>
$ near call --accountId projectp.testnet paras-token-v2.testnet nft_approve '{"token_id":"3:1","account_id":"paras-marketplace-v2.testnet","msg":"{\"market_type\":\"sale\",\"price\":\"1000000000000000000000000\",\"ft_token_id\":\"near\"}"}' --depositYocto 400000000000000000000
Scheduling a call: paras-token-v2.testnet.nft_approve({"token_id":"3:1","account_id":"paras-marketplace-v2.testnet","msg":"{\"market_type\":\"sale\",\"price\":\"1000000000000000000000000\",\"ft_token_id\":\"near\"}"}) with attached 0.0004 NEAR
Doing account.functionCall()
Receipt: CxkeuWLGB3EYcT4XKdsZhPP8xPKWnEwXs7aJEsFioYVH
        Log [paras-token-v2.testnet]: {"type":"add_market_data","params":{"owner_id":"projectp.testnet","approval_id":2,"nft_contract_id":"paras-token-v2.testnet","token_id":"3:1","ft_token_id":"near","price":"1000000000000000000000000","started_at":null,"ended_at":null,"end_price":null,"is_auction":null}}
Transaction Id Arfowjafoim9BCvkhokyV3MA4RdhAkpsSq131RG3cQFB
To see the transaction in the transaction explorer, please open this url in your browser
https://explorer.testnet.near.org/transactions/Arfowjafoim9BCvkhokyV3MA4RdhAkpsSq131RG3cQFB
''

Delete market data

pub fn delete_market_data(
        &mut self, 
        nft_contract_id: AccountId, 
        token_id: TokenId
)
$ near call --accountId projectp.testnet paras-marketplace-v2.testnet delete_market_data '{"nft_contract_id":"paras-token-v2.testnet", "token_id":"3:1"}' --depositYocto 1
Scheduling a call: paras-marketplace-v2.testnet.delete_market_data({"nft_contract_id":"paras-token-v2.testnet", "token_id":"3:1"}) with attached 0.000000000000000000000001 NEAR
Doing account.functionCall()
Receipt: FvviX9cEPssMS5hnry7f2yNof1T7KVQnuWid9oX2p2mJ
        Log [paras-marketplace-v2.testnet]: {"type":"delete_market_data","params":{"owner_id":"projectp.testnet","nft_contract_id":"paras-token-v2.testnet","token_id":"3:1"}}
Transaction Id 5ZDf1Py7jp25ZdQgZtKHT2AgBmGDjFfeuZzLTdVnLSzT
To see the transaction in the transaction explorer, please open this url in your browser
https://explorer.testnet.near.org/transactions/5ZDf1Py7jp25ZdQgZtKHT2AgBmGDjFfeuZzLTdVnLSzT
''

Buy

pub fn buy(
        &mut self, 
        nft_contract_id: AccountId, 
        token_id: TokenId
)
$ near call --accountId cymac.testnet paras-marketplace-v2.testnet buy '{"nft_contract_id":"paras-token-v2.testnet","token_id":"3:1"}' --deposit 1 --gas 300000000000000
Scheduling a call: paras-marketplace-v2.testnet.buy({"nft_contract_id":"paras-token-v2.testnet","token_id":"3:1"}) with attached 1 NEAR
Doing account.functionCall()
Retrying request to broadcast_tx_commit as it has timed out [
  'DQAAAGN5bWFjLnRlc3RuZXQAKaMKAbCqyBhfsRtKv9BhPb/xOIGEIcn6NKvet8CsX/b4r9+mYjcAABwAAABwYXJhcy1tYXJrZXRwbGFjZS12Mi50ZXN0bmV0LI/Djpoo6R9/x34NDFlIgpctSiwuW968dkvJegSiHFQBAAAAAgMAAABidXk9AAAAeyJuZnRfY29udHJhY3RfaWQiOiJwYXJhcy10b2tlbi12Mi50ZXN0bmV0IiwidG9rZW5faWQiOiIzOjEifQDAbjHZEAEAAAAAoe3MzhvC0wAAAAAAAABHFQRaDCKgLlrWM2bTqCzG8CTXKW0nKhL4OZYQgoQi15x7A+eIffx2sznfXV162FznK3SplAAdapRC88sQf68A'
]
Receipt: Est2KFQzLE7iXw23Eu5X5fZ9ewD9JAZM4BtLCbNhcsQW
        Log [paras-marketplace-v2.testnet]: Transfer 3:1 from paras-marketplace-v2.testnet to cymac.testnet
        Log [paras-marketplace-v2.testnet]: {"type":"nft_transfer","params":{"token_id":"3:1","sender_id":"projectp.testnet","receiver_id":"cymac.testnet"}}
Receipts: 4bemvM8seToCEEDcEBW1ZLZQGEXs38vbU9eTdcdKSPwj, Xme8x7ChmGnto1csvgBpqLo7KE5KgmD7ctJtnqjKQk6, 7MeUE7Jb7oeQzkBVS6uczpmomRSZJxjXkDJbvV7UEfTs
        Log [paras-marketplace-v2.testnet]: {"type":"resolve_purchase","params":{"owner_id":"projectp.testnet","nft_contract_id":"paras-token-v2.testnet","token_id":"3:1","ft_token_id":"near","price":"1000000000000000000000000","buyer_id":"cymac.testnet"}}
Transaction Id Ebx9RHDmnTg5xc8VthtdwdEx5aq6kMfj9RCLCYwaChay
To see the transaction in the transaction explorer, please open this url in your browser
https://explorer.testnet.near.org/transactions/Ebx9RHDmnTg5xc8VthtdwdEx5aq6kMfj9RCLCYwaChay
''

Add offer

There are two types of add offers.

The first one is offer to the token series, this action is only applicable to Paras NFT contract / Paras COMIC contract.

pub fn add_offer(
        &mut self,
        nft_contract_id: AccountId,
        token_id: Option<TokenId>,
        token_series_id: Option<String>,
        ft_token_id: AccountId,
        price: U128,
)
$ near call --accountId cymac.testnet paras-marketplace-v2.testnet add_offer '{"nft_contract_id":"paras-token-v2.testnet","token_series_id":"1","ft_token_id":"near","price":"1000000000000000000000000"}' --depositYocto 1000000000000000000000000
Scheduling a call: paras-marketplace-v2.testnet.add_offer({"nft_contract_id":"paras-token-v2.testnet","token_series_id":"1","ft_token_id":"near","price":"1000000000000000000000000"}) with attached 1 NEAR
Doing account.functionCall()
Receipt: 7WjmoacGeMJfgjZtkJBkFfRCRSXVd4zPjUAbsDNihDk9
        Log [paras-marketplace-v2.testnet]: {"type":"add_offer","params":{"buyer_id":"cymac.testnet","nft_contract_id":"paras-token-v2.testnet","token_id":null,"token_series_id":"1","ft_token_id":"near","price":"1000000000000000000000000"}}
Transaction Id BCsctA75ijP7nJCoSUZ9FVosvcdtuZAkMk53i6UKWYb9
To see the transaction in the transaction explorer, please open this url in your browser
https://explorer.testnet.near.org/transactions/BCsctA75ijP7nJCoSUZ9FVosvcdtuZAkMk53i6UKWYb9
''

The second one is offer to a token id, this action is applicable to every NEP-171 NFT.

$ near call --accountId cymac.testnet paras-marketplace-v2.testnet add_offer '{"nft_contract_id":"v1.tenk.testnet","token_id":"1","ft_token_id":"near","price":"1000000000000000000000000"}' --depositYocto 1000000000000000000000000
Scheduling a call: paras-marketplace-v2.testnet.add_offer({"nft_contract_id":"v1.tenk.testnet","token_id":"1","ft_token_id":"near","price":"1000000000000000000000000"}) with attached 1 NEAR
Doing account.functionCall()
Receipt: BWUD94R3A8MnaVSAwsK9qTDsMLXtWV8H3mrZoh8dvcnA
        Log [paras-marketplace-v2.testnet]: {"type":"add_offer","params":{"buyer_id":"cymac.testnet","nft_contract_id":"v1.tenk.testnet","token_id":"1","token_series_id":null,"ft_token_id":"near","price":"1000000000000000000000000"}}
Transaction Id F6thGKv694zxYuNUgTD19pEPut4nR3dmkeLcSvjyMtAm
To see the transaction in the transaction explorer, please open this url in your browser
https://explorer.testnet.near.org/transactions/F6thGKv694zxYuNUgTD19pEPut4nR3dmkeLcSvjyMtAm
''

NOTE: add offer also requires storage deposit, the same amount like adding market data

Delete offer (token series)

pub fn delete_offer(
        &mut self,
        nft_contract_id: AccountId,
        token_id: Option<TokenId>,
        token_series_id: Option<String>,
    )
$ near call --accountId cymac.testnet paras-marketplace-v2.testnet delete_offer '{"nft_contract_id":"paras-token-v2.testne
t","token_series_id":"1"}' --depositYocto 1
Scheduling a call: paras-marketplace-v2.testnet.delete_offer({"nft_contract_id":"paras-token-v2.testnet","token_series_id":"1"}) with attached 0.000000000000000000000001 NEAR
Doing account.functionCall()
Receipts: 7BasDx67ozwqMCAmQfUoLm2NDQ4TeX4H7dNrVCfNTrER, 8m7yg9g2z1KH7WgmCtskxsayqi3xW8GWzgruT4W96o8o
        Log [paras-marketplace-v2.testnet]: {"type":"delete_offer","params":{"nft_contract_id":"paras-token-v2.testnet","buyer_id":"cymac.testnet","token_id":null,"token_series_id":"1"}}
Transaction Id FNbwmqjhvUaxSbaczooREKk7UXXZ9ZhQD2avB1HQYHAQ
To see the transaction in the transaction explorer, please open this url in your browser
https://explorer.testnet.near.org/transactions/FNbwmqjhvUaxSbaczooREKk7UXXZ9ZhQD2avB1HQYHAQ
''

Delete offer (token id)

$ near call --accountId cymac.testnet paras-marketplace-v2.testnet delete_offer '{"nft_contract_id":"v1.tenk.testnet","token_id":"1"}' --depositYocto 1
Scheduling a call: paras-marketplace-v2.testnet.delete_offer({"nft_contract_id":"v1.tenk.testnet","token_id":"1"}) with attached 0.000000000000000000000001 NEAR
Doing account.functionCall()
Retrying request to broadcast_tx_commit as it has timed out [
  'DQAAAGN5bWFjLnRlc3RuZXQAKaMKAbCqyBhfsRtKv9BhPb/xOIGEIcn6NKvet8CsX/YCsN+mYjcAABwAAABwYXJhcy1tYXJrZXRwbGFjZS12Mi50ZXN0bmV0ZfrBkJlnwstuILety0R31ZW1X0ZkJ3lGmCUE09DzmR4BAAAAAgwAAABkZWxldGVfb2ZmZXI0AAAAeyJuZnRfY29udHJhY3RfaWQiOiJ2MS50ZW5rLnRlc3RuZXQiLCJ0b2tlbl9pZCI6IjEifQDgV+tIGwAAAQAAAAAAAAAAAAAAAAAAAACHZ4FxW9JTb9S8E5/GUiLbvr2jBKapMV1pUkZXbymJbYle9mL3DHsGitEAHrnaZcgsgohigWfa41goF9nKASoG'
]
Receipts: DPfNxEBtAAEW3z9A1LKLtypF6HiUwZfeAMqexjQ2yDae, CfH218SCSm2AyZYWpwjBZZiHtLEVr3CRRcD35F66eAE5
        Log [paras-marketplace-v2.testnet]: {"type":"delete_offer","params":{"nft_contract_id":"v1.tenk.testnet","buyer_id":"cymac.testnet","token_id":"1","token_series_id":null}}
Transaction Id 6AdsyPMWSzhpL8eotuEz8EXRGTAXBdAfoZVP5H5gMhN8
To see the transaction in the transaction explorer, please open this url in your browser
https://explorer.testnet.near.org/transactions/6AdsyPMWSzhpL8eotuEz8EXRGTAXBdAfoZVP5H5gMhN8
''

View methods

Get market data

pub fn get_market_data(
        self, 
        nft_contract_id: AccountId, 
        token_id: TokenId
) -> MarketDataJson
$ near view paras-marketplace-v2.testnet get_market_data '{"nft_contract_id":"paras-token-v2.testnet","token_id":"3:1"}'
View call: paras-marketplace-v2.testnet.get_market_data({"nft_contract_id":"paras-token-v2.testnet","token_id":"3:1"})
{
  owner_id: 'cymac.testnet',
  approval_id: '4',
  nft_contract_id: 'paras-token-v2.testnet',
  token_id: '3:1',
  ft_token_id: 'near',
  price: '1000000000000000000000000',
  bids: null,
  started_at: null,
  ended_at: null,
  end_price: null,
  is_auction: null
}

Get offer

pub fn get_offer(
        &self,
        nft_contract_id: AccountId,
        buyer_id: AccountId,
        token_id: Option<TokenId>,
        token_series_id: Option<String>,
) -> OfferDataJson
$ near view paras-marketplace-v2.testnet get_offer '{"nft_contract_id":"paras-token-v2.testnet","token_series_id":"1","buyer_id":"cymac.testnet"}'
View call: paras-marketplace-v2.testnet.get_offer({"nft_contract_id":"paras-token-v2.testnet","token_series_id":"1","buyer_id":"cymac.testnet"})
{
  buyer_id: 'cymac.testnet',
  nft_contract_id: 'paras-token-v2.testnet',
  token_id: null,
  token_series_id: '1',
  ft_token_id: 'near',
  price: '1000000000000000000000000'
}
PreviousMarketplace contract function callsNextNFT smart contract integration

Last updated 3 years ago