aftermath-ts-sdk 1.1.73 → 1.1.74

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.
Files changed (30) hide show
  1. package/dist/general/types/configTypes.d.ts +9 -0
  2. package/dist/general/types/configTypes.d.ts.map +1 -1
  3. package/dist/general/utils/casting.d.ts +3 -1
  4. package/dist/general/utils/casting.d.ts.map +1 -1
  5. package/dist/general/utils/casting.js +17 -0
  6. package/dist/general/utils/helpers.d.ts +2 -1
  7. package/dist/general/utils/helpers.d.ts.map +1 -1
  8. package/dist/general/utils/helpers.js +11 -0
  9. package/dist/packages/farms/farms.d.ts.map +1 -1
  10. package/dist/packages/farms/farms.js +12 -2
  11. package/dist/packages/nftAmm/api/nftAmmApi.js +4 -4
  12. package/dist/packages/pools/api/poolsApi.d.ts +200 -128
  13. package/dist/packages/pools/api/poolsApi.d.ts.map +1 -1
  14. package/dist/packages/pools/api/poolsApi.js +539 -306
  15. package/dist/packages/pools/api/poolsApiCasting.d.ts +9 -6
  16. package/dist/packages/pools/api/poolsApiCasting.d.ts.map +1 -1
  17. package/dist/packages/pools/api/poolsApiCasting.js +51 -31
  18. package/dist/packages/pools/api/poolsApiCastingTypes.d.ts +23 -1
  19. package/dist/packages/pools/api/poolsApiCastingTypes.d.ts.map +1 -1
  20. package/dist/packages/pools/pool.d.ts +43 -29
  21. package/dist/packages/pools/pool.d.ts.map +1 -1
  22. package/dist/packages/pools/pool.js +109 -49
  23. package/dist/packages/pools/pools.d.ts +5 -2
  24. package/dist/packages/pools/pools.d.ts.map +1 -1
  25. package/dist/packages/pools/pools.js +9 -2
  26. package/dist/packages/pools/poolsTypes.d.ts +34 -3
  27. package/dist/packages/pools/poolsTypes.d.ts.map +1 -1
  28. package/dist/packages/pools/utils/cmmmCalculations.d.ts.map +1 -1
  29. package/dist/packages/pools/utils/cmmmCalculations.js +9 -1
  30. package/package.json +1 -1
@@ -1,16 +1,19 @@
1
- import { PoolDepositEvent, PoolObject, PoolTradeEvent, PoolWithdrawEvent } from "../poolsTypes";
2
- import { PoolCreateEventOnChain, PoolFieldsOnChain, PoolTradeEventOnChainFields, PoolDepositEventFieldsOnChain, PoolWithdrawEventFieldsOnChain, PoolTradeEventOnChain, PoolDepositEventOnChain, PoolWithdrawEventOnChain } from "./poolsApiCastingTypes";
1
+ import { DaoFeePoolObject, DaoFeePoolOwnerCapObject, PoolDepositEvent, PoolObject, PoolTradeEvent, PoolWithdrawEvent } from "../poolsTypes";
2
+ import { PoolCreateEventOnChain, PoolTradeEventOnChainFields, PoolDepositEventFieldsOnChain, PoolWithdrawEventFieldsOnChain, PoolTradeEventOnChain, PoolDepositEventOnChain, PoolWithdrawEventOnChain, DaoFeePoolFieldsOnChain, PoolsIndexerResponse } from "./poolsApiCastingTypes";
3
3
  import { AnyObjectType, ObjectId } from "../../../types";
4
4
  import { IndexerEventOnChain } from "../../../general/types/castingTypes";
5
5
  import { SuiObjectResponse } from "@mysten/sui/client";
6
6
  export declare class PoolsApiCasting {
7
7
  static poolObjectFromSuiObject: (suiObject: SuiObjectResponse) => PoolObject;
8
- static poolObjectFromIndexer: (data: {
8
+ static poolObjectsFromIndexerResponse: (response: PoolsIndexerResponse) => PoolObject[];
9
+ static daoFeePoolObjectFromIndexerResponse: (data: {
9
10
  objectId: ObjectId;
10
11
  type: AnyObjectType;
11
- content: PoolFieldsOnChain;
12
- }) => PoolObject;
13
- static poolObjectIdFromSuiObjectResponse: (data: SuiObjectResponse) => ObjectId;
12
+ content: {
13
+ fields: DaoFeePoolFieldsOnChain;
14
+ };
15
+ }) => DaoFeePoolObject;
16
+ static daoFeePoolOwnerCapObjectFromSuiObjectResponse: (data: SuiObjectResponse) => DaoFeePoolOwnerCapObject;
14
17
  static poolObjectIdfromPoolCreateEventOnChain: (eventOnChain: PoolCreateEventOnChain) => ObjectId;
15
18
  static poolTradeEventFromOnChain: (eventOnChain: PoolTradeEventOnChain) => PoolTradeEvent;
16
19
  static poolDepositEventFromOnChain: (eventOnChain: PoolDepositEventOnChain) => PoolDepositEvent;
@@ -1 +1 @@
1
- {"version":3,"file":"poolsApiCasting.d.ts","sourceRoot":"","sources":["../../../../src/packages/pools/api/poolsApiCasting.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,iBAAiB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EACN,sBAAsB,EACtB,iBAAiB,EACjB,2BAA2B,EAC3B,6BAA6B,EAC7B,8BAA8B,EAC9B,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EACxB,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAEvD,qBAAa,eAAe;IAK3B,OAAc,uBAAuB,cACzB,iBAAiB,KAC1B,UAAU,CAsDX;IAEF,OAAc,qBAAqB,SAAU;QAC5C,QAAQ,EAAE,QAAQ,CAAC;QACnB,IAAI,EAAE,aAAa,CAAC;QACpB,OAAO,EAAE,iBAAiB,CAAC;KAC3B,KAAG,UAAU,CAmDZ;IAEF,OAAc,iCAAiC,SACxC,iBAAiB,KACrB,QAAQ,CAWT;IAMF,OAAc,sCAAsC,4CAEjD,QAAQ,CAGT;IAEF,OAAc,yBAAyB,2CAEpC,cAAc,CAiBf;IAEF,OAAc,2BAA2B,6CAEtC,gBAAgB,CAejB;IAEF,OAAc,4BAA4B,8CAEvC,iBAAiB,CAclB;IAMF,OAAc,gCAAgC,iBAC/B,oBAAoB,2BAA2B,CAAC,KAC5D,cAAc,CAkBf;IAEF,OAAc,kCAAkC,iBACjC,oBAAoB,6BAA6B,CAAC,KAC9D,gBAAgB,CAcjB;IAEF,OAAc,mCAAmC,iBAClC,oBAAoB,8BAA8B,CAAC,KAC/D,iBAAiB,C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B,CAcjB;IAEF,OAAc,mCAAmC,iBAClC,oBAAoB,8BAA8B,CAAC,KAC/D,iBAAiB,CAelB;CACF"}
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ var _a;
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  exports.PoolsApiCasting = void 0;
4
5
  const coin_1 = require("../../coin");
@@ -6,6 +7,7 @@ const utils_1 = require("../../../general/utils");
6
7
  class PoolsApiCasting {
7
8
  }
8
9
  exports.PoolsApiCasting = PoolsApiCasting;
10
+ _a = PoolsApiCasting;
9
11
  // =========================================================================
10
12
  // Objects
11
13
  // =========================================================================
@@ -33,36 +35,54 @@ PoolsApiCasting.poolObjectFromSuiObject = (suiObject) => {
33
35
  coins,
34
36
  };
35
37
  };
36
- PoolsApiCasting.poolObjectFromIndexer = (data) => {
38
+ PoolsApiCasting.poolObjectsFromIndexerResponse = (response) => {
39
+ return response.map((data) => {
40
+ const objectType = utils_1.Helpers.addLeadingZeroesToType(data.type);
41
+ const poolFieldsOnChain = data.content;
42
+ const lpCoinType = utils_1.Helpers.addLeadingZeroesToType(new coin_1.Coin(poolFieldsOnChain.lp_supply.type).innerCoinType);
43
+ const coins = poolFieldsOnChain.type_names.reduce((acc, cur, index) => (Object.assign(Object.assign({}, acc), { [utils_1.Helpers.addLeadingZeroesToType("0x" + cur)]: Object.assign({ weight: BigInt(poolFieldsOnChain.weights[index]), balance: BigInt(poolFieldsOnChain.normalized_balances[index]) /
44
+ BigInt(poolFieldsOnChain.decimal_scalars[index]), tradeFeeIn: BigInt(poolFieldsOnChain.fees_swap_in[index]), tradeFeeOut: BigInt(poolFieldsOnChain.fees_swap_out[index]), depositFee: BigInt(poolFieldsOnChain.fees_deposit[index]), withdrawFee: BigInt(poolFieldsOnChain.fees_withdraw[index]), normalizedBalance: BigInt(poolFieldsOnChain.normalized_balances[index]), decimalsScalar: BigInt(poolFieldsOnChain.decimal_scalars[index]) }, (poolFieldsOnChain.coin_decimals
45
+ ? {
46
+ decimals: Number(poolFieldsOnChain.coin_decimals[index]),
47
+ }
48
+ : {})) })), {});
49
+ const daoFeePoolObject = data.daoFeePoolObject.length === 1
50
+ ? _a.daoFeePoolObjectFromIndexerResponse(data.daoFeePoolObject[0])
51
+ : undefined;
52
+ return {
53
+ objectType,
54
+ lpCoinType,
55
+ coins,
56
+ daoFeePoolObject,
57
+ objectId: utils_1.Helpers.addLeadingZeroesToType(data.objectId),
58
+ name: poolFieldsOnChain.name,
59
+ creator: poolFieldsOnChain.creator,
60
+ lpCoinSupply: BigInt(poolFieldsOnChain.lp_supply.fields.value),
61
+ illiquidLpCoinSupply: BigInt(poolFieldsOnChain.illiquid_lp_supply),
62
+ flatness: BigInt(poolFieldsOnChain.flatness),
63
+ lpCoinDecimals: Number(poolFieldsOnChain.lp_decimals),
64
+ };
65
+ });
66
+ };
67
+ PoolsApiCasting.daoFeePoolObjectFromIndexerResponse = (data) => {
68
+ const objectId = utils_1.Helpers.addLeadingZeroesToType(data.objectId);
37
69
  const objectType = utils_1.Helpers.addLeadingZeroesToType(data.type);
38
- const poolFieldsOnChain = data.content;
39
- const lpCoinType = utils_1.Helpers.addLeadingZeroesToType(new coin_1.Coin(poolFieldsOnChain.lp_supply.type).innerCoinType);
40
- const coins = poolFieldsOnChain.type_names.reduce((acc, cur, index) => (Object.assign(Object.assign({}, acc), { [utils_1.Helpers.addLeadingZeroesToType("0x" + cur)]: Object.assign({ weight: BigInt(poolFieldsOnChain.weights[index]), balance: BigInt(poolFieldsOnChain.normalized_balances[index]) /
41
- BigInt(poolFieldsOnChain.decimal_scalars[index]), tradeFeeIn: BigInt(poolFieldsOnChain.fees_swap_in[index]), tradeFeeOut: BigInt(poolFieldsOnChain.fees_swap_out[index]), depositFee: BigInt(poolFieldsOnChain.fees_deposit[index]), withdrawFee: BigInt(poolFieldsOnChain.fees_withdraw[index]), normalizedBalance: BigInt(poolFieldsOnChain.normalized_balances[index]), decimalsScalar: BigInt(poolFieldsOnChain.decimal_scalars[index]) }, (poolFieldsOnChain.coin_decimals
42
- ? {
43
- decimals: Number(poolFieldsOnChain.coin_decimals[index]),
44
- }
45
- : {})) })), {});
70
+ const fields = data.content.fields;
46
71
  return {
72
+ objectId,
47
73
  objectType,
48
- objectId: utils_1.Helpers.addLeadingZeroesToType(data.objectId),
49
- lpCoinType,
50
- name: poolFieldsOnChain.name,
51
- creator: poolFieldsOnChain.creator,
52
- lpCoinSupply: BigInt(poolFieldsOnChain.lp_supply.fields.value),
53
- illiquidLpCoinSupply: BigInt(poolFieldsOnChain.illiquid_lp_supply),
54
- flatness: BigInt(poolFieldsOnChain.flatness),
55
- lpCoinDecimals: Number(poolFieldsOnChain.lp_decimals),
56
- coins,
74
+ feeBps: BigInt(fields.fee_bps),
75
+ feeRecipient: utils_1.Helpers.addLeadingZeroesToType(fields.fee_recipient),
57
76
  };
58
77
  };
59
- PoolsApiCasting.poolObjectIdFromSuiObjectResponse = (data) => {
60
- var _a;
61
- const content = (_a = data.data) === null || _a === void 0 ? void 0 : _a.content;
62
- if ((content === null || content === void 0 ? void 0 : content.dataType) !== "moveObject")
63
- throw new Error("sui object response is not an object");
64
- const fields = content.fields;
65
- return fields.value;
78
+ PoolsApiCasting.daoFeePoolOwnerCapObjectFromSuiObjectResponse = (data) => {
79
+ const objectType = utils_1.Helpers.getObjectType(data);
80
+ const fields = utils_1.Helpers.getObjectFields(data);
81
+ return {
82
+ objectType,
83
+ objectId: utils_1.Helpers.getObjectId(data),
84
+ daoFeePoolId: utils_1.Helpers.addLeadingZeroesToType(fields.dao_fee_pool_id),
85
+ };
66
86
  };
67
87
  // =========================================================================
68
88
  // Events
@@ -116,7 +136,7 @@ PoolsApiCasting.poolWithdrawEventFromOnChain = (eventOnChain) => {
116
136
  // Indexer Events
117
137
  // =========================================================================
118
138
  PoolsApiCasting.poolTradeEventFromIndexerOnChain = (eventOnChain) => {
119
- var _a;
139
+ var _b;
120
140
  return {
121
141
  poolId: eventOnChain.pool_id,
122
142
  trader: eventOnChain.issuer,
@@ -124,13 +144,13 @@ PoolsApiCasting.poolTradeEventFromIndexerOnChain = (eventOnChain) => {
124
144
  amountsIn: eventOnChain.amounts_in.map((amount) => BigInt(amount)),
125
145
  typesOut: eventOnChain.types_out.map((type) => utils_1.Helpers.addLeadingZeroesToType("0x" + type)),
126
146
  amountsOut: eventOnChain.amounts_out.map((amount) => BigInt(amount)),
127
- timestamp: (_a = eventOnChain.timestamp) !== null && _a !== void 0 ? _a : undefined,
147
+ timestamp: (_b = eventOnChain.timestamp) !== null && _b !== void 0 ? _b : undefined,
128
148
  txnDigest: eventOnChain.txnDigest,
129
149
  type: eventOnChain.type,
130
150
  };
131
151
  };
132
152
  PoolsApiCasting.poolDepositEventFromIndexerOnChain = (eventOnChain) => {
133
- var _a;
153
+ var _b;
134
154
  return {
135
155
  poolId: eventOnChain.pool_id,
136
156
  depositor: eventOnChain.issuer,
@@ -138,20 +158,20 @@ PoolsApiCasting.poolDepositEventFromIndexerOnChain = (eventOnChain) => {
138
158
  types: eventOnChain.types.map((type) => utils_1.Helpers.addLeadingZeroesToType("0x" + type)),
139
159
  deposits: eventOnChain.deposits.map((deposit) => BigInt(deposit)),
140
160
  lpMinted: BigInt(eventOnChain.lp_coins_minted),
141
- timestamp: (_a = eventOnChain.timestamp) !== null && _a !== void 0 ? _a : undefined,
161
+ timestamp: (_b = eventOnChain.timestamp) !== null && _b !== void 0 ? _b : undefined,
142
162
  txnDigest: eventOnChain.txnDigest,
143
163
  type: eventOnChain.type,
144
164
  };
145
165
  };
146
166
  PoolsApiCasting.poolWithdrawEventFromIndexerOnChain = (eventOnChain) => {
147
- var _a;
167
+ var _b;
148
168
  return {
149
169
  poolId: eventOnChain.pool_id,
150
170
  withdrawer: eventOnChain.issuer,
151
171
  types: eventOnChain.types.map((type) => utils_1.Helpers.addLeadingZeroesToType("0x" + type)),
152
172
  withdrawn: eventOnChain.withdrawn.map((withdraw) => BigInt(withdraw)),
153
173
  lpBurned: BigInt(eventOnChain.lp_coins_burned),
154
- timestamp: (_a = eventOnChain.timestamp) !== null && _a !== void 0 ? _a : undefined,
174
+ timestamp: (_b = eventOnChain.timestamp) !== null && _b !== void 0 ? _b : undefined,
155
175
  txnDigest: eventOnChain.txnDigest,
156
176
  type: eventOnChain.type,
157
177
  };
@@ -1,4 +1,4 @@
1
- import { BigIntAsString, CoinType, PoolName, ObjectId, SuiAddress } from "../../../types";
1
+ import { AnyObjectType, BigIntAsString, CoinType, PoolName, ObjectId, SuiAddress } from "../../../types";
2
2
  import { EventOnChain, SupplyOnChain } from "../../../general/types/castingTypes";
3
3
  export interface PoolFieldsOnChain {
4
4
  name: PoolName;
@@ -18,6 +18,14 @@ export interface PoolFieldsOnChain {
18
18
  lp_decimal_scalar: BigIntAsString;
19
19
  coin_decimals?: BigIntAsString[];
20
20
  }
21
+ export interface DaoFeePoolFieldsOnChain {
22
+ fee_bps: BigIntAsString;
23
+ fee_recipient: SuiAddress;
24
+ }
25
+ export interface DaoFeePoolOwnerCapFieldsOnChain {
26
+ id: ObjectId;
27
+ dao_fee_pool_id: ObjectId;
28
+ }
21
29
  export type PoolCreateEventOnChain = EventOnChain<{
22
30
  pool_id: ObjectId;
23
31
  lp_type: CoinType;
@@ -53,4 +61,18 @@ export interface PoolWithdrawEventFieldsOnChain {
53
61
  export type PoolTradeEventOnChain = EventOnChain<PoolTradeEventOnChainFields>;
54
62
  export type PoolDepositEventOnChain = EventOnChain<PoolDepositEventFieldsOnChain>;
55
63
  export type PoolWithdrawEventOnChain = EventOnChain<PoolWithdrawEventFieldsOnChain>;
64
+ export type PoolsIndexerResponse = {
65
+ objectId: ObjectId;
66
+ type: AnyObjectType;
67
+ content: PoolFieldsOnChain;
68
+ daoFeePoolObject: [
69
+ {
70
+ objectId: ObjectId;
71
+ type: AnyObjectType;
72
+ content: {
73
+ fields: DaoFeePoolFieldsOnChain;
74
+ };
75
+ }
76
+ ] | [];
77
+ }[];
56
78
  //# sourceMappingURL=poolsApiCastingTypes.d.ts.map
@@ -1 +1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AC;IAClB,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,QAAQ,EAAE,cAAc,EAAE,CAAC;IAC3B,eAAe,EAAE,cAAc,CAAC;CAChC;AAED,MAAM,WAAW,8BAA8B;IAC9C,OAAO,EAAE,QAAQ,CAAC;IAClB,MAAM,EAAE,UAAU,CAAC;IACnB,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,SAAS,EAAE,cAAc,EAAE,CAAC;IAC5B,eAAe,EAAE,cAAc,CAAC;CAChC;AAMD,MAAM,MAAM,qBAAqB,GAAG,YAAY,CAAC,2BAA2B,CAAC,CAAC;AAE9E,MAAM,MAAM,uBAAuB,GAClC,YAAY,CAAC,6BAA6B,CAAC,CAAC;AAE7C,MAAM,MAAM,wBAAwB,GACnC,YAAY,CAAC,8BAA8B,CAAC,CAAC;AAM9C,MAAM,MAAM,oBAAoB,GAAG;IAClC,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,aAAa,CAAC;IACpB,OAAO,EAAE,iBAAiB,CAAC;IAC3B,gBAAgB,EACb;QACA;YACC,QAAQ,EAAE,QAAQ,CAAC;YACnB,IAAI,EAAE,aAAa,CAAC;YACpB,OAAO,EAAE;gBACR,MAAM,EAAE,uBAAuB,CAAC;aAChC,CAAC;SACF;KACA,GACD,EAAE,CAAC;CACN,EAAE,CAAC"}
@@ -1,4 +1,4 @@
1
- import { ApiPoolDepositBody, ApiPoolTradeBody, ApiPoolWithdrawBody, Balance, CoinType, CoinsToBalance, PoolDataPoint, PoolGraphDataTimeframeKey, PoolObject, PoolStats, SuiNetwork, PoolDepositEvent, PoolWithdrawEvent, PoolTradeEvent, ApiPoolAllCoinWithdrawBody, ApiIndexerEventsBody, IndexerEventsWithCursor } from "../../types";
1
+ import { ApiPoolDepositBody, ApiPoolTradeBody, ApiPoolWithdrawBody, Balance, CoinType, CoinsToBalance, PoolDataPoint, PoolGraphDataTimeframeKey, PoolObject, PoolStats, SuiNetwork, PoolDepositEvent, PoolWithdrawEvent, PoolTradeEvent, ApiPoolAllCoinWithdrawBody, ApiIndexerEventsBody, IndexerEventsWithCursor, Percentage, SuiAddress, ObjectId } from "../../types";
2
2
  import { Caller } from "../../general/utils/caller";
3
3
  import { Transaction } from "@mysten/sui/transactions";
4
4
  import { AftermathApi } from "../../general/providers";
@@ -25,6 +25,44 @@ export declare class Pool extends Caller {
25
25
  * @param {SuiNetwork} [network] - The network to use.
26
26
  */
27
27
  constructor(pool: PoolObject, network?: SuiNetwork | undefined, Provider?: AftermathApi | undefined);
28
+ /**
29
+ * Fetches the deposit transaction for the pool.
30
+ * @async
31
+ * @param {ApiPoolDepositBody} inputs - The inputs for the method.
32
+ * @returns {Promise<Transaction>} The deposit transaction for the pool.
33
+ */
34
+ getDepositTransaction(inputs: ApiPoolDepositBody): Promise<Transaction>;
35
+ /**
36
+ * Fetches the withdraw transaction for the pool.
37
+ * @async
38
+ * @param {ApiPoolWithdrawBody} inputs - The inputs for the method.
39
+ * @returns {Promise<Transaction>} The withdraw transaction for the pool.
40
+ */
41
+ getWithdrawTransaction(inputs: ApiPoolWithdrawBody): Promise<Transaction>;
42
+ /**
43
+ * Fetches the all coin withdraw transaction for the pool.
44
+ * @async
45
+ * @param {ApiPoolAllCoinWithdrawBody} inputs - The inputs for the method.
46
+ * @returns {Promise<Transaction>} The all coin withdraw transaction for the pool.
47
+ */
48
+ getAllCoinWithdrawTransaction(inputs: ApiPoolAllCoinWithdrawBody): Promise<Transaction>;
49
+ /**
50
+ * Fetches the trade transaction for the pool.
51
+ * @async
52
+ * @param {ApiPoolTradeBody} inputs - The inputs for the method.
53
+ * @returns {Promise<Transaction>} The trade transaction for the pool.
54
+ */
55
+ getTradeTransaction(inputs: ApiPoolTradeBody): Promise<Transaction>;
56
+ getUpdateDaoFeeTransaction(inputs: {
57
+ walletAddress: SuiAddress;
58
+ daoFeePoolOwnerCapId: ObjectId;
59
+ newFeePercentage: Percentage;
60
+ }): Promise<Transaction>;
61
+ getUpdateDaoFeeRecipientTransaction(inputs: {
62
+ walletAddress: SuiAddress;
63
+ daoFeePoolOwnerCapId: ObjectId;
64
+ newFeeRecipient: SuiAddress;
65
+ }): Promise<Transaction>;
28
66
  /**
29
67
  * Fetches the pool statistics.
30
68
  * @async
@@ -61,34 +99,6 @@ export declare class Pool extends Caller {
61
99
  * @returns A promise that resolves to the volume in the last 24 hours.
62
100
  */
63
101
  getVolume24hrs: () => Promise<number>;
64
- /**
65
- * Fetches the deposit transaction for the pool.
66
- * @async
67
- * @param {ApiPoolDepositBody} inputs - The inputs for the method.
68
- * @returns {Promise<Transaction>} The deposit transaction for the pool.
69
- */
70
- getDepositTransaction(inputs: ApiPoolDepositBody): Promise<Transaction>;
71
- /**
72
- * Fetches the withdraw transaction for the pool.
73
- * @async
74
- * @param {ApiPoolWithdrawBody} inputs - The inputs for the method.
75
- * @returns {Promise<Transaction>} The withdraw transaction for the pool.
76
- */
77
- getWithdrawTransaction(inputs: ApiPoolWithdrawBody): Promise<Transaction>;
78
- /**
79
- * Fetches the all coin withdraw transaction for the pool.
80
- * @async
81
- * @param {ApiPoolAllCoinWithdrawBody} inputs - The inputs for the method.
82
- * @returns {Promise<Transaction>} The all coin withdraw transaction for the pool.
83
- */
84
- getAllCoinWithdrawTransaction(inputs: ApiPoolAllCoinWithdrawBody): Promise<Transaction>;
85
- /**
86
- * Fetches the trade transaction for the pool.
87
- * @async
88
- * @param {ApiPoolTradeBody} inputs - The inputs for the method.
89
- * @returns {Promise<Transaction>} The trade transaction for the pool.
90
- */
91
- getTradeTransaction(inputs: ApiPoolTradeBody): Promise<Transaction>;
92
102
  /**
93
103
  * Fetches the deposit events for the pool.
94
104
  * @async
@@ -209,6 +219,10 @@ export declare class Pool extends Caller {
209
219
  getAllCoinWithdrawLpRatio: (inputs: {
210
220
  lpCoinAmountOut: bigint;
211
221
  }) => number;
222
+ daoFeePercentage: () => Percentage | undefined;
223
+ daoFeeRecipient: () => SuiAddress | undefined;
224
+ private getAmountWithDAOFee;
225
+ private getAmountWithoutDAOFee;
212
226
  private useProvider;
213
227
  }
214
228
  //# sourceMappingURL=pool.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../../../src/packages/pools/pool.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,OAAO,EACP,QAAQ,EACR,cAAc,EACd,aAAa,EACb,yBAAyB,EACzB,UAAU,EACV,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EAEd,0BAA0B,EAC1B,oBAAoB,EACpB,uBAAuB,EACvB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAGpD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD;;;GAGG;AACH,qBAAa,IAAK,SAAQ,MAAM;aAoBd,IAAI,EAAE,UAAU;aAChB,OAAO,CAAC;IACxB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;IArB3B;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAE/B;IAEF;;OAEG;IACI,KAAK,EAAE,SAAS,GAAG,SAAS,CAAC;IAEpC;;;;;OAKG;gBAEc,IAAI,EAAE,UAAU,EAChB,OAAO,CAAC,wBAAY,EACnB,QAAQ,CAAC,0BAAc;IAMzC;;;;OAIG;IACU,QAAQ,IAAI,OAAO,CAAC,SAAS,CAAC;IAM3C;;;OAGG;IACI,QAAQ,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI;IAIvC;;;;;;OAMG;IACU,aAAa,CAAC,MAAM,EAAE;QAClC,SAAS,EAAE,yBAAyB,CAAC;KACrC,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAI5B;;;;;;OAMG;IACU,UAAU,C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M;MAyBd;IAEF;;;;;;;OAOG;IACI,qBAAqB,WAAY;QACvC,OAAO,EAAE,MAAM,CAAC;QAChB,mBAAmB,EAAE,cAAc,CAAC;QACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;KACnB,KAAG,cAAc,CAiChB;IAEF;;;;;;OAMG;IACI,4BAA4B,WAAY;QAC9C,OAAO,EAAE,MAAM,CAAC;QAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;KACnB,KAAG,cAAc,CAiBhB;IAEF;;;;;OAKG;IACI,2BAA2B,WAAY;QAC7C,eAAe,EAAE,MAAM,CAAC;KACxB,KAAG,MAAM,CAEsB;IAEhC;;;;;OAKG;IACI,yBAAyB,WAAY;QAC3C,eAAe,EAAE,MAAM,CAAC;KACxB,KAAG,MAAM,CACuD;IAM1D,gBAAgB,QAAO,UAAU,GAAG,SAAS,CAIlD;IAEK,eAAe,QAAO,UAAU,GAAG,SAAS,CAEjD;IAMF,OAAO,CAAC,mBAAmB,CAOzB;IAEF,OAAO,CAAC,sBAAsB,CAO5B;IAEF,OAAO,CAAC,WAAW,CAIjB;CACF"}
@@ -37,6 +37,9 @@ class Pool extends caller_1.Caller {
37
37
  this.getVolume24hrs = () => __awaiter(this, void 0, void 0, function* () {
38
38
  return this.fetchApi("volume-24hrs");
39
39
  });
40
+ // =========================================================================
41
+ // Calculations
42
+ // =========================================================================
40
43
  /**
41
44
  * Calculates the spot price for the pool.
42
45
  * @param {Object} inputs - The inputs for the method.
@@ -65,8 +68,10 @@ class Pool extends caller_1.Caller {
65
68
  const pool = utils_1.Helpers.deepCopy(this.pool);
66
69
  const coinInPoolBalance = pool.coins[inputs.coinInType].balance;
67
70
  const coinOutPoolBalance = pool.coins[inputs.coinOutType].balance;
68
- const coinInAmountWithFees = _1.Pools.getAmountWithProtocolFees({
69
- amount: inputs.coinInAmount,
71
+ const coinInAmountWithFees = this.getAmountWithDAOFee({
72
+ amount: _1.Pools.getAmountWithProtocolFees({
73
+ amount: inputs.coinInAmount,
74
+ }),
70
75
  });
71
76
  if (Number(coinInAmountWithFees) / Number(coinInPoolBalance) >=
72
77
  _1.Pools.constants.bounds.maxTradePercentageOfPoolBalance -
@@ -105,8 +110,10 @@ class Pool extends caller_1.Caller {
105
110
  _1.Pools.constants.bounds.maxTradePercentageOfPoolBalance -
106
111
  Pool.constants.percentageBoundsMarginOfError)
107
112
  throw new Error("coinInAmount / coinInPoolBalance >= maxTradePercentageOfPoolBalance");
108
- const coinInAmountWithoutFees = _1.Pools.getAmountWithoutProtocolFees({
109
- amount: coinInAmount,
113
+ const coinInAmountWithoutFees = this.getAmountWithoutDAOFee({
114
+ amount: _1.Pools.getAmountWithoutProtocolFees({
115
+ amount: coinInAmount,
116
+ }),
110
117
  });
111
118
  return coinInAmountWithoutFees;
112
119
  };
@@ -118,7 +125,7 @@ class Pool extends caller_1.Caller {
118
125
  * @returns {Object} The LP amount and ratio for the deposit.
119
126
  */
120
127
  this.getDepositLpAmountOut = (inputs) => {
121
- const calcedLpRatio = cmmmCalculations_1.CmmmCalculations.calcDepositFixedAmounts(this.pool, inputs.amountsIn);
128
+ const calcedLpRatio = cmmmCalculations_1.CmmmCalculations.calcDepositFixedAmounts(this.pool, Object.entries(inputs.amountsIn).reduce((acc, [coin, amount]) => (Object.assign(Object.assign({}, acc), { [coin]: this.getAmountWithDAOFee({ amount }) })), {}));
122
129
  if (calcedLpRatio >= utils_1.Casting.Fixed.fixedOneB)
123
130
  throw new Error("lpRatio >= 1");
124
131
  const lpRatio = utils_1.Casting.bigIntToFixedNumber(calcedLpRatio);
@@ -148,6 +155,9 @@ class Pool extends caller_1.Caller {
148
155
  if (amountOut / this.pool.coins[coin].balance >=
149
156
  _1.Pools.constants.bounds.maxWithdrawPercentageOfPoolBalance)
150
157
  throw new Error("coinOutAmount / coinOutPoolBalance >= maxWithdrawPercentageOfPoolBalance");
158
+ amountsOut[coin] = this.getAmountWithDAOFee({
159
+ amount: amountOut,
160
+ });
151
161
  }
152
162
  return amountsOut;
153
163
  };
@@ -162,7 +172,9 @@ class Pool extends caller_1.Caller {
162
172
  if (inputs.lpRatio >= 1)
163
173
  throw new Error("lpRatio >= 1");
164
174
  const amountsOut = Object.entries(this.pool.coins).reduce((acc, [coin, info]) => {
165
- return Object.assign(Object.assign({}, acc), { [coin]: BigInt(Math.floor(Number(info.balance) * inputs.lpRatio)) });
175
+ return Object.assign(Object.assign({}, acc), { [coin]: this.getAmountWithDAOFee({
176
+ amount: BigInt(Math.floor(Number(info.balance) * inputs.lpRatio)),
177
+ }) });
166
178
  }, {});
167
179
  return amountsOut;
168
180
  };
@@ -182,8 +194,32 @@ class Pool extends caller_1.Caller {
182
194
  */
183
195
  this.getAllCoinWithdrawLpRatio = (inputs) => Number(inputs.lpCoinAmountOut) / Number(this.pool.lpCoinSupply);
184
196
  // =========================================================================
197
+ // Getters
198
+ // =========================================================================
199
+ this.daoFeePercentage = () => {
200
+ return this.pool.daoFeePoolObject
201
+ ? utils_1.Casting.bpsToPercentage(this.pool.daoFeePoolObject.feeBps)
202
+ : undefined;
203
+ };
204
+ this.daoFeeRecipient = () => {
205
+ var _a;
206
+ return (_a = this.pool.daoFeePoolObject) === null || _a === void 0 ? void 0 : _a.feeRecipient;
207
+ };
208
+ // =========================================================================
185
209
  // Private Helpers
186
210
  // =========================================================================
211
+ this.getAmountWithDAOFee = (inputs) => {
212
+ const daoFeePercentage = this.daoFeePercentage();
213
+ if (!daoFeePercentage)
214
+ return inputs.amount;
215
+ return BigInt(Math.floor(Number(inputs.amount) * (1 - daoFeePercentage)));
216
+ };
217
+ this.getAmountWithoutDAOFee = (inputs) => {
218
+ const daoFeePercentage = this.daoFeePercentage();
219
+ if (!daoFeePercentage)
220
+ return inputs.amount;
221
+ return BigInt(Math.floor(Number(inputs.amount) * (1 / (1 - daoFeePercentage))));
222
+ };
187
223
  this.useProvider = () => {
188
224
  var _a;
189
225
  const provider = (_a = this.Provider) === null || _a === void 0 ? void 0 : _a.Pools();
@@ -193,49 +229,9 @@ class Pool extends caller_1.Caller {
193
229
  };
194
230
  this.pool = pool;
195
231
  }
196
- /**
197
- * Fetches the pool statistics.
198
- * @async
199
- * @returns {Promise<PoolStats>} The pool statistics.
200
- */
201
- getStats() {
202
- return __awaiter(this, void 0, void 0, function* () {
203
- const stats = yield this.fetchApi("stats");
204
- this.setStats(stats);
205
- return stats;
206
- });
207
- }
208
- /**
209
- * Sets the pool statistics.
210
- * @param {PoolStats} stats - The pool statistics.
211
- */
212
- setStats(stats) {
213
- this.stats = stats;
214
- }
215
- /**
216
- * Fetches the volume data for the pool.
217
- * @async
218
- * @param {Object} inputs - The inputs for the method.
219
- * @param {PoolGraphDataTimeframeKey} inputs.timeframe - The timeframe for the data.
220
- * @returns {Promise<PoolDataPoint[]>} The volume data for the pool.
221
- */
222
- getVolumeData(inputs) {
223
- return __awaiter(this, void 0, void 0, function* () {
224
- return this.fetchApi(`volume/${inputs.timeframe}`);
225
- });
226
- }
227
- /**
228
- * Fetches the fee data for the pool.
229
- * @async
230
- * @param {Object} inputs - The inputs for the method.
231
- * @param {PoolGraphDataTimeframeKey} inputs.timeframe - The timeframe for the data.
232
- * @returns {Promise<PoolDataPoint[]>} The fee data for the pool.
233
- */
234
- getFeeData(inputs) {
235
- return __awaiter(this, void 0, void 0, function* () {
236
- return this.fetchApi(`fees/${inputs.timeframe}`);
237
- });
238
- }
232
+ // =========================================================================
233
+ // Transactions
234
+ // =========================================================================
239
235
  /**
240
236
  * Fetches the deposit transaction for the pool.
241
237
  * @async
@@ -280,6 +276,70 @@ class Pool extends caller_1.Caller {
280
276
  return this.useProvider().fetchBuildTradeTx(Object.assign(Object.assign({}, inputs), { pool: this }));
281
277
  });
282
278
  }
279
+ getUpdateDaoFeeTransaction(inputs) {
280
+ var _a;
281
+ return __awaiter(this, void 0, void 0, function* () {
282
+ const daoFeePoolId = (_a = this.pool.daoFeePoolObject) === null || _a === void 0 ? void 0 : _a.objectId;
283
+ if (!daoFeePoolId)
284
+ throw new Error("this pool has no DAO fee");
285
+ return this.useProvider().buildDaoFeePoolUpdateFeeBpsTx(Object.assign(Object.assign({}, inputs), { daoFeePoolId, lpCoinType: this.pool.lpCoinType, newFeeBps: utils_1.Casting.percentageToBps(inputs.newFeePercentage) }));
286
+ });
287
+ }
288
+ getUpdateDaoFeeRecipientTransaction(inputs) {
289
+ var _a;
290
+ return __awaiter(this, void 0, void 0, function* () {
291
+ const daoFeePoolId = (_a = this.pool.daoFeePoolObject) === null || _a === void 0 ? void 0 : _a.objectId;
292
+ if (!daoFeePoolId)
293
+ throw new Error("this pool has no DAO fee");
294
+ return this.useProvider().buildDaoFeePoolUpdateFeeRecipientTx(Object.assign(Object.assign({}, inputs), { daoFeePoolId, lpCoinType: this.pool.lpCoinType, newFeeRecipient: utils_1.Helpers.addLeadingZeroesToType(inputs.newFeeRecipient) }));
295
+ });
296
+ }
297
+ // =========================================================================
298
+ // Inspections
299
+ // =========================================================================
300
+ /**
301
+ * Fetches the pool statistics.
302
+ * @async
303
+ * @returns {Promise<PoolStats>} The pool statistics.
304
+ */
305
+ getStats() {
306
+ return __awaiter(this, void 0, void 0, function* () {
307
+ const stats = yield this.fetchApi("stats");
308
+ this.setStats(stats);
309
+ return stats;
310
+ });
311
+ }
312
+ /**
313
+ * Sets the pool statistics.
314
+ * @param {PoolStats} stats - The pool statistics.
315
+ */
316
+ setStats(stats) {
317
+ this.stats = stats;
318
+ }
319
+ /**
320
+ * Fetches the volume data for the pool.
321
+ * @async
322
+ * @param {Object} inputs - The inputs for the method.
323
+ * @param {PoolGraphDataTimeframeKey} inputs.timeframe - The timeframe for the data.
324
+ * @returns {Promise<PoolDataPoint[]>} The volume data for the pool.
325
+ */
326
+ getVolumeData(inputs) {
327
+ return __awaiter(this, void 0, void 0, function* () {
328
+ return this.fetchApi(`volume/${inputs.timeframe}`);
329
+ });
330
+ }
331
+ /**
332
+ * Fetches the fee data for the pool.
333
+ * @async
334
+ * @param {Object} inputs - The inputs for the method.
335
+ * @param {PoolGraphDataTimeframeKey} inputs.timeframe - The timeframe for the data.
336
+ * @returns {Promise<PoolDataPoint[]>} The fee data for the pool.
337
+ */
338
+ getFeeData(inputs) {
339
+ return __awaiter(this, void 0, void 0, function* () {
340
+ return this.fetchApi(`fees/${inputs.timeframe}`);
341
+ });
342
+ }
283
343
  /**
284
344
  * Fetches the deposit events for the pool.
285
345
  * @async
@@ -1,4 +1,4 @@
1
- import { ApiCreatePoolBody, ApiPoolObjectIdForLpCoinTypeBody, ApiPublishLpCoinBody, Balance, CoinType, Slippage, SuiNetwork, ObjectId, PoolStats, ApiPoolsStatsBody } from "../../types";
1
+ import { ApiCreatePoolBody, ApiPoolObjectIdForLpCoinTypeBody, ApiPublishLpCoinBody, Balance, CoinType, Slippage, SuiNetwork, ObjectId, PoolStats, ApiPoolsStatsBody, ApiPoolsOwnedDaoFeePoolOwnerCapsBody } from "../../types";
2
2
  import { Pool } from "./pool";
3
3
  import { Caller } from "../../general/utils/caller";
4
4
  import { AftermathApi } from "../../general/providers";
@@ -38,6 +38,8 @@ export declare class Pools extends Caller {
38
38
  maxSwapFee: number;
39
39
  minWeight: number;
40
40
  maxWeight: number;
41
+ minDaoFee: number;
42
+ maxDaoFee: number;
41
43
  };
42
44
  defaults: {
43
45
  lpCoinDecimals: number;
@@ -111,6 +113,7 @@ export declare class Pools extends Caller {
111
113
  * @returns {Promise<PoolStats[]>} The statistics for pools.
112
114
  */
113
115
  getPoolsStats(inputs: ApiPoolsStatsBody): Promise<PoolStats[]>;
116
+ getOwnedDaoFeePoolOwnerCaps(inputs: ApiPoolsOwnedDaoFeePoolOwnerCapsBody): Promise<import("./poolsTypes").DaoFeePoolOwnerCapObject[]>;
114
117
  static getAmountWithProtocolFees: (inputs: {
115
118
  amount: Balance;
116
119
  withReferral?: boolean;
@@ -119,7 +122,7 @@ export declare class Pools extends Caller {
119
122
  amount: Balance;
120
123
  withReferral?: boolean;
121
124
  }) => bigint;
122
- static normalizeSlippage: (slippage: Slippage) => bigint;
125
+ static normalizeInvertSlippage: (slippage: Slippage) => bigint;
123
126
  static displayLpCoinType: (lpCoinType: CoinType) => string;
124
127
  static isPossibleLpCoinType: (inputs: {
125
128
  lpCoinType: CoinType;
@@ -1 +1 @@
1
- {"version":3,"file":"pools.d.ts","sourceRoot":"","sources":["../../../src/packages/pools/pools.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,iBAAiB,EAEjB,gCAAgC,EAChC,oBAAoB,EACpB,OAAO,EACP,QAAQ,EAOR,QAAQ,EACR,UAAU,EAEV,QAAQ,EACR,SAAS,EACT,iBAAiB,EACjB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AAGpD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAGvD;;;;;;;;;;GAUG;AACH,qBAAa,KAAM,SAAQ,MAAM;aAgDf,OAAO,CAAC;IACxB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;IA5C3B;;OAEG;IACH,gBAAuB,SAAS;;;;;;;;;;;;;;;;;;;;;;;MA0B9B;IAMF;;;;;OAKG;gBAGc,OAAO,CAAC,wBAAY,EACnB,QAAQ,CAAC,0BAAc;IAazC;;;;;OAKG;IACU,OAAO,CAAC,MAAM,EAAE;QAAE,QAAQ,EAAE,QAAQ,CAAA;KAAE;IAKnD;;;;;OAKG;IACU,QAAQ,CAAC,MAAM,EAAE;QAAE,SAAS,EAAE,QAAQ,EAAE,CAAA;KAAE;IASvD;;;OAGG;IAEU,WAAW;IASxB;;;;OAIG;IACU,2BAA2B,CAAC,MAAM,EAAE,oBAAoB;IAIrE;;;;OAIG;IACU,wBAAwB,CAAC,MAAM,EAAE,iBAAiB;IAQ/D;;;;;OAKG;IACI,4BAA4B,WAC1B,gCAAgC,iCAYvC;IAEF;;;;OAIG;IACI,YAAY,WAAkB;QAAE,UAAU,EAAE,QAAQ,CAAA;KAAE,sBAO3D;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c;IAazC;;;;;OAKG;IACU,OAAO,CAAC,MAAM,EAAE;QAAE,QAAQ,EAAE,QAAQ,CAAA;KAAE;IAKnD;;;;;OAKG;IACU,QAAQ,CAAC,MAAM,EAAE;QAAE,SAAS,EAAE,QAAQ,EAAE,CAAA;KAAE;IASvD;;;OAGG;IAEU,WAAW;IASxB;;;;OAIG;IACU,2BAA2B,CAAC,MAAM,EAAE,oBAAoB;IAIrE;;;;OAIG;IACU,wBAAwB,CAAC,MAAM,EAAE,iBAAiB;IAQ/D;;;;;OAKG;IACI,4BAA4B,WAC1B,gCAAgC,iCAYvC;IAEF;;;;OAIG;IACI,YAAY,WAAkB;QAAE,UAAU,EAAE,QAAQ,CAAA;KAAE,sBAO3D;IAEF;;;OAGG;IACI,mBAAmB,QAAa,QAAQ,MAAM,CAAC,CAEpD;IAEF;;;;OAIG;IACU,aAAa,CACzB,MAAM,EAAE,iBAAiB,GACvB,OAAO,CAAC,SAAS,EAAE,CAAC;IAIV,2BAA2B,CACvC,MAAM,EAAE,oCAAoC;IAS7C,OAAc,yBAAyB,WAAY;QAClD,MAAM,EAAE,OAAO,CAAC;QAChB,YAAY,CAAC,EAAE,OAAO,CAAC;KACvB,YAcC;IAEF,OAAc,4BAA4B,WAAY;QACrD,MAAM,EAAE,OAAO,CAAC;QAChB,YAAY,CAAC,EAAE,OAAO,CAAC;KACvB,YAeC;IAEF,OAAc,uBAAuB,aAAc,QAAQ,YACpB;IAMvC,OAAc,iBAAiB,eAAgB,QAAQ,KAAG,MAAM,CAM3C;IAMrB,OAAc,oBAAoB,WAAY;QAAE,UAAU,EAAE,QAAQ,CAAA;KAAE,aAOpE;IAMF,OAAO,CAAC,WAAW,CAIjB;CACF"}
@@ -165,6 +165,11 @@ class Pools extends caller_1.Caller {
165
165
  return this.fetchApi("stats", inputs);
166
166
  });
167
167
  }
168
+ getOwnedDaoFeePoolOwnerCaps(inputs) {
169
+ return __awaiter(this, void 0, void 0, function* () {
170
+ return this.useProvider().fetchOwnedDaoFeePoolOwnerCaps(inputs);
171
+ });
172
+ }
168
173
  }
169
174
  exports.Pools = Pools;
170
175
  _a = Pools;
@@ -195,7 +200,9 @@ Pools.constants = {
195
200
  minSwapFee: 0.0001,
196
201
  maxSwapFee: 0.1,
197
202
  minWeight: 0.01,
198
- maxWeight: 0.99, // 99%
203
+ maxWeight: 0.99,
204
+ minDaoFee: 0,
205
+ maxDaoFee: 1, // 100%
199
206
  },
200
207
  defaults: {
201
208
  lpCoinDecimals: 9,
@@ -227,7 +234,7 @@ Pools.getAmountWithoutProtocolFees = (inputs) => {
227
234
  (_a.constants.feePercentages.totalProtocol -
228
235
  referralDiscount)))));
229
236
  };
230
- Pools.normalizeSlippage = (slippage) => fixedUtils_1.FixedUtils.directUncast(1 - slippage);
237
+ Pools.normalizeInvertSlippage = (slippage) => fixedUtils_1.FixedUtils.directUncast(1 - slippage);
231
238
  // =========================================================================
232
239
  // Display
233
240
  // =========================================================================