@pear-protocol/types
Advanced tools
@@ -21,2 +21,5 @@ import { z } from 'zod'; | ||
| }, z.core.$strip>; | ||
| export declare const SetXVisibilityRequest: z.ZodObject<{ | ||
| xHidden: z.ZodBoolean; | ||
| }, z.core.$strip>; | ||
| export declare const StartXLoginRequest: z.ZodObject<{ | ||
@@ -87,2 +90,3 @@ returnTo: z.ZodOptional<z.ZodString>; | ||
| export type StartXLinkRequest = z.infer<typeof StartXLinkRequest>; | ||
| export type SetXVisibilityRequest = z.infer<typeof SetXVisibilityRequest>; | ||
| export type StartXLoginRequest = z.infer<typeof StartXLoginRequest>; | ||
@@ -89,0 +93,0 @@ export type ExchangeXLoginRequest = z.infer<typeof ExchangeXLoginRequest>; |
@@ -27,2 +27,5 @@ import { z } from 'zod'; | ||
| }).describe("Start of the X account link flow"); | ||
| const SetXVisibilityRequest = z.object({ | ||
| xHidden: z.boolean().describe("True to withhold the linked X account from the leaderboard, false to publish it. The wanted state rather than a flip, so a retry lands on the same result and two tabs cannot disagree. Named to match `xHidden` on the user profile - one name for one value.") | ||
| }).describe("Leaderboard visibility of the X account"); | ||
| const PkceValue = z.string().regex(/^[A-Za-z0-9_-]{43}$/, "Must be 43 base64url characters"); | ||
@@ -82,2 +85,2 @@ const StartXLoginRequest = z.object({ | ||
| export { ChangePasswordRequest, EmailLoginRequest, EmailRegisterRequest, ExchangeXLoginRequest, ForgotPasswordRequest, LinkEmailRequest, LinkWalletRequest, LoginRequest, LogoutRequest, OauthInteractionConfirmRequest, RefreshTokenRequest, RequestNonceRequest, ResendVerificationForRegisterRequest, ResetPasswordRequest, StartXLinkRequest, StartXLoginRequest, VerifyEmailRequest, WalletLoginRequest }; | ||
| export { ChangePasswordRequest, EmailLoginRequest, EmailRegisterRequest, ExchangeXLoginRequest, ForgotPasswordRequest, LinkEmailRequest, LinkWalletRequest, LoginRequest, LogoutRequest, OauthInteractionConfirmRequest, RefreshTokenRequest, RequestNonceRequest, ResendVerificationForRegisterRequest, ResetPasswordRequest, SetXVisibilityRequest, StartXLinkRequest, StartXLoginRequest, VerifyEmailRequest, WalletLoginRequest }; |
@@ -57,2 +57,5 @@ import { z } from 'zod'; | ||
| }, z.core.$strip>; | ||
| export declare const SetXVisibilityResponse: z.ZodObject<{ | ||
| xHidden: z.ZodBoolean; | ||
| }, z.core.$strip>; | ||
| export declare const DisconnectXResponse: z.ZodVoid; | ||
@@ -141,2 +144,3 @@ export declare const StartXLoginResponse: z.ZodObject<{ | ||
| export type StartXLinkResponse = z.infer<typeof StartXLinkResponse>; | ||
| export type SetXVisibilityResponse = z.infer<typeof SetXVisibilityResponse>; | ||
| export type DisconnectXResponse = z.infer<typeof DisconnectXResponse>; | ||
@@ -143,0 +147,0 @@ export type StartXLoginResponse = z.infer<typeof StartXLoginResponse>; |
@@ -40,2 +40,5 @@ import { z } from 'zod'; | ||
| }).describe("Start of the X account link flow"); | ||
| const SetXVisibilityResponse = z.object({ | ||
| xHidden: z.boolean().describe("The stored state, read back from the write: true when the leaderboard withholds the X account. A confirmation of what was asked for, not a value the caller could not otherwise know.") | ||
| }).describe("Leaderboard visibility of the X account after the write"); | ||
| const DisconnectXResponse = z.void().describe("Successful X account disconnect response"); | ||
@@ -80,2 +83,2 @@ const StartXLoginResponse = z.object({ | ||
| export { ChangePasswordResponse, DisconnectXResponse, ForgotPasswordResponse, LinkEmailResponse, LinkWalletResponse, LoginResponse, LogoutResponse, MeResponse, OauthGrant, OauthGrantsResponse, OauthInteractionClient, OauthInteractionDetailsResponse, OauthInteractionRedirectResponse, RefreshSessionResponse, RefreshTokenResponse, RegisterEmailResponse, RequestNonceResponse, ResendVerificationResponse, ResetPasswordResponse, StartXLinkResponse, StartXLoginResponse, VerifyEmailResponse }; | ||
| export { ChangePasswordResponse, DisconnectXResponse, ForgotPasswordResponse, LinkEmailResponse, LinkWalletResponse, LoginResponse, LogoutResponse, MeResponse, OauthGrant, OauthGrantsResponse, OauthInteractionClient, OauthInteractionDetailsResponse, OauthInteractionRedirectResponse, RefreshSessionResponse, RefreshTokenResponse, RegisterEmailResponse, RequestNonceResponse, ResendVerificationResponse, ResetPasswordResponse, SetXVisibilityResponse, StartXLinkResponse, StartXLoginResponse, VerifyEmailResponse }; |
| import z from 'zod'; | ||
| export declare const UnsignedDecimalString: z.ZodString; | ||
| /** | ||
| * Decimal string with an OPTIONAL sign ("0.8", "+0.8", "-0.1115"). | ||
| * Sits between UnsignedDecimalString (no sign allowed) and SignedDecimalString | ||
| * (sign required): use it for wire fields that historically shipped unsigned but | ||
| * must now also carry negative values, so existing clients keep parsing. | ||
| */ | ||
| export declare const DecimalString: z.ZodString; | ||
| export declare const SignedDecimalString: z.ZodPipe<z.ZodString, z.ZodTransform<`-${string}` | `+${string}`, string>>; | ||
@@ -4,0 +11,0 @@ export declare const Side: z.ZodEnum<{ |
| import z from 'zod'; | ||
| const UnsignedDecimalString = z.string().regex(/^\d+(\.\d+)?$/, "Must be a valid decimal string"); | ||
| const DecimalString = z.string().regex(/^[+-]?\d+(\.\d+)?$/, "Must be a valid decimal string"); | ||
| const SignedDecimalString = z.string().regex(/^[+-]\d+(\.\d+)?$/, "Must be a valid signed decimal string").transform((val) => val); | ||
@@ -17,2 +18,2 @@ const Side = z.enum([ | ||
| export { AssetWeight, Side, SignedDecimalString, UnsignedDecimalString }; | ||
| export { AssetWeight, DecimalString, Side, SignedDecimalString, UnsignedDecimalString }; |
@@ -34,1 +34,18 @@ import { z } from 'zod'; | ||
| export type CreateAuthTokenParams = z.output<typeof CreateAuthTokenParams>; | ||
| export declare const PrepareLighterFastWithdrawParams: z.ZodObject<{ | ||
| accountIndex: z.ZodNumber; | ||
| toAddress: z.ZodString; | ||
| amount: z.ZodNumber; | ||
| apiKeyIndex: z.ZodNumber; | ||
| apiPrivateKey: z.ZodString; | ||
| }, z.core.$strip>; | ||
| export type PrepareLighterFastWithdrawParams = z.output<typeof PrepareLighterFastWithdrawParams>; | ||
| export declare const SubmitLighterFastWithdrawParams: z.ZodObject<{ | ||
| accountIndex: z.ZodNumber; | ||
| toAddress: z.ZodString; | ||
| apiKeyIndex: z.ZodNumber; | ||
| apiPrivateKey: z.ZodString; | ||
| txInfo: z.ZodString; | ||
| l1Signature: z.ZodString; | ||
| }, z.core.$strip>; | ||
| export type SubmitLighterFastWithdrawParams = z.output<typeof SubmitLighterFastWithdrawParams>; |
@@ -30,3 +30,18 @@ import { z } from 'zod'; | ||
| }); | ||
| const PrepareLighterFastWithdrawParams = z.object({ | ||
| accountIndex: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER), | ||
| toAddress: z.string().regex(/^0x[0-9a-fA-F]{40}$/), | ||
| amount: z.number().int().min(4e6).max(Number.MAX_SAFE_INTEGER), | ||
| apiKeyIndex: z.number().int().nonnegative().max(254), | ||
| apiPrivateKey: z.string() | ||
| }); | ||
| const SubmitLighterFastWithdrawParams = z.object({ | ||
| accountIndex: z.number().int().nonnegative().max(Number.MAX_SAFE_INTEGER), | ||
| toAddress: z.string().regex(/^0x[0-9a-fA-F]{40}$/), | ||
| apiKeyIndex: z.number().int().nonnegative().max(254), | ||
| apiPrivateKey: z.string(), | ||
| txInfo: z.string(), | ||
| l1Signature: z.string() | ||
| }); | ||
| export { CreateAuthTokenParams, CreateLighterApiKeyParams, PrepareApproveIntegratorParams, SubmitApproveIntegratorParams, SubmitChangePubKeyParams }; | ||
| export { CreateAuthTokenParams, CreateLighterApiKeyParams, PrepareApproveIntegratorParams, PrepareLighterFastWithdrawParams, SubmitApproveIntegratorParams, SubmitChangePubKeyParams, SubmitLighterFastWithdrawParams }; |
@@ -27,1 +27,10 @@ import { z } from 'zod'; | ||
| export type CreateAuthTokenResult = z.output<typeof CreateAuthTokenResult>; | ||
| export declare const PrepareLighterFastWithdrawResult: z.ZodObject<{ | ||
| messageToSign: z.ZodString; | ||
| txInfo: z.ZodString; | ||
| }, z.core.$strip>; | ||
| export type PrepareLighterFastWithdrawResult = z.output<typeof PrepareLighterFastWithdrawResult>; | ||
| export declare const SubmitLighterFastWithdrawResult: z.ZodObject<{ | ||
| txHash: z.ZodString; | ||
| }, z.core.$strip>; | ||
| export type SubmitLighterFastWithdrawResult = z.output<typeof SubmitLighterFastWithdrawResult>; |
@@ -23,3 +23,10 @@ import { z } from 'zod'; | ||
| }); | ||
| const PrepareLighterFastWithdrawResult = z.object({ | ||
| messageToSign: z.string(), | ||
| txInfo: z.string() | ||
| }); | ||
| const SubmitLighterFastWithdrawResult = z.object({ | ||
| txHash: z.string() | ||
| }); | ||
| export { CreateApiKeyWithMessageResult, CreateAuthTokenResult, PrepareApproveIntegratorResult, SubmitApproveIntegratorResult, SubmitChangePubKeyResult }; | ||
| export { CreateApiKeyWithMessageResult, CreateAuthTokenResult, PrepareApproveIntegratorResult, PrepareLighterFastWithdrawResult, SubmitApproveIntegratorResult, SubmitChangePubKeyResult, SubmitLighterFastWithdrawResult }; |
@@ -11,5 +11,9 @@ import { z } from 'zod'; | ||
| connector: Connector, | ||
| // Every fill inside the window, whatever period its position began in — so unlike the | ||
| // money fields below, this can report trading whose fees and PnL belong to another window. | ||
| volume: z.string(), | ||
| // Positions the window watched open, as are the fees and the return beside them. | ||
| grossRealizedPnl: z.string(), | ||
| // Zero on a ranged board — unrealized PnL is only meaningful as of now. | ||
| // Zero once the window has closed — unrealized PnL is a value as of now, so only a window | ||
| // that still contains now can report it. A window ending in the future does. | ||
| grossUpnl: z.string(), | ||
@@ -29,9 +33,18 @@ // Net funding carry over the range, signed: negative when the trader paid to hold. | ||
| // | ||
| // Each position is measured against the size it opened with. An open position contributes | ||
| // its unrealized PnL, a closed one what it realized after fees. | ||
| // One formula on every position: (realized + unrealized - fees paid) over the size it | ||
| // opened with. A closed position holds nothing, so its unrealized half is zero and this | ||
| // reduces to what the trader kept; a partly reduced open position counts both the profit | ||
| // it banked and the worth of what it still holds. Only fees of fills that happened are | ||
| // charged, so a running position never pays for the exit it has not made. | ||
| // | ||
| // Measured only where the window holds both the position's open and the moment the | ||
| // measurement is taken at: now for a running position, the closing fill for a finished | ||
| // one. A position that closed after the window ended is therefore left out — the window | ||
| // holds only part of what it realized, and part of a return is not a return. | ||
| // | ||
| // Absent when the board could measure none of the account's positions — never "0", which | ||
| // would claim a break-even trader. An account reaches the board with nothing measurable | ||
| // when its only activity in scope is a fill on a position opened before startDate, or when | ||
| // none of its positions recorded an opening size. | ||
| // when its only trading in the window closed positions opened before it, when a closed | ||
| // window left its open positions unpriced, when every position it opened in the window | ||
| // closed after it, or when a position recorded no opening size. | ||
| roi: z.string().optional(), | ||
@@ -38,0 +51,0 @@ // The trader's linked X account. Absent for an account whose owner has connected no X |
@@ -62,5 +62,13 @@ import { z } from 'zod'; | ||
| sortBy: LeaderboardSortBy.default("totalNetPnl"), | ||
| // Inclusive, and it scopes the money without scoping the trading. Volume and totalTrades | ||
| // count every fill inside the window, whatever period its position began in. Realized | ||
| // PnL, unrealized PnL, the fees behind them and roi count only for a position whose | ||
| // opening fill lands at or after this, so an exit is never booked — nor its fee charged — | ||
| // against an entry the window never saw. Volume is therefore additive across two adjacent | ||
| // windows and PnL is not, and a row can report volume beside no fees at all. | ||
| startDate: UnixSeconds.optional(), | ||
| // Absent endDate means the live board: unrealized PnL is included. Any | ||
| // endDate at all yields a settled, reproducible board with no unrealized. | ||
| // Exclusive. Unrealized PnL is included whenever the window still contains now — an | ||
| // absent endDate, or one that has not yet arrived. Only a window that has already closed | ||
| // is settled and reproducible, and only there is unrealized PnL omitted: it is a value as | ||
| // of now, and now is outside such a window. | ||
| endDate: UnixSeconds.optional(), | ||
@@ -67,0 +75,0 @@ limit: z.coerce.number().int().positive().max(LEADERBOARD_MAX_LIMIT).default(LEADERBOARD_MAX_LIMIT) |
| import { z } from 'zod'; | ||
| import { RefineMinimumOneKeyValuePair } from '../common/refinement'; | ||
| import { UnsignedDecimalString, Side, SignedDecimalString } from '../common/schema'; | ||
| import { UnsignedDecimalString, DecimalString, Side, SignedDecimalString } from '../common/schema'; | ||
| import { Connector } from '../connector'; | ||
@@ -13,2 +13,3 @@ import { InstrumentId } from '../instrument'; | ||
| }).nullable(); | ||
| const TradeFee = DecimalString; | ||
| const OriginalFillRef = z.object({ | ||
@@ -28,3 +29,3 @@ exchangeFillId: ExchangeFillId, | ||
| timestamp: MsTimestamp, | ||
| tradeFee: UnsignedDecimalString, | ||
| tradeFee: TradeFee, | ||
| builderFee: UnsignedDecimalString, | ||
@@ -42,3 +43,3 @@ liquidation: LiquidationMark | ||
| timestamp: MsTimestamp, | ||
| tradeFee: UnsignedDecimalString, | ||
| tradeFee: TradeFee, | ||
| builderFee: UnsignedDecimalString | ||
@@ -56,3 +57,3 @@ }); | ||
| timestamp: MsTimestamp, | ||
| tradeFee: UnsignedDecimalString, | ||
| tradeFee: TradeFee, | ||
| builderFee: UnsignedDecimalString, | ||
@@ -96,3 +97,3 @@ liquidation: LiquidationMark | ||
| isExternal: z.boolean(), | ||
| tradeFee: UnsignedDecimalString, | ||
| tradeFee: TradeFee, | ||
| builderFee: UnsignedDecimalString, | ||
@@ -99,0 +100,0 @@ closedReason: PositionClosedReason.optional().describe("e.g. NETTED for a synthetic close fill"), |
@@ -18,2 +18,3 @@ import { z } from 'zod'; | ||
| xAvatarUrl: z.ZodNullable<z.ZodString>; | ||
| xHidden: z.ZodBoolean; | ||
| }, z.core.$strip>; | ||
@@ -20,0 +21,0 @@ export type UserPreferences = z.infer<typeof UserPreferences>; |
@@ -21,3 +21,7 @@ import { z } from 'zod'; | ||
| xName: z.string().nullable().describe("Linked X display name"), | ||
| xAvatarUrl: z.string().nullable().describe("Linked X avatar URL") | ||
| xAvatarUrl: z.string().nullable().describe("Linked X avatar URL"), | ||
| // A plain boolean rather than nullable, matching `emailVerified` above: this is the | ||
| // owner's own setting, which is known whether or not an X account is linked. With none | ||
| // linked it describes what would happen once one is. | ||
| xHidden: z.boolean().describe("Whether the leaderboard withholds the linked X account") | ||
| }).describe("User profile of the authenticated user"); | ||
@@ -24,0 +28,0 @@ const ReferralReferee = z.object({ |
@@ -16,2 +16,3 @@ import { z } from 'zod'; | ||
| xAvatarUrl: z.ZodNullable<z.ZodString>; | ||
| xHidden: z.ZodBoolean; | ||
| }, z.core.$strip>; | ||
@@ -18,0 +19,0 @@ preferences: z.ZodObject<{ |
+1
-1
| { | ||
| "name": "@pear-protocol/types", | ||
| "version": "1.25.1", | ||
| "version": "1.26.0", | ||
| "description": "Pear Protocol Types definitions", | ||
@@ -5,0 +5,0 @@ "private": false, |
857895
0.69%24595
0.4%