@opensea/sdk 9.0.0 → 10.0.0
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 +25 -4
- package/lib/abi/abis.d.ts +301 -0
- package/lib/abi/abis.js +231 -0
- package/lib/abi/abis.js.map +1 -0
- package/lib/api/api.d.ts +6 -1
- package/lib/api/api.js +60 -51
- package/lib/api/api.js.map +1 -1
- package/lib/api/orders.js +2 -2
- package/lib/api/orders.js.map +1 -1
- package/lib/constants.d.ts +2 -2
- package/lib/constants.js +7 -4
- package/lib/constants.js.map +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/orders/privateListings.js +2 -2
- package/lib/orders/privateListings.js.map +1 -1
- package/lib/orders/utils.js +9 -1
- package/lib/orders/utils.js.map +1 -1
- package/lib/provider/ethers-adapter.d.ts +17 -0
- package/lib/provider/ethers-adapter.js +135 -0
- package/lib/provider/ethers-adapter.js.map +1 -0
- package/lib/provider/seaport-bridge.d.ts +11 -0
- package/lib/provider/seaport-bridge.js +130 -0
- package/lib/provider/seaport-bridge.js.map +1 -0
- package/lib/provider/types.d.ts +62 -0
- package/lib/provider/types.js +7 -0
- package/lib/provider/types.js.map +1 -0
- package/lib/provider/viem-adapter.d.ts +27 -0
- package/lib/provider/viem-adapter.js +122 -0
- package/lib/provider/viem-adapter.js.map +1 -0
- package/lib/sdk/assets.d.ts +7 -23
- package/lib/sdk/assets.js +101 -77
- package/lib/sdk/assets.js.map +1 -1
- package/lib/sdk/base.d.ts +334 -0
- package/lib/sdk/base.js +312 -0
- package/lib/sdk/base.js.map +1 -0
- package/lib/sdk/cancellation.d.ts +1 -2
- package/lib/sdk/cancellation.js +4 -4
- package/lib/sdk/cancellation.js.map +1 -1
- package/lib/sdk/context.d.ts +5 -5
- package/lib/sdk/fulfillment.d.ts +13 -58
- package/lib/sdk/fulfillment.js +16 -58
- package/lib/sdk/fulfillment.js.map +1 -1
- package/lib/sdk/orders.d.ts +25 -26
- package/lib/sdk/orders.js +8 -9
- package/lib/sdk/orders.js.map +1 -1
- package/lib/sdk/tokens.d.ts +3 -3
- package/lib/sdk/tokens.js +17 -7
- package/lib/sdk/tokens.js.map +1 -1
- package/lib/sdk.d.ts +16 -550
- package/lib/sdk.js +35 -663
- package/lib/sdk.js.map +1 -1
- package/lib/types.d.ts +11 -6
- package/lib/types.js +3 -3
- package/lib/types.js.map +1 -1
- package/lib/utils/address.d.ts +12 -0
- package/lib/utils/address.js +39 -0
- package/lib/utils/address.js.map +1 -0
- package/lib/utils/chain.d.ts +1 -1
- package/lib/utils/fees.d.ts +5 -0
- package/lib/utils/fees.js +24 -6
- package/lib/utils/fees.js.map +1 -1
- package/lib/utils/protocol.js +5 -5
- package/lib/utils/protocol.js.map +1 -1
- package/lib/utils/units.d.ts +12 -0
- package/lib/utils/units.js +43 -0
- package/lib/utils/units.js.map +1 -0
- package/lib/utils/utils.d.ts +2 -10
- package/lib/utils/utils.js +2 -17
- package/lib/utils/utils.js.map +1 -1
- package/lib/viem.d.ts +44 -0
- package/lib/viem.js +114 -0
- package/lib/viem.js.map +1 -0
- package/package.json +25 -8
- package/src/abi/abis.ts +236 -0
- package/src/api/api.ts +66 -59
- package/src/api/orders.ts +2 -2
- package/src/constants.ts +7 -3
- package/src/index.ts +8 -0
- package/src/orders/privateListings.ts +2 -2
- package/src/orders/utils.ts +8 -1
- package/src/provider/ethers-adapter.ts +182 -0
- package/src/provider/seaport-bridge.ts +163 -0
- package/src/provider/types.ts +67 -0
- package/src/provider/viem-adapter.ts +165 -0
- package/src/sdk/assets.ts +128 -158
- package/src/sdk/base.ts +558 -0
- package/src/sdk/cancellation.ts +6 -9
- package/src/sdk/context.ts +5 -5
- package/src/sdk/fulfillment.ts +31 -72
- package/src/sdk/orders.ts +44 -44
- package/src/sdk/tokens.ts +18 -18
- package/src/sdk.ts +40 -1011
- package/src/types.ts +12 -6
- package/src/utils/address.ts +40 -0
- package/src/utils/fees.ts +28 -8
- package/src/utils/protocol.ts +5 -5
- package/src/utils/units.ts +47 -0
- package/src/utils/utils.ts +2 -22
- package/src/viem.ts +125 -0
- package/lib/src/api/accounts.d.ts +0 -18
- package/lib/src/api/accounts.js +0 -30
- package/lib/src/api/accounts.js.map +0 -1
- package/lib/src/api/api.d.ts +0 -429
- package/lib/src/api/api.js +0 -652
- package/lib/src/api/api.js.map +0 -1
- package/lib/src/api/apiPaths.d.ts +0 -37
- package/lib/src/api/apiPaths.js +0 -140
- package/lib/src/api/apiPaths.js.map +0 -1
- package/lib/src/api/collections.d.ts +0 -26
- package/lib/src/api/collections.js +0 -57
- package/lib/src/api/collections.js.map +0 -1
- package/lib/src/api/events.d.ts +0 -26
- package/lib/src/api/events.js +0 -42
- package/lib/src/api/events.js.map +0 -1
- package/lib/src/api/fetcher.d.ts +0 -24
- package/lib/src/api/fetcher.js +0 -3
- package/lib/src/api/fetcher.js.map +0 -1
- package/lib/src/api/index.d.ts +0 -2
- package/lib/src/api/index.js +0 -19
- package/lib/src/api/index.js.map +0 -1
- package/lib/src/api/listings.d.ts +0 -44
- package/lib/src/api/listings.js +0 -86
- package/lib/src/api/listings.js.map +0 -1
- package/lib/src/api/nfts.d.ts +0 -35
- package/lib/src/api/nfts.js +0 -66
- package/lib/src/api/nfts.js.map +0 -1
- package/lib/src/api/offers.d.ts +0 -54
- package/lib/src/api/offers.js +0 -122
- package/lib/src/api/offers.js.map +0 -1
- package/lib/src/api/orders.d.ts +0 -50
- package/lib/src/api/orders.js +0 -151
- package/lib/src/api/orders.js.map +0 -1
- package/lib/src/api/search.d.ts +0 -13
- package/lib/src/api/search.js +0 -21
- package/lib/src/api/search.js.map +0 -1
- package/lib/src/api/tokens.d.ts +0 -25
- package/lib/src/api/tokens.js +0 -42
- package/lib/src/api/tokens.js.map +0 -1
- package/lib/src/api/types.d.ts +0 -840
- package/lib/src/api/types.js +0 -65
- package/lib/src/api/types.js.map +0 -1
- package/lib/src/constants.d.ts +0 -22
- package/lib/src/constants.js +0 -52
- package/lib/src/constants.js.map +0 -1
- package/lib/src/index.d.ts +0 -18
- package/lib/src/index.js +0 -24
- package/lib/src/index.js.map +0 -1
- package/lib/src/orders/privateListings.d.ts +0 -12
- package/lib/src/orders/privateListings.js +0 -130
- package/lib/src/orders/privateListings.js.map +0 -1
- package/lib/src/orders/types.d.ts +0 -160
- package/lib/src/orders/types.js +0 -10
- package/lib/src/orders/types.js.map +0 -1
- package/lib/src/orders/utils.d.ts +0 -89
- package/lib/src/orders/utils.js +0 -177
- package/lib/src/orders/utils.js.map +0 -1
- package/lib/src/sdk/assets.d.ts +0 -104
- package/lib/src/sdk/assets.js +0 -397
- package/lib/src/sdk/assets.js.map +0 -1
- package/lib/src/sdk/cancellation.d.ts +0 -97
- package/lib/src/sdk/cancellation.js +0 -234
- package/lib/src/sdk/cancellation.js.map +0 -1
- package/lib/src/sdk/context.d.ts +0 -28
- package/lib/src/sdk/context.js +0 -3
- package/lib/src/sdk/context.js.map +0 -1
- package/lib/src/sdk/fulfillment.d.ts +0 -153
- package/lib/src/sdk/fulfillment.js +0 -296
- package/lib/src/sdk/fulfillment.js.map +0 -1
- package/lib/src/sdk/orders.d.ts +0 -253
- package/lib/src/sdk/orders.js +0 -677
- package/lib/src/sdk/orders.js.map +0 -1
- package/lib/src/sdk/tokens.d.ts +0 -31
- package/lib/src/sdk/tokens.js +0 -64
- package/lib/src/sdk/tokens.js.map +0 -1
- package/lib/src/sdk.d.ts +0 -560
- package/lib/src/sdk.js +0 -675
- package/lib/src/sdk.js.map +0 -1
- package/lib/src/typechain/contracts/ERC1155.d.ts +0 -236
- package/lib/src/typechain/contracts/ERC1155.js +0 -3
- package/lib/src/typechain/contracts/ERC1155.js.map +0 -1
- package/lib/src/typechain/contracts/ERC20.d.ts +0 -141
- package/lib/src/typechain/contracts/ERC20.js +0 -3
- package/lib/src/typechain/contracts/ERC20.js.map +0 -1
- package/lib/src/typechain/contracts/ERC721.d.ts +0 -213
- package/lib/src/typechain/contracts/ERC721.js +0 -3
- package/lib/src/typechain/contracts/ERC721.js.map +0 -1
- package/lib/src/typechain/contracts/Multicall3.d.ts +0 -57
- package/lib/src/typechain/contracts/Multicall3.js +0 -3
- package/lib/src/typechain/contracts/Multicall3.js.map +0 -1
- package/lib/src/typechain/contracts/TransferHelper.d.ts +0 -55
- package/lib/src/typechain/contracts/TransferHelper.js +0 -3
- package/lib/src/typechain/contracts/TransferHelper.js.map +0 -1
- package/lib/src/typechain/contracts/common.d.ts +0 -50
- package/lib/src/typechain/contracts/common.js +0 -3
- package/lib/src/typechain/contracts/common.js.map +0 -1
- package/lib/src/typechain/contracts/factories/ERC1155__factory.d.ts +0 -250
- package/lib/src/typechain/contracts/factories/ERC1155__factory.js +0 -332
- package/lib/src/typechain/contracts/factories/ERC1155__factory.js.map +0 -1
- package/lib/src/typechain/contracts/factories/ERC20__factory.d.ts +0 -174
- package/lib/src/typechain/contracts/factories/ERC20__factory.js +0 -240
- package/lib/src/typechain/contracts/factories/ERC20__factory.js.map +0 -1
- package/lib/src/typechain/contracts/factories/ERC721__factory.d.ts +0 -268
- package/lib/src/typechain/contracts/factories/ERC721__factory.js +0 -351
- package/lib/src/typechain/contracts/factories/ERC721__factory.js.map +0 -1
- package/lib/src/typechain/contracts/factories/Multicall3__factory.d.ts +0 -43
- package/lib/src/typechain/contracts/factories/Multicall3__factory.js +0 -68
- package/lib/src/typechain/contracts/factories/Multicall3__factory.js.map +0 -1
- package/lib/src/typechain/contracts/factories/TransferHelper__factory.d.ts +0 -46
- package/lib/src/typechain/contracts/factories/TransferHelper__factory.js +0 -71
- package/lib/src/typechain/contracts/factories/TransferHelper__factory.js.map +0 -1
- package/lib/src/typechain/contracts/factories/index.d.ts +0 -5
- package/lib/src/typechain/contracts/factories/index.js +0 -17
- package/lib/src/typechain/contracts/factories/index.js.map +0 -1
- package/lib/src/typechain/contracts/index.d.ts +0 -11
- package/lib/src/typechain/contracts/index.js +0 -48
- package/lib/src/typechain/contracts/index.js.map +0 -1
- package/lib/src/types.d.ts +0 -387
- package/lib/src/types.js +0 -127
- package/lib/src/types.js.map +0 -1
- package/lib/src/utils/chain.d.ts +0 -60
- package/lib/src/utils/chain.js +0 -248
- package/lib/src/utils/chain.js.map +0 -1
- package/lib/src/utils/converters.d.ts +0 -37
- package/lib/src/utils/converters.js +0 -137
- package/lib/src/utils/converters.js.map +0 -1
- package/lib/src/utils/dateHelper.d.ts +0 -38
- package/lib/src/utils/dateHelper.js +0 -52
- package/lib/src/utils/dateHelper.js.map +0 -1
- package/lib/src/utils/fees.d.ts +0 -13
- package/lib/src/utils/fees.js +0 -29
- package/lib/src/utils/fees.js.map +0 -1
- package/lib/src/utils/index.d.ts +0 -2
- package/lib/src/utils/index.js +0 -19
- package/lib/src/utils/index.js.map +0 -1
- package/lib/src/utils/protocol.d.ts +0 -75
- package/lib/src/utils/protocol.js +0 -161
- package/lib/src/utils/protocol.js.map +0 -1
- package/lib/src/utils/rateLimit.d.ts +0 -34
- package/lib/src/utils/rateLimit.js +0 -97
- package/lib/src/utils/rateLimit.js.map +0 -1
- package/lib/src/utils/stringHelper.d.ts +0 -18
- package/lib/src/utils/stringHelper.js +0 -24
- package/lib/src/utils/stringHelper.js.map +0 -1
- package/lib/src/utils/utils.d.ts +0 -18
- package/lib/src/utils/utils.js +0 -45
- package/lib/src/utils/utils.js.map +0 -1
- package/lib/typechain/contracts/ERC1155.d.ts +0 -236
- package/lib/typechain/contracts/ERC1155.js +0 -3
- package/lib/typechain/contracts/ERC1155.js.map +0 -1
- package/lib/typechain/contracts/ERC20.d.ts +0 -141
- package/lib/typechain/contracts/ERC20.js +0 -3
- package/lib/typechain/contracts/ERC20.js.map +0 -1
- package/lib/typechain/contracts/ERC721.d.ts +0 -213
- package/lib/typechain/contracts/ERC721.js +0 -3
- package/lib/typechain/contracts/ERC721.js.map +0 -1
- package/lib/typechain/contracts/Multicall3.d.ts +0 -57
- package/lib/typechain/contracts/Multicall3.js +0 -3
- package/lib/typechain/contracts/Multicall3.js.map +0 -1
- package/lib/typechain/contracts/TransferHelper.d.ts +0 -55
- package/lib/typechain/contracts/TransferHelper.js +0 -3
- package/lib/typechain/contracts/TransferHelper.js.map +0 -1
- package/lib/typechain/contracts/common.d.ts +0 -50
- package/lib/typechain/contracts/common.js +0 -3
- package/lib/typechain/contracts/common.js.map +0 -1
- package/lib/typechain/contracts/factories/ERC1155__factory.d.ts +0 -250
- package/lib/typechain/contracts/factories/ERC1155__factory.js +0 -332
- package/lib/typechain/contracts/factories/ERC1155__factory.js.map +0 -1
- package/lib/typechain/contracts/factories/ERC20__factory.d.ts +0 -174
- package/lib/typechain/contracts/factories/ERC20__factory.js +0 -240
- package/lib/typechain/contracts/factories/ERC20__factory.js.map +0 -1
- package/lib/typechain/contracts/factories/ERC721__factory.d.ts +0 -268
- package/lib/typechain/contracts/factories/ERC721__factory.js +0 -351
- package/lib/typechain/contracts/factories/ERC721__factory.js.map +0 -1
- package/lib/typechain/contracts/factories/Multicall3__factory.d.ts +0 -43
- package/lib/typechain/contracts/factories/Multicall3__factory.js +0 -68
- package/lib/typechain/contracts/factories/Multicall3__factory.js.map +0 -1
- package/lib/typechain/contracts/factories/TransferHelper__factory.d.ts +0 -46
- package/lib/typechain/contracts/factories/TransferHelper__factory.js +0 -71
- package/lib/typechain/contracts/factories/TransferHelper__factory.js.map +0 -1
- package/lib/typechain/contracts/factories/index.d.ts +0 -5
- package/lib/typechain/contracts/factories/index.js +0 -17
- package/lib/typechain/contracts/factories/index.js.map +0 -1
- package/lib/typechain/contracts/index.d.ts +0 -11
- package/lib/typechain/contracts/index.js +0 -48
- package/lib/typechain/contracts/index.js.map +0 -1
- package/src/typechain/contracts/ERC1155.ts +0 -440
- package/src/typechain/contracts/ERC20.ts +0 -286
- package/src/typechain/contracts/ERC721.ts +0 -412
- package/src/typechain/contracts/Multicall3.ts +0 -117
- package/src/typechain/contracts/TransferHelper.ts +0 -122
- package/src/typechain/contracts/common.ts +0 -131
- package/src/typechain/contracts/factories/ERC1155__factory.ts +0 -331
- package/src/typechain/contracts/factories/ERC20__factory.ts +0 -239
- package/src/typechain/contracts/factories/ERC721__factory.ts +0 -350
- package/src/typechain/contracts/factories/Multicall3__factory.ts +0 -67
- package/src/typechain/contracts/factories/TransferHelper__factory.ts +0 -76
- package/src/typechain/contracts/factories/index.ts +0 -8
- package/src/typechain/contracts/index.ts +0 -14
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSeaportBridge = createSeaportBridge;
|
|
4
|
+
/**
|
|
5
|
+
* Bridge that wraps viem clients as an ethers-compatible Signer for seaport-js.
|
|
6
|
+
* seaport-js only accepts ethers Signer | JsonRpcProvider, so we need this shim.
|
|
7
|
+
*/
|
|
8
|
+
const ethers_1 = require("ethers");
|
|
9
|
+
/**
|
|
10
|
+
* Creates an ethers-compatible Signer from viem clients, for use with seaport-js.
|
|
11
|
+
* If only a publicClient is provided (no walletClient), returns a read-only JsonRpcProvider.
|
|
12
|
+
*/
|
|
13
|
+
function createSeaportBridge(params, logger) {
|
|
14
|
+
const { publicClient, walletClient, rpcUrl: explicitRpcUrl } = params;
|
|
15
|
+
// We need the chain's RPC URL to create an ethers provider for seaport-js.
|
|
16
|
+
// Prefer an explicit rpcUrl if provided (needed for non-HTTP transports).
|
|
17
|
+
// Otherwise, extract it from the viem transport's internal properties.
|
|
18
|
+
// NOTE: transport.url / transport.value.url are viem internals that may
|
|
19
|
+
// change across viem versions.
|
|
20
|
+
const transport = publicClient.transport;
|
|
21
|
+
const detectedUrl = transport?.url ?? transport?.value?.url;
|
|
22
|
+
const rpcUrl = explicitRpcUrl ?? detectedUrl;
|
|
23
|
+
if (!rpcUrl) {
|
|
24
|
+
throw new Error("OpenSeaSDK viem entry point requires an HTTP RPC URL. " +
|
|
25
|
+
"Either use `http(url)` when creating your publicClient, or pass " +
|
|
26
|
+
"`rpcUrl` explicitly in the constructor params.");
|
|
27
|
+
}
|
|
28
|
+
if (!explicitRpcUrl && detectedUrl && logger) {
|
|
29
|
+
logger("Seaport bridge: auto-detected RPC URL from viem transport internals. " +
|
|
30
|
+
"Pass `rpcUrl` explicitly for stability across viem versions.");
|
|
31
|
+
}
|
|
32
|
+
const ethersProvider = new ethers_1.JsonRpcProvider(rpcUrl);
|
|
33
|
+
if (!walletClient) {
|
|
34
|
+
return ethersProvider;
|
|
35
|
+
}
|
|
36
|
+
return new ViemEthersSigner(walletClient, ethersProvider);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Minimal ethers AbstractSigner implementation backed by a viem WalletClient.
|
|
40
|
+
* Implements the methods that seaport-js calls: getAddress, sendTransaction,
|
|
41
|
+
* signMessage, and signTypedData.
|
|
42
|
+
*
|
|
43
|
+
* sendTransaction is overridden to use viem's walletClient.sendTransaction directly,
|
|
44
|
+
* bypassing ethers' default signTransaction + broadcastTransaction flow (similar to
|
|
45
|
+
* how ethers' own JsonRpcSigner overrides it to use eth_sendTransaction).
|
|
46
|
+
*/
|
|
47
|
+
class ViemEthersSigner extends ethers_1.AbstractSigner {
|
|
48
|
+
_walletClient;
|
|
49
|
+
constructor(walletClient, provider) {
|
|
50
|
+
super(provider);
|
|
51
|
+
this._walletClient = walletClient;
|
|
52
|
+
}
|
|
53
|
+
async getAddress() {
|
|
54
|
+
if (!this._walletClient.account) {
|
|
55
|
+
throw new Error("WalletClient must have an account");
|
|
56
|
+
}
|
|
57
|
+
return this._walletClient.account.address;
|
|
58
|
+
}
|
|
59
|
+
// seaport-js checks `.address` property directly on the signer.
|
|
60
|
+
// Throw if no account is set rather than returning empty string,
|
|
61
|
+
// which could cause subtle bugs in truthy checks.
|
|
62
|
+
get address() {
|
|
63
|
+
if (!this._walletClient.account?.address) {
|
|
64
|
+
throw new Error("WalletClient must have an account. Use `createWalletClient` with an `account` parameter.");
|
|
65
|
+
}
|
|
66
|
+
return this._walletClient.account.address;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Override sendTransaction to delegate to viem's walletClient.sendTransaction.
|
|
70
|
+
* This bypasses AbstractSigner's default flow (signTransaction → broadcastTransaction)
|
|
71
|
+
* since viem handles signing internally via the wallet.
|
|
72
|
+
*/
|
|
73
|
+
async sendTransaction(tx) {
|
|
74
|
+
const hash = await this._walletClient.sendTransaction({
|
|
75
|
+
to: tx.to,
|
|
76
|
+
data: tx.data,
|
|
77
|
+
value: tx.value != null ? BigInt(tx.value.toString()) : undefined,
|
|
78
|
+
// Forward gas parameters when provided by seaport-js or callers
|
|
79
|
+
gas: tx.gasLimit != null ? BigInt(tx.gasLimit.toString()) : undefined,
|
|
80
|
+
gasPrice: tx.gasPrice != null ? BigInt(tx.gasPrice.toString()) : undefined,
|
|
81
|
+
maxFeePerGas: tx.maxFeePerGas != null
|
|
82
|
+
? BigInt(tx.maxFeePerGas.toString())
|
|
83
|
+
: undefined,
|
|
84
|
+
maxPriorityFeePerGas: tx.maxPriorityFeePerGas != null
|
|
85
|
+
? BigInt(tx.maxPriorityFeePerGas.toString())
|
|
86
|
+
: undefined,
|
|
87
|
+
nonce: tx.nonce != null ? Number(tx.nonce) : undefined,
|
|
88
|
+
account: this._walletClient.account,
|
|
89
|
+
chain: this._walletClient.chain,
|
|
90
|
+
});
|
|
91
|
+
// Return an ethers-compatible TransactionResponse by fetching from the provider
|
|
92
|
+
const response = await this.provider.getTransaction(hash);
|
|
93
|
+
if (!response) {
|
|
94
|
+
// Fallback: construct minimal response if the tx isn't indexed yet
|
|
95
|
+
return {
|
|
96
|
+
hash,
|
|
97
|
+
wait: () => this.provider.waitForTransaction(hash),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
return response;
|
|
101
|
+
}
|
|
102
|
+
async signTransaction() {
|
|
103
|
+
throw new Error("signTransaction is not supported via the viem bridge. " +
|
|
104
|
+
"sendTransaction is overridden to delegate to viem directly.");
|
|
105
|
+
}
|
|
106
|
+
async signMessage(message) {
|
|
107
|
+
return this._walletClient.signMessage({
|
|
108
|
+
message: typeof message === "string" ? message : { raw: message },
|
|
109
|
+
account: this._walletClient.account,
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
async signTypedData(domain, types, value) {
|
|
113
|
+
const primaryType = Object.keys(types).find(key => key !== "EIP712Domain") ||
|
|
114
|
+
Object.keys(types)[0];
|
|
115
|
+
return this._walletClient.signTypedData({
|
|
116
|
+
domain: {
|
|
117
|
+
...domain,
|
|
118
|
+
chainId: domain.chainId ? Number(domain.chainId) : undefined,
|
|
119
|
+
},
|
|
120
|
+
types,
|
|
121
|
+
primaryType,
|
|
122
|
+
message: value,
|
|
123
|
+
account: this._walletClient.account,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
connect() {
|
|
127
|
+
return this;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=seaport-bridge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"seaport-bridge.js","sourceRoot":"","sources":["../../src/provider/seaport-bridge.ts"],"names":[],"mappings":";;AAgBA,kDAmCC;AAnDD;;;GAGG;AACH,mCAKe;AAGf;;;GAGG;AACH,SAAgB,mBAAmB,CACjC,MAAyB,EACzB,MAA8B;IAE9B,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,CAAA;IAErE,2EAA2E;IAC3E,0EAA0E;IAC1E,uEAAuE;IACvE,wEAAwE;IACxE,+BAA+B;IAC/B,MAAM,SAAS,GAAI,YAAoB,CAAC,SAAS,CAAA;IACjD,MAAM,WAAW,GAAG,SAAS,EAAE,GAAG,IAAI,SAAS,EAAE,KAAK,EAAE,GAAG,CAAA;IAC3D,MAAM,MAAM,GAAG,cAAc,IAAI,WAAW,CAAA;IAC5C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CACb,wDAAwD;YACtD,kEAAkE;YAClE,gDAAgD,CACnD,C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AC,IAAI,CAAC;aAClB,CAAA;QACrC,CAAC;QACD,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,KAAK,CAAC,eAAe;QACnB,MAAM,IAAI,KAAK,CACb,wDAAwD;YACtD,6DAA6D,CAChE,CAAA;IACH,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,OAA4B;QAC5C,OAAO,IAAI,CAAC,aAAa,CAAC,WAAW,CAAC;YACpC,OAAO,EAAE,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,OAAc,EAAE;YACxE,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,OAAO;SACpC,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,MAAW,EAAE,KAAU,EAAE,KAAU;QACrD,MAAM,WAAW,GACf,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,cAAc,CAAC;YACtD,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;QAEvB,OAAO,IAAI,CAAC,aAAa,CAAC,aAAa,CAAC;YACtC,MAAM,EAAE;gBACN,GAAG,MAAM;gBACT,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS;aAC7D;YACD,KAAK;YACL,WAAW;YACX,OAAO,EAAE,KAAK;YACd,OAAO,EAAE,IAAI,CAAC,aAAa,CAAC,OAAO;SACpC,CAAC,CAAA;IACJ,CAAC;IAED,OAAO;QACL,OAAO,IAAI,CAAA;IACb,CAAC;CACF"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Abstract provider interfaces for the OpenSea SDK.
|
|
3
|
+
* These allow the SDK to work with both ethers and viem (or any other library).
|
|
4
|
+
*/
|
|
5
|
+
/** Transaction receipt returned after sending a transaction. */
|
|
6
|
+
export interface TransactionResponse {
|
|
7
|
+
hash: string;
|
|
8
|
+
wait(): Promise<void>;
|
|
9
|
+
}
|
|
10
|
+
/** Minimal signer interface for the OpenSea SDK. */
|
|
11
|
+
export interface OpenSeaSigner {
|
|
12
|
+
getAddress(): Promise<string>;
|
|
13
|
+
sendTransaction(tx: {
|
|
14
|
+
to: string;
|
|
15
|
+
data?: string;
|
|
16
|
+
value?: bigint;
|
|
17
|
+
from?: string;
|
|
18
|
+
overrides?: Record<string, unknown>;
|
|
19
|
+
}): Promise<TransactionResponse>;
|
|
20
|
+
signTypedData(domain: {
|
|
21
|
+
chainId: string | number;
|
|
22
|
+
name: string;
|
|
23
|
+
version: string;
|
|
24
|
+
verifyingContract: string;
|
|
25
|
+
}, types: Record<string, Array<{
|
|
26
|
+
name: string;
|
|
27
|
+
type: string;
|
|
28
|
+
}>>, value: Record<string, unknown>): Promise<string>;
|
|
29
|
+
}
|
|
30
|
+
/** Minimal provider interface for the OpenSea SDK. */
|
|
31
|
+
export interface OpenSeaProvider {
|
|
32
|
+
waitForTransaction(hash: string): Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
/** Combined wallet: either signer+provider or provider-only. */
|
|
35
|
+
export type OpenSeaWallet = {
|
|
36
|
+
signer: OpenSeaSigner;
|
|
37
|
+
provider: OpenSeaProvider;
|
|
38
|
+
} | {
|
|
39
|
+
provider: OpenSeaProvider;
|
|
40
|
+
};
|
|
41
|
+
/** Contract read/write interface. */
|
|
42
|
+
export interface ContractCaller {
|
|
43
|
+
readContract(params: {
|
|
44
|
+
address: string;
|
|
45
|
+
abi: readonly unknown[];
|
|
46
|
+
functionName: string;
|
|
47
|
+
args: unknown[];
|
|
48
|
+
}): Promise<unknown>;
|
|
49
|
+
writeContract(params: {
|
|
50
|
+
address: string;
|
|
51
|
+
abi: readonly unknown[];
|
|
52
|
+
functionName: string;
|
|
53
|
+
args: unknown[];
|
|
54
|
+
value?: bigint;
|
|
55
|
+
overrides?: Record<string, unknown>;
|
|
56
|
+
}): Promise<TransactionResponse>;
|
|
57
|
+
encodeFunctionData(params: {
|
|
58
|
+
abi: readonly unknown[];
|
|
59
|
+
functionName: string;
|
|
60
|
+
args: unknown[];
|
|
61
|
+
}): string;
|
|
62
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/provider/types.ts"],"names":[],"mappings":";AAAA;;;GAGG"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Viem adapter — wraps viem WalletClient/PublicClient into the SDK's abstract interfaces.
|
|
3
|
+
*
|
|
4
|
+
* viem is an optional peerDependency and a devDependency (for type-checking).
|
|
5
|
+
* This module is only executed at runtime by code importing from "@opensea/sdk/viem",
|
|
6
|
+
* which requires viem to be installed.
|
|
7
|
+
*/
|
|
8
|
+
import { type PublicClient, type WalletClient } from "viem";
|
|
9
|
+
import type { ContractCaller, OpenSeaWallet } from "./types";
|
|
10
|
+
export interface ViemAdapterParams {
|
|
11
|
+
publicClient: PublicClient;
|
|
12
|
+
walletClient?: WalletClient;
|
|
13
|
+
/**
|
|
14
|
+
* Explicit RPC URL for seaport-js (which requires an ethers provider internally).
|
|
15
|
+
* If not provided, the SDK attempts to extract the URL from the publicClient's
|
|
16
|
+
* HTTP transport. Required when using non-HTTP transports (WebSocket, custom).
|
|
17
|
+
*/
|
|
18
|
+
rpcUrl?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Creates an OpenSeaWallet from viem clients.
|
|
22
|
+
*/
|
|
23
|
+
export declare function createViemWallet(params: ViemAdapterParams): OpenSeaWallet;
|
|
24
|
+
/**
|
|
25
|
+
* Creates a ContractCaller using viem clients.
|
|
26
|
+
*/
|
|
27
|
+
export declare function createViemContractCaller(params: ViemAdapterParams): ContractCaller;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createViemWallet = createViemWallet;
|
|
4
|
+
exports.createViemContractCaller = createViemContractCaller;
|
|
5
|
+
/**
|
|
6
|
+
* Viem adapter — wraps viem WalletClient/PublicClient into the SDK's abstract interfaces.
|
|
7
|
+
*
|
|
8
|
+
* viem is an optional peerDependency and a devDependency (for type-checking).
|
|
9
|
+
* This module is only executed at runtime by code importing from "@opensea/sdk/viem",
|
|
10
|
+
* which requires viem to be installed.
|
|
11
|
+
*/
|
|
12
|
+
const viem_1 = require("viem");
|
|
13
|
+
/**
|
|
14
|
+
* Creates an OpenSeaWallet from viem clients.
|
|
15
|
+
*/
|
|
16
|
+
function createViemWallet(params) {
|
|
17
|
+
const provider = createViemProvider(params.publicClient);
|
|
18
|
+
if (params.walletClient) {
|
|
19
|
+
return {
|
|
20
|
+
signer: createViemSigner(params.walletClient, params.publicClient),
|
|
21
|
+
provider,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
return { provider };
|
|
25
|
+
}
|
|
26
|
+
function createViemSigner(walletClient, publicClient) {
|
|
27
|
+
return {
|
|
28
|
+
async getAddress() {
|
|
29
|
+
if (!walletClient.account) {
|
|
30
|
+
throw new Error("WalletClient must have an account. Use `createWalletClient` with an `account` parameter.");
|
|
31
|
+
}
|
|
32
|
+
return walletClient.account.address;
|
|
33
|
+
},
|
|
34
|
+
async sendTransaction(tx) {
|
|
35
|
+
const hash = await walletClient.sendTransaction({
|
|
36
|
+
to: tx.to,
|
|
37
|
+
data: tx.data,
|
|
38
|
+
value: tx.value,
|
|
39
|
+
account: walletClient.account,
|
|
40
|
+
chain: walletClient.chain,
|
|
41
|
+
...tx.overrides,
|
|
42
|
+
});
|
|
43
|
+
return {
|
|
44
|
+
hash,
|
|
45
|
+
async wait() {
|
|
46
|
+
await publicClient.waitForTransactionReceipt({ hash });
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
async signTypedData(domain, types, value) {
|
|
51
|
+
return walletClient.signTypedData({
|
|
52
|
+
domain: {
|
|
53
|
+
chainId: Number(domain.chainId),
|
|
54
|
+
name: domain.name,
|
|
55
|
+
version: domain.version,
|
|
56
|
+
verifyingContract: domain.verifyingContract,
|
|
57
|
+
},
|
|
58
|
+
types,
|
|
59
|
+
primaryType: Object.keys(types).find(key => key !== "EIP712Domain") ||
|
|
60
|
+
Object.keys(types)[0],
|
|
61
|
+
message: value,
|
|
62
|
+
account: walletClient.account,
|
|
63
|
+
});
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function createViemProvider(publicClient) {
|
|
68
|
+
return {
|
|
69
|
+
async waitForTransaction(hash) {
|
|
70
|
+
await publicClient.waitForTransactionReceipt({
|
|
71
|
+
hash: hash,
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Creates a ContractCaller using viem clients.
|
|
78
|
+
*/
|
|
79
|
+
function createViemContractCaller(params) {
|
|
80
|
+
const { publicClient, walletClient } = params;
|
|
81
|
+
return {
|
|
82
|
+
async readContract({ address, abi, functionName, args }) {
|
|
83
|
+
return publicClient.readContract({
|
|
84
|
+
address: address,
|
|
85
|
+
abi: abi,
|
|
86
|
+
functionName,
|
|
87
|
+
args: args,
|
|
88
|
+
});
|
|
89
|
+
},
|
|
90
|
+
async writeContract({ address, abi, functionName, args, value, overrides, }) {
|
|
91
|
+
if (!walletClient) {
|
|
92
|
+
throw new Error("A WalletClient is required for write operations");
|
|
93
|
+
}
|
|
94
|
+
const hash = await walletClient.writeContract({
|
|
95
|
+
address: address,
|
|
96
|
+
abi: abi,
|
|
97
|
+
functionName,
|
|
98
|
+
args: args,
|
|
99
|
+
value,
|
|
100
|
+
account: walletClient.account,
|
|
101
|
+
chain: walletClient.chain,
|
|
102
|
+
...overrides,
|
|
103
|
+
});
|
|
104
|
+
return {
|
|
105
|
+
hash,
|
|
106
|
+
async wait() {
|
|
107
|
+
await publicClient.waitForTransactionReceipt({
|
|
108
|
+
hash: hash,
|
|
109
|
+
});
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
},
|
|
113
|
+
encodeFunctionData({ abi, functionName, args }) {
|
|
114
|
+
return (0, viem_1.encodeFunctionData)({
|
|
115
|
+
abi: abi,
|
|
116
|
+
functionName,
|
|
117
|
+
args: args,
|
|
118
|
+
});
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
//# sourceMappingURL=viem-adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viem-adapter.js","sourceRoot":"","sources":["../../src/provider/viem-adapter.ts"],"names":[],"mappings":";;AAkCA,4CAWC;AAiED,4DAsDC;AApKD;;;;;;GAMG;AACH,+BAIa;AAoBb;;GAEG;AACH,SAAgB,gBAAgB,CAAC,MAAyB;IACxD,MAAM,QAAQ,GAAG,kBAAkB,CAAC,MAAM,CAAC,YAAY,CAAC,CAAA;IAExD,IAAI,MAAM,CAAC,YAAY,EAAE,CAAC;QACxB,OAAO;YACL,MAAM,EAAE,gBAAgB,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,YAAY,CAAC;YAClE,QAAQ;SACT,CAAA;IACH,CAAC;IAED,OAAO,EAAE,QAAQ,EAAE,CAAA;AACrB,CAAC;AAED,SAAS,gBAAgB,CACvB,YAA0B,EAC1B,YAA0B;IAE1B,OAAO;QACL,KAAK,CAAC,UAAU;YACd,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC;gBAC1B,MAAM,IAAI,KAAK,CACb,0FAA0F,CAC3F,CAAA;YACH,CAAC;YACD,OAAO,YAAY,CAAC,OAAO,CAAC,OAAO,CAAA;QACrC,CAAC;QAED,KAAK,CAAC,eAAe,CAAC,EAAE;YACtB,MAAM,IAAI,GAAG,MAAM,YAAY,CAAC,eAAe,CAAC;gBAC9C,EAAE,EAAE,EAAE,CAAC,EAAmB;gBAC1B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andard } from "../types";
|
|
1
|
+
import { type Amount, type AssetWithTokenStandard } from "../types";
|
|
3
2
|
import type { SDKContext } from "./context";
|
|
4
3
|
/**
|
|
5
4
|
* Asset transfer and approval operations
|
|
@@ -31,10 +30,10 @@ export declare class AssetsManager {
|
|
|
31
30
|
*/
|
|
32
31
|
transfer({ asset, amount, fromAddress, toAddress, overrides, }: {
|
|
33
32
|
asset: AssetWithTokenStandard;
|
|
34
|
-
amount?:
|
|
33
|
+
amount?: Amount;
|
|
35
34
|
fromAddress: string;
|
|
36
35
|
toAddress: string;
|
|
37
|
-
overrides?:
|
|
36
|
+
overrides?: Record<string, unknown>;
|
|
38
37
|
}): Promise<void>;
|
|
39
38
|
/**
|
|
40
39
|
* Bulk transfer multiple assets using OpenSea's TransferHelper contract.
|
|
@@ -54,10 +53,10 @@ export declare class AssetsManager {
|
|
|
54
53
|
assets: Array<{
|
|
55
54
|
asset: AssetWithTokenStandard;
|
|
56
55
|
toAddress: string;
|
|
57
|
-
amount?:
|
|
56
|
+
amount?: Amount;
|
|
58
57
|
}>;
|
|
59
58
|
fromAddress: string;
|
|
60
|
-
overrides?:
|
|
59
|
+
overrides?: Record<string, unknown>;
|
|
61
60
|
}): Promise<string>;
|
|
62
61
|
/**
|
|
63
62
|
* Batch approve multiple assets for transfer to the OpenSea conduit.
|
|
@@ -77,28 +76,13 @@ export declare class AssetsManager {
|
|
|
77
76
|
batchApproveAssets({ assets, fromAddress, overrides, }: {
|
|
78
77
|
assets: Array<{
|
|
79
78
|
asset: AssetWithTokenStandard;
|
|
80
|
-
amount?:
|
|
79
|
+
amount?: Amount;
|
|
81
80
|
}>;
|
|
82
81
|
fromAddress: string;
|
|
83
|
-
overrides?:
|
|
82
|
+
overrides?: Record<string, unknown>;
|
|
84
83
|
}): Promise<string | undefined>;
|
|
85
84
|
/**
|
|
86
85
|
* Check if an asset is approved for transfer to a specific operator (conduit).
|
|
87
|
-
* @param asset The asset to check approval for
|
|
88
|
-
* @param owner The owner address
|
|
89
|
-
* @param operator The operator address (conduit)
|
|
90
|
-
* @param amount Optional amount for ERC20 tokens
|
|
91
|
-
* @returns True if approved, false otherwise
|
|
92
86
|
*/
|
|
93
87
|
private checkAssetApproval;
|
|
94
|
-
/**
|
|
95
|
-
* Get a TransferHelper contract instance.
|
|
96
|
-
* @returns Contract instance for TransferHelper
|
|
97
|
-
*/
|
|
98
|
-
private getTransferHelperContract;
|
|
99
|
-
/**
|
|
100
|
-
* Get a Multicall3 contract instance.
|
|
101
|
-
* @returns Contract instance for Multicall3
|
|
102
|
-
*/
|
|
103
|
-
private getMulticall3Contract;
|
|
104
88
|
}
|