@chainpatrol/sdk 0.6.0 → 0.8.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 +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +65 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +65 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1275,17 +1275,17 @@ var PolyDateFormatter = class {
|
|
|
1275
1275
|
constructor(dt, intl, opts) {
|
|
1276
1276
|
this.opts = opts;
|
|
1277
1277
|
this.originalZone = void 0;
|
|
1278
|
-
let
|
|
1278
|
+
let z16 = void 0;
|
|
1279
1279
|
if (this.opts.timeZone) {
|
|
1280
1280
|
this.dt = dt;
|
|
1281
1281
|
} else if (dt.zone.type === "fixed") {
|
|
1282
1282
|
const gmtOffset = -1 * (dt.offset / 60);
|
|
1283
1283
|
const offsetZ = gmtOffset >= 0 ? `Etc/GMT+${gmtOffset}` : `Etc/GMT${gmtOffset}`;
|
|
1284
1284
|
if (dt.offset !== 0 && IANAZone.create(offsetZ).valid) {
|
|
1285
|
-
|
|
1285
|
+
z16 = offsetZ;
|
|
1286
1286
|
this.dt = dt;
|
|
1287
1287
|
} else {
|
|
1288
|
-
|
|
1288
|
+
z16 = "UTC";
|
|
1289
1289
|
this.dt = dt.offset === 0 ? dt : dt.setZone("UTC").plus({ minutes: dt.offset });
|
|
1290
1290
|
this.originalZone = dt.zone;
|
|
1291
1291
|
}
|
|
@@ -1293,14 +1293,14 @@ var PolyDateFormatter = class {
|
|
|
1293
1293
|
this.dt = dt;
|
|
1294
1294
|
} else if (dt.zone.type === "iana") {
|
|
1295
1295
|
this.dt = dt;
|
|
1296
|
-
|
|
1296
|
+
z16 = dt.zone.name;
|
|
1297
1297
|
} else {
|
|
1298
|
-
|
|
1298
|
+
z16 = "UTC";
|
|
1299
1299
|
this.dt = dt.setZone("UTC").plus({ minutes: dt.offset });
|
|
1300
1300
|
this.originalZone = dt.zone;
|
|
1301
1301
|
}
|
|
1302
1302
|
const intlOpts = __spreadValues({}, this.opts);
|
|
1303
|
-
intlOpts.timeZone = intlOpts.timeZone ||
|
|
1303
|
+
intlOpts.timeZone = intlOpts.timeZone || z16;
|
|
1304
1304
|
this.dtf = getCachedDTF(intl, intlOpts);
|
|
1305
1305
|
}
|
|
1306
1306
|
format() {
|
|
@@ -7239,6 +7239,23 @@ z.object({
|
|
|
7239
7239
|
*/
|
|
7240
7240
|
next_page: z.string().nullable().optional().describe("Cursor for fetching the next page of results")
|
|
7241
7241
|
}).describe("Successful operation");
|
|
7242
|
+
var assetSubmitInputSchema = z.object({
|
|
7243
|
+
assets: z.array(z.string()).max(100).describe(
|
|
7244
|
+
"List of assets to classify, such as domains, social profiles, or blockchain addresses."
|
|
7245
|
+
),
|
|
7246
|
+
organizationSlug: z.string().optional().describe(
|
|
7247
|
+
"Organization slug to classify assets for. If not provided, the classification will be done for all organizations."
|
|
7248
|
+
)
|
|
7249
|
+
});
|
|
7250
|
+
z.object({
|
|
7251
|
+
submittedAssets: z.array(
|
|
7252
|
+
z.object({
|
|
7253
|
+
asset: z.string().describe("The original asset content submitted"),
|
|
7254
|
+
assetId: z.number().describe("The ID of the created or existing asset"),
|
|
7255
|
+
scanId: z.number().optional().describe("The ID of the asset scan created (if immediately created)")
|
|
7256
|
+
})
|
|
7257
|
+
).describe("Array of submitted assets with their corresponding IDs")
|
|
7258
|
+
});
|
|
7242
7259
|
var BASE_64_PATTERN = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/;
|
|
7243
7260
|
var reportCreateInputSchema = z.object({
|
|
7244
7261
|
/** Optional slug for identifying the organization within ChainPatrol. */
|
|
@@ -7353,6 +7370,17 @@ z.object({
|
|
|
7353
7370
|
organizationLogo: z.string(),
|
|
7354
7371
|
organizationLogos: z.record(z.string(), z.string()),
|
|
7355
7372
|
hiddenLogos: z.record(z.string(), z.boolean()).default({}),
|
|
7373
|
+
logoCustomization: z.object({
|
|
7374
|
+
position: z.object({
|
|
7375
|
+
x: z.number(),
|
|
7376
|
+
y: z.number()
|
|
7377
|
+
}),
|
|
7378
|
+
size: z.object({
|
|
7379
|
+
width: z.number(),
|
|
7380
|
+
height: z.number()
|
|
7381
|
+
}),
|
|
7382
|
+
scale: z.number().min(0.1).max(3).default(1)
|
|
7383
|
+
}).optional(),
|
|
7356
7384
|
executiveSummary: z.string(),
|
|
7357
7385
|
overviewText: z.string(),
|
|
7358
7386
|
overviewDisplayLocation: z.enum(["cover", "separate"]).default("cover"),
|
|
@@ -7366,7 +7394,8 @@ z.object({
|
|
|
7366
7394
|
proposalId: z.number().optional(),
|
|
7367
7395
|
screenshotUrl: z.string().nullable().optional(),
|
|
7368
7396
|
screenshotUrls: z.array(z.string()).optional(),
|
|
7369
|
-
imageUrl: z.string().optional()
|
|
7397
|
+
imageUrl: z.string().optional(),
|
|
7398
|
+
takedownCompletedAt: z.string().nullable().optional()
|
|
7370
7399
|
})
|
|
7371
7400
|
),
|
|
7372
7401
|
productUpdates: z.array(
|
|
@@ -7408,7 +7437,15 @@ z.object({
|
|
|
7408
7437
|
title: z.string(),
|
|
7409
7438
|
content: z.string()
|
|
7410
7439
|
})
|
|
7411
|
-
).default([])
|
|
7440
|
+
).default([]),
|
|
7441
|
+
faqs: z.record(
|
|
7442
|
+
z.string(),
|
|
7443
|
+
z.object({
|
|
7444
|
+
title: z.string(),
|
|
7445
|
+
content: z.string(),
|
|
7446
|
+
enabled: z.boolean().default(true)
|
|
7447
|
+
})
|
|
7448
|
+
).default({})
|
|
7412
7449
|
});
|
|
7413
7450
|
|
|
7414
7451
|
// src/client.ts
|
|
@@ -7428,28 +7465,36 @@ var ChainPatrolClientErrorCodes = /* @__PURE__ */ ((ChainPatrolClientErrorCodes2
|
|
|
7428
7465
|
})(ChainPatrolClientErrorCodes || {});
|
|
7429
7466
|
var ChainPatrolClient = class {
|
|
7430
7467
|
constructor(options) {
|
|
7431
|
-
var _a;
|
|
7468
|
+
var _a, _b;
|
|
7432
7469
|
if (!options.apiKey) {
|
|
7433
7470
|
throw new ChainPatrolClientError(
|
|
7434
7471
|
"Missing API key",
|
|
7435
7472
|
"MISSING_API_KEY" /* MISSING_API_KEY */
|
|
7436
7473
|
);
|
|
7437
7474
|
}
|
|
7438
|
-
this.baseUrl = (
|
|
7475
|
+
this.baseUrl = trimTrailingSlashes(
|
|
7476
|
+
(_a = options.baseUrl) != null ? _a : "https://app.chainpatrol.io/api/"
|
|
7477
|
+
);
|
|
7439
7478
|
this.logger = new Logger({ component: "ChainPatrolClient" });
|
|
7440
7479
|
this.apiKey = options.apiKey;
|
|
7480
|
+
this.fetchOptions = (_b = options.fetchOptions) != null ? _b : {};
|
|
7441
7481
|
}
|
|
7442
7482
|
fetch(req) {
|
|
7443
7483
|
return __async(this, null, function* () {
|
|
7484
|
+
var _a;
|
|
7444
7485
|
const url = `${trimTrailingSlashes(this.baseUrl)}/${req.path.join("/")}`;
|
|
7445
7486
|
this.logger.debug("fetch", { url, req });
|
|
7446
7487
|
const bodyString = JSON.stringify(req.body);
|
|
7447
7488
|
const res = yield fetch(url, {
|
|
7448
7489
|
method: req.method,
|
|
7449
|
-
headers: {
|
|
7490
|
+
headers: __spreadValues({
|
|
7450
7491
|
"Content-Type": "application/json",
|
|
7451
7492
|
"X-Api-Key": this.apiKey
|
|
7452
|
-
},
|
|
7493
|
+
}, (_a = this.fetchOptions.headers) != null ? _a : {}),
|
|
7494
|
+
signal: this.fetchOptions.signal,
|
|
7495
|
+
redirect: this.fetchOptions.redirect,
|
|
7496
|
+
mode: this.fetchOptions.mode,
|
|
7497
|
+
credentials: this.fetchOptions.credentials,
|
|
7453
7498
|
body: bodyString
|
|
7454
7499
|
});
|
|
7455
7500
|
if (!res.ok) {
|
|
@@ -7477,6 +7522,14 @@ var ChainPatrolClient = class {
|
|
|
7477
7522
|
method: "POST",
|
|
7478
7523
|
body
|
|
7479
7524
|
});
|
|
7525
|
+
}),
|
|
7526
|
+
submit: (req) => __async(this, null, function* () {
|
|
7527
|
+
const body = assetSubmitInputSchema.parse(req);
|
|
7528
|
+
return yield this.fetch({
|
|
7529
|
+
path: ["v2", "asset", "submit"],
|
|
7530
|
+
method: "POST",
|
|
7531
|
+
body
|
|
7532
|
+
});
|
|
7480
7533
|
})
|
|
7481
7534
|
};
|
|
7482
7535
|
}
|