@owney/sdk 0.7.32-beta.11 → 0.7.32-beta.12
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 +469 -141
- package/dist/index.d.cts +72 -23
- package/dist/index.d.ts +72 -23
- package/dist/index.js +466 -138
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -429,10 +429,9 @@ interface ConnectionState {
|
|
|
429
429
|
chainId: number | null;
|
|
430
430
|
/**
|
|
431
431
|
* Reads under this state use a saved sign-in only: an agent never opens a
|
|
432
|
-
* wallet prompt for them and fails instead.
|
|
433
|
-
*
|
|
434
|
-
*
|
|
435
|
-
* agent signed in, or the user cancelled its sign-in).
|
|
432
|
+
* wallet prompt for them and fails instead. The client sets it on every
|
|
433
|
+
* read (balances, earnings, history...). Connect/activation and user actions
|
|
434
|
+
* (deposit, withdraw) run without it, so they may still ask for a sign-in.
|
|
436
435
|
*/
|
|
437
436
|
promptless?: boolean;
|
|
438
437
|
}
|
|
@@ -711,7 +710,7 @@ interface IAgent {
|
|
|
711
710
|
after: string[];
|
|
712
711
|
beforeRequest?: () => void;
|
|
713
712
|
}): Promise<ZyfaiHandoffAnswer>;
|
|
714
|
-
disconnect(): Promise<void>;
|
|
713
|
+
disconnect(options?: DisconnectOptions): Promise<void>;
|
|
715
714
|
/**
|
|
716
715
|
* Ready the user's account for every asset the agent supports on `chainId`,
|
|
717
716
|
* `asset` first. A failure the provider says will not go away (the user can
|
|
@@ -837,6 +836,12 @@ interface IAgent {
|
|
|
837
836
|
* account was not created through Owney (AGENT_ACCOUNT_NOT_OWNEY). Optional.
|
|
838
837
|
*/
|
|
839
838
|
setAccountRefusedListener?(listener: (() => void) | undefined): void;
|
|
839
|
+
/**
|
|
840
|
+
* Called each time the agent drops a saved sign-in its server refused,
|
|
841
|
+
* outside connect (a read or a withdrawal). Not called where the sign-in is
|
|
842
|
+
* renewed (connect, deposit). Optional.
|
|
843
|
+
*/
|
|
844
|
+
setSignInRefusedListener?(listener: (() => void) | undefined): void;
|
|
840
845
|
/**
|
|
841
846
|
* May this wallet's account use Owney with this agent? Run at connect for
|
|
842
847
|
* every agent about to activate, before any agent activates or is read.
|
|
@@ -906,6 +911,15 @@ type AgentApyOptions = {
|
|
|
906
911
|
chainId?: number;
|
|
907
912
|
};
|
|
908
913
|
|
|
914
|
+
/** Options for `OwneySDK.disconnect` and `IAgent.disconnect`. */
|
|
915
|
+
type DisconnectOptions = {
|
|
916
|
+
/**
|
|
917
|
+
* Keep each agent's saved sign-ins (browser storage) so a later connect for
|
|
918
|
+
* the same wallet needs no new signature. Everything held in memory is
|
|
919
|
+
* still dropped. Default false: saved sign-ins are deleted.
|
|
920
|
+
*/
|
|
921
|
+
keepSignIns?: boolean;
|
|
922
|
+
};
|
|
909
923
|
type AgentId = "zyfai" | "yieldseeker";
|
|
910
924
|
type Asset = string;
|
|
911
925
|
type AgentSupportedAsset = {
|
|
@@ -2002,15 +2016,8 @@ declare class OwneySDK {
|
|
|
2002
2016
|
*/
|
|
2003
2017
|
private disabledAgents;
|
|
2004
2018
|
private readonly accountRefusedListeners;
|
|
2019
|
+
private readonly signInRefusedListeners;
|
|
2005
2020
|
private readonly signInProgressListeners;
|
|
2006
|
-
/**
|
|
2007
|
-
* Agents whose sign-in the user cancelled this session (the wallet rejected
|
|
2008
|
-
* the prompt), keyed by chain. Until the app ends the session they are read
|
|
2009
|
-
* from a saved sign-in only (`readStateFor`), so no read reopens the prompt
|
|
2010
|
-
* the user cancelled. A later successful activation of the agent removes
|
|
2011
|
-
* it, and `disconnect()` or a different wallet's `connect()` clears the map.
|
|
2012
|
-
*/
|
|
2013
|
-
private declinedSignIns;
|
|
2014
2021
|
private state;
|
|
2015
2022
|
private connectionRevision;
|
|
2016
2023
|
private disconnectingAgents;
|
|
@@ -2102,6 +2109,14 @@ declare class OwneySDK {
|
|
|
2102
2109
|
* each time an agent maps such a refusal. Returns the unsubscribe function.
|
|
2103
2110
|
*/
|
|
2104
2111
|
onAccountRefused(listener: (agentId: AgentId) => void): () => void;
|
|
2112
|
+
/**
|
|
2113
|
+
* Listens for an agent dropping a saved sign-in its server refused, outside
|
|
2114
|
+
* connect (a read or a withdrawal found it refused). The agent will not
|
|
2115
|
+
* sign in again by itself; the next sign-in is the user's. Not fired where a
|
|
2116
|
+
* refused sign-in is renewed (connect, deposit). Returns the unsubscribe
|
|
2117
|
+
* function.
|
|
2118
|
+
*/
|
|
2119
|
+
onSignInRefused(listener: (agentId: AgentId) => void): () => void;
|
|
2105
2120
|
/**
|
|
2106
2121
|
* Listens for the sign-ins a connect asks for (`SignInProgress`): which
|
|
2107
2122
|
* agents will ask the wallet to sign in, and each one as it starts and ends,
|
|
@@ -2110,6 +2125,14 @@ declare class OwneySDK {
|
|
|
2110
2125
|
* function.
|
|
2111
2126
|
*/
|
|
2112
2127
|
onSignInProgress(listener: (progress: SignInProgress) => void): () => void;
|
|
2128
|
+
/**
|
|
2129
|
+
* The agents that would ask the wallet to sign in on `chainId` right now:
|
|
2130
|
+
* enabled agents on that chain whose `needsSignIn` says yes. One with no
|
|
2131
|
+
* such check counts as no; one that throws counts as yes, so an unknown
|
|
2132
|
+
* answer never lets the app retry quietly into a prompt. Never prompts and
|
|
2133
|
+
* never calls the network. Empty before connect.
|
|
2134
|
+
*/
|
|
2135
|
+
signInsNeeded(chainId: number): AgentId[];
|
|
2113
2136
|
/**
|
|
2114
2137
|
* The sign-ins this connect asks for: the agents whose `needsSignIn` says
|
|
2115
2138
|
* yes now (one that throws counts as no). Each is announced at its first
|
|
@@ -2138,7 +2161,7 @@ declare class OwneySDK {
|
|
|
2138
2161
|
* Disconnect from all agents and clear connection state.
|
|
2139
2162
|
* After calling this, `connect()` must be called again before using agent methods.
|
|
2140
2163
|
*/
|
|
2141
|
-
disconnect(): Promise<void>;
|
|
2164
|
+
disconnect(options?: DisconnectOptions): Promise<void>;
|
|
2142
2165
|
private clearConnectionState;
|
|
2143
2166
|
private disconnectAgents;
|
|
2144
2167
|
private isAgentDisabled;
|
|
@@ -2161,12 +2184,11 @@ declare class OwneySDK {
|
|
|
2161
2184
|
*/
|
|
2162
2185
|
private hasNoAgentForSlot;
|
|
2163
2186
|
/**
|
|
2164
|
-
* The state
|
|
2165
|
-
*
|
|
2166
|
-
*
|
|
2167
|
-
*
|
|
2168
|
-
*
|
|
2169
|
-
* lifts it.
|
|
2187
|
+
* The state every agent read uses: promptless, so a read uses a saved
|
|
2188
|
+
* sign-in only and never opens a wallet prompt. A read that would need one
|
|
2189
|
+
* fails for that agent instead; the app keeps the last known value and
|
|
2190
|
+
* retries later. Only connect/activation and user actions (deposit,
|
|
2191
|
+
* withdraw) may ask the wallet to sign in, and they use the plain state.
|
|
2170
2192
|
*/
|
|
2171
2193
|
private readStateFor;
|
|
2172
2194
|
/**
|
|
@@ -3281,6 +3303,15 @@ declare class YieldseekerAgent implements IAgent {
|
|
|
3281
3303
|
private readonly balanceContexts;
|
|
3282
3304
|
private readonly balanceVaults;
|
|
3283
3305
|
private readonly users;
|
|
3306
|
+
/**
|
|
3307
|
+
* Agent wallets (lowercase) this page started releasing vault funds from for
|
|
3308
|
+
* a withdrawal, and when. Until the payout is done the released money sits
|
|
3309
|
+
* in the agent wallet, so no deposit notice may go out (it would be
|
|
3310
|
+
* reinvested). The ledger shows the same once it lists the withdrawal.
|
|
3311
|
+
*/
|
|
3312
|
+
private readonly releasingWallets;
|
|
3313
|
+
/** One login (and, for a new wallet, one create) per wallet and chain at a time. */
|
|
3314
|
+
private readonly pendingUsers;
|
|
3284
3315
|
private readonly pendingAgents;
|
|
3285
3316
|
private readonly pendingWalletContexts;
|
|
3286
3317
|
private readonly readCache;
|
|
@@ -3302,6 +3333,7 @@ declare class YieldseekerAgent implements IAgent {
|
|
|
3302
3333
|
private readonly settlementChecks;
|
|
3303
3334
|
private ledgerAccess?;
|
|
3304
3335
|
private accountRefusedListener?;
|
|
3336
|
+
private signInRefusedListener?;
|
|
3305
3337
|
private readonly ledgerReads;
|
|
3306
3338
|
/** contextKey -> movements this instance started settling (by tx hash) and how they refresh:
|
|
3307
3339
|
* awaiting the ledger, refreshed when ready (ledger), or on the timed backoff (legacy). */
|
|
@@ -3373,7 +3405,7 @@ declare class YieldseekerAgent implements IAgent {
|
|
|
3373
3405
|
txHash: Hex;
|
|
3374
3406
|
status: YieldseekerWalletStatus;
|
|
3375
3407
|
}>;
|
|
3376
|
-
disconnect(): Promise<void>;
|
|
3408
|
+
disconnect(options?: DisconnectOptions): Promise<void>;
|
|
3377
3409
|
/**
|
|
3378
3410
|
* Whether connecting now would ask the wallet to sign in: no reusable saved
|
|
3379
3411
|
* sign-in for this wallet and chain. Never prompts; reads only what is saved.
|
|
@@ -3439,7 +3471,9 @@ declare class YieldseekerAgent implements IAgent {
|
|
|
3439
3471
|
* left idle. While it has not, Yieldseeker is told again, up to
|
|
3440
3472
|
* DEPOSIT_NOTICE_ATTEMPTS calls in all; a failed call (network, server, rate
|
|
3441
3473
|
* limit) is sent again after a wait. Within an hour of a withdrawal it is
|
|
3442
|
-
* told once, since nothing can move yet.
|
|
3474
|
+
* told once, since nothing can move yet. While a withdrawal from the agent
|
|
3475
|
+
* wallet is under way it is not told at all: its released funds wait in that
|
|
3476
|
+
* wallet for the payout, and a notice would reinvest them (ROUT-790). Uses the agent this session already
|
|
3443
3477
|
* knows for the asset and the saved sign-in only: never prompts, never
|
|
3444
3478
|
* throws. Each call is reported through `onNotice`.
|
|
3445
3479
|
*/
|
|
@@ -3460,6 +3494,13 @@ declare class YieldseekerAgent implements IAgent {
|
|
|
3460
3494
|
* confirmed withdrawal, if that is still ahead; null when there was none in
|
|
3461
3495
|
* the last hour or the ledger cannot say.
|
|
3462
3496
|
*/
|
|
3497
|
+
/**
|
|
3498
|
+
* A withdrawal from this agent wallet that has started but not finished,
|
|
3499
|
+
* within the last hour: released by this page, or listed on the ledger with
|
|
3500
|
+
* the agent's leg still created, submitted or unknown. Older unfinished rows
|
|
3501
|
+
* do not count, so a stuck record cannot hold deposits back for good.
|
|
3502
|
+
*/
|
|
3503
|
+
private withdrawalUnderWay;
|
|
3463
3504
|
private withdrawalCooldownEnd;
|
|
3464
3505
|
/**
|
|
3465
3506
|
* The agent wallet's base-asset balance and the platform fee Yieldseeker has
|
|
@@ -3730,6 +3771,13 @@ declare class YieldseekerAgent implements IAgent {
|
|
|
3730
3771
|
private reportAccount;
|
|
3731
3772
|
private contextForAgent;
|
|
3732
3773
|
private resolveUser;
|
|
3774
|
+
/**
|
|
3775
|
+
* `login-with-wallet`, and `POST /users` for a wallet without an account.
|
|
3776
|
+
* Both draw on Yieldseeker's per-IP sign-in allowance, which all our users
|
|
3777
|
+
* share: while a 429's pause lasts nothing is sent, and a new 429 starts one.
|
|
3778
|
+
*/
|
|
3779
|
+
private signInUser;
|
|
3780
|
+
private signInRateLimited;
|
|
3733
3781
|
private forgetUser;
|
|
3734
3782
|
private ensureAgent;
|
|
3735
3783
|
private findAgent;
|
|
@@ -3776,6 +3824,7 @@ declare class YieldseekerAgent implements IAgent {
|
|
|
3776
3824
|
private loadPortfolioParts;
|
|
3777
3825
|
private deployAgent;
|
|
3778
3826
|
setAccountRefusedListener(listener: (() => void) | undefined): void;
|
|
3827
|
+
setSignInRefusedListener(listener: (() => void) | undefined): void;
|
|
3779
3828
|
setFundingLedgerAccess(access: AgentFundingLedgerAccess | undefined): void;
|
|
3780
3829
|
private historyKey;
|
|
3781
3830
|
/** Funding-ledger rows for this slot, cached 15 s. Never throws: null on any failure. */
|
|
@@ -4042,4 +4091,4 @@ declare const YIELDSEEKER_WITHDRAW_SERVER_SUBMIT: 1;
|
|
|
4042
4091
|
* Older builds do not export this. */
|
|
4043
4092
|
declare const FUNDING_DEPOSIT_RECOVERY_REPORT: 1;
|
|
4044
4093
|
|
|
4045
|
-
export { type AccountAgentApy, type AccountApyOptions, type AccountDailyEarnings, type ActivateAgentOptions, 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 ApyIncentive, 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 SignInProgress, 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, switchWalletConnectChain, updateWithdrawSwap };
|
|
4094
|
+
export { type AccountAgentApy, type AccountApyOptions, type AccountDailyEarnings, type ActivateAgentOptions, 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 ApyIncentive, 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, type DisconnectOptions, 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 SignInProgress, 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, switchWalletConnectChain, updateWithdrawSwap };
|
package/dist/index.d.ts
CHANGED
|
@@ -429,10 +429,9 @@ interface ConnectionState {
|
|
|
429
429
|
chainId: number | null;
|
|
430
430
|
/**
|
|
431
431
|
* Reads under this state use a saved sign-in only: an agent never opens a
|
|
432
|
-
* wallet prompt for them and fails instead.
|
|
433
|
-
*
|
|
434
|
-
*
|
|
435
|
-
* agent signed in, or the user cancelled its sign-in).
|
|
432
|
+
* wallet prompt for them and fails instead. The client sets it on every
|
|
433
|
+
* read (balances, earnings, history...). Connect/activation and user actions
|
|
434
|
+
* (deposit, withdraw) run without it, so they may still ask for a sign-in.
|
|
436
435
|
*/
|
|
437
436
|
promptless?: boolean;
|
|
438
437
|
}
|
|
@@ -711,7 +710,7 @@ interface IAgent {
|
|
|
711
710
|
after: string[];
|
|
712
711
|
beforeRequest?: () => void;
|
|
713
712
|
}): Promise<ZyfaiHandoffAnswer>;
|
|
714
|
-
disconnect(): Promise<void>;
|
|
713
|
+
disconnect(options?: DisconnectOptions): Promise<void>;
|
|
715
714
|
/**
|
|
716
715
|
* Ready the user's account for every asset the agent supports on `chainId`,
|
|
717
716
|
* `asset` first. A failure the provider says will not go away (the user can
|
|
@@ -837,6 +836,12 @@ interface IAgent {
|
|
|
837
836
|
* account was not created through Owney (AGENT_ACCOUNT_NOT_OWNEY). Optional.
|
|
838
837
|
*/
|
|
839
838
|
setAccountRefusedListener?(listener: (() => void) | undefined): void;
|
|
839
|
+
/**
|
|
840
|
+
* Called each time the agent drops a saved sign-in its server refused,
|
|
841
|
+
* outside connect (a read or a withdrawal). Not called where the sign-in is
|
|
842
|
+
* renewed (connect, deposit). Optional.
|
|
843
|
+
*/
|
|
844
|
+
setSignInRefusedListener?(listener: (() => void) | undefined): void;
|
|
840
845
|
/**
|
|
841
846
|
* May this wallet's account use Owney with this agent? Run at connect for
|
|
842
847
|
* every agent about to activate, before any agent activates or is read.
|
|
@@ -906,6 +911,15 @@ type AgentApyOptions = {
|
|
|
906
911
|
chainId?: number;
|
|
907
912
|
};
|
|
908
913
|
|
|
914
|
+
/** Options for `OwneySDK.disconnect` and `IAgent.disconnect`. */
|
|
915
|
+
type DisconnectOptions = {
|
|
916
|
+
/**
|
|
917
|
+
* Keep each agent's saved sign-ins (browser storage) so a later connect for
|
|
918
|
+
* the same wallet needs no new signature. Everything held in memory is
|
|
919
|
+
* still dropped. Default false: saved sign-ins are deleted.
|
|
920
|
+
*/
|
|
921
|
+
keepSignIns?: boolean;
|
|
922
|
+
};
|
|
909
923
|
type AgentId = "zyfai" | "yieldseeker";
|
|
910
924
|
type Asset = string;
|
|
911
925
|
type AgentSupportedAsset = {
|
|
@@ -2002,15 +2016,8 @@ declare class OwneySDK {
|
|
|
2002
2016
|
*/
|
|
2003
2017
|
private disabledAgents;
|
|
2004
2018
|
private readonly accountRefusedListeners;
|
|
2019
|
+
private readonly signInRefusedListeners;
|
|
2005
2020
|
private readonly signInProgressListeners;
|
|
2006
|
-
/**
|
|
2007
|
-
* Agents whose sign-in the user cancelled this session (the wallet rejected
|
|
2008
|
-
* the prompt), keyed by chain. Until the app ends the session they are read
|
|
2009
|
-
* from a saved sign-in only (`readStateFor`), so no read reopens the prompt
|
|
2010
|
-
* the user cancelled. A later successful activation of the agent removes
|
|
2011
|
-
* it, and `disconnect()` or a different wallet's `connect()` clears the map.
|
|
2012
|
-
*/
|
|
2013
|
-
private declinedSignIns;
|
|
2014
2021
|
private state;
|
|
2015
2022
|
private connectionRevision;
|
|
2016
2023
|
private disconnectingAgents;
|
|
@@ -2102,6 +2109,14 @@ declare class OwneySDK {
|
|
|
2102
2109
|
* each time an agent maps such a refusal. Returns the unsubscribe function.
|
|
2103
2110
|
*/
|
|
2104
2111
|
onAccountRefused(listener: (agentId: AgentId) => void): () => void;
|
|
2112
|
+
/**
|
|
2113
|
+
* Listens for an agent dropping a saved sign-in its server refused, outside
|
|
2114
|
+
* connect (a read or a withdrawal found it refused). The agent will not
|
|
2115
|
+
* sign in again by itself; the next sign-in is the user's. Not fired where a
|
|
2116
|
+
* refused sign-in is renewed (connect, deposit). Returns the unsubscribe
|
|
2117
|
+
* function.
|
|
2118
|
+
*/
|
|
2119
|
+
onSignInRefused(listener: (agentId: AgentId) => void): () => void;
|
|
2105
2120
|
/**
|
|
2106
2121
|
* Listens for the sign-ins a connect asks for (`SignInProgress`): which
|
|
2107
2122
|
* agents will ask the wallet to sign in, and each one as it starts and ends,
|
|
@@ -2110,6 +2125,14 @@ declare class OwneySDK {
|
|
|
2110
2125
|
* function.
|
|
2111
2126
|
*/
|
|
2112
2127
|
onSignInProgress(listener: (progress: SignInProgress) => void): () => void;
|
|
2128
|
+
/**
|
|
2129
|
+
* The agents that would ask the wallet to sign in on `chainId` right now:
|
|
2130
|
+
* enabled agents on that chain whose `needsSignIn` says yes. One with no
|
|
2131
|
+
* such check counts as no; one that throws counts as yes, so an unknown
|
|
2132
|
+
* answer never lets the app retry quietly into a prompt. Never prompts and
|
|
2133
|
+
* never calls the network. Empty before connect.
|
|
2134
|
+
*/
|
|
2135
|
+
signInsNeeded(chainId: number): AgentId[];
|
|
2113
2136
|
/**
|
|
2114
2137
|
* The sign-ins this connect asks for: the agents whose `needsSignIn` says
|
|
2115
2138
|
* yes now (one that throws counts as no). Each is announced at its first
|
|
@@ -2138,7 +2161,7 @@ declare class OwneySDK {
|
|
|
2138
2161
|
* Disconnect from all agents and clear connection state.
|
|
2139
2162
|
* After calling this, `connect()` must be called again before using agent methods.
|
|
2140
2163
|
*/
|
|
2141
|
-
disconnect(): Promise<void>;
|
|
2164
|
+
disconnect(options?: DisconnectOptions): Promise<void>;
|
|
2142
2165
|
private clearConnectionState;
|
|
2143
2166
|
private disconnectAgents;
|
|
2144
2167
|
private isAgentDisabled;
|
|
@@ -2161,12 +2184,11 @@ declare class OwneySDK {
|
|
|
2161
2184
|
*/
|
|
2162
2185
|
private hasNoAgentForSlot;
|
|
2163
2186
|
/**
|
|
2164
|
-
* The state
|
|
2165
|
-
*
|
|
2166
|
-
*
|
|
2167
|
-
*
|
|
2168
|
-
*
|
|
2169
|
-
* lifts it.
|
|
2187
|
+
* The state every agent read uses: promptless, so a read uses a saved
|
|
2188
|
+
* sign-in only and never opens a wallet prompt. A read that would need one
|
|
2189
|
+
* fails for that agent instead; the app keeps the last known value and
|
|
2190
|
+
* retries later. Only connect/activation and user actions (deposit,
|
|
2191
|
+
* withdraw) may ask the wallet to sign in, and they use the plain state.
|
|
2170
2192
|
*/
|
|
2171
2193
|
private readStateFor;
|
|
2172
2194
|
/**
|
|
@@ -3281,6 +3303,15 @@ declare class YieldseekerAgent implements IAgent {
|
|
|
3281
3303
|
private readonly balanceContexts;
|
|
3282
3304
|
private readonly balanceVaults;
|
|
3283
3305
|
private readonly users;
|
|
3306
|
+
/**
|
|
3307
|
+
* Agent wallets (lowercase) this page started releasing vault funds from for
|
|
3308
|
+
* a withdrawal, and when. Until the payout is done the released money sits
|
|
3309
|
+
* in the agent wallet, so no deposit notice may go out (it would be
|
|
3310
|
+
* reinvested). The ledger shows the same once it lists the withdrawal.
|
|
3311
|
+
*/
|
|
3312
|
+
private readonly releasingWallets;
|
|
3313
|
+
/** One login (and, for a new wallet, one create) per wallet and chain at a time. */
|
|
3314
|
+
private readonly pendingUsers;
|
|
3284
3315
|
private readonly pendingAgents;
|
|
3285
3316
|
private readonly pendingWalletContexts;
|
|
3286
3317
|
private readonly readCache;
|
|
@@ -3302,6 +3333,7 @@ declare class YieldseekerAgent implements IAgent {
|
|
|
3302
3333
|
private readonly settlementChecks;
|
|
3303
3334
|
private ledgerAccess?;
|
|
3304
3335
|
private accountRefusedListener?;
|
|
3336
|
+
private signInRefusedListener?;
|
|
3305
3337
|
private readonly ledgerReads;
|
|
3306
3338
|
/** contextKey -> movements this instance started settling (by tx hash) and how they refresh:
|
|
3307
3339
|
* awaiting the ledger, refreshed when ready (ledger), or on the timed backoff (legacy). */
|
|
@@ -3373,7 +3405,7 @@ declare class YieldseekerAgent implements IAgent {
|
|
|
3373
3405
|
txHash: Hex;
|
|
3374
3406
|
status: YieldseekerWalletStatus;
|
|
3375
3407
|
}>;
|
|
3376
|
-
disconnect(): Promise<void>;
|
|
3408
|
+
disconnect(options?: DisconnectOptions): Promise<void>;
|
|
3377
3409
|
/**
|
|
3378
3410
|
* Whether connecting now would ask the wallet to sign in: no reusable saved
|
|
3379
3411
|
* sign-in for this wallet and chain. Never prompts; reads only what is saved.
|
|
@@ -3439,7 +3471,9 @@ declare class YieldseekerAgent implements IAgent {
|
|
|
3439
3471
|
* left idle. While it has not, Yieldseeker is told again, up to
|
|
3440
3472
|
* DEPOSIT_NOTICE_ATTEMPTS calls in all; a failed call (network, server, rate
|
|
3441
3473
|
* limit) is sent again after a wait. Within an hour of a withdrawal it is
|
|
3442
|
-
* told once, since nothing can move yet.
|
|
3474
|
+
* told once, since nothing can move yet. While a withdrawal from the agent
|
|
3475
|
+
* wallet is under way it is not told at all: its released funds wait in that
|
|
3476
|
+
* wallet for the payout, and a notice would reinvest them (ROUT-790). Uses the agent this session already
|
|
3443
3477
|
* knows for the asset and the saved sign-in only: never prompts, never
|
|
3444
3478
|
* throws. Each call is reported through `onNotice`.
|
|
3445
3479
|
*/
|
|
@@ -3460,6 +3494,13 @@ declare class YieldseekerAgent implements IAgent {
|
|
|
3460
3494
|
* confirmed withdrawal, if that is still ahead; null when there was none in
|
|
3461
3495
|
* the last hour or the ledger cannot say.
|
|
3462
3496
|
*/
|
|
3497
|
+
/**
|
|
3498
|
+
* A withdrawal from this agent wallet that has started but not finished,
|
|
3499
|
+
* within the last hour: released by this page, or listed on the ledger with
|
|
3500
|
+
* the agent's leg still created, submitted or unknown. Older unfinished rows
|
|
3501
|
+
* do not count, so a stuck record cannot hold deposits back for good.
|
|
3502
|
+
*/
|
|
3503
|
+
private withdrawalUnderWay;
|
|
3463
3504
|
private withdrawalCooldownEnd;
|
|
3464
3505
|
/**
|
|
3465
3506
|
* The agent wallet's base-asset balance and the platform fee Yieldseeker has
|
|
@@ -3730,6 +3771,13 @@ declare class YieldseekerAgent implements IAgent {
|
|
|
3730
3771
|
private reportAccount;
|
|
3731
3772
|
private contextForAgent;
|
|
3732
3773
|
private resolveUser;
|
|
3774
|
+
/**
|
|
3775
|
+
* `login-with-wallet`, and `POST /users` for a wallet without an account.
|
|
3776
|
+
* Both draw on Yieldseeker's per-IP sign-in allowance, which all our users
|
|
3777
|
+
* share: while a 429's pause lasts nothing is sent, and a new 429 starts one.
|
|
3778
|
+
*/
|
|
3779
|
+
private signInUser;
|
|
3780
|
+
private signInRateLimited;
|
|
3733
3781
|
private forgetUser;
|
|
3734
3782
|
private ensureAgent;
|
|
3735
3783
|
private findAgent;
|
|
@@ -3776,6 +3824,7 @@ declare class YieldseekerAgent implements IAgent {
|
|
|
3776
3824
|
private loadPortfolioParts;
|
|
3777
3825
|
private deployAgent;
|
|
3778
3826
|
setAccountRefusedListener(listener: (() => void) | undefined): void;
|
|
3827
|
+
setSignInRefusedListener(listener: (() => void) | undefined): void;
|
|
3779
3828
|
setFundingLedgerAccess(access: AgentFundingLedgerAccess | undefined): void;
|
|
3780
3829
|
private historyKey;
|
|
3781
3830
|
/** Funding-ledger rows for this slot, cached 15 s. Never throws: null on any failure. */
|
|
@@ -4042,4 +4091,4 @@ declare const YIELDSEEKER_WITHDRAW_SERVER_SUBMIT: 1;
|
|
|
4042
4091
|
* Older builds do not export this. */
|
|
4043
4092
|
declare const FUNDING_DEPOSIT_RECOVERY_REPORT: 1;
|
|
4044
4093
|
|
|
4045
|
-
export { type AccountAgentApy, type AccountApyOptions, type AccountDailyEarnings, type ActivateAgentOptions, 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 ApyIncentive, 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 SignInProgress, 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, switchWalletConnectChain, updateWithdrawSwap };
|
|
4094
|
+
export { type AccountAgentApy, type AccountApyOptions, type AccountDailyEarnings, type ActivateAgentOptions, 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 ApyIncentive, 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, type DisconnectOptions, 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 SignInProgress, 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, switchWalletConnectChain, updateWithdrawSwap };
|