diff --git a/.changeset/silent-badgers-call.md b/.changeset/silent-badgers-call.md new file mode 100644 index 0000000000..ae6668804d --- /dev/null +++ b/.changeset/silent-badgers-call.md @@ -0,0 +1,6 @@ +--- +'wagmi-private': patch +'wagmi': patch +--- + +update injected connector diff --git a/.github/workflows/size.yml b/.github/workflows/size.yml deleted file mode 100644 index 22b426bca0..0000000000 --- a/.github/workflows/size.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Size - -on: - # Disabled until fixed - branches-ignore: - - '**' - pull_request: - branches: - - main - -jobs: - size: - name: Size - runs-on: ubuntu-latest - env: - CI_JOB_NUMBER: 1 - steps: - - uses: actions/checkout@v2 - - uses: andresz1/size-limit-action@v1.5.1 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - build_script: build diff --git a/docs/pages/docs/hooks/useSignMessage.mdx b/docs/pages/docs/hooks/useSignMessage.mdx index 1fb519c00c..bff2553ccc 100644 --- a/docs/pages/docs/hooks/useSignMessage.mdx +++ b/docs/pages/docs/hooks/useSignMessage.mdx @@ -20,7 +20,7 @@ const App = () => { if (!data) return ( - ) diff --git a/packages/private/src/connectors/injectedConnector.ts b/packages/private/src/connectors/injectedConnector.ts index fe41340eec..9e6007a474 100644 --- a/packages/private/src/connectors/injectedConnector.ts +++ b/packages/private/src/connectors/injectedConnector.ts @@ -22,16 +22,13 @@ export class InjectedConnector extends Connector< typeof window !== 'undefined' && window.ethereum?.isMetaMask ? 'MetaMask' : 'Injected' + readonly provider = window?.ethereum readonly ready = typeof window !== 'undefined' && !!window.ethereum constructor(config?: { chains?: Chain[] }) { super({ ...config, options: undefined }) } - get provider() { - return window?.ethereum - } - async connect() { try { if (!this.provider) throw new ConnectorNotFoundError() diff --git a/packages/react/src/hooks/accounts/useSignMessage.test.ts b/packages/react/src/hooks/accounts/useSignMessage.test.ts index 2042a69d3c..76df4f3514 100644 --- a/packages/react/src/hooks/accounts/useSignMessage.test.ts +++ b/packages/react/src/hooks/accounts/useSignMessage.test.ts @@ -52,9 +52,9 @@ describe('useSignMessage', () => { const res = await result.current.signMessage[1]() if (typeof res !== 'string') throw new Error('No signature') - const recovered = verifyNormalizedMessage(messageLookup.basic, res) const account = await result.current.connect[0].data.connector?.getAccount() + const recovered = verifyNormalizedMessage(messageLookup.basic, res) expect(account).toEqual(recovered) }) @@ -65,12 +65,12 @@ describe('useSignMessage', () => { "loading": false, } `) + const account = + await result.current.connect[0].data.connector?.getAccount() const recovered = verifyNormalizedMessage( messageLookup.basic, result.current.signMessage[0]?.data, ) - const account = - await result.current.connect[0].data.connector?.getAccount() expect(account).toEqual(recovered) }) @@ -85,9 +85,9 @@ describe('useSignMessage', () => { message: messageLookup.basic, }) if (typeof res !== 'string') throw new Error('No signature') - const recovered = verifyNormalizedMessage(messageLookup.basic, res) const account = await result.current.connect[0].data.connector?.getAccount() + const recovered = verifyNormalizedMessage(messageLookup.basic, res) expect(account).toEqual(recovered) }) })