@polyester/sdk 0.22.2 → 0.23.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 +14 -0
- package/dist/account-signer/types.d.ts +1 -1
- package/dist/account-signer/types.js.map +1 -1
- package/dist/environment.js +1 -1
- package/dist/environment.js.map +1 -1
- package/dist/gen/auth/v1/auth_pb.d.ts +88 -46
- package/dist/gen/auth/v1/auth_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/auth_pb.js +43 -11
- package/dist/gen/auth/v1/auth_pb.js.map +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.d.ts +5 -17
- package/dist/gen/auth/v1/subaccounts_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.js +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.js.map +1 -1
- package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts +2 -2
- package/dist/gen/chain/withdraw/v1/withdraw_pb.js.map +1 -1
- package/dist/gen/marketoverview/v1/marketoverview_pb.d.ts +2 -1
- package/dist/gen/marketoverview/v1/marketoverview_pb.d.ts.map +1 -1
- package/dist/gen/marketoverview/v1/marketoverview_pb.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/services/auth/account-signer-auth.d.ts +7 -3
- package/dist/services/auth/account-signer-auth.d.ts.map +1 -1
- package/dist/services/auth/account-signer-auth.js +28 -13
- package/dist/services/auth/account-signer-auth.js.map +1 -1
- package/dist/services/auth/auth.d.ts +19 -14
- package/dist/services/auth/auth.d.ts.map +1 -1
- package/dist/services/auth/auth.js +24 -14
- package/dist/services/auth/auth.js.map +1 -1
- package/dist/services/auth/auth.types.d.ts +2 -2
- package/dist/services/auth/wallet-challenge.schemas.js +20 -0
- package/dist/services/auth/wallet-challenge.schemas.js.map +1 -0
- package/dist/services/candles/candles.schemas.d.ts +10 -10
- package/dist/services/heatmap/heatmap.schemas.d.ts +9 -9
- package/dist/services/lifecycle/lifecycle.schemas.d.ts +42 -42
- package/dist/services/market-overview/market-overview.schemas.d.ts +3 -3
- 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 +12 -12
- package/dist/services/subaccounts/subaccounts.d.ts +1 -1
- package/dist/services/subaccounts/subaccounts.js +1 -1
- package/dist/services/subaccounts/subaccounts.js.map +1 -1
- package/dist/services/subaccounts/subaccounts.schemas.d.ts +7 -9
- package/dist/services/subaccounts/subaccounts.schemas.d.ts.map +1 -1
- package/dist/services/subaccounts/subaccounts.schemas.js +4 -5
- package/dist/services/subaccounts/subaccounts.schemas.js.map +1 -1
- package/dist/services/trading-withdraws/index.d.ts +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.d.ts +10 -72
- package/dist/services/trading-withdraws/trading-withdraws.d.ts.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.js +8 -84
- package/dist/services/trading-withdraws/trading-withdraws.js.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.types.d.ts +2 -2
- package/dist/services/trading-withdraws/wallet-message.js +43 -0
- package/dist/services/trading-withdraws/wallet-message.js.map +1 -0
- package/dist/services/triggers/trigger-input.schemas.d.ts +2 -2
- package/dist/services/triggers/triggers-output.schemas.d.ts +18 -18
- package/package.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marketoverview_pb.d.ts","names":[],"sources":["../../../../src/gen/marketoverview/v1/marketoverview_pb.ts"],"mappings":";;;;;;;;cAYa,uCAAuC;;;;;;KAQxC,cAAc;;;;;;EAMxB,MAAM;;;;;;cAOK,mBAAmB,WAAW;;;;;;KAQ/B,YAAY;;;;;;EAMtB,UAAU;;;;;;EAOV;;;;;;cAOW,iBAAiB,WAAW;;;;KAM7B,iBAAiB;;;;;;EAM3B;;;;;;EAOA;;;;;;EAOA;;;;;;EAOA;;;;;;;EAQA;;;;;;EAOA;;;;;;;EAQA;;;;;;;EA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;;EAM/C,OAAO;;;;;;EAOP,aAAa;;;;;;EAOb;;;;;;cAOW,0CAA0C,WAAW;;;;;;;aAStD;;;;;;EAMV;;;;;;EAOA;;;;;;EAOA;;;;;;EAOA;;;;;;EAOA;;;;;cAMW,yBAAyB,QAAQ;;;;aAMlC;;;;EAIV;;;;;;EAOA;;;;;;EAOA;;;;;;EAOA;;;;;;EAOA;;;;;cAMW,qBAAqB,QAAQ;;;;aAM9B;;;;EAIV;;;;;;EAOA;;;;;;EAOA;;;;;cAMW,qBAAqB,QAAQ;;;;;;;aAS9B;;;;EAIV;;;;EAKA;;;;EAKA;;;;EAKA;;;;EAKA;;;;EAKA;;;;;cAMW,iBAAiB,QAAQ;;;;;;;cASzB,uBAAuB;;;;;;;EAOlC;IACE;IACA,cAAc;IACd,eAAe;;;;;;;EAOjB;IACE;IACA,cAAc;IACd,eAAe;;;;;;;;EAQjB;IACE;IACA,cAAc;IACd,eAAe;;;;;EAKjB;IACE;IACA,cAAc;IACd,eAAe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"marketoverview_pb.js","names":[],"sources":["../../../../src/gen/marketoverview/v1/marketoverview_pb.ts"],"sourcesContent":["// @generated by protoc-gen-es v2.13.0 with parameter \"target=ts,import_extension=js\"\n// @generated from file marketoverview/v1/marketoverview.proto (package marketoverview.v1, syntax proto3)\n/* eslint-disable */\n\nimport type { GenEnum, GenFile, GenMessage, GenService } from \"@bufbuild/protobuf/codegenv2\";\nimport { enumDesc, fileDesc, messageDesc, serviceDesc } from \"@bufbuild/protobuf/codegenv2\";\nimport { file_polyester_api_options } from \"../../polyester/api/options_pb.js\";\nimport type { Message } from \"@bufbuild/protobuf\";\n\n/**\n * Describes the file marketoverview/v1/marketoverview.proto.\n */\nexport const file_marketoverview_v1_marketoverview: GenFile = /*@__PURE__*/\n fileDesc(\"CiZtYXJrZXRvdmVydmlldy92MS9tYXJrZXRvdmVydmlldy5wcm90bxIRbWFya2V0b3ZlcnZpZXcudj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dFZvbHVtZUhpc3RvcnlSZXF1ZXN0Gi8ubWFya2V0b3ZlcnZpZXcudjEuR2V0U3BvdFZvbHVtZUhpc3RvcnlSZXNwb25zZSIAEnMKEkxpc3RNYXJrZXRPdmVydmlldxIsLm1hcmtldG92ZXJ2aWV3LnYxLkxpc3RNYXJrZXRPdmVydmlld1JlcXVlc3QaLS5tYXJrZXRvdmVydmlldy52MS5MaXN0TWFya2V0T3ZlcnZpZXdSZXNwb25zZSIAQlBaTmdpdGh1Yi5jb20vRmFicmljLUxhYnMvcG9seWVzdGVyLXNkay1nby9nZW4vbWFya2V0b3ZlcnZpZXcvdjE7bWFya2V0b3ZlcnZpZXd2MWIGcHJvdG8z\", [file_polyester_api_options]);\n\n/**\n * ErrorDetail carries a typed domain error code for machine-readable handling.\n *\n * @generated from message marketoverview.v1.ErrorDetail\n */\nexport type ErrorDetail = Message<\"marketoverview.v1.ErrorDetail\"> & {\n /**\n * Stable error code for programmatic matching.\n *\n * @generated from field: marketoverview.v1.ErrorCode code = 1;\n */\n code: ErrorCode;\n};\n\n/**\n * Describes the message marketoverview.v1.ErrorDetail.\n * Use `create(ErrorDetailSchema)` to create a new message.\n */\nexport const ErrorDetailSchema: GenMessage<ErrorDetail> = /*@__PURE__*/\n messageDesc(file_marketoverview_v1_marketoverview, 0);\n\n/**\n * Sparkline contains newest-first close prices for one time range.\n *\n * @generated from message marketoverview.v1.Sparkline\n */\nexport type Sparkline = Message<\"marketoverview.v1.Sparkline\"> & {\n /**\n * Time range and sampling resolution represented by these close prices.\n *\n * @generated from field: marketoverview.v1.SparklineInterval interval = 1;\n */\n interval: SparklineInterval;\n\n /**\n * Newest-first close prices in quote units scaled by 1e6.\n *\n * @generated from field: repeated int64 close_ticks = 2;\n */\n closeTicks: bigint[];\n};\n\n/**\n * Describes the message marketoverview.v1.Sparkline.\n * Use `create(SparklineSchema)` to create a new message.\n */\nexport const SparklineSchema: GenMessage<Sparkline> = /*@__PURE__*/\n messageDesc(file_marketoverview_v1_marketoverview, 1);\n\n/**\n * @generated from message marketoverview.v1.MarketOverview\n */\nexport type MarketOverview = Message<\"marketoverview.v1.MarketOverview\"> & {\n /**\n * Numeric spot market identifier.\n *\n * @generated from field: uint32 symbol_id = 1;\n */\n symbolId: number;\n\n /**\n * Last traded price in quote units scaled by 1e6.\n *\n * @generated from field: int64 last_price_ticks = 3;\n */\n lastPriceTicks: bigint;\n\n /**\n * Last trade timestamp in nanoseconds since epoch.\n *\n * @generated from field: uint64 last_trade_ts_ns = 4;\n */\n lastTradeTsNs: bigint;\n\n /**\n * Rolling 24h change expressed in basis points (bp). Example: +123 = +1.23%.\n *\n * @generated from field: int32 change_24h_bps = 5;\n */\n change24hBps: number;\n\n /**\n * Rolling 24h stats.\n * Highest traded price in the 24h window, in quote units scaled by 1e6.\n *\n * @generated from field: int64 high_24h_ticks = 6;\n */\n high24hTicks: bigint;\n\n /**\n * Lowest traded price in the 24h window, in quote units scaled by 1e6.\n *\n * @generated from field: int64 low_24h_ticks = 7;\n */\n low24hTicks: bigint;\n\n /**\n * Rolling 24h base volume scaled by the pair's base_quantity_scale from\n * GetSpotConfig. Omitted if the amount exceeds the signed 64-bit range.\n *\n * @generated from field: optional int64 volume_24h_base_scaled = 8;\n */\n volume24hBaseScaled?: bigint | undefined;\n\n /**\n * Rolling 24h quote volume scaled by the pair's quote_quantity_scale from\n * GetSpotConfig. Omitted if the amount exceeds the signed 64-bit range.\n *\n * @generated from field: optional int64 volume_24h_quote_scaled = 14;\n */\n volume24hQuoteScaled?: bigint | undefined;\n\n /**\n * Rolling 24h USD volume, scaled by 1e6 (one unit is 0.000001 USD).\n * Applies the current quote/USD conversion to the rolling quote volume.\n * When conversion is unavailable, USDT and USDC are valued at USD parity.\n * Omitted for other quote assets when a current conversion is unavailable.\n *\n * @generated from field: optional int64 volume_24h_usd_scaled = 17;\n */\n volume24hUsdScaled?: bigint | undefined;\n\n /**\n * Listing timestamp in nanoseconds since epoch.\n *\n * @generated from field: uint64 listed_ts_ns = 15;\n */\n listedTsNs: bigint;\n\n /**\n * Current best bid price in quote units scaled by 1e6.\n *\n * @generated from field: int64 best_bid_ticks = 9;\n */\n bestBidTicks: bigint;\n\n /**\n * Best bid quantity scaled by the pair's base_quantity_scale from\n * GetSpotConfig.\n *\n * @generated from field: int64 best_bid_qty_scaled = 10;\n */\n bestBidQtyScaled: bigint;\n\n /**\n * Current best ask price in quote units scaled by 1e6.\n *\n * @generated from field: int64 best_ask_ticks = 11;\n */\n bestAskTicks: bigint;\n\n /**\n * Best ask quantity scaled by the pair's base_quantity_scale from\n * GetSpotConfig.\n *\n * @generated from field: int64 best_ask_qty_scaled = 12;\n */\n bestAskQtyScaled: bigint;\n\n /**\n * Optional sparklines (requested explicitly).\n *\n * @generated from field: repeated marketoverview.v1.Sparkline sparklines = 13;\n */\n sparklines: Sparkline[];\n\n /**\n * Current multi-venue index price in quote units scaled by 1e6.\n * Zero when no fresh, valid index price is available.\n *\n * @generated from field: int64 index_price_ticks = 16;\n */\n indexPriceTicks: bigint;\n};\n\n/**\n * Describes the message marketoverview.v1.MarketOverview.\n * Use `create(MarketOverviewSchema)` to create a new message.\n */\nexport const MarketOverviewSchema: GenMessage<MarketOverview> = /*@__PURE__*/\n messageDesc(file_marketoverview_v1_marketoverview, 2);\n\n/**\n * @generated from message marketoverview.v1.ListMarketOverviewRequest\n */\nexport type ListMarketOverviewRequest = Message<\"marketoverview.v1.ListMarketOverviewRequest\"> & {\n /**\n * Filter by stable numeric pair IDs from GetSpotConfig. When empty, returns\n * all enabled markets.\n *\n * @generated from field: repeated uint32 symbol_id = 1;\n */\n symbolId: number[];\n\n /**\n * Maximum number of markets to return. Defaults to 50 when omitted; maximum\n * is 2000.\n *\n * @generated from field: uint32 limit = 2;\n */\n limit: number;\n\n /**\n * Opaque keyset cursor from a previous response. The cursor is exclusive and\n * bound to symbol IDs, sort key, and sort direction. Sparkline options\n * affect only response enrichment and may change between pages.\n *\n * @generated from field: string page_token = 3;\n */\n pageToken: string;\n\n /**\n * Sort key. When unset/UNSPECIFIED, defaults to descending 24h USD volume.\n *\n * @generated from field: marketoverview.v1.MarketOrderBy order_by = 4;\n */\n orderBy: MarketOrderBy;\n\n /**\n * Sort direction (DESC=newest/highest first).\n *\n * @generated from field: marketoverview.v1.SortDirection sort = 5;\n */\n sort: SortDirection;\n\n /**\n * When true, include sparklines in each MarketOverview.\n *\n * @generated from field: bool include_sparklines = 6;\n */\n includeSparklines: boolean;\n\n /**\n * Which sparklines to include. If empty and include_sparklines is true,\n * server defaults to 24h.\n *\n * @generated from field: repeated marketoverview.v1.SparklineInterval sparkline_intervals = 7;\n */\n sparklineIntervals: SparklineInterval[];\n};\n\n/**\n * Describes the message marketoverview.v1.ListMarketOverviewRequest.\n * Use `create(ListMarketOverviewRequestSchema)` to create a new message.\n */\nexport const ListMarketOverviewRequestSchema: GenMessage<ListMarketOverviewRequest> = /*@__PURE__*/\n messageDesc(file_marketoverview_v1_marketoverview, 3);\n\n/**\n * @generated from message marketoverview.v1.ListMarketOverviewResponse\n */\nexport type ListMarketOverviewResponse = Message<\"marketoverview.v1.ListMarketOverviewResponse\"> & {\n /**\n * Market overview rows for the requested page.\n *\n * @generated from field: repeated marketoverview.v1.MarketOverview markets = 1;\n */\n markets: MarketOverview[];\n\n /**\n * Opaque cursor for the next page. Empty when no more results exist.\n *\n * @generated from field: string next_page_token = 2;\n */\n nextPageToken: string;\n};\n\n/**\n * Describes the message marketoverview.v1.ListMarketOverviewResponse.\n * Use `create(ListMarketOverviewResponseSchema)` to create a new message.\n */\nexport const ListMarketOverviewResponseSchema: GenMessage<ListMarketOverviewResponse> = /*@__PURE__*/\n messageDesc(file_marketoverview_v1_marketoverview, 4);\n\n/**\n * MarketOverviewBatch is a websocket payload carrying batched market overview\n * updates. It is published to a single all-markets channel at a fixed cadence.\n *\n * @generated from message marketoverview.v1.MarketOverviewBatch\n */\nexport type MarketOverviewBatch = Message<\"marketoverview.v1.MarketOverviewBatch\"> & {\n /**\n * Market overviews included in this batch.\n *\n * @generated from field: repeated marketoverview.v1.MarketOverview markets = 1;\n */\n markets: MarketOverview[];\n\n /**\n * Batch publish timestamp in nanoseconds since epoch.\n *\n * @generated from field: uint64 ts_ns = 2;\n */\n tsNs: bigint;\n};\n\n/**\n * Describes the message marketoverview.v1.MarketOverviewBatch.\n * Use `create(MarketOverviewBatchSchema)` to create a new message.\n */\nexport const MarketOverviewBatchSchema: GenMessage<MarketOverviewBatch> = /*@__PURE__*/\n messageDesc(file_marketoverview_v1_marketoverview, 5);\n\n/**\n * A finite spot-volume chart request; no pagination or arbitrary time range.\n *\n * @generated from message marketoverview.v1.GetSpotVolumeHistoryRequest\n */\nexport type GetSpotVolumeHistoryRequest = Message<\"marketoverview.v1.GetSpotVolumeHistoryRequest\"> & {\n /**\n * Pair IDs from GetSpotConfig; empty selects every configured pair separately.\n * At most 2000 distinct positive IDs. Unknown IDs are rejected. If the full\n * universe exceeds 2000 pairs, specify a filter; results are never truncated.\n *\n * @generated from field: repeated uint32 symbol_id = 1;\n */\n symbolId: number[];\n};\n\n/**\n * Describes the message marketoverview.v1.GetSpotVolumeHistoryRequest.\n * Use `create(GetSpotVolumeHistoryRequestSchema)` to create a new message.\n */\nexport const GetSpotVolumeHistoryRequestSchema: GenMessage<GetSpotVolumeHistoryRequest> = /*@__PURE__*/\n messageDesc(file_marketoverview_v1_marketoverview, 6);\n\n/**\n * One pair appears exactly once, regardless of its base and quote assets.\n * REST renders the scaled amounts as decimal strings in volumeUsd.\n *\n * @generated from message marketoverview.v1.SpotPairVolumeSeries\n */\nexport type SpotPairVolumeSeries = Message<\"marketoverview.v1.SpotPairVolumeSeries\"> & {\n /**\n * Stable numeric pair ID; clients may group these series by base asset.\n *\n * @generated from field: uint32 symbol_id = 1;\n */\n symbolId: number;\n\n /**\n * Trailing-24h USD amounts scaled by 1e6, oldest first. Exactly points values,\n * aligned with the shared response grid. Zero means no executed trades in\n * the window. USD values round down once per contributing 15-minute bucket.\n *\n * @generated from field: repeated sint64 volume_usd_scaled = 2;\n */\n volumeUsdScaled: bigint[];\n};\n\n/**\n * Describes the message marketoverview.v1.SpotPairVolumeSeries.\n * Use `create(SpotPairVolumeSeriesSchema)` to create a new message.\n */\nexport const SpotPairVolumeSeriesSchema: GenMessage<SpotPairVolumeSeries> = /*@__PURE__*/\n messageDesc(file_marketoverview_v1_marketoverview, 7);\n\n/**\n * Aligned columnar trailing-24h USD series over the most recent 24 hours.\n * The grid always contains 97 samples ending at the latest completed UTC\n * quarter-hour. Index i maps to start_ts_sec + i * 900 seconds. Each sample\n * covers [sample time - 24h, sample time); only the preceding 48 hours contribute.\n * USD conversion uses historical quote/USD prices at each completed bucket\n * boundary. When conversion is unavailable, USDT and USDC are valued at USD parity.\n * If any contributing trade cannot be valued, or a USD amount overflows,\n * the RPC fails as unavailable; partial or zero-filled valuations are not returned.\n * Intervals without executed trades are zero. Results may be reused for 15 seconds.\n *\n * @generated from message marketoverview.v1.GetSpotVolumeHistoryResponse\n */\nexport type GetSpotVolumeHistoryResponse = Message<\"marketoverview.v1.GetSpotVolumeHistoryResponse\"> & {\n /**\n * Sampling interval between points; currently always \"15m\".\n *\n * @generated from field: string bucket = 1;\n */\n bucket: string;\n\n /**\n * First sample timestamp in seconds since Unix epoch (UTC), inclusive.\n *\n * @generated from field: fixed32 start_ts_sec = 2;\n */\n startTsSec: number;\n\n /**\n * Last sample timestamp in seconds since Unix epoch (UTC), inclusive.\n *\n * @generated from field: fixed32 end_ts_sec = 3;\n */\n endTsSec: number;\n\n /**\n * Number of aligned values in every pair array and the total array; always 97.\n *\n * @generated from field: uint32 points = 4;\n */\n points: number;\n\n /**\n * Pairs ordered by ascending symbol_id; at most 2000, each included once.\n *\n * @generated from field: repeated marketoverview.v1.SpotPairVolumeSeries pairs = 5;\n */\n pairs: SpotPairVolumeSeries[];\n\n /**\n * Sum across selected pairs, USD scaled by 1e6. Exactly points values,\n * oldest first. REST renders decimal strings in totalVolumeUsd.\n * Do not sum overlapping trailing-24h samples to obtain period traded volume.\n *\n * @generated from field: repeated sint64 total_volume_usd_scaled = 6;\n */\n totalVolumeUsdScaled: bigint[];\n};\n\n/**\n * Describes the message marketoverview.v1.GetSpotVolumeHistoryResponse.\n * Use `create(GetSpotVolumeHistoryResponseSchema)` to create a new message.\n */\nexport const GetSpotVolumeHistoryResponseSchema: GenMessage<GetSpotVolumeHistoryResponse> = /*@__PURE__*/\n messageDesc(file_marketoverview_v1_marketoverview, 8);\n\n/**\n * CurrencyMetadata supplies stable defaults for display conversion. Clients may\n * localize names, symbols, and number formatting for the user's locale.\n *\n * @generated from message marketoverview.v1.CurrencyMetadata\n */\nexport type CurrencyMetadata = Message<\"marketoverview.v1.CurrencyMetadata\"> & {\n /**\n * Uppercase currency or stablecoin code, such as EUR or USDT.\n *\n * @generated from field: string code = 1;\n */\n code: string;\n\n /**\n * Default English display name.\n *\n * @generated from field: string default_english_name = 2;\n */\n defaultEnglishName: string;\n\n /**\n * Default English display symbol; the code is used where no distinct symbol exists.\n *\n * @generated from field: string symbol = 3;\n */\n symbol: string;\n\n /**\n * Default display fraction digits, including zero for currencies such as JPY.\n * This is a formatting default, not rate precision, token decimals, or cash rounding.\n * Stablecoins use two display fraction digits.\n *\n * @generated from field: uint32 fraction_digits = 4;\n */\n fractionDigits: number;\n};\n\n/**\n * Describes the message marketoverview.v1.CurrencyMetadata.\n * Use `create(CurrencyMetadataSchema)` to create a new message.\n */\nexport const CurrencyMetadataSchema: GenMessage<CurrencyMetadata> = /*@__PURE__*/\n messageDesc(file_marketoverview_v1_marketoverview, 9);\n\n/**\n * GetCurrencyConversionConfigRequest has no parameters.\n *\n * @generated from message marketoverview.v1.GetCurrencyConversionConfigRequest\n */\nexport type GetCurrencyConversionConfigRequest = Message<\"marketoverview.v1.GetCurrencyConversionConfigRequest\"> & {\n};\n\n/**\n * Describes the message marketoverview.v1.GetCurrencyConversionConfigRequest.\n * Use `create(GetCurrencyConversionConfigRequestSchema)` to create a new message.\n */\nexport const GetCurrencyConversionConfigRequestSchema: GenMessage<GetCurrencyConversionConfigRequest> = /*@__PURE__*/\n messageDesc(file_marketoverview_v1_marketoverview, 10);\n\n/**\n * GetCurrencyConversionConfigResponse contains finite, cacheable display metadata.\n * It remains available before any rates have been observed.\n *\n * @generated from message marketoverview.v1.GetCurrencyConversionConfigResponse\n */\nexport type GetCurrencyConversionConfigResponse = Message<\"marketoverview.v1.GetCurrencyConversionConfigResponse\"> & {\n /**\n * Supported fiat currencies, including USD, ordered by code.\n *\n * @generated from field: repeated marketoverview.v1.CurrencyMetadata fiat = 1;\n */\n fiat: CurrencyMetadata[];\n\n /**\n * Supported stablecoins (USDC and USDT), ordered by code.\n *\n * @generated from field: repeated marketoverview.v1.CurrencyMetadata stablecoins = 2;\n */\n stablecoins: CurrencyMetadata[];\n};\n\n/**\n * Describes the message marketoverview.v1.GetCurrencyConversionConfigResponse.\n * Use `create(GetCurrencyConversionConfigResponseSchema)` to create a new message.\n */\nexport const GetCurrencyConversionConfigResponseSchema: GenMessage<GetCurrencyConversionConfigResponse> = /*@__PURE__*/\n messageDesc(file_marketoverview_v1_marketoverview, 11);\n\n/**\n * FiatConversionRate states the fiat currency units equal to one US dollar.\n *\n * @generated from message marketoverview.v1.FiatConversionRate\n */\nexport type FiatConversionRate = Message<\"marketoverview.v1.FiatConversionRate\"> & {\n /**\n * Supported fiat currency code.\n *\n * @generated from field: string code = 1;\n */\n code: string;\n\n /**\n * Fiat currency units per 1 USD, scaled by 1e8. USD has the identity value 1e8.\n *\n * @generated from field: int64 units_per_usd_e8 = 2;\n */\n unitsPerUsdE8: bigint;\n};\n\n/**\n * Describes the message marketoverview.v1.FiatConversionRate.\n * Use `create(FiatConversionRateSchema)` to create a new message.\n */\nexport const FiatConversionRateSchema: GenMessage<FiatConversionRate> = /*@__PURE__*/\n messageDesc(file_marketoverview_v1_marketoverview, 12);\n\n/**\n * FiatConversionSnapshot contains all supported fiat rates from one observation.\n *\n * @generated from message marketoverview.v1.FiatConversionSnapshot\n */\nexport type FiatConversionSnapshot = Message<\"marketoverview.v1.FiatConversionSnapshot\"> & {\n /**\n * Complete fiat rates, including USD, ordered by code.\n *\n * @generated from field: repeated marketoverview.v1.FiatConversionRate rates = 1;\n */\n rates: FiatConversionRate[];\n\n /**\n * Shared source observation time in seconds since the Unix epoch (UTC).\n *\n * @generated from field: uint64 source_ts_sec = 2;\n */\n sourceTsSec: bigint;\n\n /**\n * True once the source observation is at least two hours old.\n *\n * @generated from field: bool stale = 3;\n */\n stale: boolean;\n};\n\n/**\n * Describes the message marketoverview.v1.FiatConversionSnapshot.\n * Use `create(FiatConversionSnapshotSchema)` to create a new message.\n */\nexport const FiatConversionSnapshotSchema: GenMessage<FiatConversionSnapshot> = /*@__PURE__*/\n messageDesc(file_marketoverview_v1_marketoverview, 13);\n\n/**\n * StablecoinConversionRate states the observed USD value of one stablecoin unit.\n *\n * @generated from message marketoverview.v1.StablecoinConversionRate\n */\nexport type StablecoinConversionRate = Message<\"marketoverview.v1.StablecoinConversionRate\"> & {\n /**\n * Supported stablecoin code (USDC or USDT).\n *\n * @generated from field: string code = 1;\n */\n code: string;\n\n /**\n * USD per 1 stablecoin unit, scaled by 1e8. This is an observed price, not a fixed peg.\n *\n * @generated from field: int64 usd_per_unit_e8 = 2;\n */\n usdPerUnitE8: bigint;\n\n /**\n * This stablecoin's source observation time in seconds since the Unix epoch (UTC).\n *\n * @generated from field: uint64 source_ts_sec = 3;\n */\n sourceTsSec: bigint;\n\n /**\n * True once this stablecoin's source observation is at least five seconds old.\n *\n * @generated from field: bool stale = 4;\n */\n stale: boolean;\n};\n\n/**\n * Describes the message marketoverview.v1.StablecoinConversionRate.\n * Use `create(StablecoinConversionRateSchema)` to create a new message.\n */\nexport const StablecoinConversionRateSchema: GenMessage<StablecoinConversionRate> = /*@__PURE__*/\n messageDesc(file_marketoverview_v1_marketoverview, 14);\n\n/**\n * GetCurrencyConversionRatesRequest has no parameters.\n *\n * @generated from message marketoverview.v1.GetCurrencyConversionRatesRequest\n */\nexport type GetCurrencyConversionRatesRequest = Message<\"marketoverview.v1.GetCurrencyConversionRatesRequest\"> & {\n};\n\n/**\n * Describes the message marketoverview.v1.GetCurrencyConversionRatesRequest.\n * Use `create(GetCurrencyConversionRatesRequestSchema)` to create a new message.\n */\nexport const GetCurrencyConversionRatesRequestSchema: GenMessage<GetCurrencyConversionRatesRequest> = /*@__PURE__*/\n messageDesc(file_marketoverview_v1_marketoverview, 15);\n\n/**\n * GetCurrencyConversionRatesResponse groups rates by their USD conversion direction.\n * Last-known observations remain available with staleness indicated. Before any\n * observation is available, the request fails with unavailable (HTTP 503).\n *\n * @generated from message marketoverview.v1.GetCurrencyConversionRatesResponse\n */\nexport type GetCurrencyConversionRatesResponse = Message<\"marketoverview.v1.GetCurrencyConversionRatesResponse\"> & {\n /**\n * Complete fiat snapshot; absent until a complete snapshot has been observed.\n *\n * @generated from field: marketoverview.v1.FiatConversionSnapshot fiat = 1;\n */\n fiat?: FiatConversionSnapshot | undefined;\n\n /**\n * Observed stablecoin rates ordered by code. Unobserved stablecoins are omitted.\n *\n * @generated from field: repeated marketoverview.v1.StablecoinConversionRate stablecoins = 2;\n */\n stablecoins: StablecoinConversionRate[];\n\n /**\n * Response construction time in seconds since the Unix epoch (UTC).\n *\n * @generated from field: uint64 snapshot_ts_sec = 3;\n */\n snapshotTsSec: bigint;\n};\n\n/**\n * Describes the message marketoverview.v1.GetCurrencyConversionRatesResponse.\n * Use `create(GetCurrencyConversionRatesResponseSchema)` to create a new message.\n */\nexport const GetCurrencyConversionRatesResponseSchema: GenMessage<GetCurrencyConversionRatesResponse> = /*@__PURE__*/\n messageDesc(file_marketoverview_v1_marketoverview, 16);\n\n/**\n * SparklineInterval identifies the time range and sampling resolution for a\n * sparkline.\n *\n * @generated from enum marketoverview.v1.SparklineInterval\n */\nexport enum SparklineInterval {\n /**\n * Unspecified interval. When requested, server may default to 24H.\n *\n * @generated from enum value: SPARKLINE_INTERVAL_UNSPECIFIED = 0;\n */\n SPARKLINE_INTERVAL_UNSPECIFIED = 0,\n\n /**\n * 1 hour sparkline. Typically returns up to 60 points (1-minute buckets).\n *\n * @generated from enum value: SPARKLINE_1H = 1;\n */\n SPARKLINE_1H = 1,\n\n /**\n * 24 hour sparkline. Typically returns up to 96 points (15-minute buckets).\n *\n * @generated from enum value: SPARKLINE_24H = 2;\n */\n SPARKLINE_24H = 2,\n\n /**\n * 1 week sparkline. Typically returns up to 168 points (1-hour buckets).\n *\n * @generated from enum value: SPARKLINE_1W = 3;\n */\n SPARKLINE_1W = 3,\n\n /**\n * 1 month sparkline. Typically returns up to 180 points (4-hour buckets).\n *\n * @generated from enum value: SPARKLINE_1M = 4;\n */\n SPARKLINE_1M = 4,\n}\n\n/**\n * Describes the enum marketoverview.v1.SparklineInterval.\n */\nexport const SparklineIntervalSchema: GenEnum<SparklineInterval> = /*@__PURE__*/\n enumDesc(file_marketoverview_v1_marketoverview, 0);\n\n/**\n * @generated from enum marketoverview.v1.MarketOrderBy\n */\nexport enum MarketOrderBy {\n /**\n * @generated from enum value: MARKET_ORDER_BY_UNSPECIFIED = 0;\n */\n MARKET_ORDER_BY_UNSPECIFIED = 0,\n\n /**\n * Sort by absolute 24h change (basis points).\n *\n * @generated from enum value: ORDER_BY_CHANGE_24H_BPS = 1;\n */\n ORDER_BY_CHANGE_24H_BPS = 1,\n\n /**\n * Sort by canonical USD 24h volume. Unvalued markets sort last in either direction.\n *\n * @generated from enum value: ORDER_BY_VOLUME_24H_USD = 2;\n */\n ORDER_BY_VOLUME_24H_USD = 2,\n\n /**\n * Sort by last price in quote units scaled by 1e6.\n *\n * @generated from enum value: ORDER_BY_LAST_PRICE = 3;\n */\n ORDER_BY_LAST_PRICE = 3,\n\n /**\n * Sort by listing time (new listings first).\n *\n * @generated from enum value: ORDER_BY_DATE_ADDED = 4;\n */\n ORDER_BY_DATE_ADDED = 4,\n}\n\n/**\n * Describes the enum marketoverview.v1.MarketOrderBy.\n */\nexport const MarketOrderBySchema: GenEnum<MarketOrderBy> = /*@__PURE__*/\n enumDesc(file_marketoverview_v1_marketoverview, 1);\n\n/**\n * @generated from enum marketoverview.v1.SortDirection\n */\nexport enum SortDirection {\n /**\n * @generated from enum value: SORT_DIRECTION_UNSPECIFIED = 0;\n */\n SORT_DIRECTION_UNSPECIFIED = 0,\n\n /**\n * Ascending (oldest/lowest first).\n *\n * @generated from enum value: SORT_ASC = 1;\n */\n SORT_ASC = 1,\n\n /**\n * Descending (newest/highest first).\n *\n * @generated from enum value: SORT_DESC = 2;\n */\n SORT_DESC = 2,\n}\n\n/**\n * Describes the enum marketoverview.v1.SortDirection.\n */\nexport const SortDirectionSchema: GenEnum<SortDirection> = /*@__PURE__*/\n enumDesc(file_marketoverview_v1_marketoverview, 2);\n\n/**\n * ErrorCode is a stable domain error code enum for Market Overview.\n * It is used for consistent error surfaces across ConnectRPC and REST.\n *\n * @generated from enum marketoverview.v1.ErrorCode\n */\nexport enum ErrorCode {\n /**\n * @generated from enum value: ERROR_CODE_UNSPECIFIED = 0;\n */\n UNSPECIFIED = 0,\n\n /**\n * @generated from enum value: ERROR_CODE_BAD_REQUEST = 1;\n */\n BAD_REQUEST = 1,\n\n /**\n * @generated from enum value: ERROR_CODE_INVALID_ARGUMENT = 2;\n */\n INVALID_ARGUMENT = 2,\n\n /**\n * @generated from enum value: ERROR_CODE_NOT_FOUND = 3;\n */\n NOT_FOUND = 3,\n\n /**\n * @generated from enum value: ERROR_CODE_UNAVAILABLE = 4;\n */\n UNAVAILABLE = 4,\n\n /**\n * @generated from enum value: ERROR_CODE_UPSTREAM_ERROR = 5;\n */\n UPSTREAM_ERROR = 5,\n}\n\n/**\n * Describes the enum marketoverview.v1.ErrorCode.\n */\nexport const ErrorCodeSchema: GenEnum<ErrorCode> = /*@__PURE__*/\n enumDesc(file_marketoverview_v1_marketoverview, 3);\n\n/**\n * List ticker-style market overview rows with optional sparklines.\n * Supports symbol filtering, sorting, and pagination controls.\n *\n * @generated from service marketoverview.v1.MarketOverviewService\n */\nexport const MarketOverviewService: GenService<{\n /**\n * Get supported fiat and stablecoin display metadata with default English names,\n * symbols, and fraction digits. Clients may localize presentation.\n *\n * @generated from rpc marketoverview.v1.MarketOverviewService.GetCurrencyConversionConfig\n */\n getCurrencyConversionConfig: {\n methodKind: \"unary\";\n input: typeof GetCurrencyConversionConfigRequestSchema;\n output: typeof GetCurrencyConversionConfigResponseSchema;\n },\n /**\n * Get fiat units per USD and USD per stablecoin unit, grouped with source freshness.\n *\n * @generated from rpc marketoverview.v1.MarketOverviewService.GetCurrencyConversionRates\n */\n getCurrencyConversionRates: {\n methodKind: \"unary\";\n input: typeof GetCurrencyConversionRatesRequestSchema;\n output: typeof GetCurrencyConversionRatesResponseSchema;\n },\n /**\n * Get aligned pair-level and total trailing-24h USD volume, sampled every\n * 15 minutes over the latest day. Unavailable valuations fail the request.\n *\n * @generated from rpc marketoverview.v1.MarketOverviewService.GetSpotVolumeHistory\n */\n getSpotVolumeHistory: {\n methodKind: \"unary\";\n input: typeof GetSpotVolumeHistoryRequestSchema;\n output: typeof GetSpotVolumeHistoryResponseSchema;\n },\n /**\n * @generated from rpc marketoverview.v1.MarketOverviewService.ListMarketOverview\n */\n listMarketOverview: {\n methodKind: \"unary\";\n input: typeof ListMarketOverviewRequestSchema;\n output: typeof ListMarketOverviewResponseSchema;\n },\n}> = /*@__PURE__*/\n serviceDesc(file_marketoverview_v1_marketoverview, 0);\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,MAAa,wCACX,uBAAS,oqJAAoqJ,CAAC,0BAA0B,CAAC;;;;;AAoB3sJ,MAAa,oBACX,0BAAY,uCAAuC,CAAC;;;;;AA2BtD,MAAa,kBACX,0BAAY,uCAAuC,CAAC;;;;;AAoItD,MAAa,uBACX,0BAAY,uCAAuC,CAAC;;;;;AAiEtD,MAAa,kCACX,0BAAY,uCAAuC,CAAC;;;;;AAyBtD,MAAa,mCACX,0BAAY,uCAAuC,CAAC;;;;;AA4BtD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cAAA,cAAA,KAAA;;;;;;CAOA,cAAA,cAAA,eAAA,KAAA;;AACF,EAAA,CAAA,CAAA;;;;AAKA,MAAa,sBACX,uBAAS,uCAAuC,CAAC;;;;;;;AAQnD,IAAY,YAAL,yBAAA,WAAA;;;;CAIL,UAAA,UAAA,iBAAA,KAAA;;;;CAKA,UAAA,UAAA,iBAAA,KAAA;;;;CAKA,UAAA,UAAA,sBAAA,KAAA;;;;CAKA,UAAA,UAAA,eAAA,KAAA;;;;CAKA,UAAA,UAAA,iBAAA,KAAA;;;;CAKA,UAAA,UAAA,oBAAA,KAAA;;AACF,EAAA,CAAA,CAAA;;;;AAKA,MAAa,kBACX,uBAAS,uCAAuC,CAAC;;;;;;;AAQnD,MAAa,wBA0CX,0BAAY,uCAAuC,CAAC"}
|
|
1
|
+
{"version":3,"file":"marketoverview_pb.js","names":[],"sources":["../../../../src/gen/marketoverview/v1/marketoverview_pb.ts"],"sourcesContent":["// @generated by protoc-gen-es v2.13.0 with parameter \"target=ts,import_extension=js\"\n// @generated from file marketoverview/v1/marketoverview.proto (package marketoverview.v1, syntax proto3)\n/* eslint-disable */\n\nimport type { GenEnum, GenFile, GenMessage, GenService } from \"@bufbuild/protobuf/codegenv2\";\nimport { enumDesc, fileDesc, messageDesc, serviceDesc } from \"@bufbuild/protobuf/codegenv2\";\nimport { file_polyester_api_options } from \"../../polyester/api/options_pb.js\";\nimport type { Message } from \"@bufbuild/protobuf\";\n\n/**\n * Describes the file marketoverview/v1/marketoverview.proto.\n */\nexport const file_marketoverview_v1_marketoverview: GenFile = /*@__PURE__*/\n fileDesc(\"CiZtYXJrZXRvdmVydmlldy92MS9tYXJrZXRvdmVydmlldy5wcm90bxIRbWFya2V0b3ZlcnZpZXcudjEiOQoLRXJyb3JEZXRhaWwSKgoEY29kZRgBIAEoDjIcLm1hcmtldG92ZXJ2aWV3LnYxLkVycm9yQ29kZSJaCglTcGFya2xpbmUSOAoIaW50ZXJ2YWwYASABKA4yJC5tYXJrZXRv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hcmtldG92ZXJ2aWV3LnYxLkxpc3RNYXJrZXRPdmVydmlld1JlcXVlc3QaLS5tYXJrZXRvdmVydmlldy52MS5MaXN0TWFya2V0T3ZlcnZpZXdSZXNwb25zZSIAQlBaTmdpdGh1Yi5jb20vRmFicmljLUxhYnMvcG9seWVzdGVyLXNkay1nby9nZW4vbWFya2V0b3ZlcnZpZXcvdjE7bWFya2V0b3ZlcnZpZXd2MWIGcHJvdG8z\", [file_polyester_api_options]);\n\n/**\n * ErrorDetail carries a typed domain error code for machine-readable handling.\n *\n * @generated from message marketoverview.v1.ErrorDetail\n */\nexport type ErrorDetail = Message<\"marketoverview.v1.ErrorDetail\"> & {\n /**\n * Stable error code for programmatic matching.\n *\n * @generated from field: marketoverview.v1.ErrorCode code = 1;\n */\n code: ErrorCode;\n};\n\n/**\n * Describes the message marketoverview.v1.ErrorDetail.\n * Use `create(ErrorDetailSchema)` to create a new message.\n */\nexport const ErrorDetailSchema: GenMessage<ErrorDetail> = /*@__PURE__*/\n messageDesc(file_marketoverview_v1_marketoverview, 0);\n\n/**\n * Sparkline contains newest-first close prices for one time range.\n *\n * @generated from message marketoverview.v1.Sparkline\n */\nexport type Sparkline = Message<\"marketoverview.v1.Sparkline\"> & {\n /**\n * Time range and sampling resolution represented by these close prices.\n *\n * @generated from field: marketoverview.v1.SparklineInterval interval = 1;\n */\n interval: SparklineInterval;\n\n /**\n * Newest-first close prices in quote units scaled by 1e6.\n *\n * @generated from field: repeated int64 close_ticks = 2;\n */\n closeTicks: bigint[];\n};\n\n/**\n * Describes the message marketoverview.v1.Sparkline.\n * Use `create(SparklineSchema)` to create a new message.\n */\nexport const SparklineSchema: GenMessage<Sparkline> = /*@__PURE__*/\n messageDesc(file_marketoverview_v1_marketoverview, 1);\n\n/**\n * @generated from message marketoverview.v1.MarketOverview\n */\nexport type MarketOverview = Message<\"marketoverview.v1.MarketOverview\"> & {\n /**\n * Numeric spot market identifier.\n *\n * @generated from field: uint32 symbol_id = 1;\n */\n symbolId: number;\n\n /**\n * Last traded price in quote units scaled by 1e6.\n *\n * @generated from field: int64 last_price_ticks = 3;\n */\n lastPriceTicks: bigint;\n\n /**\n * Last trade timestamp in nanoseconds since epoch.\n *\n * @generated from field: uint64 last_trade_ts_ns = 4;\n */\n lastTradeTsNs: bigint;\n\n /**\n * Rolling 24h change expressed in basis points (bp). Example: +123 = +1.23%.\n *\n * @generated from field: int32 change_24h_bps = 5;\n */\n change24hBps: number;\n\n /**\n * Rolling 24h stats.\n * Highest traded price in the 24h window, in quote units scaled by 1e6.\n *\n * @generated from field: int64 high_24h_ticks = 6;\n */\n high24hTicks: bigint;\n\n /**\n * Lowest traded price in the 24h window, in quote units scaled by 1e6.\n *\n * @generated from field: int64 low_24h_ticks = 7;\n */\n low24hTicks: bigint;\n\n /**\n * Rolling 24h base volume scaled by the pair's base_quantity_scale from\n * GetSpotConfig. Omitted if the amount exceeds the signed 64-bit range.\n *\n * @generated from field: optional int64 volume_24h_base_scaled = 8;\n */\n volume24hBaseScaled?: bigint | undefined;\n\n /**\n * Rolling 24h quote volume scaled by the pair's quote_quantity_scale from\n * GetSpotConfig. Omitted if the amount exceeds the signed 64-bit range.\n *\n * @generated from field: optional int64 volume_24h_quote_scaled = 14;\n */\n volume24hQuoteScaled?: bigint | undefined;\n\n /**\n * Rolling 24h USD volume, scaled by 1e6 (one unit is 0.000001 USD).\n * Applies the current quote/USD conversion to the rolling quote volume.\n * When conversion is unavailable, USDT and USDC are valued at USD parity.\n * Omitted for other quote assets when a current conversion is unavailable.\n *\n * @generated from field: optional int64 volume_24h_usd_scaled = 17;\n */\n volume24hUsdScaled?: bigint | undefined;\n\n /**\n * Listing timestamp in nanoseconds since epoch.\n *\n * @generated from field: uint64 listed_ts_ns = 15;\n */\n listedTsNs: bigint;\n\n /**\n * Current best bid price in quote units scaled by 1e6.\n *\n * @generated from field: int64 best_bid_ticks = 9;\n */\n bestBidTicks: bigint;\n\n /**\n * Best bid quantity scaled by the pair's base_quantity_scale from\n * GetSpotConfig.\n *\n * @generated from field: int64 best_bid_qty_scaled = 10;\n */\n bestBidQtyScaled: bigint;\n\n /**\n * Current best ask price in quote units scaled by 1e6.\n *\n * @generated from field: int64 best_ask_ticks = 11;\n */\n bestAskTicks: bigint;\n\n /**\n * Best ask quantity scaled by the pair's base_quantity_scale from\n * GetSpotConfig.\n *\n * @generated from field: int64 best_ask_qty_scaled = 12;\n */\n bestAskQtyScaled: bigint;\n\n /**\n * Optional sparklines (requested explicitly).\n *\n * @generated from field: repeated marketoverview.v1.Sparkline sparklines = 13;\n */\n sparklines: Sparkline[];\n\n /**\n * Current multi-venue index price in quote units scaled by 1e6.\n * Zero when no fresh, valid index price is available.\n *\n * @generated from field: int64 index_price_ticks = 16;\n */\n indexPriceTicks: bigint;\n};\n\n/**\n * Describes the message marketoverview.v1.MarketOverview.\n * Use `create(MarketOverviewSchema)` to create a new message.\n */\nexport const MarketOverviewSchema: GenMessage<MarketOverview> = /*@__PURE__*/\n messageDesc(file_marketoverview_v1_marketoverview, 2);\n\n/**\n * @generated from message marketoverview.v1.ListMarketOverviewRequest\n */\nexport type ListMarketOverviewRequest = Message<\"marketoverview.v1.ListMarketOverviewRequest\"> & {\n /**\n * Filter by stable numeric pair IDs from GetSpotConfig. When empty, returns\n * all enabled markets.\n *\n * @generated from field: repeated uint32 symbol_id = 1;\n */\n symbolId: number[];\n\n /**\n * Maximum number of markets to return. Defaults to 50 when omitted; maximum\n * is 2000.\n *\n * @generated from field: uint32 limit = 2;\n */\n limit: number;\n\n /**\n * Opaque keyset cursor from a previous response. The cursor is exclusive and\n * bound to symbol IDs, sort key, and sort direction. Sparkline options\n * affect only response enrichment and may change between pages.\n *\n * @generated from field: string page_token = 3;\n */\n pageToken: string;\n\n /**\n * Sort key. When unset/UNSPECIFIED, defaults to descending 24h USD volume.\n *\n * @generated from field: marketoverview.v1.MarketOrderBy order_by = 4;\n */\n orderBy: MarketOrderBy;\n\n /**\n * Sort direction (DESC=newest/highest first).\n *\n * @generated from field: marketoverview.v1.SortDirection sort = 5;\n */\n sort: SortDirection;\n\n /**\n * When true, include sparklines in each MarketOverview.\n *\n * @generated from field: bool include_sparklines = 6;\n */\n includeSparklines: boolean;\n\n /**\n * Which sparklines to include. If empty and include_sparklines is true,\n * server defaults to 24h.\n *\n * @generated from field: repeated marketoverview.v1.SparklineInterval sparkline_intervals = 7;\n */\n sparklineIntervals: SparklineInterval[];\n};\n\n/**\n * Describes the message marketoverview.v1.ListMarketOverviewRequest.\n * Use `create(ListMarketOverviewRequestSchema)` to create a new message.\n */\nexport const ListMarketOverviewRequestSchema: GenMessage<ListMarketOverviewRequest> = /*@__PURE__*/\n messageDesc(file_marketoverview_v1_marketoverview, 3);\n\n/**\n * @generated from message marketoverview.v1.ListMarketOverviewResponse\n */\nexport type ListMarketOverviewResponse = Message<\"marketoverview.v1.ListMarketOverviewResponse\"> & {\n /**\n * Market overview rows for the requested page.\n *\n * @generated from field: repeated marketoverview.v1.MarketOverview markets = 1;\n */\n markets: MarketOverview[];\n\n /**\n * Opaque cursor for the next page. Empty when no more results exist.\n *\n * @generated from field: string next_page_token = 2;\n */\n nextPageToken: string;\n};\n\n/**\n * Describes the message marketoverview.v1.ListMarketOverviewResponse.\n * Use `create(ListMarketOverviewResponseSchema)` to create a new message.\n */\nexport const ListMarketOverviewResponseSchema: GenMessage<ListMarketOverviewResponse> = /*@__PURE__*/\n messageDesc(file_marketoverview_v1_marketoverview, 4);\n\n/**\n * MarketOverviewBatch is a websocket payload carrying batched market overview\n * updates. It is published to a single all-markets channel at a fixed cadence.\n *\n * @generated from message marketoverview.v1.MarketOverviewBatch\n */\nexport type MarketOverviewBatch = Message<\"marketoverview.v1.MarketOverviewBatch\"> & {\n /**\n * Market overviews included in this batch.\n *\n * @generated from field: repeated marketoverview.v1.MarketOverview markets = 1;\n */\n markets: MarketOverview[];\n\n /**\n * Batch publish timestamp in nanoseconds since epoch.\n *\n * @generated from field: uint64 ts_ns = 2;\n */\n tsNs: bigint;\n};\n\n/**\n * Describes the message marketoverview.v1.MarketOverviewBatch.\n * Use `create(MarketOverviewBatchSchema)` to create a new message.\n */\nexport const MarketOverviewBatchSchema: GenMessage<MarketOverviewBatch> = /*@__PURE__*/\n messageDesc(file_marketoverview_v1_marketoverview, 5);\n\n/**\n * A finite spot-volume chart request; no pagination or arbitrary time range.\n *\n * @generated from message marketoverview.v1.GetSpotVolumeHistoryRequest\n */\nexport type GetSpotVolumeHistoryRequest = Message<\"marketoverview.v1.GetSpotVolumeHistoryRequest\"> & {\n /**\n * Pair IDs from GetSpotConfig; empty selects every configured pair separately.\n * At most 2000 distinct positive IDs. Unknown IDs are rejected. If the full\n * universe exceeds 2000 pairs, specify a filter; results are never truncated.\n *\n * @generated from field: repeated uint32 symbol_id = 1;\n */\n symbolId: number[];\n};\n\n/**\n * Describes the message marketoverview.v1.GetSpotVolumeHistoryRequest.\n * Use `create(GetSpotVolumeHistoryRequestSchema)` to create a new message.\n */\nexport const GetSpotVolumeHistoryRequestSchema: GenMessage<GetSpotVolumeHistoryRequest> = /*@__PURE__*/\n messageDesc(file_marketoverview_v1_marketoverview, 6);\n\n/**\n * One pair appears exactly once, regardless of its base and quote assets.\n * REST renders the scaled amounts as decimal strings in volumeUsd.\n *\n * @generated from message marketoverview.v1.SpotPairVolumeSeries\n */\nexport type SpotPairVolumeSeries = Message<\"marketoverview.v1.SpotPairVolumeSeries\"> & {\n /**\n * Stable numeric pair ID; clients may group these series by base asset.\n *\n * @generated from field: uint32 symbol_id = 1;\n */\n symbolId: number;\n\n /**\n * Trailing-24h USD amounts scaled by 1e6, oldest first. Exactly points values,\n * aligned with the shared response grid. Zero means no executed trades in\n * the window. USD values round down once per contributing 15-minute bucket.\n *\n * @generated from field: repeated sint64 volume_usd_scaled = 2;\n */\n volumeUsdScaled: bigint[];\n};\n\n/**\n * Describes the message marketoverview.v1.SpotPairVolumeSeries.\n * Use `create(SpotPairVolumeSeriesSchema)` to create a new message.\n */\nexport const SpotPairVolumeSeriesSchema: GenMessage<SpotPairVolumeSeries> = /*@__PURE__*/\n messageDesc(file_marketoverview_v1_marketoverview, 7);\n\n/**\n * Aligned columnar trailing-24h USD series over the most recent 24 hours.\n * The grid always contains 97 samples ending at the latest completed UTC\n * quarter-hour. Index i maps to start_ts_sec + i * 900 seconds. Each sample\n * covers [sample time - 24h, sample time); only the preceding 48 hours contribute.\n * USD conversion uses historical quote/USD prices at each completed bucket\n * boundary. When conversion is unavailable, USDT and USDC are valued at USD parity.\n * If any contributing trade cannot be valued, or a USD amount overflows,\n * the RPC fails as unavailable; partial or zero-filled valuations are not returned.\n * Intervals without executed trades are zero. Results may be reused for 15 seconds.\n *\n * @generated from message marketoverview.v1.GetSpotVolumeHistoryResponse\n */\nexport type GetSpotVolumeHistoryResponse = Message<\"marketoverview.v1.GetSpotVolumeHistoryResponse\"> & {\n /**\n * Sampling interval between points; currently always \"15m\".\n *\n * @generated from field: string bucket = 1;\n */\n bucket: string;\n\n /**\n * First sample timestamp in seconds since Unix epoch (UTC), inclusive.\n *\n * @generated from field: fixed32 start_ts_sec = 2;\n */\n startTsSec: number;\n\n /**\n * Last sample timestamp in seconds since Unix epoch (UTC), inclusive.\n *\n * @generated from field: fixed32 end_ts_sec = 3;\n */\n endTsSec: number;\n\n /**\n * Number of aligned values in every pair array and the total array; always 97.\n *\n * @generated from field: uint32 points = 4;\n */\n points: number;\n\n /**\n * Pairs ordered by ascending symbol_id; at most 2000, each included once.\n *\n * @generated from field: repeated marketoverview.v1.SpotPairVolumeSeries pairs = 5;\n */\n pairs: SpotPairVolumeSeries[];\n\n /**\n * Sum across selected pairs, USD scaled by 1e6. Exactly points values,\n * oldest first. REST renders decimal strings in totalVolumeUsd.\n * Do not sum overlapping trailing-24h samples to obtain period traded volume.\n *\n * @generated from field: repeated sint64 total_volume_usd_scaled = 6;\n */\n totalVolumeUsdScaled: bigint[];\n};\n\n/**\n * Describes the message marketoverview.v1.GetSpotVolumeHistoryResponse.\n * Use `create(GetSpotVolumeHistoryResponseSchema)` to create a new message.\n */\nexport const GetSpotVolumeHistoryResponseSchema: GenMessage<GetSpotVolumeHistoryResponse> = /*@__PURE__*/\n messageDesc(file_marketoverview_v1_marketoverview, 8);\n\n/**\n * CurrencyMetadata supplies stable defaults for display conversion. Clients may\n * localize names, symbols, and number formatting for the user's locale.\n *\n * @generated from message marketoverview.v1.CurrencyMetadata\n */\nexport type CurrencyMetadata = Message<\"marketoverview.v1.CurrencyMetadata\"> & {\n /**\n * Uppercase currency or stablecoin code, such as EUR or USDT.\n *\n * @generated from field: string code = 1;\n */\n code: string;\n\n /**\n * Default English display name.\n *\n * @generated from field: string default_english_name = 2;\n */\n defaultEnglishName: string;\n\n /**\n * Representative local display symbol; multiple currencies may share a symbol.\n * Uses the code when the selected local display data has no distinct visible symbol.\n *\n * @generated from field: string symbol = 3;\n */\n symbol: string;\n\n /**\n * Default display fraction digits, including zero for currencies such as JPY.\n * This is a formatting default, not rate precision, token decimals, or cash rounding.\n * Stablecoins use two display fraction digits.\n *\n * @generated from field: uint32 fraction_digits = 4;\n */\n fractionDigits: number;\n};\n\n/**\n * Describes the message marketoverview.v1.CurrencyMetadata.\n * Use `create(CurrencyMetadataSchema)` to create a new message.\n */\nexport const CurrencyMetadataSchema: GenMessage<CurrencyMetadata> = /*@__PURE__*/\n messageDesc(file_marketoverview_v1_marketoverview, 9);\n\n/**\n * GetCurrencyConversionConfigRequest has no parameters.\n *\n * @generated from message marketoverview.v1.GetCurrencyConversionConfigRequest\n */\nexport type GetCurrencyConversionConfigRequest = Message<\"marketoverview.v1.GetCurrencyConversionConfigRequest\"> & {\n};\n\n/**\n * Describes the message marketoverview.v1.GetCurrencyConversionConfigRequest.\n * Use `create(GetCurrencyConversionConfigRequestSchema)` to create a new message.\n */\nexport const GetCurrencyConversionConfigRequestSchema: GenMessage<GetCurrencyConversionConfigRequest> = /*@__PURE__*/\n messageDesc(file_marketoverview_v1_marketoverview, 10);\n\n/**\n * GetCurrencyConversionConfigResponse contains finite, cacheable display metadata.\n * It remains available before any rates have been observed.\n *\n * @generated from message marketoverview.v1.GetCurrencyConversionConfigResponse\n */\nexport type GetCurrencyConversionConfigResponse = Message<\"marketoverview.v1.GetCurrencyConversionConfigResponse\"> & {\n /**\n * Supported fiat currencies, including USD, ordered by code.\n *\n * @generated from field: repeated marketoverview.v1.CurrencyMetadata fiat = 1;\n */\n fiat: CurrencyMetadata[];\n\n /**\n * Supported stablecoins (USDC and USDT), ordered by code.\n *\n * @generated from field: repeated marketoverview.v1.CurrencyMetadata stablecoins = 2;\n */\n stablecoins: CurrencyMetadata[];\n};\n\n/**\n * Describes the message marketoverview.v1.GetCurrencyConversionConfigResponse.\n * Use `create(GetCurrencyConversionConfigResponseSchema)` to create a new message.\n */\nexport const GetCurrencyConversionConfigResponseSchema: GenMessage<GetCurrencyConversionConfigResponse> = /*@__PURE__*/\n messageDesc(file_marketoverview_v1_marketoverview, 11);\n\n/**\n * FiatConversionRate states the fiat currency units equal to one US dollar.\n *\n * @generated from message marketoverview.v1.FiatConversionRate\n */\nexport type FiatConversionRate = Message<\"marketoverview.v1.FiatConversionRate\"> & {\n /**\n * Supported fiat currency code.\n *\n * @generated from field: string code = 1;\n */\n code: string;\n\n /**\n * Fiat currency units per 1 USD, scaled by 1e8. USD has the identity value 1e8.\n *\n * @generated from field: int64 units_per_usd_e8 = 2;\n */\n unitsPerUsdE8: bigint;\n};\n\n/**\n * Describes the message marketoverview.v1.FiatConversionRate.\n * Use `create(FiatConversionRateSchema)` to create a new message.\n */\nexport const FiatConversionRateSchema: GenMessage<FiatConversionRate> = /*@__PURE__*/\n messageDesc(file_marketoverview_v1_marketoverview, 12);\n\n/**\n * FiatConversionSnapshot contains all supported fiat rates from one observation.\n *\n * @generated from message marketoverview.v1.FiatConversionSnapshot\n */\nexport type FiatConversionSnapshot = Message<\"marketoverview.v1.FiatConversionSnapshot\"> & {\n /**\n * Complete fiat rates, including USD, ordered by code.\n *\n * @generated from field: repeated marketoverview.v1.FiatConversionRate rates = 1;\n */\n rates: FiatConversionRate[];\n\n /**\n * Shared source observation time in seconds since the Unix epoch (UTC).\n *\n * @generated from field: uint64 source_ts_sec = 2;\n */\n sourceTsSec: bigint;\n\n /**\n * True once the source observation is at least two hours old.\n *\n * @generated from field: bool stale = 3;\n */\n stale: boolean;\n};\n\n/**\n * Describes the message marketoverview.v1.FiatConversionSnapshot.\n * Use `create(FiatConversionSnapshotSchema)` to create a new message.\n */\nexport const FiatConversionSnapshotSchema: GenMessage<FiatConversionSnapshot> = /*@__PURE__*/\n messageDesc(file_marketoverview_v1_marketoverview, 13);\n\n/**\n * StablecoinConversionRate states the observed USD value of one stablecoin unit.\n *\n * @generated from message marketoverview.v1.StablecoinConversionRate\n */\nexport type StablecoinConversionRate = Message<\"marketoverview.v1.StablecoinConversionRate\"> & {\n /**\n * Supported stablecoin code (USDC or USDT).\n *\n * @generated from field: string code = 1;\n */\n code: string;\n\n /**\n * USD per 1 stablecoin unit, scaled by 1e8. This is an observed price, not a fixed peg.\n *\n * @generated from field: int64 usd_per_unit_e8 = 2;\n */\n usdPerUnitE8: bigint;\n\n /**\n * This stablecoin's source observation time in seconds since the Unix epoch (UTC).\n *\n * @generated from field: uint64 source_ts_sec = 3;\n */\n sourceTsSec: bigint;\n\n /**\n * True once this stablecoin's source observation is at least five seconds old.\n *\n * @generated from field: bool stale = 4;\n */\n stale: boolean;\n};\n\n/**\n * Describes the message marketoverview.v1.StablecoinConversionRate.\n * Use `create(StablecoinConversionRateSchema)` to create a new message.\n */\nexport const StablecoinConversionRateSchema: GenMessage<StablecoinConversionRate> = /*@__PURE__*/\n messageDesc(file_marketoverview_v1_marketoverview, 14);\n\n/**\n * GetCurrencyConversionRatesRequest has no parameters.\n *\n * @generated from message marketoverview.v1.GetCurrencyConversionRatesRequest\n */\nexport type GetCurrencyConversionRatesRequest = Message<\"marketoverview.v1.GetCurrencyConversionRatesRequest\"> & {\n};\n\n/**\n * Describes the message marketoverview.v1.GetCurrencyConversionRatesRequest.\n * Use `create(GetCurrencyConversionRatesRequestSchema)` to create a new message.\n */\nexport const GetCurrencyConversionRatesRequestSchema: GenMessage<GetCurrencyConversionRatesRequest> = /*@__PURE__*/\n messageDesc(file_marketoverview_v1_marketoverview, 15);\n\n/**\n * GetCurrencyConversionRatesResponse groups rates by their USD conversion direction.\n * Last-known observations remain available with staleness indicated. Before any\n * observation is available, the request fails with unavailable (HTTP 503).\n *\n * @generated from message marketoverview.v1.GetCurrencyConversionRatesResponse\n */\nexport type GetCurrencyConversionRatesResponse = Message<\"marketoverview.v1.GetCurrencyConversionRatesResponse\"> & {\n /**\n * Complete fiat snapshot; absent until a complete snapshot has been observed.\n *\n * @generated from field: marketoverview.v1.FiatConversionSnapshot fiat = 1;\n */\n fiat?: FiatConversionSnapshot | undefined;\n\n /**\n * Observed stablecoin rates ordered by code. Unobserved stablecoins are omitted.\n *\n * @generated from field: repeated marketoverview.v1.StablecoinConversionRate stablecoins = 2;\n */\n stablecoins: StablecoinConversionRate[];\n\n /**\n * Response construction time in seconds since the Unix epoch (UTC).\n *\n * @generated from field: uint64 snapshot_ts_sec = 3;\n */\n snapshotTsSec: bigint;\n};\n\n/**\n * Describes the message marketoverview.v1.GetCurrencyConversionRatesResponse.\n * Use `create(GetCurrencyConversionRatesResponseSchema)` to create a new message.\n */\nexport const GetCurrencyConversionRatesResponseSchema: GenMessage<GetCurrencyConversionRatesResponse> = /*@__PURE__*/\n messageDesc(file_marketoverview_v1_marketoverview, 16);\n\n/**\n * SparklineInterval identifies the time range and sampling resolution for a\n * sparkline.\n *\n * @generated from enum marketoverview.v1.SparklineInterval\n */\nexport enum SparklineInterval {\n /**\n * Unspecified interval. When requested, server may default to 24H.\n *\n * @generated from enum value: SPARKLINE_INTERVAL_UNSPECIFIED = 0;\n */\n SPARKLINE_INTERVAL_UNSPECIFIED = 0,\n\n /**\n * 1 hour sparkline. Typically returns up to 60 points (1-minute buckets).\n *\n * @generated from enum value: SPARKLINE_1H = 1;\n */\n SPARKLINE_1H = 1,\n\n /**\n * 24 hour sparkline. Typically returns up to 96 points (15-minute buckets).\n *\n * @generated from enum value: SPARKLINE_24H = 2;\n */\n SPARKLINE_24H = 2,\n\n /**\n * 1 week sparkline. Typically returns up to 168 points (1-hour buckets).\n *\n * @generated from enum value: SPARKLINE_1W = 3;\n */\n SPARKLINE_1W = 3,\n\n /**\n * 1 month sparkline. Typically returns up to 180 points (4-hour buckets).\n *\n * @generated from enum value: SPARKLINE_1M = 4;\n */\n SPARKLINE_1M = 4,\n}\n\n/**\n * Describes the enum marketoverview.v1.SparklineInterval.\n */\nexport const SparklineIntervalSchema: GenEnum<SparklineInterval> = /*@__PURE__*/\n enumDesc(file_marketoverview_v1_marketoverview, 0);\n\n/**\n * @generated from enum marketoverview.v1.MarketOrderBy\n */\nexport enum MarketOrderBy {\n /**\n * @generated from enum value: MARKET_ORDER_BY_UNSPECIFIED = 0;\n */\n MARKET_ORDER_BY_UNSPECIFIED = 0,\n\n /**\n * Sort by absolute 24h change (basis points).\n *\n * @generated from enum value: ORDER_BY_CHANGE_24H_BPS = 1;\n */\n ORDER_BY_CHANGE_24H_BPS = 1,\n\n /**\n * Sort by canonical USD 24h volume. Unvalued markets sort last in either direction.\n *\n * @generated from enum value: ORDER_BY_VOLUME_24H_USD = 2;\n */\n ORDER_BY_VOLUME_24H_USD = 2,\n\n /**\n * Sort by last price in quote units scaled by 1e6.\n *\n * @generated from enum value: ORDER_BY_LAST_PRICE = 3;\n */\n ORDER_BY_LAST_PRICE = 3,\n\n /**\n * Sort by listing time (new listings first).\n *\n * @generated from enum value: ORDER_BY_DATE_ADDED = 4;\n */\n ORDER_BY_DATE_ADDED = 4,\n}\n\n/**\n * Describes the enum marketoverview.v1.MarketOrderBy.\n */\nexport const MarketOrderBySchema: GenEnum<MarketOrderBy> = /*@__PURE__*/\n enumDesc(file_marketoverview_v1_marketoverview, 1);\n\n/**\n * @generated from enum marketoverview.v1.SortDirection\n */\nexport enum SortDirection {\n /**\n * @generated from enum value: SORT_DIRECTION_UNSPECIFIED = 0;\n */\n SORT_DIRECTION_UNSPECIFIED = 0,\n\n /**\n * Ascending (oldest/lowest first).\n *\n * @generated from enum value: SORT_ASC = 1;\n */\n SORT_ASC = 1,\n\n /**\n * Descending (newest/highest first).\n *\n * @generated from enum value: SORT_DESC = 2;\n */\n SORT_DESC = 2,\n}\n\n/**\n * Describes the enum marketoverview.v1.SortDirection.\n */\nexport const SortDirectionSchema: GenEnum<SortDirection> = /*@__PURE__*/\n enumDesc(file_marketoverview_v1_marketoverview, 2);\n\n/**\n * ErrorCode is a stable domain error code enum for Market Overview.\n * It is used for consistent error surfaces across ConnectRPC and REST.\n *\n * @generated from enum marketoverview.v1.ErrorCode\n */\nexport enum ErrorCode {\n /**\n * @generated from enum value: ERROR_CODE_UNSPECIFIED = 0;\n */\n UNSPECIFIED = 0,\n\n /**\n * @generated from enum value: ERROR_CODE_BAD_REQUEST = 1;\n */\n BAD_REQUEST = 1,\n\n /**\n * @generated from enum value: ERROR_CODE_INVALID_ARGUMENT = 2;\n */\n INVALID_ARGUMENT = 2,\n\n /**\n * @generated from enum value: ERROR_CODE_NOT_FOUND = 3;\n */\n NOT_FOUND = 3,\n\n /**\n * @generated from enum value: ERROR_CODE_UNAVAILABLE = 4;\n */\n UNAVAILABLE = 4,\n\n /**\n * @generated from enum value: ERROR_CODE_UPSTREAM_ERROR = 5;\n */\n UPSTREAM_ERROR = 5,\n}\n\n/**\n * Describes the enum marketoverview.v1.ErrorCode.\n */\nexport const ErrorCodeSchema: GenEnum<ErrorCode> = /*@__PURE__*/\n enumDesc(file_marketoverview_v1_marketoverview, 3);\n\n/**\n * List ticker-style market overview rows with optional sparklines.\n * Supports symbol filtering, sorting, and pagination controls.\n *\n * @generated from service marketoverview.v1.MarketOverviewService\n */\nexport const MarketOverviewService: GenService<{\n /**\n * Get supported fiat and stablecoin display metadata with default English names,\n * symbols, and fraction digits. Clients may localize presentation.\n *\n * @generated from rpc marketoverview.v1.MarketOverviewService.GetCurrencyConversionConfig\n */\n getCurrencyConversionConfig: {\n methodKind: \"unary\";\n input: typeof GetCurrencyConversionConfigRequestSchema;\n output: typeof GetCurrencyConversionConfigResponseSchema;\n },\n /**\n * Get fiat units per USD and USD per stablecoin unit, grouped with source freshness.\n *\n * @generated from rpc marketoverview.v1.MarketOverviewService.GetCurrencyConversionRates\n */\n getCurrencyConversionRates: {\n methodKind: \"unary\";\n input: typeof GetCurrencyConversionRatesRequestSchema;\n output: typeof GetCurrencyConversionRatesResponseSchema;\n },\n /**\n * Get aligned pair-level and total trailing-24h USD volume, sampled every\n * 15 minutes over the latest day. Unavailable valuations fail the request.\n *\n * @generated from rpc marketoverview.v1.MarketOverviewService.GetSpotVolumeHistory\n */\n getSpotVolumeHistory: {\n methodKind: \"unary\";\n input: typeof GetSpotVolumeHistoryRequestSchema;\n output: typeof GetSpotVolumeHistoryResponseSchema;\n },\n /**\n * @generated from rpc marketoverview.v1.MarketOverviewService.ListMarketOverview\n */\n listMarketOverview: {\n methodKind: \"unary\";\n input: typeof ListMarketOverviewRequestSchema;\n output: typeof ListMarketOverviewResponseSchema;\n },\n}> = /*@__PURE__*/\n serviceDesc(file_marketoverview_v1_marketoverview, 0);\n\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,MAAa,wCACX,uBAAS,oqJAAoqJ,CAAC,0BAA0B,CAAC;;;;;AAoB3sJ,MAAa,oBACX,0BAAY,uCAAuC,CAAC;;;;;AA2BtD,MAAa,kBACX,0BAAY,uCAAuC,CAAC;;;;;AAoItD,MAAa,uBACX,0BAAY,uCAAuC,CAAC;;;;;AAiEtD,MAAa,kCACX,0BAAY,uCAAuC,CAAC;;;;;AAyBtD,MAAa,mCACX,0BAAY,uCAAuC,CAAC;;;;;AA4BtD,MAAa,4BACX,0BAAY,uCAAuC,CAAC;;;;;AAsBtD,MAAa,oCACX,0BAAY,uCAAuC,CAAC;;;;;AA8BtD,MAAa,6BACX,0BAAY,uCAAuC,CA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;;;AAQnD,IAAY,YAAL,yBAAA,WAAA;;;;CAIL,UAAA,UAAA,iBAAA,KAAA;;;;CAKA,UAAA,UAAA,iBAAA,KAAA;;;;CAKA,UAAA,UAAA,sBAAA,KAAA;;;;CAKA,UAAA,UAAA,eAAA,KAAA;;;;CAKA,UAAA,UAAA,iBAAA,KAAA;;;;CAKA,UAAA,UAAA,oBAAA,KAAA;;AACF,EAAA,CAAA,CAAA;;;;AAKA,MAAa,kBACX,uBAAS,uCAAuC,CAAC;;;;;;;AAQnD,MAAa,wBA0CX,0BAAY,uCAAuC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ import "./realtime/index.js";
|
|
|
17
17
|
import { ApiKeyPolicy, ApiKeyPolicyApplyInput, ApiKeyPolicyCreateInput, ApiKeyPolicyUpdateInput, ListApiKeyPoliciesResponse } from "./services/policies/api-key-policies/api-key-policies.schemas.js";
|
|
18
18
|
import { ApiKey, ApiKeyIdInput, ApiKeyStatus, ApiKeysCreateInput, ApiKeysListInput, ApiKeysUpdateInput } from "./services/api-keys/api-keys.schemas.js";
|
|
19
19
|
import { AccountIdentity, ClaimGeneratedUsernameInput, GeneratedUsernameOffer, Profile, UpdateProfileInput, UsernameHistoryEntry } from "./services/auth/profile/profile.schemas.js";
|
|
20
|
-
import { LoginWithWalletInput, LoginWithWalletResponse, Me,
|
|
20
|
+
import { CreateWalletChallengeInput, LoginWithWalletInput, LoginWithWalletResponse, Me, WalletChallenge, WalletChallengePurpose } from "./services/auth/auth.js";
|
|
21
21
|
import { SubaccountPolicy, SubaccountPolicyApplyInput, SubaccountPolicyCreateInput, SubaccountPolicyUpdateInput } from "./services/policies/subaccount-policies/subaccount-policies.schemas.js";
|
|
22
22
|
import { CreateSubaccountInput, CreateSubaccountResult as CreateSubaccountResult$1, EffectiveSubaccountPermissions, InviteSubaccountMemberInput, ListSubaccountInvitesInput, RemoveSubaccountMemberInput, RespondSubaccountInviteInput, SetSubaccountMemberMfaRequirementInput, Subaccount, SubaccountActivityInput, SubaccountEvent, SubaccountIdInput, SubaccountInvite, SubaccountInviteStatus, SubaccountMember, SubaccountPermission, SubaccountPermissionDefinition, SubaccountRole, SubaccountRoleCatalog, SubaccountRoleDefinition, SubaccountStatus, UpdateSubaccountInput, UpdateSubaccountMemberRoleInput } from "./services/subaccounts/subaccounts.schemas.js";
|
|
23
23
|
import { Candle, CandleColumnar, CandleColumnarInt, CandleInt, GetCandlesColumnsInput, GetCandlesInput, Timeframe } from "./services/candles/candles.schemas.js";
|
|
@@ -45,7 +45,7 @@ import { LedgerTransfer, LedgerTransferSide, ListTransfersInput } from "./servic
|
|
|
45
45
|
import { TransferSideKind } from "./services/transfers/transfers.codecs.js";
|
|
46
46
|
import { CreateInternalTransferInput, CreateInternalTransferResult, InternalTransferDestination, ResolvedInternalTransferDestination } from "./services/internal-transfers/internal-transfers.schemas.js";
|
|
47
47
|
import { CreateTradingWithdrawResult, CreateTradingWithdrawToExternalChainInput, CreateTradingWithdrawToFundingInput, ValidateWithdrawDestinationInput, ValidateWithdrawDestinationResult } from "./services/trading-withdraws/trading-withdraws.schemas.js";
|
|
48
|
-
import { CreateTradingWithdrawToExternalChainServiceInput, CreateTradingWithdrawToFundingServiceInput, PreparedTradingWithdraw, TradingWithdrawSigningConfig, TradingWithdrawWalletSigner
|
|
48
|
+
import { CreateTradingWithdrawToExternalChainServiceInput, CreateTradingWithdrawToFundingServiceInput, PreparedTradingWithdraw, TradingWithdrawSigningConfig, TradingWithdrawWalletSigner } from "./services/trading-withdraws/trading-withdraws.js";
|
|
49
49
|
import { CreateDepositAddressInput, DepositAddress, ListDepositAddressesInput } from "./services/deposit/deposit.schemas.js";
|
|
50
50
|
import { AddressBook, AddressBookEntries, AddressBookEntriesView, AddressBookEntry, AddressBookRecentDestinationsView, AddressBookTag, AddressBookTagSummary, AddressBookView, AddressBookViewInvalidated, CopyAddressBookEntryInput, CreateAddressBookEntryInput, CreateAddressBookTagInput, DeleteAddressBookEntryInput, DeleteAddressBookTagInput, GetAddressBookViewInput, InternalTransferWhitelistEntries, InternalTransferWhitelistEntry, ListAddressBookEntriesInput, ListInternalTransferWhitelistEntriesInput, ListTransferCounterpartiesInput, ListTransferDestinationsInput, MirroredWithdrawWhitelistEntry, SubaccountScopedInput, TransferCounterparties, TransferCounterparty, TransferDestination, TransferDestinations, UpdateAddressBookEntryInput, UpdateAddressBookTagInput, WithdrawWhitelistView, validateCreateAddressBookEntryInput } from "./services/address-book/address-book.schemas.js";
|
|
51
51
|
import { BatchGuardApprovals, BatchSignProtectedActionInput, CreateGuardSignerWalletResult, ExportGuardSignerWalletResult, GuardApproval, GuardSignerScopedInput, GuardSignerStatus, RotateGuardSignerWalletResult, SignProtectedActionInput } from "./services/guard-signer/guard-signer.schemas.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 CurrencyConversionConfig, type CurrencyConversionRates, type CurrencyMetadata, 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 FiatConversionRate, type FiatConversionSnapshot, 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, 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, type SpotPairVolumeSeries, type SpotVolumeHistoryInput, type SpotVolumeHistoryResponse, type StablecoinConversionRate, 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 CreateWalletChallengeInput, type CreateWhiteboardBoardInput, type CreateWhiteboardBoardResult, type CurrencyConversionConfig, type CurrencyConversionRates, type CurrencyMetadata, 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 FiatConversionRate, type FiatConversionSnapshot, 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 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, 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, type SpotPairVolumeSeries, type SpotVolumeHistoryInput, type SpotVolumeHistoryResponse, type StablecoinConversionRate, 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 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 WalletChallenge, type WalletChallengePurpose, 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 };
|
|
@@ -34,6 +34,8 @@ interface LoginOptions {
|
|
|
34
34
|
* The wallet provider to use for login.
|
|
35
35
|
*/
|
|
36
36
|
provider: "metamask" | "turnkey" | "other";
|
|
37
|
+
/** Browser origin requesting the signature; defaults to location.origin in browsers. Required outside browsers. */
|
|
38
|
+
uri?: string;
|
|
37
39
|
loginMethod?: AuthLoginMethod | null;
|
|
38
40
|
}
|
|
39
41
|
interface CreateSubaccountParams {
|
|
@@ -41,8 +43,8 @@ interface CreateSubaccountParams {
|
|
|
41
43
|
accountSigner: AccountSigner;
|
|
42
44
|
/** Optional human-readable label for this subaccount */
|
|
43
45
|
label?: string;
|
|
44
|
-
/**
|
|
45
|
-
|
|
46
|
+
/** Browser origin requesting the signature; defaults to location.origin in browsers. Required outside browsers. */
|
|
47
|
+
uri?: string;
|
|
46
48
|
}
|
|
47
49
|
interface CreateSubaccountResult {
|
|
48
50
|
subaccountId: string;
|
|
@@ -77,7 +79,7 @@ declare class AccountSignerAuthService extends AuthService {
|
|
|
77
79
|
*/
|
|
78
80
|
getAccountSigner(): AccountSigner | null;
|
|
79
81
|
/**
|
|
80
|
-
* Signs a
|
|
82
|
+
* Signs a server-issued SIWE message with the configured account signer, exchanges it for a session token, and stores the hydrated account/subaccount session state.
|
|
81
83
|
*/
|
|
82
84
|
login(options: LoginOptions): Promise<LoginResult>;
|
|
83
85
|
/**
|
|
@@ -103,6 +105,8 @@ declare class AccountSignerAuthService extends AuthService {
|
|
|
103
105
|
* Refreshes the active account-signer session and updates persisted auth state.
|
|
104
106
|
*/
|
|
105
107
|
refreshSession(params?: {
|
|
108
|
+
/** Overrides the origin remembered from login. */
|
|
109
|
+
uri?: string;
|
|
106
110
|
provider?: "metamask" | "turnkey" | "other";
|
|
107
111
|
loginMethod?: AuthLoginMethod | null;
|
|
108
112
|
}): Promise<LoginResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-signer-auth.d.ts","names":[],"sources":["../../../src/services/auth/account-signer-auth.ts"],"mappings":";;;;;;;;;;;;;UAwBiB;EACb;IAAiB;IAAmB;;EACpC;EACA;IAAS;IAAc;;EACvB;EACA,aAAa;;UAGA;EACb;EACA;EACA,WAAW;;UAGE;;;;EAIb;EACA,cAAc;;UAGD;;EAEb,eAAe;;EAEf;;EAEA;;UAGa;EACb;EACA;EACA;;;;;cAWS,iCAAiC;;WACjC,QAAM,aAAA;
|
|
1
|
+
{"version":3,"file":"account-signer-auth.d.ts","names":[],"sources":["../../../src/services/auth/account-signer-auth.ts"],"mappings":";;;;;;;;;;;;;UAwBiB;EACb;IAAiB;IAAmB;;EACpC;EACA;IAAS;IAAc;;EACvB;EACA,aAAa;;UAGA;EACb;EACA;EACA,WAAW;;UAGE;;;;EAIb;;EAEA;EACA,cAAc;;UAGD;;EAEb,eAAe;;EAEf;;EAEA;;UAGa;EACb;EACA;EACA;;;;;cAWS,iCAAiC;;WACjC,QAAM,aAAA;EAiBH,cACR,YACA,qBACA,aACA,aACA,UACA,cACA;IAEA,YAAY;IACZ,sBAAsB;IACtB,aAAa;IACb,aAAa;IACb,UAAU;IACV,cAAc;IACd,eAAe;;;;;EAmBnB,sBAAsB,aAAa;;;;EAOnC,iBAAiB,eAAe;;;;EAUhC,oBAAoB;;;;EAOd,MAAM,SAAS,eAAe,QAAQ;;;;EA+F5C,iBAAiB,OAAO;;;;EAwBlB,kBAAkB;IAAU;IAAmB;;;;;EA6D/C,UAAU;;;;EAoChB;;;;EASM,eAAe;;IAEjB;IACA;IACA,cAAc;MACd,QAAQ;;;;EAmBZ,cACI,mBACA;IAAY;IAA8B;;IACzC;IAAmB;;;EAuBxB,oBAAoB;;;;EASd,iBAAiB,QAAQ,yBAAyB,QAAQ;;;;EAuChE,YAAY"}
|
|
@@ -20,6 +20,7 @@ var AccountSignerAuthService = class extends AuthService {
|
|
|
20
20
|
#subaccounts;
|
|
21
21
|
#walletProvider = void 0;
|
|
22
22
|
#loginMethod = null;
|
|
23
|
+
#challengeUri = void 0;
|
|
23
24
|
#environmentFingerprint;
|
|
24
25
|
#tokenStorage;
|
|
25
26
|
#sessionStore;
|
|
@@ -55,7 +56,7 @@ var AccountSignerAuthService = class extends AuthService {
|
|
|
55
56
|
return this.#accountSigner;
|
|
56
57
|
}
|
|
57
58
|
/**
|
|
58
|
-
* Signs a
|
|
59
|
+
* Signs a server-issued SIWE message with the configured account signer, exchanges it for a session token, and stores the hydrated account/subaccount session state.
|
|
59
60
|
*/
|
|
60
61
|
async login(options) {
|
|
61
62
|
return this.#login(options);
|
|
@@ -66,14 +67,18 @@ var AccountSignerAuthService = class extends AuthService {
|
|
|
66
67
|
if (!accountSigner) throw new ConfigurationError("No account signer configured. Call setAccountSigner() or pass accountSigner in config.");
|
|
67
68
|
const smartAccountAddress = accountSigner.accountAddress;
|
|
68
69
|
const ownerAddress = accountSigner.ownerAddress ?? accountSigner.accountAddress;
|
|
69
|
-
const
|
|
70
|
-
const message =
|
|
70
|
+
const uri = resolveChallengeUri(options.uri ?? this.#challengeUri);
|
|
71
|
+
const { message } = await this.createWalletChallenge({
|
|
72
|
+
smartAccountAddress,
|
|
73
|
+
signerAddress: accountSigner.accountAddress,
|
|
74
|
+
uri,
|
|
75
|
+
purpose: "login"
|
|
76
|
+
});
|
|
71
77
|
const signature = await accountSigner.signMessage(message);
|
|
72
78
|
const response = await this.loginWithWallet({
|
|
73
79
|
smartAccountAddress,
|
|
74
|
-
|
|
80
|
+
message,
|
|
75
81
|
signature,
|
|
76
|
-
primaryWalletAddress: ownerAddress,
|
|
77
82
|
walletProvider: provider
|
|
78
83
|
});
|
|
79
84
|
const environmentSession = this.#getEnvironmentSession();
|
|
@@ -96,6 +101,7 @@ var AccountSignerAuthService = class extends AuthService {
|
|
|
96
101
|
this.#activeAccountId = activeAccount?.accountId ?? response.accountId;
|
|
97
102
|
this.#walletProvider = provider;
|
|
98
103
|
this.#loginMethod = resolvedLoginMethod;
|
|
104
|
+
this.#challengeUri = uri;
|
|
99
105
|
this.#accountIdentity = this.#identityFromSigner(accountSigner);
|
|
100
106
|
this.#notifyStateChange();
|
|
101
107
|
this.events.emit("authenticated", {
|
|
@@ -183,6 +189,7 @@ var AccountSignerAuthService = class extends AuthService {
|
|
|
183
189
|
this.#mainAccountId = null;
|
|
184
190
|
this.#activeAccountId = null;
|
|
185
191
|
this.#loginMethod = null;
|
|
192
|
+
this.#challengeUri = void 0;
|
|
186
193
|
this.#accountIdentity = null;
|
|
187
194
|
this.#sessionStore.clear();
|
|
188
195
|
this.#notifyStateChange();
|
|
@@ -197,6 +204,7 @@ var AccountSignerAuthService = class extends AuthService {
|
|
|
197
204
|
this.#mainAccountId = null;
|
|
198
205
|
this.#activeAccountId = null;
|
|
199
206
|
this.#loginMethod = null;
|
|
207
|
+
this.#challengeUri = void 0;
|
|
200
208
|
this.#accountIdentity = null;
|
|
201
209
|
this.#notifyStateChange();
|
|
202
210
|
if (shouldEmitLoggedOut) this.events.emit("loggedOut", void 0);
|
|
@@ -217,6 +225,7 @@ var AccountSignerAuthService = class extends AuthService {
|
|
|
217
225
|
const currentSession = this.#getEnvironmentSession();
|
|
218
226
|
return this.#login({
|
|
219
227
|
provider: this.#resolveRefreshProvider(params?.provider),
|
|
228
|
+
uri: params?.uri,
|
|
220
229
|
loginMethod: params?.loginMethod ?? this.#loginMethod
|
|
221
230
|
}, currentSession?.activeAccount);
|
|
222
231
|
}
|
|
@@ -249,19 +258,20 @@ var AccountSignerAuthService = class extends AuthService {
|
|
|
249
258
|
async createSubaccount(params) {
|
|
250
259
|
if (!this.#isAuthenticated) throw new AuthenticationError("Must be authenticated to create subaccounts");
|
|
251
260
|
if (!this.#subaccounts) throw new ConfigurationError("SubaccountsService not configured. Pass it to constructor or call setSubaccountsService().");
|
|
252
|
-
const { accountSigner, label = ""
|
|
261
|
+
const { accountSigner, label = "" } = params;
|
|
253
262
|
this.#assertAccountSignerEnvironment(accountSigner);
|
|
254
|
-
const {
|
|
255
|
-
|
|
263
|
+
const { message } = await this.createWalletChallenge({
|
|
264
|
+
smartAccountAddress: accountSigner.accountAddress,
|
|
265
|
+
signerAddress: accountSigner.accountAddress,
|
|
266
|
+
uri: resolveChallengeUri(params.uri ?? this.#challengeUri),
|
|
267
|
+
purpose: "create_subaccount"
|
|
268
|
+
});
|
|
256
269
|
const signature = await accountSigner.signMessage(message);
|
|
257
|
-
const primaryWalletAddress = this.#accountSigner?.ownerAddress ?? accountSigner.ownerAddress ?? this.#accountSigner?.accountAddress ?? "";
|
|
258
270
|
const response = await this.#subaccounts.create({
|
|
259
271
|
label,
|
|
260
272
|
smartAccountAddress: accountSigner.accountAddress,
|
|
261
|
-
|
|
262
|
-
signature
|
|
263
|
-
primaryWalletAddress,
|
|
264
|
-
walletProvider
|
|
273
|
+
message,
|
|
274
|
+
signature
|
|
265
275
|
});
|
|
266
276
|
return {
|
|
267
277
|
subaccountId: response.subaccountId,
|
|
@@ -331,6 +341,11 @@ var AccountSignerAuthService = class extends AuthService {
|
|
|
331
341
|
return this.#sessionStore.get();
|
|
332
342
|
}
|
|
333
343
|
};
|
|
344
|
+
function resolveChallengeUri(uri) {
|
|
345
|
+
const resolved = uri ?? (typeof location === "undefined" ? void 0 : location.origin);
|
|
346
|
+
if (!resolved) throw new ConfigurationError("Wallet authentication requires a browser origin URI. Pass uri outside a browser.");
|
|
347
|
+
return resolved;
|
|
348
|
+
}
|
|
334
349
|
//#endregion
|
|
335
350
|
export { AccountSignerAuthService };
|
|
336
351
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"account-signer-auth.js","names":["#accountSignerConfig","#environmentFingerprint","#subaccounts","#tokenStorage","#realtime","#sessionStore","#assertAccountSignerEnvironment","#accountSigner","#accountIdentity","#identityFromSigner","#notifyStateChange","#login","#resolveAccountSigner","#getEnvironmentSession","#loginMethod","#isAuthenticated","#mainAccountId","#activeAccountId","#walletProvider","#getEnvironmentBoundToken","#clearExpiredSessionState","#getCurrentTokenStorageOptions","#resolveRefreshProvider"],"sources":["../../../src/services/auth/account-signer-auth.ts"],"sourcesContent":["import { AuthService } from \"./auth.js\";\nimport { AuthenticationError, ConfigurationError } from \"../../shared/errors.js\";\nimport { AuthSessionStore } from \"./session.js\";\nimport type { AccountSigner, AccountSignerConfig, HexAddress } from \"../../account-signer/types.js\";\nimport { assertAccountSigner, resolveAccountSigner } from \"../../account-signer/types.js\";\nimport { EventEmitter } from \"../../utils/event-emitter.js\";\nimport { isJwtValid, getJwtTimeToExpiry } from \"../../utils/jwt.js\";\nimport type { SubaccountsService } from \"../subaccounts/index.js\";\nimport type {\n AuthState,\n AuthHydrationData,\n AuthLoginMethod,\n SessionData,\n ActiveAccountInfo,\n} from \"./session.types.js\";\nimport type { PolyesterRealtime } from \"../../realtime/index.js\";\nimport type { PolyesterEnvironment } from \"../../environment.js\";\nimport type { AuthAndPublicApiTransports } from \"../../shared/transports.js\";\nimport {\n createAuthTokenStorageSetOptions,\n type AuthTokenStorage,\n type AuthTokenStorageSetOptions,\n} from \"./token-storage.js\";\n\nexport interface AccountSignerAuthEvents {\n authenticated: { accountId: string; username: string };\n loggedOut: void;\n error: { code: string; message: string };\n servicesReady: void;\n stateChange: AuthState;\n}\n\nexport interface LoginResult {\n accountId: string;\n username: string;\n expiresAt: Date;\n}\n\nexport interface LoginOptions {\n /**\n * The wallet provider to use for login.\n */\n provider: \"metamask\" | \"turnkey\" | \"other\";\n loginMethod?: AuthLoginMethod | null;\n}\n\nexport interface CreateSubaccountParams {\n /** The account signer for the new subaccount (caller derives this, e.g. via Turnkey saltNonce) */\n accountSigner: AccountSigner;\n /** Optional human-readable label for this subaccount */\n label?: string;\n /** Wallet provider hint (e.g. \"turnkey\", \"metamask\"). Defaults to \"wallet\" */\n walletProvider?: string;\n}\n\nexport interface CreateSubaccountResult {\n subaccountId: string;\n smartAccountSaltNonce: number;\n revision: string;\n}\n\ninterface AccountIdentity {\n accountAddress: HexAddress;\n ownerAddress?: HexAddress;\n}\n\n/**\n * Coordinates wallet/account-signer authentication, session storage, subaccount selection, and session refresh.\n */\nexport class AccountSignerAuthService extends AuthService {\n readonly events = new EventEmitter<AccountSignerAuthEvents>();\n\n #accountSignerConfig: AccountSignerConfig | undefined;\n #accountSigner: AccountSigner | null = null;\n #accountIdentity: AccountIdentity | null = null;\n #isAuthenticated = false;\n #mainAccountId: string | null = null;\n #activeAccountId: string | null = null;\n #subaccounts: SubaccountsService;\n #walletProvider: \"metamask\" | \"turnkey\" | \"other\" | undefined = undefined;\n #loginMethod: AuthLoginMethod | null = null;\n #environmentFingerprint: string;\n #tokenStorage: AuthTokenStorage;\n #sessionStore: AuthSessionStore;\n #realtime: PolyesterRealtime;\n\n constructor({\n transports,\n accountSignerConfig,\n environment,\n subaccounts,\n realtime,\n tokenStorage,\n sessionStore,\n }: {\n transports: AuthAndPublicApiTransports;\n accountSignerConfig?: AccountSignerConfig;\n environment: PolyesterEnvironment;\n subaccounts: SubaccountsService;\n realtime: PolyesterRealtime;\n tokenStorage: AuthTokenStorage;\n sessionStore?: AuthSessionStore;\n }) {\n super(transports, realtime);\n\n this.#accountSignerConfig = accountSignerConfig;\n this.#environmentFingerprint = environment.fingerprint;\n this.#subaccounts = subaccounts;\n this.#tokenStorage = tokenStorage;\n this.#realtime = realtime;\n this.#sessionStore =\n sessionStore ??\n new AuthSessionStore({\n environmentFingerprint: environment.fingerprint,\n });\n }\n\n /**\n * Attaches the subaccounts service used when creating a subaccount during authenticated flows.\n */\n setSubaccountsService(subaccounts: SubaccountsService): void {\n this.#subaccounts = subaccounts;\n }\n\n /**\n * Sets the account signer used to sign login and account-switch challenges.\n */\n setAccountSigner(accountSigner: AccountSigner | null): void {\n if (accountSigner) this.#assertAccountSignerEnvironment(accountSigner);\n this.#accountSigner = accountSigner;\n this.#accountIdentity = accountSigner ? this.#identityFromSigner(accountSigner) : null;\n this.#notifyStateChange();\n }\n\n /**\n * Returns the active account signer, throwing if one has not been configured.\n */\n getAccountSigner(): AccountSigner | null {\n return this.#accountSigner;\n }\n\n /**\n * Signs a short-lived login nonce with the configured account signer, exchanges it for a session token, and stores the hydrated account/subaccount session state.\n */\n async login(options: LoginOptions): Promise<LoginResult> {\n return this.#login(options);\n }\n\n async #login(\n options: LoginOptions,\n previousActiveAccount?: ActiveAccountInfo,\n ): Promise<LoginResult> {\n const { provider, loginMethod } = options;\n\n const accountSigner = await this.#resolveAccountSigner();\n\n if (!accountSigner) {\n throw new ConfigurationError(\n \"No account signer configured. Call setAccountSigner() or pass accountSigner in config.\",\n );\n }\n\n const smartAccountAddress = accountSigner.accountAddress;\n const ownerAddress = accountSigner.ownerAddress ?? accountSigner.accountAddress;\n\n const { nonce } = await this.requestLoginNonce(smartAccountAddress);\n\n const message = `Polyester Login\\n\\nNonce: ${nonce}`;\n const signature = await accountSigner.signMessage(message);\n\n const response = await this.loginWithWallet({\n smartAccountAddress,\n nonce,\n signature,\n primaryWalletAddress: ownerAddress,\n walletProvider: provider,\n });\n\n const environmentSession = this.#getEnvironmentSession();\n const resolvedLoginMethod =\n loginMethod ??\n this.#loginMethod ??\n environmentSession?.loginMethod ??\n (provider === \"metamask\" ? \"metamask\" : null);\n\n const tokenOptions = createAuthTokenStorageSetOptions(response.accessToken);\n const activeAccount =\n previousActiveAccount?.mainAccountId === response.accountId\n ? previousActiveAccount\n : undefined;\n this.#sessionStore.commitLogin(\n {\n accessToken: response.accessToken,\n tokenOptions,\n provider,\n loginMethod: resolvedLoginMethod,\n primaryWallet: ownerAddress,\n smartAccount: smartAccountAddress,\n accountId: response.accountId,\n activeAccount,\n username: response.username ?? undefined,\n },\n this.#tokenStorage,\n );\n this.#isAuthenticated = true;\n this.#mainAccountId = response.accountId;\n this.#activeAccountId = activeAccount?.accountId ?? response.accountId;\n this.#walletProvider = provider;\n this.#loginMethod = resolvedLoginMethod;\n this.#accountIdentity = this.#identityFromSigner(accountSigner);\n\n this.#notifyStateChange();\n\n this.events.emit(\"authenticated\", {\n accountId: response.accountId,\n username: response.username,\n });\n\n const expiresAt = response.expiresAt\n ? new Date(\n Number(response.expiresAt.seconds) * 1000 +\n (response.expiresAt.nanos ?? 0) / 1_000_000,\n )\n : new Date();\n\n return {\n accountId: response.accountId,\n username: response.username,\n expiresAt,\n };\n }\n\n /**\n * Builds auth state from a session token and optional active account override.\n */\n hydrateAuthState(state: AuthHydrationData): void {\n const existingToken = this.#getEnvironmentBoundToken();\n if (!existingToken || !isJwtValid(existingToken)) return;\n\n const existingSession = this.#getEnvironmentSession();\n this.#walletProvider = existingSession?.provider ?? this.#walletProvider;\n this.#loginMethod = existingSession?.loginMethod ?? this.#loginMethod;\n\n this.#isAuthenticated = true;\n this.#mainAccountId = state.mainAccountId;\n this.#activeAccountId = state.activeAccountId ?? state.mainAccountId;\n this.#accountIdentity = state.smartAccountAddress\n ? {\n accountAddress: state.smartAccountAddress,\n ownerAddress: state.ownerAddress,\n }\n : null;\n\n this.#notifyStateChange();\n }\n\n /**\n * Loads the stored token, validates that it still belongs to this environment, and restores auth state when possible.\n */\n async restoreSession(): Promise<{ accountId: string; username: string } | null> {\n const existingToken = this.#getEnvironmentBoundToken();\n\n if (!existingToken || !isJwtValid(existingToken)) {\n this.#clearExpiredSessionState();\n return null;\n }\n\n try {\n const me = await this.me();\n this.#isAuthenticated = true;\n this.#mainAccountId = me.accountId;\n\n // preserve active account if already set (e.g. via hydration), otherwise use main\n const existingSession = this.#getEnvironmentSession();\n this.#walletProvider = existingSession?.provider ?? this.#walletProvider;\n this.#loginMethod = existingSession?.loginMethod ?? this.#loginMethod;\n if (!this.#activeAccountId) {\n this.#activeAccountId = existingSession?.activeAccount?.accountId ?? me.accountId;\n }\n\n // use existing account signer if set, otherwise try to resolve from config\n if (!this.#accountSigner) {\n this.#accountSigner = await resolveAccountSigner(this.#accountSignerConfig);\n if (this.#accountSigner) {\n this.#assertAccountSignerEnvironment(this.#accountSigner);\n this.#accountIdentity = this.#identityFromSigner(this.#accountSigner);\n }\n }\n\n // keep the display session available for SSR hydration\n if (this.#accountSigner?.accountAddress) {\n const session = this.#sessionStore.ensureSession(\n {\n provider: this.#walletProvider ? this.#walletProvider : \"other\",\n loginMethod:\n this.#loginMethod ??\n (this.#walletProvider === \"metamask\" ? \"metamask\" : null),\n primaryWallet:\n this.#accountSigner.ownerAddress ?? this.#accountSigner.accountAddress,\n smartAccount: this.#accountSigner.accountAddress,\n accountId: me.accountId,\n username: me.username ?? undefined,\n },\n { maxAgeSeconds: this.#getCurrentTokenStorageOptions().maxAgeSeconds },\n );\n this.#walletProvider = session.provider;\n this.#loginMethod = session.loginMethod ?? this.#loginMethod;\n }\n\n this.#notifyStateChange();\n return { accountId: me.accountId, username: me.username };\n } catch {\n this.#clearExpiredSessionState();\n return null;\n }\n }\n\n /**\n * Clears stored auth state and removes the persisted auth token.\n */\n async logout(): Promise<void> {\n this.#realtime.disconnectPrivate();\n this.#tokenStorage.clear();\n this.#isAuthenticated = false;\n this.#mainAccountId = null;\n this.#activeAccountId = null;\n this.#loginMethod = null;\n this.#accountIdentity = null;\n\n this.#sessionStore.clear();\n\n this.#notifyStateChange();\n this.events.emit(\"loggedOut\", undefined);\n }\n\n #clearExpiredSessionState(): void {\n const shouldEmitLoggedOut = this.#isAuthenticated;\n this.#realtime.disconnectPrivate();\n this.#tokenStorage.clear();\n this.#sessionStore.clear();\n this.#isAuthenticated = false;\n this.#mainAccountId = null;\n this.#activeAccountId = null;\n this.#loginMethod = null;\n this.#accountIdentity = null;\n this.#notifyStateChange();\n if (shouldEmitLoggedOut) {\n this.events.emit(\"loggedOut\", undefined);\n }\n }\n\n /**\n * Returns the remaining lifetime of the stored session token in milliseconds.\n */\n getSessionTimeToExpiry(): number {\n const token = this.#getEnvironmentBoundToken();\n if (!token) return 0;\n return getJwtTimeToExpiry(token);\n }\n\n /**\n * Refreshes the active account-signer session and updates persisted auth state.\n */\n async refreshSession(params?: {\n provider?: \"metamask\" | \"turnkey\" | \"other\";\n loginMethod?: AuthLoginMethod | null;\n }): Promise<LoginResult> {\n if (!this.#isAuthenticated) {\n throw new AuthenticationError(\"Must be authenticated to refresh session\");\n }\n\n const currentSession = this.#getEnvironmentSession();\n return this.#login(\n {\n provider: this.#resolveRefreshProvider(params?.provider),\n loginMethod: params?.loginMethod ?? this.#loginMethod,\n },\n currentSession?.activeAccount,\n );\n }\n\n /**\n * Switches the active account/subaccount by signing the required account switch flow.\n */\n switchAccount(\n accountId: string,\n options?: { smartAccountAddress?: string; label?: string },\n ): { accountId: string; isMain: boolean } {\n if (!this.#isAuthenticated || !this.#mainAccountId) {\n throw new AuthenticationError(\"Must be authenticated to switch accounts\");\n }\n\n this.#activeAccountId = accountId;\n const isMain = accountId === this.#mainAccountId;\n\n this.#sessionStore.setActiveAccount(\n {\n accountId,\n isMain,\n smartAccountAddress: options?.smartAccountAddress,\n label: options?.label,\n },\n { maxAgeSeconds: this.#getCurrentTokenStorageOptions().maxAgeSeconds },\n );\n this.#notifyStateChange();\n\n return { accountId, isMain };\n }\n\n /** Keeps the display-session identity current for the next server render. */\n syncSessionUsername(username: string | null): void {\n this.#sessionStore.setUsername(username, {\n maxAgeSeconds: this.#getCurrentTokenStorageOptions().maxAgeSeconds,\n });\n }\n\n /**\n * Creates a subaccount for the authenticated account and makes it available to the session state.\n */\n async createSubaccount(params: CreateSubaccountParams): Promise<CreateSubaccountResult> {\n if (!this.#isAuthenticated) {\n throw new AuthenticationError(\"Must be authenticated to create subaccounts\");\n }\n\n if (!this.#subaccounts) {\n throw new ConfigurationError(\n \"SubaccountsService not configured. Pass it to constructor or call setSubaccountsService().\",\n );\n }\n\n const { accountSigner, label = \"\", walletProvider = \"wallet\" } = params;\n this.#assertAccountSignerEnvironment(accountSigner);\n\n // request nonce for the subaccount's smart account address\n const { nonce } = await this.requestLoginNonce(accountSigner.accountAddress);\n\n // sign canonical login message with the subaccount account signer\n const message = `Polyester Login\\n\\nNonce: ${nonce}`;\n const signature = await accountSigner.signMessage(message);\n\n // use main account signer's owner address for primary wallet reference\n const primaryWalletAddress =\n this.#accountSigner?.ownerAddress ??\n accountSigner.ownerAddress ??\n this.#accountSigner?.accountAddress ??\n \"\";\n\n const response = await this.#subaccounts.create({\n label,\n smartAccountAddress: accountSigner.accountAddress,\n nonce,\n signature,\n primaryWalletAddress,\n walletProvider,\n });\n\n return {\n subaccountId: response.subaccountId,\n smartAccountSaltNonce: response.smartAccountSaltNonce,\n revision: response.revision,\n };\n }\n\n /**\n * Returns the current account-signer auth state snapshot.\n */\n getState(): AuthState {\n const accountIdentity = this.#accountSigner ?? this.#accountIdentity;\n\n return {\n isAuthenticated: this.#isAuthenticated,\n accountAddress: accountIdentity?.accountAddress ?? null,\n ownerAddress: accountIdentity?.ownerAddress ?? null,\n mainAccountId: this.#mainAccountId,\n activeAccount:\n this.#activeAccountId && this.#mainAccountId\n ? {\n accountId: this.#activeAccountId,\n isMain: this.#activeAccountId === this.#mainAccountId,\n mainAccountId: this.#mainAccountId,\n smartAccountAddress: accountIdentity?.accountAddress,\n }\n : null,\n };\n }\n\n async #resolveAccountSigner(): Promise<AccountSigner | null> {\n if (this.#accountSigner) {\n this.#assertAccountSignerEnvironment(this.#accountSigner);\n return this.#accountSigner;\n }\n\n const resolved = await resolveAccountSigner(this.#accountSignerConfig);\n if (resolved) {\n this.#assertAccountSignerEnvironment(resolved);\n this.#accountSigner = resolved;\n this.#accountIdentity = this.#identityFromSigner(resolved);\n }\n return this.#accountSigner;\n }\n\n #notifyStateChange(): void {\n this.events.emit(\"stateChange\", this.getState());\n }\n\n #getEnvironmentBoundToken(): string | null {\n return this.#sessionStore.getEnvironmentBoundToken(this.#tokenStorage);\n }\n\n #getCurrentTokenStorageOptions(): AuthTokenStorageSetOptions {\n const token = this.#tokenStorage.get();\n if (!token) return { expiresAt: null, maxAgeSeconds: null };\n return createAuthTokenStorageSetOptions(token);\n }\n\n #resolveRefreshProvider(\n provider?: \"metamask\" | \"turnkey\" | \"other\",\n ): \"metamask\" | \"turnkey\" | \"other\" {\n return (\n provider ?? this.#walletProvider ?? this.#getEnvironmentSession()?.provider ?? \"other\"\n );\n }\n\n #assertAccountSignerEnvironment(accountSigner: AccountSigner): void {\n assertAccountSigner(accountSigner);\n if (accountSigner.environmentFingerprint !== this.#environmentFingerprint) {\n throw new ConfigurationError(\n \"Account signer environment does not match client environment.\",\n );\n }\n }\n\n #identityFromSigner(accountSigner: AccountSigner): AccountIdentity {\n return {\n accountAddress: accountSigner.accountAddress,\n ownerAddress: accountSigner.ownerAddress,\n };\n }\n\n #getEnvironmentSession(): SessionData | null {\n return this.#sessionStore.get();\n }\n}\n"],"mappings":";;;;;;;;;;;AAqEA,IAAa,2BAAb,cAA8C,YAAY;CACtD,SAAkB,IAAI,aAAsC;CAE5D;CACA,iBAAuC;CACvC,mBAA2C;CAC3C,mBAAmB;CACnB,iBAAgC;CAChC,mBAAkC;CAClC;CACA,kBAAgE,KAAA;CAChE,eAAuC;CACvC;CACA;CACA;CACA;CAEA,YAAY,EACR,YACA,qBACA,aACA,aACA,UACA,cACA,gBASD;EACC,MAAM,YAAY,QAAQ;EAE1B,KAAKA,uBAAuB;EAC5B,KAAKC,0BAA0B,YAAY;EAC3C,KAAKC,eAAe;EACpB,KAAKC,gBAAgB;EACrB,KAAKC,YAAY;EACjB,KAAKC,gBACD,gBACA,IAAI,iBAAiB,EACjB,wBAAwB,YAAY,YACxC,CAAC;CACT;;;;CAKA,sBAAsB,aAAuC;EACzD,KAAKH,eA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,eAAe;EAAK;EAC1D,OAAO,iCAAiC,KAAK;CACjD;CAEA,wBACI,UACgC;EAChC,OACI,YAAY,KAAKe,mBAAmB,KAAKL,uBAAuB,CAAC,EAAE,YAAY;CAEvF;CAEA,gCAAgC,eAAoC;EAChE,oBAAoB,aAAa;EACjC,IAAI,cAAc,2BAA2B,KAAKZ,yBAC9C,MAAM,IAAI,mBACN,+DACJ;CAER;CAEA,oBAAoB,eAA+C;EAC/D,OAAO;GACH,gBAAgB,cAAc;GAC9B,cAAc,cAAc;EAChC;CACJ;CAEA,yBAA6C;EACzC,OAAO,KAAKI,cAAc,IAAI;CAClC;AACJ"}
|
|
1
|
+
{"version":3,"file":"account-signer-auth.js","names":["#accountSignerConfig","#environmentFingerprint","#subaccounts","#tokenStorage","#realtime","#sessionStore","#assertAccountSignerEnvironment","#accountSigner","#accountIdentity","#identityFromSigner","#notifyStateChange","#login","#resolveAccountSigner","#challengeUri","#getEnvironmentSession","#loginMethod","#isAuthenticated","#mainAccountId","#activeAccountId","#walletProvider","#getEnvironmentBoundToken","#clearExpiredSessionState","#getCurrentTokenStorageOptions","#resolveRefreshProvider"],"sources":["../../../src/services/auth/account-signer-auth.ts"],"sourcesContent":["import { AuthService } from \"./auth.js\";\nimport { AuthenticationError, ConfigurationError } from \"../../shared/errors.js\";\nimport { AuthSessionStore } from \"./session.js\";\nimport type { AccountSigner, AccountSignerConfig, HexAddress } from \"../../account-signer/types.js\";\nimport { assertAccountSigner, resolveAccountSigner } from \"../../account-signer/types.js\";\nimport { EventEmitter } from \"../../utils/event-emitter.js\";\nimport { isJwtValid, getJwtTimeToExpiry } from \"../../utils/jwt.js\";\nimport type { SubaccountsService } from \"../subaccounts/index.js\";\nimport type {\n AuthState,\n AuthHydrationData,\n AuthLoginMethod,\n SessionData,\n ActiveAccountInfo,\n} from \"./session.types.js\";\nimport type { PolyesterRealtime } from \"../../realtime/index.js\";\nimport type { PolyesterEnvironment } from \"../../environment.js\";\nimport type { AuthAndPublicApiTransports } from \"../../shared/transports.js\";\nimport {\n createAuthTokenStorageSetOptions,\n type AuthTokenStorage,\n type AuthTokenStorageSetOptions,\n} from \"./token-storage.js\";\n\nexport interface AccountSignerAuthEvents {\n authenticated: { accountId: string; username: string };\n loggedOut: void;\n error: { code: string; message: string };\n servicesReady: void;\n stateChange: AuthState;\n}\n\nexport interface LoginResult {\n accountId: string;\n username: string;\n expiresAt: Date;\n}\n\nexport interface LoginOptions {\n /**\n * The wallet provider to use for login.\n */\n provider: \"metamask\" | \"turnkey\" | \"other\";\n /** Browser origin requesting the signature; defaults to location.origin in browsers. Required outside browsers. */\n uri?: string;\n loginMethod?: AuthLoginMethod | null;\n}\n\nexport interface CreateSubaccountParams {\n /** The account signer for the new subaccount (caller derives this, e.g. via Turnkey saltNonce) */\n accountSigner: AccountSigner;\n /** Optional human-readable label for this subaccount */\n label?: string;\n /** Browser origin requesting the signature; defaults to location.origin in browsers. Required outside browsers. */\n uri?: string;\n}\n\nexport interface CreateSubaccountResult {\n subaccountId: string;\n smartAccountSaltNonce: number;\n revision: string;\n}\n\ninterface AccountIdentity {\n accountAddress: HexAddress;\n ownerAddress?: HexAddress;\n}\n\n/**\n * Coordinates wallet/account-signer authentication, session storage, subaccount selection, and session refresh.\n */\nexport class AccountSignerAuthService extends AuthService {\n readonly events = new EventEmitter<AccountSignerAuthEvents>();\n\n #accountSignerConfig: AccountSignerConfig | undefined;\n #accountSigner: AccountSigner | null = null;\n #accountIdentity: AccountIdentity | null = null;\n #isAuthenticated = false;\n #mainAccountId: string | null = null;\n #activeAccountId: string | null = null;\n #subaccounts: SubaccountsService;\n #walletProvider: \"metamask\" | \"turnkey\" | \"other\" | undefined = undefined;\n #loginMethod: AuthLoginMethod | null = null;\n #challengeUri: string | undefined = undefined;\n #environmentFingerprint: string;\n #tokenStorage: AuthTokenStorage;\n #sessionStore: AuthSessionStore;\n #realtime: PolyesterRealtime;\n\n constructor({\n transports,\n accountSignerConfig,\n environment,\n subaccounts,\n realtime,\n tokenStorage,\n sessionStore,\n }: {\n transports: AuthAndPublicApiTransports;\n accountSignerConfig?: AccountSignerConfig;\n environment: PolyesterEnvironment;\n subaccounts: SubaccountsService;\n realtime: PolyesterRealtime;\n tokenStorage: AuthTokenStorage;\n sessionStore?: AuthSessionStore;\n }) {\n super(transports, realtime);\n\n this.#accountSignerConfig = accountSignerConfig;\n this.#environmentFingerprint = environment.fingerprint;\n this.#subaccounts = subaccounts;\n this.#tokenStorage = tokenStorage;\n this.#realtime = realtime;\n this.#sessionStore =\n sessionStore ??\n new AuthSessionStore({\n environmentFingerprint: environment.fingerprint,\n });\n }\n\n /**\n * Attaches the subaccounts service used when creating a subaccount during authenticated flows.\n */\n setSubaccountsService(subaccounts: SubaccountsService): void {\n this.#subaccounts = subaccounts;\n }\n\n /**\n * Sets the account signer used to sign login and account-switch challenges.\n */\n setAccountSigner(accountSigner: AccountSigner | null): void {\n if (accountSigner) this.#assertAccountSignerEnvironment(accountSigner);\n this.#accountSigner = accountSigner;\n this.#accountIdentity = accountSigner ? this.#identityFromSigner(accountSigner) : null;\n this.#notifyStateChange();\n }\n\n /**\n * Returns the active account signer, throwing if one has not been configured.\n */\n getAccountSigner(): AccountSigner | null {\n return this.#accountSigner;\n }\n\n /**\n * Signs a server-issued SIWE message with the configured account signer, exchanges it for a session token, and stores the hydrated account/subaccount session state.\n */\n async login(options: LoginOptions): Promise<LoginResult> {\n return this.#login(options);\n }\n\n async #login(\n options: LoginOptions,\n previousActiveAccount?: ActiveAccountInfo,\n ): Promise<LoginResult> {\n const { provider, loginMethod } = options;\n\n const accountSigner = await this.#resolveAccountSigner();\n\n if (!accountSigner) {\n throw new ConfigurationError(\n \"No account signer configured. Call setAccountSigner() or pass accountSigner in config.\",\n );\n }\n\n const smartAccountAddress = accountSigner.accountAddress;\n const ownerAddress = accountSigner.ownerAddress ?? accountSigner.accountAddress;\n\n const uri = resolveChallengeUri(options.uri ?? this.#challengeUri);\n const { message } = await this.createWalletChallenge({\n smartAccountAddress,\n signerAddress: accountSigner.accountAddress,\n uri,\n purpose: \"login\",\n });\n const signature = await accountSigner.signMessage(message);\n\n const response = await this.loginWithWallet({\n smartAccountAddress,\n message,\n signature,\n walletProvider: provider,\n });\n\n const environmentSession = this.#getEnvironmentSession();\n const resolvedLoginMethod =\n loginMethod ??\n this.#loginMethod ??\n environmentSession?.loginMethod ??\n (provider === \"metamask\" ? \"metamask\" : null);\n\n const tokenOptions = createAuthTokenStorageSetOptions(response.accessToken);\n const activeAccount =\n previousActiveAccount?.mainAccountId === response.accountId\n ? previousActiveAccount\n : undefined;\n this.#sessionStore.commitLogin(\n {\n accessToken: response.accessToken,\n tokenOptions,\n provider,\n loginMethod: resolvedLoginMethod,\n primaryWallet: ownerAddress,\n smartAccount: smartAccountAddress,\n accountId: response.accountId,\n activeAccount,\n username: response.username ?? undefined,\n },\n this.#tokenStorage,\n );\n this.#isAuthenticated = true;\n this.#mainAccountId = response.accountId;\n this.#activeAccountId = activeAccount?.accountId ?? response.accountId;\n this.#walletProvider = provider;\n this.#loginMethod = resolvedLoginMethod;\n this.#challengeUri = uri;\n this.#accountIdentity = this.#identityFromSigner(accountSigner);\n\n this.#notifyStateChange();\n\n this.events.emit(\"authenticated\", {\n accountId: response.accountId,\n username: response.username,\n });\n\n const expiresAt = response.expiresAt\n ? new Date(\n Number(response.expiresAt.seconds) * 1000 +\n (response.expiresAt.nanos ?? 0) / 1_000_000,\n )\n : new Date();\n\n return {\n accountId: response.accountId,\n username: response.username,\n expiresAt,\n };\n }\n\n /**\n * Builds auth state from a session token and optional active account override.\n */\n hydrateAuthState(state: AuthHydrationData): void {\n const existingToken = this.#getEnvironmentBoundToken();\n if (!existingToken || !isJwtValid(existingToken)) return;\n\n const existingSession = this.#getEnvironmentSession();\n this.#walletProvider = existingSession?.provider ?? this.#walletProvider;\n this.#loginMethod = existingSession?.loginMethod ?? this.#loginMethod;\n\n this.#isAuthenticated = true;\n this.#mainAccountId = state.mainAccountId;\n this.#activeAccountId = state.activeAccountId ?? state.mainAccountId;\n this.#accountIdentity = state.smartAccountAddress\n ? {\n accountAddress: state.smartAccountAddress,\n ownerAddress: state.ownerAddress,\n }\n : null;\n\n this.#notifyStateChange();\n }\n\n /**\n * Loads the stored token, validates that it still belongs to this environment, and restores auth state when possible.\n */\n async restoreSession(): Promise<{ accountId: string; username: string } | null> {\n const existingToken = this.#getEnvironmentBoundToken();\n\n if (!existingToken || !isJwtValid(existingToken)) {\n this.#clearExpiredSessionState();\n return null;\n }\n\n try {\n const me = await this.me();\n this.#isAuthenticated = true;\n this.#mainAccountId = me.accountId;\n\n // preserve active account if already set (e.g. via hydration), otherwise use main\n const existingSession = this.#getEnvironmentSession();\n this.#walletProvider = existingSession?.provider ?? this.#walletProvider;\n this.#loginMethod = existingSession?.loginMethod ?? this.#loginMethod;\n if (!this.#activeAccountId) {\n this.#activeAccountId = existingSession?.activeAccount?.accountId ?? me.accountId;\n }\n\n // use existing account signer if set, otherwise try to resolve from config\n if (!this.#accountSigner) {\n this.#accountSigner = await resolveAccountSigner(this.#accountSignerConfig);\n if (this.#accountSigner) {\n this.#assertAccountSignerEnvironment(this.#accountSigner);\n this.#accountIdentity = this.#identityFromSigner(this.#accountSigner);\n }\n }\n\n // keep the display session available for SSR hydration\n if (this.#accountSigner?.accountAddress) {\n const session = this.#sessionStore.ensureSession(\n {\n provider: this.#walletProvider ? this.#walletProvider : \"other\",\n loginMethod:\n this.#loginMethod ??\n (this.#walletProvider === \"metamask\" ? \"metamask\" : null),\n primaryWallet:\n this.#accountSigner.ownerAddress ?? this.#accountSigner.accountAddress,\n smartAccount: this.#accountSigner.accountAddress,\n accountId: me.accountId,\n username: me.username ?? undefined,\n },\n { maxAgeSeconds: this.#getCurrentTokenStorageOptions().maxAgeSeconds },\n );\n this.#walletProvider = session.provider;\n this.#loginMethod = session.loginMethod ?? this.#loginMethod;\n }\n\n this.#notifyStateChange();\n return { accountId: me.accountId, username: me.username };\n } catch {\n this.#clearExpiredSessionState();\n return null;\n }\n }\n\n /**\n * Clears stored auth state and removes the persisted auth token.\n */\n async logout(): Promise<void> {\n this.#realtime.disconnectPrivate();\n this.#tokenStorage.clear();\n this.#isAuthenticated = false;\n this.#mainAccountId = null;\n this.#activeAccountId = null;\n this.#loginMethod = null;\n this.#challengeUri = undefined;\n this.#accountIdentity = null;\n\n this.#sessionStore.clear();\n\n this.#notifyStateChange();\n this.events.emit(\"loggedOut\", undefined);\n }\n\n #clearExpiredSessionState(): void {\n const shouldEmitLoggedOut = this.#isAuthenticated;\n this.#realtime.disconnectPrivate();\n this.#tokenStorage.clear();\n this.#sessionStore.clear();\n this.#isAuthenticated = false;\n this.#mainAccountId = null;\n this.#activeAccountId = null;\n this.#loginMethod = null;\n this.#challengeUri = undefined;\n this.#accountIdentity = null;\n this.#notifyStateChange();\n if (shouldEmitLoggedOut) {\n this.events.emit(\"loggedOut\", undefined);\n }\n }\n\n /**\n * Returns the remaining lifetime of the stored session token in milliseconds.\n */\n getSessionTimeToExpiry(): number {\n const token = this.#getEnvironmentBoundToken();\n if (!token) return 0;\n return getJwtTimeToExpiry(token);\n }\n\n /**\n * Refreshes the active account-signer session and updates persisted auth state.\n */\n async refreshSession(params?: {\n /** Overrides the origin remembered from login. */\n uri?: string;\n provider?: \"metamask\" | \"turnkey\" | \"other\";\n loginMethod?: AuthLoginMethod | null;\n }): Promise<LoginResult> {\n if (!this.#isAuthenticated) {\n throw new AuthenticationError(\"Must be authenticated to refresh session\");\n }\n\n const currentSession = this.#getEnvironmentSession();\n return this.#login(\n {\n provider: this.#resolveRefreshProvider(params?.provider),\n uri: params?.uri,\n loginMethod: params?.loginMethod ?? this.#loginMethod,\n },\n currentSession?.activeAccount,\n );\n }\n\n /**\n * Switches the active account/subaccount by signing the required account switch flow.\n */\n switchAccount(\n accountId: string,\n options?: { smartAccountAddress?: string; label?: string },\n ): { accountId: string; isMain: boolean } {\n if (!this.#isAuthenticated || !this.#mainAccountId) {\n throw new AuthenticationError(\"Must be authenticated to switch accounts\");\n }\n\n this.#activeAccountId = accountId;\n const isMain = accountId === this.#mainAccountId;\n\n this.#sessionStore.setActiveAccount(\n {\n accountId,\n isMain,\n smartAccountAddress: options?.smartAccountAddress,\n label: options?.label,\n },\n { maxAgeSeconds: this.#getCurrentTokenStorageOptions().maxAgeSeconds },\n );\n this.#notifyStateChange();\n\n return { accountId, isMain };\n }\n\n /** Keeps the display-session identity current for the next server render. */\n syncSessionUsername(username: string | null): void {\n this.#sessionStore.setUsername(username, {\n maxAgeSeconds: this.#getCurrentTokenStorageOptions().maxAgeSeconds,\n });\n }\n\n /**\n * Creates a subaccount for the authenticated account and makes it available to the session state.\n */\n async createSubaccount(params: CreateSubaccountParams): Promise<CreateSubaccountResult> {\n if (!this.#isAuthenticated) {\n throw new AuthenticationError(\"Must be authenticated to create subaccounts\");\n }\n\n if (!this.#subaccounts) {\n throw new ConfigurationError(\n \"SubaccountsService not configured. Pass it to constructor or call setSubaccountsService().\",\n );\n }\n\n const { accountSigner, label = \"\" } = params;\n this.#assertAccountSignerEnvironment(accountSigner);\n\n const { message } = await this.createWalletChallenge({\n smartAccountAddress: accountSigner.accountAddress,\n signerAddress: accountSigner.accountAddress,\n uri: resolveChallengeUri(params.uri ?? this.#challengeUri),\n purpose: \"create_subaccount\",\n });\n const signature = await accountSigner.signMessage(message);\n\n const response = await this.#subaccounts.create({\n label,\n smartAccountAddress: accountSigner.accountAddress,\n message,\n signature,\n });\n\n return {\n subaccountId: response.subaccountId,\n smartAccountSaltNonce: response.smartAccountSaltNonce,\n revision: response.revision,\n };\n }\n\n /**\n * Returns the current account-signer auth state snapshot.\n */\n getState(): AuthState {\n const accountIdentity = this.#accountSigner ?? this.#accountIdentity;\n\n return {\n isAuthenticated: this.#isAuthenticated,\n accountAddress: accountIdentity?.accountAddress ?? null,\n ownerAddress: accountIdentity?.ownerAddress ?? null,\n mainAccountId: this.#mainAccountId,\n activeAccount:\n this.#activeAccountId && this.#mainAccountId\n ? {\n accountId: this.#activeAccountId,\n isMain: this.#activeAccountId === this.#mainAccountId,\n mainAccountId: this.#mainAccountId,\n smartAccountAddress: accountIdentity?.accountAddress,\n }\n : null,\n };\n }\n\n async #resolveAccountSigner(): Promise<AccountSigner | null> {\n if (this.#accountSigner) {\n this.#assertAccountSignerEnvironment(this.#accountSigner);\n return this.#accountSigner;\n }\n\n const resolved = await resolveAccountSigner(this.#accountSignerConfig);\n if (resolved) {\n this.#assertAccountSignerEnvironment(resolved);\n this.#accountSigner = resolved;\n this.#accountIdentity = this.#identityFromSigner(resolved);\n }\n return this.#accountSigner;\n }\n\n #notifyStateChange(): void {\n this.events.emit(\"stateChange\", this.getState());\n }\n\n #getEnvironmentBoundToken(): string | null {\n return this.#sessionStore.getEnvironmentBoundToken(this.#tokenStorage);\n }\n\n #getCurrentTokenStorageOptions(): AuthTokenStorageSetOptions {\n const token = this.#tokenStorage.get();\n if (!token) return { expiresAt: null, maxAgeSeconds: null };\n return createAuthTokenStorageSetOptions(token);\n }\n\n #resolveRefreshProvider(\n provider?: \"metamask\" | \"turnkey\" | \"other\",\n ): \"metamask\" | \"turnkey\" | \"other\" {\n return (\n provider ?? this.#walletProvider ?? this.#getEnvironmentSession()?.provider ?? \"other\"\n );\n }\n\n #assertAccountSignerEnvironment(accountSigner: AccountSigner): void {\n assertAccountSigner(accountSigner);\n if (accountSigner.environmentFingerprint !== this.#environmentFingerprint) {\n throw new ConfigurationError(\n \"Account signer environment does not match client environment.\",\n );\n }\n }\n\n #identityFromSigner(accountSigner: AccountSigner): AccountIdentity {\n return {\n accountAddress: accountSigner.accountAddress,\n ownerAddress: accountSigner.ownerAddress,\n };\n }\n\n #getEnvironmentSession(): SessionData | null {\n return this.#sessionStore.get();\n }\n}\n\nfunction resolveChallengeUri(uri: string | undefined): string {\n const resolved = uri ?? (typeof location === \"undefined\" ? undefined : location.origin);\n if (!resolved)\n throw new ConfigurationError(\n \"Wallet authentication requires a browser origin URI. Pass uri outside a browser.\",\n );\n return resolved;\n}\n"],"mappings":";;;;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