@opensea/sdk 12.7.0 → 12.9.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/src/types.ts CHANGED
@@ -211,6 +211,7 @@ export enum Chain {
211
211
  Ink = "ink",
212
212
  Robinhood = "robinhood",
213
213
  StableChain = "stablechain",
214
+ Arc = "arc",
214
215
  }
215
216
 
216
217
  // Compile-time check: every ChainIdentifier from the API spec must be assignable to Chain.
@@ -388,12 +389,42 @@ export interface RequestOptions {
388
389
  * names and trait values, so the default rewrite reports a `dark_brown` trait
389
390
  * as `darkBrown` and merges two traits that differ only in casing.
390
391
  *
391
- * The return type stays the camelized view, so the caller is responsible for
392
- * passing a `T` whose keys already match the wire shape. `GetTraitsResponse`
393
- * qualifies because `Camelize<T>` passes index signatures through unchanged.
394
- * Setting this to `false` with a `T` that has snake_case keys makes the
395
- * declared type wrong: it will claim camelCase properties the response does
396
- * not have. The flag does not narrow the return type, so nothing catches it.
392
+ * Write it as the literal `false` at the call site. `get`, `post` and
393
+ * `request` overload on that literal and return the raw `T` instead of
394
+ * `Camelize<T>`, so a snake_case `T` stays snake_case in the type as well as
395
+ * at runtime. A `boolean` whose value the compiler cannot see (a variable, or
396
+ * a property widened by a `const` declaration without `as const`) selects the
397
+ * camelized signature. That is accurate when the value turns out to be
398
+ * `true`, and wrong when it is `false`, because the runtime skips the rewrite
399
+ * and the declared type still claims camelCase properties the response does
400
+ * not have. See {@link RawResponseOptions}.
397
401
  */
398
402
  camelizeResponse?: boolean
399
403
  }
404
+
405
+ /**
406
+ * The options shape that selects the un-camelized overload of `get`, `post`
407
+ * and `request`.
408
+ *
409
+ * `camelizeResponse` is the literal `false` rather than `boolean`, which is
410
+ * what lets the overload fire: TypeScript keeps the literal when the property
411
+ * is written inline at the call site or the object is declared `as const`, and
412
+ * widens it to `boolean` otherwise.
413
+ *
414
+ * @example
415
+ * ```ts
416
+ * type UploadPolicy = { upload_url: string; success_action_status: string }
417
+ *
418
+ * // Selects the raw overload. `policy.success_action_status` is typed and
419
+ * // present; `policy.successActionStatus` is a compile error.
420
+ * const policy = await api.get<UploadPolicy>(path, undefined, {
421
+ * camelizeResponse: false,
422
+ * })
423
+ * ```
424
+ *
425
+ * @category API Models
426
+ */
427
+ export type RawResponseOptions<O extends RequestOptions = RequestOptions> =
428
+ O & {
429
+ camelizeResponse: false
430
+ }
@@ -14,6 +14,7 @@ import {
14
14
  OPENSEA_SIGNED_ZONE_V2,
15
15
  SOMNIA_FEE_RECIPIENT,
16
16
  WPOL_ADDRESS,
17
+ ZERO_ADDRESS,
17
18
  } from "../constants"
18
19
  import { Chain } from "../types"
19
20
  import { CHAIN_ID_MAP } from "./chainIds.generated"
@@ -106,11 +107,10 @@ export const getOfferPaymentToken = (chain: Chain) => {
106
107
  return "0x3bd359c1119da7da1d913d1c4d2b7c461115433a" // WMON
107
108
  case Chain.Robinhood:
108
109
  return "0x0bd7d308f8e1639fab988df18a8011f41eacad73" // WETH
109
- // Payment tokens not yet mapped in the SDK
110
+ case Chain.Arc:
111
+ return "0x3600000000000000000000000000000000000000" // USDC (6-decimal ERC20 mirror of native USDC)
110
112
  case Chain.StableChain:
111
- throw new Error(
112
- `Chain ${chain} is not supported for OpenSea Seaport offers`,
113
- )
113
+ return "0x779ded0c9e1022225f8e0630b35a9b54be713736" // USDT0 (6-decimal ERC20 mirror of native gUSDT0)
114
114
  default: {
115
115
  const exhaustiveChain: never = chain
116
116
  throw new Error(`Unknown offer currency for ${exhaustiveChain}`)
@@ -167,11 +167,10 @@ export const getListingPaymentToken = (chain: Chain) => {
167
167
  return "0x0000000000000000000000000000000000000000" // ANIME
168
168
  case Chain.Robinhood:
169
169
  return "0x0000000000000000000000000000000000000000" // ETH
170
- // Payment tokens not yet mapped in the SDK
170
+ case Chain.Arc:
171
+ return ZERO_ADDRESS
171
172
  case Chain.StableChain:
172
- throw new Error(
173
- `Chain ${chain} is not supported for OpenSea Seaport listings`,
174
- )
173
+ return ZERO_ADDRESS
175
174
  default: {
176
175
  const exhaustiveChain: never = chain
177
176
  throw new Error(`Unknown listing currency for ${exhaustiveChain}`)
@@ -192,6 +191,8 @@ export const getDefaultConduit = (
192
191
  case Chain.HyperEVM:
193
192
  case Chain.Monad:
194
193
  case Chain.Robinhood:
194
+ case Chain.Arc:
195
+ case Chain.StableChain:
195
196
  return {
196
197
  key: OPENSEA_CONDUIT_KEY_2,
197
198
  address: OPENSEA_CONDUIT_ADDRESS_2,
@@ -260,6 +261,11 @@ export const getNativeWrapTokenAddress = (chain: Chain): string => {
260
261
  switch (chain) {
261
262
  case Chain.Polygon:
262
263
  return WPOL_ADDRESS
264
+ case Chain.Arc:
265
+ case Chain.StableChain:
266
+ throw new Error(
267
+ `Chain ${chain} has no wrapped native token; offers spend the native balance directly through ${getOfferPaymentToken(chain)}`,
268
+ )
263
269
  default:
264
270
  return getOfferPaymentToken(chain)
265
271
  }
@@ -22,6 +22,7 @@ export const CHAIN_ID_MAP: Record<string, string> = {
22
22
  megaeth: "4326",
23
23
  robinhood: "4663",
24
24
  somnia: "5031",
25
+ arc: "5042",
25
26
  b3: "8333",
26
27
  base: "8453",
27
28
  ape_chain: "33139",