@assetpay/steam-mobile 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -39,7 +39,7 @@ persistent CM connection.
39
39
  - [bot.trade](#bottrade) — sending, reading, and polling trade offers
40
40
  - [TradeOffer](#tradeoffer) — a single offer
41
41
  - [bot.community](#botcommunity) — inventories, profiles, trade URLs, API keys
42
- - [bot.market](#botmarket) — Community Market: listings, buy orders, history, order book
42
+ - [bot.market](#botmarket) — Community Market: listings, buy orders, history, order book, fees
43
43
  - [bot.session](#botsession) — token lifecycle and sessions
44
44
  - [bot.confirmations](#botconfirmations) — low-level mobile confirmations
45
45
  - [decodePreviewToken](#decodepreviewtoken) — decode CS2 item inspect/certificate data
@@ -175,6 +175,7 @@ The root client. It owns the HTTP layer, the session, and the namespaces, and it
175
175
  - `proxy` — Optional. A proxy URL (`http://user:pass@host:port`, `socks5://…`, etc.). All traffic — API, community, and confirmations — routes through it.
176
176
  - `mobileProfile` — Optional. `"ios"` (default), `"android"`, or a `Partial<MobileProfile>` to override individual fields. See [Mobile-app impersonation](#mobile-app-impersonation).
177
177
  - `polling` — Optional. `true` to start polling with default cadence after `login()`, or a [`PollOptions`](#polloptions) object to tune it / resume from saved `pollData`.
178
+ - `walletCurrency` — Optional. The account's known wallet currency id (`1` USD, `3` EUR, …), e.g. persisted from an earlier `getWalletDetails()`. Market calls check against it from the first request; see [bot.market](#botmarket).
178
179
 
179
180
  Throws `SteamSessionExpiredError` synchronously if the refresh token is malformed (no SteamID in its
180
181
  payload). Does **not** make any network request.
@@ -711,84 +712,131 @@ for completeness. Returns `Promise<void>`.
711
712
 
712
713
  The Steam Community Market. Needs an account that can use the market (not limited). Responses are
713
714
  returned as Steam sends them (snake_case, unknown fields preserved); nothing is retried — rate limits
714
- surface as `RateLimitError` (HTTP 429), and the order book's 403 wall as `ThrottledError`.
715
-
716
- **Currency.** `bot.market.walletCurrency` (`1` USD, `3` EUR, …) is learned by
717
- [`getWalletDetails()`](#getwalletdetails) or set by you. Once known it is sent with
718
- `getMyListings` / `createBuyOrder` and **enforced on every `getOrderbook`** — a book in another
719
- currency throws instead of being compared. Call `getWalletDetails()` first on each account.
720
-
721
- ### getWalletDetails()
715
+ surface as `RateLimitError` (HTTP 429), and the order book's 403 wall as `ThrottledError`. Every
716
+ method takes optional controls on its options object: `signal` (an `AbortSignal` — use
717
+ `AbortSignal.timeout(ms)` for a deadline on the whole call) and `timeoutMs` (per HTTP request; the
718
+ default is 50s). Writes are never re-sent implicitly, not even after Steam's eligibility check.
719
+
720
+ **Currency — fails closed.** `bot.market.walletCurrency` (`1` USD, `3` EUR, …) is seeded through
721
+ `new SteamMobile({ walletCurrency })` / `bot.market.seedWalletCurrency()`, or learned by
722
+ [`getWalletDetails()`](#getwalletdetails) from a wallet that exists. Once known it can only be
723
+ confirmed: a response in another currency throws `CurrencyMismatchError` instead of switching.
724
+ `bot.market.walletCurrencyVerified` turns true once a live read in this session answered in it
725
+ (the wallet, an order book, your buy orders or listings) — writes require it, so a wrong seed can't
726
+ price a write. Every currency-dependent call checks it:
727
+
728
+ - `getMyListings`, `getMyHistory`, `getOrderbook`, `getPriceHistory` throw
729
+ `WalletCurrencyUnknownError` when no currency is known, and `CurrencyMismatchError` when a response
730
+ is in another currency (order book `eCurrency`, buy orders' `wallet_currency`, listings'
731
+ `currencyid`, the price-history `price_prefix` / `price_suffix`). The rendered history is the
732
+ exception: a row priced in another currency (an account that changed currency keeps its old rows)
733
+ is moved to `malformed` with reason `other_currency`, never returned as money, and the rest of the
734
+ page is returned. Passing `null` as the currency option skips the check for that call. History and
735
+ price-history formats are pinned for USD and EUR only.
736
+ - `sellItem` and `createBuyOrder` need the wallet currency known and verified, and refuse a
737
+ `currency` option that differs from it.
738
+
739
+ ### getWalletDetails(\[options])
722
740
 
723
741
  Returns the wallet via `IUserAccountService/GetClientWalletDetails` as `Promise<RawWalletDetails>`:
724
742
  `has_wallet`, `balance` / `delayed_balance` (int64 cents, as strings), `currency_code` (the wallet
725
743
  currency id — `1` USD, `3` EUR, …), `user_country_code`, `time_most_recent_txn`,
726
- `formatted_balance`, and the rest of Steam's fields. Sets `walletCurrency`.
744
+ `formatted_balance`, and the rest of Steam's fields. Learns `walletCurrency`.
745
+
746
+ ### getMarketWalletInfo(\[options])
747
+
748
+ Returns `g_rgWalletInfo` from the market page as `Promise<RawMarketWalletInfo>`: the fee parameters
749
+ (`wallet_fee`, `wallet_fee_percent`, `wallet_fee_minimum`, `wallet_fee_base`,
750
+ `wallet_publisher_fee_percent_default`) and caps (`wallet_max_balance`, `wallet_trade_max_balance`)
751
+ in the wallet currency. Throws `SteamSessionExpiredError` unless the page was rendered for this
752
+ account (a logged-out page carries a default USD wallet). It never teaches the currency; a known
753
+ one must match. `feeInfoFromWalletInfo(info)` turns it into a validated `MarketFeeInfo`.
727
754
 
728
755
  ### getMyListings(\[options])
729
756
 
730
757
  - `options`
731
- - `currency` — Optional. Wallet currency id, sent as `currency` (default `walletCurrency`).
758
+ - `currency` — Optional. Wallet currency id, sent as `currency` (default `walletCurrency`; `null`
759
+ sends none and skips the checks).
732
760
 
733
761
  Loads every page of your listings. Returns `Promise<MyListings>`:
734
- `{ listings, listings_to_confirm, buy_orders, num_active_listings }` with Steam's raw entries. A
762
+ `{ listings, listings_to_confirm, listings_on_hold, buy_orders, num_active_listings, complete }` with
763
+ Steam's raw entries, listings deduplicated by `listingid`. Every listing must carry its `currencyid`
764
+ and every buy order its `wallet_currency`. `complete` is `false` when the pages did not add up to
765
+ `num_active_listings`, the total moved between pages, or the first page had no `buy_orders` array —
766
+ never read "absent from an incomplete result" as sold, cancelled or filled. A
735
767
  listing's `price` is what you receive and `fee` Steam's cut (the buyer pays `price + fee`).
736
768
  `listings_to_confirm` are listings still awaiting mobile confirmation; their item can't be relisted
737
- until the listing is confirmed or removed with [`cancelListing`](#cancellistinglistingid).
769
+ until the listing is confirmed or removed with [`cancelListing`](#cancellistinglistingid-options).
738
770
 
739
771
  ### getMyHistory(\[options])
740
772
 
741
773
  - `options`
742
774
  - `count` — Optional. Rows per page (default `500`).
743
775
  - `start` — Optional. Row offset, for paging back.
776
+ - `currency` — Optional. Currency a priced row must be in to be returned as money (default
777
+ `walletCurrency`; `null` skips). Rows in any other currency go to `malformed` as `other_currency`.
744
778
 
745
779
  Parses the rendered market history into `Promise<MarketHistory>`:
746
- `{ events, sales, purchases, listingEvents, totalCount }` — `events` is every row in page order
747
- (newest first), the others split it by `type`. Every event has `historyId`
780
+ `{ events, sales, purchases, listingEvents, malformed, totalCount }` — `events` is every row in page
781
+ order (newest first), the others split it by `type`. Every event has `historyId`
748
782
  (`history_row_<listingid>_<eventid>`), `listingid`, `eventid`, `type`, `itemName`, `gameName`, `actedOn` /
749
783
  `listedOn` (display dates, no year), `displayPrice` and `priceInCents` (also as `receivedAmount` on
750
784
  sales and `paidAmount` on purchases). Sales and purchases also carry the asset: `appID`,
751
785
  `contextID`, `assetID`, `classID`, `instanceID`, `marketName`, `unOwnedContextID`, `unOwnedID`.
752
- Throws if a real price string parses to 0 cents. `parseMarketHistory(body)` is exported for raw
753
- responses.
786
+ A sale or purchase whose price is missing or parses to 0 cents is kept out of every list and returned
787
+ in `malformed` (`historyId`, `displayPrice`, `gainOrLoss`, `reason`: `"zero_price"` |
788
+ `"missing_price"` | `"other_currency"`) — record it, never book it.
789
+ `parseMarketHistory(body)` and `priceTextCurrency(text)` are exported for raw responses.
754
790
 
755
791
  ### getOrderbook(appid, marketHashName\[, options])
756
792
 
757
793
  - `options`
758
- - `expectedCurrency` — Optional (default `walletCurrency`). Throw instead of returning a book in
759
- any other currency.
794
+ - `expectedCurrency` — Optional (default `walletCurrency`; `null` skips). Throws
795
+ `CurrencyMismatchError` instead of returning a book in any other currency.
760
796
 
761
797
  Returns the live order book as `Promise<RawOrderbookData>`: `eCurrency`, `amtMinSellOrder` /
762
798
  `amtMaxBuyOrder` (best ask / bid in cents, `null` — not `NaN` — when that side is empty), and
763
799
  `rgCompactSellOrders` / `rgCompactBuyOrders` (flat `[price, qty, price, qty, …]`, best first). The
764
800
  endpoint always answers in the wallet currency. A 403 here is Steam's order-book throttle wall and
765
- throws `ThrottledError`.
801
+ throws `ThrottledError`. `summarizeOrderbook(data)` reads the best levels —
802
+ `{ currency, lowestAsk, askVolumeAtLowest, secondLowestAsk, highestBid, bidVolumeAtHighest,
803
+ secondHighestBid }`, an empty side as `null` (never a 0-cent price) — fail-closed: every value must be
804
+ a whole number, levels strictly ordered with positive prices and quantities, and the best level must
805
+ match the depth; anything else throws.
766
806
 
767
- ### getPriceHistory(appid, marketHashName)
807
+ ### getPriceHistory(appid, marketHashName\[, options])
808
+
809
+ - `options`
810
+ - `expectedCurrency` — Optional (default `walletCurrency`; `null` skips).
768
811
 
769
812
  Returns the price history rows as `Promise<RawPriceHistoryPoint[]>` —
770
813
  `[date, price (major units), volume]`; `[]` for an item without sales history. Throws when Steam
771
- answers `success: false`.
814
+ answers `success: false`, and `CurrencyMismatchError` when the response's currency markers don't
815
+ match.
772
816
 
773
- ### getMarketItemDetails(appid, marketHashName)
817
+ ### getMarketItemDetails(appid, marketHashName\[, options])
774
818
 
775
819
  Searches the market and returns the row whose `hash_name` matches exactly (`sell_listings`,
776
- `asset_description`), or `null`.
820
+ `asset_description`), or `null`. A `success: false` answer throws, so a throttled reply is never read
821
+ as "not on the market".
777
822
 
778
823
  ### sellItem(options)
779
824
 
780
825
  - `options`
781
826
  - `appid`, `assetid`
782
- - `price` — What **you** receive, in cents (the buyer pays this plus fees).
827
+ - `price` — What **you** receive, in cents (the buyer pays this plus fees). Positive integer.
783
828
  - `contextid` — Optional (default `"2"`).
784
829
  - `amount` — Optional (default `1`).
830
+ - `currency` — Optional. The currency `price` is in; must equal `walletCurrency`.
785
831
 
786
832
  Lists an item and returns Steam's response as `Promise<RawSellItemResponse>`. The listing still needs
787
- its mobile confirmation — see [`confirmListings`](#confirmlistingsexpected). Refusals throw
788
- `MarketConfirmationLimitError`, `WalletBalanceLimitError` or `MarketBlockedError`, otherwise a
789
- `SteamError` with Steam's message.
833
+ its mobile confirmation — see [`confirmListingIds`](#confirmlistingidslistingids-options). Refusals
834
+ throw `MarketConfirmationLimitError` (with `reason`: `"too_many_pending"` | `"item_pending"` |
835
+ `"unknown"`), `WalletBalanceLimitError`, `MarketBlockedError`, `MarketItemUnavailableError`, otherwise
836
+ a `SteamError` with Steam's message. A transport failure leaves the outcome unknown: read
837
+ `getMyListings` before listing the asset again.
790
838
 
791
- ### cancelListing(listingId)
839
+ ### cancelListing(listingId\[, options])
792
840
 
793
841
  Removes a listing. Returns `Promise<void>`.
794
842
 
@@ -796,35 +844,78 @@ Removes a listing. Returns `Promise<void>`.
796
844
 
797
845
  - `options`
798
846
  - `appid`, `marketHashName`, `quantity`
799
- - `priceTotal` — Price per unit × quantity, in cents.
800
- - `currency` — Optional. Wallet currency id (default `walletCurrency`; throws if neither is known).
847
+ - `priceTotal` — Price per unit × quantity, in cents (must divide by `quantity`).
848
+ - `currency` — Optional. Must equal `walletCurrency`, which must be known.
849
+
850
+ Places a buy order and returns its `buy_orderid` as `Promise<string>` (64-bit ids are read from the
851
+ raw response, never through a JS number). When Steam answers with a mobile confirmation (HTTP 406),
852
+ exactly that confirmation is accepted (needs `identitySecret`) and the order finalized. No step is
853
+ ever retried. Errors:
801
854
 
802
- Places a buy order and returns its `buy_orderid` as `Promise<string>`. When Steam answers with a
803
- mobile confirmation (HTTP 406), it is accepted (needs `identitySecret`) and the order finalized. A
804
- refusal is a `SteamError` whose `eresult` is Steam's code. Not retried: the confirmation id carries
805
- between steps, so re-run the whole call — but a failure after the confirmation was accepted may
806
- still have placed the order, so check [`getMyListings`](#getmylistingsoptions) first.
855
+ - `RateLimitError`, `SteamSessionExpiredError`, `MarketIneligibleError` from the first request —
856
+ nothing was placed.
857
+ - `MarketBlockedError` (Steam code 15 or "unable to use the Community Market", any step) — refused;
858
+ account-level.
859
+ - `BuyOrderError` for everything else: `stage` (`"create"` | `"confirm"` | `"finalize"`), `code`
860
+ (Steam's `success` code), `confirmationId`, **`orderExists`** (Steam says an order for this item
861
+ already exists — 29 — possibly at another price) and **`mayExist`** — `true` unless Steam refused
862
+ with a code proven to mean "not placed" (25 order limit, 107 insufficient funds) and nothing in its
863
+ message says the outcome is unknown ("trouble hearing back… double check…"). Read `getMyListings`
864
+ before acting again whenever it is `true`.
807
865
 
808
- ### cancelBuyOrder(buyOrderId)
866
+ Only a confirmation of type `BuyOrder` whose creator is the order's `confirmation_id` is ever accepted.
809
867
 
810
- Cancels a buy order and returns Steam's response as `Promise<RawCancelBuyOrderResponse>`.
868
+ ### cancelBuyOrder(buyOrderId\[, options])
811
869
 
812
- ### confirmListings(expected)
870
+ Cancels a buy order. Returns Steam's response as `Promise<RawCancelBuyOrderResponse>` when it reports
871
+ success; any other verdict throws a `SteamError` with Steam's code as `eresult`.
872
+
873
+ ### confirmListingIds(listingIds\[, options])
874
+
875
+ Accepts exactly the pending market-listing confirmations created by those listing ids (a listing
876
+ confirmation's `creator` is its listing id), in one request. Returns
877
+ `Promise<{ confirmed, missing }>` — `missing` lists ids with no pending confirmation. Nothing else is
878
+ ever confirmed.
879
+
880
+ ### confirmListings(expected\[, options])
813
881
 
814
882
  - `expected` — `{ [market_hash_name]: number of listings created }`.
815
883
 
816
- Accepts the pending market-listing confirmations that match, in one request: oldest first, exact name
817
- first, then a substring match (the confirmation text can omit the wear; an empty one never matches). Returns
818
- `Promise<{ confirmed, skipped }>` ([`Confirmation`](#confirmation)`[]` each); unmatched ones stay
819
- pending in `skipped`.
884
+ Name-based fallback: accepts the pending market-listing confirmations that match, in one request:
885
+ oldest first, exact name first, then a substring match (the confirmation text can omit the wear; an
886
+ empty one never matches). It cannot tell two listings of one name apart and never checks the price —
887
+ prefer `confirmListingIds`. Returns `Promise<{ confirmed, skipped }>`
888
+ ([`Confirmation`](#confirmation)`[]` each); unmatched ones stay pending in `skipped`.
820
889
 
821
- ### rejectListings(\[types])
890
+ ### rejectListings(\[types, options])
822
891
 
823
892
  - `types` — Optional [`EConfirmationType`](#econfirmationtype)`[]` (default `[MarketListing]`; pass
824
893
  `[BuyOrder]` for buy orders).
894
+ - `options.keepCreators` — Optional. Creator ids (listing ids, buy-order confirmation ids) to leave
895
+ pending — work still in flight.
896
+
897
+ Rejects every other pending confirmation of those types in one request and returns them. Other types
898
+ are never touched.
899
+
900
+ ### Fees
901
+
902
+ Steam's own fee math (its client's `CalculateFeeAmount` /
903
+ `CalculateAmountToSendForDesiredReceivedAmount`), exact to the cent:
904
+
905
+ - `sellerReceivesForBuyerPays(buyerPays, feeInfo)` — what a seller receives at a listed price.
906
+ - `buyerPaysForSellerReceives(sellerReceives, feeInfo)` — `{ amount, steamFee, publisherFee, fees }`.
907
+ - `feesForBuyerPays(buyerPays, feeInfo)` — the fee split of a listed price.
908
+ - `landingBuyerPays(targetBuyerPays, feeInfo)` — the price a listing actually shows when listed to
909
+ receive `sellerReceivesForBuyerPays(target)`: not every price is reachable, so it can sit a cent or
910
+ two below the target; `0` when the target pays out nothing (1c, 2c).
911
+ - `feeInfoFromWalletInfo(g_rgWalletInfo[, publisherFeePercent])` — a validated `MarketFeeInfo`, or
912
+ `null` when a field is missing or out of range.
825
913
 
826
- Rejects every pending confirmation of those types in one request and returns them. Other types are
827
- never touched.
914
+ `feeInfo` is a `MarketFeeInfo` (`walletFee`, `walletFeePercent`, `walletFeeMinimum`, `walletFeeBase`,
915
+ `publisherFeePercent`, all fractions — `0.05`, never `5`); build it from
916
+ [`getMarketWalletInfo()`](#getmarketwalletinfo), or use `DEFAULT_MARKET_FEE_INFO` (5% + 10%, min 1c
917
+ each — CS2 and Rust as of 2026-10). Non-integer or negative cents, and fee info out of range, throw
918
+ `RangeError`.
828
919
 
829
920
  ---
830
921
 
@@ -1291,9 +1382,15 @@ one shared classifier so the same `instanceof` check works everywhere.
1291
1382
  | `PrivateInventoryError` | — | Partner's inventory is private (or friends-only and we're not friends). A trade URL/token does **not** bypass inventory privacy. |
1292
1383
  | `ConfirmationError` | — | A mobile-confirmation step failed (incl. missing `identitySecret` when calling [`offer.confirm()`](#confirm)). |
1293
1384
  | `FamilyViewError` | — | Family View is restricting the account. |
1294
- | `MarketConfirmationLimitError` | `eresult?` | `sellItem` refused over pending confirmations: too many listings awaiting confirmation, or this item already has one pending. |
1385
+ | `MarketConfirmationLimitError` | `eresult?`, `reason` | `sellItem` refused over pending confirmations: `too_many_pending` (confirm some first) or `item_pending` (this item already has one pending). |
1295
1386
  | `WalletBalanceLimitError` | `eresult?` | `sellItem` would push the wallet past Steam's maximum balance. |
1296
- | `MarketBlockedError` | `eresult?` | The account is currently unable to use the Community Market. |
1387
+ | `MarketBlockedError` | `eresult?` | The account is currently unable to use the Community Market (sell or buy). |
1388
+ | `MarketItemUnavailableError` | `eresult?` | `sellItem` refused: the asset is no longer in the inventory or is not marketable. |
1389
+ | `MarketIneligibleError` | — | Steam keeps redirecting to its market eligibility check: the account can't use the market (limited, new device, …). |
1390
+ | `CurrencyMismatchError` | `expected`, `actual` | A market response or a caller's price is in another currency than required; nothing was compared. |
1391
+ | `WalletCurrencyUnknownError` | — | A currency-dependent market call ran with no known wallet currency. |
1392
+ | `BuyOrderError` | `stage`, `code?`, `mayExist`, `orderExists`, `confirmationId?` | `createBuyOrder` failed at a step; `mayExist` says the order may have been placed anyway, `orderExists` that one exists for the item. |
1393
+ | `ConfirmationOutcomeUnknownError` | (extends `ConfirmationError`) | Acting on a confirmation got an unreadable answer: it may or may not have been accepted. |
1297
1394
  | `LoginError` | `extendedErrorMessage?`, `isTransient` | Credential-login failure; `isTransient` is `true` for a retryable blip (timeout / service unavailable) rather than bad credentials. |
1298
1395
  | `NoMobileAuthenticatorError` | (extends `LoginError`) | `sharedSecret` was supplied but the account has no mobile authenticator attached, so TOTP can't answer the guard challenge. Use `steamGuardCode` / `onSteamGuardRequired` with an email code instead. |
1299
1396
 
@@ -1373,4 +1470,5 @@ pnpm watch # live trade-event watcher — send the bot a trade and
1373
1470
  pnpm trade # send → confirm → cancel lifecycle (gated: SEND=1 PARTNER_TRADE_URL=…; needs a non-limited bot)
1374
1471
  pnpm partner-inventory # load a partner's inventory via /partnerinventory/ (PARTNER_TRADE_URL=…; surfaces PrivateInventoryError etc.)
1375
1472
  pnpm market-probe # read-only market + account-status probe (PROBE_APPID / PROBE_ITEM; needs a non-limited account)
1473
+ pnpm market-trade # market write round trip → debug/out report (gated: LIVE_WRITES=1 PROBE_ASSETID=…; lists far above market, 3c buy order, cleans up)
1376
1474
  ```
package/dist/index.d.mts CHANGED
@@ -44,7 +44,9 @@ interface RequestOptions {
44
44
  referer?: string;
45
45
  signal?: AbortSignal;
46
46
  timeoutMs?: number;
47
+ noEligibilityReplay?: boolean;
47
48
  }
49
+ type RequestControl = Pick<RequestOptions, "signal" | "timeoutMs">;
48
50
  declare class HttpClient {
49
51
  readonly jar: CookieJar;
50
52
  private readonly webClient;
@@ -922,9 +924,10 @@ interface RawMarketBuyOrder {
922
924
  buy_orderid: string;
923
925
  appid: number;
924
926
  hash_name: string;
925
- price: number | string;
926
- quantity: number | string;
927
- quantity_remaining: number | string;
927
+ wallet_currency: number;
928
+ price: string;
929
+ quantity: string;
930
+ quantity_remaining: string;
928
931
  description?: RawDescription;
929
932
  [key: string]: unknown;
930
933
  }
@@ -937,6 +940,7 @@ interface RawMyListingsResponse {
937
940
  [key: string]: unknown;
938
941
  };
939
942
  listings_to_confirm?: RawMarketListing[];
943
+ listings_on_hold?: RawMarketListing[];
940
944
  buy_orders?: RawMarketBuyOrder[];
941
945
  [key: string]: unknown;
942
946
  }
@@ -983,6 +987,10 @@ interface RawMarketSearchResponse {
983
987
  interface RawSellItemResponse {
984
988
  success?: boolean | number;
985
989
  message?: string;
990
+ requires_confirmation?: number;
991
+ needs_mobile_confirmation?: boolean;
992
+ needs_email_confirmation?: boolean;
993
+ email_domain?: string;
986
994
  [key: string]: unknown;
987
995
  }
988
996
  interface RawCreateBuyOrderResponse {
@@ -1004,6 +1012,22 @@ interface RawCancelBuyOrderResponse {
1004
1012
  success?: boolean | number;
1005
1013
  [key: string]: unknown;
1006
1014
  }
1015
+ interface RawMarketWalletInfo {
1016
+ wallet_currency?: number;
1017
+ wallet_country?: string;
1018
+ wallet_state?: string;
1019
+ wallet_fee?: number | string;
1020
+ wallet_fee_minimum?: number | string;
1021
+ wallet_fee_percent?: number | string;
1022
+ wallet_publisher_fee_percent_default?: number | string;
1023
+ wallet_fee_base?: number | string;
1024
+ wallet_balance?: number | string;
1025
+ wallet_delayed_balance?: number | string;
1026
+ wallet_max_balance?: number | string;
1027
+ wallet_trade_max_balance?: number | string;
1028
+ success?: number | boolean;
1029
+ [key: string]: unknown;
1030
+ }
1007
1031
  interface RawWalletDetails {
1008
1032
  has_wallet?: boolean;
1009
1033
  user_country_code?: string;
@@ -1049,6 +1073,8 @@ interface ApiCallParams {
1049
1073
  version?: number;
1050
1074
  input?: Record<string, Scalar | undefined>;
1051
1075
  retryAfterMs?: number | null;
1076
+ signal?: AbortSignal | undefined;
1077
+ timeoutMs?: number | undefined;
1052
1078
  }
1053
1079
  type ApiBody = {
1054
1080
  response?: Record<string, unknown>;
@@ -1112,13 +1138,13 @@ declare class ConfirmationManager {
1112
1138
  constructor(http: HttpClient, steamID: SteamID, identitySecret: string | undefined, profile: MobileProfile);
1113
1139
  get hasIdentitySecret(): boolean;
1114
1140
  private deviceId;
1115
- getConfirmations(time: number, key: ConfKey): Promise<Confirmation[]>;
1116
- respondToConfirmation(confID: string | string[], confKey: string | string[], time: number, key: ConfKey, accept: boolean): Promise<void>;
1117
- getPending(): Promise<Confirmation[]>;
1141
+ getConfirmations(time: number, key: ConfKey, control?: RequestControl): Promise<Confirmation[]>;
1142
+ respondToConfirmation(confID: string | string[], confKey: string | string[], time: number, key: ConfKey, accept: boolean, control?: RequestControl): Promise<void>;
1143
+ getPending(control?: RequestControl): Promise<Confirmation[]>;
1118
1144
  acceptConfirmation(confID: string, nonce: string): Promise<void>;
1119
1145
  rejectConfirmation(confID: string, nonce: string): Promise<void>;
1120
- acceptConfirmations(confs: Pick<Confirmation, "id" | "key">[]): Promise<void>;
1121
- rejectConfirmations(confs: Pick<Confirmation, "id" | "key">[]): Promise<void>;
1146
+ acceptConfirmations(confs: Pick<Confirmation, "id" | "key">[], control?: RequestControl): Promise<void>;
1147
+ rejectConfirmations(confs: Pick<Confirmation, "id" | "key">[], control?: RequestControl): Promise<void>;
1122
1148
  acceptAll(): Promise<Confirmation[]>;
1123
1149
  acceptConfirmationForObject(objectID: string): Promise<void>;
1124
1150
  private actOnConfirmations;
@@ -1270,16 +1296,56 @@ declare class ItemServerUnavailableError extends SteamError {
1270
1296
  declare class ConfirmationError extends SteamError {
1271
1297
  constructor(message: string);
1272
1298
  }
1299
+ declare class ConfirmationOutcomeUnknownError extends ConfirmationError {
1300
+ constructor(message?: string);
1301
+ }
1273
1302
  declare class FamilyViewError extends SteamError {
1274
1303
  constructor(message?: string);
1275
1304
  }
1276
1305
  declare class PrivateInventoryError extends SteamError {
1277
1306
  constructor(message?: string);
1278
1307
  }
1308
+ type MarketConfirmationLimitReason = "too_many_pending" | "item_pending" | "unknown";
1279
1309
  declare class MarketConfirmationLimitError extends SteamError {
1310
+ readonly reason: MarketConfirmationLimitReason;
1280
1311
  constructor(message?: string, options?: {
1281
1312
  eresult?: number;
1282
1313
  body?: unknown;
1314
+ reason?: MarketConfirmationLimitReason;
1315
+ });
1316
+ }
1317
+ declare class MarketItemUnavailableError extends SteamError {
1318
+ constructor(message: string, options?: {
1319
+ eresult?: number;
1320
+ body?: unknown;
1321
+ });
1322
+ }
1323
+ declare class MarketIneligibleError extends SteamError {
1324
+ constructor(message?: string);
1325
+ }
1326
+ declare class CurrencyMismatchError extends SteamError {
1327
+ readonly expected: number;
1328
+ readonly actual: number | undefined;
1329
+ constructor(expected: number, actual: number | undefined, context: string);
1330
+ }
1331
+ declare class WalletCurrencyUnknownError extends SteamError {
1332
+ constructor(context: string);
1333
+ }
1334
+ type BuyOrderStage = "create" | "confirm" | "finalize";
1335
+ declare class BuyOrderError extends SteamError {
1336
+ readonly stage: BuyOrderStage;
1337
+ readonly code: number | undefined;
1338
+ readonly mayExist: boolean;
1339
+ readonly orderExists: boolean;
1340
+ readonly confirmationId: string | undefined;
1341
+ constructor(message: string, options: {
1342
+ stage: BuyOrderStage;
1343
+ mayExist: boolean;
1344
+ orderExists?: boolean;
1345
+ code?: number;
1346
+ confirmationId?: string;
1347
+ body?: unknown;
1348
+ cause?: unknown;
1283
1349
  });
1284
1350
  }
1285
1351
  declare class WalletBalanceLimitError extends SteamError {
@@ -1473,6 +1539,33 @@ declare class SteamWebApi {
1473
1539
  getBadges(steamId: string): Promise<PlayerBadges>;
1474
1540
  }
1475
1541
  //#endregion
1542
+ //#region src/market/fees.d.ts
1543
+ interface MarketFeeInfo {
1544
+ walletFee: boolean;
1545
+ walletFeePercent: number;
1546
+ walletFeeMinimum: number;
1547
+ walletFeeBase: number;
1548
+ publisherFeePercent: number;
1549
+ }
1550
+ interface MarketFeeBreakdown {
1551
+ amount: number;
1552
+ steamFee: number;
1553
+ publisherFee: number;
1554
+ fees: number;
1555
+ }
1556
+ declare const DEFAULT_MARKET_FEE_INFO: MarketFeeInfo;
1557
+ declare function feeInfoFromWalletInfo(raw: {
1558
+ wallet_fee?: unknown;
1559
+ wallet_fee_percent?: unknown;
1560
+ wallet_fee_minimum?: unknown;
1561
+ wallet_fee_base?: unknown;
1562
+ wallet_publisher_fee_percent_default?: unknown;
1563
+ }, publisherFeePercent?: number): MarketFeeInfo | null;
1564
+ declare function buyerPaysForSellerReceives(receivedAmount: number, info: MarketFeeInfo): MarketFeeBreakdown;
1565
+ declare function feesForBuyerPays(amount: number, info: MarketFeeInfo): MarketFeeBreakdown;
1566
+ declare function sellerReceivesForBuyerPays(amount: number, info: MarketFeeInfo): number;
1567
+ declare function landingBuyerPays(targetBuyerPays: number, info: MarketFeeInfo): number;
1568
+ //#endregion
1476
1569
  //#region src/market/history.d.ts
1477
1570
  type MarketHistoryEventType = "sale" | "purchase" | "listing_event";
1478
1571
  interface MarketHistoryEvent {
@@ -1507,30 +1600,42 @@ interface MarketListingEvent extends MarketHistoryEvent {
1507
1600
  type: "listing_event";
1508
1601
  }
1509
1602
  type MarketHistoryRow = MarketSale | MarketPurchase | MarketListingEvent;
1603
+ interface MarketHistoryMalformedRow {
1604
+ historyId: string;
1605
+ displayPrice: string;
1606
+ gainOrLoss: string;
1607
+ reason: "zero_price" | "missing_price" | "other_currency";
1608
+ }
1510
1609
  interface MarketHistory {
1511
1610
  events: MarketHistoryRow[];
1512
1611
  sales: MarketSale[];
1513
1612
  purchases: MarketPurchase[];
1514
1613
  listingEvents: MarketListingEvent[];
1614
+ malformed: MarketHistoryMalformedRow[];
1515
1615
  totalCount: number | undefined;
1516
1616
  }
1517
1617
  declare function parseMarketHistory(body: RawMarketHistoryResponse): MarketHistory;
1618
+ declare function priceTextCurrency(text: string): number | undefined;
1518
1619
  //#endregion
1519
1620
  //#region src/market/MarketNamespace.d.ts
1621
+ type MarketCallOptions = RequestControl;
1520
1622
  interface MyListings {
1521
1623
  listings: RawMarketListing[];
1522
1624
  listings_to_confirm: RawMarketListing[];
1625
+ listings_on_hold: RawMarketListing[];
1523
1626
  buy_orders: RawMarketBuyOrder[];
1524
1627
  num_active_listings: number;
1628
+ complete: boolean;
1525
1629
  }
1526
- interface SellItemOptions {
1630
+ interface SellItemOptions extends MarketCallOptions {
1527
1631
  appid: number;
1528
1632
  contextid?: string;
1529
1633
  assetid: string;
1530
1634
  amount?: number;
1531
1635
  price: number;
1636
+ currency?: number;
1532
1637
  }
1533
- interface CreateBuyOrderOptions {
1638
+ interface CreateBuyOrderOptions extends MarketCallOptions {
1534
1639
  appid: number;
1535
1640
  marketHashName: string;
1536
1641
  priceTotal: number;
@@ -1541,34 +1646,64 @@ interface ConfirmListingsResult {
1541
1646
  confirmed: Confirmation[];
1542
1647
  skipped: Confirmation[];
1543
1648
  }
1649
+ interface ConfirmListingIdsResult {
1650
+ confirmed: Confirmation[];
1651
+ missing: string[];
1652
+ }
1653
+ interface OrderbookSummary {
1654
+ currency: number;
1655
+ lowestAsk: number | null;
1656
+ askVolumeAtLowest: number;
1657
+ secondLowestAsk: number | null;
1658
+ highestBid: number | null;
1659
+ bidVolumeAtHighest: number;
1660
+ secondHighestBid: number | null;
1661
+ }
1544
1662
  declare class MarketNamespace {
1545
1663
  private readonly http;
1546
1664
  private readonly session;
1547
1665
  private readonly confirmations;
1548
1666
  private readonly api;
1549
- walletCurrency: number | undefined;
1667
+ private currency;
1668
+ private currencyVerified;
1550
1669
  constructor(http: HttpClient, session: SessionManager, confirmations: ConfirmationManager, api: WebApiClient);
1551
- getWalletDetails(): Promise<RawWalletDetails>;
1670
+ get walletCurrency(): number | undefined;
1671
+ get walletCurrencyVerified(): boolean;
1672
+ seedWalletCurrency(currency: number): void;
1673
+ getWalletDetails(options?: MarketCallOptions): Promise<RawWalletDetails>;
1674
+ getMarketWalletInfo(options?: MarketCallOptions): Promise<RawMarketWalletInfo>;
1552
1675
  getMyListings(options?: {
1553
- currency?: number;
1554
- }): Promise<MyListings>;
1676
+ currency?: number | null;
1677
+ } & MarketCallOptions): Promise<MyListings>;
1555
1678
  getMyHistory(options?: {
1556
1679
  count?: number;
1557
1680
  start?: number;
1558
- }): Promise<MarketHistory>;
1681
+ currency?: number | null;
1682
+ } & MarketCallOptions): Promise<MarketHistory>;
1559
1683
  getOrderbook(appid: number, marketHashName: string, options?: {
1560
- expectedCurrency?: number;
1561
- }): Promise<RawOrderbookData>;
1562
- getPriceHistory(appid: number, marketHashName: string): Promise<RawPriceHistoryPoint[]>;
1563
- getMarketItemDetails(appid: number, marketHashName: string): Promise<RawMarketSearchResult | null>;
1684
+ expectedCurrency?: number | null;
1685
+ } & MarketCallOptions): Promise<RawOrderbookData>;
1686
+ getPriceHistory(appid: number, marketHashName: string, options?: {
1687
+ expectedCurrency?: number | null;
1688
+ } & MarketCallOptions): Promise<RawPriceHistoryPoint[]>;
1689
+ getMarketItemDetails(appid: number, marketHashName: string, options?: MarketCallOptions): Promise<RawMarketSearchResult | null>;
1564
1690
  sellItem(options: SellItemOptions): Promise<RawSellItemResponse>;
1565
- cancelListing(listingId: string): Promise<void>;
1691
+ cancelListing(listingId: string, options?: MarketCallOptions): Promise<void>;
1566
1692
  createBuyOrder(options: CreateBuyOrderOptions): Promise<string>;
1567
- cancelBuyOrder(buyOrderId: string): Promise<RawCancelBuyOrderResponse>;
1568
- confirmListings(expected: Record<string, number>): Promise<ConfirmListingsResult>;
1569
- rejectListings(types?: EConfirmationType[]): Promise<Confirmation[]>;
1693
+ cancelBuyOrder(buyOrderId: string, options?: MarketCallOptions): Promise<RawCancelBuyOrderResponse>;
1694
+ confirmListingIds(listingIds: string[], options?: MarketCallOptions): Promise<ConfirmListingIdsResult>;
1695
+ confirmListings(expected: Record<string, number>, options?: MarketCallOptions): Promise<ConfirmListingsResult>;
1696
+ rejectListings(types?: EConfirmationType[], options?: {
1697
+ keepCreators?: string[];
1698
+ } & MarketCallOptions): Promise<Confirmation[]>;
1699
+ private acceptBuyOrderConfirmation;
1570
1700
  private postBuyOrder;
1701
+ private readCurrency;
1702
+ private writeCurrency;
1703
+ private learnCurrency;
1704
+ private confirmCurrency;
1571
1705
  }
1706
+ declare function summarizeOrderbook(data: RawOrderbookData): OrderbookSummary;
1572
1707
  //#endregion
1573
1708
  //#region src/market/prices.d.ts
1574
1709
  declare function getPriceValueAsInt(strAmount: string | null | undefined): number;
@@ -1812,6 +1947,7 @@ interface SteamMobileOptions {
1812
1947
  proxy?: string;
1813
1948
  mobileProfile?: MobilePlatform | Partial<MobileProfile>;
1814
1949
  polling?: boolean | PollOptions;
1950
+ walletCurrency?: number;
1815
1951
  }
1816
1952
  type ReauthenticateOptions = Omit<LoginWithCredentialsOptions, "proxy" | "mobileProfile">;
1817
1953
  declare class SteamMobile extends EventEmitter<SteamMobileEvents> {
@@ -1901,5 +2037,5 @@ declare class Poller {
1901
2037
  private stamp;
1902
2038
  }
1903
2039
  //#endregion
1904
- export { ANDROID_PROFILE, type AcceptResult, AccessTokenError, type ApiCallParams, type AssetProperty, AuthClient, type Badge, CommunityNamespace, type ConfirmListingsResult, type Confirmation, ConfirmationError, ConfirmationManager, type CreateBuyOrderOptions, CredentialSession, type CredentialSessionEvents, type CredentialStartOptions, DEFAULT_CONTEXTID, DEFAULT_POLL_FULL_UPDATE_INTERVAL, DEFAULT_POLL_INTERVAL, DEFAULT_POLL_MAX_AGE_MS, DEFAULT_RATE_LIMIT_RETRY_MS, EAuthSessionGuardType, EAuthTokenPlatformType, EAuthTokenRevokeAction, EConfirmationMethod, EConfirmationType, EOfferFilter, EResult, ESessionPersistence, ETokenRenewalType, ETradeOfferState, ETradeStatus, type EconItem, EscrowError, type EscrowHold, type EscrowSide, type ExchangeDetails, type ExchangeItem, FamilyViewError, type GetInventoryOptions, HttpClient, type HttpResponse, HttpStatusError, IOS_PROFILE, ItemServerUnavailableError, type JwtPayload, LANG, LoginError, type LoginResult, type LoginWithCredentialsOptions, MarketBlockedError, MarketConfirmationLimitError, type MarketHistory, type MarketHistoryEvent, type MarketHistoryEventType, type MarketHistoryRow, type MarketListingEvent, MarketNamespace, type MarketPurchase, type MarketSale, type MobilePlatform, type MobileProfile, type MyListings, NewDeviceError, NoMobileAuthenticatorError, OfferLimitError, OfferTarget, OpenIdError, type OpenidConfirmation, type OpenidCookie, type OpenidLoginOptions, type OpenidLoginResult, type PlayerBadges, type PlayerBans, type PlayerSummary, type PollChange, type PollData, type PollDataStore, type PollOptions, type PollSource, Poller, PrivateInventoryError, ProxyError, RATE_LIMITS, RETRY_AFTER, type RateLimit, RateLimitError, type RateLimitedEndpoint, RawAsset, type RawAssetPropertyEntry, RawCEconTradeOffer, RawCancelBuyOrderResponse, RawCreateBuyOrderResponse, type RawDescription, RawExchangeAsset, RawGetTradeOffersResponse, RawGetTradeStatusResponse, type RawInventoryAsset, type RawInventoryResponse, RawMarketBuyOrder, RawMarketHistoryAsset, RawMarketHistoryResponse, RawMarketListing, RawMarketListingAsset, RawMarketSearchResponse, RawMarketSearchResult, RawMyListingsResponse, RawOrderbookData, type RawPartnerInventoryResponse, RawPriceHistoryPoint, RawPriceHistoryResponse, RawSellItemResponse, RawTradeStatus, RawTwoFactorStatus, RawWalletDetails, type ReauthenticateOptions, type RequestOptions, type ResolvedTarget, type SellItemOptions, type SendResult, SessionManager, type SessionManagerEvents, type SteamAction, type SteamDescriptionLine, SteamError, SteamMobile, type SteamMobileEvents, type SteamMobileOptions, type SteamProfile, SteamSessionExpiredError, type SteamTag, SteamWebApi, type SteamWebApiOptions, TERMINAL_AUTH_ERESULTS, TRANSIENT_ERESULTS, TargetCannotTradeError, ThrottledError, TradeBanError, type TradeEvents, type TradeHistory, type TradeHistoryEntry, type TradeHistoryOptions, TradeItem, TradeNamespace, TradeOffer, type TradeOfferDeps, type TradeOfferUpdate, type TradeOffersSummary, URLS, type UserDetails, type UserPartnerDetails, type UserSideDetails, WalletBalanceLimitError, WebApiClient, WebTradeEligibility, confirmOpenid, decodeJwt, decodePreviewToken, encodePreviewToken, getPriceValueAsInt, getTradeHistory, getTradeOffersSummary, getTradeStatus, isTerminalAuthEResult, isTerminalState, isTransientEResult, loginWithCredentials, parseInventory, parseMarketHistory, parseOpenidForm, parsePartnerInventory, resolveMobileProfile, resolveTarget, secondsUntilExpiry, steamOpenidLogin };
2040
+ export { ANDROID_PROFILE, type AcceptResult, AccessTokenError, type ApiCallParams, type AssetProperty, AuthClient, type Badge, BuyOrderError, BuyOrderStage, CommunityNamespace, type ConfirmListingIdsResult, type ConfirmListingsResult, type Confirmation, ConfirmationError, ConfirmationManager, ConfirmationOutcomeUnknownError, type CreateBuyOrderOptions, CredentialSession, type CredentialSessionEvents, type CredentialStartOptions, CurrencyMismatchError, DEFAULT_CONTEXTID, DEFAULT_MARKET_FEE_INFO, DEFAULT_POLL_FULL_UPDATE_INTERVAL, DEFAULT_POLL_INTERVAL, DEFAULT_POLL_MAX_AGE_MS, DEFAULT_RATE_LIMIT_RETRY_MS, EAuthSessionGuardType, EAuthTokenPlatformType, EAuthTokenRevokeAction, EConfirmationMethod, EConfirmationType, EOfferFilter, EResult, ESessionPersistence, ETokenRenewalType, ETradeOfferState, ETradeStatus, type EconItem, EscrowError, type EscrowHold, type EscrowSide, type ExchangeDetails, type ExchangeItem, FamilyViewError, type GetInventoryOptions, HttpClient, type HttpResponse, HttpStatusError, IOS_PROFILE, ItemServerUnavailableError, type JwtPayload, LANG, LoginError, type LoginResult, type LoginWithCredentialsOptions, MarketBlockedError, type MarketCallOptions, MarketConfirmationLimitError, MarketConfirmationLimitReason, type MarketFeeBreakdown, type MarketFeeInfo, type MarketHistory, type MarketHistoryEvent, type MarketHistoryEventType, type MarketHistoryMalformedRow, type MarketHistoryRow, MarketIneligibleError, MarketItemUnavailableError, type MarketListingEvent, MarketNamespace, type MarketPurchase, type MarketSale, type MobilePlatform, type MobileProfile, type MyListings, NewDeviceError, NoMobileAuthenticatorError, OfferLimitError, OfferTarget, OpenIdError, type OpenidConfirmation, type OpenidCookie, type OpenidLoginOptions, type OpenidLoginResult, type OrderbookSummary, type PlayerBadges, type PlayerBans, type PlayerSummary, type PollChange, type PollData, type PollDataStore, type PollOptions, type PollSource, Poller, PrivateInventoryError, ProxyError, RATE_LIMITS, RETRY_AFTER, type RateLimit, RateLimitError, type RateLimitedEndpoint, RawAsset, type RawAssetPropertyEntry, RawCEconTradeOffer, RawCancelBuyOrderResponse, RawCreateBuyOrderResponse, type RawDescription, RawExchangeAsset, RawGetTradeOffersResponse, RawGetTradeStatusResponse, type RawInventoryAsset, type RawInventoryResponse, RawMarketBuyOrder, RawMarketHistoryAsset, RawMarketHistoryResponse, RawMarketListing, RawMarketListingAsset, RawMarketSearchResponse, RawMarketSearchResult, RawMarketWalletInfo, RawMyListingsResponse, RawOrderbookData, type RawPartnerInventoryResponse, RawPriceHistoryPoint, RawPriceHistoryResponse, RawSellItemResponse, RawTradeStatus, RawTwoFactorStatus, RawWalletDetails, type ReauthenticateOptions, type RequestControl, type RequestOptions, type ResolvedTarget, type SellItemOptions, type SendResult, SessionManager, type SessionManagerEvents, type SteamAction, type SteamDescriptionLine, SteamError, SteamMobile, type SteamMobileEvents, type SteamMobileOptions, type SteamProfile, SteamSessionExpiredError, type SteamTag, SteamWebApi, type SteamWebApiOptions, TERMINAL_AUTH_ERESULTS, TRANSIENT_ERESULTS, TargetCannotTradeError, ThrottledError, TradeBanError, type TradeEvents, type TradeHistory, type TradeHistoryEntry, type TradeHistoryOptions, TradeItem, TradeNamespace, TradeOffer, type TradeOfferDeps, type TradeOfferUpdate, type TradeOffersSummary, URLS, type UserDetails, type UserPartnerDetails, type UserSideDetails, WalletBalanceLimitError, WalletCurrencyUnknownError, WebApiClient, WebTradeEligibility, buyerPaysForSellerReceives, confirmOpenid, decodeJwt, decodePreviewToken, encodePreviewToken, feeInfoFromWalletInfo, feesForBuyerPays, getPriceValueAsInt, getTradeHistory, getTradeOffersSummary, getTradeStatus, isTerminalAuthEResult, isTerminalState, isTransientEResult, landingBuyerPays, loginWithCredentials, parseInventory, parseMarketHistory, parseOpenidForm, parsePartnerInventory, priceTextCurrency, resolveMobileProfile, resolveTarget, secondsUntilExpiry, sellerReceivesForBuyerPays, steamOpenidLogin, summarizeOrderbook };
1905
2041
  //# sourceMappingURL=index.d.mts.map