@opensea/sdk 13.0.6 → 14.0.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 +127 -131
- package/lib/api/api.d.ts +7 -711
- package/lib/api/api.js +6 -870
- package/lib/api/api.js.map +1 -1
- package/lib/api/collections.d.ts +3 -3
- package/lib/api/collections.js +5 -4
- package/lib/api/collections.js.map +1 -1
- package/lib/api/drops.d.ts +1 -1
- package/lib/api/drops.js +1 -1
- package/lib/api/events.js +1 -1
- package/lib/api/events.js.map +1 -1
- package/lib/api/fetcher.d.ts +1 -1
- package/lib/api/listings.d.ts +2 -3
- package/lib/api/listings.js +2 -3
- package/lib/api/listings.js.map +1 -1
- package/lib/api/nfts.d.ts +1 -1
- package/lib/api/nfts.js +1 -1
- package/lib/api/orders.d.ts +1 -1
- package/lib/api/orders.js +1 -1
- package/lib/api/tokens.js +2 -23
- package/lib/api/tokens.js.map +1 -1
- package/lib/api/types.d.ts +11 -20
- package/lib/api/walletAuth.d.ts +2 -2
- package/lib/api/walletAuth.js +2 -2
- package/lib/auth/index.d.ts +2 -2
- package/lib/auth/index.js +1 -3
- package/lib/auth/index.js.map +1 -1
- package/lib/auth/oauth.d.ts +4 -4
- package/lib/auth/oauth.js +4 -4
- package/lib/auth/siwx.d.ts +1 -8
- package/lib/auth/siwx.js +1 -1
- package/lib/auth/siwx.js.map +1 -1
- package/lib/auth/types.d.ts +0 -12
- package/lib/provider/ethers-adapter.d.ts +1 -1
- package/lib/provider/ethers-adapter.js +1 -1
- package/lib/provider/seaport-bridge.js +1 -1
- package/lib/provider/seaport-bridge.js.map +1 -1
- package/lib/provider/viem-adapter.d.ts +1 -1
- package/lib/provider/viem-adapter.js +1 -1
- package/lib/sdk/assets.d.ts +2 -2
- package/lib/sdk/assets.js +2 -2
- package/lib/sdk/base.js +2 -2
- package/lib/sdk/base.js.map +1 -1
- package/lib/sdk/cancellation.d.ts +3 -3
- package/lib/sdk/cancellation.js +6 -6
- package/lib/sdk/cancellation.js.map +1 -1
- package/lib/sdk/fulfillment.d.ts +10 -3
- package/lib/sdk/fulfillment.js +39 -8
- package/lib/sdk/fulfillment.js.map +1 -1
- package/lib/sdk/orders.d.ts +6 -6
- package/lib/sdk/orders.js +21 -21
- package/lib/sdk/orders.js.map +1 -1
- package/lib/stream/client.d.ts +2 -14
- package/lib/stream/client.js +3 -19
- package/lib/stream/client.js.map +1 -1
- package/lib/stream/types.d.ts +3 -26
- package/lib/stream/types.js +0 -8
- package/lib/stream/types.js.map +1 -1
- package/lib/types.d.ts +3 -9
- package/lib/types.js +1 -1
- package/lib/utils/address.d.ts +2 -2
- package/lib/utils/address.js +2 -2
- package/lib/utils/case.d.ts +3 -3
- package/lib/utils/case.js +1 -1
- package/lib/utils/fees.js +1 -1
- package/lib/utils/fees.js.map +1 -1
- package/lib/utils/rateLimit.d.ts +0 -11
- package/lib/utils/rateLimit.js +1 -29
- package/lib/utils/rateLimit.js.map +1 -1
- package/lib/viem.js +1 -1
- package/lib/viem.js.map +1 -1
- package/package.json +2 -2
- package/src/api/api.ts +12 -1447
- package/src/api/collections.ts +7 -4
- package/src/api/drops.ts +1 -1
- package/src/api/events.ts +1 -1
- package/src/api/fetcher.ts +1 -1
- package/src/api/listings.ts +2 -3
- package/src/api/nfts.ts +1 -1
- package/src/api/orders.ts +1 -1
- package/src/api/tokens.ts +2 -24
- package/src/api/types.ts +15 -23
- package/src/api/walletAuth.ts +2 -2
- package/src/auth/index.ts +4 -7
- package/src/auth/oauth.ts +4 -4
- package/src/auth/siwx.ts +1 -8
- package/src/auth/types.ts +0 -13
- package/src/provider/ethers-adapter.ts +1 -1
- package/src/provider/seaport-bridge.ts +1 -1
- package/src/provider/viem-adapter.ts +1 -1
- package/src/sdk/assets.ts +2 -2
- package/src/sdk/base.ts +3 -2
- package/src/sdk/cancellation.ts +6 -6
- package/src/sdk/fulfillment.ts +70 -21
- package/src/sdk/orders.ts +30 -21
- package/src/stream/client.ts +2 -26
- package/src/stream/types.ts +3 -29
- package/src/types.ts +4 -11
- package/src/utils/address.ts +2 -2
- package/src/utils/case.ts +3 -3
- package/src/utils/fees.ts +1 -1
- package/src/utils/rateLimit.ts +3 -49
- package/src/viem.ts +1 -1
- package/src/abi/ERC1155.json +0 -314
- package/src/abi/ERC20.json +0 -222
- package/src/abi/ERC721.json +0 -333
- package/src/abi/Multicall3.json +0 -50
- package/src/abi/TransferHelper.json +0 -53
package/README.md
CHANGED
|
@@ -11,19 +11,19 @@
|
|
|
11
11
|
|
|
12
12
|
# @opensea/sdk <!-- omit in toc -->
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
>
|
|
16
|
-
> Pull requests opened on the mirror cannot be merged there. They are read, and a fix worth taking is recreated in the monorepo. Because a fix that has landed internally is not public until the next release, filing an issue before writing a patch is the quickest way to find out whether a bug is already fixed.
|
|
14
|
+
TypeScript SDK for [OpenSea](https://opensea.io). Read and filter the orderbook, create and fulfill listings and offers, swap tokens across chains, and subscribe to marketplace events.
|
|
17
15
|
|
|
18
|
-
|
|
16
|
+
## Install
|
|
19
17
|
|
|
20
|
-
|
|
18
|
+
```bash
|
|
19
|
+
npm install @opensea/sdk
|
|
20
|
+
```
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
Requires Node.js 22 or newer. `ethers` ships as a dependency; install `viem` too if you use the viem entry point.
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
## Get an API key
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
For quick experiments, request a free-tier key in code. It needs no signup and expires after 7 days.
|
|
27
27
|
|
|
28
28
|
```typescript
|
|
29
29
|
import { ethers } from "ethers";
|
|
@@ -40,29 +40,80 @@ Or from the shell:
|
|
|
40
40
|
curl -s -X POST https://api.opensea.io/api/v2/auth/keys | jq -r '.api_key'
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
For production, create a permanent key at [opensea.io/settings/developer](https://opensea.io/settings/developer). These keys don't expire, get higher rate limits, and can be rotated. See the [API key docs](https://docs.opensea.io/reference/api-keys).
|
|
44
|
+
|
|
45
|
+
## Quick start
|
|
46
|
+
|
|
47
|
+
Do not ship your API key in frontend code. See [Security warning](#security-warning).
|
|
48
|
+
|
|
49
|
+
### With ethers.js
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
import { ethers } from "ethers";
|
|
53
|
+
import { OpenSeaSDK, Chain } from "@opensea/sdk";
|
|
54
|
+
|
|
55
|
+
const provider = new ethers.JsonRpcProvider("https://eth-mainnet.g.alchemy.com/v2/YOUR_ALCHEMY_API_KEY");
|
|
56
|
+
const sdk = new OpenSeaSDK(provider, { chain: Chain.Mainnet, apiKey: "YOUR_API_KEY" });
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### With viem
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
import { createPublicClient, createWalletClient, http } from 'viem'
|
|
63
|
+
import { mainnet } from 'viem/chains'
|
|
64
|
+
import { OpenSeaSDK, Chain } from '@opensea/sdk/viem'
|
|
65
|
+
|
|
66
|
+
const publicClient = createPublicClient({ chain: mainnet, transport: http() })
|
|
67
|
+
const sdk = new OpenSeaSDK({ publicClient }, { chain: Chain.Mainnet, apiKey: 'YOUR_API_KEY' })
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### With a wallet adapter
|
|
71
|
+
|
|
72
|
+
To sign with a managed wallet (Privy, Turnkey, Fireblocks, Bankr) or a raw private key, wrap a
|
|
73
|
+
[`@opensea/wallet-adapters`](https://github.com/ProjectOpenSea/wallet-adapters) adapter in its
|
|
74
|
+
ethers bridge and pass the result as the signer. Orders are signed with the adapter's
|
|
75
|
+
`signTypedData`. Fulfillments, approvals and onchain cancels go through its `sendTransaction`.
|
|
76
|
+
The provider handles reads and receipts only.
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
import { ethers } from "ethers";
|
|
80
|
+
import { OpenSeaSDK, Chain } from "@opensea/sdk";
|
|
81
|
+
import { createWalletFromEnv } from "@opensea/wallet-adapters";
|
|
82
|
+
import { walletAdapterToEthersSigner } from "@opensea/wallet-adapters/ethers";
|
|
83
|
+
|
|
84
|
+
const provider = new ethers.JsonRpcProvider("https://mainnet.base.org");
|
|
85
|
+
const signer = walletAdapterToEthersSigner(createWalletFromEnv(), provider);
|
|
86
|
+
const sdk = new OpenSeaSDK(signer, { chain: Chain.Base, apiKey: "YOUR_API_KEY" });
|
|
87
|
+
|
|
88
|
+
const listing = await sdk.createListing({
|
|
89
|
+
asset: { tokenAddress, tokenId },
|
|
90
|
+
accountAddress: await signer.getAddress(),
|
|
91
|
+
amount: "0.5",
|
|
92
|
+
});
|
|
93
|
+
```
|
|
44
94
|
|
|
45
|
-
|
|
95
|
+
Creating listings and offers requires an adapter that supports typed-data signing
|
|
96
|
+
(`wallet.capabilities.signTypedData`).
|
|
46
97
|
|
|
47
98
|
## Calling the API
|
|
48
99
|
|
|
49
|
-
`sdk.api` groups
|
|
50
|
-
`
|
|
51
|
-
`
|
|
52
|
-
`
|
|
100
|
+
`sdk.api` groups methods by domain: `accounts`, `assets`, `chains`, `collections`, `drops`,
|
|
101
|
+
`events`, `listings`, `nfts`, `offers`, `orders`, `tokens`, `tools` (beta), `transactions` and
|
|
102
|
+
`walletAuth`. For example, `sdk.api.collections.getCollection(slug)` or
|
|
103
|
+
`sdk.api.offers.getAllOffers(...)`. Search is the one flat method: `sdk.api.search(args)`.
|
|
53
104
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
[API reference](developerDocs/api-reference.md#calling-the-api)
|
|
105
|
+
Version 14 removed the older flat methods such as `sdk.api.getCollection(slug)`. Each one maps to
|
|
106
|
+
the namespaced method of the same name, except four that were renamed; see the
|
|
107
|
+
[API reference](developerDocs/api-reference.md#calling-the-api).
|
|
57
108
|
|
|
58
109
|
## Response casing
|
|
59
110
|
|
|
60
|
-
The API
|
|
61
|
-
|
|
62
|
-
|
|
111
|
+
The API uses snake_case. The SDK converts response keys to camelCase, and converts camelCase
|
|
112
|
+
request bodies and query params to snake_case. You read `collection.bannerImageUrl`; the wire
|
|
113
|
+
carries `banner_image_url`.
|
|
63
114
|
|
|
64
|
-
`@opensea/api-types` describes the wire, so its types
|
|
65
|
-
|
|
115
|
+
`@opensea/api-types` describes the wire format, so its types are snake_case. Don't use them to
|
|
116
|
+
annotate a value an SDK method returned:
|
|
66
117
|
|
|
67
118
|
```typescript
|
|
68
119
|
import type { AccountResolveResponse } from "@opensea/api-types";
|
|
@@ -72,13 +123,11 @@ const account: AccountResolveResponse = await sdk.api.accounts.resolveAccount("v
|
|
|
72
123
|
console.log(account.ens_name); // undefined; the runtime key is `ensName`
|
|
73
124
|
```
|
|
74
125
|
|
|
75
|
-
TypeScript rejects
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
`address`, has no underscore to rewrite, so nothing is missing and the camelCase keys are allowed
|
|
79
|
-
through as extras.
|
|
126
|
+
TypeScript only rejects this when the wire type has a required snake_case key somewhere in its
|
|
127
|
+
tree. `AccountResolveResponse` has one required property, `address`, which has no underscore, so
|
|
128
|
+
the camelCase object type-checks and every snake_case field is `undefined` at runtime.
|
|
80
129
|
|
|
81
|
-
|
|
130
|
+
Use the SDK's own response type, which is already camelCase:
|
|
82
131
|
|
|
83
132
|
```typescript
|
|
84
133
|
import type { ResolveAccountResponse } from "@opensea/sdk";
|
|
@@ -87,7 +136,7 @@ const account: ResolveAccountResponse = await sdk.api.accounts.resolveAccount("v
|
|
|
87
136
|
console.log(account.ensName);
|
|
88
137
|
```
|
|
89
138
|
|
|
90
|
-
Or
|
|
139
|
+
Or, for a response with no SDK alias, wrap the wire type in `Camelize`:
|
|
91
140
|
|
|
92
141
|
```typescript
|
|
93
142
|
import type { AccountResolveResponse } from "@opensea/api-types";
|
|
@@ -96,13 +145,13 @@ import type { Camelize } from "@opensea/sdk";
|
|
|
96
145
|
const account: Camelize<AccountResolveResponse> = await sdk.api.accounts.resolveAccount("vitalik.eth");
|
|
97
146
|
```
|
|
98
147
|
|
|
99
|
-
`camelizeResponse: false`
|
|
100
|
-
data rather than field names
|
|
101
|
-
|
|
102
|
-
casing.
|
|
148
|
+
Pass `camelizeResponse: false` to skip the conversion for one call. Use it when response keys are
|
|
149
|
+
data rather than field names. `getTraits`, for example, is keyed by trait names the collection
|
|
150
|
+
chose, so conversion would turn a `dark_brown` trait into `darkBrown` and merge two traits that
|
|
151
|
+
differ only in casing.
|
|
103
152
|
|
|
104
|
-
Write it as the literal `false`. `api.get`, `api.post` and `api.request`
|
|
105
|
-
|
|
153
|
+
Write it as the literal `false`. `api.get`, `api.post` and `api.request` have an overload for
|
|
154
|
+
that literal that returns the raw `T`, so the declared type matches the response:
|
|
106
155
|
|
|
107
156
|
```typescript
|
|
108
157
|
type UploadPolicy = { upload_url: string; success_action_status: string };
|
|
@@ -117,10 +166,9 @@ console.log(policy.success_action_status); // typed, and present at runtime
|
|
|
117
166
|
console.log(policy.successActionStatus);
|
|
118
167
|
```
|
|
119
168
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
type is `Camelize<T>` either way, so it claims camelCase properties the response does not have:
|
|
169
|
+
TypeScript keeps the literal only when the option is written inline at the call site or the
|
|
170
|
+
object is declared `as const`. In the cases below the runtime still skips the conversion, but the
|
|
171
|
+
declared type is `Camelize<T>`, which claims camelCase properties the response doesn't have:
|
|
124
172
|
|
|
125
173
|
```typescript
|
|
126
174
|
type UploadPolicy = { upload_url: string; success_action_status: string };
|
|
@@ -136,62 +184,12 @@ const options = { camelizeResponse: false };
|
|
|
136
184
|
await sdk.api.get<UploadPolicy>("/api/v2/some/path", undefined, options);
|
|
137
185
|
```
|
|
138
186
|
|
|
139
|
-
##
|
|
140
|
-
|
|
141
|
-
### With ethers.js
|
|
142
|
-
|
|
143
|
-
```typescript
|
|
144
|
-
import { ethers } from "ethers";
|
|
145
|
-
import { OpenSeaSDK, Chain } from "@opensea/sdk";
|
|
146
|
-
|
|
147
|
-
const provider = new ethers.JsonRpcProvider("https://eth-mainnet.g.alchemy.com/v2/YOUR_ALCHEMY_API_KEY");
|
|
148
|
-
const sdk = new OpenSeaSDK(provider, { chain: Chain.Mainnet, apiKey: "YOUR_API_KEY" });
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
### With viem
|
|
152
|
-
|
|
153
|
-
```typescript
|
|
154
|
-
import { createPublicClient, createWalletClient, http } from 'viem'
|
|
155
|
-
import { mainnet } from 'viem/chains'
|
|
156
|
-
import { OpenSeaSDK, Chain } from '@opensea/sdk/viem'
|
|
157
|
-
|
|
158
|
-
const publicClient = createPublicClient({ chain: mainnet, transport: http() })
|
|
159
|
-
const sdk = new OpenSeaSDK({ publicClient }, { chain: Chain.Mainnet, apiKey: 'YOUR_API_KEY' })
|
|
160
|
-
```
|
|
161
|
-
|
|
162
|
-
### With a wallet adapter
|
|
163
|
-
|
|
164
|
-
To sign with a managed wallet (Privy, Turnkey, Fireblocks, Bankr) or a raw private key, wrap a
|
|
165
|
-
[`@opensea/wallet-adapters`](https://github.com/ProjectOpenSea/wallet-adapters) adapter in its
|
|
166
|
-
ethers bridge and pass the result as the signer. Orders are signed through the adapter's
|
|
167
|
-
`signTypedData`, and fulfillments, approvals and onchain cancels go through its `sendTransaction`.
|
|
168
|
-
The provider is used for reads and receipts only.
|
|
169
|
-
|
|
170
|
-
```typescript
|
|
171
|
-
import { ethers } from "ethers";
|
|
172
|
-
import { OpenSeaSDK, Chain } from "@opensea/sdk";
|
|
173
|
-
import { createWalletFromEnv } from "@opensea/wallet-adapters";
|
|
174
|
-
import { walletAdapterToEthersSigner } from "@opensea/wallet-adapters/ethers";
|
|
175
|
-
|
|
176
|
-
const provider = new ethers.JsonRpcProvider("https://mainnet.base.org");
|
|
177
|
-
const signer = walletAdapterToEthersSigner(createWalletFromEnv(), provider);
|
|
178
|
-
const sdk = new OpenSeaSDK(signer, { chain: Chain.Base, apiKey: "YOUR_API_KEY" });
|
|
179
|
-
|
|
180
|
-
const listing = await sdk.createListing({
|
|
181
|
-
asset: { tokenAddress, tokenId },
|
|
182
|
-
accountAddress: await signer.getAddress(),
|
|
183
|
-
amount: "0.5",
|
|
184
|
-
});
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
The adapter has to support typed-data signing (`wallet.capabilities.signTypedData`) to create
|
|
188
|
-
listings and offers.
|
|
187
|
+
## Examples
|
|
189
188
|
|
|
190
|
-
### Wallet-authenticated API
|
|
189
|
+
### Wallet-authenticated API
|
|
191
190
|
|
|
192
|
-
For a server-side EVM signer, `OpenSeaAuth` signs in with SIWE, creates a scoped
|
|
193
|
-
|
|
194
|
-
REST and MCP.
|
|
191
|
+
For a server-side EVM signer, `OpenSeaAuth` signs in with SIWE, creates a scoped personal access
|
|
192
|
+
token (PAT), and exchanges it for the short-lived JWT that REST and MCP accept.
|
|
195
193
|
|
|
196
194
|
```typescript
|
|
197
195
|
import { Wallet } from "ethers"
|
|
@@ -214,16 +212,14 @@ try {
|
|
|
214
212
|
}
|
|
215
213
|
```
|
|
216
214
|
|
|
217
|
-
Keep the same `OpenSeaAuth` instance
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
[wallet-auth guide](https://docs.opensea.io/reference/auth).
|
|
215
|
+
Keep the same `OpenSeaAuth` instance until you revoke, because it holds the SIWE session.
|
|
216
|
+
`revoke()` takes the current JWT as a guard, revokes the PAT behind it, and clears the in-memory
|
|
217
|
+
auth state. `walletAuth` has a typed helper for every deployed scoped operation. Request only the
|
|
218
|
+
scopes the task needs. See the [wallet-auth guide](https://docs.opensea.io/reference/auth).
|
|
222
219
|
|
|
223
220
|
### Cross-chain drop minting
|
|
224
221
|
|
|
225
|
-
Build the ordered transactions
|
|
226
|
-
another through the typed API client:
|
|
222
|
+
Build the ordered transactions to pay on one chain and mint a drop on another:
|
|
227
223
|
|
|
228
224
|
```typescript
|
|
229
225
|
const mint = await sdk.api.drops.buildCrossChainMintTransactions("pyro-on-ape", {
|
|
@@ -242,7 +238,9 @@ const receipt = await sdk.api.transactions.getTransactionReceipt(mint.receiptReq
|
|
|
242
238
|
|
|
243
239
|
### Order actions on EVM and Solana
|
|
244
240
|
|
|
245
|
-
|
|
241
|
+
The action APIs return the ordered approval, signing and transaction steps a wallet needs to
|
|
242
|
+
run. On Solana, pass `svm_order.id` as the order identifier and keep base58 addresses in their
|
|
243
|
+
original case.
|
|
246
244
|
|
|
247
245
|
```typescript
|
|
248
246
|
const actions = await sdk.api.listings.createListingFulfillmentActions({
|
|
@@ -261,12 +259,13 @@ const actions = await sdk.api.listings.createListingFulfillmentActions({
|
|
|
261
259
|
// sdk.api.orders.createCancelOrderActions(protocol, orderIdentifier, request, chain)
|
|
262
260
|
```
|
|
263
261
|
|
|
264
|
-
|
|
262
|
+
Run `actions.steps` in order. If a Solana step includes a partially signed transaction or needs a
|
|
263
|
+
Jito bundle, submit it exactly as the response directs. Don't rebuild it or broadcast it through a
|
|
264
|
+
public RPC.
|
|
265
265
|
|
|
266
266
|
### Token activity stats
|
|
267
267
|
|
|
268
|
-
|
|
269
|
-
raw events:
|
|
268
|
+
Get precomputed trade count and USD volume for a token without aggregating raw events:
|
|
270
269
|
|
|
271
270
|
```typescript
|
|
272
271
|
import { Chain } from "@opensea/sdk";
|
|
@@ -281,13 +280,12 @@ console.log(activity.windows["24h"]?.trades)
|
|
|
281
280
|
console.log(activity.windows["24h"]?.volumeUsd)
|
|
282
281
|
```
|
|
283
282
|
|
|
284
|
-
|
|
285
|
-
has no swaps in that period.
|
|
283
|
+
A requested window is missing from `windows` when the token had no swaps in that period.
|
|
286
284
|
|
|
287
285
|
### Real-time events
|
|
288
286
|
|
|
289
|
-
Subscribe to marketplace events over WebSocket
|
|
290
|
-
|
|
287
|
+
Subscribe to marketplace events over WebSocket with the `@opensea/sdk/stream` subpath. Stream
|
|
288
|
+
events don't count toward your API rate limits.
|
|
291
289
|
|
|
292
290
|
```typescript
|
|
293
291
|
import { OpenSeaStreamClient, EventType } from "@opensea/sdk/stream";
|
|
@@ -312,45 +310,43 @@ client.onEvents(
|
|
|
312
310
|
unsubscribe();
|
|
313
311
|
```
|
|
314
312
|
|
|
315
|
-
|
|
316
|
-
reconnects with backoff and re-subscribes to every topic it was watching
|
|
317
|
-
dropped connection recovers without any work from you.
|
|
313
|
+
It runs in Node 22+ and browsers with no extra dependencies. After a dropped connection, the
|
|
314
|
+
client reconnects with backoff and re-subscribes to every topic it was watching.
|
|
318
315
|
|
|
319
|
-
|
|
320
|
-
[migration guide](developerDocs/stream-migration.md)
|
|
316
|
+
Before version 0.4.0 this client was published as `@opensea/stream-js`. See the
|
|
317
|
+
[migration guide](developerDocs/stream-migration.md).
|
|
321
318
|
|
|
322
319
|
## Documentation
|
|
323
320
|
|
|
324
|
-
- [Quick
|
|
325
|
-
- [Getting
|
|
326
|
-
- [API
|
|
321
|
+
- [Quick start guide](developerDocs/quick-start.md)
|
|
322
|
+
- [Getting started guide](developerDocs/getting-started.md)
|
|
323
|
+
- [API reference](developerDocs/api-reference.md)
|
|
327
324
|
- [Stream migration from @opensea/stream-js](developerDocs/stream-migration.md)
|
|
328
|
-
- [Advanced
|
|
329
|
-
- [
|
|
325
|
+
- [Advanced use cases](developerDocs/advanced-use-cases.md)
|
|
326
|
+
- [FAQ](developerDocs/faq.md)
|
|
330
327
|
- [Contributing](CONTRIBUTING.md)
|
|
331
328
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
**Do not use this SDK directly in client-side/frontend applications.**
|
|
335
|
-
|
|
336
|
-
The OpenSea SDK requires an API key for initialization. If you embed your API key in frontend code (e.g., browser applications, mobile apps), it will be publicly exposed and could be extracted by anyone, leading to potential abuse and rate limit issues.
|
|
329
|
+
## Security warning
|
|
337
330
|
|
|
338
|
-
|
|
331
|
+
Don't use this SDK in frontend code. It needs your API key, and anyone can extract a key embedded
|
|
332
|
+
in a browser or mobile app, then abuse it or burn through your rate limit.
|
|
339
333
|
|
|
340
|
-
For frontend
|
|
334
|
+
For a frontend app:
|
|
341
335
|
|
|
342
|
-
1.
|
|
343
|
-
2.
|
|
344
|
-
3.
|
|
345
|
-
4.
|
|
336
|
+
1. Run your own backend that stores the API key.
|
|
337
|
+
2. Call `@opensea/sdk` from that backend.
|
|
338
|
+
3. Return what the frontend needs, such as transaction parameters.
|
|
339
|
+
4. Have users sign transactions in the browser with their own wallet (for example, MetaMask).
|
|
346
340
|
|
|
347
341
|
## Changelog
|
|
348
342
|
|
|
349
|
-
The changelog for recent versions can be found at:
|
|
350
|
-
|
|
351
343
|
- @opensea/sdk: https://github.com/ProjectOpenSea/opensea-sdk/releases
|
|
352
344
|
- OpenSea API: https://docs.opensea.io/changelog
|
|
353
345
|
|
|
346
|
+
## Contributing
|
|
347
|
+
|
|
348
|
+
Read-only mirror of a private monorepo, updated on each release. Pull requests are welcome, and we bring accepted changes into the monorepo.
|
|
349
|
+
|
|
354
350
|
## Security
|
|
355
351
|
|
|
356
352
|
Found a vulnerability? Report it through OpenSea's Bugcrowd program at https://bugcrowd.com/engagements/opensea rather than opening a public issue. See [SECURITY.md](SECURITY.md).
|