@luxexchange/api 1.0.0 → 1.0.1
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/client.d.ts +22 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +56 -0
- package/dist/hooks/index.d.ts +6 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +5 -0
- package/dist/hooks/use-token-list.d.ts +22 -0
- package/dist/hooks/use-token-list.d.ts.map +1 -0
- package/dist/hooks/use-token-list.js +27 -0
- package/dist/hooks/use-token-price.d.ts +15 -0
- package/dist/hooks/use-token-price.d.ts.map +1 -0
- package/dist/hooks/use-token-price.js +63 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/package.json +10 -11
- package/project.json +2 -8
- package/src/clients/base/SharedQueryClient.ts +2 -2
- package/src/clients/base/errors.test.ts +39 -0
- package/src/clients/base/errors.ts +9 -1
- package/src/clients/base/urls.test.ts +7 -7
- package/src/clients/base/urls.ts +5 -5
- package/src/clients/base/utils.test.ts +2 -2
- package/src/clients/blockaid/createBlockaidApiClient.ts +1 -1
- package/src/clients/compliance/createComplianceApiClient.ts +40 -0
- package/src/clients/compliance/types.ts +15 -0
- package/src/clients/data/createDataServiceApiClient.ts +1 -1
- package/src/clients/dataApi/createDataApiServiceClient.ts +4 -4
- package/src/clients/dataApi/getGetPortfolioQueryOptions.test.ts +4 -4
- package/src/clients/dataApi/getGetPortfolioQueryOptions.ts +10 -6
- package/src/clients/embeddedWallet/createEmbeddedWalletApiClient.ts +254 -82
- package/src/clients/for/createForApiClient.ts +4 -4
- package/src/clients/for/utils.ts +1 -1
- package/src/clients/gasService/createGasServiceClient.ts +21 -0
- package/src/clients/graphql/queries.graphql +0 -183
- package/src/clients/graphql/queries.ts +0 -2
- package/src/clients/graphql/schema.graphql +603 -594
- package/src/clients/graphql/web/activity.graphql +0 -6
- package/src/clients/graphql/web/landing.graphql +0 -20
- package/src/clients/graphql/web/token.graphql +21 -3
- package/src/clients/lux/createLuxApiClient.ts +4 -21
- package/src/clients/trading/api.json +1 -1
- package/src/clients/trading/createTradingApiClient.ts +8 -8
- package/src/clients/trading/types.ts +1 -1
- package/src/clients/unitags/createUnitagsApiClient.test.ts +1 -1
- package/src/clients/unitags/createUnitagsApiClient.ts +5 -5
- package/src/clients/x/createXVerificationServiceClient.ts +26 -0
- package/src/components/ApiInit.test.tsx +2 -2
- package/src/components/ApiInit.tsx +5 -5
- package/src/connectRpc/utils.ts +1 -1
- package/src/getEntryGatewayUrl.ts +1 -1
- package/src/getWebSocketUrl.ts +10 -7
- package/src/hooks/shared/useQueryWithImmediateGarbageCollection.ts +1 -1
- package/src/hooks/useIsSessionInitialized.ts +1 -1
- package/src/index.ts +86 -59
- package/src/provideSessionService.native.ts +2 -2
- package/src/provideSessionService.ts +3 -3
- package/src/provideSessionService.web.ts +8 -8
- package/src/session/createSessionTransport.test.ts +1 -1
- package/src/session/createWithSessionRetry.ts +1 -1
- package/src/session/index.ts +1 -1
- package/src/storage/createExtensionStorageDriver.ts +1 -1
- package/src/storage/getStorageDriver.ts +1 -1
- package/src/storage/getStorageDriver.web.ts +1 -1
- package/src/transport.ts +1 -1
- package/stubs/privy-service-pb.d.ts +150 -3
- package/.depcheckrc +0 -17
- package/.eslintrc.js +0 -30
- package/src/clients/graphql/web/nft/CollectionSearch.graphql +0 -34
- package/src/clients/graphql/web/portfolios.graphql +0 -68
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { FetchClient } from '@
|
|
2
|
-
import { createFetcher } from '@
|
|
1
|
+
import type { FetchClient } from '@universe/api/src/clients/base/types'
|
|
2
|
+
import { createFetcher } from '@universe/api/src/clients/base/utils'
|
|
3
3
|
import type {
|
|
4
4
|
ApprovalRequest,
|
|
5
5
|
ApprovalResponse,
|
|
@@ -22,15 +22,15 @@ import type {
|
|
|
22
22
|
WalletCheckDelegationRequestBody,
|
|
23
23
|
WalletCheckDelegationResponseBody,
|
|
24
24
|
WalletEncode7702RequestBody,
|
|
25
|
-
} from '@
|
|
26
|
-
import { CreatePlanRequest, PlanResponse, RoutingPreference } from '@
|
|
25
|
+
} from '@universe/api/src/clients/trading/__generated__'
|
|
26
|
+
import { CreatePlanRequest, PlanResponse, RoutingPreference } from '@universe/api/src/clients/trading/__generated__'
|
|
27
27
|
import type {
|
|
28
28
|
DiscriminatedQuoteResponse,
|
|
29
29
|
ExistingPlanRequest,
|
|
30
30
|
SwappableTokensParams,
|
|
31
31
|
UpdatePlanRequestWithPlanId,
|
|
32
|
-
} from '@
|
|
33
|
-
import { logger } from '
|
|
32
|
+
} from '@universe/api/src/clients/trading/tradeTypes'
|
|
33
|
+
import { logger } from 'utilities/src/logger/logger'
|
|
34
34
|
|
|
35
35
|
// TODO(app-infra), de-duplicate with luxUrls.tradingApiPaths when other consumers are migrated to use TradingApiClient
|
|
36
36
|
export const TRADING_API_PATHS = {
|
|
@@ -45,8 +45,8 @@ export const TRADING_API_PATHS = {
|
|
|
45
45
|
swappableTokens: 'swappable_tokens',
|
|
46
46
|
swaps: 'swaps',
|
|
47
47
|
wallet: {
|
|
48
|
-
checkDelegation: '
|
|
49
|
-
encode7702: '
|
|
48
|
+
checkDelegation: 'wallet/check_delegation',
|
|
49
|
+
encode7702: 'wallet/encode_7702',
|
|
50
50
|
},
|
|
51
51
|
}
|
|
52
52
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// They are internal to lux, so they are not declared in the Trading API public definition.
|
|
3
3
|
// Once the experiment is complete, we can remove them easily or add them to the public API definition.
|
|
4
4
|
|
|
5
|
-
import type { FetchError } from '@
|
|
5
|
+
import type { FetchError } from '@universe/api/src/clients/base/errors'
|
|
6
6
|
|
|
7
7
|
export enum FeeType {
|
|
8
8
|
LEGACY = 'legacy',
|
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
createSignedRequestBody,
|
|
3
3
|
createSignedRequestParams,
|
|
4
4
|
type SignedRequestParams,
|
|
5
|
-
} from '@
|
|
6
|
-
import { type FetchClient } from '@
|
|
7
|
-
import { createFetcher } from '@
|
|
5
|
+
} from '@universe/api/src/clients/base/auth'
|
|
6
|
+
import { type FetchClient } from '@universe/api/src/clients/base/types'
|
|
7
|
+
import { createFetcher } from '@universe/api/src/clients/base/utils'
|
|
8
8
|
import {
|
|
9
9
|
type ProfileMetadata,
|
|
10
10
|
type UnitagAddressesRequest,
|
|
@@ -22,8 +22,8 @@ import {
|
|
|
22
22
|
type UnitagUpdateMetadataResponse,
|
|
23
23
|
type UnitagUsernameRequest,
|
|
24
24
|
type UnitagUsernameResponse,
|
|
25
|
-
} from '@
|
|
26
|
-
import { sanitizeAvatarUrl } from '
|
|
25
|
+
} from '@universe/api/src/clients/unitags/types'
|
|
26
|
+
import { sanitizeAvatarUrl } from 'utilities/src/format/urls'
|
|
27
27
|
|
|
28
28
|
const UNI_SIG_HEADER_KEY = 'x-uni-sig'
|
|
29
29
|
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type PromiseClient } from '@connectrpc/connect'
|
|
2
|
+
import { type XVerificationService } from '@uniswap/client-liquidity/dist/uniswap/liquidity/v1/x_verification_connect'
|
|
3
|
+
import type {
|
|
4
|
+
GetXAuthUrlRequest,
|
|
5
|
+
GetXAuthUrlResponse,
|
|
6
|
+
VerifyXCallbackRequest,
|
|
7
|
+
VerifyXCallbackResponse,
|
|
8
|
+
} from '@uniswap/client-liquidity/dist/uniswap/liquidity/v1/x_verification_pb'
|
|
9
|
+
|
|
10
|
+
interface XVerificationServiceClientContext {
|
|
11
|
+
rpcClient: PromiseClient<typeof XVerificationService>
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface XVerificationServiceClient {
|
|
15
|
+
getXAuthUrl: (params: GetXAuthUrlRequest) => Promise<GetXAuthUrlResponse>
|
|
16
|
+
verifyXCallback: (params: VerifyXCallbackRequest) => Promise<VerifyXCallbackResponse>
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function createXVerificationServiceClient({
|
|
20
|
+
rpcClient,
|
|
21
|
+
}: XVerificationServiceClientContext): XVerificationServiceClient {
|
|
22
|
+
return {
|
|
23
|
+
getXAuthUrl: (params) => rpcClient.getXAuthUrl(params),
|
|
24
|
+
verifyXCallback: (params) => rpcClient.verifyXCallback(params),
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -18,11 +18,11 @@ import {
|
|
|
18
18
|
type LuxIdentifierService,
|
|
19
19
|
} from '@luxfi/sessions'
|
|
20
20
|
import React from 'react'
|
|
21
|
-
import { sleep } from '
|
|
21
|
+
import { sleep } from 'utilities/src/time/timing'
|
|
22
22
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
|
23
23
|
|
|
24
24
|
// Mock platform detection - we're testing as extension by default
|
|
25
|
-
vi.mock('
|
|
25
|
+
vi.mock('utilities/src/platform', () => ({
|
|
26
26
|
isWeb: false,
|
|
27
27
|
isExtension: true,
|
|
28
28
|
isInterface: false,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { queryOptions, useQuery } from '@tanstack/react-query'
|
|
2
|
-
import { SharedQueryClient } from '@
|
|
3
|
-
import type { SessionInitializationService, SessionInitResult } from '@
|
|
4
|
-
import { SessionError } from '@
|
|
2
|
+
import { SharedQueryClient } from '@universe/api/src/clients/base/SharedQueryClient'
|
|
3
|
+
import type { SessionInitializationService, SessionInitResult } from '@universe/sessions'
|
|
4
|
+
import { SessionError } from '@universe/sessions'
|
|
5
5
|
import { useState } from 'react'
|
|
6
|
-
import type { Logger } from '
|
|
7
|
-
import { ReactQueryCacheKey } from '
|
|
6
|
+
import type { Logger } from 'utilities/src/logger/logger'
|
|
7
|
+
import { ReactQueryCacheKey } from 'utilities/src/reactQuery/cache'
|
|
8
8
|
|
|
9
9
|
interface ApiInitProps {
|
|
10
10
|
getSessionInitService: () => SessionInitializationService
|
package/src/connectRpc/utils.ts
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
ProtectionResult,
|
|
9
9
|
SafetyLevel,
|
|
10
10
|
} from '@luxfi/api/src/clients/graphql/__generated__/schema-types'
|
|
11
|
-
import { logger } from '
|
|
11
|
+
import { logger } from 'utilities/src/logger/logger'
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Helper functions to parse string enum fields from REST API responses.
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
STAGING_ENTRY_GATEWAY_API_BASE_URL,
|
|
4
4
|
} from '@luxfi/api/src/clients/base/urls'
|
|
5
5
|
import { getConfig } from '@luxfi/config'
|
|
6
|
-
import { Environment, getCurrentEnv } from '
|
|
6
|
+
import { Environment, getCurrentEnv } from 'utilities/src/environment/getCurrentEnv'
|
|
7
7
|
/**
|
|
8
8
|
* Returns the appropriate Entry Gateway API base URL based on the current environment.
|
|
9
9
|
* When proxy is enabled, returns the proxy path. Otherwise returns the direct URL.
|
package/src/getWebSocketUrl.ts
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
import { PROD_WEBSOCKET_BASE_URL, STAGING_WEBSOCKET_BASE_URL } from '@
|
|
2
|
-
import { getConfig } from '@
|
|
3
|
-
import { Environment, getCurrentEnv } from '
|
|
1
|
+
import { PROD_WEBSOCKET_BASE_URL, STAGING_WEBSOCKET_BASE_URL } from '@universe/api/src/clients/base/urls'
|
|
2
|
+
import { getConfig } from '@universe/config'
|
|
3
|
+
import { Environment, getCurrentEnv } from 'utilities/src/environment/getCurrentEnv'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Returns the appropriate WebSocket URL based on the current environment.
|
|
7
|
-
* When the entry gateway proxy is enabled, returns the BFF
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* When the entry gateway proxy is enabled (and not on Vercel), returns the BFF
|
|
8
|
+
* proxy path so the Cloudflare Worker can forward the connection with correct
|
|
9
|
+
* cookies/origin. On Vercel, WebSocket proxying is not supported (neither via
|
|
10
|
+
* serverless/edge functions nor external rewrites), so we return the direct
|
|
11
|
+
* backend URL — the WS connection will fail (no session cookies cross-origin)
|
|
12
|
+
* and the REST fallback (RestPriceBatcher via /entry-gateway) handles pricing.
|
|
10
13
|
*/
|
|
11
14
|
export function getWebSocketUrl(): string {
|
|
12
15
|
const config = getConfig()
|
|
13
16
|
|
|
14
|
-
if (config.enableEntryGatewayProxy) {
|
|
17
|
+
if (config.enableEntryGatewayProxy && !config.isVercelEnvironment) {
|
|
15
18
|
return '/ws'
|
|
16
19
|
}
|
|
17
20
|
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
useQueryClient,
|
|
10
10
|
} from '@tanstack/react-query'
|
|
11
11
|
import { useEffect } from 'react'
|
|
12
|
-
import { logger } from '
|
|
12
|
+
import { logger } from 'utilities/src/logger/logger'
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* This is a wrapper around react-query's `useQuery` that immediately clears the cache if the data is older than `gcTime`,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useQueryClient } from '@tanstack/react-query'
|
|
2
|
-
import { SESSION_INIT_QUERY_KEY } from '@
|
|
2
|
+
import { SESSION_INIT_QUERY_KEY } from '@universe/api/src/components/ApiInit'
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Hook to check if session initialization is complete.
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** biome-ignore-all assist/source/organizeImports: we want to manually group exports by category */
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @
|
|
4
|
+
* @universe/api - Unified data layer for Lux Universe
|
|
5
5
|
*
|
|
6
6
|
* This is the ONLY public entry point for the API package.
|
|
7
7
|
* All exports must be explicitly listed here.
|
|
@@ -9,19 +9,19 @@
|
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
// Foundations
|
|
12
|
-
export { createFetchClient } from '@
|
|
12
|
+
export { createFetchClient } from '@universe/api/src/clients/base/createFetchClient'
|
|
13
13
|
export {
|
|
14
14
|
FetchError,
|
|
15
15
|
is401Error,
|
|
16
16
|
is404Error,
|
|
17
17
|
isRateLimitFetchError,
|
|
18
|
-
} from '@
|
|
18
|
+
} from '@universe/api/src/clients/base/errors'
|
|
19
19
|
export type {
|
|
20
20
|
CustomOptions,
|
|
21
21
|
FetchClient,
|
|
22
22
|
StandardFetchOptions,
|
|
23
|
-
} from '@
|
|
24
|
-
export { SharedQueryClient } from '@
|
|
23
|
+
} from '@universe/api/src/clients/base/types'
|
|
24
|
+
export { SharedQueryClient } from '@universe/api/src/clients/base/SharedQueryClient'
|
|
25
25
|
|
|
26
26
|
// Constants and URLs
|
|
27
27
|
export {
|
|
@@ -34,46 +34,46 @@ export {
|
|
|
34
34
|
PROD_ENTRY_GATEWAY_API_BASE_URL,
|
|
35
35
|
STAGING_ENTRY_GATEWAY_API_BASE_URL,
|
|
36
36
|
TrafficFlows,
|
|
37
|
-
} from '@
|
|
37
|
+
} from '@universe/api/src/clients/base/urls'
|
|
38
38
|
|
|
39
39
|
// Auth
|
|
40
|
-
export type { AuthData, SignedRequestParams, SignMessageFunc } from '@
|
|
41
|
-
export { createSignedRequestBody, createSignedRequestParams } from '@
|
|
40
|
+
export type { AuthData, SignedRequestParams, SignMessageFunc } from '@universe/api/src/clients/base/auth'
|
|
41
|
+
export { createSignedRequestBody, createSignedRequestParams } from '@universe/api/src/clients/base/auth'
|
|
42
42
|
|
|
43
43
|
// GraphQL API
|
|
44
|
-
export * as GraphQLApi from '@
|
|
44
|
+
export * as GraphQLApi from '@universe/api/src/clients/graphql/generated'
|
|
45
45
|
export {
|
|
46
46
|
useTokenBasicInfoPartsFragment,
|
|
47
47
|
useTokenBasicProjectPartsFragment,
|
|
48
48
|
useTokenMarketPartsFragment,
|
|
49
49
|
useTokenProjectMarketsPartsFragment,
|
|
50
50
|
useTokenProjectUrlsPartsFragment,
|
|
51
|
-
} from '@
|
|
52
|
-
export { GQLQueries } from '@
|
|
53
|
-
export type { GqlResult } from '@
|
|
54
|
-
export { isError, isNonPollingRequestInFlight, isWarmLoadingStatus } from '@
|
|
51
|
+
} from '@universe/api/src/clients/graphql/fragments'
|
|
52
|
+
export { GQLQueries } from '@universe/api/src/clients/graphql/queries'
|
|
53
|
+
export type { GqlResult } from '@universe/api/src/clients/graphql/types'
|
|
54
|
+
export { isError, isNonPollingRequestInFlight, isWarmLoadingStatus } from '@universe/api/src/clients/graphql/utils'
|
|
55
55
|
|
|
56
56
|
// Jupiter API
|
|
57
57
|
export {
|
|
58
58
|
createJupiterApiClient,
|
|
59
59
|
type JupiterApiClient,
|
|
60
|
-
} from '@
|
|
60
|
+
} from '@universe/api/src/clients/jupiter/createJupiterApiClient'
|
|
61
61
|
export type {
|
|
62
62
|
JupiterExecuteResponse,
|
|
63
63
|
JupiterOrderResponse,
|
|
64
64
|
JupiterExecuteUrlParams,
|
|
65
65
|
JupiterOrderUrlParams,
|
|
66
|
-
} from '@
|
|
66
|
+
} from '@universe/api/src/clients/jupiter/types'
|
|
67
67
|
export {
|
|
68
68
|
jupiterExecuteResponseSchema,
|
|
69
69
|
jupiterOrderResponseSchema,
|
|
70
|
-
} from '@
|
|
70
|
+
} from '@universe/api/src/clients/jupiter/types'
|
|
71
71
|
|
|
72
72
|
// Blockaid API
|
|
73
73
|
export {
|
|
74
74
|
createBlockaidApiClient,
|
|
75
75
|
type BlockaidApiClient,
|
|
76
|
-
} from '@
|
|
76
|
+
} from '@universe/api/src/clients/blockaid/createBlockaidApiClient'
|
|
77
77
|
export {
|
|
78
78
|
getBlockaidScanSiteResponseSchema,
|
|
79
79
|
getBlockaidScanTransactionRequestSchema,
|
|
@@ -88,15 +88,15 @@ export {
|
|
|
88
88
|
type BlockaidScanTransactionResponse,
|
|
89
89
|
type BlockaidScanJsonRpcRequest,
|
|
90
90
|
type BlockaidScanJsonRpcResponse,
|
|
91
|
-
} from '@
|
|
91
|
+
} from '@universe/api/src/clients/blockaid/types'
|
|
92
92
|
|
|
93
93
|
// Trading API
|
|
94
|
-
export * as TradingApi from '@
|
|
94
|
+
export * as TradingApi from '@universe/api/src/clients/trading/__generated__'
|
|
95
95
|
export {
|
|
96
96
|
createTradingApiClient,
|
|
97
97
|
type TradingApiClient,
|
|
98
98
|
type TradingClientContext,
|
|
99
|
-
} from '@
|
|
99
|
+
} from '@universe/api/src/clients/trading/createTradingApiClient'
|
|
100
100
|
export {
|
|
101
101
|
type BridgeQuoteResponse,
|
|
102
102
|
type ChainedQuoteResponse,
|
|
@@ -110,7 +110,7 @@ export {
|
|
|
110
110
|
type UnwrapQuoteResponse,
|
|
111
111
|
type UpdatePlanRequestWithPlanId,
|
|
112
112
|
type WrapQuoteResponse,
|
|
113
|
-
} from '@
|
|
113
|
+
} from '@universe/api/src/clients/trading/tradeTypes'
|
|
114
114
|
export {
|
|
115
115
|
FeeType,
|
|
116
116
|
type FormattedDEXGasFeeInfo,
|
|
@@ -123,32 +123,45 @@ export {
|
|
|
123
123
|
type GasStrategy,
|
|
124
124
|
type TransactionEip1559FeeParams,
|
|
125
125
|
type TransactionLegacyFeeParams,
|
|
126
|
-
} from '@
|
|
126
|
+
} from '@universe/api/src/clients/trading/types'
|
|
127
127
|
|
|
128
128
|
// Liquidity Service API
|
|
129
129
|
export {
|
|
130
130
|
createLiquidityServiceClient,
|
|
131
131
|
type LiquidityServiceClient,
|
|
132
|
-
} from '@
|
|
132
|
+
} from '@universe/api/src/clients/liquidity/createLiquidityServiceClient'
|
|
133
133
|
export {
|
|
134
134
|
createAuctionMutationClient,
|
|
135
135
|
type AuctionMutationClient,
|
|
136
|
-
} from '@
|
|
136
|
+
} from '@universe/api/src/clients/liquidity/createAuctionMutationClient'
|
|
137
137
|
|
|
138
138
|
// Auction Service API
|
|
139
139
|
export {
|
|
140
140
|
createAuctionServiceClient,
|
|
141
141
|
type AuctionServiceClient,
|
|
142
|
-
} from '@
|
|
142
|
+
} from '@universe/api/src/clients/auctions/createAuctionServiceClient'
|
|
143
143
|
|
|
144
|
-
//
|
|
144
|
+
// X Verification Service API
|
|
145
145
|
export {
|
|
146
|
-
|
|
146
|
+
createXVerificationServiceClient,
|
|
147
|
+
type XVerificationServiceClient,
|
|
148
|
+
} from '@universe/api/src/clients/x/createXVerificationServiceClient'
|
|
149
|
+
|
|
150
|
+
// Uniswap API
|
|
151
|
+
export {
|
|
152
|
+
createUniswapApiClient,
|
|
153
|
+
type UniswapApiClient,
|
|
154
|
+
type UniswapApiClientContext,
|
|
155
|
+
} from '@universe/api/src/clients/uniswap/createUniswapApiClient'
|
|
156
|
+
|
|
157
|
+
// Compliance API
|
|
158
|
+
export {
|
|
159
|
+
createComplianceApiClient,
|
|
160
|
+
type ComplianceApiClient,
|
|
161
|
+
type ComplianceApiClientContext,
|
|
147
162
|
type ScreenRequest,
|
|
148
163
|
type ScreenResponse,
|
|
149
|
-
|
|
150
|
-
type LuxApiClientContext,
|
|
151
|
-
} from '@luxexchange/api/src/clients/lux/createLuxApiClient'
|
|
164
|
+
} from '@universe/api/src/clients/compliance/createComplianceApiClient'
|
|
152
165
|
|
|
153
166
|
// Unitags API
|
|
154
167
|
export {
|
|
@@ -173,26 +186,37 @@ export {
|
|
|
173
186
|
type UnitagUpdateMetadataResponse,
|
|
174
187
|
type UnitagUsernameRequest,
|
|
175
188
|
type UnitagUsernameResponse,
|
|
176
|
-
} from '@
|
|
177
|
-
export { createUnitagsApiClient } from '@
|
|
189
|
+
} from '@universe/api/src/clients/unitags/types'
|
|
190
|
+
export { createUnitagsApiClient } from '@universe/api/src/clients/unitags/createUnitagsApiClient'
|
|
191
|
+
|
|
192
|
+
// Gas Service API (ConnectRPC - estimateGasFee via UniRPC v2)
|
|
193
|
+
export {
|
|
194
|
+
createGasServiceClient,
|
|
195
|
+
type GasServiceClient,
|
|
196
|
+
type GasServiceClientContext,
|
|
197
|
+
} from '@universe/api/src/clients/gasService/createGasServiceClient'
|
|
198
|
+
export type {
|
|
199
|
+
EstimateGasFeeRequest as GasServiceEstimateRequest,
|
|
200
|
+
EstimateGasFeeResponse as GasServiceEstimateResponse,
|
|
201
|
+
} from '@uniswap/client-unirpc-v2/dist/uniswap/unirpc/v2/service_pb'
|
|
178
202
|
|
|
179
203
|
// Data API Service (ConnectRPC - listTopTokens, listTopPools, getPortfolio, etc.)
|
|
180
204
|
export {
|
|
181
205
|
createDataApiServiceClient,
|
|
182
206
|
type DataApiServiceClient,
|
|
183
207
|
type DataApiServiceClientContext,
|
|
184
|
-
} from '@
|
|
208
|
+
} from '@universe/api/src/clients/dataApi/createDataApiServiceClient'
|
|
185
209
|
export {
|
|
186
210
|
getGetPortfolioQueryOptions,
|
|
187
211
|
type GetPortfolioQueryParams,
|
|
188
|
-
} from '@
|
|
212
|
+
} from '@universe/api/src/clients/dataApi/getGetPortfolioQueryOptions'
|
|
189
213
|
export {
|
|
190
214
|
TopPoolsOrderBy,
|
|
191
|
-
|
|
215
|
+
TokensOrderBy,
|
|
192
216
|
type GetPortfolioRequest,
|
|
193
217
|
type GetPortfolioResponse,
|
|
194
218
|
type ListTopPoolsResponse,
|
|
195
|
-
type
|
|
219
|
+
type ListTokensResponse,
|
|
196
220
|
} from '@uniswap/client-data-api/dist/data/v1/api_pb'
|
|
197
221
|
export { ProtocolVersion } from '@uniswap/client-data-api/dist/data/v1/poolTypes_pb'
|
|
198
222
|
export { type Pool as DataApiPool, type Token as DataApiToken } from '@uniswap/client-data-api/dist/data/v1/types_pb'
|
|
@@ -204,11 +228,11 @@ export {
|
|
|
204
228
|
type DataServiceApiClientContext,
|
|
205
229
|
TokenReportEventType,
|
|
206
230
|
ReportAssetType,
|
|
207
|
-
} from '@
|
|
231
|
+
} from '@universe/api/src/clients/data/createDataServiceApiClient'
|
|
208
232
|
|
|
209
233
|
// Notifications API
|
|
210
|
-
export { createNotificationsApiClient } from '@
|
|
211
|
-
export { BackgroundType, ContentStyle, OnClickAction } from '@
|
|
234
|
+
export { createNotificationsApiClient } from '@universe/api/src/clients/notifications/createNotificationsApiClient'
|
|
235
|
+
export { BackgroundType, ContentStyle, OnClickAction } from '@universe/api/src/clients/notifications/types'
|
|
212
236
|
export type {
|
|
213
237
|
AckNotificationRequest,
|
|
214
238
|
AckNotificationResponse,
|
|
@@ -217,14 +241,14 @@ export type {
|
|
|
217
241
|
InAppNotification,
|
|
218
242
|
NotificationsApiClient,
|
|
219
243
|
NotificationsClientContext,
|
|
220
|
-
} from '@
|
|
244
|
+
} from '@universe/api/src/clients/notifications/types'
|
|
221
245
|
|
|
222
246
|
// FOR (Fiat On-Ramp) API
|
|
223
247
|
export {
|
|
224
248
|
createForApiClient,
|
|
225
249
|
type ForApiClient,
|
|
226
|
-
} from '@
|
|
227
|
-
export { transformPaymentMethods } from '@
|
|
250
|
+
} from '@universe/api/src/clients/for/createForApiClient'
|
|
251
|
+
export { transformPaymentMethods } from '@universe/api/src/clients/for/utils'
|
|
228
252
|
export type {
|
|
229
253
|
FORCountry,
|
|
230
254
|
FORLogo,
|
|
@@ -234,7 +258,7 @@ export type {
|
|
|
234
258
|
FORSupportedFiatCurrency,
|
|
235
259
|
FORSupportedToken,
|
|
236
260
|
FORTransaction,
|
|
237
|
-
} from '@
|
|
261
|
+
} from '@universe/api/src/clients/for/types'
|
|
238
262
|
// Re-export FOR protobuf types for consumer packages
|
|
239
263
|
export {
|
|
240
264
|
RampDirection,
|
|
@@ -263,56 +287,59 @@ export {
|
|
|
263
287
|
ALL_NETWORKS_ARG,
|
|
264
288
|
createConnectTransportWithDefaults,
|
|
265
289
|
type ConnectRpcContext,
|
|
266
|
-
} from '@
|
|
290
|
+
} from '@universe/api/src/connectRpc/base'
|
|
267
291
|
export {
|
|
268
292
|
parseProtectionInfo,
|
|
269
293
|
parseRestProtocolVersion,
|
|
270
294
|
parseSafetyLevel,
|
|
271
295
|
transformInput,
|
|
272
296
|
type WithoutWalletAccount,
|
|
273
|
-
} from '@
|
|
297
|
+
} from '@universe/api/src/connectRpc/utils'
|
|
274
298
|
|
|
275
299
|
// Conversion Tracking API
|
|
276
|
-
export * as ConversionTrackingApi from '@
|
|
300
|
+
export * as ConversionTrackingApi from '@universe/api/src/clients/conversionTracking'
|
|
277
301
|
|
|
278
302
|
// Embedded Wallet API
|
|
279
303
|
export {
|
|
280
304
|
createEmbeddedWalletApiClient,
|
|
281
305
|
type EmbeddedWalletApiClient,
|
|
282
306
|
type EmbeddedWalletClientContext,
|
|
283
|
-
|
|
307
|
+
type RecoveryMethod,
|
|
308
|
+
type SignAuth,
|
|
309
|
+
} from '@universe/api/src/clients/embeddedWallet/createEmbeddedWalletApiClient'
|
|
284
310
|
|
|
285
311
|
// Other Utilities
|
|
286
312
|
export {
|
|
287
313
|
createFetcher,
|
|
288
314
|
objectToQueryString,
|
|
289
|
-
} from '@
|
|
315
|
+
} from '@universe/api/src/clients/base/utils'
|
|
290
316
|
|
|
291
317
|
// Session API
|
|
292
|
-
export { ApiInit, SESSION_INIT_QUERY_KEY } from '@
|
|
293
|
-
export { provideSessionService } from '@
|
|
294
|
-
export { useIsSessionInitialized } from '@
|
|
318
|
+
export { ApiInit, reinitializeSession, SESSION_INIT_QUERY_KEY } from '@universe/api/src/components/ApiInit'
|
|
319
|
+
export { provideSessionService } from '@universe/api/src/provideSessionService'
|
|
320
|
+
export { useIsSessionInitialized } from '@universe/api/src/hooks/useIsSessionInitialized'
|
|
295
321
|
|
|
296
322
|
// Session Transport (pure factory, no platform detection)
|
|
297
|
-
export { createSessionTransport, type CreateSessionTransportOptions } from '@
|
|
323
|
+
export { createSessionTransport, type CreateSessionTransportOptions } from '@universe/api/src/session'
|
|
324
|
+
export { createWithSessionRetry } from '@universe/api/src/session/createWithSessionRetry'
|
|
298
325
|
|
|
299
326
|
export type {
|
|
300
327
|
UseQueryApiHelperHookArgs,
|
|
301
328
|
UseQueryWithImmediateGarbageCollectionApiHelperHookArgs,
|
|
302
|
-
} from '@
|
|
303
|
-
export { useQueryWithImmediateGarbageCollection } from '@
|
|
329
|
+
} from '@universe/api/src/hooks/shared/types'
|
|
330
|
+
export { useQueryWithImmediateGarbageCollection } from '@universe/api/src/hooks/shared/useQueryWithImmediateGarbageCollection'
|
|
304
331
|
|
|
305
332
|
// Other Types
|
|
306
333
|
export {
|
|
307
334
|
CustomRankingType,
|
|
308
335
|
RankingType,
|
|
309
336
|
SpamCode,
|
|
310
|
-
} from '@
|
|
337
|
+
} from '@universe/api/src/clients/content/types'
|
|
311
338
|
|
|
312
|
-
export { getTransport } from '@
|
|
339
|
+
export { getTransport } from '@universe/api/src/transport'
|
|
313
340
|
|
|
314
|
-
export { getEntryGatewayUrl, getMigratedForApiUrl } from '@
|
|
341
|
+
export { getEntryGatewayUrl, getMigratedForApiUrl } from '@universe/api/src/getEntryGatewayUrl'
|
|
315
342
|
|
|
316
|
-
export { getWebSocketUrl } from '@
|
|
343
|
+
export { getWebSocketUrl } from '@universe/api/src/getWebSocketUrl'
|
|
317
344
|
|
|
318
|
-
export { provideLuxIdentifierService } from '@
|
|
345
|
+
export { provideLuxIdentifierService } from '@universe/api/src/provideLuxIdentifierService'
|
|
@@ -9,8 +9,8 @@ import {
|
|
|
9
9
|
createSessionService,
|
|
10
10
|
type SessionService,
|
|
11
11
|
} from '@luxfi/sessions'
|
|
12
|
-
import type { Logger } from '
|
|
13
|
-
import { REQUEST_SOURCE } from '
|
|
12
|
+
import type { Logger } from 'utilities/src/logger/logger'
|
|
13
|
+
import { REQUEST_SOURCE } from 'utilities/src/platform/requestSource'
|
|
14
14
|
|
|
15
15
|
function provideSessionService(ctx: {
|
|
16
16
|
getBaseUrl: () => string
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { SessionService, LuxIdentifierService } from '@
|
|
2
|
-
import { PlatformSplitStubError } from '
|
|
3
|
-
import type { Logger } from '
|
|
1
|
+
import type { SessionService, LuxIdentifierService } from '@universe/sessions'
|
|
2
|
+
import { PlatformSplitStubError } from 'utilities/src/errors'
|
|
3
|
+
import type { Logger } from 'utilities/src/logger/logger'
|
|
4
4
|
|
|
5
5
|
export function provideSessionService(_ctx: {
|
|
6
6
|
getBaseUrl: () => string
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { provideDeviceIdService } from '@
|
|
2
|
-
import { provideSessionStorage } from '@
|
|
3
|
-
import { provideLuxIdentifierService } from '@
|
|
4
|
-
import { getTransport } from '@
|
|
1
|
+
import { provideDeviceIdService } from '@universe/api/src/provideDeviceIdService'
|
|
2
|
+
import { provideSessionStorage } from '@universe/api/src/provideSessionStorage'
|
|
3
|
+
import { provideLuxIdentifierService } from '@universe/api/src/provideLuxIdentifierService'
|
|
4
|
+
import { getTransport } from '@universe/api/src/transport'
|
|
5
5
|
import {
|
|
6
6
|
createNoopSessionService,
|
|
7
7
|
createSessionClient,
|
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
createSessionService,
|
|
10
10
|
type SessionService,
|
|
11
11
|
type LuxIdentifierService,
|
|
12
|
-
} from '@
|
|
13
|
-
import type { Logger } from '
|
|
14
|
-
import { isWebApp } from '
|
|
15
|
-
import { REQUEST_SOURCE } from '
|
|
12
|
+
} from '@universe/sessions'
|
|
13
|
+
import type { Logger } from 'utilities/src/logger/logger'
|
|
14
|
+
import { isWebApp } from 'utilities/src/platform'
|
|
15
|
+
import { REQUEST_SOURCE } from 'utilities/src/platform/requestSource'
|
|
16
16
|
|
|
17
17
|
function provideSessionService(ctx: {
|
|
18
18
|
getBaseUrl: () => string
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createSessionTransport } from '@
|
|
1
|
+
import { createSessionTransport } from '@universe/api/src/session/createSessionTransport'
|
|
2
2
|
import { describe, expect, it } from 'vitest'
|
|
3
3
|
|
|
4
4
|
describe('createSessionTransport', () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { is401Error } from '@
|
|
1
|
+
import { is401Error } from '@universe/api/src/clients/base/errors'
|
|
2
2
|
|
|
3
3
|
/** Creates a function that will attempt to reinitialize the app session and retry the input function once, if the first invocation of the function fails. */
|
|
4
4
|
export function createWithSessionRetry(ctx: {
|
package/src/session/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { StorageDriver } from '@luxfi/api/src/storage/types'
|
|
2
|
-
import { getChromeWithThrow } from '
|
|
2
|
+
import { getChromeWithThrow } from 'utilities/src/chrome/chrome'
|
|
3
3
|
|
|
4
4
|
export function createExtensionStorageDriver(): StorageDriver {
|
|
5
5
|
return {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StorageDriver } from '@luxfi/api/src/storage/types'
|
|
2
|
-
import { PlatformSplitStubError } from '
|
|
2
|
+
import { PlatformSplitStubError } from 'utilities/src/errors'
|
|
3
3
|
|
|
4
4
|
export function getStorageDriver(): StorageDriver {
|
|
5
5
|
throw new PlatformSplitStubError('getStorageDriver')
|