@mento-protocol/mento-sdk 3.0.0-beta.5 → 3.0.0-beta.7
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/README.md +34 -0
- package/dist/cache/routes.d.ts.map +1 -1
- package/dist/cache/routes.js +5 -3
- package/dist/cache/routes.js.map +1 -1
- package/dist/core/abis/erc20.d.ts +7 -0
- package/dist/core/abis/erc20.d.ts.map +1 -1
- package/dist/core/abis/erc20.js +7 -0
- package/dist/core/abis/erc20.js.map +1 -1
- package/dist/core/abis/fpmm.d.ts +38 -0
- package/dist/core/abis/fpmm.d.ts.map +1 -1
- package/dist/core/abis/fpmm.js +1 -0
- package/dist/core/abis/fpmm.js.map +1 -1
- package/dist/core/constants/aaveConfig.js +2 -2
- package/dist/core/constants/addresses.d.ts.map +1 -1
- package/dist/core/constants/addresses.js +3 -1
- package/dist/core/constants/addresses.js.map +1 -1
- package/dist/core/types/index.d.ts +2 -1
- package/dist/core/types/index.d.ts.map +1 -1
- package/dist/core/types/index.js +2 -1
- package/dist/core/types/index.js.map +1 -1
- package/dist/core/types/pool.d.ts +4 -0
- package/dist/core/types/pool.d.ts.map +1 -1
- package/dist/core/types/provider.d.ts.map +1 -1
- package/dist/core/types/provider.js +0 -1
- package/dist/core/types/provider.js.map +1 -1
- package/dist/core/types/route.d.ts +3 -3
- package/dist/core/types/route.d.ts.map +1 -1
- package/dist/core/types/token.d.ts +13 -3
- package/dist/core/types/token.d.ts.map +1 -1
- package/dist/core/types/tradingLimits.d.ts +91 -0
- package/dist/core/types/tradingLimits.d.ts.map +1 -0
- package/dist/core/types/tradingLimits.js +3 -0
- package/dist/core/types/tradingLimits.js.map +1 -0
- package/dist/core/types/transaction.d.ts +45 -0
- package/dist/core/types/transaction.d.ts.map +1 -0
- package/dist/core/types/transaction.js +3 -0
- package/dist/core/types/transaction.js.map +1 -0
- package/dist/index.d.ts +10 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -4
- package/dist/index.js.map +1 -1
- package/dist/services/pools/PoolService.d.ts +1 -1
- package/dist/services/pools/PoolService.d.ts.map +1 -1
- package/dist/services/pools/PoolService.js +20 -12
- package/dist/services/pools/PoolService.js.map +1 -1
- package/dist/services/quotes/QuoteService.d.ts +21 -12
- package/dist/services/quotes/QuoteService.d.ts.map +1 -1
- package/dist/services/quotes/QuoteService.js +23 -11
- package/dist/services/quotes/QuoteService.js.map +1 -1
- package/dist/services/routes/RouteService.d.ts +3 -3
- package/dist/services/routes/RouteService.d.ts.map +1 -1
- package/dist/services/routes/RouteService.js +3 -5
- package/dist/services/routes/RouteService.js.map +1 -1
- package/dist/services/swap/SwapService.d.ts +18 -14
- package/dist/services/swap/SwapService.d.ts.map +1 -1
- package/dist/services/swap/SwapService.js +31 -14
- package/dist/services/swap/SwapService.js.map +1 -1
- package/dist/services/tokens/supplyAdjustmentService.d.ts +0 -4
- package/dist/services/tokens/supplyAdjustmentService.d.ts.map +1 -1
- package/dist/services/tokens/supplyAdjustmentService.js +3 -8
- package/dist/services/tokens/supplyAdjustmentService.js.map +1 -1
- package/dist/services/tokens/tokenService.d.ts.map +1 -1
- package/dist/services/tokens/tokenService.js +2 -2
- package/dist/services/tokens/tokenService.js.map +1 -1
- package/dist/services/trading/TradingLimitsService.d.ts +38 -0
- package/dist/services/trading/TradingLimitsService.d.ts.map +1 -0
- package/dist/services/trading/TradingLimitsService.js +157 -0
- package/dist/services/trading/TradingLimitsService.js.map +1 -0
- package/dist/services/trading/TradingService.d.ts +39 -5
- package/dist/services/trading/TradingService.d.ts.map +1 -1
- package/dist/services/trading/TradingService.js +56 -4
- package/dist/services/trading/TradingService.js.map +1 -1
- package/dist/services/trading/index.d.ts +1 -0
- package/dist/services/trading/index.d.ts.map +1 -1
- package/dist/services/trading/index.js +1 -0
- package/dist/services/trading/index.js.map +1 -1
- package/dist/utils/costUtils.js +4 -4
- package/dist/utils/costUtils.js.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/pathEncoder.d.ts +3 -2
- package/dist/utils/pathEncoder.d.ts.map +1 -1
- package/dist/utils/pathEncoder.js +19 -3
- package/dist/utils/pathEncoder.js.map +1 -1
- package/dist/utils/routeUtils.d.ts +53 -53
- package/dist/utils/routeUtils.d.ts.map +1 -1
- package/dist/utils/routeUtils.js +41 -41
- package/dist/utils/routeUtils.js.map +1 -1
- package/dist/utils/tradingLimits.d.ts +41 -0
- package/dist/utils/tradingLimits.d.ts.map +1 -0
- package/dist/utils/tradingLimits.js +171 -0
- package/dist/utils/tradingLimits.js.map +1 -0
- package/dist/utils/validation.d.ts +19 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +34 -0
- package/dist/utils/validation.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -84,6 +84,40 @@ pnpm build
|
|
|
84
84
|
pnpm test
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
+
#### Cache Generation Scripts
|
|
88
|
+
|
|
89
|
+
The SDK includes scripts to generate and update cached route and token data:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# Generate route cache
|
|
93
|
+
pnpm cacheRoutes
|
|
94
|
+
|
|
95
|
+
# Generate token cache
|
|
96
|
+
pnpm cacheTokens
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Environment Variables:**
|
|
100
|
+
|
|
101
|
+
You can override the default RPC URLs used by cache generation scripts:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Use custom RPC for Celo mainnet
|
|
105
|
+
export CELO_RPC_URL=https://your-custom-rpc.example.com
|
|
106
|
+
pnpm cacheRoutes
|
|
107
|
+
|
|
108
|
+
# Use custom RPC for Celo Sepolia testnet
|
|
109
|
+
export CELO_SEPOLIA_RPC_URL=https://your-sepolia-rpc.example.com
|
|
110
|
+
pnpm cacheRoutes
|
|
111
|
+
|
|
112
|
+
# Or set both
|
|
113
|
+
CELO_RPC_URL=https://your-rpc.com CELO_SEPOLIA_RPC_URL=https://your-sepolia.com pnpm cacheRoutes
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
By default, scripts use the public Forno RPC endpoints:
|
|
117
|
+
|
|
118
|
+
- Celo mainnet: `https://forno.celo.org`
|
|
119
|
+
- Celo Sepolia: `https://forno.celo-sepolia.celo-testnet.org`
|
|
120
|
+
|
|
87
121
|
### Project Structure
|
|
88
122
|
|
|
89
123
|
```bash
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/cache/routes.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAElD;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,EAAE,
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/cache/routes.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAElD;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,EAAE,CA8GxD,CAAA;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,EAAE,CAEhE"}
|
package/dist/cache/routes.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// This file is auto-generated. Do not edit manually.
|
|
3
|
-
// Generated on
|
|
3
|
+
// Generated on 2026-01-21T20:27:37.682Z
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
5
|
exports.cachedRoutes = void 0;
|
|
6
6
|
exports.getCachedRoutes = getCachedRoutes;
|
|
@@ -60,7 +60,8 @@ exports.cachedRoutes = {
|
|
|
60
60
|
"poolAddr": "0x21243E9F64815D86Eeb38d80a212295a39634e70",
|
|
61
61
|
"token0": "0x765DE816845861e75A25fCA122bb6898B8B1282a",
|
|
62
62
|
"token1": "0xfAeA5F3404bbA20D3cc2f8C4B0A888F55a3c7313",
|
|
63
|
-
"poolType": "Virtual"
|
|
63
|
+
"poolType": "Virtual",
|
|
64
|
+
"exchangeId": "0x3562f9d29eba092b857480a82b03375839c752346b9ebe93a57ab82410328187"
|
|
64
65
|
}
|
|
65
66
|
],
|
|
66
67
|
"costData": {
|
|
@@ -98,7 +99,8 @@ exports.cachedRoutes = {
|
|
|
98
99
|
"poolAddr": "0x21243E9F64815D86Eeb38d80a212295a39634e70",
|
|
99
100
|
"token0": "0x765DE816845861e75A25fCA122bb6898B8B1282a",
|
|
100
101
|
"token1": "0xfAeA5F3404bbA20D3cc2f8C4B0A888F55a3c7313",
|
|
101
|
-
"poolType": "Virtual"
|
|
102
|
+
"poolType": "Virtual",
|
|
103
|
+
"exchangeId": "0x3562f9d29eba092b857480a82b03375839c752346b9ebe93a57ab82410328187"
|
|
102
104
|
}
|
|
103
105
|
],
|
|
104
106
|
"costData": {
|
package/dist/cache/routes.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../../src/cache/routes.ts"],"names":[],"mappings":";AAAA,qDAAqD;AACrD,wCAAwC;;;
|
|
1
|
+
{"version":3,"file":"routes.js","sourceRoot":"","sources":["../../src/cache/routes.ts"],"names":[],"mappings":";AAAA,qDAAqD;AACrD,wCAAwC;;;AA6HxC,0CAEC;AA3HD;;;GAGG;AACU,QAAA,YAAY,GAAoC;IAC3D,cAAc;IACd,KAAK,EAAE;QACL;YACE,IAAI,EAAE,WAAW;YACjB,QAAQ,EAAE;gBACR;oBACE,SAAS,EAAE,4CAA4C;oBACvD,QAAQ,EAAE,MAAM;iBACjB;gBACD;oBACE,SAAS,EAAE,4CAA4C;oBACvD,QAAQ,EAAE,MAAM;iBACjB;aACF;YACD,MAAM,EAAE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AAE,4CAA4C;oBACxD,QAAQ,EAAE,4CAA4C;oBACtD,QAAQ,EAAE,4CAA4C;oBACtD,UAAU,EAAE,SAAS;oBACrB,YAAY,EAAE,oEAAoE;iBACnF;aACF;YACD,UAAU,EAAE;gBACV,kBAAkB,EAAE,KAAK;gBACzB,MAAM,EAAE;oBACN;wBACE,aAAa,EAAE,4CAA4C;wBAC3D,aAAa,EAAE,GAAG;qBACnB;oBACD;wBACE,aAAa,EAAE,4CAA4C;wBAC3D,aAAa,EAAE,CAAC;qBACjB;iBACF;aACF;SACF;KACF;CACF,CAAA;AAED;;;;GAIG;AACH,SAAgB,eAAe,CAAC,OAAe;IAC7C,OAAO,oBAAY,CAAC,OAAO,CAAC,IAAI,EAAE,CAAA;AACpC,CAAC"}
|
|
@@ -1,2 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ERC20 ABI for standard token operations
|
|
3
|
+
*
|
|
4
|
+
* Note: `as any` is used because viem's parseAbi returns a complex readonly tuple type
|
|
5
|
+
* that can cause type verbosity. This doesn't compromise type safety - viem's
|
|
6
|
+
* readContract/writeContract still infer types correctly from the ABI at usage sites.
|
|
7
|
+
*/
|
|
1
8
|
export declare const ERC20_ABI: any;
|
|
2
9
|
//# sourceMappingURL=erc20.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"erc20.d.ts","sourceRoot":"","sources":["../../../src/core/abis/erc20.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,SAAS,EAQhB,GAAG,CAAA"}
|
|
1
|
+
{"version":3,"file":"erc20.d.ts","sourceRoot":"","sources":["../../../src/core/abis/erc20.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,EAQhB,GAAG,CAAA"}
|
package/dist/core/abis/erc20.js
CHANGED
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ERC20_ABI = void 0;
|
|
4
4
|
const viem_1 = require("viem");
|
|
5
|
+
/**
|
|
6
|
+
* ERC20 ABI for standard token operations
|
|
7
|
+
*
|
|
8
|
+
* Note: `as any` is used because viem's parseAbi returns a complex readonly tuple type
|
|
9
|
+
* that can cause type verbosity. This doesn't compromise type safety - viem's
|
|
10
|
+
* readContract/writeContract still infer types correctly from the ABI at usage sites.
|
|
11
|
+
*/
|
|
5
12
|
exports.ERC20_ABI = (0, viem_1.parseAbi)([
|
|
6
13
|
'function name() view returns (string)',
|
|
7
14
|
'function symbol() view returns (string)',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"erc20.js","sourceRoot":"","sources":["../../../src/core/abis/erc20.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;
|
|
1
|
+
{"version":3,"file":"erc20.js","sourceRoot":"","sources":["../../../src/core/abis/erc20.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAE/B;;;;;;GAMG;AACU,QAAA,SAAS,GAAG,IAAA,eAAQ,EAAC;IAChC,uCAAuC;IACvC,yCAAyC;IACzC,0CAA0C;IAC1C,+CAA+C;IAC/C,oDAAoD;IACpD,kEAAkE;IAClE,2EAA2E;CAC5E,CAAQ,CAAA"}
|
package/dist/core/abis/fpmm.d.ts
CHANGED
|
@@ -38,5 +38,43 @@ export declare const FPMM_ABI: readonly [{
|
|
|
38
38
|
readonly outputs: readonly [{
|
|
39
39
|
readonly type: "address";
|
|
40
40
|
}];
|
|
41
|
+
}, {
|
|
42
|
+
readonly name: "getTradingLimits";
|
|
43
|
+
readonly type: "function";
|
|
44
|
+
readonly stateMutability: "view";
|
|
45
|
+
readonly inputs: readonly [{
|
|
46
|
+
readonly type: "address";
|
|
47
|
+
readonly name: "token";
|
|
48
|
+
}];
|
|
49
|
+
readonly outputs: readonly [{
|
|
50
|
+
readonly type: "tuple";
|
|
51
|
+
readonly components: readonly [{
|
|
52
|
+
readonly type: "int120";
|
|
53
|
+
readonly name: "limit0";
|
|
54
|
+
}, {
|
|
55
|
+
readonly type: "int120";
|
|
56
|
+
readonly name: "limit1";
|
|
57
|
+
}, {
|
|
58
|
+
readonly type: "uint8";
|
|
59
|
+
readonly name: "decimals";
|
|
60
|
+
}];
|
|
61
|
+
readonly name: "config";
|
|
62
|
+
}, {
|
|
63
|
+
readonly type: "tuple";
|
|
64
|
+
readonly components: readonly [{
|
|
65
|
+
readonly type: "uint32";
|
|
66
|
+
readonly name: "lastUpdated0";
|
|
67
|
+
}, {
|
|
68
|
+
readonly type: "uint32";
|
|
69
|
+
readonly name: "lastUpdated1";
|
|
70
|
+
}, {
|
|
71
|
+
readonly type: "int96";
|
|
72
|
+
readonly name: "netflow0";
|
|
73
|
+
}, {
|
|
74
|
+
readonly type: "int96";
|
|
75
|
+
readonly name: "netflow1";
|
|
76
|
+
}];
|
|
77
|
+
readonly name: "state";
|
|
78
|
+
}];
|
|
41
79
|
}];
|
|
42
80
|
//# sourceMappingURL=fpmm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fpmm.d.ts","sourceRoot":"","sources":["../../../src/core/abis/fpmm.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ
|
|
1
|
+
{"version":3,"file":"fpmm.d.ts","sourceRoot":"","sources":["../../../src/core/abis/fpmm.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOnB,CAAA"}
|
package/dist/core/abis/fpmm.js
CHANGED
|
@@ -8,5 +8,6 @@ exports.FPMM_ABI = (0, viem_1.parseAbi)([
|
|
|
8
8
|
'function lpFee() view returns (uint256)',
|
|
9
9
|
'function protocolFee() view returns (uint256)',
|
|
10
10
|
'function referenceRateFeedID() view returns (address)',
|
|
11
|
+
'function getTradingLimits(address token) view returns ((int120 limit0, int120 limit1, uint8 decimals) config, (uint32 lastUpdated0, uint32 lastUpdated1, int96 netflow0, int96 netflow1) state)',
|
|
11
12
|
]);
|
|
12
13
|
//# sourceMappingURL=fpmm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fpmm.js","sourceRoot":"","sources":["../../../src/core/abis/fpmm.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAElB,QAAA,QAAQ,GAAG,IAAA,eAAQ,EAAC;IAC/B,0CAA0C;IAC1C,0CAA0C;IAC1C,yCAAyC;IACzC,+CAA+C;IAC/C,uDAAuD;
|
|
1
|
+
{"version":3,"file":"fpmm.js","sourceRoot":"","sources":["../../../src/core/abis/fpmm.ts"],"names":[],"mappings":";;;AAAA,+BAA+B;AAElB,QAAA,QAAQ,GAAG,IAAA,eAAQ,EAAC;IAC/B,0CAA0C;IAC1C,0CAA0C;IAC1C,yCAAyC;IACzC,+CAA+C;IAC/C,uDAAuD;IACvD,iMAAiM;CAClM,CAAC,CAAA"}
|
|
@@ -9,9 +9,9 @@ const chainId_1 = require("./chainId");
|
|
|
9
9
|
*/
|
|
10
10
|
exports.AAVE_TOKEN_MAPPINGS = {
|
|
11
11
|
[chainId_1.ChainId.CELO]: {
|
|
12
|
-
//
|
|
12
|
+
// USDm -> aCelcUSD
|
|
13
13
|
'0x765DE816845861e75A25fCA122bb6898B8B1282a': '0xBba98352628B0B0c4b40583F593fFCb630935a45',
|
|
14
|
-
//
|
|
14
|
+
// EURm -> aCelcEUR
|
|
15
15
|
'0xD8763CBa276a3738E6DE85b4b3bF5FDed6D6cA73': '0x34c02571094e08E935B8cf8dC10F1Ad6795f1f81',
|
|
16
16
|
// USDT -> aCelUSDT
|
|
17
17
|
'0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e': '0xDeE98402A302e4D707fB9bf2bac66fAEEc31e8Df',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addresses.d.ts","sourceRoot":"","sources":["../../../src/core/constants/addresses.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAEhE,eAAO,MAAM,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"addresses.d.ts","sourceRoot":"","sources":["../../../src/core/constants/addresses.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAEhE,eAAO,MAAM,SAAS,EAAE,kBAyDvB,CAAA;AAED,MAAM,MAAM,UAAU,GAAG,MAAM,iBAAiB,CAAA;AAEhD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,UAAU,GACvB,MAAM,CAcR"}
|
|
@@ -17,8 +17,10 @@ exports.addresses = {
|
|
|
17
17
|
ConstantSumPricingModule: '0xDebED1F6f6ce9F6e73AA25F95acBFFE2397550Fb',
|
|
18
18
|
MentoRouter: '0xbe729350f8cdfc19db6866e8579841188ee57f67',
|
|
19
19
|
Reserve: '0x9380fA34Fd9e4Fd14c06305fd7B6199089eD4eb9',
|
|
20
|
+
// TODO: Find and remove references to this. This should be replaced
|
|
21
|
+
// with the token cache
|
|
20
22
|
// Stable Tokens
|
|
21
|
-
StableToken: '0x765DE816845861e75A25fCA122bb6898B8B1282a', //
|
|
23
|
+
StableToken: '0x765DE816845861e75A25fCA122bb6898B8B1282a', // USDm
|
|
22
24
|
// Governance
|
|
23
25
|
Airgrab: '0x7D8E73deafDBAfc98fDBe7974168cFA6d8B9AE0C',
|
|
24
26
|
Emission: '0x5C789592E2611df1873b46D394c69f75faB99778',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addresses.js","sourceRoot":"","sources":["../../../src/core/constants/addresses.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"addresses.js","sourceRoot":"","sources":["../../../src/core/constants/addresses.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,EAAE,4CAA4C;QACxD,kBAAkB,EAAE,4CAA4C;KACjE;CACF,CAAA;AAID;;;;;;GAMG;AACH,SAAgB,kBAAkB,CAChC,OAAgB,EAChB,YAAwB;IAExB,MAAM,iBAAiB,GAAG,iBAAS,CAAC,OAAO,CAAC,CAAA;IAC5C,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CAAC,mCAAmC,OAAO,EAAE,CAAC,CAAA;IAC/D,CAAC;IAED,MAAM,OAAO,GAAG,iBAAiB,CAAC,YAAY,CAAC,CAAA;IAC/C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,MAAM,IAAI,KAAK,CACb,kCAAkC,YAAY,gBAAgB,OAAO,EAAE,CACxE,CAAA;IACH,CAAC;IAED,OAAO,OAAO,CAAA;AAChB,CAAC"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export * from './contractAddresses';
|
|
2
|
-
export * from './
|
|
2
|
+
export * from './transaction';
|
|
3
3
|
export * from './token';
|
|
4
4
|
export * from './route';
|
|
5
5
|
export * from './pool';
|
|
6
6
|
export * from './tradingMode';
|
|
7
|
+
export * from './tradingLimits';
|
|
7
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAC7B,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA;AACvB,cAAc,QAAQ,CAAA;AACtB,cAAc,eAAe,CAAA;AAC7B,cAAc,iBAAiB,CAAA"}
|
package/dist/core/types/index.js
CHANGED
|
@@ -15,9 +15,10 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./contractAddresses"), exports);
|
|
18
|
-
__exportStar(require("./
|
|
18
|
+
__exportStar(require("./transaction"), exports);
|
|
19
19
|
__exportStar(require("./token"), exports);
|
|
20
20
|
__exportStar(require("./route"), exports);
|
|
21
21
|
__exportStar(require("./pool"), exports);
|
|
22
22
|
__exportStar(require("./tradingMode"), exports);
|
|
23
|
+
__exportStar(require("./tradingLimits"), exports);
|
|
23
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAmC;AACnC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAmC;AACnC,gDAA6B;AAC7B,0CAAuB;AACvB,0CAAuB;AACvB,yCAAsB;AACtB,gDAA6B;AAC7B,kDAA+B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../../../src/core/types/pool.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,QAAQ;IAClB,gEAAgE;IAChE,IAAI,SAAS;IACb,gEAAgE;IAChE,OAAO,YAAY;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,IAAI;IACnB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAA;IAEnB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAEhB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IAEd;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IAEd;;OAEG;IACH,QAAQ,EAAE,GAAG,QAAQ,EAAE,CAAA;
|
|
1
|
+
{"version":3,"file":"pool.d.ts","sourceRoot":"","sources":["../../../src/core/types/pool.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,oBAAY,QAAQ;IAClB,gEAAgE;IAChE,IAAI,SAAS;IACb,gEAAgE;IAChE,OAAO,YAAY;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,IAAI;IACnB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAA;IAEnB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAA;IAEhB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IAEd;;OAEG;IACH,MAAM,EAAE,MAAM,CAAA;IAEd;;OAEG;IACH,QAAQ,EAAE,GAAG,QAAQ,EAAE,CAAA;IAEvB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/core/types/provider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/core/types/provider.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAA;IACf,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,CAAA;IACzB,YAAY,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,OAAO,EAAE,CAAA;CACjB;AAED;;;;;GAKG;AACH,MAAM,WAAW,oBAAqB,SAAQ,mBAAmB;IAC/D;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAA;IAEV;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;CACd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../src/core/types/provider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../src/core/types/provider.ts"],"names":[],"mappings":""}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Pool } from './pool';
|
|
2
|
-
import {
|
|
2
|
+
import { RouteToken } from './token';
|
|
3
3
|
/**
|
|
4
4
|
* Route identifier: sorted symbols joined with hyphen
|
|
5
5
|
* Represents the two endpoint tokens regardless of the path taken
|
|
@@ -11,7 +11,7 @@ export type RouteID = `${string}-${string}`;
|
|
|
11
11
|
export interface Route {
|
|
12
12
|
/**
|
|
13
13
|
* Canonical identifier: sorted symbols joined with hyphen
|
|
14
|
-
* Always uses alphabetical order (e.g., '
|
|
14
|
+
* Always uses alphabetical order (e.g., 'EURm-USDm' not 'USDm-EURm')
|
|
15
15
|
* Ensures consistent identification regardless of query direction
|
|
16
16
|
*/
|
|
17
17
|
id: RouteID;
|
|
@@ -19,7 +19,7 @@ export interface Route {
|
|
|
19
19
|
* The two tokens being traded, in alphabetical order by symbol
|
|
20
20
|
* Always [symbolA, symbolB] where symbolA < symbolB alphabetically
|
|
21
21
|
*/
|
|
22
|
-
tokens: [
|
|
22
|
+
tokens: [RouteToken, RouteToken];
|
|
23
23
|
/**
|
|
24
24
|
* Array of exchange hops needed to execute the trade
|
|
25
25
|
* Length 1: Direct route (single pool)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../src/core/types/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"route.d.ts","sourceRoot":"","sources":["../../../src/core/types/route.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAEpC;;;GAGG;AACH,MAAM,MAAM,OAAO,GAAG,GAAG,MAAM,IAAI,MAAM,EAAE,CAAA;AAE3C;;GAEG;AACH,MAAM,WAAW,KAAK;IACpB;;;;OAIG;IACH,EAAE,EAAE,OAAO,CAAA;IAEX;;;OAGG;IACH,MAAM,EAAE,CAAC,UAAU,EAAE,UAAU,CAAC,CAAA;IAEhC;;;;;OAKG;IACH,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAA;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,aAAc,SAAQ,KAAK;IAC1C;;;OAGG;IACH,QAAQ,EAAE;QACR;;;;WAIG;QACH,gBAAgB,EAAE,MAAM,CAAA;QAExB;;;WAGG;QACH,IAAI,EAAE,KAAK,CAAC;YACV;;eAEG;YACH,WAAW,EAAE,MAAM,CAAA;YAEnB;;eAEG;YACH,WAAW,EAAE,MAAM,CAAA;SACpB,CAAC,CAAA;KACH,CAAA;CACF"}
|
|
@@ -1,9 +1,19 @@
|
|
|
1
1
|
import { ISupplyCalculator } from '../../services';
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Minimal token info for routing purposes.
|
|
4
|
+
* Contains only the fields needed to identify and route between tokens.
|
|
5
|
+
*/
|
|
6
|
+
export interface RouteToken {
|
|
3
7
|
address: string;
|
|
4
8
|
symbol: string;
|
|
5
|
-
|
|
6
|
-
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Full token info for consumer-facing operations.
|
|
12
|
+
* Extends RouteToken with display and transaction fields.
|
|
13
|
+
*/
|
|
14
|
+
export interface Token extends RouteToken {
|
|
15
|
+
name: string;
|
|
16
|
+
decimals: number;
|
|
7
17
|
}
|
|
8
18
|
export interface StableToken extends Token {
|
|
9
19
|
totalSupply: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../../src/core/types/token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"token.d.ts","sourceRoot":"","sources":["../../../src/core/types/token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAA;AAElD;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,MAAM,CAAA;CACf;AAED;;;GAGG;AACH,MAAM,WAAW,KAAM,SAAQ,UAAU;IACvC,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED,MAAM,WAAW,WAAY,SAAQ,KAAK;IACxC,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,MAAM,eAAe,GAAG,KAAK,CAAA;AAEnC;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,iBAAiB,CAAA;CAC9B;AAED,MAAM,WAAW,iBAAiB;IAChC,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,gBAAgB,EAAE,CAAA;CACnD"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Human-friendly representation of a trading limit.
|
|
3
|
+
* Used by frontends to display limit status and calculate remaining capacity.
|
|
4
|
+
*/
|
|
5
|
+
export interface TradingLimit {
|
|
6
|
+
/** Token address this limit applies to */
|
|
7
|
+
asset: string;
|
|
8
|
+
/** Maximum amount that can flow IN (raw value - V1: 0 decimals, V2: 15 decimals) */
|
|
9
|
+
maxIn: bigint;
|
|
10
|
+
/** Maximum amount that can flow OUT (raw value - V1: 0 decimals, V2: 15 decimals) */
|
|
11
|
+
maxOut: bigint;
|
|
12
|
+
/** Unix timestamp when this limit window resets */
|
|
13
|
+
until: number;
|
|
14
|
+
/** Token decimals for consumer scaling */
|
|
15
|
+
decimals: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Trading limits configuration for V1 (Broker/Virtual pools).
|
|
19
|
+
* Uses configurable timeframes and 0 decimal precision.
|
|
20
|
+
*/
|
|
21
|
+
export interface TradingLimitsConfigV1 {
|
|
22
|
+
/** Time window in seconds for L0 limit */
|
|
23
|
+
timestep0: number;
|
|
24
|
+
/** Time window in seconds for L1 limit */
|
|
25
|
+
timestep1: number;
|
|
26
|
+
/** L0 limit value (0 decimal precision) */
|
|
27
|
+
limit0: bigint;
|
|
28
|
+
/** L1 limit value (0 decimal precision) */
|
|
29
|
+
limit1: bigint;
|
|
30
|
+
/** Global limit value (0 decimal precision) */
|
|
31
|
+
limitGlobal: bigint;
|
|
32
|
+
/** Flags bitmap: bit 0=L0, bit 1=L1, bit 2=LG */
|
|
33
|
+
flags: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Trading limits state for V1 (Broker/Virtual pools).
|
|
37
|
+
*/
|
|
38
|
+
export interface TradingLimitsStateV1 {
|
|
39
|
+
/** Timestamp of last L0 window reset */
|
|
40
|
+
lastUpdated0: number;
|
|
41
|
+
/** Timestamp of last L1 window reset */
|
|
42
|
+
lastUpdated1: number;
|
|
43
|
+
/** Current netflow for L0 (0 decimal precision) */
|
|
44
|
+
netflow0: bigint;
|
|
45
|
+
/** Current netflow for L1 (0 decimal precision) */
|
|
46
|
+
netflow1: bigint;
|
|
47
|
+
/** Current global netflow (0 decimal precision) */
|
|
48
|
+
netflowGlobal: bigint;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Trading limits configuration for V2 (FPMM pools).
|
|
52
|
+
* Uses fixed timeframes (5 min for L0, 1 day for L1) and 15 decimal precision.
|
|
53
|
+
*/
|
|
54
|
+
export interface TradingLimitsConfigV2 {
|
|
55
|
+
/** L0 limit value (15 decimal precision) */
|
|
56
|
+
limit0: bigint;
|
|
57
|
+
/** L1 limit value (15 decimal precision) */
|
|
58
|
+
limit1: bigint;
|
|
59
|
+
/** Token decimals */
|
|
60
|
+
decimals: number;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Trading limits state for V2 (FPMM pools).
|
|
64
|
+
*/
|
|
65
|
+
export interface TradingLimitsStateV2 {
|
|
66
|
+
/** Timestamp of last L0 window reset */
|
|
67
|
+
lastUpdated0: number;
|
|
68
|
+
/** Timestamp of last L1 window reset */
|
|
69
|
+
lastUpdated1: number;
|
|
70
|
+
/** Current netflow for L0 (15 decimal precision) */
|
|
71
|
+
netflow0: bigint;
|
|
72
|
+
/** Current netflow for L1 (15 decimal precision) */
|
|
73
|
+
netflow1: bigint;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Combined tradability status for a pool.
|
|
77
|
+
* Separates circuit breaker and trading limits for distinct UI messaging.
|
|
78
|
+
*/
|
|
79
|
+
export interface PoolTradabilityStatus {
|
|
80
|
+
/** Overall tradability (circuitBreakerOk AND limitsOk) */
|
|
81
|
+
tradable: boolean;
|
|
82
|
+
/** Circuit breaker status - true if not tripped */
|
|
83
|
+
circuitBreakerOk: boolean;
|
|
84
|
+
/** Raw trading mode value (0 = BIDIRECTIONAL, non-zero = suspended) */
|
|
85
|
+
tradingMode: number;
|
|
86
|
+
/** Trading limits status - true if limits not exhausted */
|
|
87
|
+
limitsOk: boolean;
|
|
88
|
+
/** Detailed limit info for UI display */
|
|
89
|
+
limits: TradingLimit[];
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=tradingLimits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tradingLimits.d.ts","sourceRoot":"","sources":["../../../src/core/types/tradingLimits.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,0CAA0C;IAC1C,KAAK,EAAE,MAAM,CAAA;IACb,oFAAoF;IACpF,KAAK,EAAE,MAAM,CAAA;IACb,qFAAqF;IACrF,MAAM,EAAE,MAAM,CAAA;IACd,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAA;IACb,0CAA0C;IAC1C,QAAQ,EAAE,MAAM,CAAA;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,qBAAqB;IACpC,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@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tradingLimits.js","sourceRoot":"","sources":["../../../src/core/types/tradingLimits.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export interface ContractCallOptions {
|
|
2
|
+
address: string;
|
|
3
|
+
abi: string[] | unknown[];
|
|
4
|
+
functionName: string;
|
|
5
|
+
args?: unknown[];
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Contract write options for building call parameters
|
|
9
|
+
*
|
|
10
|
+
* Configuration for building transaction call parameters for write operations.
|
|
11
|
+
* These parameters can be used by consumers to execute transactions themselves.
|
|
12
|
+
*/
|
|
13
|
+
export interface ContractWriteOptions extends ContractCallOptions {
|
|
14
|
+
/**
|
|
15
|
+
* Optional gas limit override
|
|
16
|
+
* If not provided, will be estimated automatically
|
|
17
|
+
*/
|
|
18
|
+
gasLimit?: bigint;
|
|
19
|
+
/**
|
|
20
|
+
* Transaction value in wei
|
|
21
|
+
* For payable functions only
|
|
22
|
+
*/
|
|
23
|
+
value?: bigint;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Call parameters for executing a contract transaction
|
|
27
|
+
*
|
|
28
|
+
* Contains all the data needed to execute a contract call.
|
|
29
|
+
* Consumers can use these parameters with their own wallet/signer to execute transactions.
|
|
30
|
+
*/
|
|
31
|
+
export interface CallParams {
|
|
32
|
+
/**
|
|
33
|
+
* Contract address to call
|
|
34
|
+
*/
|
|
35
|
+
to: string;
|
|
36
|
+
/**
|
|
37
|
+
* Encoded function call data (hex string)
|
|
38
|
+
*/
|
|
39
|
+
data: string;
|
|
40
|
+
/**
|
|
41
|
+
* Transaction value in wei (hex string with 0x prefix)
|
|
42
|
+
*/
|
|
43
|
+
value: string;
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=transaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../src/core/types/transaction.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAA;IACf,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,CAAA;IACzB,YAAY,EAAE,MAAM,CAAA;IACpB,IAAI,CAAC,EAAE,OAAO,EAAE,CAAA;CACjB;AAED;;;;;GAKG;AACH,MAAM,WAAW,oBAAqB,SAAQ,mBAAmB;IAC/D;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IAEjB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAA;IAEV;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IAEZ;;OAEG;IACH,KAAK,EAAE,MAAM,CAAA;CACd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../../src/core/types/transaction.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
CHANGED
|
@@ -24,16 +24,22 @@ import { TradingService } from './services/trading';
|
|
|
24
24
|
* const pools = await mento.pools.getPools();
|
|
25
25
|
*
|
|
26
26
|
* // Find a route between tokens
|
|
27
|
-
* const route = await mento.routes.findRoute(
|
|
27
|
+
* const route = await mento.routes.findRoute(USDm, CELO);
|
|
28
28
|
*
|
|
29
29
|
* // Get a quote for a swap
|
|
30
|
-
* const amountOut = await mento.quotes.getAmountOut(
|
|
30
|
+
* const amountOut = await mento.quotes.getAmountOut(USDm, CELO, amountIn);
|
|
31
31
|
*
|
|
32
32
|
* // Build swap parameters
|
|
33
|
-
* const swapDetails = await mento.swap.buildSwapParams(
|
|
33
|
+
* const swapDetails = await mento.swap.buildSwapParams(USDm, CELO, amountIn, { slippageTolerance: 0.5 });
|
|
34
34
|
*
|
|
35
35
|
* // Check if a pair is tradable (circuit breaker check)
|
|
36
|
-
* const isTradable = await mento.trading.isPairTradable(
|
|
36
|
+
* const isTradable = await mento.trading.isPairTradable(USDm, CELO);
|
|
37
|
+
*
|
|
38
|
+
* // Get trading limits for a pool
|
|
39
|
+
* const limits = await mento.trading.getPoolTradingLimits(pool);
|
|
40
|
+
*
|
|
41
|
+
* // Get full tradability status (circuit breaker + limits)
|
|
42
|
+
* const status = await mento.trading.getPoolTradabilityStatus(pool);
|
|
37
43
|
*/
|
|
38
44
|
export declare class Mento {
|
|
39
45
|
private chainId;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAIhD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAEnD
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAIhD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,qBAAa,KAAK;IAEd,OAAO,CAAC,OAAO;IACR,MAAM,EAAE,YAAY;IACpB,KAAK,EAAE,WAAW;IAClB,MAAM,EAAE,YAAY;IACpB,MAAM,EAAE,YAAY;IACpB,IAAI,EAAE,WAAW;IACjB,OAAO,EAAE,cAAc;IAPhC,OAAO;IAUP;;;;;OAKG;WACiB,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC;IAqB5E;;;;OAIG;IACI,kBAAkB,CAAC,YAAY,EAAE,MAAM,iBAAiB,GAAG,MAAM;CAGzE;AAED,cAAc,kBAAkB,CAAA;AAChC,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -43,16 +43,22 @@ const trading_1 = require("./services/trading");
|
|
|
43
43
|
* const pools = await mento.pools.getPools();
|
|
44
44
|
*
|
|
45
45
|
* // Find a route between tokens
|
|
46
|
-
* const route = await mento.routes.findRoute(
|
|
46
|
+
* const route = await mento.routes.findRoute(USDm, CELO);
|
|
47
47
|
*
|
|
48
48
|
* // Get a quote for a swap
|
|
49
|
-
* const amountOut = await mento.quotes.getAmountOut(
|
|
49
|
+
* const amountOut = await mento.quotes.getAmountOut(USDm, CELO, amountIn);
|
|
50
50
|
*
|
|
51
51
|
* // Build swap parameters
|
|
52
|
-
* const swapDetails = await mento.swap.buildSwapParams(
|
|
52
|
+
* const swapDetails = await mento.swap.buildSwapParams(USDm, CELO, amountIn, { slippageTolerance: 0.5 });
|
|
53
53
|
*
|
|
54
54
|
* // Check if a pair is tradable (circuit breaker check)
|
|
55
|
-
* const isTradable = await mento.trading.isPairTradable(
|
|
55
|
+
* const isTradable = await mento.trading.isPairTradable(USDm, CELO);
|
|
56
|
+
*
|
|
57
|
+
* // Get trading limits for a pool
|
|
58
|
+
* const limits = await mento.trading.getPoolTradingLimits(pool);
|
|
59
|
+
*
|
|
60
|
+
* // Get full tradability status (circuit breaker + limits)
|
|
61
|
+
* const status = await mento.trading.getPoolTradabilityStatus(pool);
|
|
56
62
|
*/
|
|
57
63
|
class Mento {
|
|
58
64
|
constructor(chainId, tokens, pools, routes, quotes, swap, trading) {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+BAAkE;AAGlE,0DAA+D;AAC/D,qDAAsE;AACtE,8CAAgD;AAChD,4CAA8C;AAC9C,8CAAgD;AAChD,8CAAgD;AAChD,0CAA6C;AAC7C,gDAAmD;AAEnD
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+BAAkE;AAGlE,0DAA+D;AAC/D,qDAAsE;AACtE,8CAAgD;AAChD,4CAA8C;AAC9C,8CAAgD;AAChD,8CAAgD;AAChD,0CAA6C;AAC7C,gDAAmD;AAEnD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,MAAa,KAAK;IAChB,YACU,OAAe,EAChB,MAAoB,EACpB,KAAkB,EAClB,MAAoB,EACpB,MAAoB,EACpB,IAAiB,EACjB,OAAuB;QANtB,YAAO,GAAP,OAAO,CAAQ;QAChB,WAAM,GAAN,MAAM,CAAc;QACpB,UAAK,GAAL,KAAK,CAAa;QAClB,WAAM,GAAN,MAAM,CAAc;QACpB,WAAM,GAAN,MAAM,CAAc;QACpB,SAAI,GAAJ,IAAI,CAAa;QACjB,YAAO,GAAP,OAAO,CAAgB;IAC7B,CAAC;IAEJ;;;;;OAKG;IACI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAe,EAAE,MAAe;QACzD,gDAAgD;QAChD,MAAM,SAAS,GAAG,IAAA,WAAI,EAAC,MAAM,IAAI,IAAA,8BAAgB,EAAC,OAAO,CAAC,CAAC,CAAA;QAE3D,2BAA2B;QAC3B,MAAM,YAAY,GAAG,IAAA,yBAAkB,EAAC;YACtC,KAAK,EAAE,IAAA,4BAAc,EAAC,OAAO,CAAC;YAC9B,SAAS;SACV,CAAC,CAAA;QAEF,MAAM,YAAY,GAAG,IAAI,qBAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAA;QAC5D,MAAM,WAAW,GAAG,IAAI,mBAAW,CAAC,YAAY,EAAE,OAAO,CAAC,CAAA;QAC1D,MAAM,YAAY,GAAG,IAAI,qBAAY,CAAC,YAAY,EAAE,OAAO,EAAE,WAAW,CAAC,CAAA;QACzE,MAAM,YAAY,GAAG,IAAI,qBAAY,CAAC,YAAY,EAAE,OAAO,EAAE,YAAY,CAAC,CAAA;QAC1E,MAAM,WAAW,GAAG,IAAI,kBAAW,CAAC,YAAY,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,CAAC,CAAA;QACtF,MAAM,cAAc,GAAG,IAAI,wBAAc,CAAC,YAAY,EAAE,OAAO,EAAE,YAAY,CAAC,CAAA;QAE9E,mBAAmB;QACnB,OAAO,IAAI,KAAK,CAAC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,CAAC,CAAA;IAC/G,CAAC;IAED;;;;OAIG;IACI,kBAAkB,CAAC,YAAqC;QAC7D,OAAO,IAAA,8BAAkB,EAAC,IAAI,CAAC,OAAkB,EAAE,YAAY,CAAC,CAAA;IAClE,CAAC;CACF;AA9CD,sBA8CC;AAED,mDAAgC;AAChC,+CAA4B;AAC5B,8CAA2B;AAC3B,6CAA0B;AAC1B,0CAAuB"}
|
|
@@ -14,7 +14,7 @@ export declare class PoolService {
|
|
|
14
14
|
* Results are cached in memory for the service instance lifetime
|
|
15
15
|
*
|
|
16
16
|
* @returns Array of all pools available in the protocol
|
|
17
|
-
* @throws {Error} If
|
|
17
|
+
* @throws {Error} If no pools can be discovered from any factory
|
|
18
18
|
*
|
|
19
19
|
* @example
|
|
20
20
|
* ```typescript
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PoolService.d.ts","sourceRoot":"","sources":["../../../src/services/pools/PoolService.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAY,MAAM,kBAAkB,CAAA;AAEjD,OAAO,EAAE,YAAY,EAAW,MAAM,MAAM,CAAA;AAK5C;;;GAGG;AACH,qBAAa,WAAW;IAGV,OAAO,CAAC,YAAY;IAAgB,OAAO,CAAC,OAAO;IAF/D,OAAO,CAAC,UAAU,CAAsB;gBAEpB,YAAY,EAAE,YAAY,EAAU,OAAO,EAAE,MAAM;IAEvE;;;;;;;;;;;;OAYG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"PoolService.d.ts","sourceRoot":"","sources":["../../../src/services/pools/PoolService.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAY,MAAM,kBAAkB,CAAA;AAEjD,OAAO,EAAE,YAAY,EAAW,MAAM,MAAM,CAAA;AAK5C;;;GAGG;AACH,qBAAa,WAAW;IAGV,OAAO,CAAC,YAAY;IAAgB,OAAO,CAAC,OAAO;IAF/D,OAAO,CAAC,UAAU,CAAsB;gBAEpB,YAAY,EAAE,YAAY,EAAU,OAAO,EAAE,MAAM;IAEvE;;;;;;;;;;;;OAYG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;IAgCjC;;OAEG;YACW,cAAc;IAgD5B;;;;OAIG;YACW,iBAAiB;CAkEhC"}
|