@pear-protocol/types 2.9.0 → 2.11.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/dist/bundle.d.ts +1 -0
- package/dist/bundle.js +1 -0
- package/dist/common/address.d.ts +8 -2
- package/dist/position/responses.d.ts +3 -2
- package/dist/sync/payloads.d.ts +11 -0
- package/dist/sync/payloads.js +6 -2
- package/dist/sync/responses.d.ts +1 -0
- package/dist/sync/responses.js +8 -1
- package/dist/trade-accounts/payloads.d.ts +14 -13
- package/dist/users/entities.d.ts +5 -4
- package/dist/users/response.d.ts +2 -2
- package/dist/vaults/entities.d.ts +111 -0
- package/dist/vaults/entities.js +96 -0
- package/dist/vaults/index.d.ts +4 -0
- package/dist/vaults/index.js +4 -0
- package/dist/vaults/payloads.d.ts +140 -0
- package/dist/vaults/payloads.js +65 -0
- package/dist/vaults/queries.d.ts +96 -0
- package/dist/vaults/queries.js +66 -0
- package/dist/vaults/responses.d.ts +634 -0
- package/dist/vaults/responses.js +375 -0
- package/package.json +1 -1
package/dist/bundle.d.ts
CHANGED
package/dist/bundle.js
CHANGED
package/dist/common/address.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
/**
|
|
3
|
+
* A validated, lowercase Ethereum address. The zod schema below is the only
|
|
4
|
+
* mint point: interior code may assume lowercase and must never re-normalize.
|
|
5
|
+
*/
|
|
6
|
+
export type EthereumAddress = `0x${string}` & {
|
|
7
|
+
readonly __lowercaseAddress: true;
|
|
8
|
+
};
|
|
9
|
+
export declare const EthereumAddress: z.ZodPipe<z.ZodString, z.ZodTransform<EthereumAddress, string>>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { EthereumAddress } from '../common/address';
|
|
2
3
|
export declare const PositionListResponse: z.ZodObject<{
|
|
3
4
|
limit: z.ZodNumber;
|
|
4
5
|
nextCursor: z.ZodOptional<z.ZodString>;
|
|
@@ -305,7 +306,7 @@ export type OpenPositionListResponse = z.output<typeof OpenPositionListResponse>
|
|
|
305
306
|
export declare const VaultOpenPositionListResponse: z.ZodObject<{
|
|
306
307
|
limit: z.ZodNumber;
|
|
307
308
|
nextCursor: z.ZodOptional<z.ZodString>;
|
|
308
|
-
vaultAddress: z.ZodPipe<z.ZodString, z.ZodTransform
|
|
309
|
+
vaultAddress: z.ZodPipe<z.ZodString, z.ZodTransform<EthereumAddress, string>>;
|
|
309
310
|
positions: z.ZodArray<z.ZodObject<{
|
|
310
311
|
status: z.ZodLiteral<"OPEN">;
|
|
311
312
|
connector: z.ZodEnum<{
|
|
@@ -351,7 +352,7 @@ export type VaultOpenPositionListResponse = z.output<typeof VaultOpenPositionLis
|
|
|
351
352
|
export declare const VaultClosedPositionListResponse: z.ZodObject<{
|
|
352
353
|
limit: z.ZodNumber;
|
|
353
354
|
nextCursor: z.ZodOptional<z.ZodString>;
|
|
354
|
-
vaultAddress: z.ZodPipe<z.ZodString, z.ZodTransform
|
|
355
|
+
vaultAddress: z.ZodPipe<z.ZodString, z.ZodTransform<EthereumAddress, string>>;
|
|
355
356
|
positions: z.ZodArray<z.ZodObject<{
|
|
356
357
|
status: z.ZodLiteral<"CLOSED">;
|
|
357
358
|
connector: z.ZodEnum<{
|
package/dist/sync/payloads.d.ts
CHANGED
|
@@ -359,8 +359,18 @@ export declare const CreateApplicablesMeta: z.ZodObject<{
|
|
|
359
359
|
externalMaxTs: z.ZodNullable<z.ZodNumber>;
|
|
360
360
|
firstSyncStartedAt: z.ZodOptional<z.ZodNumber>;
|
|
361
361
|
newestFillTs: z.ZodOptional<z.ZodNumber>;
|
|
362
|
+
executionsUpdatedAtEpochMs: z.ZodNumber;
|
|
362
363
|
}, z.core.$strip>;
|
|
363
364
|
export type CreateApplicablesMeta = z.output<typeof CreateApplicablesMeta>;
|
|
365
|
+
/**
|
|
366
|
+
* Plain multipart fields posted beside the gzipped create payload on the bulk route.
|
|
367
|
+
* Core forwards the gzip unread, so any meta its own admission gates need must travel
|
|
368
|
+
* outside it; multipart fields arrive as strings.
|
|
369
|
+
*/
|
|
370
|
+
export declare const CreateApplicablesBulkFields: z.ZodObject<{
|
|
371
|
+
executionsUpdatedAtEpochMs: z.ZodPipe<z.ZodString, z.ZodTransform<number, string>>;
|
|
372
|
+
}, z.core.$strip>;
|
|
373
|
+
export type CreateApplicablesBulkFields = z.output<typeof CreateApplicablesBulkFields>;
|
|
364
374
|
/**
|
|
365
375
|
* POST /sync/create request — the discover+apply phase of the cycle.
|
|
366
376
|
* - applicables: baskets keyed by positionKey, find-or-created during apply.
|
|
@@ -442,6 +452,7 @@ export declare const CreateApplicablesRequest: z.ZodObject<{
|
|
|
442
452
|
externalMaxTs: z.ZodNullable<z.ZodNumber>;
|
|
443
453
|
firstSyncStartedAt: z.ZodOptional<z.ZodNumber>;
|
|
444
454
|
newestFillTs: z.ZodOptional<z.ZodNumber>;
|
|
455
|
+
executionsUpdatedAtEpochMs: z.ZodNumber;
|
|
445
456
|
}, z.core.$strip>;
|
|
446
457
|
}, z.core.$strip>;
|
|
447
458
|
export type CreateApplicablesRequest = z.output<typeof CreateApplicablesRequest>;
|
package/dist/sync/payloads.js
CHANGED
|
@@ -114,7 +114,11 @@ const SyncMeta = z.object({
|
|
|
114
114
|
});
|
|
115
115
|
const CreateApplicablesMeta = SyncMeta.extend({
|
|
116
116
|
firstSyncStartedAt: z.number().int().nonnegative().optional().describe("backend-issued timestamp returned before the first fill-history fetch"),
|
|
117
|
-
newestFillTs: z.number().int().nonnegative().refine((timestamp) => timestamp <= Date.now() + WATERMARK_FUTURE_SKEW_MS, "newestFillTs must not be ahead of server time").optional().describe("raw newest fetched fill \u2014 settle-gate source, never trim-advanced")
|
|
117
|
+
newestFillTs: z.number().int().nonnegative().refine((timestamp) => timestamp <= Date.now() + WATERMARK_FUTURE_SKEW_MS, "newestFillTs must not be ahead of server time").optional().describe("raw newest fetched fill \u2014 settle-gate source, never trim-advanced"),
|
|
118
|
+
executionsUpdatedAtEpochMs: z.number().int().nonnegative().describe("verbatim echo of fills/since executionsUpdatedAtEpochMs \u2014 stale-read gate token, not a client clock")
|
|
119
|
+
});
|
|
120
|
+
const CreateApplicablesBulkFields = z.object({
|
|
121
|
+
executionsUpdatedAtEpochMs: z.string().regex(/^\d+$/, "Must be a non-negative integer millisecond value").transform(Number).describe("mirror of meta.executionsUpdatedAtEpochMs, readable without decompressing the payload")
|
|
118
122
|
});
|
|
119
123
|
const CreateApplicablesRequest = z.object({
|
|
120
124
|
applicables: z.array(ApplicablePosition),
|
|
@@ -135,4 +139,4 @@ const CreateFundingPaymentsRequest = z.object({
|
|
|
135
139
|
meta: SyncMeta
|
|
136
140
|
});
|
|
137
141
|
|
|
138
|
-
export { ApplicableFill, ApplicableMetadata, ApplicablePosition, ConfirmFillsRequest, ConfirmableExternalFill, CreateApplicablesMeta, CreateApplicablesRequest, CreateFundingPaymentsRequest, ExternalPosition, FundingPaymentEntry, ReconcileFillsRequest, ReconcileReplacementExternalFill, SyncFillsSinceRequest, SyncFundingSinceRequest, SyncMeta, UnknownExternalFill, WATERMARK_FUTURE_SKEW_MS };
|
|
142
|
+
export { ApplicableFill, ApplicableMetadata, ApplicablePosition, ConfirmFillsRequest, ConfirmableExternalFill, CreateApplicablesBulkFields, CreateApplicablesMeta, CreateApplicablesRequest, CreateFundingPaymentsRequest, ExternalPosition, FundingPaymentEntry, ReconcileFillsRequest, ReconcileReplacementExternalFill, SyncFillsSinceRequest, SyncFundingSinceRequest, SyncMeta, UnknownExternalFill, WATERMARK_FUTURE_SKEW_MS };
|
package/dist/sync/responses.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export declare const SyncFillsSinceResponse: z.ZodObject<{
|
|
|
5
5
|
neverSynced: z.ZodBoolean;
|
|
6
6
|
firstSyncStartedAt: z.ZodOptional<z.ZodNumber>;
|
|
7
7
|
confirmedExchangeFillIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
8
|
+
executionsUpdatedAtEpochMs: z.ZodNumber;
|
|
8
9
|
}, z.core.$strip>;
|
|
9
10
|
export declare const SyncFundingSinceResponse: z.ZodObject<{
|
|
10
11
|
sinceMs: z.ZodNumber;
|
package/dist/sync/responses.js
CHANGED
|
@@ -10,7 +10,14 @@ const SyncFillsSinceResponse = z.object({
|
|
|
10
10
|
// Backend-clock boundary returned only for a never-synced account. The syncer carries this
|
|
11
11
|
// through when an empty exchange fetch provides no fill-derived checkpoint.
|
|
12
12
|
firstSyncStartedAt: z.number().int().nonnegative().optional(),
|
|
13
|
-
confirmedExchangeFillIds: z.array(z.string()).optional()
|
|
13
|
+
confirmedExchangeFillIds: z.array(z.string()).optional(),
|
|
14
|
+
// Newest executions.updatedAt this response can have observed, as epoch ms ceiled to the next
|
|
15
|
+
// whole millisecond (the column keeps microseconds); 0 when the account has no executions. The
|
|
16
|
+
// client echoes it verbatim in the create meta — core defers the create when any execution
|
|
17
|
+
// write postdates it. No client clock on the wire: ordering is against our own persisted
|
|
18
|
+
// updated_at values (Postgres now() on insert, the engine's clock on updates — the settle
|
|
19
|
+
// gate covers skew between those writers).
|
|
20
|
+
executionsUpdatedAtEpochMs: z.number().int().nonnegative()
|
|
14
21
|
});
|
|
15
22
|
const SyncFundingSinceResponse = z.object({
|
|
16
23
|
sinceMs: z.number().int().nonnegative()
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { EthereumAddress } from '../common/address';
|
|
2
3
|
/**
|
|
3
4
|
* Hyperliquid connector credentials
|
|
4
5
|
*/
|
|
@@ -9,9 +10,9 @@ declare const CreateHyperliquidCredentials: z.ZodObject<{
|
|
|
9
10
|
* Hyperliquid connector metadata
|
|
10
11
|
*/
|
|
11
12
|
declare const CreateHyperliquidMetadata: z.ZodObject<{
|
|
12
|
-
agentWalletAddress: z.ZodPipe<z.ZodString, z.ZodTransform
|
|
13
|
+
agentWalletAddress: z.ZodPipe<z.ZodString, z.ZodTransform<EthereumAddress, string>>;
|
|
13
14
|
isSubaccount: z.ZodBoolean;
|
|
14
|
-
mainAccountAddress: z.ZodPipe<z.ZodString, z.ZodTransform
|
|
15
|
+
mainAccountAddress: z.ZodPipe<z.ZodString, z.ZodTransform<EthereumAddress, string>>;
|
|
15
16
|
}, z.core.$strip>;
|
|
16
17
|
declare const CreateBinanceCredentials: z.ZodObject<{
|
|
17
18
|
read: z.ZodObject<{
|
|
@@ -49,7 +50,7 @@ declare const CreateLighterCredentials: z.ZodObject<{
|
|
|
49
50
|
* Lighter connector metadata
|
|
50
51
|
*/
|
|
51
52
|
declare const CreateLighterMetadata: z.ZodObject<{
|
|
52
|
-
l1_address: z.ZodPipe<z.ZodString, z.ZodTransform
|
|
53
|
+
l1_address: z.ZodPipe<z.ZodString, z.ZodTransform<EthereumAddress, string>>;
|
|
53
54
|
}, z.core.$strip>;
|
|
54
55
|
/**
|
|
55
56
|
* Payload to create a new trade account
|
|
@@ -57,14 +58,14 @@ declare const CreateLighterMetadata: z.ZodObject<{
|
|
|
57
58
|
export declare const CreateTradeAccount: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
58
59
|
connector: z.ZodLiteral<"hyperliquid">;
|
|
59
60
|
alias: z.ZodString;
|
|
60
|
-
exchangeIdentifier: z.ZodPipe<z.ZodString, z.ZodTransform
|
|
61
|
+
exchangeIdentifier: z.ZodPipe<z.ZodString, z.ZodTransform<EthereumAddress, string>>;
|
|
61
62
|
credentials: z.ZodObject<{
|
|
62
63
|
signer_key: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
63
64
|
}, z.core.$strip>;
|
|
64
65
|
metadata: z.ZodObject<{
|
|
65
|
-
agentWalletAddress: z.ZodPipe<z.ZodString, z.ZodTransform
|
|
66
|
+
agentWalletAddress: z.ZodPipe<z.ZodString, z.ZodTransform<EthereumAddress, string>>;
|
|
66
67
|
isSubaccount: z.ZodBoolean;
|
|
67
|
-
mainAccountAddress: z.ZodPipe<z.ZodString, z.ZodTransform
|
|
68
|
+
mainAccountAddress: z.ZodPipe<z.ZodString, z.ZodTransform<EthereumAddress, string>>;
|
|
68
69
|
}, z.core.$strip>;
|
|
69
70
|
}, z.core.$strip>, z.ZodObject<{
|
|
70
71
|
connector: z.ZodLiteral<"binance">;
|
|
@@ -106,7 +107,7 @@ export declare const CreateTradeAccount: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
106
107
|
api_key_index: z.ZodNumber;
|
|
107
108
|
}, z.core.$strip>;
|
|
108
109
|
metadata: z.ZodObject<{
|
|
109
|
-
l1_address: z.ZodPipe<z.ZodString, z.ZodTransform
|
|
110
|
+
l1_address: z.ZodPipe<z.ZodString, z.ZodTransform<EthereumAddress, string>>;
|
|
110
111
|
}, z.core.$strip>;
|
|
111
112
|
}, z.core.$strip>, z.ZodObject<{
|
|
112
113
|
alias: z.ZodString;
|
|
@@ -116,7 +117,7 @@ export declare const CreateTradeAccount: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
116
117
|
api_key_index: z.ZodNumber;
|
|
117
118
|
}, z.core.$strip>;
|
|
118
119
|
metadata: z.ZodObject<{
|
|
119
|
-
l1_address: z.ZodPipe<z.ZodString, z.ZodTransform
|
|
120
|
+
l1_address: z.ZodPipe<z.ZodString, z.ZodTransform<EthereumAddress, string>>;
|
|
120
121
|
}, z.core.$strip>;
|
|
121
122
|
connector: z.ZodLiteral<"lighter_rhc">;
|
|
122
123
|
}, z.core.$strip>], "connector">;
|
|
@@ -126,7 +127,7 @@ export declare const CreateTradeAccount: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
126
127
|
* the payload carries no credentials.
|
|
127
128
|
*/
|
|
128
129
|
export declare const CreateVaultTradeAccount: z.ZodObject<{
|
|
129
|
-
vaultAddress: z.ZodPipe<z.ZodString, z.ZodTransform
|
|
130
|
+
vaultAddress: z.ZodPipe<z.ZodString, z.ZodTransform<EthereumAddress, string>>;
|
|
130
131
|
alias: z.ZodString;
|
|
131
132
|
idempotencyKey: z.ZodOptional<z.ZodString>;
|
|
132
133
|
}, z.core.$strip>;
|
|
@@ -140,9 +141,9 @@ export declare const UpdateTradeAccount: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
140
141
|
signer_key: z.ZodPipe<z.ZodString, z.ZodTransform<`0x${string}`, string>>;
|
|
141
142
|
}, z.core.$strip>>;
|
|
142
143
|
metadata: z.ZodOptional<z.ZodObject<{
|
|
143
|
-
agentWalletAddress: z.ZodPipe<z.ZodString, z.ZodTransform
|
|
144
|
+
agentWalletAddress: z.ZodPipe<z.ZodString, z.ZodTransform<EthereumAddress, string>>;
|
|
144
145
|
isSubaccount: z.ZodBoolean;
|
|
145
|
-
mainAccountAddress: z.ZodPipe<z.ZodString, z.ZodTransform
|
|
146
|
+
mainAccountAddress: z.ZodPipe<z.ZodString, z.ZodTransform<EthereumAddress, string>>;
|
|
146
147
|
}, z.core.$strip>>;
|
|
147
148
|
}, z.core.$strip>, z.ZodObject<{
|
|
148
149
|
connector: z.ZodLiteral<"binance">;
|
|
@@ -183,7 +184,7 @@ export declare const UpdateTradeAccount: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
183
184
|
api_key_index: z.ZodNumber;
|
|
184
185
|
}, z.core.$strip>>;
|
|
185
186
|
metadata: z.ZodOptional<z.ZodObject<{
|
|
186
|
-
l1_address: z.ZodPipe<z.ZodString, z.ZodTransform
|
|
187
|
+
l1_address: z.ZodPipe<z.ZodString, z.ZodTransform<EthereumAddress, string>>;
|
|
187
188
|
}, z.core.$strip>>;
|
|
188
189
|
}, z.core.$strip>, z.ZodObject<{
|
|
189
190
|
alias: z.ZodOptional<z.ZodString>;
|
|
@@ -192,7 +193,7 @@ export declare const UpdateTradeAccount: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
192
193
|
api_key_index: z.ZodNumber;
|
|
193
194
|
}, z.core.$strip>>;
|
|
194
195
|
metadata: z.ZodOptional<z.ZodObject<{
|
|
195
|
-
l1_address: z.ZodPipe<z.ZodString, z.ZodTransform
|
|
196
|
+
l1_address: z.ZodPipe<z.ZodString, z.ZodTransform<EthereumAddress, string>>;
|
|
196
197
|
}, z.core.$strip>>;
|
|
197
198
|
connector: z.ZodLiteral<"lighter_rhc">;
|
|
198
199
|
}, z.core.$strip>], "connector">;
|
package/dist/users/entities.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
+
import { EthereumAddress } from '../common/address';
|
|
2
3
|
export declare const UserPreferences: z.ZodObject<{
|
|
3
4
|
slippageToleranceBps: z.ZodInt;
|
|
4
5
|
}, z.core.$strip>;
|
|
@@ -22,24 +23,24 @@ export type UserPreferences = z.infer<typeof UserPreferences>;
|
|
|
22
23
|
export type UserProfile = z.infer<typeof UserProfile>;
|
|
23
24
|
export declare const BoundReferralReferee: z.ZodObject<{
|
|
24
25
|
status: z.ZodLiteral<"BOUND">;
|
|
25
|
-
address: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform
|
|
26
|
+
address: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<EthereumAddress, string>>>;
|
|
26
27
|
referredAt: z.ZodOptional<z.ZodNumber>;
|
|
27
28
|
tradeCount: z.ZodNumber;
|
|
28
29
|
volumeUsd: z.ZodString;
|
|
29
30
|
}, z.core.$strip>;
|
|
30
31
|
export declare const PendingReferralReferee: z.ZodObject<{
|
|
31
32
|
status: z.ZodLiteral<"PENDING">;
|
|
32
|
-
address: z.ZodPipe<z.ZodString, z.ZodTransform
|
|
33
|
+
address: z.ZodPipe<z.ZodString, z.ZodTransform<EthereumAddress, string>>;
|
|
33
34
|
}, z.core.$strip>;
|
|
34
35
|
export declare const ReferralReferee: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
35
36
|
status: z.ZodLiteral<"BOUND">;
|
|
36
|
-
address: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform
|
|
37
|
+
address: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<EthereumAddress, string>>>;
|
|
37
38
|
referredAt: z.ZodOptional<z.ZodNumber>;
|
|
38
39
|
tradeCount: z.ZodNumber;
|
|
39
40
|
volumeUsd: z.ZodString;
|
|
40
41
|
}, z.core.$strip>, z.ZodObject<{
|
|
41
42
|
status: z.ZodLiteral<"PENDING">;
|
|
42
|
-
address: z.ZodPipe<z.ZodString, z.ZodTransform
|
|
43
|
+
address: z.ZodPipe<z.ZodString, z.ZodTransform<EthereumAddress, string>>;
|
|
43
44
|
}, z.core.$strip>], "status">;
|
|
44
45
|
export type BoundReferralReferee = z.infer<typeof BoundReferralReferee>;
|
|
45
46
|
export type PendingReferralReferee = z.infer<typeof PendingReferralReferee>;
|
package/dist/users/response.d.ts
CHANGED
|
@@ -44,13 +44,13 @@ export declare const ReferralRefereeListResponse: z.ZodObject<{
|
|
|
44
44
|
totalVolumeUsd: z.ZodString;
|
|
45
45
|
referees: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
46
46
|
status: z.ZodLiteral<"BOUND">;
|
|
47
|
-
address: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform
|
|
47
|
+
address: z.ZodOptional<z.ZodPipe<z.ZodString, z.ZodTransform<import("..").EthereumAddress, string>>>;
|
|
48
48
|
referredAt: z.ZodOptional<z.ZodNumber>;
|
|
49
49
|
tradeCount: z.ZodNumber;
|
|
50
50
|
volumeUsd: z.ZodString;
|
|
51
51
|
}, z.core.$strip>, z.ZodObject<{
|
|
52
52
|
status: z.ZodLiteral<"PENDING">;
|
|
53
|
-
address: z.ZodPipe<z.ZodString, z.ZodTransform
|
|
53
|
+
address: z.ZodPipe<z.ZodString, z.ZodTransform<import("..").EthereumAddress, string>>;
|
|
54
54
|
}, z.core.$strip>], "status">>;
|
|
55
55
|
}, z.core.$strip>;
|
|
56
56
|
export type ReferralRefereeListResponse = z.infer<typeof ReferralRefereeListResponse>;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { EthereumAddress } from '../common/address';
|
|
3
|
+
/** Lifecycle state of a vault. */
|
|
4
|
+
export declare const VaultStatus: z.ZodEnum<{
|
|
5
|
+
active: "active";
|
|
6
|
+
inactive: "inactive";
|
|
7
|
+
pending_activation: "pending_activation";
|
|
8
|
+
}>;
|
|
9
|
+
export type VaultStatus = z.infer<typeof VaultStatus>;
|
|
10
|
+
/** Browser-facing projection of a vault row, matching core's public camelCase API. */
|
|
11
|
+
export declare const Vault: z.ZodObject<{
|
|
12
|
+
id: z.ZodString;
|
|
13
|
+
vaultAddress: z.ZodPipe<z.ZodString, z.ZodTransform<EthereumAddress, string>>;
|
|
14
|
+
ownerAddress: z.ZodPipe<z.ZodString, z.ZodTransform<EthereumAddress, string>>;
|
|
15
|
+
traderAddress: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodTransform<EthereumAddress, string>>>;
|
|
16
|
+
agentAddress: z.ZodPipe<z.ZodString, z.ZodTransform<EthereumAddress, string>>;
|
|
17
|
+
status: z.ZodEnum<{
|
|
18
|
+
active: "active";
|
|
19
|
+
inactive: "inactive";
|
|
20
|
+
pending_activation: "pending_activation";
|
|
21
|
+
}>;
|
|
22
|
+
isApproved: z.ZodBoolean;
|
|
23
|
+
name: z.ZodNullable<z.ZodString>;
|
|
24
|
+
about: z.ZodNullable<z.ZodString>;
|
|
25
|
+
imageUrl: z.ZodNullable<z.ZodString>;
|
|
26
|
+
transactionHash: z.ZodNullable<z.ZodString>;
|
|
27
|
+
maxWithdrawalPeriodDays: z.ZodNumber;
|
|
28
|
+
createdAt: z.ZodString;
|
|
29
|
+
updatedAt: z.ZodString;
|
|
30
|
+
}, z.core.$strip>;
|
|
31
|
+
export type Vault = z.infer<typeof Vault>;
|
|
32
|
+
/** One durable operation row in a vault's activity ledger. */
|
|
33
|
+
export declare const Activity: z.ZodObject<{
|
|
34
|
+
id: z.ZodString;
|
|
35
|
+
vaultAddress: z.ZodOptional<z.ZodString>;
|
|
36
|
+
type: z.ZodEnum<{
|
|
37
|
+
"vault.create": "vault.create";
|
|
38
|
+
"vault.set_trader": "vault.set_trader";
|
|
39
|
+
"vault.update_metadata": "vault.update_metadata";
|
|
40
|
+
"bridge.withdraw_to_evm": "bridge.withdraw_to_evm";
|
|
41
|
+
}>;
|
|
42
|
+
status: z.ZodEnum<{
|
|
43
|
+
failed: "failed";
|
|
44
|
+
pending: "pending";
|
|
45
|
+
succeeded: "succeeded";
|
|
46
|
+
}>;
|
|
47
|
+
txHash: z.ZodOptional<z.ZodString>;
|
|
48
|
+
error: z.ZodOptional<z.ZodString>;
|
|
49
|
+
createdAt: z.ZodISODateTime;
|
|
50
|
+
updatedAt: z.ZodISODateTime;
|
|
51
|
+
}, z.core.$strip>;
|
|
52
|
+
export type Activity = z.infer<typeof Activity>;
|
|
53
|
+
/** Indexed on-chain deposit/withdrawal event for a vault. */
|
|
54
|
+
export declare const VaultEvent: z.ZodObject<{
|
|
55
|
+
id: z.ZodString;
|
|
56
|
+
vaultAddress: z.ZodPipe<z.ZodString, z.ZodTransform<EthereumAddress, string>>;
|
|
57
|
+
eventType: z.ZodEnum<{
|
|
58
|
+
DEPOSIT: "DEPOSIT";
|
|
59
|
+
WITHDRAWAL: "WITHDRAWAL";
|
|
60
|
+
}>;
|
|
61
|
+
userAddress: z.ZodPipe<z.ZodString, z.ZodTransform<EthereumAddress, string>>;
|
|
62
|
+
receiver: z.ZodPipe<z.ZodString, z.ZodTransform<EthereumAddress, string>>;
|
|
63
|
+
assets: z.ZodString;
|
|
64
|
+
shares: z.ZodString;
|
|
65
|
+
fee: z.ZodString;
|
|
66
|
+
withdrawalId: z.ZodNullable<z.ZodString>;
|
|
67
|
+
txHash: z.ZodString;
|
|
68
|
+
blockNumber: z.ZodString;
|
|
69
|
+
logIndex: z.ZodNumber;
|
|
70
|
+
createdAt: z.ZodString;
|
|
71
|
+
}, z.core.$strip>;
|
|
72
|
+
export type VaultEvent = z.infer<typeof VaultEvent>;
|
|
73
|
+
/** Most recent NAV snapshot of a vault. */
|
|
74
|
+
export declare const NavSnapshot: z.ZodObject<{
|
|
75
|
+
vaultAddress: z.ZodPipe<z.ZodString, z.ZodTransform<EthereumAddress, string>>;
|
|
76
|
+
takenAt: z.ZodString;
|
|
77
|
+
totalAssets: z.ZodString;
|
|
78
|
+
totalSupply: z.ZodString;
|
|
79
|
+
sharePrice: z.ZodString;
|
|
80
|
+
blockNumber: z.ZodString;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
export type NavSnapshot = z.infer<typeof NavSnapshot>;
|
|
83
|
+
/** One fixed-resolution NAV point in a range read. */
|
|
84
|
+
export declare const NavBucketPoint: z.ZodObject<{
|
|
85
|
+
bucket: z.ZodISODateTime;
|
|
86
|
+
totalAssets: z.ZodString;
|
|
87
|
+
totalSupply: z.ZodString;
|
|
88
|
+
sharePrice: z.ZodString;
|
|
89
|
+
blockNumber: z.ZodString;
|
|
90
|
+
}, z.core.$strip>;
|
|
91
|
+
export type NavBucketPoint = z.infer<typeof NavBucketPoint>;
|
|
92
|
+
/** Sparse bulk-read NAV point; only the requested fields carry values. */
|
|
93
|
+
export declare const BulkSnapshotPoint: z.ZodObject<{
|
|
94
|
+
timestamp: z.ZodNumber;
|
|
95
|
+
createdAt: z.ZodString;
|
|
96
|
+
tvl: z.ZodOptional<z.ZodString>;
|
|
97
|
+
sharePrice: z.ZodOptional<z.ZodString>;
|
|
98
|
+
accountValue: z.ZodOptional<z.ZodNull>;
|
|
99
|
+
unrealizedPnl: z.ZodOptional<z.ZodNull>;
|
|
100
|
+
cumulativeRealizedPnl: z.ZodOptional<z.ZodNull>;
|
|
101
|
+
leaderSharePct: z.ZodOptional<z.ZodNull>;
|
|
102
|
+
}, z.core.$strip>;
|
|
103
|
+
export type BulkSnapshotPoint = z.infer<typeof BulkSnapshotPoint>;
|
|
104
|
+
/** One sparkline point in the overview projection. */
|
|
105
|
+
export declare const SparklinePoint: z.ZodObject<{
|
|
106
|
+
timestamp: z.ZodNumber;
|
|
107
|
+
createdAt: z.ZodString;
|
|
108
|
+
tvl: z.ZodString;
|
|
109
|
+
sharePrice: z.ZodString;
|
|
110
|
+
}, z.core.$strip>;
|
|
111
|
+
export type SparklinePoint = z.infer<typeof SparklinePoint>;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { EthereumAddress } from '../common/address';
|
|
3
|
+
|
|
4
|
+
const VaultStatus = z.enum([
|
|
5
|
+
"active",
|
|
6
|
+
"inactive",
|
|
7
|
+
"pending_activation"
|
|
8
|
+
]);
|
|
9
|
+
const Vault = z.object({
|
|
10
|
+
id: z.string().uuid(),
|
|
11
|
+
vaultAddress: EthereumAddress,
|
|
12
|
+
ownerAddress: EthereumAddress,
|
|
13
|
+
traderAddress: EthereumAddress.nullable(),
|
|
14
|
+
agentAddress: EthereumAddress,
|
|
15
|
+
status: VaultStatus,
|
|
16
|
+
isApproved: z.boolean(),
|
|
17
|
+
name: z.string().nullable(),
|
|
18
|
+
about: z.string().nullable(),
|
|
19
|
+
imageUrl: z.string().nullable(),
|
|
20
|
+
transactionHash: z.string().nullable(),
|
|
21
|
+
maxWithdrawalPeriodDays: z.number().int(),
|
|
22
|
+
createdAt: z.string().datetime(),
|
|
23
|
+
updatedAt: z.string().datetime()
|
|
24
|
+
});
|
|
25
|
+
const Activity = z.object({
|
|
26
|
+
id: z.string(),
|
|
27
|
+
// Absent columns drop off the wire entirely rather than shipping as present nulls.
|
|
28
|
+
vaultAddress: z.string().optional(),
|
|
29
|
+
// Mirrors the vault_activity_type Postgres enum; duplicated literally because the SDK cannot import the database package.
|
|
30
|
+
type: z.enum([
|
|
31
|
+
"vault.create",
|
|
32
|
+
"vault.set_trader",
|
|
33
|
+
"vault.update_metadata",
|
|
34
|
+
"bridge.withdraw_to_evm"
|
|
35
|
+
]),
|
|
36
|
+
status: z.enum([
|
|
37
|
+
"pending",
|
|
38
|
+
"succeeded",
|
|
39
|
+
"failed"
|
|
40
|
+
]),
|
|
41
|
+
txHash: z.string().optional(),
|
|
42
|
+
error: z.string().optional(),
|
|
43
|
+
createdAt: z.iso.datetime(),
|
|
44
|
+
updatedAt: z.iso.datetime()
|
|
45
|
+
});
|
|
46
|
+
const VaultEvent = z.object({
|
|
47
|
+
id: z.string(),
|
|
48
|
+
vaultAddress: EthereumAddress,
|
|
49
|
+
eventType: z.enum([
|
|
50
|
+
"DEPOSIT",
|
|
51
|
+
"WITHDRAWAL"
|
|
52
|
+
]),
|
|
53
|
+
userAddress: EthereumAddress,
|
|
54
|
+
receiver: EthereumAddress,
|
|
55
|
+
assets: z.string(),
|
|
56
|
+
shares: z.string(),
|
|
57
|
+
fee: z.string(),
|
|
58
|
+
withdrawalId: z.string().nullable(),
|
|
59
|
+
txHash: z.string(),
|
|
60
|
+
blockNumber: z.string(),
|
|
61
|
+
logIndex: z.number().int(),
|
|
62
|
+
createdAt: z.string().datetime()
|
|
63
|
+
});
|
|
64
|
+
const NavSnapshot = z.object({
|
|
65
|
+
vaultAddress: EthereumAddress,
|
|
66
|
+
takenAt: z.string().datetime(),
|
|
67
|
+
totalAssets: z.string(),
|
|
68
|
+
totalSupply: z.string(),
|
|
69
|
+
sharePrice: z.string(),
|
|
70
|
+
blockNumber: z.string()
|
|
71
|
+
});
|
|
72
|
+
const NavBucketPoint = z.object({
|
|
73
|
+
bucket: z.iso.datetime(),
|
|
74
|
+
totalAssets: z.string(),
|
|
75
|
+
totalSupply: z.string(),
|
|
76
|
+
sharePrice: z.string(),
|
|
77
|
+
blockNumber: z.string()
|
|
78
|
+
});
|
|
79
|
+
const BulkSnapshotPoint = z.object({
|
|
80
|
+
timestamp: z.number(),
|
|
81
|
+
createdAt: z.string(),
|
|
82
|
+
tvl: z.string().optional(),
|
|
83
|
+
sharePrice: z.string().optional(),
|
|
84
|
+
accountValue: z.null().optional(),
|
|
85
|
+
unrealizedPnl: z.null().optional(),
|
|
86
|
+
cumulativeRealizedPnl: z.null().optional(),
|
|
87
|
+
leaderSharePct: z.null().optional()
|
|
88
|
+
});
|
|
89
|
+
const SparklinePoint = z.object({
|
|
90
|
+
timestamp: z.number(),
|
|
91
|
+
createdAt: z.string(),
|
|
92
|
+
tvl: z.string(),
|
|
93
|
+
sharePrice: z.string()
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
export { Activity, BulkSnapshotPoint, NavBucketPoint, NavSnapshot, SparklinePoint, Vault, VaultEvent, VaultStatus };
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { EthereumAddress } from '../common/address';
|
|
3
|
+
/** Positive decimal amount string, e.g. an withdrawal or approval size. */
|
|
4
|
+
export declare const PositiveAmount: z.ZodString;
|
|
5
|
+
/**
|
|
6
|
+
* Plane-2 leader-signature envelope carried by every leader-signed POST. LeaderSignatureGuard reads
|
|
7
|
+
* these fields from the raw body to recover the signer; replay defense is Restate idempotency keyed
|
|
8
|
+
* on the signature, and the client-minted nonce keeps two legitimate identical actions apart. The envelope carries
|
|
9
|
+
* auth only; every action-specific parameter is declared on the action's own schema and signed as a
|
|
10
|
+
* readable field of that action's own EIP-712 struct — the primary-type name discriminates the action.
|
|
11
|
+
*/
|
|
12
|
+
export declare const LeaderSignedAction: z.ZodObject<{
|
|
13
|
+
signature: z.ZodString;
|
|
14
|
+
nonce: z.ZodString;
|
|
15
|
+
deadline: z.ZodNumber;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
/**
|
|
18
|
+
* Create is leader self-signed: the body extends the Plane-2 envelope so
|
|
19
|
+
* CreateSignatureGuard can recover the signer. Every create field is a readable
|
|
20
|
+
* field of the signed CreateVault struct.
|
|
21
|
+
*/
|
|
22
|
+
export declare const CreateVault: z.ZodObject<{
|
|
23
|
+
signature: z.ZodString;
|
|
24
|
+
nonce: z.ZodString;
|
|
25
|
+
deadline: z.ZodNumber;
|
|
26
|
+
leader: z.ZodPipe<z.ZodString, z.ZodTransform<EthereumAddress, string>>;
|
|
27
|
+
name: z.ZodString;
|
|
28
|
+
description: z.ZodString;
|
|
29
|
+
imageUri: z.ZodOptional<z.ZodURL>;
|
|
30
|
+
configId: z.ZodNumber;
|
|
31
|
+
maxWithdrawalPeriodDays: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
}, z.core.$strict>;
|
|
33
|
+
export type CreateVaultInput = z.input<typeof CreateVault>;
|
|
34
|
+
export type CreateVault = z.infer<typeof CreateVault>;
|
|
35
|
+
/**
|
|
36
|
+
* Set-trader is leader-signed: the body extends the Plane-2 envelope so
|
|
37
|
+
* LeaderSignatureGuard can recover the signer and enforce the deadline.
|
|
38
|
+
* The `traderAddress` is a readable field of the signed SetTrader struct.
|
|
39
|
+
*/
|
|
40
|
+
export declare const SetTrader: z.ZodObject<{
|
|
41
|
+
signature: z.ZodString;
|
|
42
|
+
nonce: z.ZodString;
|
|
43
|
+
deadline: z.ZodNumber;
|
|
44
|
+
traderAddress: z.ZodPipe<z.ZodString, z.ZodTransform<EthereumAddress, string>>;
|
|
45
|
+
}, z.core.$strict>;
|
|
46
|
+
export type SetTraderInput = z.input<typeof SetTrader>;
|
|
47
|
+
export type SetTrader = z.infer<typeof SetTrader>;
|
|
48
|
+
/**
|
|
49
|
+
* Update-metadata is leader-signed: the body extends the Plane-2 envelope so
|
|
50
|
+
* LeaderSignatureGuard can recover the signer and enforce the deadline. The
|
|
51
|
+
* contract is the full display set — every field is sent and signed as a
|
|
52
|
+
* readable field of the UpdateVaultMetadata struct, because EIP-712 cannot
|
|
53
|
+
* express an omitted field. An empty string clears the optional columns.
|
|
54
|
+
*/
|
|
55
|
+
export declare const UpdateVaultMetadata: z.ZodObject<{
|
|
56
|
+
signature: z.ZodString;
|
|
57
|
+
nonce: z.ZodString;
|
|
58
|
+
deadline: z.ZodNumber;
|
|
59
|
+
name: z.ZodString;
|
|
60
|
+
about: z.ZodString;
|
|
61
|
+
imageUri: z.ZodUnion<readonly [z.ZodURL, z.ZodLiteral<"">]>;
|
|
62
|
+
}, z.core.$strict>;
|
|
63
|
+
export type UpdateVaultMetadataInput = z.input<typeof UpdateVaultMetadata>;
|
|
64
|
+
export type UpdateVaultMetadata = z.infer<typeof UpdateVaultMetadata>;
|
|
65
|
+
export declare const WithdrawToEvm: z.ZodObject<{
|
|
66
|
+
signature: z.ZodString;
|
|
67
|
+
nonce: z.ZodString;
|
|
68
|
+
deadline: z.ZodNumber;
|
|
69
|
+
amount: z.ZodString;
|
|
70
|
+
tokenId: z.ZodOptional<z.ZodString>;
|
|
71
|
+
}, z.core.$strict>;
|
|
72
|
+
export type WithdrawToEvmInput = z.input<typeof WithdrawToEvm>;
|
|
73
|
+
export type WithdrawToEvm = z.infer<typeof WithdrawToEvm>;
|
|
74
|
+
/**
|
|
75
|
+
* Agent-approve is leader-signed: the body carries only the Plane-2 envelope.
|
|
76
|
+
* The execution is fixed — maxUint256 on the vault's own asset — so there are no
|
|
77
|
+
* variable params to sign beyond the envelope; the primary-type name binds the action.
|
|
78
|
+
*/
|
|
79
|
+
export declare const AgentApprove: z.ZodObject<{
|
|
80
|
+
signature: z.ZodString;
|
|
81
|
+
nonce: z.ZodString;
|
|
82
|
+
deadline: z.ZodNumber;
|
|
83
|
+
}, z.core.$strict>;
|
|
84
|
+
export type AgentApproveInput = z.input<typeof AgentApprove>;
|
|
85
|
+
export type AgentApprove = z.infer<typeof AgentApprove>;
|
|
86
|
+
/**
|
|
87
|
+
* Set-unified-account is leader-signed: the body carries only the Plane-2 envelope.
|
|
88
|
+
* The execution is fixed — the vault's own agent — so there are no variable
|
|
89
|
+
* params to sign beyond the envelope; the primary-type name binds the action.
|
|
90
|
+
*/
|
|
91
|
+
export declare const SetUnifiedAccount: z.ZodObject<{
|
|
92
|
+
signature: z.ZodString;
|
|
93
|
+
nonce: z.ZodString;
|
|
94
|
+
deadline: z.ZodNumber;
|
|
95
|
+
}, z.core.$strict>;
|
|
96
|
+
export type SetUnifiedAccountInput = z.input<typeof SetUnifiedAccount>;
|
|
97
|
+
export type SetUnifiedAccount = z.infer<typeof SetUnifiedAccount>;
|
|
98
|
+
/** Builder-fee approval carried by the vault account provisioning workflow. */
|
|
99
|
+
export declare const BuilderFeeApproval: z.ZodObject<{
|
|
100
|
+
builderAddress: z.ZodPipe<z.ZodString, z.ZodTransform<EthereumAddress, string>>;
|
|
101
|
+
maxFeeRate: z.ZodCustom<`${string}%`, `${string}%`>;
|
|
102
|
+
}, z.core.$strip>;
|
|
103
|
+
export type BuilderFeeApproval = z.infer<typeof BuilderFeeApproval>;
|
|
104
|
+
export declare const SnapshotsBulk: z.ZodObject<{
|
|
105
|
+
vaultAddresses: z.ZodArray<z.ZodPipe<z.ZodString, z.ZodTransform<EthereumAddress, string>>>;
|
|
106
|
+
startDate: z.ZodString;
|
|
107
|
+
endDate: z.ZodString;
|
|
108
|
+
bucket: z.ZodEnum<{
|
|
109
|
+
"1d": "1d";
|
|
110
|
+
"1m": "1m";
|
|
111
|
+
"1h": "1h";
|
|
112
|
+
"5m": "5m";
|
|
113
|
+
"15m": "15m";
|
|
114
|
+
}>;
|
|
115
|
+
fields: z.ZodArray<z.ZodEnum<{
|
|
116
|
+
unrealizedPnl: "unrealizedPnl";
|
|
117
|
+
sharePrice: "sharePrice";
|
|
118
|
+
tvl: "tvl";
|
|
119
|
+
accountValue: "accountValue";
|
|
120
|
+
cumulativeRealizedPnl: "cumulativeRealizedPnl";
|
|
121
|
+
leaderSharePct: "leaderSharePct";
|
|
122
|
+
}>>;
|
|
123
|
+
}, z.core.$strict>;
|
|
124
|
+
export type SnapshotsBulkInput = z.input<typeof SnapshotsBulk>;
|
|
125
|
+
export type SnapshotsBulk = z.infer<typeof SnapshotsBulk>;
|
|
126
|
+
/**
|
|
127
|
+
* EIP-712 typed data envelope, in the shape the JSON-RPC `eth_signTypedData_v4`
|
|
128
|
+
* (and Privy's `signTypedData`) expects. Built inside the service from admitted
|
|
129
|
+
* actions; never accepted as a caller-supplied signing envelope.
|
|
130
|
+
*/
|
|
131
|
+
export declare const TypedDataPayload: z.ZodObject<{
|
|
132
|
+
domain: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
133
|
+
types: z.ZodRecord<z.ZodString, z.ZodArray<z.ZodObject<{
|
|
134
|
+
name: z.ZodString;
|
|
135
|
+
type: z.ZodString;
|
|
136
|
+
}, z.core.$strip>>>;
|
|
137
|
+
primaryType: z.ZodString;
|
|
138
|
+
message: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
139
|
+
}, z.core.$strict>;
|
|
140
|
+
export type TypedDataPayload = z.infer<typeof TypedDataPayload>;
|