@waiaas/core 2.0.0-rc.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/dist/enums/audit.d.ts +5 -0
- package/dist/enums/audit.d.ts.map +1 -0
- package/dist/enums/audit.js +31 -0
- package/dist/enums/audit.js.map +1 -0
- package/dist/enums/chain.d.ts +50 -0
- package/dist/enums/chain.d.ts.map +1 -0
- package/dist/enums/chain.js +123 -0
- package/dist/enums/chain.js.map +1 -0
- package/dist/enums/index.d.ts +10 -0
- package/dist/enums/index.d.ts.map +1 -0
- package/dist/enums/index.js +10 -0
- package/dist/enums/index.js.map +1 -0
- package/dist/enums/notification.d.ts +8 -0
- package/dist/enums/notification.d.ts.map +1 -0
- package/dist/enums/notification.js +34 -0
- package/dist/enums/notification.js.map +1 -0
- package/dist/enums/owner.d.ts +5 -0
- package/dist/enums/owner.d.ts.map +1 -0
- package/dist/enums/owner.js +5 -0
- package/dist/enums/owner.js.map +1 -0
- package/dist/enums/policy.d.ts +8 -0
- package/dist/enums/policy.d.ts.map +1 -0
- package/dist/enums/policy.js +19 -0
- package/dist/enums/policy.js.map +1 -0
- package/dist/enums/session.d.ts +5 -0
- package/dist/enums/session.d.ts.map +1 -0
- package/dist/enums/session.js +5 -0
- package/dist/enums/session.js.map +1 -0
- package/dist/enums/system.d.ts +5 -0
- package/dist/enums/system.d.ts.map +1 -0
- package/dist/enums/system.js +4 -0
- package/dist/enums/system.js.map +1 -0
- package/dist/enums/transaction.d.ts +8 -0
- package/dist/enums/transaction.d.ts.map +1 -0
- package/dist/enums/transaction.js +25 -0
- package/dist/enums/transaction.js.map +1 -0
- package/dist/enums/wallet.d.ts +5 -0
- package/dist/enums/wallet.d.ts.map +1 -0
- package/dist/enums/wallet.js +10 -0
- package/dist/enums/wallet.js.map +1 -0
- package/dist/errors/base-error.d.ts +25 -0
- package/dist/errors/base-error.d.ts.map +1 -0
- package/dist/errors/base-error.js +33 -0
- package/dist/errors/base-error.js.map +1 -0
- package/dist/errors/chain-error.d.ts +48 -0
- package/dist/errors/chain-error.d.ts.map +1 -0
- package/dist/errors/chain-error.js +83 -0
- package/dist/errors/chain-error.js.map +1 -0
- package/dist/errors/error-codes.d.ts +667 -0
- package/dist/errors/error-codes.d.ts.map +1 -0
- package/dist/errors/error-codes.js +671 -0
- package/dist/errors/error-codes.js.map +1 -0
- package/dist/errors/index.d.ts +4 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +4 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/events/event-bus.d.ts +36 -0
- package/dist/events/event-bus.d.ts.map +1 -0
- package/dist/events/event-bus.js +74 -0
- package/dist/events/event-bus.js.map +1 -0
- package/dist/events/event-types.d.ts +59 -0
- package/dist/events/event-types.d.ts.map +1 -0
- package/dist/events/event-types.js +16 -0
- package/dist/events/event-types.js.map +1 -0
- package/dist/events/index.d.ts +3 -0
- package/dist/events/index.d.ts.map +1 -0
- package/dist/events/index.js +3 -0
- package/dist/events/index.js.map +1 -0
- package/dist/i18n/en.d.ts +57 -0
- package/dist/i18n/en.d.ts.map +1 -0
- package/dist/i18n/en.js +194 -0
- package/dist/i18n/en.js.map +1 -0
- package/dist/i18n/index.d.ts +5 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +7 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/ko.d.ts +3 -0
- package/dist/i18n/ko.d.ts.map +1 -0
- package/dist/i18n/ko.js +194 -0
- package/dist/i18n/ko.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/interfaces/IChainAdapter.d.ts +61 -0
- package/dist/interfaces/IChainAdapter.d.ts.map +1 -0
- package/dist/interfaces/IChainAdapter.js +2 -0
- package/dist/interfaces/IChainAdapter.js.map +1 -0
- package/dist/interfaces/ILocalKeyStore.d.ts +24 -0
- package/dist/interfaces/ILocalKeyStore.d.ts.map +1 -0
- package/dist/interfaces/ILocalKeyStore.js +2 -0
- package/dist/interfaces/ILocalKeyStore.js.map +1 -0
- package/dist/interfaces/INotificationChannel.d.ts +32 -0
- package/dist/interfaces/INotificationChannel.d.ts.map +1 -0
- package/dist/interfaces/INotificationChannel.js +2 -0
- package/dist/interfaces/INotificationChannel.js.map +1 -0
- package/dist/interfaces/IPolicyEngine.d.ts +44 -0
- package/dist/interfaces/IPolicyEngine.d.ts.map +1 -0
- package/dist/interfaces/IPolicyEngine.js +2 -0
- package/dist/interfaces/IPolicyEngine.js.map +1 -0
- package/dist/interfaces/action-provider.types.d.ts +123 -0
- package/dist/interfaces/action-provider.types.d.ts.map +1 -0
- package/dist/interfaces/action-provider.types.js +65 -0
- package/dist/interfaces/action-provider.types.js.map +1 -0
- package/dist/interfaces/chain-adapter.types.d.ts +216 -0
- package/dist/interfaces/chain-adapter.types.d.ts.map +1 -0
- package/dist/interfaces/chain-adapter.types.js +2 -0
- package/dist/interfaces/chain-adapter.types.js.map +1 -0
- package/dist/interfaces/forex-rate.types.d.ts +63 -0
- package/dist/interfaces/forex-rate.types.d.ts.map +1 -0
- package/dist/interfaces/forex-rate.types.js +41 -0
- package/dist/interfaces/forex-rate.types.js.map +1 -0
- package/dist/interfaces/index.d.ts +15 -0
- package/dist/interfaces/index.d.ts.map +1 -0
- package/dist/interfaces/index.js +5 -0
- package/dist/interfaces/index.js.map +1 -0
- package/dist/interfaces/price-oracle.types.d.ts +99 -0
- package/dist/interfaces/price-oracle.types.d.ts.map +1 -0
- package/dist/interfaces/price-oracle.types.js +48 -0
- package/dist/interfaces/price-oracle.types.js.map +1 -0
- package/dist/interfaces/x402.types.d.ts +112 -0
- package/dist/interfaces/x402.types.d.ts.map +1 -0
- package/dist/interfaces/x402.types.js +69 -0
- package/dist/interfaces/x402.types.js.map +1 -0
- package/dist/schemas/asset.schema.d.ts +32 -0
- package/dist/schemas/asset.schema.d.ts.map +1 -0
- package/dist/schemas/asset.schema.js +15 -0
- package/dist/schemas/asset.schema.js.map +1 -0
- package/dist/schemas/config.schema.d.ts +58 -0
- package/dist/schemas/config.schema.d.ts.map +1 -0
- package/dist/schemas/config.schema.js +23 -0
- package/dist/schemas/config.schema.js.map +1 -0
- package/dist/schemas/index.d.ts +7 -0
- package/dist/schemas/index.d.ts.map +1 -0
- package/dist/schemas/index.js +9 -0
- package/dist/schemas/index.js.map +1 -0
- package/dist/schemas/policy.schema.d.ts +192 -0
- package/dist/schemas/policy.schema.d.ts.map +1 -0
- package/dist/schemas/policy.schema.js +157 -0
- package/dist/schemas/policy.schema.js.map +1 -0
- package/dist/schemas/session.schema.d.ts +51 -0
- package/dist/schemas/session.schema.d.ts.map +1 -0
- package/dist/schemas/session.schema.js +19 -0
- package/dist/schemas/session.schema.js.map +1 -0
- package/dist/schemas/transaction.schema.d.ts +834 -0
- package/dist/schemas/transaction.schema.d.ts.map +1 -0
- package/dist/schemas/transaction.schema.js +112 -0
- package/dist/schemas/transaction.schema.js.map +1 -0
- package/dist/schemas/wallet.schema.d.ts +54 -0
- package/dist/schemas/wallet.schema.d.ts.map +1 -0
- package/dist/schemas/wallet.schema.js +21 -0
- package/dist/schemas/wallet.schema.js.map +1 -0
- package/dist/testing/chain-adapter-contract.d.ts +42 -0
- package/dist/testing/chain-adapter-contract.d.ts.map +1 -0
- package/dist/testing/chain-adapter-contract.js +370 -0
- package/dist/testing/chain-adapter-contract.js.map +1 -0
- package/dist/testing/index.d.ts +8 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +7 -0
- package/dist/testing/index.js.map +1 -0
- package/dist/utils/format-amount.d.ts +41 -0
- package/dist/utils/format-amount.d.ts.map +1 -0
- package/dist/utils/format-amount.js +60 -0
- package/dist/utils/format-amount.js.map +1 -0
- package/dist/utils/format-currency.d.ts +42 -0
- package/dist/utils/format-currency.d.ts.map +1 -0
- package/dist/utils/format-currency.js +92 -0
- package/dist/utils/format-currency.js.map +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +5 -0
- package/dist/utils/index.js.map +1 -0
- package/package.json +50 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Action Provider types and interfaces (Zod SSoT).
|
|
3
|
+
*
|
|
4
|
+
* Defines ActionProviderMetadata, ActionDefinition, ActionContext,
|
|
5
|
+
* and IActionProvider for the v1.5 Action Provider framework.
|
|
6
|
+
* Actual provider implementations (ESM plugins) live in the daemon package
|
|
7
|
+
* or in ~/.waiaas/actions/ user plugin directory.
|
|
8
|
+
*
|
|
9
|
+
* Design source: doc 62 (action-provider-architecture).
|
|
10
|
+
*/
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
import { ChainTypeEnum } from '../enums/chain.js';
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
// Zod SSoT: ActionProviderMetadata
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
/** Metadata describing an Action Provider (name, version, chains, flags). */
|
|
17
|
+
export const ActionProviderMetadataSchema = z.object({
|
|
18
|
+
/** Provider name: lowercase alphanumeric + underscore, 3-50 chars. */
|
|
19
|
+
name: z.string().regex(/^[a-z][a-z0-9_]*$/).min(3).max(50),
|
|
20
|
+
/** Human-readable description, 10-500 chars. */
|
|
21
|
+
description: z.string().min(10).max(500),
|
|
22
|
+
/** SemVer version string. */
|
|
23
|
+
version: z.string().regex(/^\d+\.\d+\.\d+$/),
|
|
24
|
+
/** Supported chains (at least 1). */
|
|
25
|
+
chains: z.array(ChainTypeEnum).min(1),
|
|
26
|
+
/** Whether to expose actions as MCP tools. Defaults to false. */
|
|
27
|
+
mcpExpose: z.boolean().default(false),
|
|
28
|
+
/** Whether this provider requires an API key. Defaults to false. */
|
|
29
|
+
requiresApiKey: z.boolean().default(false),
|
|
30
|
+
/** List of required external API identifiers. Defaults to []. */
|
|
31
|
+
requiredApis: z.array(z.string()).optional().default([]),
|
|
32
|
+
});
|
|
33
|
+
// ---------------------------------------------------------------------------
|
|
34
|
+
// Zod SSoT: ActionDefinition
|
|
35
|
+
// ---------------------------------------------------------------------------
|
|
36
|
+
/** Definition of a single action within a provider. */
|
|
37
|
+
export const ActionDefinitionSchema = z.object({
|
|
38
|
+
/** Action name: lowercase alphanumeric + underscore, 3-50 chars. */
|
|
39
|
+
name: z.string().regex(/^[a-z][a-z0-9_]*$/).min(3).max(50),
|
|
40
|
+
/** Human-readable description, 20-1000 chars. */
|
|
41
|
+
description: z.string().min(20).max(1000),
|
|
42
|
+
/** Target chain for this action. */
|
|
43
|
+
chain: ChainTypeEnum,
|
|
44
|
+
/** Zod schema for input validation (duck-typed at registration). */
|
|
45
|
+
inputSchema: z.any(),
|
|
46
|
+
/** Risk level classification. */
|
|
47
|
+
riskLevel: z.enum(['low', 'medium', 'high']),
|
|
48
|
+
/** Default policy tier for this action. */
|
|
49
|
+
defaultTier: z.enum(['INSTANT', 'NOTIFY', 'DELAY', 'APPROVAL']),
|
|
50
|
+
});
|
|
51
|
+
// ---------------------------------------------------------------------------
|
|
52
|
+
// Zod SSoT: ActionContext
|
|
53
|
+
// ---------------------------------------------------------------------------
|
|
54
|
+
/** Context passed to resolve() containing wallet and session info. */
|
|
55
|
+
export const ActionContextSchema = z.object({
|
|
56
|
+
/** Wallet address (public key). */
|
|
57
|
+
walletAddress: z.string().min(1),
|
|
58
|
+
/** Target chain. */
|
|
59
|
+
chain: ChainTypeEnum,
|
|
60
|
+
/** Wallet UUID. */
|
|
61
|
+
walletId: z.string(),
|
|
62
|
+
/** Session UUID (optional for admin-initiated actions). */
|
|
63
|
+
sessionId: z.string().optional(),
|
|
64
|
+
});
|
|
65
|
+
//# sourceMappingURL=action-provider.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"action-provider.types.js","sourceRoot":"","sources":["../../src/interfaces/action-provider.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,CA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,CAAC,GAAG,CAAC,EAAE,CAAC;IAC1D,iDAAiD;IACjD,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC;IACzC,oCAAoC;IACpC,KAAK,EAAE,aAAa;IACpB,oEAAoE;IACpE,WAAW,EAAE,CAAC,CAAC,GAAG,EAAE;IACpB,iCAAiC;IACjC,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC5C,2CAA2C;IAC3C,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;CAChE,CAAC,CAAC;AAKH,8EAA8E;AAC9E,0BAA0B;AAC1B,8EAA8E;AAE9E,sEAAsE;AACtE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,mCAAmC;IACnC,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAChC,oBAAoB;IACpB,KAAK,EAAE,aAAa;IACpB,mBAAmB;IACnB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE;IACpB,2DAA2D;IAC3D,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACjC,CAAC,CAAC"}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import type { ChainType } from '../enums/chain.js';
|
|
2
|
+
/** Token amount with raw bigint value, decimals, and symbol. */
|
|
3
|
+
export interface TokenAmount {
|
|
4
|
+
/** Raw amount in smallest unit (lamports/wei). */
|
|
5
|
+
raw: bigint;
|
|
6
|
+
/** Decimal places. SOL=9, ETH=18, USDC=6. */
|
|
7
|
+
decimals: number;
|
|
8
|
+
/** Token symbol. 'SOL', 'ETH', 'USDC', etc. */
|
|
9
|
+
symbol: string;
|
|
10
|
+
}
|
|
11
|
+
/** Native token transfer request. Chain-agnostic common parameters. */
|
|
12
|
+
export interface TransferRequest {
|
|
13
|
+
/** Sender address (chain-specific format). */
|
|
14
|
+
from: string;
|
|
15
|
+
/** Recipient address (chain-specific format). */
|
|
16
|
+
to: string;
|
|
17
|
+
/** Transfer amount in smallest unit (lamports/wei). */
|
|
18
|
+
amount: bigint;
|
|
19
|
+
/** Optional memo (max 256 bytes). Solana: Memo Program, EVM: tx data. */
|
|
20
|
+
memo?: string;
|
|
21
|
+
}
|
|
22
|
+
/** Built unsigned transaction. Output of buildTransaction(), input to simulate/sign. */
|
|
23
|
+
export interface UnsignedTransaction {
|
|
24
|
+
/** Target chain. */
|
|
25
|
+
chain: ChainType;
|
|
26
|
+
/** Chain-specific serialized transaction bytes. */
|
|
27
|
+
serialized: Uint8Array;
|
|
28
|
+
/** Estimated fee in smallest unit. */
|
|
29
|
+
estimatedFee: bigint;
|
|
30
|
+
/** Transaction expiry. Solana: blockhash lifetime (~60s). EVM: undefined. */
|
|
31
|
+
expiresAt?: Date;
|
|
32
|
+
/** Chain-specific metadata (e.g. lastValidBlockHeight, nonce). */
|
|
33
|
+
metadata: Record<string, unknown>;
|
|
34
|
+
/** EVM nonce (v0.7). EVM only. */
|
|
35
|
+
nonce?: number;
|
|
36
|
+
}
|
|
37
|
+
/** Transaction simulation result. */
|
|
38
|
+
export interface SimulationResult {
|
|
39
|
+
/** Whether simulation succeeded. */
|
|
40
|
+
success: boolean;
|
|
41
|
+
/** Simulation logs. */
|
|
42
|
+
logs: string[];
|
|
43
|
+
/** Compute units consumed (Solana) or gas used (EVM). */
|
|
44
|
+
unitsConsumed?: bigint;
|
|
45
|
+
/** Error message if simulation failed. */
|
|
46
|
+
error?: string;
|
|
47
|
+
}
|
|
48
|
+
/** Transaction submission result. */
|
|
49
|
+
export interface SubmitResult {
|
|
50
|
+
/** Transaction hash. */
|
|
51
|
+
txHash: string;
|
|
52
|
+
/** Current status. */
|
|
53
|
+
status: 'submitted' | 'confirmed' | 'finalized' | 'failed';
|
|
54
|
+
/** Number of confirmations. */
|
|
55
|
+
confirmations?: number;
|
|
56
|
+
/** Block number of inclusion. */
|
|
57
|
+
blockNumber?: bigint;
|
|
58
|
+
/** Actual fee paid. */
|
|
59
|
+
fee?: bigint;
|
|
60
|
+
}
|
|
61
|
+
/** Balance information for an address. */
|
|
62
|
+
export interface BalanceInfo {
|
|
63
|
+
/** Queried address. */
|
|
64
|
+
address: string;
|
|
65
|
+
/** Balance in smallest unit. */
|
|
66
|
+
balance: bigint;
|
|
67
|
+
/** Decimal places. */
|
|
68
|
+
decimals: number;
|
|
69
|
+
/** Token symbol. */
|
|
70
|
+
symbol: string;
|
|
71
|
+
/** USD value (from price oracle, optional). */
|
|
72
|
+
usdValue?: number;
|
|
73
|
+
}
|
|
74
|
+
/** Asset information for a token held by an address. */
|
|
75
|
+
export interface AssetInfo {
|
|
76
|
+
/** Token mint address. 'native' for SOL/ETH. */
|
|
77
|
+
mint: string;
|
|
78
|
+
/** Token symbol. 'SOL', 'USDC', etc. */
|
|
79
|
+
symbol: string;
|
|
80
|
+
/** Token name. 'Solana', 'USD Coin', etc. Empty string if unknown. */
|
|
81
|
+
name: string;
|
|
82
|
+
/** Balance in smallest unit (lamports/wei). */
|
|
83
|
+
balance: bigint;
|
|
84
|
+
/** Decimal places. */
|
|
85
|
+
decimals: number;
|
|
86
|
+
/** Whether this is the native token. */
|
|
87
|
+
isNative: boolean;
|
|
88
|
+
/** USD value if available (from price oracle). */
|
|
89
|
+
usdValue?: number;
|
|
90
|
+
}
|
|
91
|
+
/** RPC health check result. */
|
|
92
|
+
export interface HealthInfo {
|
|
93
|
+
/** Whether the RPC endpoint is healthy. */
|
|
94
|
+
healthy: boolean;
|
|
95
|
+
/** RPC latency in milliseconds. */
|
|
96
|
+
latencyMs: number;
|
|
97
|
+
/** Current block height. */
|
|
98
|
+
blockHeight?: bigint;
|
|
99
|
+
}
|
|
100
|
+
/** Fee estimation result. */
|
|
101
|
+
export interface FeeEstimate {
|
|
102
|
+
/** Estimated fee in smallest unit (lamports/wei). */
|
|
103
|
+
fee: bigint;
|
|
104
|
+
/** Whether an ATA needs to be created (Solana SPL). */
|
|
105
|
+
needsAtaCreation?: boolean;
|
|
106
|
+
/** ATA creation rent cost (Solana SPL). */
|
|
107
|
+
ataRentCost?: bigint;
|
|
108
|
+
/** Breakdown details. */
|
|
109
|
+
details?: Record<string, unknown>;
|
|
110
|
+
}
|
|
111
|
+
/** Token information. */
|
|
112
|
+
export interface TokenInfo {
|
|
113
|
+
/** Token address (mint for Solana, contract for EVM). */
|
|
114
|
+
address: string;
|
|
115
|
+
/** Token symbol. */
|
|
116
|
+
symbol: string;
|
|
117
|
+
/** Token name. */
|
|
118
|
+
name: string;
|
|
119
|
+
/** Decimal places. */
|
|
120
|
+
decimals: number;
|
|
121
|
+
/** Total supply if available. */
|
|
122
|
+
totalSupply?: bigint;
|
|
123
|
+
/** Token program (Solana: Token or Token-2022). */
|
|
124
|
+
programId?: string;
|
|
125
|
+
}
|
|
126
|
+
/** Sweep result (multi-asset withdrawal). */
|
|
127
|
+
export interface SweepResult {
|
|
128
|
+
/** Total number of assets swept. */
|
|
129
|
+
total: number;
|
|
130
|
+
/** Number of successful sweeps. */
|
|
131
|
+
succeeded: number;
|
|
132
|
+
/** Number of failed sweeps. */
|
|
133
|
+
failed: number;
|
|
134
|
+
/** Individual sweep results. */
|
|
135
|
+
results: Array<{
|
|
136
|
+
mint: string;
|
|
137
|
+
txHash?: string;
|
|
138
|
+
error?: string;
|
|
139
|
+
amount: bigint;
|
|
140
|
+
}>;
|
|
141
|
+
}
|
|
142
|
+
/** Token transfer request for buildTokenTransfer(). */
|
|
143
|
+
export interface TokenTransferParams {
|
|
144
|
+
from: string;
|
|
145
|
+
to: string;
|
|
146
|
+
amount: bigint;
|
|
147
|
+
token: {
|
|
148
|
+
address: string;
|
|
149
|
+
decimals: number;
|
|
150
|
+
symbol: string;
|
|
151
|
+
};
|
|
152
|
+
memo?: string;
|
|
153
|
+
}
|
|
154
|
+
/** Contract call request for buildContractCall(). */
|
|
155
|
+
export interface ContractCallParams {
|
|
156
|
+
from: string;
|
|
157
|
+
to: string;
|
|
158
|
+
calldata?: string;
|
|
159
|
+
abi?: Record<string, unknown>[];
|
|
160
|
+
value?: bigint;
|
|
161
|
+
programId?: string;
|
|
162
|
+
instructionData?: Uint8Array;
|
|
163
|
+
accounts?: Array<{
|
|
164
|
+
pubkey: string;
|
|
165
|
+
isSigner: boolean;
|
|
166
|
+
isWritable: boolean;
|
|
167
|
+
}>;
|
|
168
|
+
}
|
|
169
|
+
/** Approve request for buildApprove(). */
|
|
170
|
+
export interface ApproveParams {
|
|
171
|
+
from: string;
|
|
172
|
+
spender: string;
|
|
173
|
+
token: {
|
|
174
|
+
address: string;
|
|
175
|
+
decimals: number;
|
|
176
|
+
symbol: string;
|
|
177
|
+
};
|
|
178
|
+
amount: bigint;
|
|
179
|
+
}
|
|
180
|
+
/** Batch request for buildBatch(). */
|
|
181
|
+
export interface BatchParams {
|
|
182
|
+
from: string;
|
|
183
|
+
instructions: Array<TransferRequest | TokenTransferParams | ContractCallParams | ApproveParams>;
|
|
184
|
+
}
|
|
185
|
+
/** Operation type identified from an unsigned transaction. */
|
|
186
|
+
export type ParsedOperationType = 'NATIVE_TRANSFER' | 'TOKEN_TRANSFER' | 'CONTRACT_CALL' | 'APPROVE' | 'UNKNOWN';
|
|
187
|
+
/** A single operation extracted from an unsigned transaction. */
|
|
188
|
+
export interface ParsedOperation {
|
|
189
|
+
/** Operation type. */
|
|
190
|
+
type: ParsedOperationType;
|
|
191
|
+
/** Recipient or target address. */
|
|
192
|
+
to?: string;
|
|
193
|
+
/** Transfer/approve amount in smallest unit. */
|
|
194
|
+
amount?: bigint;
|
|
195
|
+
/** Token address (mint for Solana, contract for EVM). */
|
|
196
|
+
token?: string;
|
|
197
|
+
/** Program/contract address (for CONTRACT_CALL). */
|
|
198
|
+
programId?: string;
|
|
199
|
+
/** Method selector or discriminator (hex string). */
|
|
200
|
+
method?: string;
|
|
201
|
+
}
|
|
202
|
+
/** Result of parsing an unsigned external transaction. */
|
|
203
|
+
export interface ParsedTransaction {
|
|
204
|
+
/** List of operations in the transaction. */
|
|
205
|
+
operations: ParsedOperation[];
|
|
206
|
+
/** Original raw transaction string (base64 for Solana, hex for EVM). */
|
|
207
|
+
rawTx: string;
|
|
208
|
+
}
|
|
209
|
+
/** Result of signing an external transaction. */
|
|
210
|
+
export interface SignedTransaction {
|
|
211
|
+
/** Signed transaction (base64 for Solana, hex for EVM). */
|
|
212
|
+
signedTransaction: string;
|
|
213
|
+
/** Transaction hash if computable before submission. */
|
|
214
|
+
txHash?: string;
|
|
215
|
+
}
|
|
216
|
+
//# sourceMappingURL=chain-adapter.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chain-adapter.types.d.ts","sourceRoot":"","sources":["../../src/interfaces/chain-adapter.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,gEAAgE;AAChE,MAAM,WAAW,WAAW;IAC1B,kDAAkD;IAClD,GAAG,EAAE,MAAM,CAAC;IACZ,6CAA6C;IAC7C,QAAQ,EAAE,MAAM,CAAC;IACjB,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,uEAAuE;AACvE,MAAM,WAAW,eAAe;IAC9B,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,EAAE,EAAE,MAAM,CAAC;IACX,uDAAuD;IACvD,MAAM,EAAE,MAAM,CAAC;IACf,yEAAyE;IACzE,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,wFAAwF;AACxF,MAAM,WAAW,mBAAmB;IAClC,oBAAoB;IACpB,KAAK,EAAE,SAAS,CAAC;IACjB,mDAAmD;IACnD,UAAU,EAAE,UAAU,CAAC;IACvB,sCAAsC;IACtC,YAAY,EA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GAAG,kBAAkB,GAAG,aAAa,CAAC,CAAC;CACjG;AAMD,8DAA8D;AAC9D,MAAM,MAAM,mBAAmB,GAC3B,iBAAiB,GACjB,gBAAgB,GAChB,eAAe,GACf,SAAS,GACT,SAAS,CAAC;AAEd,iEAAiE;AACjE,MAAM,WAAW,eAAe;IAC9B,sBAAsB;IACtB,IAAI,EAAE,mBAAmB,CAAC;IAC1B,mCAAmC;IACnC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,gDAAgD;IAChD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,oDAAoD;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qDAAqD;IACrD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,0DAA0D;AAC1D,MAAM,WAAW,iBAAiB;IAChC,6CAA6C;IAC7C,UAAU,EAAE,eAAe,EAAE,CAAC;IAC9B,wEAAwE;IACxE,KAAK,EAAE,MAAM,CAAC;CACf;AAED,iDAAiD;AACjD,MAAM,WAAW,iBAAiB;IAChC,2DAA2D;IAC3D,iBAAiB,EAAE,MAAM,CAAC;IAC1B,wDAAwD;IACxD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chain-adapter.types.js","sourceRoot":"","sources":["../../src/interfaces/chain-adapter.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Forex Rate types and interfaces (Zod SSoT).
|
|
3
|
+
*
|
|
4
|
+
* Defines CurrencyCode, ForexRate, and IForexRateService for the
|
|
5
|
+
* v1.5.3 display currency subsystem. This is SEPARATE from IPriceOracle
|
|
6
|
+
* (crypto vs forex concern separation -- tech decision #10).
|
|
7
|
+
*
|
|
8
|
+
* IForexRateService.getRate() returns null on failure (graceful fallback).
|
|
9
|
+
* Caller should display USD when rate is unavailable.
|
|
10
|
+
*/
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
/** 43 supported fiat currency codes for display currency. */
|
|
13
|
+
export declare const CurrencyCodeSchema: z.ZodEnum<["USD", "KRW", "JPY", "EUR", "GBP", "CNY", "CAD", "AUD", "CHF", "SGD", "HKD", "INR", "TWD", "THB", "MYR", "IDR", "PHP", "VND", "BRL", "MXN", "CLP", "TRY", "PLN", "CZK", "HUF", "SEK", "NOK", "DKK", "NZD", "ZAR", "ILS", "SAR", "AED", "KWD", "BHD", "NGN", "RUB", "UAH", "PKR", "BDT", "LKR", "MMK", "GEL"]>;
|
|
14
|
+
/** Fiat currency code type. Derived from CurrencyCodeSchema via z.infer. */
|
|
15
|
+
export type CurrencyCode = z.infer<typeof CurrencyCodeSchema>;
|
|
16
|
+
/** Forex rate from USD to a target fiat currency. */
|
|
17
|
+
export declare const ForexRateSchema: z.ZodObject<{
|
|
18
|
+
/** Source currency (always USD). */
|
|
19
|
+
from: z.ZodLiteral<"USD">;
|
|
20
|
+
/** Target currency code. */
|
|
21
|
+
to: z.ZodEnum<["USD", "KRW", "JPY", "EUR", "GBP", "CNY", "CAD", "AUD", "CHF", "SGD", "HKD", "INR", "TWD", "THB", "MYR", "IDR", "PHP", "VND", "BRL", "MXN", "CLP", "TRY", "PLN", "CZK", "HUF", "SEK", "NOK", "DKK", "NZD", "ZAR", "ILS", "SAR", "AED", "KWD", "BHD", "NGN", "RUB", "UAH", "PKR", "BDT", "LKR", "MMK", "GEL"]>;
|
|
22
|
+
/** Exchange rate (1 USD = rate target currency). Positive number. */
|
|
23
|
+
rate: z.ZodNumber;
|
|
24
|
+
/** Data source: 'coingecko' (fresh from API) or 'cache' (from cache). */
|
|
25
|
+
source: z.ZodEnum<["coingecko", "cache"]>;
|
|
26
|
+
/** Unix timestamp (ms) when rate was fetched. */
|
|
27
|
+
fetchedAt: z.ZodNumber;
|
|
28
|
+
/** Unix timestamp (ms) when this rate expires. */
|
|
29
|
+
expiresAt: z.ZodNumber;
|
|
30
|
+
}, "strip", z.ZodTypeAny, {
|
|
31
|
+
expiresAt: number;
|
|
32
|
+
to: "USD" | "KRW" | "JPY" | "EUR" | "GBP" | "CNY" | "CAD" | "AUD" | "CHF" | "SGD" | "HKD" | "INR" | "TWD" | "THB" | "MYR" | "IDR" | "PHP" | "VND" | "BRL" | "MXN" | "CLP" | "TRY" | "PLN" | "CZK" | "HUF" | "SEK" | "NOK" | "DKK" | "NZD" | "ZAR" | "ILS" | "SAR" | "AED" | "KWD" | "BHD" | "NGN" | "RUB" | "UAH" | "PKR" | "BDT" | "LKR" | "MMK" | "GEL";
|
|
33
|
+
source: "coingecko" | "cache";
|
|
34
|
+
fetchedAt: number;
|
|
35
|
+
from: "USD";
|
|
36
|
+
rate: number;
|
|
37
|
+
}, {
|
|
38
|
+
expiresAt: number;
|
|
39
|
+
to: "USD" | "KRW" | "JPY" | "EUR" | "GBP" | "CNY" | "CAD" | "AUD" | "CHF" | "SGD" | "HKD" | "INR" | "TWD" | "THB" | "MYR" | "IDR" | "PHP" | "VND" | "BRL" | "MXN" | "CLP" | "TRY" | "PLN" | "CZK" | "HUF" | "SEK" | "NOK" | "DKK" | "NZD" | "ZAR" | "ILS" | "SAR" | "AED" | "KWD" | "BHD" | "NGN" | "RUB" | "UAH" | "PKR" | "BDT" | "LKR" | "MMK" | "GEL";
|
|
40
|
+
source: "coingecko" | "cache";
|
|
41
|
+
fetchedAt: number;
|
|
42
|
+
from: "USD";
|
|
43
|
+
rate: number;
|
|
44
|
+
}>;
|
|
45
|
+
/** Forex rate data. Derived from ForexRateSchema via z.infer. */
|
|
46
|
+
export type ForexRate = z.infer<typeof ForexRateSchema>;
|
|
47
|
+
/**
|
|
48
|
+
* Forex rate service contract.
|
|
49
|
+
*
|
|
50
|
+
* Separate from IPriceOracle (crypto prices). Provides USD -> fiat
|
|
51
|
+
* currency exchange rates for display currency conversion.
|
|
52
|
+
*
|
|
53
|
+
* Implementation: ForexRateService (uses CoinGeckoForexProvider + InMemoryPriceCache).
|
|
54
|
+
*
|
|
55
|
+
* Graceful fallback: getRate() returns null on failure (caller shows USD).
|
|
56
|
+
*/
|
|
57
|
+
export interface IForexRateService {
|
|
58
|
+
/** Get exchange rate from USD to target currency. Returns null on failure. */
|
|
59
|
+
getRate(to: CurrencyCode): Promise<ForexRate | null>;
|
|
60
|
+
/** Get exchange rates for multiple currencies. Missing rates are omitted. */
|
|
61
|
+
getRates(currencies: CurrencyCode[]): Promise<Map<CurrencyCode, ForexRate>>;
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=forex-rate.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forex-rate.types.d.ts","sourceRoot":"","sources":["../../src/interfaces/forex-rate.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,6DAA6D;AAC7D,eAAO,MAAM,kBAAkB,0TAM7B,CAAC;AAEH,4EAA4E;AAC5E,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAM9D,qDAAqD;AACrD,eAAO,MAAM,eAAe;IAC1B,oCAAoC;;IAEpC,4BAA4B;;IAE5B,qEAAqE;;IAErE,yEAAyE;;IAEzE,iDAAiD;;IAEjD,kDAAkD;;;;;;;;;;;;;;;;EAElD,CAAC;AAEH,iEAAiE;AACjE,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAMxD;;;;;;;;;GASG;AACH,MAAM,WAAW,iBAAiB;IAChC,8EAA8E;IAC9E,OAAO,CAAC,EAAE,EAAE,YAAY,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;IACrD,6EAA6E;IAC7E,QAAQ,CAAC,UAAU,EAAE,YAAY,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,SAAS,CAAC,CAAC,CAAC;CAC7E"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Forex Rate types and interfaces (Zod SSoT).
|
|
3
|
+
*
|
|
4
|
+
* Defines CurrencyCode, ForexRate, and IForexRateService for the
|
|
5
|
+
* v1.5.3 display currency subsystem. This is SEPARATE from IPriceOracle
|
|
6
|
+
* (crypto vs forex concern separation -- tech decision #10).
|
|
7
|
+
*
|
|
8
|
+
* IForexRateService.getRate() returns null on failure (graceful fallback).
|
|
9
|
+
* Caller should display USD when rate is unavailable.
|
|
10
|
+
*/
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
// Zod SSoT: CurrencyCode (43 fiat currencies)
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
/** 43 supported fiat currency codes for display currency. */
|
|
16
|
+
export const CurrencyCodeSchema = z.enum([
|
|
17
|
+
'USD', 'KRW', 'JPY', 'EUR', 'GBP', 'CNY', 'CAD', 'AUD', 'CHF', 'SGD',
|
|
18
|
+
'HKD', 'INR', 'TWD', 'THB', 'MYR', 'IDR', 'PHP', 'VND', 'BRL', 'MXN',
|
|
19
|
+
'CLP', 'TRY', 'PLN', 'CZK', 'HUF', 'SEK', 'NOK', 'DKK', 'NZD', 'ZAR',
|
|
20
|
+
'ILS', 'SAR', 'AED', 'KWD', 'BHD', 'NGN', 'RUB', 'UAH', 'PKR', 'BDT',
|
|
21
|
+
'LKR', 'MMK', 'GEL',
|
|
22
|
+
]);
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
// Zod SSoT: ForexRate
|
|
25
|
+
// ---------------------------------------------------------------------------
|
|
26
|
+
/** Forex rate from USD to a target fiat currency. */
|
|
27
|
+
export const ForexRateSchema = z.object({
|
|
28
|
+
/** Source currency (always USD). */
|
|
29
|
+
from: z.literal('USD'),
|
|
30
|
+
/** Target currency code. */
|
|
31
|
+
to: CurrencyCodeSchema,
|
|
32
|
+
/** Exchange rate (1 USD = rate target currency). Positive number. */
|
|
33
|
+
rate: z.number().positive(),
|
|
34
|
+
/** Data source: 'coingecko' (fresh from API) or 'cache' (from cache). */
|
|
35
|
+
source: z.enum(['coingecko', 'cache']),
|
|
36
|
+
/** Unix timestamp (ms) when rate was fetched. */
|
|
37
|
+
fetchedAt: z.number().int().positive(),
|
|
38
|
+
/** Unix timestamp (ms) when this rate expires. */
|
|
39
|
+
expiresAt: z.number().int().positive(),
|
|
40
|
+
});
|
|
41
|
+
//# sourceMappingURL=forex-rate.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forex-rate.types.js","sourceRoot":"","sources":["../../src/interfaces/forex-rate.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,8EAA8E;AAC9E,8CAA8C;AAC9C,8EAA8E;AAE9E,6DAA6D;AAC7D,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,IAAI,CAAC;IACvC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK;IACpE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK;IACpE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK;IACpE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK;IACpE,KAAK,EAAE,KAAK,EAAE,KAAK;CACpB,CAAC,CAAC;AAKH,8EAA8E;AAC9E,sBAAsB;AACtB,8EAA8E;AAE9E,qDAAqD;AACrD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,oCAAoC;IACpC,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IACtB,4BAA4B;IAC5B,EAAE,EAAE,kBAAkB;IACtB,qEAAqE;IACrE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,yEAAyE;IACzE,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IACtC,iDAAiD;IACjD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACtC,kDAAkD;IAClD,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;CACvC,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type { TokenAmount, TransferRequest, UnsignedTransaction, SimulationResult, SubmitResult, BalanceInfo, HealthInfo, AssetInfo, FeeEstimate, TokenInfo, SweepResult, TokenTransferParams, ContractCallParams, ApproveParams, BatchParams, ParsedOperationType, ParsedOperation, ParsedTransaction, SignedTransaction, } from './chain-adapter.types.js';
|
|
2
|
+
export type { IChainAdapter } from './IChainAdapter.js';
|
|
3
|
+
export type { ILocalKeyStore } from './ILocalKeyStore.js';
|
|
4
|
+
export type { IPolicyEngine, PolicyEvaluation } from './IPolicyEngine.js';
|
|
5
|
+
export type { INotificationChannel, NotificationPayload } from './INotificationChannel.js';
|
|
6
|
+
export type { TokenRef, PriceInfo, CacheStats, IPriceOracle } from './price-oracle.types.js';
|
|
7
|
+
export { TokenRefSchema, PriceInfoSchema } from './price-oracle.types.js';
|
|
8
|
+
export type { ActionProviderMetadata, ActionDefinition, ActionContext, IActionProvider, } from './action-provider.types.js';
|
|
9
|
+
export { ActionProviderMetadataSchema, ActionDefinitionSchema, ActionContextSchema, } from './action-provider.types.js';
|
|
10
|
+
export type { ForexRate, CurrencyCode, IForexRateService } from './forex-rate.types.js';
|
|
11
|
+
export { ForexRateSchema, CurrencyCodeSchema } from './forex-rate.types.js';
|
|
12
|
+
export type { X402FetchRequest, X402FetchResponse, X402PaymentInfo } from './x402.types.js';
|
|
13
|
+
export type { PaymentRequired, PaymentPayload, PaymentRequirements } from './x402.types.js';
|
|
14
|
+
export { X402FetchRequestSchema, X402FetchResponseSchema, X402PaymentInfoSchema, CAIP2_TO_NETWORK, NETWORK_TO_CAIP2, parseCaip2, resolveX402Network, PaymentRequiredV2Schema, PaymentPayloadV2Schema, PaymentRequirementsV2Schema, } from './x402.types.js';
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,WAAW,EACX,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,EACZ,WAAW,EACX,UAAU,EACV,SAAS,EAET,WAAW,EACX,SAAS,EACT,WAAW,EACX,mBAAmB,EACnB,kBAAkB,EAClB,aAAa,EACb,WAAW,EAEX,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,0BAA0B,CAAC;AAGlC,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,YAAY,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC1E,YAAY,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AAG3F,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC7F,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG1E,YAAY,EACV,sBAAsB,EACtB,gBAAgB,EAChB,aAAa,EACb,eAAe,GAChB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,4BAA4B,EAC5B,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AAGpC,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AACxF,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAG5E,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAC5F,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AAC5F,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,kBAAkB,EAClB,uBAAuB,EACvB,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { TokenRefSchema, PriceInfoSchema } from './price-oracle.types.js';
|
|
2
|
+
export { ActionProviderMetadataSchema, ActionDefinitionSchema, ActionContextSchema, } from './action-provider.types.js';
|
|
3
|
+
export { ForexRateSchema, CurrencyCodeSchema } from './forex-rate.types.js';
|
|
4
|
+
export { X402FetchRequestSchema, X402FetchResponseSchema, X402PaymentInfoSchema, CAIP2_TO_NETWORK, NETWORK_TO_CAIP2, parseCaip2, resolveX402Network, PaymentRequiredV2Schema, PaymentPayloadV2Schema, PaymentRequirementsV2Schema, } from './x402.types.js';
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/interfaces/index.ts"],"names":[],"mappings":"AAiCA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAS1E,OAAO,EACL,4BAA4B,EAC5B,sBAAsB,EACtB,mBAAmB,GACpB,MAAM,4BAA4B,CAAC;AAIpC,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAK5E,OAAO,EACL,sBAAsB,EACtB,uBAAuB,EACvB,qBAAqB,EACrB,gBAAgB,EAChB,gBAAgB,EAChB,UAAU,EACV,kBAAkB,EAClB,uBAAuB,EACvB,sBAAsB,EACtB,2BAA2B,GAC5B,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Price Oracle types and interfaces (Zod SSoT).
|
|
3
|
+
*
|
|
4
|
+
* Defines TokenRef, PriceInfo, CacheStats, and IPriceOracle for the
|
|
5
|
+
* v1.5 DeFi price oracle subsystem. Actual oracle implementations
|
|
6
|
+
* (Pyth, CoinGecko) live in the daemon package.
|
|
7
|
+
*
|
|
8
|
+
* Source enum: 'pyth' | 'coingecko' | 'cache' (v1.5 decision: no chainlink/jupiter).
|
|
9
|
+
*/
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
import type { ChainType } from '../enums/chain.js';
|
|
12
|
+
/** Reference to a token for price lookup. */
|
|
13
|
+
export declare const TokenRefSchema: z.ZodObject<{
|
|
14
|
+
/** Token address (mint for Solana, contract for EVM). Min 1 char. */
|
|
15
|
+
address: z.ZodString;
|
|
16
|
+
/** Token symbol (optional, for display/logging). */
|
|
17
|
+
symbol: z.ZodOptional<z.ZodString>;
|
|
18
|
+
/** Decimal places. SOL=9, ETH=18, USDC=6. Range 0-18. */
|
|
19
|
+
decimals: z.ZodNumber;
|
|
20
|
+
/** Target chain. */
|
|
21
|
+
chain: z.ZodEnum<["solana", "ethereum"]>;
|
|
22
|
+
}, "strip", z.ZodTypeAny, {
|
|
23
|
+
chain: "solana" | "ethereum";
|
|
24
|
+
address: string;
|
|
25
|
+
decimals: number;
|
|
26
|
+
symbol?: string | undefined;
|
|
27
|
+
}, {
|
|
28
|
+
chain: "solana" | "ethereum";
|
|
29
|
+
address: string;
|
|
30
|
+
decimals: number;
|
|
31
|
+
symbol?: string | undefined;
|
|
32
|
+
}>;
|
|
33
|
+
/** Token reference for price lookup. Derived from TokenRefSchema via z.infer. */
|
|
34
|
+
export type TokenRef = z.infer<typeof TokenRefSchema>;
|
|
35
|
+
/** Price information returned by an oracle. */
|
|
36
|
+
export declare const PriceInfoSchema: z.ZodObject<{
|
|
37
|
+
/** USD price (non-negative). */
|
|
38
|
+
usdPrice: z.ZodNumber;
|
|
39
|
+
/** Price confidence ratio (0-1). Higher = more confident. Optional. */
|
|
40
|
+
confidence: z.ZodOptional<z.ZodNumber>;
|
|
41
|
+
/** Data source. v1.5: pyth (primary), coingecko (fallback), cache (from cache). */
|
|
42
|
+
source: z.ZodEnum<["pyth", "coingecko", "cache"]>;
|
|
43
|
+
/** Unix timestamp (ms) when price was fetched. Positive integer. */
|
|
44
|
+
fetchedAt: z.ZodNumber;
|
|
45
|
+
/** Unix timestamp (ms) when this price expires. Positive integer. */
|
|
46
|
+
expiresAt: z.ZodNumber;
|
|
47
|
+
/**
|
|
48
|
+
* Whether this price observation is past TTL.
|
|
49
|
+
* Note: isStale=true means past cache TTL (>5min), NOT classifyPriceAge STALE (>30min).
|
|
50
|
+
* Defaults to false.
|
|
51
|
+
*/
|
|
52
|
+
isStale: z.ZodDefault<z.ZodBoolean>;
|
|
53
|
+
}, "strip", z.ZodTypeAny, {
|
|
54
|
+
expiresAt: number;
|
|
55
|
+
usdPrice: number;
|
|
56
|
+
source: "pyth" | "coingecko" | "cache";
|
|
57
|
+
fetchedAt: number;
|
|
58
|
+
isStale: boolean;
|
|
59
|
+
confidence?: number | undefined;
|
|
60
|
+
}, {
|
|
61
|
+
expiresAt: number;
|
|
62
|
+
usdPrice: number;
|
|
63
|
+
source: "pyth" | "coingecko" | "cache";
|
|
64
|
+
fetchedAt: number;
|
|
65
|
+
confidence?: number | undefined;
|
|
66
|
+
isStale?: boolean | undefined;
|
|
67
|
+
}>;
|
|
68
|
+
/** Price information from an oracle source. Derived from PriceInfoSchema via z.infer. */
|
|
69
|
+
export type PriceInfo = z.infer<typeof PriceInfoSchema>;
|
|
70
|
+
/** Cache statistics for monitoring and diagnostics. */
|
|
71
|
+
export interface CacheStats {
|
|
72
|
+
/** Number of cache hits. */
|
|
73
|
+
hits: number;
|
|
74
|
+
/** Number of cache misses. */
|
|
75
|
+
misses: number;
|
|
76
|
+
/** Number of stale cache hits (expired but within staleMax). */
|
|
77
|
+
staleHits: number;
|
|
78
|
+
/** Current number of entries in cache. */
|
|
79
|
+
size: number;
|
|
80
|
+
/** Number of LRU evictions. */
|
|
81
|
+
evictions: number;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Price oracle contract.
|
|
85
|
+
*
|
|
86
|
+
* Implementations: PythOracle (primary), CoinGeckoOracle (fallback),
|
|
87
|
+
* OracleChain (composite with fallback + cross-validation).
|
|
88
|
+
*/
|
|
89
|
+
export interface IPriceOracle {
|
|
90
|
+
/** Get price for a single token. */
|
|
91
|
+
getPrice(token: TokenRef): Promise<PriceInfo>;
|
|
92
|
+
/** Get prices for multiple tokens. Returns Map<cacheKey, PriceInfo>. */
|
|
93
|
+
getPrices(tokens: TokenRef[]): Promise<Map<string, PriceInfo>>;
|
|
94
|
+
/** Get native token price (SOL or ETH). */
|
|
95
|
+
getNativePrice(chain: ChainType): Promise<PriceInfo>;
|
|
96
|
+
/** Get cache statistics. */
|
|
97
|
+
getCacheStats(): CacheStats;
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=price-oracle.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"price-oracle.types.d.ts","sourceRoot":"","sources":["../../src/interfaces/price-oracle.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAA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
2
|
+
* Price Oracle types and interfaces (Zod SSoT).
|
|
3
|
+
*
|
|
4
|
+
* Defines TokenRef, PriceInfo, CacheStats, and IPriceOracle for the
|
|
5
|
+
* v1.5 DeFi price oracle subsystem. Actual oracle implementations
|
|
6
|
+
* (Pyth, CoinGecko) live in the daemon package.
|
|
7
|
+
*
|
|
8
|
+
* Source enum: 'pyth' | 'coingecko' | 'cache' (v1.5 decision: no chainlink/jupiter).
|
|
9
|
+
*/
|
|
10
|
+
import { z } from 'zod';
|
|
11
|
+
import { ChainTypeEnum } from '../enums/chain.js';
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
// Zod SSoT: TokenRef
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
/** Reference to a token for price lookup. */
|
|
16
|
+
export const TokenRefSchema = z.object({
|
|
17
|
+
/** Token address (mint for Solana, contract for EVM). Min 1 char. */
|
|
18
|
+
address: z.string().min(1, 'Token address is required'),
|
|
19
|
+
/** Token symbol (optional, for display/logging). */
|
|
20
|
+
symbol: z.string().optional(),
|
|
21
|
+
/** Decimal places. SOL=9, ETH=18, USDC=6. Range 0-18. */
|
|
22
|
+
decimals: z.number().int().min(0).max(18),
|
|
23
|
+
/** Target chain. */
|
|
24
|
+
chain: ChainTypeEnum,
|
|
25
|
+
});
|
|
26
|
+
// ---------------------------------------------------------------------------
|
|
27
|
+
// Zod SSoT: PriceInfo
|
|
28
|
+
// ---------------------------------------------------------------------------
|
|
29
|
+
/** Price information returned by an oracle. */
|
|
30
|
+
export const PriceInfoSchema = z.object({
|
|
31
|
+
/** USD price (non-negative). */
|
|
32
|
+
usdPrice: z.number().nonnegative(),
|
|
33
|
+
/** Price confidence ratio (0-1). Higher = more confident. Optional. */
|
|
34
|
+
confidence: z.number().min(0).max(1).optional(),
|
|
35
|
+
/** Data source. v1.5: pyth (primary), coingecko (fallback), cache (from cache). */
|
|
36
|
+
source: z.enum(['pyth', 'coingecko', 'cache']),
|
|
37
|
+
/** Unix timestamp (ms) when price was fetched. Positive integer. */
|
|
38
|
+
fetchedAt: z.number().int().positive(),
|
|
39
|
+
/** Unix timestamp (ms) when this price expires. Positive integer. */
|
|
40
|
+
expiresAt: z.number().int().positive(),
|
|
41
|
+
/**
|
|
42
|
+
* Whether this price observation is past TTL.
|
|
43
|
+
* Note: isStale=true means past cache TTL (>5min), NOT classifyPriceAge STALE (>30min).
|
|
44
|
+
* Defaults to false.
|
|
45
|
+
*/
|
|
46
|
+
isStale: z.boolean().default(false),
|
|
47
|
+
});
|
|
48
|
+
//# sourceMappingURL=price-oracle.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"price-oracle.types.js","sourceRoot":"","sources":["../../src/interfaces/price-oracle.types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAElD,8EAA8E;AAC9E,qBAAqB;AACrB,8EAA8E;AAE9E,6CAA6C;AAC7C,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,qEAAqE;IACrE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,2BAA2B,CAAC;IACvD,oDAAoD;IACpD,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC7B,yDAAyD;IACzD,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;IACzC,oBAAoB;IACpB,KAAK,EAAE,aAAa;CACrB,CAAC,CAAC;AAKH,8EAA8E;AAC9E,sBAAsB;AACtB,8EAA8E;AAE9E,+CAA+C;AAC/C,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,gCAAgC;IAChC,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