@polyester/sdk 0.28.1 → 0.29.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 +12 -0
- package/dist/index.d.ts +2 -2
- package/dist/services/address-book/address-book.schemas.d.ts +209 -85
- package/dist/services/address-book/address-book.schemas.d.ts.map +1 -1
- package/dist/services/address-book/address-book.schemas.js +22 -3
- package/dist/services/address-book/address-book.schemas.js.map +1 -1
- package/dist/services/address-book/address-book.types.d.ts +2 -2
- package/dist/services/address-book/index.d.ts +1 -1
- package/dist/services/api-keys/api-keys.schemas.d.ts +3 -3
- package/dist/services/api-keys/api-keys.schemas.d.ts.map +1 -1
- package/dist/services/api-keys/api-keys.schemas.js +2 -2
- package/dist/services/api-keys/api-keys.schemas.js.map +1 -1
- package/dist/services/candles/candles.schemas.d.ts +10 -10
- package/dist/services/heatmap/heatmap.schemas.d.ts +13 -13
- package/dist/services/market-overview/market-overview.schemas.d.ts +3 -3
- package/dist/services/orderbook/orderbook.schemas.d.ts +1 -1
- package/dist/services/orders/orders-output.schemas.d.ts +6 -6
- package/dist/services/policies/api-key-policies/api-key-policies.schemas.d.ts +1 -1
- package/dist/services/policies/api-key-policies/api-key-policies.schemas.js +1 -1
- package/dist/services/policies/api-key-policies/api-key-policies.schemas.js.map +1 -1
- package/dist/services/subaccounts/subaccounts.schemas.d.ts +2 -2
- package/dist/services/subaccounts/subaccounts.schemas.d.ts.map +1 -1
- package/dist/services/subaccounts/subaccounts.schemas.js +3 -3
- package/dist/services/subaccounts/subaccounts.schemas.js.map +1 -1
- package/dist/services/triggers/trigger-input.schemas.d.ts +1 -1
- package/dist/services/triggers/triggers-output.schemas.d.ts +15 -15
- package/dist/shared/schemas.js +3 -1
- package/dist/shared/schemas.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-key-policies.schemas.js","names":[],"sources":["../../../../src/services/policies/api-key-policies/api-key-policies.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport {\n PolicyActionEnumSchema,\n PolicyMarketScopeEnumSchema,\n ProtoPolicyActionEnumSchema,\n ProtoPolicyMarketScopeEnumSchema,\n SpotMarketRuleSchema,\n} from \"../shared.js\";\nimport {\n PolicyMarketScopeCodec,\n PolicyActionCodec,\n policyMarketScopeLabelFor,\n policyActionLabelFor,\n} from \"../shared.codecs.js\";\nimport { idToBigInt } from \"../../../utils/base58-id.js\";\nimport {\n OptionalPublicIdSchema,\n BigIntStringSchema,\n PublicIdSchema,\n TimestampMsSchema,\n TimestampSchema,\n positiveBigintStringInputSchema,\n} from \"../../../shared/schemas.js\";\nimport { tsObjToMs, tsObjToNsString } from \"../../../utils/time.js\";\nimport { buildProtoPatch, defineProtoPatchFields } from \"../../../utils/proto-patch.js\";\n\nconst OptionalApiKeyContextSchema = v.optional(\n v.pipe(v.string(), v.trim(), v.minLength(1, \"keyId is required\")),\n);\n\nexport const ListApiKeyPoliciesInputSchema = v.strictObject({\n keyId: OptionalApiKeyContextSchema,\n});\n\nexport type ListApiKeyPoliciesInput = v.InferInput<typeof ListApiKeyPoliciesInputSchema>;\n\nexport const GetApiKeyPolicyInputSchema = v.pipe(\n v.strictObject({\n policyId: v.optional(v.pipe(v.string(), v.trim(), v.minLength(1))),\n keyId: OptionalApiKeyContextSchema,\n }),\n v.transform(({ policyId, keyId }) => ({\n policyId: policyId ? idToBigInt(policyId, \"policyId\") : undefined,\n keyId,\n })),\n);\n\nexport type GetApiKeyPolicyInput = v.InferInput<typeof GetApiKeyPolicyInputSchema>;\n\n/**\n * From the backend format to a usable frontend/UI format, so big ints to numbers, etc.\n * Shape matches auth.v1.ApiPolicyView.\n */\nexport const ApiKeyPolicySchema = v.pipe(\n v.object({\n id: PublicIdSchema,\n name: v.string(),\n description: v.string(),\n spotMarkets: v.optional(v.array(SpotMarketRuleSchema), []),\n spotMarketScope: v.pipe(\n ProtoPolicyMarketScopeEnumSchema,\n v.transform((v) => policyMarketScopeLabelFor(v)),\n ),\n actions: v.pipe(\n v.optional(v.array(ProtoPolicyActionEnumSchema), []),\n v.transform((v) => v.map((action) => policyActionLabelFor(action))),\n ),\n isTemplate: v.optional(v.boolean(), false),\n sourceTemplateId: OptionalPublicIdSchema,\n createdAt: TimestampMsSchema,\n updatedAt: TimestampSchema,\n revision: BigIntStringSchema,\n }),\n v.transform(({ updatedAt, ...policy }) => ({\n ...policy,\n updatedAt: tsObjToMs(updatedAt),\n updatedAtNs: tsObjToNsString(updatedAt),\n })),\n);\n\nexport type ApiKeyPolicy = v.InferOutput<typeof ApiKeyPolicySchema>;\n\nexport const ListApiKeyPoliciesResponseSchema = v.pipe(\n v.object({\n policies: v.optional(v.array(ApiKeyPolicySchema), []),\n }),\n v.transform((value) => value.policies),\n);\n\nexport type ListApiKeyPoliciesResponse = v.InferOutput<typeof ListApiKeyPoliciesResponseSchema>;\n\nconst ApiKeyPolicyInputBaseSchema = v.strictObject({\n name: v.string(),\n description: v.optional(v.string(), \"\"),\n spotMarkets: v.optional(v.array(SpotMarketRuleSchema), []),\n spotMarketScope: v.pipe(\n PolicyMarketScopeEnumSchema,\n v.transform((v) => PolicyMarketScopeCodec.inputToProto[v]),\n ),\n actions: v.pipe(\n v.optional(v.array(PolicyActionEnumSchema), []),\n v.transform((v) => (v ?? []).map((action) => PolicyActionCodec.inputToProto[action])),\n ),\n isTemplate: v.optional(v.boolean(), false),\n assignToKeyId: v.optional(v.pipe(v.string(), v.trim())),\n});\n\nexport const CreateApiKeyPolicyInputSchema = v.pipe(\n ApiKeyPolicyInputBaseSchema,\n v.transform(({ assignToKeyId, ...policy }) => ({ policy, assignToKeyId })),\n);\n\nexport type ApiKeyPolicyCreateInput = v.InferInput<typeof CreateApiKeyPolicyInputSchema>;\n\nconst ApiKeyPolicyPatchSchema = v.strictObject({\n name: v.optional(v.string()),\n description: v.optional(v.string()),\n spotMarkets: v.optional(v.array(SpotMarketRuleSchema)),\n spotMarketScope: v.optional(PolicyMarketScopeEnumSchema),\n actions: v.optional(v.array(PolicyActionEnumSchema)),\n isTemplate: v.optional(v.boolean()),\n});\n\ntype ApiKeyPolicyPatch = v.InferOutput<typeof ApiKeyPolicyPatchSchema>;\n\nconst API_KEY_POLICY_PATCH_FIELDS = defineProtoPatchFields<ApiKeyPolicyPatch>()({\n name: { path: \"name\", encode: (name) => ({ name }) },\n description: { path: \"description\", encode: (description) => ({ description }) },\n spotMarkets: { path: \"spot_markets\", encode: (spotMarkets) => ({ spotMarkets }) },\n spotMarketScope: {\n path: \"spot_market_scope\",\n encode: (scope) => ({ spotMarketScope: PolicyMarketScopeCodec.inputToProto[scope] }),\n },\n actions: {\n path: \"actions\",\n encode: (actions) => ({\n actions: actions.map((action) => PolicyActionCodec.inputToProto[action]),\n }),\n },\n isTemplate: { path: \"is_template\", encode: (isTemplate) => ({ isTemplate }) },\n});\n\nexport const UpdateApiKeyPolicyInputSchema = v.pipe(\n v.strictObject({\n ...ApiKeyPolicyPatchSchema.entries,\n policyId: v.pipe(\n v.string(),\n v.transform((v) => idToBigInt(v, \"policyId\")),\n ),\n expectedRevision: positiveBigintStringInputSchema(\"expectedRevision\"),\n }),\n v.check(\n ({ policyId: _policyId, expectedRevision: _expectedRevision, ...patch }) =>\n Object.values(patch).some((value) => value !== undefined),\n \"At least one API key policy field must be provided\",\n ),\n v.transform(({ policyId, expectedRevision, ...patch }) => {\n const { patch: policy, updateMask } = buildProtoPatch(patch, API_KEY_POLICY_PATCH_FIELDS);\n return {\n policyId,\n policy,\n updateMask,\n expectedRevision,\n };\n }),\n);\n\nexport type ApiKeyPolicyUpdateInput = v.InferInput<typeof UpdateApiKeyPolicyInputSchema>;\n\nexport const ApplyApiKeyPolicyInputSchema = v.strictObject({\n keyId: v.pipe(v.string(), v.trim(), v.minLength(1)),\n policyId: v.pipe(\n v.nullable(v.pipe(v.string(), v.trim())),\n v.transform((value) => (value ? idToBigInt(value, \"policyId\") : undefined)),\n ),\n});\n\nexport type ApiKeyPolicyApplyInput = v.InferInput<typeof ApplyApiKeyPolicyInputSchema>;\n\nexport const DEFAULT_API_KEY_POLICY: ApiKeyPolicy = {\n id: \"\",\n name: \"API Key Policy\",\n description: \"Default API key policy with no permissions\",\n spotMarkets: [],\n spotMarketScope: \"all\",\n actions: [],\n isTemplate: false,\n sourceTemplateId: \"\",\n createdAt: 0,\n updatedAt: 0,\n updatedAtNs: \"0\",\n revision: \"0\",\n};\n"],"mappings":";;;;;;;;AA0BA,MAAM,8BAA8B,EAAE,SAClC,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,GAAG,EAAE,UAAU,GAAG,mBAAmB,CAAC,CACpE;AAEA,MAAa,gCAAgC,EAAE,aAAa,EACxD,OAAO,4BACX,CAAC;AAID,MAAa,6BAA6B,EAAE,KACxC,EAAE,aAAa;CACX,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,GAAG,EAAE,UAAU,CAAC,CAAC,CAAC;CACjE,OAAO;AACX,CAAC,GACD,EAAE,WAAW,EAAE,UAAU,aAAa;CAClC,UAAU,WAAW,WAAW,UAAU,UAAU,IAAI,KAAA;CACxD;AACJ,EAAE,CACN;;;;;AAQA,MAAa,qBAAqB,EAAE,KAChC,EAAE,OAAO;CACL,IAAI;CACJ,MAAM,EAAE,OAAO;CACf,aAAa,EAAE,OAAO;CACtB,aAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,GAAG,CAAC,CAAC;CACzD,iBAAiB,EAAE,KACf,kCACA,EAAE,WAAW,MAAM,0BAA0B,CAAC,CAAC,CACnD;CACA,SAAS,EAAE,KACP,EAAE,SAAS,EAAE,MAAM,2BAA2B,GAAG,CAAC,CAAC,GACnD,EAAE,WAAW,MAAM,EAAE,KAAK,WAAW,qBAAqB,MAAM,CAAC,CAAC,CACtE;CACA,YAAY,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;CACzC,kBAAkB;CAClB,WAAW;CACX,WAAW;CACX,UAAU;AACd,C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,UAAW,QAAQ,WAAW,OAAO,UAAU,IAAI,KAAA,CAAU,CAC9E;AACJ,CAAC;AAID,MAAa,yBAAuC;CAChD,IAAI;CACJ,MAAM;CACN,aAAa;CACb,aAAa,CAAC;CACd,iBAAiB;CACjB,SAAS,CAAC;CACV,YAAY;CACZ,kBAAkB;CAClB,WAAW;CACX,WAAW;CACX,aAAa;CACb,UAAU;AACd"}
|
|
1
|
+
{"version":3,"file":"api-key-policies.schemas.js","names":[],"sources":["../../../../src/services/policies/api-key-policies/api-key-policies.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport {\n PolicyActionEnumSchema,\n PolicyMarketScopeEnumSchema,\n ProtoPolicyActionEnumSchema,\n ProtoPolicyMarketScopeEnumSchema,\n SpotMarketRuleSchema,\n} from \"../shared.js\";\nimport {\n PolicyMarketScopeCodec,\n PolicyActionCodec,\n policyMarketScopeLabelFor,\n policyActionLabelFor,\n} from \"../shared.codecs.js\";\nimport { idToBigInt } from \"../../../utils/base58-id.js\";\nimport {\n OptionalPublicIdSchema,\n BigIntStringSchema,\n PublicIdSchema,\n TimestampMsSchema,\n TimestampSchema,\n positiveBigintStringInputSchema,\n} from \"../../../shared/schemas.js\";\nimport { tsObjToMs, tsObjToNsString } from \"../../../utils/time.js\";\nimport { buildProtoPatch, defineProtoPatchFields } from \"../../../utils/proto-patch.js\";\n\nconst OptionalApiKeyContextSchema = v.optional(\n v.pipe(v.string(), v.trim(), v.minLength(1, \"keyId is required\")),\n);\n\nexport const ListApiKeyPoliciesInputSchema = v.strictObject({\n keyId: OptionalApiKeyContextSchema,\n});\n\nexport type ListApiKeyPoliciesInput = v.InferInput<typeof ListApiKeyPoliciesInputSchema>;\n\nexport const GetApiKeyPolicyInputSchema = v.pipe(\n v.strictObject({\n policyId: v.optional(v.pipe(v.string(), v.trim())),\n keyId: OptionalApiKeyContextSchema,\n }),\n v.transform(({ policyId, keyId }) => ({\n policyId: policyId ? idToBigInt(policyId, \"policyId\") : undefined,\n keyId,\n })),\n);\n\nexport type GetApiKeyPolicyInput = v.InferInput<typeof GetApiKeyPolicyInputSchema>;\n\n/**\n * From the backend format to a usable frontend/UI format, so big ints to numbers, etc.\n * Shape matches auth.v1.ApiPolicyView.\n */\nexport const ApiKeyPolicySchema = v.pipe(\n v.object({\n id: PublicIdSchema,\n name: v.string(),\n description: v.string(),\n spotMarkets: v.optional(v.array(SpotMarketRuleSchema), []),\n spotMarketScope: v.pipe(\n ProtoPolicyMarketScopeEnumSchema,\n v.transform((v) => policyMarketScopeLabelFor(v)),\n ),\n actions: v.pipe(\n v.optional(v.array(ProtoPolicyActionEnumSchema), []),\n v.transform((v) => v.map((action) => policyActionLabelFor(action))),\n ),\n isTemplate: v.optional(v.boolean(), false),\n sourceTemplateId: OptionalPublicIdSchema,\n createdAt: TimestampMsSchema,\n updatedAt: TimestampSchema,\n revision: BigIntStringSchema,\n }),\n v.transform(({ updatedAt, ...policy }) => ({\n ...policy,\n updatedAt: tsObjToMs(updatedAt),\n updatedAtNs: tsObjToNsString(updatedAt),\n })),\n);\n\nexport type ApiKeyPolicy = v.InferOutput<typeof ApiKeyPolicySchema>;\n\nexport const ListApiKeyPoliciesResponseSchema = v.pipe(\n v.object({\n policies: v.optional(v.array(ApiKeyPolicySchema), []),\n }),\n v.transform((value) => value.policies),\n);\n\nexport type ListApiKeyPoliciesResponse = v.InferOutput<typeof ListApiKeyPoliciesResponseSchema>;\n\nconst ApiKeyPolicyInputBaseSchema = v.strictObject({\n name: v.string(),\n description: v.optional(v.string(), \"\"),\n spotMarkets: v.optional(v.array(SpotMarketRuleSchema), []),\n spotMarketScope: v.pipe(\n PolicyMarketScopeEnumSchema,\n v.transform((v) => PolicyMarketScopeCodec.inputToProto[v]),\n ),\n actions: v.pipe(\n v.optional(v.array(PolicyActionEnumSchema), []),\n v.transform((v) => (v ?? []).map((action) => PolicyActionCodec.inputToProto[action])),\n ),\n isTemplate: v.optional(v.boolean(), false),\n assignToKeyId: v.optional(v.pipe(v.string(), v.trim())),\n});\n\nexport const CreateApiKeyPolicyInputSchema = v.pipe(\n ApiKeyPolicyInputBaseSchema,\n v.transform(({ assignToKeyId, ...policy }) => ({ policy, assignToKeyId })),\n);\n\nexport type ApiKeyPolicyCreateInput = v.InferInput<typeof CreateApiKeyPolicyInputSchema>;\n\nconst ApiKeyPolicyPatchSchema = v.strictObject({\n name: v.optional(v.string()),\n description: v.optional(v.string()),\n spotMarkets: v.optional(v.array(SpotMarketRuleSchema)),\n spotMarketScope: v.optional(PolicyMarketScopeEnumSchema),\n actions: v.optional(v.array(PolicyActionEnumSchema)),\n isTemplate: v.optional(v.boolean()),\n});\n\ntype ApiKeyPolicyPatch = v.InferOutput<typeof ApiKeyPolicyPatchSchema>;\n\nconst API_KEY_POLICY_PATCH_FIELDS = defineProtoPatchFields<ApiKeyPolicyPatch>()({\n name: { path: \"name\", encode: (name) => ({ name }) },\n description: { path: \"description\", encode: (description) => ({ description }) },\n spotMarkets: { path: \"spot_markets\", encode: (spotMarkets) => ({ spotMarkets }) },\n spotMarketScope: {\n path: \"spot_market_scope\",\n encode: (scope) => ({ spotMarketScope: PolicyMarketScopeCodec.inputToProto[scope] }),\n },\n actions: {\n path: \"actions\",\n encode: (actions) => ({\n actions: actions.map((action) => PolicyActionCodec.inputToProto[action]),\n }),\n },\n isTemplate: { path: \"is_template\", encode: (isTemplate) => ({ isTemplate }) },\n});\n\nexport const UpdateApiKeyPolicyInputSchema = v.pipe(\n v.strictObject({\n ...ApiKeyPolicyPatchSchema.entries,\n policyId: v.pipe(\n v.string(),\n v.transform((v) => idToBigInt(v, \"policyId\")),\n ),\n expectedRevision: positiveBigintStringInputSchema(\"expectedRevision\"),\n }),\n v.check(\n ({ policyId: _policyId, expectedRevision: _expectedRevision, ...patch }) =>\n Object.values(patch).some((value) => value !== undefined),\n \"At least one API key policy field must be provided\",\n ),\n v.transform(({ policyId, expectedRevision, ...patch }) => {\n const { patch: policy, updateMask } = buildProtoPatch(patch, API_KEY_POLICY_PATCH_FIELDS);\n return {\n policyId,\n policy,\n updateMask,\n expectedRevision,\n };\n }),\n);\n\nexport type ApiKeyPolicyUpdateInput = v.InferInput<typeof UpdateApiKeyPolicyInputSchema>;\n\nexport const ApplyApiKeyPolicyInputSchema = v.strictObject({\n keyId: v.pipe(v.string(), v.trim(), v.minLength(1)),\n policyId: v.pipe(\n v.nullable(v.pipe(v.string(), v.trim())),\n v.transform((value) => (value ? idToBigInt(value, \"policyId\") : undefined)),\n ),\n});\n\nexport type ApiKeyPolicyApplyInput = v.InferInput<typeof ApplyApiKeyPolicyInputSchema>;\n\nexport const DEFAULT_API_KEY_POLICY: ApiKeyPolicy = {\n id: \"\",\n name: \"API Key Policy\",\n description: \"Default API key policy with no permissions\",\n spotMarkets: [],\n spotMarketScope: \"all\",\n actions: [],\n isTemplate: false,\n sourceTemplateId: \"\",\n createdAt: 0,\n updatedAt: 0,\n updatedAtNs: \"0\",\n revision: \"0\",\n};\n"],"mappings":";;;;;;;;AA0BA,MAAM,8BAA8B,EAAE,SAClC,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,GAAG,EAAE,UAAU,GAAG,mBAAmB,CAAC,CACpE;AAEA,MAAa,gCAAgC,EAAE,aAAa,EACxD,OAAO,4BACX,CAAC;AAID,MAAa,6BAA6B,EAAE,KACxC,EAAE,aAAa;CACX,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,CAAC,CAAC;CACjD,OAAO;AACX,CAAC,GACD,EAAE,WAAW,EAAE,UAAU,aAAa;CAClC,UAAU,WAAW,WAAW,UAAU,UAAU,IAAI,KAAA;CACxD;AACJ,EAAE,CACN;;;;;AAQA,MAAa,qBAAqB,EAAE,KAChC,EAAE,OAAO;CACL,IAAI;CACJ,MAAM,EAAE,OAAO;CACf,aAAa,EAAE,OAAO;CACtB,aAAa,EAAE,SAAS,EAAE,MAAM,oBAAoB,GAAG,CAAC,CAAC;CACzD,iBAAiB,EAAE,KACf,kCACA,E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,OAAO,2BAA2B;CACxF,OAAO;EACH;EACA;EACA;EACA;CACJ;AACJ,CAAC,CACL;AAIA,MAAa,+BAA+B,EAAE,aAAa;CACvD,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,GAAG,EAAE,UAAU,CAAC,CAAC;CAClD,UAAU,EAAE,KACR,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,CAAC,CAAC,GACvC,EAAE,WAAW,UAAW,QAAQ,WAAW,OAAO,UAAU,IAAI,KAAA,CAAU,CAC9E;AACJ,CAAC;AAID,MAAa,yBAAuC;CAChD,IAAI;CACJ,MAAM;CACN,aAAa;CACb,aAAa,CAAC;CACd,iBAAiB;CACjB,SAAS,CAAC;CACV,YAAY;CACZ,kBAAkB;CAClB,WAAW;CACX,WAAW;CACX,aAAa;CACb,UAAU;AACd"}
|
|
@@ -295,8 +295,8 @@ declare const SubaccountActivityEventSchema: v.ObjectSchema<{
|
|
|
295
295
|
seconds: bigint;
|
|
296
296
|
nanos: number;
|
|
297
297
|
} | undefined, number | undefined>]>;
|
|
298
|
-
readonly entityKind: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "api_key" | "account" | "subaccount" | "destination" | "session" | "
|
|
299
|
-
readonly eventAction: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "enabled" | "disabled" | "failed" | "created" | "updated" | "deleted" | "removed" | "role_set" | "received" | "replied" | "
|
|
298
|
+
readonly entityKind: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "api_key" | "account" | "subaccount" | "destination" | "session" | "policy" | "member" | "invite" | "security">]>;
|
|
299
|
+
readonly eventAction: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "enabled" | "disabled" | "failed" | "revoked" | "created" | "updated" | "deleted" | "removed" | "role_set" | "received" | "replied" | "blocked" | "hold_placed" | "hold_released">]>;
|
|
300
300
|
readonly source: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "web" | "mobile" | "api">]>;
|
|
301
301
|
readonly ip: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
302
302
|
readonly userAgent: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subaccounts.schemas.d.ts","names":[],"sources":["../../../src/services/subaccounts/subaccounts.schemas.ts"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"subaccounts.schemas.d.ts","names":[],"sources":["../../../src/services/subaccounts/subaccounts.schemas.ts"],"mappings":";;;cA2Ca,sBAAoB,EAAA;KAErB,iBAAiB,EAAE,mBAAmB;cAI5C,iCAA+B,EAAA,yBAAA,EAAA,yBAAA,EAAA;KAEzB,uBAAuB,EAAE,mBAAmB;cAE3C,sCAAoC,EAAA;;;;;;KAOrC,iCAAiC,EAAE,mBACpC;cAGE,gCAA8B,EAAA;;;;;;;KAQ/B,2BAA2B,EAAE,mBAAmB;cAE/C,6BAA2B,EAAA;;;;;;;;;;;;;;;KAK5B,wBAAwB,EAAE,mBAAmB;cAE5C,sCAAoC,EAAA;;;;;KAMrC,iCAAiC,EAAE,mBACpC;cAGE,sCAAoC,EAAA;;;;KAKrC,iCAAiC,EAAE,kBACpC;cAGE,2BAAyB,EAAA;;;;;;;;;;;;;KAQ1B,sBAAsB,EAAE,mBAAmB;cAE1C,6BAA2B,EAAA;;;;;;;;KAS5B,wBAAwB,EAAE,kBAAkB;cAE3C,yBAAuB,EAAA;;;KAIxB,oBAAoB,EAAE,kBAAkB;cAEvC,8BAA4B,EAAA;;;;;;KAO7B,yBAAyB,EAAE,mBAAmB;cAE7C,gCAA8B,EAAA;KAE/B,2BAA2B,EAAE,mBAAmB;cAmB/C,6BAA2B,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA4B5B,wBAAwB,EAAE,kBAAkB;cAE3C,mCAAiC,EAAA;;;;;KASlC,8BAA8B,EAAE,kBAAkB;cAEjD,mCAAiC,EAAA;;;;KAKlC,8BAA8B,EAAE,kBAAkB;cAEjD,uCAAqC,EAAA;;;;;KAEtC,kCAAkC,EAAE,kBACrC;cAGE,8CAA4C,EAAA;;;;KAK7C,yCAAyC,EAAE,kBAC5C;cAGE,kCAAgC,EAAA;;;KAOjC,6BAA6B,EAAE,kBAAkB;cAIvD,oBAAkB,EAAA;KAEZ,yBAAyB,EAAE,mBAAmB;cAI7C,oCAAkC,EAAA;;;;KAQnC,+BAA+B,EAAE,kBAAkB;cAEzD,6BAA2B,EAAA,yBAAA,EAAA,yBAAA,EAAA;KAErB,mBAAmB,EAAE,mBAAmB;cAEvC,kBAAgB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAyBjB,aAAa,EAAE,mBAAmB;cAEjC,wBAAsB,EAAA;;;;;;;;KASvB,mBAAmB,EAAE,mBAAmB;cAEvC,wBAAsB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAqCvB,mBAAmB,EAAE,mBAAmB;cAEvC,+BAA6B,EAAA;;;;;KAM9B,0BAA0B,EAAE,kBAAkB;cAE7C,+BAA6B,EAAA;;;;;;;;;;;;;;;;KAc9B,kBAAkB,EAAE,mBAAmB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { enumLabel, enumLabelSchema } from "../../shared/proto-enum-codec.js";
|
|
2
2
|
import { tsObjToMs, tsObjToNsString } from "../../utils/time.js";
|
|
3
|
-
import { BigIntStringSchema, OptionalTimestampMsSchema, PublicIdSchema, TimestampSchema, idInputSchema, positiveBigintStringInputSchema } from "../../shared/schemas.js";
|
|
3
|
+
import { BigIntStringSchema, OptionalTimestampMsSchema, PublicIdOrEmptySchema, PublicIdSchema, TimestampSchema, idInputSchema, positiveBigintStringInputSchema } from "../../shared/schemas.js";
|
|
4
4
|
import { PolicyActionCodec } from "../policies/shared.codecs.js";
|
|
5
5
|
import { buildProtoPatch, defineProtoPatchFields } from "../../utils/proto-patch.js";
|
|
6
6
|
import { WalletAddressSchema, WalletChallengeMessageSchema, WalletChallengeUriSchema, WalletSignatureSchema } from "../auth/wallet-challenge.schemas.js";
|
|
@@ -36,7 +36,7 @@ const SubaccountRoleCatalogSchema = v.object({
|
|
|
36
36
|
const EffectiveSubaccountPermissionsSchema = v.object({
|
|
37
37
|
role: ProtoSubaccountRoleSchema,
|
|
38
38
|
permissions: v.optional(v.array(ProtoSubaccountPermissionSchema), []),
|
|
39
|
-
subaccountPolicyId:
|
|
39
|
+
subaccountPolicyId: PublicIdOrEmptySchema
|
|
40
40
|
});
|
|
41
41
|
const CreateSubaccountChallengeInputSchema = v.strictObject({
|
|
42
42
|
ownerAddress: WalletAddressSchema,
|
|
@@ -143,7 +143,7 @@ const SubaccountSchema = v.pipe(v.object({
|
|
|
143
143
|
ownerUsername: v.optional(v.string(), ""),
|
|
144
144
|
ownerAvatarUrl: v.optional(v.string(), ""),
|
|
145
145
|
ownerRootSmartAccountAddress: v.string(),
|
|
146
|
-
subaccountPolicyId:
|
|
146
|
+
subaccountPolicyId: PublicIdOrEmptySchema,
|
|
147
147
|
requireMemberMfa: v.optional(v.boolean(), false),
|
|
148
148
|
updatedAt: v.optional(TimestampSchema),
|
|
149
149
|
revision: BigIntStringSchema
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subaccounts.schemas.js","names":[],"sources":["../../../src/services/subaccounts/subaccounts.schemas.ts"],"sourcesContent":["import {\n WalletAddressSchema,\n WalletChallengeMessageSchema,\n WalletChallengeUriSchema,\n WalletSignatureSchema,\n} from \"../auth/wallet-challenge.schemas.js\";\nimport * as v from \"valibot\";\nimport {\n BigIntStringSchema,\n OptionalTimestampMsSchema,\n PublicIdSchema,\n TimestampSchema,\n idInputSchema,\n positiveBigintStringInputSchema,\n} from \"../../shared/schemas.js\";\nimport { tsObjToMs, tsObjToNsString } from \"../../utils/time.js\";\nimport { enumLabel, enumLabelSchema } from \"../../shared/proto-enum-codec.js\";\nimport {\n SubaccountRoleCodec,\n SubaccountPermissionCodec,\n InviteActionCodec,\n InviteStatusCodec,\n SubaccountInviteDirectionCodec,\n SUBACCOUNT_INVITE_DIRECTION_VALUES,\n SubaccountStatusCodec,\n SUBACCOUNT_STATUS_VALUES,\n ActivityEntityKindCodec,\n ActivityEventActionCodec,\n ActivityEventSourceCodec,\n} from \"./subaccounts.codecs.js\";\nimport { PolicyActionCodec } from \"../policies/shared.codecs.js\";\nimport { buildProtoPatch, defineProtoPatchFields } from \"../../utils/proto-patch.js\";\n\nconst SUBACCOUNT_ROLE_VALUES = [\n \"owner\",\n \"admin\",\n \"treasury\",\n \"leveraged_trader\",\n \"trader\",\n \"viewer\",\n] as const;\n\nexport const SubaccountRoleSchema = v.picklist(SUBACCOUNT_ROLE_VALUES);\n\nexport type SubaccountRole = v.InferOutput<typeof SubaccountRoleSchema>;\n\nconst ProtoSubaccountRoleSchema = enumLabelSchema(SubaccountRoleCodec.protoToOutput);\n\nconst ProtoSubaccountPermissionSchema = enumLabelSchema(SubaccountPermissionCodec.protoToOutput);\n\nexport type SubaccountPermission = v.InferOutput<typeof ProtoSubaccountPermissionSchema>;\n\nexport const SubaccountPermissionDefinitionSchema = v.object({\n permission: ProtoSubaccountPermissionSchema,\n displayName: v.optional(v.string(), \"\"),\n description: v.optional(v.string(), \"\"),\n policyAction: enumLabelSchema(PolicyActionCodec.protoToOutput),\n});\n\nexport type SubaccountPermissionDefinition = v.InferOutput<\n typeof SubaccountPermissionDefinitionSchema\n>;\n\nexport const SubaccountRoleDefinitionSchema = v.object({\n role: ProtoSubaccountRoleSchema,\n displayName: v.optional(v.string(), \"\"),\n description: v.optional(v.string(), \"\"),\n assignable: v.optional(v.boolean(), false),\n permissions: v.optional(v.array(ProtoSubaccountPermissionSchema), []),\n});\n\nexport type SubaccountRoleDefinition = v.InferOutput<typeof SubaccountRoleDefinitionSchema>;\n\nexport const SubaccountRoleCatalogSchema = v.object({\n permissions: v.optional(v.array(SubaccountPermissionDefinitionSchema), []),\n roles: v.optional(v.array(SubaccountRoleDefinitionSchema), []),\n});\n\nexport type SubaccountRoleCatalog = v.InferOutput<typeof SubaccountRoleCatalogSchema>;\n\nexport const EffectiveSubaccountPermissionsSchema = v.object({\n role: ProtoSubaccountRoleSchema,\n permissions: v.optional(v.array(ProtoSubaccountPermissionSchema), []),\n subaccountPolicyId: PublicIdSchema,\n});\n\nexport type EffectiveSubaccountPermissions = v.InferOutput<\n typeof EffectiveSubaccountPermissionsSchema\n>;\n\nexport const CreateSubaccountChallengeInputSchema = v.strictObject({\n ownerAddress: WalletAddressSchema,\n uri: WalletChallengeUriSchema,\n});\n\nexport type CreateSubaccountChallengeInput = v.InferInput<\n typeof CreateSubaccountChallengeInputSchema\n>;\n\nexport const SubaccountChallengeSchema = v.object({\n message: WalletChallengeMessageSchema,\n smartAccountAddress: WalletAddressSchema,\n smartAccountSaltNonce: v.number(),\n expiresAt: OptionalTimestampMsSchema,\n polyesterChainId: v.pipe(v.bigint(), v.transform(Number)),\n});\n\nexport type SubaccountChallenge = v.InferOutput<typeof SubaccountChallengeSchema>;\n\nexport const CreateSubaccountInputSchema = v.strictObject({\n label: v.optional(v.string(), \"\"),\n icon: v.optional(v.string(), \"\"),\n color: v.optional(v.string(), \"\"),\n smartAccountAddress: WalletAddressSchema,\n message: WalletChallengeMessageSchema,\n signature: WalletSignatureSchema,\n});\n\nexport type CreateSubaccountInput = v.InferInput<typeof CreateSubaccountInputSchema>;\n\nexport const SubaccountIdInputSchema = v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n});\n\nexport type SubaccountIdInput = v.InferInput<typeof SubaccountIdInputSchema>;\n\nexport const CreateSubaccountResultSchema = v.object({\n subaccountId: PublicIdSchema,\n totalCreated: v.number(),\n smartAccountSaltNonce: v.number(),\n revision: BigIntStringSchema,\n});\n\nexport type CreateSubaccountResult = v.InferOutput<typeof CreateSubaccountResultSchema>;\n\nexport const SubaccountMutationResultSchema = v.object({});\n\nexport type SubaccountMutationResult = v.InferOutput<typeof SubaccountMutationResultSchema>;\n\ntype SubaccountPatch = {\n label?: string;\n icon?: string;\n color?: string;\n status?: (typeof SUBACCOUNT_STATUS_VALUES)[number];\n};\n\nconst SUBACCOUNT_PATCH_FIELDS = defineProtoPatchFields<SubaccountPatch>()({\n label: { path: \"label\", encode: (label) => ({ label }) },\n icon: { path: \"icon\", encode: (icon) => ({ icon }) },\n color: { path: \"color\", encode: (color) => ({ color }) },\n status: {\n path: \"status\",\n encode: (status) => ({ status: SubaccountStatusCodec.inputToProto[status] }),\n },\n});\n\nexport const UpdateSubaccountInputSchema = v.pipe(\n v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n expectedRevision: positiveBigintStringInputSchema(\"expectedRevision\"),\n label: v.optional(v.string()),\n icon: v.optional(v.string()),\n color: v.optional(v.string()),\n status: v.optional(v.picklist(SUBACCOUNT_STATUS_VALUES)),\n }),\n v.check(\n ({ label, icon, color, status }) =>\n label !== undefined ||\n icon !== undefined ||\n color !== undefined ||\n status !== undefined,\n \"At least one subaccount field must be provided\",\n ),\n v.transform(({ subaccountId, expectedRevision, ...input }) => {\n const { patch: subaccount, updateMask } = buildProtoPatch(input, SUBACCOUNT_PATCH_FIELDS);\n return {\n subaccountId,\n subaccount,\n updateMask,\n expectedRevision,\n };\n }),\n);\n\nexport type UpdateSubaccountInput = v.InferInput<typeof UpdateSubaccountInputSchema>;\n\nexport const InviteSubaccountMemberInputSchema = v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n granteeAccountId: idInputSchema(\"granteeAccountId\"),\n role: v.pipe(\n SubaccountRoleSchema,\n v.transform((role) => SubaccountRoleCodec.inputToProto[role]),\n ),\n});\n\nexport type InviteSubaccountMemberInput = v.InferInput<typeof InviteSubaccountMemberInputSchema>;\n\nexport const RemoveSubaccountMemberInputSchema = v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n granteeAccountId: idInputSchema(\"granteeAccountId\"),\n});\n\nexport type RemoveSubaccountMemberInput = v.InferInput<typeof RemoveSubaccountMemberInputSchema>;\n\nexport const UpdateSubaccountMemberRoleInputSchema = InviteSubaccountMemberInputSchema;\n\nexport type UpdateSubaccountMemberRoleInput = v.InferInput<\n typeof UpdateSubaccountMemberRoleInputSchema\n>;\n\nexport const SetSubaccountMemberMfaRequirementInputSchema = v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n requireMemberMfa: v.boolean(),\n});\n\nexport type SetSubaccountMemberMfaRequirementInput = v.InferInput<\n typeof SetSubaccountMemberMfaRequirementInputSchema\n>;\n\nexport const ListSubaccountInvitesInputSchema = v.strictObject({\n direction: v.pipe(\n v.optional(v.picklist(SUBACCOUNT_INVITE_DIRECTION_VALUES), \"\"),\n v.transform((direction) => SubaccountInviteDirectionCodec.inputToProto[direction]),\n ),\n});\n\nexport type ListSubaccountInvitesInput = v.InferInput<typeof ListSubaccountInvitesInputSchema>;\n\nconst InviteActionSchema = v.picklist([\"accept\", \"decline\", \"cancel\"]);\n\nconst InviteStatusSchema = v.picklist([\"pending\", \"accepted\", \"declined\", \"cancelled\"]);\n\nexport type SubaccountInviteStatus = v.InferOutput<typeof InviteStatusSchema>;\n\nconst ProtoInviteStatusSchema = v.number();\n\nexport const RespondSubaccountInviteInputSchema = v.strictObject({\n inviteId: idInputSchema(\"inviteId\"),\n action: v.pipe(\n InviteActionSchema,\n v.transform((v) => InviteActionCodec.inputToProto[v]),\n ),\n});\n\nexport type RespondSubaccountInviteInput = v.InferInput<typeof RespondSubaccountInviteInputSchema>;\n\nconst ProtoSubaccountStatusSchema = enumLabelSchema(SubaccountStatusCodec.protoToOutput);\n\nexport type SubaccountStatus = v.InferOutput<typeof ProtoSubaccountStatusSchema>;\n\nexport const SubaccountSchema = v.pipe(\n v.object({\n id: PublicIdSchema,\n role: ProtoSubaccountRoleSchema,\n label: v.optional(v.string(), \"\"),\n icon: v.optional(v.string(), \"\"),\n color: v.optional(v.string(), \"\"),\n status: ProtoSubaccountStatusSchema,\n smartAccountAddress: v.string(),\n smartAccountSaltNonce: v.optional(v.number()),\n ownerUsername: v.optional(v.string(), \"\"),\n ownerAvatarUrl: v.optional(v.string(), \"\"),\n ownerRootSmartAccountAddress: v.string(),\n subaccountPolicyId: PublicIdSchema,\n requireMemberMfa: v.optional(v.boolean(), false),\n updatedAt: v.optional(TimestampSchema),\n revision: BigIntStringSchema,\n }),\n v.transform(({ updatedAt, ...subaccount }) => ({\n ...subaccount,\n updatedAt: tsObjToMs(updatedAt),\n updatedAtNs: tsObjToNsString(updatedAt),\n })),\n);\n\nexport type Subaccount = v.InferOutput<typeof SubaccountSchema>;\n\nexport const SubaccountMemberSchema = v.object({\n accountId: PublicIdSchema,\n role: ProtoSubaccountRoleSchema,\n username: v.optional(v.string(), \"\"),\n smartAccountAddress: v.string(),\n avatarUrl: v.optional(v.string(), \"\"),\n mfaEnrolled: v.optional(v.boolean(), false),\n});\n\nexport type SubaccountMember = v.InferOutput<typeof SubaccountMemberSchema>;\n\nexport const SubaccountInviteSchema = v.pipe(\n v.object({\n id: PublicIdSchema,\n subaccountId: PublicIdSchema,\n granteeAccountId: PublicIdSchema,\n inviterAccountId: PublicIdSchema,\n role: ProtoSubaccountRoleSchema,\n status: v.pipe(\n ProtoInviteStatusSchema,\n v.transform((v) => enumLabel(InviteStatusCodec.protoToOutput, v)),\n ),\n createdAt: OptionalTimestampMsSchema,\n respondedAt: OptionalTimestampMsSchema,\n granteeUsername: v.optional(v.string(), \"\"),\n inviterUsername: v.optional(v.string(), \"\"),\n subaccountLabel: v.optional(v.string(), \"\"),\n inviterRootSmartAccountAddress: v.string(),\n granteeRootSmartAccountAddress: v.string(),\n requireMemberMfa: v.boolean(),\n }),\n v.transform(\n ({\n subaccountLabel,\n subaccountId,\n inviterRootSmartAccountAddress,\n granteeRootSmartAccountAddress,\n ...rest\n }) => ({\n ...rest,\n subaccountId,\n subaccountLabel,\n inviterSmartAccountAddress: inviterRootSmartAccountAddress,\n granteeSmartAccountAddress: granteeRootSmartAccountAddress,\n }),\n ),\n);\n\nexport type SubaccountInvite = v.InferOutput<typeof SubaccountInviteSchema>;\n\nexport const SubaccountActivityInputSchema = v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n limit: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(200)), 50),\n pageToken: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n});\n\nexport type SubaccountActivityInput = v.InferInput<typeof SubaccountActivityInputSchema>;\n\nexport const SubaccountActivityEventSchema = v.object({\n createdAt: OptionalTimestampMsSchema,\n entityKind: enumLabelSchema(ActivityEntityKindCodec.protoToOutput),\n eventAction: enumLabelSchema(ActivityEventActionCodec.protoToOutput),\n source: enumLabelSchema(ActivityEventSourceCodec.protoToOutput),\n ip: v.optional(v.string()),\n userAgent: v.optional(v.string()),\n actorAccountId: PublicIdSchema,\n payloadJson: v.pipe(\n v.string(),\n v.transform((v) => JSON.parse(v)),\n ),\n});\n\nexport type SubaccountEvent = v.InferOutput<typeof SubaccountActivityEventSchema>;\n"],"mappings":";;;;;;;;AA0CA,MAAa,uBAAuB,EAAE,SAAS;CAR3C;CACA;CACA;CACA;CACA;CACA;AAG2C,CAAsB;AAIrE,MAAM,4BAA4B,gBAAgB,oBAAoB,aAAa;AAEnF,MAAM,kCAAkC,gBAAgB,0BAA0B,aAAa;AAI/F,MAAa,uCAAuC,EAAE,OAAO;CACzD,YAAY;CACZ,aAAa,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CACtC,aAAa,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CACtC,cAAc,gBAAgB,kBAAkB,aAAa;AACjE,CAAC;AAMD,MAAa,iCAAiC,EAAE,OAAO;CACnD,MAAM;CACN,aAAa,EAAE,SAAS,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EAAE,SAAS,EAAE,OAAO,CAAC;CACzB,WAAW,EAAE,SAAS,EAAE,OAAO,CAAC;CAChC,gBAAgB;CAChB,aAAa,EAAE,KACX,EAAE,OAAO,GACT,EAAE,WAAW,MAAM,KAAK,MAAM,CAAC,CAAC,CACpC;AACJ,CAAC"}
|
|
1
|
+
{"version":3,"file":"subaccounts.schemas.js","names":[],"sources":["../../../src/services/subaccounts/subaccounts.schemas.ts"],"sourcesContent":["import {\n WalletAddressSchema,\n WalletChallengeMessageSchema,\n WalletChallengeUriSchema,\n WalletSignatureSchema,\n} from \"../auth/wallet-challenge.schemas.js\";\nimport * as v from \"valibot\";\nimport {\n BigIntStringSchema,\n OptionalTimestampMsSchema,\n PublicIdOrEmptySchema,\n PublicIdSchema,\n TimestampSchema,\n idInputSchema,\n positiveBigintStringInputSchema,\n} from \"../../shared/schemas.js\";\nimport { tsObjToMs, tsObjToNsString } from \"../../utils/time.js\";\nimport { enumLabel, enumLabelSchema } from \"../../shared/proto-enum-codec.js\";\nimport {\n SubaccountRoleCodec,\n SubaccountPermissionCodec,\n InviteActionCodec,\n InviteStatusCodec,\n SubaccountInviteDirectionCodec,\n SUBACCOUNT_INVITE_DIRECTION_VALUES,\n SubaccountStatusCodec,\n SUBACCOUNT_STATUS_VALUES,\n ActivityEntityKindCodec,\n ActivityEventActionCodec,\n ActivityEventSourceCodec,\n} from \"./subaccounts.codecs.js\";\nimport { PolicyActionCodec } from \"../policies/shared.codecs.js\";\nimport { buildProtoPatch, defineProtoPatchFields } from \"../../utils/proto-patch.js\";\n\nconst SUBACCOUNT_ROLE_VALUES = [\n \"owner\",\n \"admin\",\n \"treasury\",\n \"leveraged_trader\",\n \"trader\",\n \"viewer\",\n] as const;\n\nexport const SubaccountRoleSchema = v.picklist(SUBACCOUNT_ROLE_VALUES);\n\nexport type SubaccountRole = v.InferOutput<typeof SubaccountRoleSchema>;\n\nconst ProtoSubaccountRoleSchema = enumLabelSchema(SubaccountRoleCodec.protoToOutput);\n\nconst ProtoSubaccountPermissionSchema = enumLabelSchema(SubaccountPermissionCodec.protoToOutput);\n\nexport type SubaccountPermission = v.InferOutput<typeof ProtoSubaccountPermissionSchema>;\n\nexport const SubaccountPermissionDefinitionSchema = v.object({\n permission: ProtoSubaccountPermissionSchema,\n displayName: v.optional(v.string(), \"\"),\n description: v.optional(v.string(), \"\"),\n policyAction: enumLabelSchema(PolicyActionCodec.protoToOutput),\n});\n\nexport type SubaccountPermissionDefinition = v.InferOutput<\n typeof SubaccountPermissionDefinitionSchema\n>;\n\nexport const SubaccountRoleDefinitionSchema = v.object({\n role: ProtoSubaccountRoleSchema,\n displayName: v.optional(v.string(), \"\"),\n description: v.optional(v.string(), \"\"),\n assignable: v.optional(v.boolean(), false),\n permissions: v.optional(v.array(ProtoSubaccountPermissionSchema), []),\n});\n\nexport type SubaccountRoleDefinition = v.InferOutput<typeof SubaccountRoleDefinitionSchema>;\n\nexport const SubaccountRoleCatalogSchema = v.object({\n permissions: v.optional(v.array(SubaccountPermissionDefinitionSchema), []),\n roles: v.optional(v.array(SubaccountRoleDefinitionSchema), []),\n});\n\nexport type SubaccountRoleCatalog = v.InferOutput<typeof SubaccountRoleCatalogSchema>;\n\nexport const EffectiveSubaccountPermissionsSchema = v.object({\n role: ProtoSubaccountRoleSchema,\n permissions: v.optional(v.array(ProtoSubaccountPermissionSchema), []),\n subaccountPolicyId: PublicIdOrEmptySchema,\n});\n\nexport type EffectiveSubaccountPermissions = v.InferOutput<\n typeof EffectiveSubaccountPermissionsSchema\n>;\n\nexport const CreateSubaccountChallengeInputSchema = v.strictObject({\n ownerAddress: WalletAddressSchema,\n uri: WalletChallengeUriSchema,\n});\n\nexport type CreateSubaccountChallengeInput = v.InferInput<\n typeof CreateSubaccountChallengeInputSchema\n>;\n\nexport const SubaccountChallengeSchema = v.object({\n message: WalletChallengeMessageSchema,\n smartAccountAddress: WalletAddressSchema,\n smartAccountSaltNonce: v.number(),\n expiresAt: OptionalTimestampMsSchema,\n polyesterChainId: v.pipe(v.bigint(), v.transform(Number)),\n});\n\nexport type SubaccountChallenge = v.InferOutput<typeof SubaccountChallengeSchema>;\n\nexport const CreateSubaccountInputSchema = v.strictObject({\n label: v.optional(v.string(), \"\"),\n icon: v.optional(v.string(), \"\"),\n color: v.optional(v.string(), \"\"),\n smartAccountAddress: WalletAddressSchema,\n message: WalletChallengeMessageSchema,\n signature: WalletSignatureSchema,\n});\n\nexport type CreateSubaccountInput = v.InferInput<typeof CreateSubaccountInputSchema>;\n\nexport const SubaccountIdInputSchema = v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n});\n\nexport type SubaccountIdInput = v.InferInput<typeof SubaccountIdInputSchema>;\n\nexport const CreateSubaccountResultSchema = v.object({\n subaccountId: PublicIdSchema,\n totalCreated: v.number(),\n smartAccountSaltNonce: v.number(),\n revision: BigIntStringSchema,\n});\n\nexport type CreateSubaccountResult = v.InferOutput<typeof CreateSubaccountResultSchema>;\n\nexport const SubaccountMutationResultSchema = v.object({});\n\nexport type SubaccountMutationResult = v.InferOutput<typeof SubaccountMutationResultSchema>;\n\ntype SubaccountPatch = {\n label?: string;\n icon?: string;\n color?: string;\n status?: (typeof SUBACCOUNT_STATUS_VALUES)[number];\n};\n\nconst SUBACCOUNT_PATCH_FIELDS = defineProtoPatchFields<SubaccountPatch>()({\n label: { path: \"label\", encode: (label) => ({ label }) },\n icon: { path: \"icon\", encode: (icon) => ({ icon }) },\n color: { path: \"color\", encode: (color) => ({ color }) },\n status: {\n path: \"status\",\n encode: (status) => ({ status: SubaccountStatusCodec.inputToProto[status] }),\n },\n});\n\nexport const UpdateSubaccountInputSchema = v.pipe(\n v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n expectedRevision: positiveBigintStringInputSchema(\"expectedRevision\"),\n label: v.optional(v.string()),\n icon: v.optional(v.string()),\n color: v.optional(v.string()),\n status: v.optional(v.picklist(SUBACCOUNT_STATUS_VALUES)),\n }),\n v.check(\n ({ label, icon, color, status }) =>\n label !== undefined ||\n icon !== undefined ||\n color !== undefined ||\n status !== undefined,\n \"At least one subaccount field must be provided\",\n ),\n v.transform(({ subaccountId, expectedRevision, ...input }) => {\n const { patch: subaccount, updateMask } = buildProtoPatch(input, SUBACCOUNT_PATCH_FIELDS);\n return {\n subaccountId,\n subaccount,\n updateMask,\n expectedRevision,\n };\n }),\n);\n\nexport type UpdateSubaccountInput = v.InferInput<typeof UpdateSubaccountInputSchema>;\n\nexport const InviteSubaccountMemberInputSchema = v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n granteeAccountId: idInputSchema(\"granteeAccountId\"),\n role: v.pipe(\n SubaccountRoleSchema,\n v.transform((role) => SubaccountRoleCodec.inputToProto[role]),\n ),\n});\n\nexport type InviteSubaccountMemberInput = v.InferInput<typeof InviteSubaccountMemberInputSchema>;\n\nexport const RemoveSubaccountMemberInputSchema = v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n granteeAccountId: idInputSchema(\"granteeAccountId\"),\n});\n\nexport type RemoveSubaccountMemberInput = v.InferInput<typeof RemoveSubaccountMemberInputSchema>;\n\nexport const UpdateSubaccountMemberRoleInputSchema = InviteSubaccountMemberInputSchema;\n\nexport type UpdateSubaccountMemberRoleInput = v.InferInput<\n typeof UpdateSubaccountMemberRoleInputSchema\n>;\n\nexport const SetSubaccountMemberMfaRequirementInputSchema = v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n requireMemberMfa: v.boolean(),\n});\n\nexport type SetSubaccountMemberMfaRequirementInput = v.InferInput<\n typeof SetSubaccountMemberMfaRequirementInputSchema\n>;\n\nexport const ListSubaccountInvitesInputSchema = v.strictObject({\n direction: v.pipe(\n v.optional(v.picklist(SUBACCOUNT_INVITE_DIRECTION_VALUES), \"\"),\n v.transform((direction) => SubaccountInviteDirectionCodec.inputToProto[direction]),\n ),\n});\n\nexport type ListSubaccountInvitesInput = v.InferInput<typeof ListSubaccountInvitesInputSchema>;\n\nconst InviteActionSchema = v.picklist([\"accept\", \"decline\", \"cancel\"]);\n\nconst InviteStatusSchema = v.picklist([\"pending\", \"accepted\", \"declined\", \"cancelled\"]);\n\nexport type SubaccountInviteStatus = v.InferOutput<typeof InviteStatusSchema>;\n\nconst ProtoInviteStatusSchema = v.number();\n\nexport const RespondSubaccountInviteInputSchema = v.strictObject({\n inviteId: idInputSchema(\"inviteId\"),\n action: v.pipe(\n InviteActionSchema,\n v.transform((v) => InviteActionCodec.inputToProto[v]),\n ),\n});\n\nexport type RespondSubaccountInviteInput = v.InferInput<typeof RespondSubaccountInviteInputSchema>;\n\nconst ProtoSubaccountStatusSchema = enumLabelSchema(SubaccountStatusCodec.protoToOutput);\n\nexport type SubaccountStatus = v.InferOutput<typeof ProtoSubaccountStatusSchema>;\n\nexport const SubaccountSchema = v.pipe(\n v.object({\n id: PublicIdSchema,\n role: ProtoSubaccountRoleSchema,\n label: v.optional(v.string(), \"\"),\n icon: v.optional(v.string(), \"\"),\n color: v.optional(v.string(), \"\"),\n status: ProtoSubaccountStatusSchema,\n smartAccountAddress: v.string(),\n smartAccountSaltNonce: v.optional(v.number()),\n ownerUsername: v.optional(v.string(), \"\"),\n ownerAvatarUrl: v.optional(v.string(), \"\"),\n ownerRootSmartAccountAddress: v.string(),\n subaccountPolicyId: PublicIdOrEmptySchema,\n requireMemberMfa: v.optional(v.boolean(), false),\n updatedAt: v.optional(TimestampSchema),\n revision: BigIntStringSchema,\n }),\n v.transform(({ updatedAt, ...subaccount }) => ({\n ...subaccount,\n updatedAt: tsObjToMs(updatedAt),\n updatedAtNs: tsObjToNsString(updatedAt),\n })),\n);\n\nexport type Subaccount = v.InferOutput<typeof SubaccountSchema>;\n\nexport const SubaccountMemberSchema = v.object({\n accountId: PublicIdSchema,\n role: ProtoSubaccountRoleSchema,\n username: v.optional(v.string(), \"\"),\n smartAccountAddress: v.string(),\n avatarUrl: v.optional(v.string(), \"\"),\n mfaEnrolled: v.optional(v.boolean(), false),\n});\n\nexport type SubaccountMember = v.InferOutput<typeof SubaccountMemberSchema>;\n\nexport const SubaccountInviteSchema = v.pipe(\n v.object({\n id: PublicIdSchema,\n subaccountId: PublicIdSchema,\n granteeAccountId: PublicIdSchema,\n inviterAccountId: PublicIdSchema,\n role: ProtoSubaccountRoleSchema,\n status: v.pipe(\n ProtoInviteStatusSchema,\n v.transform((v) => enumLabel(InviteStatusCodec.protoToOutput, v)),\n ),\n createdAt: OptionalTimestampMsSchema,\n respondedAt: OptionalTimestampMsSchema,\n granteeUsername: v.optional(v.string(), \"\"),\n inviterUsername: v.optional(v.string(), \"\"),\n subaccountLabel: v.optional(v.string(), \"\"),\n inviterRootSmartAccountAddress: v.string(),\n granteeRootSmartAccountAddress: v.string(),\n requireMemberMfa: v.boolean(),\n }),\n v.transform(\n ({\n subaccountLabel,\n subaccountId,\n inviterRootSmartAccountAddress,\n granteeRootSmartAccountAddress,\n ...rest\n }) => ({\n ...rest,\n subaccountId,\n subaccountLabel,\n inviterSmartAccountAddress: inviterRootSmartAccountAddress,\n granteeSmartAccountAddress: granteeRootSmartAccountAddress,\n }),\n ),\n);\n\nexport type SubaccountInvite = v.InferOutput<typeof SubaccountInviteSchema>;\n\nexport const SubaccountActivityInputSchema = v.strictObject({\n subaccountId: idInputSchema(\"subaccountId\"),\n limit: v.optional(v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(200)), 50),\n pageToken: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n});\n\nexport type SubaccountActivityInput = v.InferInput<typeof SubaccountActivityInputSchema>;\n\nexport const SubaccountActivityEventSchema = v.object({\n createdAt: OptionalTimestampMsSchema,\n entityKind: enumLabelSchema(ActivityEntityKindCodec.protoToOutput),\n eventAction: enumLabelSchema(ActivityEventActionCodec.protoToOutput),\n source: enumLabelSchema(ActivityEventSourceCodec.protoToOutput),\n ip: v.optional(v.string()),\n userAgent: v.optional(v.string()),\n actorAccountId: PublicIdSchema,\n payloadJson: v.pipe(\n v.string(),\n v.transform((v) => JSON.parse(v)),\n ),\n});\n\nex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AA4B;CAC5B,4BAA4B;AAChC,EACJ,CACJ;AAIA,MAAa,gCAAgC,EAAE,aAAa;CACxD,cAAc,cAAc,cAAc;CAC1C,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,QAAQ,GAAG,EAAE,SAAS,CAAC,GAAG,EAAE,SAAS,GAAG,CAAC,GAAG,EAAE;CACrF,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE;AAC1D,CAAC;AAID,MAAa,gCAAgC,EAAE,OAAO;CAClD,WAAW;CACX,YAAY,gBAAgB,wBAAwB,aAAa;CACjE,aAAa,gBAAgB,yBAAyB,aAAa;CACnE,QAAQ,gBAAgB,yBAAyB,aAAa;CAC9D,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC;CACzB,WAAW,EAAE,SAAS,EAAE,OAAO,CAAC;CAChC,gBAAgB;CAChB,aAAa,EAAE,KACX,EAAE,OAAO,GACT,EAAE,WAAW,MAAM,KAAK,MAAM,CAAC,CAAC,CACpC;AACJ,CAAC"}
|
|
@@ -845,7 +845,7 @@ type CreateTriggerInput = v.InferInput<ReturnType<typeof createCreateTriggerInpu
|
|
|
845
845
|
declare const ListTriggersInputSchema: v.SchemaWithPipe<readonly [v.StrictObjectSchema<{
|
|
846
846
|
readonly parentOrderId: v.SchemaWithPipe<readonly [v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, undefined>, v.TransformAction<string | undefined, bigint | undefined>]>;
|
|
847
847
|
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>;
|
|
848
|
-
readonly status: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["created", "armed", "running", "completed", "cancelled", "failed", "paused"], undefined>, undefined>, undefined>, v.TransformAction<("failed" | "cancelled" | "
|
|
848
|
+
readonly status: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ArraySchema<v.PicklistSchema<readonly ["created", "armed", "running", "completed", "cancelled", "failed", "paused"], undefined>, undefined>, undefined>, v.TransformAction<("failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused")[] | undefined, (TriggerStatus.STATUS_CREATED | TriggerStatus.STATUS_ARMED | TriggerStatus.STATUS_RUNNING | TriggerStatus.STATUS_COMPLETED | TriggerStatus.STATUS_CANCELED | TriggerStatus.STATUS_FAILED | TriggerStatus.STATUS_PAUSED)[]>]>;
|
|
849
849
|
readonly triggerType: v.SchemaWithPipe<readonly [v.OptionalSchema<v.PicklistSchema<readonly ["stop_loss", "take_profit", "trailing_stop", "twap", "ladder"], undefined>, undefined>, v.TransformAction<"stop_loss" | "take_profit" | "trailing_stop" | "twap" | "ladder" | undefined, TriggerType>]>;
|
|
850
850
|
readonly limit: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.GtValueAction<number, 0, undefined>, v.MaxValueAction<number, 1000, undefined>]>, 50>;
|
|
851
851
|
readonly pageToken: v.OptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.TrimAction]>, "">;
|
|
@@ -29,62 +29,62 @@ declare const CreateTriggerResultSchema: v.SchemaWithPipe<readonly [v.ObjectSche
|
|
|
29
29
|
type CreateTriggerResult = v.InferOutput<typeof CreateTriggerResultSchema>;
|
|
30
30
|
declare const CancelTriggerResultSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
31
31
|
readonly triggerId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
32
|
-
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "cancelled" | "
|
|
32
|
+
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused">]>;
|
|
33
33
|
readonly tsNs: v.BigintSchema<undefined>;
|
|
34
34
|
}, undefined>, v.TransformAction<{
|
|
35
35
|
triggerId: string;
|
|
36
|
-
status: "unspecified" | "failed" | "cancelled" | "
|
|
36
|
+
status: "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused";
|
|
37
37
|
tsNs: bigint;
|
|
38
38
|
}, {
|
|
39
39
|
ts: number;
|
|
40
40
|
tsNs: string;
|
|
41
41
|
triggerId: string;
|
|
42
|
-
status: "unspecified" | "failed" | "cancelled" | "
|
|
42
|
+
status: "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused";
|
|
43
43
|
}>]>;
|
|
44
44
|
type CancelTriggerResult = v.InferOutput<typeof CancelTriggerResultSchema>;
|
|
45
45
|
declare const ModifyTriggerResultSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
46
46
|
readonly triggerId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
47
|
-
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "cancelled" | "
|
|
47
|
+
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused">]>;
|
|
48
48
|
readonly tsNs: v.BigintSchema<undefined>;
|
|
49
49
|
}, undefined>, v.TransformAction<{
|
|
50
50
|
triggerId: string;
|
|
51
|
-
status: "unspecified" | "failed" | "cancelled" | "
|
|
51
|
+
status: "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused";
|
|
52
52
|
tsNs: bigint;
|
|
53
53
|
}, {
|
|
54
54
|
ts: number;
|
|
55
55
|
tsNs: string;
|
|
56
56
|
triggerId: string;
|
|
57
|
-
status: "unspecified" | "failed" | "cancelled" | "
|
|
57
|
+
status: "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused";
|
|
58
58
|
}>]>;
|
|
59
59
|
type ModifyTriggerResult = v.InferOutput<typeof ModifyTriggerResultSchema>;
|
|
60
60
|
declare const PauseTriggerResultSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
61
61
|
readonly triggerId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
62
|
-
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "cancelled" | "
|
|
62
|
+
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused">]>;
|
|
63
63
|
readonly tsNs: v.BigintSchema<undefined>;
|
|
64
64
|
}, undefined>, v.TransformAction<{
|
|
65
65
|
triggerId: string;
|
|
66
|
-
status: "unspecified" | "failed" | "cancelled" | "
|
|
66
|
+
status: "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused";
|
|
67
67
|
tsNs: bigint;
|
|
68
68
|
}, {
|
|
69
69
|
ts: number;
|
|
70
70
|
tsNs: string;
|
|
71
71
|
triggerId: string;
|
|
72
|
-
status: "unspecified" | "failed" | "cancelled" | "
|
|
72
|
+
status: "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused";
|
|
73
73
|
}>]>;
|
|
74
74
|
type PauseTriggerResult = v.InferOutput<typeof PauseTriggerResultSchema>;
|
|
75
75
|
declare const ResumeTriggerResultSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
76
76
|
readonly triggerId: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
77
|
-
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "cancelled" | "
|
|
77
|
+
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused">]>;
|
|
78
78
|
readonly tsNs: v.BigintSchema<undefined>;
|
|
79
79
|
}, undefined>, v.TransformAction<{
|
|
80
80
|
triggerId: string;
|
|
81
|
-
status: "unspecified" | "failed" | "cancelled" | "
|
|
81
|
+
status: "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused";
|
|
82
82
|
tsNs: bigint;
|
|
83
83
|
}, {
|
|
84
84
|
ts: number;
|
|
85
85
|
tsNs: string;
|
|
86
86
|
triggerId: string;
|
|
87
|
-
status: "unspecified" | "failed" | "cancelled" | "
|
|
87
|
+
status: "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused";
|
|
88
88
|
}>]>;
|
|
89
89
|
type ResumeTriggerResult = v.InferOutput<typeof ResumeTriggerResultSchema>;
|
|
90
90
|
type StopDetailsOutput = {
|
|
@@ -560,7 +560,7 @@ declare function createTriggerSchema(scales: SdkScales): v.SchemaWithPipe<readon
|
|
|
560
560
|
triggerId: string;
|
|
561
561
|
subaccountId: string;
|
|
562
562
|
symbolId: number;
|
|
563
|
-
status: "unspecified" | "failed" | "cancelled" | "
|
|
563
|
+
status: "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused";
|
|
564
564
|
parentOrderId: string | undefined;
|
|
565
565
|
qty: string;
|
|
566
566
|
feeAsset: "unspecified" | "quote" | "base";
|
|
@@ -716,7 +716,7 @@ declare function createTriggerSchema(scales: SdkScales): v.SchemaWithPipe<readon
|
|
|
716
716
|
triggerId: string;
|
|
717
717
|
subaccountId: string;
|
|
718
718
|
symbolId: number;
|
|
719
|
-
status: "unspecified" | "failed" | "cancelled" | "
|
|
719
|
+
status: "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused";
|
|
720
720
|
parentOrderId: string | undefined;
|
|
721
721
|
qty: string;
|
|
722
722
|
feeAsset: "unspecified" | "quote" | "base";
|
|
@@ -872,7 +872,7 @@ declare function createTriggerSchema(scales: SdkScales): v.SchemaWithPipe<readon
|
|
|
872
872
|
triggerId: string;
|
|
873
873
|
subaccountId: string;
|
|
874
874
|
symbolId: number;
|
|
875
|
-
status: "unspecified" | "failed" | "cancelled" | "
|
|
875
|
+
status: "unspecified" | "failed" | "cancelled" | "completed" | "created" | "armed" | "running" | "paused";
|
|
876
876
|
parentOrderId: string | undefined;
|
|
877
877
|
qty: string;
|
|
878
878
|
feeAsset: "unspecified" | "quote" | "base";
|
package/dist/shared/schemas.js
CHANGED
|
@@ -29,6 +29,8 @@ v.optional(v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(MAX_UINT64_
|
|
|
29
29
|
const OptionalTimestampMsToUsInputSchema = v.optional(v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(MAX_UINT64_TIMESTAMP_MS_US), v.transform((value) => BigInt(value) * MS_TO_US)));
|
|
30
30
|
const OptionalTimestampSecondsInputSchema = v.optional(v.pipe(v.number(), v.integer(), v.minValue(0), v.maxValue(Number.MAX_SAFE_INTEGER), v.transform((value) => BigInt(value))));
|
|
31
31
|
const PublicIdSchema = v.pipe(v.bigint(), v.transform((value) => formatId(value)));
|
|
32
|
+
/** Like `PublicIdSchema`, but formats the proto unset value `0n` as `""`. */
|
|
33
|
+
const PublicIdOrEmptySchema = v.pipe(v.bigint(), v.transform((value) => value === 0n ? "" : formatId(value)));
|
|
32
34
|
const OptionalPublicIdSchema = v.pipe(v.optional(v.bigint()), v.transform((value) => value ? formatId(value) : void 0));
|
|
33
35
|
const TrimmedStringSchema = v.pipe(v.string(), v.trim());
|
|
34
36
|
const OptionalTrimmedStringSchema = v.optional(TrimmedStringSchema);
|
|
@@ -64,6 +66,6 @@ function positiveBigintStringInputSchema(fieldName) {
|
|
|
64
66
|
}
|
|
65
67
|
const JsonObjectSchema = v.custom((input) => typeof input === "object" && input !== null && !Array.isArray(input));
|
|
66
68
|
//#endregion
|
|
67
|
-
export { BigIntStringSchema, JsonObjectSchema, OptionalBigIntStringSchema, OptionalNumberDefaultNullSchema, OptionalNumberToIntOrZeroSchema, OptionalPublicIdSchema, OptionalTimestampMsSchema, OptionalTimestampMsToUsInputSchema, OptionalTimestampSecondsInputSchema, PublicIdSchema, TimestampMsSchema, TimestampSchema, U128Schema, bigintStringInputSchema, idInputSchema, optionalIdInputSchema, optionalSubaccountIdInputSchema, optionalUint64DecimalFilterSchema, positiveBigintStringInputSchema };
|
|
69
|
+
export { BigIntStringSchema, JsonObjectSchema, OptionalBigIntStringSchema, OptionalNumberDefaultNullSchema, OptionalNumberToIntOrZeroSchema, OptionalPublicIdSchema, OptionalTimestampMsSchema, OptionalTimestampMsToUsInputSchema, OptionalTimestampSecondsInputSchema, PublicIdOrEmptySchema, PublicIdSchema, TimestampMsSchema, TimestampSchema, U128Schema, bigintStringInputSchema, idInputSchema, optionalIdInputSchema, optionalSubaccountIdInputSchema, optionalUint64DecimalFilterSchema, positiveBigintStringInputSchema };
|
|
68
70
|
|
|
69
71
|
//# sourceMappingURL=schemas.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.js","names":[],"sources":["../../src/shared/schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { formatId, idToBigInt } from \"../utils/base58-id.js\";\nimport { parseOptionalUint64DecimalStrict, toBpsOrZero, toIntOrZero } from \"../utils/numbers.js\";\nimport { tsNsToMs, tsObjToMs } from \"../utils/time.js\";\nimport type { JsonObject } from \"@bufbuild/protobuf\";\nimport { PROTOBUF_UINT32_MAX } from \"./wire-bounds.js\";\n\nconst UINT64_MAX = (1n << 64n) - 1n;\nconst MS_TO_US = 1_000n;\nconst MS_TO_NS = 1_000_000n;\nconst MAX_UINT64_TIMESTAMP_MS_US = Number(UINT64_MAX / MS_TO_US);\nconst MAX_UINT64_TIMESTAMP_MS = Number(UINT64_MAX / MS_TO_NS);\n\nexport const U128Schema = v.object({\n hi: v.bigint(),\n lo: v.bigint(),\n});\n\nexport const TimestampSchema = v.object({\n seconds: v.bigint(),\n nanos: v.optional(v.number(), 0),\n});\n\nexport const TimestampMsSchema = v.pipe(\n TimestampSchema,\n v.transform((value) => tsObjToMs(value)),\n);\n\nexport const OptionalTimestampMsSchema = v.pipe(\n v.optional(TimestampSchema),\n v.transform((value) => tsObjToMs(value)),\n);\n\nexport const OptionalNumberDefaultNullSchema = v.optional(v.nullable(v.number()), null);\n\nexport const OptionalNumberToIntOrZeroSchema = v.pipe(\n v.optional(v.nullable(v.pipe(v.number(), v.maxValue(PROTOBUF_UINT32_MAX))), null),\n v.transform((value) => toIntOrZero(value)),\n);\n\nexport const OptionalNumberToBpsOrZeroSchema = v.pipe(\n OptionalNumberDefaultNullSchema,\n v.transform((value) => toBpsOrZero(value)),\n);\n\nexport const TimestampNsMsSchema = v.pipe(\n v.bigint(),\n v.transform((value) => tsNsToMs(value)),\n);\n\nexport const BigIntStringSchema = v.pipe(\n v.bigint(),\n v.transform((value) => value.toString()),\n);\n\nexport const OptionalBigIntStringSchema = v.pipe(\n v.optional(v.bigint()),\n v.transform((value) => (value === undefined ? undefined : value.toString())),\n);\n\nexport const OptionalTimestampMsToNsInputSchema = v.optional(\n v.pipe(\n v.number(),\n v.integer(),\n v.minValue(0),\n v.maxValue(MAX_UINT64_TIMESTAMP_MS),\n v.transform((value) => BigInt(value) * MS_TO_NS),\n ),\n);\n\nexport const OptionalTimestampMsToUsInputSchema = v.optional(\n v.pipe(\n v.number(),\n v.integer(),\n v.minValue(0),\n v.maxValue(MAX_UINT64_TIMESTAMP_MS_US),\n v.transform((value) => BigInt(value) * MS_TO_US),\n ),\n);\n\nexport const OptionalTimestampSecondsInputSchema = v.optional(\n v.pipe(\n v.number(),\n v.integer(),\n v.minValue(0),\n v.maxValue(Number.MAX_SAFE_INTEGER),\n v.transform((value) => BigInt(value)),\n ),\n);\n\nexport const PublicIdSchema = v.pipe(\n v.bigint(),\n v.transform((value) => formatId(value)),\n);\n\nexport const OptionalPublicIdSchema = v.pipe(\n v.optional(v.bigint()),\n v.transform((value) => (value ? formatId(value) : undefined)),\n);\n\nconst TrimmedStringSchema = v.pipe(v.string(), v.trim());\n\nconst OptionalTrimmedStringSchema = v.optional(TrimmedStringSchema);\n\n/**\n * Creates a schema for required public id input.\n */\nexport function idInputSchema(fieldName: string) {\n return v.pipe(\n v.string(),\n v.trim(),\n v.minLength(1),\n v.transform((value) => idToBigInt(value, fieldName)),\n );\n}\n\n/**\n * Creates a schema for optional public id input.\n */\nexport function optionalIdInputSchema(fieldName: string) {\n return v.pipe(\n OptionalTrimmedStringSchema,\n v.transform((value) => (value ? idToBigInt(value, fieldName) : undefined)),\n );\n}\n\n/**\n * Creates a schema for optional subaccount id input.\n */\nexport function optionalSubaccountIdInputSchema() {\n return optionalIdInputSchema(\"subaccountId\");\n}\n\n/**\n * Creates a schema for optional uint64 decimal filter input.\n */\nexport function optionalUint64DecimalFilterSchema(fieldName: string) {\n return v.pipe(\n OptionalTrimmedStringSchema,\n v.transform((value) => parseOptionalUint64DecimalStrict(value, fieldName)),\n );\n}\n\n/**\n * Creates a schema for positive bigint-like input.\n */\nexport function positiveBigintLikeSchema(message: string) {\n return v.pipe(\n v.union([\n v.bigint(),\n v.pipe(\n TrimmedStringSchema,\n v.regex(/^\\d+$/),\n v.transform((value) => BigInt(value)),\n ),\n ]),\n v.check((value) => value > 0n, message),\n );\n}\n\nexport function bigintStringInputSchema(fieldName: string) {\n return v.pipe(\n TrimmedStringSchema,\n v.regex(/^\\d+$/, `${fieldName} must be a decimal integer`),\n v.transform((value) => BigInt(value)),\n );\n}\n\nexport function positiveBigintStringInputSchema(fieldName: string) {\n return v.pipe(\n bigintStringInputSchema(fieldName),\n v.check((value) => value > 0n, `${fieldName} must be greater than 0`),\n );\n}\n\nexport const JsonObjectSchema = v.custom<JsonObject>(\n (input): input is JsonObject =>\n typeof input === \"object\" && input !== null && !Array.isArray(input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mB;CACjE,OAAO,EAAE,KACL,6BACA,EAAE,WAAW,UAAU,iCAAiC,OAAO,SAAS,CAAC,CAC7E;AACJ;AAmBA,SAAgB,wBAAwB,WAAmB;CACvD,OAAO,EAAE,KACL,qBACA,EAAE,MAAM,SAAS,GAAG,UAAU,2BAA2B,GACzD,EAAE,WAAW,UAAU,OAAO,KAAK,CAAC,CACxC;AACJ;AAEA,SAAgB,gCAAgC,WAAmB;CAC/D,OAAO,EAAE,KACL,wBAAwB,SAAS,GACjC,EAAE,OAAO,UAAU,QAAQ,IAAI,GAAG,UAAU,wBAAwB,CACxE;AACJ;AAEA,MAAa,mBAAmB,EAAE,QAC7B,UACG,OAAO,UAAU,YAAY,UAAU,QAAQ,CAAC,MAAM,QAAQ,KAAK,CAC3E"}
|
|
1
|
+
{"version":3,"file":"schemas.js","names":[],"sources":["../../src/shared/schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { formatId, idToBigInt } from \"../utils/base58-id.js\";\nimport { parseOptionalUint64DecimalStrict, toBpsOrZero, toIntOrZero } from \"../utils/numbers.js\";\nimport { tsNsToMs, tsObjToMs } from \"../utils/time.js\";\nimport type { JsonObject } from \"@bufbuild/protobuf\";\nimport { PROTOBUF_UINT32_MAX } from \"./wire-bounds.js\";\n\nconst UINT64_MAX = (1n << 64n) - 1n;\nconst MS_TO_US = 1_000n;\nconst MS_TO_NS = 1_000_000n;\nconst MAX_UINT64_TIMESTAMP_MS_US = Number(UINT64_MAX / MS_TO_US);\nconst MAX_UINT64_TIMESTAMP_MS = Number(UINT64_MAX / MS_TO_NS);\n\nexport const U128Schema = v.object({\n hi: v.bigint(),\n lo: v.bigint(),\n});\n\nexport const TimestampSchema = v.object({\n seconds: v.bigint(),\n nanos: v.optional(v.number(), 0),\n});\n\nexport const TimestampMsSchema = v.pipe(\n TimestampSchema,\n v.transform((value) => tsObjToMs(value)),\n);\n\nexport const OptionalTimestampMsSchema = v.pipe(\n v.optional(TimestampSchema),\n v.transform((value) => tsObjToMs(value)),\n);\n\nexport const OptionalNumberDefaultNullSchema = v.optional(v.nullable(v.number()), null);\n\nexport const OptionalNumberToIntOrZeroSchema = v.pipe(\n v.optional(v.nullable(v.pipe(v.number(), v.maxValue(PROTOBUF_UINT32_MAX))), null),\n v.transform((value) => toIntOrZero(value)),\n);\n\nexport const OptionalNumberToBpsOrZeroSchema = v.pipe(\n OptionalNumberDefaultNullSchema,\n v.transform((value) => toBpsOrZero(value)),\n);\n\nexport const TimestampNsMsSchema = v.pipe(\n v.bigint(),\n v.transform((value) => tsNsToMs(value)),\n);\n\nexport const BigIntStringSchema = v.pipe(\n v.bigint(),\n v.transform((value) => value.toString()),\n);\n\nexport const OptionalBigIntStringSchema = v.pipe(\n v.optional(v.bigint()),\n v.transform((value) => (value === undefined ? undefined : value.toString())),\n);\n\nexport const OptionalTimestampMsToNsInputSchema = v.optional(\n v.pipe(\n v.number(),\n v.integer(),\n v.minValue(0),\n v.maxValue(MAX_UINT64_TIMESTAMP_MS),\n v.transform((value) => BigInt(value) * MS_TO_NS),\n ),\n);\n\nexport const OptionalTimestampMsToUsInputSchema = v.optional(\n v.pipe(\n v.number(),\n v.integer(),\n v.minValue(0),\n v.maxValue(MAX_UINT64_TIMESTAMP_MS_US),\n v.transform((value) => BigInt(value) * MS_TO_US),\n ),\n);\n\nexport const OptionalTimestampSecondsInputSchema = v.optional(\n v.pipe(\n v.number(),\n v.integer(),\n v.minValue(0),\n v.maxValue(Number.MAX_SAFE_INTEGER),\n v.transform((value) => BigInt(value)),\n ),\n);\n\nexport const PublicIdSchema = v.pipe(\n v.bigint(),\n v.transform((value) => formatId(value)),\n);\n\n/** Like `PublicIdSchema`, but formats the proto unset value `0n` as `\"\"`. */\nexport const PublicIdOrEmptySchema = v.pipe(\n v.bigint(),\n v.transform((value) => (value === 0n ? \"\" : formatId(value))),\n);\n\nexport const OptionalPublicIdSchema = v.pipe(\n v.optional(v.bigint()),\n v.transform((value) => (value ? formatId(value) : undefined)),\n);\n\nconst TrimmedStringSchema = v.pipe(v.string(), v.trim());\n\nconst OptionalTrimmedStringSchema = v.optional(TrimmedStringSchema);\n\n/**\n * Creates a schema for required public id input.\n */\nexport function idInputSchema(fieldName: string) {\n return v.pipe(\n v.string(),\n v.trim(),\n v.minLength(1),\n v.transform((value) => idToBigInt(value, fieldName)),\n );\n}\n\n/**\n * Creates a schema for optional public id input.\n */\nexport function optionalIdInputSchema(fieldName: string) {\n return v.pipe(\n OptionalTrimmedStringSchema,\n v.transform((value) => (value ? idToBigInt(value, fieldName) : undefined)),\n );\n}\n\n/**\n * Creates a schema for optional subaccount id input.\n */\nexport function optionalSubaccountIdInputSchema() {\n return optionalIdInputSchema(\"subaccountId\");\n}\n\n/**\n * Creates a schema for optional uint64 decimal filter input.\n */\nexport function optionalUint64DecimalFilterSchema(fieldName: string) {\n return v.pipe(\n OptionalTrimmedStringSchema,\n v.transform((value) => parseOptionalUint64DecimalStrict(value, fieldName)),\n );\n}\n\n/**\n * Creates a schema for positive bigint-like input.\n */\nexport function positiveBigintLikeSchema(message: string) {\n return v.pipe(\n v.union([\n v.bigint(),\n v.pipe(\n TrimmedStringSchema,\n v.regex(/^\\d+$/),\n v.transform((value) => BigInt(value)),\n ),\n ]),\n v.check((value) => value > 0n, message),\n );\n}\n\nexport function bigintStringInputSchema(fieldName: string) {\n return v.pipe(\n TrimmedStringSchema,\n v.regex(/^\\d+$/, `${fieldName} must be a decimal integer`),\n v.transform((value) => BigInt(value)),\n );\n}\n\nexport function positiveBigintStringInputSchema(fieldName: string) {\n return v.pipe(\n bigintStringInputSchema(fieldName),\n v.check((value) => value > 0n, `${fieldName} must be greater than 0`),\n );\n}\n\nexport const JsonObjectSchema = v.custom<JsonObject>(\n (input): input is JsonObject =>\n typeof input === \"object\" && input !== null && !Array.isArray(input),\n);\n"],"mappings":";;;;;;AAOA,MAAM,cAAc,MAAM,OAAO;AACjC,MAAM,WAAW;AACjB,MAAM,WAAW;AACjB,MAAM,6BAA6B,OAAO,aAAa,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