@agg-build/sdk 1.0.0 → 1.2.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/README.md +1 -1
- package/dist/index.d.mts +141 -8
- package/dist/index.d.ts +141 -8
- package/dist/index.js +21 -1
- package/dist/index.mjs +21 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -345,7 +345,7 @@ None. `@agg-build/sdk` is dependency-light and bundles its own clients for `viem
|
|
|
345
345
|
## Links
|
|
346
346
|
|
|
347
347
|
- Documentation — <https://docs.agg.market/>
|
|
348
|
-
- Demo app — <https://
|
|
348
|
+
- Demo app — <https://agg.market/>
|
|
349
349
|
- React hooks — [`@agg-build/hooks`](https://www.npmjs.com/package/@agg-build/hooks)
|
|
350
350
|
- Trading UI — [`@agg-build/ui`](https://www.npmjs.com/package/@agg-build/ui)
|
|
351
351
|
- Connect / sign-in UX — [`@agg-build/auth`](https://www.npmjs.com/package/@agg-build/auth)
|
package/dist/index.d.mts
CHANGED
|
@@ -389,12 +389,14 @@ type WalletTokenBalance = {
|
|
|
389
389
|
lastSyncedAt: string;
|
|
390
390
|
}[];
|
|
391
391
|
};
|
|
392
|
+
type PriceSource = "orderbook" | "cached" | "entry" | "settled";
|
|
392
393
|
type VenuePositionBalance = {
|
|
393
394
|
venue: Venue;
|
|
394
395
|
balance: number;
|
|
395
396
|
costBasis: number;
|
|
396
397
|
unrealizedPnl: number;
|
|
397
398
|
realizedPnl: number;
|
|
399
|
+
priceSource: PriceSource;
|
|
398
400
|
};
|
|
399
401
|
type UnifiedBalanceResponse = {
|
|
400
402
|
cash: {
|
|
@@ -509,6 +511,7 @@ type PositionGroup = {
|
|
|
509
511
|
currentPrice: number;
|
|
510
512
|
totalValue: number;
|
|
511
513
|
unrealizedPnlPercent: number;
|
|
514
|
+
priceSource: PriceSource;
|
|
512
515
|
}[];
|
|
513
516
|
};
|
|
514
517
|
targetMarketId: string;
|
|
@@ -789,12 +792,35 @@ type ValidateManagedRequest = {
|
|
|
789
792
|
side: "buy" | "sell";
|
|
790
793
|
amount: number;
|
|
791
794
|
};
|
|
795
|
+
type WithdrawTokenSymbol$1 = "USDC" | "USDC.e" | "USDT";
|
|
792
796
|
type WithdrawManagedRequest = {
|
|
797
|
+
/** Positive integer string in the token's native decimals (e.g. "100000" = 0.1 USDC). */
|
|
793
798
|
amountRaw: string;
|
|
794
|
-
tokenSymbol:
|
|
799
|
+
tokenSymbol: WithdrawTokenSymbol$1;
|
|
800
|
+
/** EVM 0x-prefixed 20-byte recipient address. */
|
|
795
801
|
destinationAddress: string;
|
|
796
|
-
|
|
802
|
+
/** EVM chain ID where the recipient should receive funds. Required since v2026.04. */
|
|
803
|
+
destinationChainId: number;
|
|
797
804
|
};
|
|
805
|
+
type WithdrawalSourceStatus$1 = "pending" | "submitted" | "confirmed" | "failed";
|
|
806
|
+
type WithdrawalSourceItem = {
|
|
807
|
+
sourceId: string;
|
|
808
|
+
chainId: number;
|
|
809
|
+
tokenSymbol: WithdrawTokenSymbol$1;
|
|
810
|
+
/** On-chain token address on `chainId`. */
|
|
811
|
+
tokenAddress: string;
|
|
812
|
+
/**
|
|
813
|
+
* On-chain decimals for `(chainId, tokenAddress)`. Critical for clients
|
|
814
|
+
* because `amountRaw` is in source-native decimals (BNB USDC is 18-dec,
|
|
815
|
+
* EVM USDC is 6-dec).
|
|
816
|
+
*/
|
|
817
|
+
decimals: number;
|
|
818
|
+
amountRaw: string;
|
|
819
|
+
status: WithdrawalSourceStatus$1;
|
|
820
|
+
txHash: string | null;
|
|
821
|
+
bridgeOperationId: string | null;
|
|
822
|
+
};
|
|
823
|
+
/** @deprecated Use `WithdrawalSourceItem` from the lifecycle response. */
|
|
798
824
|
type WithdrawalSource = {
|
|
799
825
|
amountRaw: string;
|
|
800
826
|
chainId: number;
|
|
@@ -1201,7 +1227,40 @@ interface WsRedeemEvent {
|
|
|
1201
1227
|
/** @unit seconds (converted from server ms) */
|
|
1202
1228
|
timestamp: number;
|
|
1203
1229
|
}
|
|
1204
|
-
|
|
1230
|
+
/** Top-level withdrawal lifecycle states surfaced to partner clients. */
|
|
1231
|
+
type WsWithdrawalLifecycleStatus = "pending" | "bridging" | "transferring" | "completed" | "partial" | "failed";
|
|
1232
|
+
type WsWithdrawalLegStatus = "planned" | "submitted" | "confirmed" | "failed";
|
|
1233
|
+
interface WsWithdrawalLifecycleLeg {
|
|
1234
|
+
sourceChainId: number;
|
|
1235
|
+
destChainId: number;
|
|
1236
|
+
type: "transfer" | "bridge";
|
|
1237
|
+
status: WsWithdrawalLegStatus;
|
|
1238
|
+
amountRaw: string;
|
|
1239
|
+
txHash: string | null;
|
|
1240
|
+
bridgeOperationId: string | null;
|
|
1241
|
+
}
|
|
1242
|
+
/**
|
|
1243
|
+
* Per-withdrawal lifecycle event. Wire shape is intentionally additive:
|
|
1244
|
+
* consumers should pass through unknown enum values rather than failing.
|
|
1245
|
+
*/
|
|
1246
|
+
interface WsWithdrawalLifecycleEvent {
|
|
1247
|
+
type: "withdrawal_lifecycle";
|
|
1248
|
+
withdrawalId: string;
|
|
1249
|
+
userId: string;
|
|
1250
|
+
status: WsWithdrawalLifecycleStatus;
|
|
1251
|
+
/** True when `status` is terminal (`completed` / `partial` / `failed`). */
|
|
1252
|
+
terminal: boolean;
|
|
1253
|
+
/** Optional leg delta — present when this event was triggered by a leg flip. */
|
|
1254
|
+
leg?: WsWithdrawalLifecycleLeg;
|
|
1255
|
+
/** All legs at the moment of emission (snapshot). */
|
|
1256
|
+
legs?: WsWithdrawalLifecycleLeg[];
|
|
1257
|
+
/** Failure reason for terminal `failed` / `partial`. */
|
|
1258
|
+
errorMessage?: string;
|
|
1259
|
+
correlationId?: string;
|
|
1260
|
+
/** @unit milliseconds (raw from server — NOT converted like other WS types) */
|
|
1261
|
+
timestamp: number;
|
|
1262
|
+
}
|
|
1263
|
+
type WsServerMessage = WsOrderbookSnapshot | WsOrderbookDelta | WsTrade | WsSubscribed | WsUnsubscribed | WsConnected | WsAuthenticated | WsHeartbeat | WsMarketResolved | WsError | WsOrderSubmitted | WsBalanceUpdate | WsOrderEvent | WsRedeemEvent | WsWithdrawalLifecycleEvent;
|
|
1205
1264
|
type WsClientMessage = {
|
|
1206
1265
|
action: "subscribe";
|
|
1207
1266
|
channel: "orderbook" | "trades";
|
|
@@ -1320,6 +1379,7 @@ interface AggWebSocketCallbacks {
|
|
|
1320
1379
|
onBalanceUpdate?: (msg: WsBalanceUpdate) => void;
|
|
1321
1380
|
onOrderEvent?: (msg: WsOrderEvent) => void;
|
|
1322
1381
|
onRedeemEvent?: (msg: WsRedeemEvent) => void;
|
|
1382
|
+
onWithdrawalLifecycle?: (msg: WsWithdrawalLifecycleEvent) => void;
|
|
1323
1383
|
onDiagnostics?: DiagnosticCallback;
|
|
1324
1384
|
onConnectionStateChange?: (connected: boolean) => void;
|
|
1325
1385
|
}
|
|
@@ -1877,19 +1937,76 @@ interface ValidateManagedResponse {
|
|
|
1877
1937
|
bridgeSourceChainId?: number;
|
|
1878
1938
|
bridgeAmountRaw?: string;
|
|
1879
1939
|
}
|
|
1940
|
+
type WithdrawTokenSymbol = "USDC" | "USDC.e" | "USDT";
|
|
1880
1941
|
interface WithdrawManagedParams {
|
|
1942
|
+
/** Positive integer string in the token's native decimals (e.g. "100000" = 0.1 USDC). */
|
|
1881
1943
|
amountRaw: string;
|
|
1882
|
-
tokenSymbol:
|
|
1944
|
+
tokenSymbol: WithdrawTokenSymbol;
|
|
1945
|
+
/** EVM 0x-prefixed 20-byte recipient address. */
|
|
1883
1946
|
destinationAddress: string;
|
|
1884
|
-
|
|
1947
|
+
/** EVM chain ID where the recipient should receive funds. Required as of v2026.04. */
|
|
1948
|
+
destinationChainId: number;
|
|
1949
|
+
}
|
|
1950
|
+
type WithdrawalLifecycleStatus = "pending" | "bridging" | "transferring" | "completed" | "partial" | "failed";
|
|
1951
|
+
type WithdrawalSourceStatus = "pending" | "submitted" | "confirmed" | "failed";
|
|
1952
|
+
type WithdrawalLegType = "transfer" | "bridge";
|
|
1953
|
+
type WithdrawalLegStatus = "planned" | "submitted" | "confirmed" | "failed";
|
|
1954
|
+
interface WithdrawalLeg {
|
|
1955
|
+
type: WithdrawalLegType;
|
|
1956
|
+
status: WithdrawalLegStatus;
|
|
1957
|
+
sourceChainId: number;
|
|
1958
|
+
destChainId: number;
|
|
1959
|
+
amountRaw: string;
|
|
1960
|
+
txHash: string | null;
|
|
1961
|
+
bridgeOperationId: string | null;
|
|
1885
1962
|
}
|
|
1886
1963
|
interface WithdrawManagedSourceItem {
|
|
1964
|
+
sourceId: string;
|
|
1887
1965
|
chainId: number;
|
|
1966
|
+
tokenSymbol: WithdrawTokenSymbol;
|
|
1967
|
+
/** On-chain token address on `chainId`. */
|
|
1968
|
+
tokenAddress: string;
|
|
1969
|
+
/**
|
|
1970
|
+
* On-chain decimals for `(chainId, tokenAddress)`. Required to interpret
|
|
1971
|
+
* `amountRaw`: BNB USDC is 18-dec, EVM USDC is 6-dec.
|
|
1972
|
+
*/
|
|
1973
|
+
decimals: number;
|
|
1888
1974
|
amountRaw: string;
|
|
1889
|
-
|
|
1890
|
-
|
|
1975
|
+
status: WithdrawalSourceStatus;
|
|
1976
|
+
txHash: string | null;
|
|
1977
|
+
bridgeOperationId: string | null;
|
|
1978
|
+
}
|
|
1979
|
+
/**
|
|
1980
|
+
* `pricingStatus === "unquoted"` until the multi-stable quote layer ships;
|
|
1981
|
+
* `expected.*` is `null` in that mode. Do NOT treat null fields as missing.
|
|
1982
|
+
*/
|
|
1983
|
+
interface WithdrawalExpected {
|
|
1984
|
+
outputRaw: string | null;
|
|
1985
|
+
feeRaw: string | null;
|
|
1986
|
+
etaSeconds: number | null;
|
|
1891
1987
|
}
|
|
1892
1988
|
interface WithdrawManagedResponse {
|
|
1989
|
+
withdrawalId: string;
|
|
1990
|
+
status: WithdrawalLifecycleStatus;
|
|
1991
|
+
requested: {
|
|
1992
|
+
tokenSymbol: WithdrawTokenSymbol;
|
|
1993
|
+
amountRaw: string;
|
|
1994
|
+
};
|
|
1995
|
+
destination: {
|
|
1996
|
+
chainId: number;
|
|
1997
|
+
address: string;
|
|
1998
|
+
tokenSymbol: WithdrawTokenSymbol;
|
|
1999
|
+
};
|
|
2000
|
+
legs: WithdrawalLeg[];
|
|
2001
|
+
expected: WithdrawalExpected;
|
|
2002
|
+
pricingStatus: "unquoted" | "quoted";
|
|
2003
|
+
/**
|
|
2004
|
+
* Persisted terminal-state error reason. Always `null` until the
|
|
2005
|
+
* withdrawal reaches `failed` / `partial`. The submit response always
|
|
2006
|
+
* returns `null`; populated values arrive via the GET status endpoint or
|
|
2007
|
+
* via a terminal `withdrawal_lifecycle` WS event.
|
|
2008
|
+
*/
|
|
2009
|
+
errorMessage: string | null;
|
|
1893
2010
|
sources: WithdrawManagedSourceItem[];
|
|
1894
2011
|
}
|
|
1895
2012
|
interface DepositAddressesToken {
|
|
@@ -2079,6 +2196,13 @@ interface SmartRouteVenueFill {
|
|
|
2079
2196
|
fills: SmartRouteFill[];
|
|
2080
2197
|
venueQty: number;
|
|
2081
2198
|
}
|
|
2199
|
+
interface SmartRouteFeeBreakdown {
|
|
2200
|
+
rawExecCost: number;
|
|
2201
|
+
venueFees: number;
|
|
2202
|
+
bridgeFees: number;
|
|
2203
|
+
executionGas: number;
|
|
2204
|
+
totalCost: number;
|
|
2205
|
+
}
|
|
2082
2206
|
interface VenueSoloQuote {
|
|
2083
2207
|
/**
|
|
2084
2208
|
* Minted by the API per successful + executable solo; send this to
|
|
@@ -2144,6 +2268,7 @@ interface SmartRouteResponse {
|
|
|
2144
2268
|
venueMarketOutcomeId: string;
|
|
2145
2269
|
reason: string;
|
|
2146
2270
|
}>;
|
|
2271
|
+
feeBreakdown?: SmartRouteFeeBreakdown;
|
|
2147
2272
|
venueSoloQuotes?: VenueSoloQuote[];
|
|
2148
2273
|
/** Estimated payout if the outcome wins (= totalFilled shares × $1). */
|
|
2149
2274
|
estimatedPayout?: number;
|
|
@@ -2448,6 +2573,14 @@ declare class AggClient {
|
|
|
2448
2573
|
redeem(body: RedeemRequest): Promise<RedeemResponse>;
|
|
2449
2574
|
/** Withdraw funds from managed wallets to an external address. */
|
|
2450
2575
|
withdrawManaged(params: WithdrawManagedParams): Promise<WithdrawManagedResponse>;
|
|
2576
|
+
/**
|
|
2577
|
+
* Read the current persisted state of a withdrawal. Used as a backfill for
|
|
2578
|
+
* the WS lifecycle channel: the client polls this on hook mount and on WS
|
|
2579
|
+
* reconnect to recover events that fired before the listener was attached
|
|
2580
|
+
* or while the socket was disconnected. Same response shape as
|
|
2581
|
+
* `withdrawManaged`.
|
|
2582
|
+
*/
|
|
2583
|
+
getWithdrawalStatus(withdrawalId: string): Promise<WithdrawManagedResponse>;
|
|
2451
2584
|
/** Trigger an on-chain balance sync for all tracked tokens across all chains. */
|
|
2452
2585
|
syncManagedBalances(): Promise<SyncBalancesResponse>;
|
|
2453
2586
|
/** Get managed wallet deposit addresses (EVM + Solana). Returns 202 shape while provisioning. */
|
|
@@ -2543,4 +2676,4 @@ declare function aggregateMidpoint(midpoints: (number | null | undefined)[]): nu
|
|
|
2543
2676
|
|
|
2544
2677
|
declare function createAggClient(options: AggClientOptions): AggClient;
|
|
2545
2678
|
|
|
2546
|
-
export { type Account, AccountProvider, AccountType, type AggAuthDeliveryMode, type AggAuthProviderType, type AggAuthStartBody, type AggAuthStartResult, type AggAuthVerifyBody, AggClient, type AggClientAuthOptions, type AggClientSessionInput, type AggLinkAccountBody, type AggLinkAccountConfirmResult, type AggLinkAccountResult, type AggSessionUser, AggWebSocket, type AggWebSocketCallbacks, type AggWebSocketOptions, type AggregatedOrderbookLevel, type AggregatedOrderbookResponse, type App, type AppClientConfigResponse, type AttributedOrderbook, type AttributedOrderbookLevel, type AuthCodeResponse, type AuthStatus, type AuthTokenResponse, type AuthUser, type BatchMidpointsResponse, type BatchOrderbooksResponse, CONFIRMED_MATCH_STATUSES, type CancelManagedExecutionResponse, type Candle, CandleBuilder, type CandleInterval, type Category, Chain, type ChartBarsResponse, type ChartCandle, type ChartResolution, type ChartVenueCandles, type ComputeSplitsRequest, type ComputeSplitsResponse, type ComputeSplitsSelection, type CreateApp, type DepositAddressesPendingResponse, type DepositAddressesReadyResponse, type DepositAddressesResponse, type DepositAddressesSupportedChain, type DepositAddressesToken, type DepositStep, type DiagnosticCallback, type DiagnosticEvent, type ExecuteManagedParams, type ExecuteManagedRequest, type ExecuteManagedResponse, type ExecuteTradeRequest, type ExecuteTradeResponse, type ExecutionOrderItem, type ExecutionOrdersQuery, type ExecutionPositionGroup, type ExecutionPositionsQuery, type GetBalanceQuery, type GetBalanceResponse, type GetHoldingsQuery, type GetHoldingsResponse, type GetOrdersParams, type GetOrdersQuery, type GetPositionsParams, type GetPositionsQuery, type HelloResponse, IMAGE_SIZES, ImageSize, type MarkSource, type MarketPriceHistory, MarketStatus, MatchStatus, MatchType, type MatchedMidpoint, type MatchedOrderbookMarket, type MatchingReport, type MidpointItem, type MidpointRow, type NonceResponse, type OrderListItem, type OrderListQuery, OrderStatus, type Orderbook, type OrderbookBatchItemError, type OrderbookBatchItemErrorCode, type OrderbookBatchItemStatus, type OrderbookHistoryPoint, type OrderbookHistoryResponse, type OrderbookLevel, type OrderbookQuoteFill, type OrderbookQuoteParams, type OrderbookQuoteResponse, type OrderbookServiceUnavailableError, type OrderbookState, type OrderbooksOnlyError, type OutcomeMidpoint, type OutcomeMidpointRow, type OutcomeOrderbookResponse, type PaginatedResponse, type PersistedAuthSnapshot, type PositionGroup, type PositionRedeemStatus, type PricePoint, type PricesHistoryResponse, type QuoteManagedParams, type QuoteManagedRequest, type QuoteManagedResponse, type QuoteManagedSplit, type QuoteManagedStep, type QuoteSplit, type QuoteStep, type RampQuote, type RampQuoteRequest, type RampSessionRequest, type RampWidgetSession, type RedeemLegResult, type RedeemLegStatus, type RedeemRequest, type RedeemResponse, type RequestedOrderbookMarket, type SafeParseFailure, type SafeParseResult, type SafeParseSuccess, type ServerWallet, type SettlementSource, type SetupDepositAddressStep, type SetupVenueKeyStep, type SimpleOrderbookLevel, type SmartRouteFill, type SmartRouteParams, type SmartRouteResponse, type SmartRouteSide, type SmartRouteStatus, type SmartRouteVenueFill, type SplitsByAmountResult, type SyncBalancesResponse, type TradeExecutorOrder, type TradeExecutorOrderListResponse, TradeSide$1 as TradeSide, type TradeSplit, type TradeStep, TurnstileChallengeError, type UnifiedBalanceResponse, type UpdateUserBody, type UpsertVenueKey, type UserActivityBridge, type UserActivityDeposit, type UserActivityItem, type UserActivityQuery, type UserActivityTrade, type UserActivityType, type UserActivityUserOp, type UserActivityWithdrawal, type UserHolding, type UserProfile, VENUES, type ValidateBalanceOnClientStep, type ValidateManagedParams, type ValidateManagedRequest, type ValidateManagedResponse, type ValidateTradeRequest, type ValidateTradeResponse, Venue, type VenueEvent, type VenueEventListItem, type VenueEventWithMarkets, type VenueKeySummary, type VenueMarket, type VenueMarketClusterNode, type VenueMarketListItem, type VenueMarketOutcome, type VenueMarketRef, type VenueOrderbookEntry, type VenueOrderbookLevel, type VenuePositionBalance, type VenuePriceInfo, type VenueSoloQuote, type VerifyBody, type VerifyResponse, type WalletChainBalance, type WalletTokenBalance, type WithdrawManagedParams, type WithdrawManagedRequest, type WithdrawManagedResponse, type WithdrawManagedSourceItem, type WithdrawalSource, type WsAttributedLevel, type WsAuthenticated, type WsBalanceUpdate, type WsCandleInterval, type WsClientMessage, type WsConnected, type WsError, type WsHeartbeat, type WsMarkSource, type WsMarketResolved, type WsOrderEvent, type WsOrderEventType, type WsOrderSubmitted, type WsOrderbookDelta, type WsOrderbookSnapshot, type WsRedeemEvent, type WsServerMessage, type WsSubscribed, type WsTrade, type WsUnsubscribed, type WsVenueBook, type WsVenueInfo, type WsVenueLevel, aggregateMidpoint, applyOrderbookDelta, computeBestSplitsByAmount, computeChecksum, createAggClient, enumGuard, formatMarketQuestion, formatOutcomeLabel, getWalletAddressFromUserProfile, hasShape, isEmail, isEnum, isFiniteNonNeg, isNonEmptyString, mergeCandles, mergeClosedCandles, normalizeVenueMarketCluster, optimizedImageUrl, parse, parseEmail, parseEmailStrict, safeParse, snapshotToOrderbook, sortVenues };
|
|
2679
|
+
export { type Account, AccountProvider, AccountType, type AggAuthDeliveryMode, type AggAuthProviderType, type AggAuthStartBody, type AggAuthStartResult, type AggAuthVerifyBody, AggClient, type AggClientAuthOptions, type AggClientSessionInput, type AggLinkAccountBody, type AggLinkAccountConfirmResult, type AggLinkAccountResult, type AggSessionUser, AggWebSocket, type AggWebSocketCallbacks, type AggWebSocketOptions, type AggregatedOrderbookLevel, type AggregatedOrderbookResponse, type App, type AppClientConfigResponse, type AttributedOrderbook, type AttributedOrderbookLevel, type AuthCodeResponse, type AuthStatus, type AuthTokenResponse, type AuthUser, type BatchMidpointsResponse, type BatchOrderbooksResponse, CONFIRMED_MATCH_STATUSES, type CancelManagedExecutionResponse, type Candle, CandleBuilder, type CandleInterval, type Category, Chain, type ChartBarsResponse, type ChartCandle, type ChartResolution, type ChartVenueCandles, type ComputeSplitsRequest, type ComputeSplitsResponse, type ComputeSplitsSelection, type CreateApp, type DepositAddressesPendingResponse, type DepositAddressesReadyResponse, type DepositAddressesResponse, type DepositAddressesSupportedChain, type DepositAddressesToken, type DepositStep, type DiagnosticCallback, type DiagnosticEvent, type ExecuteManagedParams, type ExecuteManagedRequest, type ExecuteManagedResponse, type ExecuteTradeRequest, type ExecuteTradeResponse, type ExecutionOrderItem, type ExecutionOrdersQuery, type ExecutionPositionGroup, type ExecutionPositionsQuery, type GetBalanceQuery, type GetBalanceResponse, type GetHoldingsQuery, type GetHoldingsResponse, type GetOrdersParams, type GetOrdersQuery, type GetPositionsParams, type GetPositionsQuery, type HelloResponse, IMAGE_SIZES, ImageSize, type MarkSource, type MarketPriceHistory, MarketStatus, MatchStatus, MatchType, type MatchedMidpoint, type MatchedOrderbookMarket, type MatchingReport, type MidpointItem, type MidpointRow, type NonceResponse, type OrderListItem, type OrderListQuery, OrderStatus, type Orderbook, type OrderbookBatchItemError, type OrderbookBatchItemErrorCode, type OrderbookBatchItemStatus, type OrderbookHistoryPoint, type OrderbookHistoryResponse, type OrderbookLevel, type OrderbookQuoteFill, type OrderbookQuoteParams, type OrderbookQuoteResponse, type OrderbookServiceUnavailableError, type OrderbookState, type OrderbooksOnlyError, type OutcomeMidpoint, type OutcomeMidpointRow, type OutcomeOrderbookResponse, type PaginatedResponse, type PersistedAuthSnapshot, type PositionGroup, type PositionRedeemStatus, type PricePoint, type PriceSource, type PricesHistoryResponse, type QuoteManagedParams, type QuoteManagedRequest, type QuoteManagedResponse, type QuoteManagedSplit, type QuoteManagedStep, type QuoteSplit, type QuoteStep, type RampQuote, type RampQuoteRequest, type RampSessionRequest, type RampWidgetSession, type RedeemLegResult, type RedeemLegStatus, type RedeemRequest, type RedeemResponse, type RequestedOrderbookMarket, type SafeParseFailure, type SafeParseResult, type SafeParseSuccess, type ServerWallet, type SettlementSource, type SetupDepositAddressStep, type SetupVenueKeyStep, type SimpleOrderbookLevel, type SmartRouteFill, type SmartRouteParams, type SmartRouteResponse, type SmartRouteSide, type SmartRouteStatus, type SmartRouteVenueFill, type SplitsByAmountResult, type SyncBalancesResponse, type TradeExecutorOrder, type TradeExecutorOrderListResponse, TradeSide$1 as TradeSide, type TradeSplit, type TradeStep, TurnstileChallengeError, type UnifiedBalanceResponse, type UpdateUserBody, type UpsertVenueKey, type UserActivityBridge, type UserActivityDeposit, type UserActivityItem, type UserActivityQuery, type UserActivityTrade, type UserActivityType, type UserActivityUserOp, type UserActivityWithdrawal, type UserHolding, type UserProfile, VENUES, type ValidateBalanceOnClientStep, type ValidateManagedParams, type ValidateManagedRequest, type ValidateManagedResponse, type ValidateTradeRequest, type ValidateTradeResponse, Venue, type VenueEvent, type VenueEventListItem, type VenueEventWithMarkets, type VenueKeySummary, type VenueMarket, type VenueMarketClusterNode, type VenueMarketListItem, type VenueMarketOutcome, type VenueMarketRef, type VenueOrderbookEntry, type VenueOrderbookLevel, type VenuePositionBalance, type VenuePriceInfo, type VenueSoloQuote, type VerifyBody, type VerifyResponse, type WalletChainBalance, type WalletTokenBalance, type WithdrawManagedParams, type WithdrawManagedRequest, type WithdrawManagedResponse, type WithdrawManagedSourceItem, type WithdrawTokenSymbol, type WithdrawalExpected, type WithdrawalLeg, type WithdrawalLegStatus, type WithdrawalLegType, type WithdrawalLifecycleStatus, type WithdrawalSource, type WithdrawalSourceItem, type WithdrawalSourceStatus, type WsAttributedLevel, type WsAuthenticated, type WsBalanceUpdate, type WsCandleInterval, type WsClientMessage, type WsConnected, type WsError, type WsHeartbeat, type WsMarkSource, type WsMarketResolved, type WsOrderEvent, type WsOrderEventType, type WsOrderSubmitted, type WsOrderbookDelta, type WsOrderbookSnapshot, type WsRedeemEvent, type WsServerMessage, type WsSubscribed, type WsTrade, type WsUnsubscribed, type WsVenueBook, type WsVenueInfo, type WsVenueLevel, type WsWithdrawalLegStatus, type WsWithdrawalLifecycleEvent, type WsWithdrawalLifecycleLeg, type WsWithdrawalLifecycleStatus, aggregateMidpoint, applyOrderbookDelta, computeBestSplitsByAmount, computeChecksum, createAggClient, enumGuard, formatMarketQuestion, formatOutcomeLabel, getWalletAddressFromUserProfile, hasShape, isEmail, isEnum, isFiniteNonNeg, isNonEmptyString, mergeCandles, mergeClosedCandles, normalizeVenueMarketCluster, optimizedImageUrl, parse, parseEmail, parseEmailStrict, safeParse, snapshotToOrderbook, sortVenues };
|
package/dist/index.d.ts
CHANGED
|
@@ -389,12 +389,14 @@ type WalletTokenBalance = {
|
|
|
389
389
|
lastSyncedAt: string;
|
|
390
390
|
}[];
|
|
391
391
|
};
|
|
392
|
+
type PriceSource = "orderbook" | "cached" | "entry" | "settled";
|
|
392
393
|
type VenuePositionBalance = {
|
|
393
394
|
venue: Venue;
|
|
394
395
|
balance: number;
|
|
395
396
|
costBasis: number;
|
|
396
397
|
unrealizedPnl: number;
|
|
397
398
|
realizedPnl: number;
|
|
399
|
+
priceSource: PriceSource;
|
|
398
400
|
};
|
|
399
401
|
type UnifiedBalanceResponse = {
|
|
400
402
|
cash: {
|
|
@@ -509,6 +511,7 @@ type PositionGroup = {
|
|
|
509
511
|
currentPrice: number;
|
|
510
512
|
totalValue: number;
|
|
511
513
|
unrealizedPnlPercent: number;
|
|
514
|
+
priceSource: PriceSource;
|
|
512
515
|
}[];
|
|
513
516
|
};
|
|
514
517
|
targetMarketId: string;
|
|
@@ -789,12 +792,35 @@ type ValidateManagedRequest = {
|
|
|
789
792
|
side: "buy" | "sell";
|
|
790
793
|
amount: number;
|
|
791
794
|
};
|
|
795
|
+
type WithdrawTokenSymbol$1 = "USDC" | "USDC.e" | "USDT";
|
|
792
796
|
type WithdrawManagedRequest = {
|
|
797
|
+
/** Positive integer string in the token's native decimals (e.g. "100000" = 0.1 USDC). */
|
|
793
798
|
amountRaw: string;
|
|
794
|
-
tokenSymbol:
|
|
799
|
+
tokenSymbol: WithdrawTokenSymbol$1;
|
|
800
|
+
/** EVM 0x-prefixed 20-byte recipient address. */
|
|
795
801
|
destinationAddress: string;
|
|
796
|
-
|
|
802
|
+
/** EVM chain ID where the recipient should receive funds. Required since v2026.04. */
|
|
803
|
+
destinationChainId: number;
|
|
797
804
|
};
|
|
805
|
+
type WithdrawalSourceStatus$1 = "pending" | "submitted" | "confirmed" | "failed";
|
|
806
|
+
type WithdrawalSourceItem = {
|
|
807
|
+
sourceId: string;
|
|
808
|
+
chainId: number;
|
|
809
|
+
tokenSymbol: WithdrawTokenSymbol$1;
|
|
810
|
+
/** On-chain token address on `chainId`. */
|
|
811
|
+
tokenAddress: string;
|
|
812
|
+
/**
|
|
813
|
+
* On-chain decimals for `(chainId, tokenAddress)`. Critical for clients
|
|
814
|
+
* because `amountRaw` is in source-native decimals (BNB USDC is 18-dec,
|
|
815
|
+
* EVM USDC is 6-dec).
|
|
816
|
+
*/
|
|
817
|
+
decimals: number;
|
|
818
|
+
amountRaw: string;
|
|
819
|
+
status: WithdrawalSourceStatus$1;
|
|
820
|
+
txHash: string | null;
|
|
821
|
+
bridgeOperationId: string | null;
|
|
822
|
+
};
|
|
823
|
+
/** @deprecated Use `WithdrawalSourceItem` from the lifecycle response. */
|
|
798
824
|
type WithdrawalSource = {
|
|
799
825
|
amountRaw: string;
|
|
800
826
|
chainId: number;
|
|
@@ -1201,7 +1227,40 @@ interface WsRedeemEvent {
|
|
|
1201
1227
|
/** @unit seconds (converted from server ms) */
|
|
1202
1228
|
timestamp: number;
|
|
1203
1229
|
}
|
|
1204
|
-
|
|
1230
|
+
/** Top-level withdrawal lifecycle states surfaced to partner clients. */
|
|
1231
|
+
type WsWithdrawalLifecycleStatus = "pending" | "bridging" | "transferring" | "completed" | "partial" | "failed";
|
|
1232
|
+
type WsWithdrawalLegStatus = "planned" | "submitted" | "confirmed" | "failed";
|
|
1233
|
+
interface WsWithdrawalLifecycleLeg {
|
|
1234
|
+
sourceChainId: number;
|
|
1235
|
+
destChainId: number;
|
|
1236
|
+
type: "transfer" | "bridge";
|
|
1237
|
+
status: WsWithdrawalLegStatus;
|
|
1238
|
+
amountRaw: string;
|
|
1239
|
+
txHash: string | null;
|
|
1240
|
+
bridgeOperationId: string | null;
|
|
1241
|
+
}
|
|
1242
|
+
/**
|
|
1243
|
+
* Per-withdrawal lifecycle event. Wire shape is intentionally additive:
|
|
1244
|
+
* consumers should pass through unknown enum values rather than failing.
|
|
1245
|
+
*/
|
|
1246
|
+
interface WsWithdrawalLifecycleEvent {
|
|
1247
|
+
type: "withdrawal_lifecycle";
|
|
1248
|
+
withdrawalId: string;
|
|
1249
|
+
userId: string;
|
|
1250
|
+
status: WsWithdrawalLifecycleStatus;
|
|
1251
|
+
/** True when `status` is terminal (`completed` / `partial` / `failed`). */
|
|
1252
|
+
terminal: boolean;
|
|
1253
|
+
/** Optional leg delta — present when this event was triggered by a leg flip. */
|
|
1254
|
+
leg?: WsWithdrawalLifecycleLeg;
|
|
1255
|
+
/** All legs at the moment of emission (snapshot). */
|
|
1256
|
+
legs?: WsWithdrawalLifecycleLeg[];
|
|
1257
|
+
/** Failure reason for terminal `failed` / `partial`. */
|
|
1258
|
+
errorMessage?: string;
|
|
1259
|
+
correlationId?: string;
|
|
1260
|
+
/** @unit milliseconds (raw from server — NOT converted like other WS types) */
|
|
1261
|
+
timestamp: number;
|
|
1262
|
+
}
|
|
1263
|
+
type WsServerMessage = WsOrderbookSnapshot | WsOrderbookDelta | WsTrade | WsSubscribed | WsUnsubscribed | WsConnected | WsAuthenticated | WsHeartbeat | WsMarketResolved | WsError | WsOrderSubmitted | WsBalanceUpdate | WsOrderEvent | WsRedeemEvent | WsWithdrawalLifecycleEvent;
|
|
1205
1264
|
type WsClientMessage = {
|
|
1206
1265
|
action: "subscribe";
|
|
1207
1266
|
channel: "orderbook" | "trades";
|
|
@@ -1320,6 +1379,7 @@ interface AggWebSocketCallbacks {
|
|
|
1320
1379
|
onBalanceUpdate?: (msg: WsBalanceUpdate) => void;
|
|
1321
1380
|
onOrderEvent?: (msg: WsOrderEvent) => void;
|
|
1322
1381
|
onRedeemEvent?: (msg: WsRedeemEvent) => void;
|
|
1382
|
+
onWithdrawalLifecycle?: (msg: WsWithdrawalLifecycleEvent) => void;
|
|
1323
1383
|
onDiagnostics?: DiagnosticCallback;
|
|
1324
1384
|
onConnectionStateChange?: (connected: boolean) => void;
|
|
1325
1385
|
}
|
|
@@ -1877,19 +1937,76 @@ interface ValidateManagedResponse {
|
|
|
1877
1937
|
bridgeSourceChainId?: number;
|
|
1878
1938
|
bridgeAmountRaw?: string;
|
|
1879
1939
|
}
|
|
1940
|
+
type WithdrawTokenSymbol = "USDC" | "USDC.e" | "USDT";
|
|
1880
1941
|
interface WithdrawManagedParams {
|
|
1942
|
+
/** Positive integer string in the token's native decimals (e.g. "100000" = 0.1 USDC). */
|
|
1881
1943
|
amountRaw: string;
|
|
1882
|
-
tokenSymbol:
|
|
1944
|
+
tokenSymbol: WithdrawTokenSymbol;
|
|
1945
|
+
/** EVM 0x-prefixed 20-byte recipient address. */
|
|
1883
1946
|
destinationAddress: string;
|
|
1884
|
-
|
|
1947
|
+
/** EVM chain ID where the recipient should receive funds. Required as of v2026.04. */
|
|
1948
|
+
destinationChainId: number;
|
|
1949
|
+
}
|
|
1950
|
+
type WithdrawalLifecycleStatus = "pending" | "bridging" | "transferring" | "completed" | "partial" | "failed";
|
|
1951
|
+
type WithdrawalSourceStatus = "pending" | "submitted" | "confirmed" | "failed";
|
|
1952
|
+
type WithdrawalLegType = "transfer" | "bridge";
|
|
1953
|
+
type WithdrawalLegStatus = "planned" | "submitted" | "confirmed" | "failed";
|
|
1954
|
+
interface WithdrawalLeg {
|
|
1955
|
+
type: WithdrawalLegType;
|
|
1956
|
+
status: WithdrawalLegStatus;
|
|
1957
|
+
sourceChainId: number;
|
|
1958
|
+
destChainId: number;
|
|
1959
|
+
amountRaw: string;
|
|
1960
|
+
txHash: string | null;
|
|
1961
|
+
bridgeOperationId: string | null;
|
|
1885
1962
|
}
|
|
1886
1963
|
interface WithdrawManagedSourceItem {
|
|
1964
|
+
sourceId: string;
|
|
1887
1965
|
chainId: number;
|
|
1966
|
+
tokenSymbol: WithdrawTokenSymbol;
|
|
1967
|
+
/** On-chain token address on `chainId`. */
|
|
1968
|
+
tokenAddress: string;
|
|
1969
|
+
/**
|
|
1970
|
+
* On-chain decimals for `(chainId, tokenAddress)`. Required to interpret
|
|
1971
|
+
* `amountRaw`: BNB USDC is 18-dec, EVM USDC is 6-dec.
|
|
1972
|
+
*/
|
|
1973
|
+
decimals: number;
|
|
1888
1974
|
amountRaw: string;
|
|
1889
|
-
|
|
1890
|
-
|
|
1975
|
+
status: WithdrawalSourceStatus;
|
|
1976
|
+
txHash: string | null;
|
|
1977
|
+
bridgeOperationId: string | null;
|
|
1978
|
+
}
|
|
1979
|
+
/**
|
|
1980
|
+
* `pricingStatus === "unquoted"` until the multi-stable quote layer ships;
|
|
1981
|
+
* `expected.*` is `null` in that mode. Do NOT treat null fields as missing.
|
|
1982
|
+
*/
|
|
1983
|
+
interface WithdrawalExpected {
|
|
1984
|
+
outputRaw: string | null;
|
|
1985
|
+
feeRaw: string | null;
|
|
1986
|
+
etaSeconds: number | null;
|
|
1891
1987
|
}
|
|
1892
1988
|
interface WithdrawManagedResponse {
|
|
1989
|
+
withdrawalId: string;
|
|
1990
|
+
status: WithdrawalLifecycleStatus;
|
|
1991
|
+
requested: {
|
|
1992
|
+
tokenSymbol: WithdrawTokenSymbol;
|
|
1993
|
+
amountRaw: string;
|
|
1994
|
+
};
|
|
1995
|
+
destination: {
|
|
1996
|
+
chainId: number;
|
|
1997
|
+
address: string;
|
|
1998
|
+
tokenSymbol: WithdrawTokenSymbol;
|
|
1999
|
+
};
|
|
2000
|
+
legs: WithdrawalLeg[];
|
|
2001
|
+
expected: WithdrawalExpected;
|
|
2002
|
+
pricingStatus: "unquoted" | "quoted";
|
|
2003
|
+
/**
|
|
2004
|
+
* Persisted terminal-state error reason. Always `null` until the
|
|
2005
|
+
* withdrawal reaches `failed` / `partial`. The submit response always
|
|
2006
|
+
* returns `null`; populated values arrive via the GET status endpoint or
|
|
2007
|
+
* via a terminal `withdrawal_lifecycle` WS event.
|
|
2008
|
+
*/
|
|
2009
|
+
errorMessage: string | null;
|
|
1893
2010
|
sources: WithdrawManagedSourceItem[];
|
|
1894
2011
|
}
|
|
1895
2012
|
interface DepositAddressesToken {
|
|
@@ -2079,6 +2196,13 @@ interface SmartRouteVenueFill {
|
|
|
2079
2196
|
fills: SmartRouteFill[];
|
|
2080
2197
|
venueQty: number;
|
|
2081
2198
|
}
|
|
2199
|
+
interface SmartRouteFeeBreakdown {
|
|
2200
|
+
rawExecCost: number;
|
|
2201
|
+
venueFees: number;
|
|
2202
|
+
bridgeFees: number;
|
|
2203
|
+
executionGas: number;
|
|
2204
|
+
totalCost: number;
|
|
2205
|
+
}
|
|
2082
2206
|
interface VenueSoloQuote {
|
|
2083
2207
|
/**
|
|
2084
2208
|
* Minted by the API per successful + executable solo; send this to
|
|
@@ -2144,6 +2268,7 @@ interface SmartRouteResponse {
|
|
|
2144
2268
|
venueMarketOutcomeId: string;
|
|
2145
2269
|
reason: string;
|
|
2146
2270
|
}>;
|
|
2271
|
+
feeBreakdown?: SmartRouteFeeBreakdown;
|
|
2147
2272
|
venueSoloQuotes?: VenueSoloQuote[];
|
|
2148
2273
|
/** Estimated payout if the outcome wins (= totalFilled shares × $1). */
|
|
2149
2274
|
estimatedPayout?: number;
|
|
@@ -2448,6 +2573,14 @@ declare class AggClient {
|
|
|
2448
2573
|
redeem(body: RedeemRequest): Promise<RedeemResponse>;
|
|
2449
2574
|
/** Withdraw funds from managed wallets to an external address. */
|
|
2450
2575
|
withdrawManaged(params: WithdrawManagedParams): Promise<WithdrawManagedResponse>;
|
|
2576
|
+
/**
|
|
2577
|
+
* Read the current persisted state of a withdrawal. Used as a backfill for
|
|
2578
|
+
* the WS lifecycle channel: the client polls this on hook mount and on WS
|
|
2579
|
+
* reconnect to recover events that fired before the listener was attached
|
|
2580
|
+
* or while the socket was disconnected. Same response shape as
|
|
2581
|
+
* `withdrawManaged`.
|
|
2582
|
+
*/
|
|
2583
|
+
getWithdrawalStatus(withdrawalId: string): Promise<WithdrawManagedResponse>;
|
|
2451
2584
|
/** Trigger an on-chain balance sync for all tracked tokens across all chains. */
|
|
2452
2585
|
syncManagedBalances(): Promise<SyncBalancesResponse>;
|
|
2453
2586
|
/** Get managed wallet deposit addresses (EVM + Solana). Returns 202 shape while provisioning. */
|
|
@@ -2543,4 +2676,4 @@ declare function aggregateMidpoint(midpoints: (number | null | undefined)[]): nu
|
|
|
2543
2676
|
|
|
2544
2677
|
declare function createAggClient(options: AggClientOptions): AggClient;
|
|
2545
2678
|
|
|
2546
|
-
export { type Account, AccountProvider, AccountType, type AggAuthDeliveryMode, type AggAuthProviderType, type AggAuthStartBody, type AggAuthStartResult, type AggAuthVerifyBody, AggClient, type AggClientAuthOptions, type AggClientSessionInput, type AggLinkAccountBody, type AggLinkAccountConfirmResult, type AggLinkAccountResult, type AggSessionUser, AggWebSocket, type AggWebSocketCallbacks, type AggWebSocketOptions, type AggregatedOrderbookLevel, type AggregatedOrderbookResponse, type App, type AppClientConfigResponse, type AttributedOrderbook, type AttributedOrderbookLevel, type AuthCodeResponse, type AuthStatus, type AuthTokenResponse, type AuthUser, type BatchMidpointsResponse, type BatchOrderbooksResponse, CONFIRMED_MATCH_STATUSES, type CancelManagedExecutionResponse, type Candle, CandleBuilder, type CandleInterval, type Category, Chain, type ChartBarsResponse, type ChartCandle, type ChartResolution, type ChartVenueCandles, type ComputeSplitsRequest, type ComputeSplitsResponse, type ComputeSplitsSelection, type CreateApp, type DepositAddressesPendingResponse, type DepositAddressesReadyResponse, type DepositAddressesResponse, type DepositAddressesSupportedChain, type DepositAddressesToken, type DepositStep, type DiagnosticCallback, type DiagnosticEvent, type ExecuteManagedParams, type ExecuteManagedRequest, type ExecuteManagedResponse, type ExecuteTradeRequest, type ExecuteTradeResponse, type ExecutionOrderItem, type ExecutionOrdersQuery, type ExecutionPositionGroup, type ExecutionPositionsQuery, type GetBalanceQuery, type GetBalanceResponse, type GetHoldingsQuery, type GetHoldingsResponse, type GetOrdersParams, type GetOrdersQuery, type GetPositionsParams, type GetPositionsQuery, type HelloResponse, IMAGE_SIZES, ImageSize, type MarkSource, type MarketPriceHistory, MarketStatus, MatchStatus, MatchType, type MatchedMidpoint, type MatchedOrderbookMarket, type MatchingReport, type MidpointItem, type MidpointRow, type NonceResponse, type OrderListItem, type OrderListQuery, OrderStatus, type Orderbook, type OrderbookBatchItemError, type OrderbookBatchItemErrorCode, type OrderbookBatchItemStatus, type OrderbookHistoryPoint, type OrderbookHistoryResponse, type OrderbookLevel, type OrderbookQuoteFill, type OrderbookQuoteParams, type OrderbookQuoteResponse, type OrderbookServiceUnavailableError, type OrderbookState, type OrderbooksOnlyError, type OutcomeMidpoint, type OutcomeMidpointRow, type OutcomeOrderbookResponse, type PaginatedResponse, type PersistedAuthSnapshot, type PositionGroup, type PositionRedeemStatus, type PricePoint, type PricesHistoryResponse, type QuoteManagedParams, type QuoteManagedRequest, type QuoteManagedResponse, type QuoteManagedSplit, type QuoteManagedStep, type QuoteSplit, type QuoteStep, type RampQuote, type RampQuoteRequest, type RampSessionRequest, type RampWidgetSession, type RedeemLegResult, type RedeemLegStatus, type RedeemRequest, type RedeemResponse, type RequestedOrderbookMarket, type SafeParseFailure, type SafeParseResult, type SafeParseSuccess, type ServerWallet, type SettlementSource, type SetupDepositAddressStep, type SetupVenueKeyStep, type SimpleOrderbookLevel, type SmartRouteFill, type SmartRouteParams, type SmartRouteResponse, type SmartRouteSide, type SmartRouteStatus, type SmartRouteVenueFill, type SplitsByAmountResult, type SyncBalancesResponse, type TradeExecutorOrder, type TradeExecutorOrderListResponse, TradeSide$1 as TradeSide, type TradeSplit, type TradeStep, TurnstileChallengeError, type UnifiedBalanceResponse, type UpdateUserBody, type UpsertVenueKey, type UserActivityBridge, type UserActivityDeposit, type UserActivityItem, type UserActivityQuery, type UserActivityTrade, type UserActivityType, type UserActivityUserOp, type UserActivityWithdrawal, type UserHolding, type UserProfile, VENUES, type ValidateBalanceOnClientStep, type ValidateManagedParams, type ValidateManagedRequest, type ValidateManagedResponse, type ValidateTradeRequest, type ValidateTradeResponse, Venue, type VenueEvent, type VenueEventListItem, type VenueEventWithMarkets, type VenueKeySummary, type VenueMarket, type VenueMarketClusterNode, type VenueMarketListItem, type VenueMarketOutcome, type VenueMarketRef, type VenueOrderbookEntry, type VenueOrderbookLevel, type VenuePositionBalance, type VenuePriceInfo, type VenueSoloQuote, type VerifyBody, type VerifyResponse, type WalletChainBalance, type WalletTokenBalance, type WithdrawManagedParams, type WithdrawManagedRequest, type WithdrawManagedResponse, type WithdrawManagedSourceItem, type WithdrawalSource, type WsAttributedLevel, type WsAuthenticated, type WsBalanceUpdate, type WsCandleInterval, type WsClientMessage, type WsConnected, type WsError, type WsHeartbeat, type WsMarkSource, type WsMarketResolved, type WsOrderEvent, type WsOrderEventType, type WsOrderSubmitted, type WsOrderbookDelta, type WsOrderbookSnapshot, type WsRedeemEvent, type WsServerMessage, type WsSubscribed, type WsTrade, type WsUnsubscribed, type WsVenueBook, type WsVenueInfo, type WsVenueLevel, aggregateMidpoint, applyOrderbookDelta, computeBestSplitsByAmount, computeChecksum, createAggClient, enumGuard, formatMarketQuestion, formatOutcomeLabel, getWalletAddressFromUserProfile, hasShape, isEmail, isEnum, isFiniteNonNeg, isNonEmptyString, mergeCandles, mergeClosedCandles, normalizeVenueMarketCluster, optimizedImageUrl, parse, parseEmail, parseEmailStrict, safeParse, snapshotToOrderbook, sortVenues };
|
|
2679
|
+
export { type Account, AccountProvider, AccountType, type AggAuthDeliveryMode, type AggAuthProviderType, type AggAuthStartBody, type AggAuthStartResult, type AggAuthVerifyBody, AggClient, type AggClientAuthOptions, type AggClientSessionInput, type AggLinkAccountBody, type AggLinkAccountConfirmResult, type AggLinkAccountResult, type AggSessionUser, AggWebSocket, type AggWebSocketCallbacks, type AggWebSocketOptions, type AggregatedOrderbookLevel, type AggregatedOrderbookResponse, type App, type AppClientConfigResponse, type AttributedOrderbook, type AttributedOrderbookLevel, type AuthCodeResponse, type AuthStatus, type AuthTokenResponse, type AuthUser, type BatchMidpointsResponse, type BatchOrderbooksResponse, CONFIRMED_MATCH_STATUSES, type CancelManagedExecutionResponse, type Candle, CandleBuilder, type CandleInterval, type Category, Chain, type ChartBarsResponse, type ChartCandle, type ChartResolution, type ChartVenueCandles, type ComputeSplitsRequest, type ComputeSplitsResponse, type ComputeSplitsSelection, type CreateApp, type DepositAddressesPendingResponse, type DepositAddressesReadyResponse, type DepositAddressesResponse, type DepositAddressesSupportedChain, type DepositAddressesToken, type DepositStep, type DiagnosticCallback, type DiagnosticEvent, type ExecuteManagedParams, type ExecuteManagedRequest, type ExecuteManagedResponse, type ExecuteTradeRequest, type ExecuteTradeResponse, type ExecutionOrderItem, type ExecutionOrdersQuery, type ExecutionPositionGroup, type ExecutionPositionsQuery, type GetBalanceQuery, type GetBalanceResponse, type GetHoldingsQuery, type GetHoldingsResponse, type GetOrdersParams, type GetOrdersQuery, type GetPositionsParams, type GetPositionsQuery, type HelloResponse, IMAGE_SIZES, ImageSize, type MarkSource, type MarketPriceHistory, MarketStatus, MatchStatus, MatchType, type MatchedMidpoint, type MatchedOrderbookMarket, type MatchingReport, type MidpointItem, type MidpointRow, type NonceResponse, type OrderListItem, type OrderListQuery, OrderStatus, type Orderbook, type OrderbookBatchItemError, type OrderbookBatchItemErrorCode, type OrderbookBatchItemStatus, type OrderbookHistoryPoint, type OrderbookHistoryResponse, type OrderbookLevel, type OrderbookQuoteFill, type OrderbookQuoteParams, type OrderbookQuoteResponse, type OrderbookServiceUnavailableError, type OrderbookState, type OrderbooksOnlyError, type OutcomeMidpoint, type OutcomeMidpointRow, type OutcomeOrderbookResponse, type PaginatedResponse, type PersistedAuthSnapshot, type PositionGroup, type PositionRedeemStatus, type PricePoint, type PriceSource, type PricesHistoryResponse, type QuoteManagedParams, type QuoteManagedRequest, type QuoteManagedResponse, type QuoteManagedSplit, type QuoteManagedStep, type QuoteSplit, type QuoteStep, type RampQuote, type RampQuoteRequest, type RampSessionRequest, type RampWidgetSession, type RedeemLegResult, type RedeemLegStatus, type RedeemRequest, type RedeemResponse, type RequestedOrderbookMarket, type SafeParseFailure, type SafeParseResult, type SafeParseSuccess, type ServerWallet, type SettlementSource, type SetupDepositAddressStep, type SetupVenueKeyStep, type SimpleOrderbookLevel, type SmartRouteFill, type SmartRouteParams, type SmartRouteResponse, type SmartRouteSide, type SmartRouteStatus, type SmartRouteVenueFill, type SplitsByAmountResult, type SyncBalancesResponse, type TradeExecutorOrder, type TradeExecutorOrderListResponse, TradeSide$1 as TradeSide, type TradeSplit, type TradeStep, TurnstileChallengeError, type UnifiedBalanceResponse, type UpdateUserBody, type UpsertVenueKey, type UserActivityBridge, type UserActivityDeposit, type UserActivityItem, type UserActivityQuery, type UserActivityTrade, type UserActivityType, type UserActivityUserOp, type UserActivityWithdrawal, type UserHolding, type UserProfile, VENUES, type ValidateBalanceOnClientStep, type ValidateManagedParams, type ValidateManagedRequest, type ValidateManagedResponse, type ValidateTradeRequest, type ValidateTradeResponse, Venue, type VenueEvent, type VenueEventListItem, type VenueEventWithMarkets, type VenueKeySummary, type VenueMarket, type VenueMarketClusterNode, type VenueMarketListItem, type VenueMarketOutcome, type VenueMarketRef, type VenueOrderbookEntry, type VenueOrderbookLevel, type VenuePositionBalance, type VenuePriceInfo, type VenueSoloQuote, type VerifyBody, type VerifyResponse, type WalletChainBalance, type WalletTokenBalance, type WithdrawManagedParams, type WithdrawManagedRequest, type WithdrawManagedResponse, type WithdrawManagedSourceItem, type WithdrawTokenSymbol, type WithdrawalExpected, type WithdrawalLeg, type WithdrawalLegStatus, type WithdrawalLegType, type WithdrawalLifecycleStatus, type WithdrawalSource, type WithdrawalSourceItem, type WithdrawalSourceStatus, type WsAttributedLevel, type WsAuthenticated, type WsBalanceUpdate, type WsCandleInterval, type WsClientMessage, type WsConnected, type WsError, type WsHeartbeat, type WsMarkSource, type WsMarketResolved, type WsOrderEvent, type WsOrderEventType, type WsOrderSubmitted, type WsOrderbookDelta, type WsOrderbookSnapshot, type WsRedeemEvent, type WsServerMessage, type WsSubscribed, type WsTrade, type WsUnsubscribed, type WsVenueBook, type WsVenueInfo, type WsVenueLevel, type WsWithdrawalLegStatus, type WsWithdrawalLifecycleEvent, type WsWithdrawalLifecycleLeg, type WsWithdrawalLifecycleStatus, aggregateMidpoint, applyOrderbookDelta, computeBestSplitsByAmount, computeChecksum, createAggClient, enumGuard, formatMarketQuestion, formatOutcomeLabel, getWalletAddressFromUserProfile, hasShape, isEmail, isEnum, isFiniteNonNeg, isNonEmptyString, mergeCandles, mergeClosedCandles, normalizeVenueMarketCluster, optimizedImageUrl, parse, parseEmail, parseEmailStrict, safeParse, snapshotToOrderbook, sortVenues };
|
package/dist/index.js
CHANGED
|
@@ -1015,7 +1015,7 @@ var AggWebSocket = class {
|
|
|
1015
1015
|
}
|
|
1016
1016
|
// ── Message handling ──
|
|
1017
1017
|
handleMessage(raw) {
|
|
1018
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
1018
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
1019
1019
|
const type = raw.type;
|
|
1020
1020
|
switch (type) {
|
|
1021
1021
|
case "orderbook_snapshot":
|
|
@@ -1060,6 +1060,9 @@ var AggWebSocket = class {
|
|
|
1060
1060
|
case "redeem_event":
|
|
1061
1061
|
this.handleRedeemEvent(raw);
|
|
1062
1062
|
break;
|
|
1063
|
+
case "withdrawal_lifecycle":
|
|
1064
|
+
(_l = (_k = this.callbacks).onWithdrawalLifecycle) == null ? void 0 : _l.call(_k, raw);
|
|
1065
|
+
break;
|
|
1063
1066
|
}
|
|
1064
1067
|
}
|
|
1065
1068
|
/**
|
|
@@ -2278,6 +2281,23 @@ Issued At: ${issuedAt}`;
|
|
|
2278
2281
|
});
|
|
2279
2282
|
});
|
|
2280
2283
|
}
|
|
2284
|
+
/**
|
|
2285
|
+
* Read the current persisted state of a withdrawal. Used as a backfill for
|
|
2286
|
+
* the WS lifecycle channel: the client polls this on hook mount and on WS
|
|
2287
|
+
* reconnect to recover events that fired before the listener was attached
|
|
2288
|
+
* or while the socket was disconnected. Same response shape as
|
|
2289
|
+
* `withdrawManaged`.
|
|
2290
|
+
*/
|
|
2291
|
+
getWithdrawalStatus(withdrawalId) {
|
|
2292
|
+
return __async(this, null, function* () {
|
|
2293
|
+
if (!withdrawalId) {
|
|
2294
|
+
throw new Error("withdrawalId is required");
|
|
2295
|
+
}
|
|
2296
|
+
return this.request(
|
|
2297
|
+
`/execution/withdrawals/${encodeURIComponent(withdrawalId)}`
|
|
2298
|
+
);
|
|
2299
|
+
});
|
|
2300
|
+
}
|
|
2281
2301
|
/** Trigger an on-chain balance sync for all tracked tokens across all chains. */
|
|
2282
2302
|
syncManagedBalances() {
|
|
2283
2303
|
return __async(this, null, function* () {
|
package/dist/index.mjs
CHANGED
|
@@ -918,7 +918,7 @@ var AggWebSocket = class {
|
|
|
918
918
|
}
|
|
919
919
|
// ── Message handling ──
|
|
920
920
|
handleMessage(raw) {
|
|
921
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
921
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l;
|
|
922
922
|
const type = raw.type;
|
|
923
923
|
switch (type) {
|
|
924
924
|
case "orderbook_snapshot":
|
|
@@ -963,6 +963,9 @@ var AggWebSocket = class {
|
|
|
963
963
|
case "redeem_event":
|
|
964
964
|
this.handleRedeemEvent(raw);
|
|
965
965
|
break;
|
|
966
|
+
case "withdrawal_lifecycle":
|
|
967
|
+
(_l = (_k = this.callbacks).onWithdrawalLifecycle) == null ? void 0 : _l.call(_k, raw);
|
|
968
|
+
break;
|
|
966
969
|
}
|
|
967
970
|
}
|
|
968
971
|
/**
|
|
@@ -2181,6 +2184,23 @@ Issued At: ${issuedAt}`;
|
|
|
2181
2184
|
});
|
|
2182
2185
|
});
|
|
2183
2186
|
}
|
|
2187
|
+
/**
|
|
2188
|
+
* Read the current persisted state of a withdrawal. Used as a backfill for
|
|
2189
|
+
* the WS lifecycle channel: the client polls this on hook mount and on WS
|
|
2190
|
+
* reconnect to recover events that fired before the listener was attached
|
|
2191
|
+
* or while the socket was disconnected. Same response shape as
|
|
2192
|
+
* `withdrawManaged`.
|
|
2193
|
+
*/
|
|
2194
|
+
getWithdrawalStatus(withdrawalId) {
|
|
2195
|
+
return __async(this, null, function* () {
|
|
2196
|
+
if (!withdrawalId) {
|
|
2197
|
+
throw new Error("withdrawalId is required");
|
|
2198
|
+
}
|
|
2199
|
+
return this.request(
|
|
2200
|
+
`/execution/withdrawals/${encodeURIComponent(withdrawalId)}`
|
|
2201
|
+
);
|
|
2202
|
+
});
|
|
2203
|
+
}
|
|
2184
2204
|
/** Trigger an on-chain balance sync for all tracked tokens across all chains. */
|
|
2185
2205
|
syncManagedBalances() {
|
|
2186
2206
|
return __async(this, null, function* () {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agg-build/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Vanilla TypeScript client for the AGG prediction market aggregator (auth, markets, orderbooks, charts, trading, managed execution, WebSockets). Works in browsers, Node.js, and React Native.",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"license": "MIT",
|