@domfi/sdk 0.1.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 (93) hide show
  1. package/LICENSE +16 -0
  2. package/README.md +786 -0
  3. package/dist/actions.cjs +1 -0
  4. package/dist/actions.d.cts +17 -0
  5. package/dist/actions.d.ts +17 -0
  6. package/dist/actions.js +1 -0
  7. package/dist/api.cjs +1 -0
  8. package/dist/api.d.cts +664 -0
  9. package/dist/api.d.ts +664 -0
  10. package/dist/api.js +0 -0
  11. package/dist/chunk-2VSPOLVO.js +1 -0
  12. package/dist/chunk-5YZVCHRU.js +0 -0
  13. package/dist/chunk-77XMXAXE.js +1 -0
  14. package/dist/chunk-7OVWNPZQ.js +1 -0
  15. package/dist/chunk-BMYMNNJK.js +1 -0
  16. package/dist/chunk-C5Y2WM7C.js +1 -0
  17. package/dist/chunk-C64LJM7D.js +2 -0
  18. package/dist/chunk-CLOFJTBP.js +1 -0
  19. package/dist/chunk-CMREWGOI.js +1 -0
  20. package/dist/chunk-D5VE2O4F.js +1 -0
  21. package/dist/chunk-LDE3JHVE.js +1 -0
  22. package/dist/chunk-N4Q67DTE.js +1 -0
  23. package/dist/chunk-SZE5DE54.js +1 -0
  24. package/dist/chunk-XHQVWI2J.js +1 -0
  25. package/dist/chunk-YU5DN3PI.js +1 -0
  26. package/dist/config.cjs +2 -0
  27. package/dist/config.d.cts +132 -0
  28. package/dist/config.d.ts +132 -0
  29. package/dist/config.js +1 -0
  30. package/dist/contracts.cjs +1 -0
  31. package/dist/contracts.d.cts +13073 -0
  32. package/dist/contracts.d.ts +13073 -0
  33. package/dist/contracts.js +1 -0
  34. package/dist/delegation.cjs +1 -0
  35. package/dist/delegation.d.cts +7 -0
  36. package/dist/delegation.d.ts +7 -0
  37. package/dist/delegation.js +0 -0
  38. package/dist/errors.cjs +3 -0
  39. package/dist/errors.d.cts +155 -0
  40. package/dist/errors.d.ts +155 -0
  41. package/dist/errors.js +3 -0
  42. package/dist/index.cjs +2 -0
  43. package/dist/index.d.cts +216 -0
  44. package/dist/index.d.ts +216 -0
  45. package/dist/index.js +1 -0
  46. package/dist/math.cjs +1 -0
  47. package/dist/math.d.cts +273 -0
  48. package/dist/math.d.ts +273 -0
  49. package/dist/math.js +1 -0
  50. package/dist/position-BnhSFyGe.d.cts +56 -0
  51. package/dist/position-BnhSFyGe.d.ts +56 -0
  52. package/dist/rawSchemas-MAT7EZCV.js +1 -0
  53. package/dist/referrals.cjs +1 -0
  54. package/dist/referrals.d.cts +66 -0
  55. package/dist/referrals.d.ts +66 -0
  56. package/dist/referrals.js +1 -0
  57. package/dist/serde.cjs +1 -0
  58. package/dist/serde.d.cts +24 -0
  59. package/dist/serde.d.ts +24 -0
  60. package/dist/serde.js +1 -0
  61. package/dist/token.cjs +1 -0
  62. package/dist/token.d.cts +32 -0
  63. package/dist/token.d.ts +32 -0
  64. package/dist/token.js +0 -0
  65. package/dist/trading.cjs +1 -0
  66. package/dist/trading.d.cts +20 -0
  67. package/dist/trading.d.ts +20 -0
  68. package/dist/trading.js +1 -0
  69. package/dist/types-7s13ZSql.d.ts +533 -0
  70. package/dist/types-BK6dYOXr.d.cts +118 -0
  71. package/dist/types-CMtixBIP.d.cts +464 -0
  72. package/dist/types-DB1r_Ppi.d.ts +464 -0
  73. package/dist/types-DDgJiEFg.d.ts +780 -0
  74. package/dist/types-DJBX-p4X.d.cts +780 -0
  75. package/dist/types-DQft82W7.d.cts +533 -0
  76. package/dist/types-DhCzEwnS.d.ts +118 -0
  77. package/dist/types-veTDfbhq.d.ts +436 -0
  78. package/dist/types-x1MvxSdy.d.cts +436 -0
  79. package/dist/units-BYd75H7U.d.cts +22 -0
  80. package/dist/units-BYd75H7U.d.ts +22 -0
  81. package/dist/units.cjs +1 -0
  82. package/dist/units.d.cts +248 -0
  83. package/dist/units.d.ts +248 -0
  84. package/dist/units.js +1 -0
  85. package/dist/valuation.cjs +1 -0
  86. package/dist/valuation.d.cts +5 -0
  87. package/dist/valuation.d.ts +5 -0
  88. package/dist/valuation.js +1 -0
  89. package/dist/vault.cjs +1 -0
  90. package/dist/vault.d.cts +34 -0
  91. package/dist/vault.d.ts +34 -0
  92. package/dist/vault.js +1 -0
  93. package/package.json +181 -0
@@ -0,0 +1,216 @@
1
+ import { o as DomfiActionsClient } from './types-CMtixBIP.cjs';
2
+ import { ReadinessWarningEvent, DomfiInfoClient, DomfiRawClient } from './api.cjs';
3
+ import { R as ReadOptions, e as ResultEnvelope, g as ApiStatus } from './types-DQft82W7.cjs';
4
+ import { Address } from './units.cjs';
5
+ import { DomfiChain, DomfiChainProfile } from './config.cjs';
6
+ export { CollateralConfig, baseDomfiChain, baseSepoliaDomfiChain, domfiChains } from './config.cjs';
7
+ import { P as PublicClient, b as WalletClient, c as DelegationClient, d as TradingClient, e as TradingClientNoApi } from './types-DJBX-p4X.cjs';
8
+ import { DiagnosticsEnvelope } from '@domfi/sdk/errors';
9
+ export { AbortError, ApiError, ApiErrorInit, ContractRevertError, ContractRevertErrorInit, DiagnosticsEnvelope, DomfiError, DomfiErrorCode, DomfiErrorInit, DomfiErrorKind, IdentityMismatchError, MissingAccountError, MissingApiClientError, MissingPublicClientError, MissingWalletClientError, OracleFeeCapExceededError, ProtocolCompatibilityMismatchError, ReadModelNotReadyError, TimeoutError, TransportError, TransportErrorInit, ValidationError, WalletAccountMismatchError, WalletChainMismatchError, WalletDisconnectedError, isDomfiError } from '@domfi/sdk/errors';
10
+ import { SdkCompatibilityReport } from './contracts.cjs';
11
+ import { ReferralClient } from './referrals.cjs';
12
+ import { TokenClient } from './token.cjs';
13
+ import { V as ValuationClient, d as ValuationClientNoApi } from './types-BK6dYOXr.cjs';
14
+ import { k as VaultClient } from './types-x1MvxSdy.cjs';
15
+ export { Address, Brand, ClosePercent, Collateral, DecimalInput, DecimalString, FeePercent, FormatOptions, Hex, IsoTimestamp, Leverage, Notional, NumberBrandCodec, OrderId, PairIndex, Precision2Percent, Price, Ratio, RatioCodec, ScaleP2, SignedCollateral, SignedP18, SignedP6, SlippagePercent, StringBrandCodec, TimeInput, TradeId, TradeIndex, TriggerOrderIndex, TriggerOrderIndexCodec, UnitCodec, UnixMs, UnsignedP18, UsdP6, VaultAsset, VaultShare, VaultSharePrice, WholePercent, parseDecimalString } from '@domfi/sdk/units';
16
+ import './units-BYd75H7U.cjs';
17
+ import './errors.cjs';
18
+ import 'viem';
19
+
20
+ /** HTTP request shape passed to a custom SDK REST transport. */
21
+ type DomfiHttpRequest = {
22
+ method: "GET" | "POST";
23
+ url: string;
24
+ headers?: Record<string, string>;
25
+ body?: string;
26
+ signal?: AbortSignal;
27
+ timeoutMs?: number;
28
+ };
29
+ /** HTTP response shape returned by a custom SDK REST transport. */
30
+ type DomfiHttpResponse = {
31
+ status: number;
32
+ headers: Headers | Record<string, string>;
33
+ body: string;
34
+ };
35
+ /** Custom HTTP transport hook for REST API calls. */
36
+ type IRequestTransport = (request: DomfiHttpRequest) => Promise<DomfiHttpResponse>;
37
+ /** REST API configuration for API-enabled SDK clients. */
38
+ type ApiClientOptions = {
39
+ /** Override the selected chain profile's REST API base URL. */
40
+ baseUrl?: string;
41
+ /** Custom HTTP request implementation for runtimes without global `fetch` or for tests. */
42
+ requestTransport?: IRequestTransport;
43
+ /** Default REST request timeout in milliseconds. */
44
+ defaultTimeoutMs?: number;
45
+ };
46
+ /** Observable REST transport event emitted through `createDomfiClient({ onEvent })`. */
47
+ type ApiTransportEvent = {
48
+ type: "rest_request";
49
+ diagnostics: DiagnosticsEnvelope;
50
+ url: string;
51
+ } | {
52
+ type: "rest_response";
53
+ diagnostics: DiagnosticsEnvelope;
54
+ url: string;
55
+ status: number;
56
+ };
57
+
58
+ /**
59
+ * Observable, non-fatal SDK events emitted through `createDomfiClient({ onEvent })`.
60
+ *
61
+ * Today this covers REST transport diagnostics and read-plane readiness warnings.
62
+ * Handler exceptions are ignored so observability code cannot change SDK behavior.
63
+ */
64
+ type DomfiEvent = ApiTransportEvent | ReadinessWarningEvent;
65
+ /**
66
+ * REST/RPC concurrency and retry controls for SDK-managed transport calls.
67
+ *
68
+ * These controls only wrap calls the SDK initiates. They do not change retry or
69
+ * batching behavior inside a user-provided viem client.
70
+ */
71
+ type DomfiTransportOptions = {
72
+ /** Maximum number of concurrent SDK REST API requests. Must be a positive integer. */
73
+ maxConcurrentRest?: number;
74
+ /** Maximum number of concurrent SDK-issued viem public/wallet client calls. Must be a positive integer. */
75
+ maxConcurrentRpc?: number;
76
+ /**
77
+ * Maximum REST retry attempts per request for transient REST failures.
78
+ * Must be a non-negative integer. Defaults to 0, applies only to REST requests,
79
+ * and does not retry RPC/wallet calls. Retries use abort-aware exponential
80
+ * backoff with jitter and honor `Retry-After` on HTTP 429 responses.
81
+ * Transient REST failures are transport failures, timeouts with remaining timeout budget,
82
+ * HTTP 429/5xx responses, or structured API errors with retryable:true. Structured API
83
+ * errors with retryable:false suppress retries even for HTTP 429/5xx responses.
84
+ */
85
+ retryBudget?: number;
86
+ };
87
+ /**
88
+ * Shared options for all DomFi SDK client modes.
89
+ *
90
+ * Use `api: false` for an RPC-only client, or omit `api`/pass `api` options for
91
+ * the full client with REST reads, referrals, vault reads, and high-level actions.
92
+ */
93
+ type CreateDomfiClientBaseOptions = {
94
+ /** Target DomFi deployment, by name, chain id, or custom chain profile. */
95
+ chain: DomfiChain | DomfiChainProfile;
96
+ /** viem-compatible public client used for reads, simulations, and receipt polling. */
97
+ publicClient?: PublicClient;
98
+ /** viem-compatible wallet client used for transaction sending. */
99
+ walletClient?: WalletClient;
100
+ /** Default wallet address for account-scoped operations. */
101
+ account?: Address;
102
+ /** Optional concurrency and retry controls. */
103
+ transport?: DomfiTransportOptions;
104
+ /** Observer hook for non-fatal SDK events. Handler failures are ignored. */
105
+ onEvent?: (event: DomfiEvent) => void;
106
+ };
107
+ /**
108
+ * Options for a full SDK client with REST API access enabled.
109
+ *
110
+ * Built-in mainnet and testnet profiles include default REST API URLs.
111
+ * Pass `api.baseUrl` to override the selected chain profile's `apiBaseUrl`.
112
+ */
113
+ type CreateDomfiClientWithApiOptions = CreateDomfiClientBaseOptions & {
114
+ api?: ApiClientOptions;
115
+ };
116
+ /**
117
+ * Options for an RPC-only SDK client.
118
+ *
119
+ * Set `api: false` to omit REST-dependent clients such as `api`, `raw`,
120
+ * `actions`, `vault`, and `referrals`.
121
+ */
122
+ type CreateDomfiClientNoApiOptions = CreateDomfiClientBaseOptions & {
123
+ api: false;
124
+ };
125
+ type CreateDomfiClientOptions = CreateDomfiClientWithApiOptions | CreateDomfiClientNoApiOptions;
126
+ /** System metadata client available on API-enabled SDK clients. */
127
+ type SystemClient = {
128
+ /** Returns the SDK/contract compatibility report bundled with this package. */
129
+ sdkCompatibility(opts?: ReadOptions): Promise<SdkCompatibilityReport>;
130
+ /** Reads the REST API status endpoint and maps it into the SDK result envelope. */
131
+ apiStatus(opts?: ReadOptions): Promise<ResultEnvelope<ApiStatus>>;
132
+ };
133
+ /** System metadata client available when REST API access is disabled. */
134
+ type SystemClientNoApi = {
135
+ /** Returns the SDK/contract compatibility report bundled with this package. */
136
+ sdkCompatibility(opts?: ReadOptions): Promise<SdkCompatibilityReport>;
137
+ };
138
+ /**
139
+ * SDK client returned by `createDomfiClient` when `api: false` is used.
140
+ *
141
+ * This mode keeps onchain helpers available but intentionally omits all REST
142
+ * read-plane clients and high-level action helpers that depend on REST data.
143
+ */
144
+ type DomfiClientNoApi = {
145
+ /** Resolved DomFi chain profile used by this client. */
146
+ chain: DomfiChainProfile;
147
+ /** Collateral token reads and approvals. */
148
+ token: TokenClient;
149
+ /** Delegated trading wallet helpers. */
150
+ delegation: DelegationClient;
151
+ /** RPC-backed trading preparation and sending helpers. */
152
+ trading: TradingClientNoApi;
153
+ /** RPC-only valuation helpers. */
154
+ valuation: ValuationClientNoApi;
155
+ /** SDK/system metadata helpers available without REST API access. */
156
+ system: SystemClientNoApi;
157
+ };
158
+ /**
159
+ * Full SDK client returned by `createDomfiClient` when REST API access is enabled.
160
+ *
161
+ * Includes REST domain reads, raw REST access, referrals, vault reads/writes,
162
+ * and high-level action handles in addition to onchain trading and valuation.
163
+ */
164
+ type DomfiClient = {
165
+ /** Resolved DomFi chain profile used by this client. */
166
+ chain: DomfiChainProfile;
167
+ /** Collateral token reads and approvals. */
168
+ token: TokenClient;
169
+ /** Delegated trading wallet helpers. */
170
+ delegation: DelegationClient;
171
+ /** Trading preparation, sending, and tracking helpers. */
172
+ trading: TradingClient;
173
+ /** REST-assisted valuation helpers. */
174
+ valuation: ValuationClient;
175
+ /** SDK/system metadata helpers. */
176
+ system: SystemClient;
177
+ /** Mapped high-level REST read client. */
178
+ api: DomfiInfoClient;
179
+ /** Raw REST route client. */
180
+ raw: DomfiRawClient;
181
+ /** High-level action client that starts/stages full trading and vault flows. */
182
+ actions: DomfiActionsClient;
183
+ /** Vault reads, preparation helpers, and direct send helpers. */
184
+ vault: VaultClient;
185
+ /** Referral read helpers. */
186
+ referrals: ReferralClient;
187
+ };
188
+ /**
189
+ * Creates a DomFi SDK client for a DomFi deployment.
190
+ *
191
+ * Omitting `api` creates a full client with REST reads plus transaction helpers.
192
+ * Passing `api: false` creates an RPC-only client for preparing, sending, and
193
+ * tracking transactions without REST API dependencies.
194
+ *
195
+ * The returned type narrows from the `api` option: `api: false` returns
196
+ * `DomfiClientNoApi`; all other calls return the full `DomfiClient`.
197
+ *
198
+ * @example
199
+ * ```ts
200
+ * const domfi = createDomfiClient({ chain: "mainnet", publicClient, walletClient });
201
+ * await domfi.system.apiStatus();
202
+ * ```
203
+ *
204
+ * @example
205
+ * ```ts
206
+ * const rpcOnly = createDomfiClient({ chain: "mainnet", publicClient, api: false });
207
+ * await rpcOnly.trading.prepareOpenTrade(params);
208
+ * ```
209
+ *
210
+ * @throws {ValidationError} When the chain, API base URL, or transport options are invalid.
211
+ */
212
+ declare function createDomfiClient(options: CreateDomfiClientNoApiOptions): DomfiClientNoApi;
213
+ declare function createDomfiClient(options: CreateDomfiClientWithApiOptions): DomfiClient;
214
+ declare function createDomfiClient<T extends CreateDomfiClientOptions>(options: T): T extends CreateDomfiClientNoApiOptions ? DomfiClientNoApi : DomfiClient;
215
+
216
+ export { type ApiClientOptions, type CreateDomfiClientBaseOptions, type CreateDomfiClientNoApiOptions, type CreateDomfiClientOptions, type CreateDomfiClientWithApiOptions, DomfiChain, DomfiChainProfile, type DomfiClient, type DomfiClientNoApi, type DomfiEvent, type DomfiHttpRequest, type DomfiHttpResponse, type DomfiTransportOptions, type IRequestTransport, type SystemClient, type SystemClientNoApi, createDomfiClient };
@@ -0,0 +1,216 @@
1
+ import { o as DomfiActionsClient } from './types-DB1r_Ppi.js';
2
+ import { ReadinessWarningEvent, DomfiInfoClient, DomfiRawClient } from './api.js';
3
+ import { R as ReadOptions, e as ResultEnvelope, g as ApiStatus } from './types-7s13ZSql.js';
4
+ import { Address } from './units.js';
5
+ import { DomfiChain, DomfiChainProfile } from './config.js';
6
+ export { CollateralConfig, baseDomfiChain, baseSepoliaDomfiChain, domfiChains } from './config.js';
7
+ import { P as PublicClient, b as WalletClient, c as DelegationClient, d as TradingClient, e as TradingClientNoApi } from './types-DDgJiEFg.js';
8
+ import { DiagnosticsEnvelope } from '@domfi/sdk/errors';
9
+ export { AbortError, ApiError, ApiErrorInit, ContractRevertError, ContractRevertErrorInit, DiagnosticsEnvelope, DomfiError, DomfiErrorCode, DomfiErrorInit, DomfiErrorKind, IdentityMismatchError, MissingAccountError, MissingApiClientError, MissingPublicClientError, MissingWalletClientError, OracleFeeCapExceededError, ProtocolCompatibilityMismatchError, ReadModelNotReadyError, TimeoutError, TransportError, TransportErrorInit, ValidationError, WalletAccountMismatchError, WalletChainMismatchError, WalletDisconnectedError, isDomfiError } from '@domfi/sdk/errors';
10
+ import { SdkCompatibilityReport } from './contracts.js';
11
+ import { ReferralClient } from './referrals.js';
12
+ import { TokenClient } from './token.js';
13
+ import { V as ValuationClient, d as ValuationClientNoApi } from './types-DhCzEwnS.js';
14
+ import { k as VaultClient } from './types-veTDfbhq.js';
15
+ export { Address, Brand, ClosePercent, Collateral, DecimalInput, DecimalString, FeePercent, FormatOptions, Hex, IsoTimestamp, Leverage, Notional, NumberBrandCodec, OrderId, PairIndex, Precision2Percent, Price, Ratio, RatioCodec, ScaleP2, SignedCollateral, SignedP18, SignedP6, SlippagePercent, StringBrandCodec, TimeInput, TradeId, TradeIndex, TriggerOrderIndex, TriggerOrderIndexCodec, UnitCodec, UnixMs, UnsignedP18, UsdP6, VaultAsset, VaultShare, VaultSharePrice, WholePercent, parseDecimalString } from '@domfi/sdk/units';
16
+ import './units-BYd75H7U.js';
17
+ import './errors.js';
18
+ import 'viem';
19
+
20
+ /** HTTP request shape passed to a custom SDK REST transport. */
21
+ type DomfiHttpRequest = {
22
+ method: "GET" | "POST";
23
+ url: string;
24
+ headers?: Record<string, string>;
25
+ body?: string;
26
+ signal?: AbortSignal;
27
+ timeoutMs?: number;
28
+ };
29
+ /** HTTP response shape returned by a custom SDK REST transport. */
30
+ type DomfiHttpResponse = {
31
+ status: number;
32
+ headers: Headers | Record<string, string>;
33
+ body: string;
34
+ };
35
+ /** Custom HTTP transport hook for REST API calls. */
36
+ type IRequestTransport = (request: DomfiHttpRequest) => Promise<DomfiHttpResponse>;
37
+ /** REST API configuration for API-enabled SDK clients. */
38
+ type ApiClientOptions = {
39
+ /** Override the selected chain profile's REST API base URL. */
40
+ baseUrl?: string;
41
+ /** Custom HTTP request implementation for runtimes without global `fetch` or for tests. */
42
+ requestTransport?: IRequestTransport;
43
+ /** Default REST request timeout in milliseconds. */
44
+ defaultTimeoutMs?: number;
45
+ };
46
+ /** Observable REST transport event emitted through `createDomfiClient({ onEvent })`. */
47
+ type ApiTransportEvent = {
48
+ type: "rest_request";
49
+ diagnostics: DiagnosticsEnvelope;
50
+ url: string;
51
+ } | {
52
+ type: "rest_response";
53
+ diagnostics: DiagnosticsEnvelope;
54
+ url: string;
55
+ status: number;
56
+ };
57
+
58
+ /**
59
+ * Observable, non-fatal SDK events emitted through `createDomfiClient({ onEvent })`.
60
+ *
61
+ * Today this covers REST transport diagnostics and read-plane readiness warnings.
62
+ * Handler exceptions are ignored so observability code cannot change SDK behavior.
63
+ */
64
+ type DomfiEvent = ApiTransportEvent | ReadinessWarningEvent;
65
+ /**
66
+ * REST/RPC concurrency and retry controls for SDK-managed transport calls.
67
+ *
68
+ * These controls only wrap calls the SDK initiates. They do not change retry or
69
+ * batching behavior inside a user-provided viem client.
70
+ */
71
+ type DomfiTransportOptions = {
72
+ /** Maximum number of concurrent SDK REST API requests. Must be a positive integer. */
73
+ maxConcurrentRest?: number;
74
+ /** Maximum number of concurrent SDK-issued viem public/wallet client calls. Must be a positive integer. */
75
+ maxConcurrentRpc?: number;
76
+ /**
77
+ * Maximum REST retry attempts per request for transient REST failures.
78
+ * Must be a non-negative integer. Defaults to 0, applies only to REST requests,
79
+ * and does not retry RPC/wallet calls. Retries use abort-aware exponential
80
+ * backoff with jitter and honor `Retry-After` on HTTP 429 responses.
81
+ * Transient REST failures are transport failures, timeouts with remaining timeout budget,
82
+ * HTTP 429/5xx responses, or structured API errors with retryable:true. Structured API
83
+ * errors with retryable:false suppress retries even for HTTP 429/5xx responses.
84
+ */
85
+ retryBudget?: number;
86
+ };
87
+ /**
88
+ * Shared options for all DomFi SDK client modes.
89
+ *
90
+ * Use `api: false` for an RPC-only client, or omit `api`/pass `api` options for
91
+ * the full client with REST reads, referrals, vault reads, and high-level actions.
92
+ */
93
+ type CreateDomfiClientBaseOptions = {
94
+ /** Target DomFi deployment, by name, chain id, or custom chain profile. */
95
+ chain: DomfiChain | DomfiChainProfile;
96
+ /** viem-compatible public client used for reads, simulations, and receipt polling. */
97
+ publicClient?: PublicClient;
98
+ /** viem-compatible wallet client used for transaction sending. */
99
+ walletClient?: WalletClient;
100
+ /** Default wallet address for account-scoped operations. */
101
+ account?: Address;
102
+ /** Optional concurrency and retry controls. */
103
+ transport?: DomfiTransportOptions;
104
+ /** Observer hook for non-fatal SDK events. Handler failures are ignored. */
105
+ onEvent?: (event: DomfiEvent) => void;
106
+ };
107
+ /**
108
+ * Options for a full SDK client with REST API access enabled.
109
+ *
110
+ * Built-in mainnet and testnet profiles include default REST API URLs.
111
+ * Pass `api.baseUrl` to override the selected chain profile's `apiBaseUrl`.
112
+ */
113
+ type CreateDomfiClientWithApiOptions = CreateDomfiClientBaseOptions & {
114
+ api?: ApiClientOptions;
115
+ };
116
+ /**
117
+ * Options for an RPC-only SDK client.
118
+ *
119
+ * Set `api: false` to omit REST-dependent clients such as `api`, `raw`,
120
+ * `actions`, `vault`, and `referrals`.
121
+ */
122
+ type CreateDomfiClientNoApiOptions = CreateDomfiClientBaseOptions & {
123
+ api: false;
124
+ };
125
+ type CreateDomfiClientOptions = CreateDomfiClientWithApiOptions | CreateDomfiClientNoApiOptions;
126
+ /** System metadata client available on API-enabled SDK clients. */
127
+ type SystemClient = {
128
+ /** Returns the SDK/contract compatibility report bundled with this package. */
129
+ sdkCompatibility(opts?: ReadOptions): Promise<SdkCompatibilityReport>;
130
+ /** Reads the REST API status endpoint and maps it into the SDK result envelope. */
131
+ apiStatus(opts?: ReadOptions): Promise<ResultEnvelope<ApiStatus>>;
132
+ };
133
+ /** System metadata client available when REST API access is disabled. */
134
+ type SystemClientNoApi = {
135
+ /** Returns the SDK/contract compatibility report bundled with this package. */
136
+ sdkCompatibility(opts?: ReadOptions): Promise<SdkCompatibilityReport>;
137
+ };
138
+ /**
139
+ * SDK client returned by `createDomfiClient` when `api: false` is used.
140
+ *
141
+ * This mode keeps onchain helpers available but intentionally omits all REST
142
+ * read-plane clients and high-level action helpers that depend on REST data.
143
+ */
144
+ type DomfiClientNoApi = {
145
+ /** Resolved DomFi chain profile used by this client. */
146
+ chain: DomfiChainProfile;
147
+ /** Collateral token reads and approvals. */
148
+ token: TokenClient;
149
+ /** Delegated trading wallet helpers. */
150
+ delegation: DelegationClient;
151
+ /** RPC-backed trading preparation and sending helpers. */
152
+ trading: TradingClientNoApi;
153
+ /** RPC-only valuation helpers. */
154
+ valuation: ValuationClientNoApi;
155
+ /** SDK/system metadata helpers available without REST API access. */
156
+ system: SystemClientNoApi;
157
+ };
158
+ /**
159
+ * Full SDK client returned by `createDomfiClient` when REST API access is enabled.
160
+ *
161
+ * Includes REST domain reads, raw REST access, referrals, vault reads/writes,
162
+ * and high-level action handles in addition to onchain trading and valuation.
163
+ */
164
+ type DomfiClient = {
165
+ /** Resolved DomFi chain profile used by this client. */
166
+ chain: DomfiChainProfile;
167
+ /** Collateral token reads and approvals. */
168
+ token: TokenClient;
169
+ /** Delegated trading wallet helpers. */
170
+ delegation: DelegationClient;
171
+ /** Trading preparation, sending, and tracking helpers. */
172
+ trading: TradingClient;
173
+ /** REST-assisted valuation helpers. */
174
+ valuation: ValuationClient;
175
+ /** SDK/system metadata helpers. */
176
+ system: SystemClient;
177
+ /** Mapped high-level REST read client. */
178
+ api: DomfiInfoClient;
179
+ /** Raw REST route client. */
180
+ raw: DomfiRawClient;
181
+ /** High-level action client that starts/stages full trading and vault flows. */
182
+ actions: DomfiActionsClient;
183
+ /** Vault reads, preparation helpers, and direct send helpers. */
184
+ vault: VaultClient;
185
+ /** Referral read helpers. */
186
+ referrals: ReferralClient;
187
+ };
188
+ /**
189
+ * Creates a DomFi SDK client for a DomFi deployment.
190
+ *
191
+ * Omitting `api` creates a full client with REST reads plus transaction helpers.
192
+ * Passing `api: false` creates an RPC-only client for preparing, sending, and
193
+ * tracking transactions without REST API dependencies.
194
+ *
195
+ * The returned type narrows from the `api` option: `api: false` returns
196
+ * `DomfiClientNoApi`; all other calls return the full `DomfiClient`.
197
+ *
198
+ * @example
199
+ * ```ts
200
+ * const domfi = createDomfiClient({ chain: "mainnet", publicClient, walletClient });
201
+ * await domfi.system.apiStatus();
202
+ * ```
203
+ *
204
+ * @example
205
+ * ```ts
206
+ * const rpcOnly = createDomfiClient({ chain: "mainnet", publicClient, api: false });
207
+ * await rpcOnly.trading.prepareOpenTrade(params);
208
+ * ```
209
+ *
210
+ * @throws {ValidationError} When the chain, API base URL, or transport options are invalid.
211
+ */
212
+ declare function createDomfiClient(options: CreateDomfiClientNoApiOptions): DomfiClientNoApi;
213
+ declare function createDomfiClient(options: CreateDomfiClientWithApiOptions): DomfiClient;
214
+ declare function createDomfiClient<T extends CreateDomfiClientOptions>(options: T): T extends CreateDomfiClientNoApiOptions ? DomfiClientNoApi : DomfiClient;
215
+
216
+ export { type ApiClientOptions, type CreateDomfiClientBaseOptions, type CreateDomfiClientNoApiOptions, type CreateDomfiClientOptions, type CreateDomfiClientWithApiOptions, DomfiChain, DomfiChainProfile, type DomfiClient, type DomfiClientNoApi, type DomfiEvent, type DomfiHttpRequest, type DomfiHttpResponse, type DomfiTransportOptions, type IRequestTransport, type SystemClient, type SystemClientNoApi, createDomfiClient };