@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/CHANGELOG.md +19 -0
- package/README.md +2 -2
- package/dist/index.cjs +355 -481
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +132 -289
- package/dist/index.d.ts +132 -289
- package/dist/index.js +354 -478
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -164,16 +164,6 @@ type MinswapEndpoints = {
|
|
|
164
164
|
aggregatorApiUrl: string;
|
|
165
165
|
/** key-app-api GraphQL endpoint — farm and MIN staking transaction building. */
|
|
166
166
|
keyAppApiUrl: string;
|
|
167
|
-
/**
|
|
168
|
-
* app-monorepo GraphQL endpoint — reads a pool's on-chain state (reserves,
|
|
169
|
-
* total liquidity, fee) for quoting liquidity operations.
|
|
170
|
-
*
|
|
171
|
-
* This is a different host from {@link appApiUrl} (the Go read API): it is the
|
|
172
|
-
* TypeScript monorepo's GraphQL server, which serves `appliedPoolsBy*` with the
|
|
173
|
-
* pool UTxO's Plutus datum inline so the SDK can decode reserves without its
|
|
174
|
-
* own chain access.
|
|
175
|
-
*/
|
|
176
|
-
appGraphqlUrl: string;
|
|
177
167
|
};
|
|
178
168
|
declare const DEFAULT_ENDPOINTS: Record<MinswapNetwork, MinswapEndpoints>;
|
|
179
169
|
declare const DEFAULT_TIMEOUT_MS = 30000;
|
|
@@ -317,33 +307,6 @@ declare class AppApiClient {
|
|
|
317
307
|
private headers;
|
|
318
308
|
}
|
|
319
309
|
|
|
320
|
-
type AppGraphqlOperation<T> = {
|
|
321
|
-
/** Operation name, used for error reporting only. */
|
|
322
|
-
operation: string;
|
|
323
|
-
/** The GraphQL document to execute. */
|
|
324
|
-
document: string;
|
|
325
|
-
variables?: Record<string, unknown>;
|
|
326
|
-
/** Validates the payload under the operation's field, not the whole envelope. */
|
|
327
|
-
schema: ZodType<T>;
|
|
328
|
-
};
|
|
329
|
-
/**
|
|
330
|
-
* Read client for the app-monorepo GraphQL host (`appGraphqlUrl`).
|
|
331
|
-
*
|
|
332
|
-
* Deliberately identical in shape to {@link KeyAppApiClient} — same envelope,
|
|
333
|
-
* same single-root-field unwrap, same `parseErrorBody` so resolver errors
|
|
334
|
-
* carried on a non-2xx status surface as {@link MinswapErrorCode.GRAPHQL_ERROR}
|
|
335
|
-
* — but it runs **queries** (pool state), not mutations, and the results are
|
|
336
|
-
* plain read data, never partially-signed CBOR. It exists as its own class
|
|
337
|
-
* rather than being folded into the key-app client because it targets a
|
|
338
|
-
* different host and a different operation kind.
|
|
339
|
-
*/
|
|
340
|
-
declare class AppGraphqlClient {
|
|
341
|
-
private readonly http;
|
|
342
|
-
private readonly config;
|
|
343
|
-
constructor(http: HttpCore, config: ResolvedMinswapConfig);
|
|
344
|
-
execute<T>(operation: AppGraphqlOperation<T>): Promise<T>;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
310
|
type KeyAppApiOperation<T> = {
|
|
348
311
|
/** Operation name, used for error reporting only. */
|
|
349
312
|
operation: string;
|
|
@@ -814,133 +777,6 @@ declare const estimateSchema: z.ZodPipe<z.ZodObject<{
|
|
|
814
777
|
amount_in_decimal?: boolean | null | undefined;
|
|
815
778
|
}>>;
|
|
816
779
|
type AggregatorEstimate = z.infer<typeof estimateSchema>;
|
|
817
|
-
declare const pendingOrderSchema: z.ZodPipe<z.ZodObject<{
|
|
818
|
-
owner_address: z.ZodString;
|
|
819
|
-
protocol: z.ZodString;
|
|
820
|
-
token_in: z.ZodPipe<z.ZodObject<{
|
|
821
|
-
token_id: z.ZodString;
|
|
822
|
-
logo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
823
|
-
ticker: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
824
|
-
is_verified: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
825
|
-
price_by_ada: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
826
|
-
price_by_usd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
827
|
-
project_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
828
|
-
decimals: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
829
|
-
}, z.core.$strip>, z.ZodTransform<{
|
|
830
|
-
coinId: string;
|
|
831
|
-
logo: string | null;
|
|
832
|
-
ticker: string | null;
|
|
833
|
-
isVerified: boolean | null;
|
|
834
|
-
priceByAda: number | null;
|
|
835
|
-
priceByUsd: number | null;
|
|
836
|
-
projectName: string | null;
|
|
837
|
-
decimals: number | null;
|
|
838
|
-
}, {
|
|
839
|
-
token_id: string;
|
|
840
|
-
logo?: string | null | undefined;
|
|
841
|
-
ticker?: string | null | undefined;
|
|
842
|
-
is_verified?: boolean | null | undefined;
|
|
843
|
-
price_by_ada?: number | null | undefined;
|
|
844
|
-
price_by_usd?: number | null | undefined;
|
|
845
|
-
project_name?: string | null | undefined;
|
|
846
|
-
decimals?: number | null | undefined;
|
|
847
|
-
}>>;
|
|
848
|
-
token_out: z.ZodPipe<z.ZodObject<{
|
|
849
|
-
token_id: z.ZodString;
|
|
850
|
-
logo: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
851
|
-
ticker: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
852
|
-
is_verified: z.ZodOptional<z.ZodNullable<z.ZodBoolean>>;
|
|
853
|
-
price_by_ada: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
854
|
-
price_by_usd: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
855
|
-
project_name: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
856
|
-
decimals: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
857
|
-
}, z.core.$strip>, z.ZodTransform<{
|
|
858
|
-
coinId: string;
|
|
859
|
-
logo: string | null;
|
|
860
|
-
ticker: string | null;
|
|
861
|
-
isVerified: boolean | null;
|
|
862
|
-
priceByAda: number | null;
|
|
863
|
-
priceByUsd: number | null;
|
|
864
|
-
projectName: string | null;
|
|
865
|
-
decimals: number | null;
|
|
866
|
-
}, {
|
|
867
|
-
token_id: string;
|
|
868
|
-
logo?: string | null | undefined;
|
|
869
|
-
ticker?: string | null | undefined;
|
|
870
|
-
is_verified?: boolean | null | undefined;
|
|
871
|
-
price_by_ada?: number | null | undefined;
|
|
872
|
-
price_by_usd?: number | null | undefined;
|
|
873
|
-
project_name?: string | null | undefined;
|
|
874
|
-
decimals?: number | null | undefined;
|
|
875
|
-
}>>;
|
|
876
|
-
amount_in: z.ZodString;
|
|
877
|
-
min_amount_out: z.ZodString;
|
|
878
|
-
created_at: z.ZodNumber;
|
|
879
|
-
tx_in: z.ZodString;
|
|
880
|
-
dex_fee: z.ZodString;
|
|
881
|
-
deposit: z.ZodString;
|
|
882
|
-
}, z.core.$strip>, z.ZodTransform<{
|
|
883
|
-
ownerAddress: string;
|
|
884
|
-
protocol: AggregatorProtocol;
|
|
885
|
-
tokenIn: {
|
|
886
|
-
coinId: string;
|
|
887
|
-
logo: string | null;
|
|
888
|
-
ticker: string | null;
|
|
889
|
-
isVerified: boolean | null;
|
|
890
|
-
priceByAda: number | null;
|
|
891
|
-
priceByUsd: number | null;
|
|
892
|
-
projectName: string | null;
|
|
893
|
-
decimals: number | null;
|
|
894
|
-
};
|
|
895
|
-
tokenOut: {
|
|
896
|
-
coinId: string;
|
|
897
|
-
logo: string | null;
|
|
898
|
-
ticker: string | null;
|
|
899
|
-
isVerified: boolean | null;
|
|
900
|
-
priceByAda: number | null;
|
|
901
|
-
priceByUsd: number | null;
|
|
902
|
-
projectName: string | null;
|
|
903
|
-
decimals: number | null;
|
|
904
|
-
};
|
|
905
|
-
amountIn: string;
|
|
906
|
-
minAmountOut: string;
|
|
907
|
-
/** Epoch seconds. */
|
|
908
|
-
createdAt: number;
|
|
909
|
-
/** The order's UTxO reference, `txHash#index` — pass to {@link AggregatorModule.cancelOrders}. */
|
|
910
|
-
txIn: string;
|
|
911
|
-
dexFee: string;
|
|
912
|
-
deposit: string;
|
|
913
|
-
}, {
|
|
914
|
-
owner_address: string;
|
|
915
|
-
protocol: string;
|
|
916
|
-
token_in: {
|
|
917
|
-
coinId: string;
|
|
918
|
-
logo: string | null;
|
|
919
|
-
ticker: string | null;
|
|
920
|
-
isVerified: boolean | null;
|
|
921
|
-
priceByAda: number | null;
|
|
922
|
-
priceByUsd: number | null;
|
|
923
|
-
projectName: string | null;
|
|
924
|
-
decimals: number | null;
|
|
925
|
-
};
|
|
926
|
-
token_out: {
|
|
927
|
-
coinId: string;
|
|
928
|
-
logo: string | null;
|
|
929
|
-
ticker: string | null;
|
|
930
|
-
isVerified: boolean | null;
|
|
931
|
-
priceByAda: number | null;
|
|
932
|
-
priceByUsd: number | null;
|
|
933
|
-
projectName: string | null;
|
|
934
|
-
decimals: number | null;
|
|
935
|
-
};
|
|
936
|
-
amount_in: string;
|
|
937
|
-
min_amount_out: string;
|
|
938
|
-
created_at: number;
|
|
939
|
-
tx_in: string;
|
|
940
|
-
dex_fee: string;
|
|
941
|
-
deposit: string;
|
|
942
|
-
}>>;
|
|
943
|
-
type PendingOrder = z.infer<typeof pendingOrderSchema>;
|
|
944
780
|
/** Parameters shared by {@link AggregatorModule.estimate} and the estimate echoed into build-tx. */
|
|
945
781
|
type EstimateParams = {
|
|
946
782
|
/**
|
|
@@ -991,13 +827,9 @@ type CancelOrderRef = {
|
|
|
991
827
|
txIn: string;
|
|
992
828
|
protocol: CancelProtocol;
|
|
993
829
|
};
|
|
994
|
-
type GetPendingOrdersOptions = {
|
|
995
|
-
/** Return amounts as decimal figures rather than base units. */
|
|
996
|
-
amountInDecimal?: boolean;
|
|
997
|
-
};
|
|
998
830
|
/**
|
|
999
|
-
* The aggregator: quote a swap, build its transaction, submit it, cancel
|
|
1000
|
-
* orders
|
|
831
|
+
* The aggregator: quote a swap, build its transaction, submit it, and cancel
|
|
832
|
+
* open orders (`sdk.order.getPending` lists them).
|
|
1001
833
|
*
|
|
1002
834
|
* The SDK never signs. `buildTx` and `cancelOrders` return unsigned CBOR;
|
|
1003
835
|
* `cancelOrders`' CBOR is additionally *partially signed* by the server (for
|
|
@@ -1059,14 +891,6 @@ declare class AggregatorModule implements IMinswapModule {
|
|
|
1059
891
|
}): Promise<{
|
|
1060
892
|
cbor: string;
|
|
1061
893
|
}>;
|
|
1062
|
-
/**
|
|
1063
|
-
* List an address's still-open aggregator orders.
|
|
1064
|
-
*
|
|
1065
|
-
* Only orders whose UTxO is still unspent are returned, so this is genuinely
|
|
1066
|
-
* "open orders" rather than history. For full history including filled and
|
|
1067
|
-
* cancelled orders, use {@link OrderModule.getHistory}.
|
|
1068
|
-
*/
|
|
1069
|
-
getPendingOrders(ownerAddress: string, options?: GetPendingOrdersOptions): Promise<PendingOrder[]>;
|
|
1070
894
|
}
|
|
1071
895
|
|
|
1072
896
|
/**
|
|
@@ -4650,68 +4474,6 @@ declare class FarmModule implements IMinswapModule {
|
|
|
4650
4474
|
private findPosition;
|
|
4651
4475
|
}
|
|
4652
4476
|
|
|
4653
|
-
/**
|
|
4654
|
-
* Two token-identifier conventions coexist across Minswap's backends:
|
|
4655
|
-
*
|
|
4656
|
-
* - The **app API** uses a dotted `coinId`: `policyIdHex.assetNameHex`, a bare
|
|
4657
|
-
* `policyIdHex` when the asset name is empty, or `lovelace` for ADA.
|
|
4658
|
-
* - The **aggregator** uses a concatenated *unit*: `policyIdHex + assetNameHex`
|
|
4659
|
-
* with no separator, or `lovelace`.
|
|
4660
|
-
*
|
|
4661
|
-
* The SDK speaks the dotted `coinId` everywhere so callers learn one convention.
|
|
4662
|
-
* These converters bridge to the aggregator's form at that boundary.
|
|
4663
|
-
*
|
|
4664
|
-
* A Cardano policy id is always 28 bytes — 56 hex characters — so the split
|
|
4665
|
-
* point between policy and asset name is fixed, which makes the round trip
|
|
4666
|
-
* unambiguous.
|
|
4667
|
-
*/
|
|
4668
|
-
/** Dotted `coinId` (or bare policy / `lovelace`) to the aggregator's concatenated unit. */
|
|
4669
|
-
declare function coinIdToAssetUnit(coinId: string): string;
|
|
4670
|
-
/** The aggregator's concatenated unit back to a dotted `coinId`. */
|
|
4671
|
-
declare function assetUnitToCoinId(unit: string): string;
|
|
4672
|
-
/**
|
|
4673
|
-
* A coin's policy id and asset name as separate hex fields.
|
|
4674
|
-
*
|
|
4675
|
-
* The GraphQL mutations take assets in this split `InputAsset` shape rather than
|
|
4676
|
-
* as a single id.
|
|
4677
|
-
*/
|
|
4678
|
-
type InputAsset = {
|
|
4679
|
-
currencySymbol: string;
|
|
4680
|
-
tokenName: string;
|
|
4681
|
-
};
|
|
4682
|
-
/** Split a dotted `coinId` into an `InputAsset`. */
|
|
4683
|
-
declare function coinIdToInputAsset(coinId: string): InputAsset;
|
|
4684
|
-
/** Join a split `InputAsset` back into a dotted `coinId`. */
|
|
4685
|
-
declare function inputAssetToCoinId(asset: InputAsset): string;
|
|
4686
|
-
|
|
4687
|
-
/**
|
|
4688
|
-
* Plain-object Plutus data, shaped exactly as `@minswap/internal-sdk`'s
|
|
4689
|
-
* `PlutusData` union so an encoded value can be handed straight to its
|
|
4690
|
-
* `PlutusData.toDataHex` serializer. Keeping the model here — rather than
|
|
4691
|
-
* importing the optional peer's types — lets the datum encoders be pure,
|
|
4692
|
-
* dependency-free, and unit-testable without the WASM serializer present.
|
|
4693
|
-
*
|
|
4694
|
-
* The canonical on-chain encoding these produce (constructor tag 121+i for
|
|
4695
|
-
* i≤6, 1280+(i-7) for 7..127; indefinite-length arrays for non-empty fields)
|
|
4696
|
-
* is fixed by the ledger, so the byte output is stable regardless of who
|
|
4697
|
-
* serializes it.
|
|
4698
|
-
*/
|
|
4699
|
-
type PlutusData = PlutusConstr | PlutusInt | PlutusBytes | PlutusList;
|
|
4700
|
-
/** `constructor` is the on-chain alternative index; it shadows Object.prototype.constructor as an own property, which the serializer reads. */
|
|
4701
|
-
type PlutusConstr = {
|
|
4702
|
-
constructor: number;
|
|
4703
|
-
fields: PlutusData[];
|
|
4704
|
-
};
|
|
4705
|
-
type PlutusInt = {
|
|
4706
|
-
int: string;
|
|
4707
|
-
};
|
|
4708
|
-
type PlutusBytes = {
|
|
4709
|
-
bytes: string;
|
|
4710
|
-
};
|
|
4711
|
-
type PlutusList = {
|
|
4712
|
-
list: PlutusData[];
|
|
4713
|
-
};
|
|
4714
|
-
|
|
4715
4477
|
type PoolReserves = {
|
|
4716
4478
|
reserveA: bigint;
|
|
4717
4479
|
reserveB: bigint;
|
|
@@ -4721,11 +4483,7 @@ type PoolReserves = {
|
|
|
4721
4483
|
};
|
|
4722
4484
|
|
|
4723
4485
|
/**
|
|
4724
|
-
*
|
|
4725
|
-
* queries. Used to quote liquidity operations (deposit/withdraw/zap) against the
|
|
4726
|
-
* live reserves without the SDK needing its own chain access — the query returns
|
|
4727
|
-
* the pool UTxO's Plutus datum (and value) and this module decodes it per
|
|
4728
|
-
* protocol version.
|
|
4486
|
+
* Minswap pool state from the app API (`GET /api/v1/pool/state?applied=true`), used to quote liquidity operations.
|
|
4729
4487
|
*/
|
|
4730
4488
|
type PoolVersion = "V1" | "V2" | "STABLESWAP";
|
|
4731
4489
|
/** A coin as split policy id + hex asset name (ADA is both empty strings). */
|
|
@@ -4755,7 +4513,9 @@ type PoolState = V2PoolState | V1PoolState | StableswapPoolState;
|
|
|
4755
4513
|
type AppliedPool = {
|
|
4756
4514
|
version: PoolVersion;
|
|
4757
4515
|
lpAsset: PoolAsset;
|
|
4516
|
+
/** First pool coin; for V1/V2 it pairs with `reserveA`. */
|
|
4758
4517
|
assetA: PoolAsset;
|
|
4518
|
+
/** Second pool coin; for V1/V2 it pairs with `reserveB`. */
|
|
4759
4519
|
assetB: PoolAsset;
|
|
4760
4520
|
/** Decoded pool state, discriminated by `kind` (matches `version`). */
|
|
4761
4521
|
state: PoolState;
|
|
@@ -4763,25 +4523,36 @@ type AppliedPool = {
|
|
|
4763
4523
|
utxoRef: string;
|
|
4764
4524
|
/** The pool script address the UTxO sits at. */
|
|
4765
4525
|
poolAddress: string;
|
|
4766
|
-
/** The pool datum as CBOR hex, exactly as returned. */
|
|
4767
|
-
rawDatum: string;
|
|
4768
4526
|
/**
|
|
4769
|
-
* Decimals per
|
|
4770
|
-
*
|
|
4771
|
-
* no on-chain metadata is absent (its decimals are unknown). LP tokens are not
|
|
4772
|
-
* included: LP amounts are always raw.
|
|
4527
|
+
* Decimals per `coinId`, for converting decimal amounts to raw units. ADA is 6; a coin without backend
|
|
4528
|
+
* metadata is absent (unknown decimals); LP tokens are absent because LP amounts are always raw.
|
|
4773
4529
|
*/
|
|
4774
4530
|
decimals: Record<string, number>;
|
|
4775
4531
|
};
|
|
4776
|
-
/**
|
|
4777
|
-
|
|
4778
|
-
|
|
4779
|
-
|
|
4780
|
-
|
|
4781
|
-
|
|
4782
|
-
|
|
4783
|
-
|
|
4784
|
-
|
|
4532
|
+
/**
|
|
4533
|
+
* Fetches the applied state of pools by their LP token.
|
|
4534
|
+
*
|
|
4535
|
+
* @param client - App API client.
|
|
4536
|
+
* @param lpAssets - LP token `coinId`s; any number, sent in batches of the backend limit.
|
|
4537
|
+
* @returns The pools in request order; unknown LP tokens are skipped.
|
|
4538
|
+
*/
|
|
4539
|
+
declare function getAppliedPoolsByLpAssets(client: AppApiClient, lpAssets: string[]): Promise<AppliedPool[]>;
|
|
4540
|
+
/**
|
|
4541
|
+
* Fetches every non-empty pool of a coin pair, across all pool versions.
|
|
4542
|
+
*
|
|
4543
|
+
* @param client - App API client.
|
|
4544
|
+
* @param coinA - `coinId` of one coin (`lovelace` for ADA); order does not matter.
|
|
4545
|
+
* @param coinB - `coinId` of the other coin; must differ from `coinA`.
|
|
4546
|
+
* @returns The pair's pools, highest TVL first.
|
|
4547
|
+
*/
|
|
4548
|
+
declare function getAppliedPoolsByPair(client: AppApiClient, coinA: string, coinB: string): Promise<AppliedPool[]>;
|
|
4549
|
+
/**
|
|
4550
|
+
* Builds the `coinId` the liquidity module uses as a key for a pool asset.
|
|
4551
|
+
*
|
|
4552
|
+
* @param a - The pool asset.
|
|
4553
|
+
* @returns `lovelace` for ADA, otherwise `policyId.nameHex`.
|
|
4554
|
+
*/
|
|
4555
|
+
declare function coinIdOf(a: PoolAsset): string;
|
|
4785
4556
|
|
|
4786
4557
|
/**
|
|
4787
4558
|
* A pool to operate on, identified either by its LP token `coinId` (always
|
|
@@ -4846,7 +4617,7 @@ type ZapOutParams = WalletInput & {
|
|
|
4846
4617
|
*
|
|
4847
4618
|
* The caller supplies only the pool (an LP token or a coin pair), amounts, and
|
|
4848
4619
|
* slippage: the pool's version and on-chain state (reserves / balances / total
|
|
4849
|
-
* liquidity / fee) are fetched
|
|
4620
|
+
* liquidity / fee) are fetched from the app API (`/api/v1/pool/state`), all minimums are
|
|
4850
4621
|
* computed from it, and the wallet's UTxOs are drawn from the configured
|
|
4851
4622
|
* `RpcProvider`. Building the transaction requires the optional
|
|
4852
4623
|
* `@minswap/internal-sdk` peer (Node-only).
|
|
@@ -6418,6 +6189,52 @@ type OrderHistoryParams = PageParams & {
|
|
|
6418
6189
|
txHash?: string;
|
|
6419
6190
|
currency?: MinswapCurrency;
|
|
6420
6191
|
};
|
|
6192
|
+
declare const pendingOrderSchema: z.ZodPipe<z.ZodObject<{
|
|
6193
|
+
tx_in: z.ZodString;
|
|
6194
|
+
protocol: z.ZodString;
|
|
6195
|
+
source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
6196
|
+
coin_in: z.ZodString;
|
|
6197
|
+
coin_out: z.ZodString;
|
|
6198
|
+
amount_in: z.ZodString;
|
|
6199
|
+
min_amount_out: z.ZodString;
|
|
6200
|
+
dex_fee: z.ZodString;
|
|
6201
|
+
deposit: z.ZodString;
|
|
6202
|
+
created_at: z.ZodNumber;
|
|
6203
|
+
}, z.core.$strip>, z.ZodTransform<{
|
|
6204
|
+
/** The order's UTxO reference, `txHash#index`. */
|
|
6205
|
+
txIn: string;
|
|
6206
|
+
/** App API protocol code, e.g. `"minswap-cpmm-v2"`. */
|
|
6207
|
+
protocol: string;
|
|
6208
|
+
/** Aggregator whose transaction placed the order (`"minswap"`, `"dex-hunter"`, …); `null` when placed on the DEX directly. */
|
|
6209
|
+
source: string | null;
|
|
6210
|
+
coinIn: string;
|
|
6211
|
+
coinOut: string;
|
|
6212
|
+
amountIn: string;
|
|
6213
|
+
/** `"0"` when the order sets no minimum. */
|
|
6214
|
+
minAmountOut: string;
|
|
6215
|
+
/** Batcher fee, lovelace. */
|
|
6216
|
+
dexFee: string;
|
|
6217
|
+
/** Deposit returned with the output, lovelace. */
|
|
6218
|
+
deposit: string;
|
|
6219
|
+
/** Epoch milliseconds. */
|
|
6220
|
+
createdAt: number;
|
|
6221
|
+
}, {
|
|
6222
|
+
tx_in: string;
|
|
6223
|
+
protocol: string;
|
|
6224
|
+
coin_in: string;
|
|
6225
|
+
coin_out: string;
|
|
6226
|
+
amount_in: string;
|
|
6227
|
+
min_amount_out: string;
|
|
6228
|
+
dex_fee: string;
|
|
6229
|
+
deposit: string;
|
|
6230
|
+
created_at: number;
|
|
6231
|
+
source?: string | null | undefined;
|
|
6232
|
+
}>>;
|
|
6233
|
+
type PendingOrder = z.infer<typeof pendingOrderSchema>;
|
|
6234
|
+
type PendingOrderParams = PageParams & {
|
|
6235
|
+
/** Payment or stake bech32 address; a base address also matches the addresses that share its stake key. */
|
|
6236
|
+
address: string;
|
|
6237
|
+
};
|
|
6421
6238
|
/**
|
|
6422
6239
|
* DEX order history across every protocol Minswap indexes.
|
|
6423
6240
|
*
|
|
@@ -6432,6 +6249,19 @@ declare class OrderModule implements IMinswapModule {
|
|
|
6432
6249
|
constructor(sdk: MinswapSdk);
|
|
6433
6250
|
/** Fetch an address's order history, newest first. */
|
|
6434
6251
|
getHistory(params: OrderHistoryParams): Promise<Page<Order>>;
|
|
6252
|
+
/**
|
|
6253
|
+
* List an address's open swap orders, newest first, across every protocol
|
|
6254
|
+
* and aggregator.
|
|
6255
|
+
*
|
|
6256
|
+
* An order is listed while its UTxO is unspent; each leg of a split or
|
|
6257
|
+
* multi-hop submission is its own entry. Only `SWAP` orders are listed; the
|
|
6258
|
+
* other types (deposit, withdraw, zap, limit, …) are in
|
|
6259
|
+
* {@link OrderModule.getHistory}.
|
|
6260
|
+
*
|
|
6261
|
+
* @param params - `address`, plus `limit` (1..50, default 20) and `cursor` from a previous page
|
|
6262
|
+
* @returns one page of pending orders and the cursor for the next
|
|
6263
|
+
*/
|
|
6264
|
+
getPending(params: PendingOrderParams): Promise<Page<PendingOrder>>;
|
|
6435
6265
|
/**
|
|
6436
6266
|
* Collect the UTxO references that can still be cancelled for an order.
|
|
6437
6267
|
*
|
|
@@ -8431,8 +8261,6 @@ type MinswapClients = {
|
|
|
8431
8261
|
aggregatorApi: AggregatorApiClient;
|
|
8432
8262
|
/** key-app-api GraphQL: farm and MIN staking transaction building. */
|
|
8433
8263
|
keyAppApi: KeyAppApiClient;
|
|
8434
|
-
/** app GraphQL: applied pool state (reserves, liquidity, fee) for liquidity quoting. */
|
|
8435
|
-
appGraphql: AppGraphqlClient;
|
|
8436
8264
|
};
|
|
8437
8265
|
/**
|
|
8438
8266
|
* Entry point to the Minswap API.
|
|
@@ -8573,6 +8401,40 @@ declare class MinswapError<T extends MinswapErrorCode = MinswapErrorCode> extend
|
|
|
8573
8401
|
static is<C extends MinswapErrorCode>(error: unknown, code: C): error is MinswapError<C>;
|
|
8574
8402
|
}
|
|
8575
8403
|
|
|
8404
|
+
/**
|
|
8405
|
+
* Two token-identifier conventions coexist across Minswap's backends:
|
|
8406
|
+
*
|
|
8407
|
+
* - The **app API** uses a dotted `coinId`: `policyIdHex.assetNameHex`, a bare
|
|
8408
|
+
* `policyIdHex` when the asset name is empty, or `lovelace` for ADA.
|
|
8409
|
+
* - The **aggregator** uses a concatenated *unit*: `policyIdHex + assetNameHex`
|
|
8410
|
+
* with no separator, or `lovelace`.
|
|
8411
|
+
*
|
|
8412
|
+
* The SDK speaks the dotted `coinId` everywhere so callers learn one convention.
|
|
8413
|
+
* These converters bridge to the aggregator's form at that boundary.
|
|
8414
|
+
*
|
|
8415
|
+
* A Cardano policy id is always 28 bytes — 56 hex characters — so the split
|
|
8416
|
+
* point between policy and asset name is fixed, which makes the round trip
|
|
8417
|
+
* unambiguous.
|
|
8418
|
+
*/
|
|
8419
|
+
/** Dotted `coinId` (or bare policy / `lovelace`) to the aggregator's concatenated unit. */
|
|
8420
|
+
declare function coinIdToAssetUnit(coinId: string): string;
|
|
8421
|
+
/** The aggregator's concatenated unit back to a dotted `coinId`. */
|
|
8422
|
+
declare function assetUnitToCoinId(unit: string): string;
|
|
8423
|
+
/**
|
|
8424
|
+
* A coin's policy id and asset name as separate hex fields.
|
|
8425
|
+
*
|
|
8426
|
+
* The GraphQL mutations take assets in this split `InputAsset` shape rather than
|
|
8427
|
+
* as a single id.
|
|
8428
|
+
*/
|
|
8429
|
+
type InputAsset = {
|
|
8430
|
+
currencySymbol: string;
|
|
8431
|
+
tokenName: string;
|
|
8432
|
+
};
|
|
8433
|
+
/** Split a dotted `coinId` into an `InputAsset`. */
|
|
8434
|
+
declare function coinIdToInputAsset(coinId: string): InputAsset;
|
|
8435
|
+
/** Join a split `InputAsset` back into a dotted `coinId`. */
|
|
8436
|
+
declare function inputAssetToCoinId(asset: InputAsset): string;
|
|
8437
|
+
|
|
8576
8438
|
type KupoRpcProviderOptions = {
|
|
8577
8439
|
/**
|
|
8578
8440
|
* Base URL of the Kupo instance, e.g. `https://kupo.example.com` or
|
|
@@ -8664,7 +8526,12 @@ declare class KupoRpcProvider implements RpcProvider {
|
|
|
8664
8526
|
*/
|
|
8665
8527
|
private loadSerializer;
|
|
8666
8528
|
}
|
|
8667
|
-
/**
|
|
8529
|
+
/**
|
|
8530
|
+
* Kupo's match shape as the serializer expects it. Structural rather than the
|
|
8531
|
+
* peer's own `KupoUtxo` because {@link KupoSerializer} is a seam consumers may
|
|
8532
|
+
* implement without the peer installed; the `fromKupo` call below is where the
|
|
8533
|
+
* two shapes are proven to still agree.
|
|
8534
|
+
*/
|
|
8668
8535
|
type LedgerKupoUtxo = {
|
|
8669
8536
|
transaction_id: string;
|
|
8670
8537
|
transaction_index: number;
|
|
@@ -8707,28 +8574,4 @@ type DexV1Config = {
|
|
|
8707
8574
|
};
|
|
8708
8575
|
declare const DEX_V1: DexV1Config;
|
|
8709
8576
|
|
|
8710
|
-
|
|
8711
|
-
* The slice of `@minswap/internal-sdk` the liquidity builders use. Declared
|
|
8712
|
-
* structurally (with permissive shapes) so the optional peer stays optional at
|
|
8713
|
-
* type-check time — the concrete classes are only touched at runtime, after the
|
|
8714
|
-
* package is confirmed present.
|
|
8715
|
-
*/
|
|
8716
|
-
type DexSerializer = {
|
|
8717
|
-
PlutusData: {
|
|
8718
|
-
toDataHex(data: PlutusData): string;
|
|
8719
|
-
};
|
|
8720
|
-
RustModule: {
|
|
8721
|
-
load(): Promise<void>;
|
|
8722
|
-
};
|
|
8723
|
-
[key: string]: any;
|
|
8724
|
-
};
|
|
8725
|
-
type DexBuilder = DexSerializer;
|
|
8726
|
-
/** Serialize an order datum to CBOR hex — the on-chain bytes the batcher reads. */
|
|
8727
|
-
declare function toDatumHex(datum: PlutusData): Promise<string>;
|
|
8728
|
-
/**
|
|
8729
|
-
* The loaded serializer handle, for the tx-assembly layer. `RustModule.load()`
|
|
8730
|
-
* has already run, so every class here is safe to touch.
|
|
8731
|
-
*/
|
|
8732
|
-
declare function loadDexBuilder(): Promise<DexBuilder>;
|
|
8733
|
-
|
|
8734
|
-
export { AGGREGATOR_PROTOCOLS, type AddLiquidityParams, AggregatorApiClient, type AggregatorApiGetOptions, type AggregatorApiPostOptions, type AggregatorAsset, type AggregatorEstimate, AggregatorModule, type AggregatorPath, type AggregatorProtocol, type Amount, AppApiClient, type AppApiGetOptions, type AppApiPagination, type AppApiPostOptions, type AppApiResult, AppGraphqlClient, type AppGraphqlOperation, type AppliedPool, BATCHER_FEE, type BucketMinutes, type BuildTxParams, CANCEL_ADAPTER_PROTOCOL, type CancelOrderRef, type CancelProtocol, type Candle, type CoinAmountInfo, type CoinBasicInfo, DEFAULT_ENDPOINTS, DEFAULT_RETRY, DEFAULT_TIMEOUT_MS, DEPOSIT_ADA, DEX_V1, DEX_V2, type DexBuilder, type DexV1Config, type DexV2Config, type DexVersion, type EstimateParams, FARM_LIST_SORT_FIELDS, FARM_PROTOCOLS, type FarmDepositParams, type FarmEmergencyWithdrawParams, type FarmHarvestParams, type FarmListParams, type FarmListSortField, FarmModule, type FarmProtocol, type FarmRef, type FarmSummary, type FarmWithdrawParams, type FetchLike, type GetPendingOrdersOptions, HttpCore, type HttpCoreOptions, type HttpRequest, type IMinswapModule, type InputAsset, type InputPair, KeyAppApiClient, type KeyAppApiOperation, KupoRpcProvider, type KupoRpcProviderOptions, type KupoSerializer, type LedgerKupoUtxo, LiquidityModule, type LiquidityPoolRef, MAINNET_NETWORK_ENV, type MinswapClients, type MinswapCurrency, type MinswapEndpoints, MinswapError, MinswapErrorCode, type MinswapErrorDetails, type MinswapErrorDetailsMap, type MinswapGraphQLIssue, type MinswapNetwork, type MinswapParseIssue, MinswapSdk, type MinswapSdkConfig, ORDER_SOURCE_DIRECT, ORDER_STATUSES, type Order, type OrderExtra, type OrderFill, type OrderHistoryParams, type OrderHop, OrderModule, type OrderSplit, type OrderStatus, POOL_CATEGORY_GROUPS, POOL_EVENT_ACTIONS, POOL_FILTER_TYPES, POOL_LIST_SORT_FIELDS, POOL_TYPES, type Page, type PageParams, type PendingOrder, type PoolAsset, type PoolCategoryGroup, type PoolCoin, type PoolEvent, type PoolEventAction, type PoolEventsParams, type PoolFee, type PoolListParams, type PoolListSortField, PoolModule, type PoolOhlcParams, type PoolReward, type PoolState, type PoolSummary, type PoolType, type PoolVersion, type PortfolioDefi, type PortfolioFarmPosition, type PortfolioGetDefiOptions, type PortfolioLpPosition, PortfolioModule, type PortfolioStakingPosition, type Query, type QueryValue, type RemoveLiquidityParams, type ResolvedMinswapConfig, type ResolvedWalletInputs, type RetryConfig, type RpcProvider, type RpcTxIn, type RpcUtxo, type StableswapPoolState, type StakeParams, type StakingKind, StakingModule, type StakingOverview, type StakingPool, type StakingReward, TOKEN_LIST_SORT_BY, TOKEN_TRADE_ACTIONS, type TokenDetail, type TokenGetByIdOptions, type TokenListFilters, type TokenListItem, type TokenListParams, type TokenListSortBy, TokenModule, type TokenOhlcParams, type TokenSummary, type TokenTrade, type TokenTradeAction, type TokenTradeHistoryParams, type UnstakeParams, type UnstakeResult, type V1PoolState, type V2PoolState, VALID_BUCKET_MINUTES, type WalletInputParams, type ZapInParams, type ZapOutParams, 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 };
|
|
8577
|
+
export { AGGREGATOR_PROTOCOLS, type AddLiquidityParams, AggregatorApiClient, type AggregatorApiGetOptions, type AggregatorApiPostOptions, type AggregatorAsset, type AggregatorEstimate, AggregatorModule, type AggregatorPath, type AggregatorProtocol, type Amount, AppApiClient, type AppApiGetOptions, type AppApiPagination, type AppApiPostOptions, type AppApiResult, type AppliedPool, BATCHER_FEE, type BucketMinutes, type BuildTxParams, CANCEL_ADAPTER_PROTOCOL, type CancelOrderRef, type CancelProtocol, type Candle, type CoinAmountInfo, type CoinBasicInfo, DEFAULT_ENDPOINTS, DEFAULT_RETRY, DEFAULT_TIMEOUT_MS, DEPOSIT_ADA, DEX_V1, DEX_V2, type DexV1Config, type DexV2Config, type DexVersion, type EstimateParams, FARM_LIST_SORT_FIELDS, FARM_PROTOCOLS, type FarmDepositParams, type FarmEmergencyWithdrawParams, type FarmHarvestParams, type FarmListParams, type FarmListSortField, FarmModule, type FarmProtocol, type FarmRef, type FarmSummary, type FarmWithdrawParams, type FetchLike, HttpCore, type HttpCoreOptions, type HttpRequest, type IMinswapModule, type InputAsset, KeyAppApiClient, type KeyAppApiOperation, KupoRpcProvider, type KupoRpcProviderOptions, type KupoSerializer, type LedgerKupoUtxo, LiquidityModule, type LiquidityPoolRef, MAINNET_NETWORK_ENV, type MinswapClients, type MinswapCurrency, type MinswapEndpoints, MinswapError, MinswapErrorCode, type MinswapErrorDetails, type MinswapErrorDetailsMap, type MinswapGraphQLIssue, type MinswapNetwork, type MinswapParseIssue, MinswapSdk, type MinswapSdkConfig, ORDER_SOURCE_DIRECT, ORDER_STATUSES, type Order, type OrderExtra, type OrderFill, type OrderHistoryParams, type OrderHop, OrderModule, type OrderSplit, type OrderStatus, POOL_CATEGORY_GROUPS, POOL_EVENT_ACTIONS, POOL_FILTER_TYPES, POOL_LIST_SORT_FIELDS, POOL_TYPES, type Page, type PageParams, type PendingOrder, type PendingOrderParams, type PoolAsset, type PoolCategoryGroup, type PoolCoin, type PoolEvent, type PoolEventAction, type PoolEventsParams, type PoolFee, type PoolListParams, type PoolListSortField, PoolModule, type PoolOhlcParams, type PoolReward, type PoolState, type PoolSummary, type PoolType, type PoolVersion, type PortfolioDefi, type PortfolioFarmPosition, type PortfolioGetDefiOptions, type PortfolioLpPosition, PortfolioModule, type PortfolioStakingPosition, type Query, type QueryValue, type RemoveLiquidityParams, type ResolvedMinswapConfig, type ResolvedWalletInputs, type RetryConfig, type RpcProvider, type RpcTxIn, type RpcUtxo, type StableswapPoolState, type StakeParams, type StakingKind, StakingModule, type StakingOverview, type StakingPool, type StakingReward, TOKEN_LIST_SORT_BY, TOKEN_TRADE_ACTIONS, type TokenDetail, type TokenGetByIdOptions, type TokenListFilters, type TokenListItem, type TokenListParams, type TokenListSortBy, TokenModule, type TokenOhlcParams, type TokenSummary, type TokenTrade, type TokenTradeAction, type TokenTradeHistoryParams, type UnstakeParams, type UnstakeResult, type V1PoolState, type V2PoolState, VALID_BUCKET_MINUTES, type WalletInputParams, type ZapInParams, type ZapOutParams, 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 };
|