@polyester/sdk 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/dist/catalogs/readers.js +1 -1
- package/dist/gen/auth/v1/api_keys_pb.d.ts +1 -1
- package/dist/gen/auth/v1/api_keys_pb.js.map +1 -1
- package/dist/gen/auth/v1/policies_pb.d.ts +69 -341
- package/dist/gen/auth/v1/policies_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/policies_pb.js +28 -46
- package/dist/gen/auth/v1/policies_pb.js.map +1 -1
- package/dist/gen/fees/v1/fees_pb.d.ts +0 -6
- package/dist/gen/fees/v1/fees_pb.d.ts.map +1 -1
- package/dist/gen/fees/v1/fees_pb.js +1 -1
- package/dist/gen/fees/v1/fees_pb.js.map +1 -1
- package/dist/gen/marketoverview/v1/marketoverview_pb.d.ts +6 -11
- package/dist/gen/marketoverview/v1/marketoverview_pb.d.ts.map +1 -1
- package/dist/gen/marketoverview/v1/marketoverview_pb.js +1 -1
- package/dist/gen/marketoverview/v1/marketoverview_pb.js.map +1 -1
- package/dist/gen/orderbook/v1/orderbook_pb.d.ts +3 -3
- package/dist/gen/orderbook/v1/orderbook_pb.js +1 -1
- package/dist/gen/orderbook/v1/orderbook_pb.js.map +1 -1
- package/dist/gen/orders/v1/orders_pb.d.ts +43 -12
- package/dist/gen/orders/v1/orders_pb.d.ts.map +1 -1
- package/dist/gen/orders/v1/orders_pb.js +25 -1
- package/dist/gen/orders/v1/orders_pb.js.map +1 -1
- package/dist/gen/triggers/v1/triggers_pb.d.ts +28 -14
- package/dist/gen/triggers/v1/triggers_pb.d.ts.map +1 -1
- package/dist/gen/triggers/v1/triggers_pb.js +7 -1
- package/dist/gen/triggers/v1/triggers_pb.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/services/fees/fees.schemas.d.ts +2 -3
- package/dist/services/fees/fees.schemas.d.ts.map +1 -1
- package/dist/services/fees/fees.schemas.js +3 -4
- package/dist/services/fees/fees.schemas.js.map +1 -1
- package/dist/services/market-data/market-data.schemas.js +1 -1
- package/dist/services/market-overview/market-overview.d.ts +1 -1
- package/dist/services/market-overview/market-overview.js +1 -1
- package/dist/services/market-overview/market-overview.js.map +1 -1
- package/dist/services/market-overview/market-overview.schemas.d.ts +20 -7
- package/dist/services/market-overview/market-overview.schemas.d.ts.map +1 -1
- package/dist/services/market-overview/market-overview.schemas.js +8 -6
- package/dist/services/market-overview/market-overview.schemas.js.map +1 -1
- package/dist/services/orderbook/orderbook.d.ts +3 -4
- package/dist/services/orderbook/orderbook.d.ts.map +1 -1
- package/dist/services/orderbook/orderbook.js +13 -10
- package/dist/services/orderbook/orderbook.js.map +1 -1
- package/dist/services/orderbook/orderbook.schemas.d.ts +8 -9
- package/dist/services/orderbook/orderbook.schemas.d.ts.map +1 -1
- package/dist/services/orderbook/orderbook.schemas.js +9 -8
- package/dist/services/orderbook/orderbook.schemas.js.map +1 -1
- package/dist/services/orders/order-errors.schemas.d.ts +1 -1
- package/dist/services/orders/orders-batch.schemas.d.ts +42 -42
- package/dist/services/orders/orders-batch.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-batch.schemas.js +7 -8
- package/dist/services/orders/orders-batch.schemas.js.map +1 -1
- package/dist/services/orders/orders-input.schemas.d.ts +29 -29
- package/dist/services/orders/orders-input.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-input.schemas.js +10 -10
- package/dist/services/orders/orders-input.schemas.js.map +1 -1
- package/dist/services/orders/orders-modify.schemas.d.ts +3 -2
- package/dist/services/orders/orders-modify.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-modify.schemas.js +5 -3
- package/dist/services/orders/orders-modify.schemas.js.map +1 -1
- package/dist/services/orders/orders-risk.schemas.js +1 -1
- package/dist/services/orders/orders.d.ts +5 -5
- package/dist/services/orders/orders.d.ts.map +1 -1
- package/dist/services/orders/orders.js +8 -8
- package/dist/services/orders/orders.js.map +1 -1
- package/dist/services/policies/api-key-policies/api-key-policies.d.ts +2 -2
- package/dist/services/policies/api-key-policies/api-key-policies.js +2 -2
- package/dist/services/policies/api-key-policies/api-key-policies.js.map +1 -1
- package/dist/services/policies/api-key-policies/api-key-policies.schemas.d.ts +30 -155
- package/dist/services/policies/api-key-policies/api-key-policies.schemas.d.ts.map +1 -1
- package/dist/services/policies/api-key-policies/api-key-policies.schemas.js +5 -53
- package/dist/services/policies/api-key-policies/api-key-policies.schemas.js.map +1 -1
- package/dist/services/policies/shared.codecs.js +4 -12
- package/dist/services/policies/shared.codecs.js.map +1 -1
- package/dist/services/policies/shared.d.ts +1 -1
- package/dist/services/policies/shared.d.ts.map +1 -1
- package/dist/services/policies/shared.js +5 -12
- package/dist/services/policies/shared.js.map +1 -1
- package/dist/services/policies/subaccount-policies/subaccount-policies.d.ts +1 -1
- package/dist/services/policies/subaccount-policies/subaccount-policies.js +1 -1
- package/dist/services/policies/subaccount-policies/subaccount-policies.js.map +1 -1
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.d.ts +19 -215
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.d.ts.map +1 -1
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.js +9 -115
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.js.map +1 -1
- package/dist/services/shared.js +4 -1
- package/dist/services/shared.js.map +1 -1
- package/dist/services/subaccounts/subaccounts.schemas.d.ts +1 -1
- package/dist/services/trades/trades.schemas.js +1 -1
- package/dist/services/trailing-oneof-inputs.js +1 -1
- package/dist/services/triggers/trigger-child-order.schemas.js +5 -3
- package/dist/services/triggers/trigger-child-order.schemas.js.map +1 -1
- package/dist/services/triggers/trigger-input.schemas.d.ts +46 -35
- package/dist/services/triggers/trigger-input.schemas.d.ts.map +1 -1
- package/dist/services/triggers/trigger-input.schemas.js +14 -4
- package/dist/services/triggers/trigger-input.schemas.js.map +1 -1
- package/dist/services/triggers/triggers-output.schemas.d.ts +4 -5
- package/dist/services/triggers/triggers-output.schemas.d.ts.map +1 -1
- package/dist/services/triggers/triggers-output.schemas.js +3 -3
- package/dist/services/triggers/triggers-output.schemas.js.map +1 -1
- package/dist/services/triggers/triggers.codecs.js +6 -3
- package/dist/services/triggers/triggers.codecs.js.map +1 -1
- package/dist/services/triggers/triggers.d.ts +4 -4
- package/dist/services/triggers/triggers.js +4 -4
- package/dist/services/triggers/triggers.js.map +1 -1
- package/dist/services/triggers/triggers.types.d.ts +3 -3
- package/dist/shared/decimal-surface.js +1 -1
- package/dist/shared/schemas.js +2 -2
- package/dist/shared/schemas.js.map +1 -1
- package/dist/shared/transports.js +6 -1
- package/dist/shared/transports.js.map +1 -1
- package/dist/shared/wire-bounds.js +3 -1
- package/dist/shared/wire-bounds.js.map +1 -1
- package/dist/utils/numbers.js +1 -10
- package/dist/utils/numbers.js.map +1 -1
- package/package.json +2 -2
|
@@ -1,25 +1,18 @@
|
|
|
1
1
|
import { idToBigInt } from "../../utils/base58-id.js";
|
|
2
2
|
import { MarketScope_Value, PolicyAction } from "../../gen/auth/v1/policies_pb.js";
|
|
3
|
+
import { SymbolIdInputSchema } from "../shared.js";
|
|
3
4
|
import * as v from "valibot";
|
|
4
5
|
//#region src/services/policies/shared.ts
|
|
5
|
-
const SpotMarketRuleSchema = v.object({
|
|
6
|
-
const PerpMarketRuleSchema = v.object({
|
|
7
|
-
symbol: v.string(),
|
|
8
|
-
maxLeverageX: v.number()
|
|
9
|
-
});
|
|
6
|
+
const SpotMarketRuleSchema = v.object({ symbolId: SymbolIdInputSchema });
|
|
10
7
|
const POLICY_ACTIONS = [
|
|
11
8
|
"trade-spot",
|
|
12
|
-
"trade-perp",
|
|
13
9
|
"internal-transfer",
|
|
14
10
|
"external-withdraw",
|
|
15
11
|
"read-balances",
|
|
16
12
|
"read-spot",
|
|
17
|
-
"read-perp",
|
|
18
13
|
"read-internal-transfers",
|
|
19
|
-
"read-
|
|
20
|
-
"
|
|
21
|
-
"manage-address-book",
|
|
22
|
-
"manage-transfer-whitelists"
|
|
14
|
+
"read-address-book",
|
|
15
|
+
"manage-address-book"
|
|
23
16
|
];
|
|
24
17
|
const POLICY_MARKET_SCOPES = ["all", "allowlist"];
|
|
25
18
|
const ProtoPolicyActionEnumSchema = v.enum(PolicyAction);
|
|
@@ -28,6 +21,6 @@ const ProtoPolicyMarketScopeEnumSchema = v.enum(MarketScope_Value);
|
|
|
28
21
|
const PolicyMarketScopeEnumSchema = v.picklist(POLICY_MARKET_SCOPES);
|
|
29
22
|
const PolicyIdSchema = v.pipe(v.string(), v.trim(), v.minLength(1), v.transform((v) => idToBigInt(v, "policyId")));
|
|
30
23
|
//#endregion
|
|
31
|
-
export { POLICY_ACTIONS, POLICY_MARKET_SCOPES,
|
|
24
|
+
export { POLICY_ACTIONS, POLICY_MARKET_SCOPES, PolicyActionEnumSchema, PolicyIdSchema, PolicyMarketScopeEnumSchema, ProtoPolicyActionEnumSchema, ProtoPolicyMarketScopeEnumSchema, SpotMarketRuleSchema };
|
|
32
25
|
|
|
33
26
|
//# sourceMappingURL=shared.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","names":["Proto.PolicyAction","Proto.MarketScope_Value"],"sources":["../../../src/services/policies/shared.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport * as Proto from \"../../gen/auth/v1/policies_pb.js\";\nimport { idToBigInt } from \"../../utils/base58-id.js\";\
|
|
1
|
+
{"version":3,"file":"shared.js","names":["Proto.PolicyAction","Proto.MarketScope_Value"],"sources":["../../../src/services/policies/shared.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport * as Proto from \"../../gen/auth/v1/policies_pb.js\";\nimport { idToBigInt } from \"../../utils/base58-id.js\";\nimport { SymbolIdInputSchema } from \"../shared.js\";\n\nexport const SpotMarketRuleSchema = v.object({\n symbolId: SymbolIdInputSchema,\n});\n\nexport const POLICY_ACTIONS = [\n \"trade-spot\",\n \"internal-transfer\",\n \"external-withdraw\",\n \"read-balances\",\n \"read-spot\",\n \"read-internal-transfers\",\n \"read-address-book\",\n \"manage-address-book\",\n] as const;\n\nexport const POLICY_MARKET_SCOPES = [\"all\", \"allowlist\"] as const;\n\nexport const ProtoPolicyActionEnumSchema = v.enum(Proto.PolicyAction);\nexport const PolicyActionEnumSchema = v.picklist(POLICY_ACTIONS);\nexport const ProtoPolicyMarketScopeEnumSchema = v.enum(Proto.MarketScope_Value);\nexport const PolicyMarketScopeEnumSchema = v.picklist(POLICY_MARKET_SCOPES);\nexport type PolicyMarketScope = v.InferOutput<typeof PolicyMarketScopeEnumSchema>;\n\nexport type PolicyAction = v.InferOutput<typeof PolicyActionEnumSchema>;\n\nexport const PolicyIdSchema = v.pipe(\n v.string(),\n v.trim(),\n v.minLength(1),\n v.transform((v) => idToBigInt(v, \"policyId\")),\n);\n"],"mappings":";;;;;AAKA,MAAa,uBAAuB,EAAE,OAAO,EACzC,UAAU,oBACd,CAAC;AAED,MAAa,iBAAiB;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;AACJ;AAEA,MAAa,uBAAuB,CAAC,OAAO,WAAW;AAEvD,MAAa,8BAA8B,EAAE,KAAKA,YAAkB;AACpE,MAAa,yBAAyB,EAAE,SAAS,cAAc;AAC/D,MAAa,mCAAmC,EAAE,KAAKC,iBAAuB;AAC9E,MAAa,8BAA8B,EAAE,SAAS,oBAAoB;AAK1E,MAAa,iBAAiB,EAAE,KAC5B,EAAE,OAAO,GACT,EAAE,KAAK,GACP,EAAE,UAAU,CAAC,GACb,EAAE,WAAW,MAAM,WAAW,GAAG,UAAU,CAAC,CAChD"}
|
|
@@ -37,7 +37,7 @@ declare class SubaccountPoliciesService {
|
|
|
37
37
|
*/
|
|
38
38
|
delete(policyId: string, options?: PolyesterMutationOptions): Promise<void>;
|
|
39
39
|
/**
|
|
40
|
-
* Attaches a policy to a subaccount
|
|
40
|
+
* Attaches a policy to a subaccount. Passing a null policyId clears the explicit binding and restores the system read-only policy.
|
|
41
41
|
*/
|
|
42
42
|
apply(input: v.InferInput<typeof ApplySubaccountPolicyInputSchema>, options?: PolyesterMutationOptions): Promise<void>;
|
|
43
43
|
/**
|
|
@@ -64,7 +64,7 @@ var SubaccountPoliciesService = class {
|
|
|
64
64
|
await this.#client.deleteSubaccountPolicy({ policyId: validatedPolicyId }, toConnectCallOptions(options));
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
|
-
* Attaches a policy to a subaccount
|
|
67
|
+
* Attaches a policy to a subaccount. Passing a null policyId clears the explicit binding and restores the system read-only policy.
|
|
68
68
|
*/
|
|
69
69
|
async apply(input, options) {
|
|
70
70
|
const validatedInput = parse(ApplySubaccountPolicyInputSchema, input);
|
|
@@ -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, type Transport } 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 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(transport: Transport, realtime: PolyesterRealtime, resolver?: SubaccountResolver) {\n this.#client = createClient(Proto.PolicyService, transport);\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
|
|
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, type Transport } 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 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(transport: Transport, realtime: PolyesterRealtime, resolver?: SubaccountResolver) {\n this.#client = createClient(Proto.PolicyService, transport);\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":";;;;;;;;;;;;AA+BA,IAAa,4BAAb,MAAuC;CACnC;CACA;CACA;CAEA,YAAY,WAAsB,UAA6B,UAA+B;EAC1F,KAAKA,UAAU,aAAaC,eAAqB,SAAS;EAC1D,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"}
|
|
@@ -35,30 +35,15 @@ declare const SubaccountPolicySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
|
|
|
35
35
|
readonly name: v.StringSchema<undefined>;
|
|
36
36
|
readonly description: v.StringSchema<undefined>;
|
|
37
37
|
readonly spotMarkets: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
38
|
-
readonly
|
|
38
|
+
readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
|
|
39
39
|
}, undefined>, undefined>, readonly []>;
|
|
40
40
|
readonly spotMarketScope: v.SchemaWithPipe<readonly [v.EnumSchema<typeof MarketScope_Value, undefined>, v.TransformAction<MarketScope_Value, DecodedEnum<"all" | "allowlist">>]>;
|
|
41
|
-
readonly
|
|
42
|
-
readonly perpMarkets: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
43
|
-
readonly symbol: v.StringSchema<undefined>;
|
|
44
|
-
readonly maxLeverageX: v.NumberSchema<undefined>;
|
|
45
|
-
}, undefined>, undefined>, readonly []>;
|
|
46
|
-
readonly actions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.EnumSchema<typeof PolicyAction, undefined>, undefined>, readonly []>, v.TransformAction<v.EnumValues<typeof PolicyAction>[], DecodedEnum<"trade-spot" | "trade-perp" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-perp" | "read-internal-transfers" | "read-external-withdrawals" | "read-transfer-controls" | "manage-address-book" | "manage-transfer-whitelists">[]>]>;
|
|
41
|
+
readonly actions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.EnumSchema<typeof PolicyAction, undefined>, undefined>, readonly []>, v.TransformAction<v.EnumValues<typeof PolicyAction>[], DecodedEnum<"trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book">[]>]>;
|
|
47
42
|
readonly isTemplate: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
48
43
|
readonly sourceTemplateId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.BigintSchema<undefined>, undefined>, v.TransformAction<bigint | undefined, string | undefined>]>;
|
|
49
|
-
readonly globalNotionalCap: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, number>]>;
|
|
50
44
|
readonly maxOrderNotional: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, number>]>;
|
|
51
45
|
readonly maxOpenOrders: v.NumberSchema<undefined>;
|
|
52
|
-
readonly maxOpenPositions: v.NumberSchema<undefined>;
|
|
53
|
-
readonly globalPerpLeverageX: v.NumberSchema<undefined>;
|
|
54
|
-
readonly dailyInternalTransferOutLimit: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, number>]>;
|
|
55
|
-
readonly dailyWithdrawLimit: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, number>]>;
|
|
56
|
-
readonly internalTransfersOwnOnly: v.BooleanSchema<undefined>;
|
|
57
|
-
readonly enforceWithdrawWhitelist: v.BooleanSchema<undefined>;
|
|
58
46
|
readonly tradingHalted: v.BooleanSchema<undefined>;
|
|
59
|
-
readonly liquidationOnly: v.BooleanSchema<undefined>;
|
|
60
|
-
readonly dailyLossLimit: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, number>]>;
|
|
61
|
-
readonly intradayDrawdownLimitBps: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, number>]>;
|
|
62
47
|
readonly locked: v.BooleanSchema<undefined>;
|
|
63
48
|
readonly reviewAt: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
|
|
64
49
|
readonly seconds: v.BigintSchema<undefined>;
|
|
@@ -91,30 +76,15 @@ declare const SubaccountPolicySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
|
|
|
91
76
|
name: string;
|
|
92
77
|
description: string;
|
|
93
78
|
spotMarkets: {
|
|
94
|
-
|
|
79
|
+
symbolId: number;
|
|
95
80
|
}[];
|
|
96
81
|
spotMarketScope: DecodedEnum<"all" | "allowlist">;
|
|
97
|
-
|
|
98
|
-
perpMarkets: {
|
|
99
|
-
symbol: string;
|
|
100
|
-
maxLeverageX: number;
|
|
101
|
-
}[];
|
|
102
|
-
actions: DecodedEnum<"trade-spot" | "trade-perp" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-perp" | "read-internal-transfers" | "read-external-withdrawals" | "read-transfer-controls" | "manage-address-book" | "manage-transfer-whitelists">[];
|
|
82
|
+
actions: DecodedEnum<"trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book">[];
|
|
103
83
|
isTemplate: boolean;
|
|
104
84
|
sourceTemplateId?: string | undefined;
|
|
105
|
-
globalNotionalCap: number;
|
|
106
85
|
maxOrderNotional: number;
|
|
107
86
|
maxOpenOrders: number;
|
|
108
|
-
maxOpenPositions: number;
|
|
109
|
-
globalPerpLeverageX: number;
|
|
110
|
-
dailyInternalTransferOutLimit: number;
|
|
111
|
-
dailyWithdrawLimit: number;
|
|
112
|
-
internalTransfersOwnOnly: boolean;
|
|
113
|
-
enforceWithdrawWhitelist: boolean;
|
|
114
87
|
tradingHalted: boolean;
|
|
115
|
-
liquidationOnly: boolean;
|
|
116
|
-
dailyLossLimit: number;
|
|
117
|
-
intradayDrawdownLimitBps: number;
|
|
118
88
|
locked: boolean;
|
|
119
89
|
reviewAt?: number | undefined;
|
|
120
90
|
expiresAt?: number | undefined;
|
|
@@ -131,157 +101,67 @@ declare const SubaccountPolicySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<
|
|
|
131
101
|
name: string;
|
|
132
102
|
description: string;
|
|
133
103
|
spotMarkets: {
|
|
134
|
-
|
|
104
|
+
symbolId: number;
|
|
135
105
|
}[];
|
|
136
106
|
spotMarketScope: DecodedEnum<"all" | "allowlist">;
|
|
137
|
-
|
|
138
|
-
perpMarkets: {
|
|
139
|
-
symbol: string;
|
|
140
|
-
maxLeverageX: number;
|
|
141
|
-
}[];
|
|
142
|
-
actions: DecodedEnum<"trade-spot" | "trade-perp" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-perp" | "read-internal-transfers" | "read-external-withdrawals" | "read-transfer-controls" | "manage-address-book" | "manage-transfer-whitelists">[];
|
|
107
|
+
actions: DecodedEnum<"trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book">[];
|
|
143
108
|
isTemplate: boolean;
|
|
144
109
|
sourceTemplateId?: string | undefined;
|
|
145
110
|
maxOpenOrders: number;
|
|
146
|
-
maxOpenPositions: number;
|
|
147
|
-
globalPerpLeverageX: number;
|
|
148
|
-
dailyInternalTransferOutLimit: number;
|
|
149
|
-
dailyWithdrawLimit: number;
|
|
150
|
-
internalTransfersOwnOnly: boolean;
|
|
151
|
-
enforceWithdrawWhitelist: boolean;
|
|
152
111
|
tradingHalted: boolean;
|
|
153
|
-
liquidationOnly: boolean;
|
|
154
|
-
dailyLossLimit: number;
|
|
155
112
|
locked: boolean;
|
|
156
113
|
reviewAt?: number | undefined;
|
|
157
114
|
expiresAt?: number | undefined;
|
|
158
115
|
createdAt: number;
|
|
159
116
|
revision: string;
|
|
160
117
|
maxOrderSize: number;
|
|
161
|
-
globalExposureCap: number;
|
|
162
|
-
intradayDrawdownLimitPct: number;
|
|
163
118
|
}>]>;
|
|
164
119
|
type SubaccountPolicy = v.InferOutput<typeof SubaccountPolicySchema>;
|
|
165
120
|
declare const CreateSubaccountPolicyInputSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
166
121
|
readonly name: v.StringSchema<undefined>;
|
|
167
122
|
readonly description: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
168
123
|
readonly spotMarkets: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
169
|
-
readonly
|
|
170
|
-
}, undefined>, undefined>, readonly []>;
|
|
171
|
-
readonly perpMarkets: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
172
|
-
readonly symbol: v.StringSchema<undefined>;
|
|
173
|
-
readonly maxLeverageX: v.NumberSchema<undefined>;
|
|
124
|
+
readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
|
|
174
125
|
}, undefined>, undefined>, readonly []>;
|
|
175
126
|
readonly spotMarketScope: v.SchemaWithPipe<readonly [v.PicklistSchema<readonly ["all", "allowlist"], undefined>, v.TransformAction<"all" | "allowlist", MarketScope_Value.ALL | MarketScope_Value.ALLOWLIST>]>;
|
|
176
|
-
readonly
|
|
177
|
-
readonly actions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["trade-spot", "trade-perp", "internal-transfer", "external-withdraw", "read-balances", "read-spot", "read-perp", "read-internal-transfers", "read-external-withdrawals", "read-transfer-controls", "manage-address-book", "manage-transfer-whitelists"], undefined>, undefined>, readonly ["read-balances", "read-spot"]>, v.TransformAction<("trade-spot" | "trade-perp" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-perp" | "read-internal-transfers" | "read-external-withdrawals" | "read-transfer-controls" | "manage-address-book" | "manage-transfer-whitelists")[], (PolicyAction.TRADE_SPOT | PolicyAction.TRADE_PERP | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_PERP | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_EXTERNAL_WITHDRAWALS | PolicyAction.READ_TRANSFER_CONTROLS | PolicyAction.MANAGE_ADDRESS_BOOK | PolicyAction.MANAGE_TRANSFER_WHITELISTS)[]>]>;
|
|
178
|
-
readonly globalLeverageCap: v.SchemaWithPipe<readonly [v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, null>, v.TransformAction<number | null, number>]>;
|
|
179
|
-
readonly globalExposureCap: v.SchemaWithPipe<readonly [v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, null>, v.TransformAction<number | null, bigint>]>;
|
|
127
|
+
readonly actions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["trade-spot", "internal-transfer", "external-withdraw", "read-balances", "read-spot", "read-internal-transfers", "read-address-book", "manage-address-book"], undefined>, undefined>, readonly []>, v.TransformAction<("trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book")[], (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK)[]>]>;
|
|
180
128
|
readonly maxOrderSize: v.SchemaWithPipe<readonly [v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, null>, v.TransformAction<number | null, bigint>]>;
|
|
181
129
|
readonly maxOpenOrders: v.SchemaWithPipe<readonly [v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, null>, v.TransformAction<number | null, number>]>;
|
|
182
|
-
readonly maxOpenPositions: v.SchemaWithPipe<readonly [v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, null>, v.TransformAction<number | null, number>]>;
|
|
183
|
-
readonly dailyInternalTransferLimit: v.SchemaWithPipe<readonly [v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, null>, v.TransformAction<number | null, bigint>]>;
|
|
184
|
-
readonly dailyWithdrawLimit: v.SchemaWithPipe<readonly [v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, null>, v.TransformAction<number | null, bigint>]>;
|
|
185
|
-
readonly dailyLossLimit: v.SchemaWithPipe<readonly [v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, null>, v.TransformAction<number | null, bigint>]>;
|
|
186
|
-
readonly intradayDrawdownLimitPct: v.SchemaWithPipe<readonly [v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, null>, v.TransformAction<number | null, number>]>;
|
|
187
130
|
readonly tradingHalted: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
188
|
-
readonly liquidationOnly: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
189
131
|
readonly policyLocked: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
190
|
-
readonly internalTransfersOwnOnly: v.OptionalSchema<v.BooleanSchema<undefined>, true>;
|
|
191
|
-
readonly enforceWithdrawWhitelist: v.OptionalSchema<v.BooleanSchema<undefined>, false>;
|
|
192
132
|
readonly reviewAt: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>, undefined>;
|
|
193
133
|
readonly expiresAt: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>, undefined>;
|
|
194
134
|
readonly subaccountId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.TransformAction<string | undefined, bigint | undefined>]>;
|
|
195
|
-
}, undefined>, v.
|
|
196
|
-
name: string;
|
|
197
|
-
description: string;
|
|
198
|
-
spotMarkets: {
|
|
199
|
-
symbol: string;
|
|
200
|
-
}[];
|
|
201
|
-
perpMarkets: {
|
|
202
|
-
symbol: string;
|
|
203
|
-
maxLeverageX: number;
|
|
204
|
-
}[];
|
|
205
|
-
spotMarketScope: MarketScope_Value.ALL | MarketScope_Value.ALLOWLIST;
|
|
206
|
-
perpMarketScope: MarketScope_Value.ALL | MarketScope_Value.ALLOWLIST;
|
|
207
|
-
actions: (PolicyAction.TRADE_SPOT | PolicyAction.TRADE_PERP | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_PERP | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_EXTERNAL_WITHDRAWALS | PolicyAction.READ_TRANSFER_CONTROLS | PolicyAction.MANAGE_ADDRESS_BOOK | PolicyAction.MANAGE_TRANSFER_WHITELISTS)[];
|
|
208
|
-
globalLeverageCap: number;
|
|
209
|
-
globalExposureCap: bigint;
|
|
210
|
-
maxOrderSize: bigint;
|
|
211
|
-
maxOpenOrders: number;
|
|
212
|
-
maxOpenPositions: number;
|
|
213
|
-
dailyInternalTransferLimit: bigint;
|
|
214
|
-
dailyWithdrawLimit: bigint;
|
|
215
|
-
dailyLossLimit: bigint;
|
|
216
|
-
intradayDrawdownLimitPct: number;
|
|
217
|
-
tradingHalted: boolean;
|
|
218
|
-
liquidationOnly: boolean;
|
|
219
|
-
policyLocked: boolean;
|
|
220
|
-
internalTransfersOwnOnly: boolean;
|
|
221
|
-
enforceWithdrawWhitelist: boolean;
|
|
222
|
-
reviewAt?: number | null | undefined;
|
|
223
|
-
expiresAt?: number | null | undefined;
|
|
224
|
-
subaccountId?: bigint | undefined;
|
|
225
|
-
}, "Subaccount policy actions must include read-balances and read-spot">, v.TransformAction<{
|
|
135
|
+
}, undefined>, v.TransformAction<{
|
|
226
136
|
name: string;
|
|
227
137
|
description: string;
|
|
228
138
|
spotMarkets: {
|
|
229
|
-
|
|
230
|
-
}[];
|
|
231
|
-
perpMarkets: {
|
|
232
|
-
symbol: string;
|
|
233
|
-
maxLeverageX: number;
|
|
139
|
+
symbolId: number;
|
|
234
140
|
}[];
|
|
235
141
|
spotMarketScope: MarketScope_Value.ALL | MarketScope_Value.ALLOWLIST;
|
|
236
|
-
|
|
237
|
-
actions: (PolicyAction.TRADE_SPOT | PolicyAction.TRADE_PERP | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_PERP | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_EXTERNAL_WITHDRAWALS | PolicyAction.READ_TRANSFER_CONTROLS | PolicyAction.MANAGE_ADDRESS_BOOK | PolicyAction.MANAGE_TRANSFER_WHITELISTS)[];
|
|
238
|
-
globalLeverageCap: number;
|
|
239
|
-
globalExposureCap: bigint;
|
|
142
|
+
actions: (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK)[];
|
|
240
143
|
maxOrderSize: bigint;
|
|
241
144
|
maxOpenOrders: number;
|
|
242
|
-
maxOpenPositions: number;
|
|
243
|
-
dailyInternalTransferLimit: bigint;
|
|
244
|
-
dailyWithdrawLimit: bigint;
|
|
245
|
-
dailyLossLimit: bigint;
|
|
246
|
-
intradayDrawdownLimitPct: number;
|
|
247
145
|
tradingHalted: boolean;
|
|
248
|
-
liquidationOnly: boolean;
|
|
249
146
|
policyLocked: boolean;
|
|
250
|
-
internalTransfersOwnOnly: boolean;
|
|
251
|
-
enforceWithdrawWhitelist: boolean;
|
|
252
147
|
reviewAt?: number | null | undefined;
|
|
253
148
|
expiresAt?: number | null | undefined;
|
|
254
149
|
subaccountId?: bigint | undefined;
|
|
255
150
|
}, {
|
|
256
151
|
policy: {
|
|
257
|
-
globalNotionalCap: bigint;
|
|
258
152
|
maxOrderNotional: bigint;
|
|
259
|
-
globalPerpLeverageX: number;
|
|
260
|
-
dailyInternalTransferOutLimit: bigint;
|
|
261
|
-
intradayDrawdownLimitBps: number;
|
|
262
153
|
locked: boolean;
|
|
263
154
|
reviewAt: import("@bufbuild/protobuf/wkt").Timestamp | undefined;
|
|
264
155
|
expiresAt: import("@bufbuild/protobuf/wkt").Timestamp | undefined;
|
|
265
156
|
name: string;
|
|
266
157
|
description: string;
|
|
267
158
|
spotMarkets: {
|
|
268
|
-
|
|
269
|
-
}[];
|
|
270
|
-
perpMarkets: {
|
|
271
|
-
symbol: string;
|
|
272
|
-
maxLeverageX: number;
|
|
159
|
+
symbolId: number;
|
|
273
160
|
}[];
|
|
274
161
|
spotMarketScope: MarketScope_Value.ALL | MarketScope_Value.ALLOWLIST;
|
|
275
|
-
|
|
276
|
-
actions: (PolicyAction.TRADE_SPOT | PolicyAction.TRADE_PERP | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_PERP | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_EXTERNAL_WITHDRAWALS | PolicyAction.READ_TRANSFER_CONTROLS | PolicyAction.MANAGE_ADDRESS_BOOK | PolicyAction.MANAGE_TRANSFER_WHITELISTS)[];
|
|
162
|
+
actions: (PolicyAction.TRADE_SPOT | PolicyAction.INTERNAL_TRANSFER | PolicyAction.EXTERNAL_WITHDRAW | PolicyAction.READ_BALANCES | PolicyAction.READ_SPOT | PolicyAction.READ_INTERNAL_TRANSFERS | PolicyAction.READ_ADDRESS_BOOK | PolicyAction.MANAGE_ADDRESS_BOOK)[];
|
|
277
163
|
maxOpenOrders: number;
|
|
278
|
-
maxOpenPositions: number;
|
|
279
|
-
dailyWithdrawLimit: bigint;
|
|
280
|
-
dailyLossLimit: bigint;
|
|
281
164
|
tradingHalted: boolean;
|
|
282
|
-
liquidationOnly: boolean;
|
|
283
|
-
internalTransfersOwnOnly: boolean;
|
|
284
|
-
enforceWithdrawWhitelist: boolean;
|
|
285
165
|
};
|
|
286
166
|
subaccountId: bigint | undefined;
|
|
287
167
|
}>]>;
|
|
@@ -292,29 +172,14 @@ declare const UpdateSubaccountPolicyInputSchema: v.SchemaWithPipe<readonly [v.St
|
|
|
292
172
|
readonly name: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
293
173
|
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
294
174
|
readonly spotMarkets: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
295
|
-
readonly
|
|
296
|
-
}, undefined>, undefined>, undefined>;
|
|
297
|
-
readonly perpMarkets: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
|
|
298
|
-
readonly symbol: v.StringSchema<undefined>;
|
|
299
|
-
readonly maxLeverageX: v.NumberSchema<undefined>;
|
|
175
|
+
readonly symbolId: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 4294967295, undefined>]>;
|
|
300
176
|
}, undefined>, undefined>, undefined>;
|
|
301
177
|
readonly spotMarketScope: v.OptionalSchema<v.PicklistSchema<readonly ["all", "allowlist"], undefined>, undefined>;
|
|
302
|
-
readonly
|
|
303
|
-
readonly actions: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["trade-spot", "trade-perp", "internal-transfer", "external-withdraw", "read-balances", "read-spot", "read-perp", "read-internal-transfers", "read-external-withdrawals", "read-transfer-controls", "manage-address-book", "manage-transfer-whitelists"], undefined>, undefined>, undefined>;
|
|
304
|
-
readonly globalLeverageCap: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
|
|
305
|
-
readonly globalExposureCap: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
|
|
178
|
+
readonly actions: v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["trade-spot", "internal-transfer", "external-withdraw", "read-balances", "read-spot", "read-internal-transfers", "read-address-book", "manage-address-book"], undefined>, undefined>, undefined>;
|
|
306
179
|
readonly maxOrderSize: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
|
|
307
180
|
readonly maxOpenOrders: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
|
|
308
|
-
readonly maxOpenPositions: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
|
|
309
|
-
readonly dailyInternalTransferLimit: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
|
|
310
|
-
readonly dailyWithdrawLimit: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
|
|
311
|
-
readonly dailyLossLimit: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
|
|
312
|
-
readonly intradayDrawdownLimitPct: v.OptionalSchema<v.NullableSchema<v.NumberSchema<undefined>, undefined>, undefined>;
|
|
313
181
|
readonly tradingHalted: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
314
|
-
readonly liquidationOnly: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
315
182
|
readonly policyLocked: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
316
|
-
readonly internalTransfersOwnOnly: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
317
|
-
readonly enforceWithdrawWhitelist: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
318
183
|
readonly reviewAt: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>, undefined>;
|
|
319
184
|
readonly expiresAt: v.OptionalSchema<v.NullableSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>, undefined>;
|
|
320
185
|
}, undefined>, v.CheckAction<{
|
|
@@ -323,60 +188,14 @@ declare const UpdateSubaccountPolicyInputSchema: v.SchemaWithPipe<readonly [v.St
|
|
|
323
188
|
name?: string | undefined;
|
|
324
189
|
description?: string | undefined;
|
|
325
190
|
spotMarkets?: {
|
|
326
|
-
|
|
327
|
-
}[] | undefined;
|
|
328
|
-
perpMarkets?: {
|
|
329
|
-
symbol: string;
|
|
330
|
-
maxLeverageX: number;
|
|
191
|
+
symbolId: number;
|
|
331
192
|
}[] | undefined;
|
|
332
193
|
spotMarketScope?: "all" | "allowlist" | undefined;
|
|
333
|
-
|
|
334
|
-
actions?: ("trade-spot" | "trade-perp" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-perp" | "read-internal-transfers" | "read-external-withdrawals" | "read-transfer-controls" | "manage-address-book" | "manage-transfer-whitelists")[] | undefined;
|
|
335
|
-
globalLeverageCap?: number | null | undefined;
|
|
336
|
-
globalExposureCap?: number | null | undefined;
|
|
194
|
+
actions?: ("trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book")[] | undefined;
|
|
337
195
|
maxOrderSize?: number | null | undefined;
|
|
338
196
|
maxOpenOrders?: number | null | undefined;
|
|
339
|
-
maxOpenPositions?: number | null | undefined;
|
|
340
|
-
dailyInternalTransferLimit?: number | null | undefined;
|
|
341
|
-
dailyWithdrawLimit?: number | null | undefined;
|
|
342
|
-
dailyLossLimit?: number | null | undefined;
|
|
343
|
-
intradayDrawdownLimitPct?: number | null | undefined;
|
|
344
197
|
tradingHalted?: boolean | undefined;
|
|
345
|
-
liquidationOnly?: boolean | undefined;
|
|
346
198
|
policyLocked?: boolean | undefined;
|
|
347
|
-
internalTransfersOwnOnly?: boolean | undefined;
|
|
348
|
-
enforceWithdrawWhitelist?: boolean | undefined;
|
|
349
|
-
reviewAt?: number | null | undefined;
|
|
350
|
-
expiresAt?: number | null | undefined;
|
|
351
|
-
}, "Subaccount policy actions must include read-balances and read-spot">, v.CheckAction<{
|
|
352
|
-
policyId: bigint;
|
|
353
|
-
expectedRevision: bigint;
|
|
354
|
-
name?: string | undefined;
|
|
355
|
-
description?: string | undefined;
|
|
356
|
-
spotMarkets?: {
|
|
357
|
-
symbol: string;
|
|
358
|
-
}[] | undefined;
|
|
359
|
-
perpMarkets?: {
|
|
360
|
-
symbol: string;
|
|
361
|
-
maxLeverageX: number;
|
|
362
|
-
}[] | undefined;
|
|
363
|
-
spotMarketScope?: "all" | "allowlist" | undefined;
|
|
364
|
-
perpMarketScope?: "all" | "allowlist" | undefined;
|
|
365
|
-
actions?: ("trade-spot" | "trade-perp" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-perp" | "read-internal-transfers" | "read-external-withdrawals" | "read-transfer-controls" | "manage-address-book" | "manage-transfer-whitelists")[] | undefined;
|
|
366
|
-
globalLeverageCap?: number | null | undefined;
|
|
367
|
-
globalExposureCap?: number | null | undefined;
|
|
368
|
-
maxOrderSize?: number | null | undefined;
|
|
369
|
-
maxOpenOrders?: number | null | undefined;
|
|
370
|
-
maxOpenPositions?: number | null | undefined;
|
|
371
|
-
dailyInternalTransferLimit?: number | null | undefined;
|
|
372
|
-
dailyWithdrawLimit?: number | null | undefined;
|
|
373
|
-
dailyLossLimit?: number | null | undefined;
|
|
374
|
-
intradayDrawdownLimitPct?: number | null | undefined;
|
|
375
|
-
tradingHalted?: boolean | undefined;
|
|
376
|
-
liquidationOnly?: boolean | undefined;
|
|
377
|
-
policyLocked?: boolean | undefined;
|
|
378
|
-
internalTransfersOwnOnly?: boolean | undefined;
|
|
379
|
-
enforceWithdrawWhitelist?: boolean | undefined;
|
|
380
199
|
reviewAt?: number | null | undefined;
|
|
381
200
|
expiresAt?: number | null | undefined;
|
|
382
201
|
}, "At least one subaccount policy field must be provided">, v.TransformAction<{
|
|
@@ -385,29 +204,14 @@ declare const UpdateSubaccountPolicyInputSchema: v.SchemaWithPipe<readonly [v.St
|
|
|
385
204
|
name?: string | undefined;
|
|
386
205
|
description?: string | undefined;
|
|
387
206
|
spotMarkets?: {
|
|
388
|
-
|
|
389
|
-
}[] | undefined;
|
|
390
|
-
perpMarkets?: {
|
|
391
|
-
symbol: string;
|
|
392
|
-
maxLeverageX: number;
|
|
207
|
+
symbolId: number;
|
|
393
208
|
}[] | undefined;
|
|
394
209
|
spotMarketScope?: "all" | "allowlist" | undefined;
|
|
395
|
-
|
|
396
|
-
actions?: ("trade-spot" | "trade-perp" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-perp" | "read-internal-transfers" | "read-external-withdrawals" | "read-transfer-controls" | "manage-address-book" | "manage-transfer-whitelists")[] | undefined;
|
|
397
|
-
globalLeverageCap?: number | null | undefined;
|
|
398
|
-
globalExposureCap?: number | null | undefined;
|
|
210
|
+
actions?: ("trade-spot" | "internal-transfer" | "external-withdraw" | "read-balances" | "read-spot" | "read-internal-transfers" | "read-address-book" | "manage-address-book")[] | undefined;
|
|
399
211
|
maxOrderSize?: number | null | undefined;
|
|
400
212
|
maxOpenOrders?: number | null | undefined;
|
|
401
|
-
maxOpenPositions?: number | null | undefined;
|
|
402
|
-
dailyInternalTransferLimit?: number | null | undefined;
|
|
403
|
-
dailyWithdrawLimit?: number | null | undefined;
|
|
404
|
-
dailyLossLimit?: number | null | undefined;
|
|
405
|
-
intradayDrawdownLimitPct?: number | null | undefined;
|
|
406
213
|
tradingHalted?: boolean | undefined;
|
|
407
|
-
liquidationOnly?: boolean | undefined;
|
|
408
214
|
policyLocked?: boolean | undefined;
|
|
409
|
-
internalTransfersOwnOnly?: boolean | undefined;
|
|
410
|
-
enforceWithdrawWhitelist?: boolean | undefined;
|
|
411
215
|
reviewAt?: number | null | undefined;
|
|
412
216
|
expiresAt?: number | null | undefined;
|
|
413
217
|
}, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subaccount-policies.schemas.d.ts","names":[],"sources":["../../../../src/services/policies/subaccount-policies/subaccount-policies.schemas.ts"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"subaccount-policies.schemas.d.ts","names":[],"sources":["../../../../src/services/policies/subaccount-policies/subaccount-policies.schemas.ts"],"mappings":";;;;cAqCa,mCAAiC,EAAA,yBAAA,EAAA;;;;;;;;;;;cASjC,gCAA8B,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;cAgB9B,wBAAsB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAqCvB,mBAAmB,EAAE,mBAAmB;cAmDvC,mCAAiC,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAOlC,8BAA8B,EAAE,kBAAkB;cA6DjD,mCAAiC,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2BlC,8BAA8B,EAAE,kBAAkB;cASjD,kCAAgC,EAAA;;;;KAQjC,6BAA6B,EAAE,kBAAkB"}
|