@james-wu/tokenguard-sdk 0.1.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/LICENSE ADDED
@@ -0,0 +1,184 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and
10
+ distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by the copyright
13
+ owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all other entities
16
+ that control, are controlled by, or are under common control with that entity.
17
+ For the purposes of this definition, "control" means (i) the power, direct or
18
+ indirect, to cause the direction or management of such entity, whether by
19
+ contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
20
+ outstanding shares, or (iii) beneficial ownership of such entity.
21
+
22
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
23
+ permissions granted by this License.
24
+
25
+ "Source" form shall mean the preferred form for making modifications, including
26
+ but not limited to software source code, documentation source, and configuration
27
+ files.
28
+
29
+ "Object" form shall mean any form resulting from mechanical transformation or
30
+ translation of a Source form, including but not limited to compiled object code,
31
+ generated documentation, and conversions to other media types.
32
+
33
+ "Work" shall mean the work of authorship, whether in Source or Object form,
34
+ made available under the License, as indicated by a copyright notice that is
35
+ included in or attached to the work (an example is provided in the Appendix
36
+ below).
37
+
38
+ "Derivative Works" shall mean any work, whether in Source or Object form, that
39
+ is based on (or derived from) the Work and for which the editorial revisions,
40
+ annotations, elaborations, or other modifications represent, as a whole, an
41
+ original work of authorship. For the purposes of this License, Derivative Works
42
+ shall not include works that remain separable from, or merely link (or bind by
43
+ name) to the interfaces of, the Work and Derivative Works thereof.
44
+
45
+ "Contribution" shall mean any work of authorship, including the original
46
+ version of the Work and any modifications or additions to that Work or
47
+ Derivative Works thereof, that is intentionally submitted to Licensor for
48
+ inclusion in the Work by the copyright owner or by an individual or Legal
49
+ Entity authorized to submit on behalf of the copyright owner. For the purposes
50
+ of this definition, "submitted" means any form of electronic, verbal, or
51
+ written communication sent to the Licensor or its representatives, including
52
+ but not limited to communication on electronic mailing lists, source code
53
+ control systems, and issue tracking systems that are managed by, or on behalf
54
+ of, the Licensor for the purpose of discussing and improving the Work, but
55
+ excluding communication that is conspicuously marked or otherwise designated in
56
+ writing by the copyright owner as "Not a Contribution."
57
+
58
+ "Contributor" shall mean Licensor and any individual or Legal Entity on behalf
59
+ of whom a Contribution has been received by Licensor and subsequently
60
+ incorporated within the Work.
61
+
62
+ 2. Grant of Copyright License. Subject to the terms and conditions of this
63
+ License, each Contributor hereby grants to You a perpetual, worldwide,
64
+ non-exclusive, no-charge, royalty-free, irrevocable copyright license to
65
+ reproduce, prepare Derivative Works of, publicly display, publicly perform,
66
+ sublicense, and distribute the Work and such Derivative Works in Source or
67
+ Object form.
68
+
69
+ 3. Grant of Patent License. Subject to the terms and conditions of this
70
+ License, each Contributor hereby grants to You a perpetual, worldwide,
71
+ non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this
72
+ section) patent license to make, have made, use, offer to sell, sell, import,
73
+ and otherwise transfer the Work, where such license applies only to those
74
+ patent claims licensable by such Contributor that are necessarily infringed by
75
+ their Contribution(s) alone or by combination of their Contribution(s) with the
76
+ Work to which such Contribution(s) was submitted. If You institute patent
77
+ litigation against any entity (including a cross-claim or counterclaim in a
78
+ lawsuit) alleging that the Work or a Contribution incorporated within the Work
79
+ constitutes direct or contributory patent infringement, then any patent
80
+ licenses granted to You under this License for that Work shall terminate as of
81
+ the date such litigation is filed.
82
+
83
+ 4. Redistribution. You may reproduce and distribute copies of the Work or
84
+ Derivative Works thereof in any medium, with or without modifications, and in
85
+ Source or Object form, provided that You meet the following conditions:
86
+
87
+ (a) You must give any other recipients of the Work or Derivative Works a copy
88
+ of this License; and
89
+
90
+ (b) You must cause any modified files to carry prominent notices stating that
91
+ You changed the files; and
92
+
93
+ (c) You must retain, in the Source form of any Derivative Works that You
94
+ distribute, all copyright, patent, trademark, and attribution notices from the
95
+ Source form of the Work, excluding those notices that do not pertain to any
96
+ part of the Derivative Works; and
97
+
98
+ (d) If the Work includes a "NOTICE" text file as part of its distribution, then
99
+ any Derivative Works that You distribute must include a readable copy of the
100
+ attribution notices contained within such NOTICE file, excluding those notices
101
+ that do not pertain to any part of the Derivative Works, in at least one of the
102
+ following places: within a NOTICE text file distributed as part of the
103
+ Derivative Works; within the Source form or documentation, if provided along
104
+ with the Derivative Works; or, within a display generated by the Derivative
105
+ Works, if and wherever such third-party notices normally appear. The contents
106
+ of the NOTICE file are for informational purposes only and do not modify the
107
+ License. You may add Your own attribution notices within Derivative Works that
108
+ You distribute, alongside or as an addendum to the NOTICE text from the Work,
109
+ provided that such additional attribution notices cannot be construed as
110
+ modifying the License.
111
+
112
+ You may add Your own copyright statement to Your modifications and may provide
113
+ additional or different license terms and conditions for use, reproduction, or
114
+ distribution of Your modifications, or for any such Derivative Works as a
115
+ whole, provided Your use, reproduction, and distribution of the Work otherwise
116
+ complies with the conditions stated in this License.
117
+
118
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any
119
+ Contribution intentionally submitted for inclusion in the Work by You to the
120
+ Licensor shall be under the terms and conditions of this License, without any
121
+ additional terms or conditions. Notwithstanding the above, nothing herein shall
122
+ supersede or modify the terms of any separate license agreement you may have
123
+ executed with Licensor regarding such Contributions.
124
+
125
+ 6. Trademarks. This License does not grant permission to use the trade names,
126
+ trademarks, service marks, or product names of the Licensor, except as required
127
+ for reasonable and customary use in describing the origin of the Work and
128
+ reproducing the content of the NOTICE file.
129
+
130
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
131
+ writing, Licensor provides the Work (and each Contributor provides its
132
+ Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
133
+ KIND, either express or implied, including, without limitation, any warranties
134
+ or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
135
+ PARTICULAR PURPOSE. You are solely responsible for determining the
136
+ appropriateness of using or redistributing the Work and assume any risks
137
+ associated with Your exercise of permissions under this License.
138
+
139
+ 8. Limitation of Liability. In no event and under no legal theory, whether in
140
+ tort (including negligence), contract, or otherwise, unless required by
141
+ applicable law (such as deliberate and grossly negligent acts) or agreed to in
142
+ writing, shall any Contributor be liable to You for damages, including any
143
+ direct, indirect, special, incidental, or consequential damages of any
144
+ character arising as a result of this License or out of the use or inability to
145
+ use the Work (including but not limited to damages for loss of goodwill, work
146
+ stoppage, computer failure or malfunction, or any and all other commercial
147
+ damages or losses), even if such Contributor has been advised of the
148
+ possibility of such damages.
149
+
150
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work or
151
+ Derivative Works thereof, You may choose to offer, and charge a fee for,
152
+ acceptance of support, warranty, indemnity, or other liability obligations
153
+ and/or rights consistent with this License. However, in accepting such
154
+ obligations, You may act only on Your own behalf and on Your sole
155
+ responsibility, not on behalf of any other Contributor, and only if You agree
156
+ to indemnify, defend, and hold each Contributor harmless for any liability
157
+ incurred by, or claims asserted against, such Contributor by reason of your
158
+ accepting any such warranty or additional liability.
159
+
160
+ END OF TERMS AND CONDITIONS
161
+
162
+ APPENDIX: How to apply the Apache License to your work.
163
+
164
+ To apply the Apache License to your work, attach the following boilerplate
165
+ notice, with the fields enclosed by brackets "[]" replaced with your own
166
+ identifying information. (Don't include the brackets.) The text should be
167
+ enclosed in the appropriate comment syntax for the file format. We also
168
+ recommend that a file or class name and description of purpose be included on
169
+ the same "printed page" as the copyright notice for easier identification
170
+ within third-party archives.
171
+
172
+ Copyright [yyyy] [name of copyright owner]
173
+
174
+ Licensed under the Apache License, Version 2.0 (the "License");
175
+ you may not use this file except in compliance with the License.
176
+ You may obtain a copy of the License at
177
+
178
+ http://www.apache.org/licenses/LICENSE-2.0
179
+
180
+ Unless required by applicable law or agreed to in writing, software
181
+ distributed under the License is distributed on an "AS IS" BASIS,
182
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
183
+ See the License for the specific language governing permissions and
184
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,138 @@
1
+ # `@james-wu/tokenguard-sdk`
2
+
3
+ TypeScript SDK for embedding TokenGuard risk analysis into wallets, exchanges, browser extensions, and Web3 security products.
4
+
5
+ Best for:
6
+
7
+ - wallet confirmation flows
8
+ - exchange or trading risk checks
9
+ - extension-side signing prompts
10
+ - internal security or analyst tooling
11
+
12
+ ## What It Does
13
+
14
+ The SDK wraps the TokenGuard HTTP API and gives you typed methods for:
15
+
16
+ - transaction and signature risk analysis
17
+ - domain and phishing analysis
18
+ - approval exposure checks
19
+ - address reputation lookup
20
+ - AI explanations and user advice
21
+ - quantum-readiness assessment
22
+
23
+ ## Installation
24
+
25
+ ```bash
26
+ npm install @james-wu/tokenguard-sdk
27
+ ```
28
+
29
+ ## Links
30
+
31
+ - Repository: [James-Wuguoqing/tokenguard-ai](https://github.com/James-Wuguoqing/tokenguard-ai)
32
+ - Package: [npmjs.com/package/@james-wu/tokenguard-sdk](https://www.npmjs.com/package/@james-wu/tokenguard-sdk)
33
+ - UI package: [npmjs.com/package/@james-wu/tokenguard-ui](https://www.npmjs.com/package/@james-wu/tokenguard-ui)
34
+ - Minimal integration example: [demo/minimal-integration.html](https://github.com/James-Wuguoqing/tokenguard-ai/blob/main/demo/minimal-integration.html)
35
+ - Embedded widget example: [examples/embedded-widget](https://github.com/James-Wuguoqing/tokenguard-ai/tree/main/examples/embedded-widget)
36
+
37
+ ## Quick Start
38
+
39
+ ```ts
40
+ import { TokenGuardClient } from "@james-wu/tokenguard-sdk";
41
+
42
+ const client = new TokenGuardClient({
43
+ apiKey: "tg_demo_sandbox_key",
44
+ chainId: 1,
45
+ baseUrl: "http://localhost:8787",
46
+ language: "en-US",
47
+ userLevel: "beginner"
48
+ });
49
+
50
+ const result = await client.analyzeTransaction({
51
+ walletAddress: "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
52
+ to: "0x1111111111111111111111111111111111111111",
53
+ data: "0x095ea7b30000000000000000000000001111111111111111111111111111111111111111ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
54
+ value: "0",
55
+ context: {
56
+ url: "https://metamask-support-wallet.xyz"
57
+ }
58
+ });
59
+
60
+ console.log(result.riskLevel);
61
+ console.log(result.summary);
62
+ console.log(result.recommendations);
63
+ ```
64
+
65
+ ## Production And Local Base URLs
66
+
67
+ If you pass `baseUrl`, the SDK will call that origin directly.
68
+
69
+ ```ts
70
+ const client = new TokenGuardClient({
71
+ apiKey: "YOUR_API_KEY",
72
+ chainId: 1,
73
+ baseUrl: "https://your-tokenguard-gateway.example.com"
74
+ });
75
+ ```
76
+
77
+ If `baseUrl` is omitted:
78
+
79
+ - in browsers, the SDK uses the current page origin
80
+ - in Node.js, `sandbox` falls back to `http://localhost:8787`
81
+ - in Node.js, `production` falls back to `https://api.tokenguard.ai`
82
+
83
+ ## Core Methods
84
+
85
+ - `analyzeTransaction()`
86
+ - `analyzeDomain()`
87
+ - `checkApproval()`
88
+ - `getAddressReputation()`
89
+ - `getAIExplanation()`
90
+ - `generateLiveAIExplanation()`
91
+ - `assessQuantumExposure()`
92
+ - `getUserAdvice()`
93
+ - `getAIProviderSession()`
94
+ - `connectAIProvider()`
95
+ - `disconnectAIProvider()`
96
+
97
+ ## Type Exports
98
+
99
+ The package also exports the request and response types used by the client, including:
100
+
101
+ - `TokenGuardConfig`
102
+ - `AnalyzeTransactionParams`
103
+ - `AnalyzeTransactionResult`
104
+ - `DomainAnalyzeParams`
105
+ - `DomainAnalyzeResult`
106
+ - `ApprovalCheckParams`
107
+ - `ApprovalCheckResult`
108
+ - `AddressReputationParams`
109
+ - `AddressReputationResult`
110
+ - `AIExplainParams`
111
+ - `AIExplainResult`
112
+ - `LiveAIExplainParams`
113
+ - `LiveAIExplainResult`
114
+ - `QuantumAssessParams`
115
+ - `QuantumAssessResult`
116
+ - `UserAdviceParams`
117
+ - `UserAdviceResult`
118
+
119
+ ## Notes
120
+
121
+ - This package is an API client. The core risk rules run on the TokenGuard service, not inside the browser bundle.
122
+ - Node.js 18+ and modern browsers can use the built-in `fetch` implementation.
123
+ - For local development in this repository, start the demo service with `npm run serve:managed` from the project root before using `http://localhost:8787`.
124
+
125
+ ## Local Try
126
+
127
+ If you want to try the SDK against the local demo service from this repository:
128
+
129
+ ```powershell
130
+ npm install
131
+ npm run serve:managed
132
+ ```
133
+
134
+ Then point `baseUrl` to:
135
+
136
+ ```text
137
+ http://localhost:8787
138
+ ```
@@ -0,0 +1,31 @@
1
+ import type { AIProviderCatalog, AIProviderSessionStatus, AddressReputationParams, AddressReputationResult, AIExplainParams, AIExplainResult, AnalyzeTransactionParams, AnalyzeTransactionResult, ApprovalCheckParams, ApprovalCheckResult, DomainAnalyzeParams, DomainAnalyzeResult, Environment, Language, LiveAIExplainParams, LiveAIExplainResult, QuantumAssessParams, QuantumAssessResult, UserAdviceParams, UserAdviceResult, UserLevel, ConnectAIProviderParams } from "./types.js";
2
+ export type TokenGuardConfig = {
3
+ apiKey: string;
4
+ chainId: number;
5
+ environment?: Environment;
6
+ enableAI?: boolean;
7
+ enableQuantumReady?: boolean;
8
+ language?: Language;
9
+ userLevel?: UserLevel;
10
+ baseUrl?: string;
11
+ fetcher?: typeof fetch;
12
+ };
13
+ export declare class TokenGuardClient {
14
+ private readonly config;
15
+ constructor(config: TokenGuardConfig);
16
+ private request;
17
+ analyzeTransaction(params: AnalyzeTransactionParams): Promise<AnalyzeTransactionResult>;
18
+ analyzeDomain(params: DomainAnalyzeParams): Promise<DomainAnalyzeResult>;
19
+ checkApproval(params: ApprovalCheckParams): Promise<ApprovalCheckResult>;
20
+ getAddressReputation(params: AddressReputationParams): Promise<AddressReputationResult>;
21
+ getAIExplanation(params: AIExplainParams): Promise<AIExplainResult>;
22
+ assessQuantumExposure(params: QuantumAssessParams): Promise<QuantumAssessResult>;
23
+ getUserAdvice(params: UserAdviceParams): Promise<UserAdviceResult>;
24
+ getAIProviderSession(): Promise<AIProviderSessionStatus>;
25
+ getAIProviderCatalog(): Promise<AIProviderCatalog>;
26
+ connectAIProvider(params: ConnectAIProviderParams): Promise<AIProviderSessionStatus>;
27
+ disconnectAIProvider(): Promise<AIProviderSessionStatus>;
28
+ generateLiveAIExplanation(params: LiveAIExplainParams): Promise<LiveAIExplainResult>;
29
+ }
30
+ export type { AIAuthMode, AIProviderCatalog, AIProviderCatalogEntry, AIProviderAuthModeDescriptor, AIProvider, AIProviderKind, AIProviderSessionStatus, AddressReputationParams, AddressReputationResult, AIExplainParams, AIExplainResult, AnalyzeTransactionParams, AnalyzeTransactionResult, ApprovalCheckParams, ApprovalCheckResult, ConnectAIProviderParams, DomainAnalyzeParams, DomainAnalyzeResult, DomainStatus, Environment, Language, LiveAIExplainParams, LiveAIExplainResult, OperationType, QuantumAssessParams, QuantumAssessResult, ReputationLevel, RiskLevel, SignatureScheme, TransactionContext, UserAdviceParams, UserAdviceResult, UserLevel } from "./types.js";
31
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,uBAAuB,EACvB,uBAAuB,EACvB,uBAAuB,EACvB,eAAe,EACf,eAAe,EACf,wBAAwB,EACxB,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,WAAW,EACX,QAAQ,EACR,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,SAAS,EACT,uBAAuB,EACxB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B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U,EACV,cAAc,EACd,uBAAuB,EACvB,uBAAuB,EACvB,uBAAuB,EACvB,eAAe,EACf,eAAe,EACf,wBAAwB,EACxB,wBAAwB,EACxB,mBAAmB,EACnB,mBAAmB,EACnB,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACnB,YAAY,EACZ,WAAW,EACX,QAAQ,EACR,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,mBAAmB,EACnB,mBAAmB,EACnB,eAAe,EACf,SAAS,EACT,eAAe,EACf,kBAAkB,EAClB,gBAAgB,EAChB,gBAAgB,EAChB,SAAS,EACV,MAAM,YAAY,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,134 @@
1
+ function resolveBaseUrl(environment, explicitBaseUrl) {
2
+ if (explicitBaseUrl) {
3
+ return explicitBaseUrl.replace(/\/$/, "");
4
+ }
5
+ if (typeof window !== "undefined" && window.location?.origin) {
6
+ return window.location.origin;
7
+ }
8
+ return environment === "production" ? "https://api.tokenguard.ai" : "http://localhost:8787";
9
+ }
10
+ export class TokenGuardClient {
11
+ config;
12
+ constructor(config) {
13
+ if (!config.apiKey) {
14
+ throw new Error("TokenGuardClient requires an apiKey.");
15
+ }
16
+ this.config = {
17
+ environment: config.environment ?? "sandbox",
18
+ enableAI: config.enableAI ?? true,
19
+ enableQuantumReady: config.enableQuantumReady ?? true,
20
+ language: config.language ?? "zh-CN",
21
+ userLevel: config.userLevel ?? "beginner",
22
+ ...config
23
+ };
24
+ }
25
+ async request(options) {
26
+ const fetcher = this.config.fetcher ?? fetch;
27
+ const response = await fetcher(`${resolveBaseUrl(this.config.environment, this.config.baseUrl)}${options.path}`, {
28
+ method: options.method ?? "POST",
29
+ credentials: "same-origin",
30
+ headers: {
31
+ Authorization: `Bearer ${this.config.apiKey}`,
32
+ "Content-Type": "application/json"
33
+ },
34
+ body: options.payload === undefined ? undefined : JSON.stringify(options.payload)
35
+ });
36
+ if (!response.ok) {
37
+ const text = await response.text();
38
+ throw new Error(`TokenGuard request failed: ${response.status} ${text}`);
39
+ }
40
+ return (await response.json());
41
+ }
42
+ analyzeTransaction(params) {
43
+ return this.request({
44
+ path: "/v1/tx/analyze",
45
+ payload: {
46
+ chainId: this.config.chainId,
47
+ language: this.config.language,
48
+ audience: this.config.userLevel,
49
+ ...params
50
+ }
51
+ });
52
+ }
53
+ analyzeDomain(params) {
54
+ return this.request({
55
+ path: "/v1/domain/analyze",
56
+ payload: params
57
+ });
58
+ }
59
+ checkApproval(params) {
60
+ return this.request({
61
+ path: "/v1/approval/check",
62
+ payload: params
63
+ });
64
+ }
65
+ getAddressReputation(params) {
66
+ return this.request({
67
+ path: "/v1/address/reputation",
68
+ payload: params
69
+ });
70
+ }
71
+ getAIExplanation(params) {
72
+ return this.request({
73
+ path: "/v1/ai/explain",
74
+ payload: {
75
+ audience: this.config.userLevel,
76
+ language: this.config.language,
77
+ ...params
78
+ }
79
+ });
80
+ }
81
+ assessQuantumExposure(params) {
82
+ return this.request({
83
+ path: "/v1/quantum/assess",
84
+ payload: params
85
+ });
86
+ }
87
+ getUserAdvice(params) {
88
+ return this.request({
89
+ path: "/v1/user/advice",
90
+ payload: {
91
+ audience: this.config.userLevel,
92
+ language: this.config.language,
93
+ ...params
94
+ }
95
+ });
96
+ }
97
+ getAIProviderSession() {
98
+ return this.request({
99
+ path: "/v1/ai/provider/session",
100
+ method: "GET"
101
+ });
102
+ }
103
+ getAIProviderCatalog() {
104
+ return this.request({
105
+ path: "/v1/ai/provider/catalog",
106
+ method: "GET"
107
+ });
108
+ }
109
+ connectAIProvider(params) {
110
+ return this.request({
111
+ path: "/v1/ai/provider/session",
112
+ method: "POST",
113
+ payload: params
114
+ });
115
+ }
116
+ disconnectAIProvider() {
117
+ return this.request({
118
+ path: "/v1/ai/provider/session",
119
+ method: "DELETE"
120
+ });
121
+ }
122
+ generateLiveAIExplanation(params) {
123
+ return this.request({
124
+ path: "/v1/ai/live-explain",
125
+ method: "POST",
126
+ payload: {
127
+ language: this.config.language,
128
+ audience: this.config.userLevel,
129
+ ...params
130
+ }
131
+ });
132
+ }
133
+ }
134
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA2CA,SAAS,cAAc,CAAC,WAAoC,EAAE,eAAmC;IAC/F,IAAI,eAAe,EAAE,CAAC;QACpB,OAAO,eAAe,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,CAAC;QAC7D,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;IAChC,CAAC;IAED,OAAO,WAAW,KAAK,YAAY,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,uBAAuB,CAAC;AAC9F,CAAC;AAED,MAAM,OAAO,gBAAgB;IACV,MAAM,CACyB;IAEhD,YAAY,MAAwB;QAClC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAC;QAC1D,CAAC;QAED,IAAI,CAAC,MAAM,GAAG;YACZ,WAAW,EAAE,MAAM,CAAC,WAAW,IAAI,SAAS;YAC5C,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,IAAI;YACjC,kBAAkB,EAAE,MAAM,CAAC,kBAAkB,IAAI,IAAI;YACrD,QAAQ,EAAE,MAAM,CAAC,QAAQ,IAAI,OAAO;YACpC,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,UAAU;YACzC,GAAG,MAAM;SACV,CAAC;IACJ,CAAC;IAEO,KAAK,CAAC,OAAO,CAAI,OAAuB;QAC9C,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,IAAI,KAAK,CAAC;QAC7C,MAAM,QAAQ,GAAG,MAAM,OAAO,CAAC,GAAG,cAAc,CAAC,I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AO,CAA0B;YAC3C,IAAI,EAAE,yBAAyB;YAC/B,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,MAAM;SAChB,CAAC,CAAC;IACL,CAAC;IAED,oBAAoB;QAClB,OAAO,IAAI,CAAC,OAAO,CAA0B;YAC3C,IAAI,EAAE,yBAAyB;YAC/B,MAAM,EAAE,QAAQ;SACjB,CAAC,CAAC;IACL,CAAC;IAED,yBAAyB,CAAC,MAA2B;QACnD,OAAO,IAAI,CAAC,OAAO,CAAsB;YACvC,IAAI,EAAE,qBAAqB;YAC3B,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ;gBAC9B,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS;gBAC/B,GAAG,MAAM;aACV;SACF,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -0,0 +1,160 @@
1
+ export type RiskLevel = "low" | "medium" | "high";
2
+ export type Language = "zh-CN" | "en-US";
3
+ export type UserLevel = "beginner" | "advanced";
4
+ export type Environment = "sandbox" | "production";
5
+ export type ReputationLevel = "low" | "medium" | "high";
6
+ export type DomainStatus = "trusted" | "unknown" | "suspicious";
7
+ export type ApprovalType = "exact" | "high" | "infinite";
8
+ export type OperationType = "token_approval" | "token_transfer" | "native_transfer" | "contract_interaction" | "signature_request";
9
+ export type QuantumExposureLevel = "future-low" | "future-medium" | "future-high";
10
+ export type AIProvider = "openai" | "anthropic" | "google" | "xai" | "deepseek" | "openclaw" | "template";
11
+ export type AIProviderKind = Exclude<AIProvider, "template">;
12
+ export type AIAuthMode = "apiKey" | "bearerToken" | "gateway";
13
+ export type SignatureScheme = "ECDSA" | "EdDSA" | "PQC_FALCON" | "PQC_DILITHIUM" | "UNKNOWN";
14
+ export interface TransactionContext {
15
+ url?: string;
16
+ walletType?: string;
17
+ }
18
+ export interface AnalyzeTransactionParams {
19
+ walletAddress: string;
20
+ chainId?: number;
21
+ to: string;
22
+ data?: string;
23
+ value?: string;
24
+ context?: TransactionContext;
25
+ language?: Language;
26
+ audience?: UserLevel;
27
+ }
28
+ export interface AnalyzeTransactionResult {
29
+ operationType: OperationType;
30
+ riskLevel: RiskLevel;
31
+ riskScore: number;
32
+ summary: string;
33
+ reasons: string[];
34
+ recommendations: string[];
35
+ aiExplanation: string;
36
+ }
37
+ export interface DomainAnalyzeParams {
38
+ url: string;
39
+ pageText?: string;
40
+ }
41
+ export interface DomainAnalyzeResult {
42
+ domainStatus: DomainStatus;
43
+ riskLevel: RiskLevel;
44
+ riskScore: number;
45
+ signals: string[];
46
+ aiExplanation: string;
47
+ }
48
+ export interface ApprovalCheckParams {
49
+ owner: string;
50
+ spender: string;
51
+ token: string;
52
+ amount: string;
53
+ chainId: number;
54
+ }
55
+ export interface ApprovalCheckResult {
56
+ isApproval: true;
57
+ approvalType: ApprovalType;
58
+ riskLevel: RiskLevel;
59
+ summary: string;
60
+ recommendations: string[];
61
+ }
62
+ export interface AddressReputationParams {
63
+ address: string;
64
+ chainId: number;
65
+ }
66
+ export interface AddressReputationResult {
67
+ address: string;
68
+ reputation: ReputationLevel;
69
+ tags: string[];
70
+ riskLevel: RiskLevel;
71
+ }
72
+ export interface AIExplainParams {
73
+ riskLevel: RiskLevel;
74
+ operationType: OperationType;
75
+ reasons: string[];
76
+ audience?: UserLevel;
77
+ language?: Language;
78
+ }
79
+ export interface AIExplainResult {
80
+ explanation: string;
81
+ shortWarning: string;
82
+ nextAction: string[];
83
+ }
84
+ export interface QuantumAssessParams {
85
+ walletAddress: string;
86
+ chainType: "EVM" | "UNKNOWN";
87
+ signatureScheme: SignatureScheme;
88
+ publicKeyExposed: boolean;
89
+ }
90
+ export interface QuantumAssessResult {
91
+ quantumExposureLevel: QuantumExposureLevel;
92
+ summary: string;
93
+ suggestions: string[];
94
+ }
95
+ export interface UserAdviceParams {
96
+ riskLevel: RiskLevel;
97
+ operationType: OperationType;
98
+ reasons: string[];
99
+ language?: Language;
100
+ audience?: UserLevel;
101
+ }
102
+ export interface UserAdviceResult {
103
+ title: string;
104
+ summary: string;
105
+ nextAction: string[];
106
+ }
107
+ export interface AIProviderSessionStatus {
108
+ connected: boolean;
109
+ provider?: AIProviderKind;
110
+ authMode?: AIAuthMode;
111
+ model?: string;
112
+ mode: "live" | "template";
113
+ note: string;
114
+ }
115
+ export interface AIProviderAuthModeDescriptor {
116
+ mode: AIAuthMode;
117
+ label: string;
118
+ credentialLabel: string;
119
+ credentialPlaceholder: string;
120
+ requiresCredential: boolean;
121
+ helpText: string;
122
+ }
123
+ export interface AIProviderCatalogEntry {
124
+ provider: AIProviderKind;
125
+ label: string;
126
+ defaultModel: string;
127
+ preferredAuthMode: AIAuthMode;
128
+ modelEditable: boolean;
129
+ storageNote: string;
130
+ authModes: AIProviderAuthModeDescriptor[];
131
+ }
132
+ export interface AIProviderCatalog {
133
+ defaultProvider: AIProviderKind;
134
+ providers: AIProviderCatalogEntry[];
135
+ }
136
+ export interface ConnectAIProviderParams {
137
+ provider?: AIProviderKind;
138
+ authMode?: AIAuthMode;
139
+ credential?: string;
140
+ apiKey?: string;
141
+ accessToken?: string;
142
+ model?: string;
143
+ }
144
+ export interface LiveAIExplainParams {
145
+ kind: "transaction" | "domain" | "approval" | "reputation" | "quantum";
146
+ snapshot: unknown;
147
+ language?: Language;
148
+ audience?: UserLevel;
149
+ }
150
+ export interface LiveAIExplainResult {
151
+ title: string;
152
+ explanation: string;
153
+ bullets: string[];
154
+ caution?: string;
155
+ provider: AIProvider;
156
+ model?: string;
157
+ live: boolean;
158
+ fallback: boolean;
159
+ }
160
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAClD,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG,OAAO,CAAC;AACzC,MAAM,MAAM,SAAS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/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
package/package.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "name": "@james-wu/tokenguard-sdk",
3
+ "version": "0.1.0",
4
+ "description": "TypeScript SDK for pre-sign transaction, domain, approval, reputation, and AI risk analysis in Web3 wallets and platforms.",
5
+ "type": "module",
6
+ "license": "Apache-2.0",
7
+ "sideEffects": false,
8
+ "main": "./dist/index.js",
9
+ "module": "./dist/index.js",
10
+ "types": "./dist/index.d.ts",
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "import": "./dist/index.js",
15
+ "default": "./dist/index.js"
16
+ },
17
+ "./package.json": "./package.json"
18
+ },
19
+ "files": [
20
+ "dist",
21
+ "README.md"
22
+ ],
23
+ "engines": {
24
+ "node": ">=18.0.0"
25
+ },
26
+ "publishConfig": {
27
+ "access": "public"
28
+ },
29
+ "repository": {
30
+ "type": "git",
31
+ "url": "git+https://github.com/James-Wuguoqing/tokenguard-ai.git",
32
+ "directory": "packages/sdk"
33
+ },
34
+ "homepage": "https://github.com/James-Wuguoqing/tokenguard-ai/tree/main/packages/sdk#readme",
35
+ "bugs": {
36
+ "url": "https://github.com/James-Wuguoqing/tokenguard-ai/issues"
37
+ },
38
+ "keywords": [
39
+ "tokenguard",
40
+ "web3",
41
+ "wallet-security",
42
+ "transaction-analysis",
43
+ "phishing-detection",
44
+ "approval-analysis",
45
+ "risk-analysis",
46
+ "wallet",
47
+ "sdk"
48
+ ],
49
+ "scripts": {
50
+ "build": "tsc -p tsconfig.json",
51
+ "clean": "node -e \"import('node:fs/promises').then(fs => fs.rm('dist', { recursive: true, force: true }))\"",
52
+ "prepack": "npm run build"
53
+ }
54
+ }