add deposit ether
MODIFY
src/index.ts
src/index.ts
@@ -110,6 +110,16 @@ export default class Matic extends ContractsBase {
return this.web3Client.send(txObject, _options)
}
+ depositEther(
+ amount: BN | string,
+ options?: SendOptions,
+ ) {
+ if (options && (!options.from || !amount )) {
+ throw new Error('options.from or amount is missing')
+ }
+ return this.depositManager.depositEther(amount, options)
+ }
+
approveERC20TokensForDeposit(
token: address,
amount: BN | string,

MODIFY
src/root/DepositManager.ts
src/root/DepositManager.ts
@@ -132,10 +132,37 @@ export default class DepositManager extends ContractsBase {
)
}
- depositEther(amount: string, options: SendOptions = {}) {
+ // async depositEther(amount: BN | string, options: SendOptions = {}) {
+
+ // const txObject = this.depositManagerContract.methods.depositEther()
+
+ // const _options = await this._fillOptions(
+ // options,
+ // txObject,
+ // this.web3Client.getParentWeb3(),
+ // )
+
+ // if (options.encodeAbi) {
+ // _options.data = txObject.encodeABI()
+ // _options.to = this.depositManagerContract.options.address
+ // return _options
+ // }
+
+ // return this.web3Client.send(txObject, Object.assign(_options, { value: this.encode(amount), parent: true }))
+ // }
+
+ async depositEther(amount: BN | string, options: SendOptions = {}) {
+ const txObject = this.depositManagerContract.methods.depositEther()
+
+ const _options = await this._fillOptions(
+ options,
+ txObject,
+ this.web3Client.getParentWeb3(),
+ )
+
return this.web3Client.send(
- this.depositManagerContract.methods.depositEther(),
- Object.assign(options, { value: amount }),
+ txObject,
+ Object.assign(_options, { value: amount }),
)
}

add deposit ether