@owney/sdk 0.7.23-beta.1 → 0.7.24-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +290 -831
- package/dist/index.d.cts +77 -247
- package/dist/index.d.ts +77 -247
- package/dist/index.js +272 -813
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,135 +1,5 @@
|
|
|
1
1
|
import { SIWXConfig } from '@reown/appkit-controllers';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* Swap-to-yield types (ROUT-242).
|
|
5
|
-
*
|
|
6
|
-
* The SDK never talks to 1inch directly — the API key is a paid credential and
|
|
7
|
-
* lives in the routing API. Everything here describes the routing API's
|
|
8
|
-
* `/api/v1/swap/*` contract.
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* Which rail a swap rides, decided server-side from the chains.
|
|
12
|
-
*
|
|
13
|
-
* `classic` — same chain. One atomic transaction: it either completes or
|
|
14
|
-
* nothing moved.
|
|
15
|
-
*
|
|
16
|
-
* `fusion-plus` — crossing chains. The user's funds sit in an escrow while a
|
|
17
|
-
* resolver fills the other side, so the order has a lifecycle and can end in
|
|
18
|
-
* `expired` → `refunding` → `refunded` without ever depositing.
|
|
19
|
-
*/
|
|
20
|
-
type SwapRail = "classic" | "fusion-plus";
|
|
21
|
-
type SwapTokenInfo = {
|
|
22
|
-
readonly symbol: string;
|
|
23
|
-
readonly address: string;
|
|
24
|
-
readonly decimals: number;
|
|
25
|
-
/** Native asset (ETH). A swap SOURCE only — never a deposit target. */
|
|
26
|
-
readonly isNative?: true;
|
|
27
|
-
};
|
|
28
|
-
type SwapChainTokens = {
|
|
29
|
-
readonly chainId: number;
|
|
30
|
-
/** What the user may pay with. */
|
|
31
|
-
readonly sources: readonly SwapTokenInfo[];
|
|
32
|
-
/** What a swap may resolve into — what Owney actually deposits. */
|
|
33
|
-
readonly depositTargets: readonly SwapTokenInfo[];
|
|
34
|
-
};
|
|
35
|
-
type SwapQuote = {
|
|
36
|
-
rail: SwapRail;
|
|
37
|
-
src: {
|
|
38
|
-
chainId: number;
|
|
39
|
-
symbol: string;
|
|
40
|
-
address: string;
|
|
41
|
-
amount: string;
|
|
42
|
-
};
|
|
43
|
-
dst: {
|
|
44
|
-
chainId: number;
|
|
45
|
-
symbol: string;
|
|
46
|
-
address: string;
|
|
47
|
-
amount: string;
|
|
48
|
-
};
|
|
49
|
-
/**
|
|
50
|
-
* Worst-case output once the Dutch auction has fully decayed. Gate minimum
|
|
51
|
-
* deposit checks on THIS, not `dst.amount` — a fill at auction end that lands
|
|
52
|
-
* under the agent's floor would leave the user swapped but not deposited.
|
|
53
|
-
*/
|
|
54
|
-
dstAmountMin: string;
|
|
55
|
-
/** Cross-chain only. Per-order escrow schedule in seconds, set by 1inch. */
|
|
56
|
-
timeLocks?: Record<string, number>;
|
|
57
|
-
/**
|
|
58
|
-
* Cross-chain only. How many preimages to mint before building an order.
|
|
59
|
-
* Building with the wrong number produces escrows the user's secrets cannot
|
|
60
|
-
* unlock, stranding the swap until its cancellation timelock.
|
|
61
|
-
*/
|
|
62
|
-
secretsCount?: number;
|
|
63
|
-
/**
|
|
64
|
-
* Cross-chain only. The contract the source token must be approved to (the
|
|
65
|
-
* 1inch Limit Order Protocol) before a resolver can fill the order.
|
|
66
|
-
*
|
|
67
|
-
* Absent on the classic rail, where the router address arrives with the swap
|
|
68
|
-
* calldata instead.
|
|
69
|
-
*/
|
|
70
|
-
spender?: string;
|
|
71
|
-
/**
|
|
72
|
-
* True only for a cross-chain swap FROM native ETH, which needs an on-chain
|
|
73
|
-
* order creation carrying the full amount as msg.value. The user's funds
|
|
74
|
-
* leave the wallet before any fill, so the UI must say so. ERC-20 sources are
|
|
75
|
-
* signature-only after their one-time approval.
|
|
76
|
-
*/
|
|
77
|
-
requiresOnchainOrder: boolean;
|
|
78
|
-
/**
|
|
79
|
-
* What the swap costs, as the provider reports it on this quote.
|
|
80
|
-
*
|
|
81
|
-
* Surfaced rather than derived: a fee the UI computes from its own constant
|
|
82
|
-
* drifts from the one actually charged the moment the two disagree, and they
|
|
83
|
-
* did — the integrator fee was configured on our side for days while the
|
|
84
|
-
* provider had it switched off, so the real charge was zero.
|
|
85
|
-
*
|
|
86
|
-
* Cross-chain only. The classic rail reports no breakdown.
|
|
87
|
-
*/
|
|
88
|
-
feeInfo?: {
|
|
89
|
-
/** Owney's cut. Absent until a fee receiver is configured. */
|
|
90
|
-
integratorFee?: {
|
|
91
|
-
receiver: string;
|
|
92
|
-
bps: number;
|
|
93
|
-
share: number;
|
|
94
|
-
};
|
|
95
|
-
/** The filler's cut, charged either way. */
|
|
96
|
-
resolverFee?: {
|
|
97
|
-
receiver: string;
|
|
98
|
-
bps: number;
|
|
99
|
-
};
|
|
100
|
-
};
|
|
101
|
-
/**
|
|
102
|
-
* Owney's cut in basis points, for display.
|
|
103
|
-
*
|
|
104
|
-
* Distinct from `feeInfo`, which is what the provider measured on this
|
|
105
|
-
* quote. When the provider applies the fee at settlement it reports nothing
|
|
106
|
-
* here, and this carries the agreed figure instead so the UI can still name
|
|
107
|
-
* one. Stated, not verified.
|
|
108
|
-
*/
|
|
109
|
-
integratorFeeBps?: number;
|
|
110
|
-
};
|
|
111
|
-
/**
|
|
112
|
-
* Terminal states are `executed`, `expired`, `cancelled` and `refunded`.
|
|
113
|
-
* `refunding` is the window the returning-funds screen renders: the order has
|
|
114
|
-
* failed and the money is on its way back, but is not back yet.
|
|
115
|
-
*/
|
|
116
|
-
type SwapOrderStatus = "pending" | "executed" | "expired" | "cancelled" | "refunding" | "refunded" | "unpublished";
|
|
117
|
-
/** Stage reported to the UI while a swap-and-deposit runs. */
|
|
118
|
-
type SwapStage = "quoting" | "approving" | "signing" | "swapping" | "swapped" | "depositing" | "refunding" | "refunded";
|
|
119
|
-
type SwapQuoteParams = {
|
|
120
|
-
/** Asset the user is paying WITH. */
|
|
121
|
-
from: {
|
|
122
|
-
chainId: number;
|
|
123
|
-
symbol: string;
|
|
124
|
-
amount: string;
|
|
125
|
-
};
|
|
126
|
-
/** Deposit target. Must be an asset Owney can actually deposit. */
|
|
127
|
-
to: {
|
|
128
|
-
chainId: number;
|
|
129
|
-
symbol: string;
|
|
130
|
-
};
|
|
131
|
-
};
|
|
132
|
-
|
|
133
3
|
type ZyfaiRpcUrlsConfig = Partial<Record<(typeof SUPPORTED_CHAIN_IDS)[number], string>>;
|
|
134
4
|
interface OwneySDKConfig {
|
|
135
5
|
apiKey: string;
|
|
@@ -207,7 +77,14 @@ type AvailableAgentsOptions = {
|
|
|
207
77
|
/** Disabled agents are omitted by default because they cannot accept funds. */
|
|
208
78
|
includeDisabled?: boolean;
|
|
209
79
|
};
|
|
210
|
-
|
|
80
|
+
/**
|
|
81
|
+
* A lookback window for any "last N days" read — the APY series, the daily
|
|
82
|
+
* earnings series. Named for the window itself, so nothing borrows the APY's
|
|
83
|
+
* name to ask for something else.
|
|
84
|
+
*/
|
|
85
|
+
type LookbackDays = "7D" | "14D" | "30D";
|
|
86
|
+
/** Kept so existing callers keep compiling. Prefer `LookbackDays`. */
|
|
87
|
+
type DailyApyDays = LookbackDays;
|
|
211
88
|
type HistoryFilters = {
|
|
212
89
|
fromDate?: string;
|
|
213
90
|
toDate?: string;
|
|
@@ -236,7 +113,7 @@ type WithdrawOptions = {
|
|
|
236
113
|
};
|
|
237
114
|
type AccountApyOptions = {
|
|
238
115
|
agentId?: AgentId;
|
|
239
|
-
days:
|
|
116
|
+
days: LookbackDays;
|
|
240
117
|
/**
|
|
241
118
|
* Optional asset symbol (e.g. "USDC", "WETH") to scope the daily APY series
|
|
242
119
|
* to a specific asset on the active chain. Without it the series blends every
|
|
@@ -246,6 +123,20 @@ type AccountApyOptions = {
|
|
|
246
123
|
*/
|
|
247
124
|
tokenSymbol?: string;
|
|
248
125
|
};
|
|
126
|
+
/**
|
|
127
|
+
* Options for the daily earnings series. Same shape as `AccountApyOptions` and
|
|
128
|
+
* deliberately its own type: the two reads answer different questions and are
|
|
129
|
+
* free to diverge.
|
|
130
|
+
*/
|
|
131
|
+
type DailyEarningsOptions = {
|
|
132
|
+
agentId?: AgentId;
|
|
133
|
+
days: LookbackDays;
|
|
134
|
+
/**
|
|
135
|
+
* Optional asset symbol (e.g. "USDC", "WETH") scoping the series to one
|
|
136
|
+
* asset on the active chain.
|
|
137
|
+
*/
|
|
138
|
+
tokenSymbol?: string;
|
|
139
|
+
};
|
|
249
140
|
type AllocationApyOptions = {
|
|
250
141
|
agentId?: AgentId;
|
|
251
142
|
};
|
|
@@ -525,6 +416,40 @@ interface AgentApy {
|
|
|
525
416
|
interface OwneyAgentApy {
|
|
526
417
|
agentApy: Record<AgentId, AgentApy>;
|
|
527
418
|
}
|
|
419
|
+
/** One day's cumulative NET earnings for a single asset. */
|
|
420
|
+
interface DailyEarningsPoint {
|
|
421
|
+
/** ISO date string for the day, e.g. "2026-09-01". */
|
|
422
|
+
date: string;
|
|
423
|
+
/**
|
|
424
|
+
* Earnings accumulated from the start of the returned series up to and
|
|
425
|
+
* including this day, net of the agent's performance fee, denominated in the
|
|
426
|
+
* asset's own units. A running total of daily deltas, so it measures the
|
|
427
|
+
* window — not the wallet's lifetime.
|
|
428
|
+
*/
|
|
429
|
+
amount: number;
|
|
430
|
+
}
|
|
431
|
+
/** One asset's cumulative series on the chain. */
|
|
432
|
+
interface AssetDailyEarnings {
|
|
433
|
+
/** Asset symbol, e.g. "USDC" / "WETH". */
|
|
434
|
+
asset: string;
|
|
435
|
+
/**
|
|
436
|
+
* Ascending by date. Days the wallet held nothing of this asset are absent
|
|
437
|
+
* rather than zero — a zero would read as "earned nothing that day".
|
|
438
|
+
*/
|
|
439
|
+
points: DailyEarningsPoint[];
|
|
440
|
+
}
|
|
441
|
+
interface AccountDailyEarnings {
|
|
442
|
+
walletAddress: string;
|
|
443
|
+
chainId: number;
|
|
444
|
+
/**
|
|
445
|
+
* One cumulative series per asset held on the chain, never a single blended
|
|
446
|
+
* series: USDC and WETH amounts are in different units, so adding them
|
|
447
|
+
* produces a number that means nothing (2 + 0.001). Empty when the provider
|
|
448
|
+
* returns no snapshots. Narrowed to one entry when the caller passes
|
|
449
|
+
* `tokenSymbol`.
|
|
450
|
+
*/
|
|
451
|
+
assets: AssetDailyEarnings[];
|
|
452
|
+
}
|
|
528
453
|
|
|
529
454
|
type DepositCallback = (smartWalletAddress: string, chainId: number, amount: string) => Promise<`0x${string}`> | `0x${string}`;
|
|
530
455
|
interface IAgent {
|
|
@@ -561,6 +486,12 @@ interface IAgent {
|
|
|
561
486
|
* single asset on the chain. Agents without per-asset positions ignore it.
|
|
562
487
|
*/
|
|
563
488
|
tokenSymbol?: string): Promise<AccountAgentApy>;
|
|
489
|
+
/**
|
|
490
|
+
* Daily cumulative NET earnings for the window, scoped to a chain/asset.
|
|
491
|
+
* Backs the "recent earnings" subline, whose figure must reconcile with the
|
|
492
|
+
* balance headline directly above it. (ROUT-452)
|
|
493
|
+
*/
|
|
494
|
+
getDailyEarnings?(state: ConnectionState, chainId: number, days: LookbackDays, tokenSymbol?: string): Promise<AccountDailyEarnings>;
|
|
564
495
|
getHistory(state: ConnectionState, chainId: number, options?: HistoryFilters): Promise<OwneyAgentHistory>;
|
|
565
496
|
getUserProfile(state: ConnectionState, chainId: number): Promise<AgentUserProfile>;
|
|
566
497
|
/**
|
|
@@ -759,83 +690,6 @@ declare class OwneySDK {
|
|
|
759
690
|
private hasExistingBalance;
|
|
760
691
|
private validateAssetSupport;
|
|
761
692
|
private getEligibleAgents;
|
|
762
|
-
/** Lazily built so an app that never swaps pays nothing for it. */
|
|
763
|
-
private swapApiClient?;
|
|
764
|
-
private swapApi;
|
|
765
|
-
/**
|
|
766
|
-
* Put the wallet on `chainId`, or fail with something actionable.
|
|
767
|
-
*
|
|
768
|
-
* Reuses the same guard the deposit rail uses, which re-reads the chain after
|
|
769
|
-
* switching — some wallets resolve wallet_switchEthereumChain before the
|
|
770
|
-
* network has actually changed.
|
|
771
|
-
*/
|
|
772
|
-
private ensureSwapChain;
|
|
773
|
-
/**
|
|
774
|
-
* Binds the executor's abstract deps to this client's wallet.
|
|
775
|
-
*
|
|
776
|
-
* Kept as a builder rather than baked into the executor so the whole swap
|
|
777
|
-
* flow stays testable without a provider — the executor never imports viem.
|
|
778
|
-
*/
|
|
779
|
-
private buildSwapDeps;
|
|
780
|
-
/**
|
|
781
|
-
* Assets the user may pay with, and what each chain deposits into.
|
|
782
|
-
*
|
|
783
|
-
* The source list is deliberately wider than the deposit list: it includes
|
|
784
|
-
* native ETH and USDT, which Owney never holds but users often do.
|
|
785
|
-
*/
|
|
786
|
-
getSwapTokens(): Promise<{
|
|
787
|
-
chains: SwapChainTokens[];
|
|
788
|
-
}>;
|
|
789
|
-
/**
|
|
790
|
-
* Price a swap without committing to it.
|
|
791
|
-
*
|
|
792
|
-
* `dstAmountMin` is the number to validate against a deposit minimum —
|
|
793
|
-
* `dst.amount` is an estimate that a decaying auction or slippage can undercut,
|
|
794
|
-
* and a swap landing below the floor leaves the user swapped but not
|
|
795
|
-
* deposited.
|
|
796
|
-
*/
|
|
797
|
-
getSwapQuote(params: SwapQuoteParams): Promise<SwapQuote>;
|
|
798
|
-
/**
|
|
799
|
-
* Swap an asset the user holds into a deposit asset, then deposit it.
|
|
800
|
-
*
|
|
801
|
-
* Kept separate from `deposit()` rather than bolted on as an option: the
|
|
802
|
-
* return shape differs, the staging callback is meaningless on the plain
|
|
803
|
-
* path, and integrators who never swap should not have to reason about any
|
|
804
|
-
* of it.
|
|
805
|
-
*
|
|
806
|
-
* The deposit runs on the MEASURED arrival, not the quote. A quote is an
|
|
807
|
-
* estimate, so depositing the quoted figure would either strand dust or try
|
|
808
|
-
* to move funds that never came.
|
|
809
|
-
*
|
|
810
|
-
* Failure modes differ in a way callers must respect. A same-chain swap is
|
|
811
|
-
* atomic — if it fails, nothing moved. A cross-chain swap escrows the user's
|
|
812
|
-
* funds first, so SWAP_ORDER_EXPIRED / REFUNDED / CANCELLED all mean the
|
|
813
|
-
* money left the wallet. Only the former can honestly say "nothing has left
|
|
814
|
-
* your wallet".
|
|
815
|
-
*/
|
|
816
|
-
swapAndDeposit(options: {
|
|
817
|
-
from: {
|
|
818
|
-
chainId: number;
|
|
819
|
-
symbol: string;
|
|
820
|
-
amount: string;
|
|
821
|
-
};
|
|
822
|
-
/** Deposit target. Defaults to the active chain's asset when omitted. */
|
|
823
|
-
to: {
|
|
824
|
-
chainId: number;
|
|
825
|
-
symbol: string;
|
|
826
|
-
};
|
|
827
|
-
agentId?: AgentId;
|
|
828
|
-
/** Percent, classic rail only. Fusion+ prices through its auction. */
|
|
829
|
-
slippage?: number;
|
|
830
|
-
onSwapProgress?: (stage: SwapStage) => void;
|
|
831
|
-
}): Promise<{
|
|
832
|
-
swap: {
|
|
833
|
-
received: string;
|
|
834
|
-
orderHash?: string;
|
|
835
|
-
txHash?: string;
|
|
836
|
-
};
|
|
837
|
-
deposit: OwneyDepositResult | OwneyMultiDepositResult;
|
|
838
|
-
}>;
|
|
839
693
|
/**
|
|
840
694
|
* Withdraw funds from a specific agent, or all agents that support the active chain+asset if agentId is omitted.
|
|
841
695
|
* Validates that the asset is supported by the target agent(s) on the active chain.
|
|
@@ -871,6 +725,18 @@ declare class OwneySDK {
|
|
|
871
725
|
* @param options.days - Lookback period: "7D", "14D", or "30D"
|
|
872
726
|
* @returns {AccountAgentApy} for a single agent, or {OwneyAccountApy} with totalApy and per-agent breakdown
|
|
873
727
|
*/
|
|
728
|
+
/**
|
|
729
|
+
* Daily cumulative NET earnings for the selected chain/asset, backing the
|
|
730
|
+
* "recent earnings" subline. Net is computed as Zyfai's own
|
|
731
|
+
* `lifetime + unrealized + current x 0.9`, so the figure reconciles with the
|
|
732
|
+
* balance headline rather than reading ~11% high. (ROUT-452)
|
|
733
|
+
*
|
|
734
|
+
* Unlike getAccountApy this does NOT blend across agents: earnings are
|
|
735
|
+
* summed, not weighted, and an agent that fails to report must not silently
|
|
736
|
+
* subtract from the total. Without an agentId the series is the sum of the
|
|
737
|
+
* agents that answered.
|
|
738
|
+
*/
|
|
739
|
+
getDailyEarnings({ agentId, days, tokenSymbol, }: DailyEarningsOptions): Promise<AccountDailyEarnings>;
|
|
874
740
|
getAccountApy({ agentId, days, tokenSymbol, }: AccountApyOptions): Promise<OwneyAccountApy | AccountAgentApy>;
|
|
875
741
|
/**
|
|
876
742
|
* Get transaction history for a specific agent, or all agents.
|
|
@@ -936,7 +802,7 @@ declare class OwneySDK {
|
|
|
936
802
|
getAllocationApy({ agentId, }?: AllocationApyOptions): Promise<OwneyAllocationApy>;
|
|
937
803
|
}
|
|
938
804
|
|
|
939
|
-
type OwneyErrorCode = "NOT_CONNECTED" | "NO_ACTIVE_CHAIN" | "WALLET_NO_ACCOUNTS" | "WALLET_ADDRESS_REQUIRED" | "WALLET_NOT_DEPLOYED" | "AGENT_NOT_FOUND" | "AGENT_CHAIN_INCOMPATIBLE" | "AGENT_EMPTY_LIST" | "AGENT_DISABLED" | "CHAIN_UNSUPPORTED" | "CHAIN_NO_COMPATIBLE_AGENTS" | "CHAIN_MISMATCH" | "ASSET_UNSUPPORTED" | "ASSET_NO_COMPATIBLE_AGENTS" | "DEPOSIT_BALANCE_UNAVAILABLE" | "DEPOSIT_PARTIAL_FAILURE" | "DEPOSIT_AMOUNT_BELOW_MINIMUM" | "DEPOSIT_CALLBACK_REQUIRED" | "DEPOSIT_CALLBACK_INVALID" | "DEPOSIT_NO_PERMITTED_TOKENS" | "DEPOSIT_INSUFFICIENT_BALANCE" | "WITHDRAW_NO_PERMITTED_TOKENS" | "WITHDRAW_INSUFFICIENT_BALANCE" | "WITHDRAW_ALL_FAILED" | "WITHDRAW_PARTIAL_FAILURE" | "WITHDRAW_FAILED" | "AGENT_RATE_LIMITED" | "API_ROUTING_ERROR" | "API_ROUTING_FAILED" | "API_NO_AGENTS" | "SPONSOR_REQUEST_FAILED" | "PERMIT2_APPROVAL_REQUIRED" | "SPONSORED_CALLS_UNSUPPORTED" | "SPONSORED_CALLS_NO_ID" | "SPONSORED_CALLS_NO_RECEIPT" | "
|
|
805
|
+
type OwneyErrorCode = "NOT_CONNECTED" | "NO_ACTIVE_CHAIN" | "WALLET_NO_ACCOUNTS" | "WALLET_ADDRESS_REQUIRED" | "WALLET_NOT_DEPLOYED" | "AGENT_NOT_FOUND" | "AGENT_CHAIN_INCOMPATIBLE" | "AGENT_EMPTY_LIST" | "AGENT_DISABLED" | "CHAIN_UNSUPPORTED" | "CHAIN_NO_COMPATIBLE_AGENTS" | "CHAIN_MISMATCH" | "ASSET_UNSUPPORTED" | "ASSET_NO_COMPATIBLE_AGENTS" | "DEPOSIT_BALANCE_UNAVAILABLE" | "DEPOSIT_PARTIAL_FAILURE" | "DEPOSIT_AMOUNT_BELOW_MINIMUM" | "DEPOSIT_CALLBACK_REQUIRED" | "DEPOSIT_CALLBACK_INVALID" | "DEPOSIT_NO_PERMITTED_TOKENS" | "DEPOSIT_INSUFFICIENT_BALANCE" | "WITHDRAW_NO_PERMITTED_TOKENS" | "WITHDRAW_INSUFFICIENT_BALANCE" | "WITHDRAW_ALL_FAILED" | "WITHDRAW_PARTIAL_FAILURE" | "WITHDRAW_FAILED" | "AGENT_RATE_LIMITED" | "API_ROUTING_ERROR" | "API_ROUTING_FAILED" | "API_NO_AGENTS" | "SPONSOR_REQUEST_FAILED" | "PERMIT2_APPROVAL_REQUIRED" | "SPONSORED_CALLS_UNSUPPORTED" | "SPONSORED_CALLS_NO_ID" | "SPONSORED_CALLS_NO_RECEIPT" | "BALANCE_ALL_FAILED" | "ALLOCATION_ALL_FAILED" | "VALIDATION_INVALID_DAYS";
|
|
940
806
|
declare class OwneyError extends Error {
|
|
941
807
|
readonly code: OwneyErrorCode;
|
|
942
808
|
readonly details?: Record<string, unknown>;
|
|
@@ -1002,40 +868,4 @@ type OwneySIWXConfig = {
|
|
|
1002
868
|
*/
|
|
1003
869
|
declare function createOwneySIWX(config: OwneySIWXConfig): SIWXConfig;
|
|
1004
870
|
|
|
1005
|
-
|
|
1006
|
-
* Persists cross-chain swap secrets so an in-flight order survives a reload.
|
|
1007
|
-
*
|
|
1008
|
-
* This is not a convenience. A Fusion+ order is only completable by whoever
|
|
1009
|
-
* holds the secret preimages: the resolver deploys escrows, then waits for the
|
|
1010
|
-
* secret before it can claim and release funds to the user. Lose the secrets
|
|
1011
|
-
* mid-order and the swap cannot complete — the user waits out the cancellation
|
|
1012
|
-
* timelock for a refund instead.
|
|
1013
|
-
*
|
|
1014
|
-
* That matters here because the UI explicitly tells the user "you can safely
|
|
1015
|
-
* close this window", so surviving a reload is a requirement, not a nicety.
|
|
1016
|
-
*
|
|
1017
|
-
* Trade-off: the same one `zyfai.auth-cache` makes. Secrets in `localStorage`
|
|
1018
|
-
* are exposed to XSS, but they are single-use, worthless once the order
|
|
1019
|
-
* settles, and only ever unlock funds back to the user's own wallet.
|
|
1020
|
-
*/
|
|
1021
|
-
type StoredOrder = {
|
|
1022
|
-
orderHash: string;
|
|
1023
|
-
/** Preimages, one per fill. Index matters — fill N needs secret N. */
|
|
1024
|
-
secrets: string[];
|
|
1025
|
-
/** Chain the funds left from, so a resumed session can report it. */
|
|
1026
|
-
srcChainId: number;
|
|
1027
|
-
/** For the resumed UI: what the user was paying with and expecting. */
|
|
1028
|
-
srcSymbol: string;
|
|
1029
|
-
dstSymbol: string;
|
|
1030
|
-
dstChainId: number;
|
|
1031
|
-
amount: string;
|
|
1032
|
-
/** Epoch ms. Used to drop orders far past any plausible timelock. */
|
|
1033
|
-
createdAt: number;
|
|
1034
|
-
};
|
|
1035
|
-
/**
|
|
1036
|
-
* Every stored order, newest first, dropping anything past MAX_AGE_MS.
|
|
1037
|
-
* Used on mount to resume orders the user left in flight.
|
|
1038
|
-
*/
|
|
1039
|
-
declare function listOrders(now?: number): StoredOrder[];
|
|
1040
|
-
|
|
1041
|
-
export { type AccountAgentApy, type AccountApyOptions, type AgentApy, type AgentApyDetails, type AgentBalance, AgentChainIncompatibleError, type AgentEarnings, type AgentHistoryEntry, type AgentHistoryPosition, type AgentId, AgentNotFoundError, type AgentSupportedAsset, type AgentSupportedAssets, type AgentUserProfile, type AgentWithdrawResult, type AgentsApyOptions, type AllocationAgentApy, type AllocationApyOptions, type ApyByChainAndAsset, type ApyHistoryPoint, type Asset, type AvailableAgent, type AvailableAgentsOptions, type ConnectionState, type DailyApyDays, type DepositCallback, type DepositOptions, type HistoryAction, type HistoryFilters, type HistoryOptions, type HistoryTransaction, type IAgent, InvalidHistoryCursorError, NotConnectedError, type OwneyAccountApy, type OwneyAgentApy, type OwneyAgentHistory, type OwneyAllocationApy, type OwneyBalances, type OwneyDepositResult, type OwneyEarnings, OwneyError, type OwneyErrorCode, type OwneyMultiDepositResult, type OwneyPosition, OwneySDK, type OwneySDKConfig, type OwneySIWXConfig, type OwneySupportedChainId, type OwneySupportedChains, type OwneySupportedTokens, type OwneyToken, type OwneyUserProfile, type OwneyWithdrawResult, type RebalanceLog, type SwapChainTokens, type SwapOrderStatus, type SwapQuote, type SwapQuoteParams, type SwapRail, type SwapStage, type SwapTokenInfo, type WithdrawOptions, createOwneySIWX, listOrders as listPendingSwaps, setOwneyDebug };
|
|
871
|
+
export { type AccountAgentApy, type AccountApyOptions, type AccountDailyEarnings, type AgentApy, type AgentApyDetails, type AgentBalance, AgentChainIncompatibleError, type AgentEarnings, type AgentHistoryEntry, type AgentHistoryPosition, type AgentId, AgentNotFoundError, type AgentSupportedAsset, type AgentSupportedAssets, type AgentUserProfile, type AgentWithdrawResult, type AgentsApyOptions, type AllocationAgentApy, type AllocationApyOptions, type ApyByChainAndAsset, type ApyHistoryPoint, type Asset, type AssetDailyEarnings, type AvailableAgent, type AvailableAgentsOptions, type ConnectionState, type DailyApyDays, type DailyEarningsOptions, type DailyEarningsPoint, type DepositCallback, type DepositOptions, type HistoryAction, type HistoryFilters, type HistoryOptions, type HistoryTransaction, type IAgent, InvalidHistoryCursorError, type LookbackDays, NotConnectedError, type OwneyAccountApy, type OwneyAgentApy, type OwneyAgentHistory, type OwneyAllocationApy, type OwneyBalances, type OwneyDepositResult, type OwneyEarnings, OwneyError, type OwneyErrorCode, type OwneyMultiDepositResult, type OwneyPosition, OwneySDK, type OwneySDKConfig, type OwneySIWXConfig, type OwneySupportedChainId, type OwneySupportedChains, type OwneySupportedTokens, type OwneyToken, type OwneyUserProfile, type OwneyWithdrawResult, type RebalanceLog, type WithdrawOptions, createOwneySIWX, setOwneyDebug };
|