@opensea/sdk 13.0.3 → 13.0.4
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 +28 -0
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -159,6 +159,34 @@ const publicClient = createPublicClient({ chain: mainnet, transport: http() })
|
|
|
159
159
|
const sdk = new OpenSeaSDK({ publicClient }, { chain: Chain.Mainnet, apiKey: 'YOUR_API_KEY' })
|
|
160
160
|
```
|
|
161
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.
|
|
189
|
+
|
|
162
190
|
### Wallet-authenticated API helpers
|
|
163
191
|
|
|
164
192
|
For a server-side EVM signer, `OpenSeaAuth` signs in with SIWE, creates a scoped
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opensea/sdk",
|
|
3
|
-
"version": "13.0.
|
|
3
|
+
"version": "13.0.4",
|
|
4
4
|
"description": "TypeScript SDK for the OpenSea marketplace helps developers build new experiences using NFTs, tokens, and our marketplace data",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "OpenSea Developers",
|
|
@@ -60,6 +60,7 @@
|
|
|
60
60
|
}
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
+
"@opensea/wallet-adapters": "^1.2.3",
|
|
63
64
|
"@types/node": "^25.4.0",
|
|
64
65
|
"@vitest/coverage-v8": "^3.2.4",
|
|
65
66
|
"concurrently": "^9.2.1",
|