@agg-build/sdk 4.17.1 → 4.17.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -711,7 +711,15 @@ type PositionGroup = {
711
711
  venueMarketOutcomeId: string;
712
712
  }[];
713
713
  totalSize: number;
714
+ /** Weighted over legs with a known entry price — see `costBasisUnknown`. */
714
715
  avgEntryPrice: number;
716
+ /**
717
+ * At least one leg was imported from an externally-acquired self-custody
718
+ * balance with no acquisition price we could reconcile. `totalValue`
719
+ * covers every leg; `avgEntryPrice` and `unrealizedPnl` cover only the
720
+ * legs with a known entry, and are 0 when none of them do.
721
+ */
722
+ costBasisUnknown?: boolean;
715
723
  currentPrice: number;
716
724
  totalValue: number;
717
725
  unrealizedPnlPercent: number;
@@ -2284,6 +2292,8 @@ interface SignatureRequest {
2284
2292
  /** Sign verbatim. */
2285
2293
  payload: unknown;
2286
2294
  expiresAt: string;
2295
+ /** Why this signature is being asked for, when the server knows (e.g. `"fee"`, `"funding_and_fee"`). Display only. */
2296
+ purpose?: string;
2287
2297
  }
2288
2298
  /**
2289
2299
  * Supplied by the partner. Receives a payload, returns a signature. The SDK
@@ -3089,6 +3099,14 @@ interface PlaceOrderParams {
3089
3099
  allowedSourceChainIds?: number[];
3090
3100
  /** USD budgets capped by refreshed wallet balances; omitted chains cannot fund. */
3091
3101
  chainBalances?: Record<string, number>;
3102
+ /** Referral: EVM address that receives the referral fee. Needs an app API key. */
3103
+ referrer?: string;
3104
+ /** Referral fee in bips of routed notional (1..10000). Snag-free. */
3105
+ referrerFeeBips?: number;
3106
+ /** Who funds the referral: "user" (default) reserves it from maxSpend; "app" pays from `referralPayerAddress` after the fill. */
3107
+ referralPayer?: "user" | "app";
3108
+ /** Required with `referralPayer: "app"`: the wallet that signs the parked payout transaction. */
3109
+ referralPayerAddress?: string;
3092
3110
  /**
3093
3111
  * Skip the smart-route solver and send one order straight to `venue` (predict,
3094
3112
  * hyperliquid, novig and prophetx only; others return 400). Requires a `read_write` `x-app-api-key`. No
@@ -3847,6 +3865,13 @@ interface VenueSoloQuote {
3847
3865
  estimatedPayout: number;
3848
3866
  estimatedProfit: number;
3849
3867
  returnPct: number;
3868
+ /**
3869
+ * `feeBreakdown.totalCost` plus this solo's own user-paid app fee and
3870
+ * referral — same composition as the primary route's `totalCostIncFees`.
3871
+ * `estimatedProfit`/`returnPct` stay router values, unaffected. Absent
3872
+ * when the router sent no `feeBreakdown` for this solo.
3873
+ */
3874
+ totalCostIncFees?: number;
3850
3875
  status: string;
3851
3876
  /** Per-price-level fills, identical shape to primary fills. Empty for non-ok statuses. */
3852
3877
  fills: SmartRouteVenueFill[];
@@ -3913,6 +3938,14 @@ interface SmartRouteParams {
3913
3938
  * budget.
3914
3939
  */
3915
3940
  deepEstimate?: boolean;
3941
+ /** Referral: EVM address that receives the referral fee. Needs an app API key. */
3942
+ referrer?: string;
3943
+ /** Referral fee in bips of routed notional (1..10000). Snag-free. */
3944
+ referrerFeeBips?: number;
3945
+ /** Who funds the referral: "user" (default) reserves it from maxSpend; "app" pays from `referralPayerAddress` after the fill. */
3946
+ referralPayer?: "user" | "app";
3947
+ /** Required with `referralPayer: "app"`: the wallet that signs the parked payout transaction. */
3948
+ referralPayerAddress?: string;
3916
3949
  }
3917
3950
  /** One-time setup line item — populated only on deep-estimate quotes. */
3918
3951
  interface SmartRouteSetupCostLine {
@@ -3973,6 +4006,10 @@ interface SmartRouteFeeBreakdown {
3973
4006
  appFeeBips?: number;
3974
4007
  /** Category key the bips resolved against (e.g. "sports", or "all" for the fallback). */
3975
4008
  appFeeCategory?: string;
4009
+ /** The `executionGas` line when it is actually collected with the app fee. Present iff > 0; already inside `totalCost`. */
4010
+ gasReimbursement?: number;
4011
+ /** Referral fee the USER pays, in USD. Present iff > 0 and `referralPayer` is "user"; already inside `totalCostIncFees`. An app-paid referral never appears here. */
4012
+ referralFee?: number;
3976
4013
  }
3977
4014
  /** Response from GET /orderbook/:venueMarketOutcomeId/route. */
3978
4015
  interface SmartRouteSettlementLeg {
@@ -4081,6 +4118,14 @@ interface SmartRouteResponse {
4081
4118
  categoryKey: string;
4082
4119
  quotedAppFeeRaw: string;
4083
4120
  } | null;
4121
+ /** Referral snapshot; null/absent when no referrer was accepted. */
4122
+ referral?: {
4123
+ referrer: string;
4124
+ feeBips: number;
4125
+ payer: "user" | "app";
4126
+ payerAddress?: string;
4127
+ quotedFeeUsd: number;
4128
+ } | null;
4084
4129
  /** Populated only when status === "insufficient_position". */
4085
4130
  positionAvailability?: {
4086
4131
  totalSellableShares: number;
package/dist/index.d.ts CHANGED
@@ -711,7 +711,15 @@ type PositionGroup = {
711
711
  venueMarketOutcomeId: string;
712
712
  }[];
713
713
  totalSize: number;
714
+ /** Weighted over legs with a known entry price — see `costBasisUnknown`. */
714
715
  avgEntryPrice: number;
716
+ /**
717
+ * At least one leg was imported from an externally-acquired self-custody
718
+ * balance with no acquisition price we could reconcile. `totalValue`
719
+ * covers every leg; `avgEntryPrice` and `unrealizedPnl` cover only the
720
+ * legs with a known entry, and are 0 when none of them do.
721
+ */
722
+ costBasisUnknown?: boolean;
715
723
  currentPrice: number;
716
724
  totalValue: number;
717
725
  unrealizedPnlPercent: number;
@@ -2284,6 +2292,8 @@ interface SignatureRequest {
2284
2292
  /** Sign verbatim. */
2285
2293
  payload: unknown;
2286
2294
  expiresAt: string;
2295
+ /** Why this signature is being asked for, when the server knows (e.g. `"fee"`, `"funding_and_fee"`). Display only. */
2296
+ purpose?: string;
2287
2297
  }
2288
2298
  /**
2289
2299
  * Supplied by the partner. Receives a payload, returns a signature. The SDK
@@ -3089,6 +3099,14 @@ interface PlaceOrderParams {
3089
3099
  allowedSourceChainIds?: number[];
3090
3100
  /** USD budgets capped by refreshed wallet balances; omitted chains cannot fund. */
3091
3101
  chainBalances?: Record<string, number>;
3102
+ /** Referral: EVM address that receives the referral fee. Needs an app API key. */
3103
+ referrer?: string;
3104
+ /** Referral fee in bips of routed notional (1..10000). Snag-free. */
3105
+ referrerFeeBips?: number;
3106
+ /** Who funds the referral: "user" (default) reserves it from maxSpend; "app" pays from `referralPayerAddress` after the fill. */
3107
+ referralPayer?: "user" | "app";
3108
+ /** Required with `referralPayer: "app"`: the wallet that signs the parked payout transaction. */
3109
+ referralPayerAddress?: string;
3092
3110
  /**
3093
3111
  * Skip the smart-route solver and send one order straight to `venue` (predict,
3094
3112
  * hyperliquid, novig and prophetx only; others return 400). Requires a `read_write` `x-app-api-key`. No
@@ -3847,6 +3865,13 @@ interface VenueSoloQuote {
3847
3865
  estimatedPayout: number;
3848
3866
  estimatedProfit: number;
3849
3867
  returnPct: number;
3868
+ /**
3869
+ * `feeBreakdown.totalCost` plus this solo's own user-paid app fee and
3870
+ * referral — same composition as the primary route's `totalCostIncFees`.
3871
+ * `estimatedProfit`/`returnPct` stay router values, unaffected. Absent
3872
+ * when the router sent no `feeBreakdown` for this solo.
3873
+ */
3874
+ totalCostIncFees?: number;
3850
3875
  status: string;
3851
3876
  /** Per-price-level fills, identical shape to primary fills. Empty for non-ok statuses. */
3852
3877
  fills: SmartRouteVenueFill[];
@@ -3913,6 +3938,14 @@ interface SmartRouteParams {
3913
3938
  * budget.
3914
3939
  */
3915
3940
  deepEstimate?: boolean;
3941
+ /** Referral: EVM address that receives the referral fee. Needs an app API key. */
3942
+ referrer?: string;
3943
+ /** Referral fee in bips of routed notional (1..10000). Snag-free. */
3944
+ referrerFeeBips?: number;
3945
+ /** Who funds the referral: "user" (default) reserves it from maxSpend; "app" pays from `referralPayerAddress` after the fill. */
3946
+ referralPayer?: "user" | "app";
3947
+ /** Required with `referralPayer: "app"`: the wallet that signs the parked payout transaction. */
3948
+ referralPayerAddress?: string;
3916
3949
  }
3917
3950
  /** One-time setup line item — populated only on deep-estimate quotes. */
3918
3951
  interface SmartRouteSetupCostLine {
@@ -3973,6 +4006,10 @@ interface SmartRouteFeeBreakdown {
3973
4006
  appFeeBips?: number;
3974
4007
  /** Category key the bips resolved against (e.g. "sports", or "all" for the fallback). */
3975
4008
  appFeeCategory?: string;
4009
+ /** The `executionGas` line when it is actually collected with the app fee. Present iff > 0; already inside `totalCost`. */
4010
+ gasReimbursement?: number;
4011
+ /** Referral fee the USER pays, in USD. Present iff > 0 and `referralPayer` is "user"; already inside `totalCostIncFees`. An app-paid referral never appears here. */
4012
+ referralFee?: number;
3976
4013
  }
3977
4014
  /** Response from GET /orderbook/:venueMarketOutcomeId/route. */
3978
4015
  interface SmartRouteSettlementLeg {
@@ -4081,6 +4118,14 @@ interface SmartRouteResponse {
4081
4118
  categoryKey: string;
4082
4119
  quotedAppFeeRaw: string;
4083
4120
  } | null;
4121
+ /** Referral snapshot; null/absent when no referrer was accepted. */
4122
+ referral?: {
4123
+ referrer: string;
4124
+ feeBips: number;
4125
+ payer: "user" | "app";
4126
+ payerAddress?: string;
4127
+ quotedFeeUsd: number;
4128
+ } | null;
4084
4129
  /** Populated only when status === "insufficient_position". */
4085
4130
  positionAvailability?: {
4086
4131
  totalSellableShares: number;
package/dist/index.js CHANGED
@@ -3315,6 +3315,10 @@ Issued At: ${issuedAt}`;
3315
3315
  if (params.tradeSide) query.side = params.tradeSide;
3316
3316
  if (params.mode) query.mode = params.mode;
3317
3317
  if (params.deepEstimate) query.deepEstimate = "true";
3318
+ if (params.referrer) query.referrer = params.referrer;
3319
+ if (params.referrerFeeBips != null) query.referrerFeeBips = String(params.referrerFeeBips);
3320
+ if (params.referralPayer) query.referralPayer = params.referralPayer;
3321
+ if (params.referralPayerAddress) query.referralPayerAddress = params.referralPayerAddress;
3318
3322
  const response = yield this.request(
3319
3323
  `/orderbook/${encodeURIComponent(venueMarketOutcomeId)}/route`,
3320
3324
  { query, signal: options == null ? void 0 : options.signal }
package/dist/index.mjs CHANGED
@@ -3183,6 +3183,10 @@ Issued At: ${issuedAt}`;
3183
3183
  if (params.tradeSide) query.side = params.tradeSide;
3184
3184
  if (params.mode) query.mode = params.mode;
3185
3185
  if (params.deepEstimate) query.deepEstimate = "true";
3186
+ if (params.referrer) query.referrer = params.referrer;
3187
+ if (params.referrerFeeBips != null) query.referrerFeeBips = String(params.referrerFeeBips);
3188
+ if (params.referralPayer) query.referralPayer = params.referralPayer;
3189
+ if (params.referralPayerAddress) query.referralPayerAddress = params.referralPayerAddress;
3186
3190
  const response = yield this.request(
3187
3191
  `/orderbook/${encodeURIComponent(venueMarketOutcomeId)}/route`,
3188
3192
  { query, signal: options == null ? void 0 : options.signal }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agg-build/sdk",
3
- "version": "4.17.1",
3
+ "version": "4.17.4",
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",