@polyester/sdk 0.22.2 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/account-signer/types.d.ts +1 -1
  3. package/dist/account-signer/types.js.map +1 -1
  4. package/dist/environment.js +1 -1
  5. package/dist/environment.js.map +1 -1
  6. package/dist/gen/auth/v1/auth_pb.d.ts +88 -46
  7. package/dist/gen/auth/v1/auth_pb.d.ts.map +1 -1
  8. package/dist/gen/auth/v1/auth_pb.js +43 -11
  9. package/dist/gen/auth/v1/auth_pb.js.map +1 -1
  10. package/dist/gen/auth/v1/subaccounts_pb.d.ts +5 -17
  11. package/dist/gen/auth/v1/subaccounts_pb.d.ts.map +1 -1
  12. package/dist/gen/auth/v1/subaccounts_pb.js +1 -1
  13. package/dist/gen/auth/v1/subaccounts_pb.js.map +1 -1
  14. package/dist/gen/chain/withdraw/v1/withdraw_pb.d.ts +2 -2
  15. package/dist/gen/chain/withdraw/v1/withdraw_pb.js.map +1 -1
  16. package/dist/gen/marketoverview/v1/marketoverview_pb.d.ts +2 -1
  17. package/dist/gen/marketoverview/v1/marketoverview_pb.d.ts.map +1 -1
  18. package/dist/gen/marketoverview/v1/marketoverview_pb.js.map +1 -1
  19. package/dist/index.d.ts +3 -3
  20. package/dist/services/auth/account-signer-auth.d.ts +7 -3
  21. package/dist/services/auth/account-signer-auth.d.ts.map +1 -1
  22. package/dist/services/auth/account-signer-auth.js +28 -13
  23. package/dist/services/auth/account-signer-auth.js.map +1 -1
  24. package/dist/services/auth/auth.d.ts +19 -14
  25. package/dist/services/auth/auth.d.ts.map +1 -1
  26. package/dist/services/auth/auth.js +24 -14
  27. package/dist/services/auth/auth.js.map +1 -1
  28. package/dist/services/auth/auth.types.d.ts +2 -2
  29. package/dist/services/auth/wallet-challenge.schemas.js +20 -0
  30. package/dist/services/auth/wallet-challenge.schemas.js.map +1 -0
  31. package/dist/services/candles/candles.schemas.d.ts +10 -10
  32. package/dist/services/heatmap/heatmap.schemas.d.ts +9 -9
  33. package/dist/services/lifecycle/lifecycle.schemas.d.ts +42 -42
  34. package/dist/services/market-overview/market-overview.schemas.d.ts +3 -3
  35. package/dist/services/orders/orders-batch.schemas.d.ts +14 -14
  36. package/dist/services/orders/orders-input.schemas.d.ts +1 -1
  37. package/dist/services/orders/orders-output.schemas.d.ts +12 -12
  38. package/dist/services/subaccounts/subaccounts.d.ts +1 -1
  39. package/dist/services/subaccounts/subaccounts.js +1 -1
  40. package/dist/services/subaccounts/subaccounts.js.map +1 -1
  41. package/dist/services/subaccounts/subaccounts.schemas.d.ts +7 -9
  42. package/dist/services/subaccounts/subaccounts.schemas.d.ts.map +1 -1
  43. package/dist/services/subaccounts/subaccounts.schemas.js +4 -5
  44. package/dist/services/subaccounts/subaccounts.schemas.js.map +1 -1
  45. package/dist/services/trading-withdraws/index.d.ts +1 -1
  46. package/dist/services/trading-withdraws/trading-withdraws.d.ts +10 -72
  47. package/dist/services/trading-withdraws/trading-withdraws.d.ts.map +1 -1
  48. package/dist/services/trading-withdraws/trading-withdraws.js +8 -84
  49. package/dist/services/trading-withdraws/trading-withdraws.js.map +1 -1
  50. package/dist/services/trading-withdraws/trading-withdraws.types.d.ts +2 -2
  51. package/dist/services/trading-withdraws/wallet-message.js +43 -0
  52. package/dist/services/trading-withdraws/wallet-message.js.map +1 -0
  53. package/dist/services/triggers/trigger-input.schemas.d.ts +2 -2
  54. package/dist/services/triggers/triggers-output.schemas.d.ts +18 -18
  55. package/package.json +2 -1
@@ -6,13 +6,20 @@ import "../../realtime/index.js";
6
6
  import { ProfileService } from "./profile/profile.js";
7
7
  import * as v from "valibot";
8
8
  //#region src/services/auth/auth.d.ts
9
+ declare const CreateWalletChallengeInputSchema: v.StrictObjectSchema<{
10
+ readonly smartAccountAddress: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "Invalid wallet address.">]>;
11
+ readonly signerAddress: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "Invalid wallet address.">]>;
12
+ readonly uri: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MaxLengthAction<string, 2048, undefined>, v.CheckAction<string, "Wallet challenge URI must be an HTTP(S) origin without a path, query, fragment, or user information.">]>;
13
+ readonly purpose: v.PicklistSchema<["login", "create_subaccount"], undefined>;
14
+ }, undefined>;
15
+ type CreateWalletChallengeInput = v.InferInput<typeof CreateWalletChallengeInputSchema>;
16
+ type WalletChallengePurpose = CreateWalletChallengeInput["purpose"];
9
17
  declare const LoginWithWalletInputSchema: v.StrictObjectSchema<{
10
- readonly smartAccountAddress: v.StringSchema<undefined>;
11
- readonly nonce: v.StringSchema<undefined>;
12
- readonly signature: v.StringSchema<undefined>;
18
+ readonly smartAccountAddress: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "Invalid wallet address.">]>;
19
+ readonly message: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.CheckAction<string, "Wallet challenge message exceeds 4096 UTF-8 bytes.">]>;
20
+ readonly signature: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.MaxLengthAction<string, 8192, undefined>]>;
13
21
  readonly userAgent: v.OptionalSchema<v.StringSchema<undefined>, "">;
14
22
  readonly ip: v.OptionalSchema<v.StringSchema<undefined>, "">;
15
- readonly primaryWalletAddress: v.OptionalSchema<v.StringSchema<undefined>, "">;
16
23
  readonly walletProvider: v.OptionalSchema<v.StringSchema<undefined>, "">;
17
24
  }, undefined>;
18
25
  type LoginWithWalletInput = v.InferInput<typeof LoginWithWalletInputSchema>;
@@ -54,8 +61,8 @@ declare const LoginWithWalletResponseSchema: v.ObjectSchema<{
54
61
  readonly username: v.StringSchema<undefined>;
55
62
  }, undefined>;
56
63
  type LoginWithWalletResponse = v.InferOutput<typeof LoginWithWalletResponseSchema>;
57
- declare const NonceSchema: v.ObjectSchema<{
58
- readonly nonce: v.StringSchema<undefined>;
64
+ declare const WalletChallengeSchema: v.ObjectSchema<{
65
+ readonly message: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.CheckAction<string, "Wallet challenge message exceeds 4096 UTF-8 bytes.">]>;
59
66
  readonly expiresAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
60
67
  readonly seconds: v.BigintSchema<undefined>;
61
68
  readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
@@ -64,7 +71,7 @@ declare const NonceSchema: v.ObjectSchema<{
64
71
  nanos: number;
65
72
  } | undefined, number | undefined>]>;
66
73
  }, undefined>;
67
- type Nonce = v.InferOutput<typeof NonceSchema>;
74
+ type WalletChallenge = v.InferOutput<typeof WalletChallengeSchema>;
68
75
  /**
69
76
  * Handles wallet-based authentication, caller introspection, and authenticated profile operations.
70
77
  */
@@ -84,17 +91,15 @@ declare class AuthService {
84
91
  */
85
92
  acceptTerms(options?: PolyesterMutationOptions): Promise<void>;
86
93
  /**
87
- * Requests a short-lived nonce for the given smart-account EVM address.
88
- * The nonce is single-purpose, replaced by subsequent requests, and expires
89
- * after about five minutes. The optional expiry is milliseconds since the
90
- * Unix epoch.
94
+ * Requests a server-issued SIWE message. Sign its exact UTF-8 bytes with
95
+ * personal_sign; do not hash or reconstruct it. Expiry is epoch milliseconds.
91
96
  */
92
- requestLoginNonce(smartAccountAddress: string, options?: PolyesterRequestOptions): Promise<Nonce>;
97
+ createWalletChallenge(input: CreateWalletChallengeInput, options?: PolyesterRequestOptions): Promise<WalletChallenge>;
93
98
  /**
94
- * Exchanges a signed login nonce for an authenticated session token and account identity returned by the auth API.
99
+ * Exchanges a signed SIWE message for an authenticated session token and account identity returned by the auth API.
95
100
  */
96
101
  protected loginWithWallet(input: LoginWithWalletInput, options?: PolyesterMutationOptions): Promise<LoginWithWalletResponse>;
97
102
  }
98
103
  //#endregion
99
- export { AuthService, LoginWithWalletInput, LoginWithWalletInputSchema, LoginWithWalletResponse, Me, Nonce };
104
+ export { AuthService, CreateWalletChallengeInput, CreateWalletChallengeInputSchema, LoginWithWalletInput, LoginWithWalletInputSchema, LoginWithWalletResponse, Me, WalletChallenge, WalletChallengePurpose };
100
105
  //# sourceMappingURL=auth.d.ts.map
@@ -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,YAAY,UAAU,2BAA2B;;;;;;;EAUjD,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":";;;;;;;;cA2Ba,kCAAgC,EAAA;;;;;;KAMjC,6BAA6B,EAAE,kBAAkB;KACjD,yBAAyB;cAExB,4BAA0B,EAAA;;;;;;;;KAS3B,uBAAuB,EAAE,kBAAkB;cAEjD,UAAQ,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;KAOF,KAAK,EAAE,mBAAmB;cAEhC,+BAA6B,EAAA;;;;;;;;;KAOvB,0BAA0B,EAAE,mBAAmB;cAErD,uBAAqB,EAAA;;;;;;;;;;KAKf,kBAAkB,EAAE,mBAAmB;;;;cAKtC;;EAGT,SAAS;EAEG,YAAA,YAAY,4BAA4B,UAAU;;;;EASxD,GAAG,UAAU,0BAA0B,QAAQ;;;;;;;EAW/C,YAAY,UAAU,2BAA2B;;;;;EAQjD,sBACF,OAAO,4BACP,UAAU,0BACX,QAAQ;;;;YA4BK,gBACZ,OAAO,sBACP,UAAU,2BACX,QAAQ"}
@@ -1,19 +1,26 @@
1
+ import { ValidationError } from "../../shared/errors.js";
1
2
  import { AuthService as AuthService$1 } from "../../gen/auth/v1/auth_pb.js";
2
3
  import { OptionalTimestampMsSchema, PublicIdSchema, TimestampSchema } from "../../shared/schemas.js";
3
4
  import { parse } from "../../shared/validation.js";
4
5
  import { toConnectCallOptions } from "../../shared/request-options.js";
5
6
  import { ProfileService } from "./profile/profile.js";
6
7
  import { MfaSessionInfoSchema } from "../mfa/mfa.schemas.js";
8
+ import { WalletAddressSchema, WalletChallengeMessageSchema, WalletChallengeUriSchema, WalletSignatureSchema } from "./wallet-challenge.schemas.js";
7
9
  import { createClient } from "@connectrpc/connect";
8
10
  import * as v from "valibot";
9
11
  //#region src/services/auth/auth.ts
12
+ const CreateWalletChallengeInputSchema = v.strictObject({
13
+ smartAccountAddress: WalletAddressSchema,
14
+ signerAddress: WalletAddressSchema,
15
+ uri: WalletChallengeUriSchema,
16
+ purpose: v.picklist(["login", "create_subaccount"])
17
+ });
10
18
  const LoginWithWalletInputSchema = v.strictObject({
11
- smartAccountAddress: v.string(),
12
- nonce: v.string(),
13
- signature: v.string(),
19
+ smartAccountAddress: WalletAddressSchema,
20
+ message: WalletChallengeMessageSchema,
21
+ signature: WalletSignatureSchema,
14
22
  userAgent: v.optional(v.string(), ""),
15
23
  ip: v.optional(v.string(), ""),
16
- primaryWalletAddress: v.optional(v.string(), ""),
17
24
  walletProvider: v.optional(v.string(), "")
18
25
  });
19
26
  const MeSchema = v.object({
@@ -28,8 +35,8 @@ const LoginWithWalletResponseSchema = v.object({
28
35
  accountId: PublicIdSchema,
29
36
  username: v.string()
30
37
  });
31
- const NonceSchema = v.object({
32
- nonce: v.string(),
38
+ const WalletChallengeSchema = v.object({
39
+ message: WalletChallengeMessageSchema,
33
40
  expiresAt: OptionalTimestampMsSchema
34
41
  });
35
42
  /**
@@ -61,16 +68,19 @@ var AuthService = class {
61
68
  await this.#authClient.acceptTerms({}, toConnectCallOptions(options));
62
69
  }
63
70
  /**
64
- * Requests a short-lived nonce for the given smart-account EVM address.
65
- * The nonce is single-purpose, replaced by subsequent requests, and expires
66
- * after about five minutes. The optional expiry is milliseconds since the
67
- * Unix epoch.
71
+ * Requests a server-issued SIWE message. Sign its exact UTF-8 bytes with
72
+ * personal_sign; do not hash or reconstruct it. Expiry is epoch milliseconds.
68
73
  */
69
- async requestLoginNonce(smartAccountAddress, options) {
70
- return parse(NonceSchema, await this.#publicClient.getNonce({ smartAccountAddress }, toConnectCallOptions(options)));
74
+ async createWalletChallenge(input, options) {
75
+ const validated = parse(CreateWalletChallengeInputSchema, input);
76
+ if (validated.purpose === "create_subaccount" && validated.signerAddress.toLowerCase() !== validated.smartAccountAddress.toLowerCase()) throw new ValidationError("Subaccount challenge signer must equal the smart account address.");
77
+ return parse(WalletChallengeSchema, await this.#publicClient.createWalletChallenge({
78
+ ...validated,
79
+ purpose: validated.purpose === "login" ? 1 : 2
80
+ }, toConnectCallOptions(options)));
71
81
  }
72
82
  /**
73
- * Exchanges a signed login nonce for an authenticated session token and account identity returned by the auth API.
83
+ * Exchanges a signed SIWE message for an authenticated session token and account identity returned by the auth API.
74
84
  */
75
85
  async loginWithWallet(input, options) {
76
86
  const validatedInput = parse(LoginWithWalletInputSchema, input);
@@ -79,6 +89,6 @@ var AuthService = class {
79
89
  }
80
90
  };
81
91
  //#endregion
82
- export { AuthService, LoginWithWalletInputSchema };
92
+ export { AuthService, CreateWalletChallengeInputSchema, LoginWithWalletInputSchema };
83
93
 
84
94
  //# sourceMappingURL=auth.js.map
@@ -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 * 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
+ {"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 { ValidationError } from \"../../shared/errors.js\";\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\nimport {\n WalletAddressSchema,\n WalletChallengeUriSchema,\n WalletChallengeMessageSchema,\n WalletSignatureSchema,\n} from \"./wallet-challenge.schemas.js\";\n\nexport const CreateWalletChallengeInputSchema = v.strictObject({\n smartAccountAddress: WalletAddressSchema,\n signerAddress: WalletAddressSchema,\n uri: WalletChallengeUriSchema,\n purpose: v.picklist([\"login\", \"create_subaccount\"]),\n});\nexport type CreateWalletChallengeInput = v.InferInput<typeof CreateWalletChallengeInputSchema>;\nexport type WalletChallengePurpose = CreateWalletChallengeInput[\"purpose\"];\n\nexport const LoginWithWalletInputSchema = v.strictObject({\n smartAccountAddress: WalletAddressSchema,\n message: WalletChallengeMessageSchema,\n signature: WalletSignatureSchema,\n userAgent: v.optional(v.string(), \"\"),\n ip: 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 WalletChallengeSchema = v.object({\n message: WalletChallengeMessageSchema,\n expiresAt: OptionalTimestampMsSchema,\n});\n\nexport type WalletChallenge = v.InferOutput<typeof WalletChallengeSchema>;\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 server-issued SIWE message. Sign its exact UTF-8 bytes with\n * personal_sign; do not hash or reconstruct it. Expiry is epoch milliseconds.\n */\n async createWalletChallenge(\n input: CreateWalletChallengeInput,\n options?: PolyesterRequestOptions,\n ): Promise<WalletChallenge> {\n const validated = parse(CreateWalletChallengeInputSchema, input);\n if (\n validated.purpose === \"create_subaccount\" &&\n validated.signerAddress.toLowerCase() !== validated.smartAccountAddress.toLowerCase()\n ) {\n throw new ValidationError(\n \"Subaccount challenge signer must equal the smart account address.\",\n );\n }\n return parse(\n WalletChallengeSchema,\n await this.#publicClient.createWalletChallenge(\n {\n ...validated,\n purpose:\n validated.purpose === \"login\"\n ? Proto.WalletChallengePurpose.LOGIN\n : Proto.WalletChallengePurpose.CREATE_SUBACCOUNT,\n },\n toConnectCallOptions(options),\n ),\n );\n }\n\n /**\n * Exchanges a signed SIWE message 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":";;;;;;;;;;;AA2BA,MAAa,mCAAmC,EAAE,aAAa;CAC3D,qBAAqB;CACrB,eAAe;CACf,KAAK;CACL,SAAS,EAAE,SAAS,CAAC,SAAS,mBAAmB,CAAC;AACtD,CAAC;AAID,MAAa,6BAA6B,EAAE,aAAa;CACrD,qBAAqB;CACrB,SAAS;CACT,WAAW;CACX,WAAW,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CACpC,IAAI,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CAC7B,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,wBAAwB,EAAE,OAAO;CACnC,SAAS;CACT,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;;;;;CAMA,MAAM,sBACF,OACA,SACwB;EACxB,MAAM,YAAY,MAAM,kCAAkC,KAAK;EAC/D,IACI,UAAU,YAAY,uBACtB,UAAU,cAAc,YAAY,MAAM,UAAU,oBAAoB,YAAY,GAEpF,MAAM,IAAI,gBACN,mEACJ;EAEJ,OAAO,MACH,uBACA,MAAM,KAAKF,cAAc,sBACrB;GACI,GAAG;GACH,SACI,UAAU,YAAY,UAAA,IAAA;EAG9B,GACA,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,3 +1,3 @@
1
- import { LoginWithWalletInput, LoginWithWalletResponse, Me, Nonce } from "./auth.js";
1
+ import { CreateWalletChallengeInput, LoginWithWalletInput, LoginWithWalletResponse, Me, WalletChallenge, WalletChallengePurpose } from "./auth.js";
2
2
  import { AccountSignerAuthEvents, CreateSubaccountParams, CreateSubaccountResult, LoginOptions, LoginResult } from "./account-signer-auth.js";
3
- export type { AccountSignerAuthEvents, CreateSubaccountResult as AccountSignerCreateSubaccountResult, CreateSubaccountParams, LoginOptions, LoginResult, LoginWithWalletInput, LoginWithWalletResponse, Me, Nonce };
3
+ export type { AccountSignerAuthEvents, CreateSubaccountResult as AccountSignerCreateSubaccountResult, CreateSubaccountParams, CreateWalletChallengeInput, LoginOptions, LoginResult, LoginWithWalletInput, LoginWithWalletResponse, Me, WalletChallenge, WalletChallengePurpose };
@@ -0,0 +1,20 @@
1
+ import { isEvmAddress } from "../../utils/evm.js";
2
+ import * as v from "valibot";
3
+ //#region src/services/auth/wallet-challenge.schemas.ts
4
+ const WalletAddressSchema = v.pipe(v.string(), v.check(isEvmAddress, "Invalid wallet address."));
5
+ const WalletChallengeUriSchema = v.pipe(v.string(), v.maxLength(2048), v.check((value) => {
6
+ if (!/^https?:\/\/[^/?#\s\\]+$/.test(value)) return false;
7
+ try {
8
+ const url = new URL(value);
9
+ return !url.username && !url.password;
10
+ } catch {
11
+ return false;
12
+ }
13
+ }, "Wallet challenge URI must be an HTTP(S) origin without a path, query, fragment, or user information."));
14
+ /** Preserve the server-issued UTF-8 message exactly as signed. */
15
+ const WalletChallengeMessageSchema = v.pipe(v.string(), v.minLength(1), v.check((value) => new TextEncoder().encode(value).length <= 4096, "Wallet challenge message exceeds 4096 UTF-8 bytes."));
16
+ const WalletSignatureSchema = v.pipe(v.string(), v.minLength(1), v.maxLength(8192));
17
+ //#endregion
18
+ export { WalletAddressSchema, WalletChallengeMessageSchema, WalletChallengeUriSchema, WalletSignatureSchema };
19
+
20
+ //# sourceMappingURL=wallet-challenge.schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallet-challenge.schemas.js","names":[],"sources":["../../../src/services/auth/wallet-challenge.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { isEvmAddress } from \"../../utils/evm.js\";\n\nexport const WalletAddressSchema = v.pipe(\n v.string(),\n v.check(isEvmAddress, \"Invalid wallet address.\"),\n);\n\nexport const WalletChallengeUriSchema = v.pipe(\n v.string(),\n v.maxLength(2048),\n v.check((value) => {\n if (!/^https?:\\/\\/[^/?#\\s\\\\]+$/.test(value)) return false;\n try {\n const url = new URL(value);\n return !url.username && !url.password;\n } catch {\n return false;\n }\n }, \"Wallet challenge URI must be an HTTP(S) origin without a path, query, fragment, or user information.\"),\n);\n\n/** Preserve the server-issued UTF-8 message exactly as signed. */\nexport const WalletChallengeMessageSchema = v.pipe(\n v.string(),\n v.minLength(1),\n v.check(\n (value) => new TextEncoder().encode(value).length <= 4096,\n \"Wallet challenge message exceeds 4096 UTF-8 bytes.\",\n ),\n);\n\nexport const WalletSignatureSchema = v.pipe(v.string(), v.minLength(1), v.maxLength(8192));\n"],"mappings":";;;AAGA,MAAa,sBAAsB,EAAE,KACjC,EAAE,OAAO,GACT,EAAE,MAAM,cAAc,yBAAyB,CACnD;AAEA,MAAa,2BAA2B,EAAE,KACtC,EAAE,OAAO,GACT,EAAE,UAAU,IAAI,GAChB,EAAE,OAAO,UAAU;CACf,IAAI,CAAC,2BAA2B,KAAK,KAAK,GAAG,OAAO;CACpD,IAAI;EACA,MAAM,MAAM,IAAI,IAAI,KAAK;EACzB,OAAO,CAAC,IAAI,YAAY,CAAC,IAAI;CACjC,QAAQ;EACJ,OAAO;CACX;AACJ,GAAG,sGAAsG,CAC7G;;AAGA,MAAa,+BAA+B,EAAE,KAC1C,EAAE,OAAO,GACT,EAAE,UAAU,CAAC,GACb,EAAE,OACG,UAAU,IAAI,YAAY,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,UAAU,MACrD,oDACJ,CACJ;AAEA,MAAa,wBAAwB,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,UAAU,CAAC,GAAG,EAAE,UAAU,IAAI,CAAC"}
@@ -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" | "1h" | "1w" | "1m" | "1s" | "5m" | "15m" | "30m" | "4h" | "12h" | "1mo">>]>;
14
+ readonly timeframe: v.SchemaWithPipe<readonly [v.EnumSchema<typeof Timeframe$1, undefined>, v.TransformAction<Timeframe$1, DecodedEnum<"1d" | "1s" | "1m" | "5m" | "15m" | "30m" | "1h" | "4h" | "12h" | "1w" | "1mo">>]>;
15
15
  readonly tsSec: v.BigintSchema<undefined>;
16
16
  readonly open: v.BigintSchema<undefined>;
17
17
  readonly high: v.BigintSchema<undefined>;
@@ -22,7 +22,7 @@ declare function createCandleRowSchema(scales: SdkScales): v.SchemaWithPipe<read
22
22
  readonly isClosed: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
23
23
  }, undefined>, v.TransformAction<{
24
24
  symbolId: number;
25
- timeframe: DecodedEnum<"1d" | "1h" | "1w" | "1m" | "1s" | "5m" | "15m" | "30m" | "4h" | "12h" | "1mo">;
25
+ timeframe: DecodedEnum<"1d" | "1s" | "1m" | "5m" | "15m" | "30m" | "1h" | "4h" | "12h" | "1w" | "1mo">;
26
26
  tsSec: bigint;
27
27
  open: bigint;
28
28
  high: bigint;
@@ -33,7 +33,7 @@ declare function createCandleRowSchema(scales: SdkScales): v.SchemaWithPipe<read
33
33
  isClosed: boolean;
34
34
  }, {
35
35
  symbolId: number;
36
- timeframe: DecodedEnum<"1d" | "1h" | "1w" | "1m" | "1s" | "5m" | "15m" | "30m" | "4h" | "12h" | "1mo">;
36
+ timeframe: DecodedEnum<"1d" | "1s" | "1m" | "5m" | "15m" | "30m" | "1h" | "4h" | "12h" | "1w" | "1mo">;
37
37
  time: number;
38
38
  open: string;
39
39
  high: string;
@@ -46,7 +46,7 @@ declare function createCandleRowSchema(scales: SdkScales): v.SchemaWithPipe<read
46
46
  declare const createCandleRowIntSchema: typeof createCandleRowSchema;
47
47
  declare function createCandleColumnarSchema(scales: SdkScales): v.SchemaWithPipe<readonly [v.ObjectSchema<{
48
48
  readonly symbolId: v.NumberSchema<undefined>;
49
- 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">>]>;
49
+ readonly timeframe: v.SchemaWithPipe<readonly [v.EnumSchema<typeof Timeframe$1, undefined>, v.TransformAction<Timeframe$1, DecodedEnum<"1d" | "1s" | "1m" | "5m" | "15m" | "30m" | "1h" | "4h" | "12h" | "1w" | "1mo">>]>;
50
50
  readonly tsSec: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
51
51
  readonly open: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
52
52
  readonly high: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
@@ -63,7 +63,7 @@ declare function createCandleColumnarSchema(scales: SdkScales): v.SchemaWithPipe
63
63
  readonly nextPageToken: v.OptionalSchema<v.StringSchema<undefined>, "">;
64
64
  }, undefined>, v.TransformAction<{
65
65
  symbolId: number;
66
- timeframe: DecodedEnum<"1d" | "1h" | "1w" | "1m" | "1s" | "5m" | "15m" | "30m" | "4h" | "12h" | "1mo">;
66
+ timeframe: DecodedEnum<"1d" | "1s" | "1m" | "5m" | "15m" | "30m" | "1h" | "4h" | "12h" | "1w" | "1mo">;
67
67
  tsSec: bigint[];
68
68
  open: bigint[];
69
69
  high: bigint[];
@@ -80,7 +80,7 @@ declare function createCandleColumnarSchema(scales: SdkScales): v.SchemaWithPipe
80
80
  nextPageToken: string;
81
81
  }, {
82
82
  symbolId: number;
83
- timeframe: DecodedEnum<"1d" | "1h" | "1w" | "1m" | "1s" | "5m" | "15m" | "30m" | "4h" | "12h" | "1mo">;
83
+ timeframe: DecodedEnum<"1d" | "1s" | "1m" | "5m" | "15m" | "30m" | "1h" | "4h" | "12h" | "1w" | "1mo">;
84
84
  time: number[];
85
85
  open: string[];
86
86
  high: string[];
@@ -100,7 +100,7 @@ declare function createCandleColumnarSchema(scales: SdkScales): v.SchemaWithPipe
100
100
  }>]>;
101
101
  declare function createCandleColumnarIntSchema(scales: SdkScales): v.SchemaWithPipe<readonly [v.ObjectSchema<{
102
102
  readonly symbolId: v.NumberSchema<undefined>;
103
- 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">>]>;
103
+ readonly timeframe: v.SchemaWithPipe<readonly [v.EnumSchema<typeof Timeframe$1, undefined>, v.TransformAction<Timeframe$1, DecodedEnum<"1d" | "1s" | "1m" | "5m" | "15m" | "30m" | "1h" | "4h" | "12h" | "1w" | "1mo">>]>;
104
104
  readonly tsSec: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
105
105
  readonly open: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
106
106
  readonly high: v.ArraySchema<v.BigintSchema<undefined>, undefined>;
@@ -117,7 +117,7 @@ declare function createCandleColumnarIntSchema(scales: SdkScales): v.SchemaWithP
117
117
  readonly nextPageToken: v.OptionalSchema<v.StringSchema<undefined>, "">;
118
118
  }, undefined>, v.TransformAction<{
119
119
  symbolId: number;
120
- timeframe: DecodedEnum<"1d" | "1h" | "1w" | "1m" | "1s" | "5m" | "15m" | "30m" | "4h" | "12h" | "1mo">;
120
+ timeframe: DecodedEnum<"1d" | "1s" | "1m" | "5m" | "15m" | "30m" | "1h" | "4h" | "12h" | "1w" | "1mo">;
121
121
  tsSec: bigint[];
122
122
  open: bigint[];
123
123
  high: bigint[];
@@ -134,7 +134,7 @@ declare function createCandleColumnarIntSchema(scales: SdkScales): v.SchemaWithP
134
134
  nextPageToken: string;
135
135
  }, {
136
136
  symbolId: number;
137
- timeframe: DecodedEnum<"1d" | "1h" | "1w" | "1m" | "1s" | "5m" | "15m" | "30m" | "4h" | "12h" | "1mo">;
137
+ timeframe: DecodedEnum<"1d" | "1s" | "1m" | "5m" | "15m" | "30m" | "1h" | "4h" | "12h" | "1w" | "1mo">;
138
138
  tsSec: number[];
139
139
  open: string[];
140
140
  high: string[];
@@ -158,7 +158,7 @@ type CandleColumnar = v.InferOutput<ReturnType<typeof createCandleColumnarSchema
158
158
  type CandleColumnarInt = v.InferOutput<ReturnType<typeof createCandleColumnarIntSchema>>;
159
159
  declare function createListCandlesInputSchema(): v.SchemaWithPipe<readonly [v.ObjectSchema<{
160
160
  readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
161
- 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>]>;
161
+ readonly timeframe: v.SchemaWithPipe<readonly [v.PicklistSchema<readonly ["1s", "1m", "5m", "15m", "30m", "1h", "4h", "12h", "1d", "1w", "1mo"], undefined>, v.TransformAction<"1d" | "1s" | "1m" | "5m" | "15m" | "30m" | "1h" | "4h" | "12h" | "1w" | "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>]>;
162
162
  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>;
163
163
  readonly includeIncomplete: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
164
164
  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<"1h" | "1m" | "1s" | "5m", HeatmapInterval>]>;
16
+ readonly interval: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["1s", "1m", "5m", "1h"], undefined>, "1s">, v.TransformAction<"1s" | "1m" | "5m" | "1h", 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<"1h" | "1m" | "1s" | "5m">>]>;
125
+ readonly interval: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"1s" | "1m" | "5m" | "1h">>]>;
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<"1h" | "1m" | "1s" | "5m">;
145
+ interval: DecodedEnum<"1s" | "1m" | "5m" | "1h">;
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<"1h" | "1m" | "1s" | "5m">>]>;
229
+ readonly interval: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"1s" | "1m" | "5m" | "1h">>]>;
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<"1h" | "1m" | "1s" | "5m">>]>;
270
+ readonly interval: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, DecodedEnum<"1s" | "1m" | "5m" | "1h">>]>;
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<"1h" | "1m" | "1s" | "5m">;
289
+ interval: DecodedEnum<"1s" | "1m" | "5m" | "1h">;
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<"1h" | "1m" | "1s" | "5m">;
330
+ interval: DecodedEnum<"1s" | "1m" | "5m" | "1h">;
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<"1h" | "1m" | "1s" | "5m">;
349
+ interval: DecodedEnum<"1s" | "1m" | "5m" | "1h">;
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<"1h" | "1m" | "1s" | "5m">;
390
+ interval: DecodedEnum<"1s" | "1m" | "5m" | "1h">;
391
391
  tsSec: number;
392
392
  isFinal: boolean;
393
393
  bids: {