Skip to content

Commit

Permalink
improve/update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanio committed Oct 13, 2023
1 parent 8aeaced commit de0b804
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

This is the JavaScript SDK for [OpenSea](https://opensea.io), the largest marketplace for NFTs.

It allows developers to access the official orderbook, filter it, create buy orders (**offers**), create sell orders (**listings**), and complete trades programmatically.
It allows developers to access the official orderbook, filter it, create listings and offers, and complete trades programmatically.

Get started by [requesting an API key](https://docs.opensea.io/reference/api-keys) and instantiating your own OpenSea SDK instance. Then you can create orders off-chain or fulfill orders on-chain, and listen to events (like `ApproveAllAssets` or `WrapEth`) in the process.

Expand Down
2 changes: 1 addition & 1 deletion developerDocs/advanced-use-cases.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ await openseaSDK.fulfillOrder({
})
```

If the order is a sell order (`order.side === "ask"`), the taker is the _buyer_ and this will prompt the buyer to pay for the item(s) but send them to the `recipientAddress`. If the order is a buy order ( `"bid"`), the taker is the _seller_ but the bid amount be sent to the `recipientAddress`.
If the order is a listing (sell order, `order.side === "ask"`), the taker is the _buyer_ and this will prompt the buyer to pay for the item(s) but send them to the `recipientAddress`. If the order is an offer (buy order, `"bid"`), the taker is the _seller_ but the bid amount be sent to the `recipientAddress`.

This will automatically approve the assets for trading and confirm the transaction for sending them.

Expand Down
12 changes: 6 additions & 6 deletions developerDocs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ When you make an offer on an item owned by an OpenSea user, **that user will aut

#### Offer Limits

Note: The total value of buy orders must not exceed 1000x wallet balance.
Note: The total value of offers must not exceed 1000x wallet balance.

### Making Listings / Selling Items

Expand Down Expand Up @@ -146,15 +146,15 @@ const { orders, count } = await openseaSDK.api.getOrders(
);
```

Note that the listing price of an asset is equal to the `currentPrice` of the **lowest valid sell order** on the asset. Users can lower their listing price without invalidating previous sell orders, so all get shipped down until they're canceled, or one is fulfilled.
Note that the listing price of an asset is equal to the `currentPrice` of the **lowest listing** on the asset. Users can lower their listing price without invalidating previous listing, so all get shipped down until they're canceled, or one is fulfilled.

To learn more about signatures, makers, takers, listingTime vs createdTime and other kinds of order terminology, please read the [**Terminology Section**](https://docs.opensea.io/reference#terminology) of the API Docs.

The available API filters for the orders endpoint is documented in the `OrdersQueryOptions` interface. See the main [API Docs](https://docs.opensea.io/reference#reference-getting-started) for a playground, along with more up-to-date and detailed explanations.

### Buying Items

To buy an item, you need to **fulfill a sell order**. To do that, it's just one call:
To buy an item, you need to **fulfill a listing**. To do that, it's just one call:

```typescript
const order = await openseaSDK.api.getOrder({ side: "ask", ... })
Expand All @@ -164,16 +164,16 @@ const transactionHash = await openseaSDK.fulfillOrder({ order, accountAddress })

Note that the `fulfillOrder` promise resolves when the transaction has been confirmed and mined to the blockchain. To get the transaction hash before this happens, add an event listener (see [Listening to Events](#listening-to-events)) for the `TransactionCreated` event.

If the order is a sell order (`order.side === "ask"`), the taker is the _buyer_ and this will prompt the buyer to pay for the item(s).
If the order is a listing (sell order, `order.side === "ask"`), the taker is the _buyer_ and this will prompt the buyer to pay for the item(s).

### Accepting Offers

Similar to fulfilling sell orders above, you need to fulfill a buy order on an item you own to receive the tokens in the offer.
Similar to fulfilling listings above, you need to fulfill an offer (buy order) on an item you own to receive the tokens in the offer.

```typescript
const order = await openseaSDK.api.getOrder({ side: "bid", ... })
const accountAddress = "0x..." // The owner's wallet address, also the taker
await openseaSDK.fulfillOrder({ order, accountAddress })
```

If the order is a buy order (`order.side === "bid"`), then the taker is the _owner_ and this will prompt the owner to exchange their item(s) for whatever is being offered in return. See [Listening to Events](#listening-to-events) below to respond to the setup transactions that occur the first time a user accepts a bid.
If the order is an offer (buy order, `order.side === "bid"`), then the taker is the _owner_ and this will prompt the owner to exchange their item(s) for whatever is being offered in return. See [Listening to Events](#listening-to-events) below to respond to the setup transactions that occur the first time a user accepts a bid.
2 changes: 1 addition & 1 deletion developerDocs/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ hidden: false

This is the JavaScript SDK for [OpenSea](https://opensea.io), the largest marketplace for NFTs.

It allows developers to access the official orderbook, filter it, create buy orders (**offers**), create sell orders (**listings**), and complete trades programmatically.
It allows developers to access the official orderbook, filter it, create offers and listings, and complete trades programmatically.

Get started by [requesting an API key](https://docs.opensea.io/reference/api-keys) and instantiating your own OpenSea SDK instance. Then you can create orders off-chain or fulfill orders on-chain, and listen to events in the process.

Expand Down
6 changes: 3 additions & 3 deletions src/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export class OpenSeaSDK {

/**
* Wrap ETH into WETH.
* W-ETH is needed for placing buy orders (making offers).
* W-ETH is needed for making offers.
* @param options
* @param options.amountInEth Amount of ether to wrap
* @param options.accountAddress Address of the user's wallet containing the ether
Expand Down Expand Up @@ -337,7 +337,7 @@ export class OpenSeaSDK {
* Create and submit an offer on an asset.
* @param options
* @param options.asset The asset to trade. tokenAddress and tokenId must be defined.
* @param options.accountAddress Address of the wallet making the buy order
* @param options.accountAddress Address of the wallet making the offer.
* @param options.startAmount Value of the offer in units, not base units e.g. not wei, of the payment token (or WETH if no payment token address specified)
* @param options.quantity The number of assets to bid for (if fungible or semi-fungible). Defaults to 1.
* @param options.domain An optional domain to be hashed and included in the first four bytes of the random salt.
Expand Down Expand Up @@ -435,7 +435,7 @@ export class OpenSeaSDK {
* Create and submit a listing for an asset.
* @param options
* @param options.asset The asset to trade. tokenAddress and tokenId must be defined.
* @param options.accountAddress Address of the wallet making the sell order
* @param options.accountAddress Address of the wallet making the listing
* @param options.startAmount Value of the listing at the start of the auction in units, not base units e.g. not wei, of the payment token (or WETH if no payment token address specified)
* @param options.endAmount Value of the listing at the end of the auction. If specified, price will change linearly between startAmount and endAmount as time progresses.
* @param options.quantity The number of assets to list (if fungible or semi-fungible). Defaults to 1.
Expand Down
10 changes: 5 additions & 5 deletions test/integration/postOrder.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { OFFER_AMOUNT } from "../utils/constants";
import { expectValidOrder } from "../utils/utils";

suite("SDK: order posting", () => {
test("Post Buy Order - Mainnet", async () => {
test("Post Offer - Mainnet", async () => {
const offer = {
accountAddress: walletAddress,
startAmount: +OFFER_AMOUNT,
Expand All @@ -33,7 +33,7 @@ suite("SDK: order posting", () => {
expect(orderUsingAlias).to.deep.equal(order);
});

test("Post Buy Order - Polygon", async () => {
test("Post Offer - Polygon", async () => {
const offer = {
accountAddress: walletAddress,
startAmount: +OFFER_AMOUNT,
Expand All @@ -46,7 +46,7 @@ suite("SDK: order posting", () => {
expectValidOrder(order);
});

test("Post Sell Order - Mainnet", async function () {
test("Post Listing - Mainnet", async function () {
if (!TOKEN_ADDRESS_MAINNET || !TOKEN_ID_MAINNET) {
this.skip();
}
Expand All @@ -66,7 +66,7 @@ suite("SDK: order posting", () => {
expect(orderUsingAlias).to.deep.equal(order);
});

test("Post Auction Sell Order - Mainnet", async function () {
test("Post English Auction Listing - Mainnet", async function () {
if (!TOKEN_ADDRESS_MAINNET || !TOKEN_ID_MAINNET) {
this.skip();
}
Expand Down Expand Up @@ -95,7 +95,7 @@ suite("SDK: order posting", () => {
}
});

test("Post Sell Order - Polygon", async function () {
test("Post Listing - Polygon", async function () {
if (!TOKEN_ADDRESS_POLYGON || !TOKEN_ID_POLYGON) {
this.skip();
}
Expand Down

0 comments on commit de0b804

Please sign in to comment.