@maticnetwork/maticjs-ethers
Advanced tools
Comparing version 1.0.3 to 1.1.0-beta.1
@@ -314,2 +314,5 @@ module.exports = | ||
_this.signer = _this.provider.getSigner(); | ||
if (!_this.signer || !_this.signer._address) { | ||
_this.signer = provider; | ||
} | ||
} | ||
@@ -316,0 +319,0 @@ else { |
@@ -1,2 +0,2 @@ | ||
module.exports=function(t){var n={};function r(e){if(n[e])return n[e].exports;var o=n[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=n,r.d=function(t,n,e){r.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:e})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,n){if(1&n&&(t=r(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(r.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)r.d(e,o,function(n){return t[n]}.bind(null,o));return e},r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,"a",n),n},r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r.p="",r(r.s=2)}([function(t,n){t.exports=require("ethers")},function(t,n){t.exports=require("@maticnetwork/maticjs")},function(t,n,r){"use strict";r.r(n),r.d(n,"Web3ClientPlugin",(function(){return _})),r.d(n,"EtherWeb3Client",(function(){return b})),r.d(n,"ContractMethod",(function(){return l}));var e,o=r(0),i=r(1),u=function(){},a=function(t){var n=t;return n.gasUsed=t.gasUsed.toNumber(),n.cumulativeGasUsed=t.cumulativeGasUsed.toNumber(),n},s=function(t){var n=t;return n.gasPrice=t.gasPrice.toString(),n.gas=t.gasLimit.toNumber(),n.gasLimit=t.gasLimit.toNumber(),n.value=t.value.toString(),n.transactionHash=t.hash,n},c=(e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])})(t,n)},function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}),f=function(t){function n(n){var r=t.call(this)||this;return r.bn_=o.BigNumber.from(n),r}return c(n,t),n.isBN=function(t){return t instanceof n||o.BigNumber.isBigNumber(t)},n.prototype.toString=function(t){if(16===t){var n=this.bn_.toHexString();return 0===(n=o.utils.hexStripZeros(n)).indexOf("0x")?n.slice(2):n}return this.bn_.toString()},n.prototype.toNumber=function(){return this.bn_.toNumber()},n.prototype.toBuffer=function(){return this.bn_.toBuffer()},n.prototype.add=function(t){return new n(this.bn_.add(o.BigNumber.from(t.toString())))},n.prototype.sub=function(t){return new n(this.bn_.sub(o.BigNumber.from(t.toString())))},n.prototype.mul=function(t){return new n(this.bn_.mul(o.BigNumber.from(t.toString())))},n.prototype.div=function(t){return new n(this.bn_.div(o.BigNumber.from(t.toString())))},n.prototype.lte=function(t){return this.bn_.lte(o.BigNumber.from(t.toString()))},n.prototype.lt=function(t){return this.bn_.lt(o.BigNumber.from(t.toString()))},n.prototype.gte=function(t){return this.bn_.gte(o.BigNumber.from(t.toString()))},n.prototype.gt=function(t){return this.bn_.gt(o.BigNumber.from(t.toString()))},n.prototype.eq=function(t){return this.bn_.eq(o.BigNumber.from(t.toString()))},n}(i.BaseBigNumber),p=function(){function t(t){var n=this;this.promise=t,this.onTransactionHash=u,this.onTransactionError=u,t.then((function(t){n.onTransactionHash(t.hash),setTimeout((function(){n.onTransactionReceipt&&t.wait().then((function(t){n.onTransactionReceipt(t)}))}),0)})).catch((function(t){n.onTransactionError(t)}))}return t.prototype.getReceipt=function(){var t=this;return new Promise((function(n,r){t.onTransactionReceipt=n,t.onTransactionError=r})).then((function(t){return a(t)}))},t.prototype.getTransactionHash=function(){var t=this;return new Promise((function(n,r){t.onTransactionHash=n,t.onTransactionError=r}))},t}(),h=function(){var t=function(n,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])})(n,r)};return function(n,r){function e(){this.constructor=n}t(n,r),n.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}}(),g=function(){for(var t=0,n=0,r=arguments.length;n<r;n++)t+=arguments[n].length;var e=Array(t),o=0;for(n=0;n<r;n++)for(var i=arguments[n],u=0,a=i.length;u<a;u++,o++)e[o]=i[u];return e},l=function(t){function n(n,r,e,o){var i=t.call(this,n)||this;return i.contract_=r,i.methodName=e,i.args=o,i}return h(n,t),Object.defineProperty(n.prototype,"address",{get:function(){return this.contract_.address},enumerable:!1,configurable:!0}),n.prototype.toBigNumber=function(t){return t?o.BigNumber.from(t):t},n.prototype.toConfig_=function(t){void 0===t&&(t={});var n=this.toBigNumber;return{to:t.to,from:t.from,gasPrice:n(t.gasPrice),gasLimit:n(t.gasLimit),value:n(t.value),nonce:t.nonce,data:t.data,type:t.type,maxFeePerGas:n(t.maxFeePerGas),maxPriorityFeePerGas:n(t.maxPriorityFeePerGas)}},n.prototype.encodeABI=function(){return this.contract_.interface.encodeFunctionData(this.methodName,this.args)},n.prototype.estimateGas=function(t){var n;return void 0===t&&(t={}),(n=this.contract_.estimateGas)[this.methodName].apply(n,g(this.args,[this.toConfig_(t)])).then((function(t){return t.toNumber()}))},n.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}))},n.prototype.getMethod_=function(t){var n;return void 0===t&&(t={}),(n=this.contract_)[this.methodName].apply(n,g(this.args,[this.toConfig_(t)]))},n.prototype.write=function(t){return this.logger.log("sending tx with config",t),new p(this.getMethod_(t))},n}(i.BaseContractMethod),m=function(){var t=function(n,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])})(n,r)};return function(n,r){function e(){this.constructor=n}t(n,r),n.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}}(),d=function(t){function n(n,r,e){var o=t.call(this,n,e)||this;return o.contract=r,o}return m(n,t),n.prototype.method=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];return this.logger.log("args method",arguments),new l(this.logger,this.contract,t,n)},n}(i.BaseContract),y=function(){var t=function(n,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])})(n,r)};return function(n,r){function e(){this.constructor=n}t(n,r),n.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}}(),b=function(t){function n(n,r){var e=t.call(this,r)||this;return e.name="ETHER",n._isProvider?(e.provider=n,e.signer=e.provider.getSigner()):(e.signer=n,e.provider=n.provider),e}return y(n,t),n.prototype.getBlock=function(t){return this.provider.getBlock(t).then((function(t){return t}))},n.prototype.getBlockWithTransaction=function(t){var n=this.provider;return n.send("eth_getBlockByNumber",[o.utils.hexValue(t),!0]).then((function(t){var r=n.formatter.blockWithTransactions(t);return r.stateRoot=n.formatter.hash(t.stateRoot),r.transactionsRoot=n.formatter.hash(t.transactionsRoot),r.receiptsRoot=n.formatter.hash(t.receiptsRoot),r.transactions=r.transactions.map((function(t){return s(t)})),function(t){return t.gasUsed=t.gasUsed.toNumber(),t.gasLimit=t.gasLimit.toNumber(),t.baseFeePerGas&&(t.baseFeePerGas=t.baseFeePerGas.toHexString()),t}(r)}))},n.prototype.getChainId=function(){return this.signer.getChainId()},n.prototype.getBalance=function(t){return this.provider.getBalance(t).then((function(t){return t.toString()}))},n.prototype.getAccounts=function(){return this.signer.getAddress().then((function(t){return[t]}))},n.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."}},n.prototype.getTransaction=function(t){var n=this;return this.provider.getTransaction(t).then((function(t){return n.ensureTransactionNotNull_(t),s(t)}))},n.prototype.getTransactionCount=function(t,n){return this.provider.getTransactionCount(t,n)},n.prototype.getTransactionReceipt=function(t){var n=this;return this.provider.getTransactionReceipt(t).then((function(t){return n.ensureTransactionNotNull_(t),a(t)}))},n.prototype.getGasPrice=function(){return this.provider.getGasPrice().then((function(t){return t.toString()}))},n.prototype.estimateGas=function(t){return this.provider.estimateGas(this.toEthTxConfig_(t)).then((function(t){return t.toNumber()}))},n.prototype.encodeParameters=function(t,n){return o.utils.defaultAbiCoder.encode(n,t)},n.prototype.toHex=function(t,n){if(o.utils.isAddress(t))return n?"address":"0x"+t.toLowerCase().replace(/^0x/i,"");if("boolean"==typeof t)return n?"bool":t?"0x01":"0x00";if(Buffer.isBuffer(t))return"0x"+t.toString("hex");if("object"==typeof t&&t&&!o.BigNumber.isBigNumber(t))return n?"string":o.utils.hexlify(JSON.stringify(t));if("string"==typeof t){if(0===t.indexOf("-0x")||0===t.indexOf("-0X"))return n?"int256":o.utils.hexlify(t);if(0===t.indexOf("0x")||0===t.indexOf("0X"))return n?"bytes":t;if(!isFinite(t))return n?"string":o.utils.hexlify(t)}return n?t<0?"int256":"uint256":o.utils.hexlify(t)},n.prototype.hexToNumber=function(t){return o.BigNumber.from(t).toNumber()},n.prototype.hexToNumberString=function(t){return o.BigNumber.from(t).toString()},n.prototype.signTypedData=function(t,n){var r=n.domain,e=n.types,o=n.message;return e.EIP712Domain&&delete e.EIP712Domain,this.signer._signTypedData(r,e,o)},n.prototype.etheriumSha3=function(){for(var t=this,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var e=n.map((function(n){return t.toHex(n,!0)}));return o.utils.solidityKeccak256(e,n)},n.prototype.sendRPCRequest=function(t){return this.provider.send(t.method,t.params).then((function(t){return{result:t}}))},n.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}},n.prototype.write=function(t){var n=u,r={getTransactionHash:function(){return new Promise((function(t){n=t}))}};return this.signer.sendTransaction(this.toEthTxConfig_(t)).then((function(t){n(t.hash),r.getReceipt=function(){return t.wait().then((function(t){return a(t)}))}})).catch((function(t){t})),r},n.prototype.read=function(t){return this.signer.call(this.toEthTxConfig_(t))},n.prototype.getContract=function(t,n){return new d(t,new o.Contract(t,n,this.signer),this.logger)},n.prototype.decodeParameters=function(t,n){return o.utils.defaultAbiCoder.decode(n,t)},n}(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}();n.default=_}]); | ||
module.exports=function(t){var n={};function r(e){if(n[e])return n[e].exports;var o=n[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=t,r.c=n,r.d=function(t,n,e){r.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:e})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,n){if(1&n&&(t=r(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var e=Object.create(null);if(r.r(e),Object.defineProperty(e,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)r.d(e,o,function(n){return t[n]}.bind(null,o));return e},r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,"a",n),n},r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},r.p="",r(r.s=2)}([function(t,n){t.exports=require("ethers")},function(t,n){t.exports=require("@maticnetwork/maticjs")},function(t,n,r){"use strict";r.r(n),r.d(n,"Web3ClientPlugin",(function(){return _})),r.d(n,"EtherWeb3Client",(function(){return b})),r.d(n,"ContractMethod",(function(){return l}));var e,o=r(0),i=r(1),u=function(){},s=function(t){var n=t;return n.gasUsed=t.gasUsed.toNumber(),n.cumulativeGasUsed=t.cumulativeGasUsed.toNumber(),n},a=function(t){var n=t;return n.gasPrice=t.gasPrice.toString(),n.gas=t.gasLimit.toNumber(),n.gasLimit=t.gasLimit.toNumber(),n.value=t.value.toString(),n.transactionHash=t.hash,n},c=(e=function(t,n){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])})(t,n)},function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}),f=function(t){function n(n){var r=t.call(this)||this;return r.bn_=o.BigNumber.from(n),r}return c(n,t),n.isBN=function(t){return t instanceof n||o.BigNumber.isBigNumber(t)},n.prototype.toString=function(t){if(16===t){var n=this.bn_.toHexString();return 0===(n=o.utils.hexStripZeros(n)).indexOf("0x")?n.slice(2):n}return this.bn_.toString()},n.prototype.toNumber=function(){return this.bn_.toNumber()},n.prototype.toBuffer=function(){return this.bn_.toBuffer()},n.prototype.add=function(t){return new n(this.bn_.add(o.BigNumber.from(t.toString())))},n.prototype.sub=function(t){return new n(this.bn_.sub(o.BigNumber.from(t.toString())))},n.prototype.mul=function(t){return new n(this.bn_.mul(o.BigNumber.from(t.toString())))},n.prototype.div=function(t){return new n(this.bn_.div(o.BigNumber.from(t.toString())))},n.prototype.lte=function(t){return this.bn_.lte(o.BigNumber.from(t.toString()))},n.prototype.lt=function(t){return this.bn_.lt(o.BigNumber.from(t.toString()))},n.prototype.gte=function(t){return this.bn_.gte(o.BigNumber.from(t.toString()))},n.prototype.gt=function(t){return this.bn_.gt(o.BigNumber.from(t.toString()))},n.prototype.eq=function(t){return this.bn_.eq(o.BigNumber.from(t.toString()))},n}(i.BaseBigNumber),p=function(){function t(t){var n=this;this.promise=t,this.onTransactionHash=u,this.onTransactionError=u,t.then((function(t){n.onTransactionHash(t.hash),setTimeout((function(){n.onTransactionReceipt&&t.wait().then((function(t){n.onTransactionReceipt(t)}))}),0)})).catch((function(t){n.onTransactionError(t)}))}return t.prototype.getReceipt=function(){var t=this;return new Promise((function(n,r){t.onTransactionReceipt=n,t.onTransactionError=r})).then((function(t){return s(t)}))},t.prototype.getTransactionHash=function(){var t=this;return new Promise((function(n,r){t.onTransactionHash=n,t.onTransactionError=r}))},t}(),h=function(){var t=function(n,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])})(n,r)};return function(n,r){function e(){this.constructor=n}t(n,r),n.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}}(),g=function(){for(var t=0,n=0,r=arguments.length;n<r;n++)t+=arguments[n].length;var e=Array(t),o=0;for(n=0;n<r;n++)for(var i=arguments[n],u=0,s=i.length;u<s;u++,o++)e[o]=i[u];return e},l=function(t){function n(n,r,e,o){var i=t.call(this,n)||this;return i.contract_=r,i.methodName=e,i.args=o,i}return h(n,t),Object.defineProperty(n.prototype,"address",{get:function(){return this.contract_.address},enumerable:!1,configurable:!0}),n.prototype.toBigNumber=function(t){return t?o.BigNumber.from(t):t},n.prototype.toConfig_=function(t){void 0===t&&(t={});var n=this.toBigNumber;return{to:t.to,from:t.from,gasPrice:n(t.gasPrice),gasLimit:n(t.gasLimit),value:n(t.value),nonce:t.nonce,data:t.data,type:t.type,maxFeePerGas:n(t.maxFeePerGas),maxPriorityFeePerGas:n(t.maxPriorityFeePerGas)}},n.prototype.encodeABI=function(){return this.contract_.interface.encodeFunctionData(this.methodName,this.args)},n.prototype.estimateGas=function(t){var n;return void 0===t&&(t={}),(n=this.contract_.estimateGas)[this.methodName].apply(n,g(this.args,[this.toConfig_(t)])).then((function(t){return t.toNumber()}))},n.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}))},n.prototype.getMethod_=function(t){var n;return void 0===t&&(t={}),(n=this.contract_)[this.methodName].apply(n,g(this.args,[this.toConfig_(t)]))},n.prototype.write=function(t){return this.logger.log("sending tx with config",t),new p(this.getMethod_(t))},n}(i.BaseContractMethod),m=function(){var t=function(n,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])})(n,r)};return function(n,r){function e(){this.constructor=n}t(n,r),n.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}}(),d=function(t){function n(n,r,e){var o=t.call(this,n,e)||this;return o.contract=r,o}return m(n,t),n.prototype.method=function(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];return this.logger.log("args method",arguments),new l(this.logger,this.contract,t,n)},n}(i.BaseContract),y=function(){var t=function(n,r){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var r in n)n.hasOwnProperty(r)&&(t[r]=n[r])})(n,r)};return function(n,r){function e(){this.constructor=n}t(n,r),n.prototype=null===r?Object.create(r):(e.prototype=r.prototype,new e)}}(),b=function(t){function n(n,r){var e=t.call(this,r)||this;return e.name="ETHER",n._isProvider?(e.provider=n,e.signer=e.provider.getSigner(),e.signer&&e.signer._address||(e.signer=n)):(e.signer=n,e.provider=n.provider),e}return y(n,t),n.prototype.getBlock=function(t){return this.provider.getBlock(t).then((function(t){return t}))},n.prototype.getBlockWithTransaction=function(t){var n=this.provider;return n.send("eth_getBlockByNumber",[o.utils.hexValue(t),!0]).then((function(t){var r=n.formatter.blockWithTransactions(t);return r.stateRoot=n.formatter.hash(t.stateRoot),r.transactionsRoot=n.formatter.hash(t.transactionsRoot),r.receiptsRoot=n.formatter.hash(t.receiptsRoot),r.transactions=r.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}(r)}))},n.prototype.getChainId=function(){return this.signer.getChainId()},n.prototype.getBalance=function(t){return this.provider.getBalance(t).then((function(t){return t.toString()}))},n.prototype.getAccounts=function(){return this.signer.getAddress().then((function(t){return[t]}))},n.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."}},n.prototype.getTransaction=function(t){var n=this;return this.provider.getTransaction(t).then((function(t){return n.ensureTransactionNotNull_(t),a(t)}))},n.prototype.getTransactionCount=function(t,n){return this.provider.getTransactionCount(t,n)},n.prototype.getTransactionReceipt=function(t){var n=this;return this.provider.getTransactionReceipt(t).then((function(t){return n.ensureTransactionNotNull_(t),s(t)}))},n.prototype.getGasPrice=function(){return this.provider.getGasPrice().then((function(t){return t.toString()}))},n.prototype.estimateGas=function(t){return this.provider.estimateGas(this.toEthTxConfig_(t)).then((function(t){return t.toNumber()}))},n.prototype.encodeParameters=function(t,n){return o.utils.defaultAbiCoder.encode(n,t)},n.prototype.toHex=function(t,n){if(o.utils.isAddress(t))return n?"address":"0x"+t.toLowerCase().replace(/^0x/i,"");if("boolean"==typeof t)return n?"bool":t?"0x01":"0x00";if(Buffer.isBuffer(t))return"0x"+t.toString("hex");if("object"==typeof t&&t&&!o.BigNumber.isBigNumber(t))return n?"string":o.utils.hexlify(JSON.stringify(t));if("string"==typeof t){if(0===t.indexOf("-0x")||0===t.indexOf("-0X"))return n?"int256":o.utils.hexlify(t);if(0===t.indexOf("0x")||0===t.indexOf("0X"))return n?"bytes":t;if(!isFinite(t))return n?"string":o.utils.hexlify(t)}return n?t<0?"int256":"uint256":o.utils.hexlify(t)},n.prototype.hexToNumber=function(t){return o.BigNumber.from(t).toNumber()},n.prototype.hexToNumberString=function(t){return o.BigNumber.from(t).toString()},n.prototype.signTypedData=function(t,n){var r=n.domain,e=n.types,o=n.message;return e.EIP712Domain&&delete e.EIP712Domain,this.signer._signTypedData(r,e,o)},n.prototype.etheriumSha3=function(){for(var t=this,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var e=n.map((function(n){return t.toHex(n,!0)}));return o.utils.solidityKeccak256(e,n)},n.prototype.sendRPCRequest=function(t){return this.provider.send(t.method,t.params).then((function(t){return{result:t}}))},n.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}},n.prototype.write=function(t){var n=u,r={getTransactionHash:function(){return new Promise((function(t){n=t}))}};return this.signer.sendTransaction(this.toEthTxConfig_(t)).then((function(t){n(t.hash),r.getReceipt=function(){return t.wait().then((function(t){return s(t)}))}})).catch((function(t){t})),r},n.prototype.read=function(t){return this.signer.call(this.toEthTxConfig_(t))},n.prototype.getContract=function(t,n){return new d(t,new o.Contract(t,n,this.signer),this.logger)},n.prototype.decodeParameters=function(t,n){return o.utils.defaultAbiCoder.decode(n,t)},n}(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}();n.default=_}]); | ||
//# sourceMappingURL=matic-ethers.node.min.js.map |
@@ -0,0 +0,0 @@ if (process.env.NODE_ENV === 'production') { |
@@ -0,0 +0,0 @@ import { BaseContract } from "@maticnetwork/maticjs"; |
@@ -0,0 +0,0 @@ import { BaseContractMethod, ITransactionRequestConfig, Logger } from "@maticnetwork/maticjs"; |
export * from "./web3_client"; | ||
export * from "./ethjs_method"; |
@@ -0,0 +0,0 @@ import { providers, Wallet } from "ethers"; |
export declare const doNothing: () => void; |
export * from "./do_nothing"; | ||
export * from "./transaction_write_result"; |
@@ -0,0 +0,0 @@ import { ITransactionWriteResult } from "@maticnetwork/maticjs"; |
@@ -0,0 +0,0 @@ import { IPlugin } from "@maticnetwork/maticjs"; |
import { IBlock } from "@maticnetwork/maticjs"; | ||
import { providers } from "ethers"; | ||
export declare const ethBlockToMaticBlock: (block: providers.Block) => IBlock; |
import { ITransactionReceipt } from "@maticnetwork/maticjs"; | ||
import { providers } from "ethers"; | ||
export declare const ethReceiptToMaticReceipt: (receipt: providers.TransactionReceipt) => ITransactionReceipt; |
import { ITransactionData } from "@maticnetwork/maticjs"; | ||
import { providers } from "ethers"; | ||
export declare const ethTxToMaticTx: (tx: providers.TransactionResponse) => ITransactionData; |
@@ -0,0 +0,0 @@ export * from "./eth_receipt_to_matic_receipt"; |
@@ -0,0 +0,0 @@ import { BaseBigNumber } from "@maticnetwork/maticjs"; |
{ | ||
"name": "@maticnetwork/maticjs-ethers", | ||
"version": "1.0.3", | ||
"version": "1.1.0-beta.1", | ||
"description": "ethers plugin for matic.js", | ||
@@ -5,0 +5,0 @@ "main": "dist/npm.export.js", |
@@ -0,0 +0,0 @@ [![TEST](https://github.com/maticnetwork/maticjs-ethers/actions/workflows/test.yml/badge.svg)](https://github.com/maticnetwork/maticjs-ethers/actions/workflows/test.yml) [![npm version](https://badge.fury.io/js/@maticnetwork%2Fmaticjs-ethers.svg)](https://badge.fury.io/js/@maticnetwork%2Fmaticjs-ethers) |
@@ -0,0 +0,0 @@ import { BaseContract } from "@maticnetwork/maticjs"; |
@@ -0,0 +0,0 @@ import { BaseContractMethod, ITransactionRequestConfig, ITransactionWriteResult, Logger } from "@maticnetwork/maticjs"; |
export * from "./web3_client"; | ||
export * from "./ethjs_method"; |
@@ -20,2 +20,5 @@ import { providers, Wallet, utils, Contract, ethers, BigNumber } from "ethers"; | ||
this.signer = this.provider.getSigner(); | ||
if (!this.signer || !this.signer._address) { | ||
this.signer = (provider as any); | ||
} | ||
} | ||
@@ -97,3 +100,3 @@ else { | ||
this.ensureTransactionNotNull_(result); | ||
return ethReceiptToMaticReceipt(result); | ||
@@ -156,3 +159,3 @@ }); | ||
} | ||
hexToNumberString(value) { | ||
@@ -163,4 +166,4 @@ return BigNumber.from(value).toString(); | ||
signTypedData(signer, typedData) { | ||
const {domain, types, message: value} = typedData; | ||
if(types.EIP712Domain) { | ||
const { domain, types, message: value } = typedData; | ||
if (types.EIP712Domain) { | ||
delete types.EIP712Domain; | ||
@@ -167,0 +170,0 @@ } |
export const doNothing = () => { | ||
}; |
export * from "./do_nothing"; | ||
export * from "./transaction_write_result"; |
@@ -0,0 +0,0 @@ import { ITransactionWriteResult } from "@maticnetwork/maticjs"; |
@@ -0,0 +0,0 @@ import { ITransactionRequestConfig, IPlugin, ITransactionResult, Converter, utils } from "@maticnetwork/maticjs"; |
@@ -0,0 +0,0 @@ { |
@@ -0,0 +0,0 @@ import { IBlock } from "@maticnetwork/maticjs"; |
@@ -0,0 +0,0 @@ import { ITransactionReceipt } from "@maticnetwork/maticjs"; |
@@ -0,0 +0,0 @@ import { IBlock, ITransactionData, ITransactionResult } from "@maticnetwork/maticjs"; |
@@ -0,0 +0,0 @@ export * from "./eth_receipt_to_matic_receipt"; |
@@ -0,0 +0,0 @@ import { BaseBigNumber } from "@maticnetwork/maticjs"; |
@@ -0,0 +0,0 @@ { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
1471
145106
2
1