@chainpatrol/sdk 0.6.0 → 0.7.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/dist/index.d.mts CHANGED
@@ -46,6 +46,7 @@ declare class Relay {
46
46
  type ChainPatrolClientOptions = {
47
47
  apiKey: string;
48
48
  baseUrl?: string;
49
+ fetchOptions?: Pick<RequestInit, "headers" | "signal" | "redirect" | "mode" | "credentials">;
49
50
  };
50
51
  type ApiRequest = {
51
52
  path: string[];
@@ -66,6 +67,7 @@ declare class ChainPatrolClient {
66
67
  readonly baseUrl: string;
67
68
  private readonly apiKey;
68
69
  private readonly logger;
70
+ private readonly fetchOptions;
69
71
  constructor(options: ChainPatrolClientOptions);
70
72
  fetch<TResult = unknown>(req: ApiRequest): Promise<TResult>;
71
73
  get asset(): {
package/dist/index.d.ts CHANGED
@@ -46,6 +46,7 @@ declare class Relay {
46
46
  type ChainPatrolClientOptions = {
47
47
  apiKey: string;
48
48
  baseUrl?: string;
49
+ fetchOptions?: Pick<RequestInit, "headers" | "signal" | "redirect" | "mode" | "credentials">;
49
50
  };
50
51
  type ApiRequest = {
51
52
  path: string[];
@@ -66,6 +67,7 @@ declare class ChainPatrolClient {
66
67
  readonly baseUrl: string;
67
68
  private readonly apiKey;
68
69
  private readonly logger;
70
+ private readonly fetchOptions;
69
71
  constructor(options: ChainPatrolClientOptions);
70
72
  fetch<TResult = unknown>(req: ApiRequest): Promise<TResult>;
71
73
  get asset(): {
package/dist/index.js CHANGED
@@ -7355,6 +7355,17 @@ zod.z.object({
7355
7355
  organizationLogo: zod.z.string(),
7356
7356
  organizationLogos: zod.z.record(zod.z.string(), zod.z.string()),
7357
7357
  hiddenLogos: zod.z.record(zod.z.string(), zod.z.boolean()).default({}),
7358
+ logoCustomization: zod.z.object({
7359
+ position: zod.z.object({
7360
+ x: zod.z.number(),
7361
+ y: zod.z.number()
7362
+ }),
7363
+ size: zod.z.object({
7364
+ width: zod.z.number(),
7365
+ height: zod.z.number()
7366
+ }),
7367
+ scale: zod.z.number().min(0.1).max(3).default(1)
7368
+ }).optional(),
7358
7369
  executiveSummary: zod.z.string(),
7359
7370
  overviewText: zod.z.string(),
7360
7371
  overviewDisplayLocation: zod.z.enum(["cover", "separate"]).default("cover"),
@@ -7368,7 +7379,8 @@ zod.z.object({
7368
7379
  proposalId: zod.z.number().optional(),
7369
7380
  screenshotUrl: zod.z.string().nullable().optional(),
7370
7381
  screenshotUrls: zod.z.array(zod.z.string()).optional(),
7371
- imageUrl: zod.z.string().optional()
7382
+ imageUrl: zod.z.string().optional(),
7383
+ takedownCompletedAt: zod.z.string().nullable().optional()
7372
7384
  })
7373
7385
  ),
7374
7386
  productUpdates: zod.z.array(
@@ -7410,7 +7422,15 @@ zod.z.object({
7410
7422
  title: zod.z.string(),
7411
7423
  content: zod.z.string()
7412
7424
  })
7413
- ).default([])
7425
+ ).default([]),
7426
+ faqs: zod.z.record(
7427
+ zod.z.string(),
7428
+ zod.z.object({
7429
+ title: zod.z.string(),
7430
+ content: zod.z.string(),
7431
+ enabled: zod.z.boolean().default(true)
7432
+ })
7433
+ ).default({})
7414
7434
  });
7415
7435
 
7416
7436
  // src/client.ts
@@ -7430,28 +7450,36 @@ var ChainPatrolClientErrorCodes = /* @__PURE__ */ ((ChainPatrolClientErrorCodes2
7430
7450
  })(ChainPatrolClientErrorCodes || {});
7431
7451
  var ChainPatrolClient = class {
7432
7452
  constructor(options) {
7433
- var _a;
7453
+ var _a, _b;
7434
7454
  if (!options.apiKey) {
7435
7455
  throw new ChainPatrolClientError(
7436
7456
  "Missing API key",
7437
7457
  "MISSING_API_KEY" /* MISSING_API_KEY */
7438
7458
  );
7439
7459
  }
7440
- this.baseUrl = (_a = options.baseUrl) != null ? _a : "https://app.chainpatrol.io/api/";
7460
+ this.baseUrl = trimTrailingSlashes(
7461
+ (_a = options.baseUrl) != null ? _a : "https://app.chainpatrol.io/api/"
7462
+ );
7441
7463
  this.logger = new Logger({ component: "ChainPatrolClient" });
7442
7464
  this.apiKey = options.apiKey;
7465
+ this.fetchOptions = (_b = options.fetchOptions) != null ? _b : {};
7443
7466
  }
7444
7467
  fetch(req) {
7445
7468
  return __async(this, null, function* () {
7469
+ var _a;
7446
7470
  const url = `${trimTrailingSlashes(this.baseUrl)}/${req.path.join("/")}`;
7447
7471
  this.logger.debug("fetch", { url, req });
7448
7472
  const bodyString = JSON.stringify(req.body);
7449
7473
  const res = yield fetch(url, {
7450
7474
  method: req.method,
7451
- headers: {
7475
+ headers: __spreadValues({
7452
7476
  "Content-Type": "application/json",
7453
7477
  "X-Api-Key": this.apiKey
7454
- },
7478
+ }, (_a = this.fetchOptions.headers) != null ? _a : {}),
7479
+ signal: this.fetchOptions.signal,
7480
+ redirect: this.fetchOptions.redirect,
7481
+ mode: this.fetchOptions.mode,
7482
+ credentials: this.fetchOptions.credentials,
7455
7483
  body: bodyString
7456
7484
  });
7457
7485
  if (!res.ok) {