h-agent-swap 1.1.5 → 1.1.8
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/package.json +1 -1
- package/src/swap-router.js +10 -0
package/package.json
CHANGED
package/src/swap-router.js
CHANGED
|
@@ -108,6 +108,16 @@ class SwapRouter extends HI {
|
|
|
108
108
|
// amount0 = await Token0.toAmount(amount0)
|
|
109
109
|
// amount1 = await Token1.toAmount(amount1)
|
|
110
110
|
|
|
111
|
+
let factory = new SwapFactory({
|
|
112
|
+
...this.network,
|
|
113
|
+
contract:this.factory
|
|
114
|
+
})
|
|
115
|
+
let pair = await factory.getPair({ token0,token1 })
|
|
116
|
+
let token = new HERC20({ ...this.network, contract: pair })
|
|
117
|
+
|
|
118
|
+
let liquidityAmount = await token.fromAmount(liquidity)
|
|
119
|
+
await token.tradeApprove(this.contract,liquidityAmount)
|
|
120
|
+
|
|
111
121
|
let result = await this.manage("removeLiquidity", [
|
|
112
122
|
token0,
|
|
113
123
|
token1,
|