@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.
Files changed (61) hide show
  1. package/lib/api/accounts.d.ts +13 -1
  2. package/lib/api/accounts.js +18 -0
  3. package/lib/api/accounts.js.map +1 -1
  4. package/lib/api/api.d.ts +14 -1
  5. package/lib/api/api.js +22 -0
  6. package/lib/api/api.js.map +1 -1
  7. package/lib/api/apiPaths.d.ts +3 -0
  8. package/lib/api/apiPaths.js +13 -1
  9. package/lib/api/apiPaths.js.map +1 -1
  10. package/lib/api/types.d.ts +31 -1
  11. package/lib/auth/index.d.ts +65 -0
  12. package/lib/auth/index.js +168 -0
  13. package/lib/auth/index.js.map +1 -0
  14. package/lib/auth/oauth-types.d.ts +69 -0
  15. package/lib/auth/oauth-types.js +3 -0
  16. package/lib/auth/oauth-types.js.map +1 -0
  17. package/lib/auth/oauth.d.ts +109 -0
  18. package/lib/auth/oauth.js +342 -0
  19. package/lib/auth/oauth.js.map +1 -0
  20. package/lib/auth/types.d.ts +50 -0
  21. package/lib/auth/types.js +3 -0
  22. package/lib/auth/types.js.map +1 -0
  23. package/lib/index.d.ts +7 -1
  24. package/lib/index.js +9 -1
  25. package/lib/index.js.map +1 -1
  26. package/lib/scopes.d.ts +29 -0
  27. package/lib/scopes.js +27 -0
  28. package/lib/scopes.js.map +1 -0
  29. package/lib/sdk/base.d.ts +1 -0
  30. package/lib/sdk/base.js +6 -3
  31. package/lib/sdk/base.js.map +1 -1
  32. package/lib/sdk/cancellation.js +33 -23
  33. package/lib/sdk/cancellation.js.map +1 -1
  34. package/lib/types.d.ts +5 -1
  35. package/lib/types.js +1 -0
  36. package/lib/types.js.map +1 -1
  37. package/lib/utils/chain.d.ts +1 -1
  38. package/lib/utils/chain.js +29 -5
  39. package/lib/utils/chain.js.map +1 -1
  40. package/lib/utils/chainIds.generated.js +1 -0
  41. package/lib/utils/chainIds.generated.js.map +1 -1
  42. package/lib/viem.d.ts +1 -0
  43. package/lib/viem.js +1 -0
  44. package/lib/viem.js.map +1 -1
  45. package/package.json +2 -2
  46. package/src/api/accounts.ts +41 -0
  47. package/src/api/api.ts +36 -0
  48. package/src/api/apiPaths.ts +12 -0
  49. package/src/api/types.ts +36 -0
  50. package/src/auth/index.ts +230 -0
  51. package/src/auth/oauth-types.ts +73 -0
  52. package/src/auth/oauth.ts +428 -0
  53. package/src/auth/types.ts +55 -0
  54. package/src/index.ts +10 -0
  55. package/src/scopes.ts +39 -0
  56. package/src/sdk/base.ts +6 -4
  57. package/src/sdk/cancellation.ts +39 -25
  58. package/src/types.ts +4 -0
  59. package/src/utils/chain.ts +36 -5
  60. package/src/utils/chainIds.generated.ts +1 -0
  61. 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.
@@ -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) throw new Error(`Unknown chainId for ${chain}`)
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
- default:
93
- throw new Error(`Unknown offer currency for ${chain}`)
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
- default:
137
- throw new Error(`Unknown listing currency for ${chain}`)
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
 
@@ -19,6 +19,7 @@ export const CHAIN_ID_MAP: Record<string, string> = {
19
19
  ronin: "2020",
20
20
  abstract: "2741",
21
21
  megaeth: "4326",
22
+ robinhood: "4663",
22
23
  somnia: "5031",
23
24
  b3: "8333",
24
25
  base: "8453",
package/src/viem.ts CHANGED
@@ -40,6 +40,7 @@ import {
40
40
  // Re-export everything from the main entry point
41
41
  export { OpenSeaAPI } from "./api/api"
42
42
  export * from "./api/types"
43
+ export * from "./auth"
43
44
  export * from "./constants"
44
45
  export * from "./orders/types"
45
46
  export type {