Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@maticnetwork/maticjs-ethers

Package Overview
Dependencies
Maintainers
4
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@maticnetwork/maticjs-ethers - npm Package Compare versions

Comparing version 1.1.0-beta.2 to 1.1.0-beta.3

16

dist/matic-ethers.node.js

@@ -311,12 +311,13 @@ module.exports =

_this.name = 'ETHER';
if (provider._isProvider) {
if (provider instanceof ethers__WEBPACK_IMPORTED_MODULE_0__["ethers"].providers.Web3Provider) {
_this.provider = provider;
_this.signer = _this.provider.getSigner();
if (!_this.signer || !_this.signer._address) {
_this.signer = provider;
}
_this.signer = provider.getSigner();
}
else if (provider instanceof ethers__WEBPACK_IMPORTED_MODULE_0__["ethers"].providers.JsonRpcProvider) {
_this.provider = provider;
_this.signer = provider;
}
else {
_this.signer = provider;
_this.provider = (provider.provider ? provider.provider : provider);
_this.provider = provider.provider || provider;
}

@@ -345,5 +346,2 @@ return _this;

EtherWeb3Client.prototype.getChainId = function () {
if (this.signer.getChainId) {
return this.signer.getChainId();
}
return this.provider.getNetwork().then(function (res) {

@@ -350,0 +348,0 @@ return res.chainId;

@@ -1,2 +0,2 @@

module.exports=function(t){var r={};function n(e){if(r[e])return r[e].exports;var o=r[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=r,n.d=function(t,r,e){n.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:e})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,r){if(1&r&&(t=n(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(n.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var o in t)n.d(e,o,function(r){return t[r]}.bind(null,o));return e},n.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(r,"a",r),r},n.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},n.p="",n(n.s=2)}([function(t,r){t.exports=require("ethers")},function(t,r){t.exports=require("@maticnetwork/maticjs")},function(t,r,n){"use strict";n.r(r),n.d(r,"Web3ClientPlugin",(function(){return _})),n.d(r,"EtherWeb3Client",(function(){return b})),n.d(r,"ContractMethod",(function(){return l}));var e,o=n(0),i=n(1),u=function(){},s=function(t){var r=t;return r.gasUsed=t.gasUsed.toNumber(),r.cumulativeGasUsed=t.cumulativeGasUsed.toNumber(),r},a=function(t){var r=t;return r.gasPrice=t.gasPrice.toString(),r.gas=t.gasLimit.toNumber(),r.gasLimit=t.gasLimit.toNumber(),r.value=t.value.toString(),r.transactionHash=t.hash,r},c=(e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)r.hasOwnProperty(n)&&(t[n]=r[n])})(t,r)},function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}),f=function(t){function r(r){var n=t.call(this)||this;return n.bn_=o.BigNumber.from(r),n}return c(r,t),r.isBN=function(t){return t instanceof r||o.BigNumber.isBigNumber(t)},r.prototype.toString=function(t){if(16===t){var r=this.bn_.toHexString();return 0===(r=o.utils.hexStripZeros(r)).indexOf("0x")?r.slice(2):r}return this.bn_.toString()},r.prototype.toNumber=function(){return this.bn_.toNumber()},r.prototype.toBuffer=function(){return this.bn_.toBuffer()},r.prototype.add=function(t){return new r(this.bn_.add(o.BigNumber.from(t.toString())))},r.prototype.sub=function(t){return new r(this.bn_.sub(o.BigNumber.from(t.toString())))},r.prototype.mul=function(t){return new r(this.bn_.mul(o.BigNumber.from(t.toString())))},r.prototype.div=function(t){return new r(this.bn_.div(o.BigNumber.from(t.toString())))},r.prototype.lte=function(t){return this.bn_.lte(o.BigNumber.from(t.toString()))},r.prototype.lt=function(t){return this.bn_.lt(o.BigNumber.from(t.toString()))},r.prototype.gte=function(t){return this.bn_.gte(o.BigNumber.from(t.toString()))},r.prototype.gt=function(t){return this.bn_.gt(o.BigNumber.from(t.toString()))},r.prototype.eq=function(t){return this.bn_.eq(o.BigNumber.from(t.toString()))},r}(i.BaseBigNumber),p=function(){function t(t){var r=this;this.promise=t,this.onTransactionHash=u,this.onTransactionError=u,t.then((function(t){r.onTransactionHash(t.hash),setTimeout((function(){r.onTransactionReceipt&&t.wait().then((function(t){r.onTransactionReceipt(t)}))}),0)})).catch((function(t){r.onTransactionError(t)}))}return t.prototype.getReceipt=function(){var t=this;return new Promise((function(r,n){t.onTransactionReceipt=r,t.onTransactionError=n})).then((function(t){return s(t)}))},t.prototype.getTransactionHash=function(){var t=this;return new Promise((function(r,n){t.onTransactionHash=r,t.onTransactionError=n}))},t}(),h=function(){var t=function(r,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)r.hasOwnProperty(n)&&(t[n]=r[n])})(r,n)};return function(r,n){function e(){this.constructor=r}t(r,n),r.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}}(),g=function(){for(var t=0,r=0,n=arguments.length;r<n;r++)t+=arguments[r].length;var e=Array(t),o=0;for(r=0;r<n;r++)for(var i=arguments[r],u=0,s=i.length;u<s;u++,o++)e[o]=i[u];return e},l=function(t){function r(r,n,e,o){var i=t.call(this,r)||this;return i.contract_=n,i.methodName=e,i.args=o,i}return h(r,t),Object.defineProperty(r.prototype,"address",{get:function(){return this.contract_.address},enumerable:!1,configurable:!0}),r.prototype.toBigNumber=function(t){return t?o.BigNumber.from(t):t},r.prototype.toConfig_=function(t){void 0===t&&(t={});var r=this.toBigNumber;return{to:t.to,from:t.from,gasPrice:r(t.gasPrice),gasLimit:r(t.gasLimit),value:r(t.value),nonce:t.nonce,data:t.data,type:t.type,maxFeePerGas:r(t.maxFeePerGas),maxPriorityFeePerGas:r(t.maxPriorityFeePerGas)}},r.prototype.encodeABI=function(){return this.contract_.interface.encodeFunctionData(this.methodName,this.args)},r.prototype.estimateGas=function(t){var r;return void 0===t&&(t={}),(r=this.contract_.estimateGas)[this.methodName].apply(r,g(this.args,[this.toConfig_(t)])).then((function(t){return t.toNumber()}))},r.prototype.read=function(t){return this.logger.log("sending tx with config",t),this.getMethod_(t).then((function(t){return t._isBigNumber&&(t=t.toString()),t}))},r.prototype.getMethod_=function(t){var r;return void 0===t&&(t={}),(r=this.contract_)[this.methodName].apply(r,g(this.args,[this.toConfig_(t)]))},r.prototype.write=function(t){return this.logger.log("sending tx with config",t),new p(this.getMethod_(t))},r}(i.BaseContractMethod),d=function(){var t=function(r,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)r.hasOwnProperty(n)&&(t[n]=r[n])})(r,n)};return function(r,n){function e(){this.constructor=r}t(r,n),r.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}}(),m=function(t){function r(r,n,e){var o=t.call(this,r,e)||this;return o.contract=n,o}return d(r,t),r.prototype.method=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return this.logger.log("args method",arguments),new l(this.logger,this.contract,t,r)},r}(i.BaseContract),y=function(){var t=function(r,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)r.hasOwnProperty(n)&&(t[n]=r[n])})(r,n)};return function(r,n){function e(){this.constructor=r}t(r,n),r.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}}(),b=function(t){function r(r,n){var e=t.call(this,n)||this;return e.name="ETHER",r._isProvider?(e.provider=r,e.signer=e.provider.getSigner(),e.signer&&e.signer._address||(e.signer=r)):(e.signer=r,e.provider=r.provider?r.provider:r),e}return y(r,t),r.prototype.getBlock=function(t){return this.provider.getBlock(t).then((function(t){return t}))},r.prototype.getBlockWithTransaction=function(t){var r=this.provider;return r.send("eth_getBlockByNumber",[o.utils.hexValue(t),!0]).then((function(t){var n=r.formatter.blockWithTransactions(t);return n.stateRoot=r.formatter.hash(t.stateRoot),n.transactionsRoot=r.formatter.hash(t.transactionsRoot),n.receiptsRoot=r.formatter.hash(t.receiptsRoot),n.transactions=n.transactions.map((function(t){return a(t)})),function(t){return t.gasUsed=t.gasUsed.toNumber(),t.gasLimit=t.gasLimit.toNumber(),t.baseFeePerGas&&(t.baseFeePerGas=t.baseFeePerGas.toHexString()),t}(n)}))},r.prototype.getChainId=function(){return this.signer.getChainId?this.signer.getChainId():this.provider.getNetwork().then((function(t){return t.chainId}))},r.prototype.getBalance=function(t){return this.provider.getBalance(t).then((function(t){return t.toString()}))},r.prototype.getAccounts=function(){return this.signer.getAddress().then((function(t){return[t]}))},r.prototype.ensureTransactionNotNull_=function(t){if(!t)throw{type:"invalid_transaction",message:"Could not retrieve transaction. Either it is invalid or might be in archive node."}},r.prototype.getTransaction=function(t){var r=this;return this.provider.getTransaction(t).then((function(t){return r.ensureTransactionNotNull_(t),a(t)}))},r.prototype.getTransactionCount=function(t,r){return this.provider.getTransactionCount(t,r)},r.prototype.getTransactionReceipt=function(t){var r=this;return this.provider.getTransactionReceipt(t).then((function(t){return r.ensureTransactionNotNull_(t),s(t)}))},r.prototype.getGasPrice=function(){return this.provider.getGasPrice().then((function(t){return t.toString()}))},r.prototype.estimateGas=function(t){return this.provider.estimateGas(this.toEthTxConfig_(t)).then((function(t){return t.toNumber()}))},r.prototype.encodeParameters=function(t,r){return o.utils.defaultAbiCoder.encode(r,t)},r.prototype.toHex=function(t,r){if(o.utils.isAddress(t))return r?"address":"0x"+t.toLowerCase().replace(/^0x/i,"");if("boolean"==typeof t)return r?"bool":t?"0x01":"0x00";if(Buffer.isBuffer(t))return"0x"+t.toString("hex");if("object"==typeof t&&t&&!o.BigNumber.isBigNumber(t))return r?"string":o.utils.hexlify(JSON.stringify(t));if("string"==typeof t){if(0===t.indexOf("-0x")||0===t.indexOf("-0X"))return r?"int256":o.utils.hexlify(t);if(0===t.indexOf("0x")||0===t.indexOf("0X"))return r?"bytes":t;if(!isFinite(t))return r?"string":o.utils.hexlify(t)}return r?t<0?"int256":"uint256":o.utils.hexlify(t)},r.prototype.hexToNumber=function(t){return o.BigNumber.from(t).toNumber()},r.prototype.hexToNumberString=function(t){return o.BigNumber.from(t).toString()},r.prototype.signTypedData=function(t,r){var n=r.domain,e=r.types,o=r.message;return e.EIP712Domain&&delete e.EIP712Domain,this.signer._signTypedData(n,e,o)},r.prototype.etheriumSha3=function(){for(var t=this,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var e=r.map((function(r){return t.toHex(r,!0)}));return o.utils.solidityKeccak256(e,r)},r.prototype.sendRPCRequest=function(t){return this.provider.send(t.method,t.params).then((function(t){return{result:t}}))},r.prototype.toEthTxConfig_=function(t){return{chainId:t.chainId,data:t.data,from:t.from,gasLimit:t.gasLimit,gasPrice:t.gasPrice,nonce:t.nonce,to:t.to,value:t.value}},r.prototype.write=function(t){var r=u,n={getTransactionHash:function(){return new Promise((function(t){r=t}))}};return this.signer.sendTransaction(this.toEthTxConfig_(t)).then((function(t){r(t.hash),n.getReceipt=function(){return t.wait().then((function(t){return s(t)}))}})).catch((function(t){t})),n},r.prototype.read=function(t){return this.signer.call(this.toEthTxConfig_(t))},r.prototype.getContract=function(t,r){return new m(t,new o.Contract(t,r,this.signer),this.logger)},r.prototype.decodeParameters=function(t,r){return o.utils.defaultAbiCoder.decode(r,t)},r}(i.BaseWeb3Client),_=function(){function t(){}return t.prototype.setup=function(t){t.utils.Web3Client=b,t.utils.BN=f,t.utils.isBN=function(t){return o.BigNumber.isBigNumber(t)}},t}();r.default=_}]);
module.exports=function(t){var r={};function n(e){if(r[e])return r[e].exports;var o=r[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=r,n.d=function(t,r,e){n.o(t,r)||Object.defineProperty(t,r,{enumerable:!0,get:e})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,r){if(1&r&&(t=n(t)),8&r)return t;if(4&r&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(n.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&r&&"string"!=typeof t)for(var o in t)n.d(e,o,function(r){return t[r]}.bind(null,o));return e},n.n=function(t){var r=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(r,"a",r),r},n.o=function(t,r){return Object.prototype.hasOwnProperty.call(t,r)},n.p="",n(n.s=2)}([function(t,r){t.exports=require("ethers")},function(t,r){t.exports=require("@maticnetwork/maticjs")},function(t,r,n){"use strict";n.r(r),n.d(r,"Web3ClientPlugin",(function(){return v})),n.d(r,"EtherWeb3Client",(function(){return b})),n.d(r,"ContractMethod",(function(){return l}));var e,o=n(0),i=n(1),u=function(){},s=function(t){var r=t;return r.gasUsed=t.gasUsed.toNumber(),r.cumulativeGasUsed=t.cumulativeGasUsed.toNumber(),r},a=function(t){var r=t;return r.gasPrice=t.gasPrice.toString(),r.gas=t.gasLimit.toNumber(),r.gasLimit=t.gasLimit.toNumber(),r.value=t.value.toString(),r.transactionHash=t.hash,r},c=(e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)r.hasOwnProperty(n)&&(t[n]=r[n])})(t,r)},function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}),f=function(t){function r(r){var n=t.call(this)||this;return n.bn_=o.BigNumber.from(r),n}return c(r,t),r.isBN=function(t){return t instanceof r||o.BigNumber.isBigNumber(t)},r.prototype.toString=function(t){if(16===t){var r=this.bn_.toHexString();return 0===(r=o.utils.hexStripZeros(r)).indexOf("0x")?r.slice(2):r}return this.bn_.toString()},r.prototype.toNumber=function(){return this.bn_.toNumber()},r.prototype.toBuffer=function(){return this.bn_.toBuffer()},r.prototype.add=function(t){return new r(this.bn_.add(o.BigNumber.from(t.toString())))},r.prototype.sub=function(t){return new r(this.bn_.sub(o.BigNumber.from(t.toString())))},r.prototype.mul=function(t){return new r(this.bn_.mul(o.BigNumber.from(t.toString())))},r.prototype.div=function(t){return new r(this.bn_.div(o.BigNumber.from(t.toString())))},r.prototype.lte=function(t){return this.bn_.lte(o.BigNumber.from(t.toString()))},r.prototype.lt=function(t){return this.bn_.lt(o.BigNumber.from(t.toString()))},r.prototype.gte=function(t){return this.bn_.gte(o.BigNumber.from(t.toString()))},r.prototype.gt=function(t){return this.bn_.gt(o.BigNumber.from(t.toString()))},r.prototype.eq=function(t){return this.bn_.eq(o.BigNumber.from(t.toString()))},r}(i.BaseBigNumber),p=function(){function t(t){var r=this;this.promise=t,this.onTransactionHash=u,this.onTransactionError=u,t.then((function(t){r.onTransactionHash(t.hash),setTimeout((function(){r.onTransactionReceipt&&t.wait().then((function(t){r.onTransactionReceipt(t)}))}),0)})).catch((function(t){r.onTransactionError(t)}))}return t.prototype.getReceipt=function(){var t=this;return new Promise((function(r,n){t.onTransactionReceipt=r,t.onTransactionError=n})).then((function(t){return s(t)}))},t.prototype.getTransactionHash=function(){var t=this;return new Promise((function(r,n){t.onTransactionHash=r,t.onTransactionError=n}))},t}(),h=function(){var t=function(r,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)r.hasOwnProperty(n)&&(t[n]=r[n])})(r,n)};return function(r,n){function e(){this.constructor=r}t(r,n),r.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}}(),g=function(){for(var t=0,r=0,n=arguments.length;r<n;r++)t+=arguments[r].length;var e=Array(t),o=0;for(r=0;r<n;r++)for(var i=arguments[r],u=0,s=i.length;u<s;u++,o++)e[o]=i[u];return e},l=function(t){function r(r,n,e,o){var i=t.call(this,r)||this;return i.contract_=n,i.methodName=e,i.args=o,i}return h(r,t),Object.defineProperty(r.prototype,"address",{get:function(){return this.contract_.address},enumerable:!1,configurable:!0}),r.prototype.toBigNumber=function(t){return t?o.BigNumber.from(t):t},r.prototype.toConfig_=function(t){void 0===t&&(t={});var r=this.toBigNumber;return{to:t.to,from:t.from,gasPrice:r(t.gasPrice),gasLimit:r(t.gasLimit),value:r(t.value),nonce:t.nonce,data:t.data,type:t.type,maxFeePerGas:r(t.maxFeePerGas),maxPriorityFeePerGas:r(t.maxPriorityFeePerGas)}},r.prototype.encodeABI=function(){return this.contract_.interface.encodeFunctionData(this.methodName,this.args)},r.prototype.estimateGas=function(t){var r;return void 0===t&&(t={}),(r=this.contract_.estimateGas)[this.methodName].apply(r,g(this.args,[this.toConfig_(t)])).then((function(t){return t.toNumber()}))},r.prototype.read=function(t){return this.logger.log("sending tx with config",t),this.getMethod_(t).then((function(t){return t._isBigNumber&&(t=t.toString()),t}))},r.prototype.getMethod_=function(t){var r;return void 0===t&&(t={}),(r=this.contract_)[this.methodName].apply(r,g(this.args,[this.toConfig_(t)]))},r.prototype.write=function(t){return this.logger.log("sending tx with config",t),new p(this.getMethod_(t))},r}(i.BaseContractMethod),d=function(){var t=function(r,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)r.hasOwnProperty(n)&&(t[n]=r[n])})(r,n)};return function(r,n){function e(){this.constructor=r}t(r,n),r.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}}(),m=function(t){function r(r,n,e){var o=t.call(this,r,e)||this;return o.contract=n,o}return d(r,t),r.prototype.method=function(t){for(var r=[],n=1;n<arguments.length;n++)r[n-1]=arguments[n];return this.logger.log("args method",arguments),new l(this.logger,this.contract,t,r)},r}(i.BaseContract),y=function(){var t=function(r,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)r.hasOwnProperty(n)&&(t[n]=r[n])})(r,n)};return function(r,n){function e(){this.constructor=r}t(r,n),r.prototype=null===n?Object.create(n):(e.prototype=n.prototype,new e)}}(),b=function(t){function r(r,n){var e=t.call(this,n)||this;return e.name="ETHER",r instanceof o.ethers.providers.Web3Provider?(e.provider=r,e.signer=r.getSigner()):r instanceof o.ethers.providers.JsonRpcProvider?(e.provider=r,e.signer=r):(e.signer=r,e.provider=r.provider||r),e}return y(r,t),r.prototype.getBlock=function(t){return this.provider.getBlock(t).then((function(t){return t}))},r.prototype.getBlockWithTransaction=function(t){var r=this.provider;return r.send("eth_getBlockByNumber",[o.utils.hexValue(t),!0]).then((function(t){var n=r.formatter.blockWithTransactions(t);return n.stateRoot=r.formatter.hash(t.stateRoot),n.transactionsRoot=r.formatter.hash(t.transactionsRoot),n.receiptsRoot=r.formatter.hash(t.receiptsRoot),n.transactions=n.transactions.map((function(t){return a(t)})),function(t){return t.gasUsed=t.gasUsed.toNumber(),t.gasLimit=t.gasLimit.toNumber(),t.baseFeePerGas&&(t.baseFeePerGas=t.baseFeePerGas.toHexString()),t}(n)}))},r.prototype.getChainId=function(){return this.provider.getNetwork().then((function(t){return t.chainId}))},r.prototype.getBalance=function(t){return this.provider.getBalance(t).then((function(t){return t.toString()}))},r.prototype.getAccounts=function(){return this.signer.getAddress().then((function(t){return[t]}))},r.prototype.ensureTransactionNotNull_=function(t){if(!t)throw{type:"invalid_transaction",message:"Could not retrieve transaction. Either it is invalid or might be in archive node."}},r.prototype.getTransaction=function(t){var r=this;return this.provider.getTransaction(t).then((function(t){return r.ensureTransactionNotNull_(t),a(t)}))},r.prototype.getTransactionCount=function(t,r){return this.provider.getTransactionCount(t,r)},r.prototype.getTransactionReceipt=function(t){var r=this;return this.provider.getTransactionReceipt(t).then((function(t){return r.ensureTransactionNotNull_(t),s(t)}))},r.prototype.getGasPrice=function(){return this.provider.getGasPrice().then((function(t){return t.toString()}))},r.prototype.estimateGas=function(t){return this.provider.estimateGas(this.toEthTxConfig_(t)).then((function(t){return t.toNumber()}))},r.prototype.encodeParameters=function(t,r){return o.utils.defaultAbiCoder.encode(r,t)},r.prototype.toHex=function(t,r){if(o.utils.isAddress(t))return r?"address":"0x"+t.toLowerCase().replace(/^0x/i,"");if("boolean"==typeof t)return r?"bool":t?"0x01":"0x00";if(Buffer.isBuffer(t))return"0x"+t.toString("hex");if("object"==typeof t&&t&&!o.BigNumber.isBigNumber(t))return r?"string":o.utils.hexlify(JSON.stringify(t));if("string"==typeof t){if(0===t.indexOf("-0x")||0===t.indexOf("-0X"))return r?"int256":o.utils.hexlify(t);if(0===t.indexOf("0x")||0===t.indexOf("0X"))return r?"bytes":t;if(!isFinite(t))return r?"string":o.utils.hexlify(t)}return r?t<0?"int256":"uint256":o.utils.hexlify(t)},r.prototype.hexToNumber=function(t){return o.BigNumber.from(t).toNumber()},r.prototype.hexToNumberString=function(t){return o.BigNumber.from(t).toString()},r.prototype.signTypedData=function(t,r){var n=r.domain,e=r.types,o=r.message;return e.EIP712Domain&&delete e.EIP712Domain,this.signer._signTypedData(n,e,o)},r.prototype.etheriumSha3=function(){for(var t=this,r=[],n=0;n<arguments.length;n++)r[n]=arguments[n];var e=r.map((function(r){return t.toHex(r,!0)}));return o.utils.solidityKeccak256(e,r)},r.prototype.sendRPCRequest=function(t){return this.provider.send(t.method,t.params).then((function(t){return{result:t}}))},r.prototype.toEthTxConfig_=function(t){return{chainId:t.chainId,data:t.data,from:t.from,gasLimit:t.gasLimit,gasPrice:t.gasPrice,nonce:t.nonce,to:t.to,value:t.value}},r.prototype.write=function(t){var r=u,n={getTransactionHash:function(){return new Promise((function(t){r=t}))}};return this.signer.sendTransaction(this.toEthTxConfig_(t)).then((function(t){r(t.hash),n.getReceipt=function(){return t.wait().then((function(t){return s(t)}))}})).catch((function(t){t})),n},r.prototype.read=function(t){return this.signer.call(this.toEthTxConfig_(t))},r.prototype.getContract=function(t,r){return new m(t,new o.Contract(t,r,this.signer),this.logger)},r.prototype.decodeParameters=function(t,r){return o.utils.defaultAbiCoder.decode(r,t)},r}(i.BaseWeb3Client),v=function(){function t(){}return t.prototype.setup=function(t){t.utils.Web3Client=b,t.utils.BN=f,t.utils.isBN=function(t){return o.BigNumber.isBigNumber(t)}},t}();r.default=v}]);
//# sourceMappingURL=matic-ethers.node.min.js.map

@@ -6,2 +6,3 @@ import { providers, Wallet } from "ethers";

declare type ETHER_SIGNER = providers.JsonRpcSigner;
declare type WEB3_PROVIDER = providers.Web3Provider;
export declare class EtherWeb3Client extends BaseWeb3Client {

@@ -11,3 +12,3 @@ name: string;

signer: ETHER_SIGNER;
constructor(provider: ETHER_PROVIDER | Wallet, logger: any);
constructor(provider: ETHER_PROVIDER | Wallet | WEB3_PROVIDER, logger: any);
getBlock(blockHashOrBlockNumber: any): Promise<any>;

@@ -14,0 +15,0 @@ getBlockWithTransaction(blockHashOrBlockNumber: any): Promise<any>;

{
"name": "@maticnetwork/maticjs-ethers",
"version": "1.1.0-beta.2",
"version": "1.1.0-beta.3",
"description": "ethers plugin for matic.js",

@@ -5,0 +5,0 @@ "main": "dist/npm.export.js",

@@ -9,2 +9,3 @@ import { providers, Wallet, utils, Contract, ethers, BigNumber } from "ethers";

type ETHER_SIGNER = providers.JsonRpcSigner;
type WEB3_PROVIDER = providers.Web3Provider;

@@ -16,19 +17,17 @@ export class EtherWeb3Client extends BaseWeb3Client {

constructor(provider: ETHER_PROVIDER | Wallet, logger) {
constructor(provider: ETHER_PROVIDER | Wallet | WEB3_PROVIDER, logger) {
super(logger);
if ((provider as ETHER_PROVIDER)._isProvider) {
this.provider = provider as ETHER_PROVIDER;
this.signer = this.provider.getSigner();
if (!this.signer || !this.signer._address) {
this.signer = (provider as any);
}
if (provider instanceof ethers.providers.Web3Provider) {
this.provider = provider;
this.signer = provider.getSigner();
} else if (provider instanceof ethers.providers.JsonRpcProvider) {
this.provider = provider;
this.signer = provider as any;
} else {
this.signer = provider as any;
this.provider = provider.provider || provider as any;
}
else {
this.signer = (provider as any);
this.provider = ((provider as Wallet).provider ? (provider as Wallet).provider : provider ) as any;
}
}
getBlock(blockHashOrBlockNumber) {

@@ -62,5 +61,2 @@ return this.provider.getBlock(blockHashOrBlockNumber).then(block => {

getChainId() {
if (this.signer.getChainId) {
return this.signer.getChainId();
}
return this.provider.getNetwork().then(function (res) {

@@ -67,0 +63,0 @@ return res.chainId;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc