@opensea/sdk 11.1.1 → 11.2.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/lib/api/accounts.d.ts +13 -1
- package/lib/api/accounts.js +18 -0
- package/lib/api/accounts.js.map +1 -1
- package/lib/api/api.d.ts +14 -1
- package/lib/api/api.js +22 -0
- package/lib/api/api.js.map +1 -1
- package/lib/api/apiPaths.d.ts +3 -0
- package/lib/api/apiPaths.js +13 -1
- package/lib/api/apiPaths.js.map +1 -1
- package/lib/api/types.d.ts +31 -1
- package/lib/auth/index.d.ts +65 -0
- package/lib/auth/index.js +168 -0
- package/lib/auth/index.js.map +1 -0
- package/lib/auth/oauth-types.d.ts +69 -0
- package/lib/auth/oauth-types.js +3 -0
- package/lib/auth/oauth-types.js.map +1 -0
- package/lib/auth/oauth.d.ts +109 -0
- package/lib/auth/oauth.js +342 -0
- package/lib/auth/oauth.js.map +1 -0
- package/lib/auth/types.d.ts +50 -0
- package/lib/auth/types.js +3 -0
- package/lib/auth/types.js.map +1 -0
- package/lib/index.d.ts +7 -1
- package/lib/index.js +9 -1
- package/lib/index.js.map +1 -1
- package/lib/scopes.d.ts +29 -0
- package/lib/scopes.js +27 -0
- package/lib/scopes.js.map +1 -0
- package/lib/sdk/base.d.ts +1 -0
- package/lib/sdk/base.js +6 -3
- package/lib/sdk/base.js.map +1 -1
- package/lib/sdk/cancellation.js +33 -23
- package/lib/sdk/cancellation.js.map +1 -1
- package/lib/types.d.ts +5 -1
- package/lib/types.js +1 -0
- package/lib/types.js.map +1 -1
- package/lib/utils/chain.d.ts +1 -1
- package/lib/utils/chain.js +29 -5
- package/lib/utils/chain.js.map +1 -1
- package/lib/utils/chainIds.generated.js +1 -0
- package/lib/utils/chainIds.generated.js.map +1 -1
- package/lib/viem.d.ts +1 -0
- package/lib/viem.js +1 -0
- package/lib/viem.js.map +1 -1
- package/package.json +2 -2
- package/src/api/accounts.ts +41 -0
- package/src/api/api.ts +36 -0
- package/src/api/apiPaths.ts +12 -0
- package/src/api/types.ts +36 -0
- package/src/auth/index.ts +230 -0
- package/src/auth/oauth-types.ts +73 -0
- package/src/auth/oauth.ts +428 -0
- package/src/auth/types.ts +55 -0
- package/src/index.ts +10 -0
- package/src/scopes.ts +39 -0
- package/src/sdk/base.ts +6 -4
- package/src/sdk/cancellation.ts +39 -25
- package/src/types.ts +4 -0
- package/src/utils/chain.ts +36 -5
- package/src/utils/chainIds.generated.ts +1 -0
- package/src/viem.ts +1 -0
package/src/types.ts
CHANGED
|
@@ -121,11 +121,14 @@ export interface EventData {
|
|
|
121
121
|
* @param chain `Chain` to use. Defaults to Ethereum Mainnet (`Chain.Mainnet`)
|
|
122
122
|
* @param apiKey API key to use
|
|
123
123
|
* @param apiBaseUrl Optional base URL to use for the API
|
|
124
|
+
* @param authToken Scoped JWT token for wallet-authenticated endpoints
|
|
124
125
|
*/
|
|
125
126
|
export interface OpenSeaAPIConfig {
|
|
126
127
|
chain?: Chain
|
|
127
128
|
apiKey?: string
|
|
128
129
|
apiBaseUrl?: string
|
|
130
|
+
/** Scoped JWT token for wallet-authenticated endpoints. */
|
|
131
|
+
authToken?: string
|
|
129
132
|
}
|
|
130
133
|
|
|
131
134
|
/**
|
|
@@ -164,6 +167,7 @@ export enum Chain {
|
|
|
164
167
|
Hyperliquid = "hyperliquid",
|
|
165
168
|
AnimeChain = "animechain",
|
|
166
169
|
Ink = "ink",
|
|
170
|
+
Robinhood = "robinhood",
|
|
167
171
|
}
|
|
168
172
|
|
|
169
173
|
// Compile-time check: every ChainIdentifier from the API spec must be assignable to Chain.
|
package/src/utils/chain.ts
CHANGED
|
@@ -38,7 +38,14 @@ export const usesAlternateProtocol = (chain: Chain): boolean =>
|
|
|
38
38
|
*/
|
|
39
39
|
export const getChainId = (chain: Chain): string => {
|
|
40
40
|
const id = CHAIN_ID_MAP[chain]
|
|
41
|
-
if (id === undefined)
|
|
41
|
+
if (id === undefined) {
|
|
42
|
+
if (Object.values(Chain).includes(chain)) {
|
|
43
|
+
throw new Error(
|
|
44
|
+
`Chain ${chain} has no EVM chain ID for OpenSea Seaport operations`,
|
|
45
|
+
)
|
|
46
|
+
}
|
|
47
|
+
throw new Error(`Unknown chainId for ${chain}`)
|
|
48
|
+
}
|
|
42
49
|
return id
|
|
43
50
|
}
|
|
44
51
|
|
|
@@ -68,7 +75,10 @@ export const getOfferPaymentToken = (chain: Chain) => {
|
|
|
68
75
|
case Chain.Shape:
|
|
69
76
|
case Chain.Unichain:
|
|
70
77
|
case Chain.Ink:
|
|
78
|
+
case Chain.Soneium:
|
|
71
79
|
return "0x4200000000000000000000000000000000000006" // WETH
|
|
80
|
+
case Chain.AnimeChain:
|
|
81
|
+
return "0x164906a76f1a2ea933366c446ae0ec6a37062c42" // WANIME
|
|
72
82
|
case Chain.BeraChain:
|
|
73
83
|
return "0x6969696969696969696969696969696969696969" // WBERA
|
|
74
84
|
case Chain.Sei:
|
|
@@ -89,8 +99,17 @@ export const getOfferPaymentToken = (chain: Chain) => {
|
|
|
89
99
|
return "0x046ede9564a72571df6f5e44d0405360c0f4dcab" // WSOMI
|
|
90
100
|
case Chain.Monad:
|
|
91
101
|
return "0x3bd359c1119da7da1d913d1c4d2b7c461115433a" // WMON
|
|
92
|
-
|
|
93
|
-
|
|
102
|
+
// Chains without Seaport deployment
|
|
103
|
+
case Chain.Robinhood:
|
|
104
|
+
case Chain.Solana:
|
|
105
|
+
case Chain.Hyperliquid:
|
|
106
|
+
throw new Error(
|
|
107
|
+
`Chain ${chain} is not supported for OpenSea Seaport offers`,
|
|
108
|
+
)
|
|
109
|
+
default: {
|
|
110
|
+
const exhaustiveChain: never = chain
|
|
111
|
+
throw new Error(`Unknown offer currency for ${exhaustiveChain}`)
|
|
112
|
+
}
|
|
94
113
|
}
|
|
95
114
|
}
|
|
96
115
|
|
|
@@ -102,6 +121,7 @@ export const getOfferPaymentToken = (chain: Chain) => {
|
|
|
102
121
|
export const getListingPaymentToken = (chain: Chain) => {
|
|
103
122
|
switch (chain) {
|
|
104
123
|
case Chain.Mainnet:
|
|
124
|
+
case Chain.Soneium:
|
|
105
125
|
case Chain.Somnia:
|
|
106
126
|
case Chain.HyperEVM:
|
|
107
127
|
case Chain.Arbitrum:
|
|
@@ -133,8 +153,19 @@ export const getListingPaymentToken = (chain: Chain) => {
|
|
|
133
153
|
return "0xe514d9deb7966c8be0ca922de8a064264ea6bcd4" // WETH
|
|
134
154
|
case Chain.Gunzilla:
|
|
135
155
|
return "0x0000000000000000000000000000000000000000" // GUN
|
|
136
|
-
|
|
137
|
-
|
|
156
|
+
case Chain.AnimeChain:
|
|
157
|
+
return "0x0000000000000000000000000000000000000000" // ANIME
|
|
158
|
+
// Chains without Seaport deployment
|
|
159
|
+
case Chain.Robinhood:
|
|
160
|
+
case Chain.Solana:
|
|
161
|
+
case Chain.Hyperliquid:
|
|
162
|
+
throw new Error(
|
|
163
|
+
`Chain ${chain} is not supported for OpenSea Seaport listings`,
|
|
164
|
+
)
|
|
165
|
+
default: {
|
|
166
|
+
const exhaustiveChain: never = chain
|
|
167
|
+
throw new Error(`Unknown listing currency for ${exhaustiveChain}`)
|
|
168
|
+
}
|
|
138
169
|
}
|
|
139
170
|
}
|
|
140
171
|
|
package/src/viem.ts
CHANGED