@polyester/sdk 0.35.0-devnet-20261111140253 → 0.35.0-devnet-20261112024759

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 (152) hide show
  1. package/CHANGELOG.md +12 -2
  2. package/dist/client.d.ts +6 -0
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/client.js +6 -0
  5. package/dist/client.js.map +1 -1
  6. package/dist/gen/ai/v1/assistant_pb.d.ts +2 -2
  7. package/dist/gen/ai/v1/assistant_pb.js +2 -2
  8. package/dist/gen/index.d.ts +11 -11
  9. package/dist/gen/index.js +9 -9
  10. package/dist/gen/ledger/read/v1/ledger_read_pb.d.ts +1 -1
  11. package/dist/gen/orders/v1/orders_read_pb.d.ts +1 -1
  12. package/dist/index.d.ts +10 -2
  13. package/dist/services/accounts/accounts.d.ts +1 -1
  14. package/dist/services/accounts/accounts.js +1 -1
  15. package/dist/services/accounts/accounts.js.map +1 -1
  16. package/dist/services/address-book/address-book.schemas.d.ts +2 -2
  17. package/dist/services/api-keys/api-keys.d.ts +18 -3
  18. package/dist/services/api-keys/api-keys.d.ts.map +1 -1
  19. package/dist/services/api-keys/api-keys.js +27 -3
  20. package/dist/services/api-keys/api-keys.js.map +1 -1
  21. package/dist/services/api-keys/api-keys.schemas.d.ts +112 -1
  22. package/dist/services/api-keys/api-keys.schemas.d.ts.map +1 -1
  23. package/dist/services/api-keys/api-keys.schemas.js +26 -2
  24. package/dist/services/api-keys/api-keys.schemas.js.map +1 -1
  25. package/dist/services/api-keys/api-keys.types.d.ts +2 -2
  26. package/dist/services/api-keys/index.d.ts +2 -2
  27. package/dist/services/assistant/assistant-events.schemas.d.ts +4646 -0
  28. package/dist/services/assistant/assistant-events.schemas.d.ts.map +1 -0
  29. package/dist/services/assistant/assistant-events.schemas.js +485 -0
  30. package/dist/services/assistant/assistant-events.schemas.js.map +1 -0
  31. package/dist/services/assistant/assistant.codecs.d.ts +24 -0
  32. package/dist/services/assistant/assistant.codecs.d.ts.map +1 -0
  33. package/dist/services/assistant/assistant.codecs.js +88 -0
  34. package/dist/services/assistant/assistant.codecs.js.map +1 -0
  35. package/dist/services/assistant/assistant.d.ts +76 -0
  36. package/dist/services/assistant/assistant.d.ts.map +1 -0
  37. package/dist/services/assistant/assistant.js +133 -0
  38. package/dist/services/assistant/assistant.js.map +1 -0
  39. package/dist/services/assistant/assistant.schemas.d.ts +184 -0
  40. package/dist/services/assistant/assistant.schemas.d.ts.map +1 -0
  41. package/dist/services/assistant/assistant.schemas.js +135 -0
  42. package/dist/services/assistant/assistant.schemas.js.map +1 -0
  43. package/dist/services/assistant/assistant.types.d.ts +4 -0
  44. package/dist/services/assistant/service.d.ts +8 -0
  45. package/dist/services/assistant/service.d.ts.map +1 -0
  46. package/dist/services/assistant/service.js +9 -0
  47. package/dist/services/assistant/service.js.map +1 -0
  48. package/dist/services/auth/profile/profile.d.ts +2 -2
  49. package/dist/services/auth/profile/profile.js +2 -2
  50. package/dist/services/auth/profile/profile.js.map +1 -1
  51. package/dist/services/auto-withdraw/auto-withdraw.schemas.d.ts +19 -19
  52. package/dist/services/auto-withdraw/auto-withdraw.schemas.js +1 -1
  53. package/dist/services/balances/balances.js +1 -1
  54. package/dist/services/candles/candles.js +1 -1
  55. package/dist/services/candles/candles.schemas.js +5 -2
  56. package/dist/services/candles/candles.schemas.js.map +1 -1
  57. package/dist/services/changelog/changelog.schemas.d.ts +17 -17
  58. package/dist/services/checkpoints/checkpoints.d.ts +2 -2
  59. package/dist/services/checkpoints/checkpoints.js +2 -2
  60. package/dist/services/checkpoints/checkpoints.js.map +1 -1
  61. package/dist/services/checkpoints/checkpoints.schemas.d.ts +2 -2
  62. package/dist/services/deposit/deposit.d.ts +2 -2
  63. package/dist/services/deposit/deposit.js +2 -2
  64. package/dist/services/deposit/deposit.js.map +1 -1
  65. package/dist/services/guard-signer/guard-signer.d.ts +1 -1
  66. package/dist/services/guard-signer/guard-signer.js +1 -1
  67. package/dist/services/guard-signer/guard-signer.js.map +1 -1
  68. package/dist/services/heatmap/heatmap.schemas.d.ts +4 -4
  69. package/dist/services/internal-transfers/internal-transfers.schemas.d.ts +3 -3
  70. package/dist/services/lifecycle/lifecycle.schemas.d.ts +54 -54
  71. package/dist/services/market-data/market-data.js +1 -1
  72. package/dist/services/market-overview/market-overview.schemas.d.ts +1 -1
  73. package/dist/services/orderbook/orderbook.schemas.d.ts +1 -1
  74. package/dist/services/orders/order-errors.schemas.d.ts +1 -1
  75. package/dist/services/orders/orders-batch.schemas.d.ts +32 -32
  76. package/dist/services/orders/orders-input.schemas.d.ts +4 -4
  77. package/dist/services/orders/orders-input.schemas.js +1 -1
  78. package/dist/services/orders/orders-modify.schemas.js +1 -1
  79. package/dist/services/orders/orders-output.schemas.d.ts +25 -25
  80. package/dist/services/orders/orders-output.schemas.js +3 -3
  81. package/dist/services/orders/orders-risk.schemas.js +1 -1
  82. package/dist/services/orders/orders.codecs.js +1 -1
  83. package/dist/services/orders/orders.js +3 -3
  84. package/dist/services/policies/api-key-policies/api-key-policies.d.ts +2 -2
  85. package/dist/services/policies/api-key-policies/api-key-policies.js +2 -2
  86. package/dist/services/policies/api-key-policies/api-key-policies.js.map +1 -1
  87. package/dist/services/policies/subaccount-policies/subaccount-policies.d.ts +2 -2
  88. package/dist/services/policies/subaccount-policies/subaccount-policies.js +2 -2
  89. package/dist/services/policies/subaccount-policies/subaccount-policies.js.map +1 -1
  90. package/dist/services/price-alerts/price-alerts.codecs.d.ts +20 -0
  91. package/dist/services/price-alerts/price-alerts.codecs.d.ts.map +1 -0
  92. package/dist/services/price-alerts/price-alerts.codecs.js +66 -0
  93. package/dist/services/price-alerts/price-alerts.codecs.js.map +1 -0
  94. package/dist/services/price-alerts/price-alerts.d.ts +38 -0
  95. package/dist/services/price-alerts/price-alerts.d.ts.map +1 -0
  96. package/dist/services/price-alerts/price-alerts.js +60 -0
  97. package/dist/services/price-alerts/price-alerts.js.map +1 -0
  98. package/dist/services/price-alerts/price-alerts.schemas.d.ts +309 -0
  99. package/dist/services/price-alerts/price-alerts.schemas.d.ts.map +1 -0
  100. package/dist/services/price-alerts/price-alerts.schemas.js +130 -0
  101. package/dist/services/price-alerts/price-alerts.schemas.js.map +1 -0
  102. package/dist/services/price-alerts/price-alerts.types.d.ts +3 -0
  103. package/dist/services/price-alerts/service.d.ts +8 -0
  104. package/dist/services/price-alerts/service.d.ts.map +1 -0
  105. package/dist/services/price-alerts/service.js +9 -0
  106. package/dist/services/price-alerts/service.js.map +1 -0
  107. package/dist/services/rewards/rewards.schemas.d.ts +4 -4
  108. package/dist/services/social-verification/social-verification.d.ts +1 -1
  109. package/dist/services/social-verification/social-verification.js +1 -1
  110. package/dist/services/social-verification/social-verification.js.map +1 -1
  111. package/dist/services/subaccounts/subaccounts.d.ts +6 -6
  112. package/dist/services/subaccounts/subaccounts.js +6 -6
  113. package/dist/services/subaccounts/subaccounts.js.map +1 -1
  114. package/dist/services/subaccounts/subaccounts.schemas.d.ts +21 -21
  115. package/dist/services/system/service.d.ts +8 -0
  116. package/dist/services/system/service.d.ts.map +1 -0
  117. package/dist/services/system/service.js +9 -0
  118. package/dist/services/system/service.js.map +1 -0
  119. package/dist/services/system/system.d.ts +25 -0
  120. package/dist/services/system/system.d.ts.map +1 -0
  121. package/dist/services/system/system.js +24 -0
  122. package/dist/services/system/system.js.map +1 -0
  123. package/dist/services/trades/trades.js +1 -1
  124. package/dist/services/trades/trades.schemas.d.ts +2 -2
  125. package/dist/services/trades/trades.schemas.js +1 -1
  126. package/dist/services/trading-withdraws/trading-withdraws.d.ts +1 -1
  127. package/dist/services/trading-withdraws/trading-withdraws.js +1 -1
  128. package/dist/services/trading-withdraws/trading-withdraws.js.map +1 -1
  129. package/dist/services/triggers/trigger-child-order.schemas.js +1 -1
  130. package/dist/services/triggers/trigger-input.schemas.d.ts +1 -1
  131. package/dist/services/triggers/trigger-input.schemas.js +1 -1
  132. package/dist/services/triggers/triggers-output.schemas.d.ts +63 -63
  133. package/dist/services/triggers/triggers.codecs.js +1 -1
  134. package/dist/services/triggers/triggers.js +2 -2
  135. package/dist/services/vip/vip.d.ts +1 -1
  136. package/dist/services/vip/vip.js +1 -1
  137. package/dist/services/vip/vip.js.map +1 -1
  138. package/dist/shared/connect-error-mapping.d.ts.map +1 -1
  139. package/dist/shared/connect-error-mapping.js +1 -0
  140. package/dist/shared/connect-error-mapping.js.map +1 -1
  141. package/dist/shared/error-detail.d.ts +18 -10
  142. package/dist/shared/error-detail.d.ts.map +1 -1
  143. package/dist/shared/error-detail.js +2 -0
  144. package/dist/shared/error-detail.js.map +1 -1
  145. package/dist/shared/error-details/alerts.js +15 -0
  146. package/dist/shared/error-details/alerts.js.map +1 -0
  147. package/dist/shared/error-details/assistant.js +15 -0
  148. package/dist/shared/error-details/assistant.js.map +1 -0
  149. package/dist/wired-services.d.ts.map +1 -1
  150. package/dist/wired-services.js +11 -5
  151. package/dist/wired-services.js.map +1 -1
  152. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"subaccount-policies.js","names":["#client","Proto.PolicyService","#realtime","#resolver","Proto.SubaccountPolicyViewSchema"],"sources":["../../../../src/services/policies/subaccount-policies/subaccount-policies.ts"],"sourcesContent":["import * as Proto from \"../../../gen/auth/v1/policies_pb.js\";\nimport { createClient, type Client } from \"@connectrpc/connect\";\nimport * as v from \"valibot\";\nimport { parse } from \"../../../shared/validation.js\";\nimport { removeUndefined } from \"../../../utils/remove-undefined.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../../shared/request-options.js\";\nimport type { BaseSubscribeInput } from \"../../../shared/types.js\";\nimport type { PolyesterRealtime } from \"../../../realtime/index.js\";\nimport type { AuthApiTransports } from \"../../../shared/transports.js\";\nimport { type SubaccountResolver, resolveAccountScopedInput } from \"../../subaccount-resolver.js\";\nimport {\n SubaccountPolicySchema,\n CreateSubaccountPolicyInputSchema,\n UpdateSubaccountPolicyInputSchema,\n PolicyIdSchema,\n ApplySubaccountPolicyInputSchema,\n type SubaccountPolicy,\n ListSubaccountPoliciesInputSchema,\n GetSubaccountPolicyInputSchema,\n} from \"./subaccount-policies.schemas.js\";\n\ninterface SubscribePoliciesInput extends BaseSubscribeInput<SubaccountPolicy> {\n accountId: string;\n}\n\n/**\n * Manages reusable subaccount policy templates, assignments, and realtime policy updates.\n */\nexport class SubaccountPoliciesService {\n #client: Client<typeof Proto.PolicyService>;\n #realtime: PolyesterRealtime;\n #resolver?: SubaccountResolver;\n\n constructor(\n transports: AuthApiTransports,\n realtime: PolyesterRealtime,\n resolver?: SubaccountResolver,\n ) {\n this.#client = createClient(Proto.PolicyService, transports.authApi);\n this.#realtime = realtime;\n this.#resolver = resolver;\n }\n\n /**\n * Returns subaccount policy templates visible to the caller, sorted by ascending policy ID.\n */\n async list(\n input: v.InferInput<typeof ListSubaccountPoliciesInputSchema> = {},\n options?: PolyesterRequestOptions,\n ): Promise<SubaccountPolicy[]> {\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const request = parse(ListSubaccountPoliciesInputSchema, resolved);\n const result = await this.#client.listSubaccountPolicies(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return parse(v.array(SubaccountPolicySchema), result.policies);\n }\n\n /**\n * Fetches one subaccount policy template by base58 policy ID and returns null when no policy is returned.\n */\n async get(\n input: v.InferInput<typeof GetSubaccountPolicyInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<SubaccountPolicy | null> {\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const request = parse(GetSubaccountPolicyInputSchema, resolved);\n const result = await this.#client.getSubaccountPolicy(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n if (!result.policy) return null;\n return parse(SubaccountPolicySchema, result.policy);\n }\n\n /**\n * Creates a subaccount policy template, optionally attaching it to a target subaccount in the same request.\n */\n async create(\n input: v.InferInput<typeof CreateSubaccountPolicyInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountPolicy> {\n const validatedInput = parse(CreateSubaccountPolicyInputSchema, input);\n const result = await this.#client.createSubaccountPolicy(\n removeUndefined(validatedInput),\n toConnectCallOptions(options),\n );\n if (!result.policy) throw new Error(\"Failed to create subaccount policy\");\n return parse(SubaccountPolicySchema, result.policy);\n }\n\n /**\n * Updates selected subaccount policy fields using optimistic concurrency.\n */\n async update(\n input: v.InferInput<typeof UpdateSubaccountPolicyInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountPolicy> {\n const validatedInput = parse(UpdateSubaccountPolicyInputSchema, input);\n const result = await this.#client.updateSubaccountPolicy(\n removeUndefined(validatedInput),\n toConnectCallOptions(options),\n );\n if (!result.policy) throw new Error(\"Failed to update subaccount policy\");\n return parse(SubaccountPolicySchema, result.policy);\n }\n\n /**\n * Deletes a subaccount policy template when it is not in use.\n */\n async delete(policyId: string, options?: PolyesterMutationOptions): Promise<void> {\n const validatedPolicyId = parse(PolicyIdSchema, policyId);\n await this.#client.deleteSubaccountPolicy(\n { policyId: validatedPolicyId },\n toConnectCallOptions(options),\n );\n }\n\n /**\n * Attaches a policy to a subaccount. Passing a null policyId clears the explicit binding and restores the system read-only policy.\n */\n async apply(\n input: v.InferInput<typeof ApplySubaccountPolicyInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<void> {\n const validatedInput = parse(ApplySubaccountPolicyInputSchema, input);\n await this.#client.setSubaccountPolicy(\n removeUndefined(validatedInput),\n toConnectCallOptions(options),\n );\n }\n\n /**\n * Subscribes to private subaccount policy updates for an account and emits normalized policy views.\n */\n subscribePolicies(input: SubscribePoliciesInput) {\n const channel = `private:auth:subaccount-policies:${input.accountId}:proto`;\n\n return this.#realtime.connectProtoChannel({\n channel,\n schema: Proto.SubaccountPolicyViewSchema,\n onPublication: (data) => {\n const policy = parse(SubaccountPolicySchema, data);\n input.onEvent(policy);\n },\n onConnected: () => input.onOpen?.(),\n onDisconnected: () => input.onClose?.(),\n onError: input.onError,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;AAgCA,IAAa,4BAAb,MAAuC;CACnC;CACA;CACA;CAEA,YACI,YACA,UACA,UACF;EACE,KAAKA,UAAU,aAAaC,eAAqB,WAAW,OAAO;EACnE,KAAKC,YAAY;EACjB,KAAKC,YAAY;CACrB;;;;CAKA,MAAM,KACF,QAAgE,CAAC,GACjE,SAC2B;EAC3B,MAAM,WAAW,0BAA0B,OAAO,KAAKA,SAAS;EAChE,MAAM,UAAU,MAAM,mCAAmC,QAAQ;EACjE,MAAM,SAAS,MAAM,KAAKH,QAAQ,uBAC9B,gBAAgB,OAAO,GACvB,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,EAAE,MAAM,sBAAsB,GAAG,OAAO,QAAQ;CACjE;;;;CAKA,MAAM,IACF,OACA,SACgC;EAChC,MAAM,WAAW,0BAA0B,OAAO,KAAKG,SAAS;EAChE,MAAM,UAAU,MAAM,gCAAgC,QAAQ;EAC9D,MAAM,SAAS,MAAM,KAAKH,QAAQ,oBAC9B,gBAAgB,OAAO,GACvB,qBAAqB,OAAO,CAChC;EACA,IAAI,CAAC,OAAO,QAAQ,OAAO;EAC3B,OAAO,MAAM,wBAAwB,OAAO,MAAM;CACtD;;;;CAKA,MAAM,OACF,OACA,SACyB;EACzB,MAAM,iBAAiB,MAAM,mCAAmC,KAAK;EACrE,MAAM,SAAS,MAAM,KAAKA,QAAQ,uBAC9B,gBAAgB,cAAc,GAC9B,qBAAqB,OAAO,CAChC;EACA,IAAI,CAAC,OAAO,QAAQ,MAAM,IAAI,MAAM,oCAAoC;EACxE,OAAO,MAAM,wBAAwB,OAAO,MAAM;CACtD;;;;CAKA,MAAM,OACF,OACA,SACyB;EACzB,MAAM,iBAAiB,MAAM,mCAAmC,KAAK;EACrE,MAAM,SAAS,MAAM,KAAKA,QAAQ,uBAC9B,gBAAgB,cAAc,GAC9B,qBAAqB,OAAO,CAChC;EACA,IAAI,CAAC,OAAO,QAAQ,MAAM,IAAI,MAAM,oCAAoC;EACxE,OAAO,MAAM,wBAAwB,OAAO,MAAM;CACtD;;;;CAKA,MAAM,OAAO,UAAkB,SAAmD;EAC9E,MAAM,oBAAoB,MAAM,gBAAgB,QAAQ;EACxD,MAAM,KAAKA,QAAQ,uBACf,EAAE,UAAU,kBAAkB,GAC9B,qBAAqB,OAAO,CAChC;CACJ;;;;CAKA,MAAM,MACF,OACA,SACa;EACb,MAAM,iBAAiB,MAAM,kCAAkC,KAAK;EACpE,MAAM,KAAKA,QAAQ,oBACf,gBAAgB,cAAc,GAC9B,qBAAqB,OAAO,CAChC;CACJ;;;;CAKA,kBAAkB,OAA+B;EAC7C,MAAM,UAAU,oCAAoC,MAAM,UAAU;EAEpE,OAAO,KAAKE,UAAU,oBAAoB;GACtC;GACA,QAAQE;GACR,gBAAgB,SAAS;IACrB,MAAM,SAAS,MAAM,wBAAwB,IAAI;IACjD,MAAM,QAAQ,MAAM;GACxB;GACA,mBAAmB,MAAM,SAAS;GAClC,sBAAsB,MAAM,UAAU;GACtC,SAAS,MAAM;EACnB,CAAC;CACL;AACJ"}
1
+ {"version":3,"file":"subaccount-policies.js","names":["#client","Proto.PolicyService","#realtime","#resolver","Proto.SubaccountPolicyViewSchema"],"sources":["../../../../src/services/policies/subaccount-policies/subaccount-policies.ts"],"sourcesContent":["import * as Proto from \"../../../gen/auth/v1/policies_pb.js\";\nimport { createClient, type Client } from \"@connectrpc/connect\";\nimport * as v from \"valibot\";\nimport { parse } from \"../../../shared/validation.js\";\nimport { removeUndefined } from \"../../../utils/remove-undefined.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../../shared/request-options.js\";\nimport type { BaseSubscribeInput } from \"../../../shared/types.js\";\nimport type { PolyesterRealtime } from \"../../../realtime/index.js\";\nimport type { AuthApiTransports } from \"../../../shared/transports.js\";\nimport { type SubaccountResolver, resolveAccountScopedInput } from \"../../subaccount-resolver.js\";\nimport {\n SubaccountPolicySchema,\n CreateSubaccountPolicyInputSchema,\n UpdateSubaccountPolicyInputSchema,\n PolicyIdSchema,\n ApplySubaccountPolicyInputSchema,\n type SubaccountPolicy,\n ListSubaccountPoliciesInputSchema,\n GetSubaccountPolicyInputSchema,\n} from \"./subaccount-policies.schemas.js\";\n\ninterface SubscribePoliciesInput extends BaseSubscribeInput<SubaccountPolicy> {\n accountId: string;\n}\n\n/**\n * Manages reusable subaccount policy templates, assignments, and realtime policy updates.\n */\nexport class SubaccountPoliciesService {\n #client: Client<typeof Proto.PolicyService>;\n #realtime: PolyesterRealtime;\n #resolver?: SubaccountResolver;\n\n constructor(\n transports: AuthApiTransports,\n realtime: PolyesterRealtime,\n resolver?: SubaccountResolver,\n ) {\n this.#client = createClient(Proto.PolicyService, transports.authApi);\n this.#realtime = realtime;\n this.#resolver = resolver;\n }\n\n /**\n * Returns subaccount policy templates visible to the caller, sorted by ascending policy ID. API keys need `read-subaccount-policies`; a key scoped to a sub-account sees only that sub-account's policy.\n */\n async list(\n input: v.InferInput<typeof ListSubaccountPoliciesInputSchema> = {},\n options?: PolyesterRequestOptions,\n ): Promise<SubaccountPolicy[]> {\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const request = parse(ListSubaccountPoliciesInputSchema, resolved);\n const result = await this.#client.listSubaccountPolicies(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return parse(v.array(SubaccountPolicySchema), result.policies);\n }\n\n /**\n * Fetches one subaccount policy template by base58 policy ID and returns null when no policy is returned. API keys need `read-subaccount-policies`.\n */\n async get(\n input: v.InferInput<typeof GetSubaccountPolicyInputSchema>,\n options?: PolyesterRequestOptions,\n ): Promise<SubaccountPolicy | null> {\n const resolved = resolveAccountScopedInput(input, this.#resolver);\n const request = parse(GetSubaccountPolicyInputSchema, resolved);\n const result = await this.#client.getSubaccountPolicy(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n if (!result.policy) return null;\n return parse(SubaccountPolicySchema, result.policy);\n }\n\n /**\n * Creates a subaccount policy template, optionally attaching it to a target subaccount in the same request.\n */\n async create(\n input: v.InferInput<typeof CreateSubaccountPolicyInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountPolicy> {\n const validatedInput = parse(CreateSubaccountPolicyInputSchema, input);\n const result = await this.#client.createSubaccountPolicy(\n removeUndefined(validatedInput),\n toConnectCallOptions(options),\n );\n if (!result.policy) throw new Error(\"Failed to create subaccount policy\");\n return parse(SubaccountPolicySchema, result.policy);\n }\n\n /**\n * Updates selected subaccount policy fields using optimistic concurrency.\n */\n async update(\n input: v.InferInput<typeof UpdateSubaccountPolicyInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<SubaccountPolicy> {\n const validatedInput = parse(UpdateSubaccountPolicyInputSchema, input);\n const result = await this.#client.updateSubaccountPolicy(\n removeUndefined(validatedInput),\n toConnectCallOptions(options),\n );\n if (!result.policy) throw new Error(\"Failed to update subaccount policy\");\n return parse(SubaccountPolicySchema, result.policy);\n }\n\n /**\n * Deletes a subaccount policy template when it is not in use.\n */\n async delete(policyId: string, options?: PolyesterMutationOptions): Promise<void> {\n const validatedPolicyId = parse(PolicyIdSchema, policyId);\n await this.#client.deleteSubaccountPolicy(\n { policyId: validatedPolicyId },\n toConnectCallOptions(options),\n );\n }\n\n /**\n * Attaches a policy to a subaccount. Passing a null policyId clears the explicit binding and restores the system read-only policy.\n */\n async apply(\n input: v.InferInput<typeof ApplySubaccountPolicyInputSchema>,\n options?: PolyesterMutationOptions,\n ): Promise<void> {\n const validatedInput = parse(ApplySubaccountPolicyInputSchema, input);\n await this.#client.setSubaccountPolicy(\n removeUndefined(validatedInput),\n toConnectCallOptions(options),\n );\n }\n\n /**\n * Subscribes to private subaccount policy updates for an account and emits normalized policy views.\n */\n subscribePolicies(input: SubscribePoliciesInput) {\n const channel = `private:auth:subaccount-policies:${input.accountId}:proto`;\n\n return this.#realtime.connectProtoChannel({\n channel,\n schema: Proto.SubaccountPolicyViewSchema,\n onPublication: (data) => {\n const policy = parse(SubaccountPolicySchema, data);\n input.onEvent(policy);\n },\n onConnected: () => input.onOpen?.(),\n onDisconnected: () => input.onClose?.(),\n onError: input.onError,\n });\n }\n}\n"],"mappings":";;;;;;;;;;;;AAgCA,IAAa,4BAAb,MAAuC;CACnC;CACA;CACA;CAEA,YACI,YACA,UACA,UACF;EACE,KAAKA,UAAU,aAAaC,eAAqB,WAAW,OAAO;EACnE,KAAKC,YAAY;EACjB,KAAKC,YAAY;CACrB;;;;CAKA,MAAM,KACF,QAAgE,CAAC,GACjE,SAC2B;EAC3B,MAAM,WAAW,0BAA0B,OAAO,KAAKA,SAAS;EAChE,MAAM,UAAU,MAAM,mCAAmC,QAAQ;EACjE,MAAM,SAAS,MAAM,KAAKH,QAAQ,uBAC9B,gBAAgB,OAAO,GACvB,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,EAAE,MAAM,sBAAsB,GAAG,OAAO,QAAQ;CACjE;;;;CAKA,MAAM,IACF,OACA,SACgC;EAChC,MAAM,WAAW,0BAA0B,OAAO,KAAKG,SAAS;EAChE,MAAM,UAAU,MAAM,gCAAgC,QAAQ;EAC9D,MAAM,SAAS,MAAM,KAAKH,QAAQ,oBAC9B,gBAAgB,OAAO,GACvB,qBAAqB,OAAO,CAChC;EACA,IAAI,CAAC,OAAO,QAAQ,OAAO;EAC3B,OAAO,MAAM,wBAAwB,OAAO,MAAM;CACtD;;;;CAKA,MAAM,OACF,OACA,SACyB;EACzB,MAAM,iBAAiB,MAAM,mCAAmC,KAAK;EACrE,MAAM,SAAS,MAAM,KAAKA,QAAQ,uBAC9B,gBAAgB,cAAc,GAC9B,qBAAqB,OAAO,CAChC;EACA,IAAI,CAAC,OAAO,QAAQ,MAAM,IAAI,MAAM,oCAAoC;EACxE,OAAO,MAAM,wBAAwB,OAAO,MAAM;CACtD;;;;CAKA,MAAM,OACF,OACA,SACyB;EACzB,MAAM,iBAAiB,MAAM,mCAAmC,KAAK;EACrE,MAAM,SAAS,MAAM,KAAKA,QAAQ,uBAC9B,gBAAgB,cAAc,GAC9B,qBAAqB,OAAO,CAChC;EACA,IAAI,CAAC,OAAO,QAAQ,MAAM,IAAI,MAAM,oCAAoC;EACxE,OAAO,MAAM,wBAAwB,OAAO,MAAM;CACtD;;;;CAKA,MAAM,OAAO,UAAkB,SAAmD;EAC9E,MAAM,oBAAoB,MAAM,gBAAgB,QAAQ;EACxD,MAAM,KAAKA,QAAQ,uBACf,EAAE,UAAU,kBAAkB,GAC9B,qBAAqB,OAAO,CAChC;CACJ;;;;CAKA,MAAM,MACF,OACA,SACa;EACb,MAAM,iBAAiB,MAAM,kCAAkC,KAAK;EACpE,MAAM,KAAKA,QAAQ,oBACf,gBAAgB,cAAc,GAC9B,qBAAqB,OAAO,CAChC;CACJ;;;;CAKA,kBAAkB,OAA+B;EAC7C,MAAM,UAAU,oCAAoC,MAAM,UAAU;EAEpE,OAAO,KAAKE,UAAU,oBAAoB;GACtC;GACA,QAAQE;GACR,gBAAgB,SAAS;IACrB,MAAM,SAAS,MAAM,wBAAwB,IAAI;IACjD,MAAM,QAAQ,MAAM;GACxB;GACA,mBAAmB,MAAM,SAAS;GAClC,sBAAsB,MAAM,UAAU;GACtC,SAAS,MAAM;EACnB,CAAC;CACL;AACJ"}
@@ -0,0 +1,20 @@
1
+ import "../../gen/alerts/v1/price_alerts_pb.js";
2
+ //#region src/services/price-alerts/price-alerts.codecs.d.ts
3
+ declare const PRICE_ALERT_DIRECTION_VALUES: readonly ["above", "below"];
4
+ /** `above` fires at or above the alert price, `below` at or below it. */
5
+ type PriceAlertDirection = (typeof PRICE_ALERT_DIRECTION_VALUES)[number];
6
+ declare const PRICE_ALERT_PRICE_SOURCE_VALUES: readonly ["last_price", "index_price"];
7
+ type PriceAlertPriceSource = (typeof PRICE_ALERT_PRICE_SOURCE_VALUES)[number];
8
+ declare const PRICE_ALERT_STATUS_VALUES: readonly ["active", "triggered", "cancelled"];
9
+ type PriceAlertStatus = (typeof PRICE_ALERT_STATUS_VALUES)[number];
10
+ declare const PRICE_ALERT_CHANNEL_VALUES: readonly ["in_app", "telegram"];
11
+ type PriceAlertChannel = (typeof PRICE_ALERT_CHANNEL_VALUES)[number];
12
+ declare const PRICE_ALERT_UPDATE_OUTCOME_VALUES: readonly ["applied", "unchanged", "replayed"];
13
+ /**
14
+ * What an update did: `applied` changed the alert, `unchanged` found it already as requested,
15
+ * and `replayed` recognized a reused idempotency key and changed nothing.
16
+ */
17
+ type PriceAlertUpdateOutcome = (typeof PRICE_ALERT_UPDATE_OUTCOME_VALUES)[number];
18
+ //#endregion
19
+ export { PRICE_ALERT_CHANNEL_VALUES, PRICE_ALERT_DIRECTION_VALUES, PRICE_ALERT_PRICE_SOURCE_VALUES, PRICE_ALERT_STATUS_VALUES, PRICE_ALERT_UPDATE_OUTCOME_VALUES, PriceAlertChannel, PriceAlertDirection, PriceAlertPriceSource, PriceAlertStatus, PriceAlertUpdateOutcome };
20
+ //# sourceMappingURL=price-alerts.codecs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"price-alerts.codecs.d.ts","names":[],"sources":["../../../src/services/price-alerts/price-alerts.codecs.ts"],"mappings":";;cAGa;;KAED,8BAA8B;cAE7B;KACD,gCAAgC;cAE/B;KACD,2BAA2B;cAE1B;KACD,4BAA4B;cAE3B;;;;;KAKD,kCAAkC"}
@@ -0,0 +1,66 @@
1
+ import "../../gen/alerts/v1/price_alerts_pb.js";
2
+ //#region src/services/price-alerts/price-alerts.codecs.ts
3
+ const PRICE_ALERT_DIRECTION_VALUES = ["above", "below"];
4
+ const PRICE_ALERT_PRICE_SOURCE_VALUES = ["last_price", "index_price"];
5
+ const PRICE_ALERT_STATUS_VALUES = [
6
+ "active",
7
+ "triggered",
8
+ "cancelled"
9
+ ];
10
+ const PRICE_ALERT_CHANNEL_VALUES = ["in_app", "telegram"];
11
+ const PriceAlertDirectionCodec = {
12
+ inputToProto: {
13
+ above: 1,
14
+ below: 2
15
+ },
16
+ protoToOutput: {
17
+ [0]: "unspecified",
18
+ [1]: "above",
19
+ [2]: "below"
20
+ }
21
+ };
22
+ const PriceAlertPriceSourceCodec = {
23
+ inputToProto: {
24
+ last_price: 1,
25
+ index_price: 2
26
+ },
27
+ protoToOutput: {
28
+ [0]: "unspecified",
29
+ [1]: "last_price",
30
+ [2]: "index_price"
31
+ }
32
+ };
33
+ const PriceAlertStatusCodec = {
34
+ inputToProto: {
35
+ active: 1,
36
+ triggered: 2,
37
+ cancelled: 3
38
+ },
39
+ protoToOutput: {
40
+ [0]: "unspecified",
41
+ [1]: "active",
42
+ [2]: "triggered",
43
+ [3]: "cancelled"
44
+ }
45
+ };
46
+ const PriceAlertChannelCodec = {
47
+ inputToProto: {
48
+ in_app: 1,
49
+ telegram: 2
50
+ },
51
+ protoToOutput: {
52
+ [0]: "unspecified",
53
+ [1]: "in_app",
54
+ [2]: "telegram"
55
+ }
56
+ };
57
+ const PriceAlertUpdateOutcomeCodec = { protoToOutput: {
58
+ [0]: "unspecified",
59
+ [1]: "applied",
60
+ [2]: "unchanged",
61
+ [3]: "replayed"
62
+ } };
63
+ //#endregion
64
+ export { PRICE_ALERT_CHANNEL_VALUES, PRICE_ALERT_DIRECTION_VALUES, PRICE_ALERT_PRICE_SOURCE_VALUES, PRICE_ALERT_STATUS_VALUES, PriceAlertChannelCodec, PriceAlertDirectionCodec, PriceAlertPriceSourceCodec, PriceAlertStatusCodec, PriceAlertUpdateOutcomeCodec };
65
+
66
+ //# sourceMappingURL=price-alerts.codecs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"price-alerts.codecs.js","names":[],"sources":["../../../src/services/price-alerts/price-alerts.codecs.ts"],"sourcesContent":["import * as Proto from \"../../gen/alerts/v1/price_alerts_pb.js\";\nimport type { InputToProto, ProtoToOutput } from \"../../utils/types.js\";\n\nexport const PRICE_ALERT_DIRECTION_VALUES = [\"above\", \"below\"] as const;\n/** `above` fires at or above the alert price, `below` at or below it. */\nexport type PriceAlertDirection = (typeof PRICE_ALERT_DIRECTION_VALUES)[number];\n\nexport const PRICE_ALERT_PRICE_SOURCE_VALUES = [\"last_price\", \"index_price\"] as const;\nexport type PriceAlertPriceSource = (typeof PRICE_ALERT_PRICE_SOURCE_VALUES)[number];\n\nexport const PRICE_ALERT_STATUS_VALUES = [\"active\", \"triggered\", \"cancelled\"] as const;\nexport type PriceAlertStatus = (typeof PRICE_ALERT_STATUS_VALUES)[number];\n\nexport const PRICE_ALERT_CHANNEL_VALUES = [\"in_app\", \"telegram\"] as const;\nexport type PriceAlertChannel = (typeof PRICE_ALERT_CHANNEL_VALUES)[number];\n\nexport const PRICE_ALERT_UPDATE_OUTCOME_VALUES = [\"applied\", \"unchanged\", \"replayed\"] as const;\n/**\n * What an update did: `applied` changed the alert, `unchanged` found it already as requested,\n * and `replayed` recognized a reused idempotency key and changed nothing.\n */\nexport type PriceAlertUpdateOutcome = (typeof PRICE_ALERT_UPDATE_OUTCOME_VALUES)[number];\n\nexport const PriceAlertDirectionCodec = {\n inputToProto: {\n above: Proto.AlertDirection.ABOVE,\n below: Proto.AlertDirection.BELOW,\n } satisfies InputToProto<PriceAlertDirection, Proto.AlertDirection>,\n protoToOutput: {\n [Proto.AlertDirection.DIRECTION_UNSPECIFIED]: \"unspecified\",\n [Proto.AlertDirection.ABOVE]: \"above\",\n [Proto.AlertDirection.BELOW]: \"below\",\n } satisfies ProtoToOutput<Proto.AlertDirection, PriceAlertDirection>,\n} as const;\n\nexport const PriceAlertPriceSourceCodec = {\n inputToProto: {\n last_price: Proto.AlertPriceSource.LAST_PRICE,\n index_price: Proto.AlertPriceSource.INDEX_PRICE,\n } satisfies InputToProto<PriceAlertPriceSource, Proto.AlertPriceSource>,\n protoToOutput: {\n [Proto.AlertPriceSource.PRICE_SOURCE_UNSPECIFIED]: \"unspecified\",\n [Proto.AlertPriceSource.LAST_PRICE]: \"last_price\",\n [Proto.AlertPriceSource.INDEX_PRICE]: \"index_price\",\n } satisfies ProtoToOutput<Proto.AlertPriceSource, PriceAlertPriceSource>,\n} as const;\n\nexport const PriceAlertStatusCodec = {\n inputToProto: {\n active: Proto.AlertStatus.ACTIVE,\n triggered: Proto.AlertStatus.TRIGGERED,\n cancelled: Proto.AlertStatus.CANCELLED,\n } satisfies InputToProto<PriceAlertStatus, Proto.AlertStatus>,\n protoToOutput: {\n [Proto.AlertStatus.STATUS_UNSPECIFIED]: \"unspecified\",\n [Proto.AlertStatus.ACTIVE]: \"active\",\n [Proto.AlertStatus.TRIGGERED]: \"triggered\",\n [Proto.AlertStatus.CANCELLED]: \"cancelled\",\n } satisfies ProtoToOutput<Proto.AlertStatus, PriceAlertStatus>,\n} as const;\n\nexport const PriceAlertChannelCodec = {\n inputToProto: {\n in_app: Proto.AlertChannel.IN_APP,\n telegram: Proto.AlertChannel.TELEGRAM,\n } satisfies InputToProto<PriceAlertChannel, Proto.AlertChannel>,\n protoToOutput: {\n [Proto.AlertChannel.CHANNEL_UNSPECIFIED]: \"unspecified\",\n [Proto.AlertChannel.IN_APP]: \"in_app\",\n [Proto.AlertChannel.TELEGRAM]: \"telegram\",\n } satisfies ProtoToOutput<Proto.AlertChannel, PriceAlertChannel>,\n} as const;\n\nexport const PriceAlertUpdateOutcomeCodec = {\n protoToOutput: {\n [Proto.UpdateOutcome.UPDATE_OUTCOME_UNSPECIFIED]: \"unspecified\",\n [Proto.UpdateOutcome.APPLIED]: \"applied\",\n [Proto.UpdateOutcome.UNCHANGED]: \"unchanged\",\n [Proto.UpdateOutcome.REPLAYED]: \"replayed\",\n } satisfies ProtoToOutput<Proto.UpdateOutcome, PriceAlertUpdateOutcome>,\n} as const;\n"],"mappings":";;AAGA,MAAa,+BAA+B,CAAC,SAAS,OAAO;AAI7D,MAAa,kCAAkC,CAAC,cAAc,aAAa;AAG3E,MAAa,4BAA4B;CAAC;CAAU;CAAa;AAAW;AAG5E,MAAa,6BAA6B,CAAC,UAAU,UAAU;AAU/D,MAAa,2BAA2B;CACpC,cAAc;EACV,OAAA;EACA,OAAA;CACJ;CACA,eAAe;GACmC,IAAA;GAChB,IAAA;GACA,IAAA;CAClC;AACJ;AAEA,MAAa,6BAA6B;CACtC,cAAc;EACV,YAAA;EACA,aAAA;CACJ;CACA,eAAe;GACwC,IAAA;GACd,IAAA;GACC,IAAA;CAC1C;AACJ;AAEA,MAAa,wBAAwB;CACjC,cAAc;EACV,QAAA;EACA,WAAA;EACA,WAAA;CACJ;CACA,eAAe;GAC6B,IAAA;GACZ,IAAA;GACG,IAAA;GACA,IAAA;CACnC;AACJ;AAEA,MAAa,yBAAyB;CAClC,cAAc;EACV,QAAA;EACA,UAAA;CACJ;CACA,eAAe;GAC+B,IAAA;GACb,IAAA;GACE,IAAA;CACnC;AACJ;AAEA,MAAa,+BAA+B,EACxC,eAAe;EACuC,IAAA;EACnB,IAAA;EACE,IAAA;EACD,IAAA;AACpC,EACJ"}
@@ -0,0 +1,38 @@
1
+ import { AuthApiTransports } from "../../shared/transports.js";
2
+ import { PolyesterRequestOptions } from "../../shared/request-options.js";
3
+ import { CancelPriceAlertInput, CreatePriceAlertInput, ListPriceAlertsInput, ListPriceAlertsResult, PriceAlert, UpdatePriceAlertInput, UpdatePriceAlertResult } from "./price-alerts.schemas.js";
4
+ //#region src/services/price-alerts/price-alerts.d.ts
5
+ /**
6
+ * Manages the caller's price alerts. Alerts belong to the root account, not a trading account:
7
+ * a session and the root account's API keys see the same alerts, and an API key scoped to a
8
+ * subaccount is refused (`PermissionError`, detail `SUBACCOUNT_KEY_REFUSED`). An alert fires at
9
+ * most once, only on a crossing it observes from its `referencePrice`; `update` sets a fired
10
+ * alert again. No call changes balances, orders or account settings.
11
+ */
12
+ declare class PriceAlertsService {
13
+ #private;
14
+ constructor(transports: AuthApiTransports);
15
+ /**
16
+ * Creates an active alert. Throws `PreconditionFailedError` when the market has no index
17
+ * price (`PRICE_SOURCE_UNSUPPORTED`) or the active-alert limit is reached, and a retryable
18
+ * `ServiceUnavailableError` when the market has no current price yet.
19
+ */
20
+ create(input: CreatePriceAlertInput, options?: PolyesterRequestOptions): Promise<PriceAlert>;
21
+ /** Lists the caller's alerts, newest first. */
22
+ list(input?: ListPriceAlertsInput, options?: PolyesterRequestOptions): Promise<ListPriceAlertsResult>;
23
+ /**
24
+ * Changes an alert's direction, price or channels; omitted fields stay as they are. A new
25
+ * direction or price records a new reference price. Updating a triggered alert sets it
26
+ * again, even with no field given. A stale `expectedRevision` throws
27
+ * `RevisionConflictError`; a cancelled alert throws `PreconditionFailedError`.
28
+ */
29
+ update(input: UpdatePriceAlertInput, options?: PolyesterRequestOptions): Promise<UpdatePriceAlertResult>;
30
+ /**
31
+ * Cancels an active alert; cancelling a cancelled alert returns it unchanged. A triggered
32
+ * alert throws `PreconditionFailedError` (`ALERT_TRIGGERED`).
33
+ */
34
+ cancel(input: CancelPriceAlertInput, options?: PolyesterRequestOptions): Promise<PriceAlert>;
35
+ }
36
+ //#endregion
37
+ export { PriceAlertsService };
38
+ //# sourceMappingURL=price-alerts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"price-alerts.d.ts","names":[],"sources":["../../../src/services/price-alerts/price-alerts.ts"],"mappings":";;;;;;;;;;;cAiCa;;EAGG,YAAA,YAAY;;;;;;EASlB,OACF,OAAO,uBACP,UAAU,0BACX,QAAQ;;EAUL,KACF,QAAO,sBACP,UAAU,0BACX,QAAQ;;;;;;;EAeL,OACF,OAAO,uBACP,UAAU,0BACX,QAAQ;;;;;EAaL,OACF,OAAO,uBACP,UAAU,0BACX,QAAQ"}
@@ -0,0 +1,60 @@
1
+ import { parse } from "../../shared/validation.js";
2
+ import { removeUndefined } from "../../utils/remove-undefined.js";
3
+ import { toConnectCallOptions } from "../../shared/request-options.js";
4
+ import { PriceAlertService } from "../../gen/alerts/v1/price_alerts_pb.js";
5
+ import { CancelPriceAlertInputSchema, CreatePriceAlertInputSchema, ListPriceAlertsInputSchema, ListPriceAlertsResultSchema, PriceAlertSchema, UpdatePriceAlertInputSchema, UpdatePriceAlertResultSchema } from "./price-alerts.schemas.js";
6
+ import { createClient } from "@connectrpc/connect";
7
+ //#region src/services/price-alerts/price-alerts.ts
8
+ /**
9
+ * Manages the caller's price alerts. Alerts belong to the root account, not a trading account:
10
+ * a session and the root account's API keys see the same alerts, and an API key scoped to a
11
+ * subaccount is refused (`PermissionError`, detail `SUBACCOUNT_KEY_REFUSED`). An alert fires at
12
+ * most once, only on a crossing it observes from its `referencePrice`; `update` sets a fired
13
+ * alert again. No call changes balances, orders or account settings.
14
+ */
15
+ var PriceAlertsService = class {
16
+ #client;
17
+ constructor(transports) {
18
+ this.#client = createClient(PriceAlertService, transports.authApi);
19
+ }
20
+ /**
21
+ * Creates an active alert. Throws `PreconditionFailedError` when the market has no index
22
+ * price (`PRICE_SOURCE_UNSUPPORTED`) or the active-alert limit is reached, and a retryable
23
+ * `ServiceUnavailableError` when the market has no current price yet.
24
+ */
25
+ async create(input, options) {
26
+ const request = parse(CreatePriceAlertInputSchema, input);
27
+ const response = await this.#client.createAlert(removeUndefined(request), toConnectCallOptions(options));
28
+ return parse(PriceAlertSchema, response.alert);
29
+ }
30
+ /** Lists the caller's alerts, newest first. */
31
+ async list(input = {}, options) {
32
+ const request = parse(ListPriceAlertsInputSchema, input);
33
+ const response = await this.#client.listAlerts(removeUndefined(request), toConnectCallOptions(options));
34
+ return parse(ListPriceAlertsResultSchema, response);
35
+ }
36
+ /**
37
+ * Changes an alert's direction, price or channels; omitted fields stay as they are. A new
38
+ * direction or price records a new reference price. Updating a triggered alert sets it
39
+ * again, even with no field given. A stale `expectedRevision` throws
40
+ * `RevisionConflictError`; a cancelled alert throws `PreconditionFailedError`.
41
+ */
42
+ async update(input, options) {
43
+ const request = parse(UpdatePriceAlertInputSchema, input);
44
+ const response = await this.#client.updateAlert(removeUndefined(request), toConnectCallOptions(options));
45
+ return parse(UpdatePriceAlertResultSchema, response);
46
+ }
47
+ /**
48
+ * Cancels an active alert; cancelling a cancelled alert returns it unchanged. A triggered
49
+ * alert throws `PreconditionFailedError` (`ALERT_TRIGGERED`).
50
+ */
51
+ async cancel(input, options) {
52
+ const request = parse(CancelPriceAlertInputSchema, input);
53
+ const response = await this.#client.cancelAlert(request, toConnectCallOptions(options));
54
+ return parse(PriceAlertSchema, response.alert);
55
+ }
56
+ };
57
+ //#endregion
58
+ export { PriceAlertsService };
59
+
60
+ //# sourceMappingURL=price-alerts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"price-alerts.js","names":["#client","Proto.PriceAlertService"],"sources":["../../../src/services/price-alerts/price-alerts.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/alerts/v1/price_alerts_pb.js\";\nimport {\n toConnectCallOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport type { AuthApiTransports } from \"../../shared/transports.js\";\nimport { parse } from \"../../shared/validation.js\";\nimport { removeUndefined } from \"../../utils/remove-undefined.js\";\nimport {\n CancelPriceAlertInputSchema,\n CreatePriceAlertInputSchema,\n ListPriceAlertsInputSchema,\n ListPriceAlertsResultSchema,\n PriceAlertSchema,\n UpdatePriceAlertInputSchema,\n UpdatePriceAlertResultSchema,\n type CancelPriceAlertInput,\n type CreatePriceAlertInput,\n type ListPriceAlertsInput,\n type ListPriceAlertsResult,\n type PriceAlert,\n type UpdatePriceAlertInput,\n type UpdatePriceAlertResult,\n} from \"./price-alerts.schemas.js\";\n\n/**\n * Manages the caller's price alerts. Alerts belong to the root account, not a trading account:\n * a session and the root account's API keys see the same alerts, and an API key scoped to a\n * subaccount is refused (`PermissionError`, detail `SUBACCOUNT_KEY_REFUSED`). An alert fires at\n * most once, only on a crossing it observes from its `referencePrice`; `update` sets a fired\n * alert again. No call changes balances, orders or account settings.\n */\nexport class PriceAlertsService {\n #client: Client<typeof Proto.PriceAlertService>;\n\n constructor(transports: AuthApiTransports) {\n this.#client = createClient(Proto.PriceAlertService, transports.authApi);\n }\n\n /**\n * Creates an active alert. Throws `PreconditionFailedError` when the market has no index\n * price (`PRICE_SOURCE_UNSUPPORTED`) or the active-alert limit is reached, and a retryable\n * `ServiceUnavailableError` when the market has no current price yet.\n */\n async create(\n input: CreatePriceAlertInput,\n options?: PolyesterRequestOptions,\n ): Promise<PriceAlert> {\n const request = parse(CreatePriceAlertInputSchema, input);\n const response = await this.#client.createAlert(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return parse(PriceAlertSchema, response.alert);\n }\n\n /** Lists the caller's alerts, newest first. */\n async list(\n input: ListPriceAlertsInput = {},\n options?: PolyesterRequestOptions,\n ): Promise<ListPriceAlertsResult> {\n const request = parse(ListPriceAlertsInputSchema, input);\n const response = await this.#client.listAlerts(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return parse(ListPriceAlertsResultSchema, response);\n }\n\n /**\n * Changes an alert's direction, price or channels; omitted fields stay as they are. A new\n * direction or price records a new reference price. Updating a triggered alert sets it\n * again, even with no field given. A stale `expectedRevision` throws\n * `RevisionConflictError`; a cancelled alert throws `PreconditionFailedError`.\n */\n async update(\n input: UpdatePriceAlertInput,\n options?: PolyesterRequestOptions,\n ): Promise<UpdatePriceAlertResult> {\n const request = parse(UpdatePriceAlertInputSchema, input);\n const response = await this.#client.updateAlert(\n removeUndefined(request),\n toConnectCallOptions(options),\n );\n return parse(UpdatePriceAlertResultSchema, response);\n }\n\n /**\n * Cancels an active alert; cancelling a cancelled alert returns it unchanged. A triggered\n * alert throws `PreconditionFailedError` (`ALERT_TRIGGERED`).\n */\n async cancel(\n input: CancelPriceAlertInput,\n options?: PolyesterRequestOptions,\n ): Promise<PriceAlert> {\n const request = parse(CancelPriceAlertInputSchema, input);\n const response = await this.#client.cancelAlert(request, toConnectCallOptions(options));\n return parse(PriceAlertSchema, response.alert);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;AAiCA,IAAa,qBAAb,MAAgC;CAC5B;CAEA,YAAY,YAA+B;EACvC,KAAKA,UAAU,aAAaC,mBAAyB,WAAW,OAAO;CAC3E;;;;;;CAOA,MAAM,OACF,OACA,SACmB;EACnB,MAAM,UAAU,MAAM,6BAA6B,KAAK;EACxD,MAAM,WAAW,MAAM,KAAKD,QAAQ,YAChC,gBAAgB,OAAO,GACvB,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,kBAAkB,SAAS,KAAK;CACjD;;CAGA,MAAM,KACF,QAA8B,CAAC,GAC/B,SAC8B;EAC9B,MAAM,UAAU,MAAM,4BAA4B,KAAK;EACvD,MAAM,WAAW,MAAM,KAAKA,QAAQ,WAChC,gBAAgB,OAAO,GACvB,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,6BAA6B,QAAQ;CACtD;;;;;;;CAQA,MAAM,OACF,OACA,SAC+B;EAC/B,MAAM,UAAU,MAAM,6BAA6B,KAAK;EACxD,MAAM,WAAW,MAAM,KAAKA,QAAQ,YAChC,gBAAgB,OAAO,GACvB,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,8BAA8B,QAAQ;CACvD;;;;;CAMA,MAAM,OACF,OACA,SACmB;EACnB,MAAM,UAAU,MAAM,6BAA6B,KAAK;EACxD,MAAM,WAAW,MAAM,KAAKA,QAAQ,YAAY,SAAS,qBAAqB,OAAO,CAAC;EACtF,OAAO,MAAM,kBAAkB,SAAS,KAAK;CACjD;AACJ"}
@@ -0,0 +1,309 @@
1
+ import { AlertChannel, AlertDirection, AlertPriceSource, AlertStatus } from "../../gen/alerts/v1/price_alerts_pb.js";
2
+ import * as v from "valibot";
3
+ //#region src/services/price-alerts/price-alerts.schemas.d.ts
4
+ declare const CreatePriceAlertInputSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
5
+ readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
6
+ readonly direction: v.PicklistSchema<readonly ["above", "below"], undefined>;
7
+ /** Omit to watch the index price on markets that have one, else the last price. */
8
+ readonly priceSource: v.OptionalSchema<v.PicklistSchema<readonly ["last_price", "index_price"], undefined>, undefined>;
9
+ /** Alert price as a decimal string, e.g. `"90000"`. */
10
+ readonly price: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TransformAction<string, bigint>]>;
11
+ readonly channels: v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<readonly ["in_app", "telegram"], undefined>, undefined>, v.MinLengthAction<("telegram" | "in_app")[], 1, "At least one channel is required.">, v.MaxLengthAction<("telegram" | "in_app")[], 2, "At most two channels are allowed.">, v.CheckAction<("telegram" | "in_app")[], "Channels must be distinct.">, v.TransformAction<("telegram" | "in_app")[], (AlertChannel.IN_APP | AlertChannel.TELEGRAM)[]>]>;
12
+ /** Reusing a key with the same request returns the alert it created. */
13
+ readonly idempotencyKey: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>, undefined>;
14
+ }, undefined>, v.TransformAction<{
15
+ symbolId: number;
16
+ direction: "above" | "below";
17
+ priceSource?: "last_price" | "index_price" | undefined;
18
+ price: bigint;
19
+ channels: (AlertChannel.IN_APP | AlertChannel.TELEGRAM)[];
20
+ idempotencyKey?: string | undefined;
21
+ }, {
22
+ direction: AlertDirection.ABOVE | AlertDirection.BELOW;
23
+ priceSource: AlertPriceSource.LAST_PRICE | AlertPriceSource.INDEX_PRICE | undefined;
24
+ priceTicks: bigint;
25
+ symbolId: number;
26
+ channels: (AlertChannel.IN_APP | AlertChannel.TELEGRAM)[];
27
+ idempotencyKey?: string | undefined;
28
+ }>]>;
29
+ type CreatePriceAlertInput = v.InferInput<typeof CreatePriceAlertInputSchema>;
30
+ declare const ListPriceAlertsInputSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
31
+ /** Only alerts in these states; omit or empty for every state. */
32
+ readonly statuses: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["active", "triggered", "cancelled"], undefined>, undefined>, undefined>;
33
+ /** Only alerts on this market. */
34
+ readonly symbolId: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>, undefined>;
35
+ /** Page size: default 50, at most 200. */
36
+ readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 1, undefined>, v.MaxValueAction<number, 200, undefined>]>, undefined>;
37
+ /** Previous `nextPageToken`; reuse only with the same filters. */
38
+ readonly pageToken: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>;
39
+ }, undefined>, v.TransformAction<{
40
+ statuses?: ("active" | "triggered" | "cancelled")[] | undefined;
41
+ symbolId?: number | undefined;
42
+ limit?: number | undefined;
43
+ pageToken?: string | undefined;
44
+ }, {
45
+ statuses: (AlertStatus.ACTIVE | AlertStatus.TRIGGERED | AlertStatus.CANCELLED)[] | undefined;
46
+ symbolId?: number | undefined;
47
+ limit?: number | undefined;
48
+ pageToken?: string | undefined;
49
+ }>]>;
50
+ type ListPriceAlertsInput = v.InferInput<typeof ListPriceAlertsInputSchema>;
51
+ declare const UpdatePriceAlertInputSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
52
+ readonly alertId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>;
53
+ /** The alert's `revision` from the last read. */
54
+ readonly expectedRevision: v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, v.RegexAction<string, `${string} must be a decimal integer`>, v.TransformAction<string, bigint>]>, v.CheckAction<bigint, `${string} must be greater than 0`>]>, v.MaxValueAction<bigint, 18446744073709551615n, "expectedRevision exceeds the uint64 range">]>;
55
+ readonly direction: v.OptionalSchema<v.PicklistSchema<readonly ["above", "below"], undefined>, undefined>;
56
+ readonly price: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TransformAction<string, bigint>]>, undefined>;
57
+ readonly channels: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ArraySchema<v.PicklistSchema<readonly ["in_app", "telegram"], undefined>, undefined>, v.MinLengthAction<("telegram" | "in_app")[], 1, "At least one channel is required.">, v.MaxLengthAction<("telegram" | "in_app")[], 2, "At most two channels are allowed.">, v.CheckAction<("telegram" | "in_app")[], "Channels must be distinct.">, v.TransformAction<("telegram" | "in_app")[], (AlertChannel.IN_APP | AlertChannel.TELEGRAM)[]>]>, undefined>;
58
+ readonly idempotencyKey: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>]>, undefined>;
59
+ }, undefined>, v.TransformAction<{
60
+ alertId: bigint;
61
+ expectedRevision: bigint;
62
+ direction?: "above" | "below" | undefined;
63
+ price?: bigint | undefined;
64
+ channels?: (AlertChannel.IN_APP | AlertChannel.TELEGRAM)[] | undefined;
65
+ idempotencyKey?: string | undefined;
66
+ }, {
67
+ alertId: bigint;
68
+ expectedRevision: bigint;
69
+ idempotencyKey: string | undefined;
70
+ update: Partial<{
71
+ direction: AlertDirection.ABOVE | AlertDirection.BELOW;
72
+ } & {
73
+ priceTicks: bigint;
74
+ } & {
75
+ channels: number[];
76
+ }>;
77
+ updateMask: {
78
+ paths: string[];
79
+ };
80
+ }>]>;
81
+ type UpdatePriceAlertInput = v.InferInput<typeof UpdatePriceAlertInputSchema>;
82
+ declare const CancelPriceAlertInputSchema: v.StrictObjectSchema<{
83
+ readonly alertId: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction, v.MinLengthAction<string, 1, undefined>, v.TransformAction<string, bigint>]>;
84
+ }, undefined>;
85
+ type CancelPriceAlertInput = v.InferInput<typeof CancelPriceAlertInputSchema>;
86
+ /** A price alert of the caller's root account. Prices are decimal strings. */
87
+ declare const PriceAlertSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
88
+ readonly alertId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
89
+ readonly symbolId: v.NumberSchema<undefined>;
90
+ readonly direction: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "above" | "below">]>;
91
+ readonly priceSource: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "last_price" | "index_price">]>;
92
+ readonly priceTicks: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
93
+ readonly referencePriceTicks: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
94
+ readonly armed: v.BooleanSchema<undefined>;
95
+ readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "active" | "triggered" | "cancelled">]>;
96
+ readonly channels: v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "telegram" | "in_app">]>, undefined>;
97
+ readonly revision: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
98
+ readonly createdAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
99
+ readonly seconds: v.BigintSchema<undefined>;
100
+ readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
101
+ }, undefined>, undefined>, v.TransformAction<{
102
+ seconds: bigint;
103
+ nanos: number;
104
+ } | undefined, number | undefined>]>;
105
+ readonly updatedAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
106
+ readonly seconds: v.BigintSchema<undefined>;
107
+ readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
108
+ }, undefined>, undefined>, v.TransformAction<{
109
+ seconds: bigint;
110
+ nanos: number;
111
+ } | undefined, number | undefined>]>;
112
+ readonly triggeredAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
113
+ readonly seconds: v.BigintSchema<undefined>;
114
+ readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
115
+ }, undefined>, undefined>, v.TransformAction<{
116
+ seconds: bigint;
117
+ nanos: number;
118
+ } | undefined, number | undefined>]>;
119
+ readonly triggeredPriceTicks: v.BigintSchema<undefined>;
120
+ }, undefined>, v.TransformAction<{
121
+ alertId: string;
122
+ symbolId: number;
123
+ direction: "unspecified" | "above" | "below";
124
+ priceSource: "unspecified" | "last_price" | "index_price";
125
+ priceTicks: string;
126
+ referencePriceTicks: string;
127
+ armed: boolean;
128
+ status: "unspecified" | "active" | "triggered" | "cancelled";
129
+ channels: ("unspecified" | "telegram" | "in_app")[];
130
+ revision: string;
131
+ createdAt?: number | undefined;
132
+ updatedAt?: number | undefined;
133
+ triggeredAt?: number | undefined;
134
+ triggeredPriceTicks: bigint;
135
+ }, {
136
+ alertId: string;
137
+ symbolId: number;
138
+ direction: "unspecified" | "above" | "below";
139
+ priceSource: "unspecified" | "last_price" | "index_price";
140
+ /** Alert price. */
141
+ price: string;
142
+ /** Price when the alert was created or last set again; it fires on a crossing from here. */
143
+ referencePrice: string;
144
+ /** False while an alert created past its price waits for the price to move back first. */
145
+ armed: boolean;
146
+ status: "unspecified" | "active" | "triggered" | "cancelled";
147
+ channels: ("unspecified" | "telegram" | "in_app")[];
148
+ /** Pass as `expectedRevision` to `update`. */
149
+ revision: string;
150
+ createdAt: number | null;
151
+ updatedAt: number | null;
152
+ /** Set only once the alert fired. */
153
+ triggeredAt: number | null;
154
+ /** Price that fired the alert; null unless it fired. */
155
+ triggeredPrice: string | null;
156
+ }>]>;
157
+ type PriceAlert = v.InferOutput<typeof PriceAlertSchema>;
158
+ declare const ListPriceAlertsResultSchema: v.ObjectSchema<{
159
+ readonly alerts: v.ArraySchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
160
+ readonly alertId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
161
+ readonly symbolId: v.NumberSchema<undefined>;
162
+ readonly direction: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "above" | "below">]>;
163
+ readonly priceSource: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "last_price" | "index_price">]>;
164
+ readonly priceTicks: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
165
+ readonly referencePriceTicks: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
166
+ readonly armed: v.BooleanSchema<undefined>;
167
+ readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "active" | "triggered" | "cancelled">]>;
168
+ readonly channels: v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "telegram" | "in_app">]>, undefined>;
169
+ readonly revision: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
170
+ readonly createdAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
171
+ readonly seconds: v.BigintSchema<undefined>;
172
+ readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
173
+ }, undefined>, undefined>, v.TransformAction<{
174
+ seconds: bigint;
175
+ nanos: number;
176
+ } | undefined, number | undefined>]>;
177
+ readonly updatedAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
178
+ readonly seconds: v.BigintSchema<undefined>;
179
+ readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
180
+ }, undefined>, undefined>, v.TransformAction<{
181
+ seconds: bigint;
182
+ nanos: number;
183
+ } | undefined, number | undefined>]>;
184
+ readonly triggeredAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
185
+ readonly seconds: v.BigintSchema<undefined>;
186
+ readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
187
+ }, undefined>, undefined>, v.TransformAction<{
188
+ seconds: bigint;
189
+ nanos: number;
190
+ } | undefined, number | undefined>]>;
191
+ readonly triggeredPriceTicks: v.BigintSchema<undefined>;
192
+ }, undefined>, v.TransformAction<{
193
+ alertId: string;
194
+ symbolId: number;
195
+ direction: "unspecified" | "above" | "below";
196
+ priceSource: "unspecified" | "last_price" | "index_price";
197
+ priceTicks: string;
198
+ referencePriceTicks: string;
199
+ armed: boolean;
200
+ status: "unspecified" | "active" | "triggered" | "cancelled";
201
+ channels: ("unspecified" | "telegram" | "in_app")[];
202
+ revision: string;
203
+ createdAt?: number | undefined;
204
+ updatedAt?: number | undefined;
205
+ triggeredAt?: number | undefined;
206
+ triggeredPriceTicks: bigint;
207
+ }, {
208
+ alertId: string;
209
+ symbolId: number;
210
+ direction: "unspecified" | "above" | "below";
211
+ priceSource: "unspecified" | "last_price" | "index_price";
212
+ /** Alert price. */
213
+ price: string;
214
+ /** Price when the alert was created or last set again; it fires on a crossing from here. */
215
+ referencePrice: string;
216
+ /** False while an alert created past its price waits for the price to move back first. */
217
+ armed: boolean;
218
+ status: "unspecified" | "active" | "triggered" | "cancelled";
219
+ channels: ("unspecified" | "telegram" | "in_app")[];
220
+ /** Pass as `expectedRevision` to `update`. */
221
+ revision: string;
222
+ createdAt: number | null;
223
+ updatedAt: number | null;
224
+ /** Set only once the alert fired. */
225
+ triggeredAt: number | null;
226
+ /** Price that fired the alert; null unless it fired. */
227
+ triggeredPrice: string | null;
228
+ }>]>, undefined>;
229
+ readonly nextPageToken: v.OptionalSchema<v.StringSchema<undefined>, "">;
230
+ }, undefined>;
231
+ /** One page of alerts, newest first; an empty `nextPageToken` means no more. */
232
+ type ListPriceAlertsResult = v.InferOutput<typeof ListPriceAlertsResultSchema>;
233
+ declare const UpdatePriceAlertResultSchema: v.ObjectSchema<{
234
+ readonly alert: v.SchemaWithPipe<readonly [v.ObjectSchema<{
235
+ readonly alertId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
236
+ readonly symbolId: v.NumberSchema<undefined>;
237
+ readonly direction: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "above" | "below">]>;
238
+ readonly priceSource: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "last_price" | "index_price">]>;
239
+ readonly priceTicks: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
240
+ readonly referencePriceTicks: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
241
+ readonly armed: v.BooleanSchema<undefined>;
242
+ readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "active" | "triggered" | "cancelled">]>;
243
+ readonly channels: v.ArraySchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "telegram" | "in_app">]>, undefined>;
244
+ readonly revision: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
245
+ readonly createdAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
246
+ readonly seconds: v.BigintSchema<undefined>;
247
+ readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
248
+ }, undefined>, undefined>, v.TransformAction<{
249
+ seconds: bigint;
250
+ nanos: number;
251
+ } | undefined, number | undefined>]>;
252
+ readonly updatedAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
253
+ readonly seconds: v.BigintSchema<undefined>;
254
+ readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
255
+ }, undefined>, undefined>, v.TransformAction<{
256
+ seconds: bigint;
257
+ nanos: number;
258
+ } | undefined, number | undefined>]>;
259
+ readonly triggeredAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
260
+ readonly seconds: v.BigintSchema<undefined>;
261
+ readonly nanos: v.OptionalSchema<v.NumberSchema<undefined>, 0>;
262
+ }, undefined>, undefined>, v.TransformAction<{
263
+ seconds: bigint;
264
+ nanos: number;
265
+ } | undefined, number | undefined>]>;
266
+ readonly triggeredPriceTicks: v.BigintSchema<undefined>;
267
+ }, undefined>, v.TransformAction<{
268
+ alertId: string;
269
+ symbolId: number;
270
+ direction: "unspecified" | "above" | "below";
271
+ priceSource: "unspecified" | "last_price" | "index_price";
272
+ priceTicks: string;
273
+ referencePriceTicks: string;
274
+ armed: boolean;
275
+ status: "unspecified" | "active" | "triggered" | "cancelled";
276
+ channels: ("unspecified" | "telegram" | "in_app")[];
277
+ revision: string;
278
+ createdAt?: number | undefined;
279
+ updatedAt?: number | undefined;
280
+ triggeredAt?: number | undefined;
281
+ triggeredPriceTicks: bigint;
282
+ }, {
283
+ alertId: string;
284
+ symbolId: number;
285
+ direction: "unspecified" | "above" | "below";
286
+ priceSource: "unspecified" | "last_price" | "index_price";
287
+ /** Alert price. */
288
+ price: string;
289
+ /** Price when the alert was created or last set again; it fires on a crossing from here. */
290
+ referencePrice: string;
291
+ /** False while an alert created past its price waits for the price to move back first. */
292
+ armed: boolean;
293
+ status: "unspecified" | "active" | "triggered" | "cancelled";
294
+ channels: ("unspecified" | "telegram" | "in_app")[];
295
+ /** Pass as `expectedRevision` to `update`. */
296
+ revision: string;
297
+ createdAt: number | null;
298
+ updatedAt: number | null;
299
+ /** Set only once the alert fired. */
300
+ triggeredAt: number | null;
301
+ /** Price that fired the alert; null unless it fired. */
302
+ triggeredPrice: string | null;
303
+ }>]>;
304
+ readonly outcome: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "applied" | "unchanged" | "replayed">]>;
305
+ }, undefined>;
306
+ type UpdatePriceAlertResult = v.InferOutput<typeof UpdatePriceAlertResultSchema>;
307
+ //#endregion
308
+ export { CancelPriceAlertInput, CancelPriceAlertInputSchema, CreatePriceAlertInput, CreatePriceAlertInputSchema, ListPriceAlertsInput, ListPriceAlertsInputSchema, ListPriceAlertsResult, ListPriceAlertsResultSchema, PriceAlert, PriceAlertSchema, UpdatePriceAlertInput, UpdatePriceAlertInputSchema, UpdatePriceAlertResult, UpdatePriceAlertResultSchema };
309
+ //# sourceMappingURL=price-alerts.schemas.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"price-alerts.schemas.d.ts","names":[],"sources":["../../../src/services/price-alerts/price-alerts.schemas.ts"],"mappings":";;;cAqDa,6BAA2B,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;KAoB5B,wBAAwB,EAAE,kBAAkB;cAE3C,4BAA0B,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;KAiB3B,uBAAuB,EAAE,kBAAkB;cAiB1C,6BAA2B,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAmB5B,wBAAwB,EAAE,kBAAkB;cAE3C,6BAA2B,EAAA;;;KAE5B,wBAAwB,EAAE,kBAAkB;;cAQ3C,kBAAgB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4CjB,aAAa,EAAE,mBAAmB;cAEjC,6BAA2B,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAM5B,wBAAwB,EAAE,mBAAmB;cAE5C,8BAA4B,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAK7B,yBAAyB,EAAE,mBAAmB"}