listToken
This action is used to list an ERC-1155 or ERC-721 token. You can also use this action to list to multiple exchanges/marketplaces.
You can supply an object of parameters listed below:
Parameter | Description | Required | Example |
---|---|---|---|
listings | An array of objects representing listings, mapping directly to the params property from the execute list api. | true | [{ token: "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d:0", weiPrice: 10000000000000000, orderbook: "reservoir", orderKind: "seaport-v1.4", expirationTime: 1667403808616 }] |
signer | A valid signer from ethers. | true | Refer to ethers documentation on signers Note: if you're using the SDK on the server refer to the docs on how to create a signer. |
onProgress | Callback to update UI state as execution progresses. Can also be used to get the transaction hash for a given step item. | true | (steps) => { console.log(steps) } |
precheck | A boolean indicating whether to just get back the steps and not to execute them. This is useful for checking if marketplace approval is required before iterating over the steps. | false | false |
Example
import { getClient, Execute } from "@reservoir0x/reservoir-sdk";
import { ethers } from "ethers";
...
address = "0x8ba1f109551bD432803012645Ac136ddd64DBA72"
signer = new ethers.VoidSigner(address, provider)
getClient()?.actions.listToken({
listings: [{
token: "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d:0",
weiPrice: 10000000000000000,
orderbook: "reservoir",
orderKind: "seaport-v1.4",
expirationTime: 1667403808616
}],
signer,
onProgress: (steps: Execute['steps']) => {
console.log(steps)
}
})
Updated over 1 year ago