@owney/sdk 0.6.9-beta.4 → 0.6.9-beta.6
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-GMNQBWUB.js +55 -0
- package/dist/index.cjs +860 -140
- package/dist/index.d.cts +30 -2
- package/dist/index.d.ts +30 -2
- package/dist/index.js +352 -122
- package/dist/surfliquid.agent-OMOYXWLP.js +385 -0
- package/package.json +3 -1
package/dist/index.d.cts
CHANGED
|
@@ -21,6 +21,16 @@ interface OwneySDKConfig {
|
|
|
21
21
|
* `createOwneySIWX` for apps that don't use the AppKit SIWX modal.
|
|
22
22
|
*/
|
|
23
23
|
referralSource?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Optional override for the SurfLiquid API base URL (defaults to the
|
|
26
|
+
* SurfLiquid SDK's production URL). SurfLiquid auth is an httpOnly
|
|
27
|
+
* SameSite=None cookie set by api.surfliquid.com — a THIRD-PARTY cookie from
|
|
28
|
+
* the embedding app's origin, which WebKit (all iOS browsers) discards, so
|
|
29
|
+
* every authenticated SurfLiquid call 401s on iOS. Point this at a
|
|
30
|
+
* same-origin reverse proxy (e.g. "/api/surf") so the session cookie becomes
|
|
31
|
+
* first-party. Relative paths resolve against the page origin.
|
|
32
|
+
*/
|
|
33
|
+
surfliquidApiBaseUrl?: string;
|
|
24
34
|
/**
|
|
25
35
|
* Turn on the SDK's debug logging (default false). Traces the decisions that
|
|
26
36
|
* are otherwise invisible — notably how the organization's agent policy is
|
|
@@ -43,7 +53,7 @@ type OwneySupportedChainId = (typeof SUPPORTED_CHAIN_IDS)[number];
|
|
|
43
53
|
type OwneySupportedChains = (typeof SUPPORTED_CHAINS)[number];
|
|
44
54
|
type OwneySupportedTokens = (typeof SUPPORTED_TOKENS)[number];
|
|
45
55
|
|
|
46
|
-
type AgentId = "zyfai" | "sail";
|
|
56
|
+
type AgentId = "zyfai" | "sail" | "surfliquid";
|
|
47
57
|
type Asset = string;
|
|
48
58
|
type AgentSupportedAsset = {
|
|
49
59
|
readonly symbol: string;
|
|
@@ -150,6 +160,12 @@ interface OwneyDepositResult {
|
|
|
150
160
|
}
|
|
151
161
|
interface OwneyMultiDepositResult {
|
|
152
162
|
agentResults: Record<string, OwneyDepositResult>;
|
|
163
|
+
/**
|
|
164
|
+
* Per-agent failure messages for agents that errored during a diversified
|
|
165
|
+
* deposit. Present only when at least one (but not all) agents failed —
|
|
166
|
+
* the deposit is partial, not total. Omitted when every agent succeeded.
|
|
167
|
+
*/
|
|
168
|
+
agentErrors?: Record<string, string>;
|
|
153
169
|
}
|
|
154
170
|
interface AgentWithdrawResult {
|
|
155
171
|
txHash?: string;
|
|
@@ -391,6 +407,7 @@ declare class OwneySDK {
|
|
|
391
407
|
private zyfaiRpcUrls?;
|
|
392
408
|
private routingApiBaseUrl?;
|
|
393
409
|
private referralSource?;
|
|
410
|
+
private surfliquidApiBaseUrl?;
|
|
394
411
|
private cachedSponsoredCallback;
|
|
395
412
|
private cachedWethSponsoredCallback;
|
|
396
413
|
private initializingAgentsPromise;
|
|
@@ -514,6 +531,17 @@ declare class OwneySDK {
|
|
|
514
531
|
private hasExistingBalance;
|
|
515
532
|
private validateAssetSupport;
|
|
516
533
|
private getEligibleAgents;
|
|
534
|
+
/**
|
|
535
|
+
* Agent ids the routing API provisioned for this org that support the given
|
|
536
|
+
* chain + asset, ordered by preference ({@link AGENT_ELIGIBILITY_ORDER},
|
|
537
|
+
* surfliquid first). Returns `[]` when the org has no compatible agent — never
|
|
538
|
+
* throws on an empty org. Loads agent keys on first call (apiKey only, no
|
|
539
|
+
* wallet), so the UI can resolve which agent to use before the user connects.
|
|
540
|
+
*
|
|
541
|
+
* This is the source of truth for agent availability: an agent appears here
|
|
542
|
+
* iff the routing API returned its key. No per-app feature flags.
|
|
543
|
+
*/
|
|
544
|
+
getEligibleAgentIds(chainId: number, asset: string): Promise<AgentId[]>;
|
|
517
545
|
/**
|
|
518
546
|
* Withdraw funds from a specific agent, or all agents that support the active chain+asset if agentId is omitted.
|
|
519
547
|
* Validates that the asset is supported by the target agent(s) on the active chain.
|
|
@@ -609,7 +637,7 @@ declare class OwneySDK {
|
|
|
609
637
|
getAllocationApy({ agentId, }?: AllocationApyOptions): Promise<OwneyAllocationApy>;
|
|
610
638
|
}
|
|
611
639
|
|
|
612
|
-
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";
|
|
640
|
+
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_ALL_FAILED" | "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";
|
|
613
641
|
declare class OwneyError extends Error {
|
|
614
642
|
readonly code: OwneyErrorCode;
|
|
615
643
|
readonly details?: Record<string, unknown>;
|
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,16 @@ interface OwneySDKConfig {
|
|
|
21
21
|
* `createOwneySIWX` for apps that don't use the AppKit SIWX modal.
|
|
22
22
|
*/
|
|
23
23
|
referralSource?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Optional override for the SurfLiquid API base URL (defaults to the
|
|
26
|
+
* SurfLiquid SDK's production URL). SurfLiquid auth is an httpOnly
|
|
27
|
+
* SameSite=None cookie set by api.surfliquid.com — a THIRD-PARTY cookie from
|
|
28
|
+
* the embedding app's origin, which WebKit (all iOS browsers) discards, so
|
|
29
|
+
* every authenticated SurfLiquid call 401s on iOS. Point this at a
|
|
30
|
+
* same-origin reverse proxy (e.g. "/api/surf") so the session cookie becomes
|
|
31
|
+
* first-party. Relative paths resolve against the page origin.
|
|
32
|
+
*/
|
|
33
|
+
surfliquidApiBaseUrl?: string;
|
|
24
34
|
/**
|
|
25
35
|
* Turn on the SDK's debug logging (default false). Traces the decisions that
|
|
26
36
|
* are otherwise invisible — notably how the organization's agent policy is
|
|
@@ -43,7 +53,7 @@ type OwneySupportedChainId = (typeof SUPPORTED_CHAIN_IDS)[number];
|
|
|
43
53
|
type OwneySupportedChains = (typeof SUPPORTED_CHAINS)[number];
|
|
44
54
|
type OwneySupportedTokens = (typeof SUPPORTED_TOKENS)[number];
|
|
45
55
|
|
|
46
|
-
type AgentId = "zyfai" | "sail";
|
|
56
|
+
type AgentId = "zyfai" | "sail" | "surfliquid";
|
|
47
57
|
type Asset = string;
|
|
48
58
|
type AgentSupportedAsset = {
|
|
49
59
|
readonly symbol: string;
|
|
@@ -150,6 +160,12 @@ interface OwneyDepositResult {
|
|
|
150
160
|
}
|
|
151
161
|
interface OwneyMultiDepositResult {
|
|
152
162
|
agentResults: Record<string, OwneyDepositResult>;
|
|
163
|
+
/**
|
|
164
|
+
* Per-agent failure messages for agents that errored during a diversified
|
|
165
|
+
* deposit. Present only when at least one (but not all) agents failed —
|
|
166
|
+
* the deposit is partial, not total. Omitted when every agent succeeded.
|
|
167
|
+
*/
|
|
168
|
+
agentErrors?: Record<string, string>;
|
|
153
169
|
}
|
|
154
170
|
interface AgentWithdrawResult {
|
|
155
171
|
txHash?: string;
|
|
@@ -391,6 +407,7 @@ declare class OwneySDK {
|
|
|
391
407
|
private zyfaiRpcUrls?;
|
|
392
408
|
private routingApiBaseUrl?;
|
|
393
409
|
private referralSource?;
|
|
410
|
+
private surfliquidApiBaseUrl?;
|
|
394
411
|
private cachedSponsoredCallback;
|
|
395
412
|
private cachedWethSponsoredCallback;
|
|
396
413
|
private initializingAgentsPromise;
|
|
@@ -514,6 +531,17 @@ declare class OwneySDK {
|
|
|
514
531
|
private hasExistingBalance;
|
|
515
532
|
private validateAssetSupport;
|
|
516
533
|
private getEligibleAgents;
|
|
534
|
+
/**
|
|
535
|
+
* Agent ids the routing API provisioned for this org that support the given
|
|
536
|
+
* chain + asset, ordered by preference ({@link AGENT_ELIGIBILITY_ORDER},
|
|
537
|
+
* surfliquid first). Returns `[]` when the org has no compatible agent — never
|
|
538
|
+
* throws on an empty org. Loads agent keys on first call (apiKey only, no
|
|
539
|
+
* wallet), so the UI can resolve which agent to use before the user connects.
|
|
540
|
+
*
|
|
541
|
+
* This is the source of truth for agent availability: an agent appears here
|
|
542
|
+
* iff the routing API returned its key. No per-app feature flags.
|
|
543
|
+
*/
|
|
544
|
+
getEligibleAgentIds(chainId: number, asset: string): Promise<AgentId[]>;
|
|
517
545
|
/**
|
|
518
546
|
* Withdraw funds from a specific agent, or all agents that support the active chain+asset if agentId is omitted.
|
|
519
547
|
* Validates that the asset is supported by the target agent(s) on the active chain.
|
|
@@ -609,7 +637,7 @@ declare class OwneySDK {
|
|
|
609
637
|
getAllocationApy({ agentId, }?: AllocationApyOptions): Promise<OwneyAllocationApy>;
|
|
610
638
|
}
|
|
611
639
|
|
|
612
|
-
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";
|
|
640
|
+
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_ALL_FAILED" | "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";
|
|
613
641
|
declare class OwneyError extends Error {
|
|
614
642
|
readonly code: OwneyErrorCode;
|
|
615
643
|
readonly details?: Record<string, unknown>;
|