aftermath-ts-sdk 5.0.2-dev.0bdd677 → 5.0.2-dev.b3ec308
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.d.ts +35 -34
- package/dist/index.js +19 -79
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -691,8 +691,8 @@ interface PoolsAddresses {
|
|
|
691
691
|
};
|
|
692
692
|
/** Optional data required to publish LP-coin packages. */
|
|
693
693
|
other?: {
|
|
694
|
-
/**
|
|
695
|
-
|
|
694
|
+
/** Serialized Move package compilation templated per pool for LP-coin publishing. */
|
|
695
|
+
createLpCoinPackageCompilation: string;
|
|
696
696
|
};
|
|
697
697
|
}
|
|
698
698
|
/** Package and object addresses used by DAO fee-pool operations. */
|
|
@@ -7589,6 +7589,8 @@ interface PoolCreationLpCoinMetadata {
|
|
|
7589
7589
|
symbol: string;
|
|
7590
7590
|
/** An optional URL for the LP coin icon. */
|
|
7591
7591
|
iconUrl?: Url;
|
|
7592
|
+
/** An optional description templated into the LP coin package. */
|
|
7593
|
+
description?: string;
|
|
7592
7594
|
}
|
|
7593
7595
|
/**
|
|
7594
7596
|
* A data structure used for integration with CoinGecko, representing
|
|
@@ -7699,10 +7701,23 @@ interface ApiPoolAllCoinWithdrawBody {
|
|
|
7699
7701
|
* typically specifying the coin's decimals.
|
|
7700
7702
|
*/
|
|
7701
7703
|
interface ApiPublishLpCoinBody {
|
|
7702
|
-
/** The wallet that publishes
|
|
7704
|
+
/** The wallet that publishes the LP coin package and receives the pool-creation cap. */
|
|
7703
7705
|
walletAddress: SuiAddress;
|
|
7704
|
-
/**
|
|
7705
|
-
|
|
7706
|
+
/** Name, symbol, optional icon, and optional description templated into the LP coin. */
|
|
7707
|
+
lpCoinMetadata: PoolCreationLpCoinMetadata;
|
|
7708
|
+
/** Per-coin type, weight, and decimals templated into the LP coin package. */
|
|
7709
|
+
coinsInfo: {
|
|
7710
|
+
/** The fully qualified coin type deposited into the pool. */
|
|
7711
|
+
coinType: CoinType;
|
|
7712
|
+
/** The decimal weight for this coin. Weights must sum to `1`. */
|
|
7713
|
+
weight: Percentage;
|
|
7714
|
+
/** Optional display precision stored for this coin. */
|
|
7715
|
+
decimals?: number;
|
|
7716
|
+
}[];
|
|
7717
|
+
/** The pool curve mode passed to Move as a flatness value. */
|
|
7718
|
+
poolFlatness: 0 | 1;
|
|
7719
|
+
/** Whether the supplied coin decimals are preserved for the LP coin. */
|
|
7720
|
+
respectDecimals: boolean;
|
|
7706
7721
|
}
|
|
7707
7722
|
/**
|
|
7708
7723
|
* Request body for creating a new pool, specifying coin information,
|
|
@@ -7713,8 +7728,6 @@ interface ApiCreatePoolBody {
|
|
|
7713
7728
|
walletAddress: SuiAddress;
|
|
7714
7729
|
/** The fully qualified LP coin type used by the new pool. */
|
|
7715
7730
|
lpCoinType: CoinType;
|
|
7716
|
-
/** Metadata for the LP coin published for the pool. */
|
|
7717
|
-
lpCoinMetadata: PoolCreationLpCoinMetadata;
|
|
7718
7731
|
/** Per-coin weights, fees, decimal metadata, and initial deposits. */
|
|
7719
7732
|
coinsInfo: {
|
|
7720
7733
|
/** The fully qualified coin type deposited into the pool. */
|
|
@@ -7736,8 +7749,6 @@ interface ApiCreatePoolBody {
|
|
|
7736
7749
|
createPoolCapId: ObjectId;
|
|
7737
7750
|
/** Whether the transaction should preserve the supplied coin decimals. */
|
|
7738
7751
|
respectDecimals: boolean;
|
|
7739
|
-
/** Optional decimal precision forced for the LP coin. */
|
|
7740
|
-
forceLpDecimals?: CoinDecimal;
|
|
7741
7752
|
/** Whether coin selection is prepared for a sponsored transaction. */
|
|
7742
7753
|
isSponsoredTx?: boolean;
|
|
7743
7754
|
/** Whether the LP coin is burned as part of the creation flow. */
|
|
@@ -11293,20 +11304,29 @@ declare class Pools extends Caller {
|
|
|
11293
11304
|
walletAddress: SuiAddress;
|
|
11294
11305
|
}): Promise<PoolLpInfo[]>;
|
|
11295
11306
|
/**
|
|
11296
|
-
* Builds an unsigned transaction that publishes
|
|
11307
|
+
* Builds an unsigned transaction that publishes an LP coin package templated
|
|
11308
|
+
* for this pool and mints its `CreatePoolCapV2`.
|
|
11297
11309
|
*
|
|
11298
|
-
* The
|
|
11299
|
-
*
|
|
11310
|
+
* The API templates the LP coin package with the pool's metadata, weights,
|
|
11311
|
+
* decimals, and flatness, publishes it, and transfers the resulting cap and
|
|
11312
|
+
* upgrade capability to `walletAddress`. This method does not sign, submit, or
|
|
11313
|
+
* serialize the returned `Transaction`.
|
|
11300
11314
|
*
|
|
11301
|
-
* @param inputs - Publisher address
|
|
11315
|
+
* @param inputs - Publisher address, LP coin metadata, and pool configuration.
|
|
11302
11316
|
* @returns A promise for the unsigned publish `Transaction`.
|
|
11303
|
-
* @throws `
|
|
11317
|
+
* @throws `AftermathTransportError` when the API cannot build or decode the transaction.
|
|
11304
11318
|
*
|
|
11305
11319
|
* @example
|
|
11306
11320
|
* ```typescript
|
|
11307
11321
|
* const publishTx = await pools.getPublishLpCoinTransaction({
|
|
11308
11322
|
* walletAddress: "0x<address>",
|
|
11309
|
-
*
|
|
11323
|
+
* lpCoinMetadata: { name: "MyPool LP", symbol: "MYPLP" },
|
|
11324
|
+
* coinsInfo: [
|
|
11325
|
+
* { weight: 0.5, decimals: 9 },
|
|
11326
|
+
* { weight: 0.5, decimals: 6 },
|
|
11327
|
+
* ],
|
|
11328
|
+
* poolFlatness: 0,
|
|
11329
|
+
* respectDecimals: true,
|
|
11310
11330
|
* });
|
|
11311
11331
|
* ```
|
|
11312
11332
|
*/
|
|
@@ -19596,15 +19616,6 @@ declare class PoolsApi implements MoveErrorsInterface {
|
|
|
19596
19616
|
coinTypes: CoinType[];
|
|
19597
19617
|
withTransfer?: boolean;
|
|
19598
19618
|
}) => TransactionObjectArgument[];
|
|
19599
|
-
/**
|
|
19600
|
-
* Publishes a transaction block for creating a liquidity pool coin.
|
|
19601
|
-
* @param inputs An object containing the transaction block and the decimal value of the liquidity pool coin.
|
|
19602
|
-
* @returns A promise that resolves to the result of the transaction publishing.
|
|
19603
|
-
*/
|
|
19604
|
-
publishLpCoinTx: (inputs: {
|
|
19605
|
-
tx: Transaction;
|
|
19606
|
-
lpCoinDecimals: CoinDecimal;
|
|
19607
|
-
}) => _mysten_sui_transactions.TransactionResult;
|
|
19608
19619
|
/**
|
|
19609
19620
|
* Creates a transaction to create a new pool.
|
|
19610
19621
|
* @param inputs - An object containing the necessary inputs to create the pool.
|
|
@@ -19623,14 +19634,10 @@ declare class PoolsApi implements MoveErrorsInterface {
|
|
|
19623
19634
|
depositFee: PoolDepositFee;
|
|
19624
19635
|
withdrawFee: PoolWithdrawFee;
|
|
19625
19636
|
}[];
|
|
19626
|
-
lpCoinMetadata: PoolCreationLpCoinMetadata;
|
|
19627
|
-
lpCoinIconUrl: Url;
|
|
19628
19637
|
createPoolCapId: ObjectId | TransactionObjectArgument;
|
|
19629
19638
|
poolName: PoolName;
|
|
19630
19639
|
poolFlatness: PoolFlatness;
|
|
19631
|
-
lpCoinDescription: string;
|
|
19632
19640
|
respectDecimals: boolean;
|
|
19633
|
-
forceLpDecimals?: CoinDecimal;
|
|
19634
19641
|
withTransfer?: boolean;
|
|
19635
19642
|
}) => TransactionObjectArgument[];
|
|
19636
19643
|
/**
|
|
@@ -19831,12 +19838,6 @@ declare class PoolsApi implements MoveErrorsInterface {
|
|
|
19831
19838
|
lpCoinAmount: Balance;
|
|
19832
19839
|
referrer?: SuiAddress;
|
|
19833
19840
|
}) => Promise<Transaction>;
|
|
19834
|
-
/**
|
|
19835
|
-
* Builds a transaction block for publishing an LP coin.
|
|
19836
|
-
* @param inputs - The input parameters for the transaction.
|
|
19837
|
-
* @returns The built transaction block.
|
|
19838
|
-
*/
|
|
19839
|
-
buildPublishLpCoinTx: (inputs: ApiPublishLpCoinBody) => Transaction;
|
|
19840
19841
|
/**
|
|
19841
19842
|
* Builds a standalone transaction that updates a DAO fee in basis points.
|
|
19842
19843
|
*
|
package/dist/index.js
CHANGED
|
@@ -10810,25 +10810,34 @@ var init_pools = __esm({
|
|
|
10810
10810
|
// Transactions
|
|
10811
10811
|
// =========================================================================
|
|
10812
10812
|
/**
|
|
10813
|
-
* Builds an unsigned transaction that publishes
|
|
10813
|
+
* Builds an unsigned transaction that publishes an LP coin package templated
|
|
10814
|
+
* for this pool and mints its `CreatePoolCapV2`.
|
|
10814
10815
|
*
|
|
10815
|
-
* The
|
|
10816
|
-
*
|
|
10816
|
+
* The API templates the LP coin package with the pool's metadata, weights,
|
|
10817
|
+
* decimals, and flatness, publishes it, and transfers the resulting cap and
|
|
10818
|
+
* upgrade capability to `walletAddress`. This method does not sign, submit, or
|
|
10819
|
+
* serialize the returned `Transaction`.
|
|
10817
10820
|
*
|
|
10818
|
-
* @param inputs - Publisher address
|
|
10821
|
+
* @param inputs - Publisher address, LP coin metadata, and pool configuration.
|
|
10819
10822
|
* @returns A promise for the unsigned publish `Transaction`.
|
|
10820
|
-
* @throws `
|
|
10823
|
+
* @throws `AftermathTransportError` when the API cannot build or decode the transaction.
|
|
10821
10824
|
*
|
|
10822
10825
|
* @example
|
|
10823
10826
|
* ```typescript
|
|
10824
10827
|
* const publishTx = await pools.getPublishLpCoinTransaction({
|
|
10825
10828
|
* walletAddress: "0x<address>",
|
|
10826
|
-
*
|
|
10829
|
+
* lpCoinMetadata: { name: "MyPool LP", symbol: "MYPLP" },
|
|
10830
|
+
* coinsInfo: [
|
|
10831
|
+
* { weight: 0.5, decimals: 9 },
|
|
10832
|
+
* { weight: 0.5, decimals: 6 },
|
|
10833
|
+
* ],
|
|
10834
|
+
* poolFlatness: 0,
|
|
10835
|
+
* respectDecimals: true,
|
|
10827
10836
|
* });
|
|
10828
10837
|
* ```
|
|
10829
10838
|
*/
|
|
10830
10839
|
async getPublishLpCoinTransaction(inputs) {
|
|
10831
|
-
return this.
|
|
10840
|
+
return this.fetchApiTransaction("transactions/publish-lp-coin", inputs);
|
|
10832
10841
|
}
|
|
10833
10842
|
/**
|
|
10834
10843
|
* Builds an unsigned transaction that creates a new pool on chain.
|
|
@@ -23818,7 +23827,6 @@ import { bcs as bcs2 } from "@mysten/sui/bcs";
|
|
|
23818
23827
|
import {
|
|
23819
23828
|
Transaction as Transaction12
|
|
23820
23829
|
} from "@mysten/sui/transactions";
|
|
23821
|
-
import { fromBase64 as fromBase642, normalizeSuiObjectId } from "@mysten/sui/utils";
|
|
23822
23830
|
var _PoolsApi, PoolsApi;
|
|
23823
23831
|
var init_poolsApi = __esm({
|
|
23824
23832
|
"src/packages/pools/api/poolsApi.ts"() {
|
|
@@ -24022,29 +24030,6 @@ var init_poolsApi = __esm({
|
|
|
24022
24030
|
]
|
|
24023
24031
|
});
|
|
24024
24032
|
};
|
|
24025
|
-
/**
|
|
24026
|
-
* Publishes a transaction block for creating a liquidity pool coin.
|
|
24027
|
-
* @param inputs An object containing the transaction block and the decimal value of the liquidity pool coin.
|
|
24028
|
-
* @returns A promise that resolves to the result of the transaction publishing.
|
|
24029
|
-
*/
|
|
24030
|
-
this.publishLpCoinTx = (inputs) => {
|
|
24031
|
-
const compilations = this.addresses.pools.other?.createLpCoinPackageCompilations;
|
|
24032
|
-
if (!compilations) {
|
|
24033
|
-
throw new Error(
|
|
24034
|
-
"not all required addresses have been set in provider for lp coin publishing (requires package compilations)"
|
|
24035
|
-
);
|
|
24036
|
-
}
|
|
24037
|
-
const { tx, lpCoinDecimals } = inputs;
|
|
24038
|
-
const compiledModulesAndDeps = JSON.parse(compilations[lpCoinDecimals]);
|
|
24039
|
-
return tx.publish({
|
|
24040
|
-
modules: compiledModulesAndDeps.modules.map(
|
|
24041
|
-
(m) => Array.from(fromBase642(m))
|
|
24042
|
-
),
|
|
24043
|
-
dependencies: compiledModulesAndDeps.dependencies.map(
|
|
24044
|
-
(addr) => normalizeSuiObjectId(addr)
|
|
24045
|
-
)
|
|
24046
|
-
});
|
|
24047
|
-
};
|
|
24048
24033
|
// TODO: handle bounds checks here instead of just on-chain ?
|
|
24049
24034
|
/**
|
|
24050
24035
|
* Creates a transaction to create a new pool.
|
|
@@ -24052,16 +24037,7 @@ var init_poolsApi = __esm({
|
|
|
24052
24037
|
* @returns A transaction block to create the pool.
|
|
24053
24038
|
*/
|
|
24054
24039
|
this.createPoolTx = (inputs) => {
|
|
24055
|
-
const {
|
|
24056
|
-
tx,
|
|
24057
|
-
lpCoinType,
|
|
24058
|
-
createPoolCapId,
|
|
24059
|
-
coinsInfo,
|
|
24060
|
-
lpCoinMetadata,
|
|
24061
|
-
lpCoinDescription,
|
|
24062
|
-
lpCoinIconUrl,
|
|
24063
|
-
withTransfer
|
|
24064
|
-
} = inputs;
|
|
24040
|
+
const { tx, lpCoinType, createPoolCapId, coinsInfo, withTransfer } = inputs;
|
|
24065
24041
|
const poolSize = coinsInfo.length;
|
|
24066
24042
|
const coinTypes = coinsInfo.map((coin) => coin.coinType);
|
|
24067
24043
|
const decimals = coinsInfo.map((coin) => coin.decimals);
|
|
@@ -24069,7 +24045,7 @@ var init_poolsApi = __esm({
|
|
|
24069
24045
|
target: Helpers.transactions.createTxTarget(
|
|
24070
24046
|
withTransfer ? this.addresses.pools.packages.ammInterface : this.addresses.pools.packages.amm,
|
|
24071
24047
|
withTransfer ? _PoolsApi.constants.moduleNames.interface : _PoolsApi.constants.moduleNames.poolFactory,
|
|
24072
|
-
`create_pool_${poolSize}
|
|
24048
|
+
`create_pool_${poolSize}_coins_v2`
|
|
24073
24049
|
),
|
|
24074
24050
|
typeArguments: [lpCoinType, ...coinTypes],
|
|
24075
24051
|
arguments: [
|
|
@@ -24078,25 +24054,6 @@ var init_poolsApi = __esm({
|
|
|
24078
24054
|
tx.pure(
|
|
24079
24055
|
bcs2.vector(bcs2.u8()).serialize(Casting.u8VectorFromString(inputs.poolName))
|
|
24080
24056
|
),
|
|
24081
|
-
tx.pure(
|
|
24082
|
-
bcs2.vector(bcs2.u8()).serialize(
|
|
24083
|
-
Casting.u8VectorFromString(lpCoinMetadata.name.toString())
|
|
24084
|
-
)
|
|
24085
|
-
),
|
|
24086
|
-
tx.pure(
|
|
24087
|
-
bcs2.vector(bcs2.u8()).serialize(
|
|
24088
|
-
Casting.u8VectorFromString(
|
|
24089
|
-
lpCoinMetadata.symbol.toString().toUpperCase()
|
|
24090
|
-
)
|
|
24091
|
-
)
|
|
24092
|
-
),
|
|
24093
|
-
tx.pure(
|
|
24094
|
-
bcs2.vector(bcs2.u8()).serialize(Casting.u8VectorFromString(lpCoinDescription))
|
|
24095
|
-
),
|
|
24096
|
-
tx.pure(
|
|
24097
|
-
bcs2.vector(bcs2.u8()).serialize(Casting.u8VectorFromString(lpCoinIconUrl))
|
|
24098
|
-
),
|
|
24099
|
-
// lp_icon_url
|
|
24100
24057
|
tx.pure(
|
|
24101
24058
|
bcs2.vector(bcs2.u64()).serialize(coinsInfo.map((coin) => coin.weight))
|
|
24102
24059
|
),
|
|
@@ -24121,11 +24078,7 @@ var init_poolsApi = __esm({
|
|
|
24121
24078
|
decimals.includes(void 0) ? void 0 : decimals
|
|
24122
24079
|
)
|
|
24123
24080
|
),
|
|
24124
|
-
|
|
24125
|
-
tx.pure.bool(inputs.respectDecimals),
|
|
24126
|
-
// respect_decimals
|
|
24127
|
-
tx.pure(bcs2.option(bcs2.u8()).serialize(inputs.forceLpDecimals))
|
|
24128
|
-
// force_lp_decimals
|
|
24081
|
+
tx.pure.bool(inputs.respectDecimals)
|
|
24129
24082
|
]
|
|
24130
24083
|
});
|
|
24131
24084
|
};
|
|
@@ -24641,19 +24594,6 @@ var init_poolsApi = __esm({
|
|
|
24641
24594
|
}
|
|
24642
24595
|
return tx;
|
|
24643
24596
|
};
|
|
24644
|
-
/**
|
|
24645
|
-
* Builds a transaction block for publishing an LP coin.
|
|
24646
|
-
* @param inputs - The input parameters for the transaction.
|
|
24647
|
-
* @returns The built transaction block.
|
|
24648
|
-
*/
|
|
24649
|
-
this.buildPublishLpCoinTx = (inputs) => {
|
|
24650
|
-
const { lpCoinDecimals } = inputs;
|
|
24651
|
-
const tx = new Transaction12();
|
|
24652
|
-
tx.setSender(inputs.walletAddress);
|
|
24653
|
-
const upgradeCap = this.publishLpCoinTx({ tx, lpCoinDecimals });
|
|
24654
|
-
tx.transferObjects([upgradeCap], inputs.walletAddress);
|
|
24655
|
-
return tx;
|
|
24656
|
-
};
|
|
24657
24597
|
/**
|
|
24658
24598
|
* Builds a standalone transaction that updates a DAO fee in basis points.
|
|
24659
24599
|
*
|