@agg-build/sdk 4.7.4 → 4.8.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/dist/index.d.mts CHANGED
@@ -2183,7 +2183,16 @@ type SignatureRequestType = "eip712" | "personal_sign"
2183
2183
  * and that is expected: reject it and the server falls back to asking the
2184
2184
  * user to broadcast a plain approve instead.
2185
2185
  */
2186
- | "eip7702_authorization";
2186
+ | "eip7702_authorization"
2187
+ /**
2188
+ * A Gnosis Safe transaction relayed through Polymarket — a legacy Polymarket
2189
+ * wallet funding a fill. The payload is the SafeTx as EIP-712 typed data,
2190
+ * but the wallet must `personal_sign` the RAW 32 bytes of
2191
+ * `hashTypedData(payload)` (`signMessage({ message: { raw: hash } })`):
2192
+ * Polymarket's relayer only accepts that shape. `payload.safeTxHash` carries
2193
+ * the digest for convenience; the server recomputes it from the typed data.
2194
+ */
2195
+ | "safe_tx";
2187
2196
  /** One payload the client must sign before a fill can proceed. */
2188
2197
  interface SignatureRequest {
2189
2198
  /** Echo this back with the signature. */
@@ -2207,6 +2216,10 @@ interface SignatureRequest {
2207
2216
  *
2208
2217
  * - `eip712` — `signTypedData` over `payload`.
2209
2218
  * - `personal_sign` — `personal_sign` over `payload`.
2219
+ * - `safe_tx` — `personal_sign` over the RAW 32 bytes of
2220
+ * `hashTypedData(payload)` (viem: `signMessage({ message: { raw: hash } })`,
2221
+ * MetaMask: `personal_sign` with the hex hash). The wallet shows a hash, not
2222
+ * a structured prompt — that is what Polymarket's own relayer requires.
2210
2223
  * - `hl_l1_action` — Hyperliquid L1 action, EIP-712 in phantom-agent form.
2211
2224
  * - `eip7702_authorization` — an EIP-7702 authorization over
2212
2225
  * `{ contractAddress, chainId, nonce }`. This is a signature over a RAW
@@ -3633,7 +3646,7 @@ interface SmartRouteAllocation {
3633
3646
  venue: string;
3634
3647
  amount: number;
3635
3648
  sourceTokenAddress?: string;
3636
- custodyKind?: "EOA" | "DEPOSIT_WALLET";
3649
+ custodyKind?: "EOA" | "DEPOSIT_WALLET" | "POLYMARKET_LEGACY";
3637
3650
  custodyAddress?: string;
3638
3651
  exactToken?: boolean;
3639
3652
  }
@@ -3656,6 +3669,13 @@ interface VenueSoloQuote {
3656
3669
  /** Why this venue cannot execute when quoteId is null (or execution is geo-gated). */
3657
3670
  unavailableReason?: string;
3658
3671
  venue: string;
3672
+ /**
3673
+ * The outcome this solo is bound to. `venue` alone is NOT unique — one venue
3674
+ * can list the same matched outcome more than once (e.g. two Hyperliquid
3675
+ * deployers listing the same game), producing two solo cards with the same
3676
+ * `venue`. Key on this alongside `venue` when identifying a card.
3677
+ */
3678
+ venueMarketOutcomeId?: string;
3659
3679
  avgPrice: number | null;
3660
3680
  filledQty: number;
3661
3681
  rawExecCost: number;
package/dist/index.d.ts CHANGED
@@ -2183,7 +2183,16 @@ type SignatureRequestType = "eip712" | "personal_sign"
2183
2183
  * and that is expected: reject it and the server falls back to asking the
2184
2184
  * user to broadcast a plain approve instead.
2185
2185
  */
2186
- | "eip7702_authorization";
2186
+ | "eip7702_authorization"
2187
+ /**
2188
+ * A Gnosis Safe transaction relayed through Polymarket — a legacy Polymarket
2189
+ * wallet funding a fill. The payload is the SafeTx as EIP-712 typed data,
2190
+ * but the wallet must `personal_sign` the RAW 32 bytes of
2191
+ * `hashTypedData(payload)` (`signMessage({ message: { raw: hash } })`):
2192
+ * Polymarket's relayer only accepts that shape. `payload.safeTxHash` carries
2193
+ * the digest for convenience; the server recomputes it from the typed data.
2194
+ */
2195
+ | "safe_tx";
2187
2196
  /** One payload the client must sign before a fill can proceed. */
2188
2197
  interface SignatureRequest {
2189
2198
  /** Echo this back with the signature. */
@@ -2207,6 +2216,10 @@ interface SignatureRequest {
2207
2216
  *
2208
2217
  * - `eip712` — `signTypedData` over `payload`.
2209
2218
  * - `personal_sign` — `personal_sign` over `payload`.
2219
+ * - `safe_tx` — `personal_sign` over the RAW 32 bytes of
2220
+ * `hashTypedData(payload)` (viem: `signMessage({ message: { raw: hash } })`,
2221
+ * MetaMask: `personal_sign` with the hex hash). The wallet shows a hash, not
2222
+ * a structured prompt — that is what Polymarket's own relayer requires.
2210
2223
  * - `hl_l1_action` — Hyperliquid L1 action, EIP-712 in phantom-agent form.
2211
2224
  * - `eip7702_authorization` — an EIP-7702 authorization over
2212
2225
  * `{ contractAddress, chainId, nonce }`. This is a signature over a RAW
@@ -3633,7 +3646,7 @@ interface SmartRouteAllocation {
3633
3646
  venue: string;
3634
3647
  amount: number;
3635
3648
  sourceTokenAddress?: string;
3636
- custodyKind?: "EOA" | "DEPOSIT_WALLET";
3649
+ custodyKind?: "EOA" | "DEPOSIT_WALLET" | "POLYMARKET_LEGACY";
3637
3650
  custodyAddress?: string;
3638
3651
  exactToken?: boolean;
3639
3652
  }
@@ -3656,6 +3669,13 @@ interface VenueSoloQuote {
3656
3669
  /** Why this venue cannot execute when quoteId is null (or execution is geo-gated). */
3657
3670
  unavailableReason?: string;
3658
3671
  venue: string;
3672
+ /**
3673
+ * The outcome this solo is bound to. `venue` alone is NOT unique — one venue
3674
+ * can list the same matched outcome more than once (e.g. two Hyperliquid
3675
+ * deployers listing the same game), producing two solo cards with the same
3676
+ * `venue`. Key on this alongside `venue` when identifying a card.
3677
+ */
3678
+ venueMarketOutcomeId?: string;
3659
3679
  avgPrice: number | null;
3660
3680
  filledQty: number;
3661
3681
  rawExecCost: number;
package/dist/index.js CHANGED
@@ -1901,6 +1901,8 @@ var COOKIE_REFRESH_DELIVERY = "cookie-refresh";
1901
1901
  var DEFAULT_MIDPOINT_IDS_PER_REQUEST = 75;
1902
1902
  var MAX_MIDPOINT_IDS_PER_REQUEST = 75;
1903
1903
  var MAX_SPORTS_EVENT_IDS_PER_REQUEST = 25;
1904
+ var MIN_POLL_INTERVAL_MS = 250;
1905
+ var MAX_POLL_INTERVAL_MS = 3e4;
1904
1906
  var isUserProfile = (user) => {
1905
1907
  return "accounts" in user && "wallets" in user && "avatarUrl" in user;
1906
1908
  };
@@ -3361,13 +3363,18 @@ Issued At: ${issuedAt}`;
3361
3363
  let pending = (_a = first.pendingSignatures) != null ? _a : [];
3362
3364
  let lastKey = "";
3363
3365
  const deadline = Date.now() + SELF_CUSTODY_FILL_TIMEOUT_MS;
3366
+ let nextPollMs = MIN_POLL_INTERVAL_MS;
3364
3367
  for (; ; ) {
3365
3368
  if (Date.now() > deadline) {
3366
3369
  throw new Error(`Fill for quote ${quoteId} did not finish within the timeout.`);
3367
3370
  }
3368
3371
  if (pending.length === 0) {
3369
- yield new Promise((r) => setTimeout(r, SELF_CUSTODY_POLL_INTERVAL_MS));
3372
+ yield new Promise((r) => setTimeout(r, nextPollMs));
3370
3373
  const polled = yield this.getExecutionStatus({ quoteId });
3374
+ nextPollMs = Number.isFinite(polled.pollAfterMs) ? Math.min(
3375
+ Math.max(polled.pollAfterMs, MIN_POLL_INTERVAL_MS),
3376
+ MAX_POLL_INTERVAL_MS
3377
+ ) : SELF_CUSTODY_POLL_INTERVAL_MS;
3371
3378
  if (TERMINAL_EXECUTION_STATES.has(polled.overallState)) {
3372
3379
  if (polled.overallState !== "filled" && polled.overallState !== "partially_filled") {
3373
3380
  throw new Error(`Fill for quote ${quoteId} ended as ${polled.overallState}.`);
package/dist/index.mjs CHANGED
@@ -1769,6 +1769,8 @@ var COOKIE_REFRESH_DELIVERY = "cookie-refresh";
1769
1769
  var DEFAULT_MIDPOINT_IDS_PER_REQUEST = 75;
1770
1770
  var MAX_MIDPOINT_IDS_PER_REQUEST = 75;
1771
1771
  var MAX_SPORTS_EVENT_IDS_PER_REQUEST = 25;
1772
+ var MIN_POLL_INTERVAL_MS = 250;
1773
+ var MAX_POLL_INTERVAL_MS = 3e4;
1772
1774
  var isUserProfile = (user) => {
1773
1775
  return "accounts" in user && "wallets" in user && "avatarUrl" in user;
1774
1776
  };
@@ -3229,13 +3231,18 @@ Issued At: ${issuedAt}`;
3229
3231
  let pending = (_a = first.pendingSignatures) != null ? _a : [];
3230
3232
  let lastKey = "";
3231
3233
  const deadline = Date.now() + SELF_CUSTODY_FILL_TIMEOUT_MS;
3234
+ let nextPollMs = MIN_POLL_INTERVAL_MS;
3232
3235
  for (; ; ) {
3233
3236
  if (Date.now() > deadline) {
3234
3237
  throw new Error(`Fill for quote ${quoteId} did not finish within the timeout.`);
3235
3238
  }
3236
3239
  if (pending.length === 0) {
3237
- yield new Promise((r) => setTimeout(r, SELF_CUSTODY_POLL_INTERVAL_MS));
3240
+ yield new Promise((r) => setTimeout(r, nextPollMs));
3238
3241
  const polled = yield this.getExecutionStatus({ quoteId });
3242
+ nextPollMs = Number.isFinite(polled.pollAfterMs) ? Math.min(
3243
+ Math.max(polled.pollAfterMs, MIN_POLL_INTERVAL_MS),
3244
+ MAX_POLL_INTERVAL_MS
3245
+ ) : SELF_CUSTODY_POLL_INTERVAL_MS;
3239
3246
  if (TERMINAL_EXECUTION_STATES.has(polled.overallState)) {
3240
3247
  if (polled.overallState !== "filled" && polled.overallState !== "partially_filled") {
3241
3248
  throw new Error(`Fill for quote ${quoteId} ended as ${polled.overallState}.`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agg-build/sdk",
3
- "version": "4.7.4",
3
+ "version": "4.8.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",