@symmio/trading-core 3.5.0 → 4.0.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/dist/gasless/delegation-preflight.d.ts +22 -0
- package/dist/gasless/delegation-preflight.d.ts.map +1 -1
- package/dist/gasless/delegation-preflight.js +34 -19
- package/dist/gasless/delegation-preflight.js.map +1 -1
- package/dist/index.d.ts +14 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +248 -243
- package/dist/pools/index.d.ts +1 -0
- package/dist/pools/index.d.ts.map +1 -1
- package/dist/pools/markets/get-listing-markets.d.ts +2 -0
- package/dist/pools/markets/get-listing-markets.d.ts.map +1 -1
- package/dist/pools/markets/get-listing-markets.js +1 -0
- package/dist/pools/markets/get-listing-markets.js.map +1 -1
- package/dist/pools/markets/query.d.ts.map +1 -1
- package/dist/pools/markets/query.js +1 -0
- package/dist/pools/markets/query.js.map +1 -1
- package/dist/pools/markets/to-search-params.d.ts +1 -0
- package/dist/pools/markets/to-search-params.d.ts.map +1 -1
- package/dist/pools/markets/to-search-params.js +1 -1
- package/dist/pools/markets/to-search-params.js.map +1 -1
- package/dist/pools/token-price/get-token-price.d.ts +71 -0
- package/dist/pools/token-price/get-token-price.d.ts.map +1 -0
- package/dist/pools/token-price/get-token-price.js +30 -0
- package/dist/pools/token-price/get-token-price.js.map +1 -0
- package/dist/pools/token-price/index.d.ts +4 -0
- package/dist/pools/token-price/index.d.ts.map +1 -0
- package/dist/pools/token-price/query.d.ts +52 -0
- package/dist/pools/token-price/query.d.ts.map +1 -0
- package/dist/pools/token-price/query.js +29 -0
- package/dist/pools/token-price/query.js.map +1 -0
- package/dist/pools/token-price/to-token-price.d.ts +14 -0
- package/dist/pools/token-price/to-token-price.d.ts.map +1 -0
- package/dist/pools/token-price/to-token-price.js +8 -0
- package/dist/pools/token-price/to-token-price.js.map +1 -0
- package/dist/pools/transactions/get-pool-transactions.d.ts +59 -17
- package/dist/pools/transactions/get-pool-transactions.d.ts.map +1 -1
- package/dist/pools/transactions/get-pool-transactions.js +7 -4
- package/dist/pools/transactions/get-pool-transactions.js.map +1 -1
- package/dist/pools/transactions/query.d.ts +6 -2
- package/dist/pools/transactions/query.d.ts.map +1 -1
- package/dist/pools/transactions/query.js +12 -13
- package/dist/pools/transactions/query.js.map +1 -1
- package/dist/pools/transactions/to-pool-transaction.d.ts +7 -0
- package/dist/pools/transactions/to-pool-transaction.d.ts.map +1 -1
- package/dist/pools/transactions/to-pool-transaction.js +3 -1
- package/dist/pools/transactions/to-pool-transaction.js.map +1 -1
- package/dist/pools/types/generated/listing-backend.js +8 -8
- package/dist/pools/types/generated/listing-backend.js.map +1 -1
- package/dist/pools/types.d.ts +53 -10
- package/dist/pools/types.d.ts.map +1 -1
- package/dist/pools/types.js +6 -4
- package/dist/pools/types.js.map +1 -1
- package/dist/solvers/estimated-price/get-estimated-price.d.ts +2 -0
- package/dist/solvers/estimated-price/get-estimated-price.d.ts.map +1 -1
- package/dist/solvers/estimated-price/get-estimated-price.js +4 -1
- package/dist/solvers/estimated-price/get-estimated-price.js.map +1 -1
- package/dist/solvers/estimated-price/query.d.ts +6 -2
- package/dist/solvers/estimated-price/query.d.ts.map +1 -1
- package/dist/solvers/estimated-price/query.js +3 -2
- package/dist/solvers/estimated-price/query.js.map +1 -1
- package/dist/solvers/funding-info/adapters/enigma-funding-info.d.ts +4 -0
- package/dist/solvers/funding-info/adapters/enigma-funding-info.d.ts.map +1 -0
- package/dist/solvers/funding-info/adapters/enigma-funding-info.js +17 -0
- package/dist/solvers/funding-info/adapters/enigma-funding-info.js.map +1 -0
- package/dist/solvers/funding-info/adapters/rasa-funding-info.d.ts +4 -0
- package/dist/solvers/funding-info/adapters/rasa-funding-info.d.ts.map +1 -0
- package/dist/solvers/funding-info/adapters/rasa-funding-info.js +21 -0
- package/dist/solvers/funding-info/adapters/rasa-funding-info.js.map +1 -0
- package/dist/solvers/funding-info/get-funding-info.d.ts +22 -13
- package/dist/solvers/funding-info/get-funding-info.d.ts.map +1 -1
- package/dist/solvers/funding-info/get-funding-info.js +24 -12
- package/dist/solvers/funding-info/get-funding-info.js.map +1 -1
- package/dist/solvers/funding-info/query.d.ts +14 -6
- package/dist/solvers/funding-info/query.d.ts.map +1 -1
- package/dist/solvers/funding-info/query.js +1 -0
- package/dist/solvers/funding-info/query.js.map +1 -1
- package/dist/solvers/funding-info/to-funding-info.d.ts +8 -4
- package/dist/solvers/funding-info/to-funding-info.d.ts.map +1 -1
- package/dist/solvers/funding-info/to-funding-info.js +2 -1
- package/dist/solvers/funding-info/to-funding-info.js.map +1 -1
- package/dist/solvers/funding-info/types.d.ts +26 -4
- package/dist/solvers/funding-info/types.d.ts.map +1 -1
- package/dist/solvers/instant-close/instant-close/instant-close.d.ts +8 -1
- package/dist/solvers/instant-close/instant-close/instant-close.d.ts.map +1 -1
- package/dist/solvers/instant-close/instant-close/instant-close.js +40 -32
- package/dist/solvers/instant-close/instant-close/instant-close.js.map +1 -1
- package/dist/solvers/instant-close/instant-close-bulk/instant-close-bulk.d.ts +7 -1
- package/dist/solvers/instant-close/instant-close-bulk/instant-close-bulk.d.ts.map +1 -1
- package/dist/solvers/instant-close/instant-close-bulk/instant-close-bulk.js +48 -40
- package/dist/solvers/instant-close/instant-close-bulk/instant-close-bulk.js.map +1 -1
- package/dist/solvers/instant-close/instant-close-bulk-auto/instant-close-bulk-auto.d.ts +4 -2
- package/dist/solvers/instant-close/instant-close-bulk-auto/instant-close-bulk-auto.d.ts.map +1 -1
- package/dist/solvers/instant-close/instant-close-bulk-auto/instant-close-bulk-auto.js +1 -0
- package/dist/solvers/instant-close/instant-close-bulk-auto/instant-close-bulk-auto.js.map +1 -1
- package/dist/solvers/instant-close/prepare-instant-close-params/prepare-instant-close-params.d.ts +4 -2
- package/dist/solvers/instant-close/prepare-instant-close-params/prepare-instant-close-params.d.ts.map +1 -1
- package/dist/solvers/instant-close/prepare-instant-close-params/prepare-instant-close-params.js +2 -1
- package/dist/solvers/instant-close/prepare-instant-close-params/prepare-instant-close-params.js.map +1 -1
- package/dist/solvers/instant-open/instant-open/adapters/enigma-instant-open.d.ts +2 -0
- package/dist/solvers/instant-open/instant-open/adapters/enigma-instant-open.d.ts.map +1 -1
- package/dist/solvers/instant-open/instant-open/adapters/enigma-instant-open.js +64 -56
- package/dist/solvers/instant-open/instant-open/adapters/enigma-instant-open.js.map +1 -1
- package/dist/solvers/instant-open/instant-open/adapters/rasa-instant-open.d.ts +2 -0
- package/dist/solvers/instant-open/instant-open/adapters/rasa-instant-open.d.ts.map +1 -1
- package/dist/solvers/instant-open/instant-open/adapters/rasa-instant-open.js +51 -43
- package/dist/solvers/instant-open/instant-open/adapters/rasa-instant-open.js.map +1 -1
- package/dist/solvers/instant-open/instant-open/instant-open.d.ts +6 -0
- package/dist/solvers/instant-open/instant-open/instant-open.d.ts.map +1 -1
- package/dist/solvers/instant-open/instant-open/instant-open.js.map +1 -1
- package/dist/solvers/instant-open/instant-open/types.d.ts +2 -1
- package/dist/solvers/instant-open/instant-open/types.d.ts.map +1 -1
- package/dist/solvers/instant-open/prepare-instant-open-params/prepare-instant-open-params.d.ts +3 -1
- package/dist/solvers/instant-open/prepare-instant-open-params/prepare-instant-open-params.d.ts.map +1 -1
- package/dist/solvers/instant-open/prepare-instant-open-params/prepare-instant-open-params.js +2 -1
- package/dist/solvers/instant-open/prepare-instant-open-params/prepare-instant-open-params.js.map +1 -1
- package/dist/solvers/market-info/adapters/enigma-market-info.d.ts +3 -3
- package/dist/solvers/market-info/adapters/enigma-market-info.d.ts.map +1 -1
- package/dist/solvers/market-info/adapters/enigma-market-info.js +7 -5
- package/dist/solvers/market-info/adapters/enigma-market-info.js.map +1 -1
- package/dist/solvers/market-info/get-market-info.d.ts +3 -2
- package/dist/solvers/market-info/get-market-info.d.ts.map +1 -1
- package/dist/solvers/market-info/get-market-info.js.map +1 -1
- package/dist/solvers/market-info/types.d.ts +4 -3
- package/dist/solvers/market-info/types.d.ts.map +1 -1
- package/dist/solvers/notional-cap/get-notional-cap-all.d.ts +10 -10
- package/dist/solvers/notional-cap/get-notional-cap-all.d.ts.map +1 -1
- package/dist/solvers/notional-cap/get-notional-cap-all.js +26 -23
- package/dist/solvers/notional-cap/get-notional-cap-all.js.map +1 -1
- package/dist/solvers/notional-cap/get-notional-cap-page.d.ts +49 -0
- package/dist/solvers/notional-cap/get-notional-cap-page.d.ts.map +1 -0
- package/dist/solvers/notional-cap/get-notional-cap-page.js +37 -0
- package/dist/solvers/notional-cap/get-notional-cap-page.js.map +1 -0
- package/dist/solvers/notional-cap/index.d.ts +2 -0
- package/dist/solvers/notional-cap/index.d.ts.map +1 -1
- package/dist/solvers/notional-cap/query-page.d.ts +45 -0
- package/dist/solvers/notional-cap/query-page.d.ts.map +1 -0
- package/dist/solvers/notional-cap/query-page.js +26 -0
- package/dist/solvers/notional-cap/query-page.js.map +1 -0
- package/dist/solvers/shared/index.d.ts +1 -0
- package/dist/solvers/shared/index.d.ts.map +1 -1
- package/dist/solvers/shared/instant-delegation-preflight.d.ts +65 -0
- package/dist/solvers/shared/instant-delegation-preflight.d.ts.map +1 -0
- package/dist/solvers/shared/instant-delegation-preflight.js +34 -0
- package/dist/solvers/shared/instant-delegation-preflight.js.map +1 -0
- package/dist/solvers/symbols/get-symbols.d.ts +3 -2
- package/dist/solvers/symbols/get-symbols.d.ts.map +1 -1
- package/dist/solvers/symbols/get-symbols.js +17 -3
- package/dist/solvers/symbols/get-symbols.js.map +1 -1
- package/dist/solvers/trade-volume/get-trade-volume.d.ts +2 -1
- package/dist/solvers/trade-volume/get-trade-volume.d.ts.map +1 -1
- package/dist/solvers/trade-volume/get-trade-volume.js +6 -1
- package/dist/solvers/trade-volume/get-trade-volume.js.map +1 -1
- package/dist/solvers/trade-volume/to-daily-volume.d.ts +6 -6
- package/dist/solvers/trade-volume/to-daily-volume.js.map +1 -1
- package/dist/solvers/trade-volume/types.d.ts +4 -3
- package/dist/solvers/trade-volume/types.d.ts.map +1 -1
- package/dist/solvers/types/generated/enigma-solver.js +3 -3
- package/dist/solvers/types/generated/enigma-solver.js.map +1 -1
- package/dist/solvers/types/generated/rasa-solver.js +8 -2
- package/dist/solvers/types/generated/rasa-solver.js.map +1 -1
- package/package.json +3 -3
package/dist/pools/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export * from './resolve-listing.js';
|
|
|
16
16
|
export * from './resolve-pool-source.js';
|
|
17
17
|
export * from './retry-listing/index.js';
|
|
18
18
|
export * from './rewards/index.js';
|
|
19
|
+
export * from './token-price/index.js';
|
|
19
20
|
export * from './trade-history/index.js';
|
|
20
21
|
export * from './transactions/index.js';
|
|
21
22
|
export * from './types.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pools/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pools/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC;AACvB,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC"}
|
|
@@ -23,6 +23,8 @@ export type GetListingMarketsParameters = Compute<ChainIdParameter & {
|
|
|
23
23
|
chainIds?: readonly ListingDepositChainId[];
|
|
24
24
|
/** Restrict to one lifecycle status. */
|
|
25
25
|
marketStatus?: ListingMarketStatus;
|
|
26
|
+
/** Filter by inventory lock state. Omit for both; false explicitly requests unlocked markets. */
|
|
27
|
+
isLocked?: boolean;
|
|
26
28
|
/** Page size, `1`–`100`. Service default `20`. */
|
|
27
29
|
limit?: number;
|
|
28
30
|
/** Row offset. Service default `0`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-listing-markets.d.ts","sourceRoot":"","sources":["../../../src/pools/markets/get-listing-markets.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAE/E,OAAO,KAAK,EACV,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,UAAU,CAAC;AAKlB;;;;;GAKG;AACH,MAAM,MAAM,2BAA2B,GAAG,OAAO,CAC/C,gBAAgB,GAAG;IACjB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,qBAAqB,EAAE,CAAC;IAC5C,wCAAwC;IACxC,YAAY,CAAC,EAAE,mBAAmB,CAAC;IACnC,kDAAkD;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4BAA4B;IAC5B,MAAM,CAAC,EAAE,sBAAsB,CAAC;IAChC,gDAAgD;IAChD,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,uCAAuC;IACvC,OAAO,CAAC,EAAE,oBAAoB,CAAC;CAChC,CACF,CAAC;AAEF,0EAA0E;AAC1E,MAAM,MAAM,2BAA2B,GAAG,iBAAiB,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,UAAU,GAAE,2BAAgC,GAC3C,OAAO,CAAC,2BAA2B,CAAC,
|
|
1
|
+
{"version":3,"file":"get-listing-markets.d.ts","sourceRoot":"","sources":["../../../src/pools/markets/get-listing-markets.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAE/E,OAAO,KAAK,EACV,qBAAqB,EACrB,oBAAoB,EACpB,iBAAiB,EACjB,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,UAAU,CAAC;AAKlB;;;;;GAKG;AACH,MAAM,MAAM,2BAA2B,GAAG,OAAO,CAC/C,gBAAgB,GAAG;IACjB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,qBAAqB,EAAE,CAAC;IAC5C,wCAAwC;IACxC,YAAY,CAAC,EAAE,mBAAmB,CAAC;IACnC,iGAAiG;IACjG,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kDAAkD;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4BAA4B;IAC5B,MAAM,CAAC,EAAE,sBAAsB,CAAC;IAChC,gDAAgD;IAChD,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,uCAAuC;IACvC,OAAO,CAAC,EAAE,oBAAoB,CAAC;CAChC,CACF,CAAC;AAEF,0EAA0E;AAC1E,MAAM,MAAM,2BAA2B,GAAG,iBAAiB,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,MAAM,EACd,UAAU,GAAE,2BAAgC,GAC3C,OAAO,CAAC,2BAA2B,CAAC,CAwCtC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-listing-markets.js","names":[],"sources":["../../../src/pools/markets/get-listing-markets.ts"],"sourcesContent":["import { isAxiosError } from \"axios\";\nimport type { Config } from \"../../core/config\";\nimport { SymmApiError, SymmError } from \"../../shared/errors/symm-error\";\nimport type { ChainIdParameter, Compute } from \"../../shared/types/properties\";\nimport { resolveListingService } from \"../resolve-listing\";\nimport type {\n ListingDepositChainId,\n ListingMarketFilters,\n ListingMarketPage,\n ListingMarketSortField,\n ListingMarketStatus,\n ListingSortDirection,\n} from \"../types\";\nimport { marketSearchV2MarketSearchGet } from \"../types/generated/listing-backend\";\nimport { toListingMarketPage } from \"./to-listing-market\";\nimport { toSearchParams } from \"./to-search-params\";\n\n/**\n * Parameters for {@link getListingMarkets}.\n *\n * Every field is optional: with none set the service returns its default first\n * page (20 rows, newest-listed first).\n */\nexport type GetListingMarketsParameters = Compute<\n ChainIdParameter & {\n /**\n * Free-text search, matched against contract address, ticker, and token\n * name.\n *\n * Named `search` rather than `query` because the TanStack options bag on the\n * matching query factory already owns `query`.\n */\n search?: string;\n /**\n * Restrict to tokens deposited on these chains. An empty array is sent as\n * no filter, matching the service's behavior for an absent param.\n */\n chainIds?: readonly ListingDepositChainId[];\n /** Restrict to one lifecycle status. */\n marketStatus?: ListingMarketStatus;\n /** Page size, `1`–`100`. Service default `20`. */\n limit?: number;\n /** Row offset. Service default `0`. */\n offset?: number;\n /** Server-side sort key. */\n sortBy?: ListingMarketSortField;\n /** Sort direction. Service default `\"desc\"`. */\n orderBy?: ListingSortDirection;\n /** Inclusive numeric range filters. */\n filters?: ListingMarketFilters;\n }\n>;\n\n/** Return type of {@link getListingMarkets}: one page of catalog rows. */\nexport type GetListingMarketsReturnType = ListingMarketPage;\n\n/**\n * Fetch a page of the permissionless-listing market catalog — the data behind a\n * pools list.\n *\n * The catalog spans every listing the service knows about, at every lifecycle\n * stage; pass `marketStatus: ListingMarketStatus.LISTED` to see only tradable\n * markets. Rows come back newest-listed first unless `sortBy` is set.\n *\n * @param config - The SDK config.\n * @param parameters - Search, filter, sort, and pagination inputs.\n * @returns One page of {@link ListingMarketPage} rows plus the total row count.\n * @throws {SymmApiError} when the service request fails.\n * @throws {SymmError} `LISTING_NOT_CONFIGURED` when the chain has no listing\n * backend. Gate with `supportsListingService` to hide Pools instead.\n *\n * @example\n * ```ts\n * const page = await getListingMarkets(config, {\n * marketStatus: ListingMarketStatus.LISTED,\n * sortBy: \"tvl\",\n * orderBy: \"desc\",\n * limit: 50,\n * });\n * ```\n */\nexport async function getListingMarkets(\n config: Config,\n parameters: GetListingMarketsParameters = {},\n): Promise<GetListingMarketsReturnType> {\n const { url: baseURL } = resolveListingService(config, { chainId: parameters.chainId });\n\n const params = toSearchParams({\n query: parameters.search,\n chainIds: parameters.chainIds,\n marketStatus: parameters.marketStatus,\n limit: parameters.limit,\n offset: parameters.offset,\n sortBy: parameters.sortBy,\n orderBy: parameters.orderBy,\n filters: parameters.filters,\n });\n\n try {\n const response = await marketSearchV2MarketSearchGet(params, {\n baseURL,\n // The service expects repeated keys for array params (`chain_ids=1&chain_ids=2`).\n // Axios's default bracket form (`chain_ids[]=1`) is not rejected — it is\n // silently *ignored*, so the chain filter would drop and the caller would\n // get the whole catalog back. `indexes: null` selects the repeat form.\n paramsSerializer: { indexes: null },\n });\n\n return toListingMarketPage(response.data);\n } catch (err) {\n if (err instanceof SymmError) throw err;\n\n if (isAxiosError(err)) {\n throw SymmApiError.fromAxios(err, { code: \"FETCH_LISTING_MARKETS_FAILED\", baseURL });\n }\n\n throw new SymmError(\n \"api\",\n \"FETCH_LISTING_MARKETS_FAILED\",\n `Failed to fetch listing markets: ${err instanceof Error ? err.message : String(err)}`,\n { cause: err instanceof Error ? err : undefined },\n );\n }\n}\n"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"get-listing-markets.js","names":[],"sources":["../../../src/pools/markets/get-listing-markets.ts"],"sourcesContent":["import { isAxiosError } from \"axios\";\nimport type { Config } from \"../../core/config\";\nimport { SymmApiError, SymmError } from \"../../shared/errors/symm-error\";\nimport type { ChainIdParameter, Compute } from \"../../shared/types/properties\";\nimport { resolveListingService } from \"../resolve-listing\";\nimport type {\n ListingDepositChainId,\n ListingMarketFilters,\n ListingMarketPage,\n ListingMarketSortField,\n ListingMarketStatus,\n ListingSortDirection,\n} from \"../types\";\nimport { marketSearchV2MarketSearchGet } from \"../types/generated/listing-backend\";\nimport { toListingMarketPage } from \"./to-listing-market\";\nimport { toSearchParams } from \"./to-search-params\";\n\n/**\n * Parameters for {@link getListingMarkets}.\n *\n * Every field is optional: with none set the service returns its default first\n * page (20 rows, newest-listed first).\n */\nexport type GetListingMarketsParameters = Compute<\n ChainIdParameter & {\n /**\n * Free-text search, matched against contract address, ticker, and token\n * name.\n *\n * Named `search` rather than `query` because the TanStack options bag on the\n * matching query factory already owns `query`.\n */\n search?: string;\n /**\n * Restrict to tokens deposited on these chains. An empty array is sent as\n * no filter, matching the service's behavior for an absent param.\n */\n chainIds?: readonly ListingDepositChainId[];\n /** Restrict to one lifecycle status. */\n marketStatus?: ListingMarketStatus;\n /** Filter by inventory lock state. Omit for both; false explicitly requests unlocked markets. */\n isLocked?: boolean;\n /** Page size, `1`–`100`. Service default `20`. */\n limit?: number;\n /** Row offset. Service default `0`. */\n offset?: number;\n /** Server-side sort key. */\n sortBy?: ListingMarketSortField;\n /** Sort direction. Service default `\"desc\"`. */\n orderBy?: ListingSortDirection;\n /** Inclusive numeric range filters. */\n filters?: ListingMarketFilters;\n }\n>;\n\n/** Return type of {@link getListingMarkets}: one page of catalog rows. */\nexport type GetListingMarketsReturnType = ListingMarketPage;\n\n/**\n * Fetch a page of the permissionless-listing market catalog — the data behind a\n * pools list.\n *\n * The catalog spans every listing the service knows about, at every lifecycle\n * stage; pass `marketStatus: ListingMarketStatus.LISTED` to see only tradable\n * markets. Rows come back newest-listed first unless `sortBy` is set.\n *\n * @param config - The SDK config.\n * @param parameters - Search, filter, sort, and pagination inputs.\n * @returns One page of {@link ListingMarketPage} rows plus the total row count.\n * @throws {SymmApiError} when the service request fails.\n * @throws {SymmError} `LISTING_NOT_CONFIGURED` when the chain has no listing\n * backend. Gate with `supportsListingService` to hide Pools instead.\n *\n * @example\n * ```ts\n * const page = await getListingMarkets(config, {\n * marketStatus: ListingMarketStatus.LISTED,\n * sortBy: \"tvl\",\n * orderBy: \"desc\",\n * limit: 50,\n * });\n * ```\n */\nexport async function getListingMarkets(\n config: Config,\n parameters: GetListingMarketsParameters = {},\n): Promise<GetListingMarketsReturnType> {\n const { url: baseURL } = resolveListingService(config, { chainId: parameters.chainId });\n\n const params = toSearchParams({\n query: parameters.search,\n chainIds: parameters.chainIds,\n marketStatus: parameters.marketStatus,\n isLocked: parameters.isLocked,\n limit: parameters.limit,\n offset: parameters.offset,\n sortBy: parameters.sortBy,\n orderBy: parameters.orderBy,\n filters: parameters.filters,\n });\n\n try {\n const response = await marketSearchV2MarketSearchGet(params, {\n baseURL,\n // The service expects repeated keys for array params (`chain_ids=1&chain_ids=2`).\n // Axios's default bracket form (`chain_ids[]=1`) is not rejected — it is\n // silently *ignored*, so the chain filter would drop and the caller would\n // get the whole catalog back. `indexes: null` selects the repeat form.\n paramsSerializer: { indexes: null },\n });\n\n return toListingMarketPage(response.data);\n } catch (err) {\n if (err instanceof SymmError) throw err;\n\n if (isAxiosError(err)) {\n throw SymmApiError.fromAxios(err, { code: \"FETCH_LISTING_MARKETS_FAILED\", baseURL });\n }\n\n throw new SymmError(\n \"api\",\n \"FETCH_LISTING_MARKETS_FAILED\",\n `Failed to fetch listing markets: ${err instanceof Error ? err.message : String(err)}`,\n { cause: err instanceof Error ? err : undefined },\n );\n }\n}\n"],"mappings":";;;;;;;AAmFA,eAAsB,EACpB,GACA,IAA0C,CAAC,GACL;CACtC,IAAM,EAAE,KAAK,MAAY,EAAsB,GAAQ,EAAE,SAAS,EAAW,QAAQ,CAAC,GAEhF,IAAS,EAAe;EAC5B,OAAO,EAAW;EAClB,UAAU,EAAW;EACrB,cAAc,EAAW;EACzB,UAAU,EAAW;EACrB,OAAO,EAAW;EAClB,QAAQ,EAAW;EACnB,QAAQ,EAAW;EACnB,SAAS,EAAW;EACpB,SAAS,EAAW;CACtB,CAAC;CAED,IAAI;EAUF,OAAO,GAAoB,MATJ,EAA8B,GAAQ;GAC3D;GAKA,kBAAkB,EAAE,SAAS,KAAK;EACpC,CAAC,GAEmC,IAAI;CAC1C,SAAS,GAAK;EAOZ,MANI,aAAe,IAAiB,IAEhC,EAAa,CAAG,IACZ,EAAa,UAAU,GAAK;GAAE,MAAM;GAAgC;EAAQ,CAAC,IAG/E,IAAI,EACR,OACA,gCACA,oCAAoC,aAAe,QAAQ,EAAI,UAAU,OAAO,CAAG,KACnF,EAAE,OAAO,aAAe,QAAQ,IAAM,KAAA,EAAU,CAClD;CACF;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../src/pools/markets/query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnF,OAAO,EAEL,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,EACjC,MAAM,uBAAuB,CAAC;AAE/B,wEAAwE;AACxE,MAAM,MAAM,qBAAqB,GAAG,2BAA2B,CAAC;AAEhE;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,CAAC,2BAA2B,GAAG,kBAAkB,CAAC,2DAE3G;AAED,oEAAoE;AACpE,MAAM,MAAM,yBAAyB,GAAG,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAErF;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG,OAAO,CAC5C,2BAA2B,GACzB,cAAc,CAAC,qBAAqB,EAAE,KAAK,EAAE,qBAAqB,EAAE,yBAAyB,CAAC,CACjG,CAAC;AAEF,gFAAgF;AAChF,MAAM,MAAM,6BAA6B,GAAG,kBAAkB,CAC5D,qBAAqB,EACrB,KAAK,EACL,qBAAqB,EACrB,yBAAyB,CAC1B,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,wBAA6B,GACrC,6BAA6B,
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../src/pools/markets/query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnF,OAAO,EAEL,KAAK,2BAA2B,EAChC,KAAK,2BAA2B,EACjC,MAAM,uBAAuB,CAAC;AAE/B,wEAAwE;AACxE,MAAM,MAAM,qBAAqB,GAAG,2BAA2B,CAAC;AAEhE;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,OAAO,CAAC,2BAA2B,GAAG,kBAAkB,CAAC,2DAE3G;AAED,oEAAoE;AACpE,MAAM,MAAM,yBAAyB,GAAG,UAAU,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAErF;;;GAGG;AACH,MAAM,MAAM,wBAAwB,GAAG,OAAO,CAC5C,2BAA2B,GACzB,cAAc,CAAC,qBAAqB,EAAE,KAAK,EAAE,qBAAqB,EAAE,yBAAyB,CAAC,CACjG,CAAC;AAEF,gFAAgF;AAChF,MAAM,MAAM,6BAA6B,GAAG,kBAAkB,CAC5D,qBAAqB,EACrB,KAAK,EACL,qBAAqB,EACrB,yBAAyB,CAC1B,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,MAAM,EACd,OAAO,GAAE,wBAA6B,GACrC,6BAA6B,CAsB/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"query.js","names":[],"sources":["../../../src/pools/markets/query.ts"],"sourcesContent":["import type { Config } from \"../../core/config\";\nimport type { Compute, ConfigKeyParameter } from \"../../shared/types/properties\";\nimport type { QueryParameter, SymmioQueryOptions } from \"../../shared/types/query\";\nimport { filterQueryOptions } from \"../../shared/utils/query\";\nimport {\n getListingMarkets,\n type GetListingMarketsParameters,\n type GetListingMarketsReturnType,\n} from \"./get-listing-markets\";\n\n/** Data resolved by the {@link getListingMarketsQueryOptions} query. */\nexport type GetListingMarketsData = GetListingMarketsReturnType;\n\n/**\n * Build the TanStack Query key for {@link getListingMarketsQueryOptions}.\n *\n * @param options - Search parameters plus the resolved config key.\n * @returns A stable, hashable query key.\n */\nexport function getListingMarketsQueryKey(options: Compute<GetListingMarketsParameters & ConfigKeyParameter>) {\n return [\"getListingMarkets\", filterQueryOptions(options)] as const;\n}\n\n/** Query-key type produced by {@link getListingMarketsQueryKey}. */\nexport type GetListingMarketsQueryKey = ReturnType<typeof getListingMarketsQueryKey>;\n\n/**\n * Options accepted by {@link getListingMarketsQueryOptions}: the action's\n * parameters, an optional cache scope, and TanStack overrides.\n */\nexport type GetListingMarketsOptions = Compute<\n GetListingMarketsParameters &\n QueryParameter<GetListingMarketsData, Error, GetListingMarketsData, GetListingMarketsQueryKey>\n>;\n\n/** TanStack Query options returned by {@link getListingMarketsQueryOptions}. */\nexport type GetListingMarketsQueryOptions = SymmioQueryOptions<\n GetListingMarketsData,\n Error,\n GetListingMarketsData,\n GetListingMarketsQueryKey\n>;\n\n/**\n * Build TanStack Query options for {@link getListingMarkets}.\n *\n * @param config - The SDK config.\n * @param options - Search parameters and TanStack overrides.\n * @returns Options to pass to `useQuery` / `queryClient.fetchQuery`.\n *\n * @example\n * ```ts\n * useQuery(getListingMarketsQueryOptions(config, { sortBy: \"tvl\", limit: 50 }));\n * ```\n */\nexport function getListingMarketsQueryOptions(\n config: Config,\n options: GetListingMarketsOptions = {},\n): GetListingMarketsQueryOptions {\n return {\n ...options.query,\n queryKey: getListingMarketsQueryKey({\n ...options,\n configKey: config.getChainConfigKey(options.chainId),\n }),\n enabled: options.query?.enabled ?? true,\n queryFn: () =>\n getListingMarkets(config, {\n chainId: options.chainId,\n search: options.search,\n chainIds: options.chainIds,\n marketStatus: options.marketStatus,\n limit: options.limit,\n offset: options.offset,\n sortBy: options.sortBy,\n orderBy: options.orderBy,\n filters: options.filters,\n }),\n };\n}\n"],"mappings":";;;AAmBA,SAAgB,EAA0B,GAAoE;CAC5G,OAAO,CAAC,qBAAqB,EAAmB,CAAO,CAAC;AAC1D;AAkCA,SAAgB,EACd,GACA,IAAoC,CAAC,GACN;CAC/B,OAAO;EACL,GAAG,EAAQ;EACX,UAAU,EAA0B;GAClC,GAAG;GACH,WAAW,EAAO,kBAAkB,EAAQ,OAAO;EACrD,CAAC;EACD,SAAS,EAAQ,OAAO,WAAW;EACnC,eACE,EAAkB,GAAQ;GACxB,SAAS,EAAQ;GACjB,QAAQ,EAAQ;GAChB,UAAU,EAAQ;GAClB,cAAc,EAAQ;GACtB,OAAO,EAAQ;GACf,QAAQ,EAAQ;GAChB,QAAQ,EAAQ;GAChB,SAAS,EAAQ;GACjB,SAAS,EAAQ;EACnB,CAAC;CACL;AACF"}
|
|
1
|
+
{"version":3,"file":"query.js","names":[],"sources":["../../../src/pools/markets/query.ts"],"sourcesContent":["import type { Config } from \"../../core/config\";\nimport type { Compute, ConfigKeyParameter } from \"../../shared/types/properties\";\nimport type { QueryParameter, SymmioQueryOptions } from \"../../shared/types/query\";\nimport { filterQueryOptions } from \"../../shared/utils/query\";\nimport {\n getListingMarkets,\n type GetListingMarketsParameters,\n type GetListingMarketsReturnType,\n} from \"./get-listing-markets\";\n\n/** Data resolved by the {@link getListingMarketsQueryOptions} query. */\nexport type GetListingMarketsData = GetListingMarketsReturnType;\n\n/**\n * Build the TanStack Query key for {@link getListingMarketsQueryOptions}.\n *\n * @param options - Search parameters plus the resolved config key.\n * @returns A stable, hashable query key.\n */\nexport function getListingMarketsQueryKey(options: Compute<GetListingMarketsParameters & ConfigKeyParameter>) {\n return [\"getListingMarkets\", filterQueryOptions(options)] as const;\n}\n\n/** Query-key type produced by {@link getListingMarketsQueryKey}. */\nexport type GetListingMarketsQueryKey = ReturnType<typeof getListingMarketsQueryKey>;\n\n/**\n * Options accepted by {@link getListingMarketsQueryOptions}: the action's\n * parameters, an optional cache scope, and TanStack overrides.\n */\nexport type GetListingMarketsOptions = Compute<\n GetListingMarketsParameters &\n QueryParameter<GetListingMarketsData, Error, GetListingMarketsData, GetListingMarketsQueryKey>\n>;\n\n/** TanStack Query options returned by {@link getListingMarketsQueryOptions}. */\nexport type GetListingMarketsQueryOptions = SymmioQueryOptions<\n GetListingMarketsData,\n Error,\n GetListingMarketsData,\n GetListingMarketsQueryKey\n>;\n\n/**\n * Build TanStack Query options for {@link getListingMarkets}.\n *\n * @param config - The SDK config.\n * @param options - Search parameters and TanStack overrides.\n * @returns Options to pass to `useQuery` / `queryClient.fetchQuery`.\n *\n * @example\n * ```ts\n * useQuery(getListingMarketsQueryOptions(config, { sortBy: \"tvl\", limit: 50 }));\n * ```\n */\nexport function getListingMarketsQueryOptions(\n config: Config,\n options: GetListingMarketsOptions = {},\n): GetListingMarketsQueryOptions {\n return {\n ...options.query,\n queryKey: getListingMarketsQueryKey({\n ...options,\n configKey: config.getChainConfigKey(options.chainId),\n }),\n enabled: options.query?.enabled ?? true,\n queryFn: () =>\n getListingMarkets(config, {\n chainId: options.chainId,\n search: options.search,\n chainIds: options.chainIds,\n marketStatus: options.marketStatus,\n isLocked: options.isLocked,\n limit: options.limit,\n offset: options.offset,\n sortBy: options.sortBy,\n orderBy: options.orderBy,\n filters: options.filters,\n }),\n };\n}\n"],"mappings":";;;AAmBA,SAAgB,EAA0B,GAAoE;CAC5G,OAAO,CAAC,qBAAqB,EAAmB,CAAO,CAAC;AAC1D;AAkCA,SAAgB,EACd,GACA,IAAoC,CAAC,GACN;CAC/B,OAAO;EACL,GAAG,EAAQ;EACX,UAAU,EAA0B;GAClC,GAAG;GACH,WAAW,EAAO,kBAAkB,EAAQ,OAAO;EACrD,CAAC;EACD,SAAS,EAAQ,OAAO,WAAW;EACnC,eACE,EAAkB,GAAQ;GACxB,SAAS,EAAQ;GACjB,QAAQ,EAAQ;GAChB,UAAU,EAAQ;GAClB,cAAc,EAAQ;GACtB,UAAU,EAAQ;GAClB,OAAO,EAAQ;GACf,QAAQ,EAAQ;GAChB,QAAQ,EAAQ;GAChB,SAAS,EAAQ;GACjB,SAAS,EAAQ;EACnB,CAAC;CACL;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-search-params.d.ts","sourceRoot":"","sources":["../../../src/pools/markets/to-search-params.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAuC,MAAM,UAAU,CAAC;AAC1F,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,oCAAoC,CAAC;AAoC9F;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAcrF;AAED,8DAA8D;AAC9D,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,oBAAoB,CAAC;CAChC;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,mCAAmC,
|
|
1
|
+
{"version":3,"file":"to-search-params.d.ts","sourceRoot":"","sources":["../../../src/pools/markets/to-search-params.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAuC,MAAM,UAAU,CAAC;AAC1F,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,oCAAoC,CAAC;AAoC9F;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,OAAO,CAAC,EAAE,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAcrF;AAED,8DAA8D;AAC9D,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,KAAK,GAAG,MAAM,CAAC;IACzB,OAAO,CAAC,EAAE,oBAAoB,CAAC;CAChC;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,GAAG,mCAAmC,CAa9F"}
|
|
@@ -34,7 +34,7 @@ function t(t) {
|
|
|
34
34
|
}
|
|
35
35
|
function n(e) {
|
|
36
36
|
let n = { ...t(e.filters) };
|
|
37
|
-
return e.query !== void 0 && (n.query = e.query), e.chainIds !== void 0 && (n.chain_ids = [...e.chainIds]), e.marketStatus !== void 0 && (n.market_status = e.marketStatus), e.limit !== void 0 && (n.limit = e.limit), e.offset !== void 0 && (n.offset = e.offset), e.sortBy !== void 0 && (n.sort_by = e.sortBy), e.orderBy !== void 0 && (n.order_by = e.orderBy), n;
|
|
37
|
+
return e.query !== void 0 && (n.query = e.query), e.chainIds !== void 0 && (n.chain_ids = [...e.chainIds]), e.marketStatus !== void 0 && (n.market_status = e.marketStatus), e.isLocked !== void 0 && (n.is_locked = e.isLocked), e.limit !== void 0 && (n.limit = e.limit), e.offset !== void 0 && (n.offset = e.offset), e.sortBy !== void 0 && (n.sort_by = e.sortBy), e.orderBy !== void 0 && (n.order_by = e.orderBy), n;
|
|
38
38
|
}
|
|
39
39
|
//#endregion
|
|
40
40
|
export { n as toSearchParams };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-search-params.js","names":[],"sources":["../../../src/pools/markets/to-search-params.ts"],"sourcesContent":["import type { ListingMarketFilters, ListingTimeRange, ListingValueRange } from \"../types\";\nimport type { MarketSearchV2MarketSearchGetParams } from \"../types/generated/listing-backend\";\n\n/**\n * SDK filter key to the wire field its `__ge` / `__le` bounds attach to.\n *\n * Kept as an explicit table rather than derived from the key name: several\n * fields do not round-trip through a naive camel-to-snake conversion\n * (`vol24h`, `apr24h` → `apr_24h`, `tvlDrivenApy` → `tvl_driven_apy`), and a\n * silent mismatch here is invisible — the service ignores unknown query params\n * and returns the unfiltered catalog.\n */\nconst FILTER_WIRE_FIELD = {\n marketCap: \"market_cap\",\n vol24h: \"vol24h\",\n tvl: \"tvl\",\n liquidity: \"liquidity\",\n openInterest: \"open_interest\",\n reward24h: \"reward_24h\",\n apr: \"apr\",\n apr1h: \"apr_1h\",\n apr6h: \"apr_6h\",\n apr24h: \"apr_24h\",\n apr30d: \"apr_30d\",\n tvlDrivenApy1h: \"tvl_driven_apy_1h\",\n tvlDrivenApy6h: \"tvl_driven_apy_6h\",\n tvlDrivenApy24h: \"tvl_driven_apy_24h\",\n tvlDrivenApy30d: \"tvl_driven_apy_30d\",\n tvlDrivenApy: \"tvl_driven_apy\",\n priceDrivenApy1h: \"price_driven_apy_1h\",\n priceDrivenApy6h: \"price_driven_apy_6h\",\n priceDrivenApy24h: \"price_driven_apy_24h\",\n priceDrivenApy30d: \"price_driven_apy_30d\",\n priceDrivenApy: \"price_driven_apy\",\n listingTime: \"listing_time\",\n} as const satisfies Record<keyof ListingMarketFilters, string>;\n\n/**\n * Flatten {@link ListingMarketFilters} into the service's `{field}__ge` /\n * `{field}__le` query params.\n *\n * `bigint` bounds are stringified rather than passed through: an 18-decimal\n * value exceeds `Number.MAX_SAFE_INTEGER`, so serializing it as a number would\n * round the bound. The service accepts the string form.\n *\n * @param filters - The SDK-shaped filters, or `undefined` for none.\n * @returns A flat bag of wire params; empty when nothing is filtered.\n */\nexport function toFilterParams(filters?: ListingMarketFilters): Record<string, string> {\n if (filters === undefined) return {};\n\n const params: Record<string, string> = {};\n\n for (const [key, wireField] of Object.entries(FILTER_WIRE_FIELD)) {\n const range = filters[key as keyof ListingMarketFilters] as ListingValueRange | ListingTimeRange | undefined;\n if (range === undefined) continue;\n\n if (range.min !== undefined) params[`${wireField}__ge`] = String(range.min);\n if (range.max !== undefined) params[`${wireField}__le`] = String(range.max);\n }\n\n return params;\n}\n\n/** Non-filter query inputs {@link toSearchParams} accepts. */\nexport interface ToSearchParamsInput {\n query?: string;\n chainIds?: readonly number[];\n marketStatus?: string;\n limit?: number;\n offset?: number;\n sortBy?: string;\n orderBy?: \"asc\" | \"desc\";\n filters?: ListingMarketFilters;\n}\n\n/**\n * Build the full `/v2/market/search` query bag from SDK-shaped inputs.\n *\n * Undefined inputs are omitted entirely rather than sent as empty values, so the\n * service applies its own defaults (`limit=20`, `offset=0`, `order_by=desc`).\n *\n * @param input - SDK-shaped search inputs.\n * @returns The wire query params.\n */\nexport function toSearchParams(input: ToSearchParamsInput): MarketSearchV2MarketSearchGetParams {\n const params: Record<string, unknown> = { ...toFilterParams(input.filters) };\n\n if (input.query !== undefined) params.query = input.query;\n if (input.chainIds !== undefined) params.chain_ids = [...input.chainIds];\n if (input.marketStatus !== undefined) params.market_status = input.marketStatus;\n if (input.limit !== undefined) params.limit = input.limit;\n if (input.offset !== undefined) params.offset = input.offset;\n if (input.sortBy !== undefined) params.sort_by = input.sortBy;\n if (input.orderBy !== undefined) params.order_by = input.orderBy;\n\n return params as MarketSearchV2MarketSearchGetParams;\n}\n"],"mappings":";AAYA,IAAM,IAAoB;CACxB,WAAW;CACX,QAAQ;CACR,KAAK;CACL,WAAW;CACX,cAAc;CACd,WAAW;CACX,KAAK;CACL,OAAO;CACP,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,gBAAgB;CAChB,gBAAgB;CAChB,iBAAiB;CACjB,iBAAiB;CACjB,cAAc;CACd,kBAAkB;CAClB,kBAAkB;CAClB,mBAAmB;CACnB,mBAAmB;CACnB,gBAAgB;CAChB,aAAa;AACf;AAaA,SAAgB,EAAe,GAAwD;CACrF,IAAI,MAAY,KAAA,GAAW,OAAO,CAAC;CAEnC,IAAM,IAAiC,CAAC;CAExC,KAAK,IAAM,CAAC,GAAK,MAAc,OAAO,QAAQ,CAAiB,GAAG;EAChE,IAAM,IAAQ,EAAQ;EAClB,MAAU,KAAA,MAEV,EAAM,QAAQ,KAAA,MAAW,EAAO,GAAG,EAAU,SAAS,OAAO,EAAM,GAAG,IACtE,EAAM,QAAQ,KAAA,MAAW,EAAO,GAAG,EAAU,SAAS,OAAO,EAAM,GAAG;CAC5E;CAEA,OAAO;AACT;
|
|
1
|
+
{"version":3,"file":"to-search-params.js","names":[],"sources":["../../../src/pools/markets/to-search-params.ts"],"sourcesContent":["import type { ListingMarketFilters, ListingTimeRange, ListingValueRange } from \"../types\";\nimport type { MarketSearchV2MarketSearchGetParams } from \"../types/generated/listing-backend\";\n\n/**\n * SDK filter key to the wire field its `__ge` / `__le` bounds attach to.\n *\n * Kept as an explicit table rather than derived from the key name: several\n * fields do not round-trip through a naive camel-to-snake conversion\n * (`vol24h`, `apr24h` → `apr_24h`, `tvlDrivenApy` → `tvl_driven_apy`), and a\n * silent mismatch here is invisible — the service ignores unknown query params\n * and returns the unfiltered catalog.\n */\nconst FILTER_WIRE_FIELD = {\n marketCap: \"market_cap\",\n vol24h: \"vol24h\",\n tvl: \"tvl\",\n liquidity: \"liquidity\",\n openInterest: \"open_interest\",\n reward24h: \"reward_24h\",\n apr: \"apr\",\n apr1h: \"apr_1h\",\n apr6h: \"apr_6h\",\n apr24h: \"apr_24h\",\n apr30d: \"apr_30d\",\n tvlDrivenApy1h: \"tvl_driven_apy_1h\",\n tvlDrivenApy6h: \"tvl_driven_apy_6h\",\n tvlDrivenApy24h: \"tvl_driven_apy_24h\",\n tvlDrivenApy30d: \"tvl_driven_apy_30d\",\n tvlDrivenApy: \"tvl_driven_apy\",\n priceDrivenApy1h: \"price_driven_apy_1h\",\n priceDrivenApy6h: \"price_driven_apy_6h\",\n priceDrivenApy24h: \"price_driven_apy_24h\",\n priceDrivenApy30d: \"price_driven_apy_30d\",\n priceDrivenApy: \"price_driven_apy\",\n listingTime: \"listing_time\",\n} as const satisfies Record<keyof ListingMarketFilters, string>;\n\n/**\n * Flatten {@link ListingMarketFilters} into the service's `{field}__ge` /\n * `{field}__le` query params.\n *\n * `bigint` bounds are stringified rather than passed through: an 18-decimal\n * value exceeds `Number.MAX_SAFE_INTEGER`, so serializing it as a number would\n * round the bound. The service accepts the string form.\n *\n * @param filters - The SDK-shaped filters, or `undefined` for none.\n * @returns A flat bag of wire params; empty when nothing is filtered.\n */\nexport function toFilterParams(filters?: ListingMarketFilters): Record<string, string> {\n if (filters === undefined) return {};\n\n const params: Record<string, string> = {};\n\n for (const [key, wireField] of Object.entries(FILTER_WIRE_FIELD)) {\n const range = filters[key as keyof ListingMarketFilters] as ListingValueRange | ListingTimeRange | undefined;\n if (range === undefined) continue;\n\n if (range.min !== undefined) params[`${wireField}__ge`] = String(range.min);\n if (range.max !== undefined) params[`${wireField}__le`] = String(range.max);\n }\n\n return params;\n}\n\n/** Non-filter query inputs {@link toSearchParams} accepts. */\nexport interface ToSearchParamsInput {\n query?: string;\n chainIds?: readonly number[];\n marketStatus?: string;\n isLocked?: boolean;\n limit?: number;\n offset?: number;\n sortBy?: string;\n orderBy?: \"asc\" | \"desc\";\n filters?: ListingMarketFilters;\n}\n\n/**\n * Build the full `/v2/market/search` query bag from SDK-shaped inputs.\n *\n * Undefined inputs are omitted entirely rather than sent as empty values, so the\n * service applies its own defaults (`limit=20`, `offset=0`, `order_by=desc`).\n *\n * @param input - SDK-shaped search inputs.\n * @returns The wire query params.\n */\nexport function toSearchParams(input: ToSearchParamsInput): MarketSearchV2MarketSearchGetParams {\n const params: Record<string, unknown> = { ...toFilterParams(input.filters) };\n\n if (input.query !== undefined) params.query = input.query;\n if (input.chainIds !== undefined) params.chain_ids = [...input.chainIds];\n if (input.marketStatus !== undefined) params.market_status = input.marketStatus;\n if (input.isLocked !== undefined) params.is_locked = input.isLocked;\n if (input.limit !== undefined) params.limit = input.limit;\n if (input.offset !== undefined) params.offset = input.offset;\n if (input.sortBy !== undefined) params.sort_by = input.sortBy;\n if (input.orderBy !== undefined) params.order_by = input.orderBy;\n\n return params as MarketSearchV2MarketSearchGetParams;\n}\n"],"mappings":";AAYA,IAAM,IAAoB;CACxB,WAAW;CACX,QAAQ;CACR,KAAK;CACL,WAAW;CACX,cAAc;CACd,WAAW;CACX,KAAK;CACL,OAAO;CACP,OAAO;CACP,QAAQ;CACR,QAAQ;CACR,gBAAgB;CAChB,gBAAgB;CAChB,iBAAiB;CACjB,iBAAiB;CACjB,cAAc;CACd,kBAAkB;CAClB,kBAAkB;CAClB,mBAAmB;CACnB,mBAAmB;CACnB,gBAAgB;CAChB,aAAa;AACf;AAaA,SAAgB,EAAe,GAAwD;CACrF,IAAI,MAAY,KAAA,GAAW,OAAO,CAAC;CAEnC,IAAM,IAAiC,CAAC;CAExC,KAAK,IAAM,CAAC,GAAK,MAAc,OAAO,QAAQ,CAAiB,GAAG;EAChE,IAAM,IAAQ,EAAQ;EAClB,MAAU,KAAA,MAEV,EAAM,QAAQ,KAAA,MAAW,EAAO,GAAG,EAAU,SAAS,OAAO,EAAM,GAAG,IACtE,EAAM,QAAQ,KAAA,MAAW,EAAO,GAAG,EAAU,SAAS,OAAO,EAAM,GAAG;CAC5E;CAEA,OAAO;AACT;AAwBA,SAAgB,EAAe,GAAiE;CAC9F,IAAM,IAAkC,EAAE,GAAG,EAAe,EAAM,OAAO,EAAE;CAW3E,OATI,EAAM,UAAU,KAAA,MAAW,EAAO,QAAQ,EAAM,QAChD,EAAM,aAAa,KAAA,MAAW,EAAO,YAAY,CAAC,GAAG,EAAM,QAAQ,IACnE,EAAM,iBAAiB,KAAA,MAAW,EAAO,gBAAgB,EAAM,eAC/D,EAAM,aAAa,KAAA,MAAW,EAAO,YAAY,EAAM,WACvD,EAAM,UAAU,KAAA,MAAW,EAAO,QAAQ,EAAM,QAChD,EAAM,WAAW,KAAA,MAAW,EAAO,SAAS,EAAM,SAClD,EAAM,WAAW,KAAA,MAAW,EAAO,UAAU,EAAM,SACnD,EAAM,YAAY,KAAA,MAAW,EAAO,WAAW,EAAM,UAElD;AACT"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { Config } from '../../core/config/index.js';
|
|
2
|
+
import { ChainIdParameter, Compute } from '../../shared/types/properties.js';
|
|
3
|
+
import { TokenPriceChain, TokenPrice } from '../types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Parameters for {@link getTokenPrice}.
|
|
6
|
+
*
|
|
7
|
+
* Pool listing is chain-level, so this takes only a `chainId`: the listing
|
|
8
|
+
* backend is resolved from the chain.
|
|
9
|
+
*/
|
|
10
|
+
export type GetTokenPriceParameters = Compute<ChainIdParameter & {
|
|
11
|
+
/**
|
|
12
|
+
* Bearer token from `authenticateListing`; required — the endpoint is authed.
|
|
13
|
+
* Sent as the `Authorization: Bearer <token>` header; a bad or expired token
|
|
14
|
+
* yields a `401`. An empty string is rejected before any request.
|
|
15
|
+
*/
|
|
16
|
+
accessToken: string;
|
|
17
|
+
/**
|
|
18
|
+
* The chain the token lives on, by vendor chain **name**
|
|
19
|
+
* ({@link TokenPriceChain}) — not a numeric chain id and not a
|
|
20
|
+
* `ListingDepositChainId`. A value outside the enum is rejected before any
|
|
21
|
+
* request.
|
|
22
|
+
*/
|
|
23
|
+
chain: TokenPriceChain;
|
|
24
|
+
/**
|
|
25
|
+
* The token's contract address on `chain`: an EVM `0x…` address, or a
|
|
26
|
+
* Solana base58 address when `chain` is `SOLANA`.
|
|
27
|
+
*/
|
|
28
|
+
tokenAddress: string;
|
|
29
|
+
}>;
|
|
30
|
+
/** Return type of {@link getTokenPrice}: the token's pre-listing price estimate. */
|
|
31
|
+
export type GetTokenPriceReturnType = TokenPrice;
|
|
32
|
+
/**
|
|
33
|
+
* Fetch a pre-listing **price estimate** for a token — what the Price Service
|
|
34
|
+
* thinks one unit is worth in USD, before (or regardless of whether) the token
|
|
35
|
+
* is listed as a pool.
|
|
36
|
+
*
|
|
37
|
+
* This POSTs to the authed `/v2/market/token-price` endpoint with the caller's
|
|
38
|
+
* bearer token. The backend caches the figure for about five minutes and
|
|
39
|
+
* rate-limits the endpoint (ten requests a minute per authenticated wallet,
|
|
40
|
+
* thirty globally — cached responses count too), so the result is a display
|
|
41
|
+
* estimate rather than a mark or trade price: render it with a `~`, serve
|
|
42
|
+
* repeat reads from the cache, and do not poll. Enigma-only.
|
|
43
|
+
*
|
|
44
|
+
* @param config - The SDK config.
|
|
45
|
+
* @param parameters - The bearer token, the token's chain (by name) and its contract address.
|
|
46
|
+
* @returns The token's {@link TokenPrice} estimate.
|
|
47
|
+
* @throws {SymmApiError} `FETCH_TOKEN_PRICE_FAILED` when the endpoint request
|
|
48
|
+
* fails: a `401` on a bad or expired token (re-run `authenticateListing`), a
|
|
49
|
+
* `422` on an address the service cannot resolve, and a `429` when the rate
|
|
50
|
+
* limit is exhausted (`retryAfterMs` carries the wait when the service sends one).
|
|
51
|
+
* @throws {SymmError} `LISTING_NOT_CONFIGURED` when the chain has no listing
|
|
52
|
+
* backend. Gate with `supportsListingService` to hide Pools instead.
|
|
53
|
+
* @throws {SymmError} `MISSING_ACCESS_TOKEN` (`kind: "validation"`) when
|
|
54
|
+
* `accessToken` is empty, before any request.
|
|
55
|
+
* @throws {SymmError} `UNSUPPORTED_TOKEN_PRICE_CHAIN` (`kind: "validation"`)
|
|
56
|
+
* when `chain` is not a {@link TokenPriceChain} member, before any request.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* const estimate = await getTokenPrice(config, {
|
|
61
|
+
* accessToken: token.accessToken,
|
|
62
|
+
* chain: TokenPriceChain.ARC,
|
|
63
|
+
* tokenAddress: "0x648A…620a",
|
|
64
|
+
* });
|
|
65
|
+
*
|
|
66
|
+
* // USD per token, an estimate:
|
|
67
|
+
* estimate.price;
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export declare function getTokenPrice(config: Config, parameters: GetTokenPriceParameters): Promise<TokenPrice>;
|
|
71
|
+
//# sourceMappingURL=get-token-price.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-token-price.d.ts","sourceRoot":"","sources":["../../../src/pools/token-price/get-token-price.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAE/E,OAAO,EAAE,eAAe,EAAE,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AAK5D;;;;;GAKG;AACH,MAAM,MAAM,uBAAuB,GAAG,OAAO,CAC3C,gBAAgB,GAAG;IACjB;;;;OAIG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;;;OAKG;IACH,KAAK,EAAE,eAAe,CAAC;IACvB;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAC;CACtB,CACF,CAAC;AAEF,oFAAoF;AACpF,MAAM,MAAM,uBAAuB,GAAG,UAAU,CAAC;AAEjD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAsB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,uBAAuB,GAAG,OAAO,CAAC,UAAU,CAAC,CA+C5G"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { SymmApiError as e, SymmError as t } from "../../shared/errors/symm-error.js";
|
|
2
|
+
import { resolveListingService as n } from "../resolve-listing.js";
|
|
3
|
+
import { calculateSymbolPriceV2MarketTokenPricePost as r } from "../types/generated/listing-backend.js";
|
|
4
|
+
import { TokenPriceChain as i } from "../types.js";
|
|
5
|
+
import { toTokenPrice as a } from "./to-token-price.js";
|
|
6
|
+
import { isAxiosError as o } from "axios";
|
|
7
|
+
//#region src/pools/token-price/get-token-price.ts
|
|
8
|
+
async function s(s, c) {
|
|
9
|
+
let { url: l } = n(s, { chainId: c.chainId });
|
|
10
|
+
if (c.accessToken.trim() === "") throw new t("validation", "MISSING_ACCESS_TOKEN", "getTokenPrice: `accessToken` is required — the endpoint is authed. Mint one with `authenticateListing`.");
|
|
11
|
+
if (!Object.values(i).includes(c.chain)) throw new t("validation", "UNSUPPORTED_TOKEN_PRICE_CHAIN", `getTokenPrice: unsupported chain "${String(c.chain)}". Expected one of ${Object.values(i).join(", ")}.`);
|
|
12
|
+
try {
|
|
13
|
+
return a((await r({
|
|
14
|
+
chain: c.chain,
|
|
15
|
+
token_address: c.tokenAddress
|
|
16
|
+
}, {
|
|
17
|
+
baseURL: l,
|
|
18
|
+
headers: { Authorization: `Bearer ${c.accessToken}` }
|
|
19
|
+
})).data);
|
|
20
|
+
} catch (n) {
|
|
21
|
+
throw n instanceof t ? n : o(n) ? e.fromAxios(n, {
|
|
22
|
+
code: "FETCH_TOKEN_PRICE_FAILED",
|
|
23
|
+
baseURL: l
|
|
24
|
+
}) : new t("api", "FETCH_TOKEN_PRICE_FAILED", `Failed to fetch the token price: ${n instanceof Error ? n.message : String(n)}`, { cause: n instanceof Error ? n : void 0 });
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { s as getTokenPrice };
|
|
29
|
+
|
|
30
|
+
//# sourceMappingURL=get-token-price.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-token-price.js","names":[],"sources":["../../../src/pools/token-price/get-token-price.ts"],"sourcesContent":["import { isAxiosError } from \"axios\";\nimport type { Config } from \"../../core/config\";\nimport { SymmApiError, SymmError } from \"../../shared/errors/symm-error\";\nimport type { ChainIdParameter, Compute } from \"../../shared/types/properties\";\nimport { resolveListingService } from \"../resolve-listing\";\nimport { TokenPriceChain, type TokenPrice } from \"../types\";\nimport type { CalculateSymbolPriceRequestChain } from \"../types/generated/listing-backend\";\nimport { calculateSymbolPriceV2MarketTokenPricePost } from \"../types/generated/listing-backend\";\nimport { toTokenPrice } from \"./to-token-price\";\n\n/**\n * Parameters for {@link getTokenPrice}.\n *\n * Pool listing is chain-level, so this takes only a `chainId`: the listing\n * backend is resolved from the chain.\n */\nexport type GetTokenPriceParameters = Compute<\n ChainIdParameter & {\n /**\n * Bearer token from `authenticateListing`; required — the endpoint is authed.\n * Sent as the `Authorization: Bearer <token>` header; a bad or expired token\n * yields a `401`. An empty string is rejected before any request.\n */\n accessToken: string;\n /**\n * The chain the token lives on, by vendor chain **name**\n * ({@link TokenPriceChain}) — not a numeric chain id and not a\n * `ListingDepositChainId`. A value outside the enum is rejected before any\n * request.\n */\n chain: TokenPriceChain;\n /**\n * The token's contract address on `chain`: an EVM `0x…` address, or a\n * Solana base58 address when `chain` is `SOLANA`.\n */\n tokenAddress: string;\n }\n>;\n\n/** Return type of {@link getTokenPrice}: the token's pre-listing price estimate. */\nexport type GetTokenPriceReturnType = TokenPrice;\n\n/**\n * Fetch a pre-listing **price estimate** for a token — what the Price Service\n * thinks one unit is worth in USD, before (or regardless of whether) the token\n * is listed as a pool.\n *\n * This POSTs to the authed `/v2/market/token-price` endpoint with the caller's\n * bearer token. The backend caches the figure for about five minutes and\n * rate-limits the endpoint (ten requests a minute per authenticated wallet,\n * thirty globally — cached responses count too), so the result is a display\n * estimate rather than a mark or trade price: render it with a `~`, serve\n * repeat reads from the cache, and do not poll. Enigma-only.\n *\n * @param config - The SDK config.\n * @param parameters - The bearer token, the token's chain (by name) and its contract address.\n * @returns The token's {@link TokenPrice} estimate.\n * @throws {SymmApiError} `FETCH_TOKEN_PRICE_FAILED` when the endpoint request\n * fails: a `401` on a bad or expired token (re-run `authenticateListing`), a\n * `422` on an address the service cannot resolve, and a `429` when the rate\n * limit is exhausted (`retryAfterMs` carries the wait when the service sends one).\n * @throws {SymmError} `LISTING_NOT_CONFIGURED` when the chain has no listing\n * backend. Gate with `supportsListingService` to hide Pools instead.\n * @throws {SymmError} `MISSING_ACCESS_TOKEN` (`kind: \"validation\"`) when\n * `accessToken` is empty, before any request.\n * @throws {SymmError} `UNSUPPORTED_TOKEN_PRICE_CHAIN` (`kind: \"validation\"`)\n * when `chain` is not a {@link TokenPriceChain} member, before any request.\n *\n * @example\n * ```ts\n * const estimate = await getTokenPrice(config, {\n * accessToken: token.accessToken,\n * chain: TokenPriceChain.ARC,\n * tokenAddress: \"0x648A…620a\",\n * });\n *\n * // USD per token, an estimate:\n * estimate.price;\n * ```\n */\nexport async function getTokenPrice(config: Config, parameters: GetTokenPriceParameters): Promise<TokenPrice> {\n const { url: baseURL } = resolveListingService(config, { chainId: parameters.chainId });\n\n if (parameters.accessToken.trim() === \"\") {\n throw new SymmError(\n \"validation\",\n \"MISSING_ACCESS_TOKEN\",\n \"getTokenPrice: `accessToken` is required — the endpoint is authed. Mint one with `authenticateListing`.\",\n );\n }\n\n if (!Object.values(TokenPriceChain).includes(parameters.chain)) {\n throw new SymmError(\n \"validation\",\n \"UNSUPPORTED_TOKEN_PRICE_CHAIN\",\n `getTokenPrice: unsupported chain \"${String(parameters.chain)}\". Expected one of ${Object.values(TokenPriceChain).join(\", \")}.`,\n );\n }\n\n try {\n const response = await calculateSymbolPriceV2MarketTokenPricePost(\n {\n // Value-preserving: CalculateSymbolPriceRequestChain shares the same string values as TokenPriceChain.\n chain: parameters.chain as unknown as CalculateSymbolPriceRequestChain,\n token_address: parameters.tokenAddress,\n },\n {\n baseURL,\n headers: { Authorization: `Bearer ${parameters.accessToken}` },\n },\n );\n\n return toTokenPrice(response.data);\n } catch (err) {\n if (err instanceof SymmError) throw err;\n\n if (isAxiosError(err)) {\n throw SymmApiError.fromAxios(err, { code: \"FETCH_TOKEN_PRICE_FAILED\", baseURL });\n }\n\n throw new SymmError(\n \"api\",\n \"FETCH_TOKEN_PRICE_FAILED\",\n `Failed to fetch the token price: ${err instanceof Error ? err.message : String(err)}`,\n { cause: err instanceof Error ? err : undefined },\n );\n }\n}\n"],"mappings":";;;;;;;AAgFA,eAAsB,EAAc,GAAgB,GAA0D;CAC5G,IAAM,EAAE,KAAK,MAAY,EAAsB,GAAQ,EAAE,SAAS,EAAW,QAAQ,CAAC;CAEtF,IAAI,EAAW,YAAY,KAAK,MAAM,IACpC,MAAM,IAAI,EACR,cACA,wBACA,yGACF;CAGF,IAAI,CAAC,OAAO,OAAO,CAAe,EAAE,SAAS,EAAW,KAAK,GAC3D,MAAM,IAAI,EACR,cACA,iCACA,qCAAqC,OAAO,EAAW,KAAK,EAAE,qBAAqB,OAAO,OAAO,CAAe,EAAE,KAAK,IAAI,EAAE,EAC/H;CAGF,IAAI;EAaF,OAAO,GAAa,MAZG,EACrB;GAEE,OAAO,EAAW;GAClB,eAAe,EAAW;EAC5B,GACA;GACE;GACA,SAAS,EAAE,eAAe,UAAU,EAAW,cAAc;EAC/D,CACF,GAE6B,IAAI;CACnC,SAAS,GAAK;EAOZ,MANI,aAAe,IAAiB,IAEhC,EAAa,CAAG,IACZ,EAAa,UAAU,GAAK;GAAE,MAAM;GAA4B;EAAQ,CAAC,IAG3E,IAAI,EACR,OACA,4BACA,oCAAoC,aAAe,QAAQ,EAAI,UAAU,OAAO,CAAG,KACnF,EAAE,OAAO,aAAe,QAAQ,IAAM,KAAA,EAAU,CAClD;CACF;AACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pools/token-price/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Config } from '../../core/config/index.js';
|
|
2
|
+
import { Compute, ConfigKeyParameter } from '../../shared/types/properties.js';
|
|
3
|
+
import { QueryParameter, SymmioQueryOptions } from '../../shared/types/query.js';
|
|
4
|
+
import { GetTokenPriceParameters, GetTokenPriceReturnType } from './get-token-price.js';
|
|
5
|
+
/** Data resolved by the {@link getTokenPriceQueryOptions} query. */
|
|
6
|
+
export type GetTokenPriceData = GetTokenPriceReturnType;
|
|
7
|
+
/**
|
|
8
|
+
* Build the TanStack Query key for {@link getTokenPriceQueryOptions}.
|
|
9
|
+
*
|
|
10
|
+
* The bearer `accessToken` is dropped from the key by `filterQueryOptions` — it
|
|
11
|
+
* is a credential, not a cache dimension, so two calls that differ only by a
|
|
12
|
+
* refreshed token still hit the same cache entry (and the token never leaks into
|
|
13
|
+
* a devtools-visible key).
|
|
14
|
+
*
|
|
15
|
+
* @param options - The action's parameters (including `accessToken`) plus the resolved config key.
|
|
16
|
+
* @returns A stable, hashable query key.
|
|
17
|
+
*/
|
|
18
|
+
export declare function getTokenPriceQueryKey(options: Compute<GetTokenPriceParameters & ConfigKeyParameter>): readonly ["getTokenPrice", Record<string, unknown>];
|
|
19
|
+
/** Query-key type produced by {@link getTokenPriceQueryKey}. */
|
|
20
|
+
export type GetTokenPriceQueryKey = ReturnType<typeof getTokenPriceQueryKey>;
|
|
21
|
+
/**
|
|
22
|
+
* Options accepted by {@link getTokenPriceQueryOptions}: the action's
|
|
23
|
+
* parameters, an optional cache scope, and TanStack overrides.
|
|
24
|
+
*/
|
|
25
|
+
export type GetTokenPriceOptions = Compute<GetTokenPriceParameters & QueryParameter<GetTokenPriceData, Error, GetTokenPriceData, GetTokenPriceQueryKey>>;
|
|
26
|
+
/** TanStack Query options returned by {@link getTokenPriceQueryOptions}. */
|
|
27
|
+
export type GetTokenPriceQueryOptions = SymmioQueryOptions<GetTokenPriceData, Error, GetTokenPriceData, GetTokenPriceQueryKey>;
|
|
28
|
+
/**
|
|
29
|
+
* Build TanStack Query options for {@link getTokenPrice}.
|
|
30
|
+
*
|
|
31
|
+
* The endpoint is a POST, but it is modeled as a query because it is an
|
|
32
|
+
* idempotent read the UI fetches when a token is picked. `staleTime` and
|
|
33
|
+
* `gcTime` default to five minutes to match the backend's own cache and spare
|
|
34
|
+
* its rate limit; a `query.staleTime` / `query.gcTime` override wins.
|
|
35
|
+
*
|
|
36
|
+
* @param config - The SDK config.
|
|
37
|
+
* @param options - The action's parameters (including the required `accessToken`) and TanStack overrides.
|
|
38
|
+
* @returns Options to pass to `useQuery` / `queryClient.fetchQuery`.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* ```ts
|
|
42
|
+
* useQuery(
|
|
43
|
+
* getTokenPriceQueryOptions(config, {
|
|
44
|
+
* accessToken,
|
|
45
|
+
* chain: TokenPriceChain.ARC,
|
|
46
|
+
* tokenAddress: "0x648A…620a",
|
|
47
|
+
* }),
|
|
48
|
+
* );
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export declare function getTokenPriceQueryOptions(config: Config, options: GetTokenPriceOptions): GetTokenPriceQueryOptions;
|
|
52
|
+
//# sourceMappingURL=query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.d.ts","sourceRoot":"","sources":["../../../src/pools/token-price/query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AACjF,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnF,OAAO,EAAiB,KAAK,uBAAuB,EAAE,KAAK,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAY9G,oEAAoE;AACpE,MAAM,MAAM,iBAAiB,GAAG,uBAAuB,CAAC;AAExD;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,OAAO,CAAC,uBAAuB,GAAG,kBAAkB,CAAC,uDAEnG;AAED,gEAAgE;AAChE,MAAM,MAAM,qBAAqB,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE7E;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG,OAAO,CACxC,uBAAuB,GAAG,cAAc,CAAC,iBAAiB,EAAE,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,CAAC,CAC7G,CAAC;AAEF,4EAA4E;AAC5E,MAAM,MAAM,yBAAyB,GAAG,kBAAkB,CACxD,iBAAiB,EACjB,KAAK,EACL,iBAAiB,EACjB,qBAAqB,CACtB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,oBAAoB,GAAG,yBAAyB,CAkBlH"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { filterQueryOptions as e } from "../../shared/utils/query.js";
|
|
2
|
+
import { getTokenPrice as t } from "./get-token-price.js";
|
|
3
|
+
//#region src/pools/token-price/query.ts
|
|
4
|
+
var n = 300 * 1e3;
|
|
5
|
+
function r(t) {
|
|
6
|
+
return ["getTokenPrice", e(t)];
|
|
7
|
+
}
|
|
8
|
+
function i(e, i) {
|
|
9
|
+
return {
|
|
10
|
+
staleTime: n,
|
|
11
|
+
gcTime: n,
|
|
12
|
+
...i.query,
|
|
13
|
+
queryKey: r({
|
|
14
|
+
...i,
|
|
15
|
+
configKey: e.getChainConfigKey(i.chainId)
|
|
16
|
+
}),
|
|
17
|
+
enabled: i.query?.enabled ?? !0,
|
|
18
|
+
queryFn: () => t(e, {
|
|
19
|
+
chainId: i.chainId,
|
|
20
|
+
accessToken: i.accessToken,
|
|
21
|
+
chain: i.chain,
|
|
22
|
+
tokenAddress: i.tokenAddress
|
|
23
|
+
})
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { r as getTokenPriceQueryKey, i as getTokenPriceQueryOptions };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query.js","names":[],"sources":["../../../src/pools/token-price/query.ts"],"sourcesContent":["import type { Config } from \"../../core/config\";\nimport type { Compute, ConfigKeyParameter } from \"../../shared/types/properties\";\nimport type { QueryParameter, SymmioQueryOptions } from \"../../shared/types/query\";\nimport { filterQueryOptions } from \"../../shared/utils/query\";\nimport { getTokenPrice, type GetTokenPriceParameters, type GetTokenPriceReturnType } from \"./get-token-price\";\n\n/**\n * Default cache lifetime for a token price estimate.\n *\n * The listing backend caches the figure for about five minutes and rate-limits\n * the endpoint (cached responses count against the limit), so asking sooner\n * returns the same number and burns quota. Both `staleTime` and `gcTime`\n * default to this; override per call through `query` if you need it fresher.\n */\nconst TOKEN_PRICE_CACHE_TIME_MS = 5 * 60 * 1000;\n\n/** Data resolved by the {@link getTokenPriceQueryOptions} query. */\nexport type GetTokenPriceData = GetTokenPriceReturnType;\n\n/**\n * Build the TanStack Query key for {@link getTokenPriceQueryOptions}.\n *\n * The bearer `accessToken` is dropped from the key by `filterQueryOptions` — it\n * is a credential, not a cache dimension, so two calls that differ only by a\n * refreshed token still hit the same cache entry (and the token never leaks into\n * a devtools-visible key).\n *\n * @param options - The action's parameters (including `accessToken`) plus the resolved config key.\n * @returns A stable, hashable query key.\n */\nexport function getTokenPriceQueryKey(options: Compute<GetTokenPriceParameters & ConfigKeyParameter>) {\n return [\"getTokenPrice\", filterQueryOptions(options)] as const;\n}\n\n/** Query-key type produced by {@link getTokenPriceQueryKey}. */\nexport type GetTokenPriceQueryKey = ReturnType<typeof getTokenPriceQueryKey>;\n\n/**\n * Options accepted by {@link getTokenPriceQueryOptions}: the action's\n * parameters, an optional cache scope, and TanStack overrides.\n */\nexport type GetTokenPriceOptions = Compute<\n GetTokenPriceParameters & QueryParameter<GetTokenPriceData, Error, GetTokenPriceData, GetTokenPriceQueryKey>\n>;\n\n/** TanStack Query options returned by {@link getTokenPriceQueryOptions}. */\nexport type GetTokenPriceQueryOptions = SymmioQueryOptions<\n GetTokenPriceData,\n Error,\n GetTokenPriceData,\n GetTokenPriceQueryKey\n>;\n\n/**\n * Build TanStack Query options for {@link getTokenPrice}.\n *\n * The endpoint is a POST, but it is modeled as a query because it is an\n * idempotent read the UI fetches when a token is picked. `staleTime` and\n * `gcTime` default to five minutes to match the backend's own cache and spare\n * its rate limit; a `query.staleTime` / `query.gcTime` override wins.\n *\n * @param config - The SDK config.\n * @param options - The action's parameters (including the required `accessToken`) and TanStack overrides.\n * @returns Options to pass to `useQuery` / `queryClient.fetchQuery`.\n *\n * @example\n * ```ts\n * useQuery(\n * getTokenPriceQueryOptions(config, {\n * accessToken,\n * chain: TokenPriceChain.ARC,\n * tokenAddress: \"0x648A…620a\",\n * }),\n * );\n * ```\n */\nexport function getTokenPriceQueryOptions(config: Config, options: GetTokenPriceOptions): GetTokenPriceQueryOptions {\n return {\n staleTime: TOKEN_PRICE_CACHE_TIME_MS,\n gcTime: TOKEN_PRICE_CACHE_TIME_MS,\n ...options.query,\n queryKey: getTokenPriceQueryKey({\n ...options,\n configKey: config.getChainConfigKey(options.chainId),\n }),\n enabled: options.query?.enabled ?? true,\n queryFn: () =>\n getTokenPrice(config, {\n chainId: options.chainId,\n accessToken: options.accessToken,\n chain: options.chain,\n tokenAddress: options.tokenAddress,\n }),\n };\n}\n"],"mappings":";;;AAcA,IAAM,IAA4B,MAAS;AAgB3C,SAAgB,EAAsB,GAAgE;CACpG,OAAO,CAAC,iBAAiB,EAAmB,CAAO,CAAC;AACtD;AA4CA,SAAgB,EAA0B,GAAgB,GAA0D;CAClH,OAAO;EACL,WAAW;EACX,QAAQ;EACR,GAAG,EAAQ;EACX,UAAU,EAAsB;GAC9B,GAAG;GACH,WAAW,EAAO,kBAAkB,EAAQ,OAAO;EACrD,CAAC;EACD,SAAS,EAAQ,OAAO,WAAW;EACnC,eACE,EAAc,GAAQ;GACpB,SAAS,EAAQ;GACjB,aAAa,EAAQ;GACrB,OAAO,EAAQ;GACf,cAAc,EAAQ;EACxB,CAAC;CACL;AACF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TokenPrice } from '../types.js';
|
|
2
|
+
import { SymbolPriceResponse } from '../types/generated/listing-backend.js';
|
|
3
|
+
/**
|
|
4
|
+
* Map the raw `/v2/market/token-price` response into the SDK's
|
|
5
|
+
* {@link TokenPrice}.
|
|
6
|
+
*
|
|
7
|
+
* The wire shape is a single `price` float (USD per token); it is carried
|
|
8
|
+
* through unchanged.
|
|
9
|
+
*
|
|
10
|
+
* @param raw - The endpoint's `/v2/market/token-price` response body.
|
|
11
|
+
* @returns The normalized token price estimate.
|
|
12
|
+
*/
|
|
13
|
+
export declare function toTokenPrice(raw: SymbolPriceResponse): TokenPrice;
|
|
14
|
+
//# sourceMappingURL=to-token-price.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-token-price.d.ts","sourceRoot":"","sources":["../../../src/pools/token-price/to-token-price.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAE9E;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,mBAAmB,GAAG,UAAU,CAIjE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-token-price.js","names":[],"sources":["../../../src/pools/token-price/to-token-price.ts"],"sourcesContent":["import type { TokenPrice } from \"../types\";\nimport type { SymbolPriceResponse } from \"../types/generated/listing-backend\";\n\n/**\n * Map the raw `/v2/market/token-price` response into the SDK's\n * {@link TokenPrice}.\n *\n * The wire shape is a single `price` float (USD per token); it is carried\n * through unchanged.\n *\n * @param raw - The endpoint's `/v2/market/token-price` response body.\n * @returns The normalized token price estimate.\n */\nexport function toTokenPrice(raw: SymbolPriceResponse): TokenPrice {\n return {\n price: raw.price,\n };\n}\n"],"mappings":";AAaA,SAAgB,EAAa,GAAsC;CACjE,OAAO,EACL,OAAO,EAAI,MACb;AACF"}
|
|
@@ -1,47 +1,89 @@
|
|
|
1
1
|
import { Config } from '../../core/config/index.js';
|
|
2
2
|
import { ChainIdParameter, Compute } from '../../shared/types/properties.js';
|
|
3
|
-
import { PoolTransactionPage } from '../types.js';
|
|
3
|
+
import { ListingDepositChainId, PoolTransactionPage, PoolTransactionStatus, PoolTransactionType } from '../types.js';
|
|
4
4
|
/**
|
|
5
5
|
* Parameters for {@link getPoolTransactions}.
|
|
6
|
+
*
|
|
7
|
+
* Every filter is optional and they combine; with none, the page spans **every**
|
|
8
|
+
* pool. `chainId` is the SDK's own — it selects which deployment's listing
|
|
9
|
+
* backend to ask — and is unrelated to `marketChainId`, the chain a pool's token
|
|
10
|
+
* lives on.
|
|
6
11
|
*/
|
|
7
12
|
export type GetPoolTransactionsParameters = Compute<ChainIdParameter & {
|
|
8
|
-
/** The pool's token contract address. */
|
|
9
|
-
marketAddress: string;
|
|
10
13
|
/**
|
|
11
|
-
* Narrow
|
|
12
|
-
*
|
|
14
|
+
* Narrow to one pool by its token contract address —
|
|
15
|
+
* `ListingMarket.contractAddress`. Omit for every pool. EVM addresses match
|
|
16
|
+
* case-insensitively; Solana base58 addresses are case-sensitive. An address
|
|
17
|
+
* with no listed market fails with HTTP 400 (`Market not found`) rather than
|
|
18
|
+
* returning an empty page.
|
|
19
|
+
*/
|
|
20
|
+
tokenAddress?: string;
|
|
21
|
+
/**
|
|
22
|
+
* The pool's token contract address, under its old name.
|
|
23
|
+
*
|
|
24
|
+
* @deprecated Pass `tokenAddress`. Sent as the same filter; `tokenAddress`
|
|
25
|
+
* wins when both are set.
|
|
26
|
+
*/
|
|
27
|
+
marketAddress?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Narrow to pools whose token lives on this chain — `ListingMarket.chainId`.
|
|
30
|
+
* The service rejects a chain outside its supported deposit chains
|
|
31
|
+
* (`getListingConfig`) with HTTP 422.
|
|
13
32
|
*/
|
|
33
|
+
marketChainId?: ListingDepositChainId;
|
|
34
|
+
/** Narrow to one wallet's rows. Omit for every LP's. */
|
|
14
35
|
walletAddress?: string;
|
|
36
|
+
/** Narrow to deposits or withdrawals only. Omit for both. */
|
|
37
|
+
transactionType?: PoolTransactionType;
|
|
38
|
+
/** Narrow to one lifecycle status (e.g. only `REFUND`). Omit for all statuses. */
|
|
39
|
+
transactionStatus?: PoolTransactionStatus;
|
|
15
40
|
/** Row offset. @default 0 */
|
|
16
41
|
start?: number;
|
|
17
|
-
/**
|
|
42
|
+
/**
|
|
43
|
+
* Page size. The backend caps it at 50 and rejects a larger value with
|
|
44
|
+
* HTTP 422.
|
|
45
|
+
*
|
|
46
|
+
* @default 50
|
|
47
|
+
*/
|
|
18
48
|
size?: number;
|
|
19
49
|
}>;
|
|
20
50
|
/** Return type of {@link getPoolTransactions}: one page of transaction rows. */
|
|
21
51
|
export type GetPoolTransactionsReturnType = PoolTransactionPage;
|
|
22
52
|
/**
|
|
23
|
-
* Fetch
|
|
24
|
-
*
|
|
53
|
+
* Fetch pool deposit and withdrawal history — refunded deposits included —
|
|
54
|
+
* newest first.
|
|
25
55
|
*
|
|
26
|
-
* Public and
|
|
27
|
-
*
|
|
56
|
+
* Public and unscoped by default: every LP's rows on **every** pool, in one
|
|
57
|
+
* newest-first sequence. Narrow it with `tokenAddress` (one pool),
|
|
58
|
+
* `marketChainId`, `walletAddress`, `transactionType` and `transactionStatus`;
|
|
59
|
+
* the filters combine. Each row names its own pool (`tokenAddress`, `chainId`),
|
|
60
|
+
* so an all-pools page stays attributable.
|
|
28
61
|
*
|
|
62
|
+
* The service fixes the order — newest first — and takes no sort parameter.
|
|
29
63
|
* Pagination is path-based (`/{start}/{size}`), and `count` is the total across
|
|
30
|
-
* all pages
|
|
64
|
+
* all pages, so it is what a pager should divide, not `items.length`. A `start`
|
|
65
|
+
* past `count` returns an empty page.
|
|
31
66
|
*
|
|
32
67
|
* @param config - The SDK config.
|
|
33
|
-
* @param parameters -
|
|
68
|
+
* @param parameters - Optional filters and paging.
|
|
34
69
|
* @returns One {@link PoolTransactionPage}.
|
|
35
|
-
* @throws {SymmApiError} when the endpoint request fails
|
|
70
|
+
* @throws {SymmApiError} when the endpoint request fails — including HTTP 400
|
|
71
|
+
* for a `tokenAddress` with no listed market, and HTTP 422 for an invalid
|
|
72
|
+
* filter value or a `size` above 50.
|
|
36
73
|
* @throws {SymmError} `LISTING_NOT_CONFIGURED` when the chain has no listing backend.
|
|
37
74
|
*
|
|
38
75
|
* @example
|
|
39
76
|
* ```ts
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
77
|
+
* // The latest activity across every pool.
|
|
78
|
+
* const latest = await getPoolTransactions(config);
|
|
79
|
+
*
|
|
80
|
+
* // One pool's pending withdrawals.
|
|
81
|
+
* const pending = await getPoolTransactions(config, {
|
|
82
|
+
* tokenAddress: "0x800822d361335b4d5F352Dac293cA4128b5B605f",
|
|
83
|
+
* transactionType: PoolTransactionType.WITHDRAW,
|
|
84
|
+
* transactionStatus: PoolTransactionStatus.PENDING,
|
|
43
85
|
* });
|
|
44
86
|
* ```
|
|
45
87
|
*/
|
|
46
|
-
export declare function getPoolTransactions(config: Config, parameters
|
|
88
|
+
export declare function getPoolTransactions(config: Config, parameters?: GetPoolTransactionsParameters): Promise<GetPoolTransactionsReturnType>;
|
|
47
89
|
//# sourceMappingURL=get-pool-transactions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-pool-transactions.d.ts","sourceRoot":"","sources":["../../../src/pools/transactions/get-pool-transactions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAE/E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"get-pool-transactions.d.ts","sourceRoot":"","sources":["../../../src/pools/transactions/get-pool-transactions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAE/E,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AASvH;;;;;;;GAOG;AACH,MAAM,MAAM,6BAA6B,GAAG,OAAO,CACjD,gBAAgB,GAAG;IACjB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;OAIG;IACH,aAAa,CAAC,EAAE,qBAAqB,CAAC;IACtC,wDAAwD;IACxD,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,6DAA6D;IAC7D,eAAe,CAAC,EAAE,mBAAmB,CAAC;IACtC,kFAAkF;IAClF,iBAAiB,CAAC,EAAE,qBAAqB,CAAC;IAC1C,6BAA6B;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CACF,CAAC;AAEF,gFAAgF;AAChF,MAAM,MAAM,6BAA6B,GAAG,mBAAmB,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,MAAM,EACd,UAAU,GAAE,6BAAkC,GAC7C,OAAO,CAAC,6BAA6B,CAAC,CA4CxC"}
|
|
@@ -4,12 +4,15 @@ import { getTransactionHistoryV2MarketTransactionHistoryStartSizeGet as r } from
|
|
|
4
4
|
import { toPoolTransactionPage as i } from "./to-pool-transaction.js";
|
|
5
5
|
import { isAxiosError as a } from "axios";
|
|
6
6
|
//#region src/pools/transactions/get-pool-transactions.ts
|
|
7
|
-
async function o(o, s) {
|
|
8
|
-
let { url: c } = n(o, { chainId: s.chainId }), { start: l = 0, size: u =
|
|
7
|
+
async function o(o, s = {}) {
|
|
8
|
+
let { url: c } = n(o, { chainId: s.chainId }), { start: l = 0, size: u = 50 } = s, d = s.tokenAddress ?? s.marketAddress;
|
|
9
9
|
try {
|
|
10
10
|
return i((await r(l, u, {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
token_address: d,
|
|
12
|
+
chain_id: s.marketChainId,
|
|
13
|
+
wallet_address: s.walletAddress,
|
|
14
|
+
transaction_type: s.transactionType,
|
|
15
|
+
transaction_status: s.transactionStatus
|
|
13
16
|
}, { baseURL: c })).data);
|
|
14
17
|
} catch (n) {
|
|
15
18
|
throw n instanceof t ? n : a(n) ? e.fromAxios(n, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-pool-transactions.js","names":[],"sources":["../../../src/pools/transactions/get-pool-transactions.ts"],"sourcesContent":["import { isAxiosError } from \"axios\";\nimport type { Config } from \"../../core/config\";\nimport { SymmApiError, SymmError } from \"../../shared/errors/symm-error\";\nimport type { ChainIdParameter, Compute } from \"../../shared/types/properties\";\nimport { resolveListingService } from \"../resolve-listing\";\nimport type { PoolTransactionPage } from \"../types\";\nimport {
|
|
1
|
+
{"version":3,"file":"get-pool-transactions.js","names":[],"sources":["../../../src/pools/transactions/get-pool-transactions.ts"],"sourcesContent":["import { isAxiosError } from \"axios\";\nimport type { Config } from \"../../core/config\";\nimport { SymmApiError, SymmError } from \"../../shared/errors/symm-error\";\nimport type { ChainIdParameter, Compute } from \"../../shared/types/properties\";\nimport { resolveListingService } from \"../resolve-listing\";\nimport type { ListingDepositChainId, PoolTransactionPage, PoolTransactionStatus, PoolTransactionType } from \"../types\";\nimport {\n getTransactionHistoryV2MarketTransactionHistoryStartSizeGet,\n type SupportedDepositChains,\n type TransactionType,\n type UserReadableTransactionStatus,\n} from \"../types/generated/listing-backend\";\nimport { toPoolTransactionPage } from \"./to-pool-transaction\";\n\n/**\n * Parameters for {@link getPoolTransactions}.\n *\n * Every filter is optional and they combine; with none, the page spans **every**\n * pool. `chainId` is the SDK's own — it selects which deployment's listing\n * backend to ask — and is unrelated to `marketChainId`, the chain a pool's token\n * lives on.\n */\nexport type GetPoolTransactionsParameters = Compute<\n ChainIdParameter & {\n /**\n * Narrow to one pool by its token contract address —\n * `ListingMarket.contractAddress`. Omit for every pool. EVM addresses match\n * case-insensitively; Solana base58 addresses are case-sensitive. An address\n * with no listed market fails with HTTP 400 (`Market not found`) rather than\n * returning an empty page.\n */\n tokenAddress?: string;\n /**\n * The pool's token contract address, under its old name.\n *\n * @deprecated Pass `tokenAddress`. Sent as the same filter; `tokenAddress`\n * wins when both are set.\n */\n marketAddress?: string;\n /**\n * Narrow to pools whose token lives on this chain — `ListingMarket.chainId`.\n * The service rejects a chain outside its supported deposit chains\n * (`getListingConfig`) with HTTP 422.\n */\n marketChainId?: ListingDepositChainId;\n /** Narrow to one wallet's rows. Omit for every LP's. */\n walletAddress?: string;\n /** Narrow to deposits or withdrawals only. Omit for both. */\n transactionType?: PoolTransactionType;\n /** Narrow to one lifecycle status (e.g. only `REFUND`). Omit for all statuses. */\n transactionStatus?: PoolTransactionStatus;\n /** Row offset. @default 0 */\n start?: number;\n /**\n * Page size. The backend caps it at 50 and rejects a larger value with\n * HTTP 422.\n *\n * @default 50\n */\n size?: number;\n }\n>;\n\n/** Return type of {@link getPoolTransactions}: one page of transaction rows. */\nexport type GetPoolTransactionsReturnType = PoolTransactionPage;\n\n/**\n * Fetch pool deposit and withdrawal history — refunded deposits included —\n * newest first.\n *\n * Public and unscoped by default: every LP's rows on **every** pool, in one\n * newest-first sequence. Narrow it with `tokenAddress` (one pool),\n * `marketChainId`, `walletAddress`, `transactionType` and `transactionStatus`;\n * the filters combine. Each row names its own pool (`tokenAddress`, `chainId`),\n * so an all-pools page stays attributable.\n *\n * The service fixes the order — newest first — and takes no sort parameter.\n * Pagination is path-based (`/{start}/{size}`), and `count` is the total across\n * all pages, so it is what a pager should divide, not `items.length`. A `start`\n * past `count` returns an empty page.\n *\n * @param config - The SDK config.\n * @param parameters - Optional filters and paging.\n * @returns One {@link PoolTransactionPage}.\n * @throws {SymmApiError} when the endpoint request fails — including HTTP 400\n * for a `tokenAddress` with no listed market, and HTTP 422 for an invalid\n * filter value or a `size` above 50.\n * @throws {SymmError} `LISTING_NOT_CONFIGURED` when the chain has no listing backend.\n *\n * @example\n * ```ts\n * // The latest activity across every pool.\n * const latest = await getPoolTransactions(config);\n *\n * // One pool's pending withdrawals.\n * const pending = await getPoolTransactions(config, {\n * tokenAddress: \"0x800822d361335b4d5F352Dac293cA4128b5B605f\",\n * transactionType: PoolTransactionType.WITHDRAW,\n * transactionStatus: PoolTransactionStatus.PENDING,\n * });\n * ```\n */\nexport async function getPoolTransactions(\n config: Config,\n parameters: GetPoolTransactionsParameters = {},\n): Promise<GetPoolTransactionsReturnType> {\n const { url: baseURL } = resolveListingService(config, { chainId: parameters.chainId });\n const { start = 0, size = 50 } = parameters;\n /**\n * The deprecated `marketAddress` goes out as `token_address` as well, so it\n * keeps filtering if the service retires its `market_address` alias — an\n * unknown query param is silently ignored, which would return every pool.\n */\n const tokenAddress = parameters.tokenAddress ?? parameters.marketAddress;\n\n try {\n const response = await getTransactionHistoryV2MarketTransactionHistoryStartSizeGet(\n start,\n size,\n /**\n * Axios drops `undefined` params when it serializes the query, so an\n * omitted filter sends no key. The casts only re-label the SDK's enums as\n * the generated ones; the values go out unchanged.\n */\n {\n token_address: tokenAddress,\n chain_id: parameters.marketChainId as SupportedDepositChains | undefined,\n wallet_address: parameters.walletAddress,\n transaction_type: parameters.transactionType as TransactionType | undefined,\n transaction_status: parameters.transactionStatus as UserReadableTransactionStatus | undefined,\n },\n { baseURL },\n );\n\n return toPoolTransactionPage(response.data);\n } catch (err) {\n if (err instanceof SymmError) throw err;\n\n if (isAxiosError(err)) {\n throw SymmApiError.fromAxios(err, { code: \"FETCH_POOL_TRANSACTIONS_FAILED\", baseURL });\n }\n\n throw new SymmError(\n \"api\",\n \"FETCH_POOL_TRANSACTIONS_FAILED\",\n `Failed to fetch pool transactions: ${err instanceof Error ? err.message : String(err)}`,\n { cause: err instanceof Error ? err : undefined },\n );\n }\n}\n"],"mappings":";;;;;;AAsGA,eAAsB,EACpB,GACA,IAA4C,CAAC,GACL;CACxC,IAAM,EAAE,KAAK,MAAY,EAAsB,GAAQ,EAAE,SAAS,EAAW,QAAQ,CAAC,GAChF,EAAE,WAAQ,GAAG,UAAO,OAAO,GAM3B,IAAe,EAAW,gBAAgB,EAAW;CAE3D,IAAI;EAmBF,OAAO,GAAsB,MAlBN,EACrB,GACA,GAMA;GACE,eAAe;GACf,UAAU,EAAW;GACrB,gBAAgB,EAAW;GAC3B,kBAAkB,EAAW;GAC7B,oBAAoB,EAAW;EACjC,GACA,EAAE,WAAQ,CACZ,GAEsC,IAAI;CAC5C,SAAS,GAAK;EAOZ,MANI,aAAe,IAAiB,IAEhC,EAAa,CAAG,IACZ,EAAa,UAAU,GAAK;GAAE,MAAM;GAAkC;EAAQ,CAAC,IAGjF,IAAI,EACR,OACA,kCACA,sCAAsC,aAAe,QAAQ,EAAI,UAAU,OAAO,CAAG,KACrF,EAAE,OAAO,aAAe,QAAQ,IAAM,KAAA,EAAU,CAClD;CACF;AACF"}
|