diff --git a/dist/cjs/index.js b/dist/cjs/index.js index 6e009a9a..db8f140d 100644 --- a/dist/cjs/index.js +++ b/dist/cjs/index.js @@ -42,11 +42,7 @@ let call = function ({ params, provider }) { } else { let data = callParams.data; let methodSelector = data.split('000000000000000000000000')[0]; - let contract = new ethers.ethers.Contract( - address, - mocks[address].abi, - provider, - ); + let contract = new ethers.ethers.Contract(address, mocks[address].abi, provider); let contractFunction = contract.interface.getFunction(methodSelector); if (mocks[address][contractFunction.name]) { @@ -110,11 +106,7 @@ let mockTransactions = function (configuration) { }; let getContract = function ({ params, mock, provider }) { - return new ethers.ethers.Contract( - params.to, - mock.abi, - provider, - ) + return new ethers.ethers.Contract(params.to, mock.abi, provider) }; let getContractFunction = function ({ data, params, mock, provider }) { @@ -244,7 +236,6 @@ let on = (eventName, callback) => { }; let request = ({ request, provider }) => { - switch (request.method) { case 'eth_chainId': return Promise.resolve('0x1') @@ -316,9 +307,15 @@ let Ethereum = ({ configuration, window, provider }) => { mockTransactions(_optionalChain$1([configuration, 'optionalAccess', _2 => _2.transactions])); resetEvents(); - if(provider) { - if(provider.send) { provider.send = (method, params)=>request({ provider, request: { method: method, params: params } }); } - if(provider.sendTransaction) { provider.sendTransaction = (method, params)=>request({ provider, request: { method: method, params: params } }); } + if (provider) { + if (provider.send) { + provider.send = (method, params) => + request({ provider, request: { method: method, params: params } }); + } + if (provider.sendTransaction) { + provider.sendTransaction = (method, params) => + request({ provider, request: { method: method, params: params } }); + } } else { window.ethereum = { ...window.ethereum, @@ -326,8 +323,8 @@ let Ethereum = ({ configuration, window, provider }) => { request: (configuration) => { return request({ request: configuration, - provider: new ethers.ethers.providers.Web3Provider(window.ethereum) - }) + provider: new ethers.ethers.providers.Web3Provider(window.ethereum), + }) }, }; } diff --git a/dist/es/index.js b/dist/es/index.js index 6bcfc37b..d05df46d 100644 --- a/dist/es/index.js +++ b/dist/es/index.js @@ -38,11 +38,7 @@ let call = function ({ params, provider }) { } else { let data = callParams.data; let methodSelector = data.split('000000000000000000000000')[0]; - let contract = new ethers.Contract( - address, - mocks[address].abi, - provider, - ); + let contract = new ethers.Contract(address, mocks[address].abi, provider); let contractFunction = contract.interface.getFunction(methodSelector); if (mocks[address][contractFunction.name]) { @@ -106,11 +102,7 @@ let mockTransactions = function (configuration) { }; let getContract = function ({ params, mock, provider }) { - return new ethers.Contract( - params.to, - mock.abi, - provider, - ) + return new ethers.Contract(params.to, mock.abi, provider) }; let getContractFunction = function ({ data, params, mock, provider }) { @@ -240,7 +232,6 @@ let on = (eventName, callback) => { }; let request = ({ request, provider }) => { - switch (request.method) { case 'eth_chainId': return Promise.resolve('0x1') @@ -312,9 +303,15 @@ let Ethereum = ({ configuration, window, provider }) => { mockTransactions(_optionalChain$1([configuration, 'optionalAccess', _2 => _2.transactions])); resetEvents(); - if(provider) { - if(provider.send) { provider.send = (method, params)=>request({ provider, request: { method: method, params: params } }); } - if(provider.sendTransaction) { provider.sendTransaction = (method, params)=>request({ provider, request: { method: method, params: params } }); } + if (provider) { + if (provider.send) { + provider.send = (method, params) => + request({ provider, request: { method: method, params: params } }); + } + if (provider.sendTransaction) { + provider.sendTransaction = (method, params) => + request({ provider, request: { method: method, params: params } }); + } } else { window.ethereum = { ...window.ethereum, @@ -322,8 +319,8 @@ let Ethereum = ({ configuration, window, provider }) => { request: (configuration) => { return request({ request: configuration, - provider: new ethers.providers.Web3Provider(window.ethereum) - }) + provider: new ethers.providers.Web3Provider(window.ethereum), + }) }, }; } diff --git a/dist/umd/index.js b/dist/umd/index.js index 36dd2dfd..26f1d566 100644 --- a/dist/umd/index.js +++ b/dist/umd/index.js @@ -42,11 +42,7 @@ } else { let data = callParams.data; let methodSelector = data.split('000000000000000000000000')[0]; - let contract = new ethers.ethers.Contract( - address, - mocks[address].abi, - provider, - ); + let contract = new ethers.ethers.Contract(address, mocks[address].abi, provider); let contractFunction = contract.interface.getFunction(methodSelector); if (mocks[address][contractFunction.name]) { @@ -110,11 +106,7 @@ }; let getContract = function ({ params, mock, provider }) { - return new ethers.ethers.Contract( - params.to, - mock.abi, - provider, - ) + return new ethers.ethers.Contract(params.to, mock.abi, provider) }; let getContractFunction = function ({ data, params, mock, provider }) { @@ -244,7 +236,6 @@ }; let request = ({ request, provider }) => { - switch (request.method) { case 'eth_chainId': return Promise.resolve('0x1') @@ -316,9 +307,15 @@ mockTransactions(_optionalChain$1([configuration, 'optionalAccess', _2 => _2.transactions])); resetEvents(); - if(provider) { - if(provider.send) { provider.send = (method, params)=>request({ provider, request: { method: method, params: params } }); } - if(provider.sendTransaction) { provider.sendTransaction = (method, params)=>request({ provider, request: { method: method, params: params } }); } + if (provider) { + if (provider.send) { + provider.send = (method, params) => + request({ provider, request: { method: method, params: params } }); + } + if (provider.sendTransaction) { + provider.sendTransaction = (method, params) => + request({ provider, request: { method: method, params: params } }); + } } else { window.ethereum = { ...window.ethereum, @@ -326,8 +323,8 @@ request: (configuration) => { return request({ request: configuration, - provider: new ethers.ethers.providers.Web3Provider(window.ethereum) - }) + provider: new ethers.ethers.providers.Web3Provider(window.ethereum), + }) }, }; }