@123456btc/123456btc-cli 1.0.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.
Files changed (75) hide show
  1. package/README.md +93 -0
  2. package/bin/123456btc-cli +2 -0
  3. package/dist/api/auth.d.ts +27 -0
  4. package/dist/api/auth.d.ts.map +1 -0
  5. package/dist/api/auth.js +29 -0
  6. package/dist/api/auth.js.map +1 -0
  7. package/dist/api/client.d.ts +13 -0
  8. package/dist/api/client.d.ts.map +1 -0
  9. package/dist/api/client.js +106 -0
  10. package/dist/api/client.js.map +1 -0
  11. package/dist/api/client.test.d.ts +2 -0
  12. package/dist/api/client.test.d.ts.map +1 -0
  13. package/dist/api/client.test.js +27 -0
  14. package/dist/api/client.test.js.map +1 -0
  15. package/dist/api/gas.d.ts +29 -0
  16. package/dist/api/gas.d.ts.map +1 -0
  17. package/dist/api/gas.js +35 -0
  18. package/dist/api/gas.js.map +1 -0
  19. package/dist/api/strategy.d.ts +40 -0
  20. package/dist/api/strategy.d.ts.map +1 -0
  21. package/dist/api/strategy.js +47 -0
  22. package/dist/api/strategy.js.map +1 -0
  23. package/dist/cli.d.ts +3 -0
  24. package/dist/cli.d.ts.map +1 -0
  25. package/dist/cli.js +36 -0
  26. package/dist/cli.js.map +1 -0
  27. package/dist/commands/auth.d.ts +3 -0
  28. package/dist/commands/auth.d.ts.map +1 -0
  29. package/dist/commands/auth.js +115 -0
  30. package/dist/commands/auth.js.map +1 -0
  31. package/dist/commands/gas.d.ts +3 -0
  32. package/dist/commands/gas.d.ts.map +1 -0
  33. package/dist/commands/gas.js +104 -0
  34. package/dist/commands/gas.js.map +1 -0
  35. package/dist/commands/install.d.ts +3 -0
  36. package/dist/commands/install.d.ts.map +1 -0
  37. package/dist/commands/install.js +151 -0
  38. package/dist/commands/install.js.map +1 -0
  39. package/dist/commands/strategy.d.ts +3 -0
  40. package/dist/commands/strategy.d.ts.map +1 -0
  41. package/dist/commands/strategy.js +124 -0
  42. package/dist/commands/strategy.js.map +1 -0
  43. package/dist/config.d.ts +8 -0
  44. package/dist/config.d.ts.map +1 -0
  45. package/dist/config.js +68 -0
  46. package/dist/config.js.map +1 -0
  47. package/dist/index.d.ts +16 -0
  48. package/dist/index.d.ts.map +1 -0
  49. package/dist/index.js +26 -0
  50. package/dist/index.js.map +1 -0
  51. package/dist/providers/executor.d.ts +36 -0
  52. package/dist/providers/executor.d.ts.map +1 -0
  53. package/dist/providers/executor.js +90 -0
  54. package/dist/providers/executor.js.map +1 -0
  55. package/dist/providers/solana.d.ts +34 -0
  56. package/dist/providers/solana.d.ts.map +1 -0
  57. package/dist/providers/solana.js +69 -0
  58. package/dist/providers/solana.js.map +1 -0
  59. package/dist/providers/verification.d.ts +22 -0
  60. package/dist/providers/verification.d.ts.map +1 -0
  61. package/dist/providers/verification.js +54 -0
  62. package/dist/providers/verification.js.map +1 -0
  63. package/dist/types/api.d.ts +94 -0
  64. package/dist/types/api.d.ts.map +1 -0
  65. package/dist/types/api.js +6 -0
  66. package/dist/types/api.js.map +1 -0
  67. package/dist/types/gas.d.ts +27 -0
  68. package/dist/types/gas.d.ts.map +1 -0
  69. package/dist/types/gas.js +6 -0
  70. package/dist/types/gas.js.map +1 -0
  71. package/dist/types/strategy.d.ts +30 -0
  72. package/dist/types/strategy.d.ts.map +1 -0
  73. package/dist/types/strategy.js +6 -0
  74. package/dist/types/strategy.js.map +1 -0
  75. package/package.json +74 -0
package/README.md ADDED
@@ -0,0 +1,93 @@
1
+ # 123456btc-cli
2
+
3
+ CLI toolbox for 123456btc.com - Strategy dispatch & gas settlement for AI agents and LLMs.
4
+
5
+ ## Features
6
+
7
+ - **API Key Authentication** - OpenAI-style `sk_live_...` authentication to `api.123456btc.com`
8
+ - **Strategy Dispatch** - Send strategies for local execution
9
+ - **Gas Settlement** - Track and settle gas fees via Solana
10
+ - **Identity Tier Verification** - Solana token-based tier system
11
+ - **OpenClaw Package Installer** - Install AI/LLM compatible packages
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ npm install -g @123456btc/123456btc-cli
17
+ ```
18
+
19
+ ## Quick Start
20
+
21
+ ### 1. Authenticate
22
+
23
+ ```bash
24
+ 123456btc-cli auth login
25
+ # Or with API key directly:
26
+ 123456btc-cli auth login -k sk_live_your_key
27
+ ```
28
+
29
+ ### 2. Check Status
30
+
31
+ ```bash
32
+ 123456btc-cli auth status
33
+ 123456btc-cli gas balance
34
+ ```
35
+
36
+ ### 3. Run Strategy
37
+
38
+ ```bash
39
+ # List available strategies
40
+ 123456btc-cli strategy list
41
+
42
+ # Dispatch a strategy
43
+ 123456btc-cli strategy dispatch <strategy-id> --param key=value
44
+
45
+ # Check status
46
+ 123456btc-cli strategy status <dispatch-id>
47
+ ```
48
+
49
+ ### 4. Install Package
50
+
51
+ ```bash
52
+ 123456btc-cli install package https://example.com/package
53
+ ```
54
+
55
+ ## Environment Variables
56
+
57
+ ```bash
58
+ API_BASE_URL=https://api.123456btc.com
59
+ API_KEY=sk_live_your_key
60
+ SOLANA_RPC_URL=https://api.mainnet-beta.solana.com
61
+ SOLANA_CLUSTER=mainnet-beta
62
+ ```
63
+
64
+ ## Commands
65
+
66
+ | Command | Description |
67
+ |---------|-------------|
68
+ | `auth login` | Authenticate with API |
69
+ | `auth status` | Check auth status |
70
+ | `auth logout` | Clear auth |
71
+ | `strategy list` | List available strategies |
72
+ | `strategy dispatch` | Dispatch strategy |
73
+ | `strategy status` | Check status |
74
+ | `strategy history` | View history |
75
+ | `gas balance` | Check gas balance |
76
+ | `gas settle` | Settle fees |
77
+ | `gas transactions` | View transactions |
78
+ | `gas topup` | Top up balance |
79
+ | `install package` | Install package |
80
+ | `install list` | List installed packages |
81
+
82
+ ## Development
83
+
84
+ ```bash
85
+ npm install
86
+ npm run build
87
+ npm run watch
88
+ npm run test
89
+ ```
90
+
91
+ ## License
92
+
93
+ Apache-2.0
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ require('../dist/cli.js');
@@ -0,0 +1,27 @@
1
+ import { ApiClient } from './client';
2
+ import { ApiResponse, IdentityTier } from '../types/api';
3
+ export declare class AuthApi {
4
+ private client;
5
+ constructor(client: ApiClient);
6
+ /**
7
+ * Verify API key and get identity tier
8
+ */
9
+ verifyKey(): Promise<ApiResponse<IdentityTier>>;
10
+ /**
11
+ * Refresh session token
12
+ */
13
+ refreshToken(): Promise<ApiResponse<{
14
+ token: string;
15
+ expiresAt: number;
16
+ }>>;
17
+ /**
18
+ * Get current user info
19
+ */
20
+ userInfo(): Promise<ApiResponse<{
21
+ id: string;
22
+ email?: string;
23
+ tier: string;
24
+ createdAt: string;
25
+ }>>;
26
+ }
27
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/api/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,WAAW,EAAU,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjE,qBAAa,OAAO;IAClB,OAAO,CAAC,MAAM,CAAY;gBAEd,MAAM,EAAE,SAAS;IAI7B;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;IAIrD;;OAEG;IACG,YAAY,IAAI,OAAO,CAAC,WAAW,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAMhF;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC,WAAW,CAAC;QACpC,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC,CAAC;CAQJ"}
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AuthApi = void 0;
4
+ class AuthApi {
5
+ client;
6
+ constructor(client) {
7
+ this.client = client;
8
+ }
9
+ /**
10
+ * Verify API key and get identity tier
11
+ */
12
+ async verifyKey() {
13
+ return this.client.get('/v1/auth/verify');
14
+ }
15
+ /**
16
+ * Refresh session token
17
+ */
18
+ async refreshToken() {
19
+ return this.client.post('/v1/auth/refresh');
20
+ }
21
+ /**
22
+ * Get current user info
23
+ */
24
+ async userInfo() {
25
+ return this.client.get('/v1/auth/user');
26
+ }
27
+ }
28
+ exports.AuthApi = AuthApi;
29
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/api/auth.ts"],"names":[],"mappings":";;;AAGA,MAAa,OAAO;IACV,MAAM,CAAY;IAE1B,YAAY,MAAiB;QAC3B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,SAAS;QACb,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAe,iBAAiB,CAAC,CAAC;IAC1D,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,YAAY;QAChB,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CACrB,kBAAkB,CACnB,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,QAAQ;QAMZ,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAKnB,eAAe,CAAC,CAAC;IACtB,CAAC;CACF;AAvCD,0BAuCC"}
@@ -0,0 +1,13 @@
1
+ import { AxiosRequestConfig } from 'axios';
2
+ import { ApiResponse } from '../types/api';
3
+ export declare class ApiClient {
4
+ private client;
5
+ private baseUrl;
6
+ private apiKey;
7
+ constructor(baseUrl: string, apiKey: string);
8
+ get<T>(endpoint: string, params?: Record<string, unknown>): Promise<ApiResponse<T>>;
9
+ post<T>(endpoint: string, data?: unknown, config?: AxiosRequestConfig): Promise<ApiResponse<T>>;
10
+ patch<T>(endpoint: string, data?: unknown): Promise<ApiResponse<T>>;
11
+ delete<T>(endpoint: string): Promise<ApiResponse<T>>;
12
+ }
13
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA,OAAc,EAAiB,kBAAkB,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,WAAW,EAAY,MAAM,cAAc,CAAC;AAErD,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAS;gBAEX,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAsCrC,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAenF,IAAI,CAAC,CAAC,EACV,QAAQ,EAAE,MAAM,EAChB,IAAI,CAAC,EAAE,OAAO,EACd,MAAM,CAAC,EAAE,kBAAkB,GAC1B,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAepB,KAAK,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;IAenE,MAAM,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;CAc3D"}
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ApiClient = void 0;
7
+ const axios_1 = __importDefault(require("axios"));
8
+ class ApiClient {
9
+ client;
10
+ baseUrl;
11
+ apiKey;
12
+ constructor(baseUrl, apiKey) {
13
+ this.baseUrl = baseUrl;
14
+ this.apiKey = apiKey;
15
+ this.client = axios_1.default.create({
16
+ baseURL: baseUrl,
17
+ timeout: 30000,
18
+ headers: {
19
+ 'Content-Type': 'application/json',
20
+ 'X-API-Key': apiKey,
21
+ },
22
+ });
23
+ // Response interceptor
24
+ this.client.interceptors.response.use((response) => response, (error) => {
25
+ if (error.response) {
26
+ return {
27
+ success: false,
28
+ error: {
29
+ code: error.response.data?.code || 'API_ERROR',
30
+ message: error.response.data?.message || error.message,
31
+ details: error.response.data,
32
+ },
33
+ };
34
+ }
35
+ return {
36
+ success: false,
37
+ error: {
38
+ code: 'NETWORK_ERROR',
39
+ message: error.message || 'Network error',
40
+ },
41
+ };
42
+ });
43
+ }
44
+ async get(endpoint, params) {
45
+ try {
46
+ const response = await this.client.get(endpoint, { params });
47
+ return response.data;
48
+ }
49
+ catch (error) {
50
+ return {
51
+ success: false,
52
+ error: {
53
+ code: 'GET_ERROR',
54
+ message: error instanceof Error ? error.message : 'Get request failed',
55
+ },
56
+ };
57
+ }
58
+ }
59
+ async post(endpoint, data, config) {
60
+ try {
61
+ const response = await this.client.post(endpoint, data, config);
62
+ return response.data;
63
+ }
64
+ catch (error) {
65
+ return {
66
+ success: false,
67
+ error: {
68
+ code: 'POST_ERROR',
69
+ message: error instanceof Error ? error.message : 'Post request failed',
70
+ },
71
+ };
72
+ }
73
+ }
74
+ async patch(endpoint, data) {
75
+ try {
76
+ const response = await this.client.patch(endpoint, data);
77
+ return response.data;
78
+ }
79
+ catch (error) {
80
+ return {
81
+ success: false,
82
+ error: {
83
+ code: 'PATCH_ERROR',
84
+ message: error instanceof Error ? error.message : 'Patch request failed',
85
+ },
86
+ };
87
+ }
88
+ }
89
+ async delete(endpoint) {
90
+ try {
91
+ const response = await this.client.delete(endpoint);
92
+ return response.data;
93
+ }
94
+ catch (error) {
95
+ return {
96
+ success: false,
97
+ error: {
98
+ code: 'DELETE_ERROR',
99
+ message: error instanceof Error ? error.message : 'Delete request failed',
100
+ },
101
+ };
102
+ }
103
+ }
104
+ }
105
+ exports.ApiClient = ApiClient;
106
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=client.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.test.d.ts","sourceRoot":"","sources":["../../src/api/client.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const client_1 = require("./client");
4
+ describe('ApiClient', () => {
5
+ let client;
6
+ beforeEach(() => {
7
+ client = new client_1.ApiClient('https://api.test.com', 'sk_test_test123');
8
+ });
9
+ describe('constructor', () => {
10
+ it('should create client with correct base url', () => {
11
+ expect(client).toBeDefined();
12
+ });
13
+ });
14
+ describe('get', () => {
15
+ it('should return success response on 200', async () => {
16
+ const response = await client.get('/test');
17
+ expect(response).toHaveProperty('success');
18
+ });
19
+ });
20
+ describe('post', () => {
21
+ it('should return success response on 200', async () => {
22
+ const response = await client.post('/test', { data: 'test' });
23
+ expect(response).toHaveProperty('success');
24
+ });
25
+ });
26
+ });
27
+ //# sourceMappingURL=client.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.test.js","sourceRoot":"","sources":["../../src/api/client.test.ts"],"names":[],"mappings":";;AAAA,qCAAqC;AAErC,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,IAAI,MAAiB,CAAC;IAEtB,UAAU,CAAC,GAAG,EAAE;QACd,MAAM,GAAG,IAAI,kBAAS,CAAC,sBAAsB,EAAE,iBAAiB,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;QAC3B,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;YACpD,MAAM,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC;QAC/B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE;QACnB,EAAE,CAAC,uCAAuC,EAAE,KAAK,IAAI,EAAE;YACrD,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YAC3C,MAAM,CAAC,QAAQ,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QAC7C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,MAAM,EAAE,GAAG,EAAE;QACpB,EAAE,CAAC,uCAAuC,EAAE,KAAK,IAAI,EAAE;YACrD,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;YAC9D,MAAM,CAAC,QAAQ,CAAC,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;QAC7C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { ApiClient } from './client';
2
+ import { ApiResponse, GasBalance, GasSettlement, GasTransaction } from '../types/api';
3
+ export declare class GasApi {
4
+ private client;
5
+ constructor(client: ApiClient);
6
+ /**
7
+ * Get gas balance
8
+ */
9
+ getBalance(): Promise<ApiResponse<GasBalance>>;
10
+ /**
11
+ * Settle gas fees for completed strategies
12
+ */
13
+ settle(dispatchId: string): Promise<ApiResponse<GasSettlement>>;
14
+ /**
15
+ * Get gas transactions history
16
+ */
17
+ getTransactions(params?: {
18
+ limit?: number;
19
+ offset?: number;
20
+ }): Promise<ApiResponse<GasTransaction[]>>;
21
+ /**
22
+ * Top up gas balance
23
+ */
24
+ topUp(amount: number, currency: 'SOL' | 'USDC'): Promise<ApiResponse<{
25
+ transactionId: string;
26
+ status: string;
27
+ }>>;
28
+ }
29
+ //# sourceMappingURL=gas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gas.d.ts","sourceRoot":"","sources":["../../src/api/gas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EACL,WAAW,EACX,UAAU,EACV,aAAa,EACb,cAAc,EACf,MAAM,cAAc,CAAC;AAEtB,qBAAa,MAAM;IACjB,OAAO,CAAC,MAAM,CAAY;gBAEd,MAAM,EAAE,SAAS;IAI7B;;OAEG;IACG,UAAU,IAAI,OAAO,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAIpD;;OAEG;IACG,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;IAIrE;;OAEG;IACG,eAAe,CAAC,MAAM,CAAC,EAAE;QAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,GAAG,OAAO,CAAC,WAAW,CAAC,cAAc,EAAE,CAAC,CAAC;IAI1C;;OAEG;IACG,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,GAAG,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;QACzE,aAAa,EAAE,MAAM,CAAC;QACtB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC,CAAC;CAMJ"}
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GasApi = void 0;
4
+ class GasApi {
5
+ client;
6
+ constructor(client) {
7
+ this.client = client;
8
+ }
9
+ /**
10
+ * Get gas balance
11
+ */
12
+ async getBalance() {
13
+ return this.client.get('/v1/gas/balance');
14
+ }
15
+ /**
16
+ * Settle gas fees for completed strategies
17
+ */
18
+ async settle(dispatchId) {
19
+ return this.client.post(`/v1/gas/settle/${dispatchId}`);
20
+ }
21
+ /**
22
+ * Get gas transactions history
23
+ */
24
+ async getTransactions(params) {
25
+ return this.client.get('/v1/gas/transactions', params);
26
+ }
27
+ /**
28
+ * Top up gas balance
29
+ */
30
+ async topUp(amount, currency) {
31
+ return this.client.post('/v1/gas/topup', { amount, currency });
32
+ }
33
+ }
34
+ exports.GasApi = GasApi;
35
+ //# sourceMappingURL=gas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gas.js","sourceRoot":"","sources":["../../src/api/gas.ts"],"names":[],"mappings":";;;AAQA,MAAa,MAAM;IACT,MAAM,CAAY;IAE1B,YAAY,MAAiB;QAC3B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU;QACd,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAa,iBAAiB,CAAC,CAAC;IACxD,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,UAAkB;QAC7B,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAgB,kBAAkB,UAAU,EAAE,CAAC,CAAC;IACzE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,eAAe,CAAC,MAGrB;QACC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAmB,sBAAsB,EAAE,MAAM,CAAC,CAAC;IAC3E,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,KAAK,CAAC,MAAc,EAAE,QAAwB;QAIlD,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAGpB,eAAe,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC5C,CAAC;CACF;AA3CD,wBA2CC"}
@@ -0,0 +1,40 @@
1
+ import { ApiClient } from './client';
2
+ import { ApiResponse, Strategy, StrategyDispatchRequest, StrategyDispatchResponse, StrategyStatus } from '../types/api';
3
+ export declare class StrategyApi {
4
+ private client;
5
+ constructor(client: ApiClient);
6
+ /**
7
+ * List available strategies
8
+ */
9
+ list(params?: {
10
+ tier?: string;
11
+ limit?: number;
12
+ offset?: number;
13
+ }): Promise<ApiResponse<Strategy[]>>;
14
+ /**
15
+ * Get strategy by ID
16
+ */
17
+ get(id: string): Promise<ApiResponse<Strategy>>;
18
+ /**
19
+ * Dispatch strategy to local execution
20
+ */
21
+ dispatch(request: StrategyDispatchRequest): Promise<ApiResponse<StrategyDispatchResponse>>;
22
+ /**
23
+ * Get strategy execution status
24
+ */
25
+ getStatus(dispatchId: string): Promise<ApiResponse<StrategyStatus>>;
26
+ /**
27
+ * Cancel running strategy
28
+ */
29
+ cancel(dispatchId: string): Promise<ApiResponse<{
30
+ success: boolean;
31
+ }>>;
32
+ /**
33
+ * Get strategy history
34
+ */
35
+ getHistory(params?: {
36
+ limit?: number;
37
+ status?: string;
38
+ }): Promise<ApiResponse<StrategyStatus[]>>;
39
+ }
40
+ //# sourceMappingURL=strategy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strategy.d.ts","sourceRoot":"","sources":["../../src/api/strategy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EACL,WAAW,EACX,QAAQ,EACR,uBAAuB,EACvB,wBAAwB,EACxB,cAAc,EACf,MAAM,cAAc,CAAC;AAEtB,qBAAa,WAAW;IACtB,OAAO,CAAC,MAAM,CAAY;gBAEd,MAAM,EAAE,SAAS;IAI7B;;OAEG;IACG,IAAI,CAAC,MAAM,CAAC,EAAE;QAClB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,GAAG,OAAO,CAAC,WAAW,CAAC,QAAQ,EAAE,CAAC,CAAC;IAIpC;;OAEG;IACG,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IAIrD;;OAEG;IACG,QAAQ,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,WAAW,CAAC,wBAAwB,CAAC,CAAC;IAOhG;;OAEG;IACG,SAAS,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IAMzE;;OAEG;IACG,MAAM,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAM5E;;OAEG;IACG,UAAU,CAAC,MAAM,CAAC,EAAE;QACxB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;KACjB,GAAG,OAAO,CAAC,WAAW,CAAC,cAAc,EAAE,CAAC,CAAC;CAG3C"}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StrategyApi = void 0;
4
+ class StrategyApi {
5
+ client;
6
+ constructor(client) {
7
+ this.client = client;
8
+ }
9
+ /**
10
+ * List available strategies
11
+ */
12
+ async list(params) {
13
+ return this.client.get('/v1/strategies', params);
14
+ }
15
+ /**
16
+ * Get strategy by ID
17
+ */
18
+ async get(id) {
19
+ return this.client.get(`/v1/strategies/${id}`);
20
+ }
21
+ /**
22
+ * Dispatch strategy to local execution
23
+ */
24
+ async dispatch(request) {
25
+ return this.client.post('/v1/strategy/dispatch', request);
26
+ }
27
+ /**
28
+ * Get strategy execution status
29
+ */
30
+ async getStatus(dispatchId) {
31
+ return this.client.get(`/v1/strategy/status/${dispatchId}`);
32
+ }
33
+ /**
34
+ * Cancel running strategy
35
+ */
36
+ async cancel(dispatchId) {
37
+ return this.client.post(`/v1/strategy/cancel/${dispatchId}`);
38
+ }
39
+ /**
40
+ * Get strategy history
41
+ */
42
+ async getHistory(params) {
43
+ return this.client.get('/v1/strategy/history', params);
44
+ }
45
+ }
46
+ exports.StrategyApi = StrategyApi;
47
+ //# sourceMappingURL=strategy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strategy.js","sourceRoot":"","sources":["../../src/api/strategy.ts"],"names":[],"mappings":";;;AASA,MAAa,WAAW;IACd,MAAM,CAAY;IAE1B,YAAY,MAAiB;QAC3B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAAI,CAAC,MAIV;QACC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAa,gBAAgB,EAAE,MAAM,CAAC,CAAC;IAC/D,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,GAAG,CAAC,EAAU;QAClB,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAW,kBAAkB,EAAE,EAAE,CAAC,CAAC;IAC3D,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,QAAQ,CAAC,OAAgC;QAC7C,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CACrB,uBAAuB,EACvB,OAAO,CACR,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,SAAS,CAAC,UAAkB;QAChC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CACpB,uBAAuB,UAAU,EAAE,CACpC,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,MAAM,CAAC,UAAkB;QAC7B,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CACrB,uBAAuB,UAAU,EAAE,CACpC,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU,CAAC,MAGhB;QACC,OAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAmB,sBAAsB,EAAE,MAAM,CAAC,CAAC;IAC3E,CAAC;CACF;AA9DD,kCA8DC"}
package/dist/cli.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
package/dist/cli.js ADDED
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const commander_1 = require("commander");
5
+ const auth_1 = require("./commands/auth");
6
+ const strategy_1 = require("./commands/strategy");
7
+ const gas_1 = require("./commands/gas");
8
+ const install_1 = require("./commands/install");
9
+ const program = new commander_1.Command();
10
+ // Global options
11
+ program
12
+ .option('-k, --key <api_key>', 'API key (overrides stored credential)')
13
+ .option('-u, --url <base_url>', 'API base URL')
14
+ .option('-v, --verbose', 'Verbose output');
15
+ // Version
16
+ program
17
+ .name('123456btc-cli')
18
+ .description('123456btc CLI - Strategy dispatch & gas settlement for AI agents')
19
+ .version('1.0.0');
20
+ // Add all commands
21
+ (0, auth_1.createAuthCommand)(program);
22
+ (0, strategy_1.createStrategyCommand)(program);
23
+ (0, gas_1.createGasCommand)(program);
24
+ (0, install_1.createInstallCommand)(program);
25
+ // Global error handling
26
+ program.exitOverride((code) => {
27
+ process.exit(typeof code === 'number' ? code : 1);
28
+ });
29
+ // Parse
30
+ program.parse(process.argv);
31
+ // If no command provided, show help
32
+ const parsed = program.parseOptions(process.argv);
33
+ if (parsed.args && parsed.args.length === 0) {
34
+ program.outputHelp();
35
+ }
36
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;AACA,yCAAoC;AAEpC,0CAAoD;AACpD,kDAA4D;AAC5D,wCAAkD;AAClD,gDAA0D;AAE1D,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,iBAAiB;AACjB,OAAO;KACJ,MAAM,CAAC,qBAAqB,EAAE,uCAAuC,CAAC;KACtE,MAAM,CAAC,sBAAsB,EAAE,cAAc,CAAC;KAC9C,MAAM,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC;AAE7C,UAAU;AACV,OAAO;KACJ,IAAI,CAAC,eAAe,CAAC;KACrB,WAAW,CAAC,kEAAkE,CAAC;KAC/E,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,mBAAmB;AACnB,IAAA,wBAAiB,EAAC,OAAO,CAAC,CAAC;AAC3B,IAAA,gCAAqB,EAAC,OAAO,CAAC,CAAC;AAC/B,IAAA,sBAAgB,EAAC,OAAO,CAAC,CAAC;AAC1B,IAAA,8BAAoB,EAAC,OAAO,CAAC,CAAC;AAE9B,wBAAwB;AACxB,OAAO,CAAC,YAAY,CAAC,CAAC,IAAI,EAAE,EAAE;IAC5B,OAAO,CAAC,IAAI,CAAC,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC,CAAC,CAAC;AAEH,QAAQ;AACR,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAE5B,oCAAoC;AACpC,MAAM,MAAM,GAAQ,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AACvD,IAAI,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;IAC5C,OAAO,CAAC,UAAU,EAAE,CAAC;AACvB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from 'commander';
2
+ export declare function createAuthCommand(program: Command): void;
3
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAapC,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,QA8EjD"}