@polyester/sdk 0.19.3 → 0.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/dist/gen/auth/v1/api_keys_pb.d.ts +3 -1
- package/dist/gen/auth/v1/api_keys_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/api_keys_pb.js.map +1 -1
- package/dist/gen/auth/v1/auth_pb.d.ts +49 -5
- package/dist/gen/auth/v1/auth_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/auth_pb.js +21 -3
- package/dist/gen/auth/v1/auth_pb.js.map +1 -1
- package/dist/gen/auth/v1/profile_pb.d.ts +7 -0
- package/dist/gen/auth/v1/profile_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/profile_pb.js +1 -1
- package/dist/gen/auth/v1/profile_pb.js.map +1 -1
- package/dist/gen/auth/v1/social_verification_pb.d.ts +4 -2
- package/dist/gen/auth/v1/social_verification_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/social_verification_pb.js.map +1 -1
- package/dist/gen/auth/v1/subaccounts_pb.d.ts +4 -2
- 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/deposit/v1/deposit_pb.d.ts +4 -1
- package/dist/gen/chain/deposit/v1/deposit_pb.d.ts.map +1 -1
- package/dist/gen/chain/deposit/v1/deposit_pb.js.map +1 -1
- package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts +290 -2
- package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts.map +1 -1
- package/dist/gen/chain/withdraw/v1/withdraw_pb.js +288 -9
- package/dist/gen/chain/withdraw/v1/withdraw_pb.js.map +1 -1
- package/dist/gen/index.d.ts +10 -10
- package/dist/gen/index.js +7 -7
- package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts +1 -1
- package/dist/gen/ledger/read/v1/ledger_read_pb.js +1 -1
- package/dist/gen/orderbook/v1/orderbook_pb.d.ts +5 -3
- package/dist/gen/orderbook/v1/orderbook_pb.d.ts.map +1 -1
- package/dist/gen/orderbook/v1/orderbook_pb.js.map +1 -1
- package/dist/gen/orders/v1/orders_pb.d.ts +14 -6
- package/dist/gen/orders/v1/orders_pb.d.ts.map +1 -1
- package/dist/gen/orders/v1/orders_pb.js +7 -1
- 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/orders/v1/orders_read_pb.js +2 -2
- package/dist/gen/transfer/v1/internal_transfer_pb.d.ts +200 -2
- package/dist/gen/transfer/v1/internal_transfer_pb.d.ts.map +1 -1
- package/dist/gen/transfer/v1/internal_transfer_pb.js +193 -4
- package/dist/gen/transfer/v1/internal_transfer_pb.js.map +1 -1
- package/dist/gen/triggers/v1/triggers_pb.d.ts +47 -2
- package/dist/gen/triggers/v1/triggers_pb.d.ts.map +1 -1
- package/dist/gen/triggers/v1/triggers_pb.js +1 -1
- package/dist/gen/triggers/v1/triggers_pb.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +1 -2
- package/dist/services/auth/auth.d.ts +7 -0
- package/dist/services/auth/auth.d.ts.map +1 -1
- package/dist/services/auth/auth.js +9 -0
- package/dist/services/auth/auth.js.map +1 -1
- package/dist/services/auth/profile/profile.js +1 -1
- package/dist/services/auth/profile/profile.schemas.d.ts +1 -0
- package/dist/services/auth/profile/profile.schemas.d.ts.map +1 -1
- package/dist/services/auth/profile/profile.schemas.js +2 -1
- package/dist/services/auth/profile/profile.schemas.js.map +1 -1
- package/dist/services/balances/balances.js +1 -1
- package/dist/services/balances/balances.schemas.js +1 -1
- package/dist/services/candles/candles.schemas.d.ts +10 -10
- package/dist/services/heatmap/heatmap.schemas.d.ts +9 -9
- package/dist/services/internal-transfers/internal-transfers.js +1 -1
- package/dist/services/market-overview/market-overview.js +1 -1
- package/dist/services/market-overview/market-overview.schemas.d.ts +3 -3
- package/dist/services/market-overview/market-overview.schemas.js +1 -1
- package/dist/services/orders/index.d.ts +1 -1
- package/dist/services/orders/order-errors.schemas.d.ts +1 -1
- package/dist/services/orders/orders-batch.schemas.d.ts +34 -34
- package/dist/services/orders/orders-batch.schemas.js +1 -1
- package/dist/services/orders/orders-input.schemas.d.ts +7 -7
- package/dist/services/orders/orders-input.schemas.js +2 -2
- package/dist/services/orders/orders-input.schemas.js.map +1 -1
- package/dist/services/orders/orders-output.schemas.d.ts +6 -6
- package/dist/services/orders/orders.d.ts +1 -1
- package/dist/services/orders/orders.d.ts.map +1 -1
- package/dist/services/orders/orders.js +5 -3
- package/dist/services/orders/orders.js.map +1 -1
- package/dist/services/orders/orders.schemas.d.ts +1 -1
- package/dist/services/orders/orders.types.d.ts +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.d.ts +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.js +1 -1
- package/dist/services/trading-withdraws/trading-withdraws.schemas.js +1 -1
- package/dist/services/transfers/transfers.js +1 -1
- package/dist/services/transfers/transfers.schemas.js +1 -1
- package/dist/services/triggers/trigger-child-order.schemas.js +25 -4
- package/dist/services/triggers/trigger-child-order.schemas.js.map +1 -1
- package/dist/services/triggers/trigger-input.schemas.d.ts +38 -2
- package/dist/services/triggers/trigger-input.schemas.d.ts.map +1 -1
- package/dist/services/triggers/trigger-input.schemas.js +3 -26
- package/dist/services/triggers/trigger-input.schemas.js.map +1 -1
- package/dist/services/triggers/triggers-output.schemas.d.ts +77 -2
- package/dist/services/triggers/triggers-output.schemas.d.ts.map +1 -1
- package/dist/services/triggers/triggers-output.schemas.js +36 -25
- package/dist/services/triggers/triggers-output.schemas.js.map +1 -1
- package/dist/shared/connect-error-mapping.d.ts.map +1 -1
- package/dist/shared/connect-error-mapping.js +50 -50
- package/dist/shared/connect-error-mapping.js.map +1 -1
- package/dist/shared/error-detail.d.ts +37 -0
- package/dist/shared/error-detail.d.ts.map +1 -0
- package/dist/shared/error-detail.js +106 -0
- package/dist/shared/error-detail.js.map +1 -0
- package/dist/shared/errors.d.ts +11 -6
- package/dist/shared/errors.d.ts.map +1 -1
- package/dist/shared/errors.js +3 -1
- package/dist/shared/errors.js.map +1 -1
- package/dist/utils/errors.d.ts.map +1 -1
- package/dist/utils/errors.js +1 -15
- package/dist/utils/errors.js.map +1 -1
- package/dist/wired-services.js +5 -5
- package/package.json +1 -1
- package/dist/utils/connect-order-errors.d.ts +0 -15
- package/dist/utils/connect-order-errors.d.ts.map +0 -1
- package/dist/utils/connect-order-errors.js +0 -41
- package/dist/utils/connect-order-errors.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -4,7 +4,6 @@ import { connectErrorToPolyesterError, createErrorMappingInterceptor, toPolyeste
|
|
|
4
4
|
import { checksumEvmAddress, evmHexToBytes, evmUtf8ToBytes, evmUtf8ToHex, isEvmAddress, isEvmAddressStrict, keccak256Hex } from "./utils/evm.js";
|
|
5
5
|
import { POLYESTER_TESTNET_ENVIRONMENT, createPolyesterEnvironment } from "./environment.js";
|
|
6
6
|
import { formatConnectError, formatUserFacingError, isPolicyInUseError, isPolicyLockedError, isPolicyScopeMismatchError, isResourceNotFoundError, isRetryableError, isRevisionConflictError } from "./utils/errors.js";
|
|
7
|
-
import { getOrderErrorDetail, isStaleQuoteError } from "./utils/connect-order-errors.js";
|
|
8
7
|
import { compareUnsignedIntegerStrings, shouldApplyReconciliationUpdate } from "./shared/reconciliation.js";
|
|
9
8
|
import { mergeLedgerBalances } from "./services/balances/balances.merge.js";
|
|
10
9
|
import { validateCreateAddressBookEntryInput } from "./services/address-book/address-book.schemas.js";
|
|
@@ -15,4 +14,4 @@ import { PolyesterBrowserClient } from "./browser-client.js";
|
|
|
15
14
|
import { PolyesterServerClient, createPolyesterServerClientFromCookies, createPolyesterServerClientFromRequest } from "./server-client.js";
|
|
16
15
|
import { isFreshStepUpRequiredError, isMfaEnrollmentRequiredError, isMfaLastFactorRequiredError, isSessionElevationRequiredError } from "./utils/connect-mfa-errors.js";
|
|
17
16
|
import { columnarTimestampSecAt, expandColumnarTimestampsSec } from "./utils/columnar-time.js";
|
|
18
|
-
export { AlreadyExistsError, AuthenticationError, ConfigurationError, InternalServerError, MfaEnrollmentRequiredError, MfaLastFactorRequiredError, MfaRequiredError, MfaVerificationError, NetworkError, POLYESTER_AUTH_TOKEN_COOKIE_NAME, POLYESTER_SESSION_COOKIE_NAME, POLYESTER_TESTNET_ENVIRONMENT, PermissionError, PolicyInUseError, PolicyLockedError, PolicyScopeMismatchError, PolyesterBrowserClient, PolyesterClient, PolyesterError, PolyesterServerClient, PreconditionFailedError, RateLimitError, RequestError, ResourceNotFoundError, RevisionConflictError, ServiceUnavailableError, SessionElevationRequiredError, StaleQuoteError, StepUpRequiredError, TimeoutError, TransientError, ValidationError, checksumEvmAddress, columnarTimestampSecAt, compareUnsignedIntegerStrings, connectErrorToPolyesterError, createCookieAuthTokenStorage, createErrorMappingInterceptor, createMemoryAuthTokenStorage, createPolyesterEnvironment, createPolyesterServerClientFromCookies, createPolyesterServerClientFromRequest, errorFromHttpStatus, evmHexToBytes, evmUtf8ToBytes, evmUtf8ToHex, expandColumnarTimestampsSec, formatConnectError, formatUserFacingError,
|
|
17
|
+
export { AlreadyExistsError, AuthenticationError, ConfigurationError, InternalServerError, MfaEnrollmentRequiredError, MfaLastFactorRequiredError, MfaRequiredError, MfaVerificationError, NetworkError, POLYESTER_AUTH_TOKEN_COOKIE_NAME, POLYESTER_SESSION_COOKIE_NAME, POLYESTER_TESTNET_ENVIRONMENT, PermissionError, PolicyInUseError, PolicyLockedError, PolicyScopeMismatchError, PolyesterBrowserClient, PolyesterClient, PolyesterError, PolyesterServerClient, PreconditionFailedError, RateLimitError, RequestError, ResourceNotFoundError, RevisionConflictError, ServiceUnavailableError, SessionElevationRequiredError, StaleQuoteError, StepUpRequiredError, TimeoutError, TransientError, ValidationError, checksumEvmAddress, columnarTimestampSecAt, compareUnsignedIntegerStrings, connectErrorToPolyesterError, createCookieAuthTokenStorage, createErrorMappingInterceptor, createMemoryAuthTokenStorage, createPolyesterEnvironment, createPolyesterServerClientFromCookies, createPolyesterServerClientFromRequest, errorFromHttpStatus, evmHexToBytes, evmUtf8ToBytes, evmUtf8ToHex, expandColumnarTimestampsSec, formatConnectError, formatUserFacingError, isAbortError, isEvmAddress, isEvmAddressStrict, isFreshStepUpRequiredError, isMfaEnrollmentRequiredError, isMfaLastFactorRequiredError, isPolicyInUseError, isPolicyLockedError, isPolicyScopeMismatchError, isResourceNotFoundError, isRetryableError, isRevisionConflictError, isSessionElevationRequiredError, keccak256Hex, mergeLedgerBalances, normalizeErrorMessage, shouldApplyReconciliationUpdate, tsObjToNsString as timestampToNanoseconds, toPolyesterError, validateCreateAddressBookEntryInput };
|
|
@@ -76,6 +76,13 @@ declare class AuthService {
|
|
|
76
76
|
* Returns the authenticated caller's account context, including account ID, optional API key ID, username, and session assurance details from the presented token or API key.
|
|
77
77
|
*/
|
|
78
78
|
me(options?: PolyesterRequestOptions): Promise<Me>;
|
|
79
|
+
/**
|
|
80
|
+
* Records explicit consent to the current terms for the caller's root account.
|
|
81
|
+
* Call only after the user consents. Requires an interactive JWT session;
|
|
82
|
+
* API keys are not allowed. Repeated acceptance succeeds without changing
|
|
83
|
+
* the first acceptance time. No MFA is required.
|
|
84
|
+
*/
|
|
85
|
+
acceptTerms(options?: PolyesterMutationOptions): Promise<void>;
|
|
79
86
|
/**
|
|
80
87
|
* Requests a short-lived nonce for the given smart-account EVM address.
|
|
81
88
|
* The nonce is single-purpose, replaced by subsequent requests, and expires
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","names":[],"sources":["../../../src/services/auth/auth.ts"],"mappings":";;;;;;;;cAmBa,4BAA0B,EAAA;;;;;;;;;KAU3B,uBAAuB,EAAE,kBAAkB;cAEjD,UAAQ,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;KAOF,KAAK,EAAE,mBAAmB;cAEhC,+BAA6B,EAAA;;;;;;;;;KAOvB,0BAA0B,EAAE,mBAAmB;cAErD,aAAW,EAAA;;;;;;;;;;KAKL,QAAQ,EAAE,mBAAmB;;;;cAK5B;;EAGT,SAAS;EAEG,YAAA,YAAY,4BAA4B,UAAU;;;;EASxD,GAAG,UAAU,0BAA0B,QAAQ;;;;;;;EAW/C,kBACF,6BACA,UAAU,0BACX,QAAQ;;;;YAaK,gBACZ,OAAO,sBACP,UAAU,2BACX,QAAQ"}
|
|
1
|
+
{"version":3,"file":"auth.d.ts","names":[],"sources":["../../../src/services/auth/auth.ts"],"mappings":";;;;;;;;cAmBa,4BAA0B,EAAA;;;;;;;;;KAU3B,uBAAuB,EAAE,kBAAkB;cAEjD,UAAQ,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;KAOF,KAAK,EAAE,mBAAmB;cAEhC,+BAA6B,EAAA;;;;;;;;;KAOvB,0BAA0B,EAAE,mBAAmB;cAErD,aAAW,EAAA;;;;;;;;;;KAKL,QAAQ,EAAE,mBAAmB;;;;cAK5B;;EAGT,SAAS;EAEG,YAAA,YAAY,4BAA4B,UAAU;;;;EASxD,GAAG,UAAU,0BAA0B,QAAQ;;;;;;;EAW/C,YAAY,UAAU,2BAA2B;;;;;;;EAUjD,kBACF,6BACA,UAAU,0BACX,QAAQ;;;;YAaK,gBACZ,OAAO,sBACP,UAAU,2BACX,QAAQ"}
|
|
@@ -52,6 +52,15 @@ var AuthService = class {
|
|
|
52
52
|
return parse(MeSchema, res);
|
|
53
53
|
}
|
|
54
54
|
/**
|
|
55
|
+
* Records explicit consent to the current terms for the caller's root account.
|
|
56
|
+
* Call only after the user consents. Requires an interactive JWT session;
|
|
57
|
+
* API keys are not allowed. Repeated acceptance succeeds without changing
|
|
58
|
+
* the first acceptance time. No MFA is required.
|
|
59
|
+
*/
|
|
60
|
+
async acceptTerms(options) {
|
|
61
|
+
await this.#authClient.acceptTerms({}, toConnectCallOptions(options));
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
55
64
|
* Requests a short-lived nonce for the given smart-account EVM address.
|
|
56
65
|
* The nonce is single-purpose, replaced by subsequent requests, and expires
|
|
57
66
|
* after about five minutes. The optional expiry is milliseconds since the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","names":["#publicClient","Proto.AuthService","#authClient"],"sources":["../../../src/services/auth/auth.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/auth/v1/auth_pb.js\";\nimport * as v from \"valibot\";\nimport { parse } from \"../../shared/validation.js\";\nimport { ProfileService } from \"./profile/profile.js\";\nimport {\n OptionalTimestampMsSchema,\n PublicIdSchema,\n TimestampSchema,\n} from \"../../shared/schemas.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport { MfaSessionInfoSchema } from \"../mfa/mfa.schemas.js\";\nimport type { PolyesterRealtime } from \"../../realtime/index.js\";\nimport type { AuthAndPublicApiTransports } from \"../../shared/transports.js\";\n\nexport const LoginWithWalletInputSchema = v.strictObject({\n smartAccountAddress: v.string(),\n nonce: v.string(),\n signature: v.string(),\n userAgent: v.optional(v.string(), \"\"),\n ip: v.optional(v.string(), \"\"),\n primaryWalletAddress: v.optional(v.string(), \"\"),\n walletProvider: v.optional(v.string(), \"\"),\n});\n\nexport type LoginWithWalletInput = v.InferInput<typeof LoginWithWalletInputSchema>;\n\nconst MeSchema = v.object({\n accountId: PublicIdSchema,\n apiKeyId: v.optional(v.string()),\n username: v.string(),\n session: v.optional(MfaSessionInfoSchema),\n});\n\nexport type Me = v.InferOutput<typeof MeSchema>;\n\nconst LoginWithWalletResponseSchema = v.object({\n accessToken: v.string(),\n expiresAt: v.optional(TimestampSchema),\n accountId: PublicIdSchema,\n username: v.string(),\n});\n\nexport type LoginWithWalletResponse = v.InferOutput<typeof LoginWithWalletResponseSchema>;\n\nconst NonceSchema = v.object({\n nonce: v.string(),\n expiresAt: OptionalTimestampMsSchema,\n});\n\nexport type Nonce = v.InferOutput<typeof NonceSchema>;\n\n/**\n * Handles wallet-based authentication, caller introspection, and authenticated profile operations.\n */\nexport class AuthService {\n #publicClient: Client<typeof Proto.AuthService>;\n #authClient: Client<typeof Proto.AuthService>;\n profile: ProfileService;\n\n constructor(transports: AuthAndPublicApiTransports, realtime: PolyesterRealtime) {\n this.#publicClient = createClient(Proto.AuthService, transports.publicApi);\n this.#authClient = createClient(Proto.AuthService, transports.authApi);\n this.profile = new ProfileService(transports, realtime);\n }\n\n /**\n * Returns the authenticated caller's account context, including account ID, optional API key ID, username, and session assurance details from the presented token or API key.\n */\n async me(options?: PolyesterRequestOptions): Promise<Me> {\n const res = await this.#authClient.me({}, toConnectCallOptions(options));\n return parse(MeSchema, res);\n }\n\n /**\n * Requests a short-lived nonce for the given smart-account EVM address.\n * The nonce is single-purpose, replaced by subsequent requests, and expires\n * after about five minutes. The optional expiry is milliseconds since the\n * Unix epoch.\n */\n async requestLoginNonce(\n smartAccountAddress: string,\n options?: PolyesterRequestOptions,\n ): Promise<Nonce> {\n return parse(\n NonceSchema,\n await this.#publicClient.getNonce(\n { smartAccountAddress },\n toConnectCallOptions(options),\n ),\n );\n }\n\n /**\n * Exchanges a signed login nonce for an authenticated session token and account identity returned by the auth API.\n */\n protected async loginWithWallet(\n input: LoginWithWalletInput,\n options?: PolyesterMutationOptions,\n ): Promise<LoginWithWalletResponse> {\n const validatedInput = parse(LoginWithWalletInputSchema, input);\n const res = await this.#publicClient.loginWithWallet(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(LoginWithWalletResponseSchema, res);\n }\n}\n"],"mappings":";;;;;;;;;AAmBA,MAAa,6BAA6B,EAAE,aAAa;CACrD,qBAAqB,EAAE,OAAO;CAC9B,OAAO,EAAE,OAAO;CAChB,WAAW,EAAE,OAAO;CACpB,WAAW,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CACpC,IAAI,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CAC7B,sBAAsB,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CAC/C,gBAAgB,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;AAC7C,CAAC;AAID,MAAM,WAAW,EAAE,OAAO;CACtB,WAAW;CACX,UAAU,EAAE,SAAS,EAAE,OAAO,CAAC;CAC/B,UAAU,EAAE,OAAO;CACnB,SAAS,EAAE,SAAS,oBAAoB;AAC5C,CAAC;AAID,MAAM,gCAAgC,EAAE,OAAO;CAC3C,aAAa,EAAE,OAAO;CACtB,WAAW,EAAE,SAAS,eAAe;CACrC,WAAW;CACX,UAAU,EAAE,OAAO;AACvB,CAAC;AAID,MAAM,cAAc,EAAE,OAAO;CACzB,OAAO,EAAE,OAAO;CAChB,WAAW;AACf,CAAC;;;;AAOD,IAAa,cAAb,MAAyB;CACrB;CACA;CACA;CAEA,YAAY,YAAwC,UAA6B;EAC7E,KAAKA,gBAAgB,aAAaC,eAAmB,WAAW,SAAS;EACzE,KAAKC,cAAc,aAAaD,eAAmB,WAAW,OAAO;EACrE,KAAK,UAAU,IAAI,eAAe,YAAY,QAAQ;CAC1D;;;;CAKA,MAAM,GAAG,SAAgD;EACrD,MAAM,MAAM,MAAM,KAAKC,YAAY,GAAG,CAAC,GAAG,qBAAqB,OAAO,CAAC;EACvE,OAAO,MAAM,UAAU,GAAG;CAC9B;;;;;;;CAQA,MAAM,kBACF,qBACA,SACc;EACd,OAAO,MACH,aACA,MAAM,KAAKF,cAAc,SACrB,EAAE,oBAAoB,GACtB,qBAAqB,OAAO,CAChC,CACJ;CACJ;;;;CAKA,MAAgB,gBACZ,OACA,SACgC;EAChC,MAAM,iBAAiB,MAAM,4BAA4B,KAAK;EAC9D,MAAM,MAAM,MAAM,KAAKA,cAAc,gBACjC,gBACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,+BAA+B,GAAG;CACnD;AACJ"}
|
|
1
|
+
{"version":3,"file":"auth.js","names":["#publicClient","Proto.AuthService","#authClient"],"sources":["../../../src/services/auth/auth.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/auth/v1/auth_pb.js\";\nimport * as v from \"valibot\";\nimport { parse } from \"../../shared/validation.js\";\nimport { ProfileService } from \"./profile/profile.js\";\nimport {\n OptionalTimestampMsSchema,\n PublicIdSchema,\n TimestampSchema,\n} from \"../../shared/schemas.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport { MfaSessionInfoSchema } from \"../mfa/mfa.schemas.js\";\nimport type { PolyesterRealtime } from \"../../realtime/index.js\";\nimport type { AuthAndPublicApiTransports } from \"../../shared/transports.js\";\n\nexport const LoginWithWalletInputSchema = v.strictObject({\n smartAccountAddress: v.string(),\n nonce: v.string(),\n signature: v.string(),\n userAgent: v.optional(v.string(), \"\"),\n ip: v.optional(v.string(), \"\"),\n primaryWalletAddress: v.optional(v.string(), \"\"),\n walletProvider: v.optional(v.string(), \"\"),\n});\n\nexport type LoginWithWalletInput = v.InferInput<typeof LoginWithWalletInputSchema>;\n\nconst MeSchema = v.object({\n accountId: PublicIdSchema,\n apiKeyId: v.optional(v.string()),\n username: v.string(),\n session: v.optional(MfaSessionInfoSchema),\n});\n\nexport type Me = v.InferOutput<typeof MeSchema>;\n\nconst LoginWithWalletResponseSchema = v.object({\n accessToken: v.string(),\n expiresAt: v.optional(TimestampSchema),\n accountId: PublicIdSchema,\n username: v.string(),\n});\n\nexport type LoginWithWalletResponse = v.InferOutput<typeof LoginWithWalletResponseSchema>;\n\nconst NonceSchema = v.object({\n nonce: v.string(),\n expiresAt: OptionalTimestampMsSchema,\n});\n\nexport type Nonce = v.InferOutput<typeof NonceSchema>;\n\n/**\n * Handles wallet-based authentication, caller introspection, and authenticated profile operations.\n */\nexport class AuthService {\n #publicClient: Client<typeof Proto.AuthService>;\n #authClient: Client<typeof Proto.AuthService>;\n profile: ProfileService;\n\n constructor(transports: AuthAndPublicApiTransports, realtime: PolyesterRealtime) {\n this.#publicClient = createClient(Proto.AuthService, transports.publicApi);\n this.#authClient = createClient(Proto.AuthService, transports.authApi);\n this.profile = new ProfileService(transports, realtime);\n }\n\n /**\n * Returns the authenticated caller's account context, including account ID, optional API key ID, username, and session assurance details from the presented token or API key.\n */\n async me(options?: PolyesterRequestOptions): Promise<Me> {\n const res = await this.#authClient.me({}, toConnectCallOptions(options));\n return parse(MeSchema, res);\n }\n\n /**\n * Records explicit consent to the current terms for the caller's root account.\n * Call only after the user consents. Requires an interactive JWT session;\n * API keys are not allowed. Repeated acceptance succeeds without changing\n * the first acceptance time. No MFA is required.\n */\n async acceptTerms(options?: PolyesterMutationOptions): Promise<void> {\n await this.#authClient.acceptTerms({}, toConnectCallOptions(options));\n }\n\n /**\n * Requests a short-lived nonce for the given smart-account EVM address.\n * The nonce is single-purpose, replaced by subsequent requests, and expires\n * after about five minutes. The optional expiry is milliseconds since the\n * Unix epoch.\n */\n async requestLoginNonce(\n smartAccountAddress: string,\n options?: PolyesterRequestOptions,\n ): Promise<Nonce> {\n return parse(\n NonceSchema,\n await this.#publicClient.getNonce(\n { smartAccountAddress },\n toConnectCallOptions(options),\n ),\n );\n }\n\n /**\n * Exchanges a signed login nonce for an authenticated session token and account identity returned by the auth API.\n */\n protected async loginWithWallet(\n input: LoginWithWalletInput,\n options?: PolyesterMutationOptions,\n ): Promise<LoginWithWalletResponse> {\n const validatedInput = parse(LoginWithWalletInputSchema, input);\n const res = await this.#publicClient.loginWithWallet(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(LoginWithWalletResponseSchema, res);\n }\n}\n"],"mappings":";;;;;;;;;AAmBA,MAAa,6BAA6B,EAAE,aAAa;CACrD,qBAAqB,EAAE,OAAO;CAC9B,OAAO,EAAE,OAAO;CAChB,WAAW,EAAE,OAAO;CACpB,WAAW,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CACpC,IAAI,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CAC7B,sBAAsB,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CAC/C,gBAAgB,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;AAC7C,CAAC;AAID,MAAM,WAAW,EAAE,OAAO;CACtB,WAAW;CACX,UAAU,EAAE,SAAS,EAAE,OAAO,CAAC;CAC/B,UAAU,EAAE,OAAO;CACnB,SAAS,EAAE,SAAS,oBAAoB;AAC5C,CAAC;AAID,MAAM,gCAAgC,EAAE,OAAO;CAC3C,aAAa,EAAE,OAAO;CACtB,WAAW,EAAE,SAAS,eAAe;CACrC,WAAW;CACX,UAAU,EAAE,OAAO;AACvB,CAAC;AAID,MAAM,cAAc,EAAE,OAAO;CACzB,OAAO,EAAE,OAAO;CAChB,WAAW;AACf,CAAC;;;;AAOD,IAAa,cAAb,MAAyB;CACrB;CACA;CACA;CAEA,YAAY,YAAwC,UAA6B;EAC7E,KAAKA,gBAAgB,aAAaC,eAAmB,WAAW,SAAS;EACzE,KAAKC,cAAc,aAAaD,eAAmB,WAAW,OAAO;EACrE,KAAK,UAAU,IAAI,eAAe,YAAY,QAAQ;CAC1D;;;;CAKA,MAAM,GAAG,SAAgD;EACrD,MAAM,MAAM,MAAM,KAAKC,YAAY,GAAG,CAAC,GAAG,qBAAqB,OAAO,CAAC;EACvE,OAAO,MAAM,UAAU,GAAG;CAC9B;;;;;;;CAQA,MAAM,YAAY,SAAmD;EACjE,MAAM,KAAKA,YAAY,YAAY,CAAC,GAAG,qBAAqB,OAAO,CAAC;CACxE;;;;;;;CAQA,MAAM,kBACF,qBACA,SACc;EACd,OAAO,MACH,aACA,MAAM,KAAKF,cAAc,SACrB,EAAE,oBAAoB,GACtB,qBAAqB,OAAO,CAChC,CACJ;CACJ;;;;CAKA,MAAgB,gBACZ,OACA,SACgC;EAChC,MAAM,iBAAiB,MAAM,4BAA4B,KAAK;EAC9D,MAAM,MAAM,MAAM,KAAKA,cAAc,gBACjC,gBACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,+BAA+B,GAAG;CACnD;AACJ"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { AccountIdentitySchema, ProfileService as ProfileService$1 } from "../../../gen/auth/v1/profile_pb.js";
|
|
1
2
|
import { parse } from "../../../shared/validation.js";
|
|
2
3
|
import { toConnectCallOptions } from "../../../shared/request-options.js";
|
|
3
4
|
import { removeUndefined } from "../../../utils/remove-undefined.js";
|
|
4
|
-
import { AccountIdentitySchema, ProfileService as ProfileService$1 } from "../../../gen/auth/v1/profile_pb.js";
|
|
5
5
|
import { AccountIdentitySchema as AccountIdentitySchema$1, ClaimGeneratedUsernameInputSchema, GeneratedUsernameOfferSchema, ProfileSchema, UpdateProfileInputSchema, UsernameHistoryEntrySchema } from "./profile.schemas.js";
|
|
6
6
|
import { createClient } from "@connectrpc/connect";
|
|
7
7
|
import * as v from "valibot";
|
|
@@ -25,6 +25,7 @@ declare const ProfileSchema: v.ObjectSchema<{
|
|
|
25
25
|
} | undefined, number | undefined>]>;
|
|
26
26
|
readonly vipTier: v.NumberSchema<undefined>;
|
|
27
27
|
readonly usernameUnlocked: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
28
|
+
readonly currentTermsAccepted: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
28
29
|
}, undefined>;
|
|
29
30
|
type Profile = v.InferOutput<typeof ProfileSchema>;
|
|
30
31
|
declare const UpdateProfileInputSchema: v.ObjectSchema<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.schemas.d.ts","names":[],"sources":["../../../../src/services/auth/profile/profile.schemas.ts"],"mappings":";;cASa,eAAa,EAAA
|
|
1
|
+
{"version":3,"file":"profile.schemas.d.ts","names":[],"sources":["../../../../src/services/auth/profile/profile.schemas.ts"],"mappings":";;cASa,eAAa,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;KAsBd,UAAU,EAAE,mBAAmB;cAG9B,0BAAwB,EAAA;;;;;;;KAOzB,qBAAqB,EAAE,kBAAkB;cAExC,4BAA0B,EAAA;;;;;;;;;;KAQ3B,uBAAuB,EAAE,mBAAmB;cAE3C,8BAA4B,EAAA;;;;;;;;;;;KAM7B,yBAAyB,EAAE,mBAAmB;cAE7C,mCAAiC,EAAA;;;;KAKlC,8BAA8B,EAAE,kBAAkB;cAEjD,uBAAqB,EAAA;;;;;;KAOtB,kBAAkB,EAAE,mBAAmB"}
|
|
@@ -15,7 +15,8 @@ const ProfileSchema = v.object({
|
|
|
15
15
|
createdAt: v.pipe(v.optional(TimestampSchema), v.transform((v) => v ? tsObjToMs(v) : void 0)),
|
|
16
16
|
nextUsernameChangeAt: v.pipe(v.optional(TimestampSchema), v.transform((v) => v ? tsObjToMs(v) : void 0)),
|
|
17
17
|
vipTier: v.number(),
|
|
18
|
-
usernameUnlocked: v.optional(v.boolean(), false)
|
|
18
|
+
usernameUnlocked: v.optional(v.boolean(), false),
|
|
19
|
+
currentTermsAccepted: v.optional(v.boolean(), false)
|
|
19
20
|
});
|
|
20
21
|
const UpdateProfileInputSchema = v.object({
|
|
21
22
|
username: v.optional(v.string()),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.schemas.js","names":[],"sources":["../../../../src/services/auth/profile/profile.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport {\n OptionalTimestampMsSchema,\n PublicIdSchema,\n TimestampSchema,\n} from \"../../../shared/schemas.js\";\nimport { PROTOBUF_UINT32_MAX } from \"../../../shared/wire-bounds.js\";\nimport { tsObjToMs } from \"../../../utils/time.js\";\n\nexport const ProfileSchema = v.object({\n username: v.string(),\n bio: v.string(),\n website: v.string(),\n twitter: v.string(),\n twitterVerified: v.optional(v.boolean(), false),\n discord: v.string(),\n discordVerified: v.optional(v.boolean(), false),\n avatarUrl: v.string(),\n createdAt: v.pipe(\n v.optional(TimestampSchema),\n v.transform((v) => (v ? tsObjToMs(v) : undefined)),\n ),\n nextUsernameChangeAt: v.pipe(\n v.optional(TimestampSchema),\n v.transform((v) => (v ? tsObjToMs(v) : undefined)),\n ),\n vipTier: v.number(),\n usernameUnlocked: v.optional(v.boolean(), false),\n});\n\nexport type Profile = v.InferOutput<typeof ProfileSchema>;\n// Deliberately non-strict: update() accepts a round-tripped Profile\n// ({ ...profile, bio }) and strips its readonly fields instead of rejecting.\nexport const UpdateProfileInputSchema = v.object({\n username: v.optional(v.string()),\n bio: v.optional(v.string()),\n website: v.optional(v.string()),\n twitter: v.optional(v.string()),\n avatarUrl: v.optional(v.string()),\n});\nexport type UpdateProfileInput = v.InferInput<typeof UpdateProfileInputSchema>;\n\nexport const UsernameHistoryEntrySchema = v.object({\n username: v.string(),\n setAt: v.pipe(\n v.optional(TimestampSchema),\n v.transform((v) => (v ? tsObjToMs(v) : undefined)),\n ),\n});\n\nexport type UsernameHistoryEntry = v.InferOutput<typeof UsernameHistoryEntrySchema>;\n\nexport const GeneratedUsernameOfferSchema = v.object({\n usernames: v.array(v.string()),\n offerToken: v.pipe(v.string(), v.minLength(1)),\n expiresAt: OptionalTimestampMsSchema,\n});\n\nexport type GeneratedUsernameOffer = v.InferOutput<typeof GeneratedUsernameOfferSchema>;\n\nexport const ClaimGeneratedUsernameInputSchema = v.strictObject({\n offerToken: v.pipe(v.string(), v.minLength(1)),\n optionIndex: v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(PROTOBUF_UINT32_MAX)),\n});\n\nexport type ClaimGeneratedUsernameInput = v.InferInput<typeof ClaimGeneratedUsernameInputSchema>;\n\nexport const AccountIdentitySchema = v.object({\n accountId: PublicIdSchema,\n username: v.optional(v.string()),\n avatarUrl: v.optional(v.string()),\n rootSmartAccountAddress: v.string(),\n});\n\nexport type AccountIdentity = v.InferOutput<typeof AccountIdentitySchema>;\n"],"mappings":";;;;;AASA,MAAa,gBAAgB,EAAE,OAAO;CAClC,UAAU,EAAE,OAAO;CACnB,KAAK,EAAE,OAAO;CACd,SAAS,EAAE,OAAO;CAClB,SAAS,EAAE,OAAO;CAClB,iBAAiB,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;CAC9C,SAAS,EAAE,OAAO;CAClB,iBAAiB,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;CAC9C,WAAW,EAAE,OAAO;CACpB,WAAW,EAAE,KACT,EAAE,SAAS,eAAe,GAC1B,EAAE,WAAW,MAAO,IAAI,UAAU,CAAC,IAAI,KAAA,CAAU,CACrD;CACA,sBAAsB,EAAE,KACpB,EAAE,SAAS,eAAe,GAC1B,EAAE,WAAW,MAAO,IAAI,UAAU,CAAC,IAAI,KAAA,CAAU,CACrD;CACA,SAAS,EAAE,OAAO;CAClB,kBAAkB,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;
|
|
1
|
+
{"version":3,"file":"profile.schemas.js","names":[],"sources":["../../../../src/services/auth/profile/profile.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport {\n OptionalTimestampMsSchema,\n PublicIdSchema,\n TimestampSchema,\n} from \"../../../shared/schemas.js\";\nimport { PROTOBUF_UINT32_MAX } from \"../../../shared/wire-bounds.js\";\nimport { tsObjToMs } from \"../../../utils/time.js\";\n\nexport const ProfileSchema = v.object({\n username: v.string(),\n bio: v.string(),\n website: v.string(),\n twitter: v.string(),\n twitterVerified: v.optional(v.boolean(), false),\n discord: v.string(),\n discordVerified: v.optional(v.boolean(), false),\n avatarUrl: v.string(),\n createdAt: v.pipe(\n v.optional(TimestampSchema),\n v.transform((v) => (v ? tsObjToMs(v) : undefined)),\n ),\n nextUsernameChangeAt: v.pipe(\n v.optional(TimestampSchema),\n v.transform((v) => (v ? tsObjToMs(v) : undefined)),\n ),\n vipTier: v.number(),\n usernameUnlocked: v.optional(v.boolean(), false),\n currentTermsAccepted: v.optional(v.boolean(), false),\n});\n\nexport type Profile = v.InferOutput<typeof ProfileSchema>;\n// Deliberately non-strict: update() accepts a round-tripped Profile\n// ({ ...profile, bio }) and strips its readonly fields instead of rejecting.\nexport const UpdateProfileInputSchema = v.object({\n username: v.optional(v.string()),\n bio: v.optional(v.string()),\n website: v.optional(v.string()),\n twitter: v.optional(v.string()),\n avatarUrl: v.optional(v.string()),\n});\nexport type UpdateProfileInput = v.InferInput<typeof UpdateProfileInputSchema>;\n\nexport const UsernameHistoryEntrySchema = v.object({\n username: v.string(),\n setAt: v.pipe(\n v.optional(TimestampSchema),\n v.transform((v) => (v ? tsObjToMs(v) : undefined)),\n ),\n});\n\nexport type UsernameHistoryEntry = v.InferOutput<typeof UsernameHistoryEntrySchema>;\n\nexport const GeneratedUsernameOfferSchema = v.object({\n usernames: v.array(v.string()),\n offerToken: v.pipe(v.string(), v.minLength(1)),\n expiresAt: OptionalTimestampMsSchema,\n});\n\nexport type GeneratedUsernameOffer = v.InferOutput<typeof GeneratedUsernameOfferSchema>;\n\nexport const ClaimGeneratedUsernameInputSchema = v.strictObject({\n offerToken: v.pipe(v.string(), v.minLength(1)),\n optionIndex: v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(PROTOBUF_UINT32_MAX)),\n});\n\nexport type ClaimGeneratedUsernameInput = v.InferInput<typeof ClaimGeneratedUsernameInputSchema>;\n\nexport const AccountIdentitySchema = v.object({\n accountId: PublicIdSchema,\n username: v.optional(v.string()),\n avatarUrl: v.optional(v.string()),\n rootSmartAccountAddress: v.string(),\n});\n\nexport type AccountIdentity = v.InferOutput<typeof AccountIdentitySchema>;\n"],"mappings":";;;;;AASA,MAAa,gBAAgB,EAAE,OAAO;CAClC,UAAU,EAAE,OAAO;CACnB,KAAK,EAAE,OAAO;CACd,SAAS,EAAE,OAAO;CAClB,SAAS,EAAE,OAAO;CAClB,iBAAiB,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;CAC9C,SAAS,EAAE,OAAO;CAClB,iBAAiB,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;CAC9C,WAAW,EAAE,OAAO;CACpB,WAAW,EAAE,KACT,EAAE,SAAS,eAAe,GAC1B,EAAE,WAAW,MAAO,IAAI,UAAU,CAAC,IAAI,KAAA,CAAU,CACrD;CACA,sBAAsB,EAAE,KACpB,EAAE,SAAS,eAAe,GAC1B,EAAE,WAAW,MAAO,IAAI,UAAU,CAAC,IAAI,KAAA,CAAU,CACrD;CACA,SAAS,EAAE,OAAO;CAClB,kBAAkB,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;CAC/C,sBAAsB,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;AACvD,CAAC;AAKD,MAAa,2BAA2B,EAAE,OAAO;CAC7C,UAAU,EAAE,SAAS,EAAE,OAAO,CAAC;CAC/B,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC;CAC1B,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC;CAC9B,SAAS,EAAE,SAAS,EAAE,OAAO,CAAC;CAC9B,WAAW,EAAE,SAAS,EAAE,OAAO,CAAC;AACpC,CAAC;AAGD,MAAa,6BAA6B,EAAE,OAAO;CAC/C,UAAU,EAAE,OAAO;CACnB,OAAO,EAAE,KACL,EAAE,SAAS,eAAe,GAC1B,EAAE,WAAW,MAAO,IAAI,UAAU,CAAC,IAAI,KAAA,CAAU,CACrD;AACJ,CAAC;AAID,MAAa,+BAA+B,EAAE,OAAO;CACjD,WAAW,EAAE,MAAM,EAAE,OAAO,CAAC;CAC7B,YAAY,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,UAAU,CAAC,CAAC;CAC7C,WAAW;AACf,CAAC;AAID,MAAa,oCAAoC,EAAE,aAAa;CAC5D,YAAY,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,UAAU,CAAC,CAAC;CAC7C,aAAa,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,QAAQ,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,SAAS,mBAAmB,CAAC;AAC/F,CAAC;AAID,MAAa,wBAAwB,EAAE,OAAO;CAC1C,WAAW;CACX,UAAU,EAAE,SAAS,EAAE,OAAO,CAAC;CAC/B,WAAW,EAAE,SAAS,EAAE,OAAO,CAAC;CAChC,yBAAyB,EAAE,OAAO;AACtC,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { AssetBalanceSchema, LedgerReadService } from "../../gen/ledger/read/v1/ledger_read_pb.js";
|
|
1
2
|
import { parse } from "../../shared/validation.js";
|
|
2
3
|
import { toConnectCallOptions } from "../../shared/request-options.js";
|
|
3
4
|
import { resolveAccountScopedInput } from "../subaccount-resolver.js";
|
|
4
5
|
import { accountScopeToSubaccountId } from "../../shared/account-scope.js";
|
|
5
|
-
import { AssetBalanceSchema, LedgerReadService } from "../../gen/ledger/read/v1/ledger_read_pb.js";
|
|
6
6
|
import { connectReadyGatedProtoChannel } from "../../realtime/ready-gated-subscription.js";
|
|
7
7
|
import { BalanceHistoryInputSchema, BalancesListInputSchema, EquityHistoryInputSchema, PortfolioEquityHistoryInputSchema, createBalanceHistoryResponseSchema, createEquityHistoryResponseSchema, createLedgerBalanceSchema, createPortfolioEquityHistoryResponseSchema, createPortfolioEquitySnapshotResponseSchema } from "./balances.schemas.js";
|
|
8
8
|
import { createClient } from "@connectrpc/connect";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { BalanceRange } from "../../gen/ledger/read/v1/ledger_read_pb.js";
|
|
1
2
|
import { requiredEnumLabel } from "../../shared/proto-enum-codec.js";
|
|
2
3
|
import { PublicIdSchema } from "../../shared/schemas.js";
|
|
3
4
|
import { AccountScopeInputEntries, accountScopeToSubaccountId } from "../../shared/account-scope.js";
|
|
4
|
-
import { BalanceRange } from "../../gen/ledger/read/v1/ledger_read_pb.js";
|
|
5
5
|
import { scaledToDecimalOutput } from "../../shared/decimal-surface.js";
|
|
6
6
|
import { fromU128 } from "../../utils/u128.js";
|
|
7
7
|
import { ACCOUNT_CODE_VALUES, AccountCodeCodec } from "../../shared/ledger-codes.js";
|
|
@@ -11,7 +11,7 @@ type TimestampInit = {
|
|
|
11
11
|
};
|
|
12
12
|
declare function createCandleRowSchema(scales: SdkScales): v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
13
13
|
readonly symbolId: v.NumberSchema<undefined>;
|
|
14
|
-
readonly timeframe: v.SchemaWithPipe<readonly [v.EnumSchema<typeof Timeframe$1, undefined>, v.TransformAction<Timeframe$1, DecodedEnum<"1d" | "
|
|
14
|
+
readonly timeframe: v.SchemaWithPipe<readonly [v.EnumSchema<typeof Timeframe$1, undefined>, v.TransformAction<Timeframe$1, DecodedEnum<"1d" | "1h" | "1w" | "1m" | "1s" | "5m" | "15m" | "30m" | "4h" | "12h" | "1mo">>]>;
|
|
15
15
|
readonly tsSec: v.BigintSchema<undefined>;
|
|
16
16
|
readonly open: v.BigintSchema<undefined>;
|
|
17
17
|
readonly high: v.BigintSchema<undefined>;
|
|
@@ -21,7 +21,7 @@ declare function createCandleRowSchema(scales: SdkScales): v.SchemaWithPipe<read
|
|
|
21
21
|
readonly isClosed: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
22
22
|
}, undefined>, v.TransformAction<{
|
|
23
23
|
symbolId: number;
|
|
24
|
-
timeframe: DecodedEnum<"1d" | "
|
|
24
|
+
timeframe: DecodedEnum<"1d" | "1h" | "1w" | "1m" | "1s" | "5m" | "15m" | "30m" | "4h" | "12h" | "1mo">;
|
|
25
25
|
tsSec: bigint;
|
|
26
26
|
open: bigint;
|
|
27
27
|
high: bigint;
|
|
@@ -31,7 +31,7 @@ declare function createCandleRowSchema(scales: SdkScales): v.SchemaWithPipe<read
|
|
|
31
31
|
isClosed: boolean;
|
|
32
32
|
}, {
|
|
33
33
|
symbolId: number;
|
|
34
|
-
timeframe: DecodedEnum<"1d" | "
|
|
34
|
+
timeframe: DecodedEnum<"1d" | "1h" | "1w" | "1m" | "1s" | "5m" | "15m" | "30m" | "4h" | "12h" | "1mo">;
|
|
35
35
|
time: number;
|
|
36
36
|
open: string;
|
|
37
37
|
high: string;
|
|
@@ -43,7 +43,7 @@ declare function createCandleRowSchema(scales: SdkScales): v.SchemaWithPipe<read
|
|
|
43
43
|
declare const createCandleRowIntSchema: typeof createCandleRowSchema;
|
|
44
44
|
declare function createCandleColumnarSchema(scales: SdkScales): v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
45
45
|
readonly symbolId: v.NumberSchema<undefined>;
|
|
46
|
-
readonly timeframe: v.SchemaWithPipe<readonly [v.EnumSchema<typeof Timeframe$1, undefined>, v.TransformAction<Timeframe$1, DecodedEnum<"1d" | "
|
|
46
|
+
readonly timeframe: v.SchemaWithPipe<readonly [v.EnumSchema<typeof Timeframe$1, undefined>, v.TransformAction<Timeframe$1, DecodedEnum<"1d" | "1h" | "1w" | "1m" | "1s" | "5m" | "15m" | "30m" | "4h" | "12h" | "1mo">>]>;
|
|
47
47
|
readonly tsSec: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
|
|
48
48
|
readonly open: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
|
|
49
49
|
readonly high: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
|
|
@@ -59,7 +59,7 @@ declare function createCandleColumnarSchema(scales: SdkScales): v.SchemaWithPipe
|
|
|
59
59
|
readonly nextPageToken: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
60
60
|
}, undefined>, v.TransformAction<{
|
|
61
61
|
symbolId: number;
|
|
62
|
-
timeframe: DecodedEnum<"1d" | "
|
|
62
|
+
timeframe: DecodedEnum<"1d" | "1h" | "1w" | "1m" | "1s" | "5m" | "15m" | "30m" | "4h" | "12h" | "1mo">;
|
|
63
63
|
tsSec: bigint[];
|
|
64
64
|
open: bigint[];
|
|
65
65
|
high: bigint[];
|
|
@@ -75,7 +75,7 @@ declare function createCandleColumnarSchema(scales: SdkScales): v.SchemaWithPipe
|
|
|
75
75
|
nextPageToken: string;
|
|
76
76
|
}, {
|
|
77
77
|
symbolId: number;
|
|
78
|
-
timeframe: DecodedEnum<"1d" | "
|
|
78
|
+
timeframe: DecodedEnum<"1d" | "1h" | "1w" | "1m" | "1s" | "5m" | "15m" | "30m" | "4h" | "12h" | "1mo">;
|
|
79
79
|
time: number[];
|
|
80
80
|
open: string[];
|
|
81
81
|
high: string[];
|
|
@@ -94,7 +94,7 @@ declare function createCandleColumnarSchema(scales: SdkScales): v.SchemaWithPipe
|
|
|
94
94
|
}>]>;
|
|
95
95
|
declare function createCandleColumnarIntSchema(scales: SdkScales): v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
96
96
|
readonly symbolId: v.NumberSchema<undefined>;
|
|
97
|
-
readonly timeframe: v.SchemaWithPipe<readonly [v.EnumSchema<typeof Timeframe$1, undefined>, v.TransformAction<Timeframe$1, DecodedEnum<"1d" | "
|
|
97
|
+
readonly timeframe: v.SchemaWithPipe<readonly [v.EnumSchema<typeof Timeframe$1, undefined>, v.TransformAction<Timeframe$1, DecodedEnum<"1d" | "1h" | "1w" | "1m" | "1s" | "5m" | "15m" | "30m" | "4h" | "12h" | "1mo">>]>;
|
|
98
98
|
readonly tsSec: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
|
|
99
99
|
readonly open: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
|
|
100
100
|
readonly high: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
|
|
@@ -110,7 +110,7 @@ declare function createCandleColumnarIntSchema(scales: SdkScales): v.SchemaWithP
|
|
|
110
110
|
readonly nextPageToken: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
111
111
|
}, undefined>, v.TransformAction<{
|
|
112
112
|
symbolId: number;
|
|
113
|
-
timeframe: DecodedEnum<"1d" | "
|
|
113
|
+
timeframe: DecodedEnum<"1d" | "1h" | "1w" | "1m" | "1s" | "5m" | "15m" | "30m" | "4h" | "12h" | "1mo">;
|
|
114
114
|
tsSec: bigint[];
|
|
115
115
|
open: bigint[];
|
|
116
116
|
high: bigint[];
|
|
@@ -126,7 +126,7 @@ declare function createCandleColumnarIntSchema(scales: SdkScales): v.SchemaWithP
|
|
|
126
126
|
nextPageToken: string;
|
|
127
127
|
}, {
|
|
128
128
|
symbolId: number;
|
|
129
|
-
timeframe: DecodedEnum<"1d" | "
|
|
129
|
+
timeframe: DecodedEnum<"1d" | "1h" | "1w" | "1m" | "1s" | "5m" | "15m" | "30m" | "4h" | "12h" | "1mo">;
|
|
130
130
|
tsSec: number[];
|
|
131
131
|
open: string[];
|
|
132
132
|
high: string[];
|
|
@@ -149,7 +149,7 @@ type CandleColumnar = v.InferOutput<ReturnType<typeof createCandleColumnarSchema
|
|
|
149
149
|
type CandleColumnarInt = v.InferOutput<ReturnType<typeof createCandleColumnarIntSchema>>;
|
|
150
150
|
declare function createListCandlesInputSchema(): v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
151
151
|
readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
|
|
152
|
-
readonly timeframe: v.SchemaWithPipe<readonly [v.PicklistSchema<readonly ["1s", "1m", "5m", "15m", "30m", "1h", "4h", "12h", "1d", "1w", "1mo"], undefined>, v.TransformAction<"1d" | "
|
|
152
|
+
readonly timeframe: v.SchemaWithPipe<readonly [v.PicklistSchema<readonly ["1s", "1m", "5m", "15m", "30m", "1h", "4h", "12h", "1d", "1w", "1mo"], undefined>, v.TransformAction<"1d" | "1h" | "1w" | "1m" | "1s" | "5m" | "15m" | "30m" | "4h" | "12h" | "1mo", Timeframe$1.SEC_1 | Timeframe$1.MIN_1 | Timeframe$1.MIN_5 | Timeframe$1.MIN_15 | Timeframe$1.MIN_30 | Timeframe$1.HOUR_1 | Timeframe$1.HOUR_4 | Timeframe$1.DAY_1 | Timeframe$1.HOUR_12 | Timeframe$1.WEEK_1 | Timeframe$1.MONTH_1>]>;
|
|
153
153
|
readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 10000, undefined>]>, undefined>;
|
|
154
154
|
readonly includeIncomplete: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
155
155
|
readonly includeReference: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
@@ -13,7 +13,7 @@ type TimestampInit = {
|
|
|
13
13
|
};
|
|
14
14
|
declare const GetOrderbookHeatmapInputSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
15
15
|
readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
|
|
16
|
-
readonly interval: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["1s", "1m", "5m", "1h"], undefined>, "1s">, v.TransformAction<"
|
|
16
|
+
readonly interval: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["1s", "1m", "5m", "1h"], undefined>, "1s">, v.TransformAction<"1h" | "1m" | "1s" | "5m", HeatmapInterval>]>;
|
|
17
17
|
readonly depth: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly [1, 5, 10, 20, 50, 100, 200, 500, 1000], undefined>, 50>, v.TransformAction<5 | 10 | 20 | 1 | 200 | 1000 | 500 | 100 | 50, HeatmapDepth>]>;
|
|
18
18
|
readonly quantityMode: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["close", "peak"], undefined>, "close">, v.TransformAction<"close" | "peak", HeatmapQuantityMode>]>;
|
|
19
19
|
readonly limit: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 20000, undefined>]>;
|
|
@@ -122,7 +122,7 @@ declare function convertHeatmapDeltaBucket(bucket: OrderbookHeatmapDeltaBucketRa
|
|
|
122
122
|
type OrderbookHeatmapDeltaBucket = ReturnType<typeof convertHeatmapDeltaBucket>;
|
|
123
123
|
declare const OrderbookHeatmapLiveBucketRawSchema: v.ObjectSchema<{
|
|
124
124
|
readonly symbolId: v.NumberSchema<undefined>;
|
|
125
|
-
readonly interval: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"
|
|
125
|
+
readonly interval: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"1h" | "1m" | "1s" | "5m">>]>;
|
|
126
126
|
readonly tsSec: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, number>]>;
|
|
127
127
|
readonly isFinal: v.BooleanSchema<undefined>;
|
|
128
128
|
readonly bids: v.OptionalSchema<v.ObjectSchema<{
|
|
@@ -142,7 +142,7 @@ declare const OrderbookHeatmapLiveBucketRawSchema: v.ObjectSchema<{
|
|
|
142
142
|
type OrderbookHeatmapLiveBucketRaw = v.InferOutput<typeof OrderbookHeatmapLiveBucketRawSchema>;
|
|
143
143
|
declare function convertHeatmapLiveBucket(bucket: OrderbookHeatmapLiveBucketRaw, scales: SdkScales): {
|
|
144
144
|
symbolId: number;
|
|
145
|
-
interval: DecodedEnum<"
|
|
145
|
+
interval: DecodedEnum<"1h" | "1m" | "1s" | "5m">;
|
|
146
146
|
tsSec: number;
|
|
147
147
|
isFinal: boolean;
|
|
148
148
|
bids: {
|
|
@@ -226,7 +226,7 @@ declare function convertHeatmapDeltaChain(chain: OrderbookHeatmapDeltaChainRaw,
|
|
|
226
226
|
type OrderbookHeatmapDeltaChain = ReturnType<typeof convertHeatmapDeltaChain>;
|
|
227
227
|
declare function createOrderbookHeatmapResponseSchema(scales: SdkScales): v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
228
228
|
readonly symbolId: v.NumberSchema<undefined>;
|
|
229
|
-
readonly interval: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"
|
|
229
|
+
readonly interval: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"1h" | "1m" | "1s" | "5m">>]>;
|
|
230
230
|
readonly depth: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, 5 | 10 | 20 | 1 | "unspecified" | 200 | 1000 | 500 | 100 | 50>]>;
|
|
231
231
|
readonly chain: v.OptionalSchema<v.ObjectSchema<{
|
|
232
232
|
readonly baseKeyframe: v.OptionalSchema<v.ObjectSchema<{
|
|
@@ -267,7 +267,7 @@ declare function createOrderbookHeatmapResponseSchema(scales: SdkScales): v.Sche
|
|
|
267
267
|
readonly quantityMode: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"close" | "peak">>]>;
|
|
268
268
|
readonly liveBucket: v.OptionalSchema<v.ObjectSchema<{
|
|
269
269
|
readonly symbolId: v.NumberSchema<undefined>;
|
|
270
|
-
readonly interval: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"
|
|
270
|
+
readonly interval: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"1h" | "1m" | "1s" | "5m">>]>;
|
|
271
271
|
readonly tsSec: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, number>]>;
|
|
272
272
|
readonly isFinal: v.BooleanSchema<undefined>;
|
|
273
273
|
readonly bids: v.OptionalSchema<v.ObjectSchema<{
|
|
@@ -286,7 +286,7 @@ declare function createOrderbookHeatmapResponseSchema(scales: SdkScales): v.Sche
|
|
|
286
286
|
}, undefined>, undefined>;
|
|
287
287
|
}, undefined>, v.TransformAction<{
|
|
288
288
|
symbolId: number;
|
|
289
|
-
interval: DecodedEnum<"
|
|
289
|
+
interval: DecodedEnum<"1h" | "1m" | "1s" | "5m">;
|
|
290
290
|
depth: 5 | 10 | 20 | 1 | "unspecified" | 200 | 1000 | 500 | 100 | 50;
|
|
291
291
|
chain?: {
|
|
292
292
|
baseKeyframe?: {
|
|
@@ -327,7 +327,7 @@ declare function createOrderbookHeatmapResponseSchema(scales: SdkScales): v.Sche
|
|
|
327
327
|
quantityMode: DecodedEnum<"close" | "peak">;
|
|
328
328
|
liveBucket?: {
|
|
329
329
|
symbolId: number;
|
|
330
|
-
interval: DecodedEnum<"
|
|
330
|
+
interval: DecodedEnum<"1h" | "1m" | "1s" | "5m">;
|
|
331
331
|
tsSec: number;
|
|
332
332
|
isFinal: boolean;
|
|
333
333
|
bids?: {
|
|
@@ -346,7 +346,7 @@ declare function createOrderbookHeatmapResponseSchema(scales: SdkScales): v.Sche
|
|
|
346
346
|
} | undefined;
|
|
347
347
|
}, {
|
|
348
348
|
symbolId: number;
|
|
349
|
-
interval: DecodedEnum<"
|
|
349
|
+
interval: DecodedEnum<"1h" | "1m" | "1s" | "5m">;
|
|
350
350
|
depth: 5 | 10 | 20 | 1 | "unspecified" | 200 | 1000 | 500 | 100 | 50;
|
|
351
351
|
chain: {
|
|
352
352
|
baseKeyframe: {
|
|
@@ -387,7 +387,7 @@ declare function createOrderbookHeatmapResponseSchema(scales: SdkScales): v.Sche
|
|
|
387
387
|
quantityMode: DecodedEnum<"close" | "peak">;
|
|
388
388
|
liveBucket: {
|
|
389
389
|
symbolId: number;
|
|
390
|
-
interval: DecodedEnum<"
|
|
390
|
+
interval: DecodedEnum<"1h" | "1m" | "1s" | "5m">;
|
|
391
391
|
tsSec: number;
|
|
392
392
|
isFinal: boolean;
|
|
393
393
|
bids: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { InternalTransferService } from "../../gen/transfer/v1/internal_transfer_pb.js";
|
|
1
2
|
import { parse } from "../../shared/validation.js";
|
|
2
3
|
import { toConnectCallOptions } from "../../shared/request-options.js";
|
|
3
4
|
import { removeUndefined } from "../../utils/remove-undefined.js";
|
|
4
5
|
import { resolveAccountScopedInput } from "../subaccount-resolver.js";
|
|
5
|
-
import { InternalTransferService } from "../../gen/transfer/v1/internal_transfer_pb.js";
|
|
6
6
|
import { createCreateInternalTransferInputSchema, createCreateInternalTransferResultSchema } from "./internal-transfers.schemas.js";
|
|
7
7
|
import { createClient } from "@connectrpc/connect";
|
|
8
8
|
//#region src/services/internal-transfers/internal-transfers.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { MarketOverviewBatchSchema, MarketOverviewService as MarketOverviewService$1 } from "../../gen/marketoverview/v1/marketoverview_pb.js";
|
|
1
2
|
import { parse } from "../../shared/validation.js";
|
|
2
3
|
import { toConnectCallOptions } from "../../shared/request-options.js";
|
|
3
4
|
import { CatalogLookupError } from "../../catalogs/types.js";
|
|
4
5
|
import { isDev } from "../../utils/is-dev.js";
|
|
5
|
-
import { MarketOverviewBatchSchema, MarketOverviewService as MarketOverviewService$1 } from "../../gen/marketoverview/v1/marketoverview_pb.js";
|
|
6
6
|
import { snapshotThenStream } from "../../realtime/snapshot-then-stream.js";
|
|
7
7
|
import { ListMarketOverviewInputSchema, createMarketOverviewSchema } from "./market-overview.schemas.js";
|
|
8
8
|
import { createClient } from "@connectrpc/connect";
|
|
@@ -29,7 +29,7 @@ declare function createMarketOverviewSchema(scales: SdkScales): v.SchemaWithPipe
|
|
|
29
29
|
readonly bestAskTicks: v.BigintSchema<undefined>;
|
|
30
30
|
readonly bestAskQtyScaled: v.BigintSchema<undefined>;
|
|
31
31
|
readonly sparklines: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
32
|
-
readonly interval: v.SchemaWithPipe<readonly [v.EnumSchema<typeof SparklineInterval, undefined>, v.TransformAction<SparklineInterval, "unspecified" | "
|
|
32
|
+
readonly interval: v.SchemaWithPipe<readonly [v.EnumSchema<typeof SparklineInterval, undefined>, v.TransformAction<SparklineInterval, "unspecified" | "1h" | "24h" | "1w" | "1m">]>;
|
|
33
33
|
readonly closeTicks: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
|
|
34
34
|
}, undefined>, undefined>, readonly []>;
|
|
35
35
|
readonly indexPriceTicks: v.BigintSchema<undefined>;
|
|
@@ -48,7 +48,7 @@ declare function createMarketOverviewSchema(scales: SdkScales): v.SchemaWithPipe
|
|
|
48
48
|
bestAskTicks: bigint;
|
|
49
49
|
bestAskQtyScaled: bigint;
|
|
50
50
|
sparklines: {
|
|
51
|
-
interval: "unspecified" | "
|
|
51
|
+
interval: "unspecified" | "1h" | "24h" | "1w" | "1m";
|
|
52
52
|
closeTicks: bigint[];
|
|
53
53
|
}[];
|
|
54
54
|
indexPriceTicks: bigint;
|
|
@@ -77,7 +77,7 @@ declare const ListMarketOverviewInputSchema: v.SchemaWithPipe<readonly [v.Strict
|
|
|
77
77
|
readonly orderBy: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["change_24h_bps", "volume_24h_quote", "last_price", "date_added"], undefined>, "volume_24h_quote">, v.TransformAction<"change_24h_bps" | "volume_24h_quote" | "last_price" | "date_added", MarketOrderBy.ORDER_BY_CHANGE_24H_BPS | MarketOrderBy.ORDER_BY_VOLUME_24H_QUOTE | MarketOrderBy.ORDER_BY_LAST_PRICE | MarketOrderBy.ORDER_BY_DATE_ADDED>]>;
|
|
78
78
|
readonly sort: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["asc", "desc"], undefined>, "desc">, v.TransformAction<"asc" | "desc", SortDirection.SORT_ASC | SortDirection.SORT_DESC>]>;
|
|
79
79
|
readonly includeSparklines: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
|
|
80
|
-
readonly sparklineIntervals: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["1h", "24h", "1w", "1m"], undefined>, undefined>, readonly ["24h"]>, v.TransformAction<("
|
|
80
|
+
readonly sparklineIntervals: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["1h", "24h", "1w", "1m"], undefined>, undefined>, readonly ["24h"]>, v.TransformAction<("1h" | "24h" | "1w" | "1m")[], (SparklineInterval.SPARKLINE_1H | SparklineInterval.SPARKLINE_24H | SparklineInterval.SPARKLINE_1W | SparklineInterval.SPARKLINE_1M)[]>]>;
|
|
81
81
|
}, undefined>, v.TransformAction<{
|
|
82
82
|
symbolIds: number[];
|
|
83
83
|
limit: number;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { SparklineInterval } from "../../gen/marketoverview/v1/marketoverview_pb.js";
|
|
1
2
|
import { requiredEnumLabel } from "../../shared/proto-enum-codec.js";
|
|
2
3
|
import { tsNsToMs } from "../../utils/time.js";
|
|
3
4
|
import { PositiveUint32InputSchema, SymbolIdInputSchema } from "../shared.js";
|
|
4
5
|
import { scaledToDecimalOutput } from "../../shared/decimal-surface.js";
|
|
5
|
-
import { SparklineInterval } from "../../gen/marketoverview/v1/marketoverview_pb.js";
|
|
6
6
|
import { MARKET_OVERVIEW_ORDER_BY_VALUES, MARKET_OVERVIEW_SORT_VALUES, MarketOverviewOrderByCodec, MarketOverviewSortCodec, SPARKLINE_INTERVAL_VALUES, SparklineIntervalCodec } from "./market-overview.codecs.js";
|
|
7
7
|
import * as v from "valibot";
|
|
8
8
|
//#region src/services/market-overview/market-overview.schemas.ts
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { OrderErrorCode, OrderErrorDetail, OrderErrorDetailSchema } from "./order-errors.schemas.js";
|
|
1
2
|
import { CancelAllOrdersInput, CancelAllOrdersInputSchema, CancelAllOrdersResponse, CancelAllOrdersResponseSchema, CancelOrderInput, CancelOrderInputSchema, CancelOrderResult, CancelOrderResultSchema, CreateOrderResult, GetOrderDetailsInput, GetOrderDetailsInputSchema, NewOrderInput, OpenOrdersInput, OpenOrdersInputSchema, OrderHistoryInput, OrderHistoryInputSchema, OrderIntentInput, PreviewOrderResult, createCreateOrderResultSchema, createNewOrderInputSchema, createOrderIntentInputSchema, createPreviewOrderResultSchema } from "./orders-input.schemas.js";
|
|
2
3
|
import { ModifyOrderInput, ModifyOrderResult, ModifyOrderResultSchema, createModifyOrderInputSchema } from "./orders-modify.schemas.js";
|
|
3
4
|
import { RiskPolicyInput, StopLossInput, TakeProfitInput, TrailingStopInput, createRiskPolicyInputSchema } from "./orders-risk.schemas.js";
|
|
4
5
|
import { BatchCancelOrderInput, BatchCancelOrderResult, BatchCancelOrdersInput, BatchCancelOrdersInputSchema, BatchCancelOrdersResult, BatchCancelOrdersResultSchema, BatchCreateOrderResult, BatchCreateOrdersInput, BatchCreateOrdersResult, BatchReplaceAdmissionItem, BatchReplaceOrdersInput, BatchReplaceOrdersResult, BatchReplaceOrdersResultSchema, CancelAllAfterInput, CancelAllAfterInputSchema, CancelAllAfterResult, CancelAllAfterResultSchema, GetBatchReplaceStatusInput, GetBatchReplaceStatusInputSchema, GetBatchReplaceStatusResult, GetBatchReplaceStatusResultSchema, createBatchCreateOrdersInputSchema, createBatchCreateOrdersResultSchema } from "./orders-batch.schemas.js";
|
|
5
|
-
import { OrderErrorCode, OrderErrorDetail, OrderErrorDetailSchema } from "./order-errors.schemas.js";
|
|
6
6
|
import { Order, OrderDetails, OrderTransfer, createOrderDetailsSchema, createOrderSchema, createOrderTransferSchema } from "./orders-output.schemas.js";
|
|
7
7
|
import "./orders.schemas.js";
|
|
8
8
|
import { OrdersService } from "./orders.js";
|
|
@@ -4,7 +4,7 @@ import * as v from "valibot";
|
|
|
4
4
|
//#region src/services/orders/order-errors.schemas.d.ts
|
|
5
5
|
type OrderErrorCode = keyof typeof ErrorCode;
|
|
6
6
|
declare const OrderErrorDetailSchema: v.ObjectSchema<{
|
|
7
|
-
readonly code: v.SchemaWithPipe<readonly [v.EnumSchema<typeof ErrorCode, undefined>, v.TransformAction<ErrorCode, "STALE_QUOTE" | "UNSPECIFIED" | "BAD_REQUEST" | "INVALID_ARGUMENT" | "INSUFFICIENT_FUNDS" | "UNKNOWN_SYMBOL" | "BAD_PRICE" | "BAD_QTY" | "MIN_NOTIONAL" | "QTY_STEP_SIZE" | "CONFLICT_DUPLICATE_CLIENT_ORDER_ID" | "UNAVAILABLE" | "UNAUTHENTICATED" | "PERMISSION_DENIED" | "NOT_FOUND" | "UPSTREAM_ERROR" | "FEE_ASSET_NOT_ALLOWED" | "PAIR_DISABLED" | "ORDER_UNKNOWN" | "INTERNAL_ERROR" | "SUBACCOUNT_INACTIVE" | "POLICY_MARKET_DENY" | "POLICY_MAX_NOTIONAL" | "POLICY_TRADING_HALTED" | "POLICY_SPOT_TRADE_DENY" | "API_KEY_ROOT_SCOPE_ONLY" | "API_KEY_SUB_SCOPE_ONLY" | "API_KEY_SUBACCOUNT_MISMATCH" | "API_KEY_POLICY_REQUIRED" | "API_KEY_UNKNOWN" | "API_KEY_MARKET_DENY" | "PRICE_TICK_SIZE" | "MIN_QTY" | "POST_ONLY_LIMIT_ONLY" | "BATCH_TOO_LARGE" | "POLICY_MAX_OPEN_ORDERS" | "MODIFICATION_REQUIRES_REPLACE" | "CONFLICT_IDEMPOTENCY_KEY_REUSE" | "MARKET_PRICE_UNAVAILABLE" | "PAIR_NOT_LISTED_YET" | "PAIR_DELISTED" | "PAIR_CANCEL_ONLY" | "PAIR_POST_ONLY" | "PAIR_REDUCE_ONLY" | "RISK_LIMIT" | "MARKET_HALTED" | "ACCOUNT_UNKNOWN" | "POST_ONLY_CROSS" | "REDUCE_ONLY_BLOCKED" | "PRICE_BAND_VIOLATION" | "MARKET_CAP_VIOLATION" | "EMPTY_BOOK" | "FOK_INSUFFICIENT_LIQUIDITY" | "ORDER_ALREADY_TERMINAL" | "TRIGGER_PRICE_INVALID" | "TRIGGER_PRICE_SOURCE_UNSUPPORTED" | "TRAILING_DISTANCE_INVALID" | "TRIGGER_NOT_FOUND" | "TRIGGER_CANCEL_REJECTED" | "TRIGGER_STATUS_INVALID" | "TRIGGER_NOT_MODIFIABLE" | "CONFLICT_DUPLICATE_CLIENT_TRIGGER_ID" | "MAX_SLIPPAGE_INVALID" | "VALIDATION_ERROR" | "OVERLOADED" | "MAX_QUOTE_DEBIT_TOO_SMALL" | "RATE_LIMIT_EXCEEDED" | "SUBACCOUNT_READ_FORBIDDEN" | "POLICY_SPOT_READ_DENY" | "API_KEY_SPOT_READ_DENY">]>;
|
|
7
|
+
readonly code: v.SchemaWithPipe<readonly [v.EnumSchema<typeof ErrorCode, undefined>, v.TransformAction<ErrorCode, "STALE_QUOTE" | "UNSPECIFIED" | "BAD_REQUEST" | "INVALID_ARGUMENT" | "INSUFFICIENT_FUNDS" | "UNKNOWN_SYMBOL" | "BAD_PRICE" | "BAD_QTY" | "MIN_NOTIONAL" | "QTY_STEP_SIZE" | "CONFLICT_DUPLICATE_CLIENT_ORDER_ID" | "UNAVAILABLE" | "UNAUTHENTICATED" | "PERMISSION_DENIED" | "NOT_FOUND" | "UPSTREAM_ERROR" | "FEE_ASSET_NOT_ALLOWED" | "PAIR_DISABLED" | "ORDER_UNKNOWN" | "INTERNAL_ERROR" | "SUBACCOUNT_INACTIVE" | "POLICY_MARKET_DENY" | "POLICY_MAX_NOTIONAL" | "POLICY_TRADING_HALTED" | "POLICY_SPOT_TRADE_DENY" | "API_KEY_ROOT_SCOPE_ONLY" | "API_KEY_SUB_SCOPE_ONLY" | "API_KEY_SUBACCOUNT_MISMATCH" | "API_KEY_POLICY_REQUIRED" | "API_KEY_UNKNOWN" | "API_KEY_MARKET_DENY" | "PRICE_TICK_SIZE" | "MIN_QTY" | "POST_ONLY_LIMIT_ONLY" | "BATCH_TOO_LARGE" | "POLICY_MAX_OPEN_ORDERS" | "MODIFICATION_REQUIRES_REPLACE" | "CONFLICT_IDEMPOTENCY_KEY_REUSE" | "MARKET_PRICE_UNAVAILABLE" | "PAIR_NOT_LISTED_YET" | "PAIR_DELISTED" | "PAIR_CANCEL_ONLY" | "PAIR_POST_ONLY" | "PAIR_REDUCE_ONLY" | "RISK_LIMIT" | "MARKET_HALTED" | "ACCOUNT_UNKNOWN" | "POST_ONLY_CROSS" | "REDUCE_ONLY_BLOCKED" | "PRICE_BAND_VIOLATION" | "MARKET_CAP_VIOLATION" | "EMPTY_BOOK" | "FOK_INSUFFICIENT_LIQUIDITY" | "ORDER_ALREADY_TERMINAL" | "TRIGGER_PRICE_INVALID" | "TRIGGER_PRICE_SOURCE_UNSUPPORTED" | "TRAILING_DISTANCE_INVALID" | "TRIGGER_NOT_FOUND" | "TRIGGER_CANCEL_REJECTED" | "TRIGGER_STATUS_INVALID" | "TRIGGER_NOT_MODIFIABLE" | "CONFLICT_DUPLICATE_CLIENT_TRIGGER_ID" | "MAX_SLIPPAGE_INVALID" | "VALIDATION_ERROR" | "OVERLOADED" | "MAX_QUOTE_DEBIT_TOO_SMALL" | "RATE_LIMIT_EXCEEDED" | "SUBACCOUNT_READ_FORBIDDEN" | "POLICY_SPOT_READ_DENY" | "API_KEY_SPOT_READ_DENY" | "CANCEL_REQUEST_EXPIRED">]>;
|
|
8
8
|
readonly violations: v.ArraySchema<v.ObjectSchema<{
|
|
9
9
|
readonly fieldPath: v.StringSchema<undefined>;
|
|
10
10
|
readonly ruleId: v.StringSchema<undefined>;
|