@minswap/sdk-v2 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -184,6 +184,61 @@ var AppApiClient = class {
184
184
  }
185
185
  };
186
186
 
187
+ // src/client/config.ts
188
+ var DEFAULT_ENDPOINTS = {
189
+ mainnet: {
190
+ appApiUrl: "https://api-internal.minswap.org",
191
+ aggregatorApiUrl: "https://agg-api.minswap.org",
192
+ keyAppApiUrl: "https://k-app-monorepo-mainnet-prod.minswap.org/graphql"
193
+ }
194
+ };
195
+ var DEFAULT_TIMEOUT_MS = 3e4;
196
+ var DEFAULT_RETRY = {
197
+ retries: 2,
198
+ baseDelayMs: 300
199
+ };
200
+ function invalid(param, reason) {
201
+ throw new MinswapError(`Invalid config: ${param} ${reason}`, "INVALID_PARAMS" /* INVALID_PARAMS */, {
202
+ param,
203
+ reason
204
+ });
205
+ }
206
+ function resolveConfig(config = {}) {
207
+ const network = config.network ?? "mainnet";
208
+ const fetchImpl = config.fetch ?? globalThis.fetch;
209
+ if (typeof fetchImpl !== "function") {
210
+ invalid(
211
+ "fetch",
212
+ "is not available on globalThis; pass an implementation via `new MinswapSdk({ fetch })`"
213
+ );
214
+ }
215
+ const timeoutMs = config.timeoutMs ?? DEFAULT_TIMEOUT_MS;
216
+ if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) {
217
+ invalid("timeoutMs", "must be a positive finite number");
218
+ }
219
+ const retries = config.retry?.retries ?? DEFAULT_RETRY.retries;
220
+ if (!Number.isInteger(retries) || retries < 0) {
221
+ invalid("retry.retries", "must be a non-negative integer");
222
+ }
223
+ const baseDelayMs = config.retry?.baseDelayMs ?? DEFAULT_RETRY.baseDelayMs;
224
+ if (!Number.isFinite(baseDelayMs) || baseDelayMs < 0) {
225
+ invalid("retry.baseDelayMs", "must be a non-negative finite number");
226
+ }
227
+ return {
228
+ network,
229
+ currency: config.currency ?? "USD",
230
+ apiKey: config.apiKey,
231
+ endpoints: {
232
+ ...DEFAULT_ENDPOINTS[network],
233
+ ...config.endpoints
234
+ },
235
+ fetch: fetchImpl,
236
+ timeoutMs,
237
+ retry: { retries, baseDelayMs },
238
+ rpcProvider: config.rpcProvider
239
+ };
240
+ }
241
+
187
242
  // src/client/http.ts
188
243
  var sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
189
244
  function isRetryable(error) {
@@ -373,8 +428,6 @@ async function readBody(response) {
373
428
  function truncate(value, max = 300) {
374
429
  return value.length <= max ? value : `${value.slice(0, max)}\u2026`;
375
430
  }
376
-
377
- // src/client/app-graphql-client.ts
378
431
  var graphqlEnvelope = z.object({
379
432
  data: z.unknown().nullish(),
380
433
  errors: z.array(
@@ -384,137 +437,6 @@ var graphqlEnvelope = z.object({
384
437
  })
385
438
  ).nullish()
386
439
  });
387
- var AppGraphqlClient = class {
388
- constructor(http, config) {
389
- this.http = http;
390
- this.config = config;
391
- }
392
- http;
393
- config;
394
- async execute(operation) {
395
- const endpoint = `GraphQL ${operation.operation}`;
396
- const response = await this.http.request({
397
- url: this.config.endpoints.appGraphqlUrl,
398
- method: "POST",
399
- endpoint,
400
- body: {
401
- // No `operationName`: each document defines exactly one operation, so
402
- // the server runs it without one. Sending the field name would have to
403
- // match the document's operation name exactly — a needless coupling.
404
- query: operation.document,
405
- variables: operation.variables ?? {}
406
- },
407
- schema: graphqlEnvelope,
408
- // Resolver errors can come back with a 400/500 status; decode the body
409
- // anyway so the GraphQL `errors` array is not lost as an opaque API error.
410
- parseErrorBody: true
411
- });
412
- if (response.errors && response.errors.length > 0) {
413
- throw new MinswapError(
414
- `${operation.operation} failed: ${response.errors.map((e) => e.message).join("; ")}`,
415
- "GRAPHQL_ERROR" /* GRAPHQL_ERROR */,
416
- {
417
- operation: operation.operation,
418
- errors: response.errors.map((e) => ({
419
- message: e.message,
420
- path: e.path ?? void 0
421
- }))
422
- }
423
- );
424
- }
425
- const data = response.data;
426
- if (data === null || data === void 0) {
427
- throw new MinswapError(
428
- `${operation.operation} returned no data and no errors`,
429
- "PARSE_ERROR" /* PARSE_ERROR */,
430
- {
431
- endpoint,
432
- issues: [{ path: "data", message: "Expected an object, received null" }]
433
- }
434
- );
435
- }
436
- const root = data;
437
- const keys = Object.keys(root);
438
- if (keys.length !== 1) {
439
- throw new MinswapError(
440
- `${operation.operation} expected a single root field, got [${keys.join(", ")}]`,
441
- "PARSE_ERROR" /* PARSE_ERROR */,
442
- {
443
- endpoint,
444
- issues: [
445
- { path: "data", message: `expected exactly one root field, got ${keys.length}` }
446
- ]
447
- }
448
- );
449
- }
450
- return parseOrThrow(operation.schema, root[keys[0]], endpoint);
451
- }
452
- };
453
-
454
- // src/client/config.ts
455
- var DEFAULT_ENDPOINTS = {
456
- mainnet: {
457
- appApiUrl: "https://api-internal.minswap.org",
458
- aggregatorApiUrl: "https://agg-api.minswap.org",
459
- keyAppApiUrl: "https://k-app-monorepo-mainnet-prod.minswap.org/graphql",
460
- appGraphqlUrl: "https://app-monorepo-mainnet-prod.minswap.org/graphql"
461
- }
462
- };
463
- var DEFAULT_TIMEOUT_MS = 3e4;
464
- var DEFAULT_RETRY = {
465
- retries: 2,
466
- baseDelayMs: 300
467
- };
468
- function invalid(param, reason) {
469
- throw new MinswapError(`Invalid config: ${param} ${reason}`, "INVALID_PARAMS" /* INVALID_PARAMS */, {
470
- param,
471
- reason
472
- });
473
- }
474
- function resolveConfig(config = {}) {
475
- const network = config.network ?? "mainnet";
476
- const fetchImpl = config.fetch ?? globalThis.fetch;
477
- if (typeof fetchImpl !== "function") {
478
- invalid(
479
- "fetch",
480
- "is not available on globalThis; pass an implementation via `new MinswapSdk({ fetch })`"
481
- );
482
- }
483
- const timeoutMs = config.timeoutMs ?? DEFAULT_TIMEOUT_MS;
484
- if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) {
485
- invalid("timeoutMs", "must be a positive finite number");
486
- }
487
- const retries = config.retry?.retries ?? DEFAULT_RETRY.retries;
488
- if (!Number.isInteger(retries) || retries < 0) {
489
- invalid("retry.retries", "must be a non-negative integer");
490
- }
491
- const baseDelayMs = config.retry?.baseDelayMs ?? DEFAULT_RETRY.baseDelayMs;
492
- if (!Number.isFinite(baseDelayMs) || baseDelayMs < 0) {
493
- invalid("retry.baseDelayMs", "must be a non-negative finite number");
494
- }
495
- return {
496
- network,
497
- currency: config.currency ?? "USD",
498
- apiKey: config.apiKey,
499
- endpoints: {
500
- ...DEFAULT_ENDPOINTS[network],
501
- ...config.endpoints
502
- },
503
- fetch: fetchImpl,
504
- timeoutMs,
505
- retry: { retries, baseDelayMs },
506
- rpcProvider: config.rpcProvider
507
- };
508
- }
509
- var graphqlEnvelope2 = z.object({
510
- data: z.unknown().nullish(),
511
- errors: z.array(
512
- z.object({
513
- message: z.string(),
514
- path: z.array(z.union([z.string(), z.number()])).nullish()
515
- })
516
- ).nullish()
517
- });
518
440
  var KeyAppApiClient = class {
519
441
  constructor(http, config) {
520
442
  this.http = http;
@@ -537,7 +459,7 @@ var KeyAppApiClient = class {
537
459
  query: operation.document,
538
460
  variables: operation.variables ?? {}
539
461
  },
540
- schema: graphqlEnvelope2,
462
+ schema: graphqlEnvelope,
541
463
  // This host returns resolver errors with a 400/500 status; decode the
542
464
  // body anyway so the GraphQL `errors` array is not lost.
543
465
  parseErrorBody: true
@@ -617,115 +539,6 @@ function inputAssetToCoinId(asset2) {
617
539
  }
618
540
  return asset2.tokenName === "" ? asset2.currencySymbol : `${asset2.currencySymbol}.${asset2.tokenName}`;
619
541
  }
620
- function arrayOf(schema) {
621
- return z.array(schema).nullish().transform((value) => value ?? []);
622
- }
623
- var zeroableNumber = z.number().nullish().transform((value) => value ?? 0);
624
- var coinBasicInfoSchema = z.object({
625
- coin_type: z.string().nullish(),
626
- symbol: z.string(),
627
- decimals: z.number(),
628
- icon_url: z.string(),
629
- verified: z.boolean()
630
- }).transform((c) => ({
631
- coinId: c.coin_type ?? null,
632
- symbol: c.symbol,
633
- decimals: c.decimals,
634
- iconUrl: c.icon_url,
635
- verified: c.verified
636
- }));
637
- var coinAmountInfoSchema = z.object({
638
- coin_type: z.string().nullish(),
639
- symbol: z.string(),
640
- decimals: z.number(),
641
- icon_url: z.string(),
642
- verified: z.boolean(),
643
- amount: z.number(),
644
- usd_value: z.number()
645
- }).transform((c) => ({
646
- coinId: c.coin_type ?? null,
647
- symbol: c.symbol,
648
- decimals: c.decimals,
649
- iconUrl: c.icon_url,
650
- verified: c.verified,
651
- amount: c.amount,
652
- usdValue: c.usd_value
653
- }));
654
- var poolCoinSchema = z.object({
655
- coin_type: z.string().nullish(),
656
- symbol: z.string(),
657
- decimals: z.number(),
658
- icon_url: z.string(),
659
- verified: z.boolean(),
660
- category: z.string().nullish()
661
- }).transform((c) => ({
662
- coinId: c.coin_type ?? null,
663
- symbol: c.symbol,
664
- decimals: c.decimals,
665
- iconUrl: c.icon_url,
666
- verified: c.verified,
667
- /** Free-form; not constrained to the `categoryGroup` filter values. */
668
- category: c.category ?? null
669
- }));
670
- var poolRewardSchema = z.object({
671
- coin_type: z.string().nullish(),
672
- symbol: z.string(),
673
- decimals: z.number(),
674
- icon_url: z.string(),
675
- verified: z.boolean(),
676
- daily_amount: z.number(),
677
- daily_amount_usd: z.number(),
678
- apr: z.number()
679
- }).transform((r) => ({
680
- coinId: r.coin_type ?? null,
681
- symbol: r.symbol,
682
- decimals: r.decimals,
683
- iconUrl: r.icon_url,
684
- verified: r.verified,
685
- dailyAmount: r.daily_amount,
686
- dailyAmountUsd: r.daily_amount_usd,
687
- apr: r.apr
688
- }));
689
- var poolFeeSchema = z.object({ fee_raw: z.number(), fee_usd: z.number() }).transform((f) => ({ feeRaw: f.fee_raw, feeUsd: f.fee_usd }));
690
- var coinCandleSchema = z.object({
691
- t: z.string(),
692
- ohlcv: z.array(z.number()).nullish()
693
- }).transform(({ t, ohlcv }) => {
694
- const [open = 0, high = 0, low = 0, close = 0, volume = 0] = ohlcv ?? [];
695
- return { timestamp: Date.parse(t), open, high, low, close, volume };
696
- });
697
- var poolCandleSchema = z.array(z.number()).transform(([seconds = 0, open = 0, high = 0, low = 0, close = 0, volume = 0]) => ({
698
- timestamp: seconds * 1e3,
699
- open,
700
- high,
701
- low,
702
- close,
703
- volume
704
- }));
705
- var VALID_BUCKET_MINUTES = [
706
- 1,
707
- 5,
708
- 15,
709
- 30,
710
- 60,
711
- 120,
712
- 240,
713
- 360,
714
- 720,
715
- 1440,
716
- 5760,
717
- 10080,
718
- 43200
719
- ];
720
- function assertBucket(bucketMinutes) {
721
- if (!VALID_BUCKET_MINUTES.includes(bucketMinutes)) {
722
- throw new MinswapError(
723
- `bucketMinutes must be one of ${VALID_BUCKET_MINUTES.join(", ")}; received ${bucketMinutes}`,
724
- "INVALID_PARAMS" /* INVALID_PARAMS */,
725
- { param: "bucketMinutes", reason: "unsupported bucket size" }
726
- );
727
- }
728
- }
729
542
 
730
543
  // src/modules/aggregator-module.ts
731
544
  var AGGREGATOR_PROTOCOLS = [
@@ -870,35 +683,6 @@ var estimateSchema = z.object({
870
683
  }));
871
684
  var buildTxResponseSchema = z.object({ cbor: z.string() }).transform((r) => ({ cbor: r.cbor }));
872
685
  var submitResponseSchema = z.object({ tx_id: z.string() }).transform((r) => ({ txId: r.tx_id }));
873
- var pendingOrderSchema = z.object({
874
- owner_address: z.string(),
875
- protocol: z.string(),
876
- token_in: assetSchema,
877
- token_out: assetSchema,
878
- amount_in: z.string(),
879
- min_amount_out: z.string(),
880
- created_at: z.number(),
881
- tx_in: z.string(),
882
- dex_fee: z.string(),
883
- deposit: z.string()
884
- }).transform((o) => ({
885
- ownerAddress: o.owner_address,
886
- protocol: o.protocol,
887
- tokenIn: o.token_in,
888
- tokenOut: o.token_out,
889
- amountIn: o.amount_in,
890
- minAmountOut: o.min_amount_out,
891
- /** Epoch seconds. */
892
- createdAt: o.created_at,
893
- /** The order's UTxO reference, `txHash#index` — pass to {@link AggregatorModule.cancelOrders}. */
894
- txIn: o.tx_in,
895
- dexFee: o.dex_fee,
896
- deposit: o.deposit
897
- }));
898
- var pendingOrdersSchema = z.object({
899
- orders: arrayOf(pendingOrderSchema),
900
- amount_in_decimal: z.boolean()
901
- }).transform((r) => r.orders);
902
686
  function estimateBody(params) {
903
687
  return dropUndefined({
904
688
  amount: params.amount,
@@ -999,23 +783,6 @@ var AggregatorModule = class {
999
783
  schema: buildTxResponseSchema
1000
784
  });
1001
785
  }
1002
- /**
1003
- * List an address's still-open aggregator orders.
1004
- *
1005
- * Only orders whose UTxO is still unspent are returned, so this is genuinely
1006
- * "open orders" rather than history. For full history including filled and
1007
- * cancelled orders, use {@link OrderModule.getHistory}.
1008
- */
1009
- async getPendingOrders(ownerAddress, options = {}) {
1010
- return this.sdk.clients.aggregatorApi.get({
1011
- path: "/aggregator/pending-orders",
1012
- query: {
1013
- owner_address: ownerAddress,
1014
- amount_in_decimal: options.amountInDecimal
1015
- },
1016
- schema: pendingOrdersSchema
1017
- });
1018
- }
1019
786
  };
1020
787
  function dropUndefined(obj) {
1021
788
  for (const key of Object.keys(obj)) {
@@ -1106,6 +873,115 @@ async function collect(fetchPage, options = {}) {
1106
873
  }
1107
874
  return items;
1108
875
  }
876
+ function arrayOf(schema) {
877
+ return z.array(schema).nullish().transform((value) => value ?? []);
878
+ }
879
+ var zeroableNumber = z.number().nullish().transform((value) => value ?? 0);
880
+ var coinBasicInfoSchema = z.object({
881
+ coin_type: z.string().nullish(),
882
+ symbol: z.string(),
883
+ decimals: z.number(),
884
+ icon_url: z.string(),
885
+ verified: z.boolean()
886
+ }).transform((c) => ({
887
+ coinId: c.coin_type ?? null,
888
+ symbol: c.symbol,
889
+ decimals: c.decimals,
890
+ iconUrl: c.icon_url,
891
+ verified: c.verified
892
+ }));
893
+ var coinAmountInfoSchema = z.object({
894
+ coin_type: z.string().nullish(),
895
+ symbol: z.string(),
896
+ decimals: z.number(),
897
+ icon_url: z.string(),
898
+ verified: z.boolean(),
899
+ amount: z.number(),
900
+ usd_value: z.number()
901
+ }).transform((c) => ({
902
+ coinId: c.coin_type ?? null,
903
+ symbol: c.symbol,
904
+ decimals: c.decimals,
905
+ iconUrl: c.icon_url,
906
+ verified: c.verified,
907
+ amount: c.amount,
908
+ usdValue: c.usd_value
909
+ }));
910
+ var poolCoinSchema = z.object({
911
+ coin_type: z.string().nullish(),
912
+ symbol: z.string(),
913
+ decimals: z.number(),
914
+ icon_url: z.string(),
915
+ verified: z.boolean(),
916
+ category: z.string().nullish()
917
+ }).transform((c) => ({
918
+ coinId: c.coin_type ?? null,
919
+ symbol: c.symbol,
920
+ decimals: c.decimals,
921
+ iconUrl: c.icon_url,
922
+ verified: c.verified,
923
+ /** Free-form; not constrained to the `categoryGroup` filter values. */
924
+ category: c.category ?? null
925
+ }));
926
+ var poolRewardSchema = z.object({
927
+ coin_type: z.string().nullish(),
928
+ symbol: z.string(),
929
+ decimals: z.number(),
930
+ icon_url: z.string(),
931
+ verified: z.boolean(),
932
+ daily_amount: z.number(),
933
+ daily_amount_usd: z.number(),
934
+ apr: z.number()
935
+ }).transform((r) => ({
936
+ coinId: r.coin_type ?? null,
937
+ symbol: r.symbol,
938
+ decimals: r.decimals,
939
+ iconUrl: r.icon_url,
940
+ verified: r.verified,
941
+ dailyAmount: r.daily_amount,
942
+ dailyAmountUsd: r.daily_amount_usd,
943
+ apr: r.apr
944
+ }));
945
+ var poolFeeSchema = z.object({ fee_raw: z.number(), fee_usd: z.number() }).transform((f) => ({ feeRaw: f.fee_raw, feeUsd: f.fee_usd }));
946
+ var coinCandleSchema = z.object({
947
+ t: z.string(),
948
+ ohlcv: z.array(z.number()).nullish()
949
+ }).transform(({ t, ohlcv }) => {
950
+ const [open = 0, high = 0, low = 0, close = 0, volume = 0] = ohlcv ?? [];
951
+ return { timestamp: Date.parse(t), open, high, low, close, volume };
952
+ });
953
+ var poolCandleSchema = z.array(z.number()).transform(([seconds = 0, open = 0, high = 0, low = 0, close = 0, volume = 0]) => ({
954
+ timestamp: seconds * 1e3,
955
+ open,
956
+ high,
957
+ low,
958
+ close,
959
+ volume
960
+ }));
961
+ var VALID_BUCKET_MINUTES = [
962
+ 1,
963
+ 5,
964
+ 15,
965
+ 30,
966
+ 60,
967
+ 120,
968
+ 240,
969
+ 360,
970
+ 720,
971
+ 1440,
972
+ 5760,
973
+ 10080,
974
+ 43200
975
+ ];
976
+ function assertBucket(bucketMinutes) {
977
+ if (!VALID_BUCKET_MINUTES.includes(bucketMinutes)) {
978
+ throw new MinswapError(
979
+ `bucketMinutes must be one of ${VALID_BUCKET_MINUTES.join(", ")}; received ${bucketMinutes}`,
980
+ "INVALID_PARAMS" /* INVALID_PARAMS */,
981
+ { param: "bucketMinutes", reason: "unsupported bucket size" }
982
+ );
983
+ }
984
+ }
1109
985
 
1110
986
  // src/client/rpc-provider.ts
1111
987
  function parseTxIn(ref) {
@@ -1617,11 +1493,11 @@ function calculateDepositSwapAmount(params) {
1617
1493
  const { amountIn, amountOut, reserveIn, reserveOut, tradingFeeNumerator } = params;
1618
1494
  const x = (amountOut + reserveOut) * reserveIn;
1619
1495
  const y = 4n * (amountOut + reserveOut) * (amountOut * reserveIn * reserveIn - amountIn * reserveIn * reserveOut);
1620
- const z14 = 2n * (amountOut + reserveOut);
1496
+ const z13 = 2n * (amountOut + reserveOut);
1621
1497
  const twoDenomMinusFee = 2n * FEE_DENOMINATOR - tradingFeeNumerator;
1622
1498
  const a = x * x * (twoDenomMinusFee * twoDenomMinusFee) - y * FEE_DENOMINATOR * (FEE_DENOMINATOR - tradingFeeNumerator);
1623
1499
  const b = twoDenomMinusFee * x;
1624
- return [sqrt(a) - b, z14 * (FEE_DENOMINATOR - tradingFeeNumerator)];
1500
+ return [sqrt(a) - b, z13 * (FEE_DENOMINATOR - tradingFeeNumerator)];
1625
1501
  }
1626
1502
  function calculateDepositAmount(params) {
1627
1503
  const { amountA, amountB, pool } = params;
@@ -1758,6 +1634,17 @@ async function loadDexSerializer() {
1758
1634
  })();
1759
1635
  return cached;
1760
1636
  }
1637
+ function paymentCredentialHex(addr) {
1638
+ const credential2 = addr.toPaymentCredential();
1639
+ if (!credential2) {
1640
+ throw new MinswapError(
1641
+ "Sender address has no payment credential",
1642
+ "INVALID_PARAMS" /* INVALID_PARAMS */,
1643
+ { param: "sender", reason: "address has no payment credential" }
1644
+ );
1645
+ }
1646
+ return credential2.payload.hex;
1647
+ }
1761
1648
  async function toDatumHex(datum) {
1762
1649
  const { PlutusData: plutus } = await loadDexSerializer();
1763
1650
  return plutus.toDataHex(datum);
@@ -1769,8 +1656,18 @@ async function loadDexBuilder() {
1769
1656
  // src/liquidity/build/assemble.ts
1770
1657
  async function assembleOrder(order) {
1771
1658
  const b = await loadDexBuilder();
1772
- const { TxBuilderV2, TxOut, Value, Address, Asset, Bytes, DatumSource, Utxo, EmulatorProvider } = b;
1773
- const CoinSelectionAlgorithm = b.CoinSelectionAlgorithm;
1659
+ const {
1660
+ TxBuilderV2,
1661
+ TxOut,
1662
+ Value,
1663
+ Address,
1664
+ Asset,
1665
+ Bytes,
1666
+ DatumSource,
1667
+ Utxo,
1668
+ EmulatorProvider,
1669
+ CoinSelectionAlgorithm
1670
+ } = b;
1774
1671
  const valueMap = { lovelace: order.lovelace };
1775
1672
  for (const a of order.assets) {
1776
1673
  valueMap[Asset.fromBlockFrostString(a.unit).toString()] = a.amount;
@@ -1799,7 +1696,7 @@ var unitOf = (a) => a.policyId + a.nameHex;
1799
1696
  async function resolveSender(sender) {
1800
1697
  const b = await loadDexBuilder();
1801
1698
  const addr = b.Address.fromBech32(sender);
1802
- const paymentKeyHash = addr.toPaymentCredential().payload.hex;
1699
+ const paymentKeyHash = paymentCredentialHex(addr);
1803
1700
  const stakeAddr = addr.toStakeAddress?.();
1804
1701
  const stakeKeyHash = stakeAddr ? stakeAddr.toPubKeyHash()?.keyHash.hex ?? null : null;
1805
1702
  const orderAddress = b.Address.fromPlutusJson(
@@ -1905,7 +1802,7 @@ var unitOf2 = (a) => a.policyId + a.nameHex;
1905
1802
  async function resolveSender2(sender) {
1906
1803
  const b = await loadDexBuilder();
1907
1804
  const addr = b.Address.fromBech32(sender);
1908
- const paymentKeyHash = addr.toPaymentCredential().payload.hex;
1805
+ const paymentKeyHash = paymentCredentialHex(addr);
1909
1806
  const stakeAddr = addr.toStakeAddress?.();
1910
1807
  const stakeKeyHash = stakeAddr ? stakeAddr.toPubKeyHash()?.keyHash.hex ?? null : null;
1911
1808
  const orderAddress = b.Address.fromPlutusJson(
@@ -2268,7 +2165,7 @@ var unitOfLpAsset = (a) => a.policyId + a.nameHex;
2268
2165
  async function resolveSender3(sender) {
2269
2166
  const b = await loadDexBuilder();
2270
2167
  const addr = b.Address.fromBech32(sender);
2271
- const paymentKeyHash = addr.toPaymentCredential().payload.hex;
2168
+ const paymentKeyHash = paymentCredentialHex(addr);
2272
2169
  const stakeAddr = addr.toStakeAddress?.();
2273
2170
  const stakeKeyHash = stakeAddr ? stakeAddr.toPubKeyHash()?.keyHash.hex ?? null : null;
2274
2171
  return { paymentKeyHash, stakeKeyHash };
@@ -2573,206 +2470,133 @@ function getStableswapConfigByLpAsset(lpAsset) {
2573
2470
  }
2574
2471
  return config;
2575
2472
  }
2576
- var assetSchema2 = z.object({
2577
- currencySymbol: z.string(),
2578
- tokenName: z.string(),
2579
- metadata: z.object({ decimals: z.number().nullish() }).nullish()
2473
+ var POOL_STATE_PATH = "/api/v1/pool/state";
2474
+ var POOL_STATE_ENDPOINT = `GET ${POOL_STATE_PATH}`;
2475
+ var MAX_POOL_IDS = 50;
2476
+ var uint = z.string().regex(/^\d+$/, "expected a non-negative decimal integer string").transform((s) => BigInt(s));
2477
+ var coinSchema = z.object({
2478
+ coin_type: z.string(),
2479
+ symbol: z.string(),
2480
+ decimals: z.number().nullish()
2580
2481
  });
2581
- var ammPoolSchema = z.object({
2582
- type: z.enum(["DEX", "DEX_V2", "STABLESWAP"]),
2583
- lpAsset: assetSchema2,
2584
- poolAssets: z.array(assetSchema2),
2585
- utxo: z.object({
2586
- address: z.string(),
2587
- datum: z.string(),
2588
- txIn: z.string(),
2589
- // A JSON blob `{"$ledgerValue":{unit: amountString, ...}}`; V1 reserves are
2590
- // read from it (V2/stableswap take reserves from the datum).
2591
- value: z.string()
2592
- })
2482
+ var poolStateSchema = z.object({
2483
+ protocol: z.enum(["minswap-cpmm-v1", "minswap-cpmm-v2", "minswap-stable-cpmm-v1"]),
2484
+ pool_id: z.string(),
2485
+ coin_a: coinSchema,
2486
+ coin_b: coinSchema,
2487
+ tx_in: z.string(),
2488
+ address: z.string(),
2489
+ v1: z.object({ reserve_a: uint, reserve_b: uint, liquidity: uint }).nullish(),
2490
+ v2: z.object({
2491
+ reserve_a: uint,
2492
+ reserve_b: uint,
2493
+ liquidity: uint,
2494
+ fee_a_numerator: uint,
2495
+ fee_b_numerator: uint
2496
+ }).nullish(),
2497
+ stable: z.object({
2498
+ balances: z.array(uint),
2499
+ liquidity: uint,
2500
+ amplification_coefficient: uint
2501
+ }).nullish()
2593
2502
  });
2594
- var poolsSchema = z.array(ammPoolSchema);
2595
- var POOL_FIELDS = `
2596
- type
2597
- lpAsset { currencySymbol tokenName }
2598
- poolAssets { currencySymbol tokenName metadata { decimals } }
2599
- utxo { address datum txIn value }
2600
- `;
2601
- var BY_LP_ASSETS_QUERY = `query AppliedPoolsByLpAssets($lpAssets: [InputAsset!]!) {
2602
- appliedPoolsByLPAssets(lpAssets: $lpAssets) {${POOL_FIELDS}}
2603
- }`;
2604
- var BY_PAIRS_QUERY = `query AppliedPoolsByPairs($pairs: [InputPair!]!) {
2605
- appliedPoolsByPairs(pairs: $pairs) {${POOL_FIELDS}}
2606
- }`;
2503
+ var poolStatesSchema = z.array(poolStateSchema).nullish().transform((pools) => pools ?? []);
2607
2504
  async function getAppliedPoolsByLpAssets(client, lpAssets) {
2608
- const pools = await client.execute({
2609
- operation: "appliedPoolsByLPAssets",
2610
- document: BY_LP_ASSETS_QUERY,
2611
- variables: { lpAssets },
2612
- schema: poolsSchema
2613
- });
2614
- return Promise.all(pools.map(toAppliedPool));
2615
- }
2616
- async function getAppliedPoolsByPairs(client, pairs) {
2617
- const pools = await client.execute({
2618
- operation: "appliedPoolsByPairs",
2619
- document: BY_PAIRS_QUERY,
2620
- variables: { pairs },
2621
- schema: poolsSchema
2622
- });
2623
- return Promise.all(pools.map(toAppliedPool));
2505
+ const chunks = [];
2506
+ for (let i = 0; i < lpAssets.length; i += MAX_POOL_IDS) {
2507
+ chunks.push(lpAssets.slice(i, i + MAX_POOL_IDS));
2508
+ }
2509
+ const pages = await Promise.all(
2510
+ chunks.map((chunk) => fetchPoolStates(client, { pool_ids: chunk, applied: true }))
2511
+ );
2512
+ return pages.flat();
2624
2513
  }
2625
- function mapVersion(type) {
2626
- switch (type) {
2627
- case "DEX":
2628
- return "V1";
2629
- case "DEX_V2":
2630
- return "V2";
2631
- case "STABLESWAP":
2632
- return "STABLESWAP";
2514
+ async function getAppliedPoolsByPair(client, coinA, coinB) {
2515
+ if (coinA === coinB) {
2516
+ throw new MinswapError(
2517
+ `A pool pair needs two different coins, got ${coinA} twice`,
2518
+ "INVALID_PARAMS" /* INVALID_PARAMS */,
2519
+ { param: "pool", reason: "assetA and assetB must differ" }
2520
+ );
2633
2521
  }
2522
+ return fetchPoolStates(client, { coin_a: coinA, coin_b: coinB, applied: true });
2634
2523
  }
2635
- function toPoolAsset(asset2) {
2636
- return { policyId: asset2.currencySymbol, nameHex: asset2.tokenName };
2524
+ async function fetchPoolStates(client, query) {
2525
+ const { data } = await client.get({ path: POOL_STATE_PATH, query, schema: poolStatesSchema });
2526
+ return data.map(toAppliedPool);
2637
2527
  }
2638
- function unitOf3(a) {
2528
+ function coinIdOf(a) {
2639
2529
  return a.policyId === "" ? "lovelace" : `${a.policyId}.${a.nameHex}`;
2640
2530
  }
2641
- async function toAppliedPool(pool) {
2642
- const version = mapVersion(pool.type);
2643
- const [rawA, rawB] = pool.poolAssets;
2644
- if (!rawA || !rawB) {
2645
- throw new MinswapError(
2646
- `Pool ${pool.utxo.txIn} returned ${pool.poolAssets.length} pool assets, expected 2`,
2647
- "PARSE_ERROR" /* PARSE_ERROR */,
2648
- {
2649
- endpoint: "GraphQL appliedPools",
2650
- issues: [{ path: "poolAssets", message: `expected 2, got ${pool.poolAssets.length}` }]
2651
- }
2652
- );
2531
+ function toPoolAsset(coinId) {
2532
+ const a = coinIdToInputAsset(coinId);
2533
+ return { policyId: a.currencySymbol, nameHex: a.tokenName };
2534
+ }
2535
+ function parseError(path, message) {
2536
+ return new MinswapError(`${POOL_STATE_ENDPOINT}: ${message}`, "PARSE_ERROR" /* PARSE_ERROR */, {
2537
+ endpoint: POOL_STATE_ENDPOINT,
2538
+ issues: [{ path, message }]
2539
+ });
2540
+ }
2541
+ function toAppliedPool(pool) {
2542
+ const filled = [pool.v1, pool.v2, pool.stable].filter((s) => s != null).length;
2543
+ if (filled !== 1) {
2544
+ throw parseError(pool.pool_id, `expected exactly one of v1/v2/stable, got ${filled}`);
2653
2545
  }
2654
- const fields = await decodeDatumFields(pool.utxo.datum);
2655
- let assetA;
2656
- let assetB;
2546
+ let version;
2657
2547
  let state;
2658
- if (version === "V2") {
2659
- assetA = decodeAssetNode(fields[1], "V2 pool datum", "assetA");
2660
- assetB = decodeAssetNode(fields[2], "V2 pool datum", "assetB");
2661
- state = decodeV2State(fields);
2662
- } else if (version === "STABLESWAP") {
2663
- assetA = toPoolAsset(rawA);
2664
- assetB = toPoolAsset(rawB);
2665
- state = decodeStableswapState(fields);
2548
+ if (pool.protocol === "minswap-cpmm-v2" && pool.v2) {
2549
+ version = "V2";
2550
+ state = {
2551
+ kind: "V2",
2552
+ reserveA: pool.v2.reserve_a,
2553
+ reserveB: pool.v2.reserve_b,
2554
+ totalLiquidity: pool.v2.liquidity,
2555
+ feeANumerator: pool.v2.fee_a_numerator,
2556
+ feeBNumerator: pool.v2.fee_b_numerator
2557
+ };
2558
+ } else if (pool.protocol === "minswap-cpmm-v1" && pool.v1) {
2559
+ version = "V1";
2560
+ state = {
2561
+ kind: "V1",
2562
+ reserveA: pool.v1.reserve_a,
2563
+ reserveB: pool.v1.reserve_b,
2564
+ totalLiquidity: pool.v1.liquidity
2565
+ };
2566
+ } else if (pool.protocol === "minswap-stable-cpmm-v1" && pool.stable) {
2567
+ version = "STABLESWAP";
2568
+ state = {
2569
+ kind: "STABLESWAP",
2570
+ balances: pool.stable.balances,
2571
+ totalLiquidity: pool.stable.liquidity,
2572
+ amp: pool.stable.amplification_coefficient
2573
+ };
2666
2574
  } else {
2667
- assetA = decodeAssetNode(fields[0], "V1 pool datum", "assetA");
2668
- assetB = decodeAssetNode(fields[1], "V1 pool datum", "assetB");
2669
- state = decodeV1State(fields, pool.utxo.value, assetA, assetB);
2575
+ throw parseError(pool.pool_id, `state block does not match protocol ${pool.protocol}`);
2670
2576
  }
2671
2577
  const decimals = { lovelace: 6 };
2672
- for (const a of [rawA, rawB]) {
2673
- const d = a.metadata?.decimals;
2674
- if (a.currencySymbol !== "" && d != null) {
2675
- decimals[`${a.currencySymbol}.${a.tokenName}`] = d;
2578
+ for (const coin of [pool.coin_a, pool.coin_b]) {
2579
+ if (coin.coin_type !== "lovelace" && coin.symbol !== "" && coin.decimals != null) {
2580
+ decimals[coinIdOf(toPoolAsset(coin.coin_type))] = coin.decimals;
2676
2581
  }
2677
2582
  }
2678
2583
  return {
2679
2584
  version,
2680
- lpAsset: toPoolAsset(pool.lpAsset),
2681
- assetA,
2682
- assetB,
2585
+ lpAsset: toPoolAsset(pool.pool_id),
2586
+ assetA: toPoolAsset(pool.coin_a.coin_type),
2587
+ assetB: toPoolAsset(pool.coin_b.coin_type),
2683
2588
  state,
2684
- utxoRef: pool.utxo.txIn,
2685
- poolAddress: pool.utxo.address,
2686
- rawDatum: pool.utxo.datum,
2589
+ utxoRef: pool.tx_in,
2590
+ poolAddress: pool.address,
2687
2591
  decimals
2688
2592
  };
2689
2593
  }
2690
- async function decodeDatumFields(datumHex) {
2691
- const builder = await loadDexBuilder();
2692
- const decoder = builder.PlutusData;
2693
- const fields = decoder.fromDataHex(datumHex).fields;
2694
- if (!fields) {
2695
- throw parseError("pool datum", "fields", "datum is not a constructor with fields");
2696
- }
2697
- return fields;
2698
- }
2699
- function parseError(endpoint, path, message) {
2700
- return new MinswapError(`${endpoint}: ${message}`, "PARSE_ERROR" /* PARSE_ERROR */, {
2701
- endpoint,
2702
- issues: [{ path, message }]
2703
- });
2704
- }
2705
- function decodeAssetNode(node, endpoint, field) {
2706
- const f = node?.fields;
2707
- if (!f || f.length < 2 || f[0]?.bytes === void 0 || f[1]?.bytes === void 0) {
2708
- throw parseError(endpoint, field, "expected an asset Constr[policyId, assetNameHex]");
2709
- }
2710
- return { policyId: f[0].bytes, nameHex: f[1].bytes };
2711
- }
2712
- function readInt(node, endpoint, field) {
2713
- if (!node || node.int === void 0) {
2714
- throw parseError(endpoint, field, "expected an integer");
2715
- }
2716
- return BigInt(node.int);
2717
- }
2718
- function requireFields(fields, min, endpoint) {
2719
- if (fields.length < min) {
2720
- throw parseError(endpoint, "fields", `expected >=${min}, got ${fields.length}`);
2721
- }
2722
- }
2723
- function decodeV2State(fields) {
2724
- requireFields(fields, 8, "V2 pool datum");
2725
- return {
2726
- kind: "V2",
2727
- totalLiquidity: readInt(fields[3], "V2 pool datum", "totalLiquidity"),
2728
- reserveA: readInt(fields[4], "V2 pool datum", "reserveA"),
2729
- reserveB: readInt(fields[5], "V2 pool datum", "reserveB"),
2730
- feeANumerator: readInt(fields[6], "V2 pool datum", "feeANumerator"),
2731
- feeBNumerator: readInt(fields[7], "V2 pool datum", "feeBNumerator")
2732
- };
2733
- }
2734
- function decodeStableswapState(fields) {
2735
- requireFields(fields, 3, "Stableswap pool datum");
2736
- const balancesList = fields[0]?.list;
2737
- if (!balancesList) {
2738
- throw parseError("Stableswap pool datum", "balances", "expected a list");
2739
- }
2740
- return {
2741
- kind: "STABLESWAP",
2742
- balances: balancesList.map((b, i) => readInt(b, "Stableswap pool datum", `balances[${i}]`)),
2743
- totalLiquidity: readInt(fields[1], "Stableswap pool datum", "totalLiquidity"),
2744
- amp: readInt(fields[2], "Stableswap pool datum", "amp")
2745
- };
2746
- }
2747
- var ledgerValueSchema = z.object({ $ledgerValue: z.record(z.string(), z.string()) });
2748
- function decodeV1State(fields, valueJson, assetA, assetB) {
2749
- requireFields(fields, 3, "V1 pool datum");
2750
- const totalLiquidity = readInt(fields[2], "V1 pool datum", "totalLiquidity");
2751
- let parsed;
2752
- try {
2753
- parsed = JSON.parse(valueJson);
2754
- } catch {
2755
- throw parseError("V1 pool value", "value", "not valid JSON");
2756
- }
2757
- const ledger = ledgerValueSchema.safeParse(parsed);
2758
- if (!ledger.success) {
2759
- throw parseError("V1 pool value", "$ledgerValue", "missing ledger value map");
2760
- }
2761
- const amounts = ledger.data.$ledgerValue;
2762
- return {
2763
- kind: "V1",
2764
- reserveA: BigInt(amounts[unitOf3(assetA)] ?? "0"),
2765
- reserveB: BigInt(amounts[unitOf3(assetB)] ?? "0"),
2766
- totalLiquidity
2767
- };
2768
- }
2769
2594
 
2770
2595
  // src/modules/liquidity-module.ts
2771
2596
  var assetId = (coinId) => {
2772
2597
  const a = coinIdToInputAsset(coinId);
2773
2598
  return { policyId: a.currencySymbol, nameHex: a.tokenName };
2774
2599
  };
2775
- var coinIdOf = (a) => a.policyId === "" ? "lovelace" : `${a.policyId}.${a.nameHex}`;
2776
2600
  var eqAsset = (x, y) => x.policyId === y.policyId && x.nameHex === y.nameHex;
2777
2601
  var LiquidityModule = class {
2778
2602
  constructor(sdk) {
@@ -2935,17 +2759,15 @@ var LiquidityModule = class {
2935
2759
  });
2936
2760
  }
2937
2761
  async resolvePool(ref) {
2938
- const client = this.sdk.clients.appGraphql;
2762
+ const client = this.sdk.clients.appApi;
2939
2763
  if (typeof ref === "string") {
2940
- const [pool] = await getAppliedPoolsByLpAssets(client, [coinIdToInputAsset(ref)]);
2764
+ const [pool] = await getAppliedPoolsByLpAssets(client, [ref]);
2941
2765
  if (!pool) {
2942
2766
  throw poolNotFound("LP asset", ref);
2943
2767
  }
2944
2768
  return pool;
2945
2769
  }
2946
- const pools = await getAppliedPoolsByPairs(client, [
2947
- { assetA: coinIdToInputAsset(ref.assetA), assetB: coinIdToInputAsset(ref.assetB) }
2948
- ]);
2770
+ const pools = await getAppliedPoolsByPair(client, ref.assetA, ref.assetB);
2949
2771
  const pairId = `${ref.assetA}/${ref.assetB}`;
2950
2772
  if (pools.length === 0) {
2951
2773
  throw poolNotFound("pair", pairId);
@@ -3150,6 +2972,36 @@ var orderSchema = z.object({
3150
2972
  */
3151
2973
  splits: o.splits
3152
2974
  }));
2975
+ var pendingOrderSchema = z.object({
2976
+ tx_in: z.string(),
2977
+ protocol: z.string(),
2978
+ source: z.string().nullish(),
2979
+ coin_in: z.string(),
2980
+ coin_out: z.string(),
2981
+ amount_in: z.string(),
2982
+ min_amount_out: z.string(),
2983
+ dex_fee: z.string(),
2984
+ deposit: z.string(),
2985
+ created_at: z.number()
2986
+ }).transform((o) => ({
2987
+ /** The order's UTxO reference, `txHash#index`. */
2988
+ txIn: o.tx_in,
2989
+ /** App API protocol code, e.g. `"minswap-cpmm-v2"`. */
2990
+ protocol: o.protocol,
2991
+ /** Aggregator whose transaction placed the order (`"minswap"`, `"dex-hunter"`, …); `null` when placed on the DEX directly. */
2992
+ source: o.source ?? null,
2993
+ coinIn: o.coin_in,
2994
+ coinOut: o.coin_out,
2995
+ amountIn: o.amount_in,
2996
+ /** `"0"` when the order sets no minimum. */
2997
+ minAmountOut: o.min_amount_out,
2998
+ /** Batcher fee, lovelace. */
2999
+ dexFee: o.dex_fee,
3000
+ /** Deposit returned with the output, lovelace. */
3001
+ deposit: o.deposit,
3002
+ /** Epoch milliseconds. */
3003
+ createdAt: o.created_at
3004
+ }));
3153
3005
  var OrderModule = class {
3154
3006
  constructor(sdk) {
3155
3007
  this.sdk = sdk;
@@ -3181,6 +3033,31 @@ var OrderModule = class {
3181
3033
  });
3182
3034
  return cursorPage(data, pagination?.lastCursor);
3183
3035
  }
3036
+ /**
3037
+ * List an address's open swap orders, newest first, across every protocol
3038
+ * and aggregator.
3039
+ *
3040
+ * An order is listed while its UTxO is unspent; each leg of a split or
3041
+ * multi-hop submission is its own entry. Only `SWAP` orders are listed; the
3042
+ * other types (deposit, withdraw, zap, limit, …) are in
3043
+ * {@link OrderModule.getHistory}.
3044
+ *
3045
+ * @param params - `address`, plus `limit` (1..50, default 20) and `cursor` from a previous page
3046
+ * @returns one page of pending orders and the cursor for the next
3047
+ */
3048
+ async getPending(params) {
3049
+ assertLimit(params.limit, 50);
3050
+ const { data, pagination } = await this.sdk.clients.appApi.get({
3051
+ path: "/api/v1/order/pending",
3052
+ query: {
3053
+ address: params.address,
3054
+ cursor: params.cursor,
3055
+ limit: params.limit ?? 20
3056
+ },
3057
+ schema: arrayOf(pendingOrderSchema)
3058
+ });
3059
+ return cursorPage(data, pagination?.lastCursor);
3060
+ }
3184
3061
  /**
3185
3062
  * Collect the UTxO references that can still be cancelled for an order.
3186
3063
  *
@@ -3827,7 +3704,7 @@ var DOC_LIQUID_UNSTAKE = `mutation MinBarBuildLiquidUnstakeTx($options: MinBarBu
3827
3704
  minBarBuildLiquidUnstakeTx(options: $options)
3828
3705
  }`;
3829
3706
  var amountString = z.string();
3830
- var coinSchema = z.object({
3707
+ var coinSchema2 = z.object({
3831
3708
  coin_type: z.string().nullish(),
3832
3709
  symbol: z.string(),
3833
3710
  name: z.string(),
@@ -3939,7 +3816,7 @@ var securitySchema = z.object({
3939
3816
  }));
3940
3817
  var tagSchema = z.object({ id: z.number(), name: z.string() });
3941
3818
  var tokenDetailSchema = z.object({
3942
- coin: coinSchema,
3819
+ coin: coinSchema2,
3943
3820
  price_change: priceSchema,
3944
3821
  volume: volumeSchema.nullish(),
3945
3822
  social_media: socialMediaSchema,
@@ -4327,8 +4204,7 @@ var MinswapSdk = class {
4327
4204
  this.clients = {
4328
4205
  appApi: new AppApiClient(http, this.config),
4329
4206
  aggregatorApi: new AggregatorApiClient(http, this.config),
4330
- keyAppApi: new KeyAppApiClient(http, this.config),
4331
- appGraphql: new AppGraphqlClient(http, this.config)
4207
+ keyAppApi: new KeyAppApiClient(http, this.config)
4332
4208
  };
4333
4209
  this.token = new TokenModule(this);
4334
4210
  this.pool = new PoolModule(this);
@@ -4553,6 +4429,6 @@ async function mapConcurrent(items, limit, fn) {
4553
4429
  return results;
4554
4430
  }
4555
4431
 
4556
- export { AGGREGATOR_PROTOCOLS, AggregatorApiClient, AggregatorModule, AppApiClient, AppGraphqlClient, BATCHER_FEE, CANCEL_ADAPTER_PROTOCOL, DEFAULT_ENDPOINTS, DEFAULT_RETRY, DEFAULT_TIMEOUT_MS, DEPOSIT_ADA, DEX_V1, DEX_V2, FARM_LIST_SORT_FIELDS, FARM_PROTOCOLS, FarmModule, HttpCore, KeyAppApiClient, KupoRpcProvider, LiquidityModule, MAINNET_NETWORK_ENV, MinswapError, MinswapErrorCode, MinswapSdk, ORDER_SOURCE_DIRECT, ORDER_STATUSES, OrderModule, POOL_CATEGORY_GROUPS, POOL_EVENT_ACTIONS, POOL_FILTER_TYPES, POOL_LIST_SORT_FIELDS, POOL_TYPES, PoolModule, PortfolioModule, StakingModule, TOKEN_LIST_SORT_BY, TOKEN_TRADE_ACTIONS, TokenModule, VALID_BUCKET_MINUTES, arrayOf, assertBucket, assertLimit, assetUnitToCoinId, buildUrl, coinAmountInfoSchema, coinBasicInfoSchema, coinCandleSchema, coinIdToAssetUnit, coinIdToInputAsset, collect, cursorPage, decimalToRaw, decodeOffsetCursor, encodeOffsetCursor, formatTxIn, getAppliedPoolsByLpAssets, getAppliedPoolsByPairs, inputAssetToCoinId, isPureAda, loadDexBuilder, lovelaceOf, offsetPage, paginate, parseTxIn, poolCandleSchema, poolCoinSchema, poolFeeSchema, poolRewardSchema, requireRpcProvider, resolveConfig, resolveWalletInputs, selectCollateral, toBigIntString, toDatumHex, toEpochMs, toEpochSeconds, toRfc3339, zeroableNumber };
4432
+ export { AGGREGATOR_PROTOCOLS, AggregatorApiClient, AggregatorModule, AppApiClient, BATCHER_FEE, CANCEL_ADAPTER_PROTOCOL, DEFAULT_ENDPOINTS, DEFAULT_RETRY, DEFAULT_TIMEOUT_MS, DEPOSIT_ADA, DEX_V1, DEX_V2, FARM_LIST_SORT_FIELDS, FARM_PROTOCOLS, FarmModule, HttpCore, KeyAppApiClient, KupoRpcProvider, LiquidityModule, MAINNET_NETWORK_ENV, MinswapError, MinswapErrorCode, MinswapSdk, ORDER_SOURCE_DIRECT, ORDER_STATUSES, OrderModule, POOL_CATEGORY_GROUPS, POOL_EVENT_ACTIONS, POOL_FILTER_TYPES, POOL_LIST_SORT_FIELDS, POOL_TYPES, PoolModule, PortfolioModule, StakingModule, TOKEN_LIST_SORT_BY, TOKEN_TRADE_ACTIONS, TokenModule, VALID_BUCKET_MINUTES, arrayOf, assertBucket, assertLimit, assetUnitToCoinId, buildUrl, coinAmountInfoSchema, coinBasicInfoSchema, coinCandleSchema, coinIdOf, coinIdToAssetUnit, coinIdToInputAsset, collect, cursorPage, decimalToRaw, decodeOffsetCursor, encodeOffsetCursor, formatTxIn, getAppliedPoolsByLpAssets, getAppliedPoolsByPair, inputAssetToCoinId, isPureAda, lovelaceOf, offsetPage, paginate, parseTxIn, poolCandleSchema, poolCoinSchema, poolFeeSchema, poolRewardSchema, requireRpcProvider, resolveConfig, resolveWalletInputs, selectCollateral, toBigIntString, toEpochMs, toEpochSeconds, toRfc3339, zeroableNumber };
4557
4433
  //# sourceMappingURL=index.js.map
4558
4434
  //# sourceMappingURL=index.js.map