@polyester/sdk 0.20.0 → 0.21.0
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/CHANGELOG.md +24 -0
- package/README.md +9 -9
- package/dist/environment.d.ts +2 -2
- package/dist/environment.d.ts.map +1 -1
- package/dist/environment.js +4 -4
- package/dist/environment.js.map +1 -1
- package/dist/gen/auth/v1/api_keys_pb.d.ts +3 -1
- package/dist/gen/auth/v1/api_keys_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/api_keys_pb.js.map +1 -1
- package/dist/gen/auth/v1/auth_pb.d.ts +49 -5
- package/dist/gen/auth/v1/auth_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/auth_pb.js +21 -3
- package/dist/gen/auth/v1/auth_pb.js.map +1 -1
- package/dist/gen/auth/v1/profile_pb.d.ts +7 -0
- package/dist/gen/auth/v1/profile_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/profile_pb.js +1 -1
- package/dist/gen/auth/v1/profile_pb.js.map +1 -1
- package/dist/gen/auth/v1/social_verification_pb.d.ts +12 -9
- package/dist/gen/auth/v1/social_verification_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/social_verification_pb.js.map +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.d.ts +3 -1
- package/dist/gen/auth/v1/subaccounts_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.js.map +1 -1
- package/dist/gen/chain/deposit/v1/deposit_pb.d.ts +4 -1
- package/dist/gen/chain/deposit/v1/deposit_pb.d.ts.map +1 -1
- package/dist/gen/chain/deposit/v1/deposit_pb.js.map +1 -1
- package/dist/gen/marketdata/v1/marketdata_pb.d.ts +20 -1
- package/dist/gen/marketdata/v1/marketdata_pb.d.ts.map +1 -1
- package/dist/gen/marketdata/v1/marketdata_pb.js +1 -1
- package/dist/gen/marketdata/v1/marketdata_pb.js.map +1 -1
- package/dist/gen/marketoverview/v1/marketoverview_pb.d.ts +138 -13
- package/dist/gen/marketoverview/v1/marketoverview_pb.d.ts.map +1 -1
- package/dist/gen/marketoverview/v1/marketoverview_pb.js +23 -6
- package/dist/gen/marketoverview/v1/marketoverview_pb.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/services/auth/auth.d.ts +7 -0
- package/dist/services/auth/auth.d.ts.map +1 -1
- package/dist/services/auth/auth.js +9 -0
- package/dist/services/auth/auth.js.map +1 -1
- package/dist/services/auth/profile/profile.schemas.d.ts +1 -0
- package/dist/services/auth/profile/profile.schemas.d.ts.map +1 -1
- package/dist/services/auth/profile/profile.schemas.js +2 -1
- package/dist/services/auth/profile/profile.schemas.js.map +1 -1
- package/dist/services/candles/candles.schemas.d.ts +9 -0
- package/dist/services/candles/candles.schemas.d.ts.map +1 -1
- package/dist/services/candles/candles.schemas.js +6 -0
- package/dist/services/candles/candles.schemas.js.map +1 -1
- package/dist/services/deposit/deposit.schemas.d.ts +1 -1
- package/dist/services/deposit/deposit.schemas.js +1 -1
- package/dist/services/deposit/deposit.schemas.js.map +1 -1
- package/dist/services/fees/fees.schemas.d.ts +1 -1
- package/dist/services/fees/fees.schemas.js +1 -1
- package/dist/services/fees/fees.schemas.js.map +1 -1
- package/dist/services/heatmap/heatmap.schemas.d.ts +4 -4
- package/dist/services/internal-transfers/internal-transfers.schemas.d.ts +1 -1
- package/dist/services/internal-transfers/internal-transfers.schemas.js +1 -1
- package/dist/services/internal-transfers/internal-transfers.schemas.js.map +1 -1
- package/dist/services/market-overview/index.d.ts +2 -2
- package/dist/services/market-overview/market-overview.codecs.js +2 -2
- package/dist/services/market-overview/market-overview.codecs.js.map +1 -1
- package/dist/services/market-overview/market-overview.d.ts +7 -1
- package/dist/services/market-overview/market-overview.d.ts.map +1 -1
- package/dist/services/market-overview/market-overview.js +11 -1
- package/dist/services/market-overview/market-overview.js.map +1 -1
- package/dist/services/market-overview/market-overview.schemas.d.ts +72 -12
- package/dist/services/market-overview/market-overview.schemas.d.ts.map +1 -1
- package/dist/services/market-overview/market-overview.schemas.js +30 -7
- package/dist/services/market-overview/market-overview.schemas.js.map +1 -1
- package/dist/services/market-overview/market-overview.types.d.ts +2 -2
- package/dist/services/orderbook/orderbook.schemas.d.ts +1 -1
- package/dist/services/orders/orders-batch.schemas.d.ts +14 -14
- package/dist/services/orders/orders-input.schemas.d.ts +1 -1
- package/dist/services/orders/orders-output.schemas.d.ts +6 -6
- package/dist/services/social-verification/social-verification.d.ts +1 -1
- package/dist/services/social-verification/social-verification.js +1 -1
- package/dist/services/social-verification/social-verification.js.map +1 -1
- package/dist/services/social-verification/social-verification.schemas.d.ts +17 -11
- package/dist/services/social-verification/social-verification.schemas.d.ts.map +1 -1
- package/dist/services/social-verification/social-verification.schemas.js +12 -5
- package/dist/services/social-verification/social-verification.schemas.js.map +1 -1
- package/dist/services/subaccounts/subaccounts.schemas.d.ts +1 -1
- package/dist/services/triggers/triggers-output.schemas.d.ts +1 -1
- package/dist/services/triggers/triggers-output.schemas.d.ts.map +1 -1
- package/dist/services/triggers/triggers-output.schemas.js +1 -2
- package/dist/services/triggers/triggers-output.schemas.js.map +1 -1
- package/dist/shared/validation.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AccountSigner, AccountSignerConfig, AccountSignerFactory, HexAddress } from "./account-signer/types.js";
|
|
2
|
-
import { CreatePolyesterEnvironmentParams,
|
|
2
|
+
import { CreatePolyesterEnvironmentParams, POLYESTER_DEVNET_ENVIRONMENT, PolyesterAccountAbstractionEnvironment, PolyesterContractsEnvironment, PolyesterEntryPointConfig, PolyesterEnvironment, PolyesterSafeDeploymentConfig, createPolyesterEnvironment } from "./environment.js";
|
|
3
3
|
import { CreatePolyesterAccountSignerParams } from "./account-signer/create-polyester-account-signer.js";
|
|
4
4
|
import "./account-signer/index.js";
|
|
5
5
|
import { AssetConfig, DepositWithdrawConfig, PairConfig, PairStatus, SpotConfig, ZipperAssetChainVariant, ZipperAssetConfig, ZipperChainConfig, ZipperChainContractConfig } from "./shared/catalog-config.js";
|
|
@@ -23,7 +23,7 @@ import { CreateSubaccountInput, CreateSubaccountResult as CreateSubaccountResult
|
|
|
23
23
|
import { Candle, CandleColumnar, CandleColumnarInt, CandleInt, GetCandlesColumnsInput, GetCandlesInput, Timeframe } from "./services/candles/candles.schemas.js";
|
|
24
24
|
import { ChainAnalyticsRange, GetUnifiedAssetBalancesInput, GetZippedAssetSupplyGroupInput, GetZippedAssetSupplyInput, UnifiedAssetBalancesResponse, ZippedAssetSupplyGroupResponse, ZippedAssetSupplyResponse, ZippedAssetSupplySeries } from "./services/chain-analytics/chain-analytics.schemas.js";
|
|
25
25
|
import { GetMarketTradesInput, MarketTrade } from "./services/market-data/market-data.schemas.js";
|
|
26
|
-
import { ListMarketOverviewInput, MarketOverview, MarketOverviewOrderBy, MarketOverviewSort, MarketOverviewSparkline, SparklineIntervalName } from "./services/market-overview/market-overview.schemas.js";
|
|
26
|
+
import { ListMarketOverviewInput, MarketOverview, MarketOverviewOrderBy, MarketOverviewSort, MarketOverviewSparkline, SparklineIntervalName, SpotPairVolumeSeries, SpotVolumeHistoryInput, SpotVolumeHistoryResponse } from "./services/market-overview/market-overview.schemas.js";
|
|
27
27
|
import { GetOrderbookInput, OrderbookData, OrderbookLevel } from "./services/orderbook/orderbook.schemas.js";
|
|
28
28
|
import { CreateOrderbookSubscriptionInput, OrderbookStreamHandlers, OrderbookSubscription } from "./services/orderbook/orderbook.js";
|
|
29
29
|
import { HeatmapDepthValue, HeatmapIntervalValue, HeatmapQuantityModeValue } from "./services/heatmap/heatmap.codecs.js";
|
|
@@ -105,4 +105,4 @@ import "./services/triggers/triggers.types.js";
|
|
|
105
105
|
import "./services/vip/vip.types.js";
|
|
106
106
|
import "./services/whiteboard/whiteboard.types.js";
|
|
107
107
|
import "./services/zipper/zipper.types.js";
|
|
108
|
-
export { type AccountCodeValue, type AccountIdentity, type AccountScope, type AccountScopedInput, type AccountSigner, type AccountSignerAuthEvents, type AccountSignerConfig, type CreateSubaccountResult as AccountSignerCreateSubaccountResult, type AccountSignerFactory, type ActiveAccountInfo, type AddressBook, type AddressBookEntries, type AddressBookEntriesView, type AddressBookEntry, type AddressBookRecentDestinationsView, type AddressBookTag, type AddressBookTagSummary, type AddressBookView, type AddressBookViewInvalidated, AlreadyExistsError, type ApiKey, type ApiKeyEd25519AuthProvider, type ApiKeyIdInput, type ApiKeyPolicy, type ApiKeyPolicyApplyInput, type ApiKeyPolicyCreateInput, type ApiKeyPolicyUpdateInput, type ApiKeyStatus, type ApiKeysCreateInput, type ApiKeysListInput, type ApiKeysUpdateInput, type ArchiveWhiteboardBoardInput, type ArchiveWhiteboardBoardResult, type AssetConfig, type AuthHydrationData, type AuthLoginMethod, type AuthState, type AuthTokenStorage, type AuthTokenStorageSetOptions, AuthenticationError, type BalanceHistoryInput, type BalanceHistoryResponse, type BalanceRange, type BatchCancelOrderInput, type BatchCancelOrderResult, type BatchCancelOrdersInput, type BatchCancelOrdersResult, type BatchCreateOrderResult, type BatchCreateOrdersInput, type BatchCreateOrdersResult, type BatchGuardApprovals, type BatchReplaceAdmissionItem, type BatchReplaceOrdersInput, type BatchReplaceOrdersResult, type BatchSignProtectedActionInput, type BeginMfaChallengeInput, type BeginMfaChallengeResult, type BeginPasskeyEnrollmentInput, type BeginPasskeyEnrollmentResult, type BeginTotpEnrollmentInput, type BeginTotpEnrollmentResult, type CancelAllAfterInput, type CancelAllAfterResult, type CancelAllOrdersInput, type CancelAllOrdersResponse, type CancelOrderInput, type CancelOrderResult, type CancelTriggerInput, type CancelTriggerResult, type Candle, type CandleColumnar, type CandleColumnarInt, type CandleInt, type ChainAnalyticsRange, type ClaimFreshStepUpInput, type ClaimFreshStepUpResult, type ClaimGeneratedUsernameInput, type ColumnarTimeWindow, type CompleteMfaChallengeResult, ConfigurationError, type ConnectChannelParams, type ConsumeFreshStepUpInput, type CookieAuthTokenStorageOptions, type CopyAddressBookEntryInput, type CreateAddressBookEntryInput, type CreateAddressBookTagInput, type CreateDepositAddressInput, type CreateGuardSignerWalletResult, type CreateInternalTransferInput, type CreateInternalTransferResult, type CreateOrderResult, type CreateOrderbookSubscriptionInput, type CreatePolyesterAccountSignerParams, type CreatePolyesterEnvironmentParams, type CreateServerClientFromCookiesParams, type CreateServerClientFromRequestParams, type CreateSubaccountInput, type CreateSubaccountParams, type CreateSubaccountResult$1 as CreateSubaccountResult, type CreateSubaccountResult$1 as CreateSubaccountServiceResult, type CreateTradingWithdrawResult, type CreateTradingWithdrawToExternalChainInput, type CreateTradingWithdrawToExternalChainServiceInput, type CreateTradingWithdrawToFundingInput, type CreateTradingWithdrawToFundingServiceInput, type CreateTriggerInput, type CreateTriggerResult, type CreateWhiteboardBoardInput, type CreateWhiteboardBoardResult, type DeleteAddressBookEntryInput, type DeleteAddressBookTagInput, type DeleteMfaFactorInput, type DepositAddress, type DepositWithdrawConfig, type EffectiveSubaccountPermissions, type EquityGroupBy, type EquityHistoryInput, type EquityHistoryResponse, type EquitySeries, type EquitySeriesGrouping, type EvmHex, type ExportGuardSignerWalletResult, type FinishPasskeyChallengeInput, type FinishPasskeyEnrollmentInput, type FinishPasskeyEnrollmentResult, type FinishTotpEnrollmentInput, type FinishTotpEnrollmentResult, type GeneratedUsernameOffer, type GetAddressBookViewInput, type GetBatchReplaceStatusInput, type GetBatchReplaceStatusResult, type GetCandlesColumnsInput, type GetCandlesInput, type GetLifecycleFlowInput, type GetLifecycleFlowOutput, type GetMarketTradesInput, type GetOrderDetailsInput, type GetOrderbookHeatmapInput, type GetOrderbookInput, type GetSpotFeeRatesInput, type GetTriggerInput, type GetUnifiedAssetBalancesInput, type GetUserTradesInput, type GetVerificationResponse, type GetWhiteboardBoardInput, type GetWhiteboardBoardResult, type GetZippedAssetSupplyGroupInput, type GetZippedAssetSupplyInput, type GuardApproval, type GuardSignerScopedInput, type GuardSignerStatus, type HeatmapDepthValue, type HeatmapIntervalValue, type HeatmapQuantityModeValue, type HexAddress, InternalServerError, type InternalTransferDestination, type InternalTransferWhitelistEntries, type InternalTransferWhitelistEntry, type InviteSubaccountMemberInput, type JwtAuthProvider, type LadderDetailsOutput, type LedgerBalance, type LedgerTransfer, type LedgerTransferSide, type LifecycleAssetIds, type LifecycleFlowDetail, type LifecycleFlowState, type LifecycleFlowStep, type LifecycleFlowStepActivity, type LifecycleFlowSummary, type LifecycleFlowSummaryProgress, type LifecycleFlowTimelineItem, type LifecycleFlowTxMatch, type LifecycleListOrderBy, type LifecycleListScope, type LifecycleReason, type LifecycleRequestFee, type LifecycleRequestFeeStatus, type LifecycleSort, type LifecycleTxLookupKind, type LifecycleZipperReason, type ListAddressBookEntriesInput, type ListApiKeyPoliciesResponse, type ListDepositAddressesInput, type ListInternalTransferWhitelistEntriesInput, type ListLifecycleFlowsByTxInput, type ListLifecycleFlowsByTxOutput, type ListLifecycleFlowsInput, type ListLifecycleFlowsOutput, type ListMarketOverviewInput, type ListMfaFactorsResult, type ListSubaccountInvitesInput, type ListTransferCounterpartiesInput, type ListTransferDestinationsInput, type ListTransfersInput, type ListTriggerEventsInput, type ListTriggerEventsResult, type ListTriggersInput, type ListTriggersResult, type ListWhiteboardBoardsInput, type ListWhiteboardBoardsResult, type LoginOptions, type LoginResult, type LoginWithWalletInput, type LoginWithWalletResponse, type MarketOverview, type MarketOverviewOrderBy, type MarketOverviewSort, type MarketOverviewSparkline, type MarketTrade, type Me, MfaEnrollmentRequiredError, type MfaFactor, MfaLastFactorRequiredError, MfaRequiredError, type MfaSessionInfo, MfaVerificationError, type MfaVerificationFailureReason, type MintWhiteboardJoinTokenInput, type MirroredWithdrawWhitelistEntry, type ModifyOrderInput, type ModifyOrderResult, type ModifyTriggerInput, type ModifyTriggerResult, NetworkError, type NewOrderInput, type NextVipTierThresholds, type Nonce, type OpenOrdersInput, type Order, type OrderDetails, type OrderErrorCode, type OrderErrorDetail, type OrderHistoryInput, type OrderIntentInput, type OrderTransfer, type OrderbookData, type OrderbookHeatmapDeltaBucket, type OrderbookHeatmapDeltaChain, type OrderbookHeatmapDeltaLevels, type OrderbookHeatmapKeyframe, type OrderbookHeatmapLevels, type OrderbookHeatmapLiveBucket, type OrderbookHeatmapResponse, type OrderbookLevel, type OrderbookStreamHandlers, type OrderbookSubscription, POLYESTER_AUTH_TOKEN_COOKIE_NAME, POLYESTER_SESSION_COOKIE_NAME, POLYESTER_TESTNET_ENVIRONMENT, type PairConfig, type PairStatus, type PauseTriggerInput, type PauseTriggerResult, PermissionError, type PolicyAction, PolicyInUseError, PolicyLockedError, type PolicyMarketScope, PolicyScopeMismatchError, type PolyesterAccountAbstractionEnvironment, PolyesterBrowserClient, type PolyesterBrowserClientConfig, PolyesterClient, type PolyesterClientBaseConfig, type PolyesterClientConfig, type PolyesterContractsEnvironment, type PolyesterEntryPointConfig, type PolyesterEnvironment, PolyesterError, type PolyesterErrorCode, type PolyesterErrorDetail, type PolyesterErrorOptions, type PolyesterMutationOptions, type PolyesterRealtime, type PolyesterRealtimeAuthConfig, type PolyesterRequestOptions, type PolyesterSafeDeploymentConfig, PolyesterServerClient, type PolyesterServerClientConfig, type PortfolioEquityHistoryInput, type PortfolioEquityHistoryResponse, type PortfolioEquitySeries, type PortfolioEquitySeriesGrouping, type PortfolioEquitySnapshotResponse, PreconditionFailedError, type PreparedTradingWithdraw, type PreviewOrderResult, type Profile, type RateLimitConfig, type RateLimitDetail, RateLimitError, type RateLimitErrorOptions, type RateLimitFailureReason, type RateLimitPolicyClass, type RateLimitRefillModel, type RateLimitScope, type RegenerateRecoveryCodesInput, type RegenerateRecoveryCodesResult, type ReleaseFreshStepUpInput, type RemoveSubaccountMemberInput, RequestError, type ResolveAccountInput, type ResolvedAccount, type ResolvedInternalTransferDestination, ResourceNotFoundError, type RespondSubaccountInviteInput, type ResumeTriggerInput, type ResumeTriggerResult, RevisionConflictError, type RiskPolicyInput, type RotateGuardSignerWalletResult, type SdkSubscriptionErrorContext, type ServerSessionSnapshot, ServiceUnavailableError, type SessionData, SessionElevationRequiredError, type SetSubaccountMemberMfaRequirementInput, type SignProtectedActionInput, type SocialProvider, type SocialProviderInput, type SocialVerification, type SocialVerificationMethod, type SocialVerificationStatus, type SparklineIntervalName, type SpotConfig, type SpotFeeRate, StaleQuoteError, type StartVerificationInput, type StartVerificationResponse, StepUpRequiredError, type StopDetailsOutput, type StopLossInput, type Subaccount, type SubaccountActivityInput, type SubaccountEvent, type SubaccountIdInput, type SubaccountInvite, type SubaccountInviteStatus, type SubaccountMember, type SubaccountPermission, type SubaccountPermissionDefinition, type SubaccountPolicy, type SubaccountPolicyApplyInput, type SubaccountPolicyCreateInput, type SubaccountPolicyUpdateInput, type SubaccountRole, type SubaccountRoleCatalog, type SubaccountRoleDefinition, type SubaccountScopedInput, type SubaccountStatus, type SubscribeHandlers, type SubscribeZippedAssetSupplyInput, type TakeProfitInput, type Timeframe, TimeoutError, type Trade, type TradingRateLimitClass, type TradingRateLimitRule, type TradingRateLimits, type TradingWithdrawSigningConfig, type TradingWithdrawWalletSigner, type TradingWithdrawWalletTypedData, type TrailingDetailsOutput, type TrailingStopInput, type TransferCodeValue, type TransferCounterparties, type TransferCounterparty, type TransferDestination, type TransferDestinations, type TransferSideKind, TransientError, type Transports, type Trigger, type TriggerDetailsOutput, type TriggerEvent, type TwapDetailsOutput, type UnifiedAssetBalancesResponse, type UpdateAddressBookEntryInput, type UpdateAddressBookTagInput, type UpdateMfaFactorInput, type UpdateMfaFactorResult, type UpdateProfileInput, type UpdateSubaccountInput, type UpdateSubaccountMemberRoleInput, type UpdateWhiteboardBoardAclInput, type UpdateWhiteboardBoardAclResult, type UpdateWhiteboardBoardInput, type UpdateWhiteboardBoardResult, type UsernameHistoryEntry, type ValidateWithdrawDestinationInput, type ValidateWithdrawDestinationResult, ValidationError, type VerificationReadyResponse, type VerifyRecoveryCodeChallengeInput, type VerifyTotpChallengeInput, type VipStatus, type VipTier, type VipTierCatalog, type WhiteboardAccess, type WhiteboardAclEntry, type WhiteboardAclEntryInput, type WhiteboardAclSubjectType, type WhiteboardAudience, type WhiteboardBoard, type WhiteboardBoardDetails, type WhiteboardBoardListItem, type WhiteboardJoinTokenResult, type WhiteboardPermissions, type WhiteboardPresencePayload, type WhiteboardResolvedRole, type WhiteboardSnapshot, type WhiteboardWritableRole, type WithdrawWhitelistView, type ZippedAssetSupplyBatch, type ZippedAssetSupplyGroupResponse, type ZippedAssetSupplyResponse, type ZippedAssetSupplySeries, type ZippedAssetSupplyUpdate, type ZipperAssetChainVariant, type ZipperAssetConfig, type ZipperChainConfig, type ZipperChainContractConfig, checksumEvmAddress, columnarTimestampSecAt, compareUnsignedIntegerStrings, connectErrorToPolyesterError, createCookieAuthTokenStorage, createErrorMappingInterceptor, createMemoryAuthTokenStorage, createPolyesterEnvironment, createPolyesterServerClientFromCookies, createPolyesterServerClientFromRequest, errorFromHttpStatus, evmHexToBytes, evmUtf8ToBytes, evmUtf8ToHex, expandColumnarTimestampsSec, formatConnectError, formatUserFacingError, isAbortError, isEvmAddress, isEvmAddressStrict, isFreshStepUpRequiredError, isMfaEnrollmentRequiredError, isMfaLastFactorRequiredError, isPolicyInUseError, isPolicyLockedError, isPolicyScopeMismatchError, isResourceNotFoundError, isRetryableError, isRevisionConflictError, isSessionElevationRequiredError, keccak256Hex, mergeLedgerBalances, normalizeErrorMessage, shouldApplyReconciliationUpdate, tsObjToNsString as timestampToNanoseconds, toPolyesterError, validateCreateAddressBookEntryInput };
|
|
108
|
+
export { type AccountCodeValue, type AccountIdentity, type AccountScope, type AccountScopedInput, type AccountSigner, type AccountSignerAuthEvents, type AccountSignerConfig, type CreateSubaccountResult as AccountSignerCreateSubaccountResult, type AccountSignerFactory, type ActiveAccountInfo, type AddressBook, type AddressBookEntries, type AddressBookEntriesView, type AddressBookEntry, type AddressBookRecentDestinationsView, type AddressBookTag, type AddressBookTagSummary, type AddressBookView, type AddressBookViewInvalidated, AlreadyExistsError, type ApiKey, type ApiKeyEd25519AuthProvider, type ApiKeyIdInput, type ApiKeyPolicy, type ApiKeyPolicyApplyInput, type ApiKeyPolicyCreateInput, type ApiKeyPolicyUpdateInput, type ApiKeyStatus, type ApiKeysCreateInput, type ApiKeysListInput, type ApiKeysUpdateInput, type ArchiveWhiteboardBoardInput, type ArchiveWhiteboardBoardResult, type AssetConfig, type AuthHydrationData, type AuthLoginMethod, type AuthState, type AuthTokenStorage, type AuthTokenStorageSetOptions, AuthenticationError, type BalanceHistoryInput, type BalanceHistoryResponse, type BalanceRange, type BatchCancelOrderInput, type BatchCancelOrderResult, type BatchCancelOrdersInput, type BatchCancelOrdersResult, type BatchCreateOrderResult, type BatchCreateOrdersInput, type BatchCreateOrdersResult, type BatchGuardApprovals, type BatchReplaceAdmissionItem, type BatchReplaceOrdersInput, type BatchReplaceOrdersResult, type BatchSignProtectedActionInput, type BeginMfaChallengeInput, type BeginMfaChallengeResult, type BeginPasskeyEnrollmentInput, type BeginPasskeyEnrollmentResult, type BeginTotpEnrollmentInput, type BeginTotpEnrollmentResult, type CancelAllAfterInput, type CancelAllAfterResult, type CancelAllOrdersInput, type CancelAllOrdersResponse, type CancelOrderInput, type CancelOrderResult, type CancelTriggerInput, type CancelTriggerResult, type Candle, type CandleColumnar, type CandleColumnarInt, type CandleInt, type ChainAnalyticsRange, type ClaimFreshStepUpInput, type ClaimFreshStepUpResult, type ClaimGeneratedUsernameInput, type ColumnarTimeWindow, type CompleteMfaChallengeResult, ConfigurationError, type ConnectChannelParams, type ConsumeFreshStepUpInput, type CookieAuthTokenStorageOptions, type CopyAddressBookEntryInput, type CreateAddressBookEntryInput, type CreateAddressBookTagInput, type CreateDepositAddressInput, type CreateGuardSignerWalletResult, type CreateInternalTransferInput, type CreateInternalTransferResult, type CreateOrderResult, type CreateOrderbookSubscriptionInput, type CreatePolyesterAccountSignerParams, type CreatePolyesterEnvironmentParams, type CreateServerClientFromCookiesParams, type CreateServerClientFromRequestParams, type CreateSubaccountInput, type CreateSubaccountParams, type CreateSubaccountResult$1 as CreateSubaccountResult, type CreateSubaccountResult$1 as CreateSubaccountServiceResult, type CreateTradingWithdrawResult, type CreateTradingWithdrawToExternalChainInput, type CreateTradingWithdrawToExternalChainServiceInput, type CreateTradingWithdrawToFundingInput, type CreateTradingWithdrawToFundingServiceInput, type CreateTriggerInput, type CreateTriggerResult, type CreateWhiteboardBoardInput, type CreateWhiteboardBoardResult, type DeleteAddressBookEntryInput, type DeleteAddressBookTagInput, type DeleteMfaFactorInput, type DepositAddress, type DepositWithdrawConfig, type EffectiveSubaccountPermissions, type EquityGroupBy, type EquityHistoryInput, type EquityHistoryResponse, type EquitySeries, type EquitySeriesGrouping, type EvmHex, type ExportGuardSignerWalletResult, type FinishPasskeyChallengeInput, type FinishPasskeyEnrollmentInput, type FinishPasskeyEnrollmentResult, type FinishTotpEnrollmentInput, type FinishTotpEnrollmentResult, type GeneratedUsernameOffer, type GetAddressBookViewInput, type GetBatchReplaceStatusInput, type GetBatchReplaceStatusResult, type GetCandlesColumnsInput, type GetCandlesInput, type GetLifecycleFlowInput, type GetLifecycleFlowOutput, type GetMarketTradesInput, type GetOrderDetailsInput, type GetOrderbookHeatmapInput, type GetOrderbookInput, type GetSpotFeeRatesInput, type GetTriggerInput, type GetUnifiedAssetBalancesInput, type GetUserTradesInput, type GetVerificationResponse, type GetWhiteboardBoardInput, type GetWhiteboardBoardResult, type GetZippedAssetSupplyGroupInput, type GetZippedAssetSupplyInput, type GuardApproval, type GuardSignerScopedInput, type GuardSignerStatus, type HeatmapDepthValue, type HeatmapIntervalValue, type HeatmapQuantityModeValue, type HexAddress, InternalServerError, type InternalTransferDestination, type InternalTransferWhitelistEntries, type InternalTransferWhitelistEntry, type InviteSubaccountMemberInput, type JwtAuthProvider, type LadderDetailsOutput, type LedgerBalance, type LedgerTransfer, type LedgerTransferSide, type LifecycleAssetIds, type LifecycleFlowDetail, type LifecycleFlowState, type LifecycleFlowStep, type LifecycleFlowStepActivity, type LifecycleFlowSummary, type LifecycleFlowSummaryProgress, type LifecycleFlowTimelineItem, type LifecycleFlowTxMatch, type LifecycleListOrderBy, type LifecycleListScope, type LifecycleReason, type LifecycleRequestFee, type LifecycleRequestFeeStatus, type LifecycleSort, type LifecycleTxLookupKind, type LifecycleZipperReason, type ListAddressBookEntriesInput, type ListApiKeyPoliciesResponse, type ListDepositAddressesInput, type ListInternalTransferWhitelistEntriesInput, type ListLifecycleFlowsByTxInput, type ListLifecycleFlowsByTxOutput, type ListLifecycleFlowsInput, type ListLifecycleFlowsOutput, type ListMarketOverviewInput, type ListMfaFactorsResult, type ListSubaccountInvitesInput, type ListTransferCounterpartiesInput, type ListTransferDestinationsInput, type ListTransfersInput, type ListTriggerEventsInput, type ListTriggerEventsResult, type ListTriggersInput, type ListTriggersResult, type ListWhiteboardBoardsInput, type ListWhiteboardBoardsResult, type LoginOptions, type LoginResult, type LoginWithWalletInput, type LoginWithWalletResponse, type MarketOverview, type MarketOverviewOrderBy, type MarketOverviewSort, type MarketOverviewSparkline, type MarketTrade, type Me, MfaEnrollmentRequiredError, type MfaFactor, MfaLastFactorRequiredError, MfaRequiredError, type MfaSessionInfo, MfaVerificationError, type MfaVerificationFailureReason, type MintWhiteboardJoinTokenInput, type MirroredWithdrawWhitelistEntry, type ModifyOrderInput, type ModifyOrderResult, type ModifyTriggerInput, type ModifyTriggerResult, NetworkError, type NewOrderInput, type NextVipTierThresholds, type Nonce, type OpenOrdersInput, type Order, type OrderDetails, type OrderErrorCode, type OrderErrorDetail, type OrderHistoryInput, type OrderIntentInput, type OrderTransfer, type OrderbookData, type OrderbookHeatmapDeltaBucket, type OrderbookHeatmapDeltaChain, type OrderbookHeatmapDeltaLevels, type OrderbookHeatmapKeyframe, type OrderbookHeatmapLevels, type OrderbookHeatmapLiveBucket, type OrderbookHeatmapResponse, type OrderbookLevel, type OrderbookStreamHandlers, type OrderbookSubscription, POLYESTER_AUTH_TOKEN_COOKIE_NAME, POLYESTER_DEVNET_ENVIRONMENT, POLYESTER_SESSION_COOKIE_NAME, type PairConfig, type PairStatus, type PauseTriggerInput, type PauseTriggerResult, PermissionError, type PolicyAction, PolicyInUseError, PolicyLockedError, type PolicyMarketScope, PolicyScopeMismatchError, type PolyesterAccountAbstractionEnvironment, PolyesterBrowserClient, type PolyesterBrowserClientConfig, PolyesterClient, type PolyesterClientBaseConfig, type PolyesterClientConfig, type PolyesterContractsEnvironment, type PolyesterEntryPointConfig, type PolyesterEnvironment, PolyesterError, type PolyesterErrorCode, type PolyesterErrorDetail, type PolyesterErrorOptions, type PolyesterMutationOptions, type PolyesterRealtime, type PolyesterRealtimeAuthConfig, type PolyesterRequestOptions, type PolyesterSafeDeploymentConfig, PolyesterServerClient, type PolyesterServerClientConfig, type PortfolioEquityHistoryInput, type PortfolioEquityHistoryResponse, type PortfolioEquitySeries, type PortfolioEquitySeriesGrouping, type PortfolioEquitySnapshotResponse, PreconditionFailedError, type PreparedTradingWithdraw, type PreviewOrderResult, type Profile, type RateLimitConfig, type RateLimitDetail, RateLimitError, type RateLimitErrorOptions, type RateLimitFailureReason, type RateLimitPolicyClass, type RateLimitRefillModel, type RateLimitScope, type RegenerateRecoveryCodesInput, type RegenerateRecoveryCodesResult, type ReleaseFreshStepUpInput, type RemoveSubaccountMemberInput, RequestError, type ResolveAccountInput, type ResolvedAccount, type ResolvedInternalTransferDestination, ResourceNotFoundError, type RespondSubaccountInviteInput, type ResumeTriggerInput, type ResumeTriggerResult, RevisionConflictError, type RiskPolicyInput, type RotateGuardSignerWalletResult, type SdkSubscriptionErrorContext, type ServerSessionSnapshot, ServiceUnavailableError, type SessionData, SessionElevationRequiredError, type SetSubaccountMemberMfaRequirementInput, type SignProtectedActionInput, type SocialProvider, type SocialProviderInput, type SocialVerification, type SocialVerificationMethod, type SocialVerificationStatus, type SparklineIntervalName, type SpotConfig, type SpotFeeRate, type SpotPairVolumeSeries, type SpotVolumeHistoryInput, type SpotVolumeHistoryResponse, StaleQuoteError, type StartVerificationInput, type StartVerificationResponse, StepUpRequiredError, type StopDetailsOutput, type StopLossInput, type Subaccount, type SubaccountActivityInput, type SubaccountEvent, type SubaccountIdInput, type SubaccountInvite, type SubaccountInviteStatus, type SubaccountMember, type SubaccountPermission, type SubaccountPermissionDefinition, type SubaccountPolicy, type SubaccountPolicyApplyInput, type SubaccountPolicyCreateInput, type SubaccountPolicyUpdateInput, type SubaccountRole, type SubaccountRoleCatalog, type SubaccountRoleDefinition, type SubaccountScopedInput, type SubaccountStatus, type SubscribeHandlers, type SubscribeZippedAssetSupplyInput, type TakeProfitInput, type Timeframe, TimeoutError, type Trade, type TradingRateLimitClass, type TradingRateLimitRule, type TradingRateLimits, type TradingWithdrawSigningConfig, type TradingWithdrawWalletSigner, type TradingWithdrawWalletTypedData, type TrailingDetailsOutput, type TrailingStopInput, type TransferCodeValue, type TransferCounterparties, type TransferCounterparty, type TransferDestination, type TransferDestinations, type TransferSideKind, TransientError, type Transports, type Trigger, type TriggerDetailsOutput, type TriggerEvent, type TwapDetailsOutput, type UnifiedAssetBalancesResponse, type UpdateAddressBookEntryInput, type UpdateAddressBookTagInput, type UpdateMfaFactorInput, type UpdateMfaFactorResult, type UpdateProfileInput, type UpdateSubaccountInput, type UpdateSubaccountMemberRoleInput, type UpdateWhiteboardBoardAclInput, type UpdateWhiteboardBoardAclResult, type UpdateWhiteboardBoardInput, type UpdateWhiteboardBoardResult, type UsernameHistoryEntry, type ValidateWithdrawDestinationInput, type ValidateWithdrawDestinationResult, ValidationError, type VerificationReadyResponse, type VerifyRecoveryCodeChallengeInput, type VerifyTotpChallengeInput, type VipStatus, type VipTier, type VipTierCatalog, type WhiteboardAccess, type WhiteboardAclEntry, type WhiteboardAclEntryInput, type WhiteboardAclSubjectType, type WhiteboardAudience, type WhiteboardBoard, type WhiteboardBoardDetails, type WhiteboardBoardListItem, type WhiteboardJoinTokenResult, type WhiteboardPermissions, type WhiteboardPresencePayload, type WhiteboardResolvedRole, type WhiteboardSnapshot, type WhiteboardWritableRole, type WithdrawWhitelistView, type ZippedAssetSupplyBatch, type ZippedAssetSupplyGroupResponse, type ZippedAssetSupplyResponse, type ZippedAssetSupplySeries, type ZippedAssetSupplyUpdate, type ZipperAssetChainVariant, type ZipperAssetConfig, type ZipperChainConfig, type ZipperChainContractConfig, checksumEvmAddress, columnarTimestampSecAt, compareUnsignedIntegerStrings, connectErrorToPolyesterError, createCookieAuthTokenStorage, createErrorMappingInterceptor, createMemoryAuthTokenStorage, createPolyesterEnvironment, createPolyesterServerClientFromCookies, createPolyesterServerClientFromRequest, errorFromHttpStatus, evmHexToBytes, evmUtf8ToBytes, evmUtf8ToHex, expandColumnarTimestampsSec, formatConnectError, formatUserFacingError, isAbortError, isEvmAddress, isEvmAddressStrict, isFreshStepUpRequiredError, isMfaEnrollmentRequiredError, isMfaLastFactorRequiredError, isPolicyInUseError, isPolicyLockedError, isPolicyScopeMismatchError, isResourceNotFoundError, isRetryableError, isRevisionConflictError, isSessionElevationRequiredError, keccak256Hex, mergeLedgerBalances, normalizeErrorMessage, shouldApplyReconciliationUpdate, tsObjToNsString as timestampToNanoseconds, toPolyesterError, validateCreateAddressBookEntryInput };
|
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { AlreadyExistsError, AuthenticationError, ConfigurationError, InternalSe
|
|
|
2
2
|
import { tsObjToNsString } from "./utils/time.js";
|
|
3
3
|
import { connectErrorToPolyesterError, createErrorMappingInterceptor, toPolyesterError } from "./shared/connect-error-mapping.js";
|
|
4
4
|
import { checksumEvmAddress, evmHexToBytes, evmUtf8ToBytes, evmUtf8ToHex, isEvmAddress, isEvmAddressStrict, keccak256Hex } from "./utils/evm.js";
|
|
5
|
-
import {
|
|
5
|
+
import { POLYESTER_DEVNET_ENVIRONMENT, createPolyesterEnvironment } from "./environment.js";
|
|
6
6
|
import { formatConnectError, formatUserFacingError, isPolicyInUseError, isPolicyLockedError, isPolicyScopeMismatchError, isResourceNotFoundError, isRetryableError, isRevisionConflictError } from "./utils/errors.js";
|
|
7
7
|
import { compareUnsignedIntegerStrings, shouldApplyReconciliationUpdate } from "./shared/reconciliation.js";
|
|
8
8
|
import { mergeLedgerBalances } from "./services/balances/balances.merge.js";
|
|
@@ -14,4 +14,4 @@ import { PolyesterBrowserClient } from "./browser-client.js";
|
|
|
14
14
|
import { PolyesterServerClient, createPolyesterServerClientFromCookies, createPolyesterServerClientFromRequest } from "./server-client.js";
|
|
15
15
|
import { isFreshStepUpRequiredError, isMfaEnrollmentRequiredError, isMfaLastFactorRequiredError, isSessionElevationRequiredError } from "./utils/connect-mfa-errors.js";
|
|
16
16
|
import { columnarTimestampSecAt, expandColumnarTimestampsSec } from "./utils/columnar-time.js";
|
|
17
|
-
export { AlreadyExistsError, AuthenticationError, ConfigurationError, InternalServerError, MfaEnrollmentRequiredError, MfaLastFactorRequiredError, MfaRequiredError, MfaVerificationError, NetworkError, POLYESTER_AUTH_TOKEN_COOKIE_NAME,
|
|
17
|
+
export { AlreadyExistsError, AuthenticationError, ConfigurationError, InternalServerError, MfaEnrollmentRequiredError, MfaLastFactorRequiredError, MfaRequiredError, MfaVerificationError, NetworkError, POLYESTER_AUTH_TOKEN_COOKIE_NAME, POLYESTER_DEVNET_ENVIRONMENT, POLYESTER_SESSION_COOKIE_NAME, PermissionError, PolicyInUseError, PolicyLockedError, PolicyScopeMismatchError, PolyesterBrowserClient, PolyesterClient, PolyesterError, PolyesterServerClient, PreconditionFailedError, RateLimitError, RequestError, ResourceNotFoundError, RevisionConflictError, ServiceUnavailableError, SessionElevationRequiredError, StaleQuoteError, StepUpRequiredError, TimeoutError, TransientError, ValidationError, checksumEvmAddress, columnarTimestampSecAt, compareUnsignedIntegerStrings, connectErrorToPolyesterError, createCookieAuthTokenStorage, createErrorMappingInterceptor, createMemoryAuthTokenStorage, createPolyesterEnvironment, createPolyesterServerClientFromCookies, createPolyesterServerClientFromRequest, errorFromHttpStatus, evmHexToBytes, evmUtf8ToBytes, evmUtf8ToHex, expandColumnarTimestampsSec, formatConnectError, formatUserFacingError, isAbortError, isEvmAddress, isEvmAddressStrict, isFreshStepUpRequiredError, isMfaEnrollmentRequiredError, isMfaLastFactorRequiredError, isPolicyInUseError, isPolicyLockedError, isPolicyScopeMismatchError, isResourceNotFoundError, isRetryableError, isRevisionConflictError, isSessionElevationRequiredError, keccak256Hex, mergeLedgerBalances, normalizeErrorMessage, shouldApplyReconciliationUpdate, tsObjToNsString as timestampToNanoseconds, toPolyesterError, validateCreateAddressBookEntryInput };
|
|
@@ -76,6 +76,13 @@ declare class AuthService {
|
|
|
76
76
|
* Returns the authenticated caller's account context, including account ID, optional API key ID, username, and session assurance details from the presented token or API key.
|
|
77
77
|
*/
|
|
78
78
|
me(options?: PolyesterRequestOptions): Promise<Me>;
|
|
79
|
+
/**
|
|
80
|
+
* Records explicit consent to the current terms for the caller's root account.
|
|
81
|
+
* Call only after the user consents. Requires an interactive JWT session;
|
|
82
|
+
* API keys are not allowed. Repeated acceptance succeeds without changing
|
|
83
|
+
* the first acceptance time. No MFA is required.
|
|
84
|
+
*/
|
|
85
|
+
acceptTerms(options?: PolyesterMutationOptions): Promise<void>;
|
|
79
86
|
/**
|
|
80
87
|
* Requests a short-lived nonce for the given smart-account EVM address.
|
|
81
88
|
* The nonce is single-purpose, replaced by subsequent requests, and expires
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","names":[],"sources":["../../../src/services/auth/auth.ts"],"mappings":";;;;;;;;cAmBa,4BAA0B,EAAA;;;;;;;;;KAU3B,uBAAuB,EAAE,kBAAkB;cAEjD,UAAQ,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;KAOF,KAAK,EAAE,mBAAmB;cAEhC,+BAA6B,EAAA;;;;;;;;;KAOvB,0BAA0B,EAAE,mBAAmB;cAErD,aAAW,EAAA;;;;;;;;;;KAKL,QAAQ,EAAE,mBAAmB;;;;cAK5B;;EAGT,SAAS;EAEG,YAAA,YAAY,4BAA4B,UAAU;;;;EASxD,GAAG,UAAU,0BAA0B,QAAQ;;;;;;;EAW/C,kBACF,6BACA,UAAU,0BACX,QAAQ;;;;YAaK,gBACZ,OAAO,sBACP,UAAU,2BACX,QAAQ"}
|
|
1
|
+
{"version":3,"file":"auth.d.ts","names":[],"sources":["../../../src/services/auth/auth.ts"],"mappings":";;;;;;;;cAmBa,4BAA0B,EAAA;;;;;;;;;KAU3B,uBAAuB,EAAE,kBAAkB;cAEjD,UAAQ,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;KAOF,KAAK,EAAE,mBAAmB;cAEhC,+BAA6B,EAAA;;;;;;;;;KAOvB,0BAA0B,EAAE,mBAAmB;cAErD,aAAW,EAAA;;;;;;;;;;KAKL,QAAQ,EAAE,mBAAmB;;;;cAK5B;;EAGT,SAAS;EAEG,YAAA,YAAY,4BAA4B,UAAU;;;;EASxD,GAAG,UAAU,0BAA0B,QAAQ;;;;;;;EAW/C,YAAY,UAAU,2BAA2B;;;;;;;EAUjD,kBACF,6BACA,UAAU,0BACX,QAAQ;;;;YAaK,gBACZ,OAAO,sBACP,UAAU,2BACX,QAAQ"}
|
|
@@ -52,6 +52,15 @@ var AuthService = class {
|
|
|
52
52
|
return parse(MeSchema, res);
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
|
+
* Records explicit consent to the current terms for the caller's root account.
|
|
56
|
+
* Call only after the user consents. Requires an interactive JWT session;
|
|
57
|
+
* API keys are not allowed. Repeated acceptance succeeds without changing
|
|
58
|
+
* the first acceptance time. No MFA is required.
|
|
59
|
+
*/
|
|
60
|
+
async acceptTerms(options) {
|
|
61
|
+
await this.#authClient.acceptTerms({}, toConnectCallOptions(options));
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
55
64
|
* Requests a short-lived nonce for the given smart-account EVM address.
|
|
56
65
|
* The nonce is single-purpose, replaced by subsequent requests, and expires
|
|
57
66
|
* after about five minutes. The optional expiry is milliseconds since the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","names":["#publicClient","Proto.AuthService","#authClient"],"sources":["../../../src/services/auth/auth.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/auth/v1/auth_pb.js\";\nimport * as v from \"valibot\";\nimport { parse } from \"../../shared/validation.js\";\nimport { ProfileService } from \"./profile/profile.js\";\nimport {\n OptionalTimestampMsSchema,\n PublicIdSchema,\n TimestampSchema,\n} from \"../../shared/schemas.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport { MfaSessionInfoSchema } from \"../mfa/mfa.schemas.js\";\nimport type { PolyesterRealtime } from \"../../realtime/index.js\";\nimport type { AuthAndPublicApiTransports } from \"../../shared/transports.js\";\n\nexport const LoginWithWalletInputSchema = v.strictObject({\n smartAccountAddress: v.string(),\n nonce: v.string(),\n signature: v.string(),\n userAgent: v.optional(v.string(), \"\"),\n ip: v.optional(v.string(), \"\"),\n primaryWalletAddress: v.optional(v.string(), \"\"),\n walletProvider: v.optional(v.string(), \"\"),\n});\n\nexport type LoginWithWalletInput = v.InferInput<typeof LoginWithWalletInputSchema>;\n\nconst MeSchema = v.object({\n accountId: PublicIdSchema,\n apiKeyId: v.optional(v.string()),\n username: v.string(),\n session: v.optional(MfaSessionInfoSchema),\n});\n\nexport type Me = v.InferOutput<typeof MeSchema>;\n\nconst LoginWithWalletResponseSchema = v.object({\n accessToken: v.string(),\n expiresAt: v.optional(TimestampSchema),\n accountId: PublicIdSchema,\n username: v.string(),\n});\n\nexport type LoginWithWalletResponse = v.InferOutput<typeof LoginWithWalletResponseSchema>;\n\nconst NonceSchema = v.object({\n nonce: v.string(),\n expiresAt: OptionalTimestampMsSchema,\n});\n\nexport type Nonce = v.InferOutput<typeof NonceSchema>;\n\n/**\n * Handles wallet-based authentication, caller introspection, and authenticated profile operations.\n */\nexport class AuthService {\n #publicClient: Client<typeof Proto.AuthService>;\n #authClient: Client<typeof Proto.AuthService>;\n profile: ProfileService;\n\n constructor(transports: AuthAndPublicApiTransports, realtime: PolyesterRealtime) {\n this.#publicClient = createClient(Proto.AuthService, transports.publicApi);\n this.#authClient = createClient(Proto.AuthService, transports.authApi);\n this.profile = new ProfileService(transports, realtime);\n }\n\n /**\n * Returns the authenticated caller's account context, including account ID, optional API key ID, username, and session assurance details from the presented token or API key.\n */\n async me(options?: PolyesterRequestOptions): Promise<Me> {\n const res = await this.#authClient.me({}, toConnectCallOptions(options));\n return parse(MeSchema, res);\n }\n\n /**\n * Requests a short-lived nonce for the given smart-account EVM address.\n * The nonce is single-purpose, replaced by subsequent requests, and expires\n * after about five minutes. The optional expiry is milliseconds since the\n * Unix epoch.\n */\n async requestLoginNonce(\n smartAccountAddress: string,\n options?: PolyesterRequestOptions,\n ): Promise<Nonce> {\n return parse(\n NonceSchema,\n await this.#publicClient.getNonce(\n { smartAccountAddress },\n toConnectCallOptions(options),\n ),\n );\n }\n\n /**\n * Exchanges a signed login nonce for an authenticated session token and account identity returned by the auth API.\n */\n protected async loginWithWallet(\n input: LoginWithWalletInput,\n options?: PolyesterMutationOptions,\n ): Promise<LoginWithWalletResponse> {\n const validatedInput = parse(LoginWithWalletInputSchema, input);\n const res = await this.#publicClient.loginWithWallet(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(LoginWithWalletResponseSchema, res);\n }\n}\n"],"mappings":";;;;;;;;;AAmBA,MAAa,6BAA6B,EAAE,aAAa;CACrD,qBAAqB,EAAE,OAAO;CAC9B,OAAO,EAAE,OAAO;CAChB,WAAW,EAAE,OAAO;CACpB,WAAW,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CACpC,IAAI,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CAC7B,sBAAsB,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CAC/C,gBAAgB,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;AAC7C,CAAC;AAID,MAAM,WAAW,EAAE,OAAO;CACtB,WAAW;CACX,UAAU,EAAE,SAAS,EAAE,OAAO,CAAC;CAC/B,UAAU,EAAE,OAAO;CACnB,SAAS,EAAE,SAAS,oBAAoB;AAC5C,CAAC;AAID,MAAM,gCAAgC,EAAE,OAAO;CAC3C,aAAa,EAAE,OAAO;CACtB,WAAW,EAAE,SAAS,eAAe;CACrC,WAAW;CACX,UAAU,EAAE,OAAO;AACvB,CAAC;AAID,MAAM,cAAc,EAAE,OAAO;CACzB,OAAO,EAAE,OAAO;CAChB,WAAW;AACf,CAAC;;;;AAOD,IAAa,cAAb,MAAyB;CACrB;CACA;CACA;CAEA,YAAY,YAAwC,UAA6B;EAC7E,KAAKA,gBAAgB,aAAaC,eAAmB,WAAW,SAAS;EACzE,KAAKC,cAAc,aAAaD,eAAmB,WAAW,OAAO;EACrE,KAAK,UAAU,IAAI,eAAe,YAAY,QAAQ;CAC1D;;;;CAKA,MAAM,GAAG,SAAgD;EACrD,MAAM,MAAM,MAAM,KAAKC,YAAY,GAAG,CAAC,GAAG,qBAAqB,OAAO,CAAC;EACvE,OAAO,MAAM,UAAU,GAAG;CAC9B;;;;;;;CAQA,MAAM,kBACF,qBACA,SACc;EACd,OAAO,MACH,aACA,MAAM,KAAKF,cAAc,SACrB,EAAE,oBAAoB,GACtB,qBAAqB,OAAO,CAChC,CACJ;CACJ;;;;CAKA,MAAgB,gBACZ,OACA,SACgC;EAChC,MAAM,iBAAiB,MAAM,4BAA4B,KAAK;EAC9D,MAAM,MAAM,MAAM,KAAKA,cAAc,gBACjC,gBACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,+BAA+B,GAAG;CACnD;AACJ"}
|
|
1
|
+
{"version":3,"file":"auth.js","names":["#publicClient","Proto.AuthService","#authClient"],"sources":["../../../src/services/auth/auth.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/auth/v1/auth_pb.js\";\nimport * as v from \"valibot\";\nimport { parse } from \"../../shared/validation.js\";\nimport { ProfileService } from \"./profile/profile.js\";\nimport {\n OptionalTimestampMsSchema,\n PublicIdSchema,\n TimestampSchema,\n} from \"../../shared/schemas.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport { MfaSessionInfoSchema } from \"../mfa/mfa.schemas.js\";\nimport type { PolyesterRealtime } from \"../../realtime/index.js\";\nimport type { AuthAndPublicApiTransports } from \"../../shared/transports.js\";\n\nexport const LoginWithWalletInputSchema = v.strictObject({\n smartAccountAddress: v.string(),\n nonce: v.string(),\n signature: v.string(),\n userAgent: v.optional(v.string(), \"\"),\n ip: v.optional(v.string(), \"\"),\n primaryWalletAddress: v.optional(v.string(), \"\"),\n walletProvider: v.optional(v.string(), \"\"),\n});\n\nexport type LoginWithWalletInput = v.InferInput<typeof LoginWithWalletInputSchema>;\n\nconst MeSchema = v.object({\n accountId: PublicIdSchema,\n apiKeyId: v.optional(v.string()),\n username: v.string(),\n session: v.optional(MfaSessionInfoSchema),\n});\n\nexport type Me = v.InferOutput<typeof MeSchema>;\n\nconst LoginWithWalletResponseSchema = v.object({\n accessToken: v.string(),\n expiresAt: v.optional(TimestampSchema),\n accountId: PublicIdSchema,\n username: v.string(),\n});\n\nexport type LoginWithWalletResponse = v.InferOutput<typeof LoginWithWalletResponseSchema>;\n\nconst NonceSchema = v.object({\n nonce: v.string(),\n expiresAt: OptionalTimestampMsSchema,\n});\n\nexport type Nonce = v.InferOutput<typeof NonceSchema>;\n\n/**\n * Handles wallet-based authentication, caller introspection, and authenticated profile operations.\n */\nexport class AuthService {\n #publicClient: Client<typeof Proto.AuthService>;\n #authClient: Client<typeof Proto.AuthService>;\n profile: ProfileService;\n\n constructor(transports: AuthAndPublicApiTransports, realtime: PolyesterRealtime) {\n this.#publicClient = createClient(Proto.AuthService, transports.publicApi);\n this.#authClient = createClient(Proto.AuthService, transports.authApi);\n this.profile = new ProfileService(transports, realtime);\n }\n\n /**\n * Returns the authenticated caller's account context, including account ID, optional API key ID, username, and session assurance details from the presented token or API key.\n */\n async me(options?: PolyesterRequestOptions): Promise<Me> {\n const res = await this.#authClient.me({}, toConnectCallOptions(options));\n return parse(MeSchema, res);\n }\n\n /**\n * Records explicit consent to the current terms for the caller's root account.\n * Call only after the user consents. Requires an interactive JWT session;\n * API keys are not allowed. Repeated acceptance succeeds without changing\n * the first acceptance time. No MFA is required.\n */\n async acceptTerms(options?: PolyesterMutationOptions): Promise<void> {\n await this.#authClient.acceptTerms({}, toConnectCallOptions(options));\n }\n\n /**\n * Requests a short-lived nonce for the given smart-account EVM address.\n * The nonce is single-purpose, replaced by subsequent requests, and expires\n * after about five minutes. The optional expiry is milliseconds since the\n * Unix epoch.\n */\n async requestLoginNonce(\n smartAccountAddress: string,\n options?: PolyesterRequestOptions,\n ): Promise<Nonce> {\n return parse(\n NonceSchema,\n await this.#publicClient.getNonce(\n { smartAccountAddress },\n toConnectCallOptions(options),\n ),\n );\n }\n\n /**\n * Exchanges a signed login nonce for an authenticated session token and account identity returned by the auth API.\n */\n protected async loginWithWallet(\n input: LoginWithWalletInput,\n options?: PolyesterMutationOptions,\n ): Promise<LoginWithWalletResponse> {\n const validatedInput = parse(LoginWithWalletInputSchema, input);\n const res = await this.#publicClient.loginWithWallet(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(LoginWithWalletResponseSchema, res);\n }\n}\n"],"mappings":";;;;;;;;;AAmBA,MAAa,6BAA6B,EAAE,aAAa;CACrD,qBAAqB,EAAE,OAAO;CAC9B,OAAO,EAAE,OAAO;CAChB,WAAW,EAAE,OAAO;CACpB,WAAW,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CACpC,IAAI,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CAC7B,sBAAsB,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CAC/C,gBAAgB,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;AAC7C,CAAC;AAID,MAAM,WAAW,EAAE,OAAO;CACtB,WAAW;CACX,UAAU,EAAE,SAAS,EAAE,OAAO,CAAC;CAC/B,UAAU,EAAE,OAAO;CACnB,SAAS,EAAE,SAAS,oBAAoB;AAC5C,CAAC;AAID,MAAM,gCAAgC,EAAE,OAAO;CAC3C,aAAa,EAAE,OAAO;CACtB,WAAW,EAAE,SAAS,eAAe;CACrC,WAAW;CACX,UAAU,EAAE,OAAO;AACvB,CAAC;AAID,MAAM,cAAc,EAAE,OAAO;CACzB,OAAO,EAAE,OAAO;CAChB,WAAW;AACf,CAAC;;;;AAOD,IAAa,cAAb,MAAyB;CACrB;CACA;CACA;CAEA,YAAY,YAAwC,UAA6B;EAC7E,KAAKA,gBAAgB,aAAaC,eAAmB,WAAW,SAAS;EACzE,KAAKC,cAAc,aAAaD,eAAmB,WAAW,OAAO;EACrE,KAAK,UAAU,IAAI,eAAe,YAAY,QAAQ;CAC1D;;;;CAKA,MAAM,GAAG,SAAgD;EACrD,MAAM,MAAM,MAAM,KAAKC,YAAY,GAAG,CAAC,GAAG,qBAAqB,OAAO,CAAC;EACvE,OAAO,MAAM,UAAU,GAAG;CAC9B;;;;;;;CAQA,MAAM,YAAY,SAAmD;EACjE,MAAM,KAAKA,YAAY,YAAY,CAAC,GAAG,qBAAqB,OAAO,CAAC;CACxE;;;;;;;CAQA,MAAM,kBACF,qBACA,SACc;EACd,OAAO,MACH,aACA,MAAM,KAAKF,cAAc,SACrB,EAAE,oBAAoB,GACtB,qBAAqB,OAAO,CAChC,CACJ;CACJ;;;;CAKA,MAAgB,gBACZ,OACA,SACgC;EAChC,MAAM,iBAAiB,MAAM,4BAA4B,KAAK;EAC9D,MAAM,MAAM,MAAM,KAAKA,cAAc,gBACjC,gBACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,+BAA+B,GAAG;CACnD;AACJ"}
|
|
@@ -25,6 +25,7 @@ declare const ProfileSchema: v.ObjectSchema<{
|
|
|
25
25
|
} | undefined, number | undefined>]>;
|
|
26
26
|
readonly vipTier: v.NumberSchema<undefined>;
|
|
27
27
|
readonly usernameUnlocked: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
28
|
+
readonly currentTermsAccepted: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
28
29
|
}, undefined>;
|
|
29
30
|
type Profile = v.InferOutput<typeof ProfileSchema>;
|
|
30
31
|
declare const UpdateProfileInputSchema: v.ObjectSchema<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.schemas.d.ts","names":[],"sources":["../../../../src/services/auth/profile/profile.schemas.ts"],"mappings":";;cASa,eAAa,EAAA
|
|
1
|
+
{"version":3,"file":"profile.schemas.d.ts","names":[],"sources":["../../../../src/services/auth/profile/profile.schemas.ts"],"mappings":";;cASa,eAAa,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;KAsBd,UAAU,EAAE,mBAAmB;cAG9B,0BAAwB,EAAA;;;;;;;KAOzB,qBAAqB,EAAE,kBAAkB;cAExC,4BAA0B,EAAA;;;;;;;;;;KAQ3B,uBAAuB,EAAE,mBAAmB;cAE3C,8BAA4B,EAAA;;;;;;;;;;;KAM7B,yBAAyB,EAAE,mBAAmB;cAE7C,mCAAiC,EAAA;;;;KAKlC,8BAA8B,EAAE,kBAAkB;cAEjD,uBAAqB,EAAA;;;;;;KAOtB,kBAAkB,EAAE,mBAAmB"}
|
|
@@ -15,7 +15,8 @@ const ProfileSchema = v.object({
|
|
|
15
15
|
createdAt: v.pipe(v.optional(TimestampSchema), v.transform((v) => v ? tsObjToMs(v) : void 0)),
|
|
16
16
|
nextUsernameChangeAt: v.pipe(v.optional(TimestampSchema), v.transform((v) => v ? tsObjToMs(v) : void 0)),
|
|
17
17
|
vipTier: v.number(),
|
|
18
|
-
usernameUnlocked: v.optional(v.boolean(), false)
|
|
18
|
+
usernameUnlocked: v.optional(v.boolean(), false),
|
|
19
|
+
currentTermsAccepted: v.optional(v.boolean(), false)
|
|
19
20
|
});
|
|
20
21
|
const UpdateProfileInputSchema = v.object({
|
|
21
22
|
username: v.optional(v.string()),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.schemas.js","names":[],"sources":["../../../../src/services/auth/profile/profile.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport {\n OptionalTimestampMsSchema,\n PublicIdSchema,\n TimestampSchema,\n} from \"../../../shared/schemas.js\";\nimport { PROTOBUF_UINT32_MAX } from \"../../../shared/wire-bounds.js\";\nimport { tsObjToMs } from \"../../../utils/time.js\";\n\nexport const ProfileSchema = v.object({\n username: v.string(),\n bio: v.string(),\n website: v.string(),\n twitter: v.string(),\n twitterVerified: v.optional(v.boolean(), false),\n discord: v.string(),\n discordVerified: v.optional(v.boolean(), false),\n avatarUrl: v.string(),\n createdAt: v.pipe(\n v.optional(TimestampSchema),\n v.transform((v) => (v ? tsObjToMs(v) : undefined)),\n ),\n nextUsernameChangeAt: v.pipe(\n v.optional(TimestampSchema),\n v.transform((v) => (v ? tsObjToMs(v) : undefined)),\n ),\n vipTier: v.number(),\n usernameUnlocked: v.optional(v.boolean(), false),\n});\n\nexport type Profile = v.InferOutput<typeof ProfileSchema>;\n// Deliberately non-strict: update() accepts a round-tripped Profile\n// ({ ...profile, bio }) and strips its readonly fields instead of rejecting.\nexport const UpdateProfileInputSchema = v.object({\n username: v.optional(v.string()),\n bio: v.optional(v.string()),\n website: v.optional(v.string()),\n twitter: v.optional(v.string()),\n avatarUrl: v.optional(v.string()),\n});\nexport type UpdateProfileInput = v.InferInput<typeof UpdateProfileInputSchema>;\n\nexport const UsernameHistoryEntrySchema = v.object({\n username: v.string(),\n setAt: v.pipe(\n v.optional(TimestampSchema),\n v.transform((v) => (v ? tsObjToMs(v) : undefined)),\n ),\n});\n\nexport type UsernameHistoryEntry = v.InferOutput<typeof UsernameHistoryEntrySchema>;\n\nexport const GeneratedUsernameOfferSchema = v.object({\n usernames: v.array(v.string()),\n offerToken: v.pipe(v.string(), v.minLength(1)),\n expiresAt: OptionalTimestampMsSchema,\n});\n\nexport type GeneratedUsernameOffer = v.InferOutput<typeof GeneratedUsernameOfferSchema>;\n\nexport const ClaimGeneratedUsernameInputSchema = v.strictObject({\n offerToken: v.pipe(v.string(), v.minLength(1)),\n optionIndex: v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(PROTOBUF_UINT32_MAX)),\n});\n\nexport type ClaimGeneratedUsernameInput = v.InferInput<typeof ClaimGeneratedUsernameInputSchema>;\n\nexport const AccountIdentitySchema = v.object({\n accountId: PublicIdSchema,\n username: v.optional(v.string()),\n avatarUrl: v.optional(v.string()),\n rootSmartAccountAddress: v.string(),\n});\n\nexport type AccountIdentity = v.InferOutput<typeof AccountIdentitySchema>;\n"],"mappings":";;;;;AASA,MAAa,gBAAgB,EAAE,OAAO;CAClC,UAAU,EAAE,OAAO;CACnB,KAAK,EAAE,OAAO;CACd,SAAS,EAAE,OAAO;CAClB,SAAS,EAAE,OAAO;CAClB,iBAAiB,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;CAC9C,SAAS,EAAE,OAAO;CAClB,iBAAiB,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;CAC9C,WAAW,EAAE,OAAO;CACpB,WAAW,EAAE,KACT,EAAE,SAAS,eAAe,GAC1B,EAAE,WAAW,MAAO,IAAI,UAAU,CAAC,IAAI,KAAA,CAAU,CACrD;CACA,sBAAsB,EAAE,KACpB,EAAE,SAAS,eAAe,GAC1B,EAAE,WAAW,MAAO,IAAI,UAAU,CAAC,IAAI,KAAA,CAAU,CACrD;CACA,SAAS,EAAE,OAAO;CAClB,kBAAkB,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;
|
|
1
|
+
{"version":3,"file":"profile.schemas.js","names":[],"sources":["../../../../src/services/auth/profile/profile.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport {\n OptionalTimestampMsSchema,\n PublicIdSchema,\n TimestampSchema,\n} from \"../../../shared/schemas.js\";\nimport { PROTOBUF_UINT32_MAX } from \"../../../shared/wire-bounds.js\";\nimport { tsObjToMs } from \"../../../utils/time.js\";\n\nexport const ProfileSchema = v.object({\n username: v.string(),\n bio: v.string(),\n website: v.string(),\n twitter: v.string(),\n twitterVerified: v.optional(v.boolean(), false),\n discord: v.string(),\n discordVerified: v.optional(v.boolean(), false),\n avatarUrl: v.string(),\n createdAt: v.pipe(\n v.optional(TimestampSchema),\n v.transform((v) => (v ? tsObjToMs(v) : undefined)),\n ),\n nextUsernameChangeAt: v.pipe(\n v.optional(TimestampSchema),\n v.transform((v) => (v ? tsObjToMs(v) : undefined)),\n ),\n vipTier: v.number(),\n usernameUnlocked: v.optional(v.boolean(), false),\n currentTermsAccepted: v.optional(v.boolean(), false),\n});\n\nexport type Profile = v.InferOutput<typeof ProfileSchema>;\n// Deliberately non-strict: update() accepts a round-tripped Profile\n// ({ ...profile, bio }) and strips its readonly fields instead of rejecting.\nexport const UpdateProfileInputSchema = v.object({\n username: v.optional(v.string()),\n bio: v.optional(v.string()),\n website: v.optional(v.string()),\n twitter: v.optional(v.string()),\n avatarUrl: v.optional(v.string()),\n});\nexport type UpdateProfileInput = v.InferInput<typeof UpdateProfileInputSchema>;\n\nexport const UsernameHistoryEntrySchema = v.object({\n username: v.string(),\n setAt: v.pipe(\n v.optional(TimestampSchema),\n v.transform((v) => (v ? tsObjToMs(v) : undefined)),\n ),\n});\n\nexport type UsernameHistoryEntry = v.InferOutput<typeof UsernameHistoryEntrySchema>;\n\nexport const GeneratedUsernameOfferSchema = v.object({\n usernames: v.array(v.string()),\n offerToken: v.pipe(v.string(), v.minLength(1)),\n expiresAt: OptionalTimestampMsSchema,\n});\n\nexport type GeneratedUsernameOffer = v.InferOutput<typeof GeneratedUsernameOfferSchema>;\n\nexport const ClaimGeneratedUsernameInputSchema = v.strictObject({\n offerToken: v.pipe(v.string(), v.minLength(1)),\n optionIndex: v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(PROTOBUF_UINT32_MAX)),\n});\n\nexport type ClaimGeneratedUsernameInput = v.InferInput<typeof ClaimGeneratedUsernameInputSchema>;\n\nexport const AccountIdentitySchema = v.object({\n accountId: PublicIdSchema,\n username: v.optional(v.string()),\n avatarUrl: v.optional(v.string()),\n rootSmartAccountAddress: v.string(),\n});\n\nexport type AccountIdentity = v.InferOutput<typeof AccountIdentitySchema>;\n"],"mappings":";;;;;AASA,MAAa,gBAAgB,EAAE,OAAO;CAClC,UAAU,EAAE,OAAO;CACnB,KAAK,EAAE,OAAO;CACd,SAAS,EAAE,OAAO;CAClB,SAAS,EAAE,OAAO;CAClB,iBAAiB,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;CAC9C,SAAS,EAAE,OAAO;CAClB,iBAAiB,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;CAC9C,WAAW,EAAE,OAAO;CACpB,WAAW,EAAE,KACT,EAAE,SAAS,eAAe,GAC1B,EAAE,WAAW,MAAO,IAAI,UAAU,CAAC,IAAI,KAAA,CAAU,CACrD;CACA,sBAAsB,EAAE,KACpB,EAAE,SAAS,eAAe,GAC1B,EAAE,WAAW,MAAO,IAAI,UAAU,CAAC,IAAI,KAAA,CAAU,CACrD;CACA,SAAS,EAAE,OAAO;CAClB,kBAAkB,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;CAC/C,sBAAsB,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;AACvD,CAAC;AAKD,MAAa,2BAA2B,EAAE,OAAO;CAC7C,UAAU,EAAE,SAAS,EAAE,OAAO,CAAC;CAC/B,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC;CAC1B,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC;CAC9B,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC;CAC9B,WAAW,EAAE,SAAS,EAAE,OAAO,CAAC;AACpC,CAAC;AAGD,MAAa,6BAA6B,EAAE,OAAO;CAC/C,UAAU,EAAE,OAAO;CACnB,OAAO,EAAE,KACL,EAAE,SAAS,eAAe,GAC1B,EAAE,WAAW,MAAO,IAAI,UAAU,CAAC,IAAI,KAAA,CAAU,CACrD;AACJ,CAAC;AAID,MAAa,+BAA+B,EAAE,OAAO;CACjD,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC;CAC7B,YAAY,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,UAAU,CAAC,CAAC;CAC7C,WAAW;AACf,CAAC;AAID,MAAa,oCAAoC,EAAE,aAAa;CAC5D,YAAY,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,UAAU,CAAC,CAAC;CAC7C,aAAa,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,QAAQ,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,SAAS,mBAAmB,CAAC;AAC/F,CAAC;AAID,MAAa,wBAAwB,EAAE,OAAO;CAC1C,WAAW;CACX,UAAU,EAAE,SAAS,EAAE,OAAO,CAAC;CAC/B,WAAW,EAAE,SAAS,EAAE,OAAO,CAAC;CAChC,yBAAyB,EAAE,OAAO;AACtC,CAAC"}
|
|
@@ -18,6 +18,7 @@ declare function createCandleRowSchema(scales: SdkScales): v.SchemaWithPipe<read
|
|
|
18
18
|
readonly low: v.BigintSchema<undefined>;
|
|
19
19
|
readonly close: v.BigintSchema<undefined>;
|
|
20
20
|
readonly volume: v.BigintSchema<undefined>;
|
|
21
|
+
readonly quoteVolume: v.StringSchema<undefined>;
|
|
21
22
|
readonly isClosed: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
22
23
|
}, undefined>, v.TransformAction<{
|
|
23
24
|
symbolId: number;
|
|
@@ -28,6 +29,7 @@ declare function createCandleRowSchema(scales: SdkScales): v.SchemaWithPipe<read
|
|
|
28
29
|
low: bigint;
|
|
29
30
|
close: bigint;
|
|
30
31
|
volume: bigint;
|
|
32
|
+
quoteVolume: string;
|
|
31
33
|
isClosed: boolean;
|
|
32
34
|
}, {
|
|
33
35
|
symbolId: number;
|
|
@@ -38,6 +40,7 @@ declare function createCandleRowSchema(scales: SdkScales): v.SchemaWithPipe<read
|
|
|
38
40
|
low: string;
|
|
39
41
|
close: string;
|
|
40
42
|
volume: string;
|
|
43
|
+
quoteVolume: string;
|
|
41
44
|
isClosed: boolean;
|
|
42
45
|
}>]>;
|
|
43
46
|
declare const createCandleRowIntSchema: typeof createCandleRowSchema;
|
|
@@ -50,6 +53,7 @@ declare function createCandleColumnarSchema(scales: SdkScales): v.SchemaWithPipe
|
|
|
50
53
|
readonly low: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
|
|
51
54
|
readonly close: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
|
|
52
55
|
readonly volume: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
|
|
56
|
+
readonly quoteVolume: v.ArraySchema<v.StringSchema<undefined>, undefined>;
|
|
53
57
|
readonly referenceTsSec: v.OptionalSchema<v.ArraySchema<v.BigintSchema<undefined>, undefined>, readonly []>;
|
|
54
58
|
readonly referenceOpen: v.OptionalSchema<v.ArraySchema<v.BigintSchema<undefined>, undefined>, readonly []>;
|
|
55
59
|
readonly referenceHigh: v.OptionalSchema<v.ArraySchema<v.BigintSchema<undefined>, undefined>, readonly []>;
|
|
@@ -66,6 +70,7 @@ declare function createCandleColumnarSchema(scales: SdkScales): v.SchemaWithPipe
|
|
|
66
70
|
low: bigint[];
|
|
67
71
|
close: bigint[];
|
|
68
72
|
volume: bigint[];
|
|
73
|
+
quoteVolume: string[];
|
|
69
74
|
referenceTsSec: bigint[];
|
|
70
75
|
referenceOpen: bigint[];
|
|
71
76
|
referenceHigh: bigint[];
|
|
@@ -82,6 +87,7 @@ declare function createCandleColumnarSchema(scales: SdkScales): v.SchemaWithPipe
|
|
|
82
87
|
low: string[];
|
|
83
88
|
close: string[];
|
|
84
89
|
volume: string[];
|
|
90
|
+
quoteVolume: string[];
|
|
85
91
|
nextPageToken: string;
|
|
86
92
|
reference: {
|
|
87
93
|
time: number[];
|
|
@@ -101,6 +107,7 @@ declare function createCandleColumnarIntSchema(scales: SdkScales): v.SchemaWithP
|
|
|
101
107
|
readonly low: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
|
|
102
108
|
readonly close: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
|
|
103
109
|
readonly volume: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
|
|
110
|
+
readonly quoteVolume: v.ArraySchema<v.StringSchema<undefined>, undefined>;
|
|
104
111
|
readonly referenceTsSec: v.OptionalSchema<v.ArraySchema<v.BigintSchema<undefined>, undefined>, readonly []>;
|
|
105
112
|
readonly referenceOpen: v.OptionalSchema<v.ArraySchema<v.BigintSchema<undefined>, undefined>, readonly []>;
|
|
106
113
|
readonly referenceHigh: v.OptionalSchema<v.ArraySchema<v.BigintSchema<undefined>, undefined>, readonly []>;
|
|
@@ -117,6 +124,7 @@ declare function createCandleColumnarIntSchema(scales: SdkScales): v.SchemaWithP
|
|
|
117
124
|
low: bigint[];
|
|
118
125
|
close: bigint[];
|
|
119
126
|
volume: bigint[];
|
|
127
|
+
quoteVolume: string[];
|
|
120
128
|
referenceTsSec: bigint[];
|
|
121
129
|
referenceOpen: bigint[];
|
|
122
130
|
referenceHigh: bigint[];
|
|
@@ -133,6 +141,7 @@ declare function createCandleColumnarIntSchema(scales: SdkScales): v.SchemaWithP
|
|
|
133
141
|
low: string[];
|
|
134
142
|
close: string[];
|
|
135
143
|
volume: string[];
|
|
144
|
+
quoteVolume: string[];
|
|
136
145
|
nextPageToken: string;
|
|
137
146
|
reference: {
|
|
138
147
|
tsSec: number[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"candles.schemas.d.ts","names":[],"sources":["../../../src/services/candles/candles.schemas.ts"],"mappings":";;;;;cASa,iBAAe,EAAA;KAEhB,YAAY,EAAE,mBAAmB;KAsBxC;EAAkB;EAAiB;;
|
|
1
|
+
{"version":3,"file":"candles.schemas.d.ts","names":[],"sources":["../../../src/services/candles/candles.schemas.ts"],"mappings":";;;;;cASa,iBAAe,EAAA;KAEhB,YAAY,EAAE,mBAAmB;KAsBxC;EAAkB;EAAiB;;iBAsBxB,sBAAsB,QAAQ,YAAS,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAqB1C,iCAAwB;iBAuCrB,2BAA2B,QAAQ,YAAS,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkC5C,8BAA8B,QAAQ,YAAS,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkCnD,SAAS,EAAE,YAAY,kBAAkB;KAGzC,YAAY,EAAE,YAAY,kBAAkB;KAC5C,iBAAiB,EAAE,YAAY,kBAAkB;KAGjD,oBAAoB,EAAE,YAAY,kBAAkB;iBAyBhD,gCAA4B,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAIhC,kBAAkB,EAAE,WAAW,kBAAkB;KAEjD,yBAAyB,EAAE,WAAW,kBAAkB"}
|
|
@@ -28,6 +28,7 @@ const CandleRowRawSchema = v.object({
|
|
|
28
28
|
low: v.bigint(),
|
|
29
29
|
close: v.bigint(),
|
|
30
30
|
volume: v.bigint(),
|
|
31
|
+
quoteVolume: v.string(),
|
|
31
32
|
isClosed: v.optional(v.boolean(), false)
|
|
32
33
|
});
|
|
33
34
|
function createCandleRowSchema(scales) {
|
|
@@ -42,6 +43,7 @@ function createCandleRowSchema(scales) {
|
|
|
42
43
|
low: scaledToDecimalOutput(data.low, priceScale),
|
|
43
44
|
close: scaledToDecimalOutput(data.close, priceScale),
|
|
44
45
|
volume: scaledToDecimalOutput(data.volume, scales.baseQty(data.symbolId)),
|
|
46
|
+
quoteVolume: data.quoteVolume,
|
|
45
47
|
isClosed: data.isClosed
|
|
46
48
|
};
|
|
47
49
|
}));
|
|
@@ -54,6 +56,7 @@ const CandlePointSchema = v.object({
|
|
|
54
56
|
low: v.bigint(),
|
|
55
57
|
close: v.bigint(),
|
|
56
58
|
volume: v.bigint(),
|
|
59
|
+
quoteVolume: v.string(),
|
|
57
60
|
isClosed: v.optional(v.boolean(), false)
|
|
58
61
|
});
|
|
59
62
|
const CandleColumnarRawSchema = v.object({
|
|
@@ -65,6 +68,7 @@ const CandleColumnarRawSchema = v.object({
|
|
|
65
68
|
low: v.array(v.bigint()),
|
|
66
69
|
close: v.array(v.bigint()),
|
|
67
70
|
volume: v.array(v.bigint()),
|
|
71
|
+
quoteVolume: v.array(v.string()),
|
|
68
72
|
referenceTsSec: v.optional(v.array(v.bigint()), []),
|
|
69
73
|
referenceOpen: v.optional(v.array(v.bigint()), []),
|
|
70
74
|
referenceHigh: v.optional(v.array(v.bigint()), []),
|
|
@@ -91,6 +95,7 @@ function createCandleColumnarSchema(scales) {
|
|
|
91
95
|
low: scaledArrayToDecimal(d.low, priceScale),
|
|
92
96
|
close: scaledArrayToDecimal(d.close, priceScale),
|
|
93
97
|
volume: scaledArrayToDecimal(d.volume, volumeScale),
|
|
98
|
+
quoteVolume: d.quoteVolume,
|
|
94
99
|
nextPageToken: d.nextPageToken,
|
|
95
100
|
reference: hasReference ? {
|
|
96
101
|
time: referenceTsSec.map((t) => Number(t)),
|
|
@@ -117,6 +122,7 @@ function createCandleColumnarIntSchema(scales) {
|
|
|
117
122
|
low: scaledArrayToDecimal(d.low, priceScale),
|
|
118
123
|
close: scaledArrayToDecimal(d.close, priceScale),
|
|
119
124
|
volume: scaledArrayToDecimal(d.volume, volumeScale),
|
|
125
|
+
quoteVolume: d.quoteVolume,
|
|
120
126
|
nextPageToken: d.nextPageToken,
|
|
121
127
|
reference: referenceTsSec.length > 0 ? {
|
|
122
128
|
tsSec: referenceTsSec.map((t) => Number(t)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"candles.schemas.js","names":["Proto.Timeframe"],"sources":["../../../src/services/candles/candles.schemas.ts"],"sourcesContent":["import * as Proto from \"../../gen/marketdata/v1/marketdata_pb.js\";\nimport { SymbolIdInputSchema } from \"../shared.js\";\nimport * as v from \"valibot\";\nimport type { DecodedEnum } from \"../../utils/types.js\";\nimport { OptionalTimestampSecondsInputSchema } from \"../../shared/schemas.js\";\nimport { requiredEnumLabel } from \"../../shared/proto-enum-codec.js\";\nimport { scaledToDecimalOutput, type SdkScales } from \"../../shared/decimal-surface.js\";\nimport { TIMEFRAMES, TimeframeCodec } from \"./candles.codecs.js\";\n\nexport const TimeframeSchema = v.picklist(TIMEFRAMES);\n\nexport type Timeframe = v.InferOutput<typeof TimeframeSchema>;\n\nfunction timeframeFromProto(value: Proto.Timeframe, schemaName: string): DecodedEnum<Timeframe> {\n return requiredEnumLabel(\n TimeframeCodec.protoToOutput,\n value,\n `CandlesService.${schemaName}`,\n \"timeframe\",\n );\n}\n\nconst TimeframeInputSchema = v.pipe(\n TimeframeSchema,\n v.transform((value) => TimeframeCodec.inputToProto[value]),\n);\n\nconst OptionalPositiveNumberSchema = v.optional(\n v.pipe(v.number(), v.integer(), v.gtValue(0), v.maxValue(10_000)),\n);\n\nconst OptionalBooleanSchema = v.optional(v.boolean(), false);\n\ntype TimestampInit = { seconds: bigint; nanos: number };\n\nfunction timestampFromTsSec(tsSec: bigint): TimestampInit {\n return { seconds: tsSec, nanos: 0 };\n}\n\nconst CandleRowRawSchema = v.object({\n symbolId: v.number(),\n timeframe: v.pipe(\n v.enum(Proto.Timeframe),\n v.transform((v) => timeframeFromProto(v, \"CandleRowSchema\")),\n ),\n tsSec: v.bigint(),\n open: v.bigint(),\n high: v.bigint(),\n low: v.bigint(),\n close: v.bigint(),\n volume: v.bigint(),\n isClosed: v.optional(v.boolean(), false),\n});\n\nexport function createCandleRowSchema(scales: SdkScales) {\n return v.pipe(\n CandleRowRawSchema,\n v.transform((data) => {\n const priceScale = scales.price();\n return {\n symbolId: data.symbolId,\n timeframe: data.timeframe,\n time: Number(data.tsSec),\n open: scaledToDecimalOutput(data.open, priceScale),\n high: scaledToDecimalOutput(data.high, priceScale),\n low: scaledToDecimalOutput(data.low, priceScale),\n close: scaledToDecimalOutput(data.close, priceScale),\n volume: scaledToDecimalOutput(data.volume, scales.baseQty(data.symbolId)),\n isClosed: data.isClosed,\n };\n }),\n );\n}\n\nexport const createCandleRowIntSchema = createCandleRowSchema;\n\nexport const CandlePointSchema = v.object({\n tsSec: v.bigint(),\n open: v.bigint(),\n high: v.bigint(),\n low: v.bigint(),\n close: v.bigint(),\n volume: v.bigint(),\n isClosed: v.optional(v.boolean(), false),\n});\n\nconst CandleColumnarRawSchema = v.object({\n symbolId: v.number(),\n timeframe: v.pipe(\n v.enum(Proto.Timeframe),\n v.transform((v) => timeframeFromProto(v, \"CandleColumnarSchema\")),\n ),\n tsSec: v.array(v.bigint()),\n open: v.array(v.bigint()),\n high: v.array(v.bigint()),\n low: v.array(v.bigint()),\n close: v.array(v.bigint()),\n volume: v.array(v.bigint()),\n referenceTsSec: v.optional(v.array(v.bigint()), []),\n referenceOpen: v.optional(v.array(v.bigint()), []),\n referenceHigh: v.optional(v.array(v.bigint()), []),\n referenceLow: v.optional(v.array(v.bigint()), []),\n referenceClose: v.optional(v.array(v.bigint()), []),\n referenceVolume: v.optional(v.array(v.bigint()), []),\n nextPageToken: v.optional(v.string(), \"\"),\n});\n\nfunction scaledArrayToDecimal(values: bigint[], scale: number): string[] {\n return values.map((value) => scaledToDecimalOutput(value, scale));\n}\n\nexport function createCandleColumnarSchema(scales: SdkScales) {\n return v.pipe(\n CandleColumnarRawSchema,\n v.transform((d) => {\n const priceScale = scales.price();\n const volumeScale = scales.baseQty(d.symbolId);\n const referenceTsSec = d.referenceTsSec ?? [];\n const hasReference = referenceTsSec.length > 0;\n return {\n symbolId: d.symbolId,\n timeframe: d.timeframe,\n time: d.tsSec.map((t) => Number(t)),\n open: scaledArrayToDecimal(d.open, priceScale),\n high: scaledArrayToDecimal(d.high, priceScale),\n low: scaledArrayToDecimal(d.low, priceScale),\n close: scaledArrayToDecimal(d.close, priceScale),\n volume: scaledArrayToDecimal(d.volume, volumeScale),\n nextPageToken: d.nextPageToken,\n reference: hasReference\n ? {\n time: referenceTsSec.map((t) => Number(t)),\n open: scaledArrayToDecimal(d.referenceOpen ?? [], priceScale),\n high: scaledArrayToDecimal(d.referenceHigh ?? [], priceScale),\n low: scaledArrayToDecimal(d.referenceLow ?? [], priceScale),\n close: scaledArrayToDecimal(d.referenceClose ?? [], priceScale),\n volume: scaledArrayToDecimal(d.referenceVolume ?? [], volumeScale),\n }\n : null,\n };\n }),\n );\n}\n\nexport function createCandleColumnarIntSchema(scales: SdkScales) {\n return v.pipe(\n CandleColumnarRawSchema,\n v.transform((d) => {\n const priceScale = scales.price();\n const volumeScale = scales.baseQty(d.symbolId);\n const referenceTsSec = d.referenceTsSec ?? [];\n return {\n symbolId: d.symbolId,\n timeframe: d.timeframe,\n tsSec: d.tsSec.map((t) => Number(t)),\n open: scaledArrayToDecimal(d.open, priceScale),\n high: scaledArrayToDecimal(d.high, priceScale),\n low: scaledArrayToDecimal(d.low, priceScale),\n close: scaledArrayToDecimal(d.close, priceScale),\n volume: scaledArrayToDecimal(d.volume, volumeScale),\n nextPageToken: d.nextPageToken,\n reference:\n referenceTsSec.length > 0\n ? {\n tsSec: referenceTsSec.map((t) => Number(t)),\n open: scaledArrayToDecimal(d.referenceOpen ?? [], priceScale),\n high: scaledArrayToDecimal(d.referenceHigh ?? [], priceScale),\n low: scaledArrayToDecimal(d.referenceLow ?? [], priceScale),\n close: scaledArrayToDecimal(d.referenceClose ?? [], priceScale),\n volume: scaledArrayToDecimal(d.referenceVolume ?? [], volumeScale),\n }\n : null,\n };\n }),\n );\n}\n\nexport type Candle = v.InferOutput<ReturnType<typeof createCandleRowSchema>>;\nexport type CandleInput = v.InferInput<ReturnType<typeof createCandleRowSchema>>;\nexport type CandleIntInput = v.InferInput<ReturnType<typeof createCandleRowIntSchema>>;\nexport type CandleInt = v.InferOutput<ReturnType<typeof createCandleRowIntSchema>>;\nexport type CandleColumnar = v.InferOutput<ReturnType<typeof createCandleColumnarSchema>>;\nexport type CandleColumnarInput = v.InferInput<ReturnType<typeof createCandleColumnarSchema>>;\nexport type CandleColumnarIntInput = v.InferInput<ReturnType<typeof createCandleColumnarIntSchema>>;\nexport type CandleColumnarInt = v.InferOutput<ReturnType<typeof createCandleColumnarIntSchema>>;\n\nexport const ListCandlesInputSchema = v.pipe(\n v.object({\n symbolId: SymbolIdInputSchema,\n timeframe: TimeframeInputSchema,\n limit: OptionalPositiveNumberSchema,\n includeIncomplete: v.optional(v.boolean(), false),\n includeReference: OptionalBooleanSchema,\n startTsSec: OptionalTimestampSecondsInputSchema,\n endTsSec: OptionalTimestampSecondsInputSchema,\n pageToken: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n }),\n v.transform((d) => ({\n symbolId: d.symbolId,\n timeframe: d.timeframe,\n limit: d.limit,\n includeIncomplete: d.includeIncomplete,\n includeReference: d.includeReference,\n startTime: d.startTsSec != null ? timestampFromTsSec(d.startTsSec) : undefined,\n endTime: d.endTsSec != null ? timestampFromTsSec(d.endTsSec) : undefined,\n pageToken: d.pageToken,\n })),\n);\n\nexport function createListCandlesInputSchema() {\n return ListCandlesInputSchema;\n}\n\nexport type GetCandlesInput = v.InferInput<ReturnType<typeof createListCandlesInputSchema>>;\nexport const createGetCandlesColumnsInputSchema = createListCandlesInputSchema;\nexport type GetCandlesColumnsInput = v.InferInput<ReturnType<typeof createListCandlesInputSchema>>;\n"],"mappings":";;;;;;;;AASA,MAAa,kBAAkB,EAAE,SAAS,UAAU;AAIpD,SAAS,mBAAmB,OAAwB,YAA4C;CAC5F,OAAO,kBACH,eAAe,eACf,OACA,kBAAkB,cAClB,WACJ;AACJ;AAEA,MAAM,uBAAuB,EAAE,KAC3B,iBACA,EAAE,WAAW,UAAU,eAAe,aAAa,MAAM,CAC7D;AAEA,MAAM,+BAA+B,EAAE,SACnC,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,QAAQ,GAAG,EAAE,QAAQ,CAAC,GAAG,EAAE,SAAS,GAAM,CAAC,CACpE;AAEA,MAAM,wBAAwB,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;AAI3D,SAAS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AU;IAC5D,MAAM,qBAAqB,EAAE,iBAAiB,CAAC,GAAG,UAAU;IAC5D,KAAK,qBAAqB,EAAE,gBAAgB,CAAC,GAAG,UAAU;IAC1D,OAAO,qBAAqB,EAAE,kBAAkB,CAAC,GAAG,UAAU;IAC9D,QAAQ,qBAAqB,EAAE,mBAAmB,CAAC,GAAG,WAAW;GACrE,IACA;EACd;CACJ,CAAC,CACL;AACJ;AAWA,MAAa,yBAAyB,EAAE,KACpC,EAAE,OAAO;CACL,UAAU;CACV,WAAW;CACX,OAAO;CACP,mBAAmB,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;CAChD,kBAAkB;CAClB,YAAY;CACZ,UAAU;CACV,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE;AAC1D,CAAC,GACD,EAAE,WAAW,OAAO;CAChB,UAAU,EAAE;CACZ,WAAW,EAAE;CACb,OAAO,EAAE;CACT,mBAAmB,EAAE;CACrB,kBAAkB,EAAE;CACpB,WAAW,EAAE,cAAc,OAAO,mBAAmB,EAAE,UAAU,IAAI,KAAA;CACrE,SAAS,EAAE,YAAY,OAAO,mBAAmB,EAAE,QAAQ,IAAI,KAAA;CAC/D,WAAW,EAAE;AACjB,EAAE,CACN"}
|
|
1
|
+
{"version":3,"file":"candles.schemas.js","names":["Proto.Timeframe"],"sources":["../../../src/services/candles/candles.schemas.ts"],"sourcesContent":["import * as Proto from \"../../gen/marketdata/v1/marketdata_pb.js\";\nimport { SymbolIdInputSchema } from \"../shared.js\";\nimport * as v from \"valibot\";\nimport type { DecodedEnum } from \"../../utils/types.js\";\nimport { OptionalTimestampSecondsInputSchema } from \"../../shared/schemas.js\";\nimport { requiredEnumLabel } from \"../../shared/proto-enum-codec.js\";\nimport { scaledToDecimalOutput, type SdkScales } from \"../../shared/decimal-surface.js\";\nimport { TIMEFRAMES, TimeframeCodec } from \"./candles.codecs.js\";\n\nexport const TimeframeSchema = v.picklist(TIMEFRAMES);\n\nexport type Timeframe = v.InferOutput<typeof TimeframeSchema>;\n\nfunction timeframeFromProto(value: Proto.Timeframe, schemaName: string): DecodedEnum<Timeframe> {\n return requiredEnumLabel(\n TimeframeCodec.protoToOutput,\n value,\n `CandlesService.${schemaName}`,\n \"timeframe\",\n );\n}\n\nconst TimeframeInputSchema = v.pipe(\n TimeframeSchema,\n v.transform((value) => TimeframeCodec.inputToProto[value]),\n);\n\nconst OptionalPositiveNumberSchema = v.optional(\n v.pipe(v.number(), v.integer(), v.gtValue(0), v.maxValue(10_000)),\n);\n\nconst OptionalBooleanSchema = v.optional(v.boolean(), false);\n\ntype TimestampInit = { seconds: bigint; nanos: number };\n\nfunction timestampFromTsSec(tsSec: bigint): TimestampInit {\n return { seconds: tsSec, nanos: 0 };\n}\n\nconst CandleRowRawSchema = v.object({\n symbolId: v.number(),\n timeframe: v.pipe(\n v.enum(Proto.Timeframe),\n v.transform((v) => timeframeFromProto(v, \"CandleRowSchema\")),\n ),\n tsSec: v.bigint(),\n open: v.bigint(),\n high: v.bigint(),\n low: v.bigint(),\n close: v.bigint(),\n volume: v.bigint(),\n quoteVolume: v.string(),\n isClosed: v.optional(v.boolean(), false),\n});\n\nexport function createCandleRowSchema(scales: SdkScales) {\n return v.pipe(\n CandleRowRawSchema,\n v.transform((data) => {\n const priceScale = scales.price();\n return {\n symbolId: data.symbolId,\n timeframe: data.timeframe,\n time: Number(data.tsSec),\n open: scaledToDecimalOutput(data.open, priceScale),\n high: scaledToDecimalOutput(data.high, priceScale),\n low: scaledToDecimalOutput(data.low, priceScale),\n close: scaledToDecimalOutput(data.close, priceScale),\n volume: scaledToDecimalOutput(data.volume, scales.baseQty(data.symbolId)),\n quoteVolume: data.quoteVolume,\n isClosed: data.isClosed,\n };\n }),\n );\n}\n\nexport const createCandleRowIntSchema = createCandleRowSchema;\n\nexport const CandlePointSchema = v.object({\n tsSec: v.bigint(),\n open: v.bigint(),\n high: v.bigint(),\n low: v.bigint(),\n close: v.bigint(),\n volume: v.bigint(),\n quoteVolume: v.string(),\n isClosed: v.optional(v.boolean(), false),\n});\n\nconst CandleColumnarRawSchema = v.object({\n symbolId: v.number(),\n timeframe: v.pipe(\n v.enum(Proto.Timeframe),\n v.transform((v) => timeframeFromProto(v, \"CandleColumnarSchema\")),\n ),\n tsSec: v.array(v.bigint()),\n open: v.array(v.bigint()),\n high: v.array(v.bigint()),\n low: v.array(v.bigint()),\n close: v.array(v.bigint()),\n volume: v.array(v.bigint()),\n quoteVolume: v.array(v.string()),\n referenceTsSec: v.optional(v.array(v.bigint()), []),\n referenceOpen: v.optional(v.array(v.bigint()), []),\n referenceHigh: v.optional(v.array(v.bigint()), []),\n referenceLow: v.optional(v.array(v.bigint()), []),\n referenceClose: v.optional(v.array(v.bigint()), []),\n referenceVolume: v.optional(v.array(v.bigint()), []),\n nextPageToken: v.optional(v.string(), \"\"),\n});\n\nfunction scaledArrayToDecimal(values: bigint[], scale: number): string[] {\n return values.map((value) => scaledToDecimalOutput(value, scale));\n}\n\nexport function createCandleColumnarSchema(scales: SdkScales) {\n return v.pipe(\n CandleColumnarRawSchema,\n v.transform((d) => {\n const priceScale = scales.price();\n const volumeScale = scales.baseQty(d.symbolId);\n const referenceTsSec = d.referenceTsSec ?? [];\n const hasReference = referenceTsSec.length > 0;\n return {\n symbolId: d.symbolId,\n timeframe: d.timeframe,\n time: d.tsSec.map((t) => Number(t)),\n open: scaledArrayToDecimal(d.open, priceScale),\n high: scaledArrayToDecimal(d.high, priceScale),\n low: scaledArrayToDecimal(d.low, priceScale),\n close: scaledArrayToDecimal(d.close, priceScale),\n volume: scaledArrayToDecimal(d.volume, volumeScale),\n quoteVolume: d.quoteVolume,\n nextPageToken: d.nextPageToken,\n reference: hasReference\n ? {\n time: referenceTsSec.map((t) => Number(t)),\n open: scaledArrayToDecimal(d.referenceOpen ?? [], priceScale),\n high: scaledArrayToDecimal(d.referenceHigh ?? [], priceScale),\n low: scaledArrayToDecimal(d.referenceLow ?? [], priceScale),\n close: scaledArrayToDecimal(d.referenceClose ?? [], priceScale),\n volume: scaledArrayToDecimal(d.referenceVolume ?? [], volumeScale),\n }\n : null,\n };\n }),\n );\n}\n\nexport function createCandleColumnarIntSchema(scales: SdkScales) {\n return v.pipe(\n CandleColumnarRawSchema,\n v.transform((d) => {\n const priceScale = scales.price();\n const volumeScale = scales.baseQty(d.symbolId);\n const referenceTsSec = d.referenceTsSec ?? [];\n return {\n symbolId: d.symbolId,\n timeframe: d.timeframe,\n tsSec: d.tsSec.map((t) => Number(t)),\n open: scaledArrayToDecimal(d.open, priceScale),\n high: scaledArrayToDecimal(d.high, priceScale),\n low: scaledArrayToDecimal(d.low, priceScale),\n close: scaledArrayToDecimal(d.close, priceScale),\n volume: scaledArrayToDecimal(d.volume, volumeScale),\n quoteVolume: d.quoteVolume,\n nextPageToken: d.nextPageToken,\n reference:\n referenceTsSec.length > 0\n ? {\n tsSec: referenceTsSec.map((t) => Number(t)),\n open: scaledArrayToDecimal(d.referenceOpen ?? [], priceScale),\n high: scaledArrayToDecimal(d.referenceHigh ?? [], priceScale),\n low: scaledArrayToDecimal(d.referenceLow ?? [], priceScale),\n close: scaledArrayToDecimal(d.referenceClose ?? [], priceScale),\n volume: scaledArrayToDecimal(d.referenceVolume ?? [], volumeScale),\n }\n : null,\n };\n }),\n );\n}\n\nexport type Candle = v.InferOutput<ReturnType<typeof createCandleRowSchema>>;\nexport type CandleInput = v.InferInput<ReturnType<typeof createCandleRowSchema>>;\nexport type CandleIntInput = v.InferInput<ReturnType<typeof createCandleRowIntSchema>>;\nexport type CandleInt = v.InferOutput<ReturnType<typeof createCandleRowIntSchema>>;\nexport type CandleColumnar = v.InferOutput<ReturnType<typeof createCandleColumnarSchema>>;\nexport type CandleColumnarInput = v.InferInput<ReturnType<typeof createCandleColumnarSchema>>;\nexport type CandleColumnarIntInput = v.InferInput<ReturnType<typeof createCandleColumnarIntSchema>>;\nexport type CandleColumnarInt = v.InferOutput<ReturnType<typeof createCandleColumnarIntSchema>>;\n\nexport const ListCandlesInputSchema = v.pipe(\n v.object({\n symbolId: SymbolIdInputSchema,\n timeframe: TimeframeInputSchema,\n limit: OptionalPositiveNumberSchema,\n includeIncomplete: v.optional(v.boolean(), false),\n includeReference: OptionalBooleanSchema,\n startTsSec: OptionalTimestampSecondsInputSchema,\n endTsSec: OptionalTimestampSecondsInputSchema,\n pageToken: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n }),\n v.transform((d) => ({\n symbolId: d.symbolId,\n timeframe: d.timeframe,\n limit: d.limit,\n includeIncomplete: d.includeIncomplete,\n includeReference: d.includeReference,\n startTime: d.startTsSec != null ? timestampFromTsSec(d.startTsSec) : undefined,\n endTime: d.endTsSec != null ? timestampFromTsSec(d.endTsSec) : undefined,\n pageToken: d.pageToken,\n })),\n);\n\nexport function createListCandlesInputSchema() {\n return ListCandlesInputSchema;\n}\n\nexport type GetCandlesInput = v.InferInput<ReturnType<typeof createListCandlesInputSchema>>;\nexport const createGetCandlesColumnsInputSchema = createListCandlesInputSchema;\nexport type GetCandlesColumnsInput = v.InferInput<ReturnType<typeof createListCandlesInputSchema>>;\n"],"mappings":";;;;;;;;AASA,MAAa,kBAAkB,EAAE,SAAS,UAAU;AAIpD,SAAS,mBAAmB,OAAwB,YAA4C;CAC5F,OAAO,kBACH,eAAe,eACf,OACA,kBAAkB,cAClB,WACJ;AACJ;AAEA,MAAM,uBAAuB,EAAE,KAC3B,iBACA,EAAE,WAAW,UAAU,eAAe,aAAa,MAAM,CAC7D;AAEA,MAAM,+BAA+B,EAAE,SACnC,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,QAAQ,GAAG,EAAE,QAAQ,CAAC,GAAG,EAAE,SAAS,GAAM,CAAC,CACpE;AAEA,MAAM,wBAAwB,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;AAI3D,SAAS,mBAAmB,OAA8B;CACtD,OAAO;EAAE,SAAS;EAAO,OAAO;CAAE;AACtC;AAEA,MAAM,qBAAqB,E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CAAC;IAC1C,MAAM,qBAAqB,EAAE,iBAAiB,CAAC,GAAG,UAAU;IAC5D,MAAM,qBAAqB,EAAE,iBAAiB,CAAC,GAAG,UAAU;IAC5D,KAAK,qBAAqB,EAAE,gBAAgB,CAAC,GAAG,UAAU;IAC1D,OAAO,qBAAqB,EAAE,kBAAkB,CAAC,GAAG,UAAU;IAC9D,QAAQ,qBAAqB,EAAE,mBAAmB,CAAC,GAAG,WAAW;GACrE,IACA;EACd;CACJ,CAAC,CACL;AACJ;AAWA,MAAa,yBAAyB,EAAE,KACpC,EAAE,OAAO;CACL,UAAU;CACV,WAAW;CACX,OAAO;CACP,mBAAmB,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;CAChD,kBAAkB;CAClB,YAAY;CACZ,UAAU;CACV,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE;AAC1D,CAAC,GACD,EAAE,WAAW,OAAO;CAChB,UAAU,EAAE;CACZ,WAAW,EAAE;CACb,OAAO,EAAE;CACT,mBAAmB,EAAE;CACrB,kBAAkB,EAAE;CACpB,WAAW,EAAE,cAAc,OAAO,mBAAmB,EAAE,UAAU,IAAI,KAAA;CACrE,SAAS,EAAE,YAAY,OAAO,mBAAmB,EAAE,QAAQ,IAAI,KAAA;CAC/D,WAAW,EAAE;AACjB,EAAE,CACN"}
|
|
@@ -31,7 +31,7 @@ declare function createListDepositAddressesInputSchema(): v.SchemaWithPipe<reado
|
|
|
31
31
|
}>]>;
|
|
32
32
|
type ListDepositAddressesInput = v.InferInput<ReturnType<typeof createListDepositAddressesInputSchema>>;
|
|
33
33
|
declare const DepositAddressSchema: v.ObjectSchema<{
|
|
34
|
-
readonly chainId: v.
|
|
34
|
+
readonly chainId: v.NumberSchema<undefined>;
|
|
35
35
|
readonly depositAddress: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
|
|
36
36
|
}, undefined>;
|
|
37
37
|
type DepositAddress = v.InferOutput<typeof DepositAddressSchema>;
|
|
@@ -17,7 +17,7 @@ const ListDepositAddressesInputSchema = v.pipe(v.strictObject({
|
|
|
17
17
|
subaccountId: accountScopeToSubaccountId(account)
|
|
18
18
|
})));
|
|
19
19
|
const DepositAddressSchema = v.object({
|
|
20
|
-
chainId:
|
|
20
|
+
chainId: v.number(),
|
|
21
21
|
depositAddress: v.pipe(v.string(), v.trim(), v.minLength(1))
|
|
22
22
|
});
|
|
23
23
|
const DepositAddressesSchema = v.array(DepositAddressSchema);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deposit.schemas.js","names":[],"sources":["../../../src/services/deposit/deposit.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { PositiveUint32InputSchema } from \"../shared.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\n\nexport const CreateDepositAddressInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n chainId: PositiveUint32InputSchema,\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport function createCreateDepositAddressInputSchema() {\n return CreateDepositAddressInputSchema;\n}\n\nexport type CreateDepositAddressInput = v.InferInput<\n ReturnType<typeof createCreateDepositAddressInputSchema>\n>;\nexport type CreateDepositAddressRequest = v.InferOutput<\n ReturnType<typeof createCreateDepositAddressInputSchema>\n>;\n\nexport const ListDepositAddressesInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n chainId: v.optional(PositiveUint32InputSchema),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport function createListDepositAddressesInputSchema() {\n return ListDepositAddressesInputSchema;\n}\n\nexport type ListDepositAddressesInput = v.InferInput<\n ReturnType<typeof createListDepositAddressesInputSchema>\n>;\nexport type ListDepositAddressesRequest = v.InferOutput<\n ReturnType<typeof createListDepositAddressesInputSchema>\n>;\n\nexport const DepositAddressSchema = v.object({\n chainId:
|
|
1
|
+
{"version":3,"file":"deposit.schemas.js","names":[],"sources":["../../../src/services/deposit/deposit.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { PositiveUint32InputSchema } from \"../shared.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\n\nexport const CreateDepositAddressInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n chainId: PositiveUint32InputSchema,\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport function createCreateDepositAddressInputSchema() {\n return CreateDepositAddressInputSchema;\n}\n\nexport type CreateDepositAddressInput = v.InferInput<\n ReturnType<typeof createCreateDepositAddressInputSchema>\n>;\nexport type CreateDepositAddressRequest = v.InferOutput<\n ReturnType<typeof createCreateDepositAddressInputSchema>\n>;\n\nexport const ListDepositAddressesInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n chainId: v.optional(PositiveUint32InputSchema),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport function createListDepositAddressesInputSchema() {\n return ListDepositAddressesInputSchema;\n}\n\nexport type ListDepositAddressesInput = v.InferInput<\n ReturnType<typeof createListDepositAddressesInputSchema>\n>;\nexport type ListDepositAddressesRequest = v.InferOutput<\n ReturnType<typeof createListDepositAddressesInputSchema>\n>;\n\nexport const DepositAddressSchema = v.object({\n chainId: v.number(),\n depositAddress: v.pipe(v.string(), v.trim(), v.minLength(1)),\n});\n\nexport type DepositAddress = v.InferOutput<typeof DepositAddressSchema>;\n\nexport const DepositAddressesSchema = v.array(DepositAddressSchema);\n"],"mappings":";;;;AAOA,MAAa,kCAAkC,EAAE,KAC7C,EAAE,aAAa;CACX,GAAG;CACH,SAAS;AACb,CAAC,GACD,EAAE,WAAW,EAAE,SAAS,GAAG,aAAa;CACpC,GAAG;CACH,cAAc,2BAA2B,OAAO;AACpD,EAAE,CACN;AAaA,MAAa,kCAAkC,EAAE,KAC7C,EAAE,aAAa;CACX,GAAG;CACH,SAAS,EAAE,SAAS,yBAAyB;AACjD,CAAC,GACD,EAAE,WAAW,EAAE,SAAS,GAAG,aAAa;CACpC,GAAG;CACH,cAAc,2BAA2B,OAAO;AACpD,EAAE,CACN;AAaA,MAAa,uBAAuB,EAAE,OAAO;CACzC,SAAS,EAAE,OAAO;CAClB,gBAAgB,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,GAAG,EAAE,UAAU,CAAC,CAAC;AAC/D,CAAC;AAID,MAAa,yBAAyB,EAAE,MAAM,oBAAoB"}
|
|
@@ -16,7 +16,7 @@ declare const GetSpotFeeRatesInputSchema: v.SchemaWithPipe<readonly [v.StrictObj
|
|
|
16
16
|
}>]>;
|
|
17
17
|
type GetSpotFeeRatesInput = v.InferInput<typeof GetSpotFeeRatesInputSchema>;
|
|
18
18
|
declare const SpotFeeRateSchema: v.ObjectSchema<{
|
|
19
|
-
readonly symbolId: v.
|
|
19
|
+
readonly symbolId: v.NumberSchema<undefined>;
|
|
20
20
|
readonly makerFeeRatePercent: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
|
|
21
21
|
readonly takerFeeRatePercent: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
|
|
22
22
|
readonly vipTier: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>;
|
|
@@ -12,7 +12,7 @@ const GetSpotFeeRatesInputSchema = v.pipe(v.strictObject({
|
|
|
12
12
|
symbolId: symbolIds
|
|
13
13
|
})));
|
|
14
14
|
const SpotFeeRateSchema = v.object({
|
|
15
|
-
symbolId:
|
|
15
|
+
symbolId: v.number(),
|
|
16
16
|
makerFeeRatePercent: DecimalStringSchema,
|
|
17
17
|
takerFeeRatePercent: DecimalStringSchema,
|
|
18
18
|
vipTier: VipTierNumberSchema
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fees.schemas.js","names":[],"sources":["../../../src/services/fees/fees.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport { SymbolIdInputSchema } from \"../shared.js\";\nimport { VipTierNumberSchema } from \"../vip/vip.schemas.js\";\n\nconst DecimalStringSchema = v.pipe(v.string(), v.trim(), v.minLength(1));\n\nexport const GetSpotFeeRatesInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n symbolIds: v.optional(\n v.pipe(\n v.array(SymbolIdInputSchema),\n v.transform((ids) => [...new Set(ids)]),\n v.maxLength(100),\n ),\n [],\n ),\n }),\n v.transform(({ account, symbolIds }) => ({\n subaccountId: accountScopeToSubaccountId(account),\n symbolId: symbolIds,\n })),\n);\n\nexport type GetSpotFeeRatesInput = v.InferInput<typeof GetSpotFeeRatesInputSchema>;\nexport type GetSpotFeeRatesRequest = v.InferOutput<typeof GetSpotFeeRatesInputSchema>;\n\nexport const SpotFeeRateSchema = v.object({\n symbolId:
|
|
1
|
+
{"version":3,"file":"fees.schemas.js","names":[],"sources":["../../../src/services/fees/fees.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport { SymbolIdInputSchema } from \"../shared.js\";\nimport { VipTierNumberSchema } from \"../vip/vip.schemas.js\";\n\nconst DecimalStringSchema = v.pipe(v.string(), v.trim(), v.minLength(1));\n\nexport const GetSpotFeeRatesInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n symbolIds: v.optional(\n v.pipe(\n v.array(SymbolIdInputSchema),\n v.transform((ids) => [...new Set(ids)]),\n v.maxLength(100),\n ),\n [],\n ),\n }),\n v.transform(({ account, symbolIds }) => ({\n subaccountId: accountScopeToSubaccountId(account),\n symbolId: symbolIds,\n })),\n);\n\nexport type GetSpotFeeRatesInput = v.InferInput<typeof GetSpotFeeRatesInputSchema>;\nexport type GetSpotFeeRatesRequest = v.InferOutput<typeof GetSpotFeeRatesInputSchema>;\n\nexport const SpotFeeRateSchema = v.object({\n symbolId: v.number(),\n makerFeeRatePercent: DecimalStringSchema,\n takerFeeRatePercent: DecimalStringSchema,\n vipTier: VipTierNumberSchema,\n});\n\nexport type SpotFeeRate = v.InferOutput<typeof SpotFeeRateSchema>;\n\nexport const SpotFeeRatesSchema = v.array(SpotFeeRateSchema);\n"],"mappings":";;;;;AAQA,MAAM,sBAAsB,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,GAAG,EAAE,UAAU,CAAC,CAAC;AAEvE,MAAa,6BAA6B,EAAE,KACxC,EAAE,aAAa;CACX,GAAG;CACH,WAAW,EAAE,SACT,EAAE,KACE,EAAE,MAAM,mBAAmB,GAC3B,EAAE,WAAW,QAAQ,CAAC,GAAG,IAAI,IAAI,GAAG,CAAC,CAAC,GACtC,EAAE,UAAU,GAAG,CACnB,GACA,CAAC,CACL;AACJ,CAAC,GACD,EAAE,WAAW,EAAE,SAAS,iBAAiB;CACrC,cAAc,2BAA2B,OAAO;CAChD,UAAU;AACd,EAAE,CACN;AAKA,MAAa,oBAAoB,EAAE,OAAO;CACtC,UAAU,EAAE,OAAO;CACnB,qBAAqB;CACrB,qBAAqB;CACrB,SAAS;AACb,CAAC;AAID,MAAa,qBAAqB,EAAE,MAAM,iBAAiB"}
|
|
@@ -14,7 +14,7 @@ type TimestampInit = {
|
|
|
14
14
|
declare const GetOrderbookHeatmapInputSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
15
15
|
readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
|
|
16
16
|
readonly interval: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["1s", "1m", "5m", "1h"], undefined>, "1s">, v.TransformAction<"1h" | "1m" | "1s" | "5m", HeatmapInterval>]>;
|
|
17
|
-
readonly depth: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly [1, 5, 10, 20, 50, 100, 200, 500, 1000], undefined>, 50>, v.TransformAction<5 | 10 | 20 | 1 | 200 | 1000 | 500 |
|
|
17
|
+
readonly depth: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly [1, 5, 10, 20, 50, 100, 200, 500, 1000], undefined>, 50>, v.TransformAction<5 | 10 | 20 | 1 | 200 | 1000 | 500 | 100 | 50, HeatmapDepth>]>;
|
|
18
18
|
readonly quantityMode: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["close", "peak"], undefined>, "close">, v.TransformAction<"close" | "peak", HeatmapQuantityMode>]>;
|
|
19
19
|
readonly limit: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 20000, undefined>]>;
|
|
20
20
|
readonly startTsSec: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>, v.MaxValueAction<number, number, undefined>, v.TransformAction<number, bigint>]>, undefined>;
|
|
@@ -227,7 +227,7 @@ type OrderbookHeatmapDeltaChain = ReturnType<typeof convertHeatmapDeltaChain>;
|
|
|
227
227
|
declare function createOrderbookHeatmapResponseSchema(scales: SdkScales): v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
228
228
|
readonly symbolId: v.NumberSchema<undefined>;
|
|
229
229
|
readonly interval: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"1h" | "1m" | "1s" | "5m">>]>;
|
|
230
|
-
readonly depth: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, 5 | 10 | 20 | 1 | "unspecified" | 200 | 1000 | 500 |
|
|
230
|
+
readonly depth: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, 5 | 10 | 20 | 1 | "unspecified" | 200 | 1000 | 500 | 100 | 50>]>;
|
|
231
231
|
readonly chain: v.OptionalSchema<v.ObjectSchema<{
|
|
232
232
|
readonly baseKeyframe: v.OptionalSchema<v.ObjectSchema<{
|
|
233
233
|
readonly tsSec: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, number>]>;
|
|
@@ -287,7 +287,7 @@ declare function createOrderbookHeatmapResponseSchema(scales: SdkScales): v.Sche
|
|
|
287
287
|
}, undefined>, v.TransformAction<{
|
|
288
288
|
symbolId: number;
|
|
289
289
|
interval: DecodedEnum<"1h" | "1m" | "1s" | "5m">;
|
|
290
|
-
depth: 5 | 10 | 20 | 1 | "unspecified" | 200 | 1000 | 500 |
|
|
290
|
+
depth: 5 | 10 | 20 | 1 | "unspecified" | 200 | 1000 | 500 | 100 | 50;
|
|
291
291
|
chain?: {
|
|
292
292
|
baseKeyframe?: {
|
|
293
293
|
tsSec: number;
|
|
@@ -347,7 +347,7 @@ declare function createOrderbookHeatmapResponseSchema(scales: SdkScales): v.Sche
|
|
|
347
347
|
}, {
|
|
348
348
|
symbolId: number;
|
|
349
349
|
interval: DecodedEnum<"1h" | "1m" | "1s" | "5m">;
|
|
350
|
-
depth: 5 | 10 | 20 | 1 | "unspecified" | 200 | 1000 | 500 |
|
|
350
|
+
depth: 5 | 10 | 20 | 1 | "unspecified" | 200 | 1000 | 500 | 100 | 50;
|
|
351
351
|
chain: {
|
|
352
352
|
baseKeyframe: {
|
|
353
353
|
tsSec: number;
|
|
@@ -118,7 +118,7 @@ declare function createCreateInternalTransferResultSchema(): v.SchemaWithPipe<re
|
|
|
118
118
|
readonly requestId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
|
|
119
119
|
readonly transferId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
|
|
120
120
|
readonly acceptedAtTsNs: v.BigintSchema<undefined>;
|
|
121
|
-
readonly assetId: v.
|
|
121
|
+
readonly assetId: v.NumberSchema<undefined>;
|
|
122
122
|
readonly assetCode: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
|
|
123
123
|
readonly uAssetId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>;
|
|
124
124
|
readonly amountE18: v.ObjectSchema<{
|
|
@@ -74,7 +74,7 @@ function createCreateInternalTransferResultSchema() {
|
|
|
74
74
|
requestId: NonEmptyResponseStringSchema,
|
|
75
75
|
transferId: NonEmptyResponseStringSchema,
|
|
76
76
|
acceptedAtTsNs: v.bigint(),
|
|
77
|
-
assetId:
|
|
77
|
+
assetId: v.number(),
|
|
78
78
|
assetCode: NonEmptyResponseStringSchema,
|
|
79
79
|
uAssetId: NonEmptyResponseStringSchema,
|
|
80
80
|
amountE18: U128Schema,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal-transfers.schemas.js","names":[],"sources":["../../../src/services/internal-transfers/internal-transfers.schemas.ts"],"sourcesContent":["import type { MessageInitShape } from \"@bufbuild/protobuf\";\nimport { PositiveUint32InputSchema } from \"../shared.js\";\nimport * as v from \"valibot\";\nimport type * as Proto from \"../../gen/transfer/v1/internal_transfer_pb.js\";\nimport { idInputSchema } from \"../../shared/schemas.js\";\nimport { tsNsToMs } from \"../../utils/time.js\";\nimport {\n E18_SCALE,\n quantityInputToE18,\n scaledToDecimalOutput,\n type SdkScales,\n} from \"../../shared/decimal-surface.js\";\nimport { InternalTransferDestinationCodec } from \"./internal-transfers.codecs.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport { fromU128, toU128 } from \"../../utils/u128.js\";\n\nconst U128Schema = v.object({\n hi: v.bigint(),\n lo: v.bigint(),\n});\n\nconst IdSchema = idInputSchema;\n\nexport const InternalTransferDestinationInputSchema = v.pipe(\n v.variant(\"type\", [\n v.strictObject({\n type: v.literal(\"account\"),\n accountId: IdSchema(\"accountId\"),\n }),\n v.strictObject({\n type: v.literal(\"subaccount\"),\n subaccountId: IdSchema(\"subaccountId\"),\n }),\n v.strictObject({\n type: v.literal(\"smartAccountAddress\"),\n address: v.pipe(v.string(), v.trim(), v.minLength(1)),\n }),\n ]),\n v.transform((destination) => {\n switch (destination.type) {\n case \"account\":\n return {\n case: InternalTransferDestinationCodec.inputToProtoCase.account,\n value: destination.accountId,\n } as const;\n case \"subaccount\":\n return {\n case: InternalTransferDestinationCodec.inputToProtoCase.subaccount,\n value: destination.subaccountId,\n } as const;\n case \"smartAccountAddress\":\n return {\n case: InternalTransferDestinationCodec.inputToProtoCase.smartAccountAddress,\n value: destination.address,\n } as const;\n }\n }),\n);\n\nexport type InternalTransferDestination = v.InferInput<\n typeof InternalTransferDestinationInputSchema\n>;\n\nexport function createCreateInternalTransferInputSchema(scales: SdkScales) {\n return v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n destination: InternalTransferDestinationInputSchema,\n assetId: PositiveUint32InputSchema,\n quantity: v.string(),\n idempotencyKey: v.pipe(v.string(), v.trim(), v.minLength(1)),\n }),\n v.transform(\n ({ account, quantity, ...input }) =>\n ({\n ...input,\n amountE18: toU128(\n quantityInputToE18({\n scales,\n assetId: input.assetId,\n quantity,\n }),\n ),\n subaccountId: accountScopeToSubaccountId(account),\n }) satisfies MessageInitShape<typeof Proto.CreateInternalTransferRequestSchema>,\n ),\n );\n}\n\nexport type CreateInternalTransferInput = v.InferInput<\n ReturnType<typeof createCreateInternalTransferInputSchema>\n>;\nexport type CreateInternalTransferRequest = v.InferOutput<\n ReturnType<typeof createCreateInternalTransferInputSchema>\n>;\n\nconst NonEmptyResponseStringSchema = v.pipe(v.string(), v.trim(), v.minLength(1));\nconst OptionalResponseStringSchema = v.pipe(\n v.optional(v.pipe(v.string(), v.trim())),\n v.transform((value) => (value ? value : undefined)),\n);\n\nexport const ResolvedInternalTransferDestinationSchema = v.pipe(\n v.object({\n rootAccountPublicId: OptionalResponseStringSchema,\n subaccountPublicId: OptionalResponseStringSchema,\n smartAccountAddress: OptionalResponseStringSchema,\n }),\n v.transform(({ rootAccountPublicId, subaccountPublicId, smartAccountAddress }) => ({\n rootAccountId: rootAccountPublicId,\n subaccountId: subaccountPublicId,\n smartAccountAddress,\n })),\n);\n\nexport type ResolvedInternalTransferDestination = v.InferOutput<\n typeof ResolvedInternalTransferDestinationSchema\n>;\n\nexport function createCreateInternalTransferResultSchema() {\n return v.pipe(\n v.object({\n requestId: NonEmptyResponseStringSchema,\n transferId: NonEmptyResponseStringSchema,\n acceptedAtTsNs: v.bigint(),\n assetId:
|
|
1
|
+
{"version":3,"file":"internal-transfers.schemas.js","names":[],"sources":["../../../src/services/internal-transfers/internal-transfers.schemas.ts"],"sourcesContent":["import type { MessageInitShape } from \"@bufbuild/protobuf\";\nimport { PositiveUint32InputSchema } from \"../shared.js\";\nimport * as v from \"valibot\";\nimport type * as Proto from \"../../gen/transfer/v1/internal_transfer_pb.js\";\nimport { idInputSchema } from \"../../shared/schemas.js\";\nimport { tsNsToMs } from \"../../utils/time.js\";\nimport {\n E18_SCALE,\n quantityInputToE18,\n scaledToDecimalOutput,\n type SdkScales,\n} from \"../../shared/decimal-surface.js\";\nimport { InternalTransferDestinationCodec } from \"./internal-transfers.codecs.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport { fromU128, toU128 } from \"../../utils/u128.js\";\n\nconst U128Schema = v.object({\n hi: v.bigint(),\n lo: v.bigint(),\n});\n\nconst IdSchema = idInputSchema;\n\nexport const InternalTransferDestinationInputSchema = v.pipe(\n v.variant(\"type\", [\n v.strictObject({\n type: v.literal(\"account\"),\n accountId: IdSchema(\"accountId\"),\n }),\n v.strictObject({\n type: v.literal(\"subaccount\"),\n subaccountId: IdSchema(\"subaccountId\"),\n }),\n v.strictObject({\n type: v.literal(\"smartAccountAddress\"),\n address: v.pipe(v.string(), v.trim(), v.minLength(1)),\n }),\n ]),\n v.transform((destination) => {\n switch (destination.type) {\n case \"account\":\n return {\n case: InternalTransferDestinationCodec.inputToProtoCase.account,\n value: destination.accountId,\n } as const;\n case \"subaccount\":\n return {\n case: InternalTransferDestinationCodec.inputToProtoCase.subaccount,\n value: destination.subaccountId,\n } as const;\n case \"smartAccountAddress\":\n return {\n case: InternalTransferDestinationCodec.inputToProtoCase.smartAccountAddress,\n value: destination.address,\n } as const;\n }\n }),\n);\n\nexport type InternalTransferDestination = v.InferInput<\n typeof InternalTransferDestinationInputSchema\n>;\n\nexport function createCreateInternalTransferInputSchema(scales: SdkScales) {\n return v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n destination: InternalTransferDestinationInputSchema,\n assetId: PositiveUint32InputSchema,\n quantity: v.string(),\n idempotencyKey: v.pipe(v.string(), v.trim(), v.minLength(1)),\n }),\n v.transform(\n ({ account, quantity, ...input }) =>\n ({\n ...input,\n amountE18: toU128(\n quantityInputToE18({\n scales,\n assetId: input.assetId,\n quantity,\n }),\n ),\n subaccountId: accountScopeToSubaccountId(account),\n }) satisfies MessageInitShape<typeof Proto.CreateInternalTransferRequestSchema>,\n ),\n );\n}\n\nexport type CreateInternalTransferInput = v.InferInput<\n ReturnType<typeof createCreateInternalTransferInputSchema>\n>;\nexport type CreateInternalTransferRequest = v.InferOutput<\n ReturnType<typeof createCreateInternalTransferInputSchema>\n>;\n\nconst NonEmptyResponseStringSchema = v.pipe(v.string(), v.trim(), v.minLength(1));\nconst OptionalResponseStringSchema = v.pipe(\n v.optional(v.pipe(v.string(), v.trim())),\n v.transform((value) => (value ? value : undefined)),\n);\n\nexport const ResolvedInternalTransferDestinationSchema = v.pipe(\n v.object({\n rootAccountPublicId: OptionalResponseStringSchema,\n subaccountPublicId: OptionalResponseStringSchema,\n smartAccountAddress: OptionalResponseStringSchema,\n }),\n v.transform(({ rootAccountPublicId, subaccountPublicId, smartAccountAddress }) => ({\n rootAccountId: rootAccountPublicId,\n subaccountId: subaccountPublicId,\n smartAccountAddress,\n })),\n);\n\nexport type ResolvedInternalTransferDestination = v.InferOutput<\n typeof ResolvedInternalTransferDestinationSchema\n>;\n\nexport function createCreateInternalTransferResultSchema() {\n return v.pipe(\n v.object({\n requestId: NonEmptyResponseStringSchema,\n transferId: NonEmptyResponseStringSchema,\n acceptedAtTsNs: v.bigint(),\n assetId: v.number(),\n assetCode: NonEmptyResponseStringSchema,\n uAssetId: NonEmptyResponseStringSchema,\n amountE18: U128Schema,\n destination: v.optional(ResolvedInternalTransferDestinationSchema),\n }),\n v.transform(({ acceptedAtTsNs, amountE18, ...result }) => ({\n ...result,\n acceptedAtUnixMs: tsNsToMs(acceptedAtTsNs),\n quantity: scaledToDecimalOutput(fromU128(amountE18), E18_SCALE),\n })),\n );\n}\n\nexport type CreateInternalTransferResult = v.InferOutput<\n ReturnType<typeof createCreateInternalTransferResultSchema>\n>;\n"],"mappings":";;;;;;;;;AAmBA,MAAM,aAAa,EAAE,OAAO;CACxB,IAAI,EAAE,OAAO;CACb,IAAI,EAAE,OAAO;AACjB,CAAC;AAED,MAAM,WAAW;AAEjB,MAAa,yCAAyC,EAAE,KACpD,EAAE,QAAQ,QAAQ;CACd,EAAE,aAAa;EACX,MAAM,EAAE,QAAQ,SAAS;EACzB,WAAW,SAAS,WAAW;CACnC,CAAC;CACD,EAAE,aAAa;EACX,MAAM,EAAE,QAAQ,YAAY;EAC5B,cAAc,SAAS,cAAc;CACzC,CAAC;CACD,EAAE,aAAa;EACX,MAAM,EAAE,QAAQ,qBAAqB;E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AAMA,SAAgB,2CAA2C;CACvD,OAAO,EAAE,KACL,EAAE,OAAO;EACL,WAAW;EACX,YAAY;EACZ,gBAAgB,EAAE,OAAO;EACzB,SAAS,EAAE,OAAO;EAClB,WAAW;EACX,UAAU;EACV,WAAW;EACX,aAAa,EAAE,SAAS,yCAAyC;CACrE,CAAC,GACD,EAAE,WAAW,EAAE,gBAAgB,WAAW,GAAG,cAAc;EACvD,GAAG;EACH,kBAAkB,SAAS,cAAc;EACzC,UAAU,sBAAsB,SAAS,SAAS,GAAA,EAAY;CAClE,EAAE,CACN;AACJ"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { MarketOrderBy, SortDirection, SparklineInterval } from "../../gen/marketoverview/v1/marketoverview_pb.js";
|
|
2
|
-
import { ListMarketOverviewInput, ListMarketOverviewInputSchema, MarketOverview, MarketOverviewOrderBy, MarketOverviewOrderBySchema, MarketOverviewSort, MarketOverviewSortSchema, MarketOverviewSparkline, SparklineIntervalName, SparklineIntervalSchema, createMarketOverviewSchema } from "./market-overview.schemas.js";
|
|
2
|
+
import { ListMarketOverviewInput, ListMarketOverviewInputSchema, MarketOverview, MarketOverviewOrderBy, MarketOverviewOrderBySchema, MarketOverviewSort, MarketOverviewSortSchema, MarketOverviewSparkline, SparklineIntervalName, SparklineIntervalSchema, SpotPairVolumeSeries, SpotPairVolumeSeriesSchema, SpotVolumeHistoryInput, SpotVolumeHistoryInputSchema, SpotVolumeHistoryResponse, SpotVolumeHistoryResponseSchema, createMarketOverviewSchema } from "./market-overview.schemas.js";
|
|
3
3
|
import { MarketOverviewService } from "./market-overview.js";
|
|
4
|
-
export { ListMarketOverviewInput, ListMarketOverviewInputSchema, MarketOverview, MarketOverviewOrderBy, MarketOverviewOrderBySchema, MarketOverviewService, MarketOverviewSort, MarketOverviewSortSchema, MarketOverviewSparkline, SparklineIntervalName, SparklineIntervalSchema, createMarketOverviewSchema };
|
|
4
|
+
export { ListMarketOverviewInput, ListMarketOverviewInputSchema, MarketOverview, MarketOverviewOrderBy, MarketOverviewOrderBySchema, MarketOverviewService, MarketOverviewSort, MarketOverviewSortSchema, MarketOverviewSparkline, SparklineIntervalName, SparklineIntervalSchema, SpotPairVolumeSeries, SpotPairVolumeSeriesSchema, SpotVolumeHistoryInput, SpotVolumeHistoryInputSchema, SpotVolumeHistoryResponse, SpotVolumeHistoryResponseSchema, createMarketOverviewSchema };
|