@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,464 @@
1
+ import { T as TransactionReceipt, W as WaitReceiptOptions, a as TrackResult, D as DelegationTarget } from './types-DJBX-p4X.cjs';
2
+ import { Address, Collateral, Hex, VaultAsset, VaultShare, OrderId, ClosePercent, SlippagePercent, Price, PairIndex, Leverage, TradeIndex } from './units.cjs';
3
+ import { R as ReadOptions, a as ReceiptVerifiedOpenTriggerOrderRef, V as VerifiedPositionRef, O as OpenAccountPosition, b as VerifiedOpenTriggerOrderRef, c as OpenTriggerAccountOrder, d as ApiVerifiedOpenTriggerOrderRef } from './types-DQft82W7.cjs';
4
+ import { U as UsdP6, P as PercentP6 } from './units-BYd75H7U.cjs';
5
+ import { ReferralCodeIdInput } from './referrals.cjs';
6
+ import { V as VaultVerb, a as VaultOutcomeForVerb, b as VaultDepositParams, c as VaultMintParams, d as VaultMakeWithdrawRequestParams, e as VaultCancelWithdrawRequestParams, f as VaultWithdrawParams, g as VaultRedeemParams, h as VaultDepositWithDiscountAndLockParams, i as VaultMintWithDiscountAndLockParams, j as VaultUnlockDepositParams } from './types-x1MvxSdy.cjs';
7
+
8
+ /** Approval behavior used by high-level actions before sending a transaction. */
9
+ declare const ActionApprovalPolicy: {
10
+ readonly RequireExisting: "requireExisting";
11
+ readonly AutoExact: "autoExact";
12
+ readonly UnsafeMaxUint256: "unsafeMaxUint256";
13
+ };
14
+ /** Approval behavior used by high-level actions before sending a transaction. */
15
+ type ActionApprovalPolicy = (typeof ActionApprovalPolicy)[keyof typeof ActionApprovalPolicy];
16
+ /** Simulation behavior used by high-level actions before sending a transaction. */
17
+ declare const ActionSimulationPolicy: {
18
+ readonly Required: "required";
19
+ readonly Skip: "skip";
20
+ };
21
+ /** Simulation behavior used by high-level actions before sending a transaction. */
22
+ type ActionSimulationPolicy = (typeof ActionSimulationPolicy)[keyof typeof ActionSimulationPolicy];
23
+ /** 6-decimal USD notional input for high-level open actions. */
24
+ type NotionalUsdInput = UsdP6;
25
+ /** 2-decimal leverage input for high-level open actions. */
26
+ type LeverageInput = Leverage;
27
+ /** 2-decimal slippage input for high-level market actions. */
28
+ type SlippageInput = SlippagePercent;
29
+ /** 6-decimal percentage input used for trigger derivation. */
30
+ type PercentInput = PercentP6;
31
+ /** High-level trading action name. */
32
+ type TradingActionName = "openMarket" | "openLimit" | "openStop" | "closePosition" | "updateTakeProfit" | "updateStopLoss" | "topUpCollateral" | "removeCollateral" | "updateTriggerOrder" | "cancelTriggerOrder";
33
+ /** High-level vault action name. */
34
+ type VaultActionName = "vaultDeposit" | "vaultMint" | "vaultMakeWithdrawRequest" | "vaultCancelWithdrawRequest" | "vaultWithdraw" | "vaultRedeem" | "vaultDepositWithDiscountAndLock" | "vaultMintWithDiscountAndLock" | "vaultUnlockDeposit";
35
+ /** Any high-level action name. */
36
+ type ActionName = TradingActionName | VaultActionName;
37
+ /** Mutually exclusive sizing input: choose either notional USD or collateral. */
38
+ type OpenSizingInput = {
39
+ notionalUsd: NotionalUsdInput;
40
+ collateral?: never;
41
+ } | {
42
+ collateral: Collateral;
43
+ notionalUsd?: never;
44
+ };
45
+ type ReferralTaggedActionParams = {
46
+ referralCodeId?: ReferralCodeIdInput;
47
+ };
48
+ /** High-level market-open action parameters. */
49
+ type OpenMarketActionParams = OpenSizingInput & ReferralTaggedActionParams & {
50
+ pairIndex: PairIndex;
51
+ direction: "long" | "short";
52
+ leverage: LeverageInput;
53
+ slippage: SlippageInput;
54
+ takeProfit?: Price;
55
+ stopLoss?: Price;
56
+ };
57
+ /** Trigger value input for setting a take-profit or stop-loss. */
58
+ type TriggerSetValueInput = Price | {
59
+ pnlPercent: PercentInput;
60
+ priceDeltaPercent?: never;
61
+ clear?: never;
62
+ } | {
63
+ priceDeltaPercent: PercentInput;
64
+ pnlPercent?: never;
65
+ clear?: never;
66
+ };
67
+ /** Trigger value input for clearing a take-profit or stop-loss. */
68
+ type TriggerClearInput = {
69
+ clear: true;
70
+ pnlPercent?: never;
71
+ priceDeltaPercent?: never;
72
+ };
73
+ /** Trigger value input for setting or clearing a take-profit or stop-loss. */
74
+ type TriggerUpdateValueInput = TriggerSetValueInput | TriggerClearInput;
75
+ /** High-level limit-open action parameters. */
76
+ type OpenLimitActionParams = OpenSizingInput & ReferralTaggedActionParams & {
77
+ pairIndex: PairIndex;
78
+ direction: "long" | "short";
79
+ leverage: LeverageInput;
80
+ takeProfit?: TriggerSetValueInput;
81
+ stopLoss?: TriggerSetValueInput;
82
+ entryPrice: Price;
83
+ slippage?: never;
84
+ };
85
+ /** High-level stop-open action parameters. */
86
+ type OpenStopActionParams = OpenSizingInput & ReferralTaggedActionParams & {
87
+ pairIndex: PairIndex;
88
+ direction: "long" | "short";
89
+ leverage: LeverageInput;
90
+ takeProfit?: TriggerSetValueInput;
91
+ stopLoss?: TriggerSetValueInput;
92
+ triggerPrice: Price;
93
+ slippage?: never;
94
+ };
95
+ /** Collateral adjustment amount for top-up and remove-collateral actions. */
96
+ type CollateralAdjustmentActionParams = {
97
+ collateral: Collateral;
98
+ };
99
+ /** High-level close-position action parameters. */
100
+ type ClosePositionActionParams = {
101
+ closePercent?: ClosePercent;
102
+ slippage: SlippageInput;
103
+ wantedPrice?: Price;
104
+ };
105
+ /** Position input accepted by high-level actions before reference resolution. */
106
+ type PositionInput = VerifiedPositionRef | OpenAccountPosition | {
107
+ pairIndex: PairIndex;
108
+ tradeIndex: TradeIndex;
109
+ wallet?: Address;
110
+ };
111
+ /** Account order narrowed to include a verified trigger order reference. */
112
+ type VerifiedOpenTriggerAccountOrder = OpenTriggerAccountOrder & {
113
+ verifiedRef: ApiVerifiedOpenTriggerOrderRef;
114
+ };
115
+ /** Trigger order input accepted by high-level update/cancel actions. */
116
+ type TriggerOrderInput = VerifiedOpenTriggerOrderRef | VerifiedOpenTriggerAccountOrder;
117
+ /** High-level trigger-order update parameters. */
118
+ type UpdateTriggerOrderActionParams = {
119
+ targetPrice: Price;
120
+ takeProfit?: TriggerUpdateValueInput;
121
+ stopLoss?: TriggerUpdateValueInput;
122
+ };
123
+ /** High-level vault deposit action parameters. */
124
+ type VaultDepositActionParams = VaultDepositParams;
125
+ /** High-level vault mint action parameters. */
126
+ type VaultMintActionParams = VaultMintParams;
127
+ /** High-level vault withdrawal-request action parameters. */
128
+ type VaultMakeWithdrawRequestActionParams = VaultMakeWithdrawRequestParams;
129
+ /** High-level vault cancel-withdrawal-request action parameters. */
130
+ type VaultCancelWithdrawRequestActionParams = VaultCancelWithdrawRequestParams;
131
+ /** High-level vault withdraw action parameters. */
132
+ type VaultWithdrawActionParams = VaultWithdrawParams;
133
+ /** High-level vault redeem action parameters. */
134
+ type VaultRedeemActionParams = VaultRedeemParams;
135
+ /** High-level discounted locked vault deposit action parameters. */
136
+ type VaultDepositWithDiscountAndLockActionParams = VaultDepositWithDiscountAndLockParams;
137
+ /** High-level discounted locked vault mint action parameters. */
138
+ type VaultMintWithDiscountAndLockActionParams = VaultMintWithDiscountAndLockParams;
139
+ /** High-level vault unlock-deposit action parameters. */
140
+ type VaultUnlockDepositActionParams = VaultUnlockDepositParams;
141
+ /** Common initiation options for high-level vault actions. */
142
+ type VaultActionOptions = {
143
+ account?: Address;
144
+ approval?: ActionApprovalPolicy;
145
+ simulation?: ActionSimulationPolicy;
146
+ signal?: AbortSignal;
147
+ };
148
+ type BaseActionInitiationOptions = {
149
+ account?: Address;
150
+ approval?: ActionApprovalPolicy;
151
+ simulation?: ActionSimulationPolicy;
152
+ maxOracleFeeWei?: bigint;
153
+ signal?: AbortSignal;
154
+ };
155
+ /** Initiation options for direct high-level trading actions. */
156
+ type DirectActionInitiationOptions = BaseActionInitiationOptions & {
157
+ delegation?: never;
158
+ };
159
+ /** Initiation options for delegated high-level trading actions. */
160
+ type DelegatedActionInitiationOptions = Omit<BaseActionInitiationOptions, "approval"> & {
161
+ delegation: DelegationTarget;
162
+ approval?: typeof ActionApprovalPolicy.RequireExisting;
163
+ };
164
+ /** Initiation options for high-level trading actions. */
165
+ type ActionInitiationOptions = DirectActionInitiationOptions | DelegatedActionInitiationOptions;
166
+ /** Receipt wait controls for high-level action handles. */
167
+ type ActionWaitOptions = WaitReceiptOptions;
168
+ /** Tracking controls for high-level action handles. */
169
+ type ActionTrackOptions = {
170
+ signal?: AbortSignal;
171
+ timeoutMs?: number;
172
+ readinessPolicy?: NonNullable<ReadOptions["readinessPolicy"]>;
173
+ confirmations?: number;
174
+ pollingIntervalMs?: number;
175
+ intervalMs?: number;
176
+ maxAttempts?: number;
177
+ maxDurationMs?: number;
178
+ account?: never;
179
+ expectedTradeId?: never;
180
+ verb?: never;
181
+ pairIndex?: never;
182
+ initiatedTradeId?: never;
183
+ terminalTradeId?: never;
184
+ };
185
+ /** Receipt event evidence used to confirm receipt-only actions. */
186
+ type ReceiptEventEvidence = {
187
+ eventName: string;
188
+ transactionHash: Hex;
189
+ logIndex: number;
190
+ blockNumber?: bigint;
191
+ };
192
+ /** Approval transaction evidence for high-level trading actions. */
193
+ type ActionApprovalEvidence = {
194
+ policy: typeof ActionApprovalPolicy.AutoExact | typeof ActionApprovalPolicy.UnsafeMaxUint256;
195
+ token: Address;
196
+ spender: Address;
197
+ requiredAllowance: Collateral;
198
+ approvedAllowance: Collateral;
199
+ hash: Hex;
200
+ receipt: TransactionReceipt;
201
+ };
202
+ /** Approval transaction evidence for high-level vault actions. */
203
+ type VaultActionApprovalEvidence = {
204
+ kind: "asset";
205
+ policy: typeof ActionApprovalPolicy.AutoExact | typeof ActionApprovalPolicy.UnsafeMaxUint256;
206
+ token: Address;
207
+ owner: Address;
208
+ spender: Address;
209
+ requiredAllowance: VaultAsset;
210
+ approvedAllowance: VaultAsset;
211
+ hash: Hex;
212
+ receipt: TransactionReceipt;
213
+ } | {
214
+ kind: "share";
215
+ policy: typeof ActionApprovalPolicy.AutoExact | typeof ActionApprovalPolicy.UnsafeMaxUint256;
216
+ token: Address;
217
+ owner: Address;
218
+ spender: Address;
219
+ requiredAllowance: VaultShare;
220
+ approvedAllowance: VaultShare;
221
+ hash: Hex;
222
+ receipt: TransactionReceipt;
223
+ };
224
+ type ActionApprovalEvidenceMap = {
225
+ [Name in TradingActionName]: ActionApprovalEvidence;
226
+ } & {
227
+ vaultDeposit: Extract<VaultActionApprovalEvidence, {
228
+ kind: "asset";
229
+ }>;
230
+ vaultMint: Extract<VaultActionApprovalEvidence, {
231
+ kind: "asset";
232
+ }>;
233
+ vaultMakeWithdrawRequest: Extract<VaultActionApprovalEvidence, {
234
+ kind: "share";
235
+ }>;
236
+ vaultCancelWithdrawRequest: Extract<VaultActionApprovalEvidence, {
237
+ kind: "share";
238
+ }>;
239
+ vaultWithdraw: Extract<VaultActionApprovalEvidence, {
240
+ kind: "share";
241
+ }>;
242
+ vaultRedeem: Extract<VaultActionApprovalEvidence, {
243
+ kind: "share";
244
+ }>;
245
+ vaultDepositWithDiscountAndLock: Extract<VaultActionApprovalEvidence, {
246
+ kind: "asset";
247
+ }>;
248
+ vaultMintWithDiscountAndLock: Extract<VaultActionApprovalEvidence, {
249
+ kind: "asset";
250
+ }>;
251
+ vaultUnlockDeposit: never;
252
+ };
253
+ /** Approval evidence returned for a specific high-level action name. */
254
+ type ActionApprovalEvidenceFor<Name extends ActionName> = ActionApprovalEvidenceMap[Name];
255
+ type BaseActionOutcome<Name extends ActionName> = {
256
+ action: Name;
257
+ hash: Hex;
258
+ };
259
+ type MarketActionName = "openMarket" | "closePosition" | "removeCollateral";
260
+ type PositionRefBranch<Action extends "closePosition" | "removeCollateral"> = {
261
+ action: Action;
262
+ positionRef: VerifiedPositionRef;
263
+ };
264
+ type MarketActionOutcome<Name extends MarketActionName> = (BaseActionOutcome<Name> & {
265
+ status: "submitted";
266
+ }) | (BaseActionOutcome<Name> & {
267
+ status: "executed";
268
+ receipt: TransactionReceipt;
269
+ result: Extract<TrackResult, {
270
+ status: "executed";
271
+ }>;
272
+ }) | (BaseActionOutcome<Name> & {
273
+ status: "timeout_available";
274
+ canHandleTimeout: true;
275
+ receipt: TransactionReceipt;
276
+ result: Extract<TrackResult, {
277
+ status: "timeout_available";
278
+ }>;
279
+ }) | (BaseActionOutcome<Name> & {
280
+ status: "canceled" | "timed_out" | "identity_mismatch";
281
+ result: TrackResult;
282
+ }) | (BaseActionOutcome<Name> & {
283
+ status: "unknown";
284
+ result?: TrackResult;
285
+ });
286
+ type WithPositionRef<Name extends MarketActionName, Outcome> = Name extends "closePosition" | "removeCollateral" ? Outcome & PositionRefBranch<Name> : Outcome;
287
+ type TriggerPlacementActionOutcome<Action extends "openLimit" | "openStop"> = BaseActionOutcome<Action> & {
288
+ status: "placed";
289
+ receipt: TransactionReceipt;
290
+ ref: ReceiptVerifiedOpenTriggerOrderRef;
291
+ };
292
+ type ReceiptOnlyActionName = "updateTakeProfit" | "updateStopLoss" | "topUpCollateral" | "updateTriggerOrder" | "cancelTriggerOrder";
293
+ type ConfirmedActionOutcome<Action extends ReceiptOnlyActionName> = BaseActionOutcome<Action> & {
294
+ status: "confirmed";
295
+ receipt: TransactionReceipt;
296
+ eventEvidence: ReceiptEventEvidence;
297
+ };
298
+ /** Outcome returned by an `openMarket` action handle. */
299
+ type OpenMarketActionOutcome = MarketActionOutcome<"openMarket">;
300
+ /** Outcome returned by an `openLimit` action handle. */
301
+ type OpenLimitActionOutcome = TriggerPlacementActionOutcome<"openLimit">;
302
+ /** Outcome returned by an `openStop` action handle. */
303
+ type OpenStopActionOutcome = TriggerPlacementActionOutcome<"openStop">;
304
+ /** Outcome returned by a `closePosition` action handle. */
305
+ type ClosePositionActionOutcome = WithPositionRef<"closePosition", MarketActionOutcome<"closePosition">>;
306
+ /** Outcome returned by an `updateTakeProfit` action handle. */
307
+ type UpdateTakeProfitActionOutcome = ConfirmedActionOutcome<"updateTakeProfit">;
308
+ /** Outcome returned by an `updateStopLoss` action handle. */
309
+ type UpdateStopLossActionOutcome = ConfirmedActionOutcome<"updateStopLoss">;
310
+ /** Outcome returned by a `topUpCollateral` action handle. */
311
+ type TopUpCollateralActionOutcome = ConfirmedActionOutcome<"topUpCollateral">;
312
+ /** Outcome returned by a `removeCollateral` action handle. */
313
+ type RemoveCollateralActionOutcome = WithPositionRef<"removeCollateral", MarketActionOutcome<"removeCollateral">>;
314
+ /** Outcome returned by an `updateTriggerOrder` action handle. */
315
+ type UpdateTriggerOrderActionOutcome = ConfirmedActionOutcome<"updateTriggerOrder">;
316
+ /** Outcome returned by a `cancelTriggerOrder` action handle. */
317
+ type CancelTriggerOrderActionOutcome = ConfirmedActionOutcome<"cancelTriggerOrder">;
318
+ type VaultConfirmedActionOutcome<Name extends VaultActionName, Verb extends VaultVerb> = BaseActionOutcome<Name> & {
319
+ status: "confirmed";
320
+ receipt: TransactionReceipt;
321
+ vault: {
322
+ verb: Verb;
323
+ outcome: VaultOutcomeForVerb<Verb>;
324
+ };
325
+ };
326
+ /** Outcome returned by a vault deposit action handle. */
327
+ type VaultDepositActionOutcome = VaultConfirmedActionOutcome<"vaultDeposit", "deposit">;
328
+ /** Outcome returned by a vault mint action handle. */
329
+ type VaultMintActionOutcome = VaultConfirmedActionOutcome<"vaultMint", "mint">;
330
+ /** Outcome returned by a vault withdrawal-request action handle. */
331
+ type VaultMakeWithdrawRequestActionOutcome = VaultConfirmedActionOutcome<"vaultMakeWithdrawRequest", "makeWithdrawRequest">;
332
+ /** Outcome returned by a vault cancel-withdrawal-request action handle. */
333
+ type VaultCancelWithdrawRequestActionOutcome = VaultConfirmedActionOutcome<"vaultCancelWithdrawRequest", "cancelWithdrawRequest">;
334
+ /** Outcome returned by a vault withdraw action handle. */
335
+ type VaultWithdrawActionOutcome = VaultConfirmedActionOutcome<"vaultWithdraw", "withdraw">;
336
+ /** Outcome returned by a vault redeem action handle. */
337
+ type VaultRedeemActionOutcome = VaultConfirmedActionOutcome<"vaultRedeem", "redeem">;
338
+ /** Outcome returned by a discounted locked vault deposit action handle. */
339
+ type VaultDepositWithDiscountAndLockActionOutcome = VaultConfirmedActionOutcome<"vaultDepositWithDiscountAndLock", "depositWithDiscountAndLock">;
340
+ /** Outcome returned by a discounted locked vault mint action handle. */
341
+ type VaultMintWithDiscountAndLockActionOutcome = VaultConfirmedActionOutcome<"vaultMintWithDiscountAndLock", "mintWithDiscountAndLock">;
342
+ /** Outcome returned by a vault unlock-deposit action handle. */
343
+ type VaultUnlockDepositActionOutcome = VaultConfirmedActionOutcome<"vaultUnlockDeposit", "unlockDeposit">;
344
+ type ActionOutcomeMap = {
345
+ openMarket: OpenMarketActionOutcome;
346
+ openLimit: OpenLimitActionOutcome;
347
+ openStop: OpenStopActionOutcome;
348
+ closePosition: ClosePositionActionOutcome;
349
+ updateTakeProfit: UpdateTakeProfitActionOutcome;
350
+ updateStopLoss: UpdateStopLossActionOutcome;
351
+ topUpCollateral: TopUpCollateralActionOutcome;
352
+ removeCollateral: RemoveCollateralActionOutcome;
353
+ updateTriggerOrder: UpdateTriggerOrderActionOutcome;
354
+ cancelTriggerOrder: CancelTriggerOrderActionOutcome;
355
+ vaultDeposit: VaultDepositActionOutcome;
356
+ vaultMint: VaultMintActionOutcome;
357
+ vaultMakeWithdrawRequest: VaultMakeWithdrawRequestActionOutcome;
358
+ vaultCancelWithdrawRequest: VaultCancelWithdrawRequestActionOutcome;
359
+ vaultWithdraw: VaultWithdrawActionOutcome;
360
+ vaultRedeem: VaultRedeemActionOutcome;
361
+ vaultDepositWithDiscountAndLock: VaultDepositWithDiscountAndLockActionOutcome;
362
+ vaultMintWithDiscountAndLock: VaultMintWithDiscountAndLockActionOutcome;
363
+ vaultUnlockDeposit: VaultUnlockDepositActionOutcome;
364
+ };
365
+ /** Outcome type returned for a specific high-level action name. */
366
+ type ActionOutcome<Name extends ActionName> = ActionOutcomeMap[Name];
367
+ type MarketWatchActionName = MarketActionName;
368
+ type CommonActionLifecycleState<Name extends ActionName> = {
369
+ phase: "submitted";
370
+ action: Name;
371
+ hash: Hex;
372
+ } | {
373
+ phase: "mined";
374
+ action: Name;
375
+ hash: Hex;
376
+ receipt: TransactionReceipt;
377
+ } | {
378
+ phase: "terminal";
379
+ action: Name;
380
+ hash: Hex;
381
+ outcome: ActionOutcome<Name>;
382
+ };
383
+ type MarketActionLifecycleState<Name extends MarketWatchActionName> = {
384
+ phase: "indexed";
385
+ action: Name;
386
+ hash: Hex;
387
+ orderId: OrderId;
388
+ } | {
389
+ phase: "tracking";
390
+ action: Name;
391
+ hash: Hex;
392
+ orderId: OrderId;
393
+ result: TrackResult;
394
+ } | {
395
+ phase: "unknown";
396
+ action: Name;
397
+ hash: Hex;
398
+ orderId?: OrderId;
399
+ result?: TrackResult;
400
+ };
401
+ /** Lifecycle state emitted by `ActionHandle.watch`. */
402
+ type ActionLifecycleState<Name extends ActionName> = Name extends ActionName ? CommonActionLifecycleState<Name> | (Name extends MarketWatchActionName ? MarketActionLifecycleState<Name> : never) : never;
403
+ /**
404
+ * Handle returned by `domfi.actions.*` methods.
405
+ *
406
+ * Creating an action handle starts/stages the action pipeline immediately. The accessor methods
407
+ * observe that same started operation; they do not turn the handle into an inert preview object.
408
+ */
409
+ type ActionHandle<Name extends ActionName> = {
410
+ readonly action: Name;
411
+ /** Resolves with approval evidence when the action performed an approval first. */
412
+ approval(): Promise<ActionApprovalEvidenceFor<Name> | undefined>;
413
+ /** Resolves with the main action transaction hash. */
414
+ txHash(): Promise<Hex>;
415
+ /** Waits for the main action transaction receipt. */
416
+ waitReceipt(opts?: ActionWaitOptions): Promise<TransactionReceipt>;
417
+ /** Resolves the terminal domain outcome for the action. */
418
+ outcome(opts?: ActionTrackOptions): Promise<ActionOutcome<Name>>;
419
+ /** Streams lifecycle states for the already-started action operation. */
420
+ watch(opts?: ActionTrackOptions): AsyncIterable<ActionLifecycleState<Name>>;
421
+ };
422
+ /** High-level action client available on API-enabled SDK clients. */
423
+ type DomfiActionsClient = {
424
+ /** Opens a market position, optionally approving collateral first. */
425
+ openMarket(params: OpenMarketActionParams, opts?: ActionInitiationOptions): ActionHandle<"openMarket">;
426
+ /** Places an open limit order. */
427
+ openLimit(params: OpenLimitActionParams, opts?: ActionInitiationOptions): ActionHandle<"openLimit">;
428
+ /** Places an open stop order. */
429
+ openStop(params: OpenStopActionParams, opts?: ActionInitiationOptions): ActionHandle<"openStop">;
430
+ /** Closes an existing position. */
431
+ closePosition(position: PositionInput, params: ClosePositionActionParams, opts?: ActionInitiationOptions): ActionHandle<"closePosition">;
432
+ /** Updates or clears a position take-profit trigger. */
433
+ updateTakeProfit(position: PositionInput, value: TriggerUpdateValueInput, opts?: ActionInitiationOptions): ActionHandle<"updateTakeProfit">;
434
+ /** Updates or clears a position stop-loss trigger. */
435
+ updateStopLoss(position: PositionInput, value: TriggerUpdateValueInput, opts?: ActionInitiationOptions): ActionHandle<"updateStopLoss">;
436
+ /** Adds collateral to an existing position. */
437
+ topUpCollateral(position: PositionInput, params: CollateralAdjustmentActionParams, opts?: ActionInitiationOptions): ActionHandle<"topUpCollateral">;
438
+ /** Removes collateral from an existing position. */
439
+ removeCollateral(position: PositionInput, params: CollateralAdjustmentActionParams, opts?: ActionInitiationOptions): ActionHandle<"removeCollateral">;
440
+ /** Updates an open limit/stop trigger order. */
441
+ updateTriggerOrder(order: TriggerOrderInput, params: UpdateTriggerOrderActionParams, opts?: ActionInitiationOptions): ActionHandle<"updateTriggerOrder">;
442
+ /** Cancels an open limit/stop trigger order. */
443
+ cancelTriggerOrder(order: TriggerOrderInput, opts?: ActionInitiationOptions): ActionHandle<"cancelTriggerOrder">;
444
+ /** Deposits vault assets. */
445
+ vaultDeposit(params: VaultDepositActionParams, opts?: VaultActionOptions): ActionHandle<"vaultDeposit">;
446
+ /** Mints vault shares. */
447
+ vaultMint(params: VaultMintActionParams, opts?: VaultActionOptions): ActionHandle<"vaultMint">;
448
+ /** Requests a delayed vault withdrawal. */
449
+ vaultMakeWithdrawRequest(params: VaultMakeWithdrawRequestActionParams, opts?: VaultActionOptions): ActionHandle<"vaultMakeWithdrawRequest">;
450
+ /** Cancels a pending vault withdrawal request. */
451
+ vaultCancelWithdrawRequest(params: VaultCancelWithdrawRequestActionParams, opts?: VaultActionOptions): ActionHandle<"vaultCancelWithdrawRequest">;
452
+ /** Withdraws vault assets after a withdrawal request becomes unlockable. */
453
+ vaultWithdraw(params: VaultWithdrawActionParams, opts?: VaultActionOptions): ActionHandle<"vaultWithdraw">;
454
+ /** Redeems vault shares after a withdrawal request becomes unlockable. */
455
+ vaultRedeem(params: VaultRedeemActionParams, opts?: VaultActionOptions): ActionHandle<"vaultRedeem">;
456
+ /** Deposits vault assets into a discounted locked deposit. */
457
+ vaultDepositWithDiscountAndLock(params: VaultDepositWithDiscountAndLockActionParams, opts?: VaultActionOptions): ActionHandle<"vaultDepositWithDiscountAndLock">;
458
+ /** Mints vault shares into a discounted locked deposit. */
459
+ vaultMintWithDiscountAndLock(params: VaultMintWithDiscountAndLockActionParams, opts?: VaultActionOptions): ActionHandle<"vaultMintWithDiscountAndLock">;
460
+ /** Unlocks a matured locked vault deposit. */
461
+ vaultUnlockDeposit(params: VaultUnlockDepositActionParams, opts?: VaultActionOptions): ActionHandle<"vaultUnlockDeposit">;
462
+ };
463
+
464
+ export { type VaultMakeWithdrawRequestActionParams as $, type ActionApprovalEvidence as A, type TriggerSetValueInput as B, type CancelTriggerOrderActionOutcome as C, type DelegatedActionInitiationOptions as D, type TriggerUpdateValueInput as E, type UpdateTakeProfitActionOutcome as F, type UpdateTriggerOrderActionOutcome as G, type UpdateTriggerOrderActionParams as H, type VaultActionApprovalEvidence as I, type VaultActionName as J, type VaultActionOptions as K, type LeverageInput as L, type VaultCancelWithdrawRequestActionOutcome as M, type NotionalUsdInput as N, type OpenLimitActionOutcome as O, type PercentInput as P, type VaultCancelWithdrawRequestActionParams as Q, type ReceiptEventEvidence as R, type SlippageInput as S, type TopUpCollateralActionOutcome as T, type UpdateStopLossActionOutcome as U, type VerifiedOpenTriggerAccountOrder as V, type VaultDepositActionOutcome as W, type VaultDepositActionParams as X, type VaultDepositWithDiscountAndLockActionOutcome as Y, type VaultDepositWithDiscountAndLockActionParams as Z, type VaultMakeWithdrawRequestActionOutcome as _, type ActionApprovalEvidenceFor as a, type VaultMintActionOutcome as a0, type VaultMintActionParams as a1, type VaultMintWithDiscountAndLockActionOutcome as a2, type VaultMintWithDiscountAndLockActionParams as a3, type VaultRedeemActionOutcome as a4, type VaultRedeemActionParams as a5, type VaultUnlockDepositActionOutcome as a6, type VaultUnlockDepositActionParams as a7, type VaultWithdrawActionOutcome as a8, type VaultWithdrawActionParams as a9, ActionApprovalPolicy as b, type ActionHandle as c, type ActionInitiationOptions as d, type ActionLifecycleState as e, type ActionName as f, type ActionOutcome as g, ActionSimulationPolicy as h, type ActionTrackOptions as i, type ActionWaitOptions as j, type ClosePositionActionOutcome as k, type ClosePositionActionParams as l, type CollateralAdjustmentActionParams as m, type DirectActionInitiationOptions as n, type DomfiActionsClient as o, type OpenLimitActionParams as p, type OpenMarketActionOutcome as q, type OpenMarketActionParams as r, type OpenSizingInput as s, type OpenStopActionOutcome as t, type OpenStopActionParams as u, type PositionInput as v, type RemoveCollateralActionOutcome as w, type TradingActionName as x, type TriggerClearInput as y, type TriggerOrderInput as z };