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.
1
$ near view paras-marketplace-v2.testnet storage_minimum_balance
2
View call: paras-marketplace-v2.testnet.storage_minimum_balance()
3
'8590000000000000000000'
Copied!

Add storage deposit

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

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.
1
fn nft_approve(
2
&mut self,
3
token_id: TokenId,
4
account_id: AccountId,
5
msg: Option<String>,
6
) -> Option<Promise>
Copied!
1
$ 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
2
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
3
Doing account.functionCall()
4
Receipt: CxkeuWLGB3EYcT4XKdsZhPP8xPKWnEwXs7aJEsFioYVH
5
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}}
6
Transaction Id Arfowjafoim9BCvkhokyV3MA4RdhAkpsSq131RG3cQFB
7
To see the transaction in the transaction explorer, please open this url in your browser
8
https://explorer.testnet.near.org/transactions/Arfowjafoim9BCvkhokyV3MA4RdhAkpsSq131RG3cQFB
9
''
Copied!

Delete market data

1
pub fn delete_market_data(
2
&mut self,
3
nft_contract_id: AccountId,
4
token_id: TokenId
5
)
Copied!
1
$ 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
2
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
3
Doing account.functionCall()
4
Receipt: FvviX9cEPssMS5hnry7f2yNof1T7KVQnuWid9oX2p2mJ
5
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"}}
6
Transaction Id 5ZDf1Py7jp25ZdQgZtKHT2AgBmGDjFfeuZzLTdVnLSzT
7
To see the transaction in the transaction explorer, please open this url in your browser
8
https://explorer.testnet.near.org/transactions/5ZDf1Py7jp25ZdQgZtKHT2AgBmGDjFfeuZzLTdVnLSzT
9
''
Copied!

Buy

1
pub fn buy(
2
&mut self,
3
nft_contract_id: AccountId,
4
token_id: TokenId
5
)
Copied!
1
$ 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
2
Scheduling a call: paras-marketplace-v2.testnet.buy({"nft_contract_id":"paras-token-v2.testnet","token_id":"3:1"}) with attached 1 NEAR
3
Doing account.functionCall()
4
Retrying request to broadcast_tx_commit as it has timed out [
5
'DQAAAGN5bWFjLnRlc3RuZXQAKaMKAbCqyBhfsRtKv9BhPb/xOIGEIcn6NKvet8CsX/b4r9+mYjcAABwAAABwYXJhcy1tYXJrZXRwbGFjZS12Mi50ZXN0bmV0LI/Djpoo6R9/x34NDFlIgpctSiwuW968dkvJegSiHFQBAAAAAgMAAABidXk9AAAAeyJuZnRfY29udHJhY3RfaWQiOiJwYXJhcy10b2tlbi12Mi50ZXN0bmV0IiwidG9rZW5faWQiOiIzOjEifQDAbjHZEAEAAAAAoe3MzhvC0wAAAAAAAABHFQRaDCKgLlrWM2bTqCzG8CTXKW0nKhL4OZYQgoQi15x7A+eIffx2sznfXV162FznK3SplAAdapRC88sQf68A'
6
]
7
Receipt: Est2KFQzLE7iXw23Eu5X5fZ9ewD9JAZM4BtLCbNhcsQW
8
Log [paras-marketplace-v2.testnet]: Transfer 3:1 from paras-marketplace-v2.testnet to cymac.testnet
9
Log [paras-marketplace-v2.testnet]: {"type":"nft_transfer","params":{"token_id":"3:1","sender_id":"projectp.testnet","receiver_id":"cymac.testnet"}}
10
Receipts: 4bemvM8seToCEEDcEBW1ZLZQGEXs38vbU9eTdcdKSPwj, Xme8x7ChmGnto1csvgBpqLo7KE5KgmD7ctJtnqjKQk6, 7MeUE7Jb7oeQzkBVS6uczpmomRSZJxjXkDJbvV7UEfTs
11
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"}}
12
Transaction Id Ebx9RHDmnTg5xc8VthtdwdEx5aq6kMfj9RCLCYwaChay
13
To see the transaction in the transaction explorer, please open this url in your browser
14
https://explorer.testnet.near.org/transactions/Ebx9RHDmnTg5xc8VthtdwdEx5aq6kMfj9RCLCYwaChay
15
''
Copied!

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.
1
pub fn add_offer(
2
&mut self,
3
nft_contract_id: AccountId,
4
token_id: Option<TokenId>,
5
token_series_id: Option<String>,
6
ft_token_id: AccountId,
7
price: U128,
8
)
Copied!
1
$ 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
2
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
3
Doing account.functionCall()
4
Receipt: 7WjmoacGeMJfgjZtkJBkFfRCRSXVd4zPjUAbsDNihDk9
5
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"}}
6
Transaction Id BCsctA75ijP7nJCoSUZ9FVosvcdtuZAkMk53i6UKWYb9
7
To see the transaction in the transaction explorer, please open this url in your browser
8
https://explorer.testnet.near.org/transactions/BCsctA75ijP7nJCoSUZ9FVosvcdtuZAkMk53i6UKWYb9
9
''
Copied!
The second one is offer to a token id, this action is applicable to every NEP-171 NFT.
1
$ 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
2
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
3
Doing account.functionCall()
4
Receipt: BWUD94R3A8MnaVSAwsK9qTDsMLXtWV8H3mrZoh8dvcnA
5
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"}}
6
Transaction Id F6thGKv694zxYuNUgTD19pEPut4nR3dmkeLcSvjyMtAm
7
To see the transaction in the transaction explorer, please open this url in your browser
8
https://explorer.testnet.near.org/transactions/F6thGKv694zxYuNUgTD19pEPut4nR3dmkeLcSvjyMtAm
9
''
Copied!
NOTE: add offer also requires storage deposit, the same amount like adding market data

Delete offer (token series)

1
pub fn delete_offer(
2
&mut self,
3
nft_contract_id: AccountId,
4
token_id: Option<TokenId>,
5
token_series_id: Option<String>,
6
)
Copied!
1
$ near call --accountId cymac.testnet paras-marketplace-v2.testnet delete_offer '{"nft_contract_id":"paras-token-v2.testne
2
t","token_series_id":"1"}' --depositYocto 1
3
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
4
Doing account.functionCall()
5
Receipts: 7BasDx67ozwqMCAmQfUoLm2NDQ4TeX4H7dNrVCfNTrER, 8m7yg9g2z1KH7WgmCtskxsayqi3xW8GWzgruT4W96o8o
6
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"}}
7
Transaction Id FNbwmqjhvUaxSbaczooREKk7UXXZ9ZhQD2avB1HQYHAQ
8
To see the transaction in the transaction explorer, please open this url in your browser
9
https://explorer.testnet.near.org/transactions/FNbwmqjhvUaxSbaczooREKk7UXXZ9ZhQD2avB1HQYHAQ
10
''
Copied!

Delete offer (token id)

1
$ near call --accountId cymac.testnet paras-marketplace-v2.testnet delete_offer '{"nft_contract_id":"v1.tenk.testnet","token_id":"1"}' --depositYocto 1
2
Scheduling a call: paras-marketplace-v2.testnet.delete_offer({"nft_contract_id":"v1.tenk.testnet","token_id":"1"}) with attached 0.000000000000000000000001 NEAR
3
Doing account.functionCall()
4
Retrying request to broadcast_tx_commit as it has timed out [
5
'DQAAAGN5bWFjLnRlc3RuZXQAKaMKAbCqyBhfsRtKv9BhPb/xOIGEIcn6NKvet8CsX/YCsN+mYjcAABwAAABwYXJhcy1tYXJrZXRwbGFjZS12Mi50ZXN0bmV0ZfrBkJlnwstuILety0R31ZW1X0ZkJ3lGmCUE09DzmR4BAAAAAgwAAABkZWxldGVfb2ZmZXI0AAAAeyJuZnRfY29udHJhY3RfaWQiOiJ2MS50ZW5rLnRlc3RuZXQiLCJ0b2tlbl9pZCI6IjEifQDgV+tIGwAAAQAAAAAAAAAAAAAAAAAAAACHZ4FxW9JTb9S8E5/GUiLbvr2jBKapMV1pUkZXbymJbYle9mL3DHsGitEAHrnaZcgsgohigWfa41goF9nKASoG'
6
]
7
Receipts: DPfNxEBtAAEW3z9A1LKLtypF6HiUwZfeAMqexjQ2yDae, CfH218SCSm2AyZYWpwjBZZiHtLEVr3CRRcD35F66eAE5
8
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}}
9
Transaction Id 6AdsyPMWSzhpL8eotuEz8EXRGTAXBdAfoZVP5H5gMhN8
10
To see the transaction in the transaction explorer, please open this url in your browser
11
https://explorer.testnet.near.org/transactions/6AdsyPMWSzhpL8eotuEz8EXRGTAXBdAfoZVP5H5gMhN8
12
''
Copied!

View methods

Get market data

1
pub fn get_market_data(
2
self,
3
nft_contract_id: AccountId,
4
token_id: TokenId
5
) -> MarketDataJson
Copied!
1
$ near view paras-marketplace-v2.testnet get_market_data '{"nft_contract_id":"paras-token-v2.testnet","token_id":"3:1"}'
2
View call: paras-marketplace-v2.testnet.get_market_data({"nft_contract_id":"paras-token-v2.testnet","token_id":"3:1"})
3
{
4
owner_id: 'cymac.testnet',
5
approval_id: '4',
6
nft_contract_id: 'paras-token-v2.testnet',
7
token_id: '3:1',
8
ft_token_id: 'near',
9
price: '1000000000000000000000000',
10
bids: null,
11
started_at: null,
12
ended_at: null,
13
end_price: null,
14
is_auction: null
15
}
Copied!

Get offer

1
pub fn get_offer(
2
&self,
3
nft_contract_id: AccountId,
4
buyer_id: AccountId,
5
token_id: Option<TokenId>,
6
token_series_id: Option<String>,
7
) -> OfferDataJson
Copied!
1
$ near view paras-marketplace-v2.testnet get_offer '{"nft_contract_id":"paras-token-v2.testnet","token_series_id":"1","buyer_id":"cymac.testnet"}'
2
View call: paras-marketplace-v2.testnet.get_offer({"nft_contract_id":"paras-token-v2.testnet","token_series_id":"1","buyer_id":"cymac.testnet"})
3
{
4
buyer_id: 'cymac.testnet',
5
nft_contract_id: 'paras-token-v2.testnet',
6
token_id: null,
7
token_series_id: '1',
8
ft_token_id: 'near',
9
price: '1000000000000000000000000'
10
}
Copied!