@termix-it/vue-tool 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.
- package/README.md +650 -0
- package/dist/adapters/EthersV5Adapter.d.ts +20 -0
- package/dist/adapters/EthersV5Adapter.d.ts.map +1 -0
- package/dist/adapters/EthersV6Adapter.d.ts +20 -0
- package/dist/adapters/EthersV6Adapter.d.ts.map +1 -0
- package/dist/components/AP2PaymentFlow.vue.d.ts +44 -0
- package/dist/components/AP2PaymentFlow.vue.d.ts.map +1 -0
- package/dist/components/ChatInterface.vue.d.ts +67 -0
- package/dist/components/ChatInterface.vue.d.ts.map +1 -0
- package/dist/components/ChatWidget.vue.d.ts +80 -0
- package/dist/components/ChatWidget.vue.d.ts.map +1 -0
- package/dist/components/FunctionCallDisplay.vue.d.ts +38 -0
- package/dist/components/FunctionCallDisplay.vue.d.ts.map +1 -0
- package/dist/components/PaymentApprovalModal.vue.d.ts +46 -0
- package/dist/components/PaymentApprovalModal.vue.d.ts.map +1 -0
- package/dist/components/SourcesBadge.vue.d.ts +20 -0
- package/dist/components/SourcesBadge.vue.d.ts.map +1 -0
- package/dist/components/WalletConnect.vue.d.ts +24 -0
- package/dist/components/WalletConnect.vue.d.ts.map +1 -0
- package/dist/components/WalletIndicator.vue.d.ts +33 -0
- package/dist/components/WalletIndicator.vue.d.ts.map +1 -0
- package/dist/components/index.d.ts +14 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/composables/index.d.ts +10 -0
- package/dist/composables/index.d.ts.map +1 -0
- package/dist/composables/useAP2Payment.d.ts +96 -0
- package/dist/composables/useAP2Payment.d.ts.map +1 -0
- package/dist/composables/useDI.d.ts +75 -0
- package/dist/composables/useDI.d.ts.map +1 -0
- package/dist/composables/useInternalDI.d.ts +23 -0
- package/dist/composables/useInternalDI.d.ts.map +1 -0
- package/dist/composables/useToast.d.ts +14 -0
- package/dist/composables/useToast.d.ts.map +1 -0
- package/dist/core/container.d.ts +99 -0
- package/dist/core/container.d.ts.map +1 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/internal-container.d.ts +26 -0
- package/dist/core/internal-container.d.ts.map +1 -0
- package/dist/core/tokens.d.ts +44 -0
- package/dist/core/tokens.d.ts.map +1 -0
- package/dist/core/types.d.ts +104 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/executors/AP2Executor.d.ts +20 -0
- package/dist/executors/AP2Executor.d.ts.map +1 -0
- package/dist/executors/APIExecutor.d.ts +35 -0
- package/dist/executors/APIExecutor.d.ts.map +1 -0
- package/dist/executors/ContractExecutor.d.ts +41 -0
- package/dist/executors/ContractExecutor.d.ts.map +1 -0
- package/dist/executors/ExecutorRegistry.d.ts +99 -0
- package/dist/executors/ExecutorRegistry.d.ts.map +1 -0
- package/dist/executors/FiatExecutor.d.ts +31 -0
- package/dist/executors/FiatExecutor.d.ts.map +1 -0
- package/dist/executors/base/BaseExecutor.d.ts +87 -0
- package/dist/executors/base/BaseExecutor.d.ts.map +1 -0
- package/dist/executors/base/index.d.ts +2 -0
- package/dist/executors/base/index.d.ts.map +1 -0
- package/dist/executors/index.d.ts +7 -0
- package/dist/executors/index.d.ts.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17473 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/IAPIClient.d.ts +179 -0
- package/dist/interfaces/IAPIClient.d.ts.map +1 -0
- package/dist/interfaces/IEthersAdapter.d.ts +116 -0
- package/dist/interfaces/IEthersAdapter.d.ts.map +1 -0
- package/dist/interfaces/IExecutor.d.ts +64 -0
- package/dist/interfaces/IExecutor.d.ts.map +1 -0
- package/dist/interfaces/IRenderer.d.ts +117 -0
- package/dist/interfaces/IRenderer.d.ts.map +1 -0
- package/dist/interfaces/index.d.ts +5 -0
- package/dist/interfaces/index.d.ts.map +1 -0
- package/dist/lib/markdown.d.ts +21 -0
- package/dist/lib/markdown.d.ts.map +1 -0
- package/dist/lib/utils.d.ts +72 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/renderers/AP2Renderer.d.ts +12 -0
- package/dist/renderers/AP2Renderer.d.ts.map +1 -0
- package/dist/renderers/APIRenderer.d.ts +12 -0
- package/dist/renderers/APIRenderer.d.ts.map +1 -0
- package/dist/renderers/BaseRenderer.d.ts +16 -0
- package/dist/renderers/BaseRenderer.d.ts.map +1 -0
- package/dist/renderers/ContractRenderer.d.ts +14 -0
- package/dist/renderers/ContractRenderer.d.ts.map +1 -0
- package/dist/renderers/FiatRenderer.d.ts +12 -0
- package/dist/renderers/FiatRenderer.d.ts.map +1 -0
- package/dist/renderers/RendererRegistry.d.ts +78 -0
- package/dist/renderers/RendererRegistry.d.ts.map +1 -0
- package/dist/renderers/index.d.ts +12 -0
- package/dist/renderers/index.d.ts.map +1 -0
- package/dist/services/api.d.ts +55 -0
- package/dist/services/api.d.ts.map +1 -0
- package/dist/services/functionCallExecutor.d.ts +32 -0
- package/dist/services/functionCallExecutor.d.ts.map +1 -0
- package/dist/services/moonpayService.d.ts +82 -0
- package/dist/services/moonpayService.d.ts.map +1 -0
- package/dist/services/toolCallProcessor.d.ts +12 -0
- package/dist/services/toolCallProcessor.d.ts.map +1 -0
- package/dist/services/walletService.d.ts +250 -0
- package/dist/services/walletService.d.ts.map +1 -0
- package/dist/style.css +1 -0
- package/dist/types/index.d.ts +109 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/moonpay.d.ts +31 -0
- package/dist/types/moonpay.d.ts.map +1 -0
- package/package.json +87 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Toast Composable
|
|
3
|
+
*
|
|
4
|
+
* Simple toast notification composable - can be replaced with your preferred toast library
|
|
5
|
+
*/
|
|
6
|
+
export interface ToastOptions {
|
|
7
|
+
title: string;
|
|
8
|
+
description?: string;
|
|
9
|
+
variant?: 'default' | 'destructive';
|
|
10
|
+
}
|
|
11
|
+
export declare function useToast(): {
|
|
12
|
+
toast: (options: ToastOptions) => void;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=useToast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useToast.d.ts","sourceRoot":"","sources":["../../src/composables/useToast.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC;CACrC;AAED,wBAAgB,QAAQ;qBACE,YAAY;EAcrC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { Container } from 'inversify';
|
|
2
|
+
import { SDKConfig } from './types';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Get the global container instance
|
|
6
|
+
* Throws error if not initialized
|
|
7
|
+
*/
|
|
8
|
+
export declare function getContainer(): Container;
|
|
9
|
+
/**
|
|
10
|
+
* Check if container is initialized
|
|
11
|
+
*/
|
|
12
|
+
export declare function isContainerInitialized(): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Initialize the DI container with configuration
|
|
15
|
+
*
|
|
16
|
+
* This function:
|
|
17
|
+
* 1. Creates a new container instance
|
|
18
|
+
* 2. Registers all core services
|
|
19
|
+
* 3. Registers all executors
|
|
20
|
+
* 4. Registers all renderers
|
|
21
|
+
* 5. Binds configuration values
|
|
22
|
+
*
|
|
23
|
+
* @param config - SDK configuration
|
|
24
|
+
* @returns Initialized container
|
|
25
|
+
*/
|
|
26
|
+
export declare function initializeContainer(config: SDKConfig): Container;
|
|
27
|
+
/**
|
|
28
|
+
* Reset the container (useful for testing)
|
|
29
|
+
*/
|
|
30
|
+
export declare function resetContainer(): void;
|
|
31
|
+
/**
|
|
32
|
+
* Create a child container (for scoped dependencies)
|
|
33
|
+
*
|
|
34
|
+
* Useful for:
|
|
35
|
+
* - Per-request scoping
|
|
36
|
+
* - Per-component scoping
|
|
37
|
+
* - Testing with mocks
|
|
38
|
+
*
|
|
39
|
+
* @param parentContainer - Parent container to inherit from
|
|
40
|
+
* @returns New child container
|
|
41
|
+
*/
|
|
42
|
+
export declare function createChildContainer(parentContainer?: Container): Container;
|
|
43
|
+
/**
|
|
44
|
+
* Helper to get a service from the container
|
|
45
|
+
*
|
|
46
|
+
* Type-safe service resolution
|
|
47
|
+
*
|
|
48
|
+
* @param token - Service token
|
|
49
|
+
* @returns Service instance
|
|
50
|
+
*/
|
|
51
|
+
export declare function getService<T>(token: symbol): T;
|
|
52
|
+
/**
|
|
53
|
+
* Helper to get all services of a type (for registries)
|
|
54
|
+
*
|
|
55
|
+
* @param token - Service token
|
|
56
|
+
* @returns Array of service instances
|
|
57
|
+
*/
|
|
58
|
+
export declare function getAllServices<T>(token: symbol): T[];
|
|
59
|
+
/**
|
|
60
|
+
* Helper to check if a service is bound
|
|
61
|
+
*
|
|
62
|
+
* @param token - Service token
|
|
63
|
+
* @returns True if service is bound
|
|
64
|
+
*/
|
|
65
|
+
export declare function hasService(token: symbol): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Helper to bind a service manually
|
|
68
|
+
*
|
|
69
|
+
* @param token - Service token
|
|
70
|
+
* @param service - Service instance or factory
|
|
71
|
+
* @param scope - Service scope (Singleton, Transient, Request)
|
|
72
|
+
*/
|
|
73
|
+
export declare function bindService<T>(token: symbol, service: new (...args: any[]) => T | T, scope?: 'Singleton' | 'Transient' | 'Request'): void;
|
|
74
|
+
/**
|
|
75
|
+
* Helper to bind a factory function
|
|
76
|
+
*
|
|
77
|
+
* @param token - Service token
|
|
78
|
+
* @param factory - Factory function
|
|
79
|
+
*/
|
|
80
|
+
export declare function bindFactory<T>(token: symbol, factory: (context: any) => T): void;
|
|
81
|
+
/**
|
|
82
|
+
* Helper to unbind a service
|
|
83
|
+
*
|
|
84
|
+
* @param token - Service token
|
|
85
|
+
*/
|
|
86
|
+
export declare function unbindService(token: symbol): void;
|
|
87
|
+
/**
|
|
88
|
+
* Container snapshot for testing
|
|
89
|
+
*/
|
|
90
|
+
export interface ContainerSnapshot {
|
|
91
|
+
config: SDKConfig;
|
|
92
|
+
services: Map<symbol, any>;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Create a snapshot of the container state
|
|
96
|
+
* Useful for debugging and testing
|
|
97
|
+
*/
|
|
98
|
+
export declare function snapshotContainer(): ContainerSnapshot;
|
|
99
|
+
//# sourceMappingURL=container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container.d.ts","sourceRoot":"","sources":["../../src/core/container.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,kBAAkB,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAiCpC;;;GAGG;AACH,wBAAgB,YAAY,IAAI,SAAS,CAOxC;AAED;;GAEG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAEhD;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,CAsBhE;AAsFD;;GAEG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAKrC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,eAAe,CAAC,EAAE,SAAS,GAAG,SAAS,CAM3E;AAED;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,CAG9C;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,EAAE,CAGpD;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAGjD;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,KAAK,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,EACtC,KAAK,GAAE,WAAW,GAAG,WAAW,GAAG,SAAuB,GACzD,IAAI,CAsBN;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,CAAC,EAC3B,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,GAC3B,IAAI,CAGN;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAKjD;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,MAAM,EAAE,SAAS,CAAC;IAClB,QAAQ,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC5B;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,IAAI,iBAAiB,CAgBrD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Container } from 'inversify';
|
|
2
|
+
|
|
3
|
+
export interface ContainerConfig {
|
|
4
|
+
projectId: string;
|
|
5
|
+
authorization?: string;
|
|
6
|
+
apiBaseUrl?: string;
|
|
7
|
+
domainHeaders?: any[];
|
|
8
|
+
proxyMode?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Get or create a container instance based on configuration.
|
|
12
|
+
* If the configuration hasn't changed, returns the cached container.
|
|
13
|
+
* Otherwise, creates a new container with the new configuration.
|
|
14
|
+
*/
|
|
15
|
+
export declare function getOrCreateContainer(config: ContainerConfig): Container;
|
|
16
|
+
/**
|
|
17
|
+
* Reset the global container.
|
|
18
|
+
* Useful for testing or when you need to force re-initialization.
|
|
19
|
+
*/
|
|
20
|
+
export declare function resetContainer(): void;
|
|
21
|
+
/**
|
|
22
|
+
* Get the current container instance without creating a new one.
|
|
23
|
+
* Returns null if no container has been initialized yet.
|
|
24
|
+
*/
|
|
25
|
+
export declare function getCurrentContainer(): Container | null;
|
|
26
|
+
//# sourceMappingURL=internal-container.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal-container.d.ts","sourceRoot":"","sources":["../../src/core/internal-container.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AActC,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,GAAG,EAAE,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,eAAe,GAAG,SAAS,CAyBvE;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,IAAI,CAGrC;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,SAAS,GAAG,IAAI,CAEtD"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dependency Injection Tokens
|
|
3
|
+
*
|
|
4
|
+
* This file defines all the injection tokens used throughout the application.
|
|
5
|
+
* Using symbols ensures type-safe dependency injection and prevents naming collisions.
|
|
6
|
+
*
|
|
7
|
+
* Inspired by Angular's DI token system.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Core Service Tokens
|
|
11
|
+
*/
|
|
12
|
+
export declare const TOKENS: {
|
|
13
|
+
readonly APIClient: symbol;
|
|
14
|
+
readonly EthersAdapter: symbol;
|
|
15
|
+
readonly WalletService: symbol;
|
|
16
|
+
readonly MoonPayService: symbol;
|
|
17
|
+
readonly ToolCallProcessor: symbol;
|
|
18
|
+
readonly FunctionCallExecutor: symbol;
|
|
19
|
+
readonly ExecutorRegistry: symbol;
|
|
20
|
+
readonly APIExecutor: symbol;
|
|
21
|
+
readonly ContractExecutor: symbol;
|
|
22
|
+
readonly FiatExecutor: symbol;
|
|
23
|
+
readonly AP2Executor: symbol;
|
|
24
|
+
readonly RendererRegistry: symbol;
|
|
25
|
+
readonly APIRenderer: symbol;
|
|
26
|
+
readonly ContractRenderer: symbol;
|
|
27
|
+
readonly FiatRenderer: symbol;
|
|
28
|
+
readonly AP2Renderer: symbol;
|
|
29
|
+
readonly SDKConfig: symbol;
|
|
30
|
+
readonly DomainHeaders: symbol;
|
|
31
|
+
readonly Authorization: symbol;
|
|
32
|
+
readonly APIBaseUrl: symbol;
|
|
33
|
+
readonly ProxyMode: symbol;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Type-safe token accessor
|
|
37
|
+
*/
|
|
38
|
+
export type TokenType = typeof TOKENS;
|
|
39
|
+
export type TokenKey = keyof TokenType;
|
|
40
|
+
/**
|
|
41
|
+
* Helper to get token by key
|
|
42
|
+
*/
|
|
43
|
+
export declare function getToken(key: TokenKey): symbol;
|
|
44
|
+
//# sourceMappingURL=tokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/core/tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;CAmCT,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,MAAM,CAAC;AACtC,MAAM,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC;AAEvC;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,QAAQ,GAAG,MAAM,CAE9C"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core Type Definitions for DI System
|
|
3
|
+
*
|
|
4
|
+
* This file contains shared type definitions used across the DI infrastructure.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* SDK Configuration passed during initialization
|
|
8
|
+
*/
|
|
9
|
+
export interface SDKConfig {
|
|
10
|
+
projectId: string;
|
|
11
|
+
aiConfigId?: string;
|
|
12
|
+
authorization?: string;
|
|
13
|
+
apiBaseUrl?: string;
|
|
14
|
+
domainHeaders?: DomainHeaderConfig[];
|
|
15
|
+
restExecuteHeaders?: Record<string, string>;
|
|
16
|
+
proxyMode?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Domain-specific header configuration
|
|
20
|
+
*/
|
|
21
|
+
export interface DomainHeaderConfig {
|
|
22
|
+
domain: string;
|
|
23
|
+
headers: Record<string, string>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* API Request object for beforeCallApiFunc hook
|
|
27
|
+
*/
|
|
28
|
+
export interface ApiRequest {
|
|
29
|
+
method: string;
|
|
30
|
+
url: string;
|
|
31
|
+
headers: Record<string, string>;
|
|
32
|
+
params?: Record<string, any>;
|
|
33
|
+
data?: any;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Hook function called before API executor makes a request
|
|
37
|
+
*/
|
|
38
|
+
export type BeforeCallApiFunc = (request: ApiRequest) => Promise<ApiRequest>;
|
|
39
|
+
/**
|
|
40
|
+
* Execution context passed to executors
|
|
41
|
+
*/
|
|
42
|
+
export interface ExecutionContext {
|
|
43
|
+
projectId: string;
|
|
44
|
+
authorization?: string;
|
|
45
|
+
domainHeaders?: DomainHeaderConfig[];
|
|
46
|
+
restExecuteHeaders?: Record<string, string>;
|
|
47
|
+
onProgress?: (progress: ExecutionProgress) => void;
|
|
48
|
+
onError?: (error: ExecutionError) => void;
|
|
49
|
+
/**
|
|
50
|
+
* Optional hook called before API executor makes a request.
|
|
51
|
+
* Allows modification of the request object before it's sent.
|
|
52
|
+
*/
|
|
53
|
+
beforeCallApiFunc?: BeforeCallApiFunc;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Execution progress callback data
|
|
57
|
+
*/
|
|
58
|
+
export interface ExecutionProgress {
|
|
59
|
+
stage: 'preparing' | 'executing' | 'processing' | 'completed';
|
|
60
|
+
message?: string;
|
|
61
|
+
percentage?: number;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Execution error callback data
|
|
65
|
+
*/
|
|
66
|
+
export interface ExecutionError {
|
|
67
|
+
code: string;
|
|
68
|
+
message: string;
|
|
69
|
+
details?: any;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Render context passed to renderers
|
|
73
|
+
*/
|
|
74
|
+
export interface RenderContext {
|
|
75
|
+
projectId: string;
|
|
76
|
+
authorization?: string;
|
|
77
|
+
domainHeaders?: DomainHeaderConfig[];
|
|
78
|
+
onExecute?: (functionCall: any) => Promise<void>;
|
|
79
|
+
onExecutionComplete?: (result: any) => void;
|
|
80
|
+
onError?: (error: Error) => void;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Plugin lifecycle interface
|
|
84
|
+
*/
|
|
85
|
+
export interface Plugin {
|
|
86
|
+
name: string;
|
|
87
|
+
version: string;
|
|
88
|
+
onLoad?: (container: any) => Promise<void>;
|
|
89
|
+
onUnload?: () => Promise<void>;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Service lifecycle interface
|
|
93
|
+
*/
|
|
94
|
+
export interface IDisposable {
|
|
95
|
+
dispose(): Promise<void> | void;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Service initialization interface
|
|
99
|
+
*/
|
|
100
|
+
export interface IInitializable {
|
|
101
|
+
initialize(): Promise<void> | void;
|
|
102
|
+
isInitialized(): boolean;
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,kBAAkB,EAAE,CAAC;IACrC,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5C,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,EAAE,UAAU,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC;AAE7E;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,kBAAkB,EAAE,CAAC;IACrC,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5C,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,iBAAiB,KAAK,IAAI,CAAC;IACnD,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IAC1C;;;OAGG;IACH,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;CACvC;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,WAAW,GAAG,WAAW,GAAG,YAAY,GAAG,WAAW,CAAC;IAC9D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,GAAG,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,kBAAkB,EAAE,CAAC;IACrC,SAAS,CAAC,EAAE,CAAC,YAAY,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACjD,mBAAmB,CAAC,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,CAAC;IAC5C,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,WAAW,MAAM;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;IACnC,aAAa,IAAI,OAAO,CAAC;CAC1B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BaseExecutor } from './base/BaseExecutor';
|
|
2
|
+
import { FunctionCall, ExecutionResult } from '../types';
|
|
3
|
+
import { ExecutionContext } from '../core/types';
|
|
4
|
+
import { IAPIClient } from '../interfaces/IAPIClient';
|
|
5
|
+
import { ValidationResult } from '../interfaces/IExecutor';
|
|
6
|
+
|
|
7
|
+
export declare class AP2Executor extends BaseExecutor {
|
|
8
|
+
private apiClient;
|
|
9
|
+
readonly type = "ap2";
|
|
10
|
+
constructor(apiClient: IAPIClient);
|
|
11
|
+
/**
|
|
12
|
+
* Validate AP2-specific requirements
|
|
13
|
+
*/
|
|
14
|
+
protected validateCustom(functionCall: FunctionCall): Partial<ValidationResult>;
|
|
15
|
+
/**
|
|
16
|
+
* Execute AP2 tool call
|
|
17
|
+
*/
|
|
18
|
+
protected executeInternal(functionCall: FunctionCall, context: ExecutionContext): Promise<ExecutionResult>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=AP2Executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AP2Executor.d.ts","sourceRoot":"","sources":["../../src/executors/AP2Executor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,qBACa,WAAY,SAAQ,YAAY;IAGL,OAAO,CAAC,SAAS;IAFvD,QAAQ,CAAC,IAAI,SAAS;gBAEwB,SAAS,EAAE,UAAU;IAInE;;OAEG;IACH,SAAS,CAAC,cAAc,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAU/E;;OAEG;cACa,eAAe,CAC7B,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,CAAC;CA+C5B"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { BaseExecutor } from './base/BaseExecutor';
|
|
2
|
+
import { FunctionCall, ExecutionResult, DomainHeaderConfig } from '../types';
|
|
3
|
+
import { ExecutionContext } from '../core/types';
|
|
4
|
+
import { IWalletService } from '../services/walletService';
|
|
5
|
+
import { ValidationResult } from '../interfaces/IExecutor';
|
|
6
|
+
|
|
7
|
+
export declare class APIExecutor extends BaseExecutor {
|
|
8
|
+
private walletService;
|
|
9
|
+
private domainHeaders;
|
|
10
|
+
private proxyMode;
|
|
11
|
+
private apiBaseUrl?;
|
|
12
|
+
readonly type = "api";
|
|
13
|
+
constructor(walletService: IWalletService, domainHeaders?: DomainHeaderConfig[], proxyMode?: boolean, apiBaseUrl?: string | undefined);
|
|
14
|
+
/**
|
|
15
|
+
* Validate API-specific requirements
|
|
16
|
+
*/
|
|
17
|
+
protected validateCustom(functionCall: FunctionCall): Partial<ValidationResult>;
|
|
18
|
+
/**
|
|
19
|
+
* Execute REST API call
|
|
20
|
+
*/
|
|
21
|
+
protected executeInternal(functionCall: FunctionCall, context: ExecutionContext): Promise<ExecutionResult>;
|
|
22
|
+
/**
|
|
23
|
+
* Match domain pattern against URL hostname
|
|
24
|
+
*/
|
|
25
|
+
private matchDomain;
|
|
26
|
+
/**
|
|
27
|
+
* Get headers for a specific URL by matching domain patterns
|
|
28
|
+
*/
|
|
29
|
+
private getHeadersForUrl;
|
|
30
|
+
/**
|
|
31
|
+
* Execute a calldata transaction on the blockchain
|
|
32
|
+
*/
|
|
33
|
+
private executeCalldataTransaction;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=APIExecutor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"APIExecutor.d.ts","sourceRoot":"","sources":["../../src/executors/APIExecutor.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,kBAAkB,EAAc,MAAM,UAAU,CAAC;AACzF,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAG3D,qBACa,WAAY,SAAQ,YAAY;IAIX,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,aAAa;IACzB,OAAO,CAAC,SAAS;IAChB,OAAO,CAAC,UAAU,CAAC;IANhD,QAAQ,CAAC,IAAI,SAAS;gBAGkB,aAAa,EAAE,cAAc,EAC7B,aAAa,GAAE,kBAAkB,EAAO,EAC5C,SAAS,GAAE,OAAe,EACzB,UAAU,CAAC,EAAE,MAAM,YAAA;IAMxD;;OAEG;IACH,SAAS,CAAC,cAAc,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAU/E;;OAEG;cACa,eAAe,CAC7B,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,CAAC;IAmJ3B;;OAEG;IACH,OAAO,CAAC,WAAW;IAmBnB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAkBxB;;OAEG;YACW,0BAA0B;CAsCzC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { BaseExecutor } from './base/BaseExecutor';
|
|
2
|
+
import { FunctionCall, ExecutionResult } from '../types';
|
|
3
|
+
import { ExecutionContext } from '../core/types';
|
|
4
|
+
import { IWalletService } from '../services/walletService';
|
|
5
|
+
import { IAPIClient } from '../interfaces/IAPIClient';
|
|
6
|
+
import { IEthersAdapter } from '../interfaces/IEthersAdapter';
|
|
7
|
+
import { ValidationResult } from '../interfaces/IExecutor';
|
|
8
|
+
|
|
9
|
+
export declare class ContractExecutor extends BaseExecutor {
|
|
10
|
+
private walletService;
|
|
11
|
+
private apiClient;
|
|
12
|
+
private ethersAdapter;
|
|
13
|
+
readonly type = "contract";
|
|
14
|
+
private contractABICache;
|
|
15
|
+
constructor(walletService: IWalletService, apiClient: IAPIClient, ethersAdapter: IEthersAdapter);
|
|
16
|
+
/**
|
|
17
|
+
* Validate contract-specific requirements
|
|
18
|
+
*/
|
|
19
|
+
protected validateCustom(functionCall: FunctionCall): Partial<ValidationResult>;
|
|
20
|
+
/**
|
|
21
|
+
* Execute smart contract call
|
|
22
|
+
*/
|
|
23
|
+
protected executeInternal(functionCall: FunctionCall, context: ExecutionContext): Promise<ExecutionResult>;
|
|
24
|
+
/**
|
|
25
|
+
* Fetch ABI for a contract method from the backend
|
|
26
|
+
*/
|
|
27
|
+
private getContractABI;
|
|
28
|
+
/**
|
|
29
|
+
* Execute Web3 transaction (read or write)
|
|
30
|
+
*/
|
|
31
|
+
private executeWeb3Transaction;
|
|
32
|
+
/**
|
|
33
|
+
* Convert parameters object to ordered array based on ABI
|
|
34
|
+
*/
|
|
35
|
+
private convertParametersToArray;
|
|
36
|
+
/**
|
|
37
|
+
* Attempt to determine the correct ABI function name to use for encoding.
|
|
38
|
+
*/
|
|
39
|
+
private extractFunctionNameFromABI;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=ContractExecutor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContractExecutor.d.ts","sourceRoot":"","sources":["../../src/executors/ContractExecutor.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,qBACa,gBAAiB,SAAQ,YAAY;IAOhB,OAAO,CAAC,aAAa;IACzB,OAAO,CAAC,SAAS;IACb,OAAO,CAAC,aAAa;IARrD,QAAQ,CAAC,IAAI,cAAc;IAG3B,OAAO,CAAC,gBAAgB,CAAgE;gBAGhD,aAAa,EAAE,cAAc,EACjC,SAAS,EAAE,UAAU,EACjB,aAAa,EAAE,cAAc;IAKrE;;OAEG;IACH,SAAS,CAAC,cAAc,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAmB/E;;OAEG;cACa,eAAe,CAC7B,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,CAAC;IAwH3B;;OAEG;YACW,cAAc;IAwE5B;;OAEG;YACW,sBAAsB;IA2DpC;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAmBhC;;OAEG;IACH,OAAO,CAAC,0BAA0B;CAkBnC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { IExecutor } from '../interfaces/IExecutor';
|
|
2
|
+
import { FunctionCall, ExecutionResult } from '../types';
|
|
3
|
+
import { ExecutionContext } from '../core/types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Executor registry manages all registered executors
|
|
7
|
+
* and routes function calls to the appropriate executor
|
|
8
|
+
*/
|
|
9
|
+
export declare class ExecutorRegistry {
|
|
10
|
+
private executorMap;
|
|
11
|
+
constructor(apiExecutor: IExecutor, contractExecutor: IExecutor, fiatExecutor: IExecutor, ap2Executor: IExecutor);
|
|
12
|
+
/**
|
|
13
|
+
* Register an executor
|
|
14
|
+
*
|
|
15
|
+
* @param executor - Executor instance to register
|
|
16
|
+
*/
|
|
17
|
+
register(executor: IExecutor): void;
|
|
18
|
+
/**
|
|
19
|
+
* Unregister an executor
|
|
20
|
+
*
|
|
21
|
+
* @param type - Executor type to unregister
|
|
22
|
+
*/
|
|
23
|
+
unregister(type: string): boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Get an executor by type
|
|
26
|
+
*
|
|
27
|
+
* @param type - Executor type
|
|
28
|
+
* @returns Executor instance or undefined
|
|
29
|
+
*/
|
|
30
|
+
getExecutor(type: string): IExecutor | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Check if an executor is registered
|
|
33
|
+
*
|
|
34
|
+
* @param type - Executor type
|
|
35
|
+
* @returns True if executor is registered
|
|
36
|
+
*/
|
|
37
|
+
hasExecutor(type: string): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Get all registered executors
|
|
40
|
+
*
|
|
41
|
+
* @returns Array of all executor instances
|
|
42
|
+
*/
|
|
43
|
+
getAllExecutors(): IExecutor[];
|
|
44
|
+
/**
|
|
45
|
+
* Get all registered executor types
|
|
46
|
+
*
|
|
47
|
+
* @returns Array of executor type strings
|
|
48
|
+
*/
|
|
49
|
+
getExecutorTypes(): string[];
|
|
50
|
+
/**
|
|
51
|
+
* Find the appropriate executor for a function call
|
|
52
|
+
*
|
|
53
|
+
* Uses the executor's canHandle method to determine if it can execute the call.
|
|
54
|
+
* Falls back to type-based matching if no executor claims to handle it.
|
|
55
|
+
*
|
|
56
|
+
* @param functionCall - Function call to find executor for
|
|
57
|
+
* @returns Executor instance or undefined
|
|
58
|
+
*/
|
|
59
|
+
findExecutor(functionCall: FunctionCall): IExecutor | undefined;
|
|
60
|
+
/**
|
|
61
|
+
* Execute a function call
|
|
62
|
+
*
|
|
63
|
+
* Automatically finds the appropriate executor and executes the call.
|
|
64
|
+
*
|
|
65
|
+
* @param functionCall - Function call to execute
|
|
66
|
+
* @param context - Execution context
|
|
67
|
+
* @returns Execution result
|
|
68
|
+
*/
|
|
69
|
+
execute(functionCall: FunctionCall, context: ExecutionContext): Promise<ExecutionResult>;
|
|
70
|
+
/**
|
|
71
|
+
* Validate a function call
|
|
72
|
+
*
|
|
73
|
+
* Finds the appropriate executor and validates the call.
|
|
74
|
+
*
|
|
75
|
+
* @param functionCall - Function call to validate
|
|
76
|
+
* @returns Validation result
|
|
77
|
+
*/
|
|
78
|
+
validate(functionCall: FunctionCall): {
|
|
79
|
+
isValid: boolean;
|
|
80
|
+
errors?: string[];
|
|
81
|
+
warnings?: string[];
|
|
82
|
+
executorType?: string;
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Batch execute multiple function calls
|
|
86
|
+
*
|
|
87
|
+
* Executes multiple function calls in parallel.
|
|
88
|
+
*
|
|
89
|
+
* @param functionCalls - Array of function calls to execute
|
|
90
|
+
* @param context - Execution context
|
|
91
|
+
* @returns Array of execution results in the same order
|
|
92
|
+
*/
|
|
93
|
+
executeMany(functionCalls: FunctionCall[], context: ExecutionContext): Promise<ExecutionResult[]>;
|
|
94
|
+
/**
|
|
95
|
+
* Log helper
|
|
96
|
+
*/
|
|
97
|
+
private log;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=ExecutorRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ExecutorRegistry.d.ts","sourceRoot":"","sources":["../../src/executors/ExecutorRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGjD;;;GAGG;AACH,qBACa,gBAAgB;IAE3B,OAAO,CAAC,WAAW,CAAqC;gBAI1B,WAAW,EAAE,SAAS,EACjB,gBAAgB,EAAE,SAAS,EAC/B,YAAY,EAAE,SAAS,EACxB,WAAW,EAAE,SAAS;IAWpD;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,SAAS,GAAG,IAAI;IAWnC;;;;OAIG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAQjC;;;;;OAKG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS;IAIhD;;;;;OAKG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIlC;;;;OAIG;IACH,eAAe,IAAI,SAAS,EAAE;IAI9B;;;;OAIG;IACH,gBAAgB,IAAI,MAAM,EAAE;IAI5B;;;;;;;;OAQG;IACH,YAAY,CAAC,YAAY,EAAE,YAAY,GAAG,SAAS,GAAG,SAAS;IAoB/D;;;;;;;;OAQG;IACG,OAAO,CACX,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,CAAC;IAiD3B;;;;;;;OAOG;IACH,QAAQ,CAAC,YAAY,EAAE,YAAY,GAAG;QACpC,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;QAClB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;QACpB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB;IAoBD;;;;;;;;OAQG;IACG,WAAW,CACf,aAAa,EAAE,YAAY,EAAE,EAC7B,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,EAAE,CAAC;IAM7B;;OAEG;IACH,OAAO,CAAC,GAAG;CAQZ"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { BaseExecutor } from './base/BaseExecutor';
|
|
2
|
+
import { FunctionCall, ExecutionResult } from '../types';
|
|
3
|
+
import { ExecutionContext } from '../core/types';
|
|
4
|
+
|
|
5
|
+
export interface IMoonPayService {
|
|
6
|
+
createBuyTransaction(params: any): Promise<any>;
|
|
7
|
+
createSellTransaction(params: any): Promise<any>;
|
|
8
|
+
}
|
|
9
|
+
export declare class FiatExecutor extends BaseExecutor {
|
|
10
|
+
private moonPayService;
|
|
11
|
+
readonly type = "fiat";
|
|
12
|
+
private readonly MOONPAY_LIMITS;
|
|
13
|
+
constructor(moonPayService: IMoonPayService);
|
|
14
|
+
/**
|
|
15
|
+
* Execute fiat operation
|
|
16
|
+
*/
|
|
17
|
+
protected executeInternal(functionCall: FunctionCall, context: ExecutionContext): Promise<ExecutionResult>;
|
|
18
|
+
/**
|
|
19
|
+
* Execute MoonPay buy operation
|
|
20
|
+
*/
|
|
21
|
+
private executeMoonPayBuy;
|
|
22
|
+
/**
|
|
23
|
+
* Execute MoonPay sell operation
|
|
24
|
+
*/
|
|
25
|
+
private executeMoonPaySell;
|
|
26
|
+
/**
|
|
27
|
+
* Get MoonPay currencies
|
|
28
|
+
*/
|
|
29
|
+
private getMoonPayCurrencies;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=FiatExecutor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FiatExecutor.d.ts","sourceRoot":"","sources":["../../src/executors/FiatExecutor.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAKjD,MAAM,WAAW,eAAe;IAC9B,oBAAoB,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;IAChD,qBAAqB,CAAC,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;CAClD;AAED,qBACa,YAAa,SAAQ,YAAY;IAOX,OAAO,CAAC,cAAc;IANvD,QAAQ,CAAC,IAAI,UAAU;IAGvB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAA2B;gBAGjB,cAAc,EAAE,eAAe;IAKxE;;OAEG;cACa,eAAe,CAC7B,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,eAAe,CAAC;IAuB3B;;OAEG;YACW,iBAAiB;IAgE/B;;OAEG;YACW,kBAAkB;IAsDhC;;OAEG;YACW,oBAAoB;CA+CnC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { IExecutorWithLifecycle, ValidationResult } from '../../interfaces/IExecutor';
|
|
2
|
+
import { FunctionCall, ExecutionResult } from '../../types';
|
|
3
|
+
import { ExecutionContext, ExecutionProgress } from '../../core/types';
|
|
4
|
+
|
|
5
|
+
export declare abstract class BaseExecutor implements IExecutorWithLifecycle {
|
|
6
|
+
/**
|
|
7
|
+
* Type identifier for this executor
|
|
8
|
+
* Must be overridden by subclasses
|
|
9
|
+
*/
|
|
10
|
+
abstract readonly type: string;
|
|
11
|
+
/**
|
|
12
|
+
* Human-readable name for logging
|
|
13
|
+
*/
|
|
14
|
+
protected get name(): string;
|
|
15
|
+
/**
|
|
16
|
+
* Check if this executor can handle the given function call
|
|
17
|
+
* Default implementation checks if function type matches executor type
|
|
18
|
+
*/
|
|
19
|
+
canHandle(functionCall: FunctionCall): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Validate function call before execution
|
|
22
|
+
* Can be overridden by subclasses for custom validation
|
|
23
|
+
*/
|
|
24
|
+
validate(functionCall: FunctionCall): ValidationResult;
|
|
25
|
+
/**
|
|
26
|
+
* Custom validation logic for subclasses
|
|
27
|
+
* Override this to add type-specific validation
|
|
28
|
+
*/
|
|
29
|
+
protected validateCustom(functionCall: FunctionCall): Partial<ValidationResult>;
|
|
30
|
+
/**
|
|
31
|
+
* Execute the function call
|
|
32
|
+
* This is the main entry point that orchestrates the execution lifecycle
|
|
33
|
+
*/
|
|
34
|
+
execute(functionCall: FunctionCall, context: ExecutionContext): Promise<ExecutionResult>;
|
|
35
|
+
/**
|
|
36
|
+
* Internal execution logic - must be implemented by subclasses
|
|
37
|
+
* This is where the actual work happens
|
|
38
|
+
*/
|
|
39
|
+
protected abstract executeInternal(functionCall: FunctionCall, context: ExecutionContext): Promise<ExecutionResult>;
|
|
40
|
+
/**
|
|
41
|
+
* Lifecycle hook: called when executor is initialized
|
|
42
|
+
*/
|
|
43
|
+
onInit?(): Promise<void>;
|
|
44
|
+
/**
|
|
45
|
+
* Lifecycle hook: called before execution starts
|
|
46
|
+
*/
|
|
47
|
+
onBeforeExecute?(functionCall: FunctionCall, context: ExecutionContext): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Lifecycle hook: called to prepare execution
|
|
50
|
+
* Useful for fetching metadata, checking permissions, etc.
|
|
51
|
+
*/
|
|
52
|
+
protected onPrepare?(functionCall: FunctionCall, context: ExecutionContext): Promise<void>;
|
|
53
|
+
/**
|
|
54
|
+
* Lifecycle hook: called to post-process result
|
|
55
|
+
* Useful for transforming data, adding metadata, etc.
|
|
56
|
+
*/
|
|
57
|
+
protected onPostProcess?(result: ExecutionResult, functionCall: FunctionCall, context: ExecutionContext): Promise<ExecutionResult>;
|
|
58
|
+
/**
|
|
59
|
+
* Lifecycle hook: called after execution completes (success or failure)
|
|
60
|
+
*/
|
|
61
|
+
onAfterExecute?(functionCall: FunctionCall, result: ExecutionResult, context: ExecutionContext): Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* Lifecycle hook: called when executor is disposed
|
|
64
|
+
*/
|
|
65
|
+
onDispose?(): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Helper: Create a success result
|
|
68
|
+
*/
|
|
69
|
+
protected createSuccessResult(data: any, metadata?: Record<string, any>): ExecutionResult;
|
|
70
|
+
/**
|
|
71
|
+
* Helper: Create an error result
|
|
72
|
+
*/
|
|
73
|
+
protected createErrorResult(error: string, functionCall?: FunctionCall, metadata?: Record<string, any>): ExecutionResult;
|
|
74
|
+
/**
|
|
75
|
+
* Helper: Report execution progress
|
|
76
|
+
*/
|
|
77
|
+
protected reportProgress(context: ExecutionContext, progress: ExecutionProgress): void;
|
|
78
|
+
/**
|
|
79
|
+
* Helper: Log messages with consistent formatting
|
|
80
|
+
*/
|
|
81
|
+
protected log(level: 'info' | 'warn' | 'error', message: string, data?: any): void;
|
|
82
|
+
/**
|
|
83
|
+
* Helper: Sleep utility for testing/delays
|
|
84
|
+
*/
|
|
85
|
+
protected sleep(ms: number): Promise<void>;
|
|
86
|
+
}
|
|
87
|
+
//# sourceMappingURL=BaseExecutor.d.ts.map
|