@scriptmasterlabs/mcp-x402 2.0.2 → 2.1.1
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/.well-known/x402.json +37 -0
- package/LICENSE +57 -21
- package/README.md +262 -304
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-wrapper.d.ts +71 -0
- package/dist/mcp-wrapper.d.ts.map +1 -0
- package/dist/mcp-wrapper.js +104 -0
- package/dist/mcp-wrapper.js.map +1 -0
- package/dist/x402-middleware.d.ts +76 -0
- package/dist/x402-middleware.d.ts.map +1 -0
- package/dist/x402-middleware.js +113 -0
- package/dist/x402-middleware.js.map +1 -0
- package/dist/xrpl-facilitator.d.ts +77 -0
- package/dist/xrpl-facilitator.d.ts.map +1 -0
- package/dist/xrpl-facilitator.js +156 -0
- package/dist/xrpl-facilitator.js.map +1 -0
- package/llms.txt +108 -70
- package/package.json +65 -78
- package/schema.jsonld +97 -0
- package/.env.example +0 -35
- package/.github/workflows/ci.yml +0 -59
- package/.github/workflows/keepalive.yml +0 -31
- package/.well-known/agentcard.json +0 -34
- package/CONTRIBUTING.md +0 -76
- package/Dockerfile +0 -19
- package/agents.json +0 -67
- package/dist/lib/chains/base.d.ts +0 -10
- package/dist/lib/chains/base.d.ts.map +0 -1
- package/dist/lib/chains/base.js +0 -73
- package/dist/lib/chains/base.js.map +0 -1
- package/dist/lib/chains/solana.d.ts +0 -10
- package/dist/lib/chains/solana.d.ts.map +0 -1
- package/dist/lib/chains/solana.js +0 -49
- package/dist/lib/chains/solana.js.map +0 -1
- package/dist/lib/chains/xrpl.d.ts +0 -10
- package/dist/lib/chains/xrpl.d.ts.map +0 -1
- package/dist/lib/chains/xrpl.js +0 -55
- package/dist/lib/chains/xrpl.js.map +0 -1
- package/dist/lib/credit/bureau.d.ts +0 -10
- package/dist/lib/credit/bureau.d.ts.map +0 -1
- package/dist/lib/credit/bureau.js +0 -58
- package/dist/lib/credit/bureau.js.map +0 -1
- package/dist/lib/sml-api/agentcard.d.ts +0 -17
- package/dist/lib/sml-api/agentcard.d.ts.map +0 -1
- package/dist/lib/sml-api/agentcard.js +0 -30
- package/dist/lib/sml-api/agentcard.js.map +0 -1
- package/dist/lib/sml-api/backtest.d.ts +0 -22
- package/dist/lib/sml-api/backtest.d.ts.map +0 -1
- package/dist/lib/sml-api/backtest.js +0 -28
- package/dist/lib/sml-api/backtest.js.map +0 -1
- package/dist/lib/sml-api/brokers.d.ts +0 -40
- package/dist/lib/sml-api/brokers.d.ts.map +0 -1
- package/dist/lib/sml-api/brokers.js +0 -128
- package/dist/lib/sml-api/brokers.js.map +0 -1
- package/dist/lib/sml-api/copytrader.d.ts +0 -11
- package/dist/lib/sml-api/copytrader.d.ts.map +0 -1
- package/dist/lib/sml-api/copytrader.js +0 -30
- package/dist/lib/sml-api/copytrader.js.map +0 -1
- package/dist/lib/sml-api/crawl.d.ts +0 -20
- package/dist/lib/sml-api/crawl.d.ts.map +0 -1
- package/dist/lib/sml-api/crawl.js +0 -32
- package/dist/lib/sml-api/crawl.js.map +0 -1
- package/dist/lib/sml-api/echo.d.ts +0 -10
- package/dist/lib/sml-api/echo.d.ts.map +0 -1
- package/dist/lib/sml-api/echo.js +0 -23
- package/dist/lib/sml-api/echo.js.map +0 -1
- package/dist/lib/sml-api/forge.d.ts +0 -11
- package/dist/lib/sml-api/forge.d.ts.map +0 -1
- package/dist/lib/sml-api/forge.js +0 -29
- package/dist/lib/sml-api/forge.js.map +0 -1
- package/dist/lib/sml-api/ftd.d.ts +0 -18
- package/dist/lib/sml-api/ftd.d.ts.map +0 -1
- package/dist/lib/sml-api/ftd.js +0 -43
- package/dist/lib/sml-api/ftd.js.map +0 -1
- package/dist/lib/sml-api/ghost.d.ts +0 -13
- package/dist/lib/sml-api/ghost.d.ts.map +0 -1
- package/dist/lib/sml-api/ghost.js +0 -29
- package/dist/lib/sml-api/ghost.js.map +0 -1
- package/dist/lib/sml-api/launchpad.d.ts +0 -20
- package/dist/lib/sml-api/launchpad.d.ts.map +0 -1
- package/dist/lib/sml-api/launchpad.js +0 -31
- package/dist/lib/sml-api/launchpad.js.map +0 -1
- package/dist/lib/sml-api/leviathan.d.ts +0 -22
- package/dist/lib/sml-api/leviathan.d.ts.map +0 -1
- package/dist/lib/sml-api/leviathan.js +0 -33
- package/dist/lib/sml-api/leviathan.js.map +0 -1
- package/dist/lib/sml-api/nexus.d.ts +0 -18
- package/dist/lib/sml-api/nexus.d.ts.map +0 -1
- package/dist/lib/sml-api/nexus.js +0 -40
- package/dist/lib/sml-api/nexus.js.map +0 -1
- package/dist/lib/sml-api/proof402.d.ts +0 -6
- package/dist/lib/sml-api/proof402.d.ts.map +0 -1
- package/dist/lib/sml-api/proof402.js +0 -30
- package/dist/lib/sml-api/proof402.js.map +0 -1
- package/dist/lib/sml-api/rails.d.ts +0 -12
- package/dist/lib/sml-api/rails.d.ts.map +0 -1
- package/dist/lib/sml-api/rails.js +0 -29
- package/dist/lib/sml-api/rails.js.map +0 -1
- package/dist/lib/sml-api/shadow.d.ts +0 -15
- package/dist/lib/sml-api/shadow.d.ts.map +0 -1
- package/dist/lib/sml-api/shadow.js +0 -27
- package/dist/lib/sml-api/shadow.js.map +0 -1
- package/dist/lib/sml-api/squeezeos.d.ts +0 -21
- package/dist/lib/sml-api/squeezeos.d.ts.map +0 -1
- package/dist/lib/sml-api/squeezeos.js +0 -97
- package/dist/lib/sml-api/squeezeos.js.map +0 -1
- package/dist/lib/sml-api/xdeo.d.ts +0 -13
- package/dist/lib/sml-api/xdeo.d.ts.map +0 -1
- package/dist/lib/sml-api/xdeo.js +0 -34
- package/dist/lib/sml-api/xdeo.js.map +0 -1
- package/dist/lib/sml-api/xmit.d.ts +0 -13
- package/dist/lib/sml-api/xmit.d.ts.map +0 -1
- package/dist/lib/sml-api/xmit.js +0 -34
- package/dist/lib/sml-api/xmit.js.map +0 -1
- package/dist/server/health.d.ts +0 -16
- package/dist/server/health.d.ts.map +0 -1
- package/dist/server/health.js +0 -39
- package/dist/server/health.js.map +0 -1
- package/dist/server/index.d.ts +0 -3
- package/dist/server/index.d.ts.map +0 -1
- package/dist/server/index.js +0 -199
- package/dist/server/index.js.map +0 -1
- package/dist/server/payments/ap2.d.ts +0 -17
- package/dist/server/payments/ap2.d.ts.map +0 -1
- package/dist/server/payments/ap2.js +0 -77
- package/dist/server/payments/ap2.js.map +0 -1
- package/dist/server/payments/receipt.d.ts +0 -28
- package/dist/server/payments/receipt.d.ts.map +0 -1
- package/dist/server/payments/receipt.js +0 -60
- package/dist/server/payments/receipt.js.map +0 -1
- package/dist/server/payments/router.d.ts +0 -23
- package/dist/server/payments/router.d.ts.map +0 -1
- package/dist/server/payments/router.js +0 -69
- package/dist/server/payments/router.js.map +0 -1
- package/dist/server/payments/wallet.d.ts +0 -18
- package/dist/server/payments/wallet.d.ts.map +0 -1
- package/dist/server/payments/wallet.js +0 -107
- package/dist/server/payments/wallet.js.map +0 -1
- package/dist/server/payments/x402.d.ts +0 -29
- package/dist/server/payments/x402.d.ts.map +0 -1
- package/dist/server/payments/x402.js +0 -138
- package/dist/server/payments/x402.js.map +0 -1
- package/dist/server/registry/catalog.d.ts +0 -12
- package/dist/server/registry/catalog.d.ts.map +0 -1
- package/dist/server/registry/catalog.js +0 -55
- package/dist/server/registry/catalog.js.map +0 -1
- package/dist/server/registry/discovery.d.ts +0 -16
- package/dist/server/registry/discovery.d.ts.map +0 -1
- package/dist/server/registry/discovery.js +0 -33
- package/dist/server/registry/discovery.js.map +0 -1
- package/dist/server/registry/pricing.d.ts +0 -10
- package/dist/server/registry/pricing.d.ts.map +0 -1
- package/dist/server/registry/pricing.js +0 -123
- package/dist/server/registry/pricing.js.map +0 -1
- package/dist/server/security/acl.d.ts +0 -28
- package/dist/server/security/acl.d.ts.map +0 -1
- package/dist/server/security/acl.js +0 -36
- package/dist/server/security/acl.js.map +0 -1
- package/dist/server/security/audit.d.ts +0 -15
- package/dist/server/security/audit.d.ts.map +0 -1
- package/dist/server/security/audit.js +0 -77
- package/dist/server/security/audit.js.map +0 -1
- package/dist/server/security/rate-limit.d.ts +0 -12
- package/dist/server/security/rate-limit.d.ts.map +0 -1
- package/dist/server/security/rate-limit.js +0 -72
- package/dist/server/security/rate-limit.js.map +0 -1
- package/dist/server/security/sandbox.d.ts +0 -7
- package/dist/server/security/sandbox.d.ts.map +0 -1
- package/dist/server/security/sandbox.js +0 -42
- package/dist/server/security/sandbox.js.map +0 -1
- package/dist/server/tools/agentcard.d.ts +0 -3
- package/dist/server/tools/agentcard.d.ts.map +0 -1
- package/dist/server/tools/agentcard.js +0 -118
- package/dist/server/tools/agentcard.js.map +0 -1
- package/dist/server/tools/backtest.d.ts +0 -3
- package/dist/server/tools/backtest.d.ts.map +0 -1
- package/dist/server/tools/backtest.js +0 -112
- package/dist/server/tools/backtest.js.map +0 -1
- package/dist/server/tools/brokers.d.ts +0 -3
- package/dist/server/tools/brokers.d.ts.map +0 -1
- package/dist/server/tools/brokers.js +0 -223
- package/dist/server/tools/brokers.js.map +0 -1
- package/dist/server/tools/copytrader.d.ts +0 -3
- package/dist/server/tools/copytrader.d.ts.map +0 -1
- package/dist/server/tools/copytrader.js +0 -90
- package/dist/server/tools/copytrader.js.map +0 -1
- package/dist/server/tools/crawl.d.ts +0 -3
- package/dist/server/tools/crawl.d.ts.map +0 -1
- package/dist/server/tools/crawl.js +0 -60
- package/dist/server/tools/crawl.js.map +0 -1
- package/dist/server/tools/discovery.d.ts +0 -3
- package/dist/server/tools/discovery.d.ts.map +0 -1
- package/dist/server/tools/discovery.js +0 -188
- package/dist/server/tools/discovery.js.map +0 -1
- package/dist/server/tools/echo.d.ts +0 -3
- package/dist/server/tools/echo.d.ts.map +0 -1
- package/dist/server/tools/echo.js +0 -48
- package/dist/server/tools/echo.js.map +0 -1
- package/dist/server/tools/forge.d.ts +0 -3
- package/dist/server/tools/forge.d.ts.map +0 -1
- package/dist/server/tools/forge.js +0 -77
- package/dist/server/tools/forge.js.map +0 -1
- package/dist/server/tools/ftd.d.ts +0 -3
- package/dist/server/tools/ftd.d.ts.map +0 -1
- package/dist/server/tools/ftd.js +0 -70
- package/dist/server/tools/ftd.js.map +0 -1
- package/dist/server/tools/ghost.d.ts +0 -3
- package/dist/server/tools/ghost.d.ts.map +0 -1
- package/dist/server/tools/ghost.js +0 -83
- package/dist/server/tools/ghost.js.map +0 -1
- package/dist/server/tools/index.d.ts +0 -3
- package/dist/server/tools/index.d.ts.map +0 -1
- package/dist/server/tools/index.js +0 -44
- package/dist/server/tools/index.js.map +0 -1
- package/dist/server/tools/launchpad.d.ts +0 -3
- package/dist/server/tools/launchpad.d.ts.map +0 -1
- package/dist/server/tools/launchpad.js +0 -151
- package/dist/server/tools/launchpad.js.map +0 -1
- package/dist/server/tools/leviathan.d.ts +0 -3
- package/dist/server/tools/leviathan.d.ts.map +0 -1
- package/dist/server/tools/leviathan.js +0 -73
- package/dist/server/tools/leviathan.js.map +0 -1
- package/dist/server/tools/nexus.d.ts +0 -3
- package/dist/server/tools/nexus.d.ts.map +0 -1
- package/dist/server/tools/nexus.js +0 -65
- package/dist/server/tools/nexus.js.map +0 -1
- package/dist/server/tools/proof402.d.ts +0 -3
- package/dist/server/tools/proof402.d.ts.map +0 -1
- package/dist/server/tools/proof402.js +0 -74
- package/dist/server/tools/proof402.js.map +0 -1
- package/dist/server/tools/rails.d.ts +0 -3
- package/dist/server/tools/rails.d.ts.map +0 -1
- package/dist/server/tools/rails.js +0 -82
- package/dist/server/tools/rails.js.map +0 -1
- package/dist/server/tools/shadow.d.ts +0 -3
- package/dist/server/tools/shadow.d.ts.map +0 -1
- package/dist/server/tools/shadow.js +0 -114
- package/dist/server/tools/shadow.js.map +0 -1
- package/dist/server/tools/squeezeos.d.ts +0 -3
- package/dist/server/tools/squeezeos.d.ts.map +0 -1
- package/dist/server/tools/squeezeos.js +0 -231
- package/dist/server/tools/squeezeos.js.map +0 -1
- package/dist/server/tools/xdeo.d.ts +0 -3
- package/dist/server/tools/xdeo.d.ts.map +0 -1
- package/dist/server/tools/xdeo.js +0 -58
- package/dist/server/tools/xdeo.js.map +0 -1
- package/dist/server/tools/xmit.d.ts +0 -3
- package/dist/server/tools/xmit.d.ts.map +0 -1
- package/dist/server/tools/xmit.js +0 -59
- package/dist/server/tools/xmit.js.map +0 -1
- package/docker-compose.yml +0 -50
- package/mcp-publisher.exe +0 -0
- package/render.yaml +0 -39
- package/sdk/mcp-x402-sdk/package.json +0 -18
- package/sdk/mcp-x402-sdk/src/index.ts +0 -118
- package/sdk/mcp-x402-sdk/tsconfig.json +0 -14
- package/server.json +0 -48
- package/services/backtest_service.py +0 -176
- package/src/lib/chains/base.ts +0 -77
- package/src/lib/chains/solana.ts +0 -59
- package/src/lib/chains/xrpl.ts +0 -63
- package/src/lib/credit/bureau.ts +0 -65
- package/src/lib/sml-api/agentcard.ts +0 -40
- package/src/lib/sml-api/backtest.ts +0 -47
- package/src/lib/sml-api/brokers.ts +0 -160
- package/src/lib/sml-api/copytrader.ts +0 -33
- package/src/lib/sml-api/crawl.ts +0 -44
- package/src/lib/sml-api/echo.ts +0 -28
- package/src/lib/sml-api/forge.ts +0 -33
- package/src/lib/sml-api/ftd.ts +0 -53
- package/src/lib/sml-api/ghost.ts +0 -35
- package/src/lib/sml-api/launchpad.ts +0 -43
- package/src/lib/sml-api/leviathan.ts +0 -49
- package/src/lib/sml-api/nexus.ts +0 -50
- package/src/lib/sml-api/proof402.ts +0 -27
- package/src/lib/sml-api/rails.ts +0 -34
- package/src/lib/sml-api/shadow.ts +0 -35
- package/src/lib/sml-api/squeezeos.ts +0 -95
- package/src/lib/sml-api/xdeo.ts +0 -40
- package/src/lib/sml-api/xmit.ts +0 -40
- package/src/server/health.ts +0 -52
- package/src/server/index.ts +0 -213
- package/src/server/payments/ap2.ts +0 -101
- package/src/server/payments/receipt.ts +0 -85
- package/src/server/payments/router.ts +0 -110
- package/src/server/payments/wallet.ts +0 -123
- package/src/server/payments/x402.ts +0 -177
- package/src/server/registry/catalog.ts +0 -61
- package/src/server/registry/discovery.ts +0 -39
- package/src/server/registry/pricing.ts +0 -133
- package/src/server/security/acl.ts +0 -42
- package/src/server/security/audit.ts +0 -94
- package/src/server/security/rate-limit.ts +0 -84
- package/src/server/security/sandbox.ts +0 -40
- package/src/server/tools/agentcard.ts +0 -134
- package/src/server/tools/backtest.ts +0 -119
- package/src/server/tools/brokers.ts +0 -250
- package/src/server/tools/copytrader.ts +0 -104
- package/src/server/tools/crawl.ts +0 -70
- package/src/server/tools/discovery.ts +0 -202
- package/src/server/tools/echo.ts +0 -58
- package/src/server/tools/forge.ts +0 -87
- package/src/server/tools/ftd.ts +0 -88
- package/src/server/tools/ghost.ts +0 -93
- package/src/server/tools/index.ts +0 -42
- package/src/server/tools/launchpad.ts +0 -173
- package/src/server/tools/leviathan.ts +0 -81
- package/src/server/tools/nexus.ts +0 -76
- package/src/server/tools/proof402.ts +0 -87
- package/src/server/tools/rails.ts +0 -92
- package/src/server/tools/shadow.ts +0 -128
- package/src/server/tools/squeezeos.ts +0 -312
- package/src/server/tools/xdeo.ts +0 -67
- package/src/server/tools/xmit.ts +0 -68
- package/tests/integration/e2e.test.ts +0 -51
- package/tests/unit/payments.test.ts +0 -49
- package/tests/unit/security.test.ts +0 -92
- package/tests/unit/tools.test.ts +0 -42
- package/tsconfig.json +0 -21
- package/vitest.config.ts +0 -20
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
const AGENTCARD_BASE = process.env['AGENTCARD_URL'] ?? 'https://agentcard.onrender.com';
|
|
2
|
-
|
|
3
|
-
async function acGet(path: string): Promise<unknown> {
|
|
4
|
-
const res = await fetch(`${AGENTCARD_BASE}${path}`, {
|
|
5
|
-
headers: { 'Accept': 'application/json' },
|
|
6
|
-
signal: AbortSignal.timeout(10_000),
|
|
7
|
-
});
|
|
8
|
-
if (!res.ok) throw new Error(`AgentCard GET ${path}: HTTP ${res.status}`);
|
|
9
|
-
return res.json();
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface AgentCardMintParams {
|
|
13
|
-
walletAddress: string;
|
|
14
|
-
name: string;
|
|
15
|
-
did?: string;
|
|
16
|
-
metadata?: Record<string, unknown>;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export interface AgentCardVerifyParams {
|
|
20
|
-
walletAddress: string;
|
|
21
|
-
message: string;
|
|
22
|
-
signature: string;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
async function acPost(path: string, body: unknown): Promise<unknown> {
|
|
26
|
-
const res = await fetch(`${AGENTCARD_BASE}${path}`, {
|
|
27
|
-
method: 'POST',
|
|
28
|
-
headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' },
|
|
29
|
-
body: JSON.stringify(body),
|
|
30
|
-
signal: AbortSignal.timeout(15_000),
|
|
31
|
-
});
|
|
32
|
-
if (!res.ok) throw new Error(`AgentCard POST ${path}: HTTP ${res.status}`);
|
|
33
|
-
return res.json();
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export const AgentCardAPI = {
|
|
37
|
-
lookup: (walletOrDid: string) => acGet(`/v1/card/${encodeURIComponent(walletOrDid)}`),
|
|
38
|
-
verify: (params: AgentCardVerifyParams) => acPost('/v1/verify', params),
|
|
39
|
-
mint: (params: AgentCardMintParams) => acPost('/v1/mint', params),
|
|
40
|
-
};
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
// backtester-mcp microservice client
|
|
2
|
-
// Wraps the Python backtest_service.py running at BACKTEST_BASE_URL
|
|
3
|
-
|
|
4
|
-
const BASE = process.env.BACKTEST_BASE_URL ?? 'http://localhost:8300';
|
|
5
|
-
|
|
6
|
-
export interface BacktestParams {
|
|
7
|
-
ticker: string;
|
|
8
|
-
lookback_days?: number;
|
|
9
|
-
signals?: number[];
|
|
10
|
-
fees?: number;
|
|
11
|
-
slippage?: number;
|
|
12
|
-
momentum_window?: number;
|
|
13
|
-
momentum_threshold?: number;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface ValidateParams {
|
|
17
|
-
ticker: string;
|
|
18
|
-
lookback_days?: number;
|
|
19
|
-
train_ratio?: number;
|
|
20
|
-
fees?: number;
|
|
21
|
-
slippage?: number;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
async function post(path: string, body: object): Promise<unknown> {
|
|
25
|
-
const res = await fetch(`${BASE}${path}`, {
|
|
26
|
-
method: 'POST',
|
|
27
|
-
headers: { 'Content-Type': 'application/json' },
|
|
28
|
-
body: JSON.stringify(body),
|
|
29
|
-
signal: AbortSignal.timeout(30_000),
|
|
30
|
-
});
|
|
31
|
-
if (!res.ok) {
|
|
32
|
-
const err = await res.json().catch(() => ({ error: res.statusText }));
|
|
33
|
-
throw new Error((err as { error?: string }).error ?? res.statusText);
|
|
34
|
-
}
|
|
35
|
-
return res.json();
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export const BacktestAPI = {
|
|
39
|
-
health: async (): Promise<unknown> => {
|
|
40
|
-
const res = await fetch(`${BASE}/health`, { signal: AbortSignal.timeout(5_000) });
|
|
41
|
-
return res.json();
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
backtest: (params: BacktestParams): Promise<unknown> => post('/backtest', params),
|
|
45
|
-
|
|
46
|
-
walkForward: (params: ValidateParams): Promise<unknown> => post('/validate', params),
|
|
47
|
-
};
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
// Broker execution rails — Robinhood + Tradier
|
|
2
|
-
// Robinhood: OAuth2 Bearer token (ROBINHOOD_ACCESS_TOKEN env)
|
|
3
|
-
// Tradier: Bearer token (TRADIER_API_KEY env, TRADIER_ENV=sandbox|production)
|
|
4
|
-
|
|
5
|
-
const TRADIER_BASE = process.env.TRADIER_ENV === 'production'
|
|
6
|
-
? 'https://api.tradier.com/v1'
|
|
7
|
-
: 'https://sandbox.tradier.com/v1';
|
|
8
|
-
|
|
9
|
-
const ROBINHOOD_BASE = 'https://api.robinhood.com';
|
|
10
|
-
|
|
11
|
-
// ── Shared fetch helpers ────────────────────────────────────────────────────
|
|
12
|
-
|
|
13
|
-
async function tradierGet(path: string, params?: Record<string, string>): Promise<unknown> {
|
|
14
|
-
const token = process.env.TRADIER_API_KEY;
|
|
15
|
-
if (!token) throw new Error('TRADIER_API_KEY not configured');
|
|
16
|
-
const url = new URL(`${TRADIER_BASE}${path}`);
|
|
17
|
-
if (params) Object.entries(params).forEach(([k, v]) => url.searchParams.set(k, v));
|
|
18
|
-
const res = await fetch(url.toString(), {
|
|
19
|
-
headers: { Authorization: `Bearer ${token}`, Accept: 'application/json' },
|
|
20
|
-
signal: AbortSignal.timeout(10_000),
|
|
21
|
-
});
|
|
22
|
-
if (!res.ok) throw new Error(`Tradier ${res.status}: ${res.statusText}`);
|
|
23
|
-
return res.json();
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
async function tradierPost(path: string, body: Record<string, string>): Promise<unknown> {
|
|
27
|
-
const token = process.env.TRADIER_API_KEY;
|
|
28
|
-
if (!token) throw new Error('TRADIER_API_KEY not configured');
|
|
29
|
-
const res = await fetch(`${TRADIER_BASE}${path}`, {
|
|
30
|
-
method: 'POST',
|
|
31
|
-
headers: {
|
|
32
|
-
Authorization: `Bearer ${token}`,
|
|
33
|
-
Accept: 'application/json',
|
|
34
|
-
'Content-Type': 'application/x-www-form-urlencoded',
|
|
35
|
-
},
|
|
36
|
-
body: new URLSearchParams(body).toString(),
|
|
37
|
-
signal: AbortSignal.timeout(10_000),
|
|
38
|
-
});
|
|
39
|
-
if (!res.ok) throw new Error(`Tradier ${res.status}: ${res.statusText}`);
|
|
40
|
-
return res.json();
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
async function robinhoodGet(path: string): Promise<unknown> {
|
|
44
|
-
const token = process.env.ROBINHOOD_ACCESS_TOKEN;
|
|
45
|
-
if (!token) throw new Error('ROBINHOOD_ACCESS_TOKEN not configured');
|
|
46
|
-
const res = await fetch(`${ROBINHOOD_BASE}${path}`, {
|
|
47
|
-
headers: { Authorization: `Bearer ${token}`, Accept: 'application/json' },
|
|
48
|
-
signal: AbortSignal.timeout(10_000),
|
|
49
|
-
});
|
|
50
|
-
if (!res.ok) throw new Error(`Robinhood ${res.status}: ${res.statusText}`);
|
|
51
|
-
return res.json();
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
async function robinhoodPost(path: string, body: object): Promise<unknown> {
|
|
55
|
-
const token = process.env.ROBINHOOD_ACCESS_TOKEN;
|
|
56
|
-
if (!token) throw new Error('ROBINHOOD_ACCESS_TOKEN not configured');
|
|
57
|
-
const res = await fetch(`${ROBINHOOD_BASE}${path}`, {
|
|
58
|
-
method: 'POST',
|
|
59
|
-
headers: {
|
|
60
|
-
Authorization: `Bearer ${token}`,
|
|
61
|
-
Accept: 'application/json',
|
|
62
|
-
'Content-Type': 'application/json',
|
|
63
|
-
},
|
|
64
|
-
body: JSON.stringify(body),
|
|
65
|
-
signal: AbortSignal.timeout(10_000),
|
|
66
|
-
});
|
|
67
|
-
if (!res.ok) throw new Error(`Robinhood ${res.status}: ${res.statusText}`);
|
|
68
|
-
return res.json();
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// ── Tradier API ─────────────────────────────────────────────────────────────
|
|
72
|
-
|
|
73
|
-
export interface TradierQuoteParams { symbols: string }
|
|
74
|
-
export interface TradierOrderParams {
|
|
75
|
-
account_id: string;
|
|
76
|
-
symbol: string;
|
|
77
|
-
side: 'buy' | 'sell';
|
|
78
|
-
quantity: number;
|
|
79
|
-
type: 'market' | 'limit' | 'stop' | 'stop_limit';
|
|
80
|
-
duration: 'day' | 'gtc' | 'pre' | 'post';
|
|
81
|
-
price?: number;
|
|
82
|
-
stop?: number;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export const TradierAPI = {
|
|
86
|
-
quote: (params: TradierQuoteParams) =>
|
|
87
|
-
tradierGet('/markets/quotes', { symbols: params.symbols, greeks: 'false' }),
|
|
88
|
-
|
|
89
|
-
optionChain: (symbol: string, expiration: string) =>
|
|
90
|
-
tradierGet('/markets/options/chains', { symbol, expiration, greeks: 'true' }),
|
|
91
|
-
|
|
92
|
-
order: (params: TradierOrderParams) => {
|
|
93
|
-
const body: Record<string, string> = {
|
|
94
|
-
class: 'equity',
|
|
95
|
-
symbol: params.symbol,
|
|
96
|
-
side: params.side,
|
|
97
|
-
quantity: String(params.quantity),
|
|
98
|
-
type: params.type,
|
|
99
|
-
duration: params.duration,
|
|
100
|
-
};
|
|
101
|
-
if (params.price !== undefined) body.price = String(params.price);
|
|
102
|
-
if (params.stop !== undefined) body.stop = String(params.stop);
|
|
103
|
-
return tradierPost(`/accounts/${params.account_id}/orders`, body);
|
|
104
|
-
},
|
|
105
|
-
|
|
106
|
-
positions: (account_id: string) =>
|
|
107
|
-
tradierGet(`/accounts/${account_id}/positions`),
|
|
108
|
-
|
|
109
|
-
balances: (account_id: string) =>
|
|
110
|
-
tradierGet(`/accounts/${account_id}/balances`),
|
|
111
|
-
|
|
112
|
-
orderStatus: (account_id: string, order_id: string) =>
|
|
113
|
-
tradierGet(`/accounts/${account_id}/orders/${order_id}`),
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
// ── Robinhood API ────────────────────────────────────────────────────────────
|
|
117
|
-
|
|
118
|
-
export interface RobinhoodOrderParams {
|
|
119
|
-
symbol: string;
|
|
120
|
-
side: 'buy' | 'sell';
|
|
121
|
-
quantity: number;
|
|
122
|
-
type: 'market' | 'limit';
|
|
123
|
-
time_in_force: 'gfd' | 'gtc' | 'ioc' | 'opg';
|
|
124
|
-
price?: number;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
export const RobinhoodAPI = {
|
|
128
|
-
quote: async (symbol: string) => {
|
|
129
|
-
const data = await robinhoodGet(`/quotes/?symbols=${symbol}`) as { results?: unknown[] };
|
|
130
|
-
return data.results?.[0] ?? data;
|
|
131
|
-
},
|
|
132
|
-
|
|
133
|
-
instruments: async (symbol: string) => {
|
|
134
|
-
const data = await robinhoodGet(`/instruments/?symbol=${symbol}`) as { results?: { url: string }[] };
|
|
135
|
-
return data.results?.[0];
|
|
136
|
-
},
|
|
137
|
-
|
|
138
|
-
order: async (params: RobinhoodOrderParams) => {
|
|
139
|
-
const instrument = await RobinhoodAPI.instruments(params.symbol) as { url?: string } | undefined;
|
|
140
|
-
if (!instrument?.url) throw new Error(`Instrument not found: ${params.symbol}`);
|
|
141
|
-
const body: Record<string, unknown> = {
|
|
142
|
-
account: `/accounts/${process.env.ROBINHOOD_ACCOUNT_ID}/`,
|
|
143
|
-
instrument: instrument.url,
|
|
144
|
-
symbol: params.symbol,
|
|
145
|
-
side: params.side,
|
|
146
|
-
quantity: params.quantity,
|
|
147
|
-
type: params.type,
|
|
148
|
-
time_in_force: params.time_in_force,
|
|
149
|
-
trigger: 'immediate',
|
|
150
|
-
};
|
|
151
|
-
if (params.price !== undefined) body.price = String(params.price);
|
|
152
|
-
return robinhoodPost('/orders/', body);
|
|
153
|
-
},
|
|
154
|
-
|
|
155
|
-
portfolio: () => robinhoodGet('/portfolios/'),
|
|
156
|
-
|
|
157
|
-
positions: () => robinhoodGet('/positions/?nonzero=true'),
|
|
158
|
-
|
|
159
|
-
orderHistory: () => robinhoodGet('/orders/?page_size=20'),
|
|
160
|
-
};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
const COPYTRADER_BASE = process.env['SML_COPYTRADER_URL'] ?? 'https://sml-copytrader.onrender.com';
|
|
2
|
-
|
|
3
|
-
async function ctGet(path: string): Promise<unknown> {
|
|
4
|
-
const res = await fetch(`${COPYTRADER_BASE}${path}`, {
|
|
5
|
-
headers: { 'Accept': 'application/json' },
|
|
6
|
-
signal: AbortSignal.timeout(15_000),
|
|
7
|
-
});
|
|
8
|
-
if (!res.ok) throw new Error(`CopyTrader GET ${path}: HTTP ${res.status}`);
|
|
9
|
-
return res.json();
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface CopyTraderSubscribeParams {
|
|
13
|
-
whaleAddress: string;
|
|
14
|
-
subscriberAddress: string;
|
|
15
|
-
maxCopyAmountXrp: number;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
async function ctPost(path: string, body: unknown): Promise<unknown> {
|
|
19
|
-
const res = await fetch(`${COPYTRADER_BASE}${path}`, {
|
|
20
|
-
method: 'POST',
|
|
21
|
-
headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' },
|
|
22
|
-
body: JSON.stringify(body),
|
|
23
|
-
signal: AbortSignal.timeout(15_000),
|
|
24
|
-
});
|
|
25
|
-
if (!res.ok) throw new Error(`CopyTrader POST ${path}: HTTP ${res.status}`);
|
|
26
|
-
return res.json();
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export const CopyTraderAPI = {
|
|
30
|
-
status: () => ctGet('/status'),
|
|
31
|
-
whales: () => ctGet('/whales'),
|
|
32
|
-
subscribe: (params: CopyTraderSubscribeParams) => ctPost('/subscribe', params),
|
|
33
|
-
};
|
package/src/lib/sml-api/crawl.ts
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
export interface CrawlParams {
|
|
2
|
-
url: string;
|
|
3
|
-
extract: 'text' | 'links' | 'tables' | 'structured' | 'all';
|
|
4
|
-
userAgent?: string;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export interface CrawlResult {
|
|
8
|
-
url: string;
|
|
9
|
-
content: string | unknown;
|
|
10
|
-
status_code: number;
|
|
11
|
-
content_type: string;
|
|
12
|
-
fetched_at: string;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export class CrawlClient {
|
|
16
|
-
private static instance: CrawlClient;
|
|
17
|
-
private readonly baseUrl: string;
|
|
18
|
-
|
|
19
|
-
private constructor() {
|
|
20
|
-
this.baseUrl = process.env['SML_API_BASE'] ?? 'https://api.scriptmasterlabs.com';
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
static getInstance(): CrawlClient {
|
|
24
|
-
if (!CrawlClient.instance) {
|
|
25
|
-
CrawlClient.instance = new CrawlClient();
|
|
26
|
-
}
|
|
27
|
-
return CrawlClient.instance;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
async fetch(params: CrawlParams): Promise<CrawlResult> {
|
|
31
|
-
const res = await fetch(`${this.baseUrl}/crawl/v1/fetch`, {
|
|
32
|
-
method: 'POST',
|
|
33
|
-
headers: {
|
|
34
|
-
'Content-Type': 'application/json',
|
|
35
|
-
...(params.userAgent ? { 'X-Crawl-User-Agent': params.userAgent } : {}),
|
|
36
|
-
},
|
|
37
|
-
body: JSON.stringify({ url: params.url, extract: params.extract }),
|
|
38
|
-
signal: AbortSignal.timeout(30_000),
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
if (!res.ok) throw new Error(`Crawl API error: HTTP ${res.status}`);
|
|
42
|
-
return res.json() as Promise<CrawlResult>;
|
|
43
|
-
}
|
|
44
|
-
}
|
package/src/lib/sml-api/echo.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
// echo-forge — historical pattern similarity engine (Polygon.io + ML cosine similarity)
|
|
2
|
-
// Status: NOT YET DEPLOYED. Returns informative stub response until service is live.
|
|
3
|
-
|
|
4
|
-
export interface EchoPatternParams {
|
|
5
|
-
symbol: string;
|
|
6
|
-
lookbackDays: number;
|
|
7
|
-
topN?: number;
|
|
8
|
-
walletAddress: string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const EchoForgeAPI = {
|
|
12
|
-
patternMatch: async (params: EchoPatternParams): Promise<unknown> => {
|
|
13
|
-
// Service not yet deployed to Render — surface clear coming-soon message.
|
|
14
|
-
return {
|
|
15
|
-
status: 'coming_soon',
|
|
16
|
-
service: 'echo-forge',
|
|
17
|
-
message:
|
|
18
|
-
'echo-forge (historical pattern similarity engine) is not yet deployed. ' +
|
|
19
|
-
'It uses Polygon.io data + ML cosine similarity to find historical analogs. ' +
|
|
20
|
-
'Check https://github.com/Timwal78/echo-forge for status updates.',
|
|
21
|
-
params_received: {
|
|
22
|
-
symbol: params.symbol,
|
|
23
|
-
lookback_days: params.lookbackDays,
|
|
24
|
-
top_n: params.topN ?? 5,
|
|
25
|
-
},
|
|
26
|
-
};
|
|
27
|
-
},
|
|
28
|
-
};
|
package/src/lib/sml-api/forge.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
const FORGE_BASE = process.env['FORGE_GATEWAY_URL'] ?? 'https://forge-gateway-a822.onrender.com';
|
|
2
|
-
|
|
3
|
-
async function forgeGet(path: string): Promise<unknown> {
|
|
4
|
-
const res = await fetch(`${FORGE_BASE}${path}`, {
|
|
5
|
-
headers: { 'Accept': 'application/json' },
|
|
6
|
-
signal: AbortSignal.timeout(15_000),
|
|
7
|
-
});
|
|
8
|
-
if (!res.ok) throw new Error(`Forge Gateway GET ${path}: HTTP ${res.status}`);
|
|
9
|
-
return res.json();
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface ForgeLLMParams {
|
|
13
|
-
model: string;
|
|
14
|
-
prompt: string;
|
|
15
|
-
maxTokens?: number;
|
|
16
|
-
walletAddress: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
async function forgePost(path: string, body: unknown): Promise<unknown> {
|
|
20
|
-
const res = await fetch(`${FORGE_BASE}${path}`, {
|
|
21
|
-
method: 'POST',
|
|
22
|
-
headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' },
|
|
23
|
-
body: JSON.stringify(body),
|
|
24
|
-
signal: AbortSignal.timeout(60_000),
|
|
25
|
-
});
|
|
26
|
-
if (!res.ok) throw new Error(`Forge Gateway POST ${path}: HTTP ${res.status}`);
|
|
27
|
-
return res.json();
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export const ForgeGatewayAPI = {
|
|
31
|
-
status: () => forgeGet('/health'),
|
|
32
|
-
llm: (params: ForgeLLMParams) => forgePost('/v1/llm', params),
|
|
33
|
-
};
|
package/src/lib/sml-api/ftd.ts
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
export interface FtdAlertParams {
|
|
2
|
-
ticker?: string;
|
|
3
|
-
minSpikeMultiplier: number;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export interface FtdScanParams {
|
|
7
|
-
ticker?: string;
|
|
8
|
-
scanType: 'full' | 'spike_history';
|
|
9
|
-
minSpikeMultiplier: number;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export class FtdClient {
|
|
13
|
-
private static instance: FtdClient;
|
|
14
|
-
private readonly baseUrl: string;
|
|
15
|
-
|
|
16
|
-
private constructor() {
|
|
17
|
-
this.baseUrl = process.env['SML_API_BASE'] ?? 'https://api.scriptmasterlabs.com';
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
static getInstance(): FtdClient {
|
|
21
|
-
if (!FtdClient.instance) {
|
|
22
|
-
FtdClient.instance = new FtdClient();
|
|
23
|
-
}
|
|
24
|
-
return FtdClient.instance;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
async getAlerts(params: FtdAlertParams): Promise<unknown> {
|
|
28
|
-
const qs = new URLSearchParams({ min_spike: String(params.minSpikeMultiplier) });
|
|
29
|
-
if (params.ticker) qs.set('ticker', params.ticker);
|
|
30
|
-
|
|
31
|
-
const res = await fetch(`${this.baseUrl}/ftd/v1/alerts?${qs.toString()}`, {
|
|
32
|
-
signal: AbortSignal.timeout(10_000),
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
if (!res.ok) throw new Error(`FTD API error: HTTP ${res.status}`);
|
|
36
|
-
return res.json();
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
async getFullScan(params: FtdScanParams): Promise<unknown> {
|
|
40
|
-
const qs = new URLSearchParams({
|
|
41
|
-
scan_type: params.scanType,
|
|
42
|
-
min_spike: String(params.minSpikeMultiplier),
|
|
43
|
-
});
|
|
44
|
-
if (params.ticker) qs.set('ticker', params.ticker);
|
|
45
|
-
|
|
46
|
-
const res = await fetch(`${this.baseUrl}/ftd/v1/scan?${qs.toString()}`, {
|
|
47
|
-
signal: AbortSignal.timeout(10_000),
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
if (!res.ok) throw new Error(`FTD API error: HTTP ${res.status}`);
|
|
51
|
-
return res.json();
|
|
52
|
-
}
|
|
53
|
-
}
|
package/src/lib/sml-api/ghost.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
const GHOST_BASE = process.env['GHOST_LAYER_URL'] ?? 'https://ghost-layer.onrender.com';
|
|
2
|
-
|
|
3
|
-
async function ghostGet(path: string): Promise<unknown> {
|
|
4
|
-
const res = await fetch(`${GHOST_BASE}${path}`, {
|
|
5
|
-
headers: { 'Accept': 'application/json' },
|
|
6
|
-
signal: AbortSignal.timeout(15_000),
|
|
7
|
-
});
|
|
8
|
-
if (!res.ok) throw new Error(`Ghost Layer GET ${path}: HTTP ${res.status}`);
|
|
9
|
-
return res.json();
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface GhostRouteParams {
|
|
13
|
-
fromChain: 'xrpl' | 'base';
|
|
14
|
-
toChain: 'xrpl' | 'base';
|
|
15
|
-
amount: string;
|
|
16
|
-
currency: string;
|
|
17
|
-
destinationAddress: string;
|
|
18
|
-
walletAddress: string;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
async function ghostPost(path: string, body: unknown): Promise<unknown> {
|
|
22
|
-
const res = await fetch(`${GHOST_BASE}${path}`, {
|
|
23
|
-
method: 'POST',
|
|
24
|
-
headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' },
|
|
25
|
-
body: JSON.stringify(body),
|
|
26
|
-
signal: AbortSignal.timeout(15_000),
|
|
27
|
-
});
|
|
28
|
-
if (!res.ok) throw new Error(`Ghost Layer POST ${path}: HTTP ${res.status}`);
|
|
29
|
-
return res.json();
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export const GhostLayerAPI = {
|
|
33
|
-
status: () => ghostGet('/api/status'),
|
|
34
|
-
route: (params: GhostRouteParams) => ghostPost('/api/route', params),
|
|
35
|
-
};
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
const LAUNCHPAD_BASE = process.env['SML_LAUNCHPAD_URL'] ?? 'https://sml-launchpad.onrender.com';
|
|
2
|
-
|
|
3
|
-
async function lpGet(path: string): Promise<unknown> {
|
|
4
|
-
const res = await fetch(`${LAUNCHPAD_BASE}${path}`, {
|
|
5
|
-
headers: { 'Accept': 'application/json' },
|
|
6
|
-
signal: AbortSignal.timeout(15_000),
|
|
7
|
-
});
|
|
8
|
-
if (!res.ok) throw new Error(`Launchpad GET ${path}: HTTP ${res.status}`);
|
|
9
|
-
return res.json();
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface LaunchpadCreateParams {
|
|
13
|
-
name: string;
|
|
14
|
-
symbol: string;
|
|
15
|
-
description: string;
|
|
16
|
-
creatorAddress: string;
|
|
17
|
-
initialSupply: number;
|
|
18
|
-
targetLiquidityXrp: number;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface LaunchpadBuyParams {
|
|
22
|
-
tokenAddress: string;
|
|
23
|
-
buyerAddress: string;
|
|
24
|
-
xrpAmount: number;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
async function lpPost(path: string, body: unknown): Promise<unknown> {
|
|
28
|
-
const res = await fetch(`${LAUNCHPAD_BASE}${path}`, {
|
|
29
|
-
method: 'POST',
|
|
30
|
-
headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' },
|
|
31
|
-
body: JSON.stringify(body),
|
|
32
|
-
signal: AbortSignal.timeout(20_000),
|
|
33
|
-
});
|
|
34
|
-
if (!res.ok) throw new Error(`Launchpad POST ${path}: HTTP ${res.status}`);
|
|
35
|
-
return res.json();
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export const LaunchpadAPI = {
|
|
39
|
-
status: () => lpGet('/status'),
|
|
40
|
-
list: () => lpGet('/tokens'),
|
|
41
|
-
create: (params: LaunchpadCreateParams) => lpPost('/tokens', params),
|
|
42
|
-
buy: (params: LaunchpadBuyParams) => lpPost('/tokens/buy', params),
|
|
43
|
-
};
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
export interface LeviathanSignalParams {
|
|
2
|
-
ticker?: string;
|
|
3
|
-
signalType: 'squeeze' | 'momentum' | 'dark_pool' | 'all';
|
|
4
|
-
minConfidence: number;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export interface LeviathanSignal {
|
|
8
|
-
ticker: string;
|
|
9
|
-
signal_type: string;
|
|
10
|
-
confidence: number;
|
|
11
|
-
directive: string;
|
|
12
|
-
regime: string;
|
|
13
|
-
timestamp: string;
|
|
14
|
-
source: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export class LeviathanClient {
|
|
18
|
-
private static instance: LeviathanClient;
|
|
19
|
-
private readonly baseUrl: string;
|
|
20
|
-
|
|
21
|
-
private constructor() {
|
|
22
|
-
this.baseUrl = process.env['SML_API_BASE'] ?? 'https://api.scriptmasterlabs.com';
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
static getInstance(): LeviathanClient {
|
|
26
|
-
if (!LeviathanClient.instance) {
|
|
27
|
-
LeviathanClient.instance = new LeviathanClient();
|
|
28
|
-
}
|
|
29
|
-
return LeviathanClient.instance;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
async getSignal(params: LeviathanSignalParams): Promise<LeviathanSignal[]> {
|
|
33
|
-
const qs = new URLSearchParams({
|
|
34
|
-
signal_type: params.signalType,
|
|
35
|
-
min_confidence: String(params.minConfidence),
|
|
36
|
-
});
|
|
37
|
-
if (params.ticker) qs.set('ticker', params.ticker);
|
|
38
|
-
|
|
39
|
-
const res = await fetch(`${this.baseUrl}/leviathan/v1/signal?${qs.toString()}`, {
|
|
40
|
-
signal: AbortSignal.timeout(10_000),
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
if (!res.ok) {
|
|
44
|
-
throw new Error(`Leviathan API error: HTTP ${res.status}`);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return (await res.json()) as LeviathanSignal[];
|
|
48
|
-
}
|
|
49
|
-
}
|
package/src/lib/sml-api/nexus.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
export interface NexusQueryParams {
|
|
2
|
-
capability: string;
|
|
3
|
-
maxBudget: string;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
export interface NexusHireParams {
|
|
7
|
-
agentId: string;
|
|
8
|
-
budget: string;
|
|
9
|
-
chainPreference?: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export class NexusClient {
|
|
13
|
-
private static instance: NexusClient;
|
|
14
|
-
private readonly baseUrl: string;
|
|
15
|
-
|
|
16
|
-
private constructor() {
|
|
17
|
-
this.baseUrl = process.env['SML_API_BASE'] ?? 'https://api.scriptmasterlabs.com';
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
static getInstance(): NexusClient {
|
|
21
|
-
if (!NexusClient.instance) {
|
|
22
|
-
NexusClient.instance = new NexusClient();
|
|
23
|
-
}
|
|
24
|
-
return NexusClient.instance;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
async queryAgents(params: NexusQueryParams): Promise<unknown> {
|
|
28
|
-
const res = await fetch(`${this.baseUrl}/nexus/v1/agents`, {
|
|
29
|
-
method: 'POST',
|
|
30
|
-
headers: { 'Content-Type': 'application/json' },
|
|
31
|
-
body: JSON.stringify({ capability: params.capability, max_budget: params.maxBudget }),
|
|
32
|
-
signal: AbortSignal.timeout(10_000),
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
if (!res.ok) throw new Error(`Nexus API error: HTTP ${res.status}`);
|
|
36
|
-
return res.json();
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
async hireAgent(params: NexusHireParams): Promise<unknown> {
|
|
40
|
-
const res = await fetch(`${this.baseUrl}/nexus/v1/agents/${params.agentId}/hire`, {
|
|
41
|
-
method: 'POST',
|
|
42
|
-
headers: { 'Content-Type': 'application/json' },
|
|
43
|
-
body: JSON.stringify({ budget: params.budget, chain_preference: params.chainPreference }),
|
|
44
|
-
signal: AbortSignal.timeout(10_000),
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
if (!res.ok) throw new Error(`Nexus hire error: HTTP ${res.status}`);
|
|
48
|
-
return res.json();
|
|
49
|
-
}
|
|
50
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
const PROOF402_BASE = process.env['PROOF402_SERVER_URL'] ?? 'https://four02proof.onrender.com';
|
|
2
|
-
|
|
3
|
-
async function proofGet(path: string): Promise<unknown> {
|
|
4
|
-
const res = await fetch(`${PROOF402_BASE}${path}`, {
|
|
5
|
-
headers: { 'Accept': 'application/json' },
|
|
6
|
-
signal: AbortSignal.timeout(15_000),
|
|
7
|
-
});
|
|
8
|
-
if (!res.ok) throw new Error(`402Proof GET ${path}: HTTP ${res.status}`);
|
|
9
|
-
return res.json();
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
async function proofPost(path: string, body: unknown): Promise<unknown> {
|
|
13
|
-
const res = await fetch(`${PROOF402_BASE}${path}`, {
|
|
14
|
-
method: 'POST',
|
|
15
|
-
headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' },
|
|
16
|
-
body: JSON.stringify(body),
|
|
17
|
-
signal: AbortSignal.timeout(15_000),
|
|
18
|
-
});
|
|
19
|
-
if (!res.ok) throw new Error(`402Proof POST ${path}: HTTP ${res.status}`);
|
|
20
|
-
return res.json();
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const Proof402API = {
|
|
24
|
-
invoice: (endpointId: string) => proofGet(`/v1/invoice/${encodeURIComponent(endpointId)}`),
|
|
25
|
-
verify: (txHash: string, endpointId: string) => proofPost('/v1/verify', { tx_hash: txHash, endpoint_id: endpointId }),
|
|
26
|
-
creditScore: (walletAddress: string) => proofGet(`/v1/credit/${encodeURIComponent(walletAddress)}`),
|
|
27
|
-
};
|
package/src/lib/sml-api/rails.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
const RAILS_BASE = process.env['SML_RAILS_URL'] ?? 'https://sml-rails.onrender.com';
|
|
2
|
-
|
|
3
|
-
async function railsGet(path: string): Promise<unknown> {
|
|
4
|
-
const res = await fetch(`${RAILS_BASE}${path}`, {
|
|
5
|
-
headers: { 'Accept': 'application/json' },
|
|
6
|
-
signal: AbortSignal.timeout(15_000),
|
|
7
|
-
});
|
|
8
|
-
if (!res.ok) throw new Error(`SML Rails GET ${path}: HTTP ${res.status}`);
|
|
9
|
-
return res.json();
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface RailsTransferParams {
|
|
13
|
-
fromAddress: string;
|
|
14
|
-
toAddress: string;
|
|
15
|
-
amount: string;
|
|
16
|
-
currency: 'RLUSD' | 'XRP';
|
|
17
|
-
memo?: string;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
async function railsPost(path: string, body: unknown): Promise<unknown> {
|
|
21
|
-
const res = await fetch(`${RAILS_BASE}${path}`, {
|
|
22
|
-
method: 'POST',
|
|
23
|
-
headers: { 'Accept': 'application/json', 'Content-Type': 'application/json' },
|
|
24
|
-
body: JSON.stringify(body),
|
|
25
|
-
signal: AbortSignal.timeout(20_000),
|
|
26
|
-
});
|
|
27
|
-
if (!res.ok) throw new Error(`SML Rails POST ${path}: HTTP ${res.status}`);
|
|
28
|
-
return res.json();
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
export const RailsAPI = {
|
|
32
|
-
status: () => railsGet('/status'),
|
|
33
|
-
transfer: (params: RailsTransferParams) => railsPost('/transfer', params),
|
|
34
|
-
};
|