acceptOffer
This action is used to accept a valid offer/bid.
You can supply an object of parameters listed below:
Parameter | Description | Required | Example |
---|---|---|---|
items | An array of objects representing orders to be purchased. Refer to the the execute sell api for a full list of parameters. | true | { token:"0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d:1" } |
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) } |
expectedPrice | Token price used to prevent to protect buyer from price moves. | false | 1.543 |
options | Supports all of the parameters allowed in the execute sell api | false | { source: 'opensea.io' ... } |
Example
import { getClient, Execute } from "@reservoir0x/reservoir-sdk";
import { ethers } from "ethers";
...
address = "0x8ba1f109551bD432803012645Ac136ddd64DBA72"
signer = new ethers.VoidSigner(address, provider)
getClient()?.actions.acceptOffer({
items: [{
token: "0xbc4ca0eda7647a8ab7c2061c2e118a18a936f13d:1",
quantity: 1
}],
signer,
onProgress: (steps: Execute['steps']) => {
console.log(steps)
}
})
Updated over 1 year ago