@owney/sdk 0.7.32-beta.2 → 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/{chunk-YBMCUL5D.js → chunk-CW55W2WO.js} +83 -5
- package/dist/index.cjs +3505 -590
- package/dist/index.d.cts +769 -11
- package/dist/index.d.ts +769 -11
- package/dist/index.js +3400 -568
- package/dist/{token-batch-family-EKOLMSTD.js → token-batch-family-TUGZWETV.js} +7 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -275,6 +275,13 @@ type FundingOperationLeg = {
|
|
|
275
275
|
* "definitely not booked".
|
|
276
276
|
*/
|
|
277
277
|
providerBookedAt: string | null;
|
|
278
|
+
/** The provider's own id for this leg (e.g. a withdrawal or deposit id), as stored; null when none. */
|
|
279
|
+
providerRef: string | null;
|
|
280
|
+
/**
|
|
281
|
+
* The server stopped checking this in-flight leg (no outcome was proven).
|
|
282
|
+
* Present only when true; a new fact reported for the leg reopens it.
|
|
283
|
+
*/
|
|
284
|
+
closed?: true;
|
|
278
285
|
};
|
|
279
286
|
/** One ledger operation, as the API returns it. */
|
|
280
287
|
type FundingOperationRow = {
|
|
@@ -356,6 +363,15 @@ interface OwneySDKConfig {
|
|
|
356
363
|
* already-deployed app: set `globalThis.__OWNEY_DEBUG__ = true` in devtools.
|
|
357
364
|
*/
|
|
358
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;
|
|
359
375
|
/**
|
|
360
376
|
* Absolute URL of an ERC-7677 paymaster service. When set, deposits go out as
|
|
361
377
|
* an EIP-5792 `wallet_sendCalls` with `capabilities.paymasterService`, so a
|
|
@@ -380,11 +396,43 @@ interface OwneySDKConfig {
|
|
|
380
396
|
* `OWNEY_WITHDRAWAL_RESERVATION_DISABLED=1` in the environment acts as `"off"`.
|
|
381
397
|
*/
|
|
382
398
|
withdrawalReservation?: "fail-open" | "fail-closed" | "off";
|
|
399
|
+
/**
|
|
400
|
+
* Hand Zyfai withdrawals and deposit registrations, with the user's Zyfai
|
|
401
|
+
* session, to the Owney routing API, which then sends them itself (default
|
|
402
|
+
* off). Only `true`, or a function that returns `true`, opts in.
|
|
403
|
+
*
|
|
404
|
+
* A function is called for each operation, at the moment it would first
|
|
405
|
+
* hand a withdrawal or a registration off, so an app can turn the handoff on
|
|
406
|
+
* or off in open tabs without a reload. A function that throws counts as
|
|
407
|
+
* off.
|
|
408
|
+
*
|
|
409
|
+
* Off, the SDK hands no new operation off, never sends the Zyfai session to
|
|
410
|
+
* Owney for it, and behaves as before. Turning it off never makes the
|
|
411
|
+
* browser send what the server may already hold: an operation this SDK
|
|
412
|
+
* instance already handed off keeps going through the server (its nudges,
|
|
413
|
+
* re-runs, retries and registration recovery). Recovery of a deposit handed
|
|
414
|
+
* off by an earlier page waits until it is on again.
|
|
415
|
+
*/
|
|
416
|
+
zyfaiServerTasks?: boolean | (() => boolean);
|
|
417
|
+
/**
|
|
418
|
+
* Hand each signed cross-chain (Fusion+) order's secrets to the Owney
|
|
419
|
+
* routing API, which publishes them once 1inch is ready, so the swap
|
|
420
|
+
* completes even if the tab closes (default false). Only `true` opts in.
|
|
421
|
+
* Off, the secrets never leave the browser and swaps behave as before. On,
|
|
422
|
+
* the browser still publishes them too.
|
|
423
|
+
*/
|
|
424
|
+
fusionSecretHandoff?: boolean;
|
|
383
425
|
}
|
|
384
426
|
interface ConnectionState {
|
|
385
427
|
provider: any;
|
|
386
428
|
walletAddress: `0x${string}`;
|
|
387
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;
|
|
388
436
|
}
|
|
389
437
|
declare const SUPPORTED_TOKENS: readonly ["USDC", "WETH"];
|
|
390
438
|
declare const SUPPORTED_CHAIN_IDS: readonly [8453, 42161, 1];
|
|
@@ -393,6 +441,44 @@ type OwneySupportedChainId = (typeof SUPPORTED_CHAIN_IDS)[number];
|
|
|
393
441
|
type OwneySupportedChains = (typeof SUPPORTED_CHAINS)[number];
|
|
394
442
|
type OwneySupportedTokens = (typeof SUPPORTED_TOKENS)[number];
|
|
395
443
|
|
|
444
|
+
/** Capability flag: this SDK can hand Zyfai withdrawals and deposit
|
|
445
|
+
* registrations to the server, and marks such legs with evidence `serverTask`.
|
|
446
|
+
* Older builds do not export this. */
|
|
447
|
+
declare const ZYFAI_SERVER_TASKS: 1;
|
|
448
|
+
/** A `zyfai_withdrawal` task that failed with one of these codes never sent
|
|
449
|
+
* the withdrawal to Zyfai. */
|
|
450
|
+
declare const ZYFAI_WITHDRAWAL_NOT_SENT_CODES: ReadonlySet<string>;
|
|
451
|
+
/** A `zyfai_deposit_registration` task that failed with one of these codes
|
|
452
|
+
* never registered the deposit with Zyfai, so the browser may register it. */
|
|
453
|
+
declare const ZYFAI_REGISTRATION_NOT_SENT_CODES: ReadonlySet<string>;
|
|
454
|
+
type ZyfaiTaskResult = {
|
|
455
|
+
providerWithdrawalId?: string;
|
|
456
|
+
providerDepositId?: string;
|
|
457
|
+
txHash?: string;
|
|
458
|
+
asyncPending?: true;
|
|
459
|
+
handedOff?: "reconciler";
|
|
460
|
+
lifecycle?: "failed";
|
|
461
|
+
};
|
|
462
|
+
/**
|
|
463
|
+
* - accepted: the server has a task for this leg (its state and code);
|
|
464
|
+
* - declined: the server proved no task was created (a 200 decline, or a 400,
|
|
465
|
+
* 401, 403, 404, 409 or 429; or `ZYFAI_SERVER_TASKS_OFF_CODE` without the
|
|
466
|
+
* opt-in);
|
|
467
|
+
* - unknown: anything else. The server may have a task.
|
|
468
|
+
*/
|
|
469
|
+
type ZyfaiHandoffAnswer = {
|
|
470
|
+
type: "accepted";
|
|
471
|
+
taskId: string;
|
|
472
|
+
state: string;
|
|
473
|
+
code?: string;
|
|
474
|
+
result: ZyfaiTaskResult;
|
|
475
|
+
} | {
|
|
476
|
+
type: "declined";
|
|
477
|
+
code: string;
|
|
478
|
+
} | {
|
|
479
|
+
type: "unknown";
|
|
480
|
+
};
|
|
481
|
+
|
|
396
482
|
/**
|
|
397
483
|
* One protocol's pool selection on one chain. `pools` holds Zyfai pool NAMES
|
|
398
484
|
* verbatim — matched case-sensitively by customizeBatch, and an unrecognised
|
|
@@ -426,6 +512,97 @@ type OrgAgentConfig = {
|
|
|
426
512
|
poolPolicy?: OrgPoolPolicy | null;
|
|
427
513
|
};
|
|
428
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
|
+
|
|
429
606
|
type DepositCallback = (smartWalletAddress: string, chainId: number, amount: string) => Promise<`0x${string}`> | `0x${string}`;
|
|
430
607
|
/**
|
|
431
608
|
* Read access to the funding ledger, given to agents by the client so they can
|
|
@@ -466,6 +643,33 @@ interface IAgent {
|
|
|
466
643
|
* rejected wallet request cannot happen after another leg has committed.
|
|
467
644
|
*/
|
|
468
645
|
readonly withdrawalRequiresWalletApproval?: boolean;
|
|
646
|
+
/**
|
|
647
|
+
* Settles this agent's own wallet prompts (a login, a session key) so that a
|
|
648
|
+
* following `withdraw` needs none. A multi-agent withdrawal calls it before a
|
|
649
|
+
* wallet-approval agent's owner signature, so two prompts never overlap and
|
|
650
|
+
* this agent can start as soon as that signature was accepted. Never submits
|
|
651
|
+
* a withdrawal. A rejected prompt throws; other failures are left to `withdraw`.
|
|
652
|
+
*/
|
|
653
|
+
prepareWithdrawal?(state: ConnectionState, chainId: number, token: OwneySupportedTokens): Promise<void>;
|
|
654
|
+
/**
|
|
655
|
+
* The adapter can hand its withdrawal to our server (part 4, Zyfai). Only
|
|
656
|
+
* such agents get the plan-time handoff and a `planned` withdraw context;
|
|
657
|
+
* every other agent keeps today's calls.
|
|
658
|
+
*/
|
|
659
|
+
readonly supportsServerTasks?: true;
|
|
660
|
+
/**
|
|
661
|
+
* Hands a planned withdrawal leg to our server before an earlier
|
|
662
|
+
* wallet-approval leg is signed (`after`: those legs' keys). The server sends
|
|
663
|
+
* it once those legs are accepted. Never throws; never withdraws locally.
|
|
664
|
+
* `amount` is the leg's planned share, or "MAX". `beforeRequest` runs right
|
|
665
|
+
* before the request leaves (never when none is sent), so the caller can
|
|
666
|
+
* save the leg's server mark first.
|
|
667
|
+
*/
|
|
668
|
+
handOffPlannedWithdrawal?(state: ConnectionState, chainId: number, token: OwneySupportedTokens, amount: string, ctx: {
|
|
669
|
+
operationId: string;
|
|
670
|
+
after: string[];
|
|
671
|
+
beforeRequest?: () => void;
|
|
672
|
+
}): Promise<ZyfaiHandoffAnswer>;
|
|
469
673
|
disconnect(): Promise<void>;
|
|
470
674
|
activateAgent(state: ConnectionState, chainId: number, asset?: OwneySupportedTokens): Promise<void>;
|
|
471
675
|
/**
|
|
@@ -481,8 +685,49 @@ interface IAgent {
|
|
|
481
685
|
* unchanged rather than break the connect.
|
|
482
686
|
*/
|
|
483
687
|
applyOrgPolicy?(state: ConnectionState, chainId: number, policy: OrgAgentConfig): Promise<void>;
|
|
484
|
-
|
|
485
|
-
|
|
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>;
|
|
714
|
+
deposit(state: ConnectionState, chainId: number, amount: string, asset: OwneySupportedTokens, depositCallback?: DepositCallback, onProgress?: FundingProgress, onBeforeSubmission?: (evidence: FundingEvidence) => void | Promise<void>,
|
|
715
|
+
/** `operationId`: the funding ledger operation. Zyfai hands the deposit's
|
|
716
|
+
* registration to the server with it (only agents with
|
|
717
|
+
* `supportsServerTasks` get it; every other agent keeps today's call). */
|
|
718
|
+
context?: {
|
|
719
|
+
operationId?: string;
|
|
720
|
+
}): Promise<OwneyDepositResult>;
|
|
721
|
+
withdraw(state: ConnectionState, chainId: number, token: OwneySupportedTokens, amount?: string, onProgress?: FundingProgress, gasMode?: "auto" | "sponsored" | "paid", onBeforeSubmission?: FundingProgress, assertCurrent?: () => void,
|
|
722
|
+
/** `operationId`: the funding ledger operation (Yieldseeker opts in to the
|
|
723
|
+
* server-owned send of its sponsored userOp with it; Zyfai hands its
|
|
724
|
+
* withdrawal to the server with it). `planned`: the leg was handed to the
|
|
725
|
+
* server at plan time, so this call nudges that task (only for agents with
|
|
726
|
+
* `supportsServerTasks`). */
|
|
727
|
+
context?: {
|
|
728
|
+
operationId?: string;
|
|
729
|
+
planned?: true;
|
|
730
|
+
}): Promise<AgentWithdrawResult>;
|
|
486
731
|
/** Read-only MAX proof at the owner payout block; never sends another withdrawal. */
|
|
487
732
|
verifyWithdrawalCompletion?(state: ConnectionState, evidence: FundingEvidence): Promise<WithdrawalCompletion>;
|
|
488
733
|
/** A newly observed pool allocation invalidates this asset's portfolio cache only. */
|
|
@@ -504,6 +749,13 @@ interface IAgent {
|
|
|
504
749
|
/** Optional positive proof for a repeat deposit; unknown must fall back to portfolio validation. */
|
|
505
750
|
hasExistingDepositFunds?(state: ConnectionState, chainId: number, asset: OwneySupportedTokens): Promise<true | undefined>;
|
|
506
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;
|
|
507
759
|
getEarnings(state: ConnectionState, chainId: number): Promise<AgentEarnings>;
|
|
508
760
|
/** Funding-ledger read access for earnings holds. Optional; without it an agent behaves as before. */
|
|
509
761
|
setFundingLedgerAccess?(access: AgentFundingLedgerAccess | undefined): void;
|
|
@@ -522,7 +774,14 @@ interface IAgent {
|
|
|
522
774
|
* Optional asset symbol ("USDC" / "WETH") scoping the daily series to a
|
|
523
775
|
* single asset on the chain. Agents without per-asset positions ignore it.
|
|
524
776
|
*/
|
|
525
|
-
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>;
|
|
526
785
|
/**
|
|
527
786
|
* Daily cumulative earnings in token units, scoped to a chain/asset, using
|
|
528
787
|
* the provider's earnings basis. Include an opening snapshot when available
|
|
@@ -604,6 +863,15 @@ type HistoryOptions = {
|
|
|
604
863
|
chainId?: number;
|
|
605
864
|
agentId?: AgentId;
|
|
606
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[];
|
|
607
875
|
};
|
|
608
876
|
type WithdrawOptions = {
|
|
609
877
|
/** Internal orchestration observation deadline; never retries a send. */
|
|
@@ -628,6 +896,12 @@ type WithdrawOptions = {
|
|
|
628
896
|
* their own so the app record and the ledger share one reference. It is also
|
|
629
897
|
* the withdrawal reservation's operationId. */
|
|
630
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;
|
|
631
905
|
/**
|
|
632
906
|
* Cross-device withdrawal reservation options.
|
|
633
907
|
* - `override`: the `reference` from an overridable `RESERVED_ELSEWHERE`
|
|
@@ -637,6 +911,11 @@ type WithdrawOptions = {
|
|
|
637
911
|
* this SDK still has that operation's holder token; otherwise ignored.
|
|
638
912
|
*/
|
|
639
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;
|
|
640
919
|
};
|
|
641
920
|
/** `WithdrawOptions.reservation`: see there. */
|
|
642
921
|
type WithdrawalReservationOptions = {
|
|
@@ -646,6 +925,18 @@ type WithdrawalReservationOptions = {
|
|
|
646
925
|
type AccountApyOptions = {
|
|
647
926
|
agentId?: AgentId;
|
|
648
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";
|
|
649
940
|
/**
|
|
650
941
|
* Optional asset symbol (e.g. "USDC", "WETH") to scope the daily APY series
|
|
651
942
|
* to a specific asset on the active chain. Without it the series blends every
|
|
@@ -663,6 +954,14 @@ type AccountApyOptions = {
|
|
|
663
954
|
type DailyEarningsOptions = {
|
|
664
955
|
agentId?: AgentId;
|
|
665
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[];
|
|
666
965
|
/**
|
|
667
966
|
* Optional asset symbol (e.g. "USDC", "WETH") scoping the series to one
|
|
668
967
|
* asset on the active chain.
|
|
@@ -693,6 +992,10 @@ type DepositOptions = {
|
|
|
693
992
|
assertSubmissionCurrent?: () => void;
|
|
694
993
|
/** Resume only these already signed relayer bytes; never create a new authorization. */
|
|
695
994
|
resumeTxHash?: `0x${string}`;
|
|
995
|
+
/** Resume only the saved signed batch of a deposit the server may be sending
|
|
996
|
+
* (its prepare got no answer, so no transaction hash is known); never create
|
|
997
|
+
* a new authorization. Check it first with `canResumePendingDeposit`. */
|
|
998
|
+
resumeSavedBatch?: true;
|
|
696
999
|
onProgress?: FundingProgress;
|
|
697
1000
|
/** Awaited immediately before dispatch. Throwing prevents submission.
|
|
698
1001
|
* All legs of an atomic batch are checkpointed together. */
|
|
@@ -705,6 +1008,24 @@ type DepositOptions = {
|
|
|
705
1008
|
/** Funding ledger reference (a UUID). Defaults to a new random UUID; apps pass
|
|
706
1009
|
* their own so the app record and the ledger share one reference. */
|
|
707
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;
|
|
708
1029
|
};
|
|
709
1030
|
|
|
710
1031
|
type FundingStage = "pending" | "confirmed" | "unknown" | "failed" | "not-applicable";
|
|
@@ -752,21 +1073,68 @@ interface FundingEvidence {
|
|
|
752
1073
|
maxCompletion?: WithdrawalCompletionContext;
|
|
753
1074
|
maxCompletionCheck?: WithdrawalCompletion;
|
|
754
1075
|
intendedAmount: string;
|
|
1076
|
+
/** A multi-agent withdrawal recorded this leg's planned amount (`intendedAmount`:
|
|
1077
|
+
* the leg's share, or "MAX") before any agent was dispatched. A plan, not a
|
|
1078
|
+
* submission: it never says the leg was sent. */
|
|
1079
|
+
planned?: true;
|
|
1080
|
+
/** The owner-authorized call of a wallet-approval withdrawal was accepted: the
|
|
1081
|
+
* bundler accepted the signed userOp (`userOpHash`), the wallet returned a
|
|
1082
|
+
* calls ID (`callsId`), or `eth_sendTransaction` returned a hash (`txHash`).
|
|
1083
|
+
* Not confirmation: the call can still revert. */
|
|
1084
|
+
ownerAuthorization?: "accepted";
|
|
755
1085
|
confirmedAmount?: string;
|
|
756
1086
|
/** Receipt delivery and fulfillment of a typed requested amount are separate facts. */
|
|
757
1087
|
amountCompletion?: "complete" | "shortfall";
|
|
758
1088
|
/** Verified difference between the typed request and the actual owner payout. */
|
|
759
1089
|
shortfallAmount?: string;
|
|
760
1090
|
txHash?: string;
|
|
1091
|
+
/** Zyfai's id for this deposit, from its registration (1-128 chars); reads its placement status. */
|
|
1092
|
+
providerDepositId?: string;
|
|
761
1093
|
/** Persisted before a sponsored EOA operation is sent. */
|
|
762
1094
|
userOpHash?: string;
|
|
763
1095
|
/** Lets recovery verify a consumed nonce even if a bundler forgets the operation. */
|
|
764
1096
|
userOperation?: UnsignedUserOperationEvidence;
|
|
765
1097
|
/** Base Account calls ID used to recover an uncertain wallet submission. */
|
|
766
1098
|
callsId?: string;
|
|
1099
|
+
/** The server owns this sponsored Yieldseeker userOp's send (true), or may
|
|
1100
|
+
* own it ("unknown": the opted-in send got no definitive answer). Either way
|
|
1101
|
+
* the leg is never "not sent". Not acceptance, not confirmation. Never sent
|
|
1102
|
+
* to the ledger. */
|
|
1103
|
+
serverSubmit?: true | "unknown";
|
|
1104
|
+
/** Zyfai server tasks. On a withdrawal leg: the server sends this withdrawal
|
|
1105
|
+
* (true), or may send it ("unknown": the handoff got no definitive answer),
|
|
1106
|
+
* so the browser never sends it. `false`: the server proved it has no task
|
|
1107
|
+
* for this leg, so the browser sends it; it clears an earlier mark (a
|
|
1108
|
+
* handoff checkpoint), and a merge must let it win over true and "unknown".
|
|
1109
|
+
* On a deposit leg: the server registers this deposit. Not acceptance, not
|
|
1110
|
+
* confirmation. Never sent to the ledger. */
|
|
1111
|
+
serverTask?: true | "unknown" | false;
|
|
1112
|
+
/** With `serverTask` on a Zyfai deposit leg: the client operation id of the
|
|
1113
|
+
* server's registration task, so registration recovery can nudge that task
|
|
1114
|
+
* after a reload. Not a secret. Never sent to the ledger. */
|
|
1115
|
+
serverTaskOperationId?: string;
|
|
1116
|
+
/** With `serverTask: "unknown"` on a Zyfai deposit leg: what the server
|
|
1117
|
+
* answered to the registration handoff. "lost": no answer (the server may
|
|
1118
|
+
* or may not have a task), so a later proof of no task lets the browser
|
|
1119
|
+
* register it. "declined": the server declined it with a code that does not
|
|
1120
|
+
* prove no task (e.g. ALREADY_REGISTERED), so the browser never registers
|
|
1121
|
+
* it. Local only: never sent to the ledger. */
|
|
1122
|
+
serverTaskCreate?: "declined" | "lost";
|
|
767
1123
|
/** Deposit execution was attempted, rather than only prepared. Not confirmation. */
|
|
768
1124
|
depositSubmission?: "started";
|
|
769
1125
|
depositAuthorization?: DepositAuthorizationReference;
|
|
1126
|
+
/** The server accepted this sponsored deposit and sends it itself if the
|
|
1127
|
+
* browser does not (true), or may have accepted it ("unknown": the prepare
|
|
1128
|
+
* got no definitive answer, no hash is known yet). Either way it is never
|
|
1129
|
+
* "not sent". Not confirmation. */
|
|
1130
|
+
serverBroadcast?: true | "unknown";
|
|
1131
|
+
/** With `serverBroadcast: "unknown"`: the deposit authorization's Permit2
|
|
1132
|
+
* deadline (unix seconds). After it no deposit of that authorization can
|
|
1133
|
+
* execute. */
|
|
1134
|
+
authorizationDeadline?: number;
|
|
1135
|
+
/** With `serverBroadcast`: the deposit authorization's Permit2 nonce
|
|
1136
|
+
* (decimal); see `checkDepositAuthorization`. */
|
|
1137
|
+
permit2Nonce?: string;
|
|
770
1138
|
blockNumber?: string;
|
|
771
1139
|
logIndexes?: number[];
|
|
772
1140
|
transferLogs?: {
|
|
@@ -777,7 +1145,7 @@ interface FundingEvidence {
|
|
|
777
1145
|
withdrawalRequest?: {
|
|
778
1146
|
attempted: boolean;
|
|
779
1147
|
method?: "GET" | "POST";
|
|
780
|
-
/** The route that answered
|
|
1148
|
+
/** The route that answered. v1 paths appear only in evidence saved before @zyfai/sdk 0.10.0. */
|
|
781
1149
|
path?: "/users/withdraw" | "/users/partial-withdraw" | "/users/withdraw/v2" | "/users/partial-withdraw/v2";
|
|
782
1150
|
elapsedMs?: number;
|
|
783
1151
|
/** Actual response status captured before the vendor replaces the HTTP error. */
|
|
@@ -805,6 +1173,26 @@ type ZyfaiWithdrawalLifecycle = {
|
|
|
805
1173
|
syncSettled: boolean;
|
|
806
1174
|
/** Hash of the synchronous payout transaction; present only when well formed. */
|
|
807
1175
|
syncTxHash?: `0x${string}`;
|
|
1176
|
+
/** Delayed (protocol-cooldown) redemption legs; empty when none or unreadable. */
|
|
1177
|
+
asyncLegs: {
|
|
1178
|
+
id: string;
|
|
1179
|
+
status: string;
|
|
1180
|
+
estimatedClaimAt?: string;
|
|
1181
|
+
claimTxHash?: `0x${string}`;
|
|
1182
|
+
}[];
|
|
1183
|
+
/** Ids of delayed legs Zyfai reports as failed. */
|
|
1184
|
+
failedAsyncIds: string[];
|
|
1185
|
+
/** When the delayed part is expected to arrive; present only when a valid date. */
|
|
1186
|
+
estimatedClaimAt?: string;
|
|
1187
|
+
/** Zyfai recorded an error for this withdrawal. Its text is never carried. */
|
|
1188
|
+
hasError: boolean;
|
|
1189
|
+
};
|
|
1190
|
+
/** The part of Zyfai's deposit status (`GET /users/deposits/{id}/v2`) that Owney acts on. */
|
|
1191
|
+
type ZyfaiDepositPlacement = {
|
|
1192
|
+
/** `handover_pending | credited | position_pending | positioned | recovered_to_eoa`. */
|
|
1193
|
+
status: string;
|
|
1194
|
+
/** `pending | positioned | skipped | failed`. */
|
|
1195
|
+
positionOutcome?: string;
|
|
808
1196
|
};
|
|
809
1197
|
interface AssetReadMetadata {
|
|
810
1198
|
chainId: number;
|
|
@@ -917,6 +1305,19 @@ interface OwneyPendingAllocation {
|
|
|
917
1305
|
/** ISO timestamp from Zyfai's `updatedAt`, when the payload carries one. */
|
|
918
1306
|
since?: string;
|
|
919
1307
|
}
|
|
1308
|
+
/**
|
|
1309
|
+
* A Zyfai delayed redemption in flight (`REQUESTED` or `CLAIMABLE`). Its funds
|
|
1310
|
+
* are in neither `positions` nor `tokens`; display-only, never added to a total.
|
|
1311
|
+
*/
|
|
1312
|
+
interface OwneyPendingWithdrawal {
|
|
1313
|
+
id: string;
|
|
1314
|
+
status: string;
|
|
1315
|
+
chainId: number;
|
|
1316
|
+
/** Token symbol as Zyfai reports it. */
|
|
1317
|
+
asset: string;
|
|
1318
|
+
/** Redeemed amount in least units, as a decimal string. */
|
|
1319
|
+
amountRaw: string;
|
|
1320
|
+
}
|
|
920
1321
|
interface AgentBalance {
|
|
921
1322
|
readMetadata?: AssetReadMetadata[];
|
|
922
1323
|
/** Authoritative native balances per asset/network, including idle and invested funds. */
|
|
@@ -940,6 +1341,41 @@ interface AgentBalance {
|
|
|
940
1341
|
positions?: OwneyPosition[];
|
|
941
1342
|
/** Funds received but not yet deployed. Omitted when nothing is pending. */
|
|
942
1343
|
pendingAllocations?: OwneyPendingAllocation[];
|
|
1344
|
+
/** Zyfai only: delayed redemptions still in flight. Omitted when none. Never part of a total. */
|
|
1345
|
+
pendingWithdrawals?: OwneyPendingWithdrawal[];
|
|
1346
|
+
/**
|
|
1347
|
+
* Zyfai only: every delayed redemption Zyfai lists except FAILED, recently
|
|
1348
|
+
* CLAIMED ones included (Zyfai keeps them about a day). Present, possibly
|
|
1349
|
+
* empty, whenever Zyfai sent the list; absent when it did not. Empty means no
|
|
1350
|
+
* older delayed payout can be landing now. Never part of a total.
|
|
1351
|
+
*/
|
|
1352
|
+
recentAsyncWithdrawals?: OwneyRecentAsyncWithdrawal[];
|
|
1353
|
+
}
|
|
1354
|
+
/** A delayed Zyfai redemption by status, for telling a new payout from an older remainder. */
|
|
1355
|
+
type OwneyRecentAsyncWithdrawal = {
|
|
1356
|
+
id: string;
|
|
1357
|
+
status: string;
|
|
1358
|
+
chainId: number;
|
|
1359
|
+
asset: string;
|
|
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[];
|
|
943
1379
|
}
|
|
944
1380
|
interface OwneyBalances {
|
|
945
1381
|
totalBalance: string;
|
|
@@ -981,6 +1417,36 @@ interface ApyHistoryPoint {
|
|
|
981
1417
|
unit: string;
|
|
982
1418
|
};
|
|
983
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
|
+
}
|
|
984
1450
|
interface AccountAgentApy {
|
|
985
1451
|
walletAddress: string;
|
|
986
1452
|
weightedApyAfterFee?: number;
|
|
@@ -991,6 +1457,8 @@ interface AccountAgentApy {
|
|
|
991
1457
|
* date. Empty when the provider returns no daily history.
|
|
992
1458
|
*/
|
|
993
1459
|
history?: ApyHistoryPoint[];
|
|
1460
|
+
/** Which chains/assets this history can be filtered down to. */
|
|
1461
|
+
coverage?: ApyCoverage;
|
|
994
1462
|
}
|
|
995
1463
|
interface OwneyAccountApy {
|
|
996
1464
|
totalApy: string;
|
|
@@ -1050,19 +1518,42 @@ interface AgentHistoryPosition {
|
|
|
1050
1518
|
protocol: string;
|
|
1051
1519
|
pool?: string;
|
|
1052
1520
|
tokenSymbol?: string;
|
|
1521
|
+
/** The position balance after the action (decimal string, token units). */
|
|
1053
1522
|
amount?: string;
|
|
1523
|
+
/**
|
|
1524
|
+
* The amount the action actually moved (decimal string, token units), as
|
|
1525
|
+
* opposed to `amount`, the resulting position balance. Present only when the
|
|
1526
|
+
* provider reports it; withheld on withdrawals.
|
|
1527
|
+
*/
|
|
1528
|
+
deltaAmount?: string;
|
|
1054
1529
|
}
|
|
1055
1530
|
interface AgentHistoryEntry {
|
|
1056
1531
|
/** Stable provider/transfer identity, independent of row order. */
|
|
1057
1532
|
id?: string;
|
|
1058
1533
|
agent: AgentId;
|
|
1059
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;
|
|
1060
1544
|
date: string;
|
|
1061
1545
|
oldApy: string | null;
|
|
1062
1546
|
newApy: string | null;
|
|
1063
1547
|
transactions: HistoryTransaction[];
|
|
1064
1548
|
rebalanceLog: RebalanceLog[];
|
|
1065
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;
|
|
1066
1557
|
}
|
|
1067
1558
|
interface OwneyAgentHistory {
|
|
1068
1559
|
agentErrors?: Partial<Record<AgentId, string>>;
|
|
@@ -1179,9 +1670,12 @@ type WithdrawalPayoutScan = {
|
|
|
1179
1670
|
candidates: WithdrawalPayoutCandidate[];
|
|
1180
1671
|
/** Last block scanned (inclusive, decimal). Pass it back as the next `cursor`. */
|
|
1181
1672
|
scannedTo: string;
|
|
1673
|
+
/** False when the call stopped at its request limit before the scan end (the
|
|
1674
|
+
* head minus the reorg margin), so more blocks are already waiting. */
|
|
1675
|
+
caughtUp: boolean;
|
|
1182
1676
|
};
|
|
1183
1677
|
|
|
1184
|
-
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";
|
|
1185
1679
|
declare class OwneyError extends Error {
|
|
1186
1680
|
readonly code: OwneyErrorCode;
|
|
1187
1681
|
readonly details?: Record<string, unknown>;
|
|
@@ -1234,6 +1728,12 @@ type WithdrawSwapRecord = {
|
|
|
1234
1728
|
* is continued or rechecked. Absent on records written by an older SDK.
|
|
1235
1729
|
*/
|
|
1236
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;
|
|
1237
1737
|
recovery?: WithdrawalSwapRecovery;
|
|
1238
1738
|
spent?: string;
|
|
1239
1739
|
dismissed?: boolean;
|
|
@@ -1328,6 +1828,11 @@ type PendingDeposit = {
|
|
|
1328
1828
|
* it. Absent on records written by an older SDK.
|
|
1329
1829
|
*/
|
|
1330
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;
|
|
1331
1836
|
};
|
|
1332
1837
|
/** Every record, dismissed ones included, newest first. Sweeps as it goes. */
|
|
1333
1838
|
declare function listPendingDeposits(now?: number): PendingDeposit[];
|
|
@@ -1351,17 +1856,26 @@ declare class OwneySDK {
|
|
|
1351
1856
|
private zyfaiRpcUrls?;
|
|
1352
1857
|
private yieldseekerApiBaseUrl?;
|
|
1353
1858
|
private yieldseekerSiweOrigin?;
|
|
1859
|
+
private userPoolCustomization;
|
|
1354
1860
|
private routingApiBaseUrl?;
|
|
1355
1861
|
private referralSource?;
|
|
1356
1862
|
private readonly ledger;
|
|
1357
1863
|
private readonly reservationMode;
|
|
1358
1864
|
private readonly reservationTransport;
|
|
1865
|
+
/** The caller's Zyfai server tasks opt-in: `true`, a function read each
|
|
1866
|
+
* time a handoff would start (F-I2(iii)), or undefined (off). */
|
|
1867
|
+
private readonly zyfaiServerTasks;
|
|
1868
|
+
/** The caller opted in to the Fusion+ secret handoff (`fusionSecretHandoff: true`). */
|
|
1869
|
+
private readonly fusionSecretHandoff;
|
|
1359
1870
|
private cachedSponsoredCallback;
|
|
1360
1871
|
private cachedWethSponsoredCallback;
|
|
1361
1872
|
private paymasterServiceUrl?;
|
|
1362
1873
|
private cachedSponsoredCallsCallbacks;
|
|
1363
1874
|
private readonly agentReads;
|
|
1364
1875
|
private readonly depositFamilyReads;
|
|
1876
|
+
/** Movements (owner, chain, agent, token, tx hash) whose balance refresh this
|
|
1877
|
+
* session started: true when it armed the refresh, false when its deadline
|
|
1878
|
+
* had passed (it only dropped the cache and forced one snapshot read). */
|
|
1365
1879
|
private readonly recoveredFundingReads;
|
|
1366
1880
|
private fundingBalanceChecks;
|
|
1367
1881
|
private readonly activationChecks;
|
|
@@ -1394,8 +1908,16 @@ declare class OwneySDK {
|
|
|
1394
1908
|
/** Starts a swap's operation and opens it to the swap's inner deposit or
|
|
1395
1909
|
* withdrawal. Never throws: reporting never blocks a swap. */
|
|
1396
1910
|
private openSwapLedger;
|
|
1911
|
+
/**
|
|
1912
|
+
* Part 5: the swap's ledger identity, for the executor's Fusion+ secret
|
|
1913
|
+
* handoff. Only with the `fusionSecretHandoff` opt-in and an open operation;
|
|
1914
|
+
* otherwise undefined, and the executor sends nothing. Owner and token are
|
|
1915
|
+
* lowercased, as the ledger reports them.
|
|
1916
|
+
*/
|
|
1917
|
+
private secretHandoffFor;
|
|
1397
1918
|
private closeSwapLedger;
|
|
1398
|
-
/** Reports one agent's withdrawal evidence as its leg
|
|
1919
|
+
/** Reports one agent's withdrawal evidence as its leg (with `errorCode`, when
|
|
1920
|
+
* given). Never throws. */
|
|
1399
1921
|
private ledgerWithdrawalLeg;
|
|
1400
1922
|
/** Operation/leg/tx keys whose provider samples are already scheduled. */
|
|
1401
1923
|
private readonly providerSampleKeys;
|
|
@@ -1474,6 +1996,16 @@ declare class OwneySDK {
|
|
|
1474
1996
|
private getAgent;
|
|
1475
1997
|
getActiveAgentIds(): AgentId[];
|
|
1476
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;
|
|
1477
2009
|
/**
|
|
1478
2010
|
* Read the org's agent policy once and reuse it. fetchOrgAgentConfig never
|
|
1479
2011
|
* throws — it degrades to null — so this cannot break activation.
|
|
@@ -1579,6 +2111,23 @@ declare class OwneySDK {
|
|
|
1579
2111
|
* false, so the minimum is enforced as today.
|
|
1580
2112
|
*/
|
|
1581
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;
|
|
1582
2131
|
private validateAssetSupport;
|
|
1583
2132
|
private getEligibleAgents;
|
|
1584
2133
|
/**
|
|
@@ -1595,6 +2144,24 @@ declare class OwneySDK {
|
|
|
1595
2144
|
refreshBalance?: boolean;
|
|
1596
2145
|
requireAmountMatch?: boolean;
|
|
1597
2146
|
}): Promise<FundingEvidence>;
|
|
2147
|
+
private noteFundingRefresh;
|
|
2148
|
+
/**
|
|
2149
|
+
* Re-arms an agent's balance refresh after a confirmed deposit or withdrawal
|
|
2150
|
+
* the caller already verified (e.g. after a page reload, which loses the
|
|
2151
|
+
* refresh the SDK started in memory). Same refresh as receipt recovery
|
|
2152
|
+
* (`inspectFunding`), without a receipt read, and shared with it: once per
|
|
2153
|
+
* movement (`txHash`) in this SDK session, unless that recovery came after
|
|
2154
|
+
* its own deadline and so armed nothing. `until` bounds it (the agent caps
|
|
2155
|
+
* it further). Returns false when the agent has no such refresh or `until`
|
|
2156
|
+
* has passed; throws when not connected or on another chain. Never prompts.
|
|
2157
|
+
*/
|
|
2158
|
+
refreshAgentBalanceAfterMovement(input: {
|
|
2159
|
+
agentId: AgentId;
|
|
2160
|
+
chainId: number;
|
|
2161
|
+
token: OwneySupportedTokens;
|
|
2162
|
+
txHash?: string;
|
|
2163
|
+
until: number;
|
|
2164
|
+
}): boolean;
|
|
1598
2165
|
/**
|
|
1599
2166
|
* Lists on-chain payout candidates for a withdrawal the provider accepted
|
|
1600
2167
|
* without a hash: ERC-20 `Transfer` logs on the evidence's token that reach
|
|
@@ -1622,6 +2189,26 @@ declare class OwneySDK {
|
|
|
1622
2189
|
/** Whether a foreground deposit can resume the same signed batch, never a
|
|
1623
2190
|
* fresh authorization. The batch rail independently rechecks the exact plan. */
|
|
1624
2191
|
canResumePendingDeposit(evidences: FundingEvidence[], amount: string): Promise<boolean>;
|
|
2192
|
+
/** Whether a Permit2 deposit authorization can still execute and whether it
|
|
2193
|
+
* did: `expired` when the finalized block is more than 300 s past
|
|
2194
|
+
* `deadline` (chain time), `used` when the owner's Permit2 nonce bit is set
|
|
2195
|
+
* at that block. Null when anything cannot be read. Never throws. */
|
|
2196
|
+
checkDepositAuthorization(input: {
|
|
2197
|
+
chainId: number;
|
|
2198
|
+
owner: string;
|
|
2199
|
+
token?: string;
|
|
2200
|
+
permit2Nonce: string;
|
|
2201
|
+
deadline: number;
|
|
2202
|
+
}): Promise<{
|
|
2203
|
+
expired: boolean;
|
|
2204
|
+
used: boolean;
|
|
2205
|
+
} | null>;
|
|
2206
|
+
/** Drops the saved signed body of a hashless deposit the server may have
|
|
2207
|
+
* been sending (`serverBroadcast` 'unknown'/true, no hash) once the app has
|
|
2208
|
+
* settled it another way: by the ledger's hash or its expired deadline.
|
|
2209
|
+
* Only the body with this Permit2 deadline and these exact shares is
|
|
2210
|
+
* dropped, so it never resumes or blocks a different deposit. Never throws. */
|
|
2211
|
+
discardSavedDepositBatch(evidences: FundingEvidence[]): Promise<boolean>;
|
|
1625
2212
|
/** Validate signed journal membership, never just a caller-supplied family ID. */
|
|
1626
2213
|
validateDepositReplacement(previous: FundingEvidence[], next: FundingEvidence[]): Promise<DepositReplacementValidation | undefined>;
|
|
1627
2214
|
/** Optional post-payout display proof; receipt verification and the provider
|
|
@@ -1635,6 +2222,9 @@ declare class OwneySDK {
|
|
|
1635
2222
|
/** A Zyfai withdrawal's lifecycle by the id recorded on its evidence. Never signs,
|
|
1636
2223
|
* prompts or authenticates; `null` when unavailable or not this wallet's Zyfai withdrawal. */
|
|
1637
2224
|
getZyfaiWithdrawal(evidence: FundingEvidence): Promise<ZyfaiWithdrawalLifecycle | null>;
|
|
2225
|
+
/** A Zyfai deposit's placement status by the id recorded on its evidence. Never signs,
|
|
2226
|
+
* prompts or authenticates; `null` when unavailable or not this wallet's Zyfai deposit. */
|
|
2227
|
+
getZyfaiDeposit(evidence: FundingEvidence): Promise<ZyfaiDepositPlacement | null>;
|
|
1638
2228
|
/** On-chain version and ownership status for this owner's Yieldseeker agent. */
|
|
1639
2229
|
getYieldseekerWalletStatus(asset: OwneySupportedTokens): Promise<YieldseekerWalletStatus | null>;
|
|
1640
2230
|
/** Deployment gate; an unavailable response keeps the current paid path. */
|
|
@@ -1690,6 +2280,18 @@ declare class OwneySDK {
|
|
|
1690
2280
|
* would strand funds we might have been able to move.
|
|
1691
2281
|
*/
|
|
1692
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;
|
|
1693
2295
|
private readTokenBalance;
|
|
1694
2296
|
/** How much of `token` the wallet has already approved Permit2 to move. */
|
|
1695
2297
|
private readTokenPermit2Allowance;
|
|
@@ -1701,12 +2303,36 @@ declare class OwneySDK {
|
|
|
1701
2303
|
* wallet calls also cover approval without spending the received tokens.
|
|
1702
2304
|
*/
|
|
1703
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;
|
|
1704
2321
|
private walletSeesBalance;
|
|
1705
2322
|
/**
|
|
1706
2323
|
* Runs a quoted swap. A named seam rather than an inline `executeSwap` call
|
|
1707
2324
|
* so the deposit half of `swapAndDeposit` can be exercised on its own.
|
|
1708
2325
|
*/
|
|
1709
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>;
|
|
1710
2336
|
/**
|
|
1711
2337
|
* The half of the swap deps that only ever talks to the routing API.
|
|
1712
2338
|
*
|
|
@@ -1902,6 +2528,9 @@ declare class OwneySDK {
|
|
|
1902
2528
|
assertCurrent?: () => void;
|
|
1903
2529
|
/** Funding-ledger reference for this swap and its deposit. Generated when omitted. */
|
|
1904
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;
|
|
1905
2534
|
}): Promise<{
|
|
1906
2535
|
swap: {
|
|
1907
2536
|
received: string;
|
|
@@ -2017,6 +2646,12 @@ declare class OwneySDK {
|
|
|
2017
2646
|
* omitted; a continuation reuses the one saved on its record.
|
|
2018
2647
|
*/
|
|
2019
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;
|
|
2020
2655
|
}): Promise<{
|
|
2021
2656
|
withdraw: OwneyWithdrawResult | AgentWithdrawResult;
|
|
2022
2657
|
/** What actually arrived in the wallet, smallest unit of the agent's asset. */
|
|
@@ -2071,6 +2706,13 @@ declare class OwneySDK {
|
|
|
2071
2706
|
* hold this SDK does not know about is left to the server's expiry.
|
|
2072
2707
|
*/
|
|
2073
2708
|
releaseWithdrawalReservation(operationId: string, reason: ReservationReleaseReason, agents?: ReservationAgent[]): Promise<void>;
|
|
2709
|
+
/**
|
|
2710
|
+
* Reports a withdrawal step the app closed as never sent (a reload before its
|
|
2711
|
+
* request was saved) as a failed ledger leg with `NOT_SUBMITTED`, so other
|
|
2712
|
+
* devices and later recovery stop treating it as in flight. Refuses any step
|
|
2713
|
+
* with a hash or a saved request. Never touches the hold; never throws.
|
|
2714
|
+
*/
|
|
2715
|
+
reportWithdrawalNotSubmitted(operationId: string, evidence: FundingEvidence): Promise<void>;
|
|
2074
2716
|
/**
|
|
2075
2717
|
* Reports a withdrawal leg that was proven after its call ended (a hashless
|
|
2076
2718
|
* Zyfai payout found on chain or in history) to the funding ledger, then
|
|
@@ -2081,6 +2723,15 @@ declare class OwneySDK {
|
|
|
2081
2723
|
* the server re-verifies the hash. Never throws.
|
|
2082
2724
|
*/
|
|
2083
2725
|
reportWithdrawalRecovery(operationId: string, evidence: FundingEvidence): Promise<void>;
|
|
2726
|
+
/**
|
|
2727
|
+
* Reports a deposit leg that the app's recovery verified on chain after its
|
|
2728
|
+
* call ended to the funding ledger. Only evidence whose transfer is confirmed
|
|
2729
|
+
* with a transaction hash is reported; anything else is ignored. The ledger
|
|
2730
|
+
* PATCHes the existing operation (creating it only on a 404) and the server
|
|
2731
|
+
* re-verifies the hash. Deposits hold no reservation, so nothing is released.
|
|
2732
|
+
* Never throws.
|
|
2733
|
+
*/
|
|
2734
|
+
reportDepositRecovery(operationId: string, evidence: FundingEvidence): Promise<void>;
|
|
2084
2735
|
private withdrawFromAgents;
|
|
2085
2736
|
/** Read-only invalidation after new pool-deposit activity. Does not restart
|
|
2086
2737
|
* funding reconciliation, bypass cooldowns, or authorize a transaction. */
|
|
@@ -2090,10 +2741,24 @@ declare class OwneySDK {
|
|
|
2090
2741
|
* @param agentId - Optional. Agent to query. Omit for aggregated balances.
|
|
2091
2742
|
* @returns {AgentBalance} for a single agent, or {OwneyBalances} with totalBalance and per-agent breakdown
|
|
2092
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>;
|
|
2093
2757
|
getBalances(agentId?: AgentId, options?: {
|
|
2094
2758
|
chainId?: number;
|
|
2095
2759
|
asset?: OwneySupportedTokens;
|
|
2096
2760
|
}): Promise<OwneyBalances | AgentBalance>;
|
|
2761
|
+
private readBalances;
|
|
2097
2762
|
/** Preserve failure objects for withdrawal recovery without changing public balance results. */
|
|
2098
2763
|
private readAggregatedBalances;
|
|
2099
2764
|
/**
|
|
@@ -2125,8 +2790,40 @@ declare class OwneySDK {
|
|
|
2125
2790
|
* subtract from the total. Without an agentId the series is the sum of the
|
|
2126
2791
|
* agents that answered.
|
|
2127
2792
|
*/
|
|
2128
|
-
getDailyEarnings({ agentId, days, tokenSymbol, }: DailyEarningsOptions): Promise<AccountDailyEarnings>;
|
|
2129
|
-
|
|
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>;
|
|
2130
2827
|
/**
|
|
2131
2828
|
* Get transaction history for a specific agent, or all agents.
|
|
2132
2829
|
*
|
|
@@ -2290,6 +2987,9 @@ declare class YieldseekerAgent implements IAgent {
|
|
|
2290
2987
|
private readonly endpointReadFailures;
|
|
2291
2988
|
private readonly reconcileUntil;
|
|
2292
2989
|
private readonly allocationRefresh;
|
|
2990
|
+
/** Contexts whose next permitted snapshot read is forced once: a funding
|
|
2991
|
+
* invalidation with a tx hash (receipt recovery, a re-armed refresh). */
|
|
2992
|
+
private readonly forceNextSnapshot;
|
|
2293
2993
|
private readonly activityRefreshUntil;
|
|
2294
2994
|
private readonly snapshotMovements;
|
|
2295
2995
|
private readonly movementEpochs;
|
|
@@ -2341,7 +3041,9 @@ declare class YieldseekerAgent implements IAgent {
|
|
|
2341
3041
|
disconnect(): Promise<void>;
|
|
2342
3042
|
activateAgent(state: ConnectionState, chainId: number, asset?: OwneySupportedTokens): Promise<void>;
|
|
2343
3043
|
deposit(state: ConnectionState, chainId: number, amount: string, asset: OwneySupportedTokens, depositCallback?: DepositCallback, onProgress?: FundingProgress, onBeforeSubmission?: (evidence: FundingEvidence) => void | Promise<void>): Promise<OwneyDepositResult>;
|
|
2344
|
-
withdraw(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, amount?: string, onProgress?: FundingProgress, gasMode?: "auto" | "sponsored" | "paid", onBeforeSubmission?: FundingProgress, assertOperation?: () => void
|
|
3044
|
+
withdraw(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, amount?: string, onProgress?: FundingProgress, gasMode?: "auto" | "sponsored" | "paid", onBeforeSubmission?: FundingProgress, assertOperation?: () => void, submission?: {
|
|
3045
|
+
operationId?: string;
|
|
3046
|
+
}): Promise<AgentWithdrawResult>;
|
|
2345
3047
|
private withdrawInternal;
|
|
2346
3048
|
/** Fresh position amounts for withdrawal planning, net of reserved fees. */
|
|
2347
3049
|
getWithdrawableBalance(state: ConnectionState, chainId: number, asset: OwneySupportedTokens, minimumAmount?: bigint): Promise<bigint>;
|
|
@@ -2358,6 +3060,7 @@ declare class YieldseekerAgent implements IAgent {
|
|
|
2358
3060
|
private withdrawalVaultHints;
|
|
2359
3061
|
private readWithdrawalPositions;
|
|
2360
3062
|
private resolveWithdrawalLiquidity;
|
|
3063
|
+
hasReadSession(state: ConnectionState, chainId: number): boolean;
|
|
2361
3064
|
getBalances(state: ConnectionState, chainId: number, asset?: OwneySupportedTokens): Promise<AgentBalance>;
|
|
2362
3065
|
verifyWithdrawalBalance(state: ConnectionState, evidence: FundingEvidence, balance: AgentBalance): Promise<AssetReadMetadata | undefined>;
|
|
2363
3066
|
invalidateAllocationRead(state: ConnectionState, chainId: number, asset: OwneySupportedTokens): void;
|
|
@@ -2366,7 +3069,9 @@ declare class YieldseekerAgent implements IAgent {
|
|
|
2366
3069
|
getFundingWallet(state: ConnectionState, chainId: number, asset: OwneySupportedTokens): Promise<string>;
|
|
2367
3070
|
hasExistingDepositFunds(state: ConnectionState, chainId: number, asset: OwneySupportedTokens): Promise<true | undefined>;
|
|
2368
3071
|
getEarnings(state: ConnectionState, chainId: number): Promise<AgentEarnings>;
|
|
2369
|
-
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>;
|
|
2370
3075
|
getDailyEarnings(state: ConnectionState, chainId: number, days: LookbackDays, tokenSymbol?: string): Promise<AccountDailyEarnings>;
|
|
2371
3076
|
getHistory(state: ConnectionState, chainId: number, options?: HistoryFilters): Promise<OwneyAgentHistory>;
|
|
2372
3077
|
getUserProfile(state: ConnectionState, chainId: number): Promise<AgentUserProfile>;
|
|
@@ -2478,6 +3183,10 @@ declare class YieldseekerAgent implements IAgent {
|
|
|
2478
3183
|
private snapshotMovement;
|
|
2479
3184
|
private advancePortfolioVersion;
|
|
2480
3185
|
private requestPortfolioSnapshot;
|
|
3186
|
+
private snapshotPath;
|
|
3187
|
+
/** True while `walletRequest` would refuse a read of `path`: this user's
|
|
3188
|
+
* rate-limit cooldown or that endpoint's outage cooldown. */
|
|
3189
|
+
private readCoolingDown;
|
|
2481
3190
|
private portfolioSnapshot;
|
|
2482
3191
|
private loadPortfolioContext;
|
|
2483
3192
|
private loadActivityContext;
|
|
@@ -2624,6 +3333,26 @@ type StoredOrder = {
|
|
|
2624
3333
|
amount: string;
|
|
2625
3334
|
/** Epoch ms, for ordering recovery records. */
|
|
2626
3335
|
createdAt: number;
|
|
3336
|
+
/**
|
|
3337
|
+
* A swap-deposit's deposit half, so a resume that finishes the swap can
|
|
3338
|
+
* record it (ROUT-625). `received` is the quote's guaranteed minimum. Absent
|
|
3339
|
+
* on plain swaps and on records written by an older SDK.
|
|
3340
|
+
*/
|
|
3341
|
+
pendingDeposit?: {
|
|
3342
|
+
received: string;
|
|
3343
|
+
symbol: string;
|
|
3344
|
+
chainId: number;
|
|
3345
|
+
agentId?: string;
|
|
3346
|
+
operationId?: string;
|
|
3347
|
+
/** The user action's batch (see `DepositOptions.batchId`), carried to the recorded pending deposit. */
|
|
3348
|
+
batchId?: string;
|
|
3349
|
+
};
|
|
3350
|
+
/**
|
|
3351
|
+
* Our routing API accepted these secrets (part 5's opt-in handoff) and
|
|
3352
|
+
* publishes them itself once 1inch is ready. Informational: this browser
|
|
3353
|
+
* still publishes and resumes as before. Absent when no handoff was accepted.
|
|
3354
|
+
*/
|
|
3355
|
+
serverSecrets?: true;
|
|
2627
3356
|
};
|
|
2628
3357
|
/**
|
|
2629
3358
|
* Every unresolved stored order, newest first.
|
|
@@ -2631,6 +3360,13 @@ type StoredOrder = {
|
|
|
2631
3360
|
*/
|
|
2632
3361
|
declare function listOrders(_now?: number): StoredOrder[];
|
|
2633
3362
|
|
|
3363
|
+
/**
|
|
3364
|
+
* Capability flag (part 5): this SDK can hand a signed Fusion+ order's secrets
|
|
3365
|
+
* to the routing API (`handoffSecrets`), which then publishes each one when
|
|
3366
|
+
* 1inch is ready, even if this tab is gone. Older builds do not export this.
|
|
3367
|
+
*/
|
|
3368
|
+
declare const FUSION_SECRET_SERVER_PUBLISH: 1;
|
|
3369
|
+
|
|
2634
3370
|
/**
|
|
2635
3371
|
* Non-blocking funding ledger reporter.
|
|
2636
3372
|
*
|
|
@@ -2676,4 +3412,26 @@ type LedgerLegReport = {
|
|
|
2676
3412
|
};
|
|
2677
3413
|
};
|
|
2678
3414
|
|
|
2679
|
-
|
|
3415
|
+
/** This SDK hands every Zyfai withdrawal request to the caller's
|
|
3416
|
+
* `onBeforeSubmission` before sending it, and a failed checkpoint stops it.
|
|
3417
|
+
* A caller that persisted nothing for a dead run can therefore conclude the
|
|
3418
|
+
* request was never sent. Older builds do not export this. */
|
|
3419
|
+
declare const ZYFAI_WITHDRAW_DISPATCH_CHECKPOINT: 1;
|
|
3420
|
+
|
|
3421
|
+
/** Capability flag: this SDK opts in to the server sending an accepted
|
|
3422
|
+
* sponsored deposit itself (prepare `serverBroadcast: true`) and reports such a
|
|
3423
|
+
* deposit as pending, never "not sent". Older builds do not export this. */
|
|
3424
|
+
declare const SPONSORED_DEPOSIT_SERVER_BROADCAST: 1;
|
|
3425
|
+
|
|
3426
|
+
/** Capability flag: this SDK opts in to the server sending its signed sponsored
|
|
3427
|
+
* Yieldseeker withdrawal userOp itself (`serverSubmit=1` on its own
|
|
3428
|
+
* `eth_sendUserOperation`) and reports such a leg as pending, never "not sent".
|
|
3429
|
+
* Older builds do not export this. */
|
|
3430
|
+
declare const YIELDSEEKER_WITHDRAW_SERVER_SUBMIT: 1;
|
|
3431
|
+
|
|
3432
|
+
/** Capability flag: this SDK has `reportDepositRecovery`, which reports a
|
|
3433
|
+
* deposit leg the app's recovery verified on chain to the funding ledger.
|
|
3434
|
+
* Older builds do not export this. */
|
|
3435
|
+
declare const FUNDING_DEPOSIT_RECOVERY_REPORT: 1;
|
|
3436
|
+
|
|
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 };
|