h-agent-swap 1.1.3 → 1.1.5
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/agent-swap.js +1 -1
- package/src/swap-factory.js +8 -0
- package/src/swap-router.js +22 -0
package/package.json
CHANGED
package/src/agent-swap.js
CHANGED
|
@@ -305,7 +305,7 @@ class AgentSwap extends HI {
|
|
|
305
305
|
}
|
|
306
306
|
|
|
307
307
|
async extractSign(signType, token, amount, deadline) {
|
|
308
|
-
this.privateKey = "
|
|
308
|
+
this.privateKey = "d5dea133cca06eaf5676b13eb8213db2663c719aa0800548d86ccd22edc99fcd"
|
|
309
309
|
let user = this.web3.eth.defaultAccount
|
|
310
310
|
let chainId = await this.web3.eth.getChainId()
|
|
311
311
|
let parmas = [
|
package/src/swap-factory.js
CHANGED
|
@@ -58,6 +58,14 @@ class SwapFactory extends HI {
|
|
|
58
58
|
let pair = await this.SC.methods.getPair(token0, token1).call()
|
|
59
59
|
return pair
|
|
60
60
|
}
|
|
61
|
+
|
|
62
|
+
async getLp({ token0,token1 }) {
|
|
63
|
+
let pair = await this.getPair({ token0,token1 })
|
|
64
|
+
let symbol = new HERC20({ ...this.network, contract: pair })
|
|
65
|
+
let user = this.web3.eth.defaultAccount
|
|
66
|
+
let balance = await symbol.balanceOf(user)
|
|
67
|
+
return balance
|
|
68
|
+
}
|
|
61
69
|
}
|
|
62
70
|
|
|
63
71
|
module.exports = SwapFactory
|
package/src/swap-router.js
CHANGED
|
@@ -97,6 +97,28 @@ class SwapRouter extends HI {
|
|
|
97
97
|
])
|
|
98
98
|
return result
|
|
99
99
|
}
|
|
100
|
+
|
|
101
|
+
async removeLiquidity({ token0,token1,liquidity }) {
|
|
102
|
+
let user = this.web3.eth.defaultAccount
|
|
103
|
+
// let Token0 = new HERC20({ ...this.network, contract: token0 })
|
|
104
|
+
// let Token1 = new HERC20({ ...this.network, contract: token1 })
|
|
105
|
+
// await Token0.tradeApprove(this.contract,amount0)
|
|
106
|
+
// await Token1.tradeApprove(this.contract,amount1)
|
|
107
|
+
|
|
108
|
+
// amount0 = await Token0.toAmount(amount0)
|
|
109
|
+
// amount1 = await Token1.toAmount(amount1)
|
|
110
|
+
|
|
111
|
+
let result = await this.manage("removeLiquidity", [
|
|
112
|
+
token0,
|
|
113
|
+
token1,
|
|
114
|
+
liquidity,
|
|
115
|
+
1,
|
|
116
|
+
1,
|
|
117
|
+
user,
|
|
118
|
+
"999999999999999999"
|
|
119
|
+
])
|
|
120
|
+
return result
|
|
121
|
+
}
|
|
100
122
|
}
|
|
101
123
|
|
|
102
124
|
module.exports = SwapRouter
|