@dhedge/v2-sdk 1.5.1 → 1.5.2
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/services/toros/easySwapper.d.ts +1 -1
- package/dist/v2-sdk.cjs.development.js +22 -11
- package/dist/v2-sdk.cjs.development.js.map +1 -1
- package/dist/v2-sdk.cjs.production.min.js +1 -1
- package/dist/v2-sdk.cjs.production.min.js.map +1 -1
- package/dist/v2-sdk.esm.js +22 -11
- package/dist/v2-sdk.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/services/toros/easySwapper.ts +12 -2
package/package.json
CHANGED
|
@@ -8,10 +8,16 @@ import { isPool, loadPool } from "./pool";
|
|
|
8
8
|
|
|
9
9
|
export async function getPoolDepositAsset(
|
|
10
10
|
pool: Pool,
|
|
11
|
-
poolAddress: string
|
|
11
|
+
poolAddress: string,
|
|
12
|
+
investAsset: string
|
|
12
13
|
): Promise<string | undefined> {
|
|
13
14
|
const torosPool = await loadPool(pool, poolAddress);
|
|
14
15
|
const composition = await torosPool.getComposition();
|
|
16
|
+
if (
|
|
17
|
+
composition.find(e => e.asset.toLowerCase() === investAsset.toLowerCase())
|
|
18
|
+
?.isDeposit
|
|
19
|
+
)
|
|
20
|
+
return investAsset;
|
|
15
21
|
return composition.find(e => e.isDeposit)?.asset;
|
|
16
22
|
}
|
|
17
23
|
|
|
@@ -90,7 +96,11 @@ export async function getEasySwapperTxData(
|
|
|
90
96
|
minAmountOut.mul(10000 - slippage * 100).div(10000)
|
|
91
97
|
]);
|
|
92
98
|
} else {
|
|
93
|
-
const depositAsset = await getPoolDepositAsset(
|
|
99
|
+
const depositAsset = await getPoolDepositAsset(
|
|
100
|
+
pool,
|
|
101
|
+
torosAsset,
|
|
102
|
+
investAsset
|
|
103
|
+
);
|
|
94
104
|
if (!depositAsset) throw new Error("no deposit assets");
|
|
95
105
|
const minAmountOut = await getEasySwapperDepositQuote(
|
|
96
106
|
pool,
|