@0xmonaco/types 1.0.58 → 1.0.59

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.
@@ -585,8 +585,21 @@ export interface paths {
585
585
  * @description Create authentication challenge.
586
586
  *
587
587
  * Generate a cryptographic challenge (nonce) for wallet-based authentication.
588
- * The user must sign the returned message with their private key to prove
589
- * ownership of the wallet.
588
+ * The wallet must authorize the returned message to prove control of the
589
+ * address. An EOA does that by signing it with its private key. A
590
+ * smart-contract wallet has no private key and instead produces a signature
591
+ * its own contract will accept, which Monaco checks under EIP-1271 — see
592
+ * Verify.
593
+ *
594
+ * The challenge is single-use and binds the session public key supplied here,
595
+ * so it authorizes exactly one keypair, once. The lifetime is 5 minutes, or
596
+ * 30 minutes for EVERY address while contract-signature login is enabled on
597
+ * the deployment — a multisig must collect owner approvals before it can
598
+ * answer, and the window is uniform rather than eligibility-specific so this
599
+ * unauthenticated endpoint cannot be used to probe which addresses hold a
600
+ * BuilderCodes payout bucket. Widening it is cheap: a longer window is a
601
+ * longer-lived offer to authorize one predetermined keypair once, never a
602
+ * longer-lived credential.
590
603
  */
591
604
  post: operations["create_challenge"];
592
605
  delete?: never;
@@ -659,6 +672,30 @@ export interface paths {
659
672
  * Verify the signed challenge message and create an authenticated session.
660
673
  * Binds the caller-provided ed25519 session public key to the new session;
661
674
  * subsequent requests are signed with the matching private key.
675
+ *
676
+ * How the signature is checked depends on the address. Almost every address
677
+ * is verified by recovering the signing key, exactly as before. EIP-1271
678
+ * verification applies only to an address that is BOTH eligible for
679
+ * contract-signature login AND has contract code deployed on chain: an
680
+ * eligible payout wallet that is an ordinary EOA is still verified by
681
+ * recovery. The two are mutually exclusive, and the request is identical
682
+ * either way — `signature` carries whatever the wallet produced, and no
683
+ * field changes. The one bound is length: a contract signature over 8192
684
+ * decoded bytes is refused as invalid rather than forwarded to the chain,
685
+ * which is far above any realistic owner set.
686
+ *
687
+ * Because deciding that requires reading the chain, this adds one
688
+ * client-visible outcome the recovery path does not have: UNAVAILABLE (REST
689
+ * 503). It is retryable and is NOT a verdict on the signature. It covers
690
+ * three cases, and an eligible address can see any of them even when it turns
691
+ * out to be an EOA, because the code lookup happens first: the chain did not
692
+ * answer, it did not answer within the deadline, or the server declined to
693
+ * ask because its own concurrent-verification capacity was full. That last
694
+ * one is local saturation rather than a chain fault, so an operator
695
+ * diagnosing it should check this service before the RPC endpoint.
696
+ *
697
+ * A rejected signature is 401, and so is a contract that rejects by
698
+ * REVERTING: that is the wallet answering "no", not a failure to ask.
662
699
  */
663
700
  post: operations["verify_signature"];
664
701
  delete?: never;
@@ -667,6 +704,180 @@ export interface paths {
667
704
  patch?: never;
668
705
  trace?: never;
669
706
  };
707
+ "/api/v1/buildercodes/config": {
708
+ parameters: {
709
+ query?: never;
710
+ header?: never;
711
+ path?: never;
712
+ cookie?: never;
713
+ };
714
+ /**
715
+ * Get your BuilderCodes program configuration
716
+ * @description Read this application's BuilderCodes program state.
717
+ *
718
+ * The application is taken from the authenticated session; there is no
719
+ * application id in the request. The caller must be the application's
720
+ * configured payout wallet. This method is gated by `buildercodes_enabled`
721
+ * like the rest of the service.
722
+ */
723
+ get: operations["get_buildercodes_config"];
724
+ put?: never;
725
+ post?: never;
726
+ delete?: never;
727
+ options?: never;
728
+ head?: never;
729
+ patch?: never;
730
+ trace?: never;
731
+ };
732
+ "/api/v1/buildercodes/payouts": {
733
+ parameters: {
734
+ query?: never;
735
+ header?: never;
736
+ path?: never;
737
+ cookie?: never;
738
+ };
739
+ /**
740
+ * List your per-trade BuilderCodes earnings
741
+ * @description List this application's per-trade BuilderCodes earnings.
742
+ *
743
+ * Newest credits are returned first. The application is taken from the
744
+ * authenticated session and cannot be selected by the caller.
745
+ */
746
+ get: operations["list_buildercode_payouts"];
747
+ put?: never;
748
+ post?: never;
749
+ delete?: never;
750
+ options?: never;
751
+ head?: never;
752
+ patch?: never;
753
+ trace?: never;
754
+ };
755
+ "/api/v1/buildercodes/payouts/summary": {
756
+ parameters: {
757
+ query?: never;
758
+ header?: never;
759
+ path?: never;
760
+ cookie?: never;
761
+ };
762
+ /**
763
+ * Summarize your BuilderCodes earnings
764
+ * @description Summarize this application's BuilderCodes earnings by token.
765
+ *
766
+ * Amounts stay separated by token because they are RAW atomic units. The
767
+ * application is taken from the authenticated session.
768
+ */
769
+ get: operations["get_buildercode_payout_summary"];
770
+ put?: never;
771
+ post?: never;
772
+ delete?: never;
773
+ options?: never;
774
+ head?: never;
775
+ patch?: never;
776
+ trace?: never;
777
+ };
778
+ "/api/v1/buildercodes/rewards/balance": {
779
+ parameters: {
780
+ query?: never;
781
+ header?: never;
782
+ path?: never;
783
+ cookie?: never;
784
+ };
785
+ /**
786
+ * Get your accrued BuilderCodes balance
787
+ * @description Read the caller's accrued BuilderCodes reward-bucket balances.
788
+ *
789
+ * The bucket is derived from the authenticated wallet under the reserved
790
+ * BuilderCodes application. Current enrollment is not required, so a former
791
+ * payout wallet can still inspect and claim what it accrued. Returns an empty
792
+ * list when no payout bucket or non-zero balance exists.
793
+ */
794
+ get: operations["get_buildercode_rewards_balance"];
795
+ put?: never;
796
+ post?: never;
797
+ delete?: never;
798
+ options?: never;
799
+ head?: never;
800
+ patch?: never;
801
+ trace?: never;
802
+ };
803
+ "/api/v1/buildercodes/rewards/claim": {
804
+ parameters: {
805
+ query?: never;
806
+ header?: never;
807
+ path?: never;
808
+ cookie?: never;
809
+ };
810
+ get?: never;
811
+ put?: never;
812
+ /**
813
+ * Claim accrued BuilderCodes payout balance
814
+ * @description Claim accrued BuilderCodes payout balance.
815
+ *
816
+ * Move accrued BuilderCodes payout balance from your reserved payout bucket
817
+ * into a trading balance under the authenticated application, making it
818
+ * withdrawable through the ordinary withdrawal flow. Ledger-only (one shared
819
+ * vault + one backend ledger) — no on-chain transaction and no gas.
820
+ *
821
+ * The bucket is resolved from the AUTHENTICATED caller's own wallet address,
822
+ * never from the request body, so a caller can only ever claim their own
823
+ * accrued balance. A wallet that has never been an enrolled frontend's payout
824
+ * address simply has an empty bucket. A wallet that USED to be a payout
825
+ * address keeps whatever it accrued back then and can still claim it —
826
+ * payout-address changes are not retroactive, so current enrollment is
827
+ * deliberately not required.
828
+ *
829
+ * The payout wallet may be an EOA or a smart-contract wallet. An EOA answers
830
+ * Monaco's signature challenge directly. A contract wallet — a multisig such
831
+ * as a Safe — holds no private key and cannot, so it authenticates by EIP-1271
832
+ * contract signature instead: Monaco asks the wallet contract whether it
833
+ * accepts the challenge. That path is deliberately narrow. It is offered only
834
+ * to a wallet that holds a BuilderCodes payout bucket, only while the
835
+ * `contract_wallet_auth_enabled` flag is on, and only where the deployment has
836
+ * a chain RPC endpoint configured. While any of those is not met, login is
837
+ * EOA-only and a contract payout wallet can neither call this endpoint nor
838
+ * withdraw afterwards, so its accrued share stays unclaimable.
839
+ *
840
+ * Delegated-agent sessions are refused: a delegated grant conveys only
841
+ * order-management authority, and this claim converts reserved balance into a
842
+ * tradeable one. The refusal happens before the feature check, so a delegated
843
+ * caller is refused whether or not BuilderCodes is enabled.
844
+ *
845
+ * Transport contracts differ, and this comment is emitted into the generated
846
+ * gRPC SDK where HTTP statuses do not exist. An insufficient payout balance
847
+ * is **HTTP 409** on REST and **FAILED_PRECONDITION** on gRPC; a refused
848
+ * caller (delegated session, or BuilderCodes disabled) is **HTTP 403** on
849
+ * REST and **PERMISSION_DENIED** on gRPC.
850
+ *
851
+ * A claim can also fail as **HTTP 503** / **UNAVAILABLE** when the matching
852
+ * engine is unreachable, restarting, or slow to answer. Treat that as an
853
+ * UNKNOWN outcome, NOT a rejection. The request is admitted to the sequencer
854
+ * before its reply is sent, so a claim that timed out in transit may still
855
+ * commit, and there is no idempotency key — a blind retry can claim a SECOND
856
+ * time. Do NOT retry automatically, and do not settle it with a balance
857
+ * read: an admitted claim can still be sitting in the sequencer queue when
858
+ * the balance is read, so an unchanged balance does not prove the claim will
859
+ * not commit. Treat the claim as PENDING rather than failed, re-check once
860
+ * the engine is healthy again, and reconcile before issuing another claim.
861
+ *
862
+ * Not every 503 is ambiguous, and the safe ones are tagged. TWO outcomes are
863
+ * refused BEFORE the claim can be admitted to the sequencer, so they left no
864
+ * durable-log or state footprint and definitely committed nothing. One is a
865
+ * deliberate maintenance block, where REST carries
866
+ * `"error": "OPERATIONS_BLOCKED"` and gRPC tags the status with
867
+ * `x-maintenance-blocked: true`. The other is a sequencer admission rejection
868
+ * when the engine is saturated, where REST carries `"code": "OVERLOADED"` and
869
+ * gRPC carries the same code in the status' error details. Both are safe to
870
+ * retry with backoff, and an overload positively wants one. Only an UNTAGGED
871
+ * availability failure — matching-engine transport, timeout and fail-closed
872
+ * paths — carries the unknown outcome.
873
+ */
874
+ post: operations["claim_buildercode_rewards"];
875
+ delete?: never;
876
+ options?: never;
877
+ head?: never;
878
+ patch?: never;
879
+ trace?: never;
880
+ };
670
881
  "/api/v1/delegated-agents": {
671
882
  parameters: {
672
883
  query?: never;
@@ -3042,6 +3253,73 @@ export interface components {
3042
3253
  matchResult?: components["schemas"]["MatchResult"];
3043
3254
  error?: components["schemas"]["BatchReplaceError"];
3044
3255
  };
3256
+ BuildercodePayout: {
3257
+ /**
3258
+ * Format: uuid
3259
+ * @description Trade that generated this credit.
3260
+ */
3261
+ tradeId?: string | null;
3262
+ /**
3263
+ * @description Application payout address at credit time.
3264
+ * @example 0x0000000000000000000000000000000000000001
3265
+ */
3266
+ payoutAddress?: string | null;
3267
+ /**
3268
+ * @description Credit token contract address.
3269
+ * @example 0x0000000000000000000000000000000000000002
3270
+ */
3271
+ token?: string | null;
3272
+ /**
3273
+ * @description Credited amount in RAW atomic units of the token.
3274
+ * @example 1000000
3275
+ */
3276
+ amount?: string | null;
3277
+ /**
3278
+ * Format: int32
3279
+ * @description Realized whole-basis-point rate for this credit after the Monaco-floor clamp, computed from the credited amount divided by the gross protocol take and truncated down. This can be lower than the configured BuilderCodes budget.
3280
+ * @example 1000
3281
+ */
3282
+ appliedBps?: number | null;
3283
+ /**
3284
+ * Format: date-time
3285
+ * @description RFC 3339 credit timestamp.
3286
+ */
3287
+ createdAt?: string | null;
3288
+ };
3289
+ BuildercodePayoutTokenTotal: {
3290
+ /**
3291
+ * @description Credit token contract address.
3292
+ * @example 0x0000000000000000000000000000000000000002
3293
+ */
3294
+ token?: string | null;
3295
+ /**
3296
+ * @description Summed credits in RAW atomic units of this token.
3297
+ * @example 5000000
3298
+ */
3299
+ totalAmount?: string | null;
3300
+ /**
3301
+ * Format: int64
3302
+ * @description Number of credits included in this token total.
3303
+ */
3304
+ payoutCount?: number | null;
3305
+ /**
3306
+ * Format: date-time
3307
+ * @description RFC 3339 timestamp of this token's newest credit.
3308
+ */
3309
+ lastCreditedAt?: string | null;
3310
+ };
3311
+ BuildercodeRewardsBalance: {
3312
+ /**
3313
+ * @description Reward token contract address.
3314
+ * @example 0x0000000000000000000000000000000000000002
3315
+ */
3316
+ token?: string | null;
3317
+ /**
3318
+ * @description Available BuilderCodes reward balance in RAW atomic units.
3319
+ * @example 1200000
3320
+ */
3321
+ available?: string | null;
3322
+ };
3045
3323
  CancelConditionalOrderResponse: {
3046
3324
  /**
3047
3325
  * Format: uuid
@@ -3217,6 +3495,30 @@ export interface components {
3217
3495
  */
3218
3496
  reason?: string | null;
3219
3497
  };
3498
+ ClaimBuildercodeRewardsRequest: {
3499
+ /**
3500
+ * @description Payout token contract address (0x-prefixed) to claim. BuilderCodes shares accrue in the quote token of the traded pair.
3501
+ * @example 0x0000000000000000000000000000000000000002
3502
+ */
3503
+ token: string;
3504
+ /**
3505
+ * @description Amount to claim, in RAW atomic units of the token. Must be positive and no greater than the accrued payout balance.
3506
+ * @example 1000000
3507
+ */
3508
+ amount: string;
3509
+ };
3510
+ ClaimBuildercodeRewardsResponse: {
3511
+ /**
3512
+ * @description Your BuilderCodes payout-bucket balance after the claim, RAW atomic units.
3513
+ * @example 0
3514
+ */
3515
+ payoutBalance?: string | null;
3516
+ /**
3517
+ * @description Your trading balance for the token after the claim, RAW atomic units.
3518
+ * @example 1000000
3519
+ */
3520
+ tradingBalance?: string | null;
3521
+ };
3220
3522
  ClosePositionRequest: {
3221
3523
  quantity?: string | null;
3222
3524
  closeType?: string | null;
@@ -4061,6 +4363,46 @@ export interface components {
4061
4363
  */
4062
4364
  totalPages?: number | null;
4063
4365
  };
4366
+ GetBuildercodePayoutSummaryResponse: {
4367
+ /**
4368
+ * Format: int64
4369
+ * @description Total credit count across every token.
4370
+ */
4371
+ totalPayouts?: number | null;
4372
+ /**
4373
+ * Format: date-time
4374
+ * @description RFC 3339 timestamp of the newest credit, or null when none exists.
4375
+ */
4376
+ lastCreditedAt?: string | null;
4377
+ /** @description Per-token earnings totals. Empty when this application has no payouts. */
4378
+ byToken?: components["schemas"]["BuildercodePayoutTokenTotal"][] | null;
4379
+ };
4380
+ GetBuildercodeRewardsBalanceResponse: {
4381
+ /** @description One entry per reward token with a non-zero available balance. */
4382
+ balances?: components["schemas"]["BuildercodeRewardsBalance"][] | null;
4383
+ };
4384
+ GetBuildercodesConfigResponse: {
4385
+ /**
4386
+ * Format: uuid
4387
+ * @description Application id derived from the authenticated session.
4388
+ */
4389
+ applicationId?: string | null;
4390
+ /** @description Whether this application is currently enrolled in BuilderCodes. */
4391
+ enrolled?: boolean | null;
4392
+ /**
4393
+ * @description Current lowercase-normalized payout address, or null when none is configured.
4394
+ * @example 0x0000000000000000000000000000000000000001
4395
+ */
4396
+ payoutAddress?: string | null;
4397
+ /** @description Current BuilderCodes feature-flag state. Successful responses are true because this endpoint is gated by the flag. */
4398
+ buildercodesEnabled?: boolean | null;
4399
+ /**
4400
+ * Format: uint32
4401
+ * @description Target BuilderCodes share in basis points, computed from the fill's gross non-negative Monaco protocol take and capped by the remainder after Monaco's floor.
4402
+ * @example 1000
4403
+ */
4404
+ buildercodesBudgetBps?: number | null;
4405
+ };
4064
4406
  /** @description OHLCV candlestick data. */
4065
4407
  GetCandlesResponse: {
4066
4408
  candles?: components["schemas"]["Candle"][] | null;
@@ -4979,6 +5321,30 @@ export interface components {
4979
5321
  */
4980
5322
  liquidationPrice?: string | null;
4981
5323
  status?: string | null;
5324
+ /**
5325
+ * @description RFC 3339 instant at which this position was last MUTATED — a fill,
5326
+ * collateral transfer, funding settlement or close — as the producer that
5327
+ * owns the position recorded it. It is NOT the instant the response was
5328
+ * built: polling an unchanged position returns the same value, and an oracle
5329
+ * reprice does not move it. For an OPEN position every surface reports the
5330
+ * same instant — the list, the detail read, the risk read, the WebSocket
5331
+ * positions snapshot, and the live position_update frames.
5332
+ *
5333
+ * Two cases come from the persistence clock instead and differ from the
5334
+ * matching engine's by the persistence lag: a TERMINAL row (the live
5335
+ * position_update frame carries the engine's close instant, this field
5336
+ * carries the stored one), and any position read after a matching-engine
5337
+ * restart. Accurate to that lag, not to the microsecond.
5338
+ *
5339
+ * A third case is not lag-bounded: an OPEN row read while the matching
5340
+ * engine is unreachable falls back to the row's own lifecycle columns
5341
+ * (close, then last funding, then open), so a position filled repeatedly
5342
+ * since it opened reports its opening instant until funding settles. The
5343
+ * live position_update frame is unaffected.
5344
+ *
5345
+ * Display metadata. `version` is the reconciliation key; ordering position
5346
+ * state by this field is never correct.
5347
+ */
4982
5348
  updatedAt?: string | null;
4983
5349
  riskBucketId?: string | null;
4984
5350
  marginMode?: string | null;
@@ -5030,6 +5396,12 @@ export interface components {
5030
5396
  * partial.
5031
5397
  */
5032
5398
  cumFees?: string | null;
5399
+ /**
5400
+ * Format: int64
5401
+ * @description Opaque, non-negative producer-owned version for this position row. Compare only within the same position; higher is newer. 0 is the unranked legacy sentinel and never participates in ordering: treat it exactly as an absent version and fall back to a full field comparison rather than ranking it as oldest. It advances on sequenced position mutations (open, add, reduce, close, funding, margin transfer, liquidation, ADL) and is shared by the persisted read, the WebSocket positions snapshot and a RANKED live position_update frame. A live frame is ranked only when it is a faithful projection of the row persisted at that sequence: in practice the fills that leave a position open. Frames that re-read live risk state after sequencing (funding, margin_added/margin_reduced) and terminal frames (which report size 0 and LIQUIDATED, while the stored row keeps its size and records CLOSED) omit the version even though the mutation did advance the persisted one, so an absent version never implies that nothing was persisted. mark_price, unrealized_pnl, liquidation_price, leverage, maintenance_margin_required and initial_margin_required are UNVERSIONED valuation fields, re-derived per payload rather than served from the versioned row: the version does not advance for them (five move with the oracle mark; leverage does not, being opening notional over posted margin, but the live surfaces derive it while the persisted row serves its stored column, so it can still disagree at an unchanged version) (a valuation-only oracle tick persists nothing; a state-transitioning one, a breach or recovery, does restamp the account's open positions), so the merge rule is per field group — on an equal version skip the versioned fields but still take all six from the newer payload, because discarding a whole payload on an equal version freezes displayed PnL and can leave a stale margin requirement on screen. isolated_margin is the one exception among the versioned fields: the WebSocket positions snapshot overlays it from an independent live matching-engine read rather than the versioned row, so take it from the newest payload on an equal version too or a consumer can retain stale backing. A response served from live matching-engine state reports 0 (unranked): the engine holds the state but not the version.
5402
+ * @example 918342
5403
+ */
5404
+ version?: number | null;
5033
5405
  };
5034
5406
  GetPositionRiskResponse: {
5035
5407
  positionId?: string | null;
@@ -5066,6 +5438,30 @@ export interface components {
5066
5438
  * position has no open exposure.
5067
5439
  */
5068
5440
  initialMarginRequired?: string | null;
5441
+ /**
5442
+ * @description RFC 3339 instant at which this position was last MUTATED — a fill,
5443
+ * collateral transfer, funding settlement or close — as the producer that
5444
+ * owns the position recorded it. It is NOT the instant the response was
5445
+ * built: polling an unchanged position returns the same value, and an oracle
5446
+ * reprice does not move it. For an OPEN position every surface reports the
5447
+ * same instant — the list, the detail read, the risk read, the WebSocket
5448
+ * positions snapshot, and the live position_update frames.
5449
+ *
5450
+ * Two cases come from the persistence clock instead and differ from the
5451
+ * matching engine's by the persistence lag: a TERMINAL row (the live
5452
+ * position_update frame carries the engine's close instant, this field
5453
+ * carries the stored one), and any position read after a matching-engine
5454
+ * restart. Accurate to that lag, not to the microsecond.
5455
+ *
5456
+ * A third case is not lag-bounded: an OPEN row read while the matching
5457
+ * engine is unreachable falls back to the row's own lifecycle columns
5458
+ * (close, then last funding, then open), so a position filled repeatedly
5459
+ * since it opened reports its opening instant until funding settles. The
5460
+ * live position_update frame is unaffected.
5461
+ *
5462
+ * Display metadata. `version` is the reconciliation key; ordering position
5463
+ * state by this field is never correct.
5464
+ */
5069
5465
  updatedAt?: string | null;
5070
5466
  };
5071
5467
  GetProfileResponse: {
@@ -5623,6 +6019,30 @@ export interface components {
5623
6019
  */
5624
6020
  totalPages?: number | null;
5625
6021
  };
6022
+ ListBuildercodePayoutsResponse: {
6023
+ /** @description Per-trade credits, newest first. */
6024
+ payouts?: components["schemas"]["BuildercodePayout"][] | null;
6025
+ /**
6026
+ * Format: uint32
6027
+ * @description Total payout rows for this application.
6028
+ */
6029
+ total?: number | null;
6030
+ /**
6031
+ * Format: uint32
6032
+ * @description Current page number.
6033
+ */
6034
+ page?: number | null;
6035
+ /**
6036
+ * Format: uint32
6037
+ * @description Items per page.
6038
+ */
6039
+ pageSize?: number | null;
6040
+ /**
6041
+ * Format: uint32
6042
+ * @description Total number of pages.
6043
+ */
6044
+ totalPages?: number | null;
6045
+ };
5626
6046
  ListConditionalOrdersResponse: {
5627
6047
  orders?: components["schemas"]["ConditionalOrder"][] | null;
5628
6048
  /** Format: uint32 */
@@ -6457,6 +6877,30 @@ export interface components {
6457
6877
  */
6458
6878
  liquidationPrice?: string | null;
6459
6879
  status?: string | null;
6880
+ /**
6881
+ * @description RFC 3339 instant at which this position was last MUTATED — a fill,
6882
+ * collateral transfer, funding settlement or close — as the producer that
6883
+ * owns the position recorded it. It is NOT the instant the response was
6884
+ * built: polling an unchanged position returns the same value, and an oracle
6885
+ * reprice does not move it. For an OPEN position every surface reports the
6886
+ * same instant — the list, the detail read, the risk read, the WebSocket
6887
+ * positions snapshot, and the live position_update frames.
6888
+ *
6889
+ * Two cases come from the persistence clock instead and differ from the
6890
+ * matching engine's by the persistence lag: a TERMINAL row (the live
6891
+ * position_update frame carries the engine's close instant, this field
6892
+ * carries the stored one), and any position read after a matching-engine
6893
+ * restart. Accurate to that lag, not to the microsecond.
6894
+ *
6895
+ * A third case is not lag-bounded: an OPEN row read while the matching
6896
+ * engine is unreachable falls back to the row's own lifecycle columns
6897
+ * (close, then last funding, then open), so a position filled repeatedly
6898
+ * since it opened reports its opening instant until funding settles. The
6899
+ * live position_update frame is unaffected.
6900
+ *
6901
+ * Display metadata. `version` is the reconciliation key; ordering position
6902
+ * state by this field is never correct.
6903
+ */
6460
6904
  updatedAt?: string | null;
6461
6905
  riskBucketId?: string | null;
6462
6906
  marginMode?: string | null;
@@ -6508,6 +6952,12 @@ export interface components {
6508
6952
  * partial.
6509
6953
  */
6510
6954
  cumFees?: string | null;
6955
+ /**
6956
+ * Format: int64
6957
+ * @description Opaque, non-negative producer-owned version for this position row. Compare only within the same position; higher is newer. 0 is the unranked legacy sentinel and never participates in ordering: it means the row predates this field or came from a producer that does not stamp it, so treat it exactly as an absent version and fall back to a full field comparison rather than ranking it as oldest. It advances on sequenced position mutations (open, add, reduce, close, funding, margin transfer, liquidation, ADL) and is shared by the persisted read, the WebSocket positions snapshot and a RANKED live position_update frame. A live frame is ranked only when it is a faithful projection of the row persisted at that sequence: in practice the fills that leave a position open. Frames that re-read live risk state after sequencing (funding, margin_added/margin_reduced) and terminal frames (which report size 0 and LIQUIDATED, while the stored row keeps its size and records CLOSED) omit the version even though the mutation did advance the persisted one, so an absent version never implies that nothing was persisted. mark_price, unrealized_pnl, liquidation_price, leverage, maintenance_margin_required and initial_margin_required are UNVERSIONED valuation fields, re-derived per payload rather than served from the versioned row: the version does not advance for them (five move with the oracle mark; leverage does not, being opening notional over posted margin, but the live surfaces derive it while the persisted row serves its stored column, so it can still disagree at an unchanged version) (a valuation-only oracle tick persists nothing; a state-transitioning one, a breach or recovery, does restamp the account's open positions), so the merge rule is per field group — on an equal version skip the versioned fields but still take all six from the newer payload, because discarding a whole payload on an equal version freezes displayed PnL and can leave a stale margin requirement on screen. isolated_margin is the one exception among the versioned fields: the WebSocket positions snapshot overlays it from an independent live matching-engine read rather than the versioned row, so take it from the newest payload on an equal version too or a consumer can retain stale backing. A response served from live matching-engine state reports 0 (unranked): the engine holds the state but not the version.
6958
+ * @example 918342
6959
+ */
6960
+ version?: number | null;
6511
6961
  };
6512
6962
  PositionHistoryEvent: {
6513
6963
  id?: string | null;
@@ -8052,7 +8502,7 @@ export interface components {
8052
8502
  */
8053
8503
  address: string;
8054
8504
  /**
8055
- * @description Wallet signature over the challenge message
8505
+ * @description Wallet authorization of the challenge message, hex with an optional 0x prefix. An EOA sends a 65-byte EIP-191 signature; a contract wallet verified under EIP-1271 sends whatever its own contract accepts, which is usually longer and need not be 65 bytes. Capped at 8192 decoded bytes (16386 characters with the prefix) — enough for well over a hundred owner slots — and a longer value is rejected as an invalid signature rather than forwarded to the chain.
8056
8506
  * @example 0x1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0a1b2c3d4e5f6a7b8c9d0e1f2a3b4c5d6e7f8a9b0c1d2e3f4a5b6c7d8e9f0
8057
8507
  */
8058
8508
  signature: string;
@@ -9618,6 +10068,13 @@ export interface operations {
9618
10068
  };
9619
10069
  content?: never;
9620
10070
  };
10071
+ /** @description Authentication rate limit exceeded — challenge and verify share one per-client-address budget (60 requests/min sustained, burst 120); retry after the interval in details.retryAfter */
10072
+ 429: {
10073
+ headers: {
10074
+ [name: string]: unknown;
10075
+ };
10076
+ content?: never;
10077
+ };
9621
10078
  /** @description Internal server error */
9622
10079
  500: {
9623
10080
  headers: {
@@ -9774,6 +10231,13 @@ export interface operations {
9774
10231
  };
9775
10232
  content?: never;
9776
10233
  };
10234
+ /** @description Authentication rate limit exceeded — challenge and verify share one per-client-address budget (60 requests/min sustained, burst 120), checked before the signature; retry after the interval in details.retryAfter */
10235
+ 429: {
10236
+ headers: {
10237
+ [name: string]: unknown;
10238
+ };
10239
+ content?: never;
10240
+ };
9777
10241
  /** @description Internal server error */
9778
10242
  500: {
9779
10243
  headers: {
@@ -9781,6 +10245,276 @@ export interface operations {
9781
10245
  };
9782
10246
  content?: never;
9783
10247
  };
10248
+ /** @description Contract-wallet (EIP-1271) verification could not be completed for an eligible address: the chain did not answer, did not answer within the deadline, or the server was at its concurrent-verification capacity and declined to ask. Retryable, and not a verdict on the signature. */
10249
+ 503: {
10250
+ headers: {
10251
+ [name: string]: unknown;
10252
+ };
10253
+ content?: never;
10254
+ };
10255
+ };
10256
+ };
10257
+ get_buildercodes_config: {
10258
+ parameters: {
10259
+ query?: never;
10260
+ header?: never;
10261
+ path?: never;
10262
+ cookie?: never;
10263
+ };
10264
+ requestBody?: never;
10265
+ responses: {
10266
+ /** @description OK */
10267
+ 200: {
10268
+ headers: {
10269
+ [name: string]: unknown;
10270
+ };
10271
+ content: {
10272
+ "application/json": components["schemas"]["GetBuildercodesConfigResponse"];
10273
+ };
10274
+ };
10275
+ /** @description Authentication required */
10276
+ 401: {
10277
+ headers: {
10278
+ [name: string]: unknown;
10279
+ };
10280
+ content?: never;
10281
+ };
10282
+ /** @description Refused: BuilderCodes is disabled, the caller is delegated, or the caller is not this application's payout wallet (gRPC: PERMISSION_DENIED) */
10283
+ 403: {
10284
+ headers: {
10285
+ [name: string]: unknown;
10286
+ };
10287
+ content?: never;
10288
+ };
10289
+ /** @description Authenticated application not found (gRPC: NOT_FOUND) */
10290
+ 404: {
10291
+ headers: {
10292
+ [name: string]: unknown;
10293
+ };
10294
+ content?: never;
10295
+ };
10296
+ /** @description Internal server error */
10297
+ 500: {
10298
+ headers: {
10299
+ [name: string]: unknown;
10300
+ };
10301
+ content?: never;
10302
+ };
10303
+ };
10304
+ };
10305
+ list_buildercode_payouts: {
10306
+ parameters: {
10307
+ query?: {
10308
+ /** @description Page number (1-indexed) */
10309
+ page?: number;
10310
+ /** @description Items per page (max 100) */
10311
+ pageSize?: number;
10312
+ };
10313
+ header?: never;
10314
+ path?: never;
10315
+ cookie?: never;
10316
+ };
10317
+ requestBody?: never;
10318
+ responses: {
10319
+ /** @description OK */
10320
+ 200: {
10321
+ headers: {
10322
+ [name: string]: unknown;
10323
+ };
10324
+ content: {
10325
+ "application/json": components["schemas"]["ListBuildercodePayoutsResponse"];
10326
+ };
10327
+ };
10328
+ /** @description Invalid pagination */
10329
+ 400: {
10330
+ headers: {
10331
+ [name: string]: unknown;
10332
+ };
10333
+ content?: never;
10334
+ };
10335
+ /** @description Authentication required */
10336
+ 401: {
10337
+ headers: {
10338
+ [name: string]: unknown;
10339
+ };
10340
+ content?: never;
10341
+ };
10342
+ /** @description Refused: BuilderCodes is disabled, the caller is delegated, or the caller is not this application's payout wallet (gRPC: PERMISSION_DENIED) */
10343
+ 403: {
10344
+ headers: {
10345
+ [name: string]: unknown;
10346
+ };
10347
+ content?: never;
10348
+ };
10349
+ /** @description Authenticated application not found (gRPC: NOT_FOUND) */
10350
+ 404: {
10351
+ headers: {
10352
+ [name: string]: unknown;
10353
+ };
10354
+ content?: never;
10355
+ };
10356
+ /** @description Internal server error */
10357
+ 500: {
10358
+ headers: {
10359
+ [name: string]: unknown;
10360
+ };
10361
+ content?: never;
10362
+ };
10363
+ };
10364
+ };
10365
+ get_buildercode_payout_summary: {
10366
+ parameters: {
10367
+ query?: never;
10368
+ header?: never;
10369
+ path?: never;
10370
+ cookie?: never;
10371
+ };
10372
+ requestBody?: never;
10373
+ responses: {
10374
+ /** @description OK */
10375
+ 200: {
10376
+ headers: {
10377
+ [name: string]: unknown;
10378
+ };
10379
+ content: {
10380
+ "application/json": components["schemas"]["GetBuildercodePayoutSummaryResponse"];
10381
+ };
10382
+ };
10383
+ /** @description Authentication required */
10384
+ 401: {
10385
+ headers: {
10386
+ [name: string]: unknown;
10387
+ };
10388
+ content?: never;
10389
+ };
10390
+ /** @description Refused: BuilderCodes is disabled, the caller is delegated, or the caller is not this application's payout wallet (gRPC: PERMISSION_DENIED) */
10391
+ 403: {
10392
+ headers: {
10393
+ [name: string]: unknown;
10394
+ };
10395
+ content?: never;
10396
+ };
10397
+ /** @description Authenticated application not found (gRPC: NOT_FOUND) */
10398
+ 404: {
10399
+ headers: {
10400
+ [name: string]: unknown;
10401
+ };
10402
+ content?: never;
10403
+ };
10404
+ /** @description Internal server error */
10405
+ 500: {
10406
+ headers: {
10407
+ [name: string]: unknown;
10408
+ };
10409
+ content?: never;
10410
+ };
10411
+ };
10412
+ };
10413
+ get_buildercode_rewards_balance: {
10414
+ parameters: {
10415
+ query?: never;
10416
+ header?: never;
10417
+ path?: never;
10418
+ cookie?: never;
10419
+ };
10420
+ requestBody?: never;
10421
+ responses: {
10422
+ /** @description OK */
10423
+ 200: {
10424
+ headers: {
10425
+ [name: string]: unknown;
10426
+ };
10427
+ content: {
10428
+ "application/json": components["schemas"]["GetBuildercodeRewardsBalanceResponse"];
10429
+ };
10430
+ };
10431
+ /** @description Authentication required */
10432
+ 401: {
10433
+ headers: {
10434
+ [name: string]: unknown;
10435
+ };
10436
+ content?: never;
10437
+ };
10438
+ /** @description Refused: BuilderCodes is disabled or the caller is delegated (gRPC: PERMISSION_DENIED) */
10439
+ 403: {
10440
+ headers: {
10441
+ [name: string]: unknown;
10442
+ };
10443
+ content?: never;
10444
+ };
10445
+ /** @description Internal server error */
10446
+ 500: {
10447
+ headers: {
10448
+ [name: string]: unknown;
10449
+ };
10450
+ content?: never;
10451
+ };
10452
+ };
10453
+ };
10454
+ claim_buildercode_rewards: {
10455
+ parameters: {
10456
+ query?: never;
10457
+ header?: never;
10458
+ path?: never;
10459
+ cookie?: never;
10460
+ };
10461
+ requestBody: {
10462
+ content: {
10463
+ "application/json": components["schemas"]["ClaimBuildercodeRewardsRequest"];
10464
+ };
10465
+ };
10466
+ responses: {
10467
+ /** @description OK */
10468
+ 200: {
10469
+ headers: {
10470
+ [name: string]: unknown;
10471
+ };
10472
+ content: {
10473
+ "application/json": components["schemas"]["ClaimBuildercodeRewardsResponse"];
10474
+ };
10475
+ };
10476
+ /** @description Invalid token or amount */
10477
+ 400: {
10478
+ headers: {
10479
+ [name: string]: unknown;
10480
+ };
10481
+ content?: never;
10482
+ };
10483
+ /** @description Authentication required */
10484
+ 401: {
10485
+ headers: {
10486
+ [name: string]: unknown;
10487
+ };
10488
+ content?: never;
10489
+ };
10490
+ /** @description Refused: BuilderCodes is not enabled, or the caller is a delegated-agent session (gRPC: PERMISSION_DENIED) */
10491
+ 403: {
10492
+ headers: {
10493
+ [name: string]: unknown;
10494
+ };
10495
+ content?: never;
10496
+ };
10497
+ /** @description Insufficient BuilderCodes payout balance, including a wallet that never accrued one (gRPC: FAILED_PRECONDITION) */
10498
+ 409: {
10499
+ headers: {
10500
+ [name: string]: unknown;
10501
+ };
10502
+ content?: never;
10503
+ };
10504
+ /** @description Internal server error */
10505
+ 500: {
10506
+ headers: {
10507
+ [name: string]: unknown;
10508
+ };
10509
+ content?: never;
10510
+ };
10511
+ /** @description Matching engine unavailable or slow to answer. Outcome UNKNOWN, not a rejection — the claim may still commit and there is no idempotency key, so treat it as pending and do not retry automatically; a balance read does not settle it, because an admitted claim may still be queued. Two tagged cases are the exception, both refused before the claim can be admitted and so provably non-committing, and both safe to retry: a maintenance block (`error: OPERATIONS_BLOCKED`; gRPC metadata `x-maintenance-blocked: true`) and a sequencer overload (`code: OVERLOADED`) (gRPC: UNAVAILABLE) */
10512
+ 503: {
10513
+ headers: {
10514
+ [name: string]: unknown;
10515
+ };
10516
+ content?: never;
10517
+ };
9784
10518
  };
9785
10519
  };
9786
10520
  list_delegated_agents: {