@fereai/sdk 0.3.1 → 0.4.0-dev.29
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/client.d.ts +7 -1
- package/dist/client.js +8 -0
- package/dist/index.d.ts +1 -1
- package/dist/low-level.d.ts +8 -1
- package/dist/low-level.js +14 -0
- package/dist/types.d.ts +38 -0
- package/package.json +4 -2
package/dist/client.d.ts
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* });
|
|
14
14
|
* ```
|
|
15
15
|
*/
|
|
16
|
-
import type { ChatEvent, SwapRequest, LimitOrderRequest, HooksRequest, DepositRequest, WithdrawRequest, UserResponse } from "./types.js";
|
|
16
|
+
import type { ChatEvent, SwapRequest, LimitOrderRequest, HooksRequest, DepositRequest, WithdrawRequest, SecurityCheckResponse, TokenToCheck, UserResponse } from "./types.js";
|
|
17
17
|
export declare class FereClient {
|
|
18
18
|
private readonly api;
|
|
19
19
|
private constructor();
|
|
@@ -33,6 +33,12 @@ export declare class FereClient {
|
|
|
33
33
|
swap(request: SwapRequest, timeout?: number): Promise<Record<string, unknown>>;
|
|
34
34
|
limitOrder(request: LimitOrderRequest, timeout?: number): Promise<Record<string, unknown>>;
|
|
35
35
|
setHooks(request: HooksRequest): Promise<unknown>;
|
|
36
|
+
/**
|
|
37
|
+
* Pre-check tokens for honeypot / scam / rug-pull flags. If a
|
|
38
|
+
* token is flagged and the user still wants to proceed, call
|
|
39
|
+
* `swap({ ..., bypass_security_check: true })`.
|
|
40
|
+
*/
|
|
41
|
+
checkTokenSecurity(tokens: TokenToCheck[]): Promise<SecurityCheckResponse>;
|
|
36
42
|
deposit(request: DepositRequest, timeout?: number): Promise<Record<string, unknown>>;
|
|
37
43
|
withdraw(request: WithdrawRequest, timeout?: number): Promise<Record<string, unknown>>;
|
|
38
44
|
getWallets: () => Promise<unknown>;
|
package/dist/client.js
CHANGED
|
@@ -78,6 +78,14 @@ class FereClient {
|
|
|
78
78
|
async setHooks(request) {
|
|
79
79
|
return this.api.setHooks(request);
|
|
80
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Pre-check tokens for honeypot / scam / rug-pull flags. If a
|
|
83
|
+
* token is flagged and the user still wants to proceed, call
|
|
84
|
+
* `swap({ ..., bypass_security_check: true })`.
|
|
85
|
+
*/
|
|
86
|
+
async checkTokenSecurity(tokens) {
|
|
87
|
+
return this.api.checkTokenSecurity(tokens);
|
|
88
|
+
}
|
|
81
89
|
// ----------------------------------------------------------
|
|
82
90
|
// Earn (blocks until complete)
|
|
83
91
|
// ----------------------------------------------------------
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { FereAPI } from "./low-level.js";
|
|
2
2
|
export { FereClient } from "./client.js";
|
|
3
3
|
export { AuthManager } from "./auth.js";
|
|
4
|
-
export type { ChatEvent, TaskResponse, TaskStatusResponse, SwapRequest, LimitOrderRequest, HooksRequest, DepositRequest, WithdrawRequest, CreditsInfo, WalletInfo, UserResponse, } from "./types.js";
|
|
4
|
+
export type { ChatEvent, TaskResponse, TaskStatusResponse, SwapRequest, LimitOrderRequest, HooksRequest, DepositRequest, WithdrawRequest, CreditsInfo, WalletInfo, UserResponse, TokenToCheck, SecurityCheckRequest, TokenSecurityResult, SecurityCheckSummary, SecurityCheckResponse, } from "./types.js";
|
|
5
5
|
export { TaskTimeoutError } from "./types.js";
|
package/dist/low-level.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Low-level SDK — 1:1 typed wrappers around every gateway endpoint.
|
|
3
3
|
*/
|
|
4
|
-
import type { ChatEvent, CreditsInfo, DepositRequest, HooksRequest, LimitOrderRequest, SwapRequest, TaskResponse, TaskStatusResponse, UserResponse, WithdrawRequest } from "./types.js";
|
|
4
|
+
import type { ChatEvent, CreditsInfo, DepositRequest, HooksRequest, LimitOrderRequest, SecurityCheckResponse, SwapRequest, TaskResponse, TaskStatusResponse, TokenToCheck, UserResponse, WithdrawRequest } from "./types.js";
|
|
5
5
|
export declare class FereAPI {
|
|
6
6
|
private readonly baseUrl;
|
|
7
7
|
private readonly auth;
|
|
@@ -33,6 +33,13 @@ export declare class FereAPI {
|
|
|
33
33
|
getLimitOrder(orderId: string): Promise<unknown>;
|
|
34
34
|
cancelLimitOrder(orderId: string): Promise<unknown>;
|
|
35
35
|
setHooks(request: HooksRequest): Promise<unknown>;
|
|
36
|
+
/**
|
|
37
|
+
* Pre-check whether output tokens have been flagged by Honeypot.is
|
|
38
|
+
* (EVM) or RugCheck.xyz (Solana) before submitting a swap. If a
|
|
39
|
+
* token is flagged and the user still wants to proceed, set
|
|
40
|
+
* `bypass_security_check: true` on the swap request.
|
|
41
|
+
*/
|
|
42
|
+
checkTokenSecurity(tokens: TokenToCheck[]): Promise<SecurityCheckResponse>;
|
|
36
43
|
getWallets(): Promise<unknown>;
|
|
37
44
|
getHoldings(): Promise<unknown>;
|
|
38
45
|
getEarnInfo(): Promise<unknown>;
|
package/dist/low-level.js
CHANGED
|
@@ -175,6 +175,20 @@ class FereAPI {
|
|
|
175
175
|
return this.authedPost("/v1/hooks", request);
|
|
176
176
|
}
|
|
177
177
|
// ----------------------------------------------------------
|
|
178
|
+
// Security
|
|
179
|
+
// ----------------------------------------------------------
|
|
180
|
+
/**
|
|
181
|
+
* Pre-check whether output tokens have been flagged by Honeypot.is
|
|
182
|
+
* (EVM) or RugCheck.xyz (Solana) before submitting a swap. If a
|
|
183
|
+
* token is flagged and the user still wants to proceed, set
|
|
184
|
+
* `bypass_security_check: true` on the swap request.
|
|
185
|
+
*/
|
|
186
|
+
async checkTokenSecurity(tokens) {
|
|
187
|
+
return this.authedPost("/v1/security/check", {
|
|
188
|
+
tokens,
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
// ----------------------------------------------------------
|
|
178
192
|
// Wallets
|
|
179
193
|
// ----------------------------------------------------------
|
|
180
194
|
async getWallets() {
|
package/dist/types.d.ts
CHANGED
|
@@ -55,6 +55,44 @@ export interface SwapRequest {
|
|
|
55
55
|
sell_percentage: number;
|
|
56
56
|
};
|
|
57
57
|
cancel_conditional_orders?: boolean;
|
|
58
|
+
/**
|
|
59
|
+
* Skip the in-task rug-check entirely. Set true only after
|
|
60
|
+
* pre-checking the output token via checkTokenSecurity and
|
|
61
|
+
* surfacing the verdict to your end user. Has no effect on
|
|
62
|
+
* scheduled trades.
|
|
63
|
+
*/
|
|
64
|
+
bypass_security_check?: boolean;
|
|
65
|
+
}
|
|
66
|
+
export interface TokenToCheck {
|
|
67
|
+
token_address: string;
|
|
68
|
+
chain_id: number | string;
|
|
69
|
+
}
|
|
70
|
+
export interface SecurityCheckRequest {
|
|
71
|
+
tokens: TokenToCheck[];
|
|
72
|
+
}
|
|
73
|
+
export interface TokenSecurityResult {
|
|
74
|
+
token_address: string;
|
|
75
|
+
chain_id: number;
|
|
76
|
+
allowed: boolean;
|
|
77
|
+
/** passed | failed | warning | api_unavailable | unsupported_chain | skipped */
|
|
78
|
+
status: string;
|
|
79
|
+
reason?: string | null;
|
|
80
|
+
/** "rugcheck" | "honeypot_is" | "unknown" */
|
|
81
|
+
provider: string;
|
|
82
|
+
risk_details?: Record<string, unknown> | null;
|
|
83
|
+
}
|
|
84
|
+
export interface SecurityCheckSummary {
|
|
85
|
+
total: number;
|
|
86
|
+
passed: number;
|
|
87
|
+
failed: number;
|
|
88
|
+
warning: number;
|
|
89
|
+
api_unavailable: number;
|
|
90
|
+
unsupported_chain?: number;
|
|
91
|
+
skipped?: number;
|
|
92
|
+
}
|
|
93
|
+
export interface SecurityCheckResponse {
|
|
94
|
+
results: TokenSecurityResult[];
|
|
95
|
+
summary: SecurityCheckSummary;
|
|
58
96
|
}
|
|
59
97
|
export interface LimitOrderRequest {
|
|
60
98
|
chain_id_in: number;
|
package/package.json
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fereai/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0-dev.29",
|
|
4
4
|
"description": "TypeScript SDK for the FereAI Gateway API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
-
"files": [
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
8
10
|
"scripts": {
|
|
9
11
|
"build": "tsc",
|
|
10
12
|
"prepublishOnly": "tsc"
|