@luxexchange/api 1.0.2 → 1.0.3
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/.depcheckrc +16 -0
- package/.eslintrc.js +30 -0
- package/package.json +12 -15
- package/project.json +2 -2
- package/src/clients/auctions/createAuctionServiceClient.ts +2 -2
- package/src/clients/base/SharedQueryClient.ts +3 -3
- package/src/clients/base/auth.ts +1 -1
- package/src/clients/base/createFetchClient.ts +2 -2
- package/src/clients/base/types.ts +1 -1
- package/src/clients/base/urls.test.ts +43 -43
- package/src/clients/base/urls.ts +22 -14
- package/src/clients/base/utils.ts +1 -1
- package/src/clients/blockaid/createBlockaidApiClient.ts +3 -3
- package/src/clients/content/types.ts +1 -1
- package/src/clients/conversionTracking/api-ConversionProxyService_connectquery.ts +1 -1
- package/src/clients/conversionTracking/api_connect.ts +1 -1
- package/src/clients/conversionTracking/index.ts +3 -3
- package/src/clients/data/createDataServiceApiClient.ts +2 -2
- package/src/clients/dataApi/createDataApiServiceClient.ts +2 -2
- package/src/clients/dataApi/getGetPortfolioQueryOptions.test.ts +2 -2
- package/src/clients/dataApi/getGetPortfolioQueryOptions.ts +3 -3
- package/src/clients/embeddedWallet/createEmbeddedWalletApiClient.ts +5 -5
- package/src/clients/for/createForApiClient.ts +1 -1
- package/src/clients/for/types.ts +1 -1
- package/src/clients/for/utils.ts +1 -1
- package/src/clients/gasService/createGasServiceClient.ts +2 -2
- package/src/clients/graphql/codegen.config.ts +1 -1
- package/src/clients/graphql/fragments.ts +3 -3
- package/src/clients/graphql/generated.ts +3 -0
- package/src/clients/graphql/web/{LuxPrices.graphql → UniswapPrices.graphql} +1 -1
- package/src/clients/jupiter/createJupiterApiClient.ts +3 -3
- package/src/clients/jupiter/utils.ts +1 -1
- package/src/clients/liquidity/createAuctionMutationClient.ts +2 -2
- package/src/clients/liquidity/createLiquidityServiceClient.ts +2 -2
- package/src/clients/lux/createLuxApiClient.ts +3 -3
- package/src/clients/notifications/createNotificationsApiClient.ts +4 -4
- package/src/clients/notifications/types.ts +9 -9
- package/src/clients/trading/createTradingApiClient.ts +2 -2
- package/src/clients/trading/tradeTypes.ts +2 -2
- package/src/clients/trading/types.ts +2 -2
- package/src/clients/uniswap/createUniswapApiClient.ts +83 -0
- package/src/clients/unitags/createUnitagsApiClient.test.ts +7 -7
- package/src/clients/unitags/createUnitagsApiClient.ts +1 -1
- package/src/clients/x/createXVerificationServiceClient.ts +2 -2
- package/src/components/ApiInit.test.tsx +13 -13
- package/src/components/ApiInit.tsx +2 -2
- package/src/connectRpc/utils.ts +5 -5
- package/src/getEntryGatewayUrl.ts +3 -3
- package/src/getWebSocketUrl.ts +1 -1
- package/src/hooks/shared/useQueryWithImmediateGarbageCollection.ts +1 -1
- package/src/index.ts +14 -12
- package/src/provideDeviceIdService.ts +3 -3
- package/src/provideLuxIdentifierService.ts +2 -25
- package/src/provideSessionService.native.ts +9 -9
- package/src/provideSessionService.ts +5 -5
- package/src/provideSessionService.web.ts +11 -11
- package/src/provideSessionStorage.ts +3 -3
- package/src/provideUniswapIdentifierService.ts +25 -0
- package/src/session/createSessionTransport.test.ts +1 -1
- package/src/session/createSessionTransport.ts +6 -6
- package/src/storage/createExtensionStorageDriver.ts +2 -2
- package/src/storage/createNativeStorageDriver.ts +1 -1
- package/src/storage/createWebStorageDriver.ts +1 -1
- package/src/storage/getStorageDriver.native.ts +2 -2
- package/src/storage/getStorageDriver.ts +3 -3
- package/src/storage/getStorageDriver.web.ts +4 -4
- package/src/transport.ts +3 -3
- package/stubs/privy-service-connect.d.ts +1 -1
- package/stubs/privy-service-pb.d.ts +1 -1
- package/tsconfig.json +12 -4
- package/dist/client.d.ts +0 -22
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -56
- package/dist/hooks/index.d.ts +0 -6
- package/dist/hooks/index.d.ts.map +0 -1
- package/dist/hooks/index.js +0 -5
- package/dist/hooks/use-token-list.d.ts +0 -22
- package/dist/hooks/use-token-list.d.ts.map +0 -1
- package/dist/hooks/use-token-list.js +0 -27
- package/dist/hooks/use-token-price.d.ts +0 -15
- package/dist/hooks/use-token-price.d.ts.map +0 -1
- package/dist/hooks/use-token-price.js +0 -63
- package/dist/index.d.ts +0 -6
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -5
- package/src/client.ts +0 -66
- package/src/clients/graphql/__generated__/operations.ts +0 -605
- package/src/clients/graphql/__generated__/react-hooks.ts +0 -4245
- package/src/clients/graphql/__generated__/resolvers.ts +0 -1469
- package/src/clients/graphql/__generated__/schema-types.ts +0 -2099
- package/src/clients/trading/__generated__/core/ApiError.ts +0 -25
- package/src/clients/trading/__generated__/core/ApiRequestOptions.ts +0 -17
- package/src/clients/trading/__generated__/core/ApiResult.ts +0 -11
- package/src/clients/trading/__generated__/core/CancelablePromise.ts +0 -131
- package/src/clients/trading/__generated__/core/OpenAPI.ts +0 -32
- package/src/clients/trading/__generated__/core/request.ts +0 -322
- package/src/clients/trading/__generated__/index.ts +0 -221
- package/src/clients/trading/__generated__/models/Address.ts +0 -5
- package/src/clients/trading/__generated__/models/AggregatedOutput.ts +0 -20
- package/src/clients/trading/__generated__/models/ApprovalRequest.ts +0 -25
- package/src/clients/trading/__generated__/models/ApprovalResponse.ts +0 -18
- package/src/clients/trading/__generated__/models/AutoSlippage.ts +0 -14
- package/src/clients/trading/__generated__/models/BridgeQuote.ts +0 -55
- package/src/clients/trading/__generated__/models/ChainDelegationMap.ts +0 -9
- package/src/clients/trading/__generated__/models/ChainId.ts +0 -29
- package/src/clients/trading/__generated__/models/ChainedQuote.ts +0 -63
- package/src/clients/trading/__generated__/models/CheckApprovalLPRequest.ts +0 -35
- package/src/clients/trading/__generated__/models/CheckApprovalLPResponse.ts +0 -29
- package/src/clients/trading/__generated__/models/ClaimLPFeesRequest.ts +0 -20
- package/src/clients/trading/__generated__/models/ClaimLPFeesResponse.ts +0 -13
- package/src/clients/trading/__generated__/models/ClaimLPRewardsRequest.ts +0 -19
- package/src/clients/trading/__generated__/models/ClaimLPRewardsResponse.ts +0 -13
- package/src/clients/trading/__generated__/models/ClassicGasUseEstimateUSD.ts +0 -8
- package/src/clients/trading/__generated__/models/ClassicInput.ts +0 -11
- package/src/clients/trading/__generated__/models/ClassicOutput.ts +0 -13
- package/src/clients/trading/__generated__/models/ClassicQuote.ts +0 -69
- package/src/clients/trading/__generated__/models/ClientContext.ts +0 -18
- package/src/clients/trading/__generated__/models/CosignerData.ts +0 -21
- package/src/clients/trading/__generated__/models/CreateLPPositionRequest.ts +0 -40
- package/src/clients/trading/__generated__/models/CreateLPPositionResponse.ts +0 -21
- package/src/clients/trading/__generated__/models/CreatePlanRequest.ts +0 -23
- package/src/clients/trading/__generated__/models/CreateSendRequest.ts +0 -22
- package/src/clients/trading/__generated__/models/CreateSendResponse.ts +0 -18
- package/src/clients/trading/__generated__/models/CreateSwap5792Request.ts +0 -17
- package/src/clients/trading/__generated__/models/CreateSwap5792Response.ts +0 -17
- package/src/clients/trading/__generated__/models/CreateSwap7702Request.ts +0 -21
- package/src/clients/trading/__generated__/models/CreateSwap7702Response.ts +0 -13
- package/src/clients/trading/__generated__/models/CreateSwapRequest.ts +0 -42
- package/src/clients/trading/__generated__/models/CreateSwapResponse.ts +0 -16
- package/src/clients/trading/__generated__/models/Curve.ts +0 -9
- package/src/clients/trading/__generated__/models/DEXOrder.ts +0 -35
- package/src/clients/trading/__generated__/models/DecreaseLPPositionRequest.ts +0 -33
- package/src/clients/trading/__generated__/models/DecreaseLPPositionResponse.ts +0 -19
- package/src/clients/trading/__generated__/models/DelegationDetails.ts +0 -19
- package/src/clients/trading/__generated__/models/Distributor.ts +0 -10
- package/src/clients/trading/__generated__/models/DutchInput.ts +0 -13
- package/src/clients/trading/__generated__/models/DutchInputV3.ts +0 -15
- package/src/clients/trading/__generated__/models/DutchOrderInfo.ts +0 -41
- package/src/clients/trading/__generated__/models/DutchOrderInfoV2.ts +0 -27
- package/src/clients/trading/__generated__/models/DutchOrderInfoV3.ts +0 -28
- package/src/clients/trading/__generated__/models/DutchOutput.ts +0 -15
- package/src/clients/trading/__generated__/models/DutchOutputV3.ts +0 -18
- package/src/clients/trading/__generated__/models/DutchQuote.ts +0 -27
- package/src/clients/trading/__generated__/models/DutchQuoteV2.ts +0 -28
- package/src/clients/trading/__generated__/models/DutchQuoteV3.ts +0 -30
- package/src/clients/trading/__generated__/models/Encode7702ResponseBody.ts +0 -11
- package/src/clients/trading/__generated__/models/Err400.ts +0 -9
- package/src/clients/trading/__generated__/models/Err401.ts +0 -9
- package/src/clients/trading/__generated__/models/Err404.ts +0 -17
- package/src/clients/trading/__generated__/models/Err422.ts +0 -9
- package/src/clients/trading/__generated__/models/Err429.ts +0 -9
- package/src/clients/trading/__generated__/models/Err500.ts +0 -9
- package/src/clients/trading/__generated__/models/Err504.ts +0 -9
- package/src/clients/trading/__generated__/models/GasStrategy.ts +0 -46
- package/src/clients/trading/__generated__/models/GetOrdersResponse.ts +0 -12
- package/src/clients/trading/__generated__/models/GetSwappableTokensResponse.ts +0 -29
- package/src/clients/trading/__generated__/models/GetSwapsResponse.ts +0 -18
- package/src/clients/trading/__generated__/models/HooksOptions.ts +0 -12
- package/src/clients/trading/__generated__/models/IncreaseLPPositionRequest.ts +0 -39
- package/src/clients/trading/__generated__/models/IncreaseLPPositionResponse.ts +0 -21
- package/src/clients/trading/__generated__/models/IndependentToken.ts +0 -8
- package/src/clients/trading/__generated__/models/IndicativeQuoteRequest.ts +0 -18
- package/src/clients/trading/__generated__/models/IndicativeQuoteResponse.ts +0 -14
- package/src/clients/trading/__generated__/models/IndicativeQuoteToken.ts +0 -13
- package/src/clients/trading/__generated__/models/LimitOrderQuoteRequest.ts +0 -22
- package/src/clients/trading/__generated__/models/LimitOrderQuoteResponse.ts +0 -19
- package/src/clients/trading/__generated__/models/MigrateLPPositionRequest.ts +0 -41
- package/src/clients/trading/__generated__/models/MigrateLPPositionResponse.ts +0 -13
- package/src/clients/trading/__generated__/models/NullablePermit.ts +0 -13
- package/src/clients/trading/__generated__/models/OrderIds.ts +0 -5
- package/src/clients/trading/__generated__/models/OrderInput.ts +0 -13
- package/src/clients/trading/__generated__/models/OrderOutput.ts +0 -16
- package/src/clients/trading/__generated__/models/OrderRequest.ts +0 -17
- package/src/clients/trading/__generated__/models/OrderResponse.ts +0 -13
- package/src/clients/trading/__generated__/models/OrderStatus.ts +0 -23
- package/src/clients/trading/__generated__/models/OrderType.ts +0 -11
- package/src/clients/trading/__generated__/models/OrderTypeQuery.ts +0 -12
- package/src/clients/trading/__generated__/models/Permit.ts +0 -13
- package/src/clients/trading/__generated__/models/PermitAmount.ts +0 -11
- package/src/clients/trading/__generated__/models/PlanResponse.ts +0 -75
- package/src/clients/trading/__generated__/models/PlanStatus.ts +0 -14
- package/src/clients/trading/__generated__/models/PlanStep.ts +0 -59
- package/src/clients/trading/__generated__/models/PlanStepMethod.ts +0 -12
- package/src/clients/trading/__generated__/models/PlanStepPayloadType.ts +0 -12
- package/src/clients/trading/__generated__/models/PlanStepProof.ts +0 -20
- package/src/clients/trading/__generated__/models/PlanStepStatus.ts +0 -14
- package/src/clients/trading/__generated__/models/PlanStepType.ts +0 -23
- package/src/clients/trading/__generated__/models/Pool.ts +0 -15
- package/src/clients/trading/__generated__/models/PoolInfoRequest.ts +0 -20
- package/src/clients/trading/__generated__/models/PoolInfoResponse.ts +0 -16
- package/src/clients/trading/__generated__/models/PoolInformation.ts +0 -44
- package/src/clients/trading/__generated__/models/PoolParameters.ts +0 -19
- package/src/clients/trading/__generated__/models/PoolReferenceByProtocol.ts +0 -12
- package/src/clients/trading/__generated__/models/Position.ts +0 -11
- package/src/clients/trading/__generated__/models/PriorityInput.ts +0 -12
- package/src/clients/trading/__generated__/models/PriorityOrderInfo.ts +0 -29
- package/src/clients/trading/__generated__/models/PriorityOutput.ts +0 -17
- package/src/clients/trading/__generated__/models/PriorityQuote.ts +0 -31
- package/src/clients/trading/__generated__/models/ProtocolItems.ts +0 -15
- package/src/clients/trading/__generated__/models/Protocols.ts +0 -9
- package/src/clients/trading/__generated__/models/Quote.ts +0 -14
- package/src/clients/trading/__generated__/models/QuoteRequest.ts +0 -41
- package/src/clients/trading/__generated__/models/QuoteResponse.ts +0 -19
- package/src/clients/trading/__generated__/models/RequestId.ts +0 -8
- package/src/clients/trading/__generated__/models/Routing.ts +0 -20
- package/src/clients/trading/__generated__/models/RoutingPreference.ts +0 -16
- package/src/clients/trading/__generated__/models/SafetyLevel.ts +0 -10
- package/src/clients/trading/__generated__/models/ScopeData.ts +0 -28
- package/src/clients/trading/__generated__/models/SettledAmount.ts +0 -14
- package/src/clients/trading/__generated__/models/SortKey.ts +0 -7
- package/src/clients/trading/__generated__/models/SpreadOptimization.ts +0 -11
- package/src/clients/trading/__generated__/models/StepUpdate.ts +0 -25
- package/src/clients/trading/__generated__/models/SwapSafetyMode.ts +0 -10
- package/src/clients/trading/__generated__/models/SwapStatus.ts +0 -11
- package/src/clients/trading/__generated__/models/TokenInRoute.ts +0 -20
- package/src/clients/trading/__generated__/models/TokenProject.ts +0 -13
- package/src/clients/trading/__generated__/models/TokenProjectLogo.ts +0 -8
- package/src/clients/trading/__generated__/models/TradeType.ts +0 -11
- package/src/clients/trading/__generated__/models/TransactionFailureReason.ts +0 -11
- package/src/clients/trading/__generated__/models/TransactionHash.ts +0 -8
- package/src/clients/trading/__generated__/models/TransactionRequest.ts +0 -29
- package/src/clients/trading/__generated__/models/TransactionRequest5792.ts +0 -25
- package/src/clients/trading/__generated__/models/TruncatedPlanStep.ts +0 -21
- package/src/clients/trading/__generated__/models/UniversalRouterVersion.ts +0 -8
- package/src/clients/trading/__generated__/models/UpdatePlanRequest.ts +0 -12
- package/src/clients/trading/__generated__/models/Urgency.ts +0 -12
- package/src/clients/trading/__generated__/models/V2PoolInRoute.ts +0 -19
- package/src/clients/trading/__generated__/models/V2Reserve.ts +0 -16
- package/src/clients/trading/__generated__/models/V3PoolInRoute.ts +0 -24
- package/src/clients/trading/__generated__/models/V4PoolInRoute.ts +0 -30
- package/src/clients/trading/__generated__/models/WalletCheckDelegationRequestBody.ts +0 -17
- package/src/clients/trading/__generated__/models/WalletCheckDelegationResponseBody.ts +0 -14
- package/src/clients/trading/__generated__/models/WalletEncode7702RequestBody.ts +0 -21
- package/src/clients/trading/__generated__/models/WalletExecutionContext.ts +0 -17
- package/src/clients/trading/__generated__/models/WalletInfo.ts +0 -22
- package/src/clients/trading/__generated__/models/WalletProperties.ts +0 -12
- package/src/clients/trading/__generated__/models/WrapUnwrapQuote.ts +0 -31
- package/src/clients/trading/__generated__/models/additionalValidationContract.ts +0 -9
- package/src/clients/trading/__generated__/models/additionalValidationData.ts +0 -9
- package/src/clients/trading/__generated__/models/bps.ts +0 -8
- package/src/clients/trading/__generated__/models/bpsFee.ts +0 -8
- package/src/clients/trading/__generated__/models/bridgeTokenInChainIdParam.ts +0 -6
- package/src/clients/trading/__generated__/models/chainIdParam.ts +0 -6
- package/src/clients/trading/__generated__/models/claimerWalletAddress.ts +0 -8
- package/src/clients/trading/__generated__/models/contractAddress.ts +0 -8
- package/src/clients/trading/__generated__/models/cosignerAddress.ts +0 -8
- package/src/clients/trading/__generated__/models/cursorParam.ts +0 -5
- package/src/clients/trading/__generated__/models/deadline.ts +0 -8
- package/src/clients/trading/__generated__/models/encodedOrder.ts +0 -8
- package/src/clients/trading/__generated__/models/endAmount.ts +0 -8
- package/src/clients/trading/__generated__/models/erc20EthEnabledHeader.ts +0 -8
- package/src/clients/trading/__generated__/models/fillerParam.ts +0 -9
- package/src/clients/trading/__generated__/models/gasFee.ts +0 -8
- package/src/clients/trading/__generated__/models/gasFeeInCurrency.ts +0 -8
- package/src/clients/trading/__generated__/models/gasFeeUSD.ts +0 -8
- package/src/clients/trading/__generated__/models/gasLimit.ts +0 -8
- package/src/clients/trading/__generated__/models/gasPrice.ts +0 -8
- package/src/clients/trading/__generated__/models/generatePermitAsTransaction.ts +0 -8
- package/src/clients/trading/__generated__/models/includeGasInfo.ts +0 -8
- package/src/clients/trading/__generated__/models/inputToken.ts +0 -8
- package/src/clients/trading/__generated__/models/isSpam.ts +0 -8
- package/src/clients/trading/__generated__/models/limitParam.ts +0 -5
- package/src/clients/trading/__generated__/models/liquidity.ts +0 -8
- package/src/clients/trading/__generated__/models/lpPoolFee.ts +0 -8
- package/src/clients/trading/__generated__/models/lpTickCurrent.ts +0 -8
- package/src/clients/trading/__generated__/models/maxFeePerGas.ts +0 -8
- package/src/clients/trading/__generated__/models/maxPriorityFeePerGas.ts +0 -8
- package/src/clients/trading/__generated__/models/minAmount.ts +0 -8
- package/src/clients/trading/__generated__/models/nonce.ts +0 -8
- package/src/clients/trading/__generated__/models/orderId.ts +0 -8
- package/src/clients/trading/__generated__/models/orderIdParam.ts +0 -6
- package/src/clients/trading/__generated__/models/orderIdsParam.ts +0 -9
- package/src/clients/trading/__generated__/models/orderStatusParam.ts +0 -9
- package/src/clients/trading/__generated__/models/orderTypeParam.ts +0 -9
- package/src/clients/trading/__generated__/models/outputToken.ts +0 -8
- package/src/clients/trading/__generated__/models/poolFee.ts +0 -8
- package/src/clients/trading/__generated__/models/portionAmount.ts +0 -8
- package/src/clients/trading/__generated__/models/portionAmountReceiverAddress.ts +0 -8
- package/src/clients/trading/__generated__/models/portionBips.ts +0 -8
- package/src/clients/trading/__generated__/models/quoteId.ts +0 -8
- package/src/clients/trading/__generated__/models/receiverWalletAddress.ts +0 -8
- package/src/clients/trading/__generated__/models/senderWalletAddress.ts +0 -8
- package/src/clients/trading/__generated__/models/slippageTolerance.ts +0 -14
- package/src/clients/trading/__generated__/models/sortKeyParam.ts +0 -9
- package/src/clients/trading/__generated__/models/sortParam.ts +0 -8
- package/src/clients/trading/__generated__/models/sqrtRatioX96.ts +0 -8
- package/src/clients/trading/__generated__/models/startAmount.ts +0 -8
- package/src/clients/trading/__generated__/models/swapperParam.ts +0 -9
- package/src/clients/trading/__generated__/models/tickCurrent.ts +0 -8
- package/src/clients/trading/__generated__/models/tickSpacing.ts +0 -8
- package/src/clients/trading/__generated__/models/tokenAmount.ts +0 -8
- package/src/clients/trading/__generated__/models/tokenInParam.ts +0 -6
- package/src/clients/trading/__generated__/models/tokenSymbol.ts +0 -8
- package/src/clients/trading/__generated__/models/transactionHashesParam.ts +0 -9
- package/src/clients/trading/__generated__/models/universalRouterVersionHeader.ts +0 -9
- package/src/clients/trading/__generated__/services/ApprovalService.ts +0 -39
- package/src/clients/trading/__generated__/services/DefaultService.ts +0 -46
- package/src/clients/trading/__generated__/services/IndicativeQuoteService.ts +0 -39
- package/src/clients/trading/__generated__/services/LimitOrderQuoteService.ts +0 -37
- package/src/clients/trading/__generated__/services/LiquidityService.ts +0 -239
- package/src/clients/trading/__generated__/services/OrderService.ts +0 -131
- package/src/clients/trading/__generated__/services/PlanService.ts +0 -76
- package/src/clients/trading/__generated__/services/QuoteService.ts +0 -58
- package/src/clients/trading/__generated__/services/SendService.ts +0 -37
- package/src/clients/trading/__generated__/services/SwapService.ts +0 -161
- package/src/clients/trading/__generated__/services/SwappableTokensService.ts +0 -42
- package/src/clients/trading/__generated__/services/WalletCheckDelegationService.ts +0 -37
- package/src/clients/trading/__generated__/services/WalletEncode7702Service.ts +0 -37
- package/src/hooks/index.ts +0 -6
- package/src/hooks/use-token-list.ts +0 -52
- package/src/hooks/use-token-price.ts +0 -82
|
@@ -13,7 +13,7 @@ const config: CodegenConfig = {
|
|
|
13
13
|
overwrite: true,
|
|
14
14
|
schema: 'src/clients/graphql/schema.graphql',
|
|
15
15
|
// pulls every graphql files into a single config
|
|
16
|
-
documents: ['../../apps/{mobile,extension}/src/**/*.graphql', '
|
|
16
|
+
documents: ['../../apps/{mobile,extension}/src/**/*.graphql', 'src/**/*.graphql'],
|
|
17
17
|
generates: {
|
|
18
18
|
// generates base schema types (standalone)
|
|
19
19
|
'src/clients/graphql/__generated__/schema-types.ts': {
|
|
@@ -5,15 +5,15 @@ import type {
|
|
|
5
5
|
TokenMarketPartsFragment,
|
|
6
6
|
TokenProjectMarketsPartsFragment,
|
|
7
7
|
TokenProjectUrlsPartsFragment,
|
|
8
|
-
} from '@
|
|
8
|
+
} from '@luxexchange/api/src/clients/graphql/__generated__/operations'
|
|
9
9
|
import {
|
|
10
10
|
TokenBasicInfoPartsFragmentDoc,
|
|
11
11
|
TokenBasicProjectPartsFragmentDoc,
|
|
12
12
|
TokenMarketPartsFragmentDoc,
|
|
13
13
|
TokenProjectMarketsPartsFragmentDoc,
|
|
14
14
|
TokenProjectUrlsPartsFragmentDoc,
|
|
15
|
-
} from '@
|
|
16
|
-
import type { Token } from '@
|
|
15
|
+
} from '@luxexchange/api/src/clients/graphql/__generated__/react-hooks'
|
|
16
|
+
import type { Token } from '@luxexchange/api/src/clients/graphql/__generated__/schema-types'
|
|
17
17
|
|
|
18
18
|
export interface UseTokenFragmentParams {
|
|
19
19
|
address: string | null
|
|
@@ -3,3 +3,6 @@ export * from './__generated__/schema-types'
|
|
|
3
3
|
export * from './__generated__/resolvers'
|
|
4
4
|
export * from './__generated__/operations'
|
|
5
5
|
export * from './__generated__/react-hooks'
|
|
6
|
+
|
|
7
|
+
// Aliases for Lux branding
|
|
8
|
+
export { useLxPricesQuery as useLuxPricesQuery } from './__generated__/react-hooks'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FetchClient } from '@
|
|
1
|
+
import type { FetchClient } from '@luxexchange/api/src/clients/base/types'
|
|
2
2
|
import {
|
|
3
3
|
type JupiterExecuteResponse,
|
|
4
4
|
type JupiterExecuteUrlParams,
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
type JupiterOrderUrlParams,
|
|
7
7
|
jupiterExecuteResponseSchema,
|
|
8
8
|
jupiterOrderResponseSchema,
|
|
9
|
-
} from '@
|
|
10
|
-
import { buildQuery } from '@
|
|
9
|
+
} from '@luxexchange/api/src/clients/jupiter/types'
|
|
10
|
+
import { buildQuery } from '@luxexchange/api/src/clients/jupiter/utils'
|
|
11
11
|
|
|
12
12
|
export interface JupiterApiClient {
|
|
13
13
|
fetchOrder: (params: JupiterOrderUrlParams) => Promise<JupiterOrderResponse>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { JupiterOrderUrlParams } from '@
|
|
1
|
+
import type { JupiterOrderUrlParams } from '@luxexchange/api/src/clients/jupiter/types'
|
|
2
2
|
|
|
3
3
|
export function buildQuery(params: JupiterOrderUrlParams): URLSearchParams {
|
|
4
4
|
const query = new URLSearchParams()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type PartialMessage } from '@bufbuild/protobuf'
|
|
2
2
|
import { type PromiseClient } from '@connectrpc/connect'
|
|
3
|
-
import { type AuctionService } from '@
|
|
3
|
+
import { type AuctionService } from '@luxamm/client-liquidity/dist/uniswap/liquidity/v1/auction_connect'
|
|
4
4
|
import type {
|
|
5
5
|
ExitBidAndClaimTokensRequest,
|
|
6
6
|
ExitBidAndClaimTokensResponse,
|
|
@@ -12,7 +12,7 @@ import type {
|
|
|
12
12
|
TokenCountAllocatedToLpForAuctionResponse,
|
|
13
13
|
VerifyWalletRequest,
|
|
14
14
|
VerifyWalletResponse,
|
|
15
|
-
} from '@
|
|
15
|
+
} from '@luxamm/client-liquidity/dist/uniswap/liquidity/v1/auction_pb'
|
|
16
16
|
|
|
17
17
|
interface AuctionMutationClientContext {
|
|
18
18
|
rpcClient: PromiseClient<typeof AuctionService>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type PromiseClient } from '@connectrpc/connect'
|
|
2
|
-
import { type LiquidityService } from '@
|
|
2
|
+
import { type LiquidityService } from '@luxamm/client-liquidity/dist/uniswap/liquidity/v1/api_connect'
|
|
3
3
|
import type {
|
|
4
4
|
CheckApprovalLPRequest,
|
|
5
5
|
CheckApprovalLPResponse,
|
|
@@ -21,7 +21,7 @@ import type {
|
|
|
21
21
|
MigrateV3ToV4LPPositionResponse,
|
|
22
22
|
PoolInfoRequest,
|
|
23
23
|
PoolInfoResponse,
|
|
24
|
-
} from '@
|
|
24
|
+
} from '@luxamm/client-liquidity/dist/uniswap/liquidity/v1/api_pb'
|
|
25
25
|
|
|
26
26
|
interface LiquidityServiceClientContext {
|
|
27
27
|
rpcClient: PromiseClient<typeof LiquidityService>
|
|
@@ -5,9 +5,9 @@ import {
|
|
|
5
5
|
type GasFeeResultWithoutState,
|
|
6
6
|
type GasStrategy,
|
|
7
7
|
} from '@luxexchange/api/src/clients/trading/types'
|
|
8
|
-
import { isWebApp } from '
|
|
8
|
+
import { isWebApp } from 'utilities/src/platform'
|
|
9
9
|
|
|
10
|
-
// TODO(app-infra), de-duplicate with
|
|
10
|
+
// TODO(app-infra), de-duplicate with lxUrls when other consumers are migrated to use this client
|
|
11
11
|
const LUX_API_PATHS = {
|
|
12
12
|
gasFee: '/v1/gas-fee',
|
|
13
13
|
}
|
|
@@ -22,7 +22,7 @@ type FetchGasFn = ({
|
|
|
22
22
|
smartContractDelegationAddress?: Address
|
|
23
23
|
}) => Promise<GasFeeResultWithoutState>
|
|
24
24
|
|
|
25
|
-
export interface
|
|
25
|
+
export interface LxApiClientContext {
|
|
26
26
|
fetchClient: FetchClient
|
|
27
27
|
processGasFeeResponse: (gasFeeResponse: GasFeeResponse, gasStrategy: GasStrategy) => GasFeeResultWithoutState
|
|
28
28
|
estimateGasWithClientSideProvider: (params: {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JsonValue } from '@bufbuild/protobuf'
|
|
2
|
-
import { GetNotificationsResponse as GetNotificationsResponseMessage } from '@
|
|
2
|
+
import { GetNotificationsResponse as GetNotificationsResponseMessage } from '@luxamm/client-notification-service/dist/uniswap/notificationservice/v1/api_pb'
|
|
3
3
|
import type {
|
|
4
4
|
AckNotificationRequest,
|
|
5
5
|
AckNotificationResponse,
|
|
@@ -7,7 +7,7 @@ import type {
|
|
|
7
7
|
GetNotificationsResponse,
|
|
8
8
|
NotificationsApiClient,
|
|
9
9
|
NotificationsClientContext,
|
|
10
|
-
} from '@
|
|
10
|
+
} from '@luxexchange/api/src/clients/notifications/types'
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Factory function to create a NotificationsApiClient
|
|
@@ -30,7 +30,7 @@ export function createNotificationsApiClient(ctx: NotificationsClientContext): N
|
|
|
30
30
|
|
|
31
31
|
const getNotifications = async (params?: GetNotificationsRequest): Promise<GetNotificationsResponse> => {
|
|
32
32
|
const pathPrefix = getApiPathPrefix()
|
|
33
|
-
const path = `${pathPrefix}/
|
|
33
|
+
const path = `${pathPrefix}/uniswap.notificationservice.v1.NotificationService/GetNotifications`
|
|
34
34
|
|
|
35
35
|
try {
|
|
36
36
|
const response = await fetchClient.post<JsonValue>(path, {
|
|
@@ -47,7 +47,7 @@ export function createNotificationsApiClient(ctx: NotificationsClientContext): N
|
|
|
47
47
|
|
|
48
48
|
const ackNotification = async (request: AckNotificationRequest): Promise<AckNotificationResponse> => {
|
|
49
49
|
const pathPrefix = getApiPathPrefix()
|
|
50
|
-
const path = `${pathPrefix}/
|
|
50
|
+
const path = `${pathPrefix}/uniswap.notificationservice.v1.NotificationService/AckNotifications`
|
|
51
51
|
|
|
52
52
|
try {
|
|
53
53
|
const response = await fetchClient.post<AckNotificationResponse>(path, {
|
|
@@ -10,8 +10,8 @@ import {
|
|
|
10
10
|
AckNotificationResponse as ProtoAckNotificationResponse,
|
|
11
11
|
GetNotificationsRequest as ProtoGetNotificationsRequest,
|
|
12
12
|
GetNotificationsResponse as ProtoGetNotificationsResponse,
|
|
13
|
-
} from '@
|
|
14
|
-
import { FetchClient } from '@
|
|
13
|
+
} from '@luxamm/client-notification-service/dist/uniswap/notificationservice/v1/api_pb'
|
|
14
|
+
import { FetchClient } from '@luxexchange/api/src/clients/base/types'
|
|
15
15
|
|
|
16
16
|
export interface NotificationsClientContext {
|
|
17
17
|
fetchClient: FetchClient
|
|
@@ -30,7 +30,7 @@ export type NotificationContentStyle = ContentStyle
|
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* Button configuration for notification content
|
|
33
|
-
* Re-exported from @
|
|
33
|
+
* Re-exported from @luxamm/client-notification-service
|
|
34
34
|
* Note: This is the Message class instance, not a plain object.
|
|
35
35
|
* Used within Content which comes from deserialized notifications.
|
|
36
36
|
*/
|
|
@@ -38,7 +38,7 @@ export type NotificationButton = Button
|
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
40
|
* Notification content
|
|
41
|
-
* Re-exported from @
|
|
41
|
+
* Re-exported from @luxamm/client-notification-service
|
|
42
42
|
*
|
|
43
43
|
* Notification API Type Mapping:
|
|
44
44
|
* - content.title → Modal title
|
|
@@ -54,7 +54,7 @@ export type NotificationContent = Content
|
|
|
54
54
|
|
|
55
55
|
/**
|
|
56
56
|
* In-app notification returned by the notifications API
|
|
57
|
-
* Re-exported from @
|
|
57
|
+
* Re-exported from @luxamm/client-notification-service
|
|
58
58
|
* Note: This is a plain object (not a Message class instance) to prevent
|
|
59
59
|
* React Query's structural cloning from triggering toJSON() which would
|
|
60
60
|
* convert numeric enum values to strings.
|
|
@@ -63,26 +63,26 @@ export type InAppNotification = PlainMessage<Notification>
|
|
|
63
63
|
|
|
64
64
|
/**
|
|
65
65
|
* Request parameters for fetching notifications
|
|
66
|
-
* Re-exported from @
|
|
66
|
+
* Re-exported from @luxamm/client-notification-service
|
|
67
67
|
*/
|
|
68
68
|
export type GetNotificationsRequest = PlainMessage<ProtoGetNotificationsRequest>
|
|
69
69
|
|
|
70
70
|
/**
|
|
71
71
|
* Response from the GetNotifications API endpoint
|
|
72
|
-
* Re-exported from @
|
|
72
|
+
* Re-exported from @luxamm/client-notification-service
|
|
73
73
|
* Note: This is the Message class instance from protobuf deserialization.
|
|
74
74
|
*/
|
|
75
75
|
export type GetNotificationsResponse = ProtoGetNotificationsResponse
|
|
76
76
|
|
|
77
77
|
/**
|
|
78
78
|
* Request parameters for acknowledging notifications
|
|
79
|
-
* Re-exported from @
|
|
79
|
+
* Re-exported from @luxamm/client-notification-service
|
|
80
80
|
*/
|
|
81
81
|
export type AckNotificationRequest = PlainMessage<ProtoAckNotificationRequest>
|
|
82
82
|
|
|
83
83
|
/**
|
|
84
84
|
* Response from the AckNotifications API endpoint
|
|
85
|
-
* Re-exported from @
|
|
85
|
+
* Re-exported from @luxamm/client-notification-service
|
|
86
86
|
*/
|
|
87
87
|
export type AckNotificationResponse = PlainMessage<ProtoAckNotificationResponse>
|
|
88
88
|
|
|
@@ -30,9 +30,9 @@ import type {
|
|
|
30
30
|
SwappableTokensParams,
|
|
31
31
|
UpdatePlanRequestWithPlanId,
|
|
32
32
|
} from '@luxexchange/api/src/clients/trading/tradeTypes'
|
|
33
|
-
import { logger } from '
|
|
33
|
+
import { logger } from 'utilities/src/logger/logger'
|
|
34
34
|
|
|
35
|
-
// TODO(app-infra), de-duplicate with
|
|
35
|
+
// TODO(app-infra), de-duplicate with lxUrls.tradingApiPaths when other consumers are migrated to use TradingApiClient
|
|
36
36
|
export const TRADING_API_PATHS = {
|
|
37
37
|
approval: 'check_approval',
|
|
38
38
|
order: 'order',
|
|
@@ -10,7 +10,7 @@ import type {
|
|
|
10
10
|
Routing,
|
|
11
11
|
UpdatePlanRequest,
|
|
12
12
|
WrapUnwrapQuote,
|
|
13
|
-
} from '@
|
|
13
|
+
} from '@luxexchange/api/src/clients/trading/__generated__'
|
|
14
14
|
|
|
15
15
|
export interface ExistingPlanRequest {
|
|
16
16
|
planId: string
|
|
@@ -19,7 +19,7 @@ export interface ExistingPlanRequest {
|
|
|
19
19
|
export interface UpdatePlanRequestWithPlanId extends UpdatePlanRequest, ExistingPlanRequest {}
|
|
20
20
|
|
|
21
21
|
// TradingAPI team is looking into updating type generation to produce the following types for it's current QuoteResponse type:
|
|
22
|
-
// See: https://linear.app/
|
|
22
|
+
// See: https://linear.app/uniswap/issue/API-236/explore-changing-the-quote-schema-to-pull-out-a-basequoteresponse
|
|
23
23
|
export type DiscriminatedQuoteResponse =
|
|
24
24
|
| ClassicQuoteResponse
|
|
25
25
|
| DutchQuoteResponse
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// These types are used in the gas estimation improvement experiment.
|
|
2
|
-
// They are internal to
|
|
2
|
+
// They are internal to uniswap, 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
5
|
import type { FetchError } from '@luxexchange/api/src/clients/base/errors'
|
|
@@ -52,7 +52,7 @@ export type GasFeeResponse = {
|
|
|
52
52
|
gasEstimates: GasEstimate[]
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
export type
|
|
55
|
+
export type FormattedLxSwapGasFeeInfo = {
|
|
56
56
|
approvalFeeFormatted?: string
|
|
57
57
|
swapFeeFormatted: string
|
|
58
58
|
preSavingsGasFeeFormatted: string
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { TransactionRequest } from '@ethersproject/providers'
|
|
2
|
+
import type { FetchClient } from '@luxexchange/api/src/clients/base/types'
|
|
3
|
+
import {
|
|
4
|
+
type GasFeeResponse,
|
|
5
|
+
type GasFeeResultWithoutState,
|
|
6
|
+
type GasStrategy,
|
|
7
|
+
} from '@luxexchange/api/src/clients/trading/types'
|
|
8
|
+
import { isWebApp } from 'utilities/src/platform'
|
|
9
|
+
|
|
10
|
+
// TODO(app-infra), de-duplicate with lxUrls when other consumers are migrated to use this client
|
|
11
|
+
const LX_API_PATHS = {
|
|
12
|
+
gasFee: '/v1/gas-fee',
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
type FetchGasFn = ({
|
|
16
|
+
tx,
|
|
17
|
+
fallbackGasLimit,
|
|
18
|
+
}: {
|
|
19
|
+
tx: TransactionRequest
|
|
20
|
+
gasStrategy: GasStrategy
|
|
21
|
+
fallbackGasLimit?: number
|
|
22
|
+
smartContractDelegationAddress?: Address
|
|
23
|
+
}) => Promise<GasFeeResultWithoutState>
|
|
24
|
+
|
|
25
|
+
export interface LxApiClientContext {
|
|
26
|
+
fetchClient: FetchClient
|
|
27
|
+
processGasFeeResponse: (gasFeeResponse: GasFeeResponse, gasStrategy: GasStrategy) => GasFeeResultWithoutState
|
|
28
|
+
estimateGasWithClientSideProvider: (params: {
|
|
29
|
+
tx: TransactionRequest
|
|
30
|
+
fallbackGasLimit?: number
|
|
31
|
+
}) => Promise<GasFeeResultWithoutState>
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export interface LxApiClient {
|
|
35
|
+
fetchGasFee: FetchGasFn
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function createLxApiClient(ctx: LxApiClientContext): LxApiClient {
|
|
39
|
+
const { fetchClient: client, processGasFeeResponse, estimateGasWithClientSideProvider } = ctx
|
|
40
|
+
|
|
41
|
+
const injectGasStrategies = (
|
|
42
|
+
tx: TransactionRequest,
|
|
43
|
+
gasStrategy: GasStrategy,
|
|
44
|
+
): TransactionRequest & { gasStrategies: GasStrategy[] } => {
|
|
45
|
+
return { ...tx, gasStrategies: [gasStrategy] }
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const injectSmartContractDelegationAddress = (
|
|
49
|
+
tx: TransactionRequest,
|
|
50
|
+
smartContractDelegationAddress?: Address,
|
|
51
|
+
): TransactionRequest => ({
|
|
52
|
+
...tx,
|
|
53
|
+
...(smartContractDelegationAddress ? { smartContractDelegationAddress } : {}),
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
const fetchGasFee: FetchGasFn = async ({ tx, fallbackGasLimit, smartContractDelegationAddress, gasStrategy }) => {
|
|
57
|
+
const txWithScDelegationAddress = injectSmartContractDelegationAddress(tx, smartContractDelegationAddress)
|
|
58
|
+
const body = JSON.stringify(injectGasStrategies(txWithScDelegationAddress, gasStrategy))
|
|
59
|
+
|
|
60
|
+
try {
|
|
61
|
+
const gasFeeResponse = await client.post<GasFeeResponse>(LX_API_PATHS.gasFee, {
|
|
62
|
+
body,
|
|
63
|
+
headers: smartContractDelegationAddress
|
|
64
|
+
? {
|
|
65
|
+
'x-viem-provider-enabled': 'true',
|
|
66
|
+
}
|
|
67
|
+
: {},
|
|
68
|
+
})
|
|
69
|
+
return processGasFeeResponse(gasFeeResponse, gasStrategy)
|
|
70
|
+
} catch (error) {
|
|
71
|
+
if (isWebApp) {
|
|
72
|
+
// Gas Fee API currently errors on gas estimations on disconnected state & insufficient funds
|
|
73
|
+
// Fallback to clientside estimate using provider.estimateGas
|
|
74
|
+
return estimateGasWithClientSideProvider({ tx, fallbackGasLimit })
|
|
75
|
+
}
|
|
76
|
+
throw error
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return {
|
|
81
|
+
fetchGasFee,
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import { beforeEach, describe, expect, it, type Mock, vi } from 'vitest'
|
|
2
2
|
import 'utilities/src/logger/mocks'
|
|
3
3
|
|
|
4
|
-
vi.mock('@
|
|
4
|
+
vi.mock('@luxexchange/config', () => ({
|
|
5
5
|
getConfig: vi.fn(() => ({
|
|
6
6
|
unitagsApiUrlOverride: undefined,
|
|
7
7
|
})),
|
|
8
8
|
}))
|
|
9
9
|
|
|
10
|
-
vi.mock('@
|
|
10
|
+
vi.mock('@luxexchange/api/src/clients/base/urls', () => ({
|
|
11
11
|
getCloudflareApiBaseUrl: vi.fn(() => 'https://api.test.com'),
|
|
12
12
|
TrafficFlows: {
|
|
13
13
|
Unitags: 'unitags',
|
|
14
14
|
},
|
|
15
15
|
}))
|
|
16
16
|
|
|
17
|
-
vi.mock('@
|
|
17
|
+
vi.mock('@luxexchange/api/src/clients/base/createFetchClient', () => ({
|
|
18
18
|
createFetchClient: vi.fn(() => ({
|
|
19
19
|
get: vi.fn(),
|
|
20
20
|
post: vi.fn(),
|
|
@@ -23,12 +23,12 @@ vi.mock('@luxfi/api/src/clients/base/createFetchClient', () => ({
|
|
|
23
23
|
})),
|
|
24
24
|
}))
|
|
25
25
|
|
|
26
|
-
vi.mock('@
|
|
26
|
+
vi.mock('@luxexchange/api/src/clients/base/auth', () => ({
|
|
27
27
|
createSignedRequestBody: vi.fn(),
|
|
28
28
|
createSignedRequestParams: vi.fn(),
|
|
29
29
|
}))
|
|
30
30
|
|
|
31
|
-
vi.mock('@
|
|
31
|
+
vi.mock('@luxexchange/api/src/clients/base/utils', () => ({
|
|
32
32
|
createFetcher: vi.fn(),
|
|
33
33
|
}))
|
|
34
34
|
|
|
@@ -55,8 +55,8 @@ const mockFetchClient = {
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
// Import after mocks are set up
|
|
58
|
-
import { createSignedRequestBody, createSignedRequestParams } from '@
|
|
59
|
-
import { createFetcher } from '@
|
|
58
|
+
import { createSignedRequestBody, createSignedRequestParams } from '@luxexchange/api/src/clients/base/auth'
|
|
59
|
+
import { createFetcher } from '@luxexchange/api/src/clients/base/utils'
|
|
60
60
|
|
|
61
61
|
describe('UnitagsApiClient', () => {
|
|
62
62
|
const mockCreateFetcher = createFetcher as unknown as Mock
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
type UnitagUsernameRequest,
|
|
24
24
|
type UnitagUsernameResponse,
|
|
25
25
|
} from '@luxexchange/api/src/clients/unitags/types'
|
|
26
|
-
import { sanitizeAvatarUrl } from '
|
|
26
|
+
import { sanitizeAvatarUrl } from 'utilities/src/format/urls'
|
|
27
27
|
|
|
28
28
|
const UNI_SIG_HEADER_KEY = 'x-uni-sig'
|
|
29
29
|
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type PromiseClient } from '@connectrpc/connect'
|
|
2
|
-
import { type XVerificationService } from '@
|
|
2
|
+
import { type XVerificationService } from '@luxamm/client-liquidity/dist/uniswap/liquidity/v1/x_verification_connect'
|
|
3
3
|
import type {
|
|
4
4
|
GetXAuthUrlRequest,
|
|
5
5
|
GetXAuthUrlResponse,
|
|
6
6
|
VerifyXCallbackRequest,
|
|
7
7
|
VerifyXCallbackResponse,
|
|
8
|
-
} from '@
|
|
8
|
+
} from '@luxamm/client-liquidity/dist/uniswap/liquidity/v1/x_verification_pb'
|
|
9
9
|
|
|
10
10
|
interface XVerificationServiceClientContext {
|
|
11
11
|
rpcClient: PromiseClient<typeof XVerificationService>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
|
2
2
|
import { render, waitFor } from '@testing-library/react'
|
|
3
|
-
import { ApiInit } from '@
|
|
3
|
+
import { ApiInit } from '@luxexchange/api/src/components/ApiInit'
|
|
4
4
|
import {
|
|
5
5
|
ChallengeType,
|
|
6
6
|
createChallengeSolverService,
|
|
@@ -10,15 +10,15 @@ import {
|
|
|
10
10
|
createSessionRepository,
|
|
11
11
|
createSessionService,
|
|
12
12
|
createSessionStorage,
|
|
13
|
-
|
|
13
|
+
createLxIdentifierService,
|
|
14
14
|
type DeviceIdService,
|
|
15
15
|
type SessionInitializationService,
|
|
16
16
|
type SessionService,
|
|
17
17
|
type SessionStorage,
|
|
18
|
-
type
|
|
19
|
-
} from '@
|
|
18
|
+
type LxIdentifierService,
|
|
19
|
+
} from '@luxexchange/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
|
|
@@ -39,7 +39,7 @@ describe('ApiInit Integration', () => {
|
|
|
39
39
|
}
|
|
40
40
|
let sessionStorage: SessionStorage
|
|
41
41
|
let deviceIdService: DeviceIdService
|
|
42
|
-
let
|
|
42
|
+
let lxIdentifierService: LxIdentifierService
|
|
43
43
|
let sessionService: SessionService
|
|
44
44
|
let initService: SessionInitializationService
|
|
45
45
|
let isSessionServiceEnabled: boolean
|
|
@@ -89,13 +89,13 @@ describe('ApiInit Integration', () => {
|
|
|
89
89
|
},
|
|
90
90
|
})
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
mockStorage.set('
|
|
92
|
+
lxIdentifierService = createLxIdentifierService({
|
|
93
|
+
getLxIdentifier: async () => mockStorage.get('lxIdentifier') || null,
|
|
94
|
+
setLxIdentifier: async (identifier) => {
|
|
95
|
+
mockStorage.set('lxIdentifier', identifier)
|
|
96
96
|
},
|
|
97
|
-
|
|
98
|
-
mockStorage.delete('
|
|
97
|
+
removeLxIdentifier: async () => {
|
|
98
|
+
mockStorage.delete('lxIdentifier')
|
|
99
99
|
},
|
|
100
100
|
})
|
|
101
101
|
|
|
@@ -106,7 +106,7 @@ describe('ApiInit Integration', () => {
|
|
|
106
106
|
sessionService = createSessionService({
|
|
107
107
|
sessionStorage,
|
|
108
108
|
deviceIdService,
|
|
109
|
-
|
|
109
|
+
lxIdentifierService,
|
|
110
110
|
sessionRepository,
|
|
111
111
|
})
|
|
112
112
|
|
|
@@ -3,8 +3,8 @@ import { SharedQueryClient } from '@luxexchange/api/src/clients/base/SharedQuery
|
|
|
3
3
|
import type { SessionInitializationService, SessionInitResult } from '@luxexchange/sessions'
|
|
4
4
|
import { SessionError } from '@luxexchange/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
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { type PlainMessage } from '@bufbuild/protobuf'
|
|
2
|
-
import { Platform, type PlatformAddress, type WalletAccount } from '@
|
|
3
|
-
import { ProtocolVersion } from '@
|
|
4
|
-
import { type ProtectionInfo as ProtectionInfoProtobuf } from '@
|
|
2
|
+
import { Platform, type PlatformAddress, type WalletAccount } from '@luxamm/client-data-api/dist/data/v1/api_pb'
|
|
3
|
+
import { ProtocolVersion } from '@luxamm/client-data-api/dist/data/v1/poolTypes_pb'
|
|
4
|
+
import { type ProtectionInfo as ProtectionInfoProtobuf } from '@luxamm/client-explore/dist/uniswap/explore/v1/service_pb'
|
|
5
5
|
import {
|
|
6
6
|
ProtectionAttackType,
|
|
7
7
|
type ProtectionInfo,
|
|
8
8
|
ProtectionResult,
|
|
9
9
|
SafetyLevel,
|
|
10
|
-
} from '@
|
|
11
|
-
import { logger } from '
|
|
10
|
+
} from '@luxexchange/api/src/clients/graphql/__generated__/schema-types'
|
|
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.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PROD_ENTRY_GATEWAY_API_BASE_URL,
|
|
3
3
|
STAGING_ENTRY_GATEWAY_API_BASE_URL,
|
|
4
|
-
} from '@
|
|
5
|
-
import { getConfig } from '@
|
|
6
|
-
import { Environment, getCurrentEnv } from '
|
|
4
|
+
} from '@luxexchange/api/src/clients/base/urls'
|
|
5
|
+
import { getConfig } from '@luxexchange/config'
|
|
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,6 +1,6 @@
|
|
|
1
1
|
import { PROD_WEBSOCKET_BASE_URL, STAGING_WEBSOCKET_BASE_URL } from '@luxexchange/api/src/clients/base/urls'
|
|
2
2
|
import { getConfig } from '@luxexchange/config'
|
|
3
|
-
import { Environment, getCurrentEnv } from '
|
|
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.
|
|
@@ -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`,
|
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
|
+
* @luxexchange/api - Unified data layer for Uniswap 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.
|
|
@@ -113,7 +113,7 @@ export {
|
|
|
113
113
|
} from '@luxexchange/api/src/clients/trading/tradeTypes'
|
|
114
114
|
export {
|
|
115
115
|
FeeType,
|
|
116
|
-
type
|
|
116
|
+
type FormattedLxSwapGasFeeInfo,
|
|
117
117
|
type GasEstimate,
|
|
118
118
|
type GasEstimateEip1559,
|
|
119
119
|
type GasEstimateLegacy,
|
|
@@ -149,10 +149,10 @@ export {
|
|
|
149
149
|
|
|
150
150
|
// Uniswap API
|
|
151
151
|
export {
|
|
152
|
-
|
|
153
|
-
type
|
|
154
|
-
type
|
|
155
|
-
} from '@luxexchange/api/src/clients/uniswap/
|
|
152
|
+
createLxApiClient,
|
|
153
|
+
type LxApiClient,
|
|
154
|
+
type LxApiClientContext,
|
|
155
|
+
} from '@luxexchange/api/src/clients/uniswap/createLxApiClient'
|
|
156
156
|
|
|
157
157
|
// Compliance API
|
|
158
158
|
export {
|
|
@@ -198,7 +198,7 @@ export {
|
|
|
198
198
|
export type {
|
|
199
199
|
EstimateGasFeeRequest as GasServiceEstimateRequest,
|
|
200
200
|
EstimateGasFeeResponse as GasServiceEstimateResponse,
|
|
201
|
-
} from '@
|
|
201
|
+
} from '@luxamm/client-unirpc-v2/dist/uniswap/unirpc/v2/service_pb'
|
|
202
202
|
|
|
203
203
|
// Data API Service (ConnectRPC - listTopTokens, listTopPools, getPortfolio, etc.)
|
|
204
204
|
export {
|
|
@@ -217,9 +217,9 @@ export {
|
|
|
217
217
|
type GetPortfolioResponse,
|
|
218
218
|
type ListTopPoolsResponse,
|
|
219
219
|
type ListTokensResponse,
|
|
220
|
-
} from '@
|
|
221
|
-
export { ProtocolVersion } from '@
|
|
222
|
-
export { type Pool as DataApiPool, type Token as DataApiToken } from '@
|
|
220
|
+
} from '@luxamm/client-data-api/dist/data/v1/api_pb'
|
|
221
|
+
export { ProtocolVersion } from '@luxamm/client-data-api/dist/data/v1/poolTypes_pb'
|
|
222
|
+
export { type Pool as DataApiPool, type Token as DataApiToken } from '@luxamm/client-data-api/dist/data/v1/types_pb'
|
|
223
223
|
|
|
224
224
|
// Data Service API
|
|
225
225
|
export {
|
|
@@ -280,7 +280,7 @@ export {
|
|
|
280
280
|
TransferWidgetUrlRequest,
|
|
281
281
|
WidgetUrlRequest,
|
|
282
282
|
WidgetUrlResponse,
|
|
283
|
-
} from '@
|
|
283
|
+
} from '@luxamm/client-for/dist/for/v1/api_pb'
|
|
284
284
|
|
|
285
285
|
// ConnectRPC API
|
|
286
286
|
export {
|
|
@@ -342,4 +342,6 @@ export { getEntryGatewayUrl, getMigratedForApiUrl } from '@luxexchange/api/src/g
|
|
|
342
342
|
|
|
343
343
|
export { getWebSocketUrl } from '@luxexchange/api/src/getWebSocketUrl'
|
|
344
344
|
|
|
345
|
-
export {
|
|
345
|
+
export { provideLxIdentifierService } from '@luxexchange/api/src/provideLxIdentifierService'
|
|
346
|
+
|
|
347
|
+
export const provideLuxIdentifierService = provideLxIdentifierService
|