@chainpatrol/sdk 0.2.2 → 0.3.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.ts +14 -82
- package/dist/index.js +6211 -197
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6214 -200
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { AssetCheckInput, AssetCheckOutput, AssetListInput, AssetListOutput, ReportCreateInput } from '@chainpatrol/validation';
|
|
2
|
+
|
|
1
3
|
declare const ContinueAtOwnRisk = "CHAINPATROL_CONTINUE_AT_OWN_RISK";
|
|
2
4
|
declare const IgnorelistUpdated = "CHAINPATROL_IGNORELIST_UPDATED";
|
|
3
5
|
declare const CloseCurrentTab = "CHAINPATROL_CLOSE_CURRENT_TAB";
|
|
@@ -45,6 +47,11 @@ type ChainPatrolClientOptions = {
|
|
|
45
47
|
apiKey: string;
|
|
46
48
|
baseUrl?: string;
|
|
47
49
|
};
|
|
50
|
+
type ApiRequest = {
|
|
51
|
+
path: string[];
|
|
52
|
+
method: "GET" | "POST" | "PUT" | "DELETE";
|
|
53
|
+
body?: unknown;
|
|
54
|
+
};
|
|
48
55
|
type AssetType = "URL" | "PAGE" | "ADDRESS";
|
|
49
56
|
type AssetStatus = "ALLOWED" | "BLOCKED" | "UNKNOWN";
|
|
50
57
|
declare class ChainPatrolClient {
|
|
@@ -52,95 +59,20 @@ declare class ChainPatrolClient {
|
|
|
52
59
|
private readonly apiKey;
|
|
53
60
|
private readonly logger;
|
|
54
61
|
constructor(options: ChainPatrolClientOptions);
|
|
55
|
-
|
|
62
|
+
fetch<TResult = unknown>(req: ApiRequest): Promise<TResult>;
|
|
56
63
|
get asset(): {
|
|
57
|
-
check: (req:
|
|
58
|
-
|
|
59
|
-
* Asset content. Could be a domain, URL, or crypto address.
|
|
60
|
-
*/
|
|
61
|
-
content: string;
|
|
62
|
-
}) => Promise<{
|
|
63
|
-
/**
|
|
64
|
-
* "ALLOWED" - the asset is on the allowlist
|
|
65
|
-
* "BLOCKED" - the asset is on the blocklist
|
|
66
|
-
* "UNKNOWN" - the asset's status is not known
|
|
67
|
-
*/
|
|
68
|
-
status: AssetStatus;
|
|
69
|
-
/**
|
|
70
|
-
* If the asset is allowed or blocked, this will be the reason why.
|
|
71
|
-
* ChainPatrol aggregates data from multiple sources, so this will
|
|
72
|
-
* tell you which source blocked or allowed the asset.
|
|
73
|
-
*
|
|
74
|
-
* ex. 'eth-phishing-detect' - the asset is on MetaMask's blocklist
|
|
75
|
-
* 'reported' - the asset is on ChainPatrol's blocklist because
|
|
76
|
-
* it was reported by a user
|
|
77
|
-
*/
|
|
78
|
-
reason?: string;
|
|
79
|
-
}>;
|
|
80
|
-
list: (req: {
|
|
81
|
-
/**
|
|
82
|
-
* Asset type
|
|
83
|
-
*/
|
|
84
|
-
type: AssetType;
|
|
85
|
-
/**
|
|
86
|
-
* Status of the assets to retrieve
|
|
87
|
-
*/
|
|
88
|
-
status: AssetStatus;
|
|
89
|
-
/**
|
|
90
|
-
* The start date to list assets from. This should be in the format `YYYY-MM-DD` and is inclusive.
|
|
91
|
-
*/
|
|
92
|
-
startDate?: string;
|
|
93
|
-
/**
|
|
94
|
-
* The end date to list assets from. This should be in the format `YYYY-MM-DD` and is inclusive.
|
|
95
|
-
*/
|
|
96
|
-
endDate?: string;
|
|
97
|
-
}) => Promise<{
|
|
98
|
-
content: string;
|
|
99
|
-
type: AssetType;
|
|
100
|
-
status: AssetStatus;
|
|
101
|
-
}[]>;
|
|
64
|
+
check: (req: AssetCheckInput) => Promise<AssetCheckOutput>;
|
|
65
|
+
list: (req: AssetListInput) => Promise<AssetListOutput>;
|
|
102
66
|
};
|
|
103
67
|
get report(): {
|
|
104
|
-
create: (req: {
|
|
105
|
-
/** Report title */
|
|
106
|
-
title: string;
|
|
107
|
-
/** Report description */
|
|
108
|
-
description: string;
|
|
109
|
-
/** List of assets to report with the proposed status */
|
|
110
|
-
assets: {
|
|
111
|
-
content: string;
|
|
112
|
-
status: AssetStatus;
|
|
113
|
-
}[];
|
|
114
|
-
/** Organization slug (provide this or `discordGuildId`) */
|
|
115
|
-
organizationSlug?: string;
|
|
116
|
-
/** Discord guild ID (provide this or `organizationSlug`) */
|
|
117
|
-
discordGuildId?: string;
|
|
118
|
-
/** Optional raw input of the assets */
|
|
119
|
-
rawAssetsInput?: string;
|
|
120
|
-
/** Optional List of URLs of images to attach to the report */
|
|
121
|
-
attachmentUrls?: string[];
|
|
122
|
-
/** Optional contact information of the reporter */
|
|
123
|
-
contactInfo?: string;
|
|
124
|
-
/** Optional ID of the reporter if they are a member on ChainPatrol */
|
|
125
|
-
reporterId?: number;
|
|
126
|
-
/**
|
|
127
|
-
* Optional information about the reporter if they are reporting from
|
|
128
|
-
* a platform other than ChainPatrol
|
|
129
|
-
*/
|
|
130
|
-
externalReporter?: {
|
|
131
|
-
platform: string;
|
|
132
|
-
platformIdentifier: string;
|
|
133
|
-
avatarUrl?: string;
|
|
134
|
-
displayName?: string;
|
|
135
|
-
};
|
|
136
|
-
}) => Promise<{
|
|
68
|
+
create: (req: ReportCreateInput) => Promise<{
|
|
137
69
|
id: number;
|
|
138
|
-
createdAt:
|
|
70
|
+
createdAt: Date;
|
|
139
71
|
organization: {
|
|
140
|
-
id: number;
|
|
141
72
|
slug: string;
|
|
142
73
|
name: string;
|
|
143
|
-
|
|
74
|
+
id: number;
|
|
75
|
+
} | null;
|
|
144
76
|
}>;
|
|
145
77
|
};
|
|
146
78
|
}
|