@polyester/sdk 0.35.0-devnet-20261111031027 → 0.35.0-devnet-20261111161451
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 +35 -1
- package/dist/catalogs/snapshot-validation.js +2 -1
- package/dist/catalogs/snapshot-validation.js.map +1 -1
- package/dist/client.d.ts +6 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +6 -0
- package/dist/client.js.map +1 -1
- package/dist/gen/ai/v1/assistant_pb.d.ts +4164 -0
- package/dist/gen/ai/v1/assistant_pb.d.ts.map +1 -0
- package/dist/gen/ai/v1/assistant_pb.js +1174 -0
- package/dist/gen/ai/v1/assistant_pb.js.map +1 -0
- package/dist/gen/alerts/v1/price_alerts_pb.d.ts +776 -0
- package/dist/gen/alerts/v1/price_alerts_pb.d.ts.map +1 -0
- package/dist/gen/alerts/v1/price_alerts_pb.js +378 -0
- package/dist/gen/alerts/v1/price_alerts_pb.js.map +1 -0
- package/dist/gen/auth/v1/address_book_pb.d.ts +6 -0
- package/dist/gen/auth/v1/address_book_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/address_book_pb.js +6 -0
- package/dist/gen/auth/v1/address_book_pb.js.map +1 -1
- package/dist/gen/auth/v1/api_keys_pb.d.ts +242 -2
- package/dist/gen/auth/v1/api_keys_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/api_keys_pb.js +81 -2
- package/dist/gen/auth/v1/api_keys_pb.js.map +1 -1
- package/dist/gen/auth/v1/auth_pb.d.ts +48 -6
- package/dist/gen/auth/v1/auth_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/auth_pb.js +48 -6
- package/dist/gen/auth/v1/auth_pb.js.map +1 -1
- package/dist/gen/auth/v1/policies_pb.d.ts +83 -19
- package/dist/gen/auth/v1/policies_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/policies_pb.js +74 -16
- package/dist/gen/auth/v1/policies_pb.js.map +1 -1
- package/dist/gen/auth/v1/social_verification_pb.d.ts +167 -11
- package/dist/gen/auth/v1/social_verification_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/social_verification_pb.js +41 -3
- package/dist/gen/auth/v1/social_verification_pb.js.map +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.d.ts +17 -6
- package/dist/gen/auth/v1/subaccounts_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.js.map +1 -1
- package/dist/gen/chain/deposit/v1/deposit_pb.d.ts +4 -2
- package/dist/gen/chain/deposit/v1/deposit_pb.d.ts.map +1 -1
- package/dist/gen/chain/deposit/v1/deposit_pb.js.map +1 -1
- package/dist/gen/chain/guard/v1/guard_signer_pb.d.ts +5 -0
- package/dist/gen/chain/guard/v1/guard_signer_pb.d.ts.map +1 -1
- package/dist/gen/chain/guard/v1/guard_signer_pb.js.map +1 -1
- package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.d.ts +10 -0
- package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.d.ts.map +1 -1
- package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.js +1 -1
- package/dist/gen/chain/lifecycle/v1/lifecycle_read_pb.js.map +1 -1
- package/dist/gen/chain/lifecycle/v1/types_pb.d.ts +32 -4
- package/dist/gen/chain/lifecycle/v1/types_pb.d.ts.map +1 -1
- package/dist/gen/chain/lifecycle/v1/types_pb.js +32 -4
- package/dist/gen/chain/lifecycle/v1/types_pb.js.map +1 -1
- package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.d.ts +391 -42
- package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.d.ts.map +1 -1
- package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.js +103 -17
- package/dist/gen/chain/withdraw/v1/auto_withdraw_pb.js.map +1 -1
- package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts +170 -3
- package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts.map +1 -1
- package/dist/gen/chain/withdraw/v1/withdraw_pb.js +63 -2
- package/dist/gen/chain/withdraw/v1/withdraw_pb.js.map +1 -1
- package/dist/gen/claims/v1/claims_pb.d.ts +1 -1
- package/dist/gen/claims/v1/claims_pb.js +1 -1
- package/dist/gen/claims/v1/claims_pb.js.map +1 -1
- package/dist/gen/index.d.ts +14 -10
- package/dist/gen/index.js +11 -7
- package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts +1 -1
- package/dist/gen/ledger/v1/catalog_pb.d.ts +9 -1
- package/dist/gen/ledger/v1/catalog_pb.d.ts.map +1 -1
- package/dist/gen/ledger/v1/catalog_pb.js +9 -1
- package/dist/gen/ledger/v1/catalog_pb.js.map +1 -1
- package/dist/gen/marketdata/v1/marketdata_pb.d.ts +8 -0
- package/dist/gen/marketdata/v1/marketdata_pb.d.ts.map +1 -1
- package/dist/gen/marketdata/v1/marketdata_pb.js +1 -1
- package/dist/gen/marketdata/v1/marketdata_pb.js.map +1 -1
- package/dist/gen/orders/v1/orders_pb.d.ts +4 -4
- package/dist/gen/orders/v1/orders_pb.js.map +1 -1
- package/dist/gen/orders/v1/orders_read_pb.d.ts +1 -1
- package/dist/gen/polyester/ratelimit/v1/types_pb.d.ts +20 -1
- package/dist/gen/polyester/ratelimit/v1/types_pb.d.ts.map +1 -1
- package/dist/gen/polyester/ratelimit/v1/types_pb.js +20 -1
- package/dist/gen/polyester/ratelimit/v1/types_pb.js.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts +1186 -127
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.d.ts.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js +282 -5
- package/dist/gen/swap/quickswap/v1/quickswap_broker_pb.js.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts +253 -38
- package/dist/gen/swap/quickswap/v1/quickswap_pb.d.ts.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_pb.js +180 -36
- package/dist/gen/swap/quickswap/v1/quickswap_pb.js.map +1 -1
- package/dist/gen/swap/quickswap/v1/quickswap_referral_pb.d.ts +933 -0
- package/dist/gen/swap/quickswap/v1/quickswap_referral_pb.d.ts.map +1 -0
- package/dist/gen/swap/quickswap/v1/quickswap_referral_pb.js +292 -0
- package/dist/gen/swap/quickswap/v1/quickswap_referral_pb.js.map +1 -0
- package/dist/gen/system/v1/system_pb.d.ts +77 -0
- package/dist/gen/system/v1/system_pb.d.ts.map +1 -0
- package/dist/gen/system/v1/system_pb.js +34 -0
- package/dist/gen/system/v1/system_pb.js.map +1 -0
- package/dist/gen/tradews/v1/trade_ws_pb.d.ts +2 -2
- package/dist/gen/tradews/v1/trade_ws_pb.js.map +1 -1
- package/dist/index.d.ts +14 -6
- package/dist/services/api-keys/api-keys.codecs.js +10 -1
- package/dist/services/api-keys/api-keys.codecs.js.map +1 -1
- package/dist/services/api-keys/api-keys.d.ts +16 -1
- package/dist/services/api-keys/api-keys.d.ts.map +1 -1
- package/dist/services/api-keys/api-keys.js +25 -1
- package/dist/services/api-keys/api-keys.js.map +1 -1
- package/dist/services/api-keys/api-keys.schemas.d.ts +116 -1
- package/dist/services/api-keys/api-keys.schemas.d.ts.map +1 -1
- package/dist/services/api-keys/api-keys.schemas.js +29 -3
- package/dist/services/api-keys/api-keys.schemas.js.map +1 -1
- package/dist/services/api-keys/api-keys.types.d.ts +2 -2
- package/dist/services/api-keys/index.d.ts +2 -2
- package/dist/services/assistant/assistant-events.schemas.d.ts +4618 -0
- package/dist/services/assistant/assistant-events.schemas.d.ts.map +1 -0
- package/dist/services/assistant/assistant-events.schemas.js +485 -0
- package/dist/services/assistant/assistant-events.schemas.js.map +1 -0
- package/dist/services/assistant/assistant.codecs.d.ts +24 -0
- package/dist/services/assistant/assistant.codecs.d.ts.map +1 -0
- package/dist/services/assistant/assistant.codecs.js +88 -0
- package/dist/services/assistant/assistant.codecs.js.map +1 -0
- package/dist/services/assistant/assistant.d.ts +76 -0
- package/dist/services/assistant/assistant.d.ts.map +1 -0
- package/dist/services/assistant/assistant.js +133 -0
- package/dist/services/assistant/assistant.js.map +1 -0
- package/dist/services/assistant/assistant.schemas.d.ts +184 -0
- package/dist/services/assistant/assistant.schemas.d.ts.map +1 -0
- package/dist/services/assistant/assistant.schemas.js +135 -0
- package/dist/services/assistant/assistant.schemas.js.map +1 -0
- package/dist/services/assistant/assistant.types.d.ts +4 -0
- package/dist/services/assistant/service.d.ts +8 -0
- package/dist/services/assistant/service.d.ts.map +1 -0
- package/dist/services/assistant/service.js +9 -0
- package/dist/services/assistant/service.js.map +1 -0
- package/dist/services/auto-withdraw/auto-withdraw.codecs.d.ts +9 -2
- package/dist/services/auto-withdraw/auto-withdraw.codecs.d.ts.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.codecs.js +9 -1
- package/dist/services/auto-withdraw/auto-withdraw.codecs.js.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.d.ts +15 -4
- package/dist/services/auto-withdraw/auto-withdraw.d.ts.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.js +24 -8
- package/dist/services/auto-withdraw/auto-withdraw.js.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts +394 -26
- package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.schemas.js +67 -12
- package/dist/services/auto-withdraw/auto-withdraw.schemas.js.map +1 -1
- package/dist/services/auto-withdraw/auto-withdraw.types.d.ts +3 -3
- package/dist/services/balances/balances.js +1 -1
- package/dist/services/balances/balances.schemas.d.ts +3 -3
- package/dist/services/candles/candles.js +1 -1
- package/dist/services/candles/candles.schemas.d.ts +10 -10
- package/dist/services/candles/candles.schemas.js +5 -2
- package/dist/services/candles/candles.schemas.js.map +1 -1
- package/dist/services/changelog/changelog.schemas.d.ts +17 -17
- package/dist/services/checkpoints/checkpoints.schemas.d.ts +1 -1
- package/dist/services/heatmap/heatmap.schemas.d.ts +4 -4
- package/dist/services/internal-transfers/internal-transfers.schemas.d.ts +3 -3
- package/dist/services/lifecycle/lifecycle.codecs.d.ts +2 -2
- package/dist/services/lifecycle/lifecycle.codecs.d.ts.map +1 -1
- package/dist/services/lifecycle/lifecycle.codecs.js +3 -1
- package/dist/services/lifecycle/lifecycle.codecs.js.map +1 -1
- package/dist/services/lifecycle/lifecycle.schemas.d.ts +210 -186
- package/dist/services/lifecycle/lifecycle.schemas.d.ts.map +1 -1
- package/dist/services/lifecycle/lifecycle.schemas.js +7 -1
- package/dist/services/lifecycle/lifecycle.schemas.js.map +1 -1
- package/dist/services/market-data/market-data.js +1 -1
- package/dist/services/market-data/market-data.schemas.js +7 -2
- package/dist/services/market-data/market-data.schemas.js.map +1 -1
- package/dist/services/market-overview/market-overview.schemas.d.ts +1 -1
- package/dist/services/orderbook/orderbook.schemas.d.ts +1 -1
- package/dist/services/orders/order-errors.schemas.d.ts +2 -2
- package/dist/services/orders/orders-batch.schemas.d.ts +54 -54
- package/dist/services/orders/orders-input.schemas.d.ts +6 -6
- package/dist/services/orders/orders-input.schemas.js +1 -1
- package/dist/services/orders/orders-modify.schemas.js +1 -1
- package/dist/services/orders/orders-output.schemas.d.ts +16 -16
- package/dist/services/orders/orders-output.schemas.js +3 -3
- package/dist/services/orders/orders-risk.schemas.js +1 -1
- package/dist/services/orders/orders.codecs.js +1 -1
- package/dist/services/orders/orders.js +3 -3
- package/dist/services/policies/api-key-policies/api-key-policies.schemas.d.ts +15 -15
- package/dist/services/policies/shared.codecs.js +24 -3
- package/dist/services/policies/shared.codecs.js.map +1 -1
- package/dist/services/policies/shared.d.ts +1 -1
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.d.ts +3 -3
- package/dist/services/price-alerts/price-alerts.codecs.d.ts +20 -0
- package/dist/services/price-alerts/price-alerts.codecs.d.ts.map +1 -0
- package/dist/services/price-alerts/price-alerts.codecs.js +66 -0
- package/dist/services/price-alerts/price-alerts.codecs.js.map +1 -0
- package/dist/services/price-alerts/price-alerts.d.ts +38 -0
- package/dist/services/price-alerts/price-alerts.d.ts.map +1 -0
- package/dist/services/price-alerts/price-alerts.js +60 -0
- package/dist/services/price-alerts/price-alerts.js.map +1 -0
- package/dist/services/price-alerts/price-alerts.schemas.d.ts +309 -0
- package/dist/services/price-alerts/price-alerts.schemas.d.ts.map +1 -0
- package/dist/services/price-alerts/price-alerts.schemas.js +130 -0
- package/dist/services/price-alerts/price-alerts.schemas.js.map +1 -0
- package/dist/services/price-alerts/price-alerts.types.d.ts +3 -0
- package/dist/services/price-alerts/service.d.ts +8 -0
- package/dist/services/price-alerts/service.d.ts.map +1 -0
- package/dist/services/price-alerts/service.js +9 -0
- package/dist/services/price-alerts/service.js.map +1 -0
- package/dist/services/social-verification/social-verification.codecs.js +13 -5
- package/dist/services/social-verification/social-verification.codecs.js.map +1 -1
- package/dist/services/social-verification/social-verification.d.ts +18 -3
- package/dist/services/social-verification/social-verification.d.ts.map +1 -1
- package/dist/services/social-verification/social-verification.js +26 -3
- package/dist/services/social-verification/social-verification.js.map +1 -1
- package/dist/services/social-verification/social-verification.schemas.d.ts +33 -7
- package/dist/services/social-verification/social-verification.schemas.d.ts.map +1 -1
- package/dist/services/social-verification/social-verification.schemas.js +35 -10
- package/dist/services/social-verification/social-verification.schemas.js.map +1 -1
- package/dist/services/social-verification/social-verification.types.d.ts +2 -2
- package/dist/services/subaccounts/subaccounts.schemas.d.ts +8 -8
- package/dist/services/system/service.d.ts +8 -0
- package/dist/services/system/service.d.ts.map +1 -0
- package/dist/services/system/service.js +9 -0
- package/dist/services/system/service.js.map +1 -0
- package/dist/services/system/system.d.ts +25 -0
- package/dist/services/system/system.d.ts.map +1 -0
- package/dist/services/system/system.js +24 -0
- package/dist/services/system/system.js.map +1 -0
- package/dist/services/trades/trades.js +1 -1
- package/dist/services/trades/trades.schemas.d.ts +1 -1
- package/dist/services/trades/trades.schemas.js +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.d.ts +7 -1
- package/dist/services/trading-withdraws/trading-withdraws.d.ts.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.js +11 -1
- package/dist/services/trading-withdraws/trading-withdraws.js.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.schemas.d.ts +42 -1
- package/dist/services/trading-withdraws/trading-withdraws.schemas.d.ts.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.schemas.js +19 -3
- package/dist/services/trading-withdraws/trading-withdraws.schemas.js.map +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.types.d.ts +2 -2
- package/dist/services/transfers/transfers.schemas.d.ts +5 -5
- package/dist/services/triggers/trigger-child-order.schemas.js +1 -1
- package/dist/services/triggers/trigger-input.schemas.d.ts +2 -2
- package/dist/services/triggers/trigger-input.schemas.js +1 -1
- package/dist/services/triggers/triggers-output.schemas.d.ts +49 -49
- package/dist/services/triggers/triggers.codecs.js +1 -1
- package/dist/services/triggers/triggers.js +2 -2
- package/dist/shared/catalog-config.d.ts +5 -0
- package/dist/shared/catalog-config.d.ts.map +1 -1
- package/dist/shared/catalog-config.js.map +1 -1
- package/dist/shared/connect-error-mapping.d.ts.map +1 -1
- package/dist/shared/connect-error-mapping.js +1 -0
- package/dist/shared/connect-error-mapping.js.map +1 -1
- package/dist/shared/error-detail.d.ts +24 -10
- package/dist/shared/error-detail.d.ts.map +1 -1
- package/dist/shared/error-detail.js +2 -0
- package/dist/shared/error-detail.js.map +1 -1
- package/dist/shared/error-details/alerts.js +15 -0
- package/dist/shared/error-details/alerts.js.map +1 -0
- package/dist/shared/error-details/assistant.js +15 -0
- package/dist/shared/error-details/assistant.js.map +1 -0
- package/dist/shared/error-details/withdraw.js +11 -2
- package/dist/shared/error-details/withdraw.js.map +1 -1
- package/dist/shared/ledger-codes.d.ts +4 -2
- package/dist/shared/ledger-codes.d.ts.map +1 -1
- package/dist/shared/ledger-codes.js +6 -3
- package/dist/shared/ledger-codes.js.map +1 -1
- package/dist/shared/rate-limit.schemas.d.ts +3 -3
- package/dist/shared/rate-limit.schemas.d.ts.map +1 -1
- package/dist/shared/rate-limit.schemas.js +4 -1
- package/dist/shared/rate-limit.schemas.js.map +1 -1
- package/dist/shared/transports.d.ts +2 -1
- package/dist/shared/transports.d.ts.map +1 -1
- package/dist/shared/transports.js.map +1 -1
- package/dist/wired-services.d.ts.map +1 -1
- package/dist/wired-services.js +11 -5
- package/dist/wired-services.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AuthApiTransports } from "../../shared/transports.js";
|
|
2
2
|
import { PolyesterMutationOptions, PolyesterRequestOptions } from "../../shared/request-options.js";
|
|
3
|
-
import { GetVerificationResponse, SocialProviderInputSchema, StartVerificationInput, StartVerificationResponse, VerificationReadyResponse } from "./social-verification.schemas.js";
|
|
3
|
+
import { ConfirmVerificationInput, GetVerificationResponse, SocialProviderInputSchema, StartVerificationInput, StartVerificationResponse, UnlinkSocialAccountInput, VerificationReadyResponse } from "./social-verification.schemas.js";
|
|
4
4
|
import * as v from "valibot";
|
|
5
5
|
//#region src/services/social-verification/social-verification.d.ts
|
|
6
6
|
/**
|
|
@@ -10,17 +10,32 @@ declare class SocialVerificationService {
|
|
|
10
10
|
#private;
|
|
11
11
|
constructor(transports: AuthApiTransports);
|
|
12
12
|
/**
|
|
13
|
-
* Starts or restarts provider verification. Twitter requires a handle and strips a leading @; Discord
|
|
13
|
+
* Starts or restarts provider verification. Twitter requires a handle and strips a leading @; Discord and Telegram get their identity from the provider bot. An omitted method uses the provider default (Twitter profile, Discord channel, Telegram dm). Discord and Telegram return an empty challengeCode when no new challenge is issued. For Telegram, open `actionUrl` to send the code to the Polyester bot, poll `get` until `awaiting_confirmation`, then `confirm`; while a Telegram account is linked, starting again throws until it is unlinked.
|
|
14
14
|
*/
|
|
15
15
|
start(input: StartVerificationInput, options?: PolyesterMutationOptions): Promise<StartVerificationResponse>;
|
|
16
16
|
/**
|
|
17
|
-
* Queues a provider check after the caller has placed the challenge code according to the selected verification method.
|
|
17
|
+
* Queues a provider check after the caller has placed the challenge code according to the selected verification method. Not used for Telegram, which links through `confirm`.
|
|
18
18
|
*/
|
|
19
19
|
markReady(input: v.InferInput<typeof SocialProviderInputSchema>, options?: PolyesterMutationOptions): Promise<VerificationReadyResponse>;
|
|
20
20
|
/**
|
|
21
21
|
* Returns the caller's current verification state for a provider, including status, challenge metadata, attempts, last error, and verified timestamp.
|
|
22
22
|
*/
|
|
23
23
|
get(input: v.InferInput<typeof SocialProviderInputSchema>, options?: PolyesterRequestOptions): Promise<GetVerificationResponse>;
|
|
24
|
+
/**
|
|
25
|
+
* Links the Telegram account that sent the challenge code. Pass the `providerUserId` shown
|
|
26
|
+
* while the verification is `awaiting_confirmation`, so the user links exactly the account
|
|
27
|
+
* they were shown. Requires enrolled MFA and a fresh `stepUpToken`; a retried confirmation of
|
|
28
|
+
* an existing link needs no new token. A mismatched ID or no account awaiting confirmation
|
|
29
|
+
* fails with `social_verification_invalid_state`; a Telegram account linked elsewhere fails
|
|
30
|
+
* the verification with `social_account_already_linked`.
|
|
31
|
+
*/
|
|
32
|
+
confirm(input: ConfirmVerificationInput, options?: PolyesterMutationOptions): Promise<GetVerificationResponse>;
|
|
33
|
+
/**
|
|
34
|
+
* Unlinks the Telegram account, or cancels a link in progress, and returns the `canceled`
|
|
35
|
+
* verification (absent if none was ever started). Repeating it changes nothing; start a new
|
|
36
|
+
* verification to link again.
|
|
37
|
+
*/
|
|
38
|
+
unlink(input: UnlinkSocialAccountInput, options?: PolyesterMutationOptions): Promise<GetVerificationResponse>;
|
|
24
39
|
}
|
|
25
40
|
//#endregion
|
|
26
41
|
export { SocialVerificationService };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"social-verification.d.ts","names":[],"sources":["../../../src/services/social-verification/social-verification.ts"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"social-verification.d.ts","names":[],"sources":["../../../src/services/social-verification/social-verification.ts"],"mappings":";;;;;;;;cA6Ba;;EAGG,YAAA,YAAY;;;;EAOlB,MACF,OAAO,wBACP,UAAU,2BACX,QAAQ;;;;EAYL,UACF,OAAO,EAAE,kBAAkB,4BAC3B,UAAU,2BACX,QAAQ;;;;EAYL,IACF,OAAO,EAAE,kBAAkB,4BAC3B,UAAU,0BACX,QAAQ;;;;;;;;;EAiBL,QACF,OAAO,0BACP,UAAU,2BACX,QAAQ;;;;;;EAcL,OACF,OAAO,0BACP,UAAU,2BACX,QAAQ"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { parse } from "../../shared/validation.js";
|
|
2
2
|
import { toConnectCallOptions } from "../../shared/request-options.js";
|
|
3
3
|
import { SocialVerificationService as SocialVerificationService$1 } from "../../gen/auth/v1/social_verification_pb.js";
|
|
4
|
-
import { GetVerificationResponseSchema, SocialProviderInputSchema, StartVerificationInputSchema, StartVerificationResponseSchema, VerificationReadyResponseSchema } from "./social-verification.schemas.js";
|
|
4
|
+
import { ConfirmVerificationInputSchema, GetVerificationResponseSchema, SocialProviderInputSchema, StartVerificationInputSchema, StartVerificationResponseSchema, UnlinkSocialAccountInputSchema, VerificationReadyResponseSchema } from "./social-verification.schemas.js";
|
|
5
5
|
import { createClient } from "@connectrpc/connect";
|
|
6
6
|
//#region src/services/social-verification/social-verification.ts
|
|
7
7
|
/**
|
|
@@ -13,7 +13,7 @@ var SocialVerificationService = class {
|
|
|
13
13
|
this.#client = createClient(SocialVerificationService$1, transports.authApi);
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
|
-
* Starts or restarts provider verification. Twitter requires a handle and strips a leading @; Discord
|
|
16
|
+
* Starts or restarts provider verification. Twitter requires a handle and strips a leading @; Discord and Telegram get their identity from the provider bot. An omitted method uses the provider default (Twitter profile, Discord channel, Telegram dm). Discord and Telegram return an empty challengeCode when no new challenge is issued. For Telegram, open `actionUrl` to send the code to the Polyester bot, poll `get` until `awaiting_confirmation`, then `confirm`; while a Telegram account is linked, starting again throws until it is unlinked.
|
|
17
17
|
*/
|
|
18
18
|
async start(input, options) {
|
|
19
19
|
const validated = parse(StartVerificationInputSchema, input);
|
|
@@ -21,7 +21,7 @@ var SocialVerificationService = class {
|
|
|
21
21
|
return parse(StartVerificationResponseSchema, res);
|
|
22
22
|
}
|
|
23
23
|
/**
|
|
24
|
-
* Queues a provider check after the caller has placed the challenge code according to the selected verification method.
|
|
24
|
+
* Queues a provider check after the caller has placed the challenge code according to the selected verification method. Not used for Telegram, which links through `confirm`.
|
|
25
25
|
*/
|
|
26
26
|
async markReady(input, options) {
|
|
27
27
|
const validated = parse(SocialProviderInputSchema, input);
|
|
@@ -36,6 +36,29 @@ var SocialVerificationService = class {
|
|
|
36
36
|
const res = await this.#client.getSocialVerification(validated, toConnectCallOptions(options));
|
|
37
37
|
return parse(GetVerificationResponseSchema, res);
|
|
38
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Links the Telegram account that sent the challenge code. Pass the `providerUserId` shown
|
|
41
|
+
* while the verification is `awaiting_confirmation`, so the user links exactly the account
|
|
42
|
+
* they were shown. Requires enrolled MFA and a fresh `stepUpToken`; a retried confirmation of
|
|
43
|
+
* an existing link needs no new token. A mismatched ID or no account awaiting confirmation
|
|
44
|
+
* fails with `social_verification_invalid_state`; a Telegram account linked elsewhere fails
|
|
45
|
+
* the verification with `social_account_already_linked`.
|
|
46
|
+
*/
|
|
47
|
+
async confirm(input, options) {
|
|
48
|
+
const validated = parse(ConfirmVerificationInputSchema, input);
|
|
49
|
+
const res = await this.#client.confirmSocialVerification(validated, toConnectCallOptions(options));
|
|
50
|
+
return parse(GetVerificationResponseSchema, res);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Unlinks the Telegram account, or cancels a link in progress, and returns the `canceled`
|
|
54
|
+
* verification (absent if none was ever started). Repeating it changes nothing; start a new
|
|
55
|
+
* verification to link again.
|
|
56
|
+
*/
|
|
57
|
+
async unlink(input, options) {
|
|
58
|
+
const validated = parse(UnlinkSocialAccountInputSchema, input);
|
|
59
|
+
const res = await this.#client.unlinkSocialAccount(validated, toConnectCallOptions(options));
|
|
60
|
+
return parse(GetVerificationResponseSchema, res);
|
|
61
|
+
}
|
|
39
62
|
};
|
|
40
63
|
//#endregion
|
|
41
64
|
export { SocialVerificationService };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"social-verification.js","names":["#client","Proto.SocialVerificationService"],"sources":["../../../src/services/social-verification/social-verification.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/auth/v1/social_verification_pb.js\";\nimport type * as v from \"valibot\";\nimport { parse } from \"../../shared/validation.js\";\nimport type { AuthApiTransports } from \"../../shared/transports.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport {\n StartVerificationInputSchema,\n StartVerificationResponseSchema,\n VerificationReadyResponseSchema,\n GetVerificationResponseSchema,\n SocialProviderInputSchema,\n type StartVerificationInput,\n type StartVerificationResponse,\n type VerificationReadyResponse,\n type GetVerificationResponse,\n} from \"./social-verification.schemas.js\";\n\n/**\n * Verifies ownership of external social accounts for the authenticated caller.\n */\nexport class SocialVerificationService {\n #client: Client<typeof Proto.SocialVerificationService>;\n\n constructor(transports: AuthApiTransports) {\n this.#client = createClient(Proto.SocialVerificationService, transports.authApi);\n }\n\n /**\n * Starts or restarts provider verification. Twitter requires a handle and strips a leading @; Discord
|
|
1
|
+
{"version":3,"file":"social-verification.js","names":["#client","Proto.SocialVerificationService"],"sources":["../../../src/services/social-verification/social-verification.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/auth/v1/social_verification_pb.js\";\nimport type * as v from \"valibot\";\nimport { parse } from \"../../shared/validation.js\";\nimport type { AuthApiTransports } from \"../../shared/transports.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport {\n ConfirmVerificationInputSchema,\n UnlinkSocialAccountInputSchema,\n StartVerificationInputSchema,\n StartVerificationResponseSchema,\n VerificationReadyResponseSchema,\n GetVerificationResponseSchema,\n SocialProviderInputSchema,\n type ConfirmVerificationInput,\n type UnlinkSocialAccountInput,\n type StartVerificationInput,\n type StartVerificationResponse,\n type VerificationReadyResponse,\n type GetVerificationResponse,\n} from \"./social-verification.schemas.js\";\n\n/**\n * Verifies ownership of external social accounts for the authenticated caller.\n */\nexport class SocialVerificationService {\n #client: Client<typeof Proto.SocialVerificationService>;\n\n constructor(transports: AuthApiTransports) {\n this.#client = createClient(Proto.SocialVerificationService, transports.authApi);\n }\n\n /**\n * Starts or restarts provider verification. Twitter requires a handle and strips a leading @; Discord and Telegram get their identity from the provider bot. An omitted method uses the provider default (Twitter profile, Discord channel, Telegram dm). Discord and Telegram return an empty challengeCode when no new challenge is issued. For Telegram, open `actionUrl` to send the code to the Polyester bot, poll `get` until `awaiting_confirmation`, then `confirm`; while a Telegram account is linked, starting again throws until it is unlinked.\n */\n async start(\n input: StartVerificationInput,\n options?: PolyesterMutationOptions,\n ): Promise<StartVerificationResponse> {\n const validated = parse(StartVerificationInputSchema, input);\n const res = await this.#client.startSocialVerification(\n validated,\n toConnectCallOptions(options),\n );\n return parse(StartVerificationResponseSchema, res);\n }\n\n /**\n * Queues a provider check after the caller has placed the challenge code according to the selected verification method. Not used for Telegram, which links through `confirm`.\n */\n async markReady(\n input: v.InferInput<typeof SocialProviderInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<VerificationReadyResponse> {\n const validated = parse(SocialProviderInputSchema, input);\n const res = await this.#client.socialVerificationReady(\n validated,\n toConnectCallOptions(options),\n );\n return parse(VerificationReadyResponseSchema, res);\n }\n\n /**\n * Returns the caller's current verification state for a provider, including status, challenge metadata, attempts, last error, and verified timestamp.\n */\n async get(\n input: v.InferInput<typeof SocialProviderInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<GetVerificationResponse> {\n const validated = parse(SocialProviderInputSchema, input);\n const res = await this.#client.getSocialVerification(\n validated,\n toConnectCallOptions(options),\n );\n return parse(GetVerificationResponseSchema, res);\n }\n\n /**\n * Links the Telegram account that sent the challenge code. Pass the `providerUserId` shown\n * while the verification is `awaiting_confirmation`, so the user links exactly the account\n * they were shown. Requires enrolled MFA and a fresh `stepUpToken`; a retried confirmation of\n * an existing link needs no new token. A mismatched ID or no account awaiting confirmation\n * fails with `social_verification_invalid_state`; a Telegram account linked elsewhere fails\n * the verification with `social_account_already_linked`.\n */\n async confirm(\n input: ConfirmVerificationInput,\n options?: PolyesterMutationOptions,\n ): Promise<GetVerificationResponse> {\n const validated = parse(ConfirmVerificationInputSchema, input);\n const res = await this.#client.confirmSocialVerification(\n validated,\n toConnectCallOptions(options),\n );\n return parse(GetVerificationResponseSchema, res);\n }\n\n /**\n * Unlinks the Telegram account, or cancels a link in progress, and returns the `canceled`\n * verification (absent if none was ever started). Repeating it changes nothing; start a new\n * verification to link again.\n */\n async unlink(\n input: UnlinkSocialAccountInput,\n options?: PolyesterMutationOptions,\n ): Promise<GetVerificationResponse> {\n const validated = parse(UnlinkSocialAccountInputSchema, input);\n const res = await this.#client.unlinkSocialAccount(\n validated,\n toConnectCallOptions(options),\n );\n return parse(GetVerificationResponseSchema, res);\n }\n}\n"],"mappings":";;;;;;;;;AA6BA,IAAa,4BAAb,MAAuC;CACnC;CAEA,YAAY,YAA+B;EACvC,KAAKA,UAAU,aAAaC,6BAAiC,WAAW,OAAO;CACnF;;;;CAKA,MAAM,MACF,OACA,SACkC;EAClC,MAAM,YAAY,MAAM,8BAA8B,KAAK;EAC3D,MAAM,MAAM,MAAM,KAAKD,QAAQ,wBAC3B,WACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,iCAAiC,GAAG;CACrD;;;;CAKA,MAAM,UACF,OACA,SACkC;EAClC,MAAM,YAAY,MAAM,2BAA2B,KAAK;EACxD,MAAM,MAAM,MAAM,KAAKA,QAAQ,wBAC3B,WACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,iCAAiC,GAAG;CACrD;;;;CAKA,MAAM,IACF,OACA,SACgC;EAChC,MAAM,YAAY,MAAM,2BAA2B,KAAK;EACxD,MAAM,MAAM,MAAM,KAAKA,QAAQ,sBAC3B,WACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,+BAA+B,GAAG;CACnD;;;;;;;;;CAUA,MAAM,QACF,OACA,SACgC;EAChC,MAAM,YAAY,MAAM,gCAAgC,KAAK;EAC7D,MAAM,MAAM,MAAM,KAAKA,QAAQ,0BAC3B,WACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,+BAA+B,GAAG;CACnD;;;;;;CAOA,MAAM,OACF,OACA,SACgC;EAChC,MAAM,YAAY,MAAM,gCAAgC,KAAK;EAC7D,MAAM,MAAM,MAAM,KAAKA,QAAQ,oBAC3B,WACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,+BAA+B,GAAG;CACnD;AACJ"}
|
|
@@ -3,22 +3,28 @@ import { DecodedEnum } from "../../utils/types.js";
|
|
|
3
3
|
import "./social-verification.codecs.js";
|
|
4
4
|
import * as v from "valibot";
|
|
5
5
|
//#region src/services/social-verification/social-verification.schemas.d.ts
|
|
6
|
-
declare const SocialProviderSchema: v.PicklistSchema<readonly ["twitter", "discord"], undefined>;
|
|
6
|
+
declare const SocialProviderSchema: v.PicklistSchema<readonly ["twitter", "discord", "telegram"], undefined>;
|
|
7
7
|
type SocialProvider = v.InferInput<typeof SocialProviderSchema>;
|
|
8
8
|
declare const SocialVerificationMethodSchema: v.PicklistSchema<readonly ["profile", "channel", "dm"], undefined>;
|
|
9
9
|
type SocialVerificationMethod = v.InferInput<typeof SocialVerificationMethodSchema>;
|
|
10
10
|
declare const SocialVerificationErrorCodeSchema: v.PicklistSchema<readonly ["username_invalid", "username_taken", "username_cooldown", "username_feature_locked", "username_reserved", "invalid_request", "authentication_required", "session_kind_not_allowed", "wallet_login_failed", "resource_not_found", "subaccount_access_denied", "api_key_access_denied", "api_key_invalid_status_transition", "policy_invalid", "smart_account_already_linked", "invite_access_denied", "invite_invalid_state", "mfa_disabled", "mfa_not_enrolled", "mfa_session_invalid", "mfa_challenge_not_found", "mfa_challenge_invalid", "mfa_challenge_locked", "mfa_otp_invalid", "mfa_recovery_invalid", "mfa_passkey_not_available", "mfa_passkey_credential_invalid", "mfa_passkey_verify_failed", "mfa_enrollment_binding_invalid", "step_up_required", "step_up_proof_unavailable", "step_up_already_claimed", "policy_in_use", "policy_locked", "policy_scope_mismatch", "revision_conflict", "mfa_elevation_required", "mfa_last_factor_required", "internal_error", "terms_not_accepted", "social_verification_expired", "social_verification_invalid_state", "subaccount_challenge_invalid", "social_account_already_linked"], undefined>;
|
|
11
11
|
type SocialVerificationErrorCode = v.InferOutput<typeof SocialVerificationErrorCodeSchema>;
|
|
12
|
-
declare const SocialVerificationStatusSchema: v.PicklistSchema<readonly ["pending_user_action", "queued", "in_progress", "verified", "failed", "expired", "canceled"], undefined>;
|
|
12
|
+
declare const SocialVerificationStatusSchema: v.PicklistSchema<readonly ["pending_user_action", "queued", "in_progress", "verified", "failed", "expired", "canceled", "awaiting_confirmation"], undefined>;
|
|
13
13
|
type SocialVerificationStatus = v.InferOutput<typeof SocialVerificationStatusSchema>;
|
|
14
14
|
declare const SocialVerificationSchema: v.ObjectSchema<{
|
|
15
15
|
readonly id: v.BigintSchema<undefined>;
|
|
16
|
-
readonly provider: v.PicklistSchema<readonly ["twitter", "discord"], undefined>;
|
|
16
|
+
readonly provider: v.PicklistSchema<readonly ["twitter", "discord", "telegram"], undefined>;
|
|
17
17
|
readonly method: v.PicklistSchema<readonly ["profile", "channel", "dm"], undefined>;
|
|
18
18
|
readonly handle: v.StringSchema<undefined>;
|
|
19
|
+
/**
|
|
20
|
+
* Provider-side user ID, empty until verified. For Telegram in `awaiting_confirmation`, the
|
|
21
|
+
* decimal user ID of the account that sent the code: pass it to `confirm` as is.
|
|
22
|
+
*/
|
|
19
23
|
readonly providerUserId: v.StringSchema<undefined>;
|
|
24
|
+
/** Telegram only: the account's name once the code is submitted; empty otherwise. */
|
|
25
|
+
readonly displayName: v.StringSchema<undefined>;
|
|
20
26
|
readonly challengeCode: v.StringSchema<undefined>;
|
|
21
|
-
readonly status: v.PicklistSchema<readonly ["pending_user_action", "queued", "in_progress", "verified", "failed", "expired", "canceled"], undefined>;
|
|
27
|
+
readonly status: v.PicklistSchema<readonly ["pending_user_action", "queued", "in_progress", "verified", "failed", "expired", "canceled", "awaiting_confirmation"], undefined>;
|
|
22
28
|
readonly requestedAt: v.OptionalSchema<v.ObjectSchema<{
|
|
23
29
|
readonly seconds: v.BigintSchema<undefined>;
|
|
24
30
|
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
@@ -58,6 +64,9 @@ declare const StartVerificationInputSchema: v.SchemaWithPipe<readonly [v.Variant
|
|
|
58
64
|
}, undefined>, v.StrictObjectSchema<{
|
|
59
65
|
readonly provider: v.LiteralSchema<"discord", undefined>;
|
|
60
66
|
readonly method: v.OptionalSchema<v.PicklistSchema<["channel", "dm"], undefined>, undefined>;
|
|
67
|
+
}, undefined>, v.StrictObjectSchema<{
|
|
68
|
+
readonly provider: v.LiteralSchema<"telegram", undefined>;
|
|
69
|
+
readonly method: v.OptionalSchema<v.LiteralSchema<"dm", undefined>, undefined>;
|
|
61
70
|
}, undefined>], undefined>, v.TransformAction<{
|
|
62
71
|
provider: "twitter";
|
|
63
72
|
handle: string;
|
|
@@ -65,14 +74,17 @@ declare const StartVerificationInputSchema: v.SchemaWithPipe<readonly [v.Variant
|
|
|
65
74
|
} | {
|
|
66
75
|
provider: "discord";
|
|
67
76
|
method?: "channel" | "dm" | undefined;
|
|
77
|
+
} | {
|
|
78
|
+
provider: "telegram";
|
|
79
|
+
method?: "dm" | undefined;
|
|
68
80
|
}, {
|
|
69
|
-
provider: SocialProvider$1.TWITTER | SocialProvider$1.DISCORD;
|
|
81
|
+
provider: SocialProvider$1.TWITTER | SocialProvider$1.DISCORD | SocialProvider$1.TELEGRAM;
|
|
70
82
|
method: SocialVerificationMethod$1;
|
|
71
83
|
handle?: string | undefined;
|
|
72
84
|
}>]>;
|
|
73
85
|
type StartVerificationInput = v.InferInput<typeof StartVerificationInputSchema>;
|
|
74
86
|
declare const SocialProviderInputSchema: v.StrictObjectSchema<{
|
|
75
|
-
readonly provider: v.SchemaWithPipe<readonly [v.PicklistSchema<readonly ["twitter", "discord"], undefined>, v.TransformAction<"twitter" | "discord", SocialProvider$1.TWITTER | SocialProvider$1.DISCORD>]>;
|
|
87
|
+
readonly provider: v.SchemaWithPipe<readonly [v.PicklistSchema<readonly ["twitter", "discord", "telegram"], undefined>, v.TransformAction<"telegram" | "twitter" | "discord", SocialProvider$1.TWITTER | SocialProvider$1.DISCORD | SocialProvider$1.TELEGRAM>]>;
|
|
76
88
|
}, undefined>;
|
|
77
89
|
type SocialProviderInput = v.InferInput<typeof SocialProviderInputSchema>;
|
|
78
90
|
declare const StartVerificationResponseSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
@@ -82,6 +94,8 @@ declare const StartVerificationResponseSchema: v.SchemaWithPipe<readonly [v.Obje
|
|
|
82
94
|
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
83
95
|
}, undefined>, undefined>;
|
|
84
96
|
readonly verification: v.OptionalSchema<v.CustomSchema<SocialVerification$1, undefined>, undefined>;
|
|
97
|
+
/** Telegram: the `https://t.me/...` link that sends the code to the bot; empty otherwise. */
|
|
98
|
+
readonly actionUrl: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
85
99
|
}, undefined>, v.TransformAction<{
|
|
86
100
|
challengeCode: string;
|
|
87
101
|
expiresAt?: {
|
|
@@ -89,12 +103,14 @@ declare const StartVerificationResponseSchema: v.SchemaWithPipe<readonly [v.Obje
|
|
|
89
103
|
nanos: number;
|
|
90
104
|
} | undefined;
|
|
91
105
|
verification?: SocialVerification$1 | undefined;
|
|
106
|
+
actionUrl: string;
|
|
92
107
|
}, {
|
|
93
108
|
challengeCode: string;
|
|
94
109
|
expiresAt: {
|
|
95
110
|
seconds: bigint;
|
|
96
111
|
nanos: number;
|
|
97
112
|
} | undefined;
|
|
113
|
+
actionUrl: string;
|
|
98
114
|
verification: SocialVerification | undefined;
|
|
99
115
|
}>]>;
|
|
100
116
|
type StartVerificationResponse = v.InferOutput<typeof StartVerificationResponseSchema>;
|
|
@@ -114,6 +130,16 @@ declare const GetVerificationResponseSchema: v.SchemaWithPipe<readonly [v.Object
|
|
|
114
130
|
verification: SocialVerification | undefined;
|
|
115
131
|
}>]>;
|
|
116
132
|
type GetVerificationResponse = v.InferOutput<typeof GetVerificationResponseSchema>;
|
|
133
|
+
declare const ConfirmVerificationInputSchema: v.StrictObjectSchema<{
|
|
134
|
+
readonly provider: v.SchemaWithPipe<readonly [v.LiteralSchema<"telegram", undefined>, v.TransformAction<"telegram", SocialProvider$1>]>;
|
|
135
|
+
/** The verification's `providerUserId` in `awaiting_confirmation`: a decimal 64-bit ID. */
|
|
136
|
+
readonly providerUserId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "providerUserId must be a decimal Telegram user ID">]>;
|
|
137
|
+
}, undefined>;
|
|
138
|
+
type ConfirmVerificationInput = v.InferInput<typeof ConfirmVerificationInputSchema>;
|
|
139
|
+
declare const UnlinkSocialAccountInputSchema: v.StrictObjectSchema<{
|
|
140
|
+
readonly provider: v.SchemaWithPipe<readonly [v.LiteralSchema<"telegram", undefined>, v.TransformAction<"telegram", SocialProvider$1>]>;
|
|
141
|
+
}, undefined>;
|
|
142
|
+
type UnlinkSocialAccountInput = v.InferInput<typeof UnlinkSocialAccountInputSchema>;
|
|
117
143
|
//#endregion
|
|
118
|
-
export { GetVerificationResponse, GetVerificationResponseSchema, SocialProvider, SocialProviderInput, SocialProviderInputSchema, SocialProviderSchema, SocialVerification, SocialVerificationErrorCode, SocialVerificationErrorCodeSchema, SocialVerificationMethod, SocialVerificationMethodSchema, SocialVerificationSchema, SocialVerificationStatus, SocialVerificationStatusSchema, StartVerificationInput, StartVerificationInputSchema, StartVerificationResponse, StartVerificationResponseSchema, VerificationReadyResponse, VerificationReadyResponseSchema };
|
|
144
|
+
export { ConfirmVerificationInput, ConfirmVerificationInputSchema, GetVerificationResponse, GetVerificationResponseSchema, SocialProvider, SocialProviderInput, SocialProviderInputSchema, SocialProviderSchema, SocialVerification, SocialVerificationErrorCode, SocialVerificationErrorCodeSchema, SocialVerificationMethod, SocialVerificationMethodSchema, SocialVerificationSchema, SocialVerificationStatus, SocialVerificationStatusSchema, StartVerificationInput, StartVerificationInputSchema, StartVerificationResponse, StartVerificationResponseSchema, UnlinkSocialAccountInput, UnlinkSocialAccountInputSchema, VerificationReadyResponse, VerificationReadyResponseSchema };
|
|
119
145
|
//# sourceMappingURL=social-verification.schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"social-verification.schemas.d.ts","names":[],"sources":["../../../src/services/social-verification/social-verification.schemas.ts"],"mappings":";;;;;cAuBa,sBAAoB,EAAA;KACrB,iBAAiB,EAAE,kBAAkB;cAEpC,gCAA8B,EAAA;KAC/B,2BAA2B,EAAE,kBAAkB;cAE9C,mCAAiC,EAAA;KAClC,8BAA8B,EAAE,mBAAmB;cAElD,gCAA8B,EAAA;KAC/B,2BAA2B,EAAE,mBAAmB;
|
|
1
|
+
{"version":3,"file":"social-verification.schemas.d.ts","names":[],"sources":["../../../src/services/social-verification/social-verification.schemas.ts"],"mappings":";;;;;cAuBa,sBAAoB,EAAA;KACrB,iBAAiB,EAAE,kBAAkB;cAEpC,gCAA8B,EAAA;KAC/B,2BAA2B,EAAE,kBAAkB;cAE9C,mCAAiC,EAAA;KAClC,8BAA8B,EAAE,mBAAmB;cAElD,gCAA8B,EAAA;KAC/B,2BAA2B,EAAE,mBAAmB;cAkC/C,0BAAwB,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAsBhC,yBAAyB,EAAE,mBAAmB;KACvC,qBAAqB,KAAK;EAClC,UAAU,YAAY;EACtB,QAAQ,YAAY;EACpB,QAAQ,YAAY;;;;;;;EAOpB,WAAW,YAAY;;cAGd,8BAA4B,EAAA,yBAAA,EAAA,2BAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;KAmC7B,yBAAyB,EAAE,kBAAkB;cAO5C,2BAAyB,EAAA;;;KAI1B,sBAAsB,EAAE,kBAAkB;cAEzC,iCAA+B,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;KAgBhC,4BAA4B,EAAE,mBAAmB;cAEhD,iCAA+B,EAAA,yBAAA,EAAA;;;;;;;KAShC,4BAA4B,EAAE,mBAAmB;cAEhD,+BAA6B,EAAA,yBAAA,EAAA;;;;;;;KAS9B,0BAA0B,EAAE,mBAAmB;cAQ9C,gCAA8B,EAAA;;;;;KAS/B,2BAA2B,EAAE,kBAAkB;cAE9C,gCAA8B,EAAA;;;KAI/B,2BAA2B,EAAE,kBAAkB"}
|
|
@@ -23,6 +23,7 @@ function transformVerification(v) {
|
|
|
23
23
|
method: enumLabel(SocialVerificationMethodCodec.protoToOutput, v.method),
|
|
24
24
|
handle: v.handle,
|
|
25
25
|
providerUserId: v.providerUserId,
|
|
26
|
+
displayName: v.displayName,
|
|
26
27
|
challengeCode: v.challengeCode,
|
|
27
28
|
status: enumLabel(SocialVerificationStatusCodec.protoToOutput, v.status),
|
|
28
29
|
requestedAt: v.requestedAt,
|
|
@@ -39,7 +40,13 @@ v.object({
|
|
|
39
40
|
provider: SocialProviderSchema,
|
|
40
41
|
method: SocialVerificationMethodSchema,
|
|
41
42
|
handle: v.string(),
|
|
43
|
+
/**
|
|
44
|
+
* Provider-side user ID, empty until verified. For Telegram in `awaiting_confirmation`, the
|
|
45
|
+
* decimal user ID of the account that sent the code: pass it to `confirm` as is.
|
|
46
|
+
*/
|
|
42
47
|
providerUserId: v.string(),
|
|
48
|
+
/** Telegram only: the account's name once the code is submitted; empty otherwise. */
|
|
49
|
+
displayName: v.string(),
|
|
43
50
|
challengeCode: v.string(),
|
|
44
51
|
status: SocialVerificationStatusSchema,
|
|
45
52
|
requestedAt: v.optional(TimestampSchema),
|
|
@@ -49,14 +56,21 @@ v.object({
|
|
|
49
56
|
lastError: v.string(),
|
|
50
57
|
updatedAt: v.optional(TimestampSchema)
|
|
51
58
|
});
|
|
52
|
-
const StartVerificationInputSchema = v.pipe(v.variant("provider", [
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
59
|
+
const StartVerificationInputSchema = v.pipe(v.variant("provider", [
|
|
60
|
+
v.strictObject({
|
|
61
|
+
provider: v.literal("twitter"),
|
|
62
|
+
handle: v.pipe(v.string(), v.transform(normalizeHandle), v.minLength(1), v.regex(TWITTER_HANDLE_PATTERN, "Twitter handle must be 1-15 letters, digits, or underscores")),
|
|
63
|
+
method: v.optional(v.literal("profile"))
|
|
64
|
+
}),
|
|
65
|
+
v.strictObject({
|
|
66
|
+
provider: v.literal("discord"),
|
|
67
|
+
method: v.optional(v.picklist(["channel", "dm"]))
|
|
68
|
+
}),
|
|
69
|
+
v.strictObject({
|
|
70
|
+
provider: v.literal("telegram"),
|
|
71
|
+
method: v.optional(v.literal("dm"))
|
|
72
|
+
})
|
|
73
|
+
]), v.transform(({ provider, method, ...input }) => ({
|
|
60
74
|
...input,
|
|
61
75
|
provider: SocialProviderCodec.inputToProto[provider],
|
|
62
76
|
method: method === void 0 ? 0 : SocialVerificationMethodCodec.inputToProto[method]
|
|
@@ -66,15 +80,26 @@ const SocialProviderInputSchema = v.strictObject({ provider: ProviderInputSchema
|
|
|
66
80
|
const StartVerificationResponseSchema = v.pipe(v.object({
|
|
67
81
|
challengeCode: v.string(),
|
|
68
82
|
expiresAt: v.optional(TimestampSchema),
|
|
69
|
-
verification: v.optional(v.custom(() => true))
|
|
83
|
+
verification: v.optional(v.custom(() => true)),
|
|
84
|
+
/** Telegram: the `https://t.me/...` link that sends the code to the bot; empty otherwise. */
|
|
85
|
+
actionUrl: v.optional(v.string(), "")
|
|
70
86
|
}), v.transform((res) => ({
|
|
71
87
|
challengeCode: res.challengeCode,
|
|
72
88
|
expiresAt: res.expiresAt,
|
|
89
|
+
actionUrl: res.actionUrl,
|
|
73
90
|
verification: transformVerification(res.verification)
|
|
74
91
|
})));
|
|
75
92
|
const VerificationReadyResponseSchema = v.pipe(v.object({ verification: v.optional(v.custom(() => true)) }), v.transform((res) => ({ verification: transformVerification(res.verification) })));
|
|
76
93
|
const GetVerificationResponseSchema = v.pipe(v.object({ verification: v.optional(v.custom(() => true)) }), v.transform((res) => ({ verification: transformVerification(res.verification) })));
|
|
94
|
+
/** Only Telegram links through confirmation. */
|
|
95
|
+
const TelegramProviderInputSchema = v.pipe(v.literal("telegram"), v.transform(() => 3));
|
|
96
|
+
const ConfirmVerificationInputSchema = v.strictObject({
|
|
97
|
+
provider: TelegramProviderInputSchema,
|
|
98
|
+
/** The verification's `providerUserId` in `awaiting_confirmation`: a decimal 64-bit ID. */
|
|
99
|
+
providerUserId: v.pipe(v.string(), v.regex(/^[1-9]\d{0,19}$/u, "providerUserId must be a decimal Telegram user ID"))
|
|
100
|
+
});
|
|
101
|
+
const UnlinkSocialAccountInputSchema = v.strictObject({ provider: TelegramProviderInputSchema });
|
|
77
102
|
//#endregion
|
|
78
|
-
export { GetVerificationResponseSchema, ProviderInputSchema, SocialProviderInputSchema, SocialProviderSchema, SocialVerificationMethodSchema, SocialVerificationStatusSchema, StartVerificationInputSchema, StartVerificationResponseSchema, VerificationReadyResponseSchema, transformVerification };
|
|
103
|
+
export { ConfirmVerificationInputSchema, GetVerificationResponseSchema, ProviderInputSchema, SocialProviderInputSchema, SocialProviderSchema, SocialVerificationMethodSchema, SocialVerificationStatusSchema, StartVerificationInputSchema, StartVerificationResponseSchema, UnlinkSocialAccountInputSchema, VerificationReadyResponseSchema, transformVerification };
|
|
79
104
|
|
|
80
105
|
//# sourceMappingURL=social-verification.schemas.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"social-verification.schemas.js","names":[],"sources":["../../../src/services/social-verification/social-verification.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { TimestampSchema } from \"../../shared/schemas.js\";\nimport { enumLabel } from \"../../shared/proto-enum-codec.js\";\nimport type { DecodedEnum } from \"../../utils/types.js\";\nimport * as Proto from \"../../gen/auth/v1/social_verification_pb.js\";\nimport {\n SOCIAL_PROVIDER_VALUES,\n SOCIAL_VERIFICATION_ERROR_CODE_VALUES,\n SOCIAL_VERIFICATION_METHOD_VALUES,\n SOCIAL_VERIFICATION_STATUS_VALUES,\n SocialProviderCodec,\n SocialVerificationErrorCodeCodec,\n SocialVerificationMethodCodec,\n SocialVerificationStatusCodec,\n} from \"./social-verification.codecs.js\";\n\nexport {\n SOCIAL_PROVIDER_VALUES,\n SOCIAL_VERIFICATION_ERROR_CODE_VALUES,\n SOCIAL_VERIFICATION_METHOD_VALUES,\n SOCIAL_VERIFICATION_STATUS_VALUES,\n} from \"./social-verification.codecs.js\";\n\nexport const SocialProviderSchema = v.picklist(SOCIAL_PROVIDER_VALUES);\nexport type SocialProvider = v.InferInput<typeof SocialProviderSchema>;\n\nexport const SocialVerificationMethodSchema = v.picklist(SOCIAL_VERIFICATION_METHOD_VALUES);\nexport type SocialVerificationMethod = v.InferInput<typeof SocialVerificationMethodSchema>;\n\nexport const SocialVerificationErrorCodeSchema = v.picklist(SOCIAL_VERIFICATION_ERROR_CODE_VALUES);\nexport type SocialVerificationErrorCode = v.InferOutput<typeof SocialVerificationErrorCodeSchema>;\n\nexport const SocialVerificationStatusSchema = v.picklist(SOCIAL_VERIFICATION_STATUS_VALUES);\nexport type SocialVerificationStatus = v.InferOutput<typeof SocialVerificationStatusSchema>;\n\nfunction normalizeHandle(input: string): string {\n return (input ?? \"\").trim().replace(/^@+/, \"\");\n}\n\nconst TWITTER_HANDLE_PATTERN = /^[A-Za-z0-9_]{1,15}$/;\n\n/**\n * Normalizes a social verification response into the SDK verification shape.\n */\nexport function transformVerification(\n v: Proto.SocialVerification | undefined,\n): SocialVerification | undefined {\n if (!v) return undefined;\n return {\n id: v.id,\n provider: enumLabel(SocialProviderCodec.protoToOutput, v.provider),\n method: enumLabel(SocialVerificationMethodCodec.protoToOutput, v.method),\n handle: v.handle,\n providerUserId: v.providerUserId,\n challengeCode: v.challengeCode,\n status: enumLabel(SocialVerificationStatusCodec.protoToOutput, v.status),\n requestedAt: v.requestedAt,\n expiresAt: v.expiresAt,\n verifiedAt: v.verifiedAt,\n attempts: v.attempts,\n lastError: v.lastError,\n errorCode: enumLabel(SocialVerificationErrorCodeCodec.protoToOutput, v.errorCode),\n updatedAt: v.updatedAt,\n };\n}\n\nexport const SocialVerificationSchema = v.object({\n id: v.bigint(),\n provider: SocialProviderSchema,\n method: SocialVerificationMethodSchema,\n handle: v.string(),\n providerUserId: v.string(),\n challengeCode: v.string(),\n status: SocialVerificationStatusSchema,\n requestedAt: v.optional(TimestampSchema),\n expiresAt: v.optional(TimestampSchema),\n verifiedAt: v.optional(TimestampSchema),\n attempts: v.number(),\n lastError: v.string(),\n updatedAt: v.optional(TimestampSchema),\n});\n\ntype SocialVerificationBase = v.InferOutput<typeof SocialVerificationSchema>;\nexport type SocialVerification = Omit<SocialVerificationBase, \"provider\" | \"method\" | \"status\"> & {\n provider: DecodedEnum<SocialProvider>;\n method: DecodedEnum<SocialVerificationMethod>;\n status: DecodedEnum<SocialVerificationStatus>;\n /**\n * Machine-readable failure for the current state; branch on this, not `lastError`.\n * `\"unspecified\"` when no typed failure applies or the code is newer than this SDK.\n * `\"social_account_already_linked\"` is non-retryable for this account: send the\n * user to the account already linked to that identity instead of restarting.\n */\n errorCode: DecodedEnum<SocialVerificationErrorCode>;\n};\n\nexport const StartVerificationInputSchema = v.pipe(\n v.variant(\"provider\", [\n v.strictObject({\n provider: v.literal(\"twitter\"),\n handle: v.pipe(\n v.string(),\n v.transform(normalizeHandle),\n v.minLength(1),\n v.regex(\n TWITTER_HANDLE_PATTERN,\n \"Twitter handle must be 1-15 letters, digits, or underscores\",\n ),\n ),\n method: v.optional(v.literal(\"profile\")),\n }),\n v.strictObject({\n provider: v.literal(\"discord\"),\n method: v.optional(v.picklist([\"channel\", \"dm\"])),\n }),\n ]),\n v.transform(({ provider, method, ...input }) => ({\n ...input,\n provider: SocialProviderCodec.inputToProto[provider],\n // METHOD_UNSPECIFIED lets the API choose Twitter's profile or Discord's channel default.\n method:\n method === undefined\n ? Proto.SocialVerificationMethod.METHOD_UNSPECIFIED\n : SocialVerificationMethodCodec.inputToProto[method],\n })),\n);\n\nexport type StartVerificationInput = v.InferInput<typeof StartVerificationInputSchema>;\n\nexport const ProviderInputSchema = v.pipe(\n SocialProviderSchema,\n v.transform((v) => SocialProviderCodec.inputToProto[v]),\n);\n\nexport const SocialProviderInputSchema = v.strictObject({\n provider: ProviderInputSchema,\n});\n\nexport type SocialProviderInput = v.InferInput<typeof SocialProviderInputSchema>;\n\nexport const StartVerificationResponseSchema = v.pipe(\n v.object({\n challengeCode: v.string(),\n expiresAt: v.optional(TimestampSchema),\n verification: v.optional(v.custom<Proto.SocialVerification>(() => true)),\n }),\n v.transform((res) => ({\n challengeCode: res.challengeCode,\n expiresAt: res.expiresAt,\n verification: transformVerification(res.verification),\n })),\n);\n\nexport type StartVerificationResponse = v.InferOutput<typeof StartVerificationResponseSchema>;\n\nexport const VerificationReadyResponseSchema = v.pipe(\n v.object({\n verification: v.optional(v.custom<Proto.SocialVerification>(() => true)),\n }),\n v.transform((res) => ({\n verification: transformVerification(res.verification),\n })),\n);\n\nexport type VerificationReadyResponse = v.InferOutput<typeof VerificationReadyResponseSchema>;\n\nexport const GetVerificationResponseSchema = v.pipe(\n v.object({\n verification: v.optional(v.custom<Proto.SocialVerification>(() => true)),\n }),\n v.transform((res) => ({\n verification: transformVerification(res.verification),\n })),\n);\n\nexport type GetVerificationResponse = v.InferOutput<typeof GetVerificationResponseSchema>;\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"social-verification.schemas.js","names":[],"sources":["../../../src/services/social-verification/social-verification.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { TimestampSchema } from \"../../shared/schemas.js\";\nimport { enumLabel } from \"../../shared/proto-enum-codec.js\";\nimport type { DecodedEnum } from \"../../utils/types.js\";\nimport * as Proto from \"../../gen/auth/v1/social_verification_pb.js\";\nimport {\n SOCIAL_PROVIDER_VALUES,\n SOCIAL_VERIFICATION_ERROR_CODE_VALUES,\n SOCIAL_VERIFICATION_METHOD_VALUES,\n SOCIAL_VERIFICATION_STATUS_VALUES,\n SocialProviderCodec,\n SocialVerificationErrorCodeCodec,\n SocialVerificationMethodCodec,\n SocialVerificationStatusCodec,\n} from \"./social-verification.codecs.js\";\n\nexport {\n SOCIAL_PROVIDER_VALUES,\n SOCIAL_VERIFICATION_ERROR_CODE_VALUES,\n SOCIAL_VERIFICATION_METHOD_VALUES,\n SOCIAL_VERIFICATION_STATUS_VALUES,\n} from \"./social-verification.codecs.js\";\n\nexport const SocialProviderSchema = v.picklist(SOCIAL_PROVIDER_VALUES);\nexport type SocialProvider = v.InferInput<typeof SocialProviderSchema>;\n\nexport const SocialVerificationMethodSchema = v.picklist(SOCIAL_VERIFICATION_METHOD_VALUES);\nexport type SocialVerificationMethod = v.InferInput<typeof SocialVerificationMethodSchema>;\n\nexport const SocialVerificationErrorCodeSchema = v.picklist(SOCIAL_VERIFICATION_ERROR_CODE_VALUES);\nexport type SocialVerificationErrorCode = v.InferOutput<typeof SocialVerificationErrorCodeSchema>;\n\nexport const SocialVerificationStatusSchema = v.picklist(SOCIAL_VERIFICATION_STATUS_VALUES);\nexport type SocialVerificationStatus = v.InferOutput<typeof SocialVerificationStatusSchema>;\n\nfunction normalizeHandle(input: string): string {\n return (input ?? \"\").trim().replace(/^@+/, \"\");\n}\n\nconst TWITTER_HANDLE_PATTERN = /^[A-Za-z0-9_]{1,15}$/;\n\n/**\n * Normalizes a social verification response into the SDK verification shape.\n */\nexport function transformVerification(\n v: Proto.SocialVerification | undefined,\n): SocialVerification | undefined {\n if (!v) return undefined;\n return {\n id: v.id,\n provider: enumLabel(SocialProviderCodec.protoToOutput, v.provider),\n method: enumLabel(SocialVerificationMethodCodec.protoToOutput, v.method),\n handle: v.handle,\n providerUserId: v.providerUserId,\n displayName: v.displayName,\n challengeCode: v.challengeCode,\n status: enumLabel(SocialVerificationStatusCodec.protoToOutput, v.status),\n requestedAt: v.requestedAt,\n expiresAt: v.expiresAt,\n verifiedAt: v.verifiedAt,\n attempts: v.attempts,\n lastError: v.lastError,\n errorCode: enumLabel(SocialVerificationErrorCodeCodec.protoToOutput, v.errorCode),\n updatedAt: v.updatedAt,\n };\n}\n\nexport const SocialVerificationSchema = v.object({\n id: v.bigint(),\n provider: SocialProviderSchema,\n method: SocialVerificationMethodSchema,\n handle: v.string(),\n /**\n * Provider-side user ID, empty until verified. For Telegram in `awaiting_confirmation`, the\n * decimal user ID of the account that sent the code: pass it to `confirm` as is.\n */\n providerUserId: v.string(),\n /** Telegram only: the account's name once the code is submitted; empty otherwise. */\n displayName: v.string(),\n challengeCode: v.string(),\n status: SocialVerificationStatusSchema,\n requestedAt: v.optional(TimestampSchema),\n expiresAt: v.optional(TimestampSchema),\n verifiedAt: v.optional(TimestampSchema),\n attempts: v.number(),\n lastError: v.string(),\n updatedAt: v.optional(TimestampSchema),\n});\n\ntype SocialVerificationBase = v.InferOutput<typeof SocialVerificationSchema>;\nexport type SocialVerification = Omit<SocialVerificationBase, \"provider\" | \"method\" | \"status\"> & {\n provider: DecodedEnum<SocialProvider>;\n method: DecodedEnum<SocialVerificationMethod>;\n status: DecodedEnum<SocialVerificationStatus>;\n /**\n * Machine-readable failure for the current state; branch on this, not `lastError`.\n * `\"unspecified\"` when no typed failure applies or the code is newer than this SDK.\n * `\"social_account_already_linked\"` is non-retryable for this account: send the\n * user to the account already linked to that identity instead of restarting.\n */\n errorCode: DecodedEnum<SocialVerificationErrorCode>;\n};\n\nexport const StartVerificationInputSchema = v.pipe(\n v.variant(\"provider\", [\n v.strictObject({\n provider: v.literal(\"twitter\"),\n handle: v.pipe(\n v.string(),\n v.transform(normalizeHandle),\n v.minLength(1),\n v.regex(\n TWITTER_HANDLE_PATTERN,\n \"Twitter handle must be 1-15 letters, digits, or underscores\",\n ),\n ),\n method: v.optional(v.literal(\"profile\")),\n }),\n v.strictObject({\n provider: v.literal(\"discord\"),\n method: v.optional(v.picklist([\"channel\", \"dm\"])),\n }),\n v.strictObject({\n provider: v.literal(\"telegram\"),\n method: v.optional(v.literal(\"dm\")),\n }),\n ]),\n v.transform(({ provider, method, ...input }) => ({\n ...input,\n provider: SocialProviderCodec.inputToProto[provider],\n // METHOD_UNSPECIFIED lets the API choose Twitter's profile or Discord's channel default.\n method:\n method === undefined\n ? Proto.SocialVerificationMethod.METHOD_UNSPECIFIED\n : SocialVerificationMethodCodec.inputToProto[method],\n })),\n);\n\nexport type StartVerificationInput = v.InferInput<typeof StartVerificationInputSchema>;\n\nexport const ProviderInputSchema = v.pipe(\n SocialProviderSchema,\n v.transform((v) => SocialProviderCodec.inputToProto[v]),\n);\n\nexport const SocialProviderInputSchema = v.strictObject({\n provider: ProviderInputSchema,\n});\n\nexport type SocialProviderInput = v.InferInput<typeof SocialProviderInputSchema>;\n\nexport const StartVerificationResponseSchema = v.pipe(\n v.object({\n challengeCode: v.string(),\n expiresAt: v.optional(TimestampSchema),\n verification: v.optional(v.custom<Proto.SocialVerification>(() => true)),\n /** Telegram: the `https://t.me/...` link that sends the code to the bot; empty otherwise. */\n actionUrl: v.optional(v.string(), \"\"),\n }),\n v.transform((res) => ({\n challengeCode: res.challengeCode,\n expiresAt: res.expiresAt,\n actionUrl: res.actionUrl,\n verification: transformVerification(res.verification),\n })),\n);\n\nexport type StartVerificationResponse = v.InferOutput<typeof StartVerificationResponseSchema>;\n\nexport const VerificationReadyResponseSchema = v.pipe(\n v.object({\n verification: v.optional(v.custom<Proto.SocialVerification>(() => true)),\n }),\n v.transform((res) => ({\n verification: transformVerification(res.verification),\n })),\n);\n\nexport type VerificationReadyResponse = v.InferOutput<typeof VerificationReadyResponseSchema>;\n\nexport const GetVerificationResponseSchema = v.pipe(\n v.object({\n verification: v.optional(v.custom<Proto.SocialVerification>(() => true)),\n }),\n v.transform((res) => ({\n verification: transformVerification(res.verification),\n })),\n);\n\nexport type GetVerificationResponse = v.InferOutput<typeof GetVerificationResponseSchema>;\n\n/** Only Telegram links through confirmation. */\nconst TelegramProviderInputSchema = v.pipe(\n v.literal(\"telegram\"),\n v.transform(() => Proto.SocialProvider.TELEGRAM),\n);\n\nexport const ConfirmVerificationInputSchema = v.strictObject({\n provider: TelegramProviderInputSchema,\n /** The verification's `providerUserId` in `awaiting_confirmation`: a decimal 64-bit ID. */\n providerUserId: v.pipe(\n v.string(),\n v.regex(/^[1-9]\\d{0,19}$/u, \"providerUserId must be a decimal Telegram user ID\"),\n ),\n});\n\nexport type ConfirmVerificationInput = v.InferInput<typeof ConfirmVerificationInputSchema>;\n\nexport const UnlinkSocialAccountInputSchema = v.strictObject({\n provider: TelegramProviderInputSchema,\n});\n\nexport type UnlinkSocialAccountInput = v.InferInput<typeof UnlinkSocialAccountInputSchema>;\n"],"mappings":"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"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { GetVerificationResponse, SocialProvider, SocialProviderInput, SocialVerification, SocialVerificationErrorCode, SocialVerificationMethod, SocialVerificationStatus, StartVerificationInput, StartVerificationResponse, VerificationReadyResponse } from "./social-verification.schemas.js";
|
|
2
|
-
export type { GetVerificationResponse, SocialProvider, SocialProviderInput, SocialVerification, SocialVerificationErrorCode, SocialVerificationMethod, SocialVerificationStatus, StartVerificationInput, StartVerificationResponse, VerificationReadyResponse };
|
|
1
|
+
import { ConfirmVerificationInput, GetVerificationResponse, SocialProvider, SocialProviderInput, SocialVerification, SocialVerificationErrorCode, SocialVerificationMethod, SocialVerificationStatus, StartVerificationInput, StartVerificationResponse, UnlinkSocialAccountInput, VerificationReadyResponse } from "./social-verification.schemas.js";
|
|
2
|
+
export type { ConfirmVerificationInput, GetVerificationResponse, SocialProvider, SocialProviderInput, SocialVerification, SocialVerificationErrorCode, SocialVerificationMethod, SocialVerificationStatus, StartVerificationInput, StartVerificationResponse, UnlinkSocialAccountInput, VerificationReadyResponse };
|
|
@@ -9,7 +9,7 @@ declare const SubaccountPermissionDefinitionSchema: v.ObjectSchema<{
|
|
|
9
9
|
readonly permission: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "internal_transfer" | "read_subaccount" | "update_subaccount" | "read_balances" | "read_spot" | "trade_spot" | "read_internal_transfers" | "external_withdraw" | "read_address_book" | "manage_address_book" | "read_members" | "manage_members" | "read_invites" | "manage_invites" | "read_api_keys" | "manage_api_keys" | "read_subaccount_policy" | "manage_subaccount_policy" | "read_activity" | "read_activity_security_details" | "manage_member_mfa_requirement" | "create_deposit_address" | "read_deposit_addresses" | "read_guard_signer_status" | "manage_guard_signer" | "read_auto_withdraw" | "manage_auto_withdraw" | "swap">]>;
|
|
10
10
|
readonly displayName: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
11
11
|
readonly description: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
12
|
-
readonly policyAction: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw" | "read-api-keys" | "read-api-policies" | "read-subaccount-policies" | "read-subaccount-permissions" | "read-vip-status" | "read-social-verification" | "read-profile" | "read-account-directory" | "read-withdraw-validation" | "read-daily-claims" | "claim-daily-reward" | "read-checkpoints" | "read-rewards">]>;
|
|
12
|
+
readonly policyAction: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw" | "read-api-keys" | "read-api-policies" | "read-subaccount-policies" | "read-subaccount-permissions" | "read-vip-status" | "read-social-verification" | "read-profile" | "read-account-directory" | "read-withdraw-validation" | "read-daily-claims" | "claim-daily-reward" | "read-checkpoints" | "read-rewards" | "create-deposit-address" | "read-deposit-addresses" | "read-subaccounts" | "read-subaccount-activity" | "read-subaccount-members" | "read-subaccount-invites" | "read-guard-signer-status">]>;
|
|
13
13
|
}, undefined>;
|
|
14
14
|
type SubaccountPermissionDefinition = v.InferOutput<typeof SubaccountPermissionDefinitionSchema>;
|
|
15
15
|
declare const SubaccountRoleDefinitionSchema: v.ObjectSchema<{
|
|
@@ -25,7 +25,7 @@ declare const SubaccountRoleCatalogSchema: v.ObjectSchema<{
|
|
|
25
25
|
readonly permission: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "internal_transfer" | "read_subaccount" | "update_subaccount" | "read_balances" | "read_spot" | "trade_spot" | "read_internal_transfers" | "external_withdraw" | "read_address_book" | "manage_address_book" | "read_members" | "manage_members" | "read_invites" | "manage_invites" | "read_api_keys" | "manage_api_keys" | "read_subaccount_policy" | "manage_subaccount_policy" | "read_activity" | "read_activity_security_details" | "manage_member_mfa_requirement" | "create_deposit_address" | "read_deposit_addresses" | "read_guard_signer_status" | "manage_guard_signer" | "read_auto_withdraw" | "manage_auto_withdraw" | "swap">]>;
|
|
26
26
|
readonly displayName: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
27
27
|
readonly description: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
28
|
-
readonly policyAction: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw" | "read-api-keys" | "read-api-policies" | "read-subaccount-policies" | "read-subaccount-permissions" | "read-vip-status" | "read-social-verification" | "read-profile" | "read-account-directory" | "read-withdraw-validation" | "read-daily-claims" | "claim-daily-reward" | "read-checkpoints" | "read-rewards">]>;
|
|
28
|
+
readonly policyAction: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "swap" | "trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book" | "read-auto-withdraw" | "manage-auto-withdraw" | "read-api-keys" | "read-api-policies" | "read-subaccount-policies" | "read-subaccount-permissions" | "read-vip-status" | "read-social-verification" | "read-profile" | "read-account-directory" | "read-withdraw-validation" | "read-daily-claims" | "claim-daily-reward" | "read-checkpoints" | "read-rewards" | "create-deposit-address" | "read-deposit-addresses" | "read-subaccounts" | "read-subaccount-activity" | "read-subaccount-members" | "read-subaccount-invites" | "read-guard-signer-status">]>;
|
|
29
29
|
}, undefined>, undefined>, readonly []>;
|
|
30
30
|
readonly roles: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
31
31
|
readonly role: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "owner" | "admin" | "treasury" | "leveraged_trader" | "trader" | "viewer">]>;
|
|
@@ -242,7 +242,7 @@ declare const SubaccountInviteSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
|
|
|
242
242
|
readonly granteeAccountId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
243
243
|
readonly inviterAccountId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
244
244
|
readonly role: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "owner" | "admin" | "treasury" | "leveraged_trader" | "trader" | "viewer">]>;
|
|
245
|
-
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "
|
|
245
|
+
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "accepted" | "canceled" | "pending" | "declined">]>;
|
|
246
246
|
readonly createdAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
|
|
247
247
|
readonly seconds: v.BigintSchema<undefined>;
|
|
248
248
|
readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
|
|
@@ -269,7 +269,7 @@ declare const SubaccountInviteSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
|
|
|
269
269
|
granteeAccountId: string;
|
|
270
270
|
inviterAccountId: string;
|
|
271
271
|
role: "unspecified" | "owner" | "admin" | "treasury" | "leveraged_trader" | "trader" | "viewer";
|
|
272
|
-
status: "unspecified" | "
|
|
272
|
+
status: "unspecified" | "accepted" | "canceled" | "pending" | "declined";
|
|
273
273
|
createdAt?: number | undefined;
|
|
274
274
|
respondedAt?: number | undefined;
|
|
275
275
|
granteeUsername: string;
|
|
@@ -287,7 +287,7 @@ declare const SubaccountInviteSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
|
|
|
287
287
|
granteeAccountId: string;
|
|
288
288
|
inviterAccountId: string;
|
|
289
289
|
role: "unspecified" | "owner" | "admin" | "treasury" | "leveraged_trader" | "trader" | "viewer";
|
|
290
|
-
status: "unspecified" | "
|
|
290
|
+
status: "unspecified" | "accepted" | "canceled" | "pending" | "declined";
|
|
291
291
|
createdAt?: number | undefined;
|
|
292
292
|
respondedAt?: number | undefined;
|
|
293
293
|
granteeUsername: string;
|
|
@@ -309,9 +309,9 @@ declare const SubaccountActivityEventSchema: v.ObjectSchema<{
|
|
|
309
309
|
seconds: bigint;
|
|
310
310
|
nanos: number;
|
|
311
311
|
} | undefined, number | undefined>]>;
|
|
312
|
-
readonly entityKind: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "
|
|
313
|
-
readonly eventAction: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "disabled" | "
|
|
314
|
-
readonly source: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "
|
|
312
|
+
readonly entityKind: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "api_key" | "account" | "subaccount" | "destination" | "session" | "member" | "policy" | "invite" | "security">]>;
|
|
313
|
+
readonly eventAction: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "disabled" | "removed" | "revoked" | "failed" | "created" | "updated" | "deleted" | "enabled" | "role_set" | "received" | "replied" | "blocked" | "hold_placed" | "hold_released">]>;
|
|
314
|
+
readonly source: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "web" | "mobile" | "api">]>;
|
|
315
315
|
readonly ip: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
316
316
|
readonly userAgent: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
317
317
|
readonly actorAccountId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SystemService } from "./system.js";
|
|
2
|
+
import { PolyesterCore } from "../../core-client.js";
|
|
3
|
+
//#region src/services/system/service.d.ts
|
|
4
|
+
/** Returns the client's SystemService, creating it on first use. */
|
|
5
|
+
declare const systemService: (client: PolyesterCore) => SystemService;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { systemService };
|
|
8
|
+
//# sourceMappingURL=service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.d.ts","names":[],"sources":["../../../src/services/system/service.ts"],"mappings":";;;;cAIa,gBAAa,QAAb,kBAAa"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { defineService } from "../../core-client.js";
|
|
2
|
+
import { SystemService } from "./system.js";
|
|
3
|
+
//#region src/services/system/service.ts
|
|
4
|
+
/** Returns the client's SystemService, creating it on first use. */
|
|
5
|
+
const systemService = defineService((context) => new SystemService(context.transports));
|
|
6
|
+
//#endregion
|
|
7
|
+
export { systemService };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.js","names":[],"sources":["../../../src/services/system/service.ts"],"sourcesContent":["import { defineService } from \"../../core-client.js\";\nimport { SystemService } from \"./system.js\";\n\n/** Returns the client's SystemService, creating it on first use. */\nexport const systemService = defineService((context) => new SystemService(context.transports));\n"],"mappings":";;;;AAIA,MAAa,gBAAgB,eAAe,YAAY,IAAI,cAAc,QAAQ,UAAU,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { PublicApiTransports } from "../../shared/transports.js";
|
|
2
|
+
import { PolyesterRequestOptions } from "../../shared/request-options.js";
|
|
3
|
+
//#region src/services/system/system.d.ts
|
|
4
|
+
/** The build an environment serves. */
|
|
5
|
+
interface SystemVersion {
|
|
6
|
+
/**
|
|
7
|
+
* `MAJOR.MINOR.PATCH` for a release, such as `"0.10.0"`. A build after a release appends the
|
|
8
|
+
* revisions since it and its own short revision, such as `"0.10.0-12-g4e21a2f09670"`.
|
|
9
|
+
*/
|
|
10
|
+
version: string;
|
|
11
|
+
/** Full 40-character lowercase source revision. */
|
|
12
|
+
commit: string;
|
|
13
|
+
/** `"devnet"`, `"testnet"`, `"mainnet"`, or `"local"` for a development stack. */
|
|
14
|
+
environment: "devnet" | "testnet" | "mainnet" | "local" | (string & {});
|
|
15
|
+
}
|
|
16
|
+
/** Facts about the environment itself. Public and read-only: no authentication needed. */
|
|
17
|
+
declare class SystemService {
|
|
18
|
+
#private;
|
|
19
|
+
constructor(transports: PublicApiTransports);
|
|
20
|
+
/** Returns the version and source revision of the build the environment serves. */
|
|
21
|
+
getVersion(options?: PolyesterRequestOptions): Promise<SystemVersion>;
|
|
22
|
+
}
|
|
23
|
+
//#endregion
|
|
24
|
+
export { SystemService, SystemVersion };
|
|
25
|
+
//# sourceMappingURL=system.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.d.ts","names":[],"sources":["../../../src/services/system/system.ts"],"mappings":";;;;UASiB;;;;;EAKb;;EAEA;;EAEA;;;cAIS;;EAGG,YAAA,YAAY;;EAKlB,WAAW,UAAU,0BAA0B,QAAQ"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { toConnectCallOptions } from "../../shared/request-options.js";
|
|
2
|
+
import { SystemService as SystemService$1 } from "../../gen/system/v1/system_pb.js";
|
|
3
|
+
import { createClient } from "@connectrpc/connect";
|
|
4
|
+
//#region src/services/system/system.ts
|
|
5
|
+
/** Facts about the environment itself. Public and read-only: no authentication needed. */
|
|
6
|
+
var SystemService = class {
|
|
7
|
+
#client;
|
|
8
|
+
constructor(transports) {
|
|
9
|
+
this.#client = createClient(SystemService$1, transports.publicApi);
|
|
10
|
+
}
|
|
11
|
+
/** Returns the version and source revision of the build the environment serves. */
|
|
12
|
+
async getVersion(options) {
|
|
13
|
+
const { version, commit, environment } = await this.#client.getVersion({}, toConnectCallOptions(options));
|
|
14
|
+
return {
|
|
15
|
+
version,
|
|
16
|
+
commit,
|
|
17
|
+
environment
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
22
|
+
export { SystemService };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=system.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system.js","names":["#client","Proto.SystemService"],"sources":["../../../src/services/system/system.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/system/v1/system_pb.js\";\nimport {\n toConnectCallOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport type { PublicApiTransports } from \"../../shared/transports.js\";\n\n/** The build an environment serves. */\nexport interface SystemVersion {\n /**\n * `MAJOR.MINOR.PATCH` for a release, such as `\"0.10.0\"`. A build after a release appends the\n * revisions since it and its own short revision, such as `\"0.10.0-12-g4e21a2f09670\"`.\n */\n version: string;\n /** Full 40-character lowercase source revision. */\n commit: string;\n /** `\"devnet\"`, `\"testnet\"`, `\"mainnet\"`, or `\"local\"` for a development stack. */\n environment: \"devnet\" | \"testnet\" | \"mainnet\" | \"local\" | (string & {});\n}\n\n/** Facts about the environment itself. Public and read-only: no authentication needed. */\nexport class SystemService {\n #client: Client<typeof Proto.SystemService>;\n\n constructor(transports: PublicApiTransports) {\n this.#client = createClient(Proto.SystemService, transports.publicApi);\n }\n\n /** Returns the version and source revision of the build the environment serves. */\n async getVersion(options?: PolyesterRequestOptions): Promise<SystemVersion> {\n const { version, commit, environment } = await this.#client.getVersion(\n {},\n toConnectCallOptions(options),\n );\n return { version, commit, environment };\n }\n}\n"],"mappings":";;;;;AAsBA,IAAa,gBAAb,MAA2B;CACvB;CAEA,YAAY,YAAiC;EACzC,KAAKA,UAAU,aAAaC,iBAAqB,WAAW,SAAS;CACzE;;CAGA,MAAM,WAAW,SAA2D;EACxE,MAAM,EAAE,SAAS,QAAQ,gBAAgB,MAAM,KAAKD,QAAQ,WACxD,CAAC,GACD,qBAAqB,OAAO,CAChC;EACA,OAAO;GAAE;GAAS;GAAQ;EAAY;CAC1C;AACJ"}
|
|
@@ -3,10 +3,10 @@ import { removeUndefined } from "../../utils/remove-undefined.js";
|
|
|
3
3
|
import { toConnectCallOptions } from "../../shared/request-options.js";
|
|
4
4
|
import { deliverBatch } from "../../shared/subscription-errors.js";
|
|
5
5
|
import { resolveAccountScopedInput } from "../subaccount-resolver.js";
|
|
6
|
-
import { connectReadyGatedProtoChannel } from "../../realtime/ready-gated-subscription.js";
|
|
7
6
|
import { OrdersReadService, UserTradeBatchSchema } from "../../gen/orders/v1/orders_read_pb.js";
|
|
8
7
|
import { GetUserTradesInputSchema, formatUserTrade } from "./trades.schemas.js";
|
|
9
8
|
import { createOrderTransferSchema } from "../orders/orders-output.schemas.js";
|
|
9
|
+
import { connectReadyGatedProtoChannel } from "../../realtime/ready-gated-subscription.js";
|
|
10
10
|
import { createClient } from "@connectrpc/connect";
|
|
11
11
|
import * as v from "valibot";
|
|
12
12
|
//#region src/services/trades/trades.ts
|
|
@@ -169,7 +169,7 @@ declare const GetUserTradesInputSchema: v.SchemaWithPipe<readonly [v.UnionSchema
|
|
|
169
169
|
readonly orderId: v.OptionalSchema<v.NeverSchema<undefined>, undefined>;
|
|
170
170
|
readonly lineageId: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>, v.CheckAction<bigint, `${string} must be greater than zero`>]>;
|
|
171
171
|
readonly throughGeneration: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>, undefined>;
|
|
172
|
-
}, undefined>], undefined>], ({ input }: v.UnionIssue<v.
|
|
172
|
+
}, undefined>], undefined>], ({ input }: v.UnionIssue<v.NumberIssue | v.StringIssue | v.BooleanIssue | v.IntegerIssue<number> | v.MinValueIssue<number, 1> | v.MaxValueIssue<number, 4294967295> | v.MinLengthIssue<string, 1> | v.StrictObjectIssue | v.PicklistIssue | v.UnionIssue<v.StringIssue | v.MinLengthIssue<string, 1> | v.StrictObjectIssue | v.PicklistIssue> | v.GtValueIssue<number, 0> | v.CheckIssue<bigint> | v.NeverIssue | v.MaxValueIssue<number, 1000> | v.UnionIssue<v.NumberIssue | v.StringIssue | v.BooleanIssue | v.IntegerIssue<number> | v.MinValueIssue<number, 1> | v.MaxValueIssue<number, 4294967295> | v.MinLengthIssue<string, 1> | v.StrictObjectIssue | v.PicklistIssue | v.UnionIssue<v.StringIssue | v.MinLengthIssue<string, 1> | v.StrictObjectIssue | v.PicklistIssue> | v.GtValueIssue<number, 0> | v.CheckIssue<bigint> | v.NeverIssue | v.MaxValueIssue<number, 1000>>>) => "Provide at most one of orderId or lineageId" | "throughGeneration requires lineageId" | "symbolId is required when afterMatchId is set" | "Invalid trade filters">, v.TransformAction<{
|
|
173
173
|
symbolId?: number | undefined;
|
|
174
174
|
afterMatchId?: undefined;
|
|
175
175
|
side?: Side.BUY | Side.SELL | undefined;
|
|
@@ -10,9 +10,9 @@ import { SideSchema, SymbolIdInputSchema } from "../shared.js";
|
|
|
10
10
|
import { AccountScopeInputEntries, accountScopeToSubaccountId } from "../../shared/account-scope.js";
|
|
11
11
|
import { fromU128 } from "../../utils/u128.js";
|
|
12
12
|
import { FeeAssetCodec, OrderSideCodec } from "../orders/order-enums.codecs.js";
|
|
13
|
-
import { positiveOrderIdInputSchema } from "../orders/orders-identifiers.schemas.js";
|
|
14
13
|
import { OrderLineageSchema } from "../orders/order-lineage.schemas.js";
|
|
15
14
|
import { TradeSideCodec } from "./trades.codecs.js";
|
|
15
|
+
import { positiveOrderIdInputSchema } from "../orders/orders-identifiers.schemas.js";
|
|
16
16
|
import * as v from "valibot";
|
|
17
17
|
//#region src/services/trades/trades.schemas.ts
|
|
18
18
|
const UserTradeFieldsSchema = v.object({
|