@owney/sdk 0.6.9-beta.0 → 0.6.9-beta.2
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 +300 -608
- package/dist/index.d.cts +74 -20
- package/dist/index.d.ts +74 -20
- package/dist/index.js +283 -102
- package/package.json +1 -3
- package/dist/chunk-GMNQBWUB.js +0 -55
- package/dist/surfliquid.agent-OMOYXWLP.js +0 -385
package/dist/index.d.cts
CHANGED
|
@@ -21,6 +21,15 @@ interface OwneySDKConfig {
|
|
|
21
21
|
* `createOwneySIWX` for apps that don't use the AppKit SIWX modal.
|
|
22
22
|
*/
|
|
23
23
|
referralSource?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Turn on the SDK's debug logging (default false). Traces the decisions that
|
|
26
|
+
* are otherwise invisible — notably how the organization's agent policy is
|
|
27
|
+
* compared against each user's Zyfai profile and whether it writes.
|
|
28
|
+
*
|
|
29
|
+
* Also switchable at runtime without a rebuild, which is what you want on an
|
|
30
|
+
* already-deployed app: set `globalThis.__OWNEY_DEBUG__ = true` in devtools.
|
|
31
|
+
*/
|
|
32
|
+
debug?: boolean;
|
|
24
33
|
}
|
|
25
34
|
interface ConnectionState {
|
|
26
35
|
provider: any;
|
|
@@ -34,7 +43,7 @@ type OwneySupportedChainId = (typeof SUPPORTED_CHAIN_IDS)[number];
|
|
|
34
43
|
type OwneySupportedChains = (typeof SUPPORTED_CHAINS)[number];
|
|
35
44
|
type OwneySupportedTokens = (typeof SUPPORTED_TOKENS)[number];
|
|
36
45
|
|
|
37
|
-
type AgentId = "zyfai" | "sail"
|
|
46
|
+
type AgentId = "zyfai" | "sail";
|
|
38
47
|
type Asset = string;
|
|
39
48
|
type AgentSupportedAsset = {
|
|
40
49
|
readonly symbol: string;
|
|
@@ -101,6 +110,16 @@ type DepositOptions = {
|
|
|
101
110
|
onApproved?: () => void;
|
|
102
111
|
};
|
|
103
112
|
|
|
113
|
+
/**
|
|
114
|
+
* The organization's agent execution policy, or null when the partner has never
|
|
115
|
+
* configured one — in which case the agents leave the user's profile alone.
|
|
116
|
+
* Currently capital splitting only (ROUT-229).
|
|
117
|
+
*/
|
|
118
|
+
type OrgAgentConfig = {
|
|
119
|
+
splittingMode: "none" | "automatic" | "force";
|
|
120
|
+
minSplits: number | null;
|
|
121
|
+
};
|
|
122
|
+
|
|
104
123
|
interface OwneyDepositResult {
|
|
105
124
|
txHash: string;
|
|
106
125
|
smartWallet: string;
|
|
@@ -108,12 +127,6 @@ interface OwneyDepositResult {
|
|
|
108
127
|
}
|
|
109
128
|
interface OwneyMultiDepositResult {
|
|
110
129
|
agentResults: Record<string, OwneyDepositResult>;
|
|
111
|
-
/**
|
|
112
|
-
* Per-agent failure messages for agents that errored during a diversified
|
|
113
|
-
* deposit. Present only when at least one (but not all) agents failed —
|
|
114
|
-
* the deposit is partial, not total. Omitted when every agent succeeded.
|
|
115
|
-
*/
|
|
116
|
-
agentErrors?: Record<string, string>;
|
|
117
130
|
}
|
|
118
131
|
interface AgentWithdrawResult {
|
|
119
132
|
txHash?: string;
|
|
@@ -281,6 +294,19 @@ interface IAgent {
|
|
|
281
294
|
readonly supportedAssets: readonly AgentSupportedAssets[];
|
|
282
295
|
disconnect(): Promise<void>;
|
|
283
296
|
activateAgent(state: ConnectionState, chainId: number): Promise<void>;
|
|
297
|
+
/**
|
|
298
|
+
* Apply the organization's agent policy to this user's account.
|
|
299
|
+
*
|
|
300
|
+
* Optional: an agent that has no equivalent knob simply omits it, which is why
|
|
301
|
+
* this is not part of `activateAgent`'s signature. Declared on the interface
|
|
302
|
+
* rather than only on ZyfaiAgent so the contract stays agent-neutral — the
|
|
303
|
+
* ticket asks for a design that can also cover Surf, which has no adapter yet.
|
|
304
|
+
*
|
|
305
|
+
* Implementations must be **non-fatal**: this runs during activation as a side
|
|
306
|
+
* effect, so a failure has to leave the user connected and their profile
|
|
307
|
+
* unchanged rather than break the connect.
|
|
308
|
+
*/
|
|
309
|
+
applyOrgPolicy?(state: ConnectionState, chainId: number, policy: OrgAgentConfig): Promise<void>;
|
|
284
310
|
deposit(state: ConnectionState, chainId: number, amount: string, asset: OwneySupportedTokens, depositCallback?: DepositCallback): Promise<OwneyDepositResult>;
|
|
285
311
|
withdraw(state: ConnectionState, chainId: number, token: OwneySupportedTokens, amount?: string): Promise<AgentWithdrawResult>;
|
|
286
312
|
getBalances(state: ConnectionState, chainId: number): Promise<AgentBalance>;
|
|
@@ -324,6 +350,8 @@ declare class OwneySDK {
|
|
|
324
350
|
private disabledAgents;
|
|
325
351
|
private state;
|
|
326
352
|
private apiKey;
|
|
353
|
+
private orgAgentConfig;
|
|
354
|
+
private orgAgentConfigPromise;
|
|
327
355
|
private zyfaiRpcUrls?;
|
|
328
356
|
private routingApiBaseUrl?;
|
|
329
357
|
private referralSource?;
|
|
@@ -372,6 +400,20 @@ declare class OwneySDK {
|
|
|
372
400
|
private getDefaultWethSponsoredCallback;
|
|
373
401
|
private getAgent;
|
|
374
402
|
private getActiveAgents;
|
|
403
|
+
/**
|
|
404
|
+
* Read the org's agent policy once and reuse it. fetchOrgAgentConfig never
|
|
405
|
+
* throws — it degrades to null — so this cannot break activation.
|
|
406
|
+
*/
|
|
407
|
+
private getOrgAgentConfig;
|
|
408
|
+
/**
|
|
409
|
+
* Apply the org policy to one agent, after it has activated.
|
|
410
|
+
*
|
|
411
|
+
* Sequenced after activation rather than alongside it because applying the
|
|
412
|
+
* policy needs the authenticated session activation establishes. Every failure
|
|
413
|
+
* mode is swallowed: a partner's splitting preference is not worth failing a
|
|
414
|
+
* user's connect over.
|
|
415
|
+
*/
|
|
416
|
+
private applyOrgPolicyTo;
|
|
375
417
|
private ensureAgentsInitialized;
|
|
376
418
|
private createAgent;
|
|
377
419
|
/**
|
|
@@ -436,17 +478,6 @@ declare class OwneySDK {
|
|
|
436
478
|
private hasExistingBalance;
|
|
437
479
|
private validateAssetSupport;
|
|
438
480
|
private getEligibleAgents;
|
|
439
|
-
/**
|
|
440
|
-
* Agent ids the routing API provisioned for this org that support the given
|
|
441
|
-
* chain + asset, ordered by preference ({@link AGENT_ELIGIBILITY_ORDER},
|
|
442
|
-
* surfliquid first). Returns `[]` when the org has no compatible agent — never
|
|
443
|
-
* throws on an empty org. Loads agent keys on first call (apiKey only, no
|
|
444
|
-
* wallet), so the UI can resolve which agent to use before the user connects.
|
|
445
|
-
*
|
|
446
|
-
* This is the source of truth for agent availability: an agent appears here
|
|
447
|
-
* iff the routing API returned its key. No per-app feature flags.
|
|
448
|
-
*/
|
|
449
|
-
getEligibleAgentIds(chainId: number, asset: string): Promise<AgentId[]>;
|
|
450
481
|
/**
|
|
451
482
|
* Withdraw funds from a specific agent, or all agents that support the active chain+asset if agentId is omitted.
|
|
452
483
|
* Validates that the asset is supported by the target agent(s) on the active chain.
|
|
@@ -542,7 +573,7 @@ declare class OwneySDK {
|
|
|
542
573
|
getAllocationApy({ agentId, }?: AllocationApyOptions): Promise<OwneyAllocationApy>;
|
|
543
574
|
}
|
|
544
575
|
|
|
545
|
-
type OwneyErrorCode = "NOT_CONNECTED" | "NO_ACTIVE_CHAIN" | "WALLET_NO_ACCOUNTS" | "WALLET_ADDRESS_REQUIRED" | "AGENT_NOT_FOUND" | "AGENT_CHAIN_INCOMPATIBLE" | "AGENT_EMPTY_LIST" | "AGENT_DISABLED" | "CHAIN_UNSUPPORTED" | "CHAIN_NO_COMPATIBLE_AGENTS" | "ASSET_UNSUPPORTED" | "ASSET_NO_COMPATIBLE_AGENTS" | "DEPOSIT_AMOUNT_BELOW_MINIMUM" | "DEPOSIT_CALLBACK_REQUIRED" | "DEPOSIT_CALLBACK_INVALID" | "DEPOSIT_NO_PERMITTED_TOKENS" | "
|
|
576
|
+
type OwneyErrorCode = "NOT_CONNECTED" | "NO_ACTIVE_CHAIN" | "WALLET_NO_ACCOUNTS" | "WALLET_ADDRESS_REQUIRED" | "AGENT_NOT_FOUND" | "AGENT_CHAIN_INCOMPATIBLE" | "AGENT_EMPTY_LIST" | "AGENT_DISABLED" | "CHAIN_UNSUPPORTED" | "CHAIN_NO_COMPATIBLE_AGENTS" | "ASSET_UNSUPPORTED" | "ASSET_NO_COMPATIBLE_AGENTS" | "DEPOSIT_AMOUNT_BELOW_MINIMUM" | "DEPOSIT_CALLBACK_REQUIRED" | "DEPOSIT_CALLBACK_INVALID" | "DEPOSIT_NO_PERMITTED_TOKENS" | "DEPOSIT_INSUFFICIENT_BALANCE" | "WITHDRAW_NO_PERMITTED_TOKENS" | "WITHDRAW_INSUFFICIENT_BALANCE" | "WITHDRAW_ALL_FAILED" | "WITHDRAW_PARTIAL_FAILURE" | "WITHDRAW_FAILED" | "API_ROUTING_ERROR" | "API_ROUTING_FAILED" | "API_SAIL_ERROR" | "API_SAIL_TIMEOUT" | "API_NO_AGENTS" | "SPONSOR_REQUEST_FAILED" | "PERMIT2_APPROVAL_REQUIRED" | "BALANCE_ALL_FAILED" | "ALLOCATION_ALL_FAILED" | "VALIDATION_INVALID_DAYS";
|
|
546
577
|
declare class OwneyError extends Error {
|
|
547
578
|
readonly code: OwneyErrorCode;
|
|
548
579
|
readonly details?: Record<string, unknown>;
|
|
@@ -572,6 +603,29 @@ declare class InvalidHistoryCursorError extends Error {
|
|
|
572
603
|
constructor(message: string);
|
|
573
604
|
}
|
|
574
605
|
|
|
606
|
+
/**
|
|
607
|
+
* Opt-in debug logging.
|
|
608
|
+
*
|
|
609
|
+
* The SDK is deliberately quiet: before this, `src/` contained no `console.log`
|
|
610
|
+
* at all, only `console.warn`/`console.error` for genuine faults. That is worth
|
|
611
|
+
* preserving — this runs inside every partner's app, on every user's connect, so
|
|
612
|
+
* unconditional chatter would land in end users' consoles forever.
|
|
613
|
+
*
|
|
614
|
+
* Two ways to turn it on:
|
|
615
|
+
*
|
|
616
|
+
* 1. From the app: new OwneySDK({ apiKey, debug: true })
|
|
617
|
+
* 2. From devtools, live: globalThis.__OWNEY_DEBUG__ = true
|
|
618
|
+
*
|
|
619
|
+
* (2) is the useful one when diagnosing something on an already-deployed app:
|
|
620
|
+
* the flag is read on every call, not captured once, so flipping it in the
|
|
621
|
+
* console takes effect on the next action without a rebuild or a republish.
|
|
622
|
+
*/
|
|
623
|
+
declare global {
|
|
624
|
+
var __OWNEY_DEBUG__: boolean | undefined;
|
|
625
|
+
}
|
|
626
|
+
/** Enable/disable debug logging programmatically. */
|
|
627
|
+
declare function setOwneyDebug(enabled: boolean): void;
|
|
628
|
+
|
|
575
629
|
type OwneySIWXConfig = {
|
|
576
630
|
/** Owney/Zyfai API key — same value passed to `new OwneySDK({ apiKey })`. */
|
|
577
631
|
apiKey: string;
|
|
@@ -585,4 +639,4 @@ type OwneySIWXConfig = {
|
|
|
585
639
|
*/
|
|
586
640
|
declare function createOwneySIWX(config: OwneySIWXConfig): SIWXConfig;
|
|
587
641
|
|
|
588
|
-
export { AccountAgentApy, AccountApyOptions, AgentApy, AgentApyDetails, AgentBalance, AgentChainIncompatibleError, AgentEarnings, AgentHistoryEntry, AgentHistoryPosition, AgentId, AgentNotFoundError, AgentSupportedAsset, AgentSupportedAssets, AgentUserProfile, AgentWithdrawResult, AgentsApyOptions, AllocationAgentApy, AllocationApyOptions, ApyByChainAndAsset, ApyHistoryPoint, Asset, ConnectionState, DailyApyDays, DepositCallback, DepositOptions, HistoryAction, HistoryFilters, HistoryOptions, HistoryTransaction, IAgent, InvalidHistoryCursorError, NotConnectedError, OwneyAccountApy, OwneyAgentApy, OwneyAgentHistory, OwneyAllocationApy, OwneyBalances, OwneyDepositResult, OwneyEarnings, OwneyError, OwneyErrorCode, OwneyMultiDepositResult, OwneyPosition, OwneySDK, OwneySDKConfig, OwneySIWXConfig, OwneySupportedChainId, OwneySupportedChains, OwneySupportedTokens, OwneyToken, OwneyUserProfile, OwneyWithdrawResult, RebalanceLog, WithdrawOptions, createOwneySIWX };
|
|
642
|
+
export { AccountAgentApy, AccountApyOptions, AgentApy, AgentApyDetails, AgentBalance, AgentChainIncompatibleError, AgentEarnings, AgentHistoryEntry, AgentHistoryPosition, AgentId, AgentNotFoundError, AgentSupportedAsset, AgentSupportedAssets, AgentUserProfile, AgentWithdrawResult, AgentsApyOptions, AllocationAgentApy, AllocationApyOptions, ApyByChainAndAsset, ApyHistoryPoint, Asset, ConnectionState, DailyApyDays, DepositCallback, DepositOptions, HistoryAction, HistoryFilters, HistoryOptions, HistoryTransaction, IAgent, InvalidHistoryCursorError, NotConnectedError, OwneyAccountApy, OwneyAgentApy, OwneyAgentHistory, OwneyAllocationApy, OwneyBalances, OwneyDepositResult, OwneyEarnings, OwneyError, OwneyErrorCode, OwneyMultiDepositResult, OwneyPosition, OwneySDK, OwneySDKConfig, OwneySIWXConfig, OwneySupportedChainId, OwneySupportedChains, OwneySupportedTokens, OwneyToken, OwneyUserProfile, OwneyWithdrawResult, RebalanceLog, WithdrawOptions, createOwneySIWX, setOwneyDebug };
|
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,15 @@ interface OwneySDKConfig {
|
|
|
21
21
|
* `createOwneySIWX` for apps that don't use the AppKit SIWX modal.
|
|
22
22
|
*/
|
|
23
23
|
referralSource?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Turn on the SDK's debug logging (default false). Traces the decisions that
|
|
26
|
+
* are otherwise invisible — notably how the organization's agent policy is
|
|
27
|
+
* compared against each user's Zyfai profile and whether it writes.
|
|
28
|
+
*
|
|
29
|
+
* Also switchable at runtime without a rebuild, which is what you want on an
|
|
30
|
+
* already-deployed app: set `globalThis.__OWNEY_DEBUG__ = true` in devtools.
|
|
31
|
+
*/
|
|
32
|
+
debug?: boolean;
|
|
24
33
|
}
|
|
25
34
|
interface ConnectionState {
|
|
26
35
|
provider: any;
|
|
@@ -34,7 +43,7 @@ type OwneySupportedChainId = (typeof SUPPORTED_CHAIN_IDS)[number];
|
|
|
34
43
|
type OwneySupportedChains = (typeof SUPPORTED_CHAINS)[number];
|
|
35
44
|
type OwneySupportedTokens = (typeof SUPPORTED_TOKENS)[number];
|
|
36
45
|
|
|
37
|
-
type AgentId = "zyfai" | "sail"
|
|
46
|
+
type AgentId = "zyfai" | "sail";
|
|
38
47
|
type Asset = string;
|
|
39
48
|
type AgentSupportedAsset = {
|
|
40
49
|
readonly symbol: string;
|
|
@@ -101,6 +110,16 @@ type DepositOptions = {
|
|
|
101
110
|
onApproved?: () => void;
|
|
102
111
|
};
|
|
103
112
|
|
|
113
|
+
/**
|
|
114
|
+
* The organization's agent execution policy, or null when the partner has never
|
|
115
|
+
* configured one — in which case the agents leave the user's profile alone.
|
|
116
|
+
* Currently capital splitting only (ROUT-229).
|
|
117
|
+
*/
|
|
118
|
+
type OrgAgentConfig = {
|
|
119
|
+
splittingMode: "none" | "automatic" | "force";
|
|
120
|
+
minSplits: number | null;
|
|
121
|
+
};
|
|
122
|
+
|
|
104
123
|
interface OwneyDepositResult {
|
|
105
124
|
txHash: string;
|
|
106
125
|
smartWallet: string;
|
|
@@ -108,12 +127,6 @@ interface OwneyDepositResult {
|
|
|
108
127
|
}
|
|
109
128
|
interface OwneyMultiDepositResult {
|
|
110
129
|
agentResults: Record<string, OwneyDepositResult>;
|
|
111
|
-
/**
|
|
112
|
-
* Per-agent failure messages for agents that errored during a diversified
|
|
113
|
-
* deposit. Present only when at least one (but not all) agents failed —
|
|
114
|
-
* the deposit is partial, not total. Omitted when every agent succeeded.
|
|
115
|
-
*/
|
|
116
|
-
agentErrors?: Record<string, string>;
|
|
117
130
|
}
|
|
118
131
|
interface AgentWithdrawResult {
|
|
119
132
|
txHash?: string;
|
|
@@ -281,6 +294,19 @@ interface IAgent {
|
|
|
281
294
|
readonly supportedAssets: readonly AgentSupportedAssets[];
|
|
282
295
|
disconnect(): Promise<void>;
|
|
283
296
|
activateAgent(state: ConnectionState, chainId: number): Promise<void>;
|
|
297
|
+
/**
|
|
298
|
+
* Apply the organization's agent policy to this user's account.
|
|
299
|
+
*
|
|
300
|
+
* Optional: an agent that has no equivalent knob simply omits it, which is why
|
|
301
|
+
* this is not part of `activateAgent`'s signature. Declared on the interface
|
|
302
|
+
* rather than only on ZyfaiAgent so the contract stays agent-neutral — the
|
|
303
|
+
* ticket asks for a design that can also cover Surf, which has no adapter yet.
|
|
304
|
+
*
|
|
305
|
+
* Implementations must be **non-fatal**: this runs during activation as a side
|
|
306
|
+
* effect, so a failure has to leave the user connected and their profile
|
|
307
|
+
* unchanged rather than break the connect.
|
|
308
|
+
*/
|
|
309
|
+
applyOrgPolicy?(state: ConnectionState, chainId: number, policy: OrgAgentConfig): Promise<void>;
|
|
284
310
|
deposit(state: ConnectionState, chainId: number, amount: string, asset: OwneySupportedTokens, depositCallback?: DepositCallback): Promise<OwneyDepositResult>;
|
|
285
311
|
withdraw(state: ConnectionState, chainId: number, token: OwneySupportedTokens, amount?: string): Promise<AgentWithdrawResult>;
|
|
286
312
|
getBalances(state: ConnectionState, chainId: number): Promise<AgentBalance>;
|
|
@@ -324,6 +350,8 @@ declare class OwneySDK {
|
|
|
324
350
|
private disabledAgents;
|
|
325
351
|
private state;
|
|
326
352
|
private apiKey;
|
|
353
|
+
private orgAgentConfig;
|
|
354
|
+
private orgAgentConfigPromise;
|
|
327
355
|
private zyfaiRpcUrls?;
|
|
328
356
|
private routingApiBaseUrl?;
|
|
329
357
|
private referralSource?;
|
|
@@ -372,6 +400,20 @@ declare class OwneySDK {
|
|
|
372
400
|
private getDefaultWethSponsoredCallback;
|
|
373
401
|
private getAgent;
|
|
374
402
|
private getActiveAgents;
|
|
403
|
+
/**
|
|
404
|
+
* Read the org's agent policy once and reuse it. fetchOrgAgentConfig never
|
|
405
|
+
* throws — it degrades to null — so this cannot break activation.
|
|
406
|
+
*/
|
|
407
|
+
private getOrgAgentConfig;
|
|
408
|
+
/**
|
|
409
|
+
* Apply the org policy to one agent, after it has activated.
|
|
410
|
+
*
|
|
411
|
+
* Sequenced after activation rather than alongside it because applying the
|
|
412
|
+
* policy needs the authenticated session activation establishes. Every failure
|
|
413
|
+
* mode is swallowed: a partner's splitting preference is not worth failing a
|
|
414
|
+
* user's connect over.
|
|
415
|
+
*/
|
|
416
|
+
private applyOrgPolicyTo;
|
|
375
417
|
private ensureAgentsInitialized;
|
|
376
418
|
private createAgent;
|
|
377
419
|
/**
|
|
@@ -436,17 +478,6 @@ declare class OwneySDK {
|
|
|
436
478
|
private hasExistingBalance;
|
|
437
479
|
private validateAssetSupport;
|
|
438
480
|
private getEligibleAgents;
|
|
439
|
-
/**
|
|
440
|
-
* Agent ids the routing API provisioned for this org that support the given
|
|
441
|
-
* chain + asset, ordered by preference ({@link AGENT_ELIGIBILITY_ORDER},
|
|
442
|
-
* surfliquid first). Returns `[]` when the org has no compatible agent — never
|
|
443
|
-
* throws on an empty org. Loads agent keys on first call (apiKey only, no
|
|
444
|
-
* wallet), so the UI can resolve which agent to use before the user connects.
|
|
445
|
-
*
|
|
446
|
-
* This is the source of truth for agent availability: an agent appears here
|
|
447
|
-
* iff the routing API returned its key. No per-app feature flags.
|
|
448
|
-
*/
|
|
449
|
-
getEligibleAgentIds(chainId: number, asset: string): Promise<AgentId[]>;
|
|
450
481
|
/**
|
|
451
482
|
* Withdraw funds from a specific agent, or all agents that support the active chain+asset if agentId is omitted.
|
|
452
483
|
* Validates that the asset is supported by the target agent(s) on the active chain.
|
|
@@ -542,7 +573,7 @@ declare class OwneySDK {
|
|
|
542
573
|
getAllocationApy({ agentId, }?: AllocationApyOptions): Promise<OwneyAllocationApy>;
|
|
543
574
|
}
|
|
544
575
|
|
|
545
|
-
type OwneyErrorCode = "NOT_CONNECTED" | "NO_ACTIVE_CHAIN" | "WALLET_NO_ACCOUNTS" | "WALLET_ADDRESS_REQUIRED" | "AGENT_NOT_FOUND" | "AGENT_CHAIN_INCOMPATIBLE" | "AGENT_EMPTY_LIST" | "AGENT_DISABLED" | "CHAIN_UNSUPPORTED" | "CHAIN_NO_COMPATIBLE_AGENTS" | "ASSET_UNSUPPORTED" | "ASSET_NO_COMPATIBLE_AGENTS" | "DEPOSIT_AMOUNT_BELOW_MINIMUM" | "DEPOSIT_CALLBACK_REQUIRED" | "DEPOSIT_CALLBACK_INVALID" | "DEPOSIT_NO_PERMITTED_TOKENS" | "
|
|
576
|
+
type OwneyErrorCode = "NOT_CONNECTED" | "NO_ACTIVE_CHAIN" | "WALLET_NO_ACCOUNTS" | "WALLET_ADDRESS_REQUIRED" | "AGENT_NOT_FOUND" | "AGENT_CHAIN_INCOMPATIBLE" | "AGENT_EMPTY_LIST" | "AGENT_DISABLED" | "CHAIN_UNSUPPORTED" | "CHAIN_NO_COMPATIBLE_AGENTS" | "ASSET_UNSUPPORTED" | "ASSET_NO_COMPATIBLE_AGENTS" | "DEPOSIT_AMOUNT_BELOW_MINIMUM" | "DEPOSIT_CALLBACK_REQUIRED" | "DEPOSIT_CALLBACK_INVALID" | "DEPOSIT_NO_PERMITTED_TOKENS" | "DEPOSIT_INSUFFICIENT_BALANCE" | "WITHDRAW_NO_PERMITTED_TOKENS" | "WITHDRAW_INSUFFICIENT_BALANCE" | "WITHDRAW_ALL_FAILED" | "WITHDRAW_PARTIAL_FAILURE" | "WITHDRAW_FAILED" | "API_ROUTING_ERROR" | "API_ROUTING_FAILED" | "API_SAIL_ERROR" | "API_SAIL_TIMEOUT" | "API_NO_AGENTS" | "SPONSOR_REQUEST_FAILED" | "PERMIT2_APPROVAL_REQUIRED" | "BALANCE_ALL_FAILED" | "ALLOCATION_ALL_FAILED" | "VALIDATION_INVALID_DAYS";
|
|
546
577
|
declare class OwneyError extends Error {
|
|
547
578
|
readonly code: OwneyErrorCode;
|
|
548
579
|
readonly details?: Record<string, unknown>;
|
|
@@ -572,6 +603,29 @@ declare class InvalidHistoryCursorError extends Error {
|
|
|
572
603
|
constructor(message: string);
|
|
573
604
|
}
|
|
574
605
|
|
|
606
|
+
/**
|
|
607
|
+
* Opt-in debug logging.
|
|
608
|
+
*
|
|
609
|
+
* The SDK is deliberately quiet: before this, `src/` contained no `console.log`
|
|
610
|
+
* at all, only `console.warn`/`console.error` for genuine faults. That is worth
|
|
611
|
+
* preserving — this runs inside every partner's app, on every user's connect, so
|
|
612
|
+
* unconditional chatter would land in end users' consoles forever.
|
|
613
|
+
*
|
|
614
|
+
* Two ways to turn it on:
|
|
615
|
+
*
|
|
616
|
+
* 1. From the app: new OwneySDK({ apiKey, debug: true })
|
|
617
|
+
* 2. From devtools, live: globalThis.__OWNEY_DEBUG__ = true
|
|
618
|
+
*
|
|
619
|
+
* (2) is the useful one when diagnosing something on an already-deployed app:
|
|
620
|
+
* the flag is read on every call, not captured once, so flipping it in the
|
|
621
|
+
* console takes effect on the next action without a rebuild or a republish.
|
|
622
|
+
*/
|
|
623
|
+
declare global {
|
|
624
|
+
var __OWNEY_DEBUG__: boolean | undefined;
|
|
625
|
+
}
|
|
626
|
+
/** Enable/disable debug logging programmatically. */
|
|
627
|
+
declare function setOwneyDebug(enabled: boolean): void;
|
|
628
|
+
|
|
575
629
|
type OwneySIWXConfig = {
|
|
576
630
|
/** Owney/Zyfai API key — same value passed to `new OwneySDK({ apiKey })`. */
|
|
577
631
|
apiKey: string;
|
|
@@ -585,4 +639,4 @@ type OwneySIWXConfig = {
|
|
|
585
639
|
*/
|
|
586
640
|
declare function createOwneySIWX(config: OwneySIWXConfig): SIWXConfig;
|
|
587
641
|
|
|
588
|
-
export { AccountAgentApy, AccountApyOptions, AgentApy, AgentApyDetails, AgentBalance, AgentChainIncompatibleError, AgentEarnings, AgentHistoryEntry, AgentHistoryPosition, AgentId, AgentNotFoundError, AgentSupportedAsset, AgentSupportedAssets, AgentUserProfile, AgentWithdrawResult, AgentsApyOptions, AllocationAgentApy, AllocationApyOptions, ApyByChainAndAsset, ApyHistoryPoint, Asset, ConnectionState, DailyApyDays, DepositCallback, DepositOptions, HistoryAction, HistoryFilters, HistoryOptions, HistoryTransaction, IAgent, InvalidHistoryCursorError, NotConnectedError, OwneyAccountApy, OwneyAgentApy, OwneyAgentHistory, OwneyAllocationApy, OwneyBalances, OwneyDepositResult, OwneyEarnings, OwneyError, OwneyErrorCode, OwneyMultiDepositResult, OwneyPosition, OwneySDK, OwneySDKConfig, OwneySIWXConfig, OwneySupportedChainId, OwneySupportedChains, OwneySupportedTokens, OwneyToken, OwneyUserProfile, OwneyWithdrawResult, RebalanceLog, WithdrawOptions, createOwneySIWX };
|
|
642
|
+
export { AccountAgentApy, AccountApyOptions, AgentApy, AgentApyDetails, AgentBalance, AgentChainIncompatibleError, AgentEarnings, AgentHistoryEntry, AgentHistoryPosition, AgentId, AgentNotFoundError, AgentSupportedAsset, AgentSupportedAssets, AgentUserProfile, AgentWithdrawResult, AgentsApyOptions, AllocationAgentApy, AllocationApyOptions, ApyByChainAndAsset, ApyHistoryPoint, Asset, ConnectionState, DailyApyDays, DepositCallback, DepositOptions, HistoryAction, HistoryFilters, HistoryOptions, HistoryTransaction, IAgent, InvalidHistoryCursorError, NotConnectedError, OwneyAccountApy, OwneyAgentApy, OwneyAgentHistory, OwneyAllocationApy, OwneyBalances, OwneyDepositResult, OwneyEarnings, OwneyError, OwneyErrorCode, OwneyMultiDepositResult, OwneyPosition, OwneySDK, OwneySDKConfig, OwneySIWXConfig, OwneySupportedChainId, OwneySupportedChains, OwneySupportedTokens, OwneyToken, OwneyUserProfile, OwneyWithdrawResult, RebalanceLog, WithdrawOptions, createOwneySIWX, setOwneyDebug };
|