aftermath-ts-sdk 0.0.136 → 0.0.138
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/general/utils/fixed.d.ts +15 -0
- package/dist/general/utils/fixed.d.ts.map +1 -0
- package/dist/general/utils/fixed.js +15 -0
- package/dist/general/utils/helpers.d.ts +9 -0
- package/dist/general/utils/helpers.d.ts.map +1 -1
- package/dist/general/utils/helpers.js +9 -0
- package/dist/packages/pools/api/poolsApiCasting.d.ts.map +1 -1
- package/dist/packages/pools/api/poolsApiCasting.js +7 -7
- package/dist/packages/pools/api/poolsApiHelpers.js +1 -1
- package/dist/packages/pools/utils/cmmmCalculations.d.ts +22 -8
- package/dist/packages/pools/utils/cmmmCalculations.d.ts.map +1 -1
- package/dist/packages/pools/utils/cmmmCalculations.js +1009 -261
- package/dist/packages/router/utils/synchronous/routerGraph.d.ts.map +1 -1
- package/dist/packages/router/utils/synchronous/routerGraph.js +1 -13
- package/dist/packages/router/utils/synchronous/routerPools/aftermathRouterPool.d.ts.map +1 -1
- package/dist/packages/router/utils/synchronous/routerPools/aftermathRouterPool.js +26 -8
- package/dist/packages/staking/api/stakingApi.d.ts +4 -1
- package/dist/packages/staking/api/stakingApi.d.ts.map +1 -1
- package/dist/packages/staking/api/stakingApi.js +3 -0
- package/dist/packages/staking/api/stakingApiCasting.d.ts.map +1 -1
- package/dist/packages/staking/api/stakingApiCasting.js +0 -1
- package/dist/packages/staking/api/stakingApiCastingTypes.d.ts +0 -1
- package/dist/packages/staking/api/stakingApiCastingTypes.d.ts.map +1 -1
- package/dist/packages/staking/api/stakingApiHelpers.d.ts +2 -0
- package/dist/packages/staking/api/stakingApiHelpers.d.ts.map +1 -1
- package/dist/packages/staking/api/stakingApiHelpers.js +12 -0
- package/dist/packages/staking/staking.d.ts +2 -1
- package/dist/packages/staking/staking.d.ts.map +1 -1
- package/dist/packages/staking/staking.js +5 -0
- package/dist/packages/staking/stakingTypes.d.ts +3 -2
- package/dist/packages/staking/stakingTypes.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type OnChainNumber = bigint;
|
|
2
|
+
export type LocalNumber = number;
|
|
3
|
+
export declare class Fixed {
|
|
4
|
+
static fixedOneN: number;
|
|
5
|
+
static fixedOneB: bigint;
|
|
6
|
+
static convertFromInt: (n: OnChainNumber) => LocalNumber;
|
|
7
|
+
static convertToInt: (n: LocalNumber) => OnChainNumber;
|
|
8
|
+
static directCast: (n: OnChainNumber) => LocalNumber;
|
|
9
|
+
static directUncast: (n: LocalNumber) => OnChainNumber;
|
|
10
|
+
static complement: (n: LocalNumber) => number;
|
|
11
|
+
}
|
|
12
|
+
export type OnChainRawInteger = OnChainNumber;
|
|
13
|
+
export type OnChainUnitaryParameter = OnChainNumber;
|
|
14
|
+
export type OnChainScalar = OnChainNumber;
|
|
15
|
+
//# sourceMappingURL=fixed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixed.d.ts","sourceRoot":"","sources":["../../../src/general/utils/fixed.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AACnC,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC;AAEjC,qBAAa,KAAK;IACd,OAAc,SAAS,EAAE,MAAM,CAA6B;IAC5D,OAAc,SAAS,EAAE,MAAM,CAAiC;IAIhE,OAAc,cAAc,MAAO,aAAa,KAAG,WAAW,CAAc;IAC/E,OAAc,YAAY,MAAO,WAAW,KAAG,aAAa,CAA0B;IACnF,OAAc,UAAU,MAAO,aAAa,KAAG,WAAW,CAAgC;IAC1F,OAAc,YAAY,MAAO,WAAW,KAAG,aAAa,CAE1D;IAEF,OAAc,UAAU,MAAO,WAAW,YAAqC;CAClF;AAKD,MAAM,MAAM,iBAAiB,GAAG,aAAa,CAAC;AAG9C,MAAM,MAAM,uBAAuB,GAAG,aAAa,CAAC;AAGpD,MAAM,MAAM,aAAa,GAAG,aAAa,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Fixed = void 0;
|
|
4
|
+
class Fixed {
|
|
5
|
+
}
|
|
6
|
+
exports.Fixed = Fixed;
|
|
7
|
+
Fixed.fixedOneN = 1000000000000000000;
|
|
8
|
+
Fixed.fixedOneB = BigInt("1000000000000000000");
|
|
9
|
+
// These terms come from their on chain counterparts. They are backwards from the point of view of js.
|
|
10
|
+
// On chain direct cast means e.g. taking ((x: u64) as u256).
|
|
11
|
+
Fixed.convertFromInt = (n) => Number(n);
|
|
12
|
+
Fixed.convertToInt = (n) => BigInt(Math.floor(n));
|
|
13
|
+
Fixed.directCast = (n) => Number(n) / Fixed.fixedOneN;
|
|
14
|
+
Fixed.directUncast = (n) => BigInt(Math.floor(n * Fixed.fixedOneN));
|
|
15
|
+
Fixed.complement = (n) => Math.max(0, 1 - Math.max(0, n));
|
|
@@ -19,6 +19,15 @@ export declare class Helpers {
|
|
|
19
19
|
static sumBigInt: (arr: bigint[]) => bigint;
|
|
20
20
|
static closeEnough: (a: number, b: number, tolerance: number) => boolean;
|
|
21
21
|
static closeEnoughBigInt: (a: bigint, b: bigint, tolerance: number) => boolean;
|
|
22
|
+
static veryCloseInt: (a: number, b: number, fixedOne: number) => boolean;
|
|
23
|
+
static blendedOperations: {
|
|
24
|
+
mulNNN: (a: number, b: number) => number;
|
|
25
|
+
mulNNB: (a: number, b: number) => bigint;
|
|
26
|
+
mulNBN: (a: number, b: bigint) => number;
|
|
27
|
+
mulNBB: (a: number, b: bigint) => bigint;
|
|
28
|
+
mulBBN: (a: bigint, b: bigint) => number;
|
|
29
|
+
mulBBB: (a: bigint, b: bigint) => bigint;
|
|
30
|
+
};
|
|
22
31
|
static capitalizeOnlyFirstLetter: (str: string) => string;
|
|
23
32
|
static parseJsonWithBigint: (json: string, unsafeStringNumberConversion?: boolean) => any;
|
|
24
33
|
static deepCopy: <T>(target: T) => T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/general/utils/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAEvE,qBAAa,OAAO;IAKnB,gBAAuB,aAAa,iCAA2B;IAC/D,gBAAuB,MAAM,0BAAoB;IACjD,gBAAuB,WAAW,+BAAyB;IAC3D,gBAAuB,OAAO,2BAAqB;IACnD,gBAAuB,GAAG,uBAAiB;IAC3C,gBAAuB,YAAY,gCAA0B;IAM7D,OAAc,0BAA0B,SACjC,aAAa,KACjB,aAAa,CAAiC;IAEjD,OAAc,sBAAsB,SAC7B,aAAa,KACjB,aAAa,CAqBd;IAMF,OAAc,QAAQ,QAAS,MAAM,KAAG,OAAO,CAA6B;IAE5E,OAAc,GAAG,QAAS,MAAM,EAAE,YACQ;IAE1C,OAAc,SAAS,QAAS,MAAM,EAAE,YACU;IAElD,OAAc,WAAW,MAAO,MAAM,KAAK,MAAM,aAAa,MAAM,aACrB;IAE/C,OAAc,iBAAiB,MAC3B,MAAM,KACN,MAAM,aACE,MAAM,aACwC;
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/general/utils/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,uBAA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mB,SAC1B,MAAM,iDAiBT;IAMJ,OAAc,QAAQ,sBAwBpB;IAEF,OAAc,UAAU,QAAS,GAAG,EAAE,YAcpC;IAEF,OAAc,WAAW,uBAA2C;IAEpE,OAAc,KAAK,OAAQ,MAAM,sBAA2C;IAE5E,OAAc,SAAS,eAC4C;WAMrD,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,EAAE;CAMjE"}
|
|
@@ -56,6 +56,15 @@ Helpers.sum = (arr) => arr.reduce((prev, cur) => prev + cur, 0);
|
|
|
56
56
|
Helpers.sumBigInt = (arr) => arr.reduce((prev, cur) => prev + cur, BigInt(0));
|
|
57
57
|
Helpers.closeEnough = (a, b, tolerance) => Math.abs(a - b) <= tolerance * Math.max(a, b);
|
|
58
58
|
Helpers.closeEnoughBigInt = (a, b, tolerance) => Helpers.closeEnough(Number(a), Number(b), tolerance);
|
|
59
|
+
Helpers.veryCloseInt = (a, b, fixedOne) => Math.abs(Math.floor(a / fixedOne) - Math.floor(b / fixedOne)) <= 1;
|
|
60
|
+
Helpers.blendedOperations = {
|
|
61
|
+
mulNNN: (a, b) => a * b,
|
|
62
|
+
mulNNB: (a, b) => BigInt(Math.floor(a * b)),
|
|
63
|
+
mulNBN: (a, b) => a * Number(b),
|
|
64
|
+
mulNBB: (a, b) => BigInt(Math.floor(a * Number(b))),
|
|
65
|
+
mulBBN: (a, b) => Number(a * b),
|
|
66
|
+
mulBBB: (a, b) => a * b,
|
|
67
|
+
};
|
|
59
68
|
/////////////////////////////////////////////////////////////////////
|
|
60
69
|
//// Display
|
|
61
70
|
/////////////////////////////////////////////////////////////////////
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"poolsApiCasting.d.ts","sourceRoot":"","sources":["../../../../src/packages/pools/api/poolsApiCasting.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,QAAQ,EACR,iBAAiB,EAGjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAEN,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,iBAAiB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EACN,sBAAsB,EACtB,uBAAuB,EAEvB,qBAAqB,EACrB,wBAAwB,EACxB,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"poolsApiCasting.d.ts","sourceRoot":"","sources":["../../../../src/packages/pools/api/poolsApiCasting.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,QAAQ,EACR,iBAAiB,EAGjB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAEN,gBAAgB,EAChB,UAAU,EACV,cAAc,EACd,iBAAiB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EACN,sBAAsB,EACtB,uBAAuB,EAEvB,qBAAqB,EACrB,wBAAwB,EACxB,MAAM,wBAAwB,CAAC;AAKhC,qBAAa,eAAe;IAK3B,OAAc,uBAAuB,cACzB,iBAAiB,KAC1B,UAAU,CA8CX;IAMF,OAAc,yBAAyB,2CAEpC,cAAc,CAiBf;IAEF,OAAc,2BAA2B,6CAEtC,gBAAgB,CAejB;IAEF,OAAc,4BAA4B,8CAEvC,iBAAiB,CAclB;IAEF,OAAc,sCAAsC,4CAEjD,QAAQ,CAGT;CACF"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.PoolsApiCasting = void 0;
|
|
4
4
|
const sui_js_1 = require("@mysten/sui.js");
|
|
5
5
|
const coin_1 = require("../../coin");
|
|
6
|
+
const utils_1 = require("../../../general/utils");
|
|
6
7
|
class PoolsApiCasting {
|
|
7
8
|
}
|
|
8
9
|
exports.PoolsApiCasting = PoolsApiCasting;
|
|
@@ -12,8 +13,7 @@ exports.PoolsApiCasting = PoolsApiCasting;
|
|
|
12
13
|
PoolsApiCasting.poolObjectFromSuiObject = (suiObject) => {
|
|
13
14
|
const objectId = (0, sui_js_1.getObjectId)(suiObject);
|
|
14
15
|
const poolFieldsOnChain = (0, sui_js_1.getObjectFields)(suiObject);
|
|
15
|
-
const lpCoinType = new coin_1.Coin(poolFieldsOnChain.lp_supply.type)
|
|
16
|
-
.innerCoinType;
|
|
16
|
+
const lpCoinType = utils_1.Helpers.addLeadingZeroesToType(new coin_1.Coin(poolFieldsOnChain.lp_supply.type).innerCoinType);
|
|
17
17
|
const coins = poolFieldsOnChain.type_names.reduce((acc, cur, index) => {
|
|
18
18
|
return Object.assign(Object.assign({}, acc), { ["0x" + cur]: {
|
|
19
19
|
weight: BigInt(poolFieldsOnChain.weights[index]),
|
|
@@ -26,7 +26,7 @@ PoolsApiCasting.poolObjectFromSuiObject = (suiObject) => {
|
|
|
26
26
|
}, {});
|
|
27
27
|
return {
|
|
28
28
|
objectId,
|
|
29
|
-
lpCoinType
|
|
29
|
+
lpCoinType,
|
|
30
30
|
name: poolFieldsOnChain.name,
|
|
31
31
|
creator: poolFieldsOnChain.creator,
|
|
32
32
|
lpCoinSupply: BigInt(poolFieldsOnChain.lp_supply.fields.value),
|
|
@@ -43,9 +43,9 @@ PoolsApiCasting.poolTradeEventFromOnChain = (eventOnChain) => {
|
|
|
43
43
|
return {
|
|
44
44
|
poolId: fields.pool_id,
|
|
45
45
|
trader: fields.issuer,
|
|
46
|
-
typesIn: fields.types_in.map((type) => "0x" + type),
|
|
46
|
+
typesIn: fields.types_in.map((type) => utils_1.Helpers.addLeadingZeroesToType("0x" + type)),
|
|
47
47
|
amountsIn: fields.amounts_in,
|
|
48
|
-
typesOut: fields.types_out.map((type) => "0x" + type),
|
|
48
|
+
typesOut: fields.types_out.map((type) => utils_1.Helpers.addLeadingZeroesToType("0x" + type)),
|
|
49
49
|
amountsOut: fields.amounts_out,
|
|
50
50
|
timestamp: eventOnChain.timestampMs,
|
|
51
51
|
txnDigest: eventOnChain.id.txDigest,
|
|
@@ -58,7 +58,7 @@ PoolsApiCasting.poolDepositEventFromOnChain = (eventOnChain) => {
|
|
|
58
58
|
poolId: fields.pool_id,
|
|
59
59
|
depositor: fields.issuer,
|
|
60
60
|
// TODO: create a function for all this 0x nonsense
|
|
61
|
-
types: fields.types.map((type) => "0x" + type),
|
|
61
|
+
types: fields.types.map((type) => utils_1.Helpers.addLeadingZeroesToType("0x" + type)),
|
|
62
62
|
deposits: fields.deposits,
|
|
63
63
|
lpMinted: fields.lp_coins_minted,
|
|
64
64
|
timestamp: eventOnChain.timestampMs,
|
|
@@ -71,7 +71,7 @@ PoolsApiCasting.poolWithdrawEventFromOnChain = (eventOnChain) => {
|
|
|
71
71
|
return {
|
|
72
72
|
poolId: fields.pool_id,
|
|
73
73
|
withdrawer: fields.issuer,
|
|
74
|
-
types: fields.types.map((type) => "0x" + type),
|
|
74
|
+
types: fields.types.map((type) => utils_1.Helpers.addLeadingZeroesToType("0x" + type)),
|
|
75
75
|
withdrawn: fields.withdrawn,
|
|
76
76
|
lpBurned: fields.lp_coins_burned,
|
|
77
77
|
timestamp: eventOnChain.timestampMs,
|
|
@@ -143,7 +143,7 @@ class PoolsApiHelpers {
|
|
|
143
143
|
};
|
|
144
144
|
this.publishLpCoinTx = (inputs) => {
|
|
145
145
|
const { tx } = inputs;
|
|
146
|
-
const compiledModulesAndDeps = JSON.parse(`{"modules":["
|
|
146
|
+
const compiledModulesAndDeps = JSON.parse(`{"modules":["oRzrCwYAAAAJAQAGAgYIAw4LBBkCBRsQBytPCHpgCtoBBQzfAQ0AAgIDAQcAAAIAAgECAAAGAAEAAQQDAQECAQICCAAHCAEAAQgAAgkABwgBBUFGX0xQCVR4Q29udGV4dAVhZl9scA1hbW1faW50ZXJmYWNlDmNyZWF0ZV9scF9jb2luC2R1bW15X2ZpZWxkBGluaXQKdHhfY29udGV4dAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAKSGtSCGxSkXYC0/yRf8awt+oAmrsP3RxZjHuO/XNom1AACAQUBAAAAAAEECwALATgAAgA="],"dependencies":["0x66b4bc89ea0b5269b5f062eddd7f42f100df85121906104fbdba6d43c8b6d45f","0x921ad4821b14a45d80b4ff245ff1ac2dfa8026aec3f74716631ee3bf5cda26d4","0x321a50c956db8b0b8fe53af2756e33212e18ea1a6ba82b9dd4308114b6944289","0x0000000000000000000000000000000000000000000000000000000000000001","0xd017a79cc5f7a2108da262921ae6397cfb252a58d70eb8cbcaefba3ea821394b","0x484d68333fe65c4910a5c708c9aa6469bfc59d343bc5ed898a18226ae422959f","0x0000000000000000000000000000000000000000000000000000000000000002","0x0000000000000000000000000000000000000000000000000000000000000003","0x373c265b27110d08e500ebb2a2e40aab08e1dd7d7f40eb878094ed260c4e5afa","0x98ce01359788d3b0bb7963832aec636d4865087c1971ac687cfeae13eba76e0f"],"digest":[198,111,64,73,135,80,243,246,232,194,92,89,122,230,95,41,203,135,103,8,227,133,230,153,52,142,209,199,76,64,227,67]}`);
|
|
147
147
|
return tx.publish({
|
|
148
148
|
modules: compiledModulesAndDeps.modules.map((m) => Array.from((0, sui_js_1.fromB64)(m))),
|
|
149
149
|
dependencies: compiledModulesAndDeps.dependencies.map((addr) => (0, sui_js_1.normalizeSuiObjectId)(addr)),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Balance, CoinType, CoinsToBalance, PoolObject } from "../../../types";
|
|
2
|
+
import { LocalNumber, OnChainScalar } from "../../../general/utils/fixed";
|
|
2
3
|
export declare class CmmmCalculations {
|
|
3
4
|
private static minWeight;
|
|
4
5
|
private static maxWeightedTokens;
|
|
@@ -8,21 +9,34 @@ export declare class CmmmCalculations {
|
|
|
8
9
|
private static maxInvariantRatio;
|
|
9
10
|
private static maxNewtonAttempts;
|
|
10
11
|
private static convergenceBound;
|
|
11
|
-
private static
|
|
12
|
-
private static
|
|
13
|
-
private static convertToInt;
|
|
14
|
-
private static directCast;
|
|
15
|
-
private static directUncast;
|
|
12
|
+
private static tolerance;
|
|
13
|
+
private static validityTolerance;
|
|
16
14
|
static calcInvariant: (pool: PoolObject) => number;
|
|
17
15
|
static calcInvariantQuadratic: (prod: number, sum: number, flatness: number) => number;
|
|
18
16
|
static calcInvariantComponents: (pool: PoolObject, index: CoinType) => [prod: number, sum: number, p0: number, s0: number, h: number];
|
|
19
|
-
private static getTokenBalanceGivenInvariantAndAllOtherBalances;
|
|
20
17
|
static calcSpotPrice: (pool: PoolObject, coinTypeIn: CoinType, coinTypeOut: CoinType) => number;
|
|
21
18
|
static calcSpotPriceWithFees: (pool: PoolObject, coinTypeIn: CoinType, coinTypeOut: CoinType, ignoreFees?: boolean) => number;
|
|
22
19
|
private static calcSpotPriceBody;
|
|
23
20
|
static calcOutGivenIn: (pool: PoolObject, coinTypeIn: CoinType, coinTypeOut: CoinType, amountIn: Balance) => Balance;
|
|
24
21
|
static calcInGivenOut: (pool: PoolObject, coinTypeIn: CoinType, coinTypeOut: CoinType, amountOut: Balance) => Balance;
|
|
25
|
-
static
|
|
26
|
-
static
|
|
22
|
+
static calcSwapFixedIn: (pool: PoolObject, amountsIn: CoinsToBalance, amountsOutDirection: CoinsToBalance) => OnChainScalar;
|
|
23
|
+
static calcSwapFixedOut: (pool: PoolObject, amountsInDirection: CoinsToBalance, amountsOut: CoinsToBalance) => OnChainScalar;
|
|
24
|
+
static calcDepositFixedAmounts: (pool: PoolObject, amountsIn: CoinsToBalance) => OnChainScalar;
|
|
25
|
+
private static calcDepositFixedAmountsInitialEstimate;
|
|
26
|
+
static calcWithdrawFlpAmountsOut: (pool: PoolObject, amountsOutDirection: CoinsToBalance, lpRatio: LocalNumber) => CoinsToBalance;
|
|
27
|
+
private static calcWithdrawFlpAmountsOutInitialEstimate;
|
|
28
|
+
static calcAllCoinDeposit: (pool: PoolObject, amountsIn: CoinsToBalance) => CoinsToBalance;
|
|
29
|
+
static calcAllCoinWithdraw: (pool: PoolObject, amountsOut: CoinsToBalance) => CoinsToBalance;
|
|
30
|
+
private static getTokenBalanceGivenInvariantAndAllOtherBalances;
|
|
31
|
+
static checkValidSwap: (pool: PoolObject, amountsIn: CoinsToBalance, amountsInScalar: LocalNumber, amountsOut: CoinsToBalance, amountsOutScalar: LocalNumber) => boolean;
|
|
32
|
+
static checkValid1dSwap: (pool: PoolObject, coinTypeIn: CoinType, coinTypeOut: CoinType, amountInB: Balance, amountOutB: Balance) => boolean;
|
|
33
|
+
static checkValidDeposit: (pool: PoolObject, amountsIn: CoinsToBalance, lpRatioRaw: OnChainScalar) => boolean;
|
|
34
|
+
static checkValidWithdraw: (pool: PoolObject, amountsOutSrc: CoinsToBalance, lpRatio: LocalNumber) => boolean;
|
|
35
|
+
static getEstimateOutGivenIn: (pool: PoolObject, coinTypeIn: CoinType, coinTypeOut: CoinType, amountIn: Balance) => Balance;
|
|
36
|
+
static getEstimateInGivenOut: (pool: PoolObject, coinTypeIn: CoinType, coinTypeOut: CoinType, amountOut: Balance) => Balance;
|
|
37
|
+
static getEstimateSwapFixedIn: (pool: PoolObject, amountsIn: CoinsToBalance, amountsOutDirection: CoinsToBalance) => LocalNumber;
|
|
38
|
+
static getEstimateSwapFixedOut: (pool: PoolObject, amountsInDirection: CoinsToBalance, amountsOut: CoinsToBalance) => LocalNumber;
|
|
39
|
+
static getEstimateDepositFixedAmounts: (pool: PoolObject, amountsIn: CoinsToBalance) => LocalNumber;
|
|
40
|
+
static getEstimateWithdrawFlpAmountsOut: (pool: PoolObject, amountsOutDirection: CoinsToBalance, lpRatio: LocalNumber) => LocalNumber;
|
|
27
41
|
}
|
|
28
42
|
//# sourceMappingURL=cmmmCalculations.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cmmmCalculations.d.ts","sourceRoot":"","sources":["../../../../src/packages/pools/utils/cmmmCalculations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cmmmCalculations.d.ts","sourceRoot":"","sources":["../../../../src/packages/pools/utils/cmmmCalculations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AA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