list
Lists a token on the Mintbase market for a provided price.
The token is specified via
tokenId
as well as the nftContractId
from where the token was minted.The nftContactId can be supplied as an argument or through the
CONTRACT_ADDRESS
environment variable.Market address default values depend on the
NEAR_NETWORK
environment variable. If you set it to mainnet
you will get the mainnet address simple.market.mintbase1.near
otherwise it will default to the testnet
value market-v2-beta.mintspace2.testnet
.list
takes a single argument of type ListArgs
export type ListArgs = {
//contract to which the token belongs,
//as an argument or through CONTRACT_ADDRESS env
contractAddress: string;
//tokenId of the token to be listed
tokenId: string;
//mintbase market address where the token will be listed, this defaults to the correct value depending on the NEAR_NETWORK environment variable
marketAddress?: string;
//price to be listed for
price: string;
}
Example usage of list method in a hypothetical React component:
ListComponent.ts
1
import { useState } from 'react';
2
import { useWallet } from '@mintbase-js/react';
3
import { execute, list, ListArgs } from '@mintbase-js/sdk';
4
5
6
export const ListComponent = ({ contractAddress, marketAddress , tokenId, price }:ListArgs):JSX.Element => {
7
8
const { selector } = useWallet();
9
10
const handleList = async (): Promise<void> => {
11
const wallet = await selector.wallet();
12
13
await execute(
14
{wallet},
15
list({
16
contractAddress: nftContractId,
17
marketAddress: marketId,
18
tokenId: tokenId,
19
price: price
20
})
21
)
22
}
23
24
return (
25
<div>
26
<button onClick={handleList}>
27
DeployContract with name= {name} and owner= {owner}
28
</button>
29
</div>
30
);
31
};
Last modified 9mo ago