@polyester/sdk 0.24.1 → 0.25.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -0
- package/README.md +18 -12
- package/dist/account-signer/create-polyester-account-signer.d.ts +9 -5
- package/dist/account-signer/create-polyester-account-signer.d.ts.map +1 -1
- package/dist/account-signer/create-polyester-account-signer.js +9 -5
- package/dist/account-signer/create-polyester-account-signer.js.map +1 -1
- package/dist/account-signer/types.d.ts +9 -3
- package/dist/account-signer/types.d.ts.map +1 -1
- package/dist/account-signer/types.js.map +1 -1
- package/dist/core-client.d.ts +3 -0
- package/dist/core-client.d.ts.map +1 -1
- package/dist/core-client.js +5 -0
- package/dist/core-client.js.map +1 -1
- package/dist/environment.d.ts.map +1 -1
- package/dist/environment.js +0 -4
- package/dist/environment.js.map +1 -1
- package/dist/gen/auth/v1/auth_pb.d.ts +7 -4
- package/dist/gen/auth/v1/auth_pb.d.ts.map +1 -1
- package/dist/gen/auth/v1/auth_pb.js.map +1 -1
- package/dist/gen/claims/v1/claims_pb.d.ts +313 -0
- package/dist/gen/claims/v1/claims_pb.d.ts.map +1 -0
- package/dist/gen/claims/v1/claims_pb.js +135 -0
- package/dist/gen/claims/v1/claims_pb.js.map +1 -0
- package/dist/gen/index.d.ts +2 -1
- package/dist/gen/index.js +2 -1
- package/dist/gen/orders/v1/orders_pb.d.ts +50 -3
- package/dist/gen/orders/v1/orders_pb.d.ts.map +1 -1
- package/dist/gen/orders/v1/orders_pb.js +55 -43
- package/dist/gen/orders/v1/orders_pb.js.map +1 -1
- package/dist/gen/orders/v1/orders_read_pb.d.ts +10 -0
- package/dist/gen/orders/v1/orders_read_pb.d.ts.map +1 -1
- package/dist/gen/orders/v1/orders_read_pb.js +3 -1
- package/dist/gen/orders/v1/orders_read_pb.js.map +1 -1
- package/dist/index.d.ts +4 -1
- package/dist/services/accounts/accounts.schemas.d.ts +2 -2
- package/dist/services/accounts/accounts.schemas.d.ts.map +1 -1
- package/dist/services/accounts/accounts.schemas.js +3 -3
- package/dist/services/accounts/accounts.schemas.js.map +1 -1
- package/dist/services/address-book/address-book.schemas.d.ts +67 -68
- package/dist/services/address-book/address-book.schemas.d.ts.map +1 -1
- package/dist/services/address-book/address-book.schemas.js +11 -13
- package/dist/services/address-book/address-book.schemas.js.map +1 -1
- package/dist/services/api-keys/api-keys.schemas.d.ts +1 -2
- package/dist/services/api-keys/api-keys.schemas.d.ts.map +1 -1
- package/dist/services/api-keys/api-keys.schemas.js +4 -9
- package/dist/services/api-keys/api-keys.schemas.js.map +1 -1
- package/dist/services/auth/auth.d.ts +2 -3
- package/dist/services/auth/auth.d.ts.map +1 -1
- package/dist/services/auth/auth.js +4 -2
- package/dist/services/auth/auth.js.map +1 -1
- package/dist/services/auth/cookie-constants.d.ts +1 -1
- package/dist/services/auth/cookie-constants.d.ts.map +1 -1
- package/dist/services/auth/cookie-constants.js +1 -1
- package/dist/services/auth/cookie-constants.js.map +1 -1
- package/dist/services/balances/balances.schemas.d.ts +3 -3
- package/dist/services/balances/balances.schemas.d.ts.map +1 -1
- package/dist/services/balances/balances.schemas.js +7 -12
- package/dist/services/balances/balances.schemas.js.map +1 -1
- package/dist/services/candles/candles.schemas.d.ts +3 -3
- package/dist/services/candles/candles.schemas.d.ts.map +1 -1
- package/dist/services/candles/candles.schemas.js +5 -6
- package/dist/services/candles/candles.schemas.js.map +1 -1
- package/dist/services/chain-analytics/chain-analytics.schemas.d.ts +3 -3
- package/dist/services/chain-analytics/chain-analytics.schemas.d.ts.map +1 -1
- package/dist/services/chain-analytics/chain-analytics.schemas.js +2 -3
- package/dist/services/chain-analytics/chain-analytics.schemas.js.map +1 -1
- package/dist/services/claims/claims.codecs.d.ts +8 -0
- package/dist/services/claims/claims.codecs.d.ts.map +1 -0
- package/dist/services/claims/claims.codecs.js +17 -0
- package/dist/services/claims/claims.codecs.js.map +1 -0
- package/dist/services/claims/claims.d.ts +19 -0
- package/dist/services/claims/claims.d.ts.map +1 -0
- package/dist/services/claims/claims.js +30 -0
- package/dist/services/claims/claims.js.map +1 -0
- package/dist/services/claims/claims.schemas.d.ts +122 -0
- package/dist/services/claims/claims.schemas.d.ts.map +1 -0
- package/dist/services/claims/claims.schemas.js +47 -0
- package/dist/services/claims/claims.schemas.js.map +1 -0
- package/dist/services/claims/claims.types.d.ts +3 -0
- package/dist/services/claims/index.d.ts +5 -0
- package/dist/services/heatmap/heatmap.schemas.d.ts +4 -4
- package/dist/services/heatmap/heatmap.schemas.d.ts.map +1 -1
- package/dist/services/heatmap/heatmap.schemas.js +10 -10
- package/dist/services/heatmap/heatmap.schemas.js.map +1 -1
- package/dist/services/internal-transfers/internal-transfers.schemas.d.ts.map +1 -1
- package/dist/services/internal-transfers/internal-transfers.schemas.js +1 -5
- package/dist/services/internal-transfers/internal-transfers.schemas.js.map +1 -1
- package/dist/services/lifecycle/lifecycle.schemas.d.ts +63 -63
- package/dist/services/lifecycle/lifecycle.schemas.d.ts.map +1 -1
- package/dist/services/lifecycle/lifecycle.schemas.js +10 -11
- package/dist/services/lifecycle/lifecycle.schemas.js.map +1 -1
- package/dist/services/market-overview/market-overview.schemas.d.ts +1 -1
- package/dist/services/market-overview/market-overview.schemas.d.ts.map +1 -1
- package/dist/services/market-overview/market-overview.schemas.js +3 -3
- package/dist/services/market-overview/market-overview.schemas.js.map +1 -1
- package/dist/services/mfa/mfa.schemas.d.ts +11 -11
- package/dist/services/mfa/mfa.schemas.d.ts.map +1 -1
- package/dist/services/mfa/mfa.schemas.js +4 -5
- package/dist/services/mfa/mfa.schemas.js.map +1 -1
- package/dist/services/orderbook/orderbook.schemas.d.ts +1 -1
- package/dist/services/orders/order-enums.codecs.js +2 -1
- package/dist/services/orders/order-enums.codecs.js.map +1 -1
- package/dist/services/orders/order-errors.schemas.d.ts +4 -5
- package/dist/services/orders/order-errors.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-batch.schemas.d.ts +110 -32
- package/dist/services/orders/orders-batch.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-batch.schemas.js +9 -10
- package/dist/services/orders/orders-batch.schemas.js.map +1 -1
- package/dist/services/orders/orders-input.schemas.d.ts +111 -8
- package/dist/services/orders/orders-input.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-input.schemas.js +20 -4
- package/dist/services/orders/orders-input.schemas.js.map +1 -1
- package/dist/services/orders/orders-modify.schemas.d.ts +2 -2
- package/dist/services/orders/orders-modify.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-modify.schemas.js +3 -3
- package/dist/services/orders/orders-modify.schemas.js.map +1 -1
- package/dist/services/orders/orders-output.schemas.d.ts +48 -32
- package/dist/services/orders/orders-output.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-output.schemas.js +16 -16
- package/dist/services/orders/orders-output.schemas.js.map +1 -1
- package/dist/services/orders/orders-risk.schemas.d.ts +0 -1
- package/dist/services/orders/orders-risk.schemas.d.ts.map +1 -1
- package/dist/services/orders/orders-risk.schemas.js +4 -4
- package/dist/services/orders/orders-risk.schemas.js.map +1 -1
- package/dist/services/policies/api-key-policies/api-key-policies.schemas.d.ts +4 -4
- package/dist/services/policies/shared.codecs.js +3 -3
- package/dist/services/policies/shared.codecs.js.map +1 -1
- package/dist/services/policies/shared.d.ts +0 -1
- package/dist/services/policies/shared.d.ts.map +1 -1
- package/dist/services/policies/shared.js +2 -3
- package/dist/services/policies/shared.js.map +1 -1
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.d.ts +2 -2
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.d.ts.map +1 -1
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.js +2 -5
- package/dist/services/policies/subaccount-policies/subaccount-policies.schemas.js.map +1 -1
- package/dist/services/rate-limits/rate-limits.schemas.d.ts +6 -7
- package/dist/services/rate-limits/rate-limits.schemas.d.ts.map +1 -1
- package/dist/services/rate-limits/rate-limits.schemas.js +2 -3
- package/dist/services/rate-limits/rate-limits.schemas.js.map +1 -1
- package/dist/services/social-verification/social-verification.schemas.d.ts.map +1 -1
- package/dist/services/social-verification/social-verification.schemas.js +4 -4
- package/dist/services/social-verification/social-verification.schemas.js.map +1 -1
- package/dist/services/subaccounts/subaccounts.schemas.d.ts +23 -24
- package/dist/services/subaccounts/subaccounts.schemas.d.ts.map +1 -1
- package/dist/services/subaccounts/subaccounts.schemas.js +10 -12
- package/dist/services/subaccounts/subaccounts.schemas.js.map +1 -1
- package/dist/services/trades/trades.schemas.d.ts +1 -1
- package/dist/services/trades/trades.schemas.d.ts.map +1 -1
- package/dist/services/trades/trades.schemas.js +4 -8
- package/dist/services/trades/trades.schemas.js.map +1 -1
- package/dist/services/transfers/transfers.schemas.d.ts +3 -4
- package/dist/services/transfers/transfers.schemas.d.ts.map +1 -1
- package/dist/services/transfers/transfers.schemas.js +5 -10
- package/dist/services/transfers/transfers.schemas.js.map +1 -1
- package/dist/services/triggers/trigger-input.schemas.d.ts +2 -2
- package/dist/services/triggers/triggers-output.schemas.d.ts +56 -58
- package/dist/services/triggers/triggers-output.schemas.d.ts.map +1 -1
- package/dist/services/triggers/triggers-output.schemas.js +34 -36
- package/dist/services/triggers/triggers-output.schemas.js.map +1 -1
- package/dist/services/whiteboard/whiteboard.schemas.d.ts +42 -42
- package/dist/services/whiteboard/whiteboard.schemas.d.ts.map +1 -1
- package/dist/services/whiteboard/whiteboard.schemas.js +9 -10
- package/dist/services/whiteboard/whiteboard.schemas.js.map +1 -1
- package/dist/shared/proto-enum-codec.js +11 -6
- package/dist/shared/proto-enum-codec.js.map +1 -1
- package/dist/shared/rate-limit.schemas.d.ts +4 -5
- package/dist/shared/rate-limit.schemas.d.ts.map +1 -1
- package/dist/shared/rate-limit.schemas.js +41 -46
- package/dist/shared/rate-limit.schemas.js.map +1 -1
- package/dist/shared/schemas.js +5 -1
- package/dist/shared/schemas.js.map +1 -1
- package/dist/utils/timestamp.js +8 -1
- package/dist/utils/timestamp.js.map +1 -1
- package/dist/wired-services.d.ts.map +1 -1
- package/dist/wired-services.js +2 -0
- package/dist/wired-services.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { enumLabelSchema } from "../../shared/proto-enum-codec.js";
|
|
2
2
|
import { BigIntStringSchema, OptionalTimestampMsSchema, PublicIdSchema, TimestampMsSchema as TimestampMsSchema$1, idInputSchema, optionalSubaccountIdInputSchema, positiveBigintStringInputSchema } from "../../shared/schemas.js";
|
|
3
3
|
import { parse } from "../../shared/validation.js";
|
|
4
4
|
import { PositiveUint32InputSchema } from "../shared.js";
|
|
5
5
|
import { buildProtoPatch, defineProtoPatchFields } from "../../utils/proto-patch.js";
|
|
6
6
|
import { AccountScopeInputEntries, accountScopeToSubaccountId } from "../../shared/account-scope.js";
|
|
7
|
-
import { SubaccountRole } from "../../gen/auth/v1/subaccounts_pb.js";
|
|
8
7
|
import { SubaccountRoleCodec } from "../subaccounts/subaccounts.codecs.js";
|
|
9
|
-
import { AccountScopeType, AddressBookEntryKind, DestinationWhitelistStatus, InternalWhitelistResolutionStatus, TransferCounterpartyDirection } from "../../gen/auth/v1/address_book_pb.js";
|
|
10
8
|
import { ADDRESS_BOOK_ENTRY_KIND_VALUES, AccountScopeTypeCodec, AddressBookEntryKindCodec, DestinationWhitelistStatusCodec, InternalWhitelistResolutionStatusCodec, TRANSFER_COUNTERPARTY_DIRECTION_VALUES, TransferCounterpartyDirectionCodec } from "./address-book.codecs.js";
|
|
11
9
|
import * as v from "valibot";
|
|
12
10
|
//#region src/services/address-book/address-book.schemas.ts
|
|
@@ -161,7 +159,7 @@ const GetAddressBookViewInputSchema = v.pipe(v.strictObject({
|
|
|
161
159
|
})));
|
|
162
160
|
const CountSchema = v.pipe(v.bigint(), v.transform((value) => Number(value)));
|
|
163
161
|
const AccountScopeSchema = v.object({
|
|
164
|
-
scopeType:
|
|
162
|
+
scopeType: enumLabelSchema(AccountScopeTypeCodec.protoToOutput),
|
|
165
163
|
rootAccountId: PublicIdSchema,
|
|
166
164
|
subaccountId: PublicIdSchema
|
|
167
165
|
});
|
|
@@ -172,7 +170,7 @@ const ExternalWithdrawAddressSchema = v.object({
|
|
|
172
170
|
const InternalTransferAccountSchema = v.object({
|
|
173
171
|
rootAccountId: PublicIdSchema,
|
|
174
172
|
targetAccountId: PublicIdSchema,
|
|
175
|
-
targetScopeType:
|
|
173
|
+
targetScopeType: enumLabelSchema(AccountScopeTypeCodec.protoToOutput),
|
|
176
174
|
smartAccountAddress: v.string(),
|
|
177
175
|
rootUsername: v.string(),
|
|
178
176
|
subaccountLabel: v.string()
|
|
@@ -191,12 +189,12 @@ const AddressBookEntryValueSchema = v.variant("case", [
|
|
|
191
189
|
value: v.optional(v.undefined())
|
|
192
190
|
})
|
|
193
191
|
]);
|
|
194
|
-
const DestinationWhitelistStatusSchema =
|
|
195
|
-
const AddressBookEntryKindSchema =
|
|
196
|
-
const TransferCounterpartyDirectionSchema =
|
|
192
|
+
const DestinationWhitelistStatusSchema = enumLabelSchema(DestinationWhitelistStatusCodec.protoToOutput);
|
|
193
|
+
const AddressBookEntryKindSchema = enumLabelSchema(AddressBookEntryKindCodec.protoToOutput);
|
|
194
|
+
const TransferCounterpartyDirectionSchema = enumLabelSchema(TransferCounterpartyDirectionCodec.protoToOutput);
|
|
197
195
|
const AddressBookSchema = v.object({
|
|
198
196
|
scope: v.optional(AccountScopeSchema),
|
|
199
|
-
callerRole:
|
|
197
|
+
callerRole: enumLabelSchema(SubaccountRoleCodec.protoToOutput),
|
|
200
198
|
label: v.string(),
|
|
201
199
|
ownerUsername: v.string(),
|
|
202
200
|
smartAccountAddress: v.string()
|
|
@@ -257,13 +255,13 @@ const InternalTransferWhitelistEntrySchema = v.object({
|
|
|
257
255
|
scope: v.optional(AccountScopeSchema),
|
|
258
256
|
rootAccountId: PublicIdSchema,
|
|
259
257
|
targetAccountId: PublicIdSchema,
|
|
260
|
-
targetScopeType:
|
|
258
|
+
targetScopeType: enumLabelSchema(AccountScopeTypeCodec.protoToOutput),
|
|
261
259
|
smartAccountAddress: v.string(),
|
|
262
260
|
rootUsername: v.string(),
|
|
263
261
|
subaccountLabel: v.string(),
|
|
264
262
|
createdAt: TimestampMsSchema,
|
|
265
263
|
updatedAt: TimestampMsSchema,
|
|
266
|
-
resolutionStatus:
|
|
264
|
+
resolutionStatus: enumLabelSchema(InternalWhitelistResolutionStatusCodec.protoToOutput)
|
|
267
265
|
});
|
|
268
266
|
const InternalTransferWhitelistEntriesSchema = v.array(InternalTransferWhitelistEntrySchema);
|
|
269
267
|
const MirroredWithdrawWhitelistEntrySchema = v.object({
|
|
@@ -301,7 +299,7 @@ const AddressBookEntriesViewSchema = v.object({
|
|
|
301
299
|
whitelistStatus: DestinationWhitelistStatusSchema,
|
|
302
300
|
rootAccountId: PublicIdSchema,
|
|
303
301
|
targetAccountId: PublicIdSchema,
|
|
304
|
-
targetScopeType:
|
|
302
|
+
targetScopeType: enumLabelSchema(AccountScopeTypeCodec.protoToOutput),
|
|
305
303
|
smartAccountAddress: v.string(),
|
|
306
304
|
rootUsername: v.string(),
|
|
307
305
|
subaccountLabel: v.string(),
|
|
@@ -330,7 +328,7 @@ const AddressBookRecentDestinationsViewSchema = v.object({
|
|
|
330
328
|
lastSeenAt: TimestampMsSchema,
|
|
331
329
|
rootAccountId: PublicIdSchema,
|
|
332
330
|
targetAccountId: PublicIdSchema,
|
|
333
|
-
targetScopeType:
|
|
331
|
+
targetScopeType: enumLabelSchema(AccountScopeTypeCodec.protoToOutput),
|
|
334
332
|
smartAccountAddress: v.string(),
|
|
335
333
|
rootUsername: v.string(),
|
|
336
334
|
subaccountLabel: v.string()
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address-book.schemas.js","names":["Proto.AccountScopeType","Proto.DestinationWhitelistStatus","Proto.AddressBookEntryKind","Proto.TransferCounterpartyDirection","Proto.InternalWhitelistResolutionStatus","RequiredTimestampMsSchema"],"sources":["../../../src/services/address-book/address-book.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { PositiveUint32InputSchema } from \"../shared.js\";\nimport { parse } from \"../../shared/validation.js\";\nimport * as Proto from \"../../gen/auth/v1/address_book_pb.js\";\nimport { SubaccountRole } from \"../../gen/auth/v1/subaccounts_pb.js\";\nimport {\n OptionalTimestampMsSchema,\n BigIntStringSchema,\n PublicIdSchema,\n TimestampMsSchema as RequiredTimestampMsSchema,\n idInputSchema,\n optionalSubaccountIdInputSchema,\n positiveBigintStringInputSchema,\n} from \"../../shared/schemas.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport { requiredEnumLabel } from \"../../shared/proto-enum-codec.js\";\nimport {\n ADDRESS_BOOK_ENTRY_KIND_VALUES,\n AccountScopeTypeCodec,\n AddressBookEntryKindCodec,\n DestinationWhitelistStatusCodec,\n InternalWhitelistResolutionStatusCodec,\n TRANSFER_COUNTERPARTY_DIRECTION_VALUES,\n TransferCounterpartyDirectionCodec,\n} from \"./address-book.codecs.js\";\nimport { SubaccountRoleCodec } from \"../subaccounts/subaccounts.codecs.js\";\nimport { buildProtoPatch, defineProtoPatchFields } from \"../../utils/proto-patch.js\";\n\nconst OptionalSubaccountIdSchema = optionalSubaccountIdInputSchema();\nconst IdSchema = idInputSchema;\n\nconst AddressBookLimitSchema = v.optional(\n v.pipe(v.number(), v.integer(), v.gtValue(0), v.maxValue(500)),\n);\nconst AddressBookCounterpartyLimitSchema = v.optional(\n v.pipe(v.number(), v.integer(), v.gtValue(0), v.maxValue(200)),\n);\nconst AddressBookViewLimitSchema = v.optional(\n v.pipe(v.number(), v.integer(), v.gtValue(0), v.maxValue(200)),\n);\nconst PageTokenSchema = v.optional(v.pipe(v.string(), v.trim()), \"\");\n\nconst TimestampMsSchema = OptionalTimestampMsSchema;\n\nconst AddressBookTagInputSchema = v.strictObject({\n name: v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(48)),\n color: v.optional(v.pipe(v.string(), v.trim(), v.maxLength(32)), \"\"),\n});\nconst AddressBookTagInputsSchema = v.pipe(v.array(AddressBookTagInputSchema), v.maxLength(10));\n\nexport const ListAddressBookEntriesInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n kind: v.optional(v.picklist(ADDRESS_BOOK_ENTRY_KIND_VALUES)),\n limit: AddressBookLimitSchema,\n pageToken: PageTokenSchema,\n }),\n v.transform(({ account, kind, limit, pageToken }) => ({\n subaccountId: accountScopeToSubaccountId(account),\n kind: kind ? AddressBookEntryKindCodec.inputToProto[kind] : undefined,\n limit,\n pageToken,\n })),\n);\n\nexport type ListAddressBookEntriesInput = v.InferInput<typeof ListAddressBookEntriesInputSchema>;\n\nexport const CreateAddressBookEntryInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n label: v.pipe(v.string(), v.trim(), v.minLength(1)),\n note: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n entry: v.variant(\"kind\", [\n v.strictObject({\n kind: v.literal(\"external\"),\n polychainChainId: PositiveUint32InputSchema,\n address: v.pipe(v.string(), v.trim(), v.minLength(1)),\n }),\n v.strictObject({\n kind: v.literal(\"internal\"),\n smartAccountAddress: v.pipe(v.string(), v.trim(), v.minLength(1)),\n }),\n ]),\n tagIds: v.optional(v.array(IdSchema(\"tagId\")), []),\n newTags: v.optional(AddressBookTagInputsSchema, []),\n }),\n v.transform(({ account, entry, ...rest }) => ({\n ...rest,\n subaccountId: accountScopeToSubaccountId(account),\n entry:\n entry.kind === \"external\"\n ? {\n case: \"external\" as const,\n value: {\n polychainChainId: entry.polychainChainId,\n address: entry.address,\n },\n }\n : {\n case: \"internal\" as const,\n value: {\n smartAccountAddress: entry.smartAccountAddress,\n },\n },\n })),\n);\n\nexport type CreateAddressBookEntryInput = v.InferInput<typeof CreateAddressBookEntryInputSchema>;\n\nexport function validateCreateAddressBookEntryInput(input: CreateAddressBookEntryInput): void {\n parse(CreateAddressBookEntryInputSchema, input);\n}\n\ntype AddressBookEntryPatch = {\n label?: string;\n note?: string;\n tagIds?: bigint[];\n newTags?: v.InferOutput<typeof AddressBookTagInputSchema>[];\n};\n\nconst ADDRESS_BOOK_ENTRY_PATCH_FIELDS = defineProtoPatchFields<AddressBookEntryPatch>()({\n label: { path: \"label\", encode: (label) => ({ label }) },\n note: { path: \"note\", encode: (note) => ({ note }) },\n tagIds: { path: \"tag_ids\", encode: (tagIds) => ({ tagIds }) },\n newTags: { path: \"new_tags\", encode: (newTags) => ({ newTags }) },\n});\n\nexport const UpdateAddressBookEntryInputSchema = v.pipe(\n v.strictObject({\n addressBookEntryId: IdSchema(\"addressBookEntryId\"),\n expectedRevision: positiveBigintStringInputSchema(\"expectedRevision\"),\n label: v.optional(v.pipe(v.string(), v.trim())),\n note: v.optional(v.pipe(v.string(), v.trim())),\n tagIds: v.optional(v.array(IdSchema(\"tagId\"))),\n newTags: v.optional(AddressBookTagInputsSchema),\n }),\n v.check(\n ({ label, note, tagIds, newTags }) =>\n label !== undefined ||\n note !== undefined ||\n tagIds !== undefined ||\n newTags !== undefined,\n \"At least one address-book entry field must be provided\",\n ),\n v.transform(({ addressBookEntryId, expectedRevision, ...input }) => {\n const { patch: entry, updateMask } = buildProtoPatch(\n input,\n ADDRESS_BOOK_ENTRY_PATCH_FIELDS,\n );\n return { addressBookEntryId, entry, updateMask, expectedRevision };\n }),\n);\n\nexport type UpdateAddressBookEntryInput = v.InferInput<typeof UpdateAddressBookEntryInputSchema>;\n\nexport const DeleteAddressBookEntryInputSchema = v.strictObject({\n addressBookEntryId: IdSchema(\"addressBookEntryId\"),\n});\n\nexport type DeleteAddressBookEntryInput = v.InferInput<typeof DeleteAddressBookEntryInputSchema>;\n\nexport const CopyAddressBookEntryInputSchema = v.strictObject({\n addressBookEntryId: IdSchema(\"addressBookEntryId\"),\n targetSubaccountId: OptionalSubaccountIdSchema,\n});\n\nexport type CopyAddressBookEntryInput = v.InferInput<typeof CopyAddressBookEntryInputSchema>;\n\nexport const CreateAddressBookTagInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n name: v.pipe(v.string(), v.trim(), v.minLength(1)),\n color: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type CreateAddressBookTagInput = v.InferInput<typeof CreateAddressBookTagInputSchema>;\n\nexport const UpdateAddressBookTagInputSchema = v.pipe(\n v.strictObject({\n tagId: IdSchema(\"tagId\"),\n name: v.optional(v.pipe(v.string(), v.trim(), v.minLength(1))),\n color: v.optional(v.pipe(v.string(), v.trim())),\n }),\n v.check(\n ({ name, color }) => name !== undefined || color !== undefined,\n \"At least one address-book tag field must be provided\",\n ),\n);\n\nexport type UpdateAddressBookTagInput = v.InferInput<typeof UpdateAddressBookTagInputSchema>;\n\nexport const DeleteAddressBookTagInputSchema = v.strictObject({\n tagId: IdSchema(\"tagId\"),\n});\n\nexport type DeleteAddressBookTagInput = v.InferInput<typeof DeleteAddressBookTagInputSchema>;\n\nexport const ListTransferCounterpartiesInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n direction: v.optional(v.picklist(TRANSFER_COUNTERPARTY_DIRECTION_VALUES)),\n kind: v.optional(v.picklist(ADDRESS_BOOK_ENTRY_KIND_VALUES)),\n limit: AddressBookCounterpartyLimitSchema,\n }),\n v.transform(({ account, direction, kind, limit }) => ({\n subaccountId: accountScopeToSubaccountId(account),\n direction: direction\n ? TransferCounterpartyDirectionCodec.inputToProto[direction]\n : undefined,\n kind: kind ? AddressBookEntryKindCodec.inputToProto[kind] : undefined,\n limit,\n })),\n);\n\nexport type ListTransferCounterpartiesInput = v.InferInput<\n typeof ListTransferCounterpartiesInputSchema\n>;\n\nexport const ListTransferDestinationsInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n kind: v.optional(v.picklist(ADDRESS_BOOK_ENTRY_KIND_VALUES)),\n limit: AddressBookLimitSchema,\n pageToken: PageTokenSchema,\n }),\n v.transform(({ account, kind, limit, pageToken }) => ({\n subaccountId: accountScopeToSubaccountId(account),\n kind: kind ? AddressBookEntryKindCodec.inputToProto[kind] : undefined,\n limit,\n pageToken,\n })),\n);\n\nexport type ListTransferDestinationsInput = v.InferInput<\n typeof ListTransferDestinationsInputSchema\n>;\n\nexport const SubaccountScopedInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n }),\n v.transform(({ account }) => ({\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type SubaccountScopedInput = v.InferInput<typeof SubaccountScopedInputSchema>;\n\nexport const ListInternalTransferWhitelistEntriesInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n limit: AddressBookLimitSchema,\n pageToken: PageTokenSchema,\n }),\n v.transform(({ account, limit, pageToken }) => ({\n subaccountId: accountScopeToSubaccountId(account),\n limit,\n pageToken,\n })),\n);\n\nexport type ListInternalTransferWhitelistEntriesInput = v.InferInput<\n typeof ListInternalTransferWhitelistEntriesInputSchema\n>;\n\nexport const GetAddressBookViewInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n limit: AddressBookViewLimitSchema,\n /** Minimum `viewRevision` (from an invalidation event) the returned view must reach. */\n minimumViewRevision: v.optional(positiveBigintStringInputSchema(\"minimumViewRevision\")),\n }),\n v.transform(({ account, limit, minimumViewRevision }) => ({\n subaccountId: accountScopeToSubaccountId(account),\n limit,\n minimumViewRevision,\n })),\n);\n\nexport type GetAddressBookViewInput = v.InferInput<typeof GetAddressBookViewInputSchema>;\n\nconst CountSchema = v.pipe(\n v.bigint(),\n v.transform((value) => Number(value)),\n);\n\nconst AccountScopeSchema = v.object({\n scopeType: v.pipe(\n v.enum(Proto.AccountScopeType),\n v.transform((value) =>\n requiredEnumLabel(\n AccountScopeTypeCodec.protoToOutput,\n value,\n \"PolyesterClient.AccountScopeSchema\",\n \"scope type\",\n ),\n ),\n ),\n rootAccountId: PublicIdSchema,\n subaccountId: PublicIdSchema,\n});\n\nconst ExternalWithdrawAddressSchema = v.object({\n polychainChainId: v.pipe(v.number(), v.integer()),\n address: v.string(),\n});\n\nconst InternalTransferAccountSchema = v.object({\n rootAccountId: PublicIdSchema,\n targetAccountId: PublicIdSchema,\n targetScopeType: v.pipe(\n v.enum(Proto.AccountScopeType),\n v.transform((value) =>\n requiredEnumLabel(\n AccountScopeTypeCodec.protoToOutput,\n value,\n \"PolyesterClient.InternalTransferAccountSchema\",\n \"target scope type\",\n ),\n ),\n ),\n smartAccountAddress: v.string(),\n rootUsername: v.string(),\n subaccountLabel: v.string(),\n});\n\nconst AddressBookEntryValueSchema = v.variant(\"case\", [\n v.object({ case: v.literal(\"external\"), value: ExternalWithdrawAddressSchema }),\n v.object({ case: v.literal(\"internal\"), value: InternalTransferAccountSchema }),\n v.object({ case: v.undefined(), value: v.optional(v.undefined()) }),\n]);\n\nconst DestinationWhitelistStatusSchema = v.pipe(\n v.enum(Proto.DestinationWhitelistStatus),\n v.transform((value) =>\n requiredEnumLabel(\n DestinationWhitelistStatusCodec.protoToOutput,\n value,\n \"PolyesterClient.DestinationWhitelistStatusSchema\",\n \"whitelist status\",\n ),\n ),\n);\n\nconst AddressBookEntryKindSchema = v.pipe(\n v.enum(Proto.AddressBookEntryKind),\n v.transform((value) =>\n requiredEnumLabel(\n AddressBookEntryKindCodec.protoToOutput,\n value,\n \"PolyesterClient.AddressBookEntryKindSchema\",\n \"entry kind\",\n ),\n ),\n);\n\nconst TransferCounterpartyDirectionSchema = v.pipe(\n v.enum(Proto.TransferCounterpartyDirection),\n v.transform((value) =>\n requiredEnumLabel(\n TransferCounterpartyDirectionCodec.protoToOutput,\n value,\n \"PolyesterClient.TransferCounterpartyDirectionSchema\",\n \"direction\",\n ),\n ),\n);\n\nexport const AddressBookSchema = v.object({\n scope: v.optional(AccountScopeSchema),\n callerRole: v.pipe(\n v.enum(SubaccountRole),\n v.transform((role) =>\n requiredEnumLabel(\n SubaccountRoleCodec.protoToOutput,\n role,\n \"AddressBookEntrySchema\",\n \"caller role\",\n ),\n ),\n ),\n label: v.string(),\n ownerUsername: v.string(),\n smartAccountAddress: v.string(),\n});\n\nexport type AddressBook = v.InferOutput<typeof AddressBookSchema>;\n\nexport const AddressBookTagSummarySchema = v.object({\n tagId: PublicIdSchema,\n name: v.string(),\n color: v.string(),\n});\n\nexport type AddressBookTagSummary = v.InferOutput<typeof AddressBookTagSummarySchema>;\n\nexport const AddressBookTagSchema = v.object({\n tagId: PublicIdSchema,\n scope: v.optional(AccountScopeSchema),\n name: v.string(),\n color: v.string(),\n createdAt: TimestampMsSchema,\n updatedAt: TimestampMsSchema,\n});\n\nexport type AddressBookTag = v.InferOutput<typeof AddressBookTagSchema>;\n\nexport const AddressBookEntrySchema = v.object({\n addressBookEntryId: PublicIdSchema,\n scope: v.optional(AccountScopeSchema),\n kind: AddressBookEntryKindSchema,\n label: v.string(),\n note: v.string(),\n createdAt: TimestampMsSchema,\n updatedAt: TimestampMsSchema,\n entry: AddressBookEntryValueSchema,\n tags: v.array(AddressBookTagSchema),\n revision: BigIntStringSchema,\n});\n\nexport type AddressBookEntry = v.InferOutput<typeof AddressBookEntrySchema>;\n\nexport const AddressBookEntriesSchema = v.array(AddressBookEntrySchema);\nexport type AddressBookEntries = v.InferOutput<typeof AddressBookEntriesSchema>;\n\nexport const TransferCounterpartySchema = v.object({\n counterpartyId: PublicIdSchema,\n scope: v.optional(AccountScopeSchema),\n direction: TransferCounterpartyDirectionSchema,\n kind: AddressBookEntryKindSchema,\n saved: v.boolean(),\n addressBookEntryId: PublicIdSchema,\n useCount: CountSchema,\n firstSeenAt: TimestampMsSchema,\n lastSeenAt: TimestampMsSchema,\n counterparty: AddressBookEntryValueSchema,\n});\n\nexport type TransferCounterparty = v.InferOutput<typeof TransferCounterpartySchema>;\n\nexport const TransferCounterpartiesSchema = v.array(TransferCounterpartySchema);\nexport type TransferCounterparties = v.InferOutput<typeof TransferCounterpartiesSchema>;\n\nexport const TransferDestinationSchema = v.object({\n scope: v.optional(AccountScopeSchema),\n kind: AddressBookEntryKindSchema,\n saved: v.boolean(),\n whitelisted: v.boolean(),\n whitelistStatus: DestinationWhitelistStatusSchema,\n addressBookEntry: v.optional(AddressBookEntrySchema),\n destination: AddressBookEntryValueSchema,\n whitelistEffectiveAt: TimestampMsSchema,\n whitelistUpdatedAt: TimestampMsSchema,\n});\n\nexport type TransferDestination = v.InferOutput<typeof TransferDestinationSchema>;\n\nexport const TransferDestinationsSchema = v.array(TransferDestinationSchema);\nexport type TransferDestinations = v.InferOutput<typeof TransferDestinationsSchema>;\n\nexport const InternalTransferWhitelistEntrySchema = v.object({\n entryId: PublicIdSchema,\n scope: v.optional(AccountScopeSchema),\n rootAccountId: PublicIdSchema,\n targetAccountId: PublicIdSchema,\n targetScopeType: v.pipe(\n v.enum(Proto.AccountScopeType),\n v.transform((value) =>\n requiredEnumLabel(\n AccountScopeTypeCodec.protoToOutput,\n value,\n \"PolyesterClient.InternalTransferWhitelistEntrySchema\",\n \"target scope type\",\n ),\n ),\n ),\n smartAccountAddress: v.string(),\n rootUsername: v.string(),\n subaccountLabel: v.string(),\n createdAt: TimestampMsSchema,\n updatedAt: TimestampMsSchema,\n resolutionStatus: v.pipe(\n v.enum(Proto.InternalWhitelistResolutionStatus),\n v.transform((value) =>\n requiredEnumLabel(\n InternalWhitelistResolutionStatusCodec.protoToOutput,\n value,\n \"PolyesterClient.InternalTransferWhitelistEntrySchema\",\n \"resolution status\",\n ),\n ),\n ),\n});\n\nexport type InternalTransferWhitelistEntry = v.InferOutput<\n typeof InternalTransferWhitelistEntrySchema\n>;\n\nexport const InternalTransferWhitelistEntriesSchema = v.array(InternalTransferWhitelistEntrySchema);\n\nexport type InternalTransferWhitelistEntries = v.InferOutput<\n typeof InternalTransferWhitelistEntriesSchema\n>;\n\nexport const MirroredWithdrawWhitelistEntrySchema = v.object({\n canonicalAddress: v.string(),\n rawAddressHex: v.string(),\n updatedAt: TimestampMsSchema,\n polychainChainId: v.pipe(v.number(), v.integer()),\n});\n\nexport type MirroredWithdrawWhitelistEntry = v.InferOutput<\n typeof MirroredWithdrawWhitelistEntrySchema\n>;\n\nexport const WithdrawWhitelistViewSchema = v.object({\n scope: v.optional(AccountScopeSchema),\n externalWhitelistRequired: v.boolean(),\n internalWhitelistRequired: v.boolean(),\n activeEntries: v.optional(v.array(MirroredWithdrawWhitelistEntrySchema), []),\n});\n\nexport type WithdrawWhitelistView = v.InferOutput<typeof WithdrawWhitelistViewSchema>;\n\nexport const AddressBookEntriesViewSchema = v.object({\n external: v.optional(\n v.array(\n v.object({\n addressBookEntryId: PublicIdSchema,\n scope: v.optional(AccountScopeSchema),\n label: v.string(),\n note: v.string(),\n tagIds: v.optional(v.array(PublicIdSchema), []),\n whitelistStatus: DestinationWhitelistStatusSchema,\n polychainChainId: v.pipe(v.number(), v.integer()),\n address: v.string(),\n createdAt: TimestampMsSchema,\n updatedAt: TimestampMsSchema,\n revision: BigIntStringSchema,\n }),\n ),\n [],\n ),\n internal: v.optional(\n v.array(\n v.object({\n addressBookEntryId: PublicIdSchema,\n scope: v.optional(AccountScopeSchema),\n label: v.string(),\n note: v.string(),\n tagIds: v.optional(v.array(PublicIdSchema), []),\n whitelistStatus: DestinationWhitelistStatusSchema,\n rootAccountId: PublicIdSchema,\n targetAccountId: PublicIdSchema,\n targetScopeType: v.pipe(\n v.enum(Proto.AccountScopeType),\n v.transform((value) =>\n requiredEnumLabel(\n AccountScopeTypeCodec.protoToOutput,\n value,\n \"PolyesterClient.AddressBookEntriesViewSchema\",\n \"target scope type\",\n ),\n ),\n ),\n smartAccountAddress: v.string(),\n rootUsername: v.string(),\n subaccountLabel: v.string(),\n createdAt: TimestampMsSchema,\n updatedAt: TimestampMsSchema,\n revision: BigIntStringSchema,\n }),\n ),\n [],\n ),\n});\n\nexport type AddressBookEntriesView = v.InferOutput<typeof AddressBookEntriesViewSchema>;\n\nexport const AddressBookRecentDestinationsViewSchema = v.object({\n external: v.optional(\n v.array(\n v.object({\n scope: v.optional(AccountScopeSchema),\n lastDirection: TransferCounterpartyDirectionSchema,\n saved: v.boolean(),\n addressBookEntryId: PublicIdSchema,\n useCount: CountSchema,\n lastSeenAt: TimestampMsSchema,\n polychainChainId: v.pipe(v.number(), v.integer()),\n address: v.string(),\n }),\n ),\n [],\n ),\n internal: v.optional(\n v.array(\n v.object({\n scope: v.optional(AccountScopeSchema),\n lastDirection: TransferCounterpartyDirectionSchema,\n saved: v.boolean(),\n addressBookEntryId: PublicIdSchema,\n useCount: CountSchema,\n lastSeenAt: TimestampMsSchema,\n rootAccountId: PublicIdSchema,\n targetAccountId: PublicIdSchema,\n targetScopeType: v.pipe(\n v.enum(Proto.AccountScopeType),\n v.transform((value) =>\n requiredEnumLabel(\n AccountScopeTypeCodec.protoToOutput,\n value,\n \"PolyesterClient.AddressBookRecentDestinationsViewSchema\",\n \"target scope type\",\n ),\n ),\n ),\n smartAccountAddress: v.string(),\n rootUsername: v.string(),\n subaccountLabel: v.string(),\n }),\n ),\n [],\n ),\n});\n\nexport type AddressBookRecentDestinationsView = v.InferOutput<\n typeof AddressBookRecentDestinationsViewSchema\n>;\n\nexport const AddressBookViewSchema = v.object({\n books: v.optional(v.array(AddressBookSchema), []),\n entries: v.optional(AddressBookEntriesViewSchema),\n recentDestinations: v.optional(AddressBookRecentDestinationsViewSchema),\n tags: v.optional(v.array(AddressBookTagSummarySchema), []),\n withdrawWhitelist: v.optional(WithdrawWhitelistViewSchema),\n recentDestinationsTruncated: v.optional(v.boolean(), false),\n viewRevision: v.optional(BigIntStringSchema, 0n),\n});\n\nexport type AddressBookView = v.InferOutput<typeof AddressBookViewSchema>;\n\nexport const AddressBookViewInvalidatedSchema = v.object({\n scope: v.optional(AccountScopeSchema),\n invalidatedAt: RequiredTimestampMsSchema,\n viewRevision: v.optional(BigIntStringSchema, 0n),\n});\n\nexport type AddressBookViewInvalidated = v.InferOutput<typeof AddressBookViewInvalidatedSchema>;\n"],"mappings":";;;;;;;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AAkB;EACpC,eAAe;EACf,OAAO,EAAE,QAAQ;EACjB,oBAAoB;EACpB,UAAU;EACV,YAAY;EACZ,kBAAkB,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,QAAQ,CAAC;EAChD,SAAS,EAAE,OAAO;CACtB,CAAC,CACL,GACA,CAAC,CACL;CACA,UAAU,EAAE,SACR,EAAE,MACE,EAAE,OAAO;EACL,OAAO,EAAE,SAAS,kBAAkB;EACpC,eAAe;EACf,OAAO,EAAE,QAAQ;EACjB,oBAAoB;EACpB,UAAU;EACV,YAAY;EACZ,eAAe;EACf,iBAAiB;EACjB,iBAAiB,EAAE,KACf,EAAE,KAAKA,gBAAsB,GAC7B,EAAE,WAAW,UACT,kBACI,sBAAsB,eACtB,OACA,2DACA,mBACJ,CACJ,CACJ;EACA,qBAAqB,EAAE,OAAO;EAC9B,cAAc,EAAE,OAAO;EACvB,iBAAiB,EAAE,OAAO;CAC9B,CAAC,CACL,GACA,CAAC,CACL;AACJ,CAAC;AAMD,MAAa,wBAAwB,EAAE,OAAO;CAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,GAAG,CAAC,CAAC;CAChD,SAAS,EAAE,SAAS,4BAA4B;CAChD,oBAAoB,EAAE,SAAS,uCAAuC;CACtE,MAAM,EAAE,SAAS,EAAE,MAAM,2BAA2B,GAAG,CAAC,CAAC;CACzD,mBAAmB,EAAE,SAAS,2BAA2B;CACzD,6BAA6B,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;CAC1D,cAAc,EAAE,SAAS,oBAAoB,EAAE;AACnD,CAAC;AAID,MAAa,mCAAmC,EAAE,OAAO;CACrD,OAAO,EAAE,SAAS,kBAAkB;CACpC,eAAeK;CACf,cAAc,EAAE,SAAS,oBAAoB,EAAE;AACnD,CAAC"}
|
|
1
|
+
{"version":3,"file":"address-book.schemas.js","names":["RequiredTimestampMsSchema"],"sources":["../../../src/services/address-book/address-book.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { PositiveUint32InputSchema } from \"../shared.js\";\nimport { parse } from \"../../shared/validation.js\";\nimport {\n OptionalTimestampMsSchema,\n BigIntStringSchema,\n PublicIdSchema,\n TimestampMsSchema as RequiredTimestampMsSchema,\n idInputSchema,\n optionalSubaccountIdInputSchema,\n positiveBigintStringInputSchema,\n} from \"../../shared/schemas.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport { enumLabelSchema } from \"../../shared/proto-enum-codec.js\";\nimport {\n ADDRESS_BOOK_ENTRY_KIND_VALUES,\n AccountScopeTypeCodec,\n AddressBookEntryKindCodec,\n DestinationWhitelistStatusCodec,\n InternalWhitelistResolutionStatusCodec,\n TRANSFER_COUNTERPARTY_DIRECTION_VALUES,\n TransferCounterpartyDirectionCodec,\n} from \"./address-book.codecs.js\";\nimport { SubaccountRoleCodec } from \"../subaccounts/subaccounts.codecs.js\";\nimport { buildProtoPatch, defineProtoPatchFields } from \"../../utils/proto-patch.js\";\n\nconst OptionalSubaccountIdSchema = optionalSubaccountIdInputSchema();\nconst IdSchema = idInputSchema;\n\nconst AddressBookLimitSchema = v.optional(\n v.pipe(v.number(), v.integer(), v.gtValue(0), v.maxValue(500)),\n);\nconst AddressBookCounterpartyLimitSchema = v.optional(\n v.pipe(v.number(), v.integer(), v.gtValue(0), v.maxValue(200)),\n);\nconst AddressBookViewLimitSchema = v.optional(\n v.pipe(v.number(), v.integer(), v.gtValue(0), v.maxValue(200)),\n);\nconst PageTokenSchema = v.optional(v.pipe(v.string(), v.trim()), \"\");\n\nconst TimestampMsSchema = OptionalTimestampMsSchema;\n\nconst AddressBookTagInputSchema = v.strictObject({\n name: v.pipe(v.string(), v.trim(), v.minLength(1), v.maxLength(48)),\n color: v.optional(v.pipe(v.string(), v.trim(), v.maxLength(32)), \"\"),\n});\nconst AddressBookTagInputsSchema = v.pipe(v.array(AddressBookTagInputSchema), v.maxLength(10));\n\nexport const ListAddressBookEntriesInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n kind: v.optional(v.picklist(ADDRESS_BOOK_ENTRY_KIND_VALUES)),\n limit: AddressBookLimitSchema,\n pageToken: PageTokenSchema,\n }),\n v.transform(({ account, kind, limit, pageToken }) => ({\n subaccountId: accountScopeToSubaccountId(account),\n kind: kind ? AddressBookEntryKindCodec.inputToProto[kind] : undefined,\n limit,\n pageToken,\n })),\n);\n\nexport type ListAddressBookEntriesInput = v.InferInput<typeof ListAddressBookEntriesInputSchema>;\n\nexport const CreateAddressBookEntryInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n label: v.pipe(v.string(), v.trim(), v.minLength(1)),\n note: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n entry: v.variant(\"kind\", [\n v.strictObject({\n kind: v.literal(\"external\"),\n polychainChainId: PositiveUint32InputSchema,\n address: v.pipe(v.string(), v.trim(), v.minLength(1)),\n }),\n v.strictObject({\n kind: v.literal(\"internal\"),\n smartAccountAddress: v.pipe(v.string(), v.trim(), v.minLength(1)),\n }),\n ]),\n tagIds: v.optional(v.array(IdSchema(\"tagId\")), []),\n newTags: v.optional(AddressBookTagInputsSchema, []),\n }),\n v.transform(({ account, entry, ...rest }) => ({\n ...rest,\n subaccountId: accountScopeToSubaccountId(account),\n entry:\n entry.kind === \"external\"\n ? {\n case: \"external\" as const,\n value: {\n polychainChainId: entry.polychainChainId,\n address: entry.address,\n },\n }\n : {\n case: \"internal\" as const,\n value: {\n smartAccountAddress: entry.smartAccountAddress,\n },\n },\n })),\n);\n\nexport type CreateAddressBookEntryInput = v.InferInput<typeof CreateAddressBookEntryInputSchema>;\n\nexport function validateCreateAddressBookEntryInput(input: CreateAddressBookEntryInput): void {\n parse(CreateAddressBookEntryInputSchema, input);\n}\n\ntype AddressBookEntryPatch = {\n label?: string;\n note?: string;\n tagIds?: bigint[];\n newTags?: v.InferOutput<typeof AddressBookTagInputSchema>[];\n};\n\nconst ADDRESS_BOOK_ENTRY_PATCH_FIELDS = defineProtoPatchFields<AddressBookEntryPatch>()({\n label: { path: \"label\", encode: (label) => ({ label }) },\n note: { path: \"note\", encode: (note) => ({ note }) },\n tagIds: { path: \"tag_ids\", encode: (tagIds) => ({ tagIds }) },\n newTags: { path: \"new_tags\", encode: (newTags) => ({ newTags }) },\n});\n\nexport const UpdateAddressBookEntryInputSchema = v.pipe(\n v.strictObject({\n addressBookEntryId: IdSchema(\"addressBookEntryId\"),\n expectedRevision: positiveBigintStringInputSchema(\"expectedRevision\"),\n label: v.optional(v.pipe(v.string(), v.trim())),\n note: v.optional(v.pipe(v.string(), v.trim())),\n tagIds: v.optional(v.array(IdSchema(\"tagId\"))),\n newTags: v.optional(AddressBookTagInputsSchema),\n }),\n v.check(\n ({ label, note, tagIds, newTags }) =>\n label !== undefined ||\n note !== undefined ||\n tagIds !== undefined ||\n newTags !== undefined,\n \"At least one address-book entry field must be provided\",\n ),\n v.transform(({ addressBookEntryId, expectedRevision, ...input }) => {\n const { patch: entry, updateMask } = buildProtoPatch(\n input,\n ADDRESS_BOOK_ENTRY_PATCH_FIELDS,\n );\n return { addressBookEntryId, entry, updateMask, expectedRevision };\n }),\n);\n\nexport type UpdateAddressBookEntryInput = v.InferInput<typeof UpdateAddressBookEntryInputSchema>;\n\nexport const DeleteAddressBookEntryInputSchema = v.strictObject({\n addressBookEntryId: IdSchema(\"addressBookEntryId\"),\n});\n\nexport type DeleteAddressBookEntryInput = v.InferInput<typeof DeleteAddressBookEntryInputSchema>;\n\nexport const CopyAddressBookEntryInputSchema = v.strictObject({\n addressBookEntryId: IdSchema(\"addressBookEntryId\"),\n targetSubaccountId: OptionalSubaccountIdSchema,\n});\n\nexport type CopyAddressBookEntryInput = v.InferInput<typeof CopyAddressBookEntryInputSchema>;\n\nexport const CreateAddressBookTagInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n name: v.pipe(v.string(), v.trim(), v.minLength(1)),\n color: v.optional(v.pipe(v.string(), v.trim()), \"\"),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type CreateAddressBookTagInput = v.InferInput<typeof CreateAddressBookTagInputSchema>;\n\nexport const UpdateAddressBookTagInputSchema = v.pipe(\n v.strictObject({\n tagId: IdSchema(\"tagId\"),\n name: v.optional(v.pipe(v.string(), v.trim(), v.minLength(1))),\n color: v.optional(v.pipe(v.string(), v.trim())),\n }),\n v.check(\n ({ name, color }) => name !== undefined || color !== undefined,\n \"At least one address-book tag field must be provided\",\n ),\n);\n\nexport type UpdateAddressBookTagInput = v.InferInput<typeof UpdateAddressBookTagInputSchema>;\n\nexport const DeleteAddressBookTagInputSchema = v.strictObject({\n tagId: IdSchema(\"tagId\"),\n});\n\nexport type DeleteAddressBookTagInput = v.InferInput<typeof DeleteAddressBookTagInputSchema>;\n\nexport const ListTransferCounterpartiesInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n direction: v.optional(v.picklist(TRANSFER_COUNTERPARTY_DIRECTION_VALUES)),\n kind: v.optional(v.picklist(ADDRESS_BOOK_ENTRY_KIND_VALUES)),\n limit: AddressBookCounterpartyLimitSchema,\n }),\n v.transform(({ account, direction, kind, limit }) => ({\n subaccountId: accountScopeToSubaccountId(account),\n direction: direction\n ? TransferCounterpartyDirectionCodec.inputToProto[direction]\n : undefined,\n kind: kind ? AddressBookEntryKindCodec.inputToProto[kind] : undefined,\n limit,\n })),\n);\n\nexport type ListTransferCounterpartiesInput = v.InferInput<\n typeof ListTransferCounterpartiesInputSchema\n>;\n\nexport const ListTransferDestinationsInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n kind: v.optional(v.picklist(ADDRESS_BOOK_ENTRY_KIND_VALUES)),\n limit: AddressBookLimitSchema,\n pageToken: PageTokenSchema,\n }),\n v.transform(({ account, kind, limit, pageToken }) => ({\n subaccountId: accountScopeToSubaccountId(account),\n kind: kind ? AddressBookEntryKindCodec.inputToProto[kind] : undefined,\n limit,\n pageToken,\n })),\n);\n\nexport type ListTransferDestinationsInput = v.InferInput<\n typeof ListTransferDestinationsInputSchema\n>;\n\nexport const SubaccountScopedInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n }),\n v.transform(({ account }) => ({\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type SubaccountScopedInput = v.InferInput<typeof SubaccountScopedInputSchema>;\n\nexport const ListInternalTransferWhitelistEntriesInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n limit: AddressBookLimitSchema,\n pageToken: PageTokenSchema,\n }),\n v.transform(({ account, limit, pageToken }) => ({\n subaccountId: accountScopeToSubaccountId(account),\n limit,\n pageToken,\n })),\n);\n\nexport type ListInternalTransferWhitelistEntriesInput = v.InferInput<\n typeof ListInternalTransferWhitelistEntriesInputSchema\n>;\n\nexport const GetAddressBookViewInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n limit: AddressBookViewLimitSchema,\n /** Minimum `viewRevision` (from an invalidation event) the returned view must reach. */\n minimumViewRevision: v.optional(positiveBigintStringInputSchema(\"minimumViewRevision\")),\n }),\n v.transform(({ account, limit, minimumViewRevision }) => ({\n subaccountId: accountScopeToSubaccountId(account),\n limit,\n minimumViewRevision,\n })),\n);\n\nexport type GetAddressBookViewInput = v.InferInput<typeof GetAddressBookViewInputSchema>;\n\nconst CountSchema = v.pipe(\n v.bigint(),\n v.transform((value) => Number(value)),\n);\n\nconst AccountScopeSchema = v.object({\n scopeType: enumLabelSchema(AccountScopeTypeCodec.protoToOutput),\n rootAccountId: PublicIdSchema,\n subaccountId: PublicIdSchema,\n});\n\nconst ExternalWithdrawAddressSchema = v.object({\n polychainChainId: v.pipe(v.number(), v.integer()),\n address: v.string(),\n});\n\nconst InternalTransferAccountSchema = v.object({\n rootAccountId: PublicIdSchema,\n targetAccountId: PublicIdSchema,\n targetScopeType: enumLabelSchema(AccountScopeTypeCodec.protoToOutput),\n smartAccountAddress: v.string(),\n rootUsername: v.string(),\n subaccountLabel: v.string(),\n});\n\nconst AddressBookEntryValueSchema = v.variant(\"case\", [\n v.object({ case: v.literal(\"external\"), value: ExternalWithdrawAddressSchema }),\n v.object({ case: v.literal(\"internal\"), value: InternalTransferAccountSchema }),\n v.object({ case: v.undefined(), value: v.optional(v.undefined()) }),\n]);\n\nconst DestinationWhitelistStatusSchema = enumLabelSchema(\n DestinationWhitelistStatusCodec.protoToOutput,\n);\n\nconst AddressBookEntryKindSchema = enumLabelSchema(AddressBookEntryKindCodec.protoToOutput);\n\nconst TransferCounterpartyDirectionSchema = enumLabelSchema(\n TransferCounterpartyDirectionCodec.protoToOutput,\n);\n\nexport const AddressBookSchema = v.object({\n scope: v.optional(AccountScopeSchema),\n callerRole: enumLabelSchema(SubaccountRoleCodec.protoToOutput),\n label: v.string(),\n ownerUsername: v.string(),\n smartAccountAddress: v.string(),\n});\n\nexport type AddressBook = v.InferOutput<typeof AddressBookSchema>;\n\nexport const AddressBookTagSummarySchema = v.object({\n tagId: PublicIdSchema,\n name: v.string(),\n color: v.string(),\n});\n\nexport type AddressBookTagSummary = v.InferOutput<typeof AddressBookTagSummarySchema>;\n\nexport const AddressBookTagSchema = v.object({\n tagId: PublicIdSchema,\n scope: v.optional(AccountScopeSchema),\n name: v.string(),\n color: v.string(),\n createdAt: TimestampMsSchema,\n updatedAt: TimestampMsSchema,\n});\n\nexport type AddressBookTag = v.InferOutput<typeof AddressBookTagSchema>;\n\nexport const AddressBookEntrySchema = v.object({\n addressBookEntryId: PublicIdSchema,\n scope: v.optional(AccountScopeSchema),\n kind: AddressBookEntryKindSchema,\n label: v.string(),\n note: v.string(),\n createdAt: TimestampMsSchema,\n updatedAt: TimestampMsSchema,\n entry: AddressBookEntryValueSchema,\n tags: v.array(AddressBookTagSchema),\n revision: BigIntStringSchema,\n});\n\nexport type AddressBookEntry = v.InferOutput<typeof AddressBookEntrySchema>;\n\nexport const AddressBookEntriesSchema = v.array(AddressBookEntrySchema);\nexport type AddressBookEntries = v.InferOutput<typeof AddressBookEntriesSchema>;\n\nexport const TransferCounterpartySchema = v.object({\n counterpartyId: PublicIdSchema,\n scope: v.optional(AccountScopeSchema),\n direction: TransferCounterpartyDirectionSchema,\n kind: AddressBookEntryKindSchema,\n saved: v.boolean(),\n addressBookEntryId: PublicIdSchema,\n useCount: CountSchema,\n firstSeenAt: TimestampMsSchema,\n lastSeenAt: TimestampMsSchema,\n counterparty: AddressBookEntryValueSchema,\n});\n\nexport type TransferCounterparty = v.InferOutput<typeof TransferCounterpartySchema>;\n\nexport const TransferCounterpartiesSchema = v.array(TransferCounterpartySchema);\nexport type TransferCounterparties = v.InferOutput<typeof TransferCounterpartiesSchema>;\n\nexport const TransferDestinationSchema = v.object({\n scope: v.optional(AccountScopeSchema),\n kind: AddressBookEntryKindSchema,\n saved: v.boolean(),\n whitelisted: v.boolean(),\n whitelistStatus: DestinationWhitelistStatusSchema,\n addressBookEntry: v.optional(AddressBookEntrySchema),\n destination: AddressBookEntryValueSchema,\n whitelistEffectiveAt: TimestampMsSchema,\n whitelistUpdatedAt: TimestampMsSchema,\n});\n\nexport type TransferDestination = v.InferOutput<typeof TransferDestinationSchema>;\n\nexport const TransferDestinationsSchema = v.array(TransferDestinationSchema);\nexport type TransferDestinations = v.InferOutput<typeof TransferDestinationsSchema>;\n\nexport const InternalTransferWhitelistEntrySchema = v.object({\n entryId: PublicIdSchema,\n scope: v.optional(AccountScopeSchema),\n rootAccountId: PublicIdSchema,\n targetAccountId: PublicIdSchema,\n targetScopeType: enumLabelSchema(AccountScopeTypeCodec.protoToOutput),\n smartAccountAddress: v.string(),\n rootUsername: v.string(),\n subaccountLabel: v.string(),\n createdAt: TimestampMsSchema,\n updatedAt: TimestampMsSchema,\n resolutionStatus: enumLabelSchema(InternalWhitelistResolutionStatusCodec.protoToOutput),\n});\n\nexport type InternalTransferWhitelistEntry = v.InferOutput<\n typeof InternalTransferWhitelistEntrySchema\n>;\n\nexport const InternalTransferWhitelistEntriesSchema = v.array(InternalTransferWhitelistEntrySchema);\n\nexport type InternalTransferWhitelistEntries = v.InferOutput<\n typeof InternalTransferWhitelistEntriesSchema\n>;\n\nexport const MirroredWithdrawWhitelistEntrySchema = v.object({\n canonicalAddress: v.string(),\n rawAddressHex: v.string(),\n updatedAt: TimestampMsSchema,\n polychainChainId: v.pipe(v.number(), v.integer()),\n});\n\nexport type MirroredWithdrawWhitelistEntry = v.InferOutput<\n typeof MirroredWithdrawWhitelistEntrySchema\n>;\n\nexport const WithdrawWhitelistViewSchema = v.object({\n scope: v.optional(AccountScopeSchema),\n externalWhitelistRequired: v.boolean(),\n internalWhitelistRequired: v.boolean(),\n activeEntries: v.optional(v.array(MirroredWithdrawWhitelistEntrySchema), []),\n});\n\nexport type WithdrawWhitelistView = v.InferOutput<typeof WithdrawWhitelistViewSchema>;\n\nexport const AddressBookEntriesViewSchema = v.object({\n external: v.optional(\n v.array(\n v.object({\n addressBookEntryId: PublicIdSchema,\n scope: v.optional(AccountScopeSchema),\n label: v.string(),\n note: v.string(),\n tagIds: v.optional(v.array(PublicIdSchema), []),\n whitelistStatus: DestinationWhitelistStatusSchema,\n polychainChainId: v.pipe(v.number(), v.integer()),\n address: v.string(),\n createdAt: TimestampMsSchema,\n updatedAt: TimestampMsSchema,\n revision: BigIntStringSchema,\n }),\n ),\n [],\n ),\n internal: v.optional(\n v.array(\n v.object({\n addressBookEntryId: PublicIdSchema,\n scope: v.optional(AccountScopeSchema),\n label: v.string(),\n note: v.string(),\n tagIds: v.optional(v.array(PublicIdSchema), []),\n whitelistStatus: DestinationWhitelistStatusSchema,\n rootAccountId: PublicIdSchema,\n targetAccountId: PublicIdSchema,\n targetScopeType: enumLabelSchema(AccountScopeTypeCodec.protoToOutput),\n smartAccountAddress: v.string(),\n rootUsername: v.string(),\n subaccountLabel: v.string(),\n createdAt: TimestampMsSchema,\n updatedAt: TimestampMsSchema,\n revision: BigIntStringSchema,\n }),\n ),\n [],\n ),\n});\n\nexport type AddressBookEntriesView = v.InferOutput<typeof AddressBookEntriesViewSchema>;\n\nexport const AddressBookRecentDestinationsViewSchema = v.object({\n external: v.optional(\n v.array(\n v.object({\n scope: v.optional(AccountScopeSchema),\n lastDirection: TransferCounterpartyDirectionSchema,\n saved: v.boolean(),\n addressBookEntryId: PublicIdSchema,\n useCount: CountSchema,\n lastSeenAt: TimestampMsSchema,\n polychainChainId: v.pipe(v.number(), v.integer()),\n address: v.string(),\n }),\n ),\n [],\n ),\n internal: v.optional(\n v.array(\n v.object({\n scope: v.optional(AccountScopeSchema),\n lastDirection: TransferCounterpartyDirectionSchema,\n saved: v.boolean(),\n addressBookEntryId: PublicIdSchema,\n useCount: CountSchema,\n lastSeenAt: TimestampMsSchema,\n rootAccountId: PublicIdSchema,\n targetAccountId: PublicIdSchema,\n targetScopeType: enumLabelSchema(AccountScopeTypeCodec.protoToOutput),\n smartAccountAddress: v.string(),\n rootUsername: v.string(),\n subaccountLabel: v.string(),\n }),\n ),\n [],\n ),\n});\n\nexport type AddressBookRecentDestinationsView = v.InferOutput<\n typeof AddressBookRecentDestinationsViewSchema\n>;\n\nexport const AddressBookViewSchema = v.object({\n books: v.optional(v.array(AddressBookSchema), []),\n entries: v.optional(AddressBookEntriesViewSchema),\n recentDestinations: v.optional(AddressBookRecentDestinationsViewSchema),\n tags: v.optional(v.array(AddressBookTagSummarySchema), []),\n withdrawWhitelist: v.optional(WithdrawWhitelistViewSchema),\n recentDestinationsTruncated: v.optional(v.boolean(), false),\n viewRevision: v.optional(BigIntStringSchema, 0n),\n});\n\nexport type AddressBookView = v.InferOutput<typeof AddressBookViewSchema>;\n\nexport const AddressBookViewInvalidatedSchema = v.object({\n scope: v.optional(AccountScopeSchema),\n invalidatedAt: RequiredTimestampMsSchema,\n viewRevision: v.optional(BigIntStringSchema, 0n),\n});\n\nexport type AddressBookViewInvalidated = v.InferOutput<typeof AddressBookViewInvalidatedSchema>;\n"],"mappings":";;;;;;;;;;AA6BA,MAAM,6BAA6B,g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,EAAE,SAAS,2BAA2B;CACzD,6BAA6B,EAAE,SAAS,EAAE,QAAQ,GAAG,KAAK;CAC1D,cAAc,EAAE,SAAS,oBAAoB,EAAE;AACnD,CAAC;AAID,MAAa,mCAAmC,EAAE,OAAO;CACrD,OAAO,EAAE,SAAS,kBAAkB;CACpC,eAAeA;CACf,cAAc,EAAE,SAAS,oBAAoB,EAAE;AACnD,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ApiKeyStatus as ApiKeyStatus$1 } from "../../gen/auth/v1/api_keys_pb.js";
|
|
2
1
|
import * as v from "valibot";
|
|
3
2
|
//#region src/services/api-keys/api-keys.schemas.d.ts
|
|
4
3
|
declare const ApiKeyStatusSchema: v.PicklistSchema<readonly ["active", "revoked", "disabled"], undefined>;
|
|
@@ -134,7 +133,7 @@ declare const ApiKeySchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
134
133
|
seconds: bigint;
|
|
135
134
|
nanos: number;
|
|
136
135
|
} | undefined, string | undefined>]>;
|
|
137
|
-
readonly status: v.SchemaWithPipe<readonly [v.
|
|
136
|
+
readonly status: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "disabled" | "active" | "revoked">]>;
|
|
138
137
|
readonly createdByActor: v.StringSchema<undefined>;
|
|
139
138
|
readonly revision: v.SchemaWithPipe<readonly [v.BigintSchema<undefined>, v.TransformAction<bigint, string>]>;
|
|
140
139
|
}, undefined>, v.TransformAction<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-keys.schemas.d.ts","names":[],"sources":["../../../src/services/api-keys/api-keys.schemas.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"api-keys.schemas.d.ts","names":[],"sources":["../../../src/services/api-keys/api-keys.schemas.ts"],"mappings":";;cAwBM,oBAAkB,EAAA;KAGZ,eAAe,EAAE,mBAAmB;cAEnC,wBAAsB,EAAA,yBAAA,EAAA;;;;;;;;;;;KASvB,mBAAmB,EAAE,kBAAkB;cAEtC,qBAAmB,EAAA;;;KAIpB,gBAAgB,EAAE,kBAAkB;cAEnC,0BAAwB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAezB,qBAAqB,EAAE,kBAAkB;cAgCxC,0BAAwB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAqCzB,qBAAqB,EAAE,kBAAkB;cAExC,cAAY,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAoCb,SAAS,EAAE,mBAAmB"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { enumLabelSchema } from "../../shared/proto-enum-codec.js";
|
|
2
2
|
import { tsObjToMs, tsObjToNsString } from "../../utils/time.js";
|
|
3
3
|
import { BigIntStringSchema, OptionalPublicIdSchema, OptionalTimestampMsSchema, TimestampMsSchema, TimestampSchema, positiveBigintStringInputSchema } from "../../shared/schemas.js";
|
|
4
|
-
import { ApiKeyStatus } from "../../gen/auth/v1/api_keys_pb.js";
|
|
5
4
|
import { buildProtoPatch, defineProtoPatchFields } from "../../utils/proto-patch.js";
|
|
6
|
-
import {
|
|
5
|
+
import { msToTimestamp } from "../../utils/timestamp.js";
|
|
7
6
|
import { AccountScopeInputEntries, accountScopeToSubaccountId } from "../../shared/account-scope.js";
|
|
8
7
|
import { API_KEY_STATUS_VALUES, API_KEY_UPDATE_STATUS_VALUES, ApiKeyStatusCodec } from "./api-keys.codecs.js";
|
|
9
8
|
import * as v from "valibot";
|
|
@@ -49,11 +48,7 @@ const API_KEY_PATCH_FIELDS = defineProtoPatchFields()({
|
|
|
49
48
|
path: "expires_at",
|
|
50
49
|
encode: (expiresAtIso) => {
|
|
51
50
|
if (expiresAtIso === null) return {};
|
|
52
|
-
|
|
53
|
-
return { expiresAt: toTimestamp({
|
|
54
|
-
seconds: BigInt(Math.floor(expiresAtMs / 1e3)),
|
|
55
|
-
nanos: expiresAtMs % 1e3 * 1e6
|
|
56
|
-
}) };
|
|
51
|
+
return { expiresAt: msToTimestamp(new Date(expiresAtIso).getTime()) };
|
|
57
52
|
}
|
|
58
53
|
}
|
|
59
54
|
});
|
|
@@ -91,7 +86,7 @@ const ApiKeySchema = v.pipe(v.object({
|
|
|
91
86
|
const ms = tsObjToMs(v);
|
|
92
87
|
return ms ? new Date(ms).toISOString() : void 0;
|
|
93
88
|
})),
|
|
94
|
-
status:
|
|
89
|
+
status: enumLabelSchema(ApiKeyStatusCodec.protoToOutput),
|
|
95
90
|
createdByActor: v.string(),
|
|
96
91
|
revision: BigIntStringSchema
|
|
97
92
|
}), v.transform(({ subaccountId, updatedAt, ...rest }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-keys.schemas.js","names":[
|
|
1
|
+
{"version":3,"file":"api-keys.schemas.js","names":[],"sources":["../../../src/services/api-keys/api-keys.schemas.ts"],"sourcesContent":["import * as v from \"valibot\";\nimport { msToTimestamp } from \"../../utils/timestamp.js\";\nimport { tsObjToMs, tsObjToNsString } from \"../../utils/time.js\";\nimport {\n OptionalPublicIdSchema,\n OptionalTimestampMsSchema,\n BigIntStringSchema,\n TimestampMsSchema,\n TimestampSchema,\n positiveBigintStringInputSchema,\n} from \"../../shared/schemas.js\";\nimport {\n AccountScopeInputEntries,\n accountScopeToSubaccountId,\n} from \"../../shared/account-scope.js\";\nimport { enumLabelSchema } from \"../../shared/proto-enum-codec.js\";\nimport { bytesToHex } from \"@noble/hashes/utils.js\";\nimport {\n API_KEY_STATUS_VALUES,\n API_KEY_UPDATE_STATUS_VALUES,\n ApiKeyStatusCodec,\n} from \"./api-keys.codecs.js\";\nimport { buildProtoPatch, defineProtoPatchFields } from \"../../utils/proto-patch.js\";\n\nconst ApiKeyStatusSchema = v.picklist(API_KEY_STATUS_VALUES);\nconst ApiKeyUpdateStatusSchema = v.picklist(API_KEY_UPDATE_STATUS_VALUES);\n\nexport type ApiKeyStatus = v.InferOutput<typeof ApiKeyStatusSchema>;\n\nexport const ApiKeysListInputSchema = v.pipe(\n v.strictObject({\n ...AccountScopeInputEntries,\n }),\n v.transform(({ account }) => ({\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type ApiKeysListInput = v.InferInput<typeof ApiKeysListInputSchema>;\n\nexport const ApiKeyIdInputSchema = v.strictObject({\n keyId: v.pipe(v.string(), v.trim(), v.minLength(1, \"keyId is required\")),\n});\n\nexport type ApiKeyIdInput = v.InferInput<typeof ApiKeyIdInputSchema>;\n\nexport const ApiKeysCreateInputSchema = v.pipe(\n v.strictObject({\n label: v.string(),\n icon: v.optional(v.string(), \"\"),\n color: v.optional(v.string(), \"\"),\n ...AccountScopeInputEntries,\n ipWhitelist: v.optional(v.array(v.string()), []),\n publicKeyEd25519: v.instance(Uint8Array<ArrayBufferLike>),\n }),\n v.transform(({ account, ...input }) => ({\n ...input,\n subaccountId: accountScopeToSubaccountId(account),\n })),\n);\n\nexport type ApiKeysCreateInput = v.InferInput<typeof ApiKeysCreateInputSchema>;\n\ntype ApiKeyPatch = {\n label?: string;\n icon?: string;\n color?: string;\n status?: v.InferOutput<typeof ApiKeyUpdateStatusSchema>;\n ipWhitelist?: string[];\n expiresAtIso?: string | null;\n};\n\nconst API_KEY_PATCH_FIELDS = defineProtoPatchFields<ApiKeyPatch>()({\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: ApiKeyStatusCodec.inputToProto[status] }),\n },\n ipWhitelist: {\n path: \"ip_whitelist\",\n encode: (ipWhitelist) => ({ ipWhitelist }),\n },\n expiresAtIso: {\n path: \"expires_at\",\n encode: (expiresAtIso) => {\n if (expiresAtIso === null) return {};\n return { expiresAt: msToTimestamp(new Date(expiresAtIso).getTime()) };\n },\n },\n});\n\nexport const ApiKeysUpdateInputSchema = v.pipe(\n v.strictObject({\n keyId: v.pipe(v.string(), v.trim(), v.minLength(1, \"keyId is required\")),\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(ApiKeyUpdateStatusSchema),\n ipWhitelist: v.optional(v.array(v.string())),\n expiresAtIso: v.optional(\n v.nullable(\n v.pipe(\n v.string(),\n v.check(\n (value) => Number.isFinite(Date.parse(value)),\n \"expiresAtIso must be a valid timestamp\",\n ),\n ),\n ),\n ),\n }),\n v.check(\n ({ label, icon, color, status, ipWhitelist, expiresAtIso }) =>\n label !== undefined ||\n icon !== undefined ||\n color !== undefined ||\n status !== undefined ||\n ipWhitelist !== undefined ||\n expiresAtIso !== undefined,\n \"At least one API key field must be provided\",\n ),\n v.transform(({ keyId, expectedRevision, ...input }) => {\n const { patch: apiKey, updateMask } = buildProtoPatch(input, API_KEY_PATCH_FIELDS);\n return { keyId, apiKey, updateMask, expectedRevision };\n }),\n);\n\nexport type ApiKeysUpdateInput = v.InferInput<typeof ApiKeysUpdateInputSchema>;\n\nexport const ApiKeySchema = v.pipe(\n v.object({\n keyId: v.string(),\n label: v.optional(v.string(), \"\"),\n icon: v.optional(v.string(), \"\"),\n color: v.optional(v.string(), \"\"),\n ipWhitelist: v.optional(v.array(v.string()), []),\n subaccountId: OptionalPublicIdSchema,\n policyId: OptionalPublicIdSchema,\n createdAt: TimestampMsSchema,\n updatedAt: v.optional(TimestampSchema),\n lastUsedAt: OptionalTimestampMsSchema,\n publicKeyEd25519: v.instance(Uint8Array<ArrayBufferLike>),\n expiresAt: v.pipe(\n v.optional(TimestampSchema),\n v.transform((v) => {\n const ms = tsObjToMs(v);\n return ms ? new Date(ms).toISOString() : undefined;\n }),\n ),\n status: enumLabelSchema(ApiKeyStatusCodec.protoToOutput),\n createdByActor: v.string(),\n revision: BigIntStringSchema,\n }),\n v.transform(({ subaccountId, updatedAt, ...rest }) => {\n const hex = bytesToHex(rest.publicKeyEd25519);\n return {\n ...rest,\n subaccountId,\n updatedAt: tsObjToMs(updatedAt),\n updatedAtNs: tsObjToNsString(updatedAt),\n publicKeyHex: hex,\n };\n }),\n);\n\nexport type ApiKey = v.InferOutput<typeof ApiKeySchema>;\n\nexport const ApiKeysSchema = v.array(ApiKeySchema);\n"],"mappings":";;;;;;;;;;AAwB2B,EAAE,SAAS,qBAAqB;AAC3D,MAAM,2BAA2B,EAAE,SAAS,4BAA4B;AAIxE,MAAa,yBAAyB,EAAE,KACpC,EAAE,aAAa,EACX,GAAG,yBACP,CAAC,GACD,EAAE,WAAW,EAAE,eAAe,EAC1B,cAAc,2BAA2B,OAAO,EACpD,EAAE,CACN;AAIA,MAAa,sBAAsB,EAAE,aAAa,EAC9C,OAAO,EAAE,KAAK,EAAE,OAAO,GAAG,EAAE,KAAK,GAAG,EAAE,UAAU,GAAG,mBAAmB,CAAC,EAC3E,CAAC;AAID,MAAa,2BAA2B,EAAE,KACtC,EAAE,aAAa;CACX,OAAO,EAAE,OAAO;CAChB,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CAC/B,OAAO,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CAChC,GAAG;CACH,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;CAC/C,kBAAkB,EAAE,SAAS,UAA2B;AAC5D,CAAC,GACD,EAAE,WAAW,EAAE,SAAS,GAAG,aAAa;CACpC,GAAG;CACH,cAAc,2BAA2B,OAAO;AACpD,EAAE,CACN;AAaA,MAAM,uBAAuB,uBAAoC,CAAC,CAAC;CAC/D,OAAO;EAAE,MAAM;EAAS,SAAS,WAAW,EAAE,MAAM;CAAG;CACvD,MAAM;EAAE,MAAM;EAAQ,SAAS,UAAU,EAAE,KAAK;CAAG;CACnD,OAAO;EAAE,MAAM;EAAS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;CAAiB;AACzD,CAAC,CACL;AAIA,MAAa,eAAe,EAAE,KAC1B,EAAE,OAAO;CACL,OAAO,EAAE,OAAO;CAChB,OAAO,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CAChC,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CAC/B,OAAO,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CAChC,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;CAC/C,cAAc;CACd,UAAU;CACV,WAAW;CACX,WAAW,EAAE,SAAS,eAAe;CACrC,YAAY;CACZ,kBAAkB,EAAE,SAAS,UAA2B;CACxD,WAAW,EAAE,KACT,EAAE,SAAS,eAAe,GAC1B,EAAE,WAAW,MAAM;EACf,MAAM,KAAK,UAAU,CAAC;EACtB,OAAO,KAAK,IAAI,KAAK,EAAE,CAAC,CAAC,YAAY,IAAI,KAAA;CAC7C,CAAC,CACL;CACA,QAAQ,gBAAgB,kBAAkB,aAAa;CACvD,gBAAgB,EAAE,OAAO;CACzB,UAAU;AACd,CAAC,GACD,EAAE,WAAW,EAAE,cAAc,WAAW,GAAG,WAAW;CAClD,MAAM,MAAM,WAAW,KAAK,gBAAgB;CAC5C,OAAO;EACH,GAAG;EACH;EACA,WAAW,UAAU,SAAS;EAC9B,aAAa,gBAAgB,SAAS;EACtC,cAAc;CAClB;AACJ,CAAC,CACL;AAIA,MAAa,gBAAgB,EAAE,MAAM,YAAY"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { SessionLevel } from "../../gen/auth/v1/mfa_pb.js";
|
|
2
1
|
import { AuthAndPublicApiTransports } from "../../shared/transports.js";
|
|
3
2
|
import { PolyesterMutationOptions, PolyesterRequestOptions } from "../../shared/request-options.js";
|
|
4
3
|
import { PolyesterRealtime } from "../../realtime/types.js";
|
|
@@ -17,7 +16,7 @@ type WalletChallengePurpose = CreateWalletChallengeInput["purpose"];
|
|
|
17
16
|
declare const LoginWithWalletInputSchema: v.StrictObjectSchema<{
|
|
18
17
|
readonly smartAccountAddress: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.CheckAction<string, "Invalid wallet address.">]>;
|
|
19
18
|
readonly message: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.MinLengthAction<string, 1, undefined>, v.CheckAction<string, "Wallet challenge message exceeds 4096 UTF-8 bytes.">]>;
|
|
20
|
-
readonly signature: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.
|
|
19
|
+
readonly signature: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.RegexAction<string, "Login signature must be a 65-byte hexadecimal EOA signature.">]>;
|
|
21
20
|
readonly userAgent: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
22
21
|
readonly ip: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
23
22
|
readonly walletProvider: v.OptionalSchema<v.StringSchema<undefined>, "">;
|
|
@@ -29,7 +28,7 @@ declare const MeSchema: v.ObjectSchema<{
|
|
|
29
28
|
readonly username: v.StringSchema<undefined>;
|
|
30
29
|
readonly session: v.OptionalSchema<v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
31
30
|
readonly sessionId: v.StringSchema<undefined>;
|
|
32
|
-
readonly sessionLevel: v.SchemaWithPipe<readonly [v.
|
|
31
|
+
readonly sessionLevel: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "primaryAuthenticated" | "mfaElevated" | "freshStepUp">]>;
|
|
33
32
|
readonly authenticationMethods: v.OptionalSchema<v.ArraySchema<v.StringSchema<undefined>, undefined>, readonly []>;
|
|
34
33
|
readonly authTime: v.SchemaWithPipe<readonly [v.OptionalSchema<v.ObjectSchema<{
|
|
35
34
|
readonly seconds: v.BigintSchema<undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.d.ts","names":[],"sources":["../../../src/services/auth/auth.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth.d.ts","names":[],"sources":["../../../src/services/auth/auth.ts"],"mappings":";;;;;;;cA0Ba,kCAAgC,EAAA;;;;;;KAMjC,6BAA6B,EAAE,kBAAkB;KACjD,yBAAyB;cAWxB,4BAA0B,EAAA;;;;;;;;KAS3B,uBAAuB,EAAE,kBAAkB;cAEjD,UAAQ,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;KAOF,KAAK,EAAE,mBAAmB;cAEhC,+BAA6B,EAAA;;;;;;;;;KAOvB,0BAA0B,EAAE,mBAAmB;cAErD,uBAAqB,EAAA;;;;;;;;;;KAKf,kBAAkB,EAAE,mBAAmB;;;;cAKtC;;EAGT,SAAS;EAEG,YAAA,YAAY,4BAA4B,UAAU;;;;EASxD,GAAG,UAAU,0BAA0B,QAAQ;;;;;;;EAW/C,YAAY,UAAU,2BAA2B;;;;;EAQjD,sBACF,OAAO,4BACP,UAAU,0BACX,QAAQ;;;;YA4BK,gBACZ,OAAO,sBACP,UAAU,2BACX,QAAQ"}
|
|
@@ -5,7 +5,7 @@ import { parse } from "../../shared/validation.js";
|
|
|
5
5
|
import { toConnectCallOptions } from "../../shared/request-options.js";
|
|
6
6
|
import { ProfileService } from "./profile/profile.js";
|
|
7
7
|
import { MfaSessionInfoSchema } from "../mfa/mfa.schemas.js";
|
|
8
|
-
import { WalletAddressSchema, WalletChallengeMessageSchema, WalletChallengeUriSchema
|
|
8
|
+
import { WalletAddressSchema, WalletChallengeMessageSchema, WalletChallengeUriSchema } from "./wallet-challenge.schemas.js";
|
|
9
9
|
import { createClient } from "@connectrpc/connect";
|
|
10
10
|
import * as v from "valibot";
|
|
11
11
|
//#region src/services/auth/auth.ts
|
|
@@ -15,10 +15,12 @@ const CreateWalletChallengeInputSchema = v.strictObject({
|
|
|
15
15
|
uri: WalletChallengeUriSchema,
|
|
16
16
|
purpose: v.picklist(["login", "create_subaccount"])
|
|
17
17
|
});
|
|
18
|
+
/** An EIP-191 EOA signature: 65 hexadecimal bytes, with an optional 0x prefix. */
|
|
19
|
+
const LoginEoaSignatureSchema = v.pipe(v.string(), v.regex(/^(?:0x)?[0-9a-fA-F]{130}$/, "Login signature must be a 65-byte hexadecimal EOA signature."));
|
|
18
20
|
const LoginWithWalletInputSchema = v.strictObject({
|
|
19
21
|
smartAccountAddress: WalletAddressSchema,
|
|
20
22
|
message: WalletChallengeMessageSchema,
|
|
21
|
-
signature:
|
|
23
|
+
signature: LoginEoaSignatureSchema,
|
|
22
24
|
userAgent: v.optional(v.string(), ""),
|
|
23
25
|
ip: v.optional(v.string(), ""),
|
|
24
26
|
walletProvider: v.optional(v.string(), "")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth.js","names":["#publicClient","Proto.AuthService","#authClient"],"sources":["../../../src/services/auth/auth.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/auth/v1/auth_pb.js\";\nimport * as v from \"valibot\";\nimport { ValidationError } from \"../../shared/errors.js\";\nimport { parse } from \"../../shared/validation.js\";\nimport { ProfileService } from \"./profile/profile.js\";\nimport {\n OptionalTimestampMsSchema,\n PublicIdSchema,\n TimestampSchema,\n} from \"../../shared/schemas.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport { MfaSessionInfoSchema } from \"../mfa/mfa.schemas.js\";\nimport type { PolyesterRealtime } from \"../../realtime/index.js\";\nimport type { AuthAndPublicApiTransports } from \"../../shared/transports.js\";\n\nimport {\n WalletAddressSchema,\n WalletChallengeUriSchema,\n WalletChallengeMessageSchema,\n
|
|
1
|
+
{"version":3,"file":"auth.js","names":["#publicClient","Proto.AuthService","#authClient"],"sources":["../../../src/services/auth/auth.ts"],"sourcesContent":["import { createClient, type Client } from \"@connectrpc/connect\";\nimport * as Proto from \"../../gen/auth/v1/auth_pb.js\";\nimport * as v from \"valibot\";\nimport { ValidationError } from \"../../shared/errors.js\";\nimport { parse } from \"../../shared/validation.js\";\nimport { ProfileService } from \"./profile/profile.js\";\nimport {\n OptionalTimestampMsSchema,\n PublicIdSchema,\n TimestampSchema,\n} from \"../../shared/schemas.js\";\nimport {\n toConnectCallOptions,\n type PolyesterMutationOptions,\n type PolyesterRequestOptions,\n} from \"../../shared/request-options.js\";\nimport { MfaSessionInfoSchema } from \"../mfa/mfa.schemas.js\";\nimport type { PolyesterRealtime } from \"../../realtime/index.js\";\nimport type { AuthAndPublicApiTransports } from \"../../shared/transports.js\";\n\nimport {\n WalletAddressSchema,\n WalletChallengeUriSchema,\n WalletChallengeMessageSchema,\n} from \"./wallet-challenge.schemas.js\";\n\nexport const CreateWalletChallengeInputSchema = v.strictObject({\n smartAccountAddress: WalletAddressSchema,\n signerAddress: WalletAddressSchema,\n uri: WalletChallengeUriSchema,\n purpose: v.picklist([\"login\", \"create_subaccount\"]),\n});\nexport type CreateWalletChallengeInput = v.InferInput<typeof CreateWalletChallengeInputSchema>;\nexport type WalletChallengePurpose = CreateWalletChallengeInput[\"purpose\"];\n\n/** An EIP-191 EOA signature: 65 hexadecimal bytes, with an optional 0x prefix. */\nconst LoginEoaSignatureSchema = v.pipe(\n v.string(),\n v.regex(\n /^(?:0x)?[0-9a-fA-F]{130}$/,\n \"Login signature must be a 65-byte hexadecimal EOA signature.\",\n ),\n);\n\nexport const LoginWithWalletInputSchema = v.strictObject({\n smartAccountAddress: WalletAddressSchema,\n message: WalletChallengeMessageSchema,\n signature: LoginEoaSignatureSchema,\n userAgent: v.optional(v.string(), \"\"),\n ip: v.optional(v.string(), \"\"),\n walletProvider: v.optional(v.string(), \"\"),\n});\n\nexport type LoginWithWalletInput = v.InferInput<typeof LoginWithWalletInputSchema>;\n\nconst MeSchema = v.object({\n accountId: PublicIdSchema,\n apiKeyId: v.optional(v.string()),\n username: v.string(),\n session: v.optional(MfaSessionInfoSchema),\n});\n\nexport type Me = v.InferOutput<typeof MeSchema>;\n\nconst LoginWithWalletResponseSchema = v.object({\n accessToken: v.string(),\n expiresAt: v.optional(TimestampSchema),\n accountId: PublicIdSchema,\n username: v.string(),\n});\n\nexport type LoginWithWalletResponse = v.InferOutput<typeof LoginWithWalletResponseSchema>;\n\nconst WalletChallengeSchema = v.object({\n message: WalletChallengeMessageSchema,\n expiresAt: OptionalTimestampMsSchema,\n});\n\nexport type WalletChallenge = v.InferOutput<typeof WalletChallengeSchema>;\n\n/**\n * Handles wallet-based authentication, caller introspection, and authenticated profile operations.\n */\nexport class AuthService {\n #publicClient: Client<typeof Proto.AuthService>;\n #authClient: Client<typeof Proto.AuthService>;\n profile: ProfileService;\n\n constructor(transports: AuthAndPublicApiTransports, realtime: PolyesterRealtime) {\n this.#publicClient = createClient(Proto.AuthService, transports.publicApi);\n this.#authClient = createClient(Proto.AuthService, transports.authApi);\n this.profile = new ProfileService(transports, realtime);\n }\n\n /**\n * Returns the authenticated caller's account context, including account ID, optional API key ID, username, and session assurance details from the presented token or API key.\n */\n async me(options?: PolyesterRequestOptions): Promise<Me> {\n const res = await this.#authClient.me({}, toConnectCallOptions(options));\n return parse(MeSchema, res);\n }\n\n /**\n * Records explicit consent to the current terms for the caller's root account.\n * Call only after the user consents. Requires an interactive JWT session;\n * API keys are not allowed. Repeated acceptance succeeds without changing\n * the first acceptance time. No MFA is required.\n */\n async acceptTerms(options?: PolyesterMutationOptions): Promise<void> {\n await this.#authClient.acceptTerms({}, toConnectCallOptions(options));\n }\n\n /**\n * Requests a server-issued SIWE message. Sign its exact UTF-8 bytes with\n * personal_sign; do not hash or reconstruct it. Expiry is epoch milliseconds.\n */\n async createWalletChallenge(\n input: CreateWalletChallengeInput,\n options?: PolyesterRequestOptions,\n ): Promise<WalletChallenge> {\n const validated = parse(CreateWalletChallengeInputSchema, input);\n if (\n validated.purpose === \"create_subaccount\" &&\n validated.signerAddress.toLowerCase() !== validated.smartAccountAddress.toLowerCase()\n ) {\n throw new ValidationError(\n \"Subaccount challenge signer must equal the smart account address.\",\n );\n }\n return parse(\n WalletChallengeSchema,\n await this.#publicClient.createWalletChallenge(\n {\n ...validated,\n purpose:\n validated.purpose === \"login\"\n ? Proto.WalletChallengePurpose.LOGIN\n : Proto.WalletChallengePurpose.CREATE_SUBACCOUNT,\n },\n toConnectCallOptions(options),\n ),\n );\n }\n\n /**\n * Exchanges a signed SIWE message for an authenticated session token and account identity returned by the auth API.\n */\n protected async loginWithWallet(\n input: LoginWithWalletInput,\n options?: PolyesterMutationOptions,\n ): Promise<LoginWithWalletResponse> {\n const validatedInput = parse(LoginWithWalletInputSchema, input);\n const res = await this.#publicClient.loginWithWallet(\n validatedInput,\n toConnectCallOptions(options),\n );\n return parse(LoginWithWalletResponseSchema, res);\n }\n}\n"],"mappings":";;;;;;;;;;;AA0BA,MAAa,mCAAmC,EAAE,aAAa;CAC3D,qBAAqB;CACrB,eAAe;CACf,KAAK;CACL,SAAS,EAAE,SAAS,CAAC,SAAS,mBAAmB,CAAC;AACtD,CAAC;;AAKD,MAAM,0BAA0B,EAAE,KAC9B,EAAE,OAAO,GACT,EAAE,MACE,6BACA,8DACJ,CACJ;AAEA,MAAa,6BAA6B,EAAE,aAAa;CACrD,qBAAqB;CACrB,SAAS;CACT,WAAW;CACX,WAAW,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CACpC,IAAI,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;CAC7B,gBAAgB,EAAE,SAAS,EAAE,OAAO,GAAG,EAAE;AAC7C,CAAC;AAID,MAAM,WAAW,EAAE,OAAO;CACtB,WAAW;CACX,UAAU,EAAE,SAAS,EAAE,OAAO,CAAC;CAC/B,UAAU,EAAE,OAAO;CACnB,SAAS,EAAE,SAAS,oBAAoB;AAC5C,CAAC;AAID,MAAM,gCAAgC,EAAE,OAAO;CAC3C,aAAa,EAAE,OAAO;CACtB,WAAW,EAAE,SAAS,eAAe;CACrC,WAAW;CACX,UAAU,EAAE,OAAO;AACvB,CAAC;AAID,MAAM,wBAAwB,EAAE,OAAO;CACnC,SAAS;CACT,WAAW;AACf,CAAC;;;;AAOD,IAAa,cAAb,MAAyB;CACrB;CACA;CACA;CAEA,YAAY,YAAwC,UAA6B;EAC7E,KAAKA,gBAAgB,aAAaC,eAAmB,WAAW,SAAS;EACzE,KAAKC,cAAc,aAAaD,eAAmB,WAAW,OAAO;EACrE,KAAK,UAAU,IAAI,eAAe,YAAY,QAAQ;CAC1D;;;;CAKA,MAAM,GAAG,SAAgD;EACrD,MAAM,MAAM,MAAM,KAAKC,YAAY,GAAG,CAAC,GAAG,qBAAqB,OAAO,CAAC;EACvE,OAAO,MAAM,UAAU,GAAG;CAC9B;;;;;;;CAQA,MAAM,YAAY,SAAmD;EACjE,MAAM,KAAKA,YAAY,YAAY,CAAC,GAAG,qBAAqB,OAAO,CAAC;CACxE;;;;;CAMA,MAAM,sBACF,OACA,SACwB;EACxB,MAAM,YAAY,MAAM,kCAAkC,KAAK;EAC/D,IACI,UAAU,YAAY,uBACtB,UAAU,cAAc,YAAY,MAAM,UAAU,oBAAoB,YAAY,GAEpF,MAAM,IAAI,gBACN,mEACJ;EAEJ,OAAO,MACH,uBACA,MAAM,KAAKF,cAAc,sBACrB;GACI,GAAG;GACH,SACI,UAAU,YAAY,UAAA,IAAA;EAG9B,GACA,qBAAqB,OAAO,CAChC,CACJ;CACJ;;;;CAKA,MAAgB,gBACZ,OACA,SACgC;EAChC,MAAM,iBAAiB,MAAM,4BAA4B,KAAK;EAC9D,MAAM,MAAM,MAAM,KAAKA,cAAc,gBACjC,gBACA,qBAAqB,OAAO,CAChC;EACA,OAAO,MAAM,+BAA+B,GAAG;CACnD;AACJ"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/services/auth/cookie-constants.d.ts
|
|
2
|
-
declare const POLYESTER_SESSION_COOKIE_NAME = "
|
|
2
|
+
declare const POLYESTER_SESSION_COOKIE_NAME = "polyester_session_4";
|
|
3
3
|
declare const POLYESTER_AUTH_TOKEN_COOKIE_NAME = "polyester_auth_token";
|
|
4
4
|
//#endregion
|
|
5
5
|
export { POLYESTER_AUTH_TOKEN_COOKIE_NAME, POLYESTER_SESSION_COOKIE_NAME };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cookie-constants.d.ts","names":[],"sources":["../../../src/services/auth/cookie-constants.ts"],"mappings":";
|
|
1
|
+
{"version":3,"file":"cookie-constants.d.ts","names":[],"sources":["../../../src/services/auth/cookie-constants.ts"],"mappings":";cACa;cAEA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region src/services/auth/cookie-constants.ts
|
|
2
|
-
const POLYESTER_SESSION_COOKIE_NAME = "
|
|
2
|
+
const POLYESTER_SESSION_COOKIE_NAME = "polyester_session_4";
|
|
3
3
|
const POLYESTER_LOGIN_COOKIE_MAX_AGE = 604800;
|
|
4
4
|
const POLYESTER_AUTH_TOKEN_COOKIE_NAME = "polyester_auth_token";
|
|
5
5
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cookie-constants.js","names":[],"sources":["../../../src/services/auth/cookie-constants.ts"],"sourcesContent":["//
|
|
1
|
+
{"version":3,"file":"cookie-constants.js","names":[],"sources":["../../../src/services/auth/cookie-constants.ts"],"sourcesContent":["// v4: environment fingerprints no longer include API or WebSocket URLs.\nexport const POLYESTER_SESSION_COOKIE_NAME = \"polyester_session_4\";\nexport const POLYESTER_LOGIN_COOKIE_MAX_AGE = 60 * 60 * 24 * 7; // 7 days\nexport const POLYESTER_AUTH_TOKEN_COOKIE_NAME = \"polyester_auth_token\";\n"],"mappings":";AACA,MAAa,gCAAgC;AAC7C,MAAa,iCAAiC;AAC9C,MAAa,mCAAmC"}
|
|
@@ -75,7 +75,7 @@ declare const BalanceHistoryInputSchema: v.SchemaWithPipe<readonly [v.StrictObje
|
|
|
75
75
|
}>]>;
|
|
76
76
|
type BalanceHistoryInput = v.InferInput<typeof BalanceHistoryInputSchema>;
|
|
77
77
|
declare function createBalanceHistoryResponseSchema(): v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
78
|
-
readonly range: v.SchemaWithPipe<readonly [v.
|
|
78
|
+
readonly range: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "1d" | "7d" | "30d" | "90d" | "180d" | "365d">]>;
|
|
79
79
|
readonly bucket: v.StringSchema<undefined>;
|
|
80
80
|
readonly startTsSec: v.NumberSchema<undefined>;
|
|
81
81
|
readonly endTsSec: v.NumberSchema<undefined>;
|
|
@@ -190,7 +190,7 @@ declare const EquitySeriesSchema: v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
|
190
190
|
equity: string[];
|
|
191
191
|
}>]>;
|
|
192
192
|
declare function createEquityHistoryResponseSchema(scales: SdkScales): v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
193
|
-
readonly range: v.SchemaWithPipe<readonly [v.
|
|
193
|
+
readonly range: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "1d" | "7d" | "30d" | "90d" | "180d" | "365d">]>;
|
|
194
194
|
readonly bucket: v.StringSchema<undefined>;
|
|
195
195
|
readonly startTsSec: v.NumberSchema<undefined>;
|
|
196
196
|
readonly endTsSec: v.NumberSchema<undefined>;
|
|
@@ -302,7 +302,7 @@ declare const PortfolioEquitySeriesSchema: v.SchemaWithPipe<readonly [v.ObjectSc
|
|
|
302
302
|
equity: string[];
|
|
303
303
|
}>]>;
|
|
304
304
|
declare function createPortfolioEquityHistoryResponseSchema(scales: SdkScales): v.SchemaWithPipe<readonly [v.ObjectSchema<{
|
|
305
|
-
readonly range: v.SchemaWithPipe<readonly [v.
|
|
305
|
+
readonly range: v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.TransformAction<number, "unspecified" | "1d" | "7d" | "30d" | "90d" | "180d" | "365d">]>;
|
|
306
306
|
readonly bucket: v.StringSchema<undefined>;
|
|
307
307
|
readonly startTsSec: v.NumberSchema<undefined>;
|
|
308
308
|
readonly endTsSec: v.NumberSchema<undefined>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"balances.schemas.d.ts","names":[],"sources":["../../../src/services/balances/balances.schemas.ts"],"mappings":";;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"balances.schemas.d.ts","names":[],"sources":["../../../src/services/balances/balances.schemas.ts"],"mappings":";;;;;;;;;;;;;iBAkCgB,6BAAyB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+B7B,gBAAgB,EAAE,YAAY,kBAAkB;cAQ/C,oBAAkB,EAAA;KAEnB,eAAe,EAAE,mBAAmB;cASnC,qBAAmB,EAAA;KAEpB,gBAAgB,EAAE,mBAAmB;cAEpC,2BAAyB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;KAwB1B,sBAAsB,EAAE,kBAAkB;iBAQtC,sCAAkC,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA2BtC,yBAAyB,EAAE,YACnC,kBAAkB;cAGT,0BAAwB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;KAwBzB,qBAAqB,EAAE,kBAAkB;cAExC,mCAAiC,EAAA;;;KAIlC,8BAA8B,EAAE,kBAAkB;KAmBlD;EAEF;EACA,aAAa,YAAY;EACzB;;EAGA;EACA;EACA;;cAGG,oBAAkB,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKO,UAAA;EAA8B;;iBA2BpD,kCAAkC,QAAQ,YAAS,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA3B7B,UAAA;IAA8B;;;;;;;;;;;IAA9B,UAAA;IAA8B;;;;;;;;;;;IAA9B,UAAA;IAA8B;;;;KAqDxD,eAAe,EAAE,mBAAmB;KACpC,wBAAwB,EAAE,YAClC,kBAAkB;KAcV;EACJ;EAA0B;EAAmB;;EAC7C;EAA0B;EAAmB;;cAExC,6BAA2B,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;EAQF,UAAA;EAAuC;;iBAY7D,2CAA2C,QAAQ,YAAS,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAZtC,UAAA;IAAuC;;;;;;;;;;;IAAvC,UAAA;IAAuC;;;;;;;;;;;IAAvC,UAAA;IAAuC;;;;KAqCjE,wBAAwB,EAAE,mBAAmB;KAC7C,iCAAiC,EAAE,YAC3C,kBAAkB;iBA6BN,4CAA4C,QAAQ,YAAS,EAAA,yBAAA,EAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAmBjE,kCAAkC,EAAE,YAC5C,kBAAkB"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { PublicIdSchema } from "../../shared/schemas.js";
|
|
1
|
+
import { enumLabel, enumLabelSchema } from "../../shared/proto-enum-codec.js";
|
|
2
|
+
import { PublicIdSchema, U128Schema } from "../../shared/schemas.js";
|
|
4
3
|
import { AccountScopeInputEntries, accountScopeToSubaccountId } from "../../shared/account-scope.js";
|
|
5
4
|
import { scaledToDecimalOutput } from "../../shared/decimal-surface.js";
|
|
6
5
|
import { fromU128 } from "../../utils/u128.js";
|
|
@@ -18,10 +17,6 @@ const EQUITY_SCALE = 4;
|
|
|
18
17
|
* asset units scaled by 1e7"), unlike live ledger balances which use E18.
|
|
19
18
|
*/
|
|
20
19
|
const BALANCE_HISTORY_SCALE = 7;
|
|
21
|
-
const U128Schema = v.object({
|
|
22
|
-
hi: v.bigint(),
|
|
23
|
-
lo: v.bigint()
|
|
24
|
-
});
|
|
25
20
|
/**
|
|
26
21
|
* AssetBalance u128 fields on the ledger wire are always 18-decimal scaled
|
|
27
22
|
* (PolyesterChain base units), independent of per-asset quantityScale used
|
|
@@ -77,7 +72,7 @@ const BalanceSeriesSchema = v.object({
|
|
|
77
72
|
});
|
|
78
73
|
function createBalanceHistoryResponseSchema() {
|
|
79
74
|
return v.pipe(v.object({
|
|
80
|
-
range:
|
|
75
|
+
range: enumLabelSchema(BalanceRangeCodec.protoToOutput),
|
|
81
76
|
bucket: v.string(),
|
|
82
77
|
startTsSec: v.number(),
|
|
83
78
|
endTsSec: v.number(),
|
|
@@ -92,7 +87,7 @@ function createBalanceHistoryResponseSchema() {
|
|
|
92
87
|
series: data.series.map((s) => {
|
|
93
88
|
return {
|
|
94
89
|
assetId: s.assetId,
|
|
95
|
-
accountCode:
|
|
90
|
+
accountCode: enumLabel(AccountCodeCodec.protoToOutput, s.accountCode),
|
|
96
91
|
balance: s.balanceQ.map((b) => scaledToDecimalOutput(b, BALANCE_HISTORY_SCALE))
|
|
97
92
|
};
|
|
98
93
|
})
|
|
@@ -129,7 +124,7 @@ const EquitySeriesSchema = v.pipe(v.object({
|
|
|
129
124
|
if (series.grouping.case === "account") return {
|
|
130
125
|
grouping: {
|
|
131
126
|
type: "account",
|
|
132
|
-
accountCode:
|
|
127
|
+
accountCode: enumLabel(AccountCodeCodec.protoToOutput, series.grouping.value.accountCode),
|
|
133
128
|
name: series.grouping.value.name
|
|
134
129
|
},
|
|
135
130
|
equity
|
|
@@ -145,7 +140,7 @@ const EquitySeriesSchema = v.pipe(v.object({
|
|
|
145
140
|
}));
|
|
146
141
|
function createEquityHistoryResponseSchema(scales) {
|
|
147
142
|
return v.pipe(v.object({
|
|
148
|
-
range:
|
|
143
|
+
range: enumLabelSchema(BalanceRangeCodec.protoToOutput),
|
|
149
144
|
bucket: v.string(),
|
|
150
145
|
startTsSec: v.number(),
|
|
151
146
|
endTsSec: v.number(),
|
|
@@ -190,7 +185,7 @@ const PortfolioEquitySeriesSchema = v.pipe(v.object({
|
|
|
190
185
|
})));
|
|
191
186
|
function createPortfolioEquityHistoryResponseSchema(scales) {
|
|
192
187
|
return v.pipe(v.object({
|
|
193
|
-
range:
|
|
188
|
+
range: enumLabelSchema(BalanceRangeCodec.protoToOutput),
|
|
194
189
|
bucket: v.string(),
|
|
195
190
|
startTsSec: v.number(),
|
|
196
191
|
endTsSec: v.number(),
|