@agg-build/sdk 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/index.d.mts +130 -8
- package/dist/index.d.ts +130 -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
|
@@ -789,12 +789,35 @@ type ValidateManagedRequest = {
|
|
|
789
789
|
side: "buy" | "sell";
|
|
790
790
|
amount: number;
|
|
791
791
|
};
|
|
792
|
+
type WithdrawTokenSymbol$1 = "USDC" | "USDC.e" | "USDT";
|
|
792
793
|
type WithdrawManagedRequest = {
|
|
794
|
+
/** Positive integer string in the token's native decimals (e.g. "100000" = 0.1 USDC). */
|
|
793
795
|
amountRaw: string;
|
|
794
|
-
tokenSymbol:
|
|
796
|
+
tokenSymbol: WithdrawTokenSymbol$1;
|
|
797
|
+
/** EVM 0x-prefixed 20-byte recipient address. */
|
|
795
798
|
destinationAddress: string;
|
|
796
|
-
|
|
799
|
+
/** EVM chain ID where the recipient should receive funds. Required since v2026.04. */
|
|
800
|
+
destinationChainId: number;
|
|
801
|
+
};
|
|
802
|
+
type WithdrawalSourceStatus$1 = "pending" | "submitted" | "confirmed" | "failed";
|
|
803
|
+
type WithdrawalSourceItem = {
|
|
804
|
+
sourceId: string;
|
|
805
|
+
chainId: number;
|
|
806
|
+
tokenSymbol: WithdrawTokenSymbol$1;
|
|
807
|
+
/** On-chain token address on `chainId`. */
|
|
808
|
+
tokenAddress: string;
|
|
809
|
+
/**
|
|
810
|
+
* On-chain decimals for `(chainId, tokenAddress)`. Critical for clients
|
|
811
|
+
* because `amountRaw` is in source-native decimals (BNB USDC is 18-dec,
|
|
812
|
+
* EVM USDC is 6-dec).
|
|
813
|
+
*/
|
|
814
|
+
decimals: number;
|
|
815
|
+
amountRaw: string;
|
|
816
|
+
status: WithdrawalSourceStatus$1;
|
|
817
|
+
txHash: string | null;
|
|
818
|
+
bridgeOperationId: string | null;
|
|
797
819
|
};
|
|
820
|
+
/** @deprecated Use `WithdrawalSourceItem` from the lifecycle response. */
|
|
798
821
|
type WithdrawalSource = {
|
|
799
822
|
amountRaw: string;
|
|
800
823
|
chainId: number;
|
|
@@ -1201,7 +1224,40 @@ interface WsRedeemEvent {
|
|
|
1201
1224
|
/** @unit seconds (converted from server ms) */
|
|
1202
1225
|
timestamp: number;
|
|
1203
1226
|
}
|
|
1204
|
-
|
|
1227
|
+
/** Top-level withdrawal lifecycle states surfaced to partner clients. */
|
|
1228
|
+
type WsWithdrawalLifecycleStatus = "pending" | "bridging" | "transferring" | "completed" | "partial" | "failed";
|
|
1229
|
+
type WsWithdrawalLegStatus = "planned" | "submitted" | "confirmed" | "failed";
|
|
1230
|
+
interface WsWithdrawalLifecycleLeg {
|
|
1231
|
+
sourceChainId: number;
|
|
1232
|
+
destChainId: number;
|
|
1233
|
+
type: "transfer" | "bridge";
|
|
1234
|
+
status: WsWithdrawalLegStatus;
|
|
1235
|
+
amountRaw: string;
|
|
1236
|
+
txHash: string | null;
|
|
1237
|
+
bridgeOperationId: string | null;
|
|
1238
|
+
}
|
|
1239
|
+
/**
|
|
1240
|
+
* Per-withdrawal lifecycle event. Wire shape is intentionally additive:
|
|
1241
|
+
* consumers should pass through unknown enum values rather than failing.
|
|
1242
|
+
*/
|
|
1243
|
+
interface WsWithdrawalLifecycleEvent {
|
|
1244
|
+
type: "withdrawal_lifecycle";
|
|
1245
|
+
withdrawalId: string;
|
|
1246
|
+
userId: string;
|
|
1247
|
+
status: WsWithdrawalLifecycleStatus;
|
|
1248
|
+
/** True when `status` is terminal (`completed` / `partial` / `failed`). */
|
|
1249
|
+
terminal: boolean;
|
|
1250
|
+
/** Optional leg delta — present when this event was triggered by a leg flip. */
|
|
1251
|
+
leg?: WsWithdrawalLifecycleLeg;
|
|
1252
|
+
/** All legs at the moment of emission (snapshot). */
|
|
1253
|
+
legs?: WsWithdrawalLifecycleLeg[];
|
|
1254
|
+
/** Failure reason for terminal `failed` / `partial`. */
|
|
1255
|
+
errorMessage?: string;
|
|
1256
|
+
correlationId?: string;
|
|
1257
|
+
/** @unit milliseconds (raw from server — NOT converted like other WS types) */
|
|
1258
|
+
timestamp: number;
|
|
1259
|
+
}
|
|
1260
|
+
type WsServerMessage = WsOrderbookSnapshot | WsOrderbookDelta | WsTrade | WsSubscribed | WsUnsubscribed | WsConnected | WsAuthenticated | WsHeartbeat | WsMarketResolved | WsError | WsOrderSubmitted | WsBalanceUpdate | WsOrderEvent | WsRedeemEvent | WsWithdrawalLifecycleEvent;
|
|
1205
1261
|
type WsClientMessage = {
|
|
1206
1262
|
action: "subscribe";
|
|
1207
1263
|
channel: "orderbook" | "trades";
|
|
@@ -1320,6 +1376,7 @@ interface AggWebSocketCallbacks {
|
|
|
1320
1376
|
onBalanceUpdate?: (msg: WsBalanceUpdate) => void;
|
|
1321
1377
|
onOrderEvent?: (msg: WsOrderEvent) => void;
|
|
1322
1378
|
onRedeemEvent?: (msg: WsRedeemEvent) => void;
|
|
1379
|
+
onWithdrawalLifecycle?: (msg: WsWithdrawalLifecycleEvent) => void;
|
|
1323
1380
|
onDiagnostics?: DiagnosticCallback;
|
|
1324
1381
|
onConnectionStateChange?: (connected: boolean) => void;
|
|
1325
1382
|
}
|
|
@@ -1877,19 +1934,76 @@ interface ValidateManagedResponse {
|
|
|
1877
1934
|
bridgeSourceChainId?: number;
|
|
1878
1935
|
bridgeAmountRaw?: string;
|
|
1879
1936
|
}
|
|
1937
|
+
type WithdrawTokenSymbol = "USDC" | "USDC.e" | "USDT";
|
|
1880
1938
|
interface WithdrawManagedParams {
|
|
1939
|
+
/** Positive integer string in the token's native decimals (e.g. "100000" = 0.1 USDC). */
|
|
1881
1940
|
amountRaw: string;
|
|
1882
|
-
tokenSymbol:
|
|
1941
|
+
tokenSymbol: WithdrawTokenSymbol;
|
|
1942
|
+
/** EVM 0x-prefixed 20-byte recipient address. */
|
|
1883
1943
|
destinationAddress: string;
|
|
1884
|
-
|
|
1944
|
+
/** EVM chain ID where the recipient should receive funds. Required as of v2026.04. */
|
|
1945
|
+
destinationChainId: number;
|
|
1946
|
+
}
|
|
1947
|
+
type WithdrawalLifecycleStatus = "pending" | "bridging" | "transferring" | "completed" | "partial" | "failed";
|
|
1948
|
+
type WithdrawalSourceStatus = "pending" | "submitted" | "confirmed" | "failed";
|
|
1949
|
+
type WithdrawalLegType = "transfer" | "bridge";
|
|
1950
|
+
type WithdrawalLegStatus = "planned" | "submitted" | "confirmed" | "failed";
|
|
1951
|
+
interface WithdrawalLeg {
|
|
1952
|
+
type: WithdrawalLegType;
|
|
1953
|
+
status: WithdrawalLegStatus;
|
|
1954
|
+
sourceChainId: number;
|
|
1955
|
+
destChainId: number;
|
|
1956
|
+
amountRaw: string;
|
|
1957
|
+
txHash: string | null;
|
|
1958
|
+
bridgeOperationId: string | null;
|
|
1885
1959
|
}
|
|
1886
1960
|
interface WithdrawManagedSourceItem {
|
|
1961
|
+
sourceId: string;
|
|
1887
1962
|
chainId: number;
|
|
1963
|
+
tokenSymbol: WithdrawTokenSymbol;
|
|
1964
|
+
/** On-chain token address on `chainId`. */
|
|
1965
|
+
tokenAddress: string;
|
|
1966
|
+
/**
|
|
1967
|
+
* On-chain decimals for `(chainId, tokenAddress)`. Required to interpret
|
|
1968
|
+
* `amountRaw`: BNB USDC is 18-dec, EVM USDC is 6-dec.
|
|
1969
|
+
*/
|
|
1970
|
+
decimals: number;
|
|
1888
1971
|
amountRaw: string;
|
|
1889
|
-
|
|
1890
|
-
|
|
1972
|
+
status: WithdrawalSourceStatus;
|
|
1973
|
+
txHash: string | null;
|
|
1974
|
+
bridgeOperationId: string | null;
|
|
1975
|
+
}
|
|
1976
|
+
/**
|
|
1977
|
+
* `pricingStatus === "unquoted"` until the multi-stable quote layer ships;
|
|
1978
|
+
* `expected.*` is `null` in that mode. Do NOT treat null fields as missing.
|
|
1979
|
+
*/
|
|
1980
|
+
interface WithdrawalExpected {
|
|
1981
|
+
outputRaw: string | null;
|
|
1982
|
+
feeRaw: string | null;
|
|
1983
|
+
etaSeconds: number | null;
|
|
1891
1984
|
}
|
|
1892
1985
|
interface WithdrawManagedResponse {
|
|
1986
|
+
withdrawalId: string;
|
|
1987
|
+
status: WithdrawalLifecycleStatus;
|
|
1988
|
+
requested: {
|
|
1989
|
+
tokenSymbol: WithdrawTokenSymbol;
|
|
1990
|
+
amountRaw: string;
|
|
1991
|
+
};
|
|
1992
|
+
destination: {
|
|
1993
|
+
chainId: number;
|
|
1994
|
+
address: string;
|
|
1995
|
+
tokenSymbol: WithdrawTokenSymbol;
|
|
1996
|
+
};
|
|
1997
|
+
legs: WithdrawalLeg[];
|
|
1998
|
+
expected: WithdrawalExpected;
|
|
1999
|
+
pricingStatus: "unquoted" | "quoted";
|
|
2000
|
+
/**
|
|
2001
|
+
* Persisted terminal-state error reason. Always `null` until the
|
|
2002
|
+
* withdrawal reaches `failed` / `partial`. The submit response always
|
|
2003
|
+
* returns `null`; populated values arrive via the GET status endpoint or
|
|
2004
|
+
* via a terminal `withdrawal_lifecycle` WS event.
|
|
2005
|
+
*/
|
|
2006
|
+
errorMessage: string | null;
|
|
1893
2007
|
sources: WithdrawManagedSourceItem[];
|
|
1894
2008
|
}
|
|
1895
2009
|
interface DepositAddressesToken {
|
|
@@ -2448,6 +2562,14 @@ declare class AggClient {
|
|
|
2448
2562
|
redeem(body: RedeemRequest): Promise<RedeemResponse>;
|
|
2449
2563
|
/** Withdraw funds from managed wallets to an external address. */
|
|
2450
2564
|
withdrawManaged(params: WithdrawManagedParams): Promise<WithdrawManagedResponse>;
|
|
2565
|
+
/**
|
|
2566
|
+
* Read the current persisted state of a withdrawal. Used as a backfill for
|
|
2567
|
+
* the WS lifecycle channel: the client polls this on hook mount and on WS
|
|
2568
|
+
* reconnect to recover events that fired before the listener was attached
|
|
2569
|
+
* or while the socket was disconnected. Same response shape as
|
|
2570
|
+
* `withdrawManaged`.
|
|
2571
|
+
*/
|
|
2572
|
+
getWithdrawalStatus(withdrawalId: string): Promise<WithdrawManagedResponse>;
|
|
2451
2573
|
/** Trigger an on-chain balance sync for all tracked tokens across all chains. */
|
|
2452
2574
|
syncManagedBalances(): Promise<SyncBalancesResponse>;
|
|
2453
2575
|
/** Get managed wallet deposit addresses (EVM + Solana). Returns 202 shape while provisioning. */
|
|
@@ -2543,4 +2665,4 @@ declare function aggregateMidpoint(midpoints: (number | null | undefined)[]): nu
|
|
|
2543
2665
|
|
|
2544
2666
|
declare function createAggClient(options: AggClientOptions): AggClient;
|
|
2545
2667
|
|
|
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 };
|
|
2668
|
+
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 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
|
@@ -789,12 +789,35 @@ type ValidateManagedRequest = {
|
|
|
789
789
|
side: "buy" | "sell";
|
|
790
790
|
amount: number;
|
|
791
791
|
};
|
|
792
|
+
type WithdrawTokenSymbol$1 = "USDC" | "USDC.e" | "USDT";
|
|
792
793
|
type WithdrawManagedRequest = {
|
|
794
|
+
/** Positive integer string in the token's native decimals (e.g. "100000" = 0.1 USDC). */
|
|
793
795
|
amountRaw: string;
|
|
794
|
-
tokenSymbol:
|
|
796
|
+
tokenSymbol: WithdrawTokenSymbol$1;
|
|
797
|
+
/** EVM 0x-prefixed 20-byte recipient address. */
|
|
795
798
|
destinationAddress: string;
|
|
796
|
-
|
|
799
|
+
/** EVM chain ID where the recipient should receive funds. Required since v2026.04. */
|
|
800
|
+
destinationChainId: number;
|
|
801
|
+
};
|
|
802
|
+
type WithdrawalSourceStatus$1 = "pending" | "submitted" | "confirmed" | "failed";
|
|
803
|
+
type WithdrawalSourceItem = {
|
|
804
|
+
sourceId: string;
|
|
805
|
+
chainId: number;
|
|
806
|
+
tokenSymbol: WithdrawTokenSymbol$1;
|
|
807
|
+
/** On-chain token address on `chainId`. */
|
|
808
|
+
tokenAddress: string;
|
|
809
|
+
/**
|
|
810
|
+
* On-chain decimals for `(chainId, tokenAddress)`. Critical for clients
|
|
811
|
+
* because `amountRaw` is in source-native decimals (BNB USDC is 18-dec,
|
|
812
|
+
* EVM USDC is 6-dec).
|
|
813
|
+
*/
|
|
814
|
+
decimals: number;
|
|
815
|
+
amountRaw: string;
|
|
816
|
+
status: WithdrawalSourceStatus$1;
|
|
817
|
+
txHash: string | null;
|
|
818
|
+
bridgeOperationId: string | null;
|
|
797
819
|
};
|
|
820
|
+
/** @deprecated Use `WithdrawalSourceItem` from the lifecycle response. */
|
|
798
821
|
type WithdrawalSource = {
|
|
799
822
|
amountRaw: string;
|
|
800
823
|
chainId: number;
|
|
@@ -1201,7 +1224,40 @@ interface WsRedeemEvent {
|
|
|
1201
1224
|
/** @unit seconds (converted from server ms) */
|
|
1202
1225
|
timestamp: number;
|
|
1203
1226
|
}
|
|
1204
|
-
|
|
1227
|
+
/** Top-level withdrawal lifecycle states surfaced to partner clients. */
|
|
1228
|
+
type WsWithdrawalLifecycleStatus = "pending" | "bridging" | "transferring" | "completed" | "partial" | "failed";
|
|
1229
|
+
type WsWithdrawalLegStatus = "planned" | "submitted" | "confirmed" | "failed";
|
|
1230
|
+
interface WsWithdrawalLifecycleLeg {
|
|
1231
|
+
sourceChainId: number;
|
|
1232
|
+
destChainId: number;
|
|
1233
|
+
type: "transfer" | "bridge";
|
|
1234
|
+
status: WsWithdrawalLegStatus;
|
|
1235
|
+
amountRaw: string;
|
|
1236
|
+
txHash: string | null;
|
|
1237
|
+
bridgeOperationId: string | null;
|
|
1238
|
+
}
|
|
1239
|
+
/**
|
|
1240
|
+
* Per-withdrawal lifecycle event. Wire shape is intentionally additive:
|
|
1241
|
+
* consumers should pass through unknown enum values rather than failing.
|
|
1242
|
+
*/
|
|
1243
|
+
interface WsWithdrawalLifecycleEvent {
|
|
1244
|
+
type: "withdrawal_lifecycle";
|
|
1245
|
+
withdrawalId: string;
|
|
1246
|
+
userId: string;
|
|
1247
|
+
status: WsWithdrawalLifecycleStatus;
|
|
1248
|
+
/** True when `status` is terminal (`completed` / `partial` / `failed`). */
|
|
1249
|
+
terminal: boolean;
|
|
1250
|
+
/** Optional leg delta — present when this event was triggered by a leg flip. */
|
|
1251
|
+
leg?: WsWithdrawalLifecycleLeg;
|
|
1252
|
+
/** All legs at the moment of emission (snapshot). */
|
|
1253
|
+
legs?: WsWithdrawalLifecycleLeg[];
|
|
1254
|
+
/** Failure reason for terminal `failed` / `partial`. */
|
|
1255
|
+
errorMessage?: string;
|
|
1256
|
+
correlationId?: string;
|
|
1257
|
+
/** @unit milliseconds (raw from server — NOT converted like other WS types) */
|
|
1258
|
+
timestamp: number;
|
|
1259
|
+
}
|
|
1260
|
+
type WsServerMessage = WsOrderbookSnapshot | WsOrderbookDelta | WsTrade | WsSubscribed | WsUnsubscribed | WsConnected | WsAuthenticated | WsHeartbeat | WsMarketResolved | WsError | WsOrderSubmitted | WsBalanceUpdate | WsOrderEvent | WsRedeemEvent | WsWithdrawalLifecycleEvent;
|
|
1205
1261
|
type WsClientMessage = {
|
|
1206
1262
|
action: "subscribe";
|
|
1207
1263
|
channel: "orderbook" | "trades";
|
|
@@ -1320,6 +1376,7 @@ interface AggWebSocketCallbacks {
|
|
|
1320
1376
|
onBalanceUpdate?: (msg: WsBalanceUpdate) => void;
|
|
1321
1377
|
onOrderEvent?: (msg: WsOrderEvent) => void;
|
|
1322
1378
|
onRedeemEvent?: (msg: WsRedeemEvent) => void;
|
|
1379
|
+
onWithdrawalLifecycle?: (msg: WsWithdrawalLifecycleEvent) => void;
|
|
1323
1380
|
onDiagnostics?: DiagnosticCallback;
|
|
1324
1381
|
onConnectionStateChange?: (connected: boolean) => void;
|
|
1325
1382
|
}
|
|
@@ -1877,19 +1934,76 @@ interface ValidateManagedResponse {
|
|
|
1877
1934
|
bridgeSourceChainId?: number;
|
|
1878
1935
|
bridgeAmountRaw?: string;
|
|
1879
1936
|
}
|
|
1937
|
+
type WithdrawTokenSymbol = "USDC" | "USDC.e" | "USDT";
|
|
1880
1938
|
interface WithdrawManagedParams {
|
|
1939
|
+
/** Positive integer string in the token's native decimals (e.g. "100000" = 0.1 USDC). */
|
|
1881
1940
|
amountRaw: string;
|
|
1882
|
-
tokenSymbol:
|
|
1941
|
+
tokenSymbol: WithdrawTokenSymbol;
|
|
1942
|
+
/** EVM 0x-prefixed 20-byte recipient address. */
|
|
1883
1943
|
destinationAddress: string;
|
|
1884
|
-
|
|
1944
|
+
/** EVM chain ID where the recipient should receive funds. Required as of v2026.04. */
|
|
1945
|
+
destinationChainId: number;
|
|
1946
|
+
}
|
|
1947
|
+
type WithdrawalLifecycleStatus = "pending" | "bridging" | "transferring" | "completed" | "partial" | "failed";
|
|
1948
|
+
type WithdrawalSourceStatus = "pending" | "submitted" | "confirmed" | "failed";
|
|
1949
|
+
type WithdrawalLegType = "transfer" | "bridge";
|
|
1950
|
+
type WithdrawalLegStatus = "planned" | "submitted" | "confirmed" | "failed";
|
|
1951
|
+
interface WithdrawalLeg {
|
|
1952
|
+
type: WithdrawalLegType;
|
|
1953
|
+
status: WithdrawalLegStatus;
|
|
1954
|
+
sourceChainId: number;
|
|
1955
|
+
destChainId: number;
|
|
1956
|
+
amountRaw: string;
|
|
1957
|
+
txHash: string | null;
|
|
1958
|
+
bridgeOperationId: string | null;
|
|
1885
1959
|
}
|
|
1886
1960
|
interface WithdrawManagedSourceItem {
|
|
1961
|
+
sourceId: string;
|
|
1887
1962
|
chainId: number;
|
|
1963
|
+
tokenSymbol: WithdrawTokenSymbol;
|
|
1964
|
+
/** On-chain token address on `chainId`. */
|
|
1965
|
+
tokenAddress: string;
|
|
1966
|
+
/**
|
|
1967
|
+
* On-chain decimals for `(chainId, tokenAddress)`. Required to interpret
|
|
1968
|
+
* `amountRaw`: BNB USDC is 18-dec, EVM USDC is 6-dec.
|
|
1969
|
+
*/
|
|
1970
|
+
decimals: number;
|
|
1888
1971
|
amountRaw: string;
|
|
1889
|
-
|
|
1890
|
-
|
|
1972
|
+
status: WithdrawalSourceStatus;
|
|
1973
|
+
txHash: string | null;
|
|
1974
|
+
bridgeOperationId: string | null;
|
|
1975
|
+
}
|
|
1976
|
+
/**
|
|
1977
|
+
* `pricingStatus === "unquoted"` until the multi-stable quote layer ships;
|
|
1978
|
+
* `expected.*` is `null` in that mode. Do NOT treat null fields as missing.
|
|
1979
|
+
*/
|
|
1980
|
+
interface WithdrawalExpected {
|
|
1981
|
+
outputRaw: string | null;
|
|
1982
|
+
feeRaw: string | null;
|
|
1983
|
+
etaSeconds: number | null;
|
|
1891
1984
|
}
|
|
1892
1985
|
interface WithdrawManagedResponse {
|
|
1986
|
+
withdrawalId: string;
|
|
1987
|
+
status: WithdrawalLifecycleStatus;
|
|
1988
|
+
requested: {
|
|
1989
|
+
tokenSymbol: WithdrawTokenSymbol;
|
|
1990
|
+
amountRaw: string;
|
|
1991
|
+
};
|
|
1992
|
+
destination: {
|
|
1993
|
+
chainId: number;
|
|
1994
|
+
address: string;
|
|
1995
|
+
tokenSymbol: WithdrawTokenSymbol;
|
|
1996
|
+
};
|
|
1997
|
+
legs: WithdrawalLeg[];
|
|
1998
|
+
expected: WithdrawalExpected;
|
|
1999
|
+
pricingStatus: "unquoted" | "quoted";
|
|
2000
|
+
/**
|
|
2001
|
+
* Persisted terminal-state error reason. Always `null` until the
|
|
2002
|
+
* withdrawal reaches `failed` / `partial`. The submit response always
|
|
2003
|
+
* returns `null`; populated values arrive via the GET status endpoint or
|
|
2004
|
+
* via a terminal `withdrawal_lifecycle` WS event.
|
|
2005
|
+
*/
|
|
2006
|
+
errorMessage: string | null;
|
|
1893
2007
|
sources: WithdrawManagedSourceItem[];
|
|
1894
2008
|
}
|
|
1895
2009
|
interface DepositAddressesToken {
|
|
@@ -2448,6 +2562,14 @@ declare class AggClient {
|
|
|
2448
2562
|
redeem(body: RedeemRequest): Promise<RedeemResponse>;
|
|
2449
2563
|
/** Withdraw funds from managed wallets to an external address. */
|
|
2450
2564
|
withdrawManaged(params: WithdrawManagedParams): Promise<WithdrawManagedResponse>;
|
|
2565
|
+
/**
|
|
2566
|
+
* Read the current persisted state of a withdrawal. Used as a backfill for
|
|
2567
|
+
* the WS lifecycle channel: the client polls this on hook mount and on WS
|
|
2568
|
+
* reconnect to recover events that fired before the listener was attached
|
|
2569
|
+
* or while the socket was disconnected. Same response shape as
|
|
2570
|
+
* `withdrawManaged`.
|
|
2571
|
+
*/
|
|
2572
|
+
getWithdrawalStatus(withdrawalId: string): Promise<WithdrawManagedResponse>;
|
|
2451
2573
|
/** Trigger an on-chain balance sync for all tracked tokens across all chains. */
|
|
2452
2574
|
syncManagedBalances(): Promise<SyncBalancesResponse>;
|
|
2453
2575
|
/** Get managed wallet deposit addresses (EVM + Solana). Returns 202 shape while provisioning. */
|
|
@@ -2543,4 +2665,4 @@ declare function aggregateMidpoint(midpoints: (number | null | undefined)[]): nu
|
|
|
2543
2665
|
|
|
2544
2666
|
declare function createAggClient(options: AggClientOptions): AggClient;
|
|
2545
2667
|
|
|
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 };
|
|
2668
|
+
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 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.0.
|
|
3
|
+
"version": "1.0.1",
|
|
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",
|