@owney/sdk 0.7.32-beta.4 → 0.7.32-beta.5
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 +1204 -154
- package/dist/index.d.cts +445 -39
- package/dist/index.d.ts +445 -39
- package/dist/index.js +1203 -154
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -363,6 +363,15 @@ interface OwneySDKConfig {
|
|
|
363
363
|
* already-deployed app: set `globalThis.__OWNEY_DEBUG__ = true` in devtools.
|
|
364
364
|
*/
|
|
365
365
|
debug?: boolean;
|
|
366
|
+
/**
|
|
367
|
+
* When true, the organization's pool policy is NOT applied on connect, so a
|
|
368
|
+
* user's own deposit-time pool selection (ROUT-569) is never overwritten by
|
|
369
|
+
* the org-level one on their next reconnect. Splitting and the rest of the
|
|
370
|
+
* org policy still apply. Turn this on in apps that expose the deposit-time
|
|
371
|
+
* Pools step (the spread flow); leave it off where the partner dashboard's
|
|
372
|
+
* pool customization is the source of truth.
|
|
373
|
+
*/
|
|
374
|
+
userPoolCustomization?: boolean;
|
|
366
375
|
/**
|
|
367
376
|
* Absolute URL of an ERC-7677 paymaster service. When set, deposits go out as
|
|
368
377
|
* an EIP-5792 `wallet_sendCalls` with `capabilities.paymasterService`, so a
|
|
@@ -418,6 +427,12 @@ interface ConnectionState {
|
|
|
418
427
|
provider: any;
|
|
419
428
|
walletAddress: `0x${string}`;
|
|
420
429
|
chainId: number | null;
|
|
430
|
+
/**
|
|
431
|
+
* Reads under this state use a saved sign-in only: an agent never opens a
|
|
432
|
+
* wallet prompt for them and fails instead. Set by the whole-portfolio reads
|
|
433
|
+
* of an agent that is not active on the connection chain.
|
|
434
|
+
*/
|
|
435
|
+
promptless?: boolean;
|
|
421
436
|
}
|
|
422
437
|
declare const SUPPORTED_TOKENS: readonly ["USDC", "WETH"];
|
|
423
438
|
declare const SUPPORTED_CHAIN_IDS: readonly [8453, 42161, 1];
|
|
@@ -426,39 +441,6 @@ type OwneySupportedChainId = (typeof SUPPORTED_CHAIN_IDS)[number];
|
|
|
426
441
|
type OwneySupportedChains = (typeof SUPPORTED_CHAINS)[number];
|
|
427
442
|
type OwneySupportedTokens = (typeof SUPPORTED_TOKENS)[number];
|
|
428
443
|
|
|
429
|
-
/**
|
|
430
|
-
* One protocol's pool selection on one chain. `pools` holds Zyfai pool NAMES
|
|
431
|
-
* verbatim — matched case-sensitively by customizeBatch, and an unrecognised
|
|
432
|
-
* name makes Zyfai's rebalance engine skip the whole protocol, so these strings
|
|
433
|
-
* must not be normalised anywhere.
|
|
434
|
-
*
|
|
435
|
-
* An empty array means "no usable pools on this chain".
|
|
436
|
-
*/
|
|
437
|
-
type OrgPoolSelection = {
|
|
438
|
-
protocolId: string;
|
|
439
|
-
chainId: number;
|
|
440
|
-
pools: string[];
|
|
441
|
-
};
|
|
442
|
-
/**
|
|
443
|
-
* The partner's protocol/pool policy (ROUT-224). Sparse — only protocols they
|
|
444
|
-
* narrowed appear. Optional so an older routing API, which does not return the
|
|
445
|
-
* field, still parses; undefined and null both mean "change nothing".
|
|
446
|
-
*/
|
|
447
|
-
type OrgPoolPolicy = {
|
|
448
|
-
autoApproveProtocols: boolean;
|
|
449
|
-
autoApprovePools: boolean;
|
|
450
|
-
selections: OrgPoolSelection[];
|
|
451
|
-
};
|
|
452
|
-
/**
|
|
453
|
-
* The organization's agent execution policy, or null when the partner has never
|
|
454
|
-
* configured one — in which case the agents leave the user's profile alone.
|
|
455
|
-
*/
|
|
456
|
-
type OrgAgentConfig = {
|
|
457
|
-
splittingMode: "none" | "automatic" | "force";
|
|
458
|
-
minSplits: number | null;
|
|
459
|
-
poolPolicy?: OrgPoolPolicy | null;
|
|
460
|
-
};
|
|
461
|
-
|
|
462
444
|
/** Capability flag: this SDK can hand Zyfai withdrawals and deposit
|
|
463
445
|
* registrations to the server, and marks such legs with evidence `serverTask`.
|
|
464
446
|
* Older builds do not export this. */
|
|
@@ -497,6 +479,130 @@ type ZyfaiHandoffAnswer = {
|
|
|
497
479
|
type: "unknown";
|
|
498
480
|
};
|
|
499
481
|
|
|
482
|
+
/**
|
|
483
|
+
* One protocol's pool selection on one chain. `pools` holds Zyfai pool NAMES
|
|
484
|
+
* verbatim — matched case-sensitively by customizeBatch, and an unrecognised
|
|
485
|
+
* name makes Zyfai's rebalance engine skip the whole protocol, so these strings
|
|
486
|
+
* must not be normalised anywhere.
|
|
487
|
+
*
|
|
488
|
+
* An empty array means "no usable pools on this chain".
|
|
489
|
+
*/
|
|
490
|
+
type OrgPoolSelection = {
|
|
491
|
+
protocolId: string;
|
|
492
|
+
chainId: number;
|
|
493
|
+
pools: string[];
|
|
494
|
+
};
|
|
495
|
+
/**
|
|
496
|
+
* The partner's protocol/pool policy (ROUT-224). Sparse — only protocols they
|
|
497
|
+
* narrowed appear. Optional so an older routing API, which does not return the
|
|
498
|
+
* field, still parses; undefined and null both mean "change nothing".
|
|
499
|
+
*/
|
|
500
|
+
type OrgPoolPolicy = {
|
|
501
|
+
autoApproveProtocols: boolean;
|
|
502
|
+
autoApprovePools: boolean;
|
|
503
|
+
selections: OrgPoolSelection[];
|
|
504
|
+
};
|
|
505
|
+
/**
|
|
506
|
+
* The organization's agent execution policy, or null when the partner has never
|
|
507
|
+
* configured one — in which case the agents leave the user's profile alone.
|
|
508
|
+
*/
|
|
509
|
+
type OrgAgentConfig = {
|
|
510
|
+
splittingMode: "none" | "automatic" | "force";
|
|
511
|
+
minSplits: number | null;
|
|
512
|
+
poolPolicy?: OrgPoolPolicy | null;
|
|
513
|
+
};
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* Pool policy: Owney's org-level protocol/pool policy -> Zyfai's two mismatched
|
|
517
|
+
* write shapes.
|
|
518
|
+
*
|
|
519
|
+
* Zyfai splits "which protocols and pools may this user's funds sit in" across
|
|
520
|
+
* two calls that do not share an axis:
|
|
521
|
+
*
|
|
522
|
+
* updateUserProfile({ protocols }) per ASSET, chain-agnostic
|
|
523
|
+
* customizeBatch([{ protocolId, per (PROTOCOL, CHAIN), asset-agnostic
|
|
524
|
+
* chainId, pools, autoselect }])
|
|
525
|
+
*
|
|
526
|
+
* `protocols` is an explicit ALLOW-LIST: a protocol left out of it is disabled
|
|
527
|
+
* for that asset, on every chain, immediately. `customizeBatch` is the opposite
|
|
528
|
+
* shape — one record per (protocol, chain) pair, asset-agnostic, and per
|
|
529
|
+
* docs.zyf.ai it "creates or updates a record for the (user, protocol, chain)
|
|
530
|
+
* combination"; "previous customizations for the same combination are
|
|
531
|
+
* overwritten".
|
|
532
|
+
*
|
|
533
|
+
* That second property is the reason this file exists rather than a single
|
|
534
|
+
* flat translation: customizeBatch overwrites only the combinations it is
|
|
535
|
+
* GIVEN. The partner's stored policy (`OrgPoolPolicy.selections`) is sparse —
|
|
536
|
+
* only the protocols they actually narrowed appear — but the payload we send
|
|
537
|
+
* must be EXHAUSTIVE over every (protocol, chain) pair Zyfai offers this user.
|
|
538
|
+
* If we only sent the narrowed pairs, a partner who restricts Morpho, saves,
|
|
539
|
+
* then later re-ticks every pool box would never be able to undo it: nothing
|
|
540
|
+
* in the (sparse) policy would tell us to send a record clearing it, and the
|
|
541
|
+
* old restrictive record would stay live on the user's profile forever.
|
|
542
|
+
*
|
|
543
|
+
* Pure functions, kept out of the agent so the mapping is testable without a
|
|
544
|
+
* Zyfai client. See splitting.ts for the same pattern on the other lever.
|
|
545
|
+
*/
|
|
546
|
+
|
|
547
|
+
/** One selectable pool, with the figures the deposit-time Pools step shows. */
|
|
548
|
+
type AvailablePool = {
|
|
549
|
+
chainId: number;
|
|
550
|
+
token: string;
|
|
551
|
+
name: string;
|
|
552
|
+
/** combined_apy (pool + rewards), already a percent. null when absent. */
|
|
553
|
+
apy: number | null;
|
|
554
|
+
/** TVL in USD. null when absent. See ZyfCustomizationPoolInfo: `tvl` is in
|
|
555
|
+
* the pool's own token, `tvlUsd` is the dollar figure — only the latter is
|
|
556
|
+
* safe to show with a currency symbol. */
|
|
557
|
+
tvlUsd: number | null;
|
|
558
|
+
/** Per-pool deep link (e.g. the Morpho vault page). null when absent. */
|
|
559
|
+
link: string | null;
|
|
560
|
+
};
|
|
561
|
+
/** Public Zyfai strategies used by deposit-time pool customization. */
|
|
562
|
+
type PoolSelectionStrategy = "aggressive" | "yieldmaxxing";
|
|
563
|
+
/** One asset's explicit choice for a protocol on one chain. */
|
|
564
|
+
type UserPoolSelection = {
|
|
565
|
+
asset: "USDC" | "WETH";
|
|
566
|
+
protocolId: string;
|
|
567
|
+
chainId: number;
|
|
568
|
+
/** Names enabled by the user for this asset/protocol/chain. */
|
|
569
|
+
pools: string[];
|
|
570
|
+
/** Every name shown for this asset/protocol/chain in the superset catalog. */
|
|
571
|
+
availablePools: string[];
|
|
572
|
+
};
|
|
573
|
+
/** The complete saved draft for the asset/chain legs selected in the deposit. */
|
|
574
|
+
type UserPoolSelectionRequest = {
|
|
575
|
+
strategies: Array<{
|
|
576
|
+
asset: "USDC" | "WETH";
|
|
577
|
+
strategy: PoolSelectionStrategy;
|
|
578
|
+
}>;
|
|
579
|
+
selections: UserPoolSelection[];
|
|
580
|
+
};
|
|
581
|
+
/**
|
|
582
|
+
* What a user's account currently has saved (ROUT-650): each asset's strategy,
|
|
583
|
+
* plus the pool list of every protocol/chain pair frozen by an earlier Save.
|
|
584
|
+
* Pairs Zyfai still autoselects are left out, so "no entry" means "default".
|
|
585
|
+
*/
|
|
586
|
+
type SavedPoolSelection = {
|
|
587
|
+
strategies: Array<{
|
|
588
|
+
asset: "USDC" | "WETH";
|
|
589
|
+
strategy: string;
|
|
590
|
+
}>;
|
|
591
|
+
pairs: Array<{
|
|
592
|
+
protocolId: string;
|
|
593
|
+
chainId: number;
|
|
594
|
+
pools: string[];
|
|
595
|
+
}>;
|
|
596
|
+
};
|
|
597
|
+
/** One protocol with its pools for the deposit asset — what the Pools step
|
|
598
|
+
* renders: a protocol row that opens to a list of selectable pools. */
|
|
599
|
+
type PoolCatalogProtocol = {
|
|
600
|
+
protocolId: string;
|
|
601
|
+
name: string;
|
|
602
|
+
logo: string | null;
|
|
603
|
+
pools: AvailablePool[];
|
|
604
|
+
};
|
|
605
|
+
|
|
500
606
|
type DepositCallback = (smartWalletAddress: string, chainId: number, amount: string) => Promise<`0x${string}`> | `0x${string}`;
|
|
501
607
|
/**
|
|
502
608
|
* Read access to the funding ledger, given to agents by the client so they can
|
|
@@ -579,6 +685,32 @@ interface IAgent {
|
|
|
579
685
|
* unchanged rather than break the connect.
|
|
580
686
|
*/
|
|
581
687
|
applyOrgPolicy?(state: ConnectionState, chainId: number, policy: OrgAgentConfig): Promise<void>;
|
|
688
|
+
/**
|
|
689
|
+
* The deposit-time pool catalogue for one asset and strategy: protocols with
|
|
690
|
+
* their selectable pools and figures. Optional — an agent with no pool
|
|
691
|
+
* customization omits it. (ROUT-569)
|
|
692
|
+
*/
|
|
693
|
+
getPoolCatalog?(params: {
|
|
694
|
+
asset: string;
|
|
695
|
+
strategy: "conservative" | "aggressive" | "yieldmaxxing";
|
|
696
|
+
}): Promise<PoolCatalogProtocol[]>;
|
|
697
|
+
/**
|
|
698
|
+
* Apply a user's own pool selection to their account, driven by the
|
|
699
|
+
* deposit-time Pools step. Optional, and non-fatal like `applyOrgPolicy`.
|
|
700
|
+
* (ROUT-569)
|
|
701
|
+
*/
|
|
702
|
+
setPoolSelection?(selection: UserPoolSelectionRequest): Promise<void>;
|
|
703
|
+
/**
|
|
704
|
+
* Read back what `setPoolSelection` saved, for the pairs and assets given,
|
|
705
|
+
* so the Pools step can open on the user's own choices. Optional. (ROUT-650)
|
|
706
|
+
*/
|
|
707
|
+
getPoolSelection?(state: ConnectionState, chainId: number, params: {
|
|
708
|
+
pairs: Array<{
|
|
709
|
+
protocolId: string;
|
|
710
|
+
chainId: number;
|
|
711
|
+
}>;
|
|
712
|
+
assets: Array<"USDC" | "WETH">;
|
|
713
|
+
}): Promise<SavedPoolSelection>;
|
|
582
714
|
deposit(state: ConnectionState, chainId: number, amount: string, asset: OwneySupportedTokens, depositCallback?: DepositCallback, onProgress?: FundingProgress, onBeforeSubmission?: (evidence: FundingEvidence) => void | Promise<void>,
|
|
583
715
|
/** `operationId`: the funding ledger operation. Zyfai hands the deposit's
|
|
584
716
|
* registration to the server with it (only agents with
|
|
@@ -617,6 +749,13 @@ interface IAgent {
|
|
|
617
749
|
/** Optional positive proof for a repeat deposit; unknown must fall back to portfolio validation. */
|
|
618
750
|
hasExistingDepositFunds?(state: ConnectionState, chainId: number, asset: OwneySupportedTokens): Promise<true | undefined>;
|
|
619
751
|
getBalances(state: ConnectionState, chainId: number, asset?: OwneySupportedTokens): Promise<AgentBalance>;
|
|
752
|
+
/**
|
|
753
|
+
* Whether this wallet can be read on `chainId` from a saved sign-in, with no
|
|
754
|
+
* wallet prompt. Lets the whole-portfolio reads include an agent that does
|
|
755
|
+
* not run on the connection chain (Yieldseeker on Base while the wallet is
|
|
756
|
+
* on Arbitrum); agents without it are read only while active.
|
|
757
|
+
*/
|
|
758
|
+
hasReadSession?(state: ConnectionState, chainId: number): boolean;
|
|
620
759
|
getEarnings(state: ConnectionState, chainId: number): Promise<AgentEarnings>;
|
|
621
760
|
/** Funding-ledger read access for earnings holds. Optional; without it an agent behaves as before. */
|
|
622
761
|
setFundingLedgerAccess?(access: AgentFundingLedgerAccess | undefined): void;
|
|
@@ -635,7 +774,14 @@ interface IAgent {
|
|
|
635
774
|
* Optional asset symbol ("USDC" / "WETH") scoping the daily series to a
|
|
636
775
|
* single asset on the chain. Agents without per-asset positions ignore it.
|
|
637
776
|
*/
|
|
638
|
-
tokenSymbol?: string
|
|
777
|
+
tokenSymbol?: string,
|
|
778
|
+
/**
|
|
779
|
+
* Chain the series is scoped to, when that differs from the chain the
|
|
780
|
+
* connection is on. `null` spans every chain the wallet held (ROUT-479);
|
|
781
|
+
* omitted means `chainId`. Kept apart from `chainId` because that one
|
|
782
|
+
* still resolves the wallet and must stay a real, connected chain.
|
|
783
|
+
*/
|
|
784
|
+
scopeChainId?: number | null): Promise<AccountAgentApy>;
|
|
639
785
|
/**
|
|
640
786
|
* Daily cumulative earnings in token units, scoped to a chain/asset, using
|
|
641
787
|
* the provider's earnings basis. Include an opening snapshot when available
|
|
@@ -717,6 +863,15 @@ type HistoryOptions = {
|
|
|
717
863
|
chainId?: number;
|
|
718
864
|
agentId?: AgentId;
|
|
719
865
|
filters?: HistoryFilters;
|
|
866
|
+
/**
|
|
867
|
+
* Chains to read, instead of the one `activateAgent` last set (ROUT-479).
|
|
868
|
+
*
|
|
869
|
+
* Each chain pages independently and the results merge into one
|
|
870
|
+
* chronological list, with every entry stamped with the chain it came from.
|
|
871
|
+
* Omit for the single-chain behaviour, which stays the default: fanning out
|
|
872
|
+
* by default would multiply every existing caller's request count.
|
|
873
|
+
*/
|
|
874
|
+
chainIds?: OwneySupportedChainId[];
|
|
720
875
|
};
|
|
721
876
|
type WithdrawOptions = {
|
|
722
877
|
/** Internal orchestration observation deadline; never retries a send. */
|
|
@@ -741,6 +896,12 @@ type WithdrawOptions = {
|
|
|
741
896
|
* their own so the app record and the ledger share one reference. It is also
|
|
742
897
|
* the withdrawal reservation's operationId. */
|
|
743
898
|
operationId?: string;
|
|
899
|
+
/**
|
|
900
|
+
* Groups this withdrawal with the others started by one user action (a
|
|
901
|
+
* "withdraw all" sends one per asset). A UUID, recorded on the funding
|
|
902
|
+
* ledger's operation; a value that is not a UUID is ignored.
|
|
903
|
+
*/
|
|
904
|
+
batchId?: string;
|
|
744
905
|
/**
|
|
745
906
|
* Cross-device withdrawal reservation options.
|
|
746
907
|
* - `override`: the `reference` from an overridable `RESERVED_ELSEWHERE`
|
|
@@ -750,6 +911,11 @@ type WithdrawOptions = {
|
|
|
750
911
|
* this SDK still has that operation's holder token; otherwise ignored.
|
|
751
912
|
*/
|
|
752
913
|
reservation?: WithdrawalReservationOptions;
|
|
914
|
+
/**
|
|
915
|
+
* Chain to withdraw from. Defaults to the chain `activateAgent` last set.
|
|
916
|
+
* See `DepositOptions.chainId` — the same rules apply.
|
|
917
|
+
*/
|
|
918
|
+
chainId?: number;
|
|
753
919
|
};
|
|
754
920
|
/** `WithdrawOptions.reservation`: see there. */
|
|
755
921
|
type WithdrawalReservationOptions = {
|
|
@@ -759,6 +925,18 @@ type WithdrawalReservationOptions = {
|
|
|
759
925
|
type AccountApyOptions = {
|
|
760
926
|
agentId?: AgentId;
|
|
761
927
|
days: LookbackDays;
|
|
928
|
+
/**
|
|
929
|
+
* Chain to scope the daily series to, instead of the one `activateAgent`
|
|
930
|
+
* last set (ROUT-479).
|
|
931
|
+
*
|
|
932
|
+
* `"all"` blends every chain the wallet held that day, which is what the
|
|
933
|
+
* chart's "All chains" filter asks for. Unlike the history and earnings
|
|
934
|
+
* reads this needs no fan-out: the provider's daily-APY payload is already
|
|
935
|
+
* wallet-wide and names each position's chain, so the scope is a filter over
|
|
936
|
+
* one response rather than several calls. Omit for the active chain, which
|
|
937
|
+
* stays the default.
|
|
938
|
+
*/
|
|
939
|
+
chainId?: OwneySupportedChainId | "all";
|
|
762
940
|
/**
|
|
763
941
|
* Optional asset symbol (e.g. "USDC", "WETH") to scope the daily APY series
|
|
764
942
|
* to a specific asset on the active chain. Without it the series blends every
|
|
@@ -776,6 +954,14 @@ type AccountApyOptions = {
|
|
|
776
954
|
type DailyEarningsOptions = {
|
|
777
955
|
agentId?: AgentId;
|
|
778
956
|
days: LookbackDays;
|
|
957
|
+
/**
|
|
958
|
+
* Chains to read, instead of the one `activateAgent` last set (ROUT-479).
|
|
959
|
+
*
|
|
960
|
+
* The same asset is summed across them — USDC on Base and USDC on Arbitrum
|
|
961
|
+
* are the same unit. Different assets stay apart, as they already do within
|
|
962
|
+
* one chain. Omit for the single-chain behaviour, which stays the default.
|
|
963
|
+
*/
|
|
964
|
+
chainIds?: OwneySupportedChainId[];
|
|
779
965
|
/**
|
|
780
966
|
* Optional asset symbol (e.g. "USDC", "WETH") scoping the series to one
|
|
781
967
|
* asset on the active chain.
|
|
@@ -822,6 +1008,24 @@ type DepositOptions = {
|
|
|
822
1008
|
/** Funding ledger reference (a UUID). Defaults to a new random UUID; apps pass
|
|
823
1009
|
* their own so the app record and the ledger share one reference. */
|
|
824
1010
|
operationId?: string;
|
|
1011
|
+
/**
|
|
1012
|
+
* Groups this deposit with the others started by one user action (a spread
|
|
1013
|
+
* deposit sends one per position). A UUID, recorded on the funding ledger's
|
|
1014
|
+
* operation; a value that is not a UUID is ignored.
|
|
1015
|
+
*/
|
|
1016
|
+
batchId?: string;
|
|
1017
|
+
/**
|
|
1018
|
+
* Chain to deposit on. Defaults to the chain `activateAgent` last set, so
|
|
1019
|
+
* omitting it behaves exactly as before.
|
|
1020
|
+
*
|
|
1021
|
+
* Pass it to fund several chains in a row without re-activating between
|
|
1022
|
+
* them (ROUT-245's spread strategies). It selects the target; it does not
|
|
1023
|
+
* replace activation, which is what populates `activeAgents`, and it does
|
|
1024
|
+
* not remove the wallet's network switch — the default deposit callbacks
|
|
1025
|
+
* still put the wallet on this chain before signing, since a deposit
|
|
1026
|
+
* signature is EIP-712 with the chain in its domain.
|
|
1027
|
+
*/
|
|
1028
|
+
chainId?: number;
|
|
825
1029
|
};
|
|
826
1030
|
|
|
827
1031
|
type FundingStage = "pending" | "confirmed" | "unknown" | "failed" | "not-applicable";
|
|
@@ -1154,6 +1358,25 @@ type OwneyRecentAsyncWithdrawal = {
|
|
|
1154
1358
|
chainId: number;
|
|
1155
1359
|
asset: string;
|
|
1156
1360
|
};
|
|
1361
|
+
/**
|
|
1362
|
+
* One position drained by `withdrawAll()` — a chain and asset pair.
|
|
1363
|
+
*
|
|
1364
|
+
* Carries either a result or an error, never both: a leg that failed while
|
|
1365
|
+
* others succeeded is the normal case, not an exception, and the caller needs
|
|
1366
|
+
* to name the ones that did not arrive.
|
|
1367
|
+
*/
|
|
1368
|
+
interface OwneyWithdrawAllLeg {
|
|
1369
|
+
chainId: OwneySupportedChainId;
|
|
1370
|
+
asset: OwneySupportedTokens;
|
|
1371
|
+
/** What the position held when the sweep started. */
|
|
1372
|
+
amount: string;
|
|
1373
|
+
result?: OwneyWithdrawResult | AgentWithdrawResult;
|
|
1374
|
+
error?: string;
|
|
1375
|
+
}
|
|
1376
|
+
interface OwneyWithdrawAllResult {
|
|
1377
|
+
/** Every position attempted, in the order it was attempted. */
|
|
1378
|
+
legs: OwneyWithdrawAllLeg[];
|
|
1379
|
+
}
|
|
1157
1380
|
interface OwneyBalances {
|
|
1158
1381
|
totalBalance: string;
|
|
1159
1382
|
/** Asset that `totalBalance` is denominated in. Currently always `"usdc"`. */
|
|
@@ -1194,6 +1417,36 @@ interface ApyHistoryPoint {
|
|
|
1194
1417
|
unit: string;
|
|
1195
1418
|
};
|
|
1196
1419
|
}
|
|
1420
|
+
/**
|
|
1421
|
+
* What the APY chart's chain/asset menus are allowed to offer, and how far
|
|
1422
|
+
* back each option reaches (ROUT-479).
|
|
1423
|
+
*
|
|
1424
|
+
* An option only earns a place if some day in the window held a real position
|
|
1425
|
+
* on it — a balance and a rate. Listing anything else would offer a filter
|
|
1426
|
+
* that draws a blank chart. `days` is what the menu prints beside each row,
|
|
1427
|
+
* and the legs genuinely differ: a wallet can hold USDC for a fortnight and
|
|
1428
|
+
* WETH for three days.
|
|
1429
|
+
*/
|
|
1430
|
+
interface ApyCoverage {
|
|
1431
|
+
chains: {
|
|
1432
|
+
chainId: number;
|
|
1433
|
+
days: number;
|
|
1434
|
+
}[];
|
|
1435
|
+
/** Legs whose `tokenSymbol` the provider left unset are absent — they cannot
|
|
1436
|
+
* be named, so they cannot be picked. Their chain still counts. */
|
|
1437
|
+
assets: {
|
|
1438
|
+
asset: string;
|
|
1439
|
+
days: number;
|
|
1440
|
+
}[];
|
|
1441
|
+
/** Each asset on each chain, for a menu that offers the two together
|
|
1442
|
+
* (ROUT-647). The lists above cannot say this: USDC on Base and WETH on
|
|
1443
|
+
* Arbitrum put both chains and both assets in them, and no WETH on Base. */
|
|
1444
|
+
pairs: {
|
|
1445
|
+
chainId: number;
|
|
1446
|
+
asset: string;
|
|
1447
|
+
days: number;
|
|
1448
|
+
}[];
|
|
1449
|
+
}
|
|
1197
1450
|
interface AccountAgentApy {
|
|
1198
1451
|
walletAddress: string;
|
|
1199
1452
|
weightedApyAfterFee?: number;
|
|
@@ -1204,6 +1457,8 @@ interface AccountAgentApy {
|
|
|
1204
1457
|
* date. Empty when the provider returns no daily history.
|
|
1205
1458
|
*/
|
|
1206
1459
|
history?: ApyHistoryPoint[];
|
|
1460
|
+
/** Which chains/assets this history can be filtered down to. */
|
|
1461
|
+
coverage?: ApyCoverage;
|
|
1207
1462
|
}
|
|
1208
1463
|
interface OwneyAccountApy {
|
|
1209
1464
|
totalApy: string;
|
|
@@ -1277,12 +1532,28 @@ interface AgentHistoryEntry {
|
|
|
1277
1532
|
id?: string;
|
|
1278
1533
|
agent: AgentId;
|
|
1279
1534
|
action: HistoryAction;
|
|
1535
|
+
/**
|
|
1536
|
+
* Chain this entry came from, stamped by the history fan-out (ROUT-479).
|
|
1537
|
+
*
|
|
1538
|
+
* Absent on a single-chain read, where the caller already knows the chain.
|
|
1539
|
+
* The entry has no chain of its own otherwise: `transactions[].chainId` is
|
|
1540
|
+
* optional and missing whenever the indexer has not attached the transfer,
|
|
1541
|
+
* so a row cannot be labelled from it reliably.
|
|
1542
|
+
*/
|
|
1543
|
+
chainId?: OwneySupportedChainId;
|
|
1280
1544
|
date: string;
|
|
1281
1545
|
oldApy: string | null;
|
|
1282
1546
|
newApy: string | null;
|
|
1283
1547
|
transactions: HistoryTransaction[];
|
|
1284
1548
|
rebalanceLog: RebalanceLog[];
|
|
1285
1549
|
positions?: AgentHistoryPosition[];
|
|
1550
|
+
/**
|
|
1551
|
+
* Set on a `Withdraw` that was only requested from an async vault
|
|
1552
|
+
* (ROUT-624). The vault pays out in batches later, so the funds have not
|
|
1553
|
+
* reached the wallet yet and `transactions[0].amount` is the amount
|
|
1554
|
+
* requested.
|
|
1555
|
+
*/
|
|
1556
|
+
asyncRequest?: true;
|
|
1286
1557
|
}
|
|
1287
1558
|
interface OwneyAgentHistory {
|
|
1288
1559
|
agentErrors?: Partial<Record<AgentId, string>>;
|
|
@@ -1404,7 +1675,7 @@ type WithdrawalPayoutScan = {
|
|
|
1404
1675
|
caughtUp: boolean;
|
|
1405
1676
|
};
|
|
1406
1677
|
|
|
1407
|
-
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" | "AGENT_ACTIVATION_PARTIAL_FAILURE" | "YIELDSEEKER_AGENT_MISSING" | "YIELDSEEKER_WALLET_UNVERIFIED" | "CHAIN_UNSUPPORTED" | "CHAIN_NO_COMPATIBLE_AGENTS" | "CHAIN_MISMATCH" | "ASSET_UNSUPPORTED" | "ASSET_NO_COMPATIBLE_AGENTS" | "DEPOSIT_BALANCE_UNAVAILABLE" | "DEPOSIT_PARTIAL_FAILURE" | "DEPOSIT_IN_PROGRESS" | "DEPOSIT_CHECKPOINT_FAILED" | "DEPOSIT_AMOUNT_BELOW_MINIMUM" | "DEPOSIT_INVALID_AMOUNT" | "DEPOSIT_CALLBACK_REQUIRED" | "DEPOSIT_CALLBACK_INVALID" | "DEPOSIT_NO_PERMITTED_TOKENS" | "DEPOSIT_INSUFFICIENT_BALANCE" | "WITHDRAW_IN_PROGRESS" | "WITHDRAW_NO_PERMITTED_TOKENS" | "WITHDRAW_BALANCE_UNAVAILABLE" | "WITHDRAW_INSUFFICIENT_BALANCE" | "WITHDRAW_ALL_FAILED" | "WITHDRAW_UNCONFIRMED" | "WITHDRAW_PARTIAL_FAILURE" | "WITHDRAW_SWAP_INCOMPLETE" | "WITHDRAW_FAILED" | "WITHDRAW_INVALID_AMOUNT" | "WITHDRAW_RESERVATION_UNAVAILABLE" | "AGENT_RATE_LIMITED" | "API_ROUTING_ERROR" | "API_ROUTING_FAILED" | "API_NO_AGENTS" | "AGENT_API_ERROR" | "AGENT_AUTH_FAILED" | "AGENT_INVALID_RESPONSE" | "AGENT_TIMEOUT" | "AGENT_TRANSACTION_REVERTED" | "AGENT_APY_PERIOD_UNSUPPORTED" | "SPONSOR_REQUEST_FAILED" | "PERMIT2_APPROVAL_REQUIRED" | "SPONSORED_CALLS_UNSUPPORTED" | "SPONSORED_CALLS_NO_ID" | "SPONSORED_CALLS_NO_RECEIPT" | "SWAP_DISABLED" | "SWAP_RATE_LIMITED" | "SWAP_REQUEST_FAILED" | "SWAP_QUOTE_FAILED" | "SWAP_UNSUPPORTED_PAIR" | "SWAP_APPROVAL_REQUIRED" | "SWAP_BELOW_DEPOSIT_MINIMUM" | "SWAP_DEPOSIT_PENDING" | "SWAP_WALLET_PROMPT_TIMEOUT" | "SWAP_INSUFFICIENT_GAS" | "SWAP_NATIVE_UNSUPPORTED" | "SWAP_ORDER_EXPIRED" | "SWAP_ORDER_REFUNDED" | "SWAP_ORDER_CANCELLED" | "WITHDRAW_ARRIVAL_TIMEOUT" | "WITHDRAW_SWAP_FAILED" | "BALANCE_ALL_FAILED" | "EARNINGS_ALL_FAILED" | "ALLOCATION_ALL_FAILED" | "VALIDATION_INVALID_DAYS";
|
|
1678
|
+
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" | "AGENT_ACTIVATION_PARTIAL_FAILURE" | "YIELDSEEKER_AGENT_MISSING" | "YIELDSEEKER_WALLET_UNVERIFIED" | "CHAIN_UNSUPPORTED" | "CHAIN_NO_COMPATIBLE_AGENTS" | "CHAIN_MISMATCH" | "ASSET_UNSUPPORTED" | "ASSET_NO_COMPATIBLE_AGENTS" | "DEPOSIT_BALANCE_UNAVAILABLE" | "DEPOSIT_PARTIAL_FAILURE" | "DEPOSIT_IN_PROGRESS" | "DEPOSIT_CHECKPOINT_FAILED" | "DEPOSIT_AMOUNT_BELOW_MINIMUM" | "DEPOSIT_INVALID_AMOUNT" | "DEPOSIT_CALLBACK_REQUIRED" | "DEPOSIT_CALLBACK_INVALID" | "DEPOSIT_NO_PERMITTED_TOKENS" | "DEPOSIT_INSUFFICIENT_BALANCE" | "WITHDRAW_IN_PROGRESS" | "WITHDRAW_NO_PERMITTED_TOKENS" | "WITHDRAW_BALANCE_UNAVAILABLE" | "WITHDRAW_INSUFFICIENT_BALANCE" | "WITHDRAW_ALL_FAILED" | "WITHDRAW_UNCONFIRMED" | "WITHDRAW_NOTHING_TO_WITHDRAW" | "WITHDRAW_PARTIAL_FAILURE" | "WITHDRAW_SWAP_INCOMPLETE" | "WITHDRAW_FAILED" | "WITHDRAW_INVALID_AMOUNT" | "WITHDRAW_RESERVATION_UNAVAILABLE" | "AGENT_RATE_LIMITED" | "API_ROUTING_ERROR" | "API_ROUTING_FAILED" | "API_NO_AGENTS" | "AGENT_API_ERROR" | "AGENT_AUTH_FAILED" | "AGENT_INVALID_RESPONSE" | "AGENT_TIMEOUT" | "AGENT_TRANSACTION_REVERTED" | "AGENT_APY_PERIOD_UNSUPPORTED" | "SPONSOR_REQUEST_FAILED" | "PERMIT2_APPROVAL_REQUIRED" | "SPONSORED_CALLS_UNSUPPORTED" | "SPONSORED_CALLS_NO_ID" | "SPONSORED_CALLS_NO_RECEIPT" | "SWAP_DISABLED" | "SWAP_RATE_LIMITED" | "SWAP_REQUEST_FAILED" | "SWAP_QUOTE_FAILED" | "SWAP_UNSUPPORTED_PAIR" | "SWAP_APPROVAL_REQUIRED" | "SWAP_BELOW_DEPOSIT_MINIMUM" | "SWAP_DEPOSIT_PENDING" | "SWAP_WALLET_PROMPT_TIMEOUT" | "SWAP_INSUFFICIENT_GAS" | "SWAP_NATIVE_UNSUPPORTED" | "SWAP_ORDER_EXPIRED" | "SWAP_ORDER_REFUNDED" | "SWAP_ORDER_CANCELLED" | "SWAP_ORDER_NOT_FOUND" | "WITHDRAW_ARRIVAL_TIMEOUT" | "WITHDRAW_SWAP_FAILED" | "BALANCE_ALL_FAILED" | "EARNINGS_ALL_FAILED" | "ALLOCATION_ALL_FAILED" | "POOL_CATALOG_UNSUPPORTED" | "POOL_SELECTION_UNSUPPORTED" | "VALIDATION_INVALID_DAYS";
|
|
1408
1679
|
declare class OwneyError extends Error {
|
|
1409
1680
|
readonly code: OwneyErrorCode;
|
|
1410
1681
|
readonly details?: Record<string, unknown>;
|
|
@@ -1457,6 +1728,12 @@ type WithdrawSwapRecord = {
|
|
|
1457
1728
|
* is continued or rechecked. Absent on records written by an older SDK.
|
|
1458
1729
|
*/
|
|
1459
1730
|
operationId?: string;
|
|
1731
|
+
/**
|
|
1732
|
+
* The batch this withdrawal belongs to (see `WithdrawOptions.batchId`), kept
|
|
1733
|
+
* so a continuation or recheck reports into the same batch. Absent when the
|
|
1734
|
+
* withdrawal was not part of one.
|
|
1735
|
+
*/
|
|
1736
|
+
batchId?: string;
|
|
1460
1737
|
recovery?: WithdrawalSwapRecovery;
|
|
1461
1738
|
spent?: string;
|
|
1462
1739
|
dismissed?: boolean;
|
|
@@ -1551,6 +1828,11 @@ type PendingDeposit = {
|
|
|
1551
1828
|
* it. Absent on records written by an older SDK.
|
|
1552
1829
|
*/
|
|
1553
1830
|
operationId?: string;
|
|
1831
|
+
/**
|
|
1832
|
+
* The user action's batch (see `DepositOptions.batchId`), so finishing the
|
|
1833
|
+
* deposit later reports under it. Absent when the swap had none.
|
|
1834
|
+
*/
|
|
1835
|
+
batchId?: string;
|
|
1554
1836
|
};
|
|
1555
1837
|
/** Every record, dismissed ones included, newest first. Sweeps as it goes. */
|
|
1556
1838
|
declare function listPendingDeposits(now?: number): PendingDeposit[];
|
|
@@ -1574,6 +1856,7 @@ declare class OwneySDK {
|
|
|
1574
1856
|
private zyfaiRpcUrls?;
|
|
1575
1857
|
private yieldseekerApiBaseUrl?;
|
|
1576
1858
|
private yieldseekerSiweOrigin?;
|
|
1859
|
+
private userPoolCustomization;
|
|
1577
1860
|
private routingApiBaseUrl?;
|
|
1578
1861
|
private referralSource?;
|
|
1579
1862
|
private readonly ledger;
|
|
@@ -1713,6 +1996,16 @@ declare class OwneySDK {
|
|
|
1713
1996
|
private getAgent;
|
|
1714
1997
|
getActiveAgentIds(): AgentId[];
|
|
1715
1998
|
private getActiveAgents;
|
|
1999
|
+
/**
|
|
2000
|
+
* Agents that do not run on the connection chain but can be read on their
|
|
2001
|
+
* own from a saved sign-in: Yieldseeker, Base-only, while the wallet sits on
|
|
2002
|
+
* Arbitrum or Ethereum. The whole-portfolio reads (ROUT-479) add them, under
|
|
2003
|
+
* a promptless state; with no saved sign-in they are left out, as before.
|
|
2004
|
+
*/
|
|
2005
|
+
private offChainPortfolioAgents;
|
|
2006
|
+
/** Every agent a whole-portfolio read covers: the active ones on the
|
|
2007
|
+
* connection chain, then the off-chain ones on their own chain. */
|
|
2008
|
+
private portfolioReads;
|
|
1716
2009
|
/**
|
|
1717
2010
|
* Read the org's agent policy once and reuse it. fetchOrgAgentConfig never
|
|
1718
2011
|
* throws — it degrades to null — so this cannot break activation.
|
|
@@ -1818,6 +2111,23 @@ declare class OwneySDK {
|
|
|
1818
2111
|
* false, so the minimum is enforced as today.
|
|
1819
2112
|
*/
|
|
1820
2113
|
private hasExistingBalance;
|
|
2114
|
+
/**
|
|
2115
|
+
* Guard an explicitly requested chain against one agent's own list.
|
|
2116
|
+
*
|
|
2117
|
+
* Only reachable when the caller passes `chainId` — the activated chain has
|
|
2118
|
+
* already been checked by `activateAgent`. Kept separate from
|
|
2119
|
+
* `validateAssetSupport` so "this agent is not on Ethereum" does not arrive
|
|
2120
|
+
* worded as "this agent does not support USDC".
|
|
2121
|
+
*/
|
|
2122
|
+
private validateChainSupport;
|
|
2123
|
+
/**
|
|
2124
|
+
* Guard an explicitly requested chain before a fan-out.
|
|
2125
|
+
*
|
|
2126
|
+
* Without this the split simply produces no agents, and the caller is told
|
|
2127
|
+
* their amount "cannot activate every eligible agent" against a combined
|
|
2128
|
+
* minimum of 0 — an error about the amount when the chain is at fault.
|
|
2129
|
+
*/
|
|
2130
|
+
private validateChainHasAgents;
|
|
1821
2131
|
private validateAssetSupport;
|
|
1822
2132
|
private getEligibleAgents;
|
|
1823
2133
|
/**
|
|
@@ -1970,6 +2280,18 @@ declare class OwneySDK {
|
|
|
1970
2280
|
* would strand funds we might have been able to move.
|
|
1971
2281
|
*/
|
|
1972
2282
|
/** ERC20 balance of the connected wallet, read through the wallet's own node. */
|
|
2283
|
+
/**
|
|
2284
|
+
* A read client pinned to `chainId`, over HTTP rather than the wallet.
|
|
2285
|
+
*
|
|
2286
|
+
* The swap rail has read this way from the start, and the reason is written
|
|
2287
|
+
* out at `buildSwapDeps`: a provider-backed client reads from whatever chain
|
|
2288
|
+
* the WALLET is on, which after a cross-chain swap is the source chain, not
|
|
2289
|
+
* the one the funds landed on. The deposit's own reads did not, so a Permit2
|
|
2290
|
+
* check for WETH on Arbitrum went to Base — where that address is not a
|
|
2291
|
+
* contract at all, so viem got "0x" back and threw "The contract function
|
|
2292
|
+
* 'allowance' returned no data".
|
|
2293
|
+
*/
|
|
2294
|
+
private chainReader;
|
|
1973
2295
|
private readTokenBalance;
|
|
1974
2296
|
/** How much of `token` the wallet has already approved Permit2 to move. */
|
|
1975
2297
|
private readTokenPermit2Allowance;
|
|
@@ -1981,12 +2303,36 @@ declare class OwneySDK {
|
|
|
1981
2303
|
* wallet calls also cover approval without spending the received tokens.
|
|
1982
2304
|
*/
|
|
1983
2305
|
private settleSwapDepositAmount;
|
|
2306
|
+
/**
|
|
2307
|
+
* Deposit a swap's output, retrying once at the balance the deposit saw.
|
|
2308
|
+
*
|
|
2309
|
+
* `settleSwapDepositAmount` approves and THEN reads, but the read and the
|
|
2310
|
+
* deposit's own pre-check can disagree: the approval is confirmed through
|
|
2311
|
+
* the wallet's node, the read goes to a pinned RPC, and gas paid in WETH
|
|
2312
|
+
* (MetaMask offers this to a wallet with no ETH) can land after either.
|
|
2313
|
+
* ROUT-618 failed that way with the settle step in place.
|
|
2314
|
+
*
|
|
2315
|
+
* The pre-check reports the balance it saw, and that is the authority, so
|
|
2316
|
+
* a shortfall is retried once at that figure. Only a small one: a node that
|
|
2317
|
+
* has not caught up can read near zero, and depositing that would leave the
|
|
2318
|
+
* rest of the swap stranded behind a "success".
|
|
2319
|
+
*/
|
|
2320
|
+
private depositSwapOutput;
|
|
1984
2321
|
private walletSeesBalance;
|
|
1985
2322
|
/**
|
|
1986
2323
|
* Runs a quoted swap. A named seam rather than an inline `executeSwap` call
|
|
1987
2324
|
* so the deposit half of `swapAndDeposit` can be exercised on its own.
|
|
1988
2325
|
*/
|
|
1989
2326
|
private runSwap;
|
|
2327
|
+
/**
|
|
2328
|
+
* Throws SWAP_INSUFFICIENT_GAS when the wallet cannot pay for this swap.
|
|
2329
|
+
*
|
|
2330
|
+
* Only the classic rail is ever refused: it is the one where the user sends
|
|
2331
|
+
* the transactions. Call it on a preview quote to warn BEFORE a withdrawal
|
|
2332
|
+
* moves anything — `withdrawAndSwap` repeats it on its own quote, but by
|
|
2333
|
+
* then the funds have already left the agent (ROUT-622).
|
|
2334
|
+
*/
|
|
2335
|
+
checkSwapGas(quote: SwapQuote): Promise<void>;
|
|
1990
2336
|
/**
|
|
1991
2337
|
* The half of the swap deps that only ever talks to the routing API.
|
|
1992
2338
|
*
|
|
@@ -2182,6 +2528,9 @@ declare class OwneySDK {
|
|
|
2182
2528
|
assertCurrent?: () => void;
|
|
2183
2529
|
/** Funding-ledger reference for this swap and its deposit. Generated when omitted. */
|
|
2184
2530
|
operationId?: string;
|
|
2531
|
+
/** Groups this swap and deposit with the others started by one user action
|
|
2532
|
+
* (see `DepositOptions.batchId`). Saved on the pending deposit record. */
|
|
2533
|
+
batchId?: string;
|
|
2185
2534
|
}): Promise<{
|
|
2186
2535
|
swap: {
|
|
2187
2536
|
received: string;
|
|
@@ -2297,6 +2646,12 @@ declare class OwneySDK {
|
|
|
2297
2646
|
* omitted; a continuation reuses the one saved on its record.
|
|
2298
2647
|
*/
|
|
2299
2648
|
operationId?: string;
|
|
2649
|
+
/**
|
|
2650
|
+
* Groups this withdrawal with the others started by one user action (see
|
|
2651
|
+
* `WithdrawOptions.batchId`). Saved on the record, so a continuation
|
|
2652
|
+
* reports into the same batch.
|
|
2653
|
+
*/
|
|
2654
|
+
batchId?: string;
|
|
2300
2655
|
}): Promise<{
|
|
2301
2656
|
withdraw: OwneyWithdrawResult | AgentWithdrawResult;
|
|
2302
2657
|
/** What actually arrived in the wallet, smallest unit of the agent's asset. */
|
|
@@ -2386,10 +2741,24 @@ declare class OwneySDK {
|
|
|
2386
2741
|
* @param agentId - Optional. Agent to query. Omit for aggregated balances.
|
|
2387
2742
|
* @returns {AgentBalance} for a single agent, or {OwneyBalances} with totalBalance and per-agent breakdown
|
|
2388
2743
|
*/
|
|
2744
|
+
/**
|
|
2745
|
+
* Withdraw every position the wallet holds, across chains and assets.
|
|
2746
|
+
*
|
|
2747
|
+
* `withdraw()` drains one asset on one chain, so this is N of those. It
|
|
2748
|
+
* deliberately does not stop at the first failure: the funds in the other
|
|
2749
|
+
* positions are just as withdrawable, and someone who asked for everything
|
|
2750
|
+
* is better served by three of four than by none. Each leg reports its own
|
|
2751
|
+
* outcome so the caller can name the ones that did not arrive; only a total
|
|
2752
|
+
* failure throws.
|
|
2753
|
+
*
|
|
2754
|
+
* @returns {OwneyWithdrawAllResult} one leg per position attempted.
|
|
2755
|
+
*/
|
|
2756
|
+
withdrawAll(): Promise<OwneyWithdrawAllResult>;
|
|
2389
2757
|
getBalances(agentId?: AgentId, options?: {
|
|
2390
2758
|
chainId?: number;
|
|
2391
2759
|
asset?: OwneySupportedTokens;
|
|
2392
2760
|
}): Promise<OwneyBalances | AgentBalance>;
|
|
2761
|
+
private readBalances;
|
|
2393
2762
|
/** Preserve failure objects for withdrawal recovery without changing public balance results. */
|
|
2394
2763
|
private readAggregatedBalances;
|
|
2395
2764
|
/**
|
|
@@ -2421,8 +2790,40 @@ declare class OwneySDK {
|
|
|
2421
2790
|
* subtract from the total. Without an agentId the series is the sum of the
|
|
2422
2791
|
* agents that answered.
|
|
2423
2792
|
*/
|
|
2424
|
-
getDailyEarnings({ agentId, days, tokenSymbol, }: DailyEarningsOptions): Promise<AccountDailyEarnings>;
|
|
2425
|
-
|
|
2793
|
+
getDailyEarnings({ agentId, days, tokenSymbol, chainIds, }: DailyEarningsOptions): Promise<AccountDailyEarnings>;
|
|
2794
|
+
/**
|
|
2795
|
+
* The deposit-time pool catalogue (ROUT-569): every protocol with its
|
|
2796
|
+
* selectable pools (name, APY, TVL, link) for `asset` under `strategy`.
|
|
2797
|
+
* Defaults to the zyfai agent, the only one with pool customization today.
|
|
2798
|
+
*/
|
|
2799
|
+
getPoolCatalog(params: {
|
|
2800
|
+
asset: OwneySupportedTokens;
|
|
2801
|
+
strategy: "conservative" | "aggressive" | "yieldmaxxing";
|
|
2802
|
+
agentId?: AgentId;
|
|
2803
|
+
}): Promise<PoolCatalogProtocol[]>;
|
|
2804
|
+
/**
|
|
2805
|
+
* Apply a user's deposit-time pool selection to their account (ROUT-569).
|
|
2806
|
+
* The request carries explicit pool choices plus the resulting strategy for
|
|
2807
|
+
* each asset reviewed in the deposit flow.
|
|
2808
|
+
*/
|
|
2809
|
+
setPoolSelection(params: {
|
|
2810
|
+
selection: UserPoolSelectionRequest;
|
|
2811
|
+
agentId?: AgentId;
|
|
2812
|
+
}): Promise<void>;
|
|
2813
|
+
/**
|
|
2814
|
+
* The pool selection saved on the user's account (ROUT-650), so the Pools
|
|
2815
|
+
* step can show what applies now rather than the defaults. `pairs` and
|
|
2816
|
+
* `assets` say which protocol/chain lists and strategies to read.
|
|
2817
|
+
*/
|
|
2818
|
+
getPoolSelection(params: {
|
|
2819
|
+
pairs: Array<{
|
|
2820
|
+
protocolId: string;
|
|
2821
|
+
chainId: number;
|
|
2822
|
+
}>;
|
|
2823
|
+
assets: Array<"USDC" | "WETH">;
|
|
2824
|
+
agentId?: AgentId;
|
|
2825
|
+
}): Promise<SavedPoolSelection>;
|
|
2826
|
+
getAccountApy({ agentId, days, tokenSymbol, chainId: scope, }: AccountApyOptions): Promise<OwneyAccountApy | AccountAgentApy>;
|
|
2426
2827
|
/**
|
|
2427
2828
|
* Get transaction history for a specific agent, or all agents.
|
|
2428
2829
|
*
|
|
@@ -2659,6 +3060,7 @@ declare class YieldseekerAgent implements IAgent {
|
|
|
2659
3060
|
private withdrawalVaultHints;
|
|
2660
3061
|
private readWithdrawalPositions;
|
|
2661
3062
|
private resolveWithdrawalLiquidity;
|
|
3063
|
+
hasReadSession(state: ConnectionState, chainId: number): boolean;
|
|
2662
3064
|
getBalances(state: ConnectionState, chainId: number, asset?: OwneySupportedTokens): Promise<AgentBalance>;
|
|
2663
3065
|
verifyWithdrawalBalance(state: ConnectionState, evidence: FundingEvidence, balance: AgentBalance): Promise<AssetReadMetadata | undefined>;
|
|
2664
3066
|
invalidateAllocationRead(state: ConnectionState, chainId: number, asset: OwneySupportedTokens): void;
|
|
@@ -2667,7 +3069,9 @@ declare class YieldseekerAgent implements IAgent {
|
|
|
2667
3069
|
getFundingWallet(state: ConnectionState, chainId: number, asset: OwneySupportedTokens): Promise<string>;
|
|
2668
3070
|
hasExistingDepositFunds(state: ConnectionState, chainId: number, asset: OwneySupportedTokens): Promise<true | undefined>;
|
|
2669
3071
|
getEarnings(state: ConnectionState, chainId: number): Promise<AgentEarnings>;
|
|
2670
|
-
getAccountApy(state: ConnectionState, chainId: number, days: DailyApyDays, tokenSymbol?: string
|
|
3072
|
+
getAccountApy(state: ConnectionState, chainId: number, days: DailyApyDays, tokenSymbol?: string,
|
|
3073
|
+
/** The chart's chain filter (ROUT-479); null is every chain. */
|
|
3074
|
+
scopeChainId?: number | null): Promise<AccountAgentApy>;
|
|
2671
3075
|
getDailyEarnings(state: ConnectionState, chainId: number, days: LookbackDays, tokenSymbol?: string): Promise<AccountDailyEarnings>;
|
|
2672
3076
|
getHistory(state: ConnectionState, chainId: number, options?: HistoryFilters): Promise<OwneyAgentHistory>;
|
|
2673
3077
|
getUserProfile(state: ConnectionState, chainId: number): Promise<AgentUserProfile>;
|
|
@@ -2940,6 +3344,8 @@ type StoredOrder = {
|
|
|
2940
3344
|
chainId: number;
|
|
2941
3345
|
agentId?: string;
|
|
2942
3346
|
operationId?: string;
|
|
3347
|
+
/** The user action's batch (see `DepositOptions.batchId`), carried to the recorded pending deposit. */
|
|
3348
|
+
batchId?: string;
|
|
2943
3349
|
};
|
|
2944
3350
|
/**
|
|
2945
3351
|
* Our routing API accepted these secrets (part 5's opt-in handoff) and
|
|
@@ -3028,4 +3434,4 @@ declare const YIELDSEEKER_WITHDRAW_SERVER_SUBMIT: 1;
|
|
|
3028
3434
|
* Older builds do not export this. */
|
|
3029
3435
|
declare const FUNDING_DEPOSIT_RECOVERY_REPORT: 1;
|
|
3030
3436
|
|
|
3031
|
-
export { type AccountAgentApy, type AccountApyOptions, type AccountDailyEarnings, type AgentApy, type AgentApyDetails, type AgentBalance, AgentChainIncompatibleError, type AgentEarnings, type AgentFundingLedgerAccess, 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 AssetReadMetadata, type AvailableAgent, type AvailableAgentsOptions, type ConnectionState, type DailyApyDays, type DailyEarningsOptions, type DailyEarningsPoint, type DepositAuthorizationReference, type DepositCallback, type DepositOptions, type DepositReplacementValidation, FUNDING_DEPOSIT_RECOVERY_REPORT, FUSION_SECRET_SERVER_PUBLISH, type FundingEvidence, type FundingOperationKind, type FundingOperationLeg, type FundingOperationRow, type FundingProgress, type FundingStage, type HistoryAction, type HistoryFilters, type HistoryOptions, type HistoryTransaction, type IAgent, InvalidHistoryCursorError, type LedgerLegReport, 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 PendingDeposit, type ProviderSnapshotSample, type RebalanceLog, type ReservationAgent, type ReservationReleaseReason, type RpcUrlsConfig, SDK_VERSION, SPONSORED_DEPOSIT_SERVER_BROADCAST, type SwapChainTokens, type SwapDirection, type SwapOrderStatus, type SwapQuote, type SwapQuoteParams, type SwapRail, type SwapStage, type SwapTokenInfo, type SwapTokenSearchResult, type UnsignedUserOperationEvidence, type WithdrawOptions, type WithdrawSwapRecord, type WithdrawSwapStatus, type WithdrawalCompletion, type WithdrawalCompletionContext, type WithdrawalPayoutCandidate, type WithdrawalPayoutScan, type WithdrawalReservationConflict, type WithdrawalReservationMode, type WithdrawalReservationOptions, type WithdrawalSwapRecovery, YIELDSEEKER_WITHDRAW_SERVER_SUBMIT, YieldseekerAgent, type YieldseekerWalletStatus, ZYFAI_REGISTRATION_NOT_SENT_CODES, ZYFAI_SERVER_TASKS, ZYFAI_WITHDRAWAL_NOT_SENT_CODES, ZYFAI_WITHDRAW_DISPATCH_CHECKPOINT, type ZyfaiDepositPlacement, type ZyfaiRpcUrlsConfig, type ZyfaiWithdrawalLifecycle, clearWithdrawSwap, createOwneySIWX, listPendingDeposits, listOrders as listPendingSwaps, listWithdrawSwaps, saveWithdrawSwap, setOwneyDebug, subscribeWithdrawSwaps, updateWithdrawSwap };
|
|
3437
|
+
export { type AccountAgentApy, type AccountApyOptions, type AccountDailyEarnings, type AgentApy, type AgentApyDetails, type AgentBalance, AgentChainIncompatibleError, type AgentEarnings, type AgentFundingLedgerAccess, type AgentHistoryEntry, type AgentHistoryPosition, type AgentId, AgentNotFoundError, type AgentSupportedAsset, type AgentSupportedAssets, type AgentUserProfile, type AgentWithdrawResult, type AgentsApyOptions, type AllocationAgentApy, type AllocationApyOptions, type ApyByChainAndAsset, type ApyCoverage, type ApyHistoryPoint, type Asset, type AssetDailyEarnings, type AssetReadMetadata, type AvailableAgent, type AvailableAgentsOptions, type AvailablePool, type ConnectionState, type DailyApyDays, type DailyEarningsOptions, type DailyEarningsPoint, type DepositAuthorizationReference, type DepositCallback, type DepositOptions, type DepositReplacementValidation, FUNDING_DEPOSIT_RECOVERY_REPORT, FUSION_SECRET_SERVER_PUBLISH, type FundingEvidence, type FundingOperationKind, type FundingOperationLeg, type FundingOperationRow, type FundingProgress, type FundingStage, type HistoryAction, type HistoryFilters, type HistoryOptions, type HistoryTransaction, type IAgent, InvalidHistoryCursorError, type LedgerLegReport, type LookbackDays, NotConnectedError, type OrgPoolPolicy, type OrgPoolSelection, 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 OwneyWithdrawAllLeg, type OwneyWithdrawAllResult, type OwneyWithdrawResult, type PendingDeposit, type PoolCatalogProtocol, type PoolSelectionStrategy, type ProviderSnapshotSample, type RebalanceLog, type ReservationAgent, type ReservationReleaseReason, type RpcUrlsConfig, SDK_VERSION, SPONSORED_DEPOSIT_SERVER_BROADCAST, type SavedPoolSelection, type SwapChainTokens, type SwapDirection, type SwapOrderStatus, type SwapQuote, type SwapQuoteParams, type SwapRail, type SwapStage, type SwapTokenInfo, type SwapTokenSearchResult, type UnsignedUserOperationEvidence, type UserPoolSelection, type UserPoolSelectionRequest, type WithdrawOptions, type WithdrawSwapRecord, type WithdrawSwapStatus, type WithdrawalCompletion, type WithdrawalCompletionContext, type WithdrawalPayoutCandidate, type WithdrawalPayoutScan, type WithdrawalReservationConflict, type WithdrawalReservationMode, type WithdrawalReservationOptions, type WithdrawalSwapRecovery, YIELDSEEKER_WITHDRAW_SERVER_SUBMIT, YieldseekerAgent, type YieldseekerWalletStatus, ZYFAI_REGISTRATION_NOT_SENT_CODES, ZYFAI_SERVER_TASKS, ZYFAI_WITHDRAWAL_NOT_SENT_CODES, ZYFAI_WITHDRAW_DISPATCH_CHECKPOINT, type ZyfaiDepositPlacement, type ZyfaiRpcUrlsConfig, type ZyfaiWithdrawalLifecycle, clearWithdrawSwap, createOwneySIWX, listPendingDeposits, listOrders as listPendingSwaps, listWithdrawSwaps, saveWithdrawSwap, setOwneyDebug, subscribeWithdrawSwaps, updateWithdrawSwap };
|