@opensea/sdk 12.3.0 → 12.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -26,8 +26,10 @@ Get started by getting an API key and instantiating your own OpenSea SDK instanc
26
26
  **For quick experimentation** — request a free-tier key in code, no signup needed. The returned key is valid for 7 days.
27
27
 
28
28
  ```typescript
29
- import { OpenSeaSDK } from "@opensea/sdk";
29
+ import { ethers } from "ethers";
30
+ import { OpenSeaSDK, Chain } from "@opensea/sdk";
30
31
 
32
+ const provider = new ethers.JsonRpcProvider("https://eth-mainnet.g.alchemy.com/v2/YOUR_ALCHEMY_API_KEY");
31
33
  const { apiKey } = await OpenSeaSDK.requestInstantApiKey();
32
34
  const sdk = new OpenSeaSDK(provider, { chain: Chain.Mainnet, apiKey });
33
35
  ```
@@ -42,6 +44,17 @@ curl -s -X POST https://api.opensea.io/api/v2/auth/keys | jq -r '.api_key'
42
44
 
43
45
  Happy seafaring!
44
46
 
47
+ ## Calling the API
48
+
49
+ `sdk.api` groups its methods by domain: `sdk.api.collections.getCollection(slug)`,
50
+ `sdk.api.nfts.getNFT(...)`, `sdk.api.offers.getAllOffers(...)`, and so on across `accounts`,
51
+ `assets`, `chains`, `drops`, `events`, `listings`, `orders`, `tokens`, `transactions` and
52
+ `walletAuth`. Search stays flat as `sdk.api.search(args)`.
53
+
54
+ The older flat methods (`sdk.api.getCollection(slug)`) still work, carry `@deprecated` tags naming
55
+ their replacements, and are removed in the next major. See the
56
+ [API reference](developerDocs/api-reference.md#calling-the-api) for the four whose names change.
57
+
45
58
  ## Quick Start
46
59
 
47
60
  ### With ethers.js
@@ -104,7 +117,7 @@ Build the ordered transactions for paying on one chain and minting a drop on
104
117
  another through the typed API client:
105
118
 
106
119
  ```typescript
107
- const mint = await sdk.api.buildCrossChainDropMintTransactions("pyro-on-ape", {
120
+ const mint = await sdk.api.drops.buildCrossChainMintTransactions("pyro-on-ape", {
108
121
  payer: "0x1111111111111111111111111111111111111111",
109
122
  minter: "0x1111111111111111111111111111111111111111",
110
123
  quantity: 1,
@@ -115,7 +128,7 @@ const mint = await sdk.api.buildCrossChainDropMintTransactions("pyro-on-ape", {
115
128
  })
116
129
 
117
130
  // Submit mint.transactions in order, then poll the exact returned request.
118
- const receipt = await sdk.api.getTransactionReceipt(mint.receiptRequest)
131
+ const receipt = await sdk.api.transactions.getTransactionReceipt(mint.receiptRequest)
119
132
  ```
120
133
 
121
134
  ### Order actions on EVM and Solana
@@ -123,7 +136,7 @@ const receipt = await sdk.api.getTransactionReceipt(mint.receiptRequest)
123
136
  Use the typed action APIs when a wallet needs ordered approval, signing, or transaction steps. Solana callers should pass `svm_order.id` as the order identifier and preserve base58 address casing.
124
137
 
125
138
  ```typescript
126
- const actions = await sdk.api.createListingFulfillmentActions({
139
+ const actions = await sdk.api.listings.createListingFulfillmentActions({
127
140
  listing: {
128
141
  hash: "<svm_order.id>",
129
142
  chain: "solana",
@@ -134,9 +147,9 @@ const actions = await sdk.api.createListingFulfillmentActions({
134
147
  })
135
148
 
136
149
  // Also available:
137
- // sdk.api.createOfferActions(request)
138
- // sdk.api.createOfferFulfillmentActions(request)
139
- // sdk.api.createCancelOrderActions(protocol, orderIdentifier, request, chain)
150
+ // sdk.api.offers.createOfferActions(request)
151
+ // sdk.api.offers.createOfferFulfillmentActions(request)
152
+ // sdk.api.orders.createCancelOrderActions(protocol, orderIdentifier, request, chain)
140
153
  ```
141
154
 
142
155
  Execute `actions.steps` in order. If a Solana action includes a partially signed transaction or requires a Jito bundle, submit it exactly as directed by the response rather than rebuilding or broadcasting it through a public RPC.
@@ -147,7 +160,9 @@ Read materialized trade count and USD volume for a token without aggregating
147
160
  raw events:
148
161
 
149
162
  ```typescript
150
- const activity = await sdk.api.getTokenActivityStats(
163
+ import { Chain } from "@opensea/sdk";
164
+
165
+ const activity = await sdk.api.tokens.getTokenActivityStats(
151
166
  Chain.Base,
152
167
  "0x4200000000000000000000000000000000000006",
153
168
  { windows: ["1h", "24h"] },